aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java6
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java28
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/authentication/KeystoneAuthHolderTest.java22
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/cloudify/utils/MsoCloudifyUtilsTest.java13
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsUnitTest.java133
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVfModuleRequest.java8
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVolumeGroupRequest.java6
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/UpdateVfModuleRequest.java8
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/UpdateVolumeGroupRequest.java6
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/MapAdapter.java62
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/MapElements.java37
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/MapEntry.java36
-rw-r--r--adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/mappers/JAXBMarshallingTest.java51
-rw-r--r--adapters/mso-adapters-rest-interface/src/test/resources/createVfModuleRequest-with-params.xml206
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.3__AddBluePrintNameVersion.sql8
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.4__AddPnfResourceAndCustomization.sql39
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CvnfcCatalogDbQueryTest.java10
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java307
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql12
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java27
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java15
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/MsoTenantAdapterImpl.java9
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java32
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java17
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java16
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java15
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/schema.sql2
-rw-r--r--adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/client/RequestsDbClientTest.java12
-rw-r--r--adapters/mso-requests-db-adapter/src/test/resources/db/migration/afterMigrate.sql3
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java1
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/pom.xml104
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/src/main/resources/vnfmadapter.yaml522
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/pom.xml17
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/pom.xml80
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/Constants.java33
-rwxr-xr-xadapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/VnfmAdapterApplication.java54
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/WebSecurityConfigImpl.java51
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterController.java34
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/resources/application.yaml31
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/HealthCheckTest.java55
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/resources/application-test.yaml19
-rw-r--r--adapters/mso-vnfm-adapter/pom.xml22
-rw-r--r--adapters/pom.xml1
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java2
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/NotificationDataImpl.java15
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java174
-rw-r--r--asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java131
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy28
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy14
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtils.groovy64
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AppCClient.groovy36
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy76
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcess.groovy76
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupName.groovy24
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenant.groovy50
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModule.groovy110
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleVolumeGroup.groovy65
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DecomposeService.groovy39
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModule.groovy69
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtil.groovy78
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy39
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/FalloutHandler.groovy170
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy50
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenericNotificationService.groovy8
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ManualHandling.groovy124
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy36
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy111
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy60
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModule.groovy62
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/RainyDayHandler.groovy61
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ReceiveWorkflowMessage.groovy44
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapter.groovy88
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy91
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV2.groovy81
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterUtils.groovy97
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SniroHomingV1.groovy46
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SniroUtils.groovy28
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/TrinityExceptionUtil.groovy136
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy61
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModule.groovy42
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VfModule.groovy10
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VfModuleBase.groovy42
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VidUtils.groovy28
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy96
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterUtils.groovy18
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/Skip.java20
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowContextHolder.java2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/InstanceGroup.java17
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceInstance.java8
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Tenant.java22
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/WorkflowResourceIds.java9
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java104
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java10
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java34
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java4
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/exceptions/MultipleObjectsFoundException.java47
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/exceptions/NoServiceInstanceFoundException.java47
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java8
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/CDSPropertiesImpl.java15
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/ExtractPojosForBBTest.java11
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java28
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java125
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java38
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/exceptions/MultipleObjectsFoundExceptionTest.java67
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/exceptions/NoServiceInstanceFoundExceptionTest.java66
-rw-r--r--bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GeneralBuildingBlockInstanceGroupExpected.json323
-rw-r--r--bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_instanceGroupAddMembers.json27
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerService.java20
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/SDNCAdapterCallbackServiceImpl.java5
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/VnfAdapterNotifyServiceImpl.java8
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowMessageResource.java5
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowResource.java1
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java1
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/adapter/sdnc/ObjectFactoryTest.java63
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteInstanceGroupBB.bpmn62
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/BaseBPMNTest.java8
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteInstanceGroupBBTest.java53
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSDNCNetworkResource.groovy33
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CompareModelofE2EServiceInstance.groovy53
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy137
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy77
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateDeviceResource.groovy87
-rwxr-xr-xbpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateGenericALaCarteServiceInstance.groovy101
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateNetworkInstance.groovy82
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy39
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy69
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleInfra.groovy112
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1.groovy32
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVnfInfra.groovy162
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeActivateSDNCNetworkResource.groovy35
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Delete3rdONAPE2EServiceInstance.groovy145
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCustomE2EServiceInstance.groovy71
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteDeviceResource.groovy49
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteGenericALaCarteServiceInstance.groovy63
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteNetworkInstance.groovy80
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy39
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVFCNSResource.groovy24
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleInfra.groovy82
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy47
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVnfInfra.groovy53
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelVersions.groovy47
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelofE2EServiceInstance.groovy25
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy116
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstanceRollback.groovy67
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy239
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceRollback.groovy59
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy53
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy157
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstanceRollback.groovy62
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy62
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy491
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy106
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeRollback.groovy17
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2.groovy63
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy153
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy160
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModulesRollback.groovy100
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy114
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy314
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy99
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy210
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstanceRollback.groovy54
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy53
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteServiceInstance.groovy55
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy67
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy110
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy151
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2.groovy29
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnf.groovy32
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy131
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleE2EServiceInstance.groovy28
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy26
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy83
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstanceRollback.groovy55
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstance.groovy201
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceRollback.groovy50
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy219
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy100
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/HealchCheckActivate.groovy6
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ReplaceVnfInfra.groovy122
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/RollbackVnf.groovy24
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstance.groovy68
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy90
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateNetworkInstance.groovy71
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModule.groovy70
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleInfra.groovy87
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleInfraV2.groovy81
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolume.groovy88
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy35
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVnfInfra.groovy114
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfCmBase.groovy237
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfConfigUpdate.groovy212
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfInPlaceUpdate.groovy115
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy206
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy91
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy166
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollback.groovy82
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy154
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollback.groovy82
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRG.groovy91
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXC.groovy93
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustServiceTest.groovy2555
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustServiceTest.groovy1267
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollbackTest.groovy1184
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGTest.groovy1818
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollbackTest.groovy1180
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCTest.groovy1667
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRGTest.groovy1028
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXCTest.groovy1020
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/GroovyTestBase.groovy139
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/MapGetter.groovy49
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/MapSetter.groovy53
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/AllTestsTestSuite.java6
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DeleteVcpeResCustService/request.json1
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java25
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java13
-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/appc/tasks/AppcRunTasks.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOut.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheck.java15
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/validations/CloudRegionOrchestrationValidator.java20
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java91
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java110
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowType.java3
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClientResponseValidator.java24
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java15
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIInstanceGroupResources.java10
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java20
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapper.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/BaseTaskTest.java1
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/data/TestDataSetup.java17
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java19
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasksTest.java11
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/validations/CloudRegionOrchestrationValidatorTest.java20
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java33
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java18
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionUnitTest.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java8
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIInstanceGroupResourcesTest.java21
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapperTest.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleOperationInformationUnassign.json2
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/AAIEdgeLabel.java4
-rw-r--r--common/src/main/java/org/onap/so/client/cds/BasicAuthClientInterceptor.java15
-rw-r--r--common/src/main/java/org/onap/so/client/cds/CDSProcessingClient.java17
-rw-r--r--common/src/main/java/org/onap/so/client/cds/CDSProcessingHandler.java17
-rw-r--r--common/src/main/java/org/onap/so/client/cds/CDSProcessingListener.java15
-rw-r--r--common/src/main/java/org/onap/so/client/cds/CDSProperties.java15
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryResourcesClient.java22
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/TransactionBuilder.java20
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/Id.java20
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/Pathed.java20
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/Resource.java20
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/ResourceAndUrl.java20
-rw-r--r--common/src/main/java/org/onap/so/logger/MsoLogger.java109
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/RequestStatus.java10
-rw-r--r--common/src/main/java/org/onap/so/utils/UUIDChecker.java33
-rw-r--r--common/src/test/java/org/onap/so/client/cds/CDSProcessingClientTest.java17
-rw-r--r--common/src/test/java/org/onap/so/client/cds/TestCDSProcessingListener.java15
-rw-r--r--common/src/test/java/org/onap/so/client/cds/TestCDSPropertiesImpl.java15
-rw-r--r--common/src/test/java/org/onap/so/serviceinstancebeans/RequestStatusTest.java43
-rw-r--r--common/src/test/java/org/onap/so/utils/UUIDCheckerTest.java26
-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-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java450
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/GlobalHealthcheckHandler.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/NodeHealthcheckHandler.java3
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java43
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java1
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelper.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java25
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/RequestStatus.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/InstanceIdMapValidation.java8
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/RequestParametersValidation.java17
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/MsoRequestTest.java4
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java92
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironmentTest.java20
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/validation/RequestParametersValidationTest.java72
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/OrchestrationFilterResponse.json8
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/OrchestrationList.json6
-rw-r--r--mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImpl.java16
-rw-r--r--mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/OperationalEnvServiceModelStatusRepository.java5
-rw-r--r--mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/OperationalEnvServiceModelStatusTest.java3
-rw-r--r--mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/RequestDBConfig.java11
-rw-r--r--mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImplTest.java30
-rw-r--r--mso-api-handlers/mso-requests-db-repositories/src/test/resources/schema.sql2
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/WatchdogDistributionStatus.java1
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java10
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/OrchestrationAction.java2
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/PnfResource.java215
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/PnfResourceCustomization.java220
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ResourceType.java1
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/Service.java605
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ServiceRecipe.java17
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResourceCustomization.java510
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfVfmoduleCvnfcConfigurationCustomization.java1
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java1363
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/PnfCustomizationRepository.java32
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/PnfResourceRepository.java29
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfVfmoduleCvnfcConfigurationCustomizationRepository.java8
-rw-r--r--mso-catalog-db/src/test/java/org/onap/so/db/catalog/ServiceTest.java89
-rw-r--r--mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/PnfCustomizationRepositoryTest.java62
-rw-r--r--mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/PnfResourceRepositoryTest.java50
-rw-r--r--mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/VnfCustomizationRepositoryTest.java78
-rw-r--r--mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/VnfVfmoduleCvnfcConfigurationCustomizationRepositoryTest.java11
-rw-r--r--mso-catalog-db/src/test/resources/data.sql17
-rw-r--r--mso-catalog-db/src/test/resources/schema.sql40
-rw-r--r--packages/docker/pom.xml30
-rw-r--r--so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/configuration/rest/CorsConfigurer.java9
-rw-r--r--so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/monitoring/configuration/CamundaConfigurationTest.java (renamed from so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/montoring/configuration/CamundaConfigurationTest.java)0
-rw-r--r--so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/monitoring/configuration/CamundaRestUrlProviderTest.java (renamed from so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/montoring/configuration/CamundaRestUrlProviderTest.java)0
-rw-r--r--so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/monitoring/configuration/HttpServiceProviderConfigurationTest.java (renamed from so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/montoring/configuration/HttpServiceProviderConfigurationTest.java)0
-rw-r--r--so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/monitoring/configuration/PojoClassesTests.java (renamed from so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/montoring/configuration/PojoClassesTests.java)0
-rw-r--r--so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/monitoring/configuration/database/DatabaseUrlProviderTest.java (renamed from so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/montoring/configuration/database/DatabaseUrlProviderTest.java)0
-rw-r--r--so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/monitoring/db/api/DatabaseServiceProviderTest.java (renamed from so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/montoring/db/api/DatabaseServiceProviderTest.java)0
-rw-r--r--so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/monitoring/rest/service/CamundaProcessDataServiceProviderTest.java (renamed from so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/montoring/rest/service/CamundaProcessDataServiceProviderTest.java)0
-rw-r--r--so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/monitoring/utils/ObjectEqualsUtilsTest.java (renamed from so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/montoring/utils/ObjectEqualsUtilsTest.java)0
317 files changed, 17936 insertions, 13576 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 f50a6fd1bd..97e1627fd3 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
@@ -1047,7 +1047,11 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin{
}
} else if (type.equalsIgnoreCase("json")) {
try {
- return JSON_MAPPER.writeValueAsString(inputValue);
+ if (inputValue instanceof String) {
+ return JSON_MAPPER.readTree(inputValue.toString());
+ }
+ //will already marshal to json without intervention
+ return inputValue;
}
catch (Exception e) {
logger.debug("Unable to convert {} to a JsonNode!", inputValue);
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 a0fbd485d1..47ff6c1b5f 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
@@ -38,6 +38,8 @@ import com.woorea.openstack.keystone.Keystone;
import com.woorea.openstack.keystone.model.Access;
import com.woorea.openstack.keystone.model.Authentication;
import com.woorea.openstack.keystone.utils.KeystoneUtils;
+
+import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
@@ -1328,13 +1330,13 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
logger.debug("Parameter: {} is of type {}", key, type);
if ("string".equalsIgnoreCase(type)) {
// Easiest!
- String str = inputs.get(key).toString();
+ String str = inputs.get(key) != null ? inputs.get(key).toString() : null;
if (alias)
newInputs.put(realName, str);
else
newInputs.put(key, str);
} else if ("number".equalsIgnoreCase(type)) {
- String integerString = inputs.get(key).toString();
+ String integerString = inputs.get(key) != null ? inputs.get(key).toString() : null;
Integer anInteger = null;
try {
anInteger = Integer.parseInt(integerString);
@@ -1356,20 +1358,24 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
}
} else if ("json".equalsIgnoreCase(type)) {
Object jsonObj = inputs.get(key);
- String jsonString;
+ Object json;
try {
- jsonString = JSON_MAPPER.writeValueAsString(jsonObj);
- } catch (JsonProcessingException e) {
+ if (jsonObj instanceof String) {
+ json = JSON_MAPPER.readTree(jsonObj.toString());
+ } else {
+ //will already marshal to json without intervention
+ json = jsonObj;
+ }
+ } catch (IOException e) {
logger.error("failed to map to json, directly converting to string instead", e);
- jsonString = jsonObj.toString();
+ json = jsonObj.toString();
}
if (alias)
- newInputs.put(realName, jsonString);
+ newInputs.put(realName, json);
else
- newInputs.put(key, jsonString);
- //}
+ newInputs.put(key, json);
} else if ("comma_delimited_list".equalsIgnoreCase(type)) {
- String commaSeparated = inputs.get(key).toString();
+ String commaSeparated = inputs.get(key) != null ? inputs.get(key).toString() : null;
try {
List<String> anArrayList = this.convertCdlToArrayList(commaSeparated);
if (alias)
@@ -1384,7 +1390,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
newInputs.put(key, commaSeparated);
}
} else if ("boolean".equalsIgnoreCase(type)) {
- String booleanString = inputs.get(key).toString();
+ String booleanString = inputs.get(key) != null ? inputs.get(key).toString() : null;
Boolean aBool = Boolean.valueOf(booleanString);
if (alias)
newInputs.put(realName, aBool);
diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/authentication/KeystoneAuthHolderTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/authentication/KeystoneAuthHolderTest.java
index af24975771..8469ad506c 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/authentication/KeystoneAuthHolderTest.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/authentication/KeystoneAuthHolderTest.java
@@ -1,6 +1,26 @@
+/*-
+ * ============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=========================================================
+ */
+
/*
* ============LICENSE_START==========================================
- * org.onap.music
+ * ONAP - SO
* ===================================================================
* Copyright (c) 2019 IBM.
* ===================================================================
diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloudify/utils/MsoCloudifyUtilsTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloudify/utils/MsoCloudifyUtilsTest.java
index f63aab7ce1..833b4ab760 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloudify/utils/MsoCloudifyUtilsTest.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloudify/utils/MsoCloudifyUtilsTest.java
@@ -24,6 +24,7 @@ package org.onap.so.cloudify.utils;
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.assertTrue;
import static org.junit.Assert.fail;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
@@ -70,6 +71,7 @@ import org.skyscreamer.jsonassert.JSONAssert;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
public class MsoCloudifyUtilsTest {
@@ -305,11 +307,18 @@ public class MsoCloudifyUtilsTest {
paramJson.setParamType("json");
paramJson.setParamName("my-json");
- Map<String, Object> jsonMap = mapper.readValue(getJson("free-form.json"), new TypeReference<Map<String, Object>>(){});
+ HeatTemplateParam paramJsonEscaped = new HeatTemplateParam();
+ paramJsonEscaped.setParamType("json");
+ paramJsonEscaped.setParamName("my-json-escaped");
+ Map<String, Object> jsonMap = mapper.readValue(getJson("free-form.json"), new TypeReference<Map<String, Object>>(){});
+
assertEquals(3, utils.convertInputValue("3", paramNum));
assertEquals("hello", utils.convertInputValue("hello", paramString));
- JSONAssert.assertEquals(getJson("free-form.json"), utils.convertInputValue(jsonMap, paramJson).toString(), false);
+ assertTrue("expect no change in type", utils.convertInputValue(jsonMap, paramJson) instanceof Map);
+ assertTrue("expect string to become jsonNode", utils.convertInputValue(getJson("free-form.json"), paramJsonEscaped) instanceof JsonNode);
+
+ JSONAssert.assertEquals(getJson("free-form.json"), mapper.writeValueAsString(utils.convertInputValue(getJson("free-form.json"), paramJsonEscaped)), false);
}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsUnitTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsUnitTest.java
index 40bbe90218..9edc805cf3 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsUnitTest.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsUnitTest.java
@@ -1,11 +1,36 @@
+/*-
+ * ============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.openstack.utils;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
+import java.util.ArrayList;
import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -17,6 +42,7 @@ import org.skyscreamer.jsonassert.JSONAssert;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
public class MsoHeatUtilsUnitTest {
@@ -45,20 +71,123 @@ public class MsoHeatUtilsUnitTest {
paramJson.setParamType("json");
paramJson.setParamName("my-json");
+ HeatTemplateParam paramJsonEscaped = new HeatTemplateParam();
+ paramJsonEscaped.setParamType("json");
+ paramJsonEscaped.setParamName("my-json-escaped");
+
Map<String, Object> jsonMap = mapper.readValue(getJson("free-form.json"), new TypeReference<Map<String, Object>>(){});
input.put("my-json", jsonMap);
+ input.put("my-json-escaped", getJson("free-form.json"));
+
parameters.add(paramNum);
parameters.add(paramString);
parameters.add(paramJson);
-
+ parameters.add(paramJsonEscaped);
+
Map<String, Object> output = utils.convertInputMap(input, template);
assertEquals(3, output.get("my-number"));
assertEquals("hello", output.get("my-string"));
- JSONAssert.assertEquals(getJson("free-form.json"), (String)output.get("my-json"), false);
+ assertTrue("expect no change in type", output.get("my-json") instanceof Map);
+ assertTrue("expect string to become jsonNode", output.get("my-json-escaped") instanceof JsonNode);
+
+ JSONAssert.assertEquals(getJson("free-form.json"), mapper.writeValueAsString(output.get("my-json-escaped")), false);
}
+ @Test
+ public final void convertInputMapValuesTest() {
+ MsoHeatUtils utils = new MsoHeatUtils();
+ Map<String, Object> inputs = new HashMap<>();
+ Set<HeatTemplateParam> params = new HashSet<>();
+ HeatTemplate ht = new HeatTemplate();
+ HeatTemplateParam htp = new HeatTemplateParam();
+ htp.setParamName("vnf_name");
+ htp.setParamType("string");
+ params.add(htp);
+ inputs.put("vnf_name", "a_vnf_name");
+ htp = new HeatTemplateParam();
+ htp.setParamName("image_size");
+ htp.setParamType("number");
+ params.add(htp);
+ inputs.put("image_size", "1024");
+ htp = new HeatTemplateParam();
+ htp.setParamName("external");
+ htp.setParamType("boolean");
+ params.add(htp);
+ inputs.put("external", "false");
+ htp = new HeatTemplateParam();
+ htp.setParamName("oam_ips");
+ htp.setParamType("comma_delimited_list");
+ params.add(htp);
+ inputs.put("oam_ips", "a,b");
+ htp = new HeatTemplateParam();
+ htp.setParamName("oam_prefixes");
+ htp.setParamType("json");
+ params.add(htp);
+ String jsonEscInput = "[{\"prefix\": \"aValue\"}, {\"prefix\": \"aValue2\"}]";
+ inputs.put("oam_prefixes", jsonEscInput);
+ ht.setParameters(params);
+
+ Map<String, Object> output = utils.convertInputMap(inputs, ht);
+
+ assertEquals("a_vnf_name", output.get("vnf_name"));
+ assertEquals(1024, output.get("image_size"));
+ assertEquals(false, output.get("external"));
+ List<String> cdl = new ArrayList<>();
+ cdl.add(0, "a");
+ cdl.add(1, "b");
+ assertEquals(cdl, output.get("oam_ips"));
+ ObjectMapper JSON_MAPPER = new ObjectMapper();
+ JsonNode jn = null;
+ try {
+ jn = JSON_MAPPER.readTree(jsonEscInput);
+ } catch (Exception e) {
+ }
+ assertEquals(jn, output.get("oam_prefixes"));
+ }
+
+ @Test
+ public final void convertInputMapNullsTest() {
+ MsoHeatUtils utils = new MsoHeatUtils();
+ Map<String, Object> inputs = new HashMap<>();
+ Set<HeatTemplateParam> params = new HashSet<>();
+ HeatTemplate ht = new HeatTemplate();
+ HeatTemplateParam htp = new HeatTemplateParam();
+ htp.setParamName("vnf_name");
+ htp.setParamType("string");
+ params.add(htp);
+ inputs.put("vnf_name", null);
+ htp = new HeatTemplateParam();
+ htp.setParamName("image_size");
+ htp.setParamType("number");
+ params.add(htp);
+ inputs.put("image_size", null);
+ htp = new HeatTemplateParam();
+ htp.setParamName("external");
+ htp.setParamType("boolean");
+ params.add(htp);
+ inputs.put("external", null);
+ htp = new HeatTemplateParam();
+ htp.setParamName("oam_ips");
+ htp.setParamType("comma_delimited_list");
+ params.add(htp);
+ inputs.put("oam_ips", null);
+ htp = new HeatTemplateParam();
+ htp.setParamName("oam_prefixes");
+ htp.setParamType("json");
+ params.add(htp);
+ inputs.put("oam_prefixes", null);
+ ht.setParameters(params);
+
+ Map<String, Object> output = utils.convertInputMap(inputs, ht);
+
+ assertNull(output.get("vnf_name"));
+ assertNull(output.get("image_size"));
+ assertEquals(false, output.get("external"));
+ assertNull(output.get("oam_ips"));
+ assertNull(output.get("oam_prefixes"));
+ }
private String getJson(String filename) throws IOException {
return new String(Files.readAllBytes(Paths.get("src/test/resources/__files/MsoHeatUtils/" + filename)));
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVfModuleRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVfModuleRequest.java
index c62dc0dfbf..a136ff778d 100644
--- a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVfModuleRequest.java
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVfModuleRequest.java
@@ -23,9 +23,14 @@ package org.onap.so.adapters.vnfrest;
import java.util.HashMap;
import java.util.Map;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAnyElement;
import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import org.onap.so.entity.MsoRequest;
+import org.onap.so.openstack.mappers.MapAdapter;
import com.fasterxml.jackson.annotation.JsonRootName;
@@ -35,6 +40,7 @@ import com.fasterxml.jackson.annotation.JsonRootName;
*/
@JsonRootName("createVfModuleRequest")
@XmlRootElement(name = "createVfModuleRequest")
+@XmlAccessorType(XmlAccessType.FIELD)
public class CreateVfModuleRequest extends VfRequestCommon {
private String cloudSiteId;
private String tenantId;
@@ -57,7 +63,7 @@ public class CreateVfModuleRequest extends VfRequestCommon {
private Boolean failIfExists = false;
private Boolean backout = true;
private Boolean enableBridge;
-
+ @XmlJavaTypeAdapter(MapAdapter.class)
private Map<String, Object> vfModuleParams = new HashMap<>();
private MsoRequest msoRequest = new MsoRequest();
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVolumeGroupRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVolumeGroupRequest.java
index 214abd4e9d..d402004d57 100644
--- a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVolumeGroupRequest.java
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVolumeGroupRequest.java
@@ -24,14 +24,19 @@ package org.onap.so.adapters.vnfrest;
import java.util.HashMap;
import java.util.Map;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import org.onap.so.entity.MsoRequest;
+import org.onap.so.openstack.mappers.MapAdapter;
import com.fasterxml.jackson.annotation.JsonRootName;
@JsonRootName("createVolumeGroupRequest")
@XmlRootElement(name = "createVolumeGroupRequest")
+@XmlAccessorType(XmlAccessType.FIELD)
public class CreateVolumeGroupRequest extends VfRequestCommon {
private String cloudSiteId;
private String tenantId;
@@ -41,6 +46,7 @@ public class CreateVolumeGroupRequest extends VfRequestCommon {
private String vnfVersion;
private String vfModuleType;
private String modelCustomizationUuid;
+ @XmlJavaTypeAdapter(MapAdapter.class)
private Map<String,Object> volumeGroupParams = new HashMap<>();
private Boolean failIfExists;
private Boolean enableBridge;
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/UpdateVfModuleRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/UpdateVfModuleRequest.java
index 1c7696a79b..bac9eae2c5 100644
--- a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/UpdateVfModuleRequest.java
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/UpdateVfModuleRequest.java
@@ -24,14 +24,19 @@ package org.onap.so.adapters.vnfrest;
import java.util.HashMap;
import java.util.Map;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import org.onap.so.entity.MsoRequest;
+import org.onap.so.openstack.mappers.MapAdapter;
import com.fasterxml.jackson.annotation.JsonRootName;
@JsonRootName("updateVfModuleRequest")
@XmlRootElement(name = "updateVfModuleRequest")
+@XmlAccessorType(XmlAccessType.FIELD)
public class UpdateVfModuleRequest extends VfRequestCommon {
private String cloudSiteId;
@@ -57,7 +62,8 @@ public class UpdateVfModuleRequest extends VfRequestCommon {
private String requestType;
private Boolean failIfExists;
private Boolean backout;
-
+
+ @XmlJavaTypeAdapter(MapAdapter.class)
private Map<String,Object> vfModuleParams = new HashMap<>();
private MsoRequest msoRequest = new MsoRequest();
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/UpdateVolumeGroupRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/UpdateVolumeGroupRequest.java
index 8ddef1eeaf..d3b685a1d0 100644
--- a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/UpdateVolumeGroupRequest.java
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/UpdateVolumeGroupRequest.java
@@ -24,14 +24,19 @@ package org.onap.so.adapters.vnfrest;
import java.util.HashMap;
import java.util.Map;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import org.onap.so.entity.MsoRequest;
+import org.onap.so.openstack.mappers.MapAdapter;
import com.fasterxml.jackson.annotation.JsonRootName;
@JsonRootName("updateVolumeGroupRequest")
@XmlRootElement(name = "updateVolumeGroupRequest")
+@XmlAccessorType(XmlAccessType.FIELD)
public class UpdateVolumeGroupRequest extends VfRequestCommon {
private String cloudSiteId;
private String tenantId;
@@ -41,6 +46,7 @@ public class UpdateVolumeGroupRequest extends VfRequestCommon {
private String vnfVersion;
private String vfModuleType;
private String modelCustomizationUuid;
+ @XmlJavaTypeAdapter(MapAdapter.class)
private Map<String,Object> volumeGroupParams = new HashMap<>();
private MsoRequest msoRequest = new MsoRequest();
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/MapAdapter.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/MapAdapter.java
new file mode 100644
index 0000000000..e816646e1c
--- /dev/null
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/MapAdapter.java
@@ -0,0 +1,62 @@
+/*-
+ * ============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.openstack.mappers;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.bind.annotation.adapters.XmlAdapter;
+
+import org.w3c.dom.Element;
+
+public class MapAdapter extends XmlAdapter<MapEntry, Map<String, Object>> {
+
+ @Override
+ public MapEntry marshal(Map<String, Object> v) throws Exception {
+
+ if (v == null || v.isEmpty()) {return null;}
+
+ MapEntry map = new MapEntry();
+
+ for (String key : v.keySet()) {
+ map.addEntry(key, v.get(key));
+ }
+
+ return map;
+ }
+
+ @Override
+ public Map<String, Object> unmarshal(MapEntry v) throws Exception {
+ if (v == null) {return null;}
+
+ Map<String, Object> map = new HashMap<>(v.entry.size());
+
+ for(MapElements entry: v.entry) {
+ if (entry.value instanceof Element) {
+ map.put(entry.key, ((Element)entry.value).getTextContent());
+ } else {
+ map.put(entry.key, entry.value);
+ }
+ }
+
+ return map;
+ }
+}
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/MapElements.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/MapElements.java
new file mode 100644
index 0000000000..709393bb84
--- /dev/null
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/MapElements.java
@@ -0,0 +1,37 @@
+/*-
+ * ============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.openstack.mappers;
+
+import javax.xml.bind.annotation.XmlElement;
+
+public class MapElements
+{
+ @XmlElement public String key;
+ @XmlElement public Object value;
+
+ public MapElements() {} //Required by JAXB
+
+ public MapElements(String key, Object value)
+ {
+ this.key = key;
+ this.value = value;
+ }
+}
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/MapEntry.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/MapEntry.java
new file mode 100644
index 0000000000..e6dc0e0538
--- /dev/null
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/MapEntry.java
@@ -0,0 +1,36 @@
+/*-
+ * ============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.openstack.mappers;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class MapEntry {
+
+ public List<MapElements> entry = new ArrayList<>();
+
+ public MapEntry() {} //Required by JAXB
+
+ public void addEntry(String key, Object value) {
+ entry.add(new MapElements(key, value));
+ }
+
+}
diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/mappers/JAXBMarshallingTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/mappers/JAXBMarshallingTest.java
new file mode 100644
index 0000000000..038e88317d
--- /dev/null
+++ b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/mappers/JAXBMarshallingTest.java
@@ -0,0 +1,51 @@
+/*-
+ * ============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.openstack.mappers;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+
+import org.junit.Test;
+import org.onap.so.adapters.vnfrest.CreateVfModuleRequest;
+
+
+public class JAXBMarshallingTest {
+
+
+ @Test
+ public void xmlMarshalTest() throws IOException, JAXBException {
+ JAXBContext context = JAXBContext.newInstance(CreateVfModuleRequest.class);
+
+ CreateVfModuleRequest request = (CreateVfModuleRequest) context.createUnmarshaller().unmarshal(Files.newBufferedReader(Paths.get("src/test/resources/createVfModuleRequest-with-params.xml")));
+
+ assertEquals("ubuntu-16-04-cloud-amd64", request.getVfModuleParams().get("vcpe_image_name"));
+ assertEquals("10.2.0.0/24", request.getVfModuleParams().get("cpe_public_net_cidr"));
+ assertEquals("", request.getVfModuleParams().get("workload_context"));
+
+ }
+
+}
diff --git a/adapters/mso-adapters-rest-interface/src/test/resources/createVfModuleRequest-with-params.xml b/adapters/mso-adapters-rest-interface/src/test/resources/createVfModuleRequest-with-params.xml
new file mode 100644
index 0000000000..76ba3695f2
--- /dev/null
+++ b/adapters/mso-adapters-rest-interface/src/test/resources/createVfModuleRequest-with-params.xml
@@ -0,0 +1,206 @@
+<createVfModuleRequest>
+ <cloudSiteId>RegionOne</cloudSiteId>
+ <tenantId>09d8566ea45e43aa974cf447ed591d77</tenantId>
+ <vnfId>8daea639-82b9-4da6-aec9-5054f006a82d</vnfId>
+ <vnfName>vcpe_vnf_vcpe_infra_201903101808</vnfName>
+ <vfModuleName>vcpe_vfmodule_vcpeinfra53f27a6285bd_201903101808</vfModuleName>
+ <vfModuleId>1ea78add-a36c-4af4-959f-4c43292b3aac</vfModuleId>
+ <vnfType>demoVCPEInfra/vCPE_infra 53f27a62-85bd 0</vnfType>
+ <vfModuleType>VcpeInfra53f27a6285bd..base_vcpe_infra..module-0</vfModuleType>
+ <vnfVersion>1.0</vnfVersion>
+ <modelCustomizationUuid>76135970-0c64-4b62-a4d0-56606fc040b3</modelCustomizationUuid>
+ <requestType></requestType>
+ <volumeGroupId></volumeGroupId>
+ <volumeGroupStackId></volumeGroupStackId>
+ <baseVfModuleId></baseVfModuleId>
+ <baseVfModuleStackId></baseVfModuleStackId>
+ <skipAAI>true</skipAAI>
+ <backout>false</backout>
+ <failIfExists>true</failIfExists>
+ <vfModuleParams>
+ <entry>
+ <key>vf_module_id</key>
+ <value>1ea78add-a36c-4af4-959f-4c43292b3aac</value>
+ </entry>
+ <entry>
+ <key>cpe_public_subnet_id</key>
+ <value>vcpe_net_cpe_public_subnet_201903101808</value>
+ </entry>
+ <entry>
+ <key>oof_directives</key>
+ <value>{}</value>
+ </entry>
+ <entry>
+ <key>cpe_signal_subnet_id</key>
+ <value>vcpe_net_cpe_signal_subnet_201903101808</value>
+ </entry>
+ <entry>
+ <key>onap_private_net_id</key>
+ <value>oam_network_hkV9</value>
+ </entry>
+ <entry>
+ <key>vnf_name</key>
+ <value>vcpe_vnf_vcpe_infra_201903101808</value>
+ </entry>
+ <entry>
+ <key>key_name</key>
+ <value>vaaa_key</value>
+ </entry>
+ <entry>
+ <key>workload_context</key>
+ <value></value>
+ </entry>
+ <entry>
+ <key>vweb_name_0</key>
+ <value>zdcpe1cpe01web01_201903101808</value>
+ </entry>
+ <entry>
+ <key>vf_module_name</key>
+ <value>vcpe_vfmodule_vcpeinfra53f27a6285bd_201903101808</value>
+ </entry>
+ <entry>
+ <key>vcpe_flavor_name</key>
+ <value>m1.medium</value>
+ </entry>
+ <entry>
+ <key>vdhcp_name_0</key>
+ <value>zdcpe1cpe01dhcp01_201903101808</value>
+ </entry>
+ <entry>
+ <key>vdhcp_private_ip_0</key>
+ <value>10.4.0.1</value>
+ </entry>
+ <entry>
+ <key>install_script_version</key>
+ <value>1.3.0</value>
+ </entry>
+ <entry>
+ <key>vdhcp_private_ip_1</key>
+ <value>10.0.101.1</value>
+ </entry>
+ <entry>
+ <key>vnf_id</key>
+ <value>8daea639-82b9-4da6-aec9-5054f006a82d</value>
+ </entry>
+ <entry>
+ <key>cloud_env</key>
+ <value>openstack</value>
+ </entry>
+ <entry>
+ <key>mr_ip_addr</key>
+ <value>10.12.5.69</value>
+ </entry>
+ <entry>
+ <key>repo_url_artifacts</key>
+ <value>https://nexus.onap.org/content/repositories/releases</value>
+ </entry>
+ <entry>
+ <key>dcae_collector_port</key>
+ <value>8080</value>
+ </entry>
+ <entry>
+ <key>repo_url_blob</key>
+ <value>https://nexus.onap.org/content/sites/raw</value>
+ </entry>
+ <entry>
+ <key>public_net_id</key>
+ <value>971040b2-7059-49dc-b220-4fab50cb2ad4</value>
+ </entry>
+ <entry>
+ <key>onap_private_net_cidr</key>
+ <value>10.0.0.0/16</value>
+ </entry>
+ <entry>
+ <key>cpe_signal_net_cidr</key>
+ <value>10.4.0.0/24</value>
+ </entry>
+ <entry>
+ <key>environment_context</key>
+ <value></value>
+ </entry>
+ <entry>
+ <key>onap_private_subnet_id</key>
+ <value>oam_network_hkV9</value>
+ </entry>
+ <entry>
+ <key>vweb_private_ip_0</key>
+ <value>10.2.0.10</value>
+ </entry>
+ <entry>
+ <key>vaaa_private_ip_1</key>
+ <value>10.0.101.2</value>
+ </entry>
+ <entry>
+ <key>cpe_public_net_id</key>
+ <value>vcpe_net_cpe_public_201903101808</value>
+ </entry>
+ <entry>
+ <key>vweb_private_ip_1</key>
+ <value>10.0.101.40</value>
+ </entry>
+ <entry>
+ <key>mr_ip_port</key>
+ <value>30227</value>
+ </entry>
+ <entry>
+ <key>vaaa_private_ip_0</key>
+ <value>10.4.0.2</value>
+ </entry>
+ <entry>
+ <key>pub_key</key>
+ <value>ssh-rsa
+ AAAAB3NzaC1yc2EAAAADAQABAAABAQDKXDgoo3+WOqcUG8/5uUbk81+yczgwC4Y8ywTmuQqbNxlY1oQ0YxdMUqUnhitSXs5S/yRuAVOYHwGg2mCs20oAINrP+mxBI544AMIb9itPjCtgqtE2EWo6MmnFGbHB4Sx3XioE7F4VPsh7japsIwzOjbrQe+Mua1TGQ5d4nfEOQaaglXLLPFfuc7WbhbJbK6Q7rHqZfRcOwAMXgDoBqlyqKeiKwnumddo2RyNT8ljYmvB6buz7KnMinzo7qB0uktVT05FH9Rg0CTWH5norlG5qXgP2aukL0gk1ph8iAt7uYLf1ktp+LJI2gaF6L0/qli9EmVCSLr1uJ38Q8CBflhkh</value>
+ </entry>
+ <entry>
+ <key>sdnc_directives</key>
+ <value>{}</value>
+ </entry>
+ <entry>
+ <key>vdns_private_ip_0</key>
+ <value>10.2.0.1</value>
+ </entry>
+ <entry>
+ <key>cpe_signal_net_id</key>
+ <value>vcpe_net_cpe_signal_201903101808</value>
+ </entry>
+ <entry>
+ <key>vdns_private_ip_1</key>
+ <value>10.0.101.3</value>
+ </entry>
+ <entry>
+ <key>demo_artifacts_version</key>
+ <value>1.3.0</value>
+ </entry>
+ <entry>
+ <key>vdns_name_0</key>
+ <value>zdcpe1cpe01dns01_201903101808</value>
+ </entry>
+ <entry>
+ <key>cpe_public_net_cidr</key>
+ <value>10.2.0.0/24</value>
+ </entry>
+ <entry>
+ <key>vaaa_name_0</key>
+ <value>zdcpe1cpe01aaa01_201903101808</value>
+ </entry>
+ <entry>
+ <key>dcae_collector_ip</key>
+ <value>10.0.4.102</value>
+ </entry>
+ <entry>
+ <key>vcpe_image_name</key>
+ <value>ubuntu-16-04-cloud-amd64</value>
+ </entry>
+ <entry>
+ <key>vf_module_index</key>
+ <value>0</value>
+ </entry>
+
+ </vfModuleParams>
+ <msoRequest>
+ <requestId>11c8ec20-a1f8-4aa2-926f-e55d67a30f8b</requestId>
+ <serviceInstanceId>807648fc-c84c-4662-bf23-23c7d8cbe0c8</serviceInstanceId>
+ </msoRequest>
+ <messageId>11c8ec20-a1f8-4aa2-926f-e55d67a30f8b-1552241542248</messageId>
+ <notificationUrl>http://so-bpmn-infra.onap:8081/mso/WorkflowMessage/VNFAResponse/11c8ec20-a1f8-4aa2-926f-e55d67a30f8b-1552241542248</notificationUrl>
+</createVfModuleRequest> \ No newline at end of file
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.3__AddBluePrintNameVersion.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.3__AddBluePrintNameVersion.sql
new file mode 100644
index 0000000000..97397df290
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.3__AddBluePrintNameVersion.sql
@@ -0,0 +1,8 @@
+use catalogdb;
+
+ALTER TABLE vnf_resource_customization
+ADD CDS_BLUEPRINT_NAME varchar(200) null;
+
+ALTER TABLE vnf_resource_customization
+ADD CDS_BLUEPRINT_VERSION varchar(20) null;
+
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.4__AddPnfResourceAndCustomization.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.4__AddPnfResourceAndCustomization.sql
new file mode 100644
index 0000000000..5571bf89ee
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.4__AddPnfResourceAndCustomization.sql
@@ -0,0 +1,39 @@
+use catalogdb;
+
+CREATE TABLE IF NOT EXISTS `pnf_resource` (
+ `ORCHESTRATION_MODE` varchar(20) DEFAULT NULL,
+ `DESCRIPTION` varchar(1200) DEFAULT NULL,
+ `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ `MODEL_UUID` varchar(200) NOT NULL,
+ `MODEL_INVARIANT_UUID` varchar(200) DEFAULT NULL,
+ `MODEL_VERSION` varchar(20) NOT NULL,
+ `MODEL_NAME` varchar(200) DEFAULT NULL,
+ `TOSCA_NODE_TYPE` varchar(200) DEFAULT NULL,
+ `RESOURCE_CATEGORY` varchar(200) DEFAULT NULL,
+ `RESOURCE_SUB_CATEGORY` varchar(200) DEFAULT NULL,
+ PRIMARY KEY (`MODEL_UUID`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+CREATE TABLE IF NOT EXISTS `pnf_resource_customization` (
+ `MODEL_CUSTOMIZATION_UUID` varchar(200) NOT NULL,
+ `MODEL_INSTANCE_NAME` varchar(200) NOT NULL,
+ `NF_TYPE` varchar(200) DEFAULT NULL,
+ `NF_ROLE` varchar(200) DEFAULT NULL,
+ `NF_FUNCTION` varchar(200) DEFAULT NULL,
+ `NF_NAMING_CODE` varchar(200) DEFAULT NULL,
+ `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ `PNF_RESOURCE_MODEL_UUID` varchar(200) NOT NULL,
+ `MULTI_STAGE_DESIGN` varchar(20) DEFAULT NULL,
+ `RESOURCE_INPUT` varchar(2000) DEFAULT NULL,
+ CDS_BLUEPRINT_NAME varchar(200) DEFAULT NULL,
+ CDS_BLUEPRINT_VERSION varchar(20) DEFAULT NULL,
+ PRIMARY KEY (`MODEL_CUSTOMIZATION_UUID`),
+ KEY `fk_pnf_resource_customization__pnf_resource1_idx` (`PNF_RESOURCE_MODEL_UUID`),
+ CONSTRAINT `fk_pnf_resource_customization__pnf_resource1` FOREIGN KEY (`PNF_RESOURCE_MODEL_UUID`) REFERENCES `pnf_resource` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+CREATE TABLE IF NOT EXISTS `pnf_resource_customization_to_service` (
+ `SERVICE_MODEL_UUID` varchar(200) NOT NULL,
+ `RESOURCE_MODEL_CUSTOMIZATION_UUID` varchar(200) NOT NULL,
+ PRIMARY KEY (`SERVICE_MODEL_UUID`,`RESOURCE_MODEL_CUSTOMIZATION_UUID`)
+)ENGINE=InnoDB DEFAULT CHARSET=latin1; \ No newline at end of file
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CvnfcCatalogDbQueryTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CvnfcCatalogDbQueryTest.java
index b08b93eb87..89f4824492 100644
--- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CvnfcCatalogDbQueryTest.java
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CvnfcCatalogDbQueryTest.java
@@ -170,6 +170,14 @@ public class CvnfcCatalogDbQueryTest {
} else {
Assert.fail("No linked VnfVfmoduleCvnfcConfigurationCustomization found for CvnfcCustomization");
}
+
+ VnfVfmoduleCvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomizationFound = client.
+ getVnfVfmoduleCvnfcConfigurationCustomizationByVnfCustomizationUuidAndVfModuleCustomizationUuidAndCvnfcCustomizationUuid(
+ "6912dd02-2b16-11e9-b210-d663bd873d93",
+ "bdbf984a-2b16-11e9-b210-d663bd873d93",
+ "0c042562-2bac-11e9-b210-d663bd873d93");
+ assertNotNull(vnfVfmoduleCvnfcConfigurationCustomizationFound);
+ System.out.println(vnfVfmoduleCvnfcConfigurationCustomizationFound.getModelCustomizationUUID());
}
protected CvnfcCustomization setUpCvnfcCustomization(String id){
@@ -198,4 +206,4 @@ public class CvnfcCatalogDbQueryTest {
vnfcCustomization.setDescription("testVnfcCustomizationDescription");
return vnfcCustomization;
}
-}
+} \ No newline at end of file
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 4479e1ba4a..d28784bb93 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
@@ -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.
@@ -22,6 +22,7 @@ package org.onap.so.db.catalog.client;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
import static org.mockito.Mockito.when;
import java.util.List;
@@ -42,6 +43,8 @@ import org.onap.so.db.catalog.beans.ExternalServiceToInternalService;
import org.onap.so.db.catalog.beans.HomingInstance;
import org.onap.so.db.catalog.beans.InstanceGroup;
import org.onap.so.db.catalog.beans.NetworkResourceCustomization;
+import org.onap.so.db.catalog.beans.PnfResource;
+import org.onap.so.db.catalog.beans.PnfResourceCustomization;
import org.onap.so.db.catalog.beans.ServerType;
import org.onap.so.db.catalog.beans.Service;
import org.onap.so.db.catalog.beans.ServiceRecipe;
@@ -59,6 +62,7 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.web.server.LocalServerPort;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.mock.mockito.MockBean;
+import org.springframework.security.core.parameters.P;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;
@@ -68,31 +72,36 @@ import com.fasterxml.jackson.databind.ObjectMapper;
@SpringBootTest(classes = CatalogDBApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@ActiveProfiles("test")
public class CatalogDbClientTest {
+
public static final String MTN13 = "mtn13";
-
+
@LocalServerPort
private int port;
@Value("${mso.db.auth}")
private String msoAdaptersAuth;
-
+
@Autowired
CatalogDbClientPortChanger client;
@Before
- public void initialize(){
- client.wiremockPort= String.valueOf(port);
+ public void initialize() {
+ client.wiremockPort = String.valueOf(port);
}
@Test
- public void testGetRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(){
- RainyDayHandlerStatus rainyDayHandlerStatus = client.getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep("AssignServiceInstanceBB", "*", "*", "*", "*");
+ public void testGetRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep() {
+ RainyDayHandlerStatus rainyDayHandlerStatus = client
+ .getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(
+ "AssignServiceInstanceBB", "*", "*", "*", "*");
Assert.assertEquals("Rollback", rainyDayHandlerStatus.getPolicy());
}
@Test
- public void testGetRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStepRecordNotFound(){
- RainyDayHandlerStatus rainyDayHandlerStatus = client.getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(UUID.randomUUID().toString(), "*", "*", "*", "*");
+ public void testGetRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStepRecordNotFound() {
+ RainyDayHandlerStatus rainyDayHandlerStatus = client
+ .getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(
+ UUID.randomUUID().toString(), "*", "*", "*", "*");
Assert.assertNull(rainyDayHandlerStatus);
}
@@ -184,7 +193,8 @@ public class CatalogDbClientTest {
@Test
public void testGetVnfResourceCustomizationByModelCustomizationUUID() {
- VnfResourceCustomization vnfResourceCustomization = client.getVnfResourceCustomizationByModelCustomizationUUID("68dc9a92-214c-11e7-93ae-92361f002671");
+ VnfResourceCustomization vnfResourceCustomization = client
+ .getVnfResourceCustomizationByModelCustomizationUUID("68dc9a92-214c-11e7-93ae-92361f002671");
Assert.assertNotNull(vnfResourceCustomization);
Assert.assertEquals("vSAMP", vnfResourceCustomization.getNfRole());
Assert.assertNotNull(vnfResourceCustomization.getModelCustomizationUUID());
@@ -196,7 +206,8 @@ public class CatalogDbClientTest {
@Test
public void testGetVnfResourceCustomizationByModelCustomizationUUINotFound() {
- VnfResourceCustomization vnfResourceCustomization = client.getVnfResourceCustomizationByModelCustomizationUUID(UUID.randomUUID().toString());
+ VnfResourceCustomization vnfResourceCustomization = client
+ .getVnfResourceCustomizationByModelCustomizationUUID(UUID.randomUUID().toString());
Assert.assertNull(vnfResourceCustomization);
}
@@ -205,12 +216,14 @@ public class CatalogDbClientTest {
InstanceGroup instanceGroup = client.getInstanceGroupByModelUUID("0c8692ef-b9c0-435d-a738-edf31e71f38b");
Assert.assertNotNull(instanceGroup);
Assert.assertEquals("network_collection_resource_1806..NetworkCollection..0", instanceGroup.getModelName());
- Assert.assertEquals("org.openecomp.resource.cr.NetworkCollectionResource1806", instanceGroup.getToscaNodeType().toString());
+ Assert.assertEquals("org.openecomp.resource.cr.NetworkCollectionResource1806",
+ instanceGroup.getToscaNodeType().toString());
}
@Test
public void testGetVfModuleCustomizationByModelCuztomizationUUID() {
- VfModuleCustomization vfModuleCustomization = client.getVfModuleCustomizationByModelCuztomizationUUID("cb82ffd8-252a-11e7-93ae-92361f002671");
+ VfModuleCustomization vfModuleCustomization = client
+ .getVfModuleCustomizationByModelCuztomizationUUID("cb82ffd8-252a-11e7-93ae-92361f002671");
Assert.assertNotNull(vfModuleCustomization);
Assert.assertNotNull(vfModuleCustomization.getModelCustomizationUUID());
Assert.assertEquals("base", vfModuleCustomization.getLabel());
@@ -218,13 +231,15 @@ public class CatalogDbClientTest {
@Test
public void testGetVfModuleCustomizationByModelCuztomizationUUIDNotFound() {
- VfModuleCustomization vfModuleCustomization = client.getVfModuleCustomizationByModelCuztomizationUUID(UUID.randomUUID().toString());
+ VfModuleCustomization vfModuleCustomization = client
+ .getVfModuleCustomizationByModelCuztomizationUUID(UUID.randomUUID().toString());
Assert.assertNull(vfModuleCustomization);
}
@Test
public void testGetNetworkResourceCustomizationByModelCustomizationUUID() {
- NetworkResourceCustomization networkResourceCustomization = client.getNetworkResourceCustomizationByModelCustomizationUUID("3bdbb104-476c-483e-9f8b-c095b3d308ac");
+ NetworkResourceCustomization networkResourceCustomization = client
+ .getNetworkResourceCustomizationByModelCustomizationUUID("3bdbb104-476c-483e-9f8b-c095b3d308ac");
Assert.assertNotNull(networkResourceCustomization);
Assert.assertNotNull(networkResourceCustomization.getModelCustomizationUUID());
Assert.assertEquals("CONTRAIL30_GNDIRECT 9", networkResourceCustomization.getModelInstanceName());
@@ -233,13 +248,16 @@ public class CatalogDbClientTest {
@Test
public void testGetNetworkResourceCustomizationByModelCustomizationUUIDNotFound() {
- NetworkResourceCustomization networkResourceCustomization = client.getNetworkResourceCustomizationByModelCustomizationUUID(UUID.randomUUID().toString());
+ NetworkResourceCustomization networkResourceCustomization = client
+ .getNetworkResourceCustomizationByModelCustomizationUUID(UUID.randomUUID().toString());
Assert.assertNull(networkResourceCustomization);
}
@Test
public void testGgetVfModuleCustomizationByModelCustomizationUUIDAndVfModuleModelUUID() {
- VfModuleCustomization vfModuleCustomization = client.getVfModuleCustomizationByModelCustomizationUUIDAndVfModuleModelUUID("cb82ffd8-252a-11e7-93ae-92361f002672", "20c4431c-246d-11e7-93ae-92361f002672");
+ VfModuleCustomization vfModuleCustomization = client
+ .getVfModuleCustomizationByModelCustomizationUUIDAndVfModuleModelUUID(
+ "cb82ffd8-252a-11e7-93ae-92361f002672", "20c4431c-246d-11e7-93ae-92361f002672");
Assert.assertNotNull(vfModuleCustomization);
Assert.assertNotNull(vfModuleCustomization.getModelCustomizationUUID());
Assert.assertNotNull(vfModuleCustomization.getVfModule());
@@ -248,29 +266,35 @@ public class CatalogDbClientTest {
@Test
public void testGgetVfModuleCustomizationByModelCustomizationUUIDAndVfModuleModelUUIDNotFound() {
- VfModuleCustomization vfModuleCustomization = client.getVfModuleCustomizationByModelCustomizationUUIDAndVfModuleModelUUID("cb82ffd8-252a-11e7-93ae-92361f002672", UUID.randomUUID().toString());
+ VfModuleCustomization vfModuleCustomization = client
+ .getVfModuleCustomizationByModelCustomizationUUIDAndVfModuleModelUUID(
+ "cb82ffd8-252a-11e7-93ae-92361f002672", UUID.randomUUID().toString());
Assert.assertNull(vfModuleCustomization);
}
@Test
public void testGetFirstByServiceModelUUIDAndAction() {
- ServiceRecipe serviceRecipe = client.getFirstByServiceModelUUIDAndAction("4694a55f-58b3-4f17-92a5-796d6f5ffd0d", "createInstance");
+ ServiceRecipe serviceRecipe = client
+ .getFirstByServiceModelUUIDAndAction("4694a55f-58b3-4f17-92a5-796d6f5ffd0d", "createInstance");
Assert.assertNotNull(serviceRecipe);
Assert.assertNotNull(serviceRecipe.getServiceModelUUID());
Assert.assertNotNull(serviceRecipe.getAction());
- Assert.assertEquals("/mso/async/services/CreateGenericALaCarteServiceInstance", serviceRecipe.getOrchestrationUri());
+ Assert.assertEquals("/mso/async/services/CreateGenericALaCarteServiceInstance",
+ serviceRecipe.getOrchestrationUri());
Assert.assertEquals("MSOTADevInfra aLaCarte", serviceRecipe.getDescription());
}
@Test
public void testGetFirstByServiceModelUUIDAndActionNotFound() {
- ServiceRecipe serviceRecipe = client.getFirstByServiceModelUUIDAndAction("5df8b6de-2083-11e7-93ae-92361f002671", UUID.randomUUID().toString());
+ ServiceRecipe serviceRecipe = client
+ .getFirstByServiceModelUUIDAndAction("5df8b6de-2083-11e7-93ae-92361f002671", UUID.randomUUID().toString());
Assert.assertNull(serviceRecipe);
}
-
+
@Test
public void testGetFirstVnfResourceByModelInvariantUUIDAndModelVersion() {
- VnfResource vnfResource = client.getFirstVnfResourceByModelInvariantUUIDAndModelVersion("2fff5b20-214b-11e7-93ae-92361f002671", "2.0");
+ VnfResource vnfResource = client
+ .getFirstVnfResourceByModelInvariantUUIDAndModelVersion("2fff5b20-214b-11e7-93ae-92361f002671", "2.0");
Assert.assertNotNull(vnfResource);
Assert.assertNotNull(vnfResource.getModelInvariantId());
Assert.assertNotNull(vnfResource.getModelVersion());
@@ -281,7 +305,9 @@ public class CatalogDbClientTest {
@Test
public void testGetFirstVnfResourceByModelInvariantUUIDAndModelVersionNotFound() {
- VnfResource vnfResource = client.getFirstVnfResourceByModelInvariantUUIDAndModelVersion("2fff5b20-214b-11e7-93ae-92361f002671", UUID.randomUUID().toString());
+ VnfResource vnfResource = client
+ .getFirstVnfResourceByModelInvariantUUIDAndModelVersion("2fff5b20-214b-11e7-93ae-92361f002671",
+ UUID.randomUUID().toString());
Assert.assertNull(vnfResource);
}
@@ -289,12 +315,15 @@ public class CatalogDbClientTest {
public void testGetFirstVnfResourceCustomizationByModelInstanceNameAndVnfResources() {
VnfResource vnfr = new VnfResource();
vnfr.setModelUUID("ff2ae348-214a-11e7-93ae-92361f002671");
- VnfResourceCustomization firstVnfResourceCustomizationByModelInstanceNameAndVnfResources = client.getFirstVnfResourceCustomizationByModelInstanceNameAndVnfResources("vSAMP10a 1", vnfr);
+ VnfResourceCustomization firstVnfResourceCustomizationByModelInstanceNameAndVnfResources = client
+ .getFirstVnfResourceCustomizationByModelInstanceNameAndVnfResources("vSAMP10a 1", vnfr);
Assert.assertNotNull(firstVnfResourceCustomizationByModelInstanceNameAndVnfResources);
Assert.assertEquals("vSAMP", firstVnfResourceCustomizationByModelInstanceNameAndVnfResources.getNfRole());
- Assert.assertEquals("vSAMP10a 1", firstVnfResourceCustomizationByModelInstanceNameAndVnfResources.getModelInstanceName());
+ Assert.assertEquals("vSAMP10a 1",
+ firstVnfResourceCustomizationByModelInstanceNameAndVnfResources.getModelInstanceName());
Assert.assertNotNull(firstVnfResourceCustomizationByModelInstanceNameAndVnfResources.getVnfResources());
- Assert.assertNotNull(firstVnfResourceCustomizationByModelInstanceNameAndVnfResources.getVfModuleCustomizations());
+ Assert
+ .assertNotNull(firstVnfResourceCustomizationByModelInstanceNameAndVnfResources.getVfModuleCustomizations());
}
@Test
@@ -315,7 +344,9 @@ public class CatalogDbClientTest {
@Test
public void testGetFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction() {
- VnfComponentsRecipe vnfComponentsRecipe = client.getFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction("20c4431c-246d-11e7-93ae-92361f002671", "volumeGroup", "createInstance");
+ VnfComponentsRecipe vnfComponentsRecipe = client
+ .getFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction(
+ "20c4431c-246d-11e7-93ae-92361f002671", "volumeGroup", "createInstance");
Assert.assertNotNull(vnfComponentsRecipe);
Assert.assertNotNull(vnfComponentsRecipe.getAction());
Assert.assertNotNull(vnfComponentsRecipe.getVfModuleModelUUID());
@@ -328,23 +359,28 @@ public class CatalogDbClientTest {
@Test
public void testGetFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndActionNotFound() {
- VnfComponentsRecipe vnfComponentsRecipe = client.getFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction(UUID.randomUUID().toString(), "volumeGroup", "createInstance");
+ VnfComponentsRecipe vnfComponentsRecipe = client
+ .getFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction(UUID.randomUUID().toString(),
+ "volumeGroup", "createInstance");
Assert.assertNull(vnfComponentsRecipe);
}
@Test
public void testGetFirstVnfComponentsRecipeByVnfComponentTypeAndAction() {
- VnfComponentsRecipe vnfComponentsRecipe = client.getFirstVnfComponentsRecipeByVnfComponentTypeAndAction("volumeGroup", "createInstance");
+ VnfComponentsRecipe vnfComponentsRecipe = client
+ .getFirstVnfComponentsRecipeByVnfComponentTypeAndAction("volumeGroup", "createInstance");
Assert.assertNotNull(vnfComponentsRecipe);
Assert.assertNotNull(vnfComponentsRecipe.getAction());
Assert.assertNotNull(vnfComponentsRecipe.getVnfComponentType());
Assert.assertEquals("VID_DEFAULT recipe t", vnfComponentsRecipe.getDescription());
- Assert.assertEquals("/mso/async/services/CreateVfModuleVolumeInfraV1", vnfComponentsRecipe.getOrchestrationUri());
+ Assert
+ .assertEquals("/mso/async/services/CreateVfModuleVolumeInfraV1", vnfComponentsRecipe.getOrchestrationUri());
}
@Test
public void testGetServiceByModelVersionAndModelInvariantUUID() {
- Service service = client.getServiceByModelVersionAndModelInvariantUUID("2.0", "9647dfc4-2083-11e7-93ae-92361f002671");
+ Service service = client
+ .getServiceByModelVersionAndModelInvariantUUID("2.0", "9647dfc4-2083-11e7-93ae-92361f002671");
Assert.assertNotNull(service);
Assert.assertNotNull(service.getModelVersion());
Assert.assertNotNull(service.getModelInvariantUUID());
@@ -360,7 +396,8 @@ public class CatalogDbClientTest {
@Test
public void testGetVfModuleByModelInvariantUUIDAndModelVersion() {
- VfModule vfModule = client.getVfModuleByModelInvariantUUIDAndModelVersion("78ca26d0-246d-11e7-93ae-92361f002671", "2");
+ VfModule vfModule = client
+ .getVfModuleByModelInvariantUUIDAndModelVersion("78ca26d0-246d-11e7-93ae-92361f002671", "2");
Assert.assertNotNull(vfModule);
Assert.assertNotNull(vfModule.getModelVersion());
Assert.assertNotNull(vfModule.getModelInvariantUUID());
@@ -373,10 +410,11 @@ public class CatalogDbClientTest {
VfModule vfModule = client.getVfModuleByModelInvariantUUIDAndModelVersion(UUID.randomUUID().toString(), "2");
Assert.assertNull(vfModule);
}
-
+
@Test
public void testGetServiceByModelInvariantUUIDOrderByModelVersionDesc() {
- List<Service> serviceList = client.getServiceByModelInvariantUUIDOrderByModelVersionDesc("9647dfc4-2083-11e7-93ae-92361f002671");
+ List<Service> serviceList = client
+ .getServiceByModelInvariantUUIDOrderByModelVersionDesc("9647dfc4-2083-11e7-93ae-92361f002671");
Assert.assertFalse(serviceList.isEmpty());
Assert.assertEquals(2, serviceList.size());
Service service = serviceList.get(0);
@@ -385,22 +423,25 @@ public class CatalogDbClientTest {
@Test
public void testGetServiceByModelInvariantUUIDOrderByModelVersionDescNotFound() {
- List<Service> serviceList = client.getServiceByModelInvariantUUIDOrderByModelVersionDesc(UUID.randomUUID().toString());
+ List<Service> serviceList = client
+ .getServiceByModelInvariantUUIDOrderByModelVersionDesc(UUID.randomUUID().toString());
Assert.assertTrue(serviceList.isEmpty());
}
@Test
public void testGetVfModuleByModelInvariantUUIDOrderByModelVersionDesc() {
- List<VfModule> moduleList = client.getVfModuleByModelInvariantUUIDOrderByModelVersionDesc("78ca26d0-246d-11e7-93ae-92361f002671");
+ List<VfModule> moduleList = client
+ .getVfModuleByModelInvariantUUIDOrderByModelVersionDesc("78ca26d0-246d-11e7-93ae-92361f002671");
Assert.assertFalse(moduleList.isEmpty());
Assert.assertEquals(2, moduleList.size());
VfModule module = moduleList.get(0);
- Assert.assertEquals("vSAMP10a DEV Base",module.getDescription());
+ Assert.assertEquals("vSAMP10a DEV Base", module.getDescription());
}
@Test
public void testPostCloudSite() {
- CatalogDbClientPortChanger localClient = new CatalogDbClientPortChanger("http://localhost:" + client.wiremockPort, msoAdaptersAuth, client.wiremockPort);
+ CatalogDbClientPortChanger localClient = new CatalogDbClientPortChanger(
+ "http://localhost:" + client.wiremockPort, msoAdaptersAuth, client.wiremockPort);
CloudSite cloudSite = new CloudSite();
cloudSite.setId("MTN6");
cloudSite.setClli("TESTCLLI");
@@ -438,60 +479,61 @@ public class CatalogDbClientTest {
@Test
public void testPostHomingInstance() {
- CatalogDbClientPortChanger localClient = new CatalogDbClientPortChanger("http://localhost:" + client.wiremockPort, msoAdaptersAuth, client.wiremockPort);
+ CatalogDbClientPortChanger localClient = new CatalogDbClientPortChanger(
+ "http://localhost:" + client.wiremockPort, msoAdaptersAuth, client.wiremockPort);
HomingInstance homingInstance = new HomingInstance();
homingInstance.setServiceInstanceId("5df8d6be-2083-11e7-93ae-92361f232671");
homingInstance.setCloudOwner("CloudOwner-1");
homingInstance.setCloudRegionId("CloudRegionOne");
homingInstance.setOofDirectives("{\n" +
- "\"directives\": [\n" +
- "{\n" +
- "\"directives\": [\n" +
- "{\n" +
- "\"attributes\": [\n" +
- "{\n" +
- "\"attribute_value\": \"onap.hpa.flavor31\",\n" +
- "\"attribute_name\": \"firewall_flavor_name\"\n" +
- "}\n" +
- "],\n" +
- "\"type\": \"flavor_directives\"\n" +
- "}\n" +
- "],\n" +
- "\"type\": \"vnfc\",\n" +
- "\"id\": \"vfw\"\n" +
- "},\n" +
- "{\n" +
- "\"directives\": [\n" +
- "{\n" +
- "\"attributes\": [\n" +
- "{\n" +
- "\"attribute_value\": \"onap.hpa.flavor32\",\n" +
- "\"attribute_name\": \"packetgen_flavor_name\"\n" +
- "}\n" +
- "],\n" +
- "\"type\": \"flavor_directives\"\n" +
- "}\n" +
- "],\n" +
- "\"type\": \"vnfc\",\n" +
- "\"id\": \"vgenerator\"\n" +
- "},\n" +
- "{\n" +
- "\"directives\": [\n" +
- "{\n" +
- "\"attributes\": [\n" +
- "{\n" +
- "\"attribute_value\": \"onap.hpa.flavor31\",\n" +
- "\"attribute_name\": \"sink_flavor_name\"\n" +
- "}\n" +
- "],\n" +
- "\"type\": \"flavor_directives\"\n" +
- "}\n" +
- "],\n" +
- "\"type\": \"vnfc\",\n" +
- "\"id\": \"vsink\"\n" +
- "}\n" +
- "]\n" +
- "}");
+ "\"directives\": [\n" +
+ "{\n" +
+ "\"directives\": [\n" +
+ "{\n" +
+ "\"attributes\": [\n" +
+ "{\n" +
+ "\"attribute_value\": \"onap.hpa.flavor31\",\n" +
+ "\"attribute_name\": \"firewall_flavor_name\"\n" +
+ "}\n" +
+ "],\n" +
+ "\"type\": \"flavor_directives\"\n" +
+ "}\n" +
+ "],\n" +
+ "\"type\": \"vnfc\",\n" +
+ "\"id\": \"vfw\"\n" +
+ "},\n" +
+ "{\n" +
+ "\"directives\": [\n" +
+ "{\n" +
+ "\"attributes\": [\n" +
+ "{\n" +
+ "\"attribute_value\": \"onap.hpa.flavor32\",\n" +
+ "\"attribute_name\": \"packetgen_flavor_name\"\n" +
+ "}\n" +
+ "],\n" +
+ "\"type\": \"flavor_directives\"\n" +
+ "}\n" +
+ "],\n" +
+ "\"type\": \"vnfc\",\n" +
+ "\"id\": \"vgenerator\"\n" +
+ "},\n" +
+ "{\n" +
+ "\"directives\": [\n" +
+ "{\n" +
+ "\"attributes\": [\n" +
+ "{\n" +
+ "\"attribute_value\": \"onap.hpa.flavor31\",\n" +
+ "\"attribute_name\": \"sink_flavor_name\"\n" +
+ "}\n" +
+ "],\n" +
+ "\"type\": \"flavor_directives\"\n" +
+ "}\n" +
+ "],\n" +
+ "\"type\": \"vnfc\",\n" +
+ "\"id\": \"vsink\"\n" +
+ "}\n" +
+ "]\n" +
+ "}");
localClient.postHomingInstance(homingInstance);
HomingInstance getHomingInstance = this.client.getHomingInstance("5df8d6be-2083-11e7-93ae-92361f232671");
Assert.assertNotNull(getHomingInstance);
@@ -501,7 +543,7 @@ public class CatalogDbClientTest {
Assert.assertEquals("CloudRegionOne", getHomingInstance.getCloudRegionId());
}
- @Test
+ @Test
public void testGetServiceByModelName() {
Service service = client.getServiceByModelName("MSOTADevInfra_Test_Service");
Assert.assertNotNull(service);
@@ -534,39 +576,44 @@ public class CatalogDbClientTest {
}
@Test
- public void testGetNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(){
- NorthBoundRequest northBoundRequest = new NorthBoundRequest();
- northBoundRequest.setAction("createService");
- northBoundRequest.setRequestScope("service");
- northBoundRequest.setIsAlacarte(true);
- northBoundRequest.setCloudOwner("my-custom-cloud-owner");
- client.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner("createService", "service", true, "my-custom-cloud-owner");
- Assert.assertNotNull(northBoundRequest);
- Assert.assertEquals("createService",northBoundRequest.getAction());
- Assert.assertEquals("service",northBoundRequest.getRequestScope());
- Assert.assertEquals(true,northBoundRequest.getIsAlacarte() );
- Assert.assertEquals("my-custom-cloud-owner", northBoundRequest.getCloudOwner());
+ public void testGetNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner() {
+ NorthBoundRequest northBoundRequest = new NorthBoundRequest();
+ northBoundRequest.setAction("createService");
+ northBoundRequest.setRequestScope("service");
+ northBoundRequest.setIsAlacarte(true);
+ northBoundRequest.setCloudOwner("my-custom-cloud-owner");
+ client.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner("createService", "service", true,
+ "my-custom-cloud-owner");
+ Assert.assertNotNull(northBoundRequest);
+ Assert.assertEquals("createService", northBoundRequest.getAction());
+ Assert.assertEquals("service", northBoundRequest.getRequestScope());
+ Assert.assertEquals(true, northBoundRequest.getIsAlacarte());
+ Assert.assertEquals("my-custom-cloud-owner", northBoundRequest.getCloudOwner());
}
-
+
@Test
public void testFindServiceRecipeByActionAndServiceModelUUID() {
- ServiceRecipe serviceRecipe = client.findServiceRecipeByActionAndServiceModelUUID("createInstance","4694a55f-58b3-4f17-92a5-796d6f5ffd0d" );
+ ServiceRecipe serviceRecipe = client
+ .findServiceRecipeByActionAndServiceModelUUID("createInstance", "4694a55f-58b3-4f17-92a5-796d6f5ffd0d");
Assert.assertNotNull(serviceRecipe);
Assert.assertNotNull(serviceRecipe.getServiceModelUUID());
Assert.assertNotNull(serviceRecipe.getAction());
- Assert.assertEquals("/mso/async/services/CreateGenericALaCarteServiceInstance", serviceRecipe.getOrchestrationUri());
+ Assert.assertEquals("/mso/async/services/CreateGenericALaCarteServiceInstance",
+ serviceRecipe.getOrchestrationUri());
Assert.assertEquals("MSOTADevInfra aLaCarte", serviceRecipe.getDescription());
}
@Test
public void testFindServiceRecipeByActionAndServiceModelUUIDNotFound() {
- ServiceRecipe serviceRecipe = client.findServiceRecipeByActionAndServiceModelUUID("not_found","5df8b6de-2083-11e7-93ae-test" );
+ ServiceRecipe serviceRecipe = client
+ .findServiceRecipeByActionAndServiceModelUUID("not_found", "5df8b6de-2083-11e7-93ae-test");
Assert.assertNull(serviceRecipe);
}
@Test
public void testFindExternalToInternalServiceByServiceName() {
- ExternalServiceToInternalService externalServiceToInternalService = client.findExternalToInternalServiceByServiceName("MySpecialServiceName");
+ ExternalServiceToInternalService externalServiceToInternalService = client
+ .findExternalToInternalServiceByServiceName("MySpecialServiceName");
Assert.assertNotNull(externalServiceToInternalService);
Assert.assertNotNull(externalServiceToInternalService.getServiceName());
Assert.assertNotNull(externalServiceToInternalService.getServiceModelUUID());
@@ -575,7 +622,51 @@ public class CatalogDbClientTest {
@Test
public void testFindExternalToInternalServiceByServiceNameNotFound() {
- ExternalServiceToInternalService externalServiceToInternalService = client.findExternalToInternalServiceByServiceName("Not_Found");
+ ExternalServiceToInternalService externalServiceToInternalService = client
+ .findExternalToInternalServiceByServiceName("Not_Found");
Assert.assertNull(externalServiceToInternalService);
}
+
+ @Test
+ public void getPnfResourceByModelUUID_validUuid_expectedOutput() {
+ PnfResource pnfResource = client.getPnfResourceByModelUUID("ff2ae348-214a-11e7-93ae-92361f002680");
+ Assert.assertNotNull(pnfResource);
+ assertEquals("PNFResource modelUUID", "ff2ae348-214a-11e7-93ae-92361f002680", pnfResource.getModelUUID());
+ assertEquals("PNFResource modelInvariantUUID", "2fff5b20-214b-11e7-93ae-92361f002680",
+ pnfResource.getModelInvariantUUID());
+ assertEquals("PNFResource modelVersion", "1.0", pnfResource.getModelVersion());
+ assertEquals("PNFResource orchestration mode", "", pnfResource.getOrchestrationMode());
+ }
+
+ @Test
+ public void getPnfResourceByModelUUID_invalidUuid_NullOutput() {
+ PnfResource pnfResource = client.getPnfResourceByModelUUID(UUID.randomUUID().toString());
+ Assert.assertNull(pnfResource);
+ }
+
+ @Test
+ public void getPnfResourceCustomizationByModelCustomizationUUID_validUuid_expectedOutput() {
+ PnfResourceCustomization pnfResourceCustomization = client
+ .getPnfResourceCustomizationByModelCustomizationUUID("68dc9a92-214c-11e7-93ae-92361f002680");
+ assertEquals("modelInstanceName", "PNF routing", pnfResourceCustomization.getModelInstanceName());
+ assertEquals("blueprintName", "test_configuration_restconf", pnfResourceCustomization.getBlueprintName());
+ assertEquals("blueprintVersion", "1.0.0", pnfResourceCustomization.getBlueprintVersion());
+ PnfResource pnfResource = pnfResourceCustomization.getPnfResources();
+ assertNotNull(pnfResource);
+
+ assertEquals("PNFResource modelUUID", "ff2ae348-214a-11e7-93ae-92361f002680", pnfResource.getModelUUID());
+ assertEquals("PNFResource modelInvariantUUID", "2fff5b20-214b-11e7-93ae-92361f002680",
+ pnfResource.getModelInvariantUUID());
+ assertEquals("PNFResource modelVersion", "1.0", pnfResource.getModelVersion());
+ assertEquals("PNFResource orchestration mode", "", pnfResource.getOrchestrationMode());
+
+ }
+
+ @Test
+ public void getPnfResourceCustomizationByModelCustomizationUUID_invalidUuid_nullOutput() {
+ PnfResourceCustomization pnfResourceCustomization = client
+ .getPnfResourceCustomizationByModelCustomizationUUID(UUID.randomUUID().toString());
+ Assert.assertNull(pnfResourceCustomization);
+ }
+
}
diff --git a/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql b/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql
index 1223080e59..91deab8fff 100644
--- a/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql
+++ b/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql
@@ -293,3 +293,15 @@ VALUES ( '1',
'68dc9a92-214c-11e7-93ae-92361f002671',
'cb82ffd8-252a-11e7-93ae-92361f002671',
'9bcce658-9b37-11e8-98d0-529269fb1459');
+
+insert into service(model_uuid, model_name, model_invariant_uuid, model_version, description, creation_timestamp, tosca_csar_artifact_uuid, service_type, service_role, environment_context, workload_context) values
+('5df8b6de-2083-11e7-93ae-92361f002676', 'PNF_routing_service', '9647dfc4-2083-11e7-93ae-92361f002676', '1.0', 'PNF service', '2019-03-08 12:00:29', null, 'NA', 'NA', 'Luna', 'Oxygen');
+
+insert into pnf_resource(orchestration_mode, description, creation_timestamp, model_uuid, model_invariant_uuid, model_version, model_name, tosca_node_type) values
+('', 'PNF routing', '2019-03-08 12:00:28', 'ff2ae348-214a-11e7-93ae-92361f002680', '2fff5b20-214b-11e7-93ae-92361f002680', '1.0', 'PNF resource', null);
+
+insert into pnf_resource_customization(model_customization_uuid, model_instance_name, nf_type, nf_role, nf_function, nf_naming_code, creation_timestamp, pnf_resource_model_uuid, multi_stage_design, cds_blueprint_name, cds_blueprint_version) values
+('68dc9a92-214c-11e7-93ae-92361f002680', 'PNF routing', 'routing', 'routing', 'routing', 'routing', '2019-03-08 12:00:29', 'ff2ae348-214a-11e7-93ae-92361f002680', null, "test_configuration_restconf", "1.0.0");
+
+insert into pnf_resource_customization_to_service(service_model_uuid, resource_model_customization_uuid) values
+('5df8b6de-2083-11e7-93ae-92361f002676', '68dc9a92-214c-11e7-93ae-92361f002680'); \ No newline at end of file
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java
index 80333d6c7e..d0ffa27027 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java
@@ -126,10 +126,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
String messageId,
MsoRequest msoRequest,
String notificationUrl) {
- String error;
- MsoLogger.setLogContext (msoRequest);
- MsoLogger.setServiceName ("CreateNetworkA");
logger.debug("Async Create Network: {} of type {} in {}/{}", networkName, networkType, cloudSiteId, tenantId);
// Use the synchronous method to perform the actual Create
@@ -252,11 +249,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
String messageId,
MsoRequest msoRequest,
String notificationUrl) {
- String error;
- String serviceName = "UpdateNetworkA";
- MsoLogger.setServiceName (serviceName);
- MsoLogger.setLogContext (msoRequest);
logger.debug("Async Update Network: {} of type {} in {}/{}", networkId, networkType, cloudSiteId, tenantId);
// Use the synchronous method to perform the actual Create
@@ -292,9 +285,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
msoRequest,
subnetIdMap,
networkRollback);
- MsoLogger.setServiceName (serviceName);
} catch (NetworkException e) {
- MsoLogger.setServiceName (serviceName);
logger.debug ("Got a NetworkException on updateNetwork: ", e);
MsoExceptionCategory exCat = null;
String eMsg = null;
@@ -348,11 +339,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
String messageId,
MsoRequest msoRequest,
String notificationUrl) {
- String error;
- MsoLogger.setLogContext (msoRequest);
- String serviceName = "QueryNetworkA";
- MsoLogger.setServiceName (serviceName);
logger.debug("Async Query Network {} in {}/{}", networkNameOrId, cloudSiteId, tenantId);
String errorCreateNetworkMessage = "{} {} Error sending createNetwork notification {} ";
@@ -378,9 +365,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
status,
vlans,
subnetIdMap);
- MsoLogger.setServiceName (serviceName);
} catch (NetworkException e) {
- MsoLogger.setServiceName (serviceName);
logger.debug (NETWORK_EXCEPTION_MSG, e);
MsoExceptionCategory exCat = null;
String eMsg = null;
@@ -450,10 +435,8 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
String messageId,
MsoRequest msoRequest,
String notificationUrl) {
- String error;
- MsoLogger.setLogContext (msoRequest);
+
String serviceName = "DeleteNetworkA";
- MsoLogger.setServiceName (serviceName);
logger.debug("Async Delete Network {} in {}/{}", networkId, cloudSiteId, tenantId);
// Use the synchronous method to perform the actual Create
@@ -464,9 +447,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
try {
networkAdapter.deleteNetwork (cloudSiteId, tenantId, networkType, modelCustomizationUuid, networkId, msoRequest, networkDeleted);
- MsoLogger.setServiceName (serviceName);
} catch (NetworkException e) {
- MsoLogger.setServiceName (serviceName);
logger.debug (NETWORK_EXCEPTION_MSG, e);
MsoExceptionCategory exCat = null;
String eMsg = null;
@@ -513,9 +494,6 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
*/
@Override
public void rollbackNetworkA (NetworkRollback rollback, String messageId, String notificationUrl) {
- String error;
- String serviceName = "RollbackNetworkA";
- MsoLogger.setServiceName (serviceName);
// rollback may be null (e.g. if network already existed when Create was called)
if (rollback == null) {
logger.warn("{} {} Rollback is null", MessageEnum.RA_ROLLBACK_NULL,
@@ -523,16 +501,13 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
return;
}
- MsoLogger.setLogContext (rollback.getMsoRequest ());
logger.info("{} {}", MessageEnum.RA_ASYNC_ROLLBACK, rollback.getNetworkStackId());
// Use the synchronous method to perform the actual Create
try {
networkAdapter.rollbackNetwork (rollback);
- MsoLogger.setServiceName (serviceName);
} catch (NetworkException e) {
- MsoLogger.setServiceName (serviceName);
logger.debug ("Got a NetworkException on rollbackNetwork: ", e);
// Build and send Asynchronous error response
MsoExceptionCategory exCat = null;
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 79966577f8..fc2fc4844b 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
@@ -266,9 +266,6 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
Holder <String> networkFqdn,
Holder <Map <String, String>> subnetIdMap,
Holder <NetworkRollback> rollback) throws NetworkException {
- MsoLogger.setLogContext (msoRequest);
- MsoLogger.setServiceName (CREATE_NETWORK_CONTEXT);
-
logger.debug("*** CREATE Network: {} of type {} in {}/{}", networkName, networkType, cloudSiteId, tenantId);
// Will capture execution time for metrics
@@ -714,8 +711,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
MsoRequest msoRequest,
Holder <Map <String, String>> subnetIdMap,
Holder <NetworkRollback> rollback) throws NetworkException {
- MsoLogger.setLogContext (msoRequest);
- MsoLogger.setServiceName (UPDATE_NETWORK_CONTEXT);
+
logger.debug("***UPDATE Network adapter with Network: {} of type {} in {}/{}", networkName, networkType,
cloudSiteId, tenantId);
@@ -1150,8 +1146,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
Holder <List <Integer>> vlans,
Holder <List <RouteTarget>> routeTargets,
Holder <Map <String, String>> subnetIdMap) throws NetworkException {
- MsoLogger.setLogContext (msoRequest);
- MsoLogger.setServiceName ("QueryNetwork");
+
logger.debug("*** QUERY Network with Network: {} in {}/{}", networkNameOrId, cloudSiteId, tenantId);
// Will capture execution time for metrics
@@ -1289,8 +1284,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
String networkId,
MsoRequest msoRequest,
Holder <Boolean> networkDeleted) throws NetworkException {
- MsoLogger.setLogContext (msoRequest);
- MsoLogger.setServiceName ("DeleteNetwork");
+
logger.debug("*** DELETE Network adapter with Network: {} in {}/{}", networkId, cloudSiteId, tenantId);
// Will capture execution time for metrics
@@ -1382,7 +1376,6 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
*/
@Override
public void rollbackNetwork (NetworkRollback rollback) throws NetworkException {
- MsoLogger.setServiceName ("RollbackNetwork");
// Will capture execution time for metrics
long startTime = System.currentTimeMillis ();
@@ -1392,8 +1385,6 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
return;
}
- MsoLogger.setLogContext (rollback.getMsoRequest());
-
// Get the elements of the VnfRollback object for easier access
String cloudSiteId = rollback.getCloudId ();
String tenantId = rollback.getTenantId ();
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/MsoTenantAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/MsoTenantAdapterImpl.java
index db9226bb19..f46a95df91 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/MsoTenantAdapterImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/MsoTenantAdapterImpl.java
@@ -88,8 +88,6 @@ public class MsoTenantAdapterImpl implements MsoTenantAdapter {
MsoRequest msoRequest,
Holder <String> tenantId,
Holder <TenantRollback> rollback) throws TenantException {
- MsoLogger.setLogContext (msoRequest);
- MsoLogger.setServiceName (CREATE_TENANT);
logger.debug("Call to MSO createTenant adapter. Creating Tenant: {} in {}", tenantName, cloudSiteId);
@@ -153,8 +151,7 @@ public class MsoTenantAdapterImpl implements MsoTenantAdapter {
Holder <String> tenantId,
Holder <String> tenantName,
Holder <Map <String, String>> metadata) throws TenantException {
- MsoLogger.setLogContext (msoRequest);
- MsoLogger.setServiceName (QUERY_TENANT);
+
logger.debug ("Querying Tenant {} in {}", tenantNameOrId, cloudSiteId);
MsoTenantUtils tUtils;
@@ -198,8 +195,6 @@ public class MsoTenantAdapterImpl implements MsoTenantAdapter {
String tenantId,
MsoRequest msoRequest,
Holder <Boolean> tenantDeleted) throws TenantException {
- MsoLogger.setLogContext (msoRequest);
- MsoLogger.setServiceName (DELETE_TENANT);
logger.debug ("Deleting Tenant {} in {}", tenantId, cloudSiteId);
@@ -230,7 +225,6 @@ public class MsoTenantAdapterImpl implements MsoTenantAdapter {
*/
@Override
public void rollbackTenant (TenantRollback rollback) throws TenantException {
- MsoLogger.setServiceName (ROLLBACK_TENANT);
// rollback may be null (e.g. if stack already existed when Create was called)
if (rollback == null) {
logger.warn("{} {} rollbackTenant, rollback is null", MessageEnum.RA_ROLLBACK_NULL,
@@ -242,7 +236,6 @@ public class MsoTenantAdapterImpl implements MsoTenantAdapter {
String cloudSiteId = rollback.getCloudId ();
String tenantId = rollback.getTenantId ();
- MsoLogger.setLogContext (rollback.getMsoRequest ());
logger.debug("Rolling Back Tenant {} in {}", rollback.getTenantId(), cloudSiteId);
if (rollback.getTenantCreated ()) {
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java
index 2c9d3776a7..cf52280b3f 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java
@@ -132,10 +132,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
String messageId,
MsoRequest msoRequest,
String notificationUrl) {
- String error;
- String serviceName = "CreateVnfA";
- MsoLogger.setLogContext (msoRequest);
- MsoLogger.setServiceName (serviceName);
+
logger.info("{} createVnfA", MessageEnum.RA_ASYNC_CREATE_VNF);
// Use the synchronous method to perform the actual Create
MsoVnfAdapter vnfAdapter = vnfImpl;
@@ -160,9 +157,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
vnfId,
outputs,
vnfRollback);
- MsoLogger.setServiceName (serviceName);
} catch (VnfException e) {
- MsoLogger.setServiceName (serviceName);
logger.error("{} {} VnfException in createVnfA ", MessageEnum.RA_CREATE_VNF_ERR,
MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e);
org.onap.so.adapters.vnf.async.client.MsoExceptionCategory exCat = null;
@@ -218,10 +213,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
String messageId,
MsoRequest msoRequest,
String notificationUrl) {
- String error;
- String serviceName = "UpdateVnfA";
- MsoLogger.setServiceName (serviceName);
- MsoLogger.setLogContext (msoRequest);
+
logger.info("{} UpdateVnfA", MessageEnum.RA_ASYNC_UPDATE_VNF);
// Use the synchronous method to perform the actual Create
@@ -234,9 +226,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
try {
vnfAdapter.updateVnf (cloudSiteId, tenantId, vnfType,vnfVersion, vnfName, requestType, volumeGroupHeatStackId, inputs, msoRequest, outputs, vnfRollback);
- MsoLogger.setServiceName (serviceName);
} catch (VnfException e) {
- MsoLogger.setServiceName (serviceName);
logger.error("{} {} Exception sending updateVnf notification ", MessageEnum.RA_UPDATE_VNF_ERR,
MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e);
org.onap.so.adapters.vnf.async.client.MsoExceptionCategory exCat = null;
@@ -299,10 +289,8 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
String messageId,
MsoRequest msoRequest,
String notificationUrl) {
- String error;
+
String serviceName = "QueryVnfA";
- MsoLogger.setServiceName (serviceName);
- MsoLogger.setLogContext (msoRequest);
logger.info("{}", MessageEnum.RA_ASYNC_QUERY_VNF);
// Use the synchronous method to perform the actual query
@@ -316,9 +304,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
try {
vnfAdapter.queryVnf (cloudSiteId, tenantId, vnfName, msoRequest, vnfExists, vnfId, status, outputs);
- MsoLogger.setServiceName (serviceName);
} catch (VnfException e) {
- MsoLogger.setServiceName (serviceName);
logger.error("{} {} Exception sending queryVnfA notification ", MessageEnum.RA_QUERY_VNF_ERR,
MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e);
org.onap.so.adapters.vnf.async.client.MsoExceptionCategory exCat = null;
@@ -389,10 +375,8 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
String messageId,
MsoRequest msoRequest,
String notificationUrl) {
- String error;
+
String serviceName = "DeleteVnfA";
- MsoLogger.setServiceName (serviceName);
- MsoLogger.setLogContext (msoRequest);
logger.info("{}", MessageEnum.RA_ASYNC_DELETE_VNF);
// Use the synchronous method to perform the actual delete
@@ -400,9 +384,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
try {
vnfAdapter.deleteVnf (cloudSiteId, tenantId, vnfName, msoRequest);
- MsoLogger.setServiceName (serviceName);
} catch (VnfException e) {
- MsoLogger.setServiceName (serviceName);
logger.error("{} {} Exception sending deleteVnfA notification ", MessageEnum.RA_DELETE_VNF_ERR,
MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e);
org.onap.so.adapters.vnf.async.client.MsoExceptionCategory exCat = null;
@@ -451,16 +433,12 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
*/
@Override
public void rollbackVnfA (VnfRollback rollback, String messageId, String notificationUrl) {
- String serviceName = "RollbackVnfA";
- MsoLogger.setServiceName (serviceName);
- String error;
// rollback may be null (e.g. if stack already existed when Create was called)
if (rollback == null) {
logger.info("{} rollbackVnfA: Empty Rollback: No action to perform", MessageEnum.RA_ROLLBACK_NULL);
return;
}
- MsoLogger.setLogContext (rollback.getMsoRequest ());
logger.info("{} rollbackVnfA", MessageEnum.RA_ASYNC_ROLLBACK_VNF);
// Use the synchronous method to perform the actual rollback
@@ -468,9 +446,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
try {
vnfAdapter.rollbackVnf (rollback);
- MsoLogger.setServiceName (serviceName);
} catch (VnfException e) {
- MsoLogger.setServiceName (serviceName);
logger.error("{} {} Exception sending rollbackVnfA notification ", MessageEnum.RA_ROLLBACK_VNF_ERR,
MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e);
org.onap.so.adapters.vnf.async.client.MsoExceptionCategory exCat = null;
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 ce060abee8..4d915f9e84 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
@@ -275,7 +275,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
Holder <VnfRollback> rollback) throws VnfException {
// As of 1707 - this method should no longer be called
MsoLogger.setLogContext (msoRequest.getRequestId (), msoRequest.getServiceInstanceId ());
- MsoLogger.setServiceName ("UpdateVnf");
logger.debug("UpdateVnf called?? This should not be called any longer - update vfModule");
}
@@ -303,8 +302,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
Holder <String> vnfId,
Holder <VnfStatus> status,
Holder <Map <String, String>> outputs) throws VnfException {
- MsoLogger.setLogContext (msoRequest);
- MsoLogger.setServiceName ("QueryVnf");
+
logger.debug("Querying VNF {} in {}", vnfName, cloudSiteId + "/" + tenantId);
// Will capture execution time for metrics
@@ -363,8 +361,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
String tenantId,
String vnfName,
MsoRequest msoRequest) throws VnfException {
- MsoLogger.setLogContext (msoRequest);
- MsoLogger.setServiceName ("DeleteVnf");
+
logger.debug("Deleting VNF {} in {}", vnfName, cloudSiteId + "/" + tenantId);
// Will capture execution time for metrics
long startTime = System.currentTimeMillis ();
@@ -401,7 +398,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
@Override
public void rollbackVnf (VnfRollback rollback) throws VnfException {
long startTime = System.currentTimeMillis ();
- MsoLogger.setServiceName ("RollbackVnf");
// rollback may be null (e.g. if stack already existed when Create was called)
if (rollback == null) {
logger.info(MessageEnum.RA_ROLLBACK_NULL.toString(), "OpenStack", "rollbackVnf");
@@ -413,15 +409,12 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
String tenantId = rollback.getTenantId ();
String vnfId = rollback.getVnfId ();
- MsoLogger.setLogContext (rollback.getMsoRequest());
-
logger.debug("Rolling Back VNF {} in {}", vnfId, cloudSiteId + "/" + tenantId);
// Use the MsoHeatUtils to delete the stack. Set the polling flag to true.
// The possible outcomes of deleteStack are a StackInfo object with status
// of NOTFOUND (on success) or FAILED (on error). Also, MsoOpenstackException
// could be thrown.
- long subStartTime = System.currentTimeMillis ();
try {
heat.deleteStack (tenantId, cloudSiteId, vnfId, true);
} catch (MsoException me) {
@@ -604,8 +597,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
useMCUuid = true;
}
}
- MsoLogger.setLogContext (msoRequest);
- MsoLogger.setServiceName ("CreateVfModule");
+
String requestTypeString = "";
if (requestType != null && !"".equals(requestType)) {
requestTypeString = requestType;
@@ -1377,7 +1369,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
String methodName = "updateVfModule";
MsoLogger.setLogContext (msoRequest.getRequestId (), msoRequest.getServiceInstanceId ());
String serviceName = VNF_ADAPTER_SERVICE_NAME + methodName;
- MsoLogger.setServiceName (serviceName);
StringBuilder sbInit = new StringBuilder();
sbInit.append("updateVfModule: \n");
@@ -1505,7 +1496,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
throw new VnfException (me);
}
if (nestedHeatStack == null || nestedHeatStack.getStatus() == HeatStatus.NOTFOUND) {
- MsoLogger.setServiceName (serviceName);
String error = "Update VFModule: Attached volume heatStack ID DOES NOT EXIST " + nestedStackId + " in " + cloudSiteId + "/" + tenantId + " USER ERROR" ;
logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudSiteId,
tenantId, error, "OpenStack", "QueryStack", MsoLogger.ErrorCode.DataError.getValue(), error);
@@ -1538,7 +1528,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
throw new VnfException (me);
}
if (nestedBaseHeatStack == null || nestedBaseHeatStack.getStatus() == HeatStatus.NOTFOUND) {
- MsoLogger.setServiceName (serviceName);
String error = "Update VFModule: Attached base heatStack ID DOES NOT EXIST " + nestedBaseStackId + " in " + cloudSiteId + "/" + tenantId + " USER ERROR" ;
logger.error ("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName,
cloudSiteId, tenantId, error, "OpenStack",
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java
index b0601e9264..833e200ce9 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java
@@ -206,8 +206,6 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
Holder <Map <String, String>> outputs)
throws VnfException
{
- MsoLogger.setLogContext (msoRequest);
- MsoLogger.setServiceName ("QueryVnfCloudify");
logger.debug ("Querying VNF {} in {}", vnfName, cloudSiteId + "/" + tenantId);
// Will capture execution time for metrics
@@ -265,8 +263,6 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
String tenantId,
String vnfName,
MsoRequest msoRequest) throws VnfException {
- MsoLogger.setLogContext (msoRequest);
- MsoLogger.setServiceName ("DeleteVnf");
// This operation is no longer supported at the VNF level. The adapter is only called to deploy modules.
logger.debug("DeleteVNF command attempted but not supported");
@@ -285,11 +281,9 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
@Override
public void rollbackVnf (VnfRollback rollback) throws VnfException {
long startTime = System.currentTimeMillis ();
- MsoLogger.setServiceName ("RollbackVnf");
// rollback may be null (e.g. if stack already existed when Create was called)
if (rollback == null) {
- logger.info ("{} {} {} {}", MessageEnum.RA_ROLLBACK_NULL.toString(), "OpenStack", "rollbackVnf", MsoLogger
- .getServiceName());
+ logger.info ("{} {} {}", MessageEnum.RA_ROLLBACK_NULL.toString(), "OpenStack", "rollbackVnf");
return;
}
@@ -303,8 +297,6 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
String tenantId = rollback.getTenantId ();
String vfModuleId = rollback.getVfModuleStackId ();
- MsoLogger.setLogContext (rollback.getMsoRequest());
-
logger.debug("Rolling Back VF Module {} in {}", vfModuleId, cloudSiteId + "/" + tenantId);
DeploymentInfo deployment = null;
@@ -579,9 +571,6 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
// Will capture execution time for metrics
long startTime = System.currentTimeMillis ();
- MsoLogger.setLogContext (msoRequest);
- MsoLogger.setServiceName ("CreateVfModule");
-
// Require a model customization ID. Every VF Module definition must have one.
if (modelCustomizationUuid == null || modelCustomizationUuid.isEmpty()) {
logger.debug("Missing required input: modelCustomizationUuid");
@@ -1183,8 +1172,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
String vnfName,
MsoRequest msoRequest,
Holder <Map <String, String>> outputs) throws VnfException {
- MsoLogger.setLogContext (msoRequest);
- MsoLogger.setServiceName ("DeleteVf");
+
logger.debug ("Deleting VF " + vnfName + " in " + cloudSiteId + "/" + tenantId);
// Will capture execution time for metrics
long startTime = System.currentTimeMillis ();
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java
index cb1e350774..b1b97b695e 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java
@@ -225,8 +225,6 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
Holder <Map <String, String>> outputs)
throws VnfException
{
- MsoLogger.setLogContext (msoRequest);
- MsoLogger.setServiceName ("QueryVnf");
logger.debug("Querying VNF " + vnfNameOrId + " in " + cloudSiteId + "/" + tenantId);
// Will capture execution time for metrics
@@ -282,8 +280,6 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
String tenantId,
String vnfName,
MsoRequest msoRequest) throws VnfException {
- MsoLogger.setLogContext (msoRequest);
- MsoLogger.setServiceName ("DeleteVnf");
// This operation is no longer supported at the VNF level. The adapter is only called to deploy modules.
logger.debug("DeleteVNF command attempted but not supported");
@@ -302,11 +298,9 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
@Override
public void rollbackVnf (VnfRollback rollback) throws VnfException {
long startTime = System.currentTimeMillis ();
- MsoLogger.setServiceName ("RollbackVnf");
// rollback may be null (e.g. if stack already existed when Create was called)
if (rollback == null) {
- logger.info("{} {} {} {}", MessageEnum.RA_ROLLBACK_NULL.toString(), "OpenStack", "rollbackVnf",
- MsoLogger.getServiceName());
+ logger.info("{} {} {}", MessageEnum.RA_ROLLBACK_NULL.toString(), "OpenStack", "rollbackVnf");
return;
}
@@ -322,8 +316,6 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
String vfModuleId = rollback.getVfModuleStackId ();
- MsoLogger.setLogContext (rollback.getMsoRequest());
-
logger.debug("Rolling Back VF Module " + vfModuleId + " in " + cloudSiteId + "/" + tenantId);
VduInstance vduInstance = null;
@@ -621,9 +613,6 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
// Will capture execution time for metrics
long startTime = System.currentTimeMillis ();
- MsoLogger.setLogContext (msoRequest);
- MsoLogger.setServiceName ("CreateVfModule");
-
// Require a model customization ID. Every VF Module definition must have one.
if (modelCustomizationUuid == null || modelCustomizationUuid.isEmpty()) {
logger.debug("Missing required input: modelCustomizationUuid");
@@ -1169,8 +1158,6 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
MsoRequest msoRequest,
Holder <Map <String, String>> outputs) throws VnfException
{
- MsoLogger.setLogContext (msoRequest);
- MsoLogger.setServiceName ("DeleteVfModule");
logger.debug("Deleting VF Module " + vfModuleId + " in " + cloudSiteId + "/" + tenantId);
// Will capture execution time for metrics
diff --git a/adapters/mso-openstack-adapters/src/test/resources/schema.sql b/adapters/mso-openstack-adapters/src/test/resources/schema.sql
index e9f2a09860..ac08f8b645 100644
--- a/adapters/mso-openstack-adapters/src/test/resources/schema.sql
+++ b/adapters/mso-openstack-adapters/src/test/resources/schema.sql
@@ -384,6 +384,8 @@ create table `vnf_resource_customization` (
`vnf_resource_model_uuid` varchar(200) not null,
`multi_stage_design` varchar(20) default null,
`resource_input` varchar(20000) default null,
+ `cds_blueprint_name` varchar(200),
+ `cds_blueprint_version` varchar(200),
primary key (`model_customization_uuid`),
key `fk_vnf_resource_customization__vnf_resource1_idx` (`vnf_resource_model_uuid`),
constraint `fk_vnf_resource_customization__vnf_resource1` foreign key (`vnf_resource_model_uuid`) references `vnf_resource` (`model_uuid`) on delete cascade on update cascade
diff --git a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/client/RequestsDbClientTest.java b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/client/RequestsDbClientTest.java
index efb5932e51..304b025bf8 100644
--- a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/client/RequestsDbClientTest.java
+++ b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/client/RequestsDbClientTest.java
@@ -218,11 +218,17 @@ public class RequestsDbClientTest {
}
@Test
- public void findOneByOperationalEnvIdAndServiceModelVersionIdTest(){
- OperationalEnvServiceModelStatus operationalEnvServiceModelStatus =requestsDbClient.findOneByOperationalEnvIdAndServiceModelVersionId("1234","TEST1234");
+ public void findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestIdTest(){
+ OperationalEnvServiceModelStatus operationalEnvServiceModelStatus =requestsDbClient.findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestId("1234","TEST1234", "00032ab7-3fb3-42e5-965d-8ea592502017");
assertNotNull(operationalEnvServiceModelStatus);
assertEquals("1234",operationalEnvServiceModelStatus.getOperationalEnvId());
assertEquals("TEST1234",operationalEnvServiceModelStatus.getServiceModelVersionId());
+
+ OperationalEnvServiceModelStatus operationalEnvServiceModelStatus1 =requestsDbClient.findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestId("1234","TEST1235", "00032ab7-3fb3-42e5-965d-8ea592502018");
+ assertNotNull(operationalEnvServiceModelStatus1);
+ assertEquals("00032ab7-3fb3-42e5-965d-8ea592502018",operationalEnvServiceModelStatus1.getRequestId());
+ assertEquals("1234",operationalEnvServiceModelStatus1.getOperationalEnvId());
+ assertEquals("TEST1235",operationalEnvServiceModelStatus1.getServiceModelVersionId());
}
@Test
@@ -238,5 +244,7 @@ public class RequestsDbClientTest {
OperationalEnvDistributionStatus operationalEnvDistributionStatus =requestsDbClient.getDistributionStatusById("111");
assertNotNull(operationalEnvDistributionStatus);
assertEquals("111",operationalEnvDistributionStatus.getDistributionId());
+ assertEquals("ERROR",operationalEnvDistributionStatus.getDistributionIdErrorReason());
+ assertEquals("00032ab7-3fb3-42e5-965d-8ea592502017",operationalEnvDistributionStatus.getRequestId());
}
}
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 de1ae85cc6..48d589592f 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
@@ -43,6 +43,9 @@ VALUES
INSERT INTO activate_operational_env_service_model_distribution_status (OPERATIONAL_ENV_ID, SERVICE_MODEL_VERSION_ID, REQUEST_ID,SERVICE_MOD_VER_FINAL_DISTR_STATUS,RECOVERY_ACTION,RETRY_COUNT_LEFT,WORKLOAD_CONTEXT, CREATE_TIME, MODIFY_TIME)
VALUES
('1234', 'TEST1235', '00032ab7-3fb3-42e5-965d-8ea592502017', "Test", "Test", 2, 'DEFAULT', '2018-08-14 16:50:59', '2018-08-14 16:50:59');
+INSERT INTO activate_operational_env_service_model_distribution_status (OPERATIONAL_ENV_ID, SERVICE_MODEL_VERSION_ID, REQUEST_ID,SERVICE_MOD_VER_FINAL_DISTR_STATUS,RECOVERY_ACTION,RETRY_COUNT_LEFT,WORKLOAD_CONTEXT, CREATE_TIME, MODIFY_TIME)
+VALUES
+('1234', 'TEST1235', '00032ab7-3fb3-42e5-965d-8ea592502018', "Test", "Test", 2, 'DEFAULT', '2018-08-14 16:50:59', '2018-08-14 16:50:59');
INSERT INTO `activate_operational_env_per_distributionid_status` (`DISTRIBUTION_ID`, `DISTRIBUTION_ID_STATUS`, `DISTRIBUTION_ID_ERROR_REASON`, `CREATE_TIME`, `MODIFY_TIME`, `OPERATIONAL_ENV_ID`, `SERVICE_MODEL_VERSION_ID`, `REQUEST_ID`)
VALUES
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java
index 62233273b1..d0973d3c44 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java
@@ -66,7 +66,6 @@ public class SDNCServiceRequestTask {
public void runRequest(SDNCServiceRequest request,String msoRequestId,String msoServiceInstanceId,String myUrlSuffix)
{
MsoLogger.setLogContext(msoRequestId, msoServiceInstanceId);
- MsoLogger.setServiceName(getClass().getSimpleName());
String sdncRequestId = request.getSdncRequestId();
String sdncService = request.getSdncService();
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/pom.xml b/adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/pom.xml
new file mode 100644
index 0000000000..56d425745f
--- /dev/null
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/pom.xml
@@ -0,0 +1,104 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.onap.so.adapters</groupId>
+ <artifactId>mso-vnfm-adapter</artifactId>
+ <version>1.4.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>mso-vnfm-adapter-api</artifactId>
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+ <gson-fire-version>1.8.2</gson-fire-version>
+ <retrofit-version>2.3.0</retrofit-version>
+ <threetenbp-version>1.3.5</threetenbp-version>
+ <oltu-version>1.0.1</oltu-version>
+ <swagger-core-version>1.5.15</swagger-core-version>
+ </properties>
+ <name>mso-vnfm-adapter-api</name>
+ <description>MSO VNFM adapter API</description>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>io.swagger</groupId>
+ <artifactId>swagger-codegen-maven-plugin</artifactId>
+ <version>2.3.1</version>
+ <executions>
+ <execution>
+ <id>vnfmadapter</id>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ <configuration>
+ <inputSpec>${basedir}/src/main/resources/vnfmadapter.yaml</inputSpec>
+ <language>java</language>
+ <library>retrofit2</library>
+ <output>${project.build.directory}/generated-sources/vnfmadapter</output>
+ <apiPackage>org.onap.vnfmadapter.v1.api</apiPackage>
+ <modelPackage>org.onap.vnfmadapter.v1.model</modelPackage>
+ <configOptions>
+ <jackson>true</jackson>
+ <sourceFolder>src/gen/java/main</sourceFolder>
+ <withXml>true</withXml>
+ <useRxJava2>true</useRxJava2>
+ </configOptions>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>io.swagger</groupId>
+ <artifactId>swagger-annotations</artifactId>
+ <version>${swagger-core-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.squareup.retrofit2</groupId>
+ <artifactId>converter-gson</artifactId>
+ <version>${retrofit-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.squareup.retrofit2</groupId>
+ <artifactId>retrofit</artifactId>
+ <version>${retrofit-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.squareup.retrofit2</groupId>
+ <artifactId>converter-scalars</artifactId>
+ <version>${retrofit-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.oltu.oauth2</groupId>
+ <artifactId>org.apache.oltu.oauth2.client</artifactId>
+ <version>${oltu-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>io.gsonfire</groupId>
+ <artifactId>gson-fire</artifactId>
+ <version>${gson-fire-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.threeten</groupId>
+ <artifactId>threetenbp</artifactId>
+ <version>${threetenbp-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>io.reactivex.rxjava2</groupId>
+ <artifactId>rxjava</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.squareup.retrofit2</groupId>
+ <artifactId>adapter-rxjava2</artifactId>
+ <version>${retrofit-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.google.code.gson</groupId>
+ <artifactId>gson</artifactId>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/src/main/resources/vnfmadapter.yaml b/adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/src/main/resources/vnfmadapter.yaml
new file mode 100644
index 0000000000..dc5f85e5fe
--- /dev/null
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/src/main/resources/vnfmadapter.yaml
@@ -0,0 +1,522 @@
+swagger: '2.0'
+info:
+ version: 1.0.0
+ title: ONAP SO VNFM Adapter API
+ description: >-
+ Describes the API between SO (Service Orchestrator) and the adapter for VNFM
+ (Virtual Network Function Manager)
+basePath: /so/vnfm-adapter/v1
+schemes:
+ - http
+ - https
+consumes:
+ - application/json
+produces:
+ - application/json
+paths:
+ '/vnfs/{vnfId}':
+ post:
+ tags:
+ - SO VNFM Adapter
+ summary: VNF create
+ description: Create a VNF instance using a VNFM.
+ operationId: vnf_create
+ consumes:
+ - application/json
+ parameters:
+ - required: true
+ type: string
+ description: >-
+ The identifier of the VNF. This must be the vnf-id of an existing
+ generic-vnf in AAI.
+ name: vnfId
+ in: path
+ - in: body
+ name: body
+ description: VNF creation parameters
+ required: true
+ schema:
+ $ref: '#/definitions/CreateVnfRequest'
+ - name: X-ONAP-RequestID
+ description: >-
+ Used to track REST requests for logging purposes. Identifies a
+ single top level invocation of ONAP
+ in: header
+ required: true
+ type: string
+ - name: X-InvocationID
+ description: >-
+ Used to track REST requests for logging purposes. Identifies a
+ single invocation of a single component
+ in: header
+ required: true
+ type: string
+ responses:
+ '202':
+ description: >-
+ The request was accepted for processing, but the processing has not
+ been completed.
+ schema:
+ $ref: '#/definitions/CreateVnfResponse'
+ '400':
+ description: >-
+ An error occurred in the VNFM adapter relating to the given input,
+ for example, if the definition of the given VNF in AAI does not
+ included required information.
+ '404':
+ description: A VNF with the specified ID was not found in AAI.
+ '500':
+ description: >-
+ An error occurred in the VNFM adapter not relating to the given
+ input, or an error is received from the VNFM.
+ delete:
+ tags:
+ - SO VNFM Adapter
+ summary: VNF delete
+ description: Delete an instance of a VNF using a VNFM.
+ operationId: vnf_delete
+ consumes:
+ - application/json
+ parameters:
+ - required: true
+ type: string
+ description: >-
+ The identifier of the VNF. This must be the vnf-id of an existing
+ generic-vnf in AAI
+ name: vnfId
+ in: path
+ - name: X-ONAP-RequestID
+ description: >-
+ Used to track REST requests for logging purposes. Identifies a
+ single top level invocation of ONAP
+ in: header
+ required: true
+ type: string
+ - name: X-InvocationID
+ description: >-
+ Used to track REST requests for logging purposes. Identifies a
+ single invocation of a single component
+ in: header
+ required: true
+ type: string
+ responses:
+ '202':
+ description: >-
+ The request was accepted for processing, but the processing has not
+ been completed.
+ schema:
+ $ref: '#/definitions/DeleteVnfResponse'
+ '400':
+ description: >-
+ An error occurred in the VNFM adapter relating to the given input,
+ for example, if the definition of the given VNF in AAI does not
+ included required information.
+ '404':
+ description: A VNF with the specified ID was not found in AAI.
+ '500':
+ description: >-
+ An error occurred in the VNFM adapter not relating to the given
+ input, or an error is received from the VNFM.
+ '/jobs/{jobId}':
+ get:
+ tags:
+ - SO VNFM Adapter
+ summary: Job query
+ description: Query the status of a job.
+ operationId: job_query
+ consumes:
+ - application/json
+ produces:
+ - application/json
+ parameters:
+ - required: true
+ type: string
+ description: The identifier of the Job.
+ name: jobId
+ in: path
+ - name: X-ONAP-RequestID
+ description: >-
+ Used to track REST requests for logging purposes. Identifies a
+ single top level invocation of ONAP
+ in: header
+ required: true
+ type: string
+ - name: X-InvocationID
+ description: >-
+ Used to track REST requests for logging purposes. Identifies a
+ single invocation of a single component
+ in: header
+ required: true
+ type: string
+ responses:
+ '200':
+ description: ''
+ schema:
+ $ref: '#/definitions/QueryJobResponse'
+ '404':
+ description: A job with the specified ID was not found.
+ '500':
+ description: >-
+ An error occurred in the VNFM adapter not relating to the given
+ input, or an error is received from the VNFM.
+definitions:
+ CreateVnfRequest:
+ type: object
+ properties:
+ name:
+ type: string
+ description: The name to be applied to the VNF.
+ tenant:
+ $ref: '#/definitions/Tenant'
+ additionalParams:
+ type: object
+ description: >-
+ Additional input parameters for the instantiation process, specific to
+ the VNF being instantiated, as declared in the VNFD as part of
+ "InstantiateVnfOpConfig".
+ additionalProperties:
+ type: string
+ externalVirtualLinks:
+ type: array
+ description: Information about external VLs to connect the VNF to.
+ items:
+ $ref: '#/definitions/ExternalVirtualLink'
+ required:
+ - name
+ - tenant
+ Tenant:
+ type: object
+ description: Details of the tenant that VNFs can be deployed into
+ properties:
+ cloudOwner:
+ type: string
+ description: The owner in AAI of the cloud to which the tenant belongs.
+ regionName:
+ type: string
+ description: The regionName in AAI of the cloud to which the tenant belongs.
+ tenantId:
+ type: string
+ description: The identifier of the tenant in the VIM.
+ required:
+ - cloudOwner
+ - regionName
+ - tenantId
+ CreateVnfResponse:
+ type: object
+ properties:
+ jobId:
+ description: The ID of the job which can be used to query the status of the job
+ type: string
+ required:
+ - jobId
+ DeleteVnfResponse:
+ type: object
+ properties:
+ jobId:
+ description: >-
+ The ID of the job which can be used to query the status of the delete
+ job
+ type: string
+ required:
+ - jobId
+ QueryJobResponse:
+ type: object
+ properties:
+ operationStatusRetrievalStatus:
+ $ref: '#/definitions/OperationStatusRetrievalStatusEnum'
+ id:
+ type: string
+ operation:
+ $ref: '#/definitions/OperationEnum'
+ operationState:
+ $ref: '#/definitions/OperationStateEnum'
+ startTime:
+ type: string
+ format: date-time
+ stateEnteredTime:
+ type: string
+ format: date-time
+ vnfInstanceId:
+ type: string
+ required:
+ - operationStatusRetrievalStatus
+ OperationStatusRetrievalStatusEnum:
+ description: The status of the attempt to retrrieve the operation from the VNFM
+ type: string
+ enum:
+ - STATUS_FOUND
+ - WAITING_FOR_STATUS
+ - OPERATION_NOT_FOUND
+ - CANNOT_RETRIEVE_STATUS
+ OperationEnum:
+ description: The operation
+ type: string
+ enum:
+ - INSTANTIATE
+ - SCALE
+ - SCALE_TO_LEVEL
+ - CHANGE_FLAVOUR
+ - TERMINATE
+ - HEAL
+ - OPERATE
+ - CHANGE_EXT_CONN
+ - MODIFY_INFO
+ OperationStateEnum:
+ description: The status of the operation
+ type: string
+ enum:
+ - STARTING
+ - PROCESSING
+ - COMPLETED
+ - FAILED_TEMP
+ - FAILED
+ - ROLLING_BACK
+ - ROLLED_BACK
+ ExternalVirtualLink:
+ description: |
+ This type represents an external VL.
+ type: object
+ required:
+ - id
+ - resourceId
+ - extCps
+ properties:
+ id:
+ description: |
+ An identifier with the intention of being globally unique.
+ type: string
+ tenant:
+ $ref: '#/definitions/Tenant'
+ resourceId:
+ description: |
+ An identifier maintained by the VIM.
+ type: string
+ extCps:
+ description: |
+ External CPs of the VNF to be connected to this external VL.
+ type: array
+ items:
+ description: >
+ This type represents configuration information for external CPs
+ created from a CPD.
+ type: object
+ required:
+ - cpdId
+ properties:
+ cpdId:
+ description: |
+ An identifier that is unique within a VNF descriptor.
+ type: string
+ cpConfig:
+ description: >
+ List of instance data that need to be configured on the CP
+ instances created from the respective CPD.
+ type: array
+ items:
+ description: >
+ This type represents an externally provided link port or
+ network address information per instance of an external
+ connection point. In case a link port is provided, the VNFM
+ shall use that link port when connecting the external CP to
+ the external VL. In a link port is not provided, the VNFM
+ shall create a link port on the external VL, and use that link
+ port to connect the external CP to the external VL.
+ type: object
+ properties:
+ cpInstanceId:
+ description: >
+ An identifier that is unique for the respective type
+ within a VNF instance, but may not be globally unique.
+ type: string
+ linkPortId:
+ description: |
+ An identifier with the intention of being globally unique.
+ type: string
+ cpProtocolData:
+ description: >
+ Parameters for configuring the network protocols on the
+ link port that connects the CP to a VL. The following
+ conditions apply to the attributes "linkPortId" and
+ "cpProtocolData": * The "linkPortId" and "cpProtocolData"
+ attributes shall both be absent for the deletion of an
+ existing external CP instance
+ addressed by cpInstanceId.
+ * At least one of these attributes shall be present for a
+ to-be-created external CP instance or an existing external
+ CP instance.
+ * If the "linkPortId" attribute is absent, the VNFM shall
+ create a link port.
+
+ * If the "cpProtocolData" attribute is absent, the
+ "linkPortId" attribute shall be provided referencing a
+ pre-created link port,
+ and the VNFM can use means outside the scope of the present
+ document to obtain the pre-configured address information for the
+ connection point from the resource representing the link port.
+ * If both "cpProtocolData" and "linkportId" are provided,
+ the API consumer shall ensure that the cpProtocolData can
+ be used with the
+ pre-created link port referenced by "linkPortId".
+ type: array
+ items:
+ description: |
+ This type represents network protocol data.
+ type: object
+ required:
+ - layerProtocol
+ properties:
+ layerProtocol:
+ description: >
+ Identifier of layer(s) and protocol(s). This
+ attribute allows to signal the addition of further
+ types of layer and protocol in future versions of
+ the present document in a backwards-compatible way.
+ In the current version of the present document, only
+ IP over Ethernet is supported.
+ type: string
+ enum:
+ - IP_OVER_ETHERNET
+ ipOverEthernet:
+ description: >
+ This type represents network address data for IP
+ over Ethernet.
+ type: object
+ properties:
+ macAddress:
+ description: >
+ A MAC address. Representation: string that
+ consists of groups of two hexadecimal digits,
+ separated by hyphens or colons.
+ type: string
+ format: MAC
+ ipAddresses:
+ description: >
+ List of IP addresses to assign to the CP
+ instance. Each entry represents IP address data
+ for fixed or dynamic IP address assignment per
+ subnet. If this attribute is not present, no IP
+ address shall be assigned.
+ type: array
+ items:
+ type: object
+ required:
+ - type
+ properties:
+ type:
+ description: >
+ The type of the IP addresses. Permitted
+ values: IPV4, IPV6.
+ type: string
+ enum:
+ - IPV4
+ - IPV6
+ fixedAddresses:
+ description: >
+ Fixed addresses to assign (from the subnet
+ defined by "subnetId" if provided).
+ Exactly one of "fixedAddresses",
+ "numDynamicAddresses" or "ipAddressRange"
+ shall be present.
+ type: array
+ items:
+ description: >
+ An IPV4 or IPV6 address. Representation:
+ In case of an IPV4 address, string that
+ consists of four decimal integers
+ separated by dots, each integer ranging
+ from 0 to 255. In case of an IPV6
+ address, string that consists of groups
+ of zero to four hexadecimal digits,
+ separated by colons.
+ type: string
+ format: IP
+ numDynamicAddresses:
+ description: >
+ Number of dynamic addresses to assign
+ (from the subnet defined by "subnetId" if
+ provided). Exactly one of
+ "fixedAddresses", "numDynamicAddresses" or
+ "ipAddressRange" shall be present.
+ type: integer
+ addressRange:
+ description: >
+ An IP address range to be used, e.g. in
+ case of egress connections. In case this
+ attribute is present, IP addresses from
+ the range will be used.
+ type: object
+ required:
+ - minAddress
+ - maxAddress
+ properties:
+ minAddress:
+ description: >
+ An IPV4 or IPV6 address. Representation:
+ In case of an IPV4 address, string that
+ consists of four decimal integers
+ separated by dots, each integer ranging
+ from 0 to 255. In case of an IPV6
+ address, string that consists of groups
+ of zero to four hexadecimal digits,
+ separated by colons.
+ type: string
+ format: IP
+ maxAddress:
+ description: >
+ An IPV4 or IPV6 address. Representation:
+ In case of an IPV4 address, string that
+ consists of four decimal integers
+ separated by dots, each integer ranging
+ from 0 to 255. In case of an IPV6
+ address, string that consists of groups
+ of zero to four hexadecimal digits,
+ separated by colons.
+ type: string
+ format: IP
+ subnetId:
+ description: >
+ An identifier maintained by the VIM or
+ other resource provider. It is expected to
+ be unique within the VIM instance.
+ type: string
+ extLinkPorts:
+ description: >
+ Externally provided link ports to be used to connect external
+ connection points to this external VL. If this attribute is not
+ present, the VNFM shall create the link ports on the external VL.
+ type: array
+ items:
+ description: >
+ This type represents an externally provided link port to be used to
+ connect an external connection point to an external VL.
+ type: object
+ required:
+ - id
+ - resourceHandle
+ properties:
+ id:
+ description: |
+ An identifier with the intention of being globally unique.
+ type: string
+ resourceHandle:
+ required:
+ - tenant
+ - resourceId
+ type: object
+ description: >
+ This type represents the information that allows addressing a
+ virtualised resource that is used by a VNF instance.
+ properties:
+ tenant:
+ $ref: '#/definitions/Tenant'
+ resourceId:
+ description: >
+ An identifier maintained by the VIM or other resource
+ provider. It is expected to be unique within the VIM
+ instance.
+ type: string
+ vimLevelResourceType:
+ description: >
+ Type of the resource in the scope of the VIM or the resource
+ provider.
+ type: string \ No newline at end of file
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/pom.xml b/adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/pom.xml
new file mode 100644
index 0000000000..0cf1ce72e2
--- /dev/null
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/pom.xml
@@ -0,0 +1,17 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.onap.so.adapters</groupId>
+ <artifactId>mso-vnfm-adapter</artifactId>
+ <version>1.4.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>mso-vnfm-adapter-ext-clients</artifactId>
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+ </properties>
+ <name>mso-vnfm-adapter-ext-clients</name>
+ <description>Clients for the vnfm adpater to use towards REST endpoints which are external to the VNFM adapter/</description>
+</project>
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/pom.xml b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/pom.xml
new file mode 100644
index 0000000000..4554835b33
--- /dev/null
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/pom.xml
@@ -0,0 +1,80 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.onap.so.adapters</groupId>
+ <artifactId>mso-vnfm-adapter</artifactId>
+ <version>1.4.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>mso-vnfm-etsi-adapter</artifactId>
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+ </properties>
+ <name>mso-vnfm-etsi-adapter</name>
+ <description>MSO ETSI compliant VNFM Adapter</description>
+
+ <build>
+ <finalName>${project.artifactId}-${project.version}</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-maven-plugin</artifactId>
+ <configuration>
+ <mainClass>org.onap.so.adapters.vnfmadapter.VnfmAdapterApplication</mainClass>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>repackage</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>original</id>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.jacoco</groupId>
+ <artifactId>jacoco-maven-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-web</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-security</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-tomcat</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-actuator</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.so.adapters</groupId>
+ <artifactId>mso-adapters-rest-interface</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/Constants.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/Constants.java
new file mode 100644
index 0000000000..cdf7de869e
--- /dev/null
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/Constants.java
@@ -0,0 +1,33 @@
+/*-
+ * ============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.so.adapters.vnfmadapter;
+
+/**
+ * Adapter constants
+ */
+public class Constants {
+
+ public static final String SERVICE_NAME = "vnfm-adapter";
+ public static final String SERVICE_VERSION = "v1";
+ public static final String BASE_URL = "/so/" + SERVICE_NAME + "/" + SERVICE_VERSION;
+
+ private Constants() {}
+}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/VnfmAdapterApplication.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/VnfmAdapterApplication.java
new file mode 100755
index 0000000000..024e936cfb
--- /dev/null
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/VnfmAdapterApplication.java
@@ -0,0 +1,54 @@
+/*-
+ * ============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.so.adapters.vnfmadapter;
+
+import static org.slf4j.LoggerFactory.getLogger;
+import org.onap.so.adapters.vnfmadapter.rest.VnfmAdapterController;
+import org.slf4j.Logger;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+/**
+ * The spring boot application for the VNFM (Virtual Network Function Manager) Adapter.
+ * <p>
+ * The VNFM Adapter receives requests through its REST API {@link VnfmAdapterController} which it adapts
+ * into ETSI SOL003 compliant LCM (Life Cycle Management) calls towards an ETSI compliant VNFM.
+ *
+ * @see <a href=
+ * "https://www.etsi.org/deliver/etsi_gs/NFV-SOL/001_099/003/02.05.01_60/gs_nfv-sol003v020501p.pdf">ETSI
+ * SOL003 v2.5.1</a>
+ */
+@SpringBootApplication(scanBasePackages = {"org.onap.so"})
+public class VnfmAdapterApplication {
+ private static final Logger logger = getLogger(VnfmAdapterApplication.class);
+
+
+ /**
+ * Entry point for the Spring boot application
+ *
+ * @param args arguments for the application
+ */
+ public static void main(final String[] args) {
+ new SpringApplication(VnfmAdapterApplication.class).run(args);
+ logger.info("VnfmAdapterApplication started!");
+ }
+
+}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/WebSecurityConfigImpl.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/WebSecurityConfigImpl.java
new file mode 100644
index 0000000000..6baa672535
--- /dev/null
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/WebSecurityConfigImpl.java
@@ -0,0 +1,51 @@
+/*-
+ * ============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.so.adapters.vnfmadapter;
+
+import org.onap.so.security.MSOSpringFirewall;
+import org.onap.so.security.WebSecurityConfig;
+import org.springframework.security.config.annotation.web.builders.HttpSecurity;
+import org.springframework.security.config.annotation.web.builders.WebSecurity;
+import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
+import org.springframework.security.web.firewall.StrictHttpFirewall;
+import org.springframework.util.StringUtils;
+
+/**
+ * Configure the web security for the application.
+ */
+@EnableWebSecurity
+public class WebSecurityConfigImpl extends WebSecurityConfig {
+
+ @Override
+ protected void configure(final HttpSecurity http) throws Exception {
+ http.csrf().disable().authorizeRequests().antMatchers("/manage/health","/manage/info").permitAll()
+ .antMatchers("/**").hasAnyRole(StringUtils.collectionToDelimitedString(getRoles(), ",")).and()
+ .httpBasic();
+ }
+
+ @Override
+ public void configure(final WebSecurity web) throws Exception {
+ super.configure(web);
+ final StrictHttpFirewall firewall = new MSOSpringFirewall();
+ web.httpFirewall(firewall);
+ }
+
+}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterController.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterController.java
new file mode 100644
index 0000000000..4dabec3e9b
--- /dev/null
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterController.java
@@ -0,0 +1,34 @@
+/*-
+ * ============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.so.adapters.vnfmadapter.rest;
+
+import static org.onap.so.adapters.vnfmadapter.Constants.BASE_URL;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+/**
+ * Controller for handling requests to the VNFM (Virtual Network Function Manager) adapter REST API.
+ */
+@Controller
+@RequestMapping(value = BASE_URL)
+public class VnfmAdapterController {
+
+}
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
new file mode 100644
index 0000000000..7719c0c98c
--- /dev/null
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/resources/application.yaml
@@ -0,0 +1,31 @@
+# Copyright © 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.
+server:
+ port: 9092
+ tomcat:
+ max-threads: 50
+
+#Actuator
+management:
+ endpoints:
+ web:
+ base-path: /manage
+ exposure:
+ include: "*"
+ metrics:
+ se-global-registry: false
+ export:
+ prometheus:
+ enabled: true # Whether exporting of metrics to Prometheus is enabled.
+ step: 1m # Step size (i.e. reporting frequency) to use.
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/HealthCheckTest.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/HealthCheckTest.java
new file mode 100644
index 0000000000..ee22e03f87
--- /dev/null
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/HealthCheckTest.java
@@ -0,0 +1,55 @@
+/*-
+ * ============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.so.adapters.vnfmadapter.rest;
+
+import static org.junit.Assert.assertEquals;
+import java.net.URI;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.onap.so.adapters.vnfmadapter.VnfmAdapterApplication;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
+import org.springframework.boot.test.web.client.TestRestTemplate;
+import org.springframework.boot.web.server.LocalServerPort;
+import org.springframework.http.RequestEntity;
+import org.springframework.http.ResponseEntity;
+import org.springframework.test.context.ActiveProfiles;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = VnfmAdapterApplication.class, webEnvironment = WebEnvironment.RANDOM_PORT)
+@ActiveProfiles("test")
+public class HealthCheckTest {
+
+ @LocalServerPort
+ private int port;
+
+ private final TestRestTemplate restTemplate = new TestRestTemplate();
+
+ @Test
+ public void testHealthcheck() throws Exception {
+ final RequestEntity<Void> request =
+ RequestEntity.get(new URI("http://localhost:" + port + "/manage/health")).build();
+ final ResponseEntity<Void> response = restTemplate.exchange(request, Void.class);
+ assertEquals(200, response.getStatusCode().value());
+ }
+
+}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/resources/application-test.yaml b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/resources/application-test.yaml
new file mode 100644
index 0000000000..cc5a068d69
--- /dev/null
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/resources/application-test.yaml
@@ -0,0 +1,19 @@
+# Copyright © 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.
+spring:
+ security:
+ usercredentials:
+ - username: test
+ password: '$2a$12$Zi3AuYcZoZO/gBQyUtST2.F5N6HqcTtaNci2Et.ufsQhski56srIu'
+ role: BPEL-Client \ No newline at end of file
diff --git a/adapters/mso-vnfm-adapter/pom.xml b/adapters/mso-vnfm-adapter/pom.xml
new file mode 100644
index 0000000000..9cc17056c2
--- /dev/null
+++ b/adapters/mso-vnfm-adapter/pom.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.onap.so</groupId>
+ <artifactId>adapters</artifactId>
+ <version>1.4.0-SNAPSHOT</version>
+ </parent>
+ <groupId>org.onap.so.adapters</groupId>
+ <artifactId>mso-vnfm-adapter</artifactId>
+ <name>MSO VNFM Adapter</name>
+ <description>MSO Adapter for VNFM</description>
+ <packaging>pom</packaging>
+
+ <modules>
+ <module>mso-vnfm-adapter-api</module>
+ <module>mso-vnfm-adapter-ext-clients</module>
+ <module>mso-vnfm-etsi-adapter</module>
+ </modules>
+</project>
diff --git a/adapters/pom.xml b/adapters/pom.xml
index 634a1616e6..d00304b837 100644
--- a/adapters/pom.xml
+++ b/adapters/pom.xml
@@ -20,6 +20,7 @@
<module>mso-catalog-db-adapter</module>
<module>mso-vfc-adapter</module>
<module>mso-openstack-adapters</module>
+ <module>mso-vnfm-adapter</module>
</modules>
<dependencies>
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 bb70e3c65c..dc30b0e7de 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
@@ -189,7 +189,6 @@ public class ASDCController {
*/
public void initASDC () throws ASDCControllerException {
String event = "Initialize the ASDC Controller";
- MsoLogger.setServiceName ("InitASDC");
logger.debug(event);
if (this.getControllerStatus () != ASDCControllerStatus.STOPPED) {
String endEvent = "The controller is already initialized, call the closeASDC method first";
@@ -237,7 +236,6 @@ public class ASDCController {
*/
public void closeASDC () throws ASDCControllerException {
- MsoLogger.setServiceName ("CloseController");
if (this.getControllerStatus () == ASDCControllerStatus.BUSY) {
throw new ASDCControllerException ("Cannot close the ASDC controller as it's currently in BUSY state");
}
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/NotificationDataImpl.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/NotificationDataImpl.java
index a1c660f75f..cbe16d864a 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/NotificationDataImpl.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/NotificationDataImpl.java
@@ -30,19 +30,31 @@ import org.onap.sdc.api.notification.INotificationData;
import org.onap.sdc.api.notification.IResourceInstance;
import org.springframework.stereotype.Component;
-import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonAutoDetect;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
@Component
+@JsonAutoDetect(fieldVisibility = Visibility.ANY, getterVisibility = Visibility.NONE, setterVisibility = Visibility.NONE)
public class NotificationDataImpl implements INotificationData {
+ @JsonProperty("distributionID")
private String distributionID;
+ @JsonProperty("serviceName")
private String serviceName;
+ @JsonProperty("serviceVersion")
private String serviceVersion;
+ @JsonProperty("serviceUUID")
private String serviceUUID;
+ @JsonProperty("serviceDescription")
private String serviceDescription;
+ @JsonProperty("serviceInvariantUUID")
private String serviceInvariantUUID;
+ @JsonProperty("resources")
private List<ResourceInfoImpl> resources;
+ @JsonProperty("serviceArtifacts")
private List<ArtifactInfoImpl> serviceArtifacts;
+ @JsonProperty("workloadContext")
private String workloadContext;
@Override
@@ -118,7 +130,6 @@ public class NotificationDataImpl implements INotificationData {
return ret;
}
- @JsonIgnore
public List<ResourceInfoImpl> getResourcesImpl(){
return resources;
}
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 56784ba475..6d9e2fbb0c 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
@@ -53,6 +53,7 @@ import org.onap.sdc.toscaparser.api.Property;
import org.onap.sdc.toscaparser.api.RequirementAssignment;
import org.onap.sdc.toscaparser.api.RequirementAssignments;
import org.onap.sdc.toscaparser.api.elements.Metadata;
+import org.onap.sdc.toscaparser.api.elements.StatefulEntityType;
import org.onap.sdc.toscaparser.api.functions.GetInput;
import org.onap.sdc.toscaparser.api.parameters.Input;
import org.onap.sdc.utils.DistributionStatusEnum;
@@ -138,6 +139,10 @@ import com.fasterxml.jackson.databind.ObjectMapper;
@Component
public class ToscaResourceInstaller {
+ protected static final String NODES_VRF_ENTRY = "org.openecomp.nodes.VRFEntry";
+
+ protected static final String VLAN_NETWORK_RECEPTOR = "org.openecomp.nodes.VLANNetworkReceptor";
+
protected static final String ALLOTTED_RESOURCE = "Allotted Resource";
protected static final String MULTI_STAGE_DESIGN = "multi_stage_design";
@@ -295,8 +300,7 @@ public class ToscaResourceInstaller {
List<ASDCElementInfo> artifactListForLogging = new ArrayList<>();
try {
createToscaCsar(toscaResourceStruct);
- createService(toscaResourceStruct, vfResourceStruct);
- Service service = toscaResourceStruct.getCatalogService();
+ Service service = createService(toscaResourceStruct, vfResourceStruct);
processResourceSequence(toscaResourceStruct, service);
processVFResources(toscaResourceStruct, service, vfResourceStructure);
@@ -524,6 +528,62 @@ public class ToscaResourceInstaller {
}
}
}
+
+
+ protected ConfigurationResource getConfigurationResource(NodeTemplate nodeTemplate) {
+ Metadata metadata = nodeTemplate.getMetaData();
+ ConfigurationResource configResource = new ConfigurationResource();
+ configResource.setModelName(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
+ configResource.setModelInvariantUUID(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
+ configResource.setModelUUID(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
+ configResource.setModelVersion(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_VERSION));
+ configResource.setDescription(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
+ configResource.setToscaNodeType(nodeTemplate.getType());
+ return configResource;
+ }
+
+ protected ConfigurationResourceCustomization getConfigurationResourceCustomization(NodeTemplate nodeTemplate, ToscaResourceStructure toscaResourceStructure,
+ ServiceProxyResourceCustomization spResourceCustomization ) {
+ Metadata metadata = nodeTemplate.getMetaData();
+
+ ConfigurationResource configResource = getConfigurationResource(nodeTemplate);
+
+ ConfigurationResourceCustomization configCustomizationResource = new ConfigurationResourceCustomization();
+
+ Set<ConfigurationResourceCustomization> configResourceCustomizationSet = new HashSet<>();
+
+ configCustomizationResource.setModelCustomizationUUID(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
+ configCustomizationResource.setModelInstanceName(nodeTemplate.getName());
+
+ configCustomizationResource.setNfFunction(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFFUNCTION));
+ configCustomizationResource.setNfRole(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFROLE));
+ configCustomizationResource.setNfType(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFTYPE));
+ configCustomizationResource.setServiceProxyResourceCustomizationUUID(spResourceCustomization.getModelCustomizationUUID());
+
+ configCustomizationResource.setConfigurationResource(configResource);
+ configResourceCustomizationSet.add(configCustomizationResource);
+
+ configResource.setConfigurationResourceCustomization(configResourceCustomizationSet);
+ return configCustomizationResource;
+ }
+
+
+ protected Optional<ConfigurationResourceCustomization> getVnrNodeTemplate(List<NodeTemplate> configurationNodeTemplatesList,
+ ToscaResourceStructure toscaResourceStructure, ServiceProxyResourceCustomization spResourceCustomization) {
+ Optional<ConfigurationResourceCustomization> configurationResourceCust = Optional.empty();
+ for (NodeTemplate nodeTemplate : configurationNodeTemplatesList) {
+ StatefulEntityType entityType = nodeTemplate.getTypeDefinition();
+ String type = entityType.getType();
+
+ if(VLAN_NETWORK_RECEPTOR.equals(type)) {
+ configurationResourceCust= Optional.of(getConfigurationResourceCustomization(nodeTemplate,
+ toscaResourceStructure,spResourceCustomization));
+ break;
+ }
+ }
+
+ return configurationResourceCust;
+ }
protected void processServiceProxyAndConfiguration(ToscaResourceStructure toscaResourceStruct, Service service) {
@@ -538,16 +598,16 @@ public class ToscaResourceInstaller {
if (serviceProxyResourceList != null) {
for (NodeTemplate spNode : serviceProxyResourceList) {
- serviceProxy = createServiceProxy(spNode, service, toscaResourceStruct);
-
+ serviceProxy = createServiceProxy(spNode, service, toscaResourceStruct);
serviceProxyList.add(serviceProxy);
-
+ Optional<ConfigurationResourceCustomization> vnrResourceCustomization = getVnrNodeTemplate(configurationNodeTemplatesList,toscaResourceStruct,serviceProxy);
+
for (NodeTemplate configNode : configurationNodeTemplatesList) {
List<RequirementAssignment> requirementsList = toscaResourceStruct.getSdcCsarHelper().getRequirementsOf(configNode).getAll();
for (RequirementAssignment requirement : requirementsList) {
if (requirement.getNodeTemplateName().equals(spNode.getName())) {
- ConfigurationResourceCustomization configurationResource = createConfiguration(configNode, toscaResourceStruct, serviceProxy);
+ ConfigurationResourceCustomization configurationResource = createConfiguration(configNode, toscaResourceStruct, serviceProxy, vnrResourceCustomization);
Optional<ConfigurationResourceCustomization> matchingObject = configurationResourceList.stream()
.filter(configurationResourceCustomization -> configNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID).equals(configurationResource.getModelCustomizationUUID()))
@@ -881,8 +941,6 @@ public class ToscaResourceInstaller {
protected Service createService(ToscaResourceStructure toscaResourceStructure,
VfResourceStructure vfResourceStructure) {
- toscaResourceStructure.getServiceMetadata();
-
Metadata serviceMetadata = toscaResourceStructure.getServiceMetadata();
Service service = new Service();
@@ -945,32 +1003,26 @@ public class ToscaResourceInstaller {
return spCustomizationResource;
}
- protected ConfigurationResourceCustomization createConfiguration(NodeTemplate nodeTemplate, ToscaResourceStructure toscaResourceStructure, ServiceProxyResourceCustomization spResourceCustomization) {
+ protected ConfigurationResourceCustomization createConfiguration(NodeTemplate nodeTemplate,
+ ToscaResourceStructure toscaResourceStructure, ServiceProxyResourceCustomization spResourceCustomization,
+ Optional<ConfigurationResourceCustomization> vnrResourceCustomization) {
- Metadata metadata = nodeTemplate.getMetaData();
+ ConfigurationResourceCustomization configCustomizationResource = getConfigurationResourceCustomization(nodeTemplate,
+ toscaResourceStructure,spResourceCustomization);
- ConfigurationResource configResource = new ConfigurationResource();
-
- configResource.setModelName(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
- configResource.setModelInvariantUUID(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
- configResource.setModelUUID(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
- configResource.setModelVersion(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_VERSION));
- configResource.setDescription(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
- configResource.setToscaNodeType(nodeTemplate.getType());
-
- ConfigurationResourceCustomization configCustomizationResource = new ConfigurationResourceCustomization();
+ ConfigurationResource configResource = getConfigurationResource(nodeTemplate);
Set<ConfigurationResourceCustomization> configResourceCustomizationSet = new HashSet<>();
- configCustomizationResource.setModelCustomizationUUID(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
- configCustomizationResource.setModelInstanceName(nodeTemplate.getName());
-
- configCustomizationResource.setNfFunction(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFFUNCTION));
- configCustomizationResource.setNfRole(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFROLE));
- configCustomizationResource.setNfType(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFTYPE));
- configCustomizationResource.setServiceProxyResourceCustomizationUUID(spResourceCustomization.getModelCustomizationUUID());
- configCustomizationResource.setConfigResourceCustomization(configCustomizationResource);
+ StatefulEntityType entityType = nodeTemplate.getTypeDefinition();
+ String type = entityType.getType();
+
+ if(NODES_VRF_ENTRY.equals(type)) {
+ configCustomizationResource.setConfigResourceCustomization(vnrResourceCustomization.orElse(null));
+ }
+
configCustomizationResource.setConfigurationResource(configResource);
+
configResourceCustomizationSet.add(configCustomizationResource);
configResource.setConfigurationResourceCustomization(configResourceCustomizationSet);
@@ -1431,7 +1483,6 @@ public class ToscaResourceInstaller {
vfModuleMemberName = node.getName();
}
-
// Extract CVFC lists
List<NodeTemplate> cvfcList = toscaResourceStructure.getSdcCsarHelper().getNodeTemplateBySdcType(vfTemplate, SdcTypes.CVFC);
@@ -1439,7 +1490,7 @@ public class ToscaResourceInstaller {
CvnfcCustomization existingCvnfcCustomization = findExistingCvfc(existingCvnfcSet, cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
- if(existingCvnfcCustomization == null && (vfModuleMemberName != null && vfModuleMemberName.equalsIgnoreCase(cvfcTemplate.getName()))){
+ if(vfModuleMemberName != null && vfModuleMemberName.equalsIgnoreCase(cvfcTemplate.getName())){
//Extract associated VFC - Should always be just one
List<NodeTemplate> vfcList = toscaResourceStructure.getSdcCsarHelper().getNodeTemplateBySdcType(cvfcTemplate, SdcTypes.VFC);
@@ -1450,6 +1501,12 @@ public class ToscaResourceInstaller {
VnfcCustomization existingVnfcCustomization = null;
existingVnfcCustomization = findExistingVfc(existingVnfcSet, vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
+
+ if(existingVnfcCustomization == null){
+ vnfcCustomization = new VnfcCustomization();
+ } else {
+ vnfcCustomization = existingVnfcCustomization;
+ }
// Only Add Abstract VNFC's to our DB, ignore all others
if(existingVnfcCustomization == null && vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_SUBCATEGORY).equalsIgnoreCase("Abstract")){
@@ -1472,32 +1529,40 @@ public class ToscaResourceInstaller {
// This check is needed incase the VFC subcategory is something other than Abstract. In that case we want to skip adding that record to our DB.
if(vnfcCustomization.getModelCustomizationUUID() != null){
- CvnfcCustomization cvnfcCustomization = new CvnfcCustomization();
- cvnfcCustomization.setModelCustomizationUUID(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
- cvnfcCustomization.setModelInstanceName(cvfcTemplate.getName());
- cvnfcCustomization.setModelInvariantUUID(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
- cvnfcCustomization.setModelName(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
- cvnfcCustomization.setModelUUID(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
-
- cvnfcCustomization.setModelVersion(
- testNull(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)));
- cvnfcCustomization.setDescription(
- testNull(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)));
- cvnfcCustomization.setToscaNodeType(testNull(cvfcTemplate.getType()));
+ CvnfcCustomization cvnfcCustomization = null;
- if(existingVnfcCustomization != null){
- cvnfcCustomization.setVnfcCustomization(existingVnfcCustomization);
- }else{
- cvnfcCustomization.setVnfcCustomization(vnfcCustomization);
+ if(existingCvnfcCustomization != null){
+ cvnfcCustomization = existingCvnfcCustomization;
}
+ else{
- cvnfcCustomization.setNfcFunction(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(cvfcTemplate, "nfc_function"));
- cvnfcCustomization.setNfcNamingCode(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(cvfcTemplate, "nfc_naming_code"));
- cvnfcCustomization.setVfModuleCustomization(vfModuleCustomization);
- cvnfcCustomization.setVnfResourceCustomization(vnfResource);
-
- cvnfcCustomizations.add(cvnfcCustomization);
- existingCvnfcSet.add(cvnfcCustomization);
+ cvnfcCustomization = new CvnfcCustomization();
+ cvnfcCustomization.setModelCustomizationUUID(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
+ cvnfcCustomization.setModelInstanceName(cvfcTemplate.getName());
+ cvnfcCustomization.setModelInvariantUUID(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
+ cvnfcCustomization.setModelName(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
+ cvnfcCustomization.setModelUUID(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
+
+ cvnfcCustomization.setModelVersion(
+ testNull(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)));
+ cvnfcCustomization.setDescription(
+ testNull(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)));
+ cvnfcCustomization.setToscaNodeType(testNull(cvfcTemplate.getType()));
+
+ if(existingVnfcCustomization != null){
+ cvnfcCustomization.setVnfcCustomization(existingVnfcCustomization);
+ }else{
+ cvnfcCustomization.setVnfcCustomization(vnfcCustomization);
+ }
+
+ cvnfcCustomization.setNfcFunction(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(cvfcTemplate, "nfc_function"));
+ cvnfcCustomization.setNfcNamingCode(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(cvfcTemplate, "nfc_naming_code"));
+ cvnfcCustomization.setVfModuleCustomization(vfModuleCustomization);
+ cvnfcCustomization.setVnfResourceCustomization(vnfResource);
+
+ cvnfcCustomizations.add(cvnfcCustomization);
+ existingCvnfcSet.add(cvnfcCustomization);
+ }
//*****************************************************************************************************************************************
//* Extract Fabric Configuration
@@ -1543,8 +1608,7 @@ public class ToscaResourceInstaller {
VnfResourceCustomization vnfResource, VfModuleCustomization vfModuleCustomization, CvnfcCustomization cvnfcCustomization,
ConfigurationResource configResource, NodeTemplate vfTemplate, String vfModuleMemberName) {
- Metadata fabricMetadata = fabricTemplate.getMetaData();
-
+ Metadata fabricMetadata = fabricTemplate.getMetaData();
VnfVfmoduleCvnfcConfigurationCustomization vfModuleToCvnfc = new VnfVfmoduleCvnfcConfigurationCustomization();
diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java
index 9ab4c5ecb2..e4eb09782a 100644
--- a/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java
@@ -23,71 +23,48 @@ package org.onap.so.asdc.installer.heat;
import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
import static com.shazam.shazamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertEquals;
-
-import static org.junit.Assert.assertNull;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.doNothing;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.doThrow;
-import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-import java.io.File;
-import java.io.FileInputStream;
import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
import java.util.List;
+import java.util.Optional;
-import javax.transaction.Transactional;
-
-import org.apache.commons.io.IOUtils;
import org.hibernate.exception.LockAcquisitionException;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.mockito.Mock;
+import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import org.onap.sdc.api.notification.IResourceInstance;
-import org.onap.sdc.api.results.IDistributionClientDownloadResult;
+import org.onap.sdc.tosca.parser.api.ISdcCsarHelper;
import org.onap.sdc.tosca.parser.impl.SdcCsarHelperImpl;
import org.onap.sdc.tosca.parser.impl.SdcPropertyNames;
-import org.onap.sdc.toscaparser.api.CapabilityAssignment;
-import org.onap.sdc.toscaparser.api.CapabilityAssignments;
import org.onap.sdc.toscaparser.api.Group;
import org.onap.sdc.toscaparser.api.NodeTemplate;
import org.onap.sdc.toscaparser.api.elements.Metadata;
+import org.onap.sdc.toscaparser.api.elements.StatefulEntityType;
import org.onap.sdc.utils.DistributionStatusEnum;
import org.onap.so.asdc.BaseTest;
-import org.onap.so.asdc.client.ASDCConfiguration;
import org.onap.so.asdc.client.exceptions.ArtifactInstallerException;
import org.onap.so.asdc.client.test.emulators.ArtifactInfoImpl;
import org.onap.so.asdc.client.test.emulators.JsonStatusData;
import org.onap.so.asdc.client.test.emulators.NotificationDataImpl;
-import org.onap.so.asdc.installer.VfModuleArtifact;
-import org.onap.so.asdc.installer.VfResourceStructure;
-import org.onap.so.db.catalog.beans.AllottedResource;
-import org.onap.so.db.catalog.beans.AllottedResourceCustomization;
-import org.onap.so.db.catalog.beans.ExternalServiceToInternalService;
-import org.onap.so.db.catalog.beans.HeatTemplate;
-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.VnfResource;
-import org.onap.so.db.catalog.beans.VnfResourceCustomization;
+import org.onap.so.asdc.installer.ToscaResourceStructure;
+import org.onap.so.db.catalog.beans.ConfigurationResource;
+import org.onap.so.db.catalog.beans.ConfigurationResourceCustomization;
+import org.onap.so.db.catalog.beans.ServiceProxyResourceCustomization;
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.ExternalServiceToInternalServiceRepository;
import org.onap.so.db.catalog.data.repository.ServiceRepository;
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.repository.WatchdogComponentDistributionStatusRepository;
import org.springframework.beans.factory.annotation.Autowired;
@@ -114,6 +91,16 @@ public class ToscaResourceInstallerTest extends BaseTest {
private IResourceInstance resourceInstance;
@Rule
public ExpectedException expectedException = ExpectedException.none();
+ @Mock
+ private NodeTemplate nodeTemplate;
+ @Mock
+ private ToscaResourceStructure toscaResourceStructure;
+ @Mock
+ private ServiceProxyResourceCustomization spResourceCustomization;
+ @Mock
+ private ISdcCsarHelper csarHelper;
+ @Mock
+ private StatefulEntityType entityType;
private NotificationDataImpl notificationData;
private JsonStatusData statusData;
@@ -310,4 +297,82 @@ public class ToscaResourceInstallerTest extends BaseTest {
}
return actualWatchdogComponentDistributionStatus;
}
+
+
+
+
+ private void prepareConfigurationResource() {
+ doReturn(metadata).when(nodeTemplate).getMetaData();
+ doReturn(MockConstants.TEMPLATE_TYPE).when(nodeTemplate).getType();
+
+ doReturn(MockConstants.MODEL_NAME).when(metadata).getValue(SdcPropertyNames.PROPERTY_NAME_NAME);
+ doReturn(MockConstants.MODEL_INVARIANT_UUID).when(metadata).getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID);
+ doReturn(MockConstants.MODEL_UUID).when(metadata).getValue(SdcPropertyNames.PROPERTY_NAME_UUID);
+ doReturn(MockConstants.MODEL_VERSION).when(metadata).getValue(SdcPropertyNames.PROPERTY_NAME_VERSION);
+ doReturn(MockConstants.MODEL_DESCRIPTION).when(metadata).getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION);
+ doReturn(MockConstants.MODEL_NAME).when(metadata).getValue(SdcPropertyNames.PROPERTY_NAME_NAME);
+ doReturn(MockConstants.MODEL_NAME).when(metadata).getValue(SdcPropertyNames.PROPERTY_NAME_NAME);
+ }
+
+ @Test
+ public void getConfigurationResourceTest() {
+ prepareConfigurationResource();
+
+ ConfigurationResource configResource=toscaInstaller.getConfigurationResource(nodeTemplate);
+
+ assertNotNull(configResource);
+ assertEquals(MockConstants.MODEL_NAME, configResource.getModelName());
+ assertEquals(MockConstants.MODEL_INVARIANT_UUID, configResource.getModelInvariantUUID());
+ assertEquals(MockConstants.MODEL_UUID, configResource.getModelUUID());
+ assertEquals(MockConstants.MODEL_VERSION, configResource.getModelVersion());
+ assertEquals(MockConstants.MODEL_DESCRIPTION, configResource.getDescription());
+ assertEquals(MockConstants.TEMPLATE_TYPE, nodeTemplate.getType());
+ }
+
+ private void prepareConfigurationResourceCustomization() {
+ prepareConfigurationResource();
+ doReturn(MockConstants.MODEL_CUSTOMIZATIONUUID).when(metadata).getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID);
+ doReturn(csarHelper).when(toscaResourceStructure).getSdcCsarHelper();
+ doReturn(null).when(csarHelper).getNodeTemplatePropertyLeafValue(nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFFUNCTION);
+ doReturn(null).when(csarHelper).getNodeTemplatePropertyLeafValue(nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFROLE);
+ doReturn(null).when(csarHelper).getNodeTemplatePropertyLeafValue(nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFTYPE);
+ doReturn(MockConstants.MODEL_CUSTOMIZATIONUUID).when(spResourceCustomization).getModelCustomizationUUID();
+ }
+
+
+ @Test
+ public void getConfigurationResourceCustomizationTest() {
+ prepareConfigurationResourceCustomization();
+
+ ConfigurationResourceCustomization configurationResourceCustomization = toscaInstaller.getConfigurationResourceCustomization(
+ nodeTemplate, toscaResourceStructure, spResourceCustomization);
+ assertNotNull(configurationResourceCustomization);
+ assertNotNull(configurationResourceCustomization.getConfigurationResource());
+ assertEquals(MockConstants.MODEL_CUSTOMIZATIONUUID, configurationResourceCustomization.getServiceProxyResourceCustomizationUUID());
+ }
+
+ @Test
+ public void getVnrNodeTemplateTest() {
+ prepareConfigurationResourceCustomization();
+ List<NodeTemplate> nodeTemplateList = new ArrayList<>();
+ doReturn(ToscaResourceInstaller.VLAN_NETWORK_RECEPTOR).when(entityType).getType();
+ doReturn(entityType).when(nodeTemplate).getTypeDefinition();
+ nodeTemplateList.add(nodeTemplate);
+ Optional<ConfigurationResourceCustomization> vnrResourceCustomization=
+ toscaInstaller.getVnrNodeTemplate(nodeTemplateList, toscaResourceStructure, spResourceCustomization);
+ assertTrue(vnrResourceCustomization.isPresent());
+ assertEquals(ToscaResourceInstaller.VLAN_NETWORK_RECEPTOR, entityType.getType());
+ }
+
+ class MockConstants{
+ public final static String MODEL_NAME = "VLAN Network Receptor Configuration";
+ public final static String MODEL_INVARIANT_UUID = "1608eef4-de53-4334-a8d2-ba79cab4bde0";
+ public final static String MODEL_UUID = "212ca27b-554c-474c-96b9-ddc2f1b1ddba";
+ public final static String MODEL_VERSION = "30.0";
+ public final static String MODEL_DESCRIPTION = "VLAN network receptor configuration object";
+ public final static String MODEL_CUSTOMIZATIONUUID = "2db953e8-679d-437b-bff7-cb262638a8cd";
+ public final static String TEMPLATE_TYPE = "org.openecomp.nodes.VLANNetworkReceptor";
+ public final static String TEMPLATE_NAME = "VLAN Network Receptor Configuration 0";
+
+ }
}
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 8a8e41247c..b9053b75da 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
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -38,12 +40,14 @@ import org.onap.so.client.aai.AAIVersion
import org.onap.so.client.aai.entities.uri.AAIUri
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
import org.onap.so.openpojo.rules.HasToStringRule
import org.onap.so.utils.TargetEntity
@Deprecated
class AaiUtil {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, AaiUtil.class);
+ private static final Logger logger = LoggerFactory.getLogger( AaiUtil.class);
public MsoUtils utils = new MsoUtils()
@@ -101,14 +105,14 @@ class AaiUtil {
String returnCode = apiResponse.getStatus()
String aaiResponseAsString = apiResponse.readEntity(String.class)
- msoLogger.debug("Call AAI Cloud Region Return code: " + returnCode)
+ logger.debug("Call AAI Cloud Region Return code: " + returnCode)
execution.setVariable(execution.getVariable("prefix")+"queryCloudRegionReturnCode", returnCode)
if(returnCode == "200"){
- msoLogger.debug("Call AAI Cloud Region is Successful.")
+ logger.debug("Call AAI Cloud Region is Successful.")
String regionVersion = taskProcessor.utils.getNodeText(aaiResponseAsString, "cloud-region-version")
- msoLogger.debug("Cloud Region Version from AAI for " + backend + " is: " + regionVersion)
+ logger.debug("Cloud Region Version from AAI for " + backend + " is: " + regionVersion)
if (backend == "PO") {
regionId = taskProcessor.utils.getNodeText(aaiResponseAsString, "cloud-region-id")
} else { // backend not "PO"
@@ -121,20 +125,24 @@ class AaiUtil {
if(regionId == null){
throw new BpmnError("MSOWorkflowException")
}
- msoLogger.debug("Cloud Region Id from AAI " + backend + " is: " + regionId)
+ logger.debug("Cloud Region Id from AAI " + backend + " is: " + regionId)
}else if (returnCode == "404"){ // not 200
if (backend == "PO") {
regionId = inputCloudRegion
}else{ // backend not "PO"
regionId = "AAIAIC25"
}
- msoLogger.debug("Cloud Region value for code='404' of " + backend + " is: " + regionId)
+ logger.debug("Cloud Region value for code='404' of " + backend + " is: " + regionId)
}else{
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Call AAI Cloud Region is NOT Successful.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Call AAI Cloud Region is NOT Successful.", "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue());
throw new BpmnError("MSOWorkflowException")
}
}catch(Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception occured while getting the Cloud Reqion.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.getMessage());
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception occured while getting the Cloud Reqion.", "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), e.getMessage());
(new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, e.getMessage())
}
return regionId
@@ -157,7 +165,7 @@ class AaiUtil {
if (aaiVnfResponse != null) {
String vfModulesText = taskProcessor.utils.getNodeXml(aaiVnfResponse, "vf-modules")
if (aaiVnfResponse.getVfModules() == null || aaiVnfResponse.getVfModules().getVfModule().isEmpty()) {
- msoLogger.debug("There are no VF modules in this VNF yet")
+ logger.debug("There are no VF modules in this VNF yet")
return 0
}
else {
@@ -176,7 +184,7 @@ class AaiUtil {
}
}
matchingVfModules = matchingVfModules + "</vfModules>"
- msoLogger.debug("Matching VF Modules: " + matchingVfModules)
+ logger.debug("Matching VF Modules: " + matchingVfModules)
String lowestUnusedIndex = taskProcessor.utils.getLowestUnusedIndex(matchingVfModules)
return Integer.parseInt(lowestUnusedIndex)
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy
index 57af763ed5..c700fa70e1 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy
@@ -387,7 +387,7 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
/**
* Returns the process definition key (i.e. the process name) of the
* current process.
- *
+ *
* @param execution the execution
*/
public String getProcessKey(DelegateExecution execution) {
@@ -718,19 +718,19 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
'/' + UriUtils.encodePathSegment(messageType, 'UTF-8') +
'/' + UriUtils.encodePathSegment(correlator, 'UTF-8')
}
-
+
public void setRollbackEnabled(DelegateExecution execution, isDebugLogEnabled) {
-
+
// Rollback settings
def prefix = execution.getVariable('prefix')
def disableRollback = execution.getVariable("disableRollback")
def defaultRollback = UrnPropertiesReader.getVariable("mso.rollback", execution).toBoolean()
-
+
logDebug('disableRollback: ' + disableRollback, isDebugLogEnabled)
logDebug('defaultRollback: ' + defaultRollback, isDebugLogEnabled)
-
+
def rollbackEnabled
-
+
if(disableRollback == null || disableRollback == '' ) {
// get from default urn settings for mso_rollback
disableRollback = !defaultRollback
@@ -752,7 +752,7 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
execution.setVariable(prefix+"backoutOnFailure", rollbackEnabled)
logDebug('rollbackEnabled (aka backoutOnFailure): ' + rollbackEnabled, isDebugLogEnabled)
}
-
+
public void setBasicDBAuthHeader(DelegateExecution execution, isDebugLogEnabled) {
try {
String basicAuthValueDB = UrnPropertiesReader.getVariable("mso.adapters.db.auth", execution)
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtils.groovy
index a43a2b1f89..d0967cc327 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtils.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtils.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -39,11 +41,13 @@ import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
class AllottedResourceUtils {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, AllottedResourceUtils.class);
+ private static final Logger logger = LoggerFactory.getLogger( AllottedResourceUtils.class);
private AbstractServiceTaskProcessor taskProcessor
@@ -65,7 +69,7 @@ class AllottedResourceUtils {
*/
public String getAROrchStatus (DelegateExecution execution) {
- msoLogger.trace("getAROrchStatus ")
+ logger.trace("getAROrchStatus ")
String msg = ""
String serviceInstanceId = execution.getVariable("serviceInstanceId")
String arType = execution.getVariable("allottedResourceType")
@@ -73,7 +77,7 @@ class AllottedResourceUtils {
String siXml = execution.getVariable("CSI_service")
String orchStatus = null
XmlParser xmlParser = new XmlParser()
- msoLogger.debug("getAROrchStatus siXml:" + siXml)
+ logger.debug("getAROrchStatus siXml:" + siXml)
try {
if (!isBlank(siXml)) {
def groovy.util.Node siNode = xmlParser.parseText(siXml)
@@ -83,7 +87,7 @@ class AllottedResourceUtils {
for (groovy.util.Node relationship in relationships) {
def groovy.util.Node relatedTo = utils.getChildNode(relationship, 'related-to')
if ((relatedTo != null) && (relatedTo.text().equals('allotted-resource'))) {
- msoLogger.debug("getARORchStatus AR found")
+ logger.debug("getARORchStatus AR found")
def groovy.util.Node relatedLink = utils.getChildNode(relationship, 'related-link')
if (relatedLink != null){
Optional<AllottedResource> ar = getARbyLink(execution, relatedLink.text(), arRole)
@@ -97,10 +101,10 @@ class AllottedResourceUtils {
}
}
}catch(Exception e){
- msoLogger.debug(" Error encountered in getAROrchStatus" + e.getMessage())
+ logger.debug(" Error encountered in getAROrchStatus" + e.getMessage())
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error in getAROrchStatus" + e.getMessage())
}
- msoLogger.trace(" Exit getAROrchStatus - OrchStatus:" + orchStatus)
+ logger.trace(" Exit getAROrchStatus - OrchStatus:" + orchStatus)
return orchStatus
}
@@ -108,7 +112,7 @@ class AllottedResourceUtils {
// used on Delete - called from doDeleteAR
// setsVariable aaiARGetResponse
public boolean ifExistsAR(DelegateExecution execution, String allottedResourceId) {
- msoLogger.trace("ifExistsAR ")
+ logger.trace("ifExistsAR ")
try {
AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.ALLOTTED_RESOURCE, allottedResourceId)
AAIResultWrapper wrapper = getAAIClient().get(resourceUri)
@@ -127,24 +131,24 @@ class AllottedResourceUtils {
public String getPSIFmARLink(DelegateExecution execution, String arLink)
{
// Path: /aai/{version}/business/customers/customer/{cust}/service-subscriptions/service-subscription/{subs}/service-instances/service-instance/{psiid}/allotted-resources/allotted-resource/{arid}
- msoLogger.trace(" getPSIFmARLink - path:" + arLink)
+ logger.trace(" getPSIFmARLink - path:" + arLink)
String[] split = arLink.split("/service-instance/")
String[] splitB = split[1].split("/allotted-resources/")
String siId = splitB[0]
- msoLogger.trace(" Exit getPSIFmARLink - parentServiceInstanceId:" + siId )
+ logger.trace(" Exit getPSIFmARLink - parentServiceInstanceId:" + siId )
return siId
}
-
+
// get Allotted resource using Link
// used on Create called from getARORchStatus
// used on Delete called from ifExistsAR
// setsVariable aaiARPath - used for Patch in create
-
+
public Optional<AllottedResource> getARbyLink (DelegateExecution execution, String link, String role) {
- msoLogger.trace("getARbyLink ")
+ logger.trace("getARbyLink ")
Optional<AllottedResource> allottedResource = Optional.empty()
try {
- msoLogger.debug("GET AR Aai Path is: \n" + link)
+ logger.debug("GET AR Aai Path is: \n" + link)
AAIResourceUri uri = AAIUriFactory.createResourceFromExistingURI(AAIObjectType.ALLOTTED_RESOURCE, UriBuilder.fromPath(link).build())
allottedResource = getAAIClient().get(AllottedResource.class,uri);
if(allottedResource.isPresent()) {
@@ -152,16 +156,16 @@ class AllottedResourceUtils {
if (role == allottedResource.get().getRole()) {
setExecutionVariables(execution,allottedResource.get(),uri)
} else {
- msoLogger.debug("AAI AR does not match input role:" + role)
+ logger.debug("AAI AR does not match input role:" + role)
}
} else {
setExecutionVariables(execution,allottedResource.get(),uri)
}
}else{
- msoLogger.debug("GET AR received a Not Found (404) Response")
+ logger.debug("GET AR received a Not Found (404) Response")
}
}catch(Exception e){
- msoLogger.debug(" Error encountered within GetAaiAR" + e.getMessage())
+ logger.debug(" Error encountered within GetAaiAR" + e.getMessage())
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error in GetAaiAR" + e.getMessage())
}
return allottedResource
@@ -181,45 +185,47 @@ class AllottedResourceUtils {
}
public void updateAROrchStatus(DelegateExecution execution, String status, String aaiARPath){
- msoLogger.trace("updaAROrchStatus ")
+ logger.trace("updaAROrchStatus ")
try{
AllottedResource allottedResource = new AllottedResource();
allottedResource.setOrchestrationStatus(status)
- msoLogger.debug('AAI AR URI: ' + aaiARPath)
+ logger.debug('AAI AR URI: ' + aaiARPath)
AAIResourceUri uri = AAIUriFactory.createResourceFromExistingURI(AAIObjectType.ALLOTTED_RESOURCE, UriBuilder.fromPath(aaiARPath).build())
getAAIClient().update(uri,allottedResource)
}catch(Exception e){
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in updateAR.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.getMessage());
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception in updateAR.", "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), e.getMessage());
exceptionUtil.buildAndThrowWorkflowException(execution, 500, 'Internal Error in updateAROrchStatus.' + e.getMessage())
}
- msoLogger.trace("Exit updateAROrchStatus ")
+ logger.trace("Exit updateAROrchStatus ")
}
//Sets Variable "wasDeleted"
public void deleteAR(DelegateExecution execution, String aaiARPath){
- msoLogger.trace(" deleteAR - aaiARPath:" + aaiARPath)
+ logger.trace(" deleteAR - aaiARPath:" + aaiARPath)
try {
AAIResourceUri uri = AAIUriFactory.createResourceFromExistingURI(AAIObjectType.ALLOTTED_RESOURCE, UriBuilder.fromPath(aaiARPath).build())
getAAIClient().delete(uri);
}catch(NotFoundException ex){
- msoLogger.debug(" Delete AR Received a Not Found (404) Response")
+ logger.debug(" Delete AR Received a Not Found (404) Response")
}catch(PreconditionFailedException ex){
- msoLogger.debug("Delete AR Received a Resource Version Mismatch Error: \n")
+ logger.debug("Delete AR Received a Resource Version Mismatch Error: \n")
exceptionUtil.buildAndThrowWorkflowException(execution, 412, "DeleteAR Received a resource-version Mismatch Error Response from AAI")
}catch(Exception e){
- msoLogger.debug(" Error encountered in deleteAR!" + e)
+ logger.debug(" Error encountered in deleteAR!" + e)
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During Delete AR")
}
- msoLogger.debug(" Delete AR Received a Good Response")
+ logger.debug(" Delete AR Received a Good Response")
execution.setVariable("wasDeleted", "true")
- msoLogger.trace("Exit deleteAR ")
+ logger.trace("Exit deleteAR ")
}
public void buildAAIErrorResponse(DelegateExecution execution, String response, String errorMessage){
- msoLogger.trace("BuildAAIErrorResponse")
+ logger.trace("BuildAAIErrorResponse")
if((response != null) && (response.contains("Fault") || response.contains("RESTFault"))){
WorkflowException workflowException = exceptionUtil.MapAAIExceptionToWorkflowException(response, execution)
@@ -228,10 +234,10 @@ class AllottedResourceUtils {
exceptionUtil.buildWorkflowException(execution, 500, errorMessage)
}
- msoLogger.trace("Exit BuildAAIErrorResponse Process")
+ logger.trace("Exit BuildAAIErrorResponse Process")
throw new BpmnError("MSOWorkflowException")
}
-
+
public AAIResourcesClient getAAIClient(){
return new AAIResourcesClient()
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AppCClient.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AppCClient.groovy
index 5cbbe0ab46..7beb24f692 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AppCClient.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AppCClient.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -27,6 +29,8 @@ import org.onap.appc.client.lcm.model.Action
import org.onap.so.client.appc.ApplicationControllerAction;
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
/**
* This groovy class supports the <class>AppCClient.bpmn</class> process.
@@ -49,22 +53,22 @@ import org.onap.so.logger.MsoLogger
*/
public class AppCClient extends AbstractServiceTaskProcessor{
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, AppCClient.class);
+ private static final Logger logger = LoggerFactory.getLogger( AppCClient.class);
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtils = new JsonUtils()
def prefix = "UPDVnfI_"
-
+
public void preProcessRequest(DelegateExecution execution){
}
-
+
public void runAppcCommand(DelegateExecution execution) {
- msoLogger.trace("Start runCommand ")
+ logger.trace("Start runCommand ")
def method = getClass().getSimpleName() + '.runAppcCommand(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
execution.setVariable("rollbackVnfStop", false)
execution.setVariable("rollbackVnfLock", false)
execution.setVariable("rollbackQuiesceTraffic", false)
@@ -83,7 +87,7 @@ public class AppCClient extends AbstractServiceTaskProcessor{
String vserverIdList = execution.getVariable("vserverIdList")
String identityUrl = execution.getVariable("identityUrl")
String controllerType = execution.getVariable("controllerType")
- String vfModuleId = execution.getVariable("vfModuleId")
+ String vfModuleId = execution.getVariable("vfModuleId")
HashMap<String, String> payloadInfo = new HashMap<String, String>();
payloadInfo.put("vnfName", vnfName)
payloadInfo.put("aicIdentity", aicIdentity)
@@ -93,8 +97,8 @@ public class AppCClient extends AbstractServiceTaskProcessor{
payloadInfo.put("identityUrl", identityUrl)
payloadInfo.put("vfModuleId",vfModuleId)
Optional<String> payload
- msoLogger.debug("Running APP-C action: " + action.toString())
- msoLogger.debug("VNFID: " + vnfId)
+ logger.debug("Running APP-C action: " + action.toString())
+ logger.debug("VNFID: " + vnfId)
execution.setVariable('msoRequestId', msoRequestId)
execution.setVariable("failedActivity", "APP-C")
execution.setVariable('workStep', action.toString())
@@ -108,17 +112,19 @@ public class AppCClient extends AbstractServiceTaskProcessor{
execution.setVariable('healthCheckIndex', healthCheckIndex + 1)
}
ApplicationControllerAction client = new ApplicationControllerAction()
- msoLogger.debug("Created Application Controller Action Object")
+ logger.debug("Created Application Controller Action Object")
//PayloadInfo contains extra information that adds on to payload before making request to appc
client.runAppCCommand(action, msoRequestId, vnfId, payload, payloadInfo, controllerType)
- msoLogger.debug("ran through the main method for Application Contoller")
+ logger.debug("ran through the main method for Application Contoller")
appcCode = client.getErrorCode()
appcMessage = client.getErrorMessage()
}
catch (BpmnError e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
appcMessage = e.getMessage()
- }
+ }
execution.setVariable("errorCode", appcCode)
if (appcCode == '0' && action != null) {
if (action.equals(Action.Lock)) {
@@ -142,8 +148,8 @@ public class AppCClient extends AbstractServiceTaskProcessor{
}
execution.setVariable("errorText", appcMessage)
execution.setVariable("responsePayload", responsePayload)
- msoLogger.debug("Error Message: " + appcMessage)
- msoLogger.debug("ERROR CODE: " + execution.getVariable("errorCode"))
- msoLogger.trace("End of runCommand ")
+ logger.debug("Error Message: " + appcMessage)
+ logger.debug("ERROR CODE: " + execution.getVariable("errorCode"))
+ logger.trace("End of runCommand ")
}
}
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 df0dfaee60..7511a855a4 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
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -31,6 +33,8 @@ import org.onap.so.client.HttpClient
import org.onap.so.client.HttpClientFactory
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
import org.onap.so.utils.TargetEntity
import org.springframework.web.util.UriUtils
@@ -43,7 +47,7 @@ import javax.ws.rs.core.Response
*/
class CatalogDbUtils {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CatalogDbUtils.class);
+ private static final Logger logger = LoggerFactory.getLogger( CatalogDbUtils.class);
private HttpClientFactory httpClientFactory
private MsoUtils msoUtils
@@ -60,7 +64,7 @@ class CatalogDbUtils {
JSONArray vnfsList = null
String endPoint = "/serviceVnfs?vnfModelCustomizationUuid=" + UriUtils.encode(vnfModelCustomizationUuid, "UTF-8")
try {
- msoLogger.debug("ENDPOINT: " + endPoint)
+ logger.debug("ENDPOINT: " + endPoint)
String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
if (catalogDbResponse != null) {
@@ -75,7 +79,9 @@ class CatalogDbUtils {
}
catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), e.message);
throw e
}
@@ -111,7 +117,9 @@ class CatalogDbUtils {
return getResponseFromCatalogDb(execution, endPoint)
}
catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), e.message);
throw e
}
}
@@ -133,7 +141,9 @@ class CatalogDbUtils {
}
catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), e.message);
throw e
}
@@ -157,7 +167,9 @@ class CatalogDbUtils {
}
catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), e.message);
throw e
}
@@ -167,7 +179,7 @@ class CatalogDbUtils {
private JSONArray parseNetworksJson (String catalogDbResponse, String arrayName, String catalogUtilsVersion) {
JSONArray modelInfos = null
- msoLogger.debug("parseNetworksJson - catalogUtilsVersion is " + catalogUtilsVersion)
+ logger.debug("parseNetworksJson - catalogUtilsVersion is " + catalogUtilsVersion)
try {
// Create array of jsons
@@ -202,10 +214,12 @@ class CatalogDbUtils {
}
String modelInfosString = modelInfos.toString()
- msoLogger.debug("Returning networks JSON: " + modelInfosString)
+ logger.debug("Returning networks JSON: " + modelInfosString)
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in parsing Catalog DB Response", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception in parsing Catalog DB Response", "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), e.message);
}
return modelInfos
@@ -214,7 +228,7 @@ class CatalogDbUtils {
private JSONArray parseVnfsJson (String catalogDbResponse, String arrayName, String catalogUtilsVersion) {
JSONArray modelInfos = null
- msoLogger.debug("parseVnfsJson - catalogUtilsVersion is " + catalogUtilsVersion)
+ logger.debug("parseVnfsJson - catalogUtilsVersion is " + catalogUtilsVersion)
try {
// Create array of jsons
@@ -226,7 +240,7 @@ class CatalogDbUtils {
for (int i = 0; i < vnfs.length(); i++) {
JSONObject vnf = vnfs.getJSONObject(i)
- msoLogger.debug(vnf.toString(2))
+ logger.debug(vnf.toString(2))
JSONObject modelInfo = buildModelInfo("vnf", vnf, catalogUtilsVersion)
JSONObject modelJson = new JSONObject()
modelJson.put("modelInfo", modelInfo)
@@ -254,7 +268,7 @@ class CatalogDbUtils {
vfModules = vnf.getJSONArray("vfModules")
} catch (Exception e)
{
- msoLogger.debug("Cannot find VF MODULE ARRAY: " + i + ", exception is " + e.message)
+ logger.debug("Cannot find VF MODULE ARRAY: " + i + ", exception is " + e.message)
}
if (vfModules != null) {
@@ -279,10 +293,12 @@ class CatalogDbUtils {
}
String modelInfosString = modelInfos.toString()
- msoLogger.debug("Returning vnfs JSON: " + modelInfosString)
+ logger.debug("Returning vnfs JSON: " + modelInfosString)
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in parsing Catalog DB Response", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception in parsing Catalog DB Response", "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), e.message);
}
return modelInfos
@@ -291,7 +307,7 @@ class CatalogDbUtils {
private JSONArray parseAllottedResourcesJson (String catalogDbResponse, String arrayName, String catalogUtilsVersion) {
JSONArray modelInfos = null
- msoLogger.debug("parseAllottedResourcesJson - catalogUtilsVersion is " + catalogUtilsVersion)
+ logger.debug("parseAllottedResourcesJson - catalogUtilsVersion is " + catalogUtilsVersion)
try {
// Create array of jsons
@@ -331,10 +347,12 @@ class CatalogDbUtils {
}
String modelInfosString = modelInfos.toString()
- msoLogger.debug("Returning allottedResources JSON: " + modelInfosString)
+ logger.debug("Returning allottedResources JSON: " + modelInfosString)
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in parsing Catalog DB Response", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception in parsing Catalog DB Response", "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), e.message);
}
return modelInfos
@@ -358,10 +376,12 @@ class CatalogDbUtils {
JSONArray allottedResourcesArray = parseAllottedResourcesJson(serviceResourcesRoot.toString(), "serviceAllottedResources", catalogUtilsVersion)
serviceResources.put("serviceAllottedResources", allottedResourcesArray)
serviceResourcesObject.put("serviceResources", serviceResources)
- msoLogger.debug("Returning serviceResources JSON: " + serviceResourcesObject.toString())
+ logger.debug("Returning serviceResources JSON: " + serviceResourcesObject.toString())
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in parsing Catalog DB Response", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception in parsing Catalog DB Response", "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), e.message);
}
return serviceResourcesObject
@@ -407,7 +427,9 @@ class CatalogDbUtils {
modelJson.put("modelInfo", modelInfo)
}
catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception while parsing model information", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception while parsing model information", "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), e.message);
}
return modelInfo
}
@@ -425,16 +447,16 @@ class CatalogDbUtils {
String basicAuthCred = execution.getVariable("BasicAuthHeaderValueDB")
client.addAdditionalHeader("Authorization", StringUtils.defaultIfEmpty(basicAuthCred, getBasicDBAuthHeader(execution)))
- msoLogger.debug('sending GET to Catalog DB endpoint: ' + endPoint)
+ logger.debug('sending GET to Catalog DB endpoint: ' + endPoint)
Response response = client.get()
responseData = response.readEntity(String.class)
if (responseData != null) {
- msoLogger.debug("Received data from Catalog DB: " + responseData)
+ logger.debug("Received data from Catalog DB: " + responseData)
}
- msoLogger.debug('Response code:' + response.getStatus())
- msoLogger.debug('Response:' + System.lineSeparator() + responseData)
+ logger.debug('Response code:' + response.getStatus())
+ logger.debug('Response:' + System.lineSeparator() + responseData)
if (response.getStatus() == 200) {
// parse response as needed
return responseData
@@ -444,7 +466,7 @@ class CatalogDbUtils {
}
}
catch (Exception e) {
- msoLogger.debug("ERROR WHILE QUERYING CATALOG DB: " + e.message)
+ logger.debug("ERROR WHILE QUERYING CATALOG DB: " + e.message)
throw e
}
@@ -457,7 +479,7 @@ class CatalogDbUtils {
String endPoint = "/resourceRecipe?resourceModelUuid=" + UriUtils.encode(resourceModelUuid, "UTF-8")+ "&action=" + UriUtils.encode(action, "UTF-8")
JSONObject responseJson = null
try {
- msoLogger.debug("ENDPOINT: " + endPoint)
+ logger.debug("ENDPOINT: " + endPoint)
String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
if (catalogDbResponse != null) {
@@ -488,4 +510,4 @@ class CatalogDbUtils {
return encodedString
}
-} \ No newline at end of file
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcess.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcess.groovy
index 865b9ee8a7..b12230009d 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcess.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcess.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -24,9 +26,11 @@ import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
public class CompleteMsoProcess extends AbstractServiceTaskProcessor {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CompleteMsoProcess.class);
+ private static final Logger logger = LoggerFactory.getLogger( CompleteMsoProcess.class);
String Prefix="CMSO_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
@@ -35,7 +39,7 @@ public class CompleteMsoProcess extends AbstractServiceTaskProcessor {
public initializeProcessVariables(DelegateExecution execution){
def method = getClass().getSimpleName() + '.initializeProcessVariables(' +'execution=' + execution.getId() +')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
try {
/* Initialize all the process request variables in this block */
@@ -70,7 +74,7 @@ public class CompleteMsoProcess extends AbstractServiceTaskProcessor {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method)
}
@@ -80,16 +84,16 @@ public class CompleteMsoProcess extends AbstractServiceTaskProcessor {
initializeProcessVariables(execution)
def method = getClass().getSimpleName() + '.preProcessRequest(' +'execution=' + execution.getId() +')'
- // msoLogger.trace("Started CompleteMsoProcess preProcessRequest Method ");
- msoLogger.trace('Entered ' + method)
-
+ // logger.trace("Started CompleteMsoProcess preProcessRequest Method ");
+ logger.trace('Entered ' + method)
+
setBasicDBAuthHeader(execution, execution.getVariable('isDebugLogEnabled'))
try {
def xml = execution.getVariable("CompleteMsoProcessRequest")
- msoLogger.debug("CompleteMsoProcess Request: " + xml)
- msoLogger.debug("Incoming Request is: "+ xml)
+ logger.debug("CompleteMsoProcess Request: " + xml)
+ logger.debug("Incoming Request is: "+ xml)
//mso-bpel-name from the incoming request
def msoBpelName = utils.getNodeText(xml,"mso-bpel-name")
@@ -142,18 +146,18 @@ public class CompleteMsoProcess extends AbstractServiceTaskProcessor {
execution.setVariable("CMSO_source",utils.getNodeText(xml,"source"))
}
- msoLogger.trace("--> " + execution.getVariable(""))
- msoLogger.trace("--> " + execution.getVariable(""))
+ logger.trace("--> " + execution.getVariable(""))
+ logger.trace("--> " + execution.getVariable(""))
// set the DHV/Service Instantiation values if specified in the request
execution.setVariable("CMSO_is_srv_inst_req", String.valueOf("true".equals(utils.getNodeText(xml, "is-srv-inst-req"))))
- msoLogger.trace("--> " + execution.getVariable(""))
+ logger.trace("--> " + execution.getVariable(""))
execution.setVariable("CMSO_is_json_content", String.valueOf("JSON".equals(utils.getNodeText(xml, "resp-content-type"))))
- msoLogger.trace("--> " + execution.getVariable(""))
+ logger.trace("--> " + execution.getVariable(""))
execution.setVariable("CMSO_service_inst_id", utils.getNodeText(xml, "service-instance-id"))
- msoLogger.trace("--> " + execution.getVariable(""))
+ logger.trace("--> " + execution.getVariable(""))
execution.setVariable("CMSO_start_time", utils.getNodeText(xml, "start-time"))
- msoLogger.trace("--> " + execution.getVariable(""))
+ logger.trace("--> " + execution.getVariable(""))
// this variable is used by the camunda flow to set the Content-Type for the async response
if (execution.getVariable("CMSO_is_srv_inst_req").equals("true") &&
execution.getVariable("CMSO_is_json_content").equals("true")) {
@@ -162,11 +166,11 @@ public class CompleteMsoProcess extends AbstractServiceTaskProcessor {
execution.setVariable("CMSO_content_type", "text/xml")
}
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.debug("Exception Occured During PreProcessRequest: " + e);
+ logger.debug("Exception Occured During PreProcessRequest: " + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in " + method)
}
}
@@ -174,7 +178,7 @@ public class CompleteMsoProcess extends AbstractServiceTaskProcessor {
public void setUpdateDBstatustoSuccessPayload (DelegateExecution execution){
def method = getClass().getSimpleName() + '.setUpdateDBstatustoSuccessPayload(' +'execution=' + execution.getId() +')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
try {
@@ -207,7 +211,7 @@ public class CompleteMsoProcess extends AbstractServiceTaskProcessor {
}
idXml = utils.removeXmlPreamble(idXml)
idXml = utils.removeXmlNamespaces(idXml)
- msoLogger.debug("Incoming Instance Id Xml: " + idXml)
+ logger.debug("Incoming Instance Id Xml: " + idXml)
String payload = """
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://org.onap.so/requestsdb">
@@ -225,22 +229,24 @@ public class CompleteMsoProcess extends AbstractServiceTaskProcessor {
</soapenv:Envelope>"""
execution.setVariable("CMSO_setUpdateDBstatustoSuccessPayload", payload)
- msoLogger.debug("Outgoing Update Mso Request Payload is: " + payload)
- msoLogger.debug("setUpdateDBstatustoSuccessPayload: " + payload)
+ logger.debug("Outgoing Update Mso Request Payload is: " + payload)
+ logger.debug("setUpdateDBstatustoSuccessPayload: " + payload)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method)
}
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
}
public void buildDataError (DelegateExecution execution, String message) {
def method = getClass().getSimpleName() + '.buildDataError(' +'execution=' + execution.getId() +')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
try {
String msoCompletionResponse = """
@@ -252,17 +258,19 @@ public class CompleteMsoProcess extends AbstractServiceTaskProcessor {
// Format Response
def xmlMsoCompletionResponse = utils.formatXml(msoCompletionResponse)
String buildMsoCompletionResponseAsString = xmlMsoCompletionResponse.drop(38).trim()
- msoLogger.debug("CompleteMsoProcess Response: " + buildMsoCompletionResponseAsString)
+ logger.debug("CompleteMsoProcess Response: " + buildMsoCompletionResponseAsString)
execution.setVariable("CompleteMsoProcessResponse", buildMsoCompletionResponseAsString)
- msoLogger.debug("@@ CompleteMsoProcess Response @@ " + "\n" + execution.getVariable("CompletionHandlerResponse"))
+ logger.debug("@@ CompleteMsoProcess Response @@ " + "\n" + execution.getVariable("CompletionHandlerResponse"))
exceptionUtil.buildAndThrowWorkflowException(execution, 500, message)
} catch (BpmnError e) {
- msoLogger.debug("Rethrowing MSOWorkflowException")
+ logger.debug("Rethrowing MSOWorkflowException")
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method)
}
@@ -271,8 +279,8 @@ public class CompleteMsoProcess extends AbstractServiceTaskProcessor {
public void postProcessResponse (DelegateExecution execution) {
def method = getClass().getSimpleName() + '.postProcessResponse(' +'execution=' + execution.getId() +')'
- msoLogger.trace('Entered ' + method)
- // msoLogger.trace("Started CompleteMsoProcess PostProcessRequest Method ");
+ logger.trace('Entered ' + method)
+ // logger.trace("Started CompleteMsoProcess PostProcessRequest Method ");
try {
String msoCompletionResponse = """
@@ -286,19 +294,21 @@ public class CompleteMsoProcess extends AbstractServiceTaskProcessor {
String buildMsoCompletionResponseAsString = xmlMsoCompletionResponse.drop(38).trim()
// TODO: Should deprecate use of processKey+Response variable for the response. Will use "WorkflowResponse" instead
execution.setVariable("WorkflowResponse", buildMsoCompletionResponseAsString)
- msoLogger.debug("CompleteMsoProcess Response: " + buildMsoCompletionResponseAsString)
+ logger.debug("CompleteMsoProcess Response: " + buildMsoCompletionResponseAsString)
execution.setVariable("CompleteMsoProcessResponse", buildMsoCompletionResponseAsString)
execution.setVariable("CMSO_ResponseCode", "200")
setSuccessIndicator(execution, true)
- msoLogger.debug("@@ CompleteMsoProcess Response @@ " + "\n" + execution.getVariable("CompleteMsoProcessResponse"))
+ logger.debug("@@ CompleteMsoProcess Response @@ " + "\n" + execution.getVariable("CompleteMsoProcessResponse"))
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method)
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupName.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupName.groovy
index f4e7926c8e..7d18a8b1ce 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupName.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupName.groovy
@@ -6,6 +6,8 @@
* ================================================================================
* Modifications Copyright 2018 Nokia
* ================================================================================
+ * 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
@@ -36,9 +38,11 @@ import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.constants.Defaults
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
public class ConfirmVolumeGroupName extends AbstractServiceTaskProcessor{
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, ConfirmVolumeGroupName.class);
+ private static final Logger logger = LoggerFactory.getLogger( ConfirmVolumeGroupName.class);
def static final Prefix = "CVGN_"
private final ExceptionUtil exceptionUtil
@@ -92,7 +96,7 @@ public class ConfirmVolumeGroupName extends AbstractServiceTaskProcessor{
execution.setVariable("CVGN_queryVolumeGroupResponse", "Volume Group not Found!")
}
} catch (Exception ex) {
- msoLogger.debug("Exception occurred while executing AAI GET:" + ex.getMessage())
+ logger.debug("Exception occurred while executing AAI GET:" + ex.getMessage())
execution.setVariable("CVGN_queryVolumeGroupResponseCode", HttpStatus.INTERNAL_SERVER_ERROR.value())
execution.setVariable("CVGN_queryVolumeGroupResponse", "AAI GET Failed:" + ex.getMessage())
exceptionUtil.buildAndThrowWorkflowException(execution, HttpStatus.INTERNAL_SERVER_ERROR.value(), "AAI GET Failed")
@@ -104,21 +108,21 @@ public class ConfirmVolumeGroupName extends AbstractServiceTaskProcessor{
public void checkAAIQueryResult(DelegateExecution execution) {
def actualVolumeGroupName = ""
if (execution.getVariable("CVGN_queryVolumeGroupResponseCode") == HttpStatus.NOT_FOUND.value()) {
- msoLogger.debug('volumeGroupId does not exist in AAI')
+ logger.debug('volumeGroupId does not exist in AAI')
}
else if (execution.getVariable("CVGN_queryVolumeGroupResponseCode") == HttpStatus.OK.value()) {
VolumeGroup volumeGroup = execution.getVariable("CVGN_queryVolumeGroupResponse")
if (!Strings.isNullOrEmpty(volumeGroup.getVolumeGroupName())) {
actualVolumeGroupName = volumeGroup.getVolumeGroupName()
- msoLogger.debug("volumeGroupId exists in AAI")
+ logger.debug("volumeGroupId exists in AAI")
}
}
execution.setVariable("CVGN_volumeGroupNameMatches", false)
def volumeGroupName = execution.getVariable("CVGN_volumeGroupName")
if (!actualVolumeGroupName.isEmpty() && volumeGroupName.equals(actualVolumeGroupName)) {
- msoLogger.debug('Volume Group Name Matches AAI records')
+ logger.debug('Volume Group Name Matches AAI records')
execution.setVariable("CVGN_volumeGroupNameMatches", true)
}
}
@@ -126,20 +130,24 @@ public class ConfirmVolumeGroupName extends AbstractServiceTaskProcessor{
// generates a WorkflowException if the A&AI query returns a response code other than 200/404
public void handleAAIQueryFailure(DelegateExecution execution) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Error occurred attempting to query AAI, Response Code " + execution.getVariable("CVGN_queryVolumeGroupResponseCode"), "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "ErrorResponse is:\n" + execution.getVariable("CVGN_queryVolumeGroupResponse"));
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Error occurred attempting to query AAI, Response Code " + execution.getVariable("CVGN_queryVolumeGroupResponseCode"),
+ "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(),
+ "ErrorResponse is:\n" + execution.getVariable("CVGN_queryVolumeGroupResponse"));
}
// generates a WorkflowException if the volume group name does not match AAI record for this volume group
public void handleVolumeGroupNameNoMatch(DelegateExecution execution) {
def errorNotAssociated = "Error occurred - volume group id ${execution.getVariable('CVGN_volumeGroupId')} " +
"is not associated with ${execution.getVariable('CVGN_volumeGroupName')}"
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, errorNotAssociated, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), errorNotAssociated, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, errorNotAssociated)
}
// sends a successful WorkflowResponse
public void reportSuccess(DelegateExecution execution) {
- msoLogger.debug("Sending 200 back to the caller")
+ logger.debug("Sending 200 back to the caller")
def responseXML = ""
execution.setVariable("WorkflowResponse", responseXML)
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenant.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenant.groovy
index 47a4612672..9c6c5cd0aa 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenant.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenant.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -31,6 +33,8 @@ import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.constants.Defaults
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
/**
* Vnf Module Subflow for confirming the volume group belongs
@@ -41,16 +45,16 @@ import org.onap.so.logger.MsoLogger
*
*/
class ConfirmVolumeGroupTenant extends AbstractServiceTaskProcessor{
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, ConfirmVolumeGroupTenant.class);
+ private static final Logger logger = LoggerFactory.getLogger( ConfirmVolumeGroupTenant.class);
String Prefix="CVGT_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
public void preProcessRequest(DelegateExecution execution){
execution.setVariable("prefix", Prefix)
- msoLogger.trace("STARTED Confirm Volume Group Tenant Subflow ")
+ logger.trace("STARTED Confirm Volume Group Tenant Subflow ")
try{
- msoLogger.trace("Started QueryAAIForVolumeGroup Process ")
+ logger.trace("Started QueryAAIForVolumeGroup Process ")
String volumeGroupId = execution.getVariable("volumeGroupId")
String incomingGroupName = execution.getVariable("volumeGroupName")
@@ -71,46 +75,48 @@ class ConfirmVolumeGroupTenant extends AbstractServiceTaskProcessor{
}
//Determine if Tenant Ids match
if(incomingTenantId.equals(volumeGroupTenantId)){
- msoLogger.debug("Tenant Ids Match")
+ logger.debug("Tenant Ids Match")
execution.setVariable("tenantIdsMatch", true)
}else{
- msoLogger.debug("Tenant Ids DO NOT Match")
+ logger.debug("Tenant Ids DO NOT Match")
execution.setVariable("tenantIdsMatch", false)
}
//Determine if Volume Group Names match
String volumeGroupName = volumeGroup.get().getVolumeGroupName()
if(incomingGroupName == null || incomingGroupName.length() < 1){
- msoLogger.debug("Incoming Volume Group Name is NOT Provided.")
+ logger.debug("Incoming Volume Group Name is NOT Provided.")
execution.setVariable("groupNamesMatch", true)
}else{
- msoLogger.debug("Incoming Volume Group Name is: " + incomingGroupName)
+ logger.debug("Incoming Volume Group Name is: " + incomingGroupName)
if(volumeGroupName.equals(incomingGroupName)){
- msoLogger.debug("Volume Group Names Match.")
+ logger.debug("Volume Group Names Match.")
execution.setVariable("groupNamesMatch", true)
}else{
- msoLogger.debug("Volume Group Names DO NOT Match.")
+ logger.debug("Volume Group Names DO NOT Match.")
execution.setVariable("groupNamesMatch", false)
}
}
}else{
- msoLogger.debug("QueryAAIForVolumeGroup Bad REST Response!")
+ logger.debug("QueryAAIForVolumeGroup Bad REST Response!")
exceptionUtil.buildAndThrowWorkflowException(execution, 1, "Error Searching AAI for Volume Group. Received a Bad Response.")
}
}catch(BpmnError b){
throw b
}catch(Exception e){
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing queryAAIForVolumeGroup.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.getMessage());
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Occured Processing queryAAIForVolumeGroup.", "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), e.getMessage());
exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error - Occured in preProcessRequest.")
}
- msoLogger.trace("COMPLETED queryAAIForVolumeGroup Process ")
+ logger.trace("COMPLETED queryAAIForVolumeGroup Process ")
}
public void assignVolumeHeatId(DelegateExecution execution){
execution.setVariable("prefix", Prefix)
try{
- msoLogger.trace("Started assignVolumeHeatId Process ")
+ logger.trace("Started assignVolumeHeatId Process ")
VolumeGroup volumeGroup = execution.getVariable("queryAAIVolumeGroupResponse")
String heatStackId = volumeGroup.getHeatStackId()
@@ -118,20 +124,22 @@ class ConfirmVolumeGroupTenant extends AbstractServiceTaskProcessor{
execution.setVariable("ConfirmVolumeGroupTenantResponse", heatStackId)
// TODO: Should deprecate use of processKey+Response variable for the response. Will use "WorkflowResponse" instead
execution.setVariable("WorkflowResponse", heatStackId)
- msoLogger.debug("Volume Heat Stack Id is: " + heatStackId)
+ logger.debug("Volume Heat Stack Id is: " + heatStackId)
}catch(Exception e){
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing assignVolumeHeatId.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Occured Processing assignVolumeHeatId.", "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), e);
exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error - Occured in assignVolumeHeatId.")
}
- msoLogger.trace("COMPLETED assignVolumeHeatId Process ")
- msoLogger.trace("COMPLETED Confirm Volume Group Tenant Subflow ")
+ logger.trace("COMPLETED assignVolumeHeatId Process ")
+ logger.trace("COMPLETED Confirm Volume Group Tenant Subflow ")
}
public void assignWorkflowException(DelegateExecution execution, String message){
execution.setVariable("prefix", Prefix)
String processKey = getProcessKey(execution);
- msoLogger.trace("STARTED Assign Workflow Exception ")
+ logger.trace("STARTED Assign Workflow Exception ")
try{
String volumeGroupId = execution.getVariable("volumeGroupId")
int errorCode = 1
@@ -139,9 +147,11 @@ class ConfirmVolumeGroupTenant extends AbstractServiceTaskProcessor{
exceptionUtil.buildWorkflowException(execution, errorCode, errorMessage)
}catch(Exception e){
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing assignWorkflowException.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Occured Processing assignWorkflowException.", "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), e);
}
- msoLogger.trace("COMPLETED Assign Workflow Exception =")
+ logger.trace("COMPLETED Assign Workflow Exception =")
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModule.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModule.groovy
index 370600755b..e608bbddbe 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModule.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModule.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -32,9 +34,11 @@ import org.onap.so.client.graphinventory.entities.uri.Depth
import org.onap.so.db.catalog.beans.OrchestrationStatus
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
public class CreateAAIVfModule extends AbstractServiceTaskProcessor{
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CreateAAIVfModule.class);
+ private static final Logger logger = LoggerFactory.getLogger( CreateAAIVfModule.class);
def prefix="CAAIVfMod_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
@@ -119,13 +123,13 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{
Boolean isBaseVfModule = false
String isBaseVfModuleString = execution.getVariable("isBaseVfModule")
if (isBaseVfModuleString != null && isBaseVfModuleString.equals("true")) {
- isBaseVfModule = true
+ isBaseVfModule = true
}
execution.setVariable("CAAIVfMod_isBaseVfModule", isBaseVfModule)
String isVidRequest = execution.getVariable("isVidRequest")
if (isVidRequest != null && "true".equals(isVidRequest)) {
- msoLogger.debug("VID Request received")
+ logger.debug("VID Request received")
}
execution.setVariable("CAAIVfMod_moduleName",execution.getVariable("vfModuleName"))
@@ -133,8 +137,8 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{
AaiUtil aaiUriUtil = new AaiUtil(this)
String aaiNamespace = aaiUriUtil.getNamespace()
- msoLogger.debug('AAI namespace is: ' + aaiNamespace)
-
+ logger.debug('AAI namespace is: ' + aaiNamespace)
+
execution.setVariable("CAAIVfMod_aaiNamespace",aaiNamespace)
}
@@ -163,30 +167,30 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{
execution.setVariable("CAAIVfMod_queryGenericVnfResponse", "Generic Vnf not Found!")
}
} catch (Exception ex) {
- msoLogger.debug("Exception occurred while executing AAI GET:" + ex.getMessage())
+ logger.debug("Exception occurred while executing AAI GET:" + ex.getMessage())
exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error - Occured in queryAAIForGenericVnf.")
}
}
-
+
// process the result from queryAAIForGenericVnf()
- // note: this method is primarily for logging as the actual decision logic is embedded in the bpmn flow
+ // note: this method is primarily for logging as the actual decision logic is embedded in the bpmn flow
public void processAAIGenericVnfQuery(DelegateExecution execution) {
if (execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode") == 404 &&
execution.getVariable("CAAIVfMod_vnfId").isEmpty()) {
- msoLogger.debug("New Generic VNF requested and it does not already exist")
+ logger.debug("New Generic VNF requested and it does not already exist")
} else if (execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode") == 200 &&
!execution.getVariable("CAAIVfMod_vnfId").isEmpty()) {
- msoLogger.debug("Adding module to existing Generic VNF")
+ logger.debug("Adding module to existing Generic VNF")
} else if (execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode") == 200 &&
execution.getVariable("CAAIVfMod_vnfId").isEmpty()) {
- msoLogger.debug("Invalid request for new Generic VNF which already exists")
+ logger.debug("Invalid request for new Generic VNF which already exists")
execution.setVariable("CAAIVfMod_queryGenericVnfResponse",
"Invalid request for new Generic VNF which already exists, Vnf Name=" +
- execution.getVariable("CAAIVfMod_vnfName"))
+ execution.getVariable("CAAIVfMod_vnfName"))
} else { // execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode") == 404 &&
// !execution.getVariable("CAAIVfMod_vnfId").isEmpty())
- msoLogger.debug("Invalid request for Add-on Module requested for non-existant Generic VNF")
+ logger.debug("Invalid request for Add-on Module requested for non-existant Generic VNF")
execution.setVariable("CAAIVfMod_createVfModuleResponse",
"Invalid request for Add-on Module requested for non-existant Generic VNF, VNF Id=" +
execution.getVariable("CAAIVfMod_vnfId"))
@@ -216,7 +220,7 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{
execution.setVariable("CAAIVfMod_createGenericVnfResponse", "Vnf Created")
} catch (Exception ex) {
ex.printStackTrace()
- msoLogger.debug("Exception occurred while executing AAI PUT:" + ex.getMessage())
+ logger.debug("Exception occurred while executing AAI PUT:" + ex.getMessage())
exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error - Occured in createGenericVnf.")
}
}
@@ -224,7 +228,7 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{
// construct and send a PUT request to A&AI to create a Base or Add-on VF Module
public void createVfModule(DelegateExecution execution, Boolean isBaseModule) {
// TBD - is this how we want to generate the Id for the new (Base) VF Module?
-
+
// Generate the new VF Module ID here if it has not been provided by the parent process
def newModuleId = execution.getVariable('newVfModuleId')
if (newModuleId == null || newModuleId.isEmpty()) {
@@ -249,7 +253,7 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{
rollbackData.put("VFMODULE", "vnfName", execution.getVariable("CAAIVfMod_vnfName"))
rollbackData.put("VFMODULE", "isBaseModule", isBaseModule.toString())
execution.setVariable("RollbackData", rollbackData)
- msoLogger.debug("RollbackData:" + rollbackData)
+ logger.debug("RollbackData:" + rollbackData)
org.onap.aai.domain.yang.VfModule vfModule = new org.onap.aai.domain.yang.VfModule()
vfModule.setVfModuleId(newModuleId)
@@ -276,14 +280,14 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{
rollbackData.put("VFMODULE", "vfModuleId", newModuleId)
rollbackData.put("VFMODULE", "vfModuleName", execution.getVariable("CAAIVfMod_moduleName"))
execution.setVariable("RollbackData", rollbackData)
- msoLogger.debug("RollbackData:" + rollbackData)
-
+ logger.debug("RollbackData:" + rollbackData)
+
String responseOut = ""
-
+
String isVidRequest = execution.getVariable("isVidRequest")
def moduleIndexString = String.valueOf(moduleIndex)
- if (isBaseModule && (isVidRequest == null || "false".equals(isVidRequest))) {
-
+ if (isBaseModule && (isVidRequest == null || "false".equals(isVidRequest))) {
+
responseOut = """<CreateAAIVfModuleResponse>
<vnf-id>${MsoUtils.xmlEscape(execution.getVariable("CAAIVfMod_vnfId"))}</vnf-id>
<vf-module-id>${MsoUtils.xmlEscape(newModuleId)}</vf-module-id>
@@ -300,13 +304,13 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{
}
execution.setVariable("CreateAAIVfModuleResponse", responseOut)
- msoLogger.debug("CreateAAIVfModuleResponse:" + System.lineSeparator()+responseOut)
- msoLogger.debug("CreateAAIVfModule Response /n " + responseOut)
+ logger.debug("CreateAAIVfModuleResponse:" + System.lineSeparator()+responseOut)
+ logger.debug("CreateAAIVfModule Response /n " + responseOut)
}
} catch (Exception ex) {
execution.setVariable("CAAIVfMod_createVfModuleResponseCode", 500)
execution.setVariable("CAAIVfMod_createVfModuleResponse", ex.getMessage())
- msoLogger.debug("Exception occurred while executing AAI PUT:" + ex.getMessage())
+ logger.debug("Exception occurred while executing AAI PUT:" + ex.getMessage())
exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error - Occured in createVfModule.")
}
}
@@ -344,18 +348,18 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{
GenericVnf genericVnf = execution.getVariable("CAAIVfMod_queryGenericVnfResponse")
def vnfNameFromAAI = genericVnf.getVnfName()
execution.setVariable("CAAIVfMod_vnfNameFromAAI", vnfNameFromAAI)
- msoLogger.debug("Obtained vnf-name from AAI for existing VNF: " + vnfNameFromAAI)
+ logger.debug("Obtained vnf-name from AAI for existing VNF: " + vnfNameFromAAI)
def newModuleName = execution.getVariable("CAAIVfMod_moduleName")
- msoLogger.debug("VF Module to be added: " + newModuleName)
+ logger.debug("VF Module to be added: " + newModuleName)
execution.setVariable("CAAIVfMod_moduleExists", false)
if (genericVnf !=null && genericVnf.getVfModules()!=null && !genericVnf.getVfModules().getVfModule().isEmpty()) {
def qryModuleList = genericVnf.getVfModules().getVfModule()
- msoLogger.debug("Existing VF Module List: " + qryModuleList)
+ logger.debug("Existing VF Module List: " + qryModuleList)
for (org.onap.aai.domain.yang.VfModule qryModule : qryModuleList) {
def qryModuleName = qryModule.getVfModuleName()
if (newModuleName.equals(qryModuleName)) {
// a module with the requested name already exists - failure
- msoLogger.debug("VF Module " + qryModuleName + " already exists for Generic VNF " + vnfNameFromAAI)
+ logger.debug("VF Module " + qryModuleName + " already exists for Generic VNF " + vnfNameFromAAI)
execution.setVariable("CAAIVfMod_moduleExists", true)
execution.setVariable("CAAIVfMod_parseModuleResponse",
"VF Module " + qryModuleName + " already exists for Generic VNF " + vnfNameFromAAI)
@@ -364,31 +368,31 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{
}
}
if (execution.getVariable("CAAIVfMod_moduleExists") == false) {
- msoLogger.debug("VF Module " + execution.getVariable("CAAIVfMod_moduleName") + " does not exist for Generic VNF " + vnfNameFromAAI)
+ logger.debug("VF Module " + execution.getVariable("CAAIVfMod_moduleName") + " does not exist for Generic VNF " + vnfNameFromAAI)
execution.setVariable("CAAIVfMod_parseModuleResponse",
"VF Module " + newModuleName + " does not exist for Generic VNF " + vnfNameFromAAI)
- }
+ }
}
-
+
// parses the output from the result from queryAAIForGenericVnf() to determine if the vf-module-name
- // requested for an Add-on VF Module does not already exist for the specified Generic VNF;
+ // requested for an Add-on VF Module does not already exist for the specified Generic VNF;
// also retrieves VNF name from AAI response for existing VNF
public void parseForBaseModule(DelegateExecution execution) {
GenericVnf genericVnf = execution.getVariable("CAAIVfMod_queryGenericVnfResponse")
def vnfNameFromAAI = genericVnf.getVnfName()
execution.setVariable("CAAIVfMod_vnfNameFromAAI", vnfNameFromAAI)
- msoLogger.debug("Obtained vnf-name from AAI for existing VNF: " + vnfNameFromAAI)
+ logger.debug("Obtained vnf-name from AAI for existing VNF: " + vnfNameFromAAI)
def newModuleName = execution.getVariable("CAAIVfMod_moduleName")
- msoLogger.debug("VF Module to be added: " + newModuleName)
+ logger.debug("VF Module to be added: " + newModuleName)
def qryModuleList = genericVnf !=null ? genericVnf.getVfModules():null;
execution.setVariable("CAAIVfMod_moduleExists", false)
if (qryModuleList != null && !qryModuleList.getVfModule().isEmpty()) {
def qryModules = qryModuleList.getVfModule()
- msoLogger.debug("Existing VF Module List: " + qryModules)
+ logger.debug("Existing VF Module List: " + qryModules)
for (org.onap.aai.domain.yang.VfModule qryModule : qryModules) {
if (newModuleName.equals(qryModule.getVfModuleName())) {
// a module with the requested name already exists - failure
- msoLogger.debug("VF Module " + qryModule.getVfModuleName() + " already exists for Generic VNF " + vnfNameFromAAI)
+ logger.debug("VF Module " + qryModule.getVfModuleName() + " already exists for Generic VNF " + vnfNameFromAAI)
execution.setVariable("CAAIVfMod_baseModuleConflict", true)
execution.setVariable("CAAIVfMod_parseModuleResponse",
"VF Module " + qryModule.getVfModuleName() + " already exists for Generic VNF " + vnfNameFromAAI)
@@ -402,30 +406,32 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{
for (org.onap.aai.domain.yang.VfModule qryModule : qryModules) {
if (qryModule.isBaseVfModule) {
// a base module already exists in this VNF - failure
- msoLogger.debug("Base VF Module already exists for Generic VNF " + vnfNameFromAAI)
+ logger.debug("Base VF Module already exists for Generic VNF " + vnfNameFromAAI)
execution.setVariable("CAAIVfMod_baseModuleConflict", true)
execution.setVariable("CAAIVfMod_parseModuleResponse",
"Base VF Module already exists for Generic VNF " + vnfNameFromAAI)
break
}
}
-
+
}
if (execution.getVariable("CAAIVfMod_baseModuleConflict") == false) {
- msoLogger.debug("VF Module " + execution.getVariable("CAAIVfMod_moduleName") + " does not exist for Generic VNF " + execution.getVariable("CAAIVfMod_vnfNameFromAAI"))
+ logger.debug("VF Module " + execution.getVariable("CAAIVfMod_moduleName") + " does not exist for Generic VNF " + execution.getVariable("CAAIVfMod_vnfNameFromAAI"))
execution.setVariable("CAAIVfMod_parseModuleResponse",
"VF Module " + newModuleName + " does not exist for Generic VNF " + vnfNameFromAAI)
- }
+ }
}
-
+
// generates a WorkflowException when the A&AI query returns a response code other than 200 or 404
public void handleAAIQueryFailure(DelegateExecution execution) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Error occurred attempting to query AAI, Response Code " + execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode") + ", Error Response " + execution.getVariable("CAAIVfMod_queryGenericVnfResponse"), "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Error occurred attempting to query AAI, Response Code " + execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode") + ", Error Response " + execution.getVariable("CAAIVfMod_queryGenericVnfResponse"),
+ "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
int code = execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode")
exceptionUtil.buildAndThrowWorkflowException(execution, code, "Error occurred attempting to query AAI")
}
-
+
// generates a WorkflowException if
// - the A&AI Generic VNF PUT returns a response code other than 200 or 201
// - the requested Generic VNF already exists but vnf-id == null
@@ -437,31 +443,31 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{
def errorResponse
if (execution.getVariable("CAAIVfMod_createGenericVnfResponseCode") != null &&
!isOneOf(execution.getVariable("CAAIVfMod_createGenericVnfResponseCode"), 200, 201)) {
- msoLogger.debug("Failure creating Generic VNF: " + execution.getVariable("CAAIVfMod_createGenericVnfResponse"))
+ logger.debug("Failure creating Generic VNF: " + execution.getVariable("CAAIVfMod_createGenericVnfResponse"))
errorResponse = execution.getVariable("CAAIVfMod_createGenericVnfResponse")
errorCode = 5000
} else if (execution.getVariable("CAAIVfMod_queryGenericVnfResponse") != null &&
execution.getVariable("CAAIVfMod_newGenericVnf") == true) {
// attempted to create a Generic VNF that already exists but vnf-id == null
- msoLogger.debug(execution.getVariable("CAAIVfMod_queryGenericVnfResponse"))
+ logger.debug(execution.getVariable("CAAIVfMod_queryGenericVnfResponse"))
errorResponse = execution.getVariable("CAAIVfMod_queryGenericVnfResponse")
errorCode = 1002
} else if (execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode") == 404 &&
execution.getVariable("CAAIVfMod_newGenericVnf") == false) {
// attempted to create a Generic VNF where vnf-name does not exist but vnf-id != null
- msoLogger.debug(execution.getVariable("CAAIVfMod_queryGenericVnfResponse"))
+ logger.debug(execution.getVariable("CAAIVfMod_queryGenericVnfResponse"))
errorResponse = execution.getVariable("CAAIVfMod_queryGenericVnfResponse")
errorCode = 1002
} else if (execution.getVariable("CAAIVfMod_createVfModuleResponseCode") != null) {
- msoLogger.debug("Failed to add VF Module: " + execution.getVariable("CAAIVfMod_createVfModuleResponse"))
+ logger.debug("Failed to add VF Module: " + execution.getVariable("CAAIVfMod_createVfModuleResponse"))
errorResponse = execution.getVariable("CAAIVfMod_createVfModuleResponse")
errorCode = 5000
} else if (execution.getVariable("CAAIVfMod_moduleExists") == true) {
- msoLogger.debug("Attempting to add VF Module that already exists: " + execution.getVariable("CAAIVfMod_parseModuleResponse"))
+ logger.debug("Attempting to add VF Module that already exists: " + execution.getVariable("CAAIVfMod_parseModuleResponse"))
errorResponse = execution.getVariable("CAAIVfMod_parseModuleResponse")
errorCode = 1002
} else if (execution.getVariable("CAAIVfMod_baseModuleConflict") == true) {
- msoLogger.debug("Attempting to add Base VF Module to VNF that already has a Base VF Module: " + execution.getVariable("CAAIVfMod_parseModuleResponse"))
+ logger.debug("Attempting to add Base VF Module to VNF that already has a Base VF Module: " + execution.getVariable("CAAIVfMod_parseModuleResponse"))
errorResponse = execution.getVariable("CAAIVfMod_parseModuleResponse")
errorCode = 1002
} else {
@@ -470,8 +476,10 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{
errorCode = 2000
}
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Error occurred during CreateAAIVfModule flow", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, errorResponse);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Error occurred during CreateAAIVfModule flow", "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), errorResponse);
exceptionUtil.buildAndThrowWorkflowException(execution, errorCode, errorResponse)
- msoLogger.debug("Workflow exception occurred in CreateAAIVfModule: " + errorResponse)
+ logger.debug("Workflow exception occurred in CreateAAIVfModule: " + errorResponse)
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleVolumeGroup.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleVolumeGroup.groovy
index 075068513a..dc4871119e 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleVolumeGroup.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleVolumeGroup.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -25,10 +27,11 @@ import org.camunda.bpm.engine.delegate.DelegateExecution
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.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
public class CreateAAIVfModuleVolumeGroup extends AbstractServiceTaskProcessor {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CreateAAIVfModuleVolumeGroup.class);
+ private static final Logger logger = LoggerFactory.getLogger( CreateAAIVfModuleVolumeGroup.class);
private XmlParser xmlParser = new XmlParser()
ExceptionUtil exceptionUtil = new ExceptionUtil()
@@ -59,12 +62,12 @@ public class CreateAAIVfModuleVolumeGroup extends AbstractServiceTaskProcessor {
def method = getClass().getSimpleName() + '.preProcessRequest(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
try {
def xml = execution.getVariable('CreateAAIVfModuleVolumeGroupRequest')
- msoLogger.debug('Received request xml:\n' + xml)
- msoLogger.debug("CreateAAIVfModuleVolume Received Request XML: " + xml)
+ logger.debug('Received request xml:\n' + xml)
+ logger.debug("CreateAAIVfModuleVolume Received Request XML: " + xml)
initProcessVariables(execution)
def vnfId = getRequiredNodeText(execution, xml,'vnf-id')
@@ -72,21 +75,21 @@ public class CreateAAIVfModuleVolumeGroup extends AbstractServiceTaskProcessor {
def vfModuleId = getRequiredNodeText(execution, xml,'vf-module-id')
execution.setVariable('CAAIVfModVG_vfModuleId', vfModuleId)
-
+
def aicCloudRegion = getRequiredNodeText(execution, xml,'aic-cloud-region')
execution.setVariable('CAAIVfModVG_aicCloudRegion', aicCloudRegion)
-
+
def cloudOwner = getRequiredNodeText(execution, xml,'cloud-owner')
execution.setVariable('CAAIVfModVG_cloudOwner', cloudOwner)
-
+
def volumeGroupId = getRequiredNodeText(execution, xml,'volume-group-id')
execution.setVariable('CAAIVfModVG_volumeGroupId', volumeGroupId)
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(e);
+ logger.error(e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preProcessRequest(): ' + e.getMessage())
}
@@ -102,7 +105,7 @@ public class CreateAAIVfModuleVolumeGroup extends AbstractServiceTaskProcessor {
def method = getClass().getSimpleName() + '.getVfModule(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
try {
def vnfId = execution.getVariable('CAAIVfModVG_vnfId')
@@ -119,15 +122,15 @@ public class CreateAAIVfModuleVolumeGroup extends AbstractServiceTaskProcessor {
}
}catch (Exception ex) {
ex.printStackTrace()
- msoLogger.debug('Exception occurred while executing AAI GET:' + ex.getMessage())
+ logger.debug('Exception occurred while executing AAI GET:' + ex.getMessage())
execution.setVariable('CAAIVfModVG_getVfModuleResponseCode', 500)
execution.setVariable('CAAIVfModVG_getVfModuleResponse', 'AAI GET Failed:' + ex.getMessage())
}
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(e);
+ logger.error(e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in getVfModule(): ' + e.getMessage())
}
}
@@ -142,7 +145,7 @@ public class CreateAAIVfModuleVolumeGroup extends AbstractServiceTaskProcessor {
def method = getClass().getSimpleName() + '.updateVfModule(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
try {
def vnfId = execution.getVariable('CAAIVfModVG_vnfId')
@@ -152,10 +155,10 @@ public class CreateAAIVfModuleVolumeGroup extends AbstractServiceTaskProcessor {
// Confirm resource-version is in retrieved VF Module
if (vfModule.getResourceVersion() == null) {
def msg = 'Can\'t update VF Module ' + vfModuleId + ' since \'resource-version\' is missing'
- msoLogger.error( msg);
+ logger.error(msg);
throw new Exception(msg)
}
-
+
// Construct payload by creating a Volume Group relationhip and inserting it into the VF Module
def aicCloudRegion = execution.getVariable('CAAIVfModVG_aicCloudRegion')
def cloudOwner = execution.getVariable('CAAIVfModVG_cloudOwner')
@@ -164,31 +167,31 @@ public class CreateAAIVfModuleVolumeGroup extends AbstractServiceTaskProcessor {
try {
AAIResourceUri vfModuleUri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId,vfModuleId);
AAIResourceUri volumeGroupUri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, cloudOwner, aicCloudRegion,volumeGroupId);
- msoLogger.debug("Creating relationship between Vf Module: " + vfModuleUri.build().toString() + " and Volume Group: " + volumeGroupUri.build().toString())
+ logger.debug("Creating relationship between Vf Module: " + vfModuleUri.build().toString() + " and Volume Group: " + volumeGroupUri.build().toString())
getAAIClient().connect(vfModuleUri,volumeGroupUri)
execution.setVariable('CAAIVfModVG_updateVfModuleResponseCode', 200)
execution.setVariable('CAAIVfModVG_updateVfModuleResponse', "Success")
- msoLogger.debug("CreateAAIVfModule Response code: " + 200)
- msoLogger.debug("CreateAAIVfModule Response: " + "Success")
+ logger.debug("CreateAAIVfModule Response code: " + 200)
+ logger.debug("CreateAAIVfModule Response: " + "Success")
} catch (Exception ex) {
ex.printStackTrace()
- msoLogger.debug('Exception occurred while executing AAI PUT:' + ex.getMessage())
+ logger.debug('Exception occurred while executing AAI PUT:' + ex.getMessage())
execution.setVariable('CAAIVfModVG_updateVfModuleResponseCode', 500)
execution.setVariable('CAAIVfModVG_updateVfModuleResponse', 'AAI PUT Failed:' + ex.getMessage())
}
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(e);
+ logger.error(e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in updateVfModule(): ' + e.getMessage())
}
}
-
+
/**
* Find and return the value of the Volume Group ID for the specified VF Module. If
* the value of the Volume Group ID cannot be found for any reason, 'null' is returned.
- *
+ *
* @param vfModuleNode VF Module (as a Node) retrieved from AAI.
* @return the value of the Volume Group ID for the specified VF Module. If the
* value of the Volume Group ID cannot be found for any reason, 'null' is returned.
@@ -214,12 +217,12 @@ public class CreateAAIVfModuleVolumeGroup extends AbstractServiceTaskProcessor {
def method = getClass().getSimpleName() + '.handleAAIQueryFailure(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
- msoLogger.error( 'Error occurred attempting to query AAI, Response Code ' + execution.getVariable('CAAIVfModVG_getVfModuleResponseCode'));
+ logger.trace('Entered ' + method)
+ logger.error('Error occurred attempting to query AAI, Response Code ' + execution.getVariable('CAAIVfModVG_getVfModuleResponseCode'));
ExceptionUtil exceptionUtil = new ExceptionUtil()
exceptionUtil.buildWorkflowException(execution, 5000, execution.getVariable('CAAIVfModVG_getVfModuleResponse'))
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
}
/**
@@ -231,12 +234,12 @@ public class CreateAAIVfModuleVolumeGroup extends AbstractServiceTaskProcessor {
def method = getClass().getSimpleName() + '.handleUpdateVfModuleFailure(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
- msoLogger.error('Error occurred attempting to update VF Module in AAI, Response Code ' + execution.getVariable('CAAIVfModVG_updateVfModuleResponseCode'));
+ logger.error('Error occurred attempting to update VF Module in AAI, Response Code ' + execution.getVariable('CAAIVfModVG_updateVfModuleResponseCode'));
ExceptionUtil exceptionUtil = new ExceptionUtil()
exceptionUtil.buildWorkflowException(execution, 5000, execution.getVariable('CAAIVfModVG_updateVfModuleResponse'))
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DecomposeService.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DecomposeService.groovy
index 1c1d5eb0e3..d8e4b7f6b1 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DecomposeService.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DecomposeService.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -26,7 +28,8 @@ import org.json.JSONObject;
import org.onap.so.bpmn.core.domain.ServiceDecomposition
import org.onap.so.bpmn.core.json.DecomposeJsonUtil;
import org.onap.so.bpmn.core.json.JsonUtils
-import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
/**
* This groovy class supports the <class>DecomposeService.bpmn</class> process.
@@ -48,7 +51,7 @@ import org.onap.so.logger.MsoLogger
*
*/
public class DecomposeService extends AbstractServiceTaskProcessor {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DecomposeService.class);
+ private static final Logger logger = LoggerFactory.getLogger( DecomposeService.class);
String Prefix="DDS_"
@@ -58,7 +61,7 @@ public class DecomposeService extends AbstractServiceTaskProcessor {
public void preProcessRequest (DelegateExecution execution) {
String msg = ""
- msoLogger.trace("preProcessRequest of DecomposeService ")
+ logger.trace("preProcessRequest of DecomposeService ")
setBasicDBAuthHeader(execution, execution.getVariable('isDebugLogEnabled'))
try {
@@ -80,15 +83,15 @@ public class DecomposeService extends AbstractServiceTaskProcessor {
throw e;
} catch (Exception ex){
msg = "Exception in preProcessRequest " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("Exit preProcessRequest of DecomposeService ")
+ logger.trace("Exit preProcessRequest of DecomposeService ")
}
public void queryCatalogDb (DelegateExecution execution) {
String msg = ""
- msoLogger.trace("queryCatalogDB of DecomposeService ")
+ logger.trace("queryCatalogDB of DecomposeService ")
try {
@@ -97,8 +100,8 @@ public class DecomposeService extends AbstractServiceTaskProcessor {
String serviceModelUuid = execution.getVariable("DDS_serviceModelUuid")
String modelVersion = execution.getVariable("DDS_modelVersion")
- msoLogger.debug("serviceModelInvariantId: " + serviceModelInvariantId)
- msoLogger.debug("modelVersion: " + modelVersion)
+ logger.debug("serviceModelInvariantId: " + serviceModelInvariantId)
+ logger.debug("modelVersion: " + modelVersion)
JSONObject catalogDbResponse = null
if(serviceModelUuid != null && serviceModelUuid.length() > 0)
@@ -110,30 +113,30 @@ public class DecomposeService extends AbstractServiceTaskProcessor {
if (catalogDbResponse == null || catalogDbResponse.toString().equalsIgnoreCase("null")) {
msg = "No data found in Catalog DB"
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
String catalogDbResponseString = catalogDbResponse.toString()
execution.setVariable("DDS_catalogDbResponse", catalogDbResponseString)
- msoLogger.debug("catalog DB response string: "+ catalogDbResponseString)
+ logger.debug("catalog DB response string: "+ catalogDbResponseString)
} catch (BpmnError e) {
throw e;
} catch (Exception ex){
msg = "Exception in queryCatalogDb " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("Exit queryCatalogDb of DecomposeService ")
+ logger.trace("Exit queryCatalogDb of DecomposeService ")
}
public void actuallyDecomposeService (DelegateExecution execution) {
String msg = ""
- msoLogger.trace("actuallyDecomposeService of DecomposeService ")
+ logger.trace("actuallyDecomposeService of DecomposeService ")
try {
@@ -142,9 +145,9 @@ public class DecomposeService extends AbstractServiceTaskProcessor {
String serviceInstanceId = execution.getVariable("serviceInstanceId")
String serviceModelInvariantId = execution.getVariable("DDS_serviceModelInvariantId")
- msoLogger.debug("serviceModelInvariantId: " + serviceModelInvariantId)
+ logger.debug("serviceModelInvariantId: " + serviceModelInvariantId)
- msoLogger.debug("getting service decomposition")
+ logger.debug("getting service decomposition")
String catalogDbResponse = execution.getVariable("DDS_catalogDbResponse")
ServiceDecomposition serviceDecomposition = DecomposeJsonUtil.jsonToServiceDecomposition(catalogDbResponse, serviceInstanceId)
@@ -152,16 +155,16 @@ public class DecomposeService extends AbstractServiceTaskProcessor {
execution.setVariable("serviceDecomposition", serviceDecomposition)
execution.setVariable("serviceDecompositionString", serviceDecomposition.toJsonString())
- msoLogger.debug("service decomposition: "+ serviceDecomposition.toJsonString())
+ logger.debug("service decomposition: "+ serviceDecomposition.toJsonString())
} catch (BpmnError e) {
throw e;
} catch (Exception ex){
msg = "Exception in actuallyDecomposeService " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("Exit actuallyDecomposeService of DecomposeService ")
+ logger.trace("Exit actuallyDecomposeService of DecomposeService ")
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModule.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModule.groovy
index b8df241913..301c74d2eb 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModule.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModule.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -27,9 +29,11 @@ import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.client.graphinventory.entities.uri.Depth
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DeleteAAIVfModule.class);
+ private static final Logger logger = LoggerFactory.getLogger( DeleteAAIVfModule.class);
def Prefix="DAAIVfMod_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
@@ -55,20 +59,20 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{
execution.setVariable("DAAIVfMod_deleteVfModuleResponse","")
}
-
+
// parse the incoming DELETE_VF_MODULE request and store the Generic Vnf
// and Vf Module Ids in the flow DelegateExecution
public void preProcessRequest(DelegateExecution execution) {
def xml = execution.getVariable("DeleteAAIVfModuleRequest")
- msoLogger.debug("DeleteAAIVfModule Request: " + xml)
- msoLogger.debug("input request xml:" + xml)
+ logger.debug("DeleteAAIVfModule Request: " + xml)
+ logger.debug("input request xml:" + xml)
initProcessVariables(execution)
def vnfId = utils.getNodeText(xml,"vnf-id")
def vfModuleId = utils.getNodeText(xml,"vf-module-id")
execution.setVariable("DAAIVfMod_vnfId", vnfId)
execution.setVariable("DAAIVfMod_vfModuleId", vfModuleId)
}
-
+
// send a GET request to AA&I to retrieve the Generic Vnf/Vf Module information based on a Vnf Id
// expect a 200 response with the information in the response body or a 404 if the Generic Vnf does not exist
public void queryAAIForGenericVnf(DelegateExecution execution) {
@@ -91,12 +95,12 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{
}
} catch (Exception ex) {
- msoLogger.debug("Exception occurred while executing AAI GET:" + ex.getMessage())
+ logger.debug("Exception occurred while executing AAI GET:" + ex.getMessage())
execution.setVariable("DAAIVfMod_queryGenericVnfResponse", "AAI GET Failed:" + ex.getMessage())
exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error - Occured during queryAAIForGenericVnf")
}
}
-
+
// construct and send a DELETE request to A&AI to delete a Generic Vnf
// note: to get here, all the modules associated with the Generic Vnf must already be deleted
public void deleteGenericVnf(DelegateExecution execution) {
@@ -109,7 +113,7 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{
execution.setVariable("DAAIVfMod_deleteGenericVnfResponse", "Vnf Deleted")
} catch (Exception ex) {
ex.printStackTrace()
- msoLogger.debug("Exception occurred while executing AAI DELETE:" + ex.getMessage())
+ logger.debug("Exception occurred while executing AAI DELETE:" + ex.getMessage())
exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error - Occured during deleteGenericVnf")
}
}
@@ -120,7 +124,7 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{
try {
String vnfId = execution.getVariable("DAAIVfMod_vnfId")
String vfModuleId = execution.getVariable("DAAIVfMod_vfModuleId")
-
+
AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId)
getAAIClient().delete(uri)
@@ -128,19 +132,19 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{
execution.setVariable("DAAIVfMod_deleteVfModuleResponse", "Vf Module Deleted")
} catch (Exception ex) {
ex.printStackTrace()
- msoLogger.debug("Exception occurred while executing AAI PUT:" + ex.getMessage())
+ logger.debug("Exception occurred while executing AAI PUT:" + ex.getMessage())
exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error - Occured during deleteVfModule")
}
}
-
+
// parses the output from the result from queryAAIForGenericVnf() to determine if the Vf Module
// to be deleted exists for the specified Generic Vnf and if it is the Base Module,
// there are no Add-on Modules present
public void parseForVfModule(DelegateExecution execution) {
GenericVnf genericVnf = execution.getVariable("DAAIVfMod_queryGenericVnfResponse")
-
+
def delModuleId = execution.getVariable("DAAIVfMod_vfModuleId")
- msoLogger.debug("Vf Module to be deleted: " + delModuleId)
+ logger.debug("Vf Module to be deleted: " + delModuleId)
execution.setVariable("DAAIVfMod_genVnfRsrcVer", genericVnf.getResourceVersion())
@@ -179,30 +183,32 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{
}
}
}
- msoLogger.debug(execution.getVariable("DAAIVfMod_parseModuleResponse"))
+ logger.debug(execution.getVariable("DAAIVfMod_parseModuleResponse"))
}
}
if (execution.getVariable("DAAIVfMod_moduleExists") == false) { // (execution.getVariable("DAAIVfMod_moduleExists") == false)
- msoLogger.debug("Vf Module Id " + delModuleId + " does not exist for Generic Vnf Id " + execution.getVariable("DAAIVfMod_vnfId"))
+ logger.debug("Vf Module Id " + delModuleId + " does not exist for Generic Vnf Id " + execution.getVariable("DAAIVfMod_vnfId"))
execution.setVariable("DAAIVfMod_parseModuleResponse",
"Vf Module Id " + delModuleId + " does not exist for Generic Vnf Id " +
execution.getVariable("DAAIVfMod_vnfName"))
}
}
-
+
// parses the output from the result from queryAAIForGenericVnf() to determine if the Vf Module
// to be deleted exists for the specified Generic Vnf and if it is the Base Module,
// there are no Add-on Modules present
public void parseForResourceVersion(DelegateExecution execution) {
GenericVnf genericVnf = execution.getVariable("DAAIVfMod_queryGenericVnfResponse")
execution.setVariable("DAAIVfMod_genVnfRsrcVer", genericVnf.getResourceVersion())
- msoLogger.debug("Latest Generic VNF Resource Version: " + genericVnf.getResourceVersion())
+ logger.debug("Latest Generic VNF Resource Version: " + genericVnf.getResourceVersion())
}
-
-
+
+
// generates a WorkflowException if the A&AI query returns a response code other than 200
public void handleAAIQueryFailure(DelegateExecution execution) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Error occurred attempting to query AAI, Response Code " + execution.getVariable("DAAIVfMod_queryGenericVnfResponseCode") + ", Error Response " + execution.getVariable("DAAIVfMod_queryGenericVnfResponse"), "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Error occurred attempting to query AAI, Response Code " + execution.getVariable("DAAIVfMod_queryGenericVnfResponseCode") + ", Error Response " + execution.getVariable("DAAIVfMod_queryGenericVnfResponse"),
+ "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
def errorCode = 5000
// set the errorCode to distinguish between a A&AI failure
// and the Generic Vnf Id not found
@@ -211,7 +217,7 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{
}
exceptionUtil.buildAndThrowWorkflowException(execution, errorCode, execution.getVariable("DAAIVfMod_queryGenericVnfResponse"))
}
-
+
// generates a WorkflowException if
// - the A&AI Vf Module DELETE returns a response code other than 200
// - the Vf Module is a Base Module that is not the last Vf Module
@@ -221,24 +227,24 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{
def errorResponse = ""
if (execution.getVariable("DAAIVfMod_deleteVfModuleResponseCode") != null &&
execution.getVariable("DAAIVfMod_deleteVfModuleResponseCode") != 200) {
- msoLogger.debug("AAI failure deleting a Vf Module: " + execution.getVariable("DAAIVfMod_deleteVfModuleResponse"))
+ logger.debug("AAI failure deleting a Vf Module: " + execution.getVariable("DAAIVfMod_deleteVfModuleResponse"))
errorResponse = execution.getVariable("DAAIVfMod_deleteVfModuleResponse")
- msoLogger.debug("DeleteAAIVfModule - deleteVfModuleResponse" + errorResponse)
+ logger.debug("DeleteAAIVfModule - deleteVfModuleResponse" + errorResponse)
errorCode = 5000
} else {
if (execution.getVariable("DAAIVfMod_isBaseModule", true) == true &&
execution.getVariable("DAAIVfMod_isLastModule") == false) {
// attempt to delete a Base Module that is not the last Vf Module
- msoLogger.debug(execution.getVariable("DAAIVfMod_parseModuleResponse"))
+ logger.debug(execution.getVariable("DAAIVfMod_parseModuleResponse"))
errorResponse = execution.getVariable("DAAIVfMod_parseModuleResponse")
- msoLogger.debug("DeleteAAIVfModule - parseModuleResponse" + errorResponse)
+ logger.debug("DeleteAAIVfModule - parseModuleResponse" + errorResponse)
errorCode = 1002
} else {
// attempt to delete a non-existant Vf Module
if (execution.getVariable("DAAIVfMod_moduleExists") == false) {
- msoLogger.debug(execution.getVariable("DAAIVfMod_parseModuleResponse"))
+ logger.debug(execution.getVariable("DAAIVfMod_parseModuleResponse"))
errorResponse = execution.getVariable("DAAIVfMod_parseModuleResponse")
- msoLogger.debug("DeleteAAIVfModule - parseModuleResponse" + errorResponse)
+ logger.debug("DeleteAAIVfModule - parseModuleResponse" + errorResponse)
errorCode = 1002
} else {
// if the responses get populated corerctly, we should never get here
@@ -247,7 +253,9 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{
}
}
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Error occurred during DeleteAAIVfModule flow", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, errorResponse);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Error occurred during DeleteAAIVfModule flow", "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), errorResponse);
exceptionUtil.buildAndThrowWorkflowException(execution, errorCode, errorResponse)
}
@@ -255,7 +263,10 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{
// generates a WorkflowException if
// - the A&AI Generic Vnf DELETE returns a response code other than 200
public void handleDeleteGenericVnfFailure(DelegateExecution execution) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "AAI error occurred deleting the Generic Vnf", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, execution.getVariable("DAAIVfMod_deleteGenericVnfResponse"));
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "AAI error occurred deleting the Generic Vnf", "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(),
+ execution.getVariable("DAAIVfMod_deleteGenericVnfResponse"));
exceptionUtil.buildAndThrowWorkflowException(execution, 5000, execution.getVariable("DAAIVfMod_deleteGenericVnfResponse"))
}
}
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 e132b411a5..a77320b771 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
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -30,6 +32,8 @@ import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
@@ -37,7 +41,7 @@ import org.onap.so.logger.MsoLogger
* @version 1.0
*/
class ExceptionUtil extends AbstractServiceTaskProcessor {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, ExceptionUtil.class);
+ private static final Logger logger = LoggerFactory.getLogger( ExceptionUtil.class);
@@ -57,12 +61,12 @@ class ExceptionUtil extends AbstractServiceTaskProcessor {
def utils=new MsoUtils()
def prefix=execution.getVariable("prefix")
def errorMsg = execution.getVariable(prefix+"ErrorResponse")
- msoLogger.trace("Begin MapAAIExceptionToWorkflowException ")
+ logger.trace("Begin MapAAIExceptionToWorkflowException ")
String text = null
def variables
String errorCode = '5000'
WorkflowException wfex
- msoLogger.debug("response: " + response)
+ logger.debug("response: " + response)
try{
try {
//String msg = utils.getNodeXml(response, "Fault")
@@ -70,7 +74,7 @@ class ExceptionUtil extends AbstractServiceTaskProcessor {
text = utils.getNodeText(response, "text")
} catch (Exception ex) {
//Ignore the exception - cases include non xml payload
- msoLogger.debug("error mapping error, ignoring: " + ex)
+ logger.debug("error mapping error, ignoring: " + ex)
}
if(text != null) {
@@ -81,12 +85,13 @@ class ExceptionUtil extends AbstractServiceTaskProcessor {
text = text.replaceFirst("%4", variables[3])
}
String modifiedErrorMessage = 'Received error from A&amp;AI (' + text +')'
- msoLogger.debug("ModifiedErrorMessage " + modifiedErrorMessage)
+ logger.debug("ModifiedErrorMessage " + modifiedErrorMessage)
// let $ModifiedErrorMessage := concat( 'Received error from A',$exceptionaai:ampersand,'AI (' ,functx:replace-multi($ErrorMessage,$from,$Variables ),')')
buildWorkflowException(execution, 5000, modifiedErrorMessage)
wfex = execution.getVariable("WorkflowException")
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Fault", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, wfex.errorMessage);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Fault", "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), wfex.errorMessage);
return wfex
} else {
try {
@@ -96,18 +101,19 @@ class ExceptionUtil extends AbstractServiceTaskProcessor {
int errorCodeInt = Integer.parseInt(errorCode)
buildWorkflowException(execution, errorCodeInt, mappedErrorMessage)
- msoLogger.debug("mappedErrorMessage " + mappedErrorMessage)
+ logger.debug("mappedErrorMessage " + mappedErrorMessage)
wfex = execution.getVariable("WorkflowException")
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Fault", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, wfex.errorMessage);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Fault", "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), wfex.errorMessage);
return wfex
} catch(Exception ex) {
- msoLogger.debug("error mapping error, return null: " + ex)
+ logger.debug("error mapping error, return null: " + ex)
return null
}
}
}catch(Exception e){
- msoLogger.debug("Exception occured during MapAAIExceptionToWorkflowException: " + e)
+ logger.debug("Exception occured during MapAAIExceptionToWorkflowException: " + e)
buildWorkflowException(execution, 5000, "Error mapping AAI Response to WorkflowException")
}
}
@@ -125,7 +131,7 @@ class ExceptionUtil extends AbstractServiceTaskProcessor {
*/
WorkflowException MapAAIExceptionToWorkflowExceptionGeneric(DelegateExecution execution, String response, int resCode){
def utils=new MsoUtils()
- msoLogger.debug("Start MapAAIExceptionToWorkflowExceptionGeneric Process")
+ logger.debug("Start MapAAIExceptionToWorkflowExceptionGeneric Process")
WorkflowException wfex
try {
@@ -142,12 +148,12 @@ class ExceptionUtil extends AbstractServiceTaskProcessor {
buildWorkflowException(execution, resCode, "Received a bad response from AAI")
}
} catch (Exception ex) {
- msoLogger.debug("Exception Occured during MapAAIExceptionToWorkflowExceptionGeneric: " + ex)
+ logger.debug("Exception Occured during MapAAIExceptionToWorkflowExceptionGeneric: " + ex)
buildWorkflowException(execution, resCode, "Internal Error - Occured in MapAAIExceptionToWorkflowExceptionGeneric")
}
- msoLogger.debug("Outgoing WorkflowException is: " + execution.getVariable("WorkflowException"))
- msoLogger.debug("Completed MapAAIExceptionToWorkflowExceptionGeneric Process")
+ logger.debug("Outgoing WorkflowException is: " + execution.getVariable("WorkflowException"))
+ logger.debug("Completed MapAAIExceptionToWorkflowExceptionGeneric Process")
}
/**
@@ -269,11 +275,11 @@ class ExceptionUtil extends AbstractServiceTaskProcessor {
public void buildWorkflowException(DelegateExecution execution, int errorCode, String errorMessage) {
MsoUtils utils = new MsoUtils()
String processKey = getProcessKey(execution);
- msoLogger.debug("Building a WorkflowException for " + processKey)
+ logger.debug("Building a WorkflowException for " + processKey)
WorkflowException exception = new WorkflowException(processKey, errorCode, errorMessage);
execution.setVariable("WorkflowException", exception);
- msoLogger.debug("Outgoing WorkflowException is " + exception)
+ logger.debug("Outgoing WorkflowException is " + exception)
}
/**
@@ -287,12 +293,12 @@ class ExceptionUtil extends AbstractServiceTaskProcessor {
*/
public void buildAndThrowWorkflowException(DelegateExecution execution, int errorCode, String errorMessage) {
String processKey = getProcessKey(execution);
- msoLogger.debug("Building a WorkflowException for Subflow " + processKey)
+ logger.debug("Building a WorkflowException for Subflow " + processKey)
WorkflowException exception = new WorkflowException(processKey, errorCode, errorMessage);
execution.setVariable("WorkflowException", exception);
- msoLogger.debug("Outgoing WorkflowException is " + exception)
- msoLogger.debug("Throwing MSOWorkflowException")
+ logger.debug("Outgoing WorkflowException is " + exception)
+ logger.debug("Throwing MSOWorkflowException")
throw new BpmnError(errorCode.toString(), String.format("MSOWorkflowException: %s", errorMessage))
}
@@ -308,16 +314,16 @@ class ExceptionUtil extends AbstractServiceTaskProcessor {
public void processSubflowsBPMNException(DelegateExecution execution){
String processKey = getProcessKey(execution)
try{
- msoLogger.debug("Started ProcessSubflowsBPMNException Method")
+ logger.debug("Started ProcessSubflowsBPMNException Method")
if(execution.getVariable("WorkflowException") == null){
buildWorkflowException(execution, 2500, "Internal Error - Occured During " + processKey)
}
- msoLogger.debug(processKey + " Outgoing WorkflowException is: " + execution.getVariable("WorkflowException"))
+ logger.debug(processKey + " Outgoing WorkflowException is: " + execution.getVariable("WorkflowException"))
}catch(Exception e){
- msoLogger.debug("Caught Exception during ProcessSubflowsBPMNException Method: " + e)
+ logger.debug("Caught Exception during ProcessSubflowsBPMNException Method: " + e)
}
- msoLogger.debug("Completed ProcessSubflowsBPMNException Method")
+ logger.debug("Completed ProcessSubflowsBPMNException Method")
}
/**
@@ -334,7 +340,7 @@ class ExceptionUtil extends AbstractServiceTaskProcessor {
public String processMainflowsBPMNException(DelegateExecution execution, String requestInfo){
String processKey = getProcessKey(execution)
try{
- msoLogger.debug("Started ProcessMainflowBPMNException Method")
+ logger.debug("Started ProcessMainflowBPMNException Method")
if(execution.getVariable("WorkflowException") == null || isBlank(requestInfo)){
buildWorkflowException(execution, 2500, "Internal Error - WorkflowException Object and/or RequestInfo is null! " + processKey)
}
@@ -354,16 +360,16 @@ class ExceptionUtil extends AbstractServiceTaskProcessor {
</aetgt:WorkflowException>
</aetgt:FalloutHandlerRequest>"""
- msoLogger.debug(processKey + " Outgoing WorkflowException is: " + execution.getVariable("WorkflowException"))
- msoLogger.debug(processKey + " Outgoing FalloutHandler Request is: " + falloutHandlerRequest)
+ logger.debug(processKey + " Outgoing WorkflowException is: " + execution.getVariable("WorkflowException"))
+ logger.debug(processKey + " Outgoing FalloutHandler Request is: " + falloutHandlerRequest)
return falloutHandlerRequest
}catch(Exception e){
- msoLogger.debug("Caught Exception during ProcessMainflowBPMNException Method: " + e)
+ logger.debug("Caught Exception during ProcessMainflowBPMNException Method: " + e)
return null
}
- msoLogger.debug("Completed ProcessMainflowBPMNException Method")
+ logger.debug("Completed ProcessMainflowBPMNException Method")
}
/**
@@ -377,8 +383,8 @@ class ExceptionUtil extends AbstractServiceTaskProcessor {
public void processJavaException(DelegateExecution execution){
String processKey = getProcessKey(execution)
try{
- msoLogger.debug("Caught a Java Exception in " + processKey)
- msoLogger.debug("Started processJavaException Method")
+ logger.debug("Caught a Java Exception in " + processKey)
+ logger.debug("Started processJavaException Method")
// if the BPMN flow java error handler sets "BPMN_javaExpMsg", append it to the WFE
String javaExpMsg = execution.getVariable("BPMN_javaExpMsg")
String errorMessage = execution.getVariable("gUnknownError")
@@ -387,20 +393,20 @@ class ExceptionUtil extends AbstractServiceTaskProcessor {
wfeExpMsg = wfeExpMsg + ": " + javaExpMsg
}
if (errorMessage != null && !errorMessage.empty) {
- msoLogger.error("Unknown Error: " + errorMessage);
+ logger.error("Unknown Error: " + errorMessage);
}
- msoLogger.error("Java Error: " + wfeExpMsg);
+ logger.error("Java Error: " + wfeExpMsg);
buildWorkflowException(execution, 2500, wfeExpMsg)
}catch(BpmnError b){
- msoLogger.error(b);
+ logger.error(b);
throw b
}catch(Exception e){
- msoLogger.error(e);
- msoLogger.debug("Caught Exception during processJavaException Method: " + e)
+ logger.error(e);
+ logger.debug("Caught Exception during processJavaException Method: " + e)
buildWorkflowException(execution, 2500, "Internal Error - During Process Java Exception")
}
- msoLogger.debug("Completed processJavaException Method")
+ logger.debug("Completed processJavaException Method")
}
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 94c82f5a0c..918bcdd4cc 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
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2018 Huawei Technologies Co., Ltd. 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
@@ -25,7 +27,8 @@ import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.logging.ref.slf4j.ONAPLogConstants
import org.onap.so.client.HttpClient
import org.onap.so.client.HttpClientFactory
-import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
import org.onap.so.utils.TargetEntity
import javax.ws.rs.core.MediaType
@@ -37,7 +40,7 @@ class ExternalAPIUtil {
String Prefix="EXTAPI_"
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, ExternalAPIUtil.class)
+ private static final Logger logger = LoggerFactory.getLogger( ExternalAPIUtil.class);
private final HttpClientFactory httpClientFactory;
private final MsoUtils utils;
@@ -96,7 +99,7 @@ class ExternalAPIUtil {
//
// def uri = execution.getVariable("ExternalAPIURi")
// if(uri) {
-// msoLogger.debug("ExternalAPIUtil.getUri: " + uri)
+// logger.debug("ExternalAPIUtil.getUri: " + uri)
// return uri
// }
//
@@ -104,21 +107,21 @@ class ExternalAPIUtil {
// }
public String setTemplate(String template, Map<String, String> valueMap) {
- msoLogger.debug("ExternalAPIUtil setTemplate", true);
+ logger.debug("ExternalAPIUtil setTemplate", true);
StringBuffer result = new StringBuffer();
String pattern = "<.*>";
Pattern r = Pattern.compile(pattern);
Matcher m = r.matcher(template);
- msoLogger.debug("ExternalAPIUtil template:" + template, true);
+ logger.debug("ExternalAPIUtil template:" + template, true);
while (m.find()) {
String key = template.substring(m.start() + 1, m.end() - 1);
- msoLogger.debug("ExternalAPIUtil key:" + key + " contains key? " + valueMap.containsKey(key), true);
+ logger.debug("ExternalAPIUtil key:" + key + " contains key? " + valueMap.containsKey(key), true);
m.appendReplacement(result, valueMap.getOrDefault(key, "\"TBD\""));
}
m.appendTail(result);
- msoLogger.debug("ExternalAPIUtil return:" + result.toString(), true);
+ logger.debug("ExternalAPIUtil return:" + result.toString(), true);
return result.toString();
}
@@ -134,12 +137,12 @@ class ExternalAPIUtil {
*
*/
public Response executeExternalAPIGetCall(DelegateExecution execution, String url){
- msoLogger.debug(" ======== STARTED Execute ExternalAPI Get Process ======== ")
+ logger.debug(" ======== STARTED Execute ExternalAPI Get Process ======== ")
Response apiResponse = null
try{
String uuid = utils.getRequestID()
- msoLogger.debug( "Generated uuid is: " + uuid)
- msoLogger.debug( "URL to be used is: " + url)
+ logger.debug( "Generated uuid is: " + uuid)
+ logger.debug( "URL to be used is: " + url)
HttpClient client = httpClientFactory.newJsonClient(new URL(url), TargetEntity.EXTERNAL)
client.addBasicAuthHeader(execution.getVariable("URN_externalapi_auth"), execution.getVariable("URN_mso_msoKey"))
@@ -149,9 +152,9 @@ class ExternalAPIUtil {
apiResponse = client.get()
- msoLogger.debug( "======== COMPLETED Execute ExternalAPI Get Process ======== ")
+ logger.debug( "======== COMPLETED Execute ExternalAPI Get Process ======== ")
}catch(Exception e){
- msoLogger.debug("Exception occured while executing ExternalAPI Get Call. Exception is: \n" + e)
+ logger.debug("Exception occured while executing ExternalAPI Get Call. Exception is: \n" + e)
exceptionUtil.buildAndThrowWorkflowException(execution, 9999, e.getMessage())
}
return apiResponse
@@ -170,12 +173,12 @@ class ExternalAPIUtil {
*
*/
public Response executeExternalAPIPostCall(DelegateExecution execution, String url, String payload){
- msoLogger.debug( " ======== Started Execute ExternalAPI Post Process ======== ")
+ logger.debug( " ======== Started Execute ExternalAPI Post Process ======== ")
Response apiResponse = null
try{
String uuid = utils.getRequestID()
- msoLogger.debug( "Generated uuid is: " + uuid)
- msoLogger.debug( "URL to be used is: " + url)
+ logger.debug( "Generated uuid is: " + uuid)
+ logger.debug( "URL to be used is: " + url)
HttpClient httpClient = httpClientFactory.newJsonClient(new URL(url), TargetEntity.AAI)
httpClient.addBasicAuthHeader(execution.getVariable("URN_externalapi_auth"), execution.getVariable("URN_mso_msoKey"))
@@ -184,9 +187,9 @@ class ExternalAPIUtil {
apiResponse = httpClient.post(payload)
- msoLogger.debug( "======== Completed Execute ExternalAPI Post Process ======== ")
+ logger.debug( "======== Completed Execute ExternalAPI Post Process ======== ")
}catch(Exception e){
- msoLogger.error("Exception occured while executing ExternalAPI Post Call. Exception is: \n" + e)
+ logger.error("Exception occured while executing ExternalAPI Post Call. Exception is: \n" + e)
exceptionUtil.buildAndThrowWorkflowException(execution, 9999, e.getMessage())
}
return apiResponse
@@ -194,4 +197,4 @@ class ExternalAPIUtil {
-} \ No newline at end of file
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/FalloutHandler.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/FalloutHandler.groovy
index 480dcd5e8f..2a8f8f1593 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/FalloutHandler.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/FalloutHandler.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -28,20 +30,22 @@ import org.apache.commons.lang3.*
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
public class FalloutHandler extends AbstractServiceTaskProcessor {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, FalloutHandler.class);
+ private static final Logger logger = LoggerFactory.getLogger( FalloutHandler.class);
String Prefix="FH_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
-
+
public initializeProcessVariables(DelegateExecution execution){
def method = getClass().getSimpleName() + '.initializeProcessVariables(' +'execution=' + execution.getId() +')'
- msoLogger.trace('Entered ' + method)
-
+ logger.trace('Entered ' + method)
+
try {
execution.setVariable("prefix",Prefix)
-
+
//These variables are form the input Message to the BPMN
execution.setVariable("FH_request_id","")
execution.setVariable("FH_request_action","")
@@ -83,42 +87,44 @@ public class FalloutHandler extends AbstractServiceTaskProcessor {
//Auth variables
execution.setVariable("BasicAuthHeaderValue","")
-
+
//Parameter list
execution.setVariable("FH_parameterList", "")
-
+
//Response variables
execution.setVariable("FalloutHandlerResponse","")
execution.setVariable("FH_ErrorResponse", null)
execution.setVariable("FH_ResponseCode", "")
-
+
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
// exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method)
}
}
-
+
public void preProcessRequest (DelegateExecution execution) {
def method = getClass().getSimpleName() + '.preProcessRequest(' +'execution=' + execution.getId() +')'
- msoLogger.trace('Entered ' + method)
-
+ logger.trace('Entered ' + method)
+
// Initialize flow variables
initializeProcessVariables(execution)
setSuccessIndicator(execution, false)
-
+
setBasicDBAuthHeader(execution, execution.getVariable('isDebugLogEnabled'))
-
+
try {
def xml = execution.getVariable("FalloutHandlerRequest")
- msoLogger.debug(" XML --> " + xml)
- msoLogger.debug("FalloutHandler request: " + xml)
-
+ logger.debug(" XML --> " + xml)
+ logger.debug("FalloutHandler request: " + xml)
+
//Check the incoming request type
//Incoming request can be ACTIVE_REQUESTS (request-information node) or INFRA_ACTIVE_REQUESTS (request-info node)
if (utils.nodeExists(xml, "request-information")) {
execution.setVariable("FH_request_id-Ok", true) // Incoming request is for ACTIVE_REQUESTS
}
-
+
//Check notification-url for the incoming request type
//ACTIVE_REQUESTS may have notificationurl node
//INFRA_ACTIVE_REQUESTS notificationurl node does not exist
@@ -126,7 +132,7 @@ public class FalloutHandler extends AbstractServiceTaskProcessor {
if (utils.nodeExists(xml, "notification-url")) {
notificationurl = utils.getNodeText(xml,"notification-url")
if(notificationurl != null && !notificationurl.isEmpty()) {
- msoLogger.debug("********** Incoming notification Url is: " + notificationurl);
+ logger.debug("********** Incoming notification Url is: " + notificationurl);
execution.setVariable("FH_notification-url-Ok", true)
execution.setVariable("FH_notification-url",notificationurl)
}
@@ -139,8 +145,8 @@ public class FalloutHandler extends AbstractServiceTaskProcessor {
if (utils.nodeExists(xml, "request-id")) {
execution.setVariable("FH_request_id",utils.getNodeText(xml,"request-id"))
}
- msoLogger.debug("FH_request_id: " + execution.getVariable("FH_request_id"))
-
+ logger.debug("FH_request_id: " + execution.getVariable("FH_request_id"))
+
// INFRA_ACTIVE_REQUESTS have "action" element ... mandatory
// ACTIVE_REQUEST have "request-action" ... mandatory
if (utils.nodeExists(xml, "request-action")) {
@@ -148,8 +154,8 @@ public class FalloutHandler extends AbstractServiceTaskProcessor {
} else if (utils.nodeExists(xml, "action")) {
execution.setVariable("FH_request_action",utils.getNodeText(xml,"action"))
}
-
-
+
+
//Check source for the incoming request type
//For INFRA_ACTIVE_REQUESTS payload source IS optional
//For ACTIVE_REQUESTS payload source is NOT optional
@@ -157,7 +163,7 @@ public class FalloutHandler extends AbstractServiceTaskProcessor {
if (utils.nodeExists(xml, "source")) {
execution.setVariable("FH_source",utils.getNodeText(xml,"source"))
}
-
+
//Check if ErrorCode node exists. If yes, initialize it from request xml, if no, it will stay with defaulf value already set in initializeProcessVariables() method above.
def errorCode = ""
if (utils.nodeExists(xml, "ErrorCode")) {
@@ -166,8 +172,8 @@ public class FalloutHandler extends AbstractServiceTaskProcessor {
execution.setVariable("FH_ErrorCode", errorCode)
}
}
- msoLogger.debug("FH_ErrorCode: " + errorCode)
-
+ logger.debug("FH_ErrorCode: " + errorCode)
+
//Check if ErrorMessage node exists. If yes, initialize it from request xml, if no, it will stay with defaulf value already set in initializeProcessVariables() method above.
def errorMessage = ""
if (utils.nodeExists(xml, "ErrorMessage")) {
@@ -177,25 +183,25 @@ public class FalloutHandler extends AbstractServiceTaskProcessor {
execution.setVariable("FH_ErrorMessage", errorCode)
}
}
-
+
//Check for Parameter List
if (utils.nodeExists(xml, "parameter-list")) {
def parameterList = utils.getNodeXml(xml, "parameter-list", false)
execution.setVariable("FH_parameterList", parameterList)
}
-
- msoLogger.trace("--> " + execution.getVariable(""))
- msoLogger.debug("FH_request_id-OK --> " + execution.getVariable("FH_request_id-Ok"))
-
+
+ logger.trace("--> " + execution.getVariable(""))
+ logger.debug("FH_request_id-OK --> " + execution.getVariable("FH_request_id-Ok"))
+
// set the DHV/Service Instantiation values if specified in the request
execution.setVariable("FH_is_srv_inst_req", String.valueOf("true".equals(utils.getNodeText(xml, "is-srv-inst-req"))))
- msoLogger.trace("--> " + execution.getVariable(""))
+ logger.trace("--> " + execution.getVariable(""))
execution.setVariable("FH_is_json_content", String.valueOf("JSON".equals(utils.getNodeText(xml, "resp-content-type"))))
- msoLogger.trace("--> " + execution.getVariable(""))
+ logger.trace("--> " + execution.getVariable(""))
execution.setVariable("FH_service_inst_id", utils.getNodeText(xml, "service-instance-id"))
- msoLogger.trace("--> " + execution.getVariable(""))
+ logger.trace("--> " + execution.getVariable(""))
execution.setVariable("FH_start_time", utils.getNodeText(xml, "start-time"))
- msoLogger.trace("--> " + execution.getVariable(""))
+ logger.trace("--> " + execution.getVariable(""))
// this variable is used by the camunda flow to set the Content-Type for the async response
if (execution.getVariable("FH_is_srv_inst_req").equals("true") &&
execution.getVariable("FH_is_json_content").equals("true")) {
@@ -204,17 +210,19 @@ public class FalloutHandler extends AbstractServiceTaskProcessor {
execution.setVariable("FH_content_type", "text/xml")
}
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
// exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in" + method)
}
-
- msoLogger.debug("OUTOF --> Initialize Variables Fallout Handler #########");
+
+ logger.debug("OUTOF --> Initialize Variables Fallout Handler #########");
}
-
+
public String updateRequestPayload (DelegateExecution execution){
def method = getClass().getSimpleName() + '.updateRequestPayload(' +'execution=' + execution.getId() +')'
- msoLogger.trace('Entered ' + method)
-
+ logger.trace('Entered ' + method)
+
try {
String payload = """
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://org.onap.so/requestsdb">
@@ -231,19 +239,21 @@ public class FalloutHandler extends AbstractServiceTaskProcessor {
</soapenv:Body>
</soapenv:Envelope>
"""
-
- msoLogger.debug("updateRequestPayload: " + payload)
+
+ logger.debug("updateRequestPayload: " + payload)
execution.setVariable("FH_updateRequestPayload", payload)
return execution.getVariable("FH_updateRequestPayload")
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
// exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method)
}
}
-
+
public String updateRequestInfraPayload (DelegateExecution execution){
def method = getClass().getSimpleName() + '.updateRequestInfraPayload(' +'execution=' + execution.getId() +')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
try {
String payload = """
@@ -262,18 +272,20 @@ public class FalloutHandler extends AbstractServiceTaskProcessor {
"""
execution.setVariable("FH_updateRequestInfraPayload", payload)
- msoLogger.debug("updateRequestInfraPayload: " + payload)
+ logger.debug("updateRequestInfraPayload: " + payload)
return execution.getVariable("FH_updateRequestInfraPayload")
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
// exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method)
}
}
-
+
public String updateRequestGammaPayload (DelegateExecution execution){
def method = getClass().getSimpleName() + '.updateRequestGammaPayload(' +'execution=' + execution.getId() +')'
- msoLogger.trace('Entered ' + method)
-
+ logger.trace('Entered ' + method)
+
try {
String payload = """
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="${UrnPropertiesReader.getVariable("mso.default.adapter.namespace", execution)}/requestsdb">
@@ -289,20 +301,22 @@ public class FalloutHandler extends AbstractServiceTaskProcessor {
</soapenv:Body>
</soapenv:Envelope>
"""
-
+
execution.setVariable("FH_updateRequestGammaPayload", payload)
- msoLogger.debug("updateRequestGammaPayload: " + payload)
+ logger.debug("updateRequestGammaPayload: " + payload)
return execution.getVariable("FH_updateRequestGammaPayload")
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
// exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method)
}
}
-
+
public String updateResponseStatusPayload (DelegateExecution execution){
def method = getClass().getSimpleName() + '.updateResponseStatusPayload(' +'execution=' + execution.getId() +')'
- msoLogger.trace('Entered ' + method)
-
+ logger.trace('Entered ' + method)
+
try {
String payload = """
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://org.onap.so/requestsdb">
@@ -316,22 +330,24 @@ public class FalloutHandler extends AbstractServiceTaskProcessor {
</soapenv:Body>
</soapenv:Envelope>
"""
-
+
execution.setVariable("FH_updateResponseStatusPayload", payload)
- msoLogger.debug("updateResponseStatusPayload: " + payload)
+ logger.debug("updateResponseStatusPayload: " + payload)
return execution.getVariable("FH_updateResponseStatusPayload")
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
// exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method)
}
}
-
+
public void buildDBWorkflowException(DelegateExecution execution, String responseCodeVariable) {
def method = getClass().getSimpleName() + '.buildDBWorkflowException(' +
'execution=' + execution.getId() +
', responseCodeVariable=' + responseCodeVariable + ')'
- msoLogger.trace('Entered ' + method)
-
+ logger.trace('Entered ' + method)
+
try {
def responseCode = execution.getVariable(responseCodeVariable)
// If the HTTP response code was null, it means a connection fault occurred (a java exception)
@@ -339,40 +355,44 @@ public class FalloutHandler extends AbstractServiceTaskProcessor {
def errorCode = responseCode == null ? 7000 : 7020
// exceptionUtil.buildWorkflowException(execution, errorCode, errorMessage)
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
// exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method)
}
}
-
+
/**
* Used to create a workflow response in success and failure cases.
*/
public void postProcessResponse (DelegateExecution execution) {
def method = getClass().getSimpleName() + '.postProcessResponse(' +'execution=' + execution.getId() +')'
- msoLogger.trace('Entered ' + method)
-
+ logger.trace('Entered ' + method)
+
try {
Boolean success = (Boolean) execution.getVariable("FH_success")
String out = success ? "Fallout Handler Succeeded" : "Fallout Handler Failed";
-
+
String falloutHandlerResponse = """
<workflow:FalloutHandlerResponse xmlns:workflow="http://org.onap/so/workflow/schema/v1">
<workflow:out>${MsoUtils.xmlEscape(out)}</workflow:out>
</workflow:FalloutHandlerResponse>
"""
-
+
falloutHandlerResponse = utils.formatXml(falloutHandlerResponse)
- msoLogger.debug("FalloutHandler Response: " + falloutHandlerResponse);
-
+ logger.debug("FalloutHandler Response: " + falloutHandlerResponse);
+
execution.setVariable("FalloutHandlerResponse", falloutHandlerResponse)
execution.setVariable("WorkflowResponse", falloutHandlerResponse)
execution.setVariable("FH_ResponseCode", success ? "200" : "500")
setSuccessIndicator(execution, success)
-
- msoLogger.debug("FalloutHandlerResponse =\n" + falloutHandlerResponse)
+
+ logger.debug("FalloutHandlerResponse =\n" + falloutHandlerResponse)
} catch (Exception e) {
// Do NOT throw WorkflowException!
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
}
}
-} \ No newline at end of file
+}
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 1be24c4ce0..4d7557bfcd 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
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -41,9 +43,11 @@ import org.onap.so.client.graphinventory.entities.uri.Depth
import org.onap.so.utils.TargetEntity
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
public class GenerateVfModuleName extends AbstractServiceTaskProcessor{
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, GenerateVfModuleName.class);
+ private static final Logger logger = LoggerFactory.getLogger( GenerateVfModuleName.class);
def Prefix="GVFMN_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
@@ -53,13 +57,13 @@ public class GenerateVfModuleName extends AbstractServiceTaskProcessor{
public void preProcessRequest(DelegateExecution execution) {
try {
def vnfId = execution.getVariable("vnfId")
- msoLogger.debug("vnfId is " + vnfId)
+ logger.debug("vnfId is " + vnfId)
def vnfName = execution.getVariable("vnfName")
- msoLogger.debug("vnfName is " + vnfName)
+ logger.debug("vnfName is " + vnfName)
def vfModuleLabel = execution.getVariable("vfModuleLabel")
- msoLogger.debug("vfModuleLabel is " + vfModuleLabel)
+ logger.debug("vfModuleLabel is " + vfModuleLabel)
def personaModelId = execution.getVariable("personaModelId")
- msoLogger.debug("personaModelId is " + personaModelId)
+ logger.debug("personaModelId is " + personaModelId)
execution.setVariable("GVFMN_vfModuleXml", "")
}catch(BpmnError b){
throw b
@@ -73,7 +77,7 @@ public class GenerateVfModuleName extends AbstractServiceTaskProcessor{
def method = getClass().getSimpleName() + '.queryAAI(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
try {
def vnfId = execution.getVariable('vnfId')
@@ -84,7 +88,7 @@ public class GenerateVfModuleName extends AbstractServiceTaskProcessor{
uri.depth(Depth.ONE)
String endPoint = aaiUtil.createAaiUri(uri)
- msoLogger.debug("AAI endPoint: " + endPoint)
+ logger.debug("AAI endPoint: " + endPoint)
try {
HttpClient client = new HttpClientFactory().newXmlClient(new URL(endPoint), TargetEntity.AAI)
@@ -96,29 +100,29 @@ public class GenerateVfModuleName extends AbstractServiceTaskProcessor{
def responseData = ''
- msoLogger.debug('sending GET to AAI endpoint \'' + endPoint + '\'')
+ logger.debug('sending GET to AAI endpoint \'' + endPoint + '\'')
Response response = client.get()
- msoLogger.debug("GenerateVfModuleName - invoking httpGet() to AAI")
+ logger.debug("GenerateVfModuleName - invoking httpGet() to AAI")
responseData = response.readEntity(String.class)
if (responseData != null) {
- msoLogger.debug("Received generic VNF data: " + responseData)
+ logger.debug("Received generic VNF data: " + responseData)
}
- msoLogger.debug("GenerateVfModuleName - queryAAIVfModule Response: " + responseData)
- msoLogger.debug("GenerateVfModuleName - queryAAIVfModule ResponseCode: " + response.getStatus())
+ logger.debug("GenerateVfModuleName - queryAAIVfModule Response: " + responseData)
+ logger.debug("GenerateVfModuleName - queryAAIVfModule ResponseCode: " + response.getStatus())
execution.setVariable('GVFMN_queryAAIVfModuleResponseCode', response.getStatus())
execution.setVariable('GVFMN_queryAAIVfModuleResponse', responseData)
- msoLogger.debug('Response code:' + response.getStatus())
- msoLogger.debug('Response:' + System.lineSeparator() + responseData)
+ logger.debug('Response code:' + response.getStatus())
+ logger.debug('Response:' + System.lineSeparator() + responseData)
if (response.getStatus() == 200) {
// Set the VfModuleXML
if (responseData != null) {
String vfModulesText = utils.getNodeXml(responseData, "vf-modules")
if (vfModulesText == null || vfModulesText.isEmpty()) {
- msoLogger.debug("There are no VF modules in this VNF yet")
+ logger.debug("There are no VF modules in this VNF yet")
execution.setVariable("GVFMN_vfModuleXml", null)
}
else {
@@ -141,21 +145,23 @@ public class GenerateVfModuleName extends AbstractServiceTaskProcessor{
}
}
matchingVfModules = matchingVfModules + "</vfModules>"
- msoLogger.debug("Matching VF Modules: " + matchingVfModules)
+ logger.debug("Matching VF Modules: " + matchingVfModules)
execution.setVariable("GVFMN_vfModuleXml", matchingVfModules)
}
}
}
} catch (Exception ex) {
ex.printStackTrace()
- msoLogger.debug('Exception occurred while executing AAI GET:' + ex.getMessage())
+ logger.debug('Exception occurred while executing AAI GET:' + ex.getMessage())
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'AAI GET Failed:' + ex.getMessage())
}
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAI(): ' + e.getMessage())
}
@@ -165,16 +171,16 @@ public class GenerateVfModuleName extends AbstractServiceTaskProcessor{
def method = getClass().getSimpleName() + '.generateName() ' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
String vfModuleXml = execution.getVariable("GVFMN_vfModuleXml")
String moduleIndex = utils.getLowestUnusedIndex(vfModuleXml)
- msoLogger.debug("moduleIndex is: " + moduleIndex)
+ logger.debug("moduleIndex is: " + moduleIndex)
def vnfName = execution.getVariable("vnfName")
def vfModuleLabel = execution.getVariable("vfModuleLabel")
def vfModuleName = vnfName + "_" + vfModuleLabel + "_" + moduleIndex
- msoLogger.debug("vfModuleName is: " + vfModuleName)
+ logger.debug("vfModuleName is: " + vfModuleName)
execution.setVariable("vfModuleName", vfModuleName)
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenericNotificationService.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenericNotificationService.groovy
index 591e76e491..1163b6bf08 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenericNotificationService.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenericNotificationService.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -27,16 +29,10 @@ import org.onap.so.bpmn.common.scripts.ExceptionUtil
import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.bpmn.core.json.JsonUtils
import java.text.SimpleDateFormat
-import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
public class GenericNotificationService extends AbstractServiceTaskProcessor {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, GenericNotificationService.class);
-
-
-
ExceptionUtil exceptionUtil = new ExceptionUtil()
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ManualHandling.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ManualHandling.groovy
index 820364b1f7..7e04adbff2 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ManualHandling.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ManualHandling.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -43,6 +45,8 @@ import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.client.ruby.*
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
@@ -73,7 +77,7 @@ import org.onap.so.logger.MsoLogger
*
*/
public class ManualHandling extends AbstractServiceTaskProcessor {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, ManualHandling.class);
+ private static final Logger logger = LoggerFactory.getLogger( ManualHandling.class);
String Prefix="MH_"
@@ -83,46 +87,46 @@ public class ManualHandling extends AbstractServiceTaskProcessor {
public void preProcessRequest (DelegateExecution execution) {
String msg = ""
- msoLogger.trace("preProcessRequest of ManualHandling ")
+ logger.trace("preProcessRequest of ManualHandling ")
try {
execution.setVariable("prefix", Prefix)
setBasicDBAuthHeader(execution, execution.getVariable('isDebugLogEnabled'))
// check for required input
String requestId = execution.getVariable("msoRequestId")
- msoLogger.debug("msoRequestId is: " + requestId)
+ logger.debug("msoRequestId is: " + requestId)
def serviceType = execution.getVariable("serviceType")
- msoLogger.debug("serviceType is: " + serviceType)
+ logger.debug("serviceType is: " + serviceType)
def vnfType = execution.getVariable("vnfType")
- msoLogger.debug("vnftype is: " + vnfType)
+ logger.debug("vnftype is: " + vnfType)
def currentActivity = execution.getVariable("currentActivity")
- msoLogger.debug("currentActivity is: " + currentActivity)
+ logger.debug("currentActivity is: " + currentActivity)
def workStep = execution.getVariable("workStep")
- msoLogger.debug("workStep is: " + workStep)
+ logger.debug("workStep is: " + workStep)
def failedActivity = execution.getVariable("failedActivity")
- msoLogger.debug("failedActivity is: " + failedActivity)
+ logger.debug("failedActivity is: " + failedActivity)
def errorCode = execution.getVariable("errorCode")
- msoLogger.debug("errorCode is: " + errorCode)
+ logger.debug("errorCode is: " + errorCode)
def errorText = execution.getVariable("errorText")
- msoLogger.debug("errorText is: " + errorText)
+ logger.debug("errorText is: " + errorText)
def requestorId = execution.getVariable("requestorId")
- msoLogger.debug("requestorId is: " + requestorId)
+ logger.debug("requestorId is: " + requestorId)
def validResponses = execution.getVariable("validResponses")
- msoLogger.debug("validResponses is: " + validResponses)
+ logger.debug("validResponses is: " + validResponses)
} catch (BpmnError e) {
throw e;
} catch (Exception ex){
msg = "Exception in preProcessRequest " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("Exit preProcessRequest of RainyDayHandler ")
+ logger.trace("Exit preProcessRequest of RainyDayHandler ")
}
public void createManualTask (DelegateExecution execution) {
String msg = ""
- msoLogger.trace("createManualTask of ManualHandling ")
+ logger.trace("createManualTask of ManualHandling ")
try {
String taskId = UUID.randomUUID()
@@ -139,7 +143,7 @@ public class ManualHandling extends AbstractServiceTaskProcessor {
String buildingBlockStep = execution.getVariable("workStep")
String validResponses = execution.getVariable("validResponses")
- msoLogger.debug("Before creating task")
+ logger.debug("Before creating task")
Map<String, String> taskVariables = new HashMap<String, String>()
taskVariables.put("type", type)
@@ -158,16 +162,16 @@ public class ManualHandling extends AbstractServiceTaskProcessor {
Task manualTask = taskService.newTask(taskId)
taskService.saveTask(manualTask)
taskService.setVariables(taskId, taskVariables)
- msoLogger.debug("successfully created task: "+ taskId)
+ logger.debug("successfully created task: "+ taskId)
} catch (BpmnError e) {
- msoLogger.debug("BPMN exception: " + e.errorMessage)
+ logger.debug("BPMN exception: " + e.errorMessage)
throw e;
} catch (Exception ex){
msg = "Exception in createManualTask " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("Exit createManualTask of ManualHandling ")
+ logger.trace("Exit createManualTask of ManualHandling ")
}
public void setTaskVariables (DelegateTask task) {
@@ -175,9 +179,9 @@ public class ManualHandling extends AbstractServiceTaskProcessor {
DelegateExecution execution = task.getExecution()
String msg = ""
- msoLogger.trace("setTaskVariables of ManualHandling ")
+ logger.trace("setTaskVariables of ManualHandling ")
String taskId = task.getId()
- msoLogger.debug("taskId is: " + taskId)
+ logger.debug("taskId is: " + taskId)
try {
execution.setVariable('taskId', taskId)
@@ -193,7 +197,7 @@ public class ManualHandling extends AbstractServiceTaskProcessor {
String buildingBlockStep = execution.getVariable("workStep")
String validResponses = execution.getVariable("validResponses")
- msoLogger.debug("Before creating task")
+ logger.debug("Before creating task")
Map<String, String> taskVariables = new HashMap<String, String>()
taskVariables.put("type", type)
@@ -211,16 +215,16 @@ public class ManualHandling extends AbstractServiceTaskProcessor {
taskService.setVariables(taskId, taskVariables)
- msoLogger.debug("successfully created task: "+ taskId)
+ logger.debug("successfully created task: "+ taskId)
} catch (BpmnError e) {
- msoLogger.debug("BPMN exception: " + e.errorMessage)
+ logger.debug("BPMN exception: " + e.errorMessage)
throw e;
} catch (Exception ex){
msg = "Exception in createManualTask " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("Exit createManualTask of ManualHandling ")
+ logger.trace("Exit createManualTask of ManualHandling ")
}
public void completeTask (DelegateTask task) {
@@ -228,9 +232,9 @@ public class ManualHandling extends AbstractServiceTaskProcessor {
DelegateExecution execution = task.getExecution()
String msg = ""
- msoLogger.trace("completeTask of ManualHandling ")
+ logger.trace("completeTask of ManualHandling ")
String taskId = task.getId()
- msoLogger.debug("taskId is: " + taskId)
+ logger.debug("taskId is: " + taskId)
try {
TaskService taskService = execution.getProcessEngineServices().getTaskService()
@@ -238,27 +242,27 @@ public class ManualHandling extends AbstractServiceTaskProcessor {
Map<String, String> taskVariables = taskService.getVariables(taskId)
String responseValue = taskVariables.get("responseValue")
- msoLogger.debug("Received responseValue on completion: "+ responseValue)
+ logger.debug("Received responseValue on completion: "+ responseValue)
// Have to set the first letter of the response to upper case
String responseValueForRainyDay = responseValue.substring(0, 1).toUpperCase() + responseValue.substring(1)
- msoLogger.debug("ResponseValue to RainyDayHandler: "+ responseValueForRainyDay)
+ logger.debug("ResponseValue to RainyDayHandler: "+ responseValueForRainyDay)
execution.setVariable("responseValue", responseValueForRainyDay)
} catch (BpmnError e) {
- msoLogger.debug("BPMN exception: " + e.errorMessage)
+ logger.debug("BPMN exception: " + e.errorMessage)
throw e;
} catch (Exception ex){
msg = "Exception in createManualTask " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("Exit completeTask of ManualHandling ")
+ logger.trace("Exit completeTask of ManualHandling ")
}
public void prepareRequestsDBStatusUpdate (DelegateExecution execution, String requestStatus){
def method = getClass().getSimpleName() + '.prepareRequestsDBStatusUpdate(' +'execution=' + execution.getId() +')'
- msoLogger.trace("prepareRequestsDBStatusUpdate of ManualHandling ")
+ logger.trace("prepareRequestsDBStatusUpdate of ManualHandling ")
try {
def requestId = execution.getVariable("msoRequestId")
String payload = """
@@ -267,29 +271,31 @@ public class ManualHandling extends AbstractServiceTaskProcessor {
<soapenv:Body>
<req:updateInfraRequest>
<requestId>${MsoUtils.xmlEscape(requestId)}</requestId>
- <lastModifiedBy>ManualHandling</lastModifiedBy>
- <requestStatus>${MsoUtils.xmlEscape(requestStatus)}</requestStatus>
+ <lastModifiedBy>ManualHandling</lastModifiedBy>
+ <requestStatus>${MsoUtils.xmlEscape(requestStatus)}</requestStatus>
</req:updateInfraRequest>
</soapenv:Body>
</soapenv:Envelope>
"""
execution.setVariable("setUpdateDBstatusPayload", payload)
- msoLogger.debug("Outgoing Update Mso Request Payload is: " + payload)
- msoLogger.debug("setUpdateDBstatusPayload: " + payload)
+ logger.debug("Outgoing Update Mso Request Payload is: " + payload)
+ logger.debug("setUpdateDBstatusPayload: " + payload)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method)
}
- msoLogger.trace("Exit prepareRequestsDBStatusUpdate of ManualHandling ")
+ logger.trace("Exit prepareRequestsDBStatusUpdate of ManualHandling ")
}
public void createAOTSTicket (DelegateExecution execution) {
String msg = ""
- msoLogger.trace("createAOTSTicket of ManualHandling ")
+ logger.trace("createAOTSTicket of ManualHandling ")
def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
// This method will not be throwing an exception, but rather log the error
@@ -298,44 +304,46 @@ public class ManualHandling extends AbstractServiceTaskProcessor {
setBasicDBAuthHeader(execution,isDebugLogEnabled)
// check for required input
String requestId = execution.getVariable("msoRequestId")
- msoLogger.debug("requestId is: " + requestId)
+ logger.debug("requestId is: " + requestId)
def currentActivity = execution.getVariable("currentActivity")
- msoLogger.debug("currentActivity is: " + currentActivity)
+ logger.debug("currentActivity is: " + currentActivity)
def workStep = execution.getVariable("workStep")
- msoLogger.debug("workStep is: " + workStep)
+ logger.debug("workStep is: " + workStep)
def failedActivity = execution.getVariable("failedActivity")
- msoLogger.debug("failedActivity is: " + failedActivity)
+ logger.debug("failedActivity is: " + failedActivity)
def errorCode = execution.getVariable("errorCode")
- msoLogger.debug("errorCode is: " + errorCode)
+ logger.debug("errorCode is: " + errorCode)
def errorText = execution.getVariable("errorText")
- msoLogger.debug("errorText is: " + errorText)
+ logger.debug("errorText is: " + errorText)
def vnfName = execution.getVariable("vnfName")
- msoLogger.debug("vnfName is: " + vnfName)
+ logger.debug("vnfName is: " + vnfName)
String rubyRequestId = UUID.randomUUID()
- msoLogger.debug("rubyRequestId: " + rubyRequestId)
+ logger.debug("rubyRequestId: " + rubyRequestId)
String sourceName = vnfName
- msoLogger.debug("sourceName: " + sourceName)
+ logger.debug("sourceName: " + sourceName)
String reason = "VID Workflow failed at " + failedActivity + " " + workStep + " call with error " + errorCode
- msoLogger.debug("reason: " + reason)
+ logger.debug("reason: " + reason)
String workflowId = requestId
- msoLogger.debug("workflowId: " + workflowId)
+ logger.debug("workflowId: " + workflowId)
String notification = "Request originated from VID | Workflow fallout on " + vnfName + " | Workflow step failure: " + workStep + " failed | VID workflow ID: " + workflowId
- msoLogger.debug("notification: " + notification)
+ logger.debug("notification: " + notification)
- msoLogger.debug("Creating AOTS Ticket request")
+ logger.debug("Creating AOTS Ticket request")
RubyClient rubyClient = new RubyClient()
rubyClient.rubyCreateTicketCheckRequest(rubyRequestId, sourceName, reason, workflowId, notification)
} catch (BpmnError e) {
msg = "BPMN error in createAOTSTicket " + ex.getMessage()
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
} catch (Exception ex){
msg = "Exception in createAOTSTicket " + ex.getMessage()
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
}
- msoLogger.trace("Exit createAOTSTicket of ManualHandling ")
+ logger.trace("Exit createAOTSTicket of ManualHandling ")
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy
index 4f0b530a3b..ff1d2ecb19 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -28,6 +30,8 @@ import org.onap.so.bpmn.core.BPMNLogger
import org.onap.so.bpmn.core.xml.XmlTool
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
import org.onap.so.utils.CryptoUtils
import org.slf4j.MDC
import org.w3c.dom.Element
@@ -36,16 +40,16 @@ import groovy.util.slurpersupport.NodeChild
import groovy.xml.XmlUtil
class MsoUtils {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, MsoUtils.class);
-
+ private static final Logger logger = LoggerFactory.getLogger( MsoUtils.class);
+
def initializeEndPoints(execution){
// use this placeholder to initialize end points, if called independently, this need to be set
- execution.setVariable("AAIEndPoint","http://localhost:28080/SoapUIMocks")
+ execution.setVariable("AAIEndPoint","http://localhost:28080/SoapUIMocks")
}
-
+
/**
* Returns the unescaped contents of element
- *
+ *
* @param xmlInput
* @param element
* @return
@@ -287,36 +291,38 @@ class MsoUtils {
return null
}
}
-
+
def log(logmode,logtxt,isDebugLogEnabled="false"){
if ("INFO"==logmode) {
- msoLogger.info(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, logtxt, "BPMN", MsoLogger.getServiceName());
+ logger.info(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, logtxt, "BPMN", MsoLogger.getServiceName());
} else if ("WARN"==logmode) {
// to see the warning text displayed in the log entry, the text must also be passed as arg0 (2nd argument) to invoke the correct MsoLogger warn() method
- msoLogger.warn (MessageEnum.BPMN_GENERAL_WARNING, logtxt, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, logtxt);
+ logger.warn ("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_WARNING.toString(), logtxt, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), logtxt);
} else if ("ERROR"==logmode) {
// to see the error text displayed in the log entry, the text must also be passed as arg0 (2nd argument) to invoke the correct MsoLogger error() method
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, logtxt, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, logtxt);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), logtxt, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), logtxt);
} else {
BPMNLogger.debug(isDebugLogEnabled, logtxt);
}
}
-
+
def logContext(requestId, serviceInstanceId){
- msoLogger.setLogContext(requestId, serviceInstanceId);
+// msoLogger.setLogContext(requestId, serviceInstanceId);
}
def logMetrics(elapsedTime, logtxt){
- msoLogger.recordMetricEvent (elapsedTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- logtxt, "BPMN", MsoLogger.getServiceName(), null);
+// msoLogger.recordMetricEvent (elapsedTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
+// logtxt, "BPMN", MsoLogger.getServiceName(), null);
}
-
+
def logAudit(logtxt){
long startTime = System.currentTimeMillis();
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, logtxt);
+// msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, logtxt);
}
// headers: header - name-value
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 5e949fd8d2..cac7a35282 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
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2018 Intel Corp. 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
@@ -32,7 +34,8 @@ 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.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
import org.onap.so.db.catalog.beans.CloudIdentity
import org.onap.so.db.catalog.beans.CloudSite
import org.onap.so.db.catalog.beans.HomingInstance
@@ -54,6 +57,7 @@ import javax.ws.rs.core.Response
* resources by calling OOF.
*/
class OofHoming extends AbstractServiceTaskProcessor {
+ private static final Logger logger = LoggerFactory.getLogger( OofHoming.class);
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtil = new JsonUtils()
@@ -67,29 +71,28 @@ class OofHoming extends AbstractServiceTaskProcessor {
* @param execution
*/
public void callOof(DelegateExecution execution) {
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix", "HOME_")
- utils.log("DEBUG", "*** Started Homing Call OOF ***", isDebugEnabled)
+ logger.debug( "*** Started Homing Call OOF ***")
try {
execution.setVariable("rollbackData", null)
execution.setVariable("rolledBack", false)
String requestId = execution.getVariable("msoRequestId")
- utils.log("DEBUG", "Incoming Request Id is: " + requestId, isDebugEnabled)
+ logger.debug( "Incoming Request Id is: " + requestId)
String serviceInstanceId = execution.getVariable("serviceInstanceId")
- utils.log("DEBUG", "Incoming Service Instance Id is: " + serviceInstanceId, isDebugEnabled)
+ logger.debug( "Incoming Service Instance Id is: " + serviceInstanceId)
String serviceInstanceName = execution.getVariable("serviceInstanceName")
- utils.log("DEBUG", "Incoming Service Instance Name is: " + serviceInstanceName, isDebugEnabled)
+ logger.debug( "Incoming Service Instance Name is: " + serviceInstanceName)
ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
- utils.log("DEBUG", "Incoming Service Decomposition is: " + serviceDecomposition, isDebugEnabled)
+ logger.debug( "Incoming Service Decomposition is: " + serviceDecomposition)
String subscriberInfo = execution.getVariable("subscriberInfo")
- utils.log("DEBUG", "Incoming Subscriber Information is: " + subscriberInfo, isDebugEnabled)
+ logger.debug( "Incoming Subscriber Information is: " + subscriberInfo)
Map customerLocation = execution.getVariable("customerLocation")
- utils.log("DEBUG", "Incoming Customer Location is: " + customerLocation.toString(), isDebugEnabled)
+ logger.debug( "Incoming Customer Location is: " + customerLocation.toString())
String cloudOwner = execution.getVariable("cloudOwner")
- utils.log("DEBUG", "Incoming cloudOwner is: " + cloudOwner, isDebugEnabled)
+ logger.debug( "Incoming cloudOwner is: " + cloudOwner)
String cloudRegionId = execution.getVariable("cloudRegionId")
- utils.log("DEBUG", "Incoming cloudRegionId is: " + cloudRegionId, isDebugEnabled)
+ logger.debug( "Incoming cloudRegionId is: " + cloudRegionId)
if (isBlank(requestId) ||
isBlank(serviceInstanceId) ||
@@ -119,18 +122,17 @@ class OofHoming extends AbstractServiceTaskProcessor {
String basicAuthValue = utils.encrypt(basicAuth, msokey)
if (basicAuthValue != null) {
- utils.log("DEBUG", "Obtained BasicAuth username and password for OOF Adapter: " + basicAuthValue,
- isDebugEnabled)
+ logger.debug( "Obtained BasicAuth username and password for OOF Adapter: " + basicAuthValue)
try {
authHeader = utils.getBasicAuth(basicAuthValue, msokey)
execution.setVariable("BasicAuthHeaderValue", authHeader)
} catch (Exception ex) {
- utils.log("DEBUG", "Unable to encode username and password string: " + ex, isDebugEnabled)
+ logger.debug( "Unable to encode username and password string: " + ex)
exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Internal Error - Unable to " +
"encode username and password string")
}
} else {
- utils.log("DEBUG", "Unable to obtain BasicAuth - BasicAuth value null", isDebugEnabled)
+ logger.debug( "Unable to obtain BasicAuth - BasicAuth value null")
exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Internal Error - BasicAuth " +
"value null")
}
@@ -143,7 +145,7 @@ class OofHoming extends AbstractServiceTaskProcessor {
timeout = "PT30M"
}
}
- utils.log("DEBUG", "Async Callback Timeout will be: " + timeout, isDebugEnabled)
+ logger.debug( "Async Callback Timeout will be: " + timeout)
execution.setVariable("timeout", timeout)
execution.setVariable("correlator", requestId)
@@ -153,10 +155,10 @@ class OofHoming extends AbstractServiceTaskProcessor {
String oofRequest = oofUtils.buildRequest(execution, requestId, serviceDecomposition,
subscriber, customerLocation)
execution.setVariable("oofRequest", oofRequest)
- utils.log("DEBUG", "OOF Request is: " + oofRequest, isDebugEnabled)
+ logger.debug( "OOF Request is: " + oofRequest)
String urlString = UrnPropertiesReader.getVariable("mso.oof.endpoint", execution)
- utils.log("DEBUG", "Posting to OOF Url: " + urlString, isDebugEnabled)
+ logger.debug( "Posting to OOF Url: " + urlString)
URL url = new URL(urlString);
@@ -165,15 +167,15 @@ class OofHoming extends AbstractServiceTaskProcessor {
Response httpResponse = httpClient.post(oofRequest)
int responseCode = httpResponse.getStatus()
- logDebug("OOF sync response code is: " + responseCode, isDebugEnabled)
+ logDebug("OOF sync response code is: " + responseCode)
- utils.log("DEBUG", "*** Completed Homing Call OOF ***", isDebugEnabled)
+ logger.debug( "*** Completed Homing Call OOF ***")
}
} catch (BpmnError b) {
throw b
} catch (Exception e) {
- msoLogger.error(e);
+ logger.error(e);
exceptionUtil.buildAndThrowWorkflowException(execution, 2500,
"Internal Error - Occured in Homing callOof: " + e.getMessage())
}
@@ -188,19 +190,19 @@ class OofHoming extends AbstractServiceTaskProcessor {
* @param execution
*/
public void processHomingSolution(DelegateExecution execution) {
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
- utils.log("DEBUG", "*** Started Homing Process Homing Solution ***", isDebugEnabled)
+
+ logger.debug( "*** Started Homing Process Homing Solution ***")
try {
String response = execution.getVariable("asyncCallbackResponse")
- utils.log("DEBUG", "OOF Async Callback Response is: " + response, isDebugEnabled)
+ logger.debug( "OOF Async Callback Response is: " + response)
utils.logAudit("OOF Async Callback Response is: " + response)
oofUtils.validateCallbackResponse(execution, response)
String placements = jsonUtil.getJsonValue(response, "solutions.placementSolutions")
- utils.log("DEBUG", "****** Solution Placements: " + placements + " *****", isDebugEnabled)
+ logger.debug( "****** Solution Placements: " + placements + " *****")
ServiceDecomposition decomposition = execution.getVariable("serviceDecomposition")
- utils.log("DEBUG", "Service Decomposition: " + decomposition, isDebugEnabled)
+ logger.debug( "Service Decomposition: " + decomposition)
List<Resource> resourceList = decomposition.getServiceResources()
JSONArray arr = new JSONArray(placements)
@@ -208,12 +210,12 @@ class OofHoming extends AbstractServiceTaskProcessor {
JSONArray arrSol = arr.getJSONArray(i)
for (int j = 0; j < arrSol.length(); j++) {
JSONObject placement = arrSol.getJSONObject(j)
- utils.log("DEBUG", "****** Placement Solution is: " + placement + " *****", "true")
+ logger.debug( "****** Placement Solution is: " + placement + " *****")
String jsonServiceResourceId = jsonUtil.getJsonValue( placement.toString(), "serviceResourceId")
- utils.log("DEBUG", "****** homing serviceResourceId is: " + jsonServiceResourceId + " *****", "true")
+ logger.debug( "****** homing serviceResourceId is: " + jsonServiceResourceId + " *****")
for (Resource resource : resourceList) {
String serviceResourceId = resource.getResourceId()
- utils.log("DEBUG", "****** decomp serviceResourceId is: " + serviceResourceId + " *****", "true")
+ logger.debug( "****** decomp serviceResourceId is: " + serviceResourceId + " *****")
if (serviceResourceId.equalsIgnoreCase(jsonServiceResourceId)) {
JSONObject solution = placement.getJSONObject("solution")
String solutionType = solution.getString("identifierType")
@@ -223,26 +225,26 @@ class OofHoming extends AbstractServiceTaskProcessor {
} else {
inventoryType = "cloud"
}
- utils.log("DEBUG", "****** homing inventoryType is: " + inventoryType + " *****", "true")
+ logger.debug( "****** homing inventoryType is: " + inventoryType + " *****")
resource.getHomingSolution().setInventoryType(InventoryType.valueOf(inventoryType))
JSONArray assignmentArr = placement.getJSONArray("assignmentInfo")
- utils.log("DEBUG", "****** assignmentInfo is: " + assignmentArr.toString() + " *****", "true")
+ logger.debug( "****** assignmentInfo is: " + assignmentArr.toString() + " *****")
Map<String, String> assignmentMap = jsonUtil.entryArrayToMap(execution,
assignmentArr.toString(), "key", "value")
String oofDirectives = null
assignmentMap.each { key, value ->
- utils.log("DEBUG", "****** element: " + key + " *****", "true")
+ logger.debug( "****** element: " + key + " *****")
if (key == "oof_directives") {
oofDirectives = value
- utils.log("DEBUG", "****** homing oofDirectives: " + oofDirectives + " *****", "true")
+ logger.debug( "****** homing oofDirectives: " + oofDirectives + " *****")
}
}
String cloudOwner = assignmentMap.get("cloudOwner")
- utils.log("DEBUG", "****** homing cloudOwner: " + cloudOwner + " *****", "true")
+ logger.debug( "****** homing cloudOwner: " + cloudOwner + " *****")
String cloudRegionId = assignmentMap.get("locationId")
- utils.log("DEBUG", "****** homing cloudRegionId: " + cloudRegionId + " *****", "true")
+ logger.debug( "****** homing cloudRegionId: " + cloudRegionId + " *****")
resource.getHomingSolution().setCloudOwner(cloudOwner)
resource.getHomingSolution().setCloudRegionId(cloudRegionId)
@@ -252,7 +254,7 @@ class OofHoming extends AbstractServiceTaskProcessor {
String orchestrator = execution.getVariable("orchestrator")
if ((orchestrator != null) && (orchestrator != "")) {
cloudSite.setOrchestrator(orchestrator)
- utils.log("DEBUG", "****** orchestrator: " + orchestrator + " *****", "true")
+ logger.debug( "****** orchestrator: " + orchestrator + " *****")
} else {
cloudSite.setOrchestrator("multicloud")
}
@@ -278,15 +280,15 @@ class OofHoming extends AbstractServiceTaskProcessor {
cloudIdentity.setIdentityUrl(msbHost + multicloudApiEndpoint
+ "/" + cloudOwner + "/" +
cloudRegionId + "/infra_workload")
- utils.log("DEBUG", "****** Cloud IdentityUrl: " + msbHost + multicloudApiEndpoint
+ logger.debug( "****** Cloud IdentityUrl: " + msbHost + multicloudApiEndpoint
+ "/" + cloudOwner + "/" +
cloudRegionId + "/infra_workload"
- + " *****", "true")
- utils.log("DEBUG", "****** CloudIdentity: " + cloudIdentity.toString()
- + " *****", "true")
+ + " *****")
+ logger.debug( "****** CloudIdentity: " + cloudIdentity.toString()
+ + " *****")
cloudSite.setIdentityService(cloudIdentity)
- utils.log("DEBUG", "****** CloudSite: " + cloudSite.toString()
- + " *****", "true")
+ logger.debug( "****** CloudSite: " + cloudSite.toString()
+ + " *****")
// Set cloudsite in catalog DB here
oofUtils.createCloudSite(cloudSite, execution)
@@ -294,7 +296,7 @@ class OofHoming extends AbstractServiceTaskProcessor {
if (oofDirectives != null && oofDirectives != "") {
resource.getHomingSolution().setOofDirectives(oofDirectives)
execution.setVariable("oofDirectives", oofDirectives)
- utils.log("DEBUG", "***** OofDirectives set to: " + oofDirectives +
+ logger.debug( "***** OofDirectives set to: " + oofDirectives +
" *****", "true")
}
@@ -319,8 +321,8 @@ class OofHoming extends AbstractServiceTaskProcessor {
resource.getHomingSolution().setServiceInstanceId(solution.getJSONArray("identifiers")[0].toString())
}
} else {
- utils.log("DEBUG", "ProcessHomingSolution Exception: no matching serviceResourceIds returned in " +
- "homing solution", isDebugEnabled)
+ logger.debug( "ProcessHomingSolution Exception: no matching serviceResourceIds returned in " +
+ "homing solution")
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - " +
"Occurred in Homing ProcessHomingSolution: no matching serviceResourceIds returned")
@@ -351,13 +353,13 @@ class OofHoming extends AbstractServiceTaskProcessor {
execution.setVariable("serviceDecomposition", decomposition)
execution.setVariable("homingSolution", placements) //TODO - can be removed as output variable
- utils.log("DEBUG", "*** Completed Homing Process Homing Solution ***", isDebugEnabled)
+ logger.debug( "*** Completed Homing Process Homing Solution ***")
} catch (BpmnError b) {
- utils.log("DEBUG", "ProcessHomingSolution Error: " + b, isDebugEnabled)
+ logger.debug( "ProcessHomingSolution Error: " + b)
throw b
} catch (Exception e) {
- utils.log("DEBUG", "ProcessHomingSolution Exception: " + e, isDebugEnabled)
- msoLogger.error(e);
+ logger.debug( "ProcessHomingSolution Exception: " + e)
+ logger.error(e);
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occurred in Homing ProcessHomingSolution")
}
}
@@ -369,14 +371,13 @@ class OofHoming extends AbstractServiceTaskProcessor {
* @param - execution
*/
public String logStart(DelegateExecution execution) {
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+
String requestId = execution.getVariable("testReqId")
if (isBlank(requestId)) {
requestId = execution.getVariable("msoRequestId")
}
execution.setVariable("DHVCS_requestId", requestId)
- utils.log("DEBUG", "***** STARTED Homing Subflow for request: " + requestId + " *****", "true")
- utils.log("DEBUG", "****** Homing Subflow Global Debug Enabled: " + isDebugEnabled + " *****", "true")
+ logger.debug( "***** STARTED Homing Subflow for request: " + requestId + " *****")
utils.logAudit("***** STARTED Homing Subflow for request: " + requestId + " *****")
}
@@ -404,18 +405,18 @@ class OofHoming extends AbstractServiceTaskProcessor {
'mso:workflow:message:endpoint was not passed in')
}
- utils.log("DEBUG", "passed in endpoint: " + endpoint + " *****", "true")
+ logger.debug( "passed in endpoint: " + endpoint + " *****")
while (endpoint.endsWith('/')) {
endpoint = endpoint.substring(0, endpoint.length() - 1)
}
- utils.log("DEBUG", "processed endpoint: " + endpoint + " *****", "true")
+ logger.debug( "processed endpoint: " + endpoint + " *****")
return endpoint +
'/' + UriUtils.encodePathSegment(messageType, 'UTF-8') +
'/' + UriUtils.encodePathSegment(correlator, 'UTF-8')
} catch (Exception ex) {
- utils.log("DEBUG", "createCallbackURL Exception: " + ex + " *****", "true")
+ logger.debug( "createCallbackURL Exception: " + ex + " *****")
}
}
}
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 af33f38a64..b68e979b3c 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
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2018 Intel Corp. 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
@@ -46,6 +48,8 @@ import org.springframework.http.client.BufferingClientHttpRequestFactory
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory
import org.springframework.web.client.RestTemplate
import org.springframework.web.util.UriComponentsBuilder
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
import javax.ws.rs.core.MediaType
import javax.ws.rs.core.Response
@@ -54,6 +58,8 @@ import javax.xml.ws.http.HTTPException
import static org.onap.so.bpmn.common.scripts.GenericUtils.*
class OofUtils {
+ private static final Logger logger = LoggerFactory.getLogger( OofUtils.class);
+
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtil = new JsonUtils()
@@ -86,40 +92,39 @@ class OofUtils {
ArrayList existingCandidates = null,
ArrayList excludedCandidates = null,
ArrayList requiredCandidates = null) {
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
- utils.log("DEBUG", "Started Building OOF Request", isDebugEnabled)
+ logger.debug( "Started Building OOF Request")
String callbackEndpoint = UrnPropertiesReader.getVariable("mso.oof.callbackEndpoint", execution)
- utils.log("DEBUG", "mso.oof.callbackEndpoint is: " + callbackEndpoint, isDebugEnabled)
+ logger.debug( "mso.oof.callbackEndpoint is: " + callbackEndpoint)
try {
def callbackUrl = utils.createHomingCallbackURL(callbackEndpoint, "oofResponse", requestId)
- utils.log("DEBUG", "callbackUrl is: " + callbackUrl, isDebugEnabled)
+ logger.debug( "callbackUrl is: " + callbackUrl)
def transactionId = requestId
- utils.log("DEBUG", "transactionId is: " + transactionId, isDebugEnabled)
+ logger.debug( "transactionId is: " + transactionId)
//ServiceInstance Info
ServiceInstance serviceInstance = decomposition.getServiceInstance()
def serviceInstanceId = ""
def serviceName = ""
serviceInstanceId = execution.getVariable("serviceInstanceId")
- utils.log("DEBUG", "serviceInstanceId is: " + serviceInstanceId, isDebugEnabled)
+ logger.debug( "serviceInstanceId is: " + serviceInstanceId)
serviceName = execution.getVariable("subscriptionServiceType")
- utils.log("DEBUG", "serviceName is: " + serviceName, isDebugEnabled)
+ logger.debug( "serviceName is: " + serviceName)
if (serviceInstanceId == null || serviceInstanceId == "null") {
- utils.log("DEBUG", "Unable to obtain Service Instance Id", isDebugEnabled)
+ logger.debug( "Unable to obtain Service Instance Id")
exceptionUtil.buildAndThrowWorkflowException(execution, 400, "Internal Error - Unable to " +
"obtain Service Instance Id, execution.getVariable(\"serviceInstanceId\") is null")
}
if (serviceName == null || serviceName == "null") {
- utils.log("DEBUG", "Unable to obtain Service Name", isDebugEnabled)
+ logger.debug( "Unable to obtain Service Name")
exceptionUtil.buildAndThrowWorkflowException(execution, 400, "Internal Error - Unable to " +
"obtain Service Name, execution.getVariable(\"subscriptionServiceType\") is null")
}
//Model Info
ModelInfo model = decomposition.getModelInfo()
- utils.log("DEBUG", "ModelInfo: " + model.toString(), isDebugEnabled)
+ logger.debug( "ModelInfo: " + model.toString())
String modelType = model.getModelType()
String modelInvariantId = model.getModelInvariantUuid()
String modelVersionId = model.getModelUuid()
@@ -153,12 +158,10 @@ class OofUtils {
List<VnfResource> vnfResourceList = decomposition.getVnfResources()
if (allottedResourceList == null || allottedResourceList.isEmpty()) {
- utils.log("DEBUG", "Allotted Resources List is empty - will try to get service VNFs instead.",
- isDebugEnabled)
+ logger.debug( "Allotted Resources List is empty - will try to get service VNFs instead.")
} else {
for (AllottedResource resource : allottedResourceList) {
- utils.log("DEBUG", "Allotted Resource: " + resource.toString(),
- isDebugEnabled)
+ logger.debug( "Allotted Resource: " + resource.toString())
def serviceResourceId = resource.getResourceId()
def toscaNodeType = resource.getToscaNodeType()
def resourceModuleName = toscaNodeType.substring(toscaNodeType.lastIndexOf(".") + 1)
@@ -195,13 +198,11 @@ class OofUtils {
}
if (vnfResourceList == null || vnfResourceList.isEmpty()) {
- utils.log("DEBUG", "VNF Resources List is empty",
- isDebugEnabled)
+ logger.debug( "VNF Resources List is empty")
} else {
for (VnfResource vnfResource : vnfResourceList) {
- utils.log("DEBUG", "VNF Resource: " + vnfResource.toString(),
- isDebugEnabled)
+ logger.debug( "VNF Resource: " + vnfResource.toString())
ModelInfo vnfResourceModelInfo = vnfResource.getModelInfo()
def toscaNodeType = vnfResource.getToscaNodeType()
def resourceModuleName = toscaNodeType.substring(toscaNodeType.lastIndexOf(".") + 1)
@@ -239,7 +240,7 @@ class OofUtils {
String licenseDemands = ""
sb = new StringBuilder()
if (vnfResourceList.isEmpty() || vnfResourceList == null) {
- utils.log("DEBUG", "Vnf Resources List is Empty", isDebugEnabled)
+ logger.debug( "Vnf Resources List is Empty")
} else {
for (VnfResource vnfResource : vnfResourceList) {
ModelInfo vnfResourceModelInfo = vnfResource.getModelInfo()
@@ -322,10 +323,10 @@ class OofUtils {
"}"
- utils.log("DEBUG", "Completed Building OOF Request", isDebugEnabled)
+ logger.debug( "Completed Building OOF Request")
return request
} catch (Exception ex) {
- utils.log("DEBUG", "buildRequest Exception: " + ex, isDebugEnabled)
+ logger.debug( "buildRequest Exception: " + ex)
}
}
@@ -339,7 +340,6 @@ class OofUtils {
* @param response - the async callback response from oof
*/
Void validateCallbackResponse(DelegateExecution execution, String response) {
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
String placements = ""
if (isBlank(response)) {
exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "OOF Async Callback Response is Empty")
@@ -349,12 +349,12 @@ class OofUtils {
if (isBlank(placements) || placements.equalsIgnoreCase("[]")) {
String statusMessage = jsonUtil.getJsonValue(response, "statusMessage")
if (isBlank(statusMessage)) {
- utils.log("DEBUG", "Error Occurred in Homing: OOF Async Callback Response does " +
- "not contain placement solution.", isDebugEnabled)
+ logger.debug( "Error Occurred in Homing: OOF Async Callback Response does " +
+ "not contain placement solution.")
exceptionUtil.buildAndThrowWorkflowException(execution, 400,
"OOF Async Callback Response does not contain placement solution.")
} else {
- utils.log("DEBUG", "Error Occurred in Homing: " + statusMessage, isDebugEnabled)
+ logger.debug( "Error Occurred in Homing: " + statusMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 400, statusMessage)
}
} else {
@@ -374,11 +374,11 @@ class OofUtils {
} else {
errorMessage = "OOF Async Callback Response contains a Request Error. Unable to determine the Request Error Exception."
}
- utils.log("DEBUG", "Error Occurred in Homing: " + errorMessage, isDebugEnabled)
+ logger.debug( "Error Occurred in Homing: " + errorMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 400, errorMessage)
} else {
- utils.log("DEBUG", "Error Occurred in Homing: Received an Unknown Async Callback Response from OOF.", isDebugEnabled)
+ logger.debug( "Error Occurred in Homing: Received an Unknown Async Callback Response from OOF.")
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Received an Unknown Async Callback Response from OOF.")
}
}
@@ -518,15 +518,15 @@ class OofUtils {
Response response = client.post(request.getBody().toString())
int responseCode = response.getStatus()
- logDebug("CatalogDB response code is: " + responseCode, isDebugEnabled)
+ logDebug("CatalogDB response code is: " + responseCode)
String syncResponse = response.readEntity(String.class)
- logDebug("CatalogDB response is: " + syncResponse, isDebugEnabled)
+ logDebug("CatalogDB response is: " + syncResponse)
if(responseCode != 202){
exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Sync Response from CatalogDB.")
}
}
-
+
/**
* This method creates a HomingInstance in catalog database.
*
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModule.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModule.groovy
index 15f00ac25f..259808feb6 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModule.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModule.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -37,11 +39,13 @@ import org.onap.so.client.graphinventory.entities.uri.Depth
import org.springframework.web.util.UriUtils
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
public class PrepareUpdateAAIVfModule extends VfModuleBase {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, PrepareUpdateAAIVfModule.class);
+ private static final Logger logger = LoggerFactory.getLogger( PrepareUpdateAAIVfModule.class);
ExceptionUtil exceptionUtil = new ExceptionUtil()
@@ -76,12 +80,12 @@ public class PrepareUpdateAAIVfModule extends VfModuleBase {
def method = getClass().getSimpleName() + '.preProcessRequest(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
try {
def xml = execution.getVariable('PrepareUpdateAAIVfModuleRequest')
- msoLogger.debug('Received request xml:\n' + xml)
- msoLogger.debug("PrepareUpdateAAIVfModule Request : " + xml)
+ logger.debug('Received request xml:\n' + xml)
+ logger.debug("PrepareUpdateAAIVfModule Request : " + xml)
initProcessVariables(execution)
@@ -94,11 +98,11 @@ public class PrepareUpdateAAIVfModule extends VfModuleBase {
def orchestrationStatus = getRequiredNodeText(execution, xml,'orchestration-status')
execution.setVariable('PUAAIVfMod_orchestrationStatus', orchestrationStatus)
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(e)
+ logger.error(e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preProcessRequest(): ' + e.getMessage())
}
}
@@ -113,7 +117,7 @@ public class PrepareUpdateAAIVfModule extends VfModuleBase {
def method = getClass().getSimpleName() + '.getGenericVnf(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
try {
def vnfId = execution.getVariable('PUAAIVfMod_vnfId')
@@ -129,16 +133,16 @@ public class PrepareUpdateAAIVfModule extends VfModuleBase {
execution.setVariable('PUAAIVfMod_getVnfResponseCode', 200)
} catch (Exception ex) {
- msoLogger.error(ex);
- msoLogger.debug('Exception occurred while executing AAI GET:' + ex.getMessage())
+ logger.error(ex);
+ logger.debug('Exception occurred while executing AAI GET:' + ex.getMessage())
execution.setVariable('PUAAIVfMod_getVnfResponseCode', 500)
execution.setVariable('PUAAIVfMod_getVnfResponse', 'AAI GET Failed:' + ex.getMessage())
}
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(e)
+ logger.error(e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in getGenericVnf(): ' + e.getMessage())
}
}
@@ -155,7 +159,7 @@ public class PrepareUpdateAAIVfModule extends VfModuleBase {
def method = getClass().getSimpleName() + '.validateVfModule(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
try {
GenericVnf genericVnf = execution.getVariable('PUAAIVfMod_getVnfResponse')
@@ -190,11 +194,11 @@ public class PrepareUpdateAAIVfModule extends VfModuleBase {
}
}
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(e)
+ logger.error(e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in validateVfModule(): ' + e.getMessage())
}
}
@@ -208,7 +212,7 @@ public class PrepareUpdateAAIVfModule extends VfModuleBase {
def method = getClass().getSimpleName() + '.updateVfModule(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
try {
def vnfId = execution.getVariable('PUAAIVfMod_vnfId')
@@ -228,20 +232,20 @@ public class PrepareUpdateAAIVfModule extends VfModuleBase {
// backward compatibilty, the heat-stack-id is an output
execution.setVariable('PUAAIVfMod_outVfModule', vfModule)
def vnfName = execution.getVariable('PUAAIVfMod_vnfName')
- msoLogger.debug('Output PUAAIVfMod_vnfName set to ' + vnfName)
+ logger.debug('Output PUAAIVfMod_vnfName set to ' + vnfName)
// TODO: Should deprecate use of processKey+Response variable for the response. Will use "WorkflowResponse" instead
execution.setVariable('WorkflowResponse', vfModule)
def heatStackId = vfModule.getHeatStackId()
execution.setVariable('PUAAIVfMod_heatStackId', heatStackId)
- msoLogger.debug('Output PUAAIVfMod_heatStackId set to \'' + heatStackId + '\'')
+ logger.debug('Output PUAAIVfMod_heatStackId set to \'' + heatStackId + '\'')
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
} catch (BpmnError e) {
execution.setVariable('PUAAIVfMod_updateVfModuleResponseCode', 500)
throw e;
} catch (Exception e) {
- msoLogger.error(e)
+ logger.error(e)
execution.setVariable('PUAAIVfMod_updateVfModuleResponseCode', 500)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in updateVfModule(): ' + e.getMessage())
}
@@ -256,15 +260,15 @@ public class PrepareUpdateAAIVfModule extends VfModuleBase {
def method = getClass().getSimpleName() + '.handleVnfNotFound(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
- msoLogger.error('Error occurred attempting to query AAI, Response Code ' + execution.getVariable('PUAAIVfMod_getVnfResponseCode'));
+ logger.error('Error occurred attempting to query AAI, Response Code ' + execution.getVariable('PUAAIVfMod_getVnfResponseCode'));
String processKey = getProcessKey(execution);
WorkflowException exception = new WorkflowException(processKey, 5000,
execution.getVariable('PUAAIVfMod_getVnfResponse'))
execution.setVariable('WorkflowException', exception)
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
}
/**
@@ -276,17 +280,17 @@ public class PrepareUpdateAAIVfModule extends VfModuleBase {
def method = getClass().getSimpleName() + '.handleVfModuleValidationError(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
def String errorMsg = 'VF Module validation error: ' + execution.getVariable('PUAAIVfMod_vfModuleValidationError')
- msoLogger.error(errorMsg);
- msoLogger.debug("PrepareUpdateAAIVfModule: Error Message : " + errorMsg)
+ logger.error(errorMsg);
+ logger.debug("PrepareUpdateAAIVfModule: Error Message : " + errorMsg)
String processKey = getProcessKey(execution);
WorkflowException exception = new WorkflowException(processKey, 5000, errorMsg)
execution.setVariable('WorkflowException', exception)
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
}
/**
@@ -298,14 +302,14 @@ public class PrepareUpdateAAIVfModule extends VfModuleBase {
def method = getClass().getSimpleName() + '.handleUpdateVfModuleFailure(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
- msoLogger.error('Error occurred attempting to update VF Module in AAI, Response Code ' + execution.getVariable('PUAAIVfMod_updateVfModuleResponseCode'));
+ logger.error('Error occurred attempting to update VF Module in AAI, Response Code ' + execution.getVariable('PUAAIVfMod_updateVfModuleResponseCode'));
String processKey = getProcessKey(execution);
WorkflowException exception = new WorkflowException(processKey, 5000,
execution.getVariable('PUAAIVfMod_updateVfModuleResponse'))
execution.setVariable('WorkflowException', exception)
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/RainyDayHandler.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/RainyDayHandler.groovy
index 0d66b8f51b..9f26cead49 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/RainyDayHandler.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/RainyDayHandler.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -32,7 +34,8 @@ import org.onap.so.client.policy.PolicyClientImpl
import org.onap.so.client.policy.entities.DictionaryData
import org.onap.so.client.policy.entities.PolicyDecision
import org.onap.so.client.policy.entities.Treatments
-import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
/**
@@ -58,7 +61,7 @@ import org.onap.so.logger.MsoLogger
*
*/
public class RainyDayHandler extends AbstractServiceTaskProcessor {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, RainyDayHandler.class);
+ private static final Logger logger = LoggerFactory.getLogger( RainyDayHandler.class);
String Prefix="RDH_"
@@ -68,44 +71,44 @@ public class RainyDayHandler extends AbstractServiceTaskProcessor {
public void preProcessRequest (DelegateExecution execution) {
String msg = ""
- msoLogger.trace("preProcessRequest of RainyDayHandler ")
+ logger.trace("preProcessRequest of RainyDayHandler ")
try {
execution.setVariable("prefix", Prefix)
// check for required input
String requestId = execution.getVariable("msoRequestId")
- msoLogger.debug("msoRequestId is: " + requestId)
+ logger.debug("msoRequestId is: " + requestId)
def serviceType = execution.getVariable("serviceType")
- msoLogger.debug("serviceType is: " + serviceType)
+ logger.debug("serviceType is: " + serviceType)
def vnfType = execution.getVariable("vnfType")
- msoLogger.debug("vnftype is: " + vnfType)
+ logger.debug("vnftype is: " + vnfType)
def currentActivity = execution.getVariable("currentActivity")
- msoLogger.debug("currentActivity is: " + currentActivity)
+ logger.debug("currentActivity is: " + currentActivity)
def workStep = execution.getVariable("workStep")
- msoLogger.debug("workStep is: " + workStep)
+ logger.debug("workStep is: " + workStep)
def failedActivity = execution.getVariable("failedActivity")
- msoLogger.debug("failedActivity is: " + failedActivity)
+ logger.debug("failedActivity is: " + failedActivity)
def errorCode = execution.getVariable("errorCode")
- msoLogger.debug("errorCode is: " + errorCode)
+ logger.debug("errorCode is: " + errorCode)
def errorText = execution.getVariable("errorText")
- msoLogger.debug("errorText is: " + errorText)
+ logger.debug("errorText is: " + errorText)
String defaultPolicyDisposition = (String) UrnPropertiesReader.getVariable("policy.default.disposition",execution)
- msoLogger.debug("defaultPolicyDisposition is: " + defaultPolicyDisposition)
+ logger.debug("defaultPolicyDisposition is: " + defaultPolicyDisposition)
execution.setVariable('defaultPolicyDisposition', defaultPolicyDisposition)
} catch (BpmnError e) {
throw e;
} catch (Exception ex){
msg = "Exception in preProcessRequest " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("Exit preProcessRequest of RainyDayHandler ")
+ logger.trace("Exit preProcessRequest of RainyDayHandler ")
}
public void queryPolicy (DelegateExecution execution) {
String msg = ""
- msoLogger.trace("queryPolicy of RainyDayHandler ")
+ logger.trace("queryPolicy of RainyDayHandler ")
try {
@@ -113,14 +116,14 @@ public class RainyDayHandler extends AbstractServiceTaskProcessor {
String serviceType = execution.getVariable("serviceType")
String vnfType = execution.getVariable("vnfType")
- msoLogger.debug("serviceType: " + serviceType)
- msoLogger.debug("vnfType: " + vnfType)
+ logger.debug("serviceType: " + serviceType)
+ logger.debug("vnfType: " + vnfType)
def errorCode = execution.getVariable("errorCode")
def bbId = execution.getVariable("currentActivity")
def workStep = execution.getVariable("workStep")
- msoLogger.debug("Before querying policy")
+ logger.debug("Before querying policy")
String decision = 'DENY'
String disposition = "Abort"
@@ -128,9 +131,9 @@ public class RainyDayHandler extends AbstractServiceTaskProcessor {
String defaultPolicyDisposition = (String) execution.getVariable('defaultPolicyDisposition')
if (defaultPolicyDisposition != null && !defaultPolicyDisposition.isEmpty()) {
- msoLogger.debug("Setting disposition to the configured default instead of querying Policy: " + defaultPolicyDisposition)
+ logger.debug("Setting disposition to the configured default instead of querying Policy: " + defaultPolicyDisposition)
disposition = defaultPolicyDisposition
- msoLogger.debug("Setting default allowed treatments: " + defaultAllowedTreatments)
+ logger.debug("Setting default allowed treatments: " + defaultAllowedTreatments)
execution.setVariable("validResponses", defaultAllowedTreatments)
}
else {
@@ -139,28 +142,28 @@ public class RainyDayHandler extends AbstractServiceTaskProcessor {
try {
PolicyClient policyClient = new PolicyClientImpl()
- msoLogger.debug("Created policy client")
+ logger.debug("Created policy client")
decisionObject = policyClient.getDecision(serviceType, vnfType, bbId, workStep, errorCode)
- msoLogger.debug("Obtained decision object")
+ logger.debug("Obtained decision object")
DictionaryData dictClient = policyClient.getAllowedTreatments(bbId, workStep)
Treatments treatments = dictClient.getTreatments()
String validResponses = treatments.getString()
if (validResponses != null) {
validResponses = validResponses.toLowerCase()
}
- msoLogger.debug("Obtained validResponses: " + validResponses)
+ logger.debug("Obtained validResponses: " + validResponses)
execution.setVariable("validResponses", validResponses)
} catch(Exception e) {
msg = "Exception in queryPolicy " + e.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
}
if (decisionObject != null) {
decision = decisionObject.getDecision()
disposition = decisionObject.getDetails()
- msoLogger.debug("Obtained disposition from policy engine: " + disposition)
+ logger.debug("Obtained disposition from policy engine: " + disposition)
}
else {
disposition = "Abort"
@@ -171,17 +174,17 @@ public class RainyDayHandler extends AbstractServiceTaskProcessor {
}
execution.setVariable("handlingCode", disposition)
- msoLogger.debug("Disposition: "+ disposition)
+ logger.debug("Disposition: "+ disposition)
} catch (BpmnError e) {
- msoLogger.debug("BPMN exception: " + e.errorMessage)
+ logger.debug("BPMN exception: " + e.errorMessage)
throw e;
} catch (Exception ex){
msg = "Exception in queryPolicy " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
//exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("Exit queryPolicy of RainyDayHandler ")
+ logger.trace("Exit queryPolicy of RainyDayHandler ")
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ReceiveWorkflowMessage.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ReceiveWorkflowMessage.groovy
index 717d0df1ba..6094e457f1 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ReceiveWorkflowMessage.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ReceiveWorkflowMessage.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -29,12 +31,14 @@ import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.onap.so.bpmn.common.scripts.ExceptionUtil
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
class ReceiveWorkflowMessage extends AbstractServiceTaskProcessor {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, ReceiveWorkflowMessage.class);
+ private static final Logger logger = LoggerFactory.getLogger( ReceiveWorkflowMessage.class);
ExceptionUtil exceptionUtil = new ExceptionUtil()
@@ -48,7 +52,7 @@ public void preProcessRequest (DelegateExecution execution) {
def method = getClass().getSimpleName() + '.preProcessRequest(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
def prefix="RCVWFMSG_"
execution.setVariable("prefix", prefix)
@@ -58,42 +62,46 @@ public void preProcessRequest (DelegateExecution execution) {
// Confirm that timeout value has been provided in 'RCVWFMSG_timeout'.
def timeout = execution.getVariable('RCVWFMSG_timeout')
- msoLogger.debug('Timeout value is \'' + timeout + '\'')
+ logger.debug('Timeout value is \'' + timeout + '\'')
if ((timeout == null) || (timeout.isEmpty())) {
String msg = getProcessKey(execution) + ': Missing or empty input variable \'RCVWFMSG_timeout\''
- msoLogger.debug(msg)
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.debug(msg)
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
// Confirm that message type has been provided in 'RCVWFMSG_messageType'
def messageType = execution.getVariable('RCVWFMSG_messageType')
- msoLogger.debug('Message type is \'' + messageType + '\'')
+ logger.debug('Message type is \'' + messageType + '\'')
if ((messageType == null) || (messageType.isEmpty())) {
String msg = getProcessKey(execution) + ': Missing or empty input variable \'RCVWFMSG_messageType\''
- msoLogger.debug(msg)
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.debug(msg)
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
// Confirm that correlator value has been provided in 'RCVWFMSG_correlator'
def correlator = execution.getVariable('RCVWFMSG_correlator')
- msoLogger.debug('Correlator value is \'' + correlator + '\'')
+ logger.debug('Correlator value is \'' + correlator + '\'')
if ((correlator == null) || (correlator.isEmpty())) {
String msg = getProcessKey(execution) + ': Missing or empty input variable \'RCVWFMSG_correlator\''
- msoLogger.debug(msg)
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.debug(msg)
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
execution.setVariable(messageType + '_CORRELATOR', correlator)
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
} catch (BpmnError e) {
throw e
} catch (Exception e) {
String msg = 'Caught exception in ' + method + ": " + e
- msoLogger.debug(msg)
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.debug(msg)
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
}
@@ -107,7 +115,7 @@ public void preProcessRequest (DelegateExecution execution) {
def method = getClass().getSimpleName() + '.processReceivedMessage(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
String messageType = null;
String receivedMessage = null;
@@ -115,18 +123,18 @@ public void preProcessRequest (DelegateExecution execution) {
try {
messageType = execution.getVariable('RCVWFMSG_messageType')
receivedMessage = execution.getVariable(messageType + '_MESSAGE')
- msoLogger.debug(getProcessKey(execution) + ": received message:\n" + receivedMessage)
+ logger.debug(getProcessKey(execution) + ": received message:\n" + receivedMessage)
// The received message is made available to the calling flow in WorkflowResponse
execution.setVariable("WorkflowResponse", receivedMessage)
setSuccessIndicator(execution, true)
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
} catch (Exception e) {
receivedMessage = receivedMessage == null || String.valueOf(receivedMessage).isEmpty() ? "NONE" : receivedMessage
String msg = "Error processing received workflow message: " + receivedMessage
- msoLogger.debug(getProcessKey(execution) + ': ' + msg)
+ logger.debug(getProcessKey(execution) + ': ' + msg)
exceptionUtil.buildWorkflowException(execution, 7020, msg)
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapter.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapter.groovy
index a430cdb715..5444c6a44b 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapter.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapter.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -27,13 +29,15 @@ import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
import static org.apache.commons.lang3.StringUtils.*
// SDNC Adapter Request/Response processing
public class SDNCAdapter extends AbstractServiceTaskProcessor {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SDNCAdapter.class);
+ private static final Logger logger = LoggerFactory.getLogger( SDNCAdapter.class);
def Prefix="SDNCA_"
@@ -46,8 +50,8 @@ public class SDNCAdapter extends AbstractServiceTaskProcessor {
public void preProcessRequest (DelegateExecution execution) {
try{
- msoLogger.trace("Begin PreProcess SDNCAdapterRequestScript ")
- msoLogger.debug("Incoming sdncAdapterWorkflowRequest:\n" + execution.getVariable("sdncAdapterWorkflowRequest"))
+ logger.trace("Begin PreProcess SDNCAdapterRequestScript ")
+ logger.debug("Incoming sdncAdapterWorkflowRequest:\n" + execution.getVariable("sdncAdapterWorkflowRequest"))
// Initialize some variables used throughout the flow
execution.setVariable("prefix", Prefix)
@@ -69,7 +73,9 @@ public class SDNCAdapter extends AbstractServiceTaskProcessor {
def encodedString = utils.getBasicAuth(basicAuthValue, UrnPropertiesReader.getVariable("mso.msoKey", execution))
execution.setVariable("BasicAuthHeaderValue",encodedString)
} catch (IOException ex) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Unable to encode username password string", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Unable to encode username password string", "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue());
}
// TODO Use variables instead of passing xml request - Huh?
@@ -87,27 +93,27 @@ public class SDNCAdapter extends AbstractServiceTaskProcessor {
if((useQualifiedHostName!=null) && (useQualifiedHostName.equals("true"))){
callbackUrlToUse = msoUtil.getQualifiedHostNameForCallback(callbackUrlToUse)
}
- msoLogger.debug("Callback URL to use:\n" + callbackUrlToUse)
+ logger.debug("Callback URL to use:\n" + callbackUrlToUse)
requestHeader = requestHeader.replace(origCallbackUrl, callbackUrlToUse)
// Get parameters from request header
def sdnca_svcInstanceId = utils.getNodeText(requestHeader, "SvcInstanceId") // optional
- msoLogger.debug("SvcInstanceId: " + sdnca_svcInstanceId)
+ logger.debug("SvcInstanceId: " + sdnca_svcInstanceId)
def sdnca_msoAction = utils.getNodeText(requestHeader, "MsoAction") // optional
- msoLogger.debug("MsoAction: " + sdnca_msoAction)
+ logger.debug("MsoAction: " + sdnca_msoAction)
def sdnca_svcAction = utils.getNodeText(requestHeader, "SvcAction")
- msoLogger.debug("SvcAction: " + sdnca_svcAction)
+ logger.debug("SvcAction: " + sdnca_svcAction)
def sdnca_svcOperation = utils.getNodeText(requestHeader, "SvcOperation")
- msoLogger.debug("SvcOperation: " + sdnca_svcOperation)
+ logger.debug("SvcOperation: " + sdnca_svcOperation)
def sdncRequestData = utils.getChildNodes(sdncwfreq, "SDNCRequestData")
sdncRequestData = sdncRequestData.replace("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n", "")
sdncRequestData = sdncRequestData.replaceAll('tag0:', '').replaceAll(':tag0', '')
- msoLogger.debug("SDNCRequestData:\n" + sdncRequestData)
+ logger.debug("SDNCRequestData:\n" + sdncRequestData)
def sdnca_serviceType = ""
if (utils.nodeExists(sdncwfreq, "service-type")) {
sdnca_serviceType = utils.getNodeText(sdncwfreq, "service-type")
}
- msoLogger.debug("service-type: " + sdnca_serviceType)
+ logger.debug("service-type: " + sdnca_serviceType)
def serviceConfigActivate = false
def source = ''
if ((sdnca_svcAction == 'activate') && (sdnca_svcOperation == 'service-configuration-operation') && (sdnca_serviceType == 'uCPE-VMS')) {
@@ -117,9 +123,9 @@ public class SDNCAdapter extends AbstractServiceTaskProcessor {
}
}
execution.setVariable("serviceConfigActivate", serviceConfigActivate)
- msoLogger.debug("serviceConfigActivate: " + serviceConfigActivate)
+ logger.debug("serviceConfigActivate: " + serviceConfigActivate)
execution.setVariable("source", source)
- msoLogger.debug("source: " + source)
+ logger.debug("source: " + source)
//calling process should pass a generated uuid if sending multiple sdnc requests
def sdncRequestId = utils.getNodeText(requestHeader, "RequestId")
@@ -155,22 +161,22 @@ public class SDNCAdapter extends AbstractServiceTaskProcessor {
${sdncRequestData}
</sdncadaptersc:RequestData></aetgt:SDNCAdapterRequest></SOAP-ENV:Body></SOAP-ENV:Envelope>"""
- msoLogger.debug("Outgoing SDNCAdapterRequest:\n" + sdncAdapterRequest)
+ logger.debug("Outgoing SDNCAdapterRequest:\n" + sdncAdapterRequest)
execution.setVariable("sdncAdapterRequest", sdncAdapterRequest)
- msoLogger.debug(UrnPropertiesReader.getVariable("mso.adapters.sdnc.endpoint", execution))
+ logger.debug(UrnPropertiesReader.getVariable("mso.adapters.sdnc.endpoint", execution))
}catch(Exception e){
- msoLogger.debug('Internal Error occured during PreProcess Method: ', e)
+ logger.debug('Internal Error occured during PreProcess Method: ', e)
exceptionUtil.buildAndThrowWorkflowException(execution, 9999, 'Internal Error occured during PreProcess Method') // TODO: what message and error code?
}
- msoLogger.trace("End pre Process SDNCRequestScript ")
+ logger.trace("End pre Process SDNCRequestScript ")
}
public void postProcessResponse (DelegateExecution execution) {
try{
- msoLogger.trace("Begin POSTProcess SDNCAdapter ")
- msoLogger.trace("Incoming sdncAdapterCallbackRequest:\n" + execution.getVariable("sdncAdapterCallbackRequest"))
+ logger.trace("Begin POSTProcess SDNCAdapter ")
+ logger.trace("Incoming sdncAdapterCallbackRequest:\n" + execution.getVariable("sdncAdapterCallbackRequest"))
// Check the sdnccallback request and get the responsecode
def sdnccallbackreq = execution.getVariable("sdncAdapterCallbackRequest")
@@ -185,7 +191,7 @@ public class SDNCAdapter extends AbstractServiceTaskProcessor {
callbackRequestData = callbackRequestData.replace("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n", "")
- msoLogger.trace("EnhancedCallbackRequestData:\n" + callbackRequestData)
+ logger.trace("EnhancedCallbackRequestData:\n" + callbackRequestData)
execution.setVariable("enhancedCallbackRequestData", callbackRequestData)
String sdncAdapterWorkflowResponse ="""
@@ -210,25 +216,25 @@ public class SDNCAdapter extends AbstractServiceTaskProcessor {
}
}
execution.setVariable("continueListening", continueListening)
- msoLogger.debug("Continue Listening: " + continueListening)
+ logger.debug("Continue Listening: " + continueListening)
execution.setVariable("asynchronousResponseTimeout", false)
}else{
// Timed out waiting for asynchronous message, build error response
exceptionUtil.buildWorkflowException(execution, 500, "SDNC Callback Timeout Error")
execution.setVariable("asynchronousResponseTimeout", true)
- msoLogger.debug("Timed out waiting for asynchronous message")
+ logger.debug("Timed out waiting for asynchronous message")
}
}catch(Exception e){
- msoLogger.debug('Internal Error occured during PostProcess Method: ' + e)
+ logger.debug('Internal Error occured during PostProcess Method: ' + e)
exceptionUtil.buildAndThrowWorkflowException(execution, 9999, 'Internal Error occured during PostProcess Method') // TODO: what message and error code?
}
- msoLogger.trace("End POSTProcess SDNCAdapter ")
+ logger.trace("End POSTProcess SDNCAdapter ")
}
public void callbackResponsecheck(DelegateExecution execution){
def sdnccallbackreq=execution.getVariable("sdncAdapterCallbackRequest")
- msoLogger.debug("sdncAdapterCallbackRequest :" + sdnccallbackreq)
+ logger.debug("sdncAdapterCallbackRequest :" + sdnccallbackreq)
if (sdnccallbackreq==null){
execution.setVariable("callbackResponseReceived",false);
}else{
@@ -238,14 +244,14 @@ public class SDNCAdapter extends AbstractServiceTaskProcessor {
public void resetCallbackRequest(DelegateExecution execution) {
- msoLogger.trace("Begin Reset Callback Info SDNCAdapter ")
+ logger.trace("Begin Reset Callback Info SDNCAdapter ")
// Clear sdncAdapterCallbackRequest variable
execution.removeVariable("sdncAdapterCallbackRequest")
// Determine and set SDNC Timeout Value
def enhancedCallbackRequestData = execution.getVariable("enhancedCallbackRequestData")
- msoLogger.debug("sdncAdapter - enhancedCallbackRequestData :" + enhancedCallbackRequestData)
+ logger.debug("sdncAdapter - enhancedCallbackRequestData :" + enhancedCallbackRequestData)
def interim = false
if (enhancedCallbackRequestData != null) {
if (utils.nodeExists(enhancedCallbackRequestData, "ack-final-indicator")) {
@@ -264,15 +270,15 @@ public class SDNCAdapter extends AbstractServiceTaskProcessor {
timeoutValue = "PT" + utils.getNodeText(sdncAdapterWorkflowRequest, "SDNCTimeOutValueInMinutes") + "M"
}
execution.setVariable("sdncTimeoutValue", timeoutValue)
- msoLogger.debug("Setting SDNC Timeout Value to " + timeoutValue)
+ logger.debug("Setting SDNC Timeout Value to " + timeoutValue)
- msoLogger.trace("End Reset Callback Info SDNCAdapter ")
+ logger.trace("End Reset Callback Info SDNCAdapter ")
}
public void prepareDBMessage(DelegateExecution execution) {
- msoLogger.trace("Begin Prepare DB Message SDNCAdapter ")
+ logger.trace("Begin Prepare DB Message SDNCAdapter ")
// Create DB Message
def dbRequestId = execution.getVariable("mso-request-id")
@@ -289,9 +295,9 @@ public class SDNCAdapter extends AbstractServiceTaskProcessor {
"""
execution.setVariable("dbUpdateInterimStageCompletion", dbUpdateInterimStageCompletion)
- msoLogger.debug("sdncAdapter - dbUpdateInterimStageCompletion :" + dbUpdateInterimStageCompletion)
- msoLogger.debug("DB UpdateInterimStageCompletion:\n" + dbUpdateInterimStageCompletion)
- msoLogger.trace("End Prepare DB Message SDNCAdapter ")
+ logger.debug("sdncAdapter - dbUpdateInterimStageCompletion :" + dbUpdateInterimStageCompletion)
+ logger.debug("DB UpdateInterimStageCompletion:\n" + dbUpdateInterimStageCompletion)
+ logger.trace("End Prepare DB Message SDNCAdapter ")
}
public String generateCurrentTimeInUtc(){
@@ -303,11 +309,11 @@ public class SDNCAdapter extends AbstractServiceTaskProcessor {
public void toggleSuccessIndicator(DelegateExecution execution){
execution.setVariable("SDNCA_SuccessIndicator", true)
- msoLogger.debug("Setting SDNCA Success Indicator to True")
+ logger.debug("Setting SDNCA Success Indicator to True")
}
public void assignError(DelegateExecution execution){
- msoLogger.trace("Started Assign Error ")
+ logger.trace("Started Assign Error ")
WorkflowException wf = execution.getVariable("WorkflowException")
if(wf == null){
exceptionUtil.buildWorkflowException(execution, 5000, "SDNCAdapter Encountered an Internal Error") // TODO: Not sure what message and error code we want here.....
@@ -315,17 +321,17 @@ public class SDNCAdapter extends AbstractServiceTaskProcessor {
execution.setVariable("WorkflowException", wf)
}
- msoLogger.debug("Outgoing WorkflowException is: " + execution.getVariable("WorkflowException"))
- msoLogger.trace("End Assign Error ")
+ logger.debug("Outgoing WorkflowException is: " + execution.getVariable("WorkflowException"))
+ logger.trace("End Assign Error ")
}
public void setTimeout(DelegateExecution execution){
- msoLogger.trace("Started SetTimeout ")
- msoLogger.debug("Timer expired, telling correlation service to stop listening")
+ logger.trace("Started SetTimeout ")
+ logger.debug("Timer expired, telling correlation service to stop listening")
execution.setVariable("asynchronousResponseTimeout", true)
- msoLogger.debug("Timed out branch sleeping for one second to give success branch a chance to complete if running")
+ logger.debug("Timed out branch sleeping for one second to give success branch a chance to complete if running")
Thread.sleep(1000)
- msoLogger.trace("End SetTimeout ")
+ logger.trace("End SetTimeout ")
}
}
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 9f1570ee15..1f39a5eac9 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
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -42,13 +44,15 @@ import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.client.HttpClient
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
import org.onap.so.utils.TargetEntity
class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SDNCAdapterRestV1.class);
+ private static final Logger logger = LoggerFactory.getLogger( SDNCAdapterRestV1.class);
ExceptionUtil exceptionUtil = new ExceptionUtil()
@@ -61,7 +65,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
def method = getClass().getSimpleName() + '.preProcessRequest(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
def prefix="SDNCREST_"
execution.setVariable("prefix", prefix)
@@ -73,7 +77,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
String request = validateRequest(execution, "mso-request-id")
String requestType = jsonUtil.getJsonRootProperty(request)
execution.setVariable(prefix + 'requestType', requestType)
- msoLogger.debug(getProcessKey(execution) + ': ' + prefix + 'requestType = ' + requestType)
+ logger.debug(getProcessKey(execution) + ': ' + prefix + 'requestType = ' + requestType)
// Determine the SDNCAdapter endpoint
@@ -81,8 +85,9 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
if (sdncAdapterEndpoint == null || sdncAdapterEndpoint.isEmpty()) {
String msg = getProcessKey(execution) + ': mso:adapters:sdnc:rest:endpoint URN mapping is not defined'
- msoLogger.debug(msg)
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.debug(msg)
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -101,13 +106,14 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
if (sdncRequestId == null || sdncRequestId.isEmpty()) {
String msg = getProcessKey(execution) + ': no sdncRequestId in ' + requestType
- msoLogger.debug(msg)
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.debug(msg)
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
execution.setVariable('SDNCAResponse_CORRELATOR', sdncRequestId)
- msoLogger.debug(getProcessKey(execution) + ': SDNCAResponse_CORRELATOR = ' + sdncRequestId)
+ logger.debug(getProcessKey(execution) + ': SDNCAResponse_CORRELATOR = ' + sdncRequestId)
// Get the bpNotificationUrl from the request (just to make sure it's there)
@@ -115,8 +121,9 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
if (bpNotificationUrl == null || bpNotificationUrl.isEmpty()) {
String msg = getProcessKey(execution) + ': no bpNotificationUrl in ' + requestType
- msoLogger.debug(msg)
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.debug(msg)
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -131,8 +138,9 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
} else {
String msg = getProcessKey(execution) + ': Unsupported request type: ' + requestType
- msoLogger.debug(msg)
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.debug(msg)
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -145,15 +153,19 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
String basicAuthValue = UrnPropertiesReader.getVariable("mso.adapters.po.auth", execution)
if (basicAuthValue == null || basicAuthValue.isEmpty()) {
- msoLogger.debug(getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined")
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.debug(getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined")
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined", "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
} else {
try {
def encodedString = utils.getBasicAuth(basicAuthValue, UrnPropertiesReader.getVariable("mso.msoKey", execution))
execution.setVariable(prefix + 'basicAuthHeaderValue', encodedString)
} catch (IOException ex) {
- msoLogger.debug(getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter")
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.debug(getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter")
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter",
+ "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
}
}
@@ -165,7 +177,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
// in addition to null/empty, also need to verify that the timer value is a valid duration "P[n]T[n]H|M|S"
String timerRegex = "PT[0-9]+[HMS]";
if (timeout == null || timeout.isEmpty() || !timeout.matches(timerRegex)) {
- msoLogger.debug(getProcessKey(execution) + ': preProcessRequest(): null/empty/invalid bpTimeout value. Using "mso.adapters.sdnc.timeout"')
+ logger.debug(getProcessKey(execution) + ': preProcessRequest(): null/empty/invalid bpTimeout value. Using "mso.adapters.sdnc.timeout"')
timeout = UrnPropertiesReader.getVariable("mso.adapters.sdnc.timeout", execution)
}
@@ -177,13 +189,14 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
}
execution.setVariable(prefix + 'timeout', timeout)
- msoLogger.debug(getProcessKey(execution) + ': ' + prefix + 'timeout = ' + timeout)
+ logger.debug(getProcessKey(execution) + ': ' + prefix + 'timeout = ' + timeout)
} catch (BpmnError e) {
throw e
} catch (Exception e) {
String msg = 'Caught exception in ' + method + ": " + e
- msoLogger.debug(msg)
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.debug(msg)
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
}
@@ -195,17 +208,17 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
def method = getClass().getSimpleName() + '.sendRequestToSDNCAdapter(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
String prefix = execution.getVariable('prefix')
try {
String sdncAdapterMethod = execution.getVariable(prefix + 'sdncAdapterMethod')
- msoLogger.debug("SDNC Method is: " + sdncAdapterMethod)
+ logger.debug("SDNC Method is: " + sdncAdapterMethod)
String sdncAdapterUrl = execution.getVariable(prefix + 'sdncAdapterUrl')
- msoLogger.debug("SDNC Url is: " + sdncAdapterUrl)
+ logger.debug("SDNC Url is: " + sdncAdapterUrl)
String sdncAdapterRequest = execution.getVariable(prefix + 'sdncAdapterRequest')
- msoLogger.debug("SDNC Rest Request is: " + sdncAdapterRequest)
+ logger.debug("SDNC Rest Request is: " + sdncAdapterRequest)
URL url = new URL(sdncAdapterUrl);
@@ -229,8 +242,9 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
response = httpClient.delete(sdncAdapterRequest)
} else {
String msg = 'Unsupported HTTP method "' + sdncAdapterMethod + '" in ' + method + ": " + e
- msoLogger.debug(msg)
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.debug(msg)
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -242,8 +256,9 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
throw e
} catch (Exception e) {
String msg = 'Caught exception in ' + method + ": " + e
- msoLogger.debug(msg, e)
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.debug(msg, e)
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
}
@@ -255,14 +270,14 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
def method = getClass().getSimpleName() + '.processCallback(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
String prefix = execution.getVariable('prefix')
String callback = execution.getVariable('SDNCAResponse_MESSAGE')
String requestId = execution.getVariable("mso-request-id");
String serviceInstanceId = execution.getVariable("mso-service-instance-id")
utils.logContext(requestId, serviceInstanceId)
- msoLogger.debug("Incoming SDNC Rest Callback is: " + callback)
+ logger.debug("Incoming SDNC Rest Callback is: " + callback)
try {
int callbackNumber = 1
@@ -290,7 +305,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
} catch (Exception e) {
callback = callback == null || String.valueOf(callback).isEmpty() ? "NONE" : callback
String msg = "Received error from SDNCAdapter: " + callback
- msoLogger.debug(getProcessKey(execution) + ': ' + msg)
+ logger.debug(getProcessKey(execution) + ': ' + msg)
exceptionUtil.buildWorkflowException(execution, 5300, msg)
}
}
@@ -333,7 +348,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
def method = getClass().getSimpleName() + '.getLastCallback(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
String prefix = execution.getVariable('prefix')
@@ -355,8 +370,9 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
return callback
} catch (Exception e) {
String msg = 'Caught exception in ' + method + ": " + e
- msoLogger.debug(msg)
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.debug(msg)
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
}
@@ -368,7 +384,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
def method = getClass().getSimpleName() + '.setTimeoutValue(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
String prefix = execution.getVariable('prefix')
@@ -380,8 +396,9 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
}
} catch (Exception e) {
String msg = 'Caught exception in ' + method + ": " + e
- msoLogger.debug(msg)
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.debug(msg)
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV2.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV2.groovy
index 1a20497bbc..64f54dbd66 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV2.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV2.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -37,6 +39,8 @@ import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
@@ -45,7 +49,7 @@ import org.onap.so.logger.MsoLogger
* any non-final response received from SDNC.
*/
class SDNCAdapterRestV2 extends SDNCAdapterRestV1 {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SDNCAdapterRestV2.class);
+ private static final Logger logger = LoggerFactory.getLogger( SDNCAdapterRestV2.class);
ExceptionUtil exceptionUtil = new ExceptionUtil()
@@ -58,7 +62,7 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 {
def method = getClass().getSimpleName() + '.preProcessRequest(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
def prefix="SDNCREST_"
execution.setVariable("prefix", prefix)
@@ -70,8 +74,8 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 {
String request = validateRequest(execution, "mso-request-id")
String requestType = jsonUtil.getJsonRootProperty(request)
execution.setVariable(prefix + 'requestType', requestType)
- msoLogger.debug(getProcessKey(execution) + ': ' + prefix + 'requestType = ' + requestType)
- msoLogger.debug('SDNCAdapterRestV2, request: ' + request)
+ logger.debug(getProcessKey(execution) + ': ' + prefix + 'requestType = ' + requestType)
+ logger.debug('SDNCAdapterRestV2, request: ' + request)
// Determine the SDNCAdapter endpoint
@@ -79,8 +83,9 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 {
if (sdncAdapterEndpoint == null || sdncAdapterEndpoint.isEmpty()) {
String msg = getProcessKey(execution) + ': mso:adapters:sdnc:rest:endpoint URN mapping is not defined'
- msoLogger.debug(msg)
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.debug(msg)
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -99,13 +104,14 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 {
if (sdncRequestId == null || sdncRequestId.isEmpty()) {
String msg = getProcessKey(execution) + ': no sdncRequestId in ' + requestType
- msoLogger.debug(msg)
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.debug(msg)
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
execution.setVariable('SDNCAResponse_CORRELATOR', sdncRequestId)
- msoLogger.debug(getProcessKey(execution) + ': SDNCAResponse_CORRELATOR = ' + sdncRequestId)
+ logger.debug(getProcessKey(execution) + ': SDNCAResponse_CORRELATOR = ' + sdncRequestId)
// Get the bpNotificationUrl from the request (just to make sure it's there)
@@ -113,8 +119,9 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 {
if (bpNotificationUrl == null || bpNotificationUrl.isEmpty()) {
String msg = getProcessKey(execution) + ': no bpNotificationUrl in ' + requestType
- msoLogger.debug(msg)
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.debug(msg)
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -123,32 +130,37 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 {
} else {
String msg = getProcessKey(execution) + ': Unsupported request type: ' + requestType
- msoLogger.debug(msg)
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.debug(msg)
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
execution.setVariable(prefix + 'sdncAdapterMethod', sdncAdapterMethod)
- msoLogger.debug(getProcessKey(execution) + ': ' + prefix + 'sdncAdapterMethod = ' + sdncAdapterMethod)
+ logger.debug(getProcessKey(execution) + ': ' + prefix + 'sdncAdapterMethod = ' + sdncAdapterMethod)
execution.setVariable(prefix + 'sdncAdapterUrl', sdncAdapterUrl)
- msoLogger.debug(getProcessKey(execution) + ': ' + prefix + 'sdncAdapterUrl = ' + sdncAdapterUrl)
+ logger.debug(getProcessKey(execution) + ': ' + prefix + 'sdncAdapterUrl = ' + sdncAdapterUrl)
execution.setVariable(prefix + 'sdncAdapterRequest', sdncAdapterRequest)
- msoLogger.debug(getProcessKey(execution) + ': ' + prefix + 'sdncAdapterRequest = \n' + sdncAdapterRequest)
+ logger.debug(getProcessKey(execution) + ': ' + prefix + 'sdncAdapterRequest = \n' + sdncAdapterRequest)
// Get the Basic Auth credentials for the SDNCAdapter (yes... we ARE using the PO adapters credentials)
String basicAuthValue = UrnPropertiesReader.getVariable("mso.adapters.po.auth",execution)
if (basicAuthValue == null || basicAuthValue.isEmpty()) {
- msoLogger.debug(getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined")
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.debug(getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined")
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined", "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
} else {
try {
def encodedString = utils.getBasicAuth(basicAuthValue, UrnPropertiesReader.getVariable("mso.msoKey", execution))
execution.setVariable(prefix + 'basicAuthHeaderValue', encodedString)
} catch (IOException ex) {
- msoLogger.debug(getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter")
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.debug(getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter")
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter",
+ "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
}
}
@@ -160,25 +172,26 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 {
// in addition to null/empty, also need to verify that the timer value is a valid duration "P[n]T[n]H|M|S"
String timerRegex = "PT[0-9]+[HMS]";
if (timeout == null || timeout.isEmpty() || !timeout.matches(timerRegex)) {
- msoLogger.debug(getProcessKey(execution) + ': preProcessRequest(): null/empty/invalid bpTimeout value. Using "mso.adapters.sdnc.timeout"')
+ logger.debug(getProcessKey(execution) + ': preProcessRequest(): null/empty/invalid bpTimeout value. Using "mso.adapters.sdnc.timeout"')
timeout = UrnPropertiesReader.getVariable("mso.adapters.sdnc.timeout", execution)
}
// the timeout could still be null at this point if the config parm is missing/undefined
// forced to log (so OPs can fix the config) and temporarily use a hard coded value of 10 seconds
if (timeout == null) {
- msoLogger.warnSimple('preProcessRequest()', 'property "mso.adapters.sdnc.timeout" is missing/undefined. Using "PT10S"')
+ logger.warn("Service Name: {} Error: {}", 'preProcessRequest()', 'property "mso.adapters.sdnc.timeout" is missing/undefined. Using "PT10S"')
timeout = "PT10S"
}
execution.setVariable(prefix + 'timeout', timeout)
- msoLogger.debug(getProcessKey(execution) + ': ' + prefix + 'timeout = ' + timeout)
+ logger.debug(getProcessKey(execution) + ': ' + prefix + 'timeout = ' + timeout)
} catch (BpmnError e) {
throw e
} catch (Exception e) {
String msg = 'Caught exception in ' + method + ": " + e
- msoLogger.debug(msg)
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.debug(msg)
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
}
@@ -190,14 +203,14 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 {
def method = getClass().getSimpleName() + '.processCallback(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
String prefix = execution.getVariable('prefix')
String callback = execution.getVariable('SDNCAResponse_MESSAGE')
- msoLogger.debug("Incoming SDNC Rest Callback is: " + callback)
+ logger.debug("Incoming SDNC Rest Callback is: " + callback)
try {
- msoLogger.debug(getProcessKey(execution) + ": received callback:\n" + callback)
+ logger.debug(getProcessKey(execution) + ": received callback:\n" + callback)
int callbackNumber = 1
while (execution.getVariable(prefix + 'callback' + callbackNumber) != null) {
@@ -236,7 +249,7 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 {
} catch (Exception e) {
callback = callback == null || String.valueOf(callback).isEmpty() ? "NONE" : callback
String msg = "Received error from SDNCAdapter: " + callback
- msoLogger.debug(getProcessKey(execution) + ': ' + msg)
+ logger.debug(getProcessKey(execution) + ': ' + msg)
exceptionUtil.buildWorkflowException(execution, 5300, msg)
}
}
@@ -250,14 +263,14 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 {
def method = getClass().getSimpleName() + '.prepareInterimNotification(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
String prefix = execution.getVariable('prefix')
- msoLogger.debug("Preparing Interim Notification")
+ logger.debug("Preparing Interim Notification")
try {
def interimNotification = execution.getVariable(prefix + "interimNotification")
- msoLogger.debug("Preparing Interim Notification:\n" + JsonUtils.prettyJson(interimNotification))
+ logger.debug("Preparing Interim Notification:\n" + JsonUtils.prettyJson(interimNotification))
for (int i = 0; ; i++) {
def variable = JsonUtils.getJsonParamValue(interimNotification, 'variableList', 'variable', i)
@@ -270,13 +283,13 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 {
if ((variableName != null) && !variableName.isEmpty()) {
def variableValue = JsonUtils.getJsonValue(variable, "value")
execution.setVariable(variableName, variableValue)
- msoLogger.debug("Setting "+ variableName + "=" + variableValue)
+ logger.debug("Setting "+ variableName + "=" + variableValue)
}
}
} catch (Exception e) {
String msg = "Error preparing interim notification"
- msoLogger.debug(getProcessKey(execution) + ': ' + msg)
+ logger.debug(getProcessKey(execution) + ': ' + msg)
exceptionUtil.buildWorkflowException(execution, 5300, msg)
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterUtils.groovy
index bed857dda8..b5ea12b85a 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterUtils.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterUtils.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -29,6 +31,8 @@ import org.springframework.web.util.UriUtils
import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
@@ -38,7 +42,7 @@ import org.onap.so.logger.MsoLogger
*
*/
class SDNCAdapterUtils {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SDNCAdapterUtils.class);
+ private static final Logger logger = LoggerFactory.getLogger( SDNCAdapterUtils.class);
ExceptionUtil exceptionUtil = new ExceptionUtil()
@@ -259,7 +263,9 @@ class SDNCAdapterUtils {
def callbackUrl = (String)UrnPropertiesReader.getVariable('mso.workflow.sdncadapter.callback',execution)
if (callbackUrl == null || callbackUrl.trim() == "") {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'mso:workflow:sdncadapter:callback URN is not set', "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'mso:workflow:sdncadapter:callback URN is not set', "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue());
workflowException(execution, 'Internal Error', 9999) // TODO: what message and error code?
}
@@ -373,7 +379,7 @@ class SDNCAdapterUtils {
', additionalData=' + (additionalData == null ? "no" : "yes") +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
MsoUtils utils = taskProcessor.utils
try {
def prefix = execution.getVariable('prefix')
@@ -395,7 +401,9 @@ class SDNCAdapterUtils {
def callbackUrl = (String)UrnPropertiesReader.getVariable('mso.workflow.sdncadapter.callback',execution)
if (callbackUrl == null || callbackUrl.trim() == "") {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'mso:workflow:sdncadapter:callback URN is not set', "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'mso:workflow:sdncadapter:callback URN is not set', "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Internal Error - During PreProcess Request")
}
@@ -460,13 +468,15 @@ class SDNCAdapterUtils {
content = utils.removeXmlPreamble(utils.formatXML(content))
execution.setVariable(resultVar, content)
- msoLogger.debug(resultVar + ' = ' + System.lineSeparator() + content)
+ logger.debug(resultVar + ' = ' + System.lineSeparator() + content)
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error")
}
}
@@ -783,17 +793,17 @@ class SDNCAdapterUtils {
* @param workflowException the WorkflowException Object returned from sdnc call
*/
public void validateSDNCResponse(DelegateExecution execution, String response, WorkflowException workflowException, boolean successIndicator){
- msoLogger.debug("SDNC Response is: " + response)
- msoLogger.debug("SuccessIndicator is: " + successIndicator)
+ logger.debug("SDNC Response is: " + response)
+ logger.debug("SuccessIndicator is: " + successIndicator)
try {
def prefix = execution.getVariable('prefix')
execution.setVariable(prefix+'sdncResponseSuccess', false)
- msoLogger.debug("Response" + ' = ' + (response == null ? "" : System.lineSeparator()) + response)
+ logger.debug("Response" + ' = ' + (response == null ? "" : System.lineSeparator()) + response)
if (successIndicator){
if (response == null || response.trim().equals("")) {
- msoLogger.debug(response + ' is empty');
+ logger.debug(response + ' is empty');
exceptionUtil.buildAndThrowWorkflowException(execution, 500, "SDNCAdapter Workflow Response is Empty")
}else{
@@ -801,7 +811,7 @@ class SDNCAdapterUtils {
def String sdncAdapterWorkflowResponse = taskProcessor.utils.getNodeXml(response, 'response-data', false)
def String decodedXml = sdncAdapterWorkflowResponse.replace('<?xml version="1.0" encoding="UTF-8"?>', "")
decodedXml = taskProcessor.utils.getNodeXml(response, 'RequestData')
- msoLogger.debug("decodedXml:\n" + decodedXml)
+ logger.debug("decodedXml:\n" + decodedXml)
int requestDataResponseCode = 200
def String requestDataResponseMessage = ''
@@ -813,33 +823,33 @@ class SDNCAdapterUtils {
requestDataResponseMessage = taskProcessor.utils.getNodeText(sdncAdapterWorkflowResponse, "ResponseMessage")
}
}catch(Exception e){
- msoLogger.debug('Error caught while decoding resposne ' + e.getMessage())
+ logger.debug('Error caught while decoding resposne ' + e.getMessage())
}
if(taskProcessor.utils.nodeExists(decodedXml, "response-code")) {
- msoLogger.debug("response-code node Exist ")
+ logger.debug("response-code node Exist ")
String code = taskProcessor.utils.getNodeText(decodedXml, "response-code")
if(code.isEmpty() || code.equals("")){
// if response-code is blank then Success
- msoLogger.debug("response-code node is empty")
+ logger.debug("response-code node is empty")
requestDataResponseCode = 0
}else{
requestDataResponseCode = code.toInteger()
- msoLogger.debug("response-code is: " + requestDataResponseCode)
+ logger.debug("response-code is: " + requestDataResponseCode)
}
}else if(taskProcessor.utils.nodeExists(sdncAdapterWorkflowResponse, "ResponseCode")){
- msoLogger.debug("ResponseCode node Exist ")
+ logger.debug("ResponseCode node Exist ")
String code = taskProcessor.utils.getNodeText(sdncAdapterWorkflowResponse, "ResponseCode")
if(code.isEmpty() || code.equals("")){
// if ResponseCode blank then Success
- msoLogger.debug("ResponseCode node is empty")
+ logger.debug("ResponseCode node is empty")
requestDataResponseCode = 0
}else{
requestDataResponseCode = code.toInteger()
- msoLogger.debug("ResponseCode is: " + requestDataResponseCode)
+ logger.debug("ResponseCode is: " + requestDataResponseCode)
}
}else{
- msoLogger.debug("A Response Code DOES NOT Exist.")
+ logger.debug("A Response Code DOES NOT Exist.")
// if a response code does not exist then Success
requestDataResponseCode = 0
}
@@ -849,8 +859,8 @@ class SDNCAdapterUtils {
// if a response code is 0 or 2XX then Success
if ((requestDataResponseCode >= 200 && requestDataResponseCode <= 299) || requestDataResponseCode == 0) {
execution.setVariable(prefix+'sdncResponseSuccess', true)
- msoLogger.debug("Setting sdncResponseSuccess to True ")
- msoLogger.debug("Exited ValidateSDNCResponse Method")
+ logger.debug("Setting sdncResponseSuccess to True ")
+ logger.debug("Exited ValidateSDNCResponse Method")
}else{
ExceptionUtil exceptionUtil = new ExceptionUtil()
String convertedCode = exceptionUtil.MapSDNCResponseCodeToErrorCode(requestDataResponseCode.toString())
@@ -863,12 +873,12 @@ class SDNCAdapterUtils {
requestDataResponseCode = 500
}
- msoLogger.debug("SDNC callback response-code: " + requestDataResponseCode)
- msoLogger.debug("SDNC callback response-message: " + requestDataResponseMessage)
+ logger.debug("SDNC callback response-code: " + requestDataResponseCode)
+ logger.debug("SDNC callback response-message: " + requestDataResponseMessage)
}
}else {
- msoLogger.debug('SDNCAdapter Subflow did NOT complete Successfully. SuccessIndicator is False. ')
+ logger.debug('SDNCAdapter Subflow did NOT complete Successfully. SuccessIndicator is False. ')
if(workflowException != null){
exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage())
}else{
@@ -880,7 +890,7 @@ class SDNCAdapterUtils {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.debug('END of Validate SDNC Response')
+ logger.debug('END of Validate SDNC Response')
exceptionUtil.buildAndThrowWorkflowException(execution, 500, 'Internal Error- Unable to validate SDNC Response ');
}
}
@@ -897,20 +907,20 @@ class SDNCAdapterUtils {
'execution=' + execution.getId() +
', response=' + response +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
def prefix = execution.getVariable('prefix')
TrinityExceptionUtil trinityExceptionUtil = new TrinityExceptionUtil()
try {
execution.setVariable(prefix+'sdncResponseSuccess', false)
- msoLogger.debug("sdncAdapter Success Indicator is: " + success)
+ logger.debug("sdncAdapter Success Indicator is: " + success)
if (success) {
// we need to look inside the request data for error
def String callbackRequestData = taskProcessor.utils.getNodeXml(response, 'RequestData', false)
def String decodedXml = callbackRequestData
- msoLogger.debug("decodedXml:\n" + decodedXml)
+ logger.debug("decodedXml:\n" + decodedXml)
def requestDataResponseCode = '200'
def requestDataResponseMessage = ''
@@ -929,29 +939,29 @@ class SDNCAdapterUtils {
requestDataResponseMessage = taskProcessor.utils.getNodeText(response, "ResponseMessage")
}
- msoLogger.debug("SDNC callback response-code: " + requestDataResponseCode)
- msoLogger.debug("SDNC callback response-message: " + requestDataResponseMessage)
+ logger.debug("SDNC callback response-code: " + requestDataResponseCode)
+ logger.debug("SDNC callback response-message: " + requestDataResponseMessage)
// Get the AAI Status to determine if rollback is needed on ASSIGN
def aai_status = ''
if (taskProcessor.utils.nodeExists(decodedXml, "aai-status")) {
aai_status = ((String) taskProcessor.utils.getNodeText(decodedXml, "aai-status"))
- msoLogger.debug("SDNC sent AAI STATUS code: " + aai_status)
+ logger.debug("SDNC sent AAI STATUS code: " + aai_status)
}
if (aai_status != null && !aai_status.equals("")) {
execution.setVariable(prefix+"AaiStatus",aai_status)
- msoLogger.debug("Set variable " + prefix + "AaiStatus: " + execution.getVariable(prefix+"AaiStatus"))
+ logger.debug("Set variable " + prefix + "AaiStatus: " + execution.getVariable(prefix+"AaiStatus"))
}
// Get the result string to determine if rollback is needed on ASSIGN in Add Bonding flow only
def sdncResult = ''
if (taskProcessor.utils.nodeExists(decodedXml, "result")) {
sdncResult = ((String) taskProcessor.utils.getNodeText(decodedXml, "result"))
- msoLogger.debug("SDNC sent result: " + sdncResult)
+ logger.debug("SDNC sent result: " + sdncResult)
}
if (sdncResult != null && !sdncResult.equals("")) {
execution.setVariable(prefix+"SdncResult",sdncResult)
- msoLogger.debug("Set variable " + prefix + "SdncResult: " + execution.getVariable(prefix+"SdncResult"))
+ logger.debug("Set variable " + prefix + "SdncResult: " + execution.getVariable(prefix+"SdncResult"))
}
try{
@@ -960,7 +970,7 @@ class SDNCAdapterUtils {
intDataResponseCode = 400
}
- msoLogger.debug("intDataResponseCode " + intDataResponseCode )
+ logger.debug("intDataResponseCode " + intDataResponseCode )
// if response-code is not Success (200, 201, etc) we need to throw an exception
if ((intDataResponseCode < 200 || intDataResponseCode > 299) && intDataResponseCode != 0) {
@@ -971,25 +981,30 @@ class SDNCAdapterUtils {
}
}else {
- msoLogger.warn(MessageEnum.BPMN_GENERAL_WARNING, 'sdncAdapter did not complete successfully, sdncAdapter Success Indicator was false ', "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, 'sdncAdapter did not complete successfully, sdncAdapter Success Indicator was false ');
+ logger.warn("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_WARNING,
+ 'sdncAdapter did not complete successfully, sdncAdapter Success Indicator was false ',
+ "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError,
+ 'sdncAdapter did not complete successfully, sdncAdapter Success Indicator was false ')
execution.setVariable("L3HLAB_rollback", true)
def msg = trinityExceptionUtil.intDataResponseCode(response, execution)
exceptionUtil.buildAndThrowWorkflowException(execution, intDataResponseCode, msg)
}
if (response == null || response.trim().equals("")) {
- msoLogger.warn(MessageEnum.BPMN_GENERAL_WARNING, 'sdncAdapter workflow response is empty', "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, 'sdncAdapter workflow response is empty');;
+ logger.warn("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_WARNING,
+ 'sdncAdapter workflow response is empty', "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError, 'sdncAdapter workflow response is empty')
execution.setVariable("L3HLAB_rollback", true)
def msg = trinityExceptionUtil.buildException("Exception occurred while validating SDNC response " , execution)
exceptionUtil.buildAndThrowWorkflowException(execution, intResponseCode, msg)
}
execution.setVariable(prefix+'sdncResponseSuccess', true)
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
execution.setVariable(prefix+"ResponseCode",400)
execution.setVariable("L3HLAB_rollback", true)
def msg = trinityExceptionUtil.buildException("Exception occurred while validating SDNC response: " + e.getMessage(), execution)
@@ -1024,4 +1039,4 @@ class SDNCAdapterUtils {
return ecompModelInformation
}
-} \ No newline at end of file
+}
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 9556ae7d6a..8c2da2c112 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
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -46,8 +48,8 @@ import static org.onap.so.bpmn.common.scripts.GenericUtils.*;
import java.net.URL
import javax.ws.rs.core.Response
-import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
/**
@@ -61,7 +63,7 @@ import org.onap.so.logger.MsoLogger
*/
class SniroHomingV1 extends AbstractServiceTaskProcessor{
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SniroHomingV1.class);
+ private static final Logger logger = LoggerFactory.getLogger( SniroHomingV1.class);
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtil = new JsonUtils()
SniroUtils sniroUtils = new SniroUtils(this)
@@ -77,19 +79,19 @@ class SniroHomingV1 extends AbstractServiceTaskProcessor{
*/
public void callSniro(DelegateExecution execution){
execution.setVariable("prefix","HOME_")
- msoLogger.trace("Started Sniro Homing Call Sniro ")
+ logger.trace("Started Sniro Homing Call Sniro ")
try{
execution.setVariable("rollbackData", null)
execution.setVariable("rolledBack", false)
String requestId = execution.getVariable("msoRequestId")
- msoLogger.debug("Incoming Request Id is: " + requestId)
+ logger.debug("Incoming Request Id is: " + requestId)
String serviceInstanceId = execution.getVariable("serviceInstanceId")
- msoLogger.debug("Incoming Service Instance Id is: " + serviceInstanceId)
+ logger.debug("Incoming Service Instance Id is: " + serviceInstanceId)
ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
- msoLogger.debug("Incoming Service Decomposition is: " + serviceDecomposition)
+ logger.debug("Incoming Service Decomposition is: " + serviceDecomposition)
String subscriberInfo = execution.getVariable("subscriberInfo")
- msoLogger.debug("Incoming Subscriber Information is: " + subscriberInfo)
+ logger.debug("Incoming Subscriber Information is: " + subscriberInfo)
if(isBlank(requestId) || isBlank(serviceInstanceId) || isBlank(serviceDecomposition.toString()) || isBlank(subscriberInfo)){
exceptionUtil.buildAndThrowWorkflowException(execution, 4000, "A required input variable is missing or null")
@@ -117,7 +119,7 @@ class SniroHomingV1 extends AbstractServiceTaskProcessor{
timeout = "PT30M";
}
}
- msoLogger.debug("Async Callback Timeout will be: " + timeout)
+ logger.debug("Async Callback Timeout will be: " + timeout)
execution.setVariable("timeout", timeout);
execution.setVariable("correlator", requestId);
@@ -126,12 +128,12 @@ class SniroHomingV1 extends AbstractServiceTaskProcessor{
//Build Request & Call Sniro
String sniroRequest = sniroUtils.buildRequest(execution, requestId, serviceDecomposition, subscriber, homingParameters)
execution.setVariable("sniroRequest", sniroRequest)
- msoLogger.debug("SNIRO Request is: " + sniroRequest)
+ logger.debug("SNIRO Request is: " + sniroRequest)
String endpoint = UrnPropertiesReader.getVariable("sniro.manager.uri.v1", execution)
String host = UrnPropertiesReader.getVariable("sniro.manager.host", execution)
String urlString = host + endpoint
- msoLogger.debug("Sniro Url is: " + urlString)
+ logger.debug("Sniro Url is: " + urlString)
URL url = new URL(urlString);
HttpClient httpClient = new HttpClientFactory().newJsonClient(url, TargetEntity.SNIRO)
@@ -140,21 +142,21 @@ class SniroHomingV1 extends AbstractServiceTaskProcessor{
int responseCode = httpResponse.getStatus()
- msoLogger.debug("Sniro sync response code is: " + responseCode)
+ logger.debug("Sniro sync response code is: " + responseCode)
if(httpResponse.hasEntity()){
- msoLogger.debug("Sniro sync response is: " + httpResponse.readEntity(String.class))
+ logger.debug("Sniro sync response is: " + httpResponse.readEntity(String.class))
}
if(responseCode != 202){
exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Sync Response from Sniro.")
}
- msoLogger.trace("Completed Sniro Homing Call Sniro")
+ logger.trace("Completed Sniro Homing Call Sniro")
}
}catch(BpmnError b){
throw b
}catch(Exception e){
- msoLogger.debug("Error encountered within Homing CallSniro method: " + e)
+ logger.debug("Error encountered within Homing CallSniro method: " + e)
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in Homing CallSniro: " + e.getMessage())
}
}
@@ -170,10 +172,10 @@ class SniroHomingV1 extends AbstractServiceTaskProcessor{
* @author cb645j
*/
public void processHomingSolution(DelegateExecution execution){
- msoLogger.trace("Started Sniro Homing Process Homing Solution")
+ logger.trace("Started Sniro Homing Process Homing Solution")
try{
String response = execution.getVariable("asyncCallbackResponse")
- msoLogger.debug("Sniro Async Callback Response is: " + response)
+ logger.debug("Sniro Async Callback Response is: " + response)
sniroUtils.validateCallbackResponse(execution, response)
@@ -233,11 +235,11 @@ class SniroHomingV1 extends AbstractServiceTaskProcessor{
}
execution.setVariable("serviceDecomposition", decomposition)
- msoLogger.trace("Completed Sniro Homing Process Homing Solution")
+ logger.trace("Completed Sniro Homing Process Homing Solution")
}catch(BpmnError b){
throw b
}catch(Exception e){
- msoLogger.debug("Error encountered within Homing ProcessHomingSolution method: " + e)
+ logger.debug("Error encountered within Homing ProcessHomingSolution method: " + e)
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in Sniro Homing Process Solution")
}
}
@@ -255,9 +257,9 @@ class SniroHomingV1 extends AbstractServiceTaskProcessor{
requestId = execution.getVariable("msoRequestId")
}
execution.setVariable("DHVCS_requestId", requestId)
- msoLogger.trace("STARTED Homing Subflow for request: " + requestId + " ")
- msoLogger.debug("****** Homing Subflow Global Debug Enabled: " + execution.getVariable("isDebugLogEnabled") + " *****")
- msoLogger.trace("STARTED Homing Subflow for request: " + requestId + " ")
+ logger.trace("STARTED Homing Subflow for request: " + requestId + " ")
+ logger.debug("****** Homing Subflow Global Debug Enabled: " + execution.getVariable("isDebugLogEnabled") + " *****")
+ logger.trace("STARTED Homing Subflow for request: " + requestId + " ")
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SniroUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SniroUtils.groovy
index 5ff49fbae8..2343d5451c 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SniroUtils.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SniroUtils.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -34,13 +36,13 @@ import static org.onap.so.bpmn.common.scripts.GenericUtils.*
import java.time.Duration
-import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
class SniroUtils{
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SniroUtils.class);
+ private static final Logger logger = LoggerFactory.getLogger( SniroUtils.class);
ExceptionUtil exceptionUtil = new ExceptionUtil()
@@ -70,14 +72,14 @@ class SniroUtils{
* @author cb645j
*/
public String buildRequest(DelegateExecution execution, String requestId, ServiceDecomposition decomposition, Subscriber subscriber, String homingParams){
- msoLogger.debug("Started Building Sniro Request")
+ logger.debug("Started Building Sniro Request")
def callbackUrl = utils.createWorkflowMessageAdapterCallbackURL(execution, "SNIROResponse", requestId)
def transactionId = requestId
//ServiceInstance Info
ServiceInstance serviceInstance = decomposition.getServiceInstance()
def serviceInstanceId
if(serviceInstance == null){
- msoLogger.debug("Unable to obtain Service Instance Id, ServiceInstance Object is null" )
+ logger.debug("Unable to obtain Service Instance Id, ServiceInstance Object is null" )
exceptionUtil.buildAndThrowWorkflowException(execution, 400, "Internal Error - Unable to obtain Service Instance Id, ServiceInstance Object is null")
}else{
serviceInstanceId = serviceInstance.getInstanceId()
@@ -142,7 +144,7 @@ class SniroUtils{
}
if(resourceList.isEmpty() || resourceList == null){
- msoLogger.debug("Resources List is Empty")
+ logger.debug("Resources List is Empty")
}else{
for(Resource resource:resourceList){
ModelInfo resourceModelInfo = resource.getModelInfo()
@@ -197,7 +199,7 @@ class SniroUtils{
String licenseDemands = ""
sb = new StringBuilder()
if(vnfResourceList.isEmpty() || vnfResourceList == null){
- msoLogger.debug("Vnf Resources List is Empty")
+ logger.debug("Vnf Resources List is Empty")
}else{
for(VnfResource vnfResource:vnfResourceList){
ModelInfo vnfResourceModelInfo = vnfResource.getModelInfo()
@@ -291,7 +293,7 @@ class SniroUtils{
}
}"""
- msoLogger.debug("Completed Building Sniro Request")
+ logger.debug("Completed Building Sniro Request")
return request
}
@@ -321,7 +323,7 @@ class SniroUtils{
licenses = jsonUtil.getJsonValue(response, "solutionInfo.licenseInfo")
}
if((isBlank(placements) || placements.equalsIgnoreCase("[]")) && (isBlank(licenses) || licenses.equalsIgnoreCase("[]"))){
- msoLogger.debug("Sniro Async Response does not contain: licenses or placements")
+ logger.debug("Sniro Async Response does not contain: licenses or placements")
}else{
return
}
@@ -336,20 +338,20 @@ class SniroUtils{
}else{
errorMessage = "Sniro Async Response contains an error: not provided"
}
- msoLogger.debug("Sniro Async Response contains an error: " + errorMessage)
+ logger.debug("Sniro Async Response contains an error: " + errorMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 400, errorMessage)
}else{
- msoLogger.debug("Sniro Async Response contains an error: not provided")
+ logger.debug("Sniro Async Response contains an error: not provided")
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Sniro Async Response contains an error: not provided")
}
}
}catch(BpmnError b){
throw b
}catch(Exception e){
- msoLogger.debug("Error encountered within Homing validateCallbackResponse method: " + e)
+ logger.debug("Error encountered within Homing validateCallbackResponse method: " + e)
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in Sniro Homing Validate Async Response")
}
}
-} \ No newline at end of file
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/TrinityExceptionUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/TrinityExceptionUtil.groovy
index 3cf1edb8ca..ebce0c6753 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/TrinityExceptionUtil.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/TrinityExceptionUtil.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -24,15 +26,17 @@ import org.camunda.bpm.engine.delegate.DelegateExecution
import org.apache.commons.lang3.*
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
class TrinityExceptionUtil {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, TrinityExceptionUtil.class);
+ private static final Logger logger = LoggerFactory.getLogger( TrinityExceptionUtil.class);
+
+
+
-
-
-
public static enum Error {
SVC_GENERAL_SERVICE_ERROR("SVC0001","Internal Error"),
SVC_BAD_PARAMETER("SVC0002", "Invalid input value for message part %1"),
@@ -64,8 +68,8 @@ class TrinityExceptionUtil {
}
-
-
+
+
String mapAdapterExecptionToCommonException(String response, DelegateExecution execution)
{
def utils=new MsoUtils()
@@ -73,26 +77,26 @@ class TrinityExceptionUtil {
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
+
-
def errorCode
-
+
try {
- errorCode = MapCategoryToErrorCode(utils.getNodeText(response, "category"))
+ errorCode = MapCategoryToErrorCode(utils.getNodeText(response, "category"))
execution.setVariable(prefix+"err",errorCode)
String message = buildException(response, execution)
- msoLogger.trace("End MapAdapterExecptionToWorkflowException ")
+ logger.trace("End MapAdapterExecptionToWorkflowException ")
return message
}catch (Exception ex) {
//Ignore the exception - cases include non xml payload
- msoLogger.debug("error mapping error, ignoring: " + ex)
- msoLogger.trace("End MapAdapterExecptionToWorkflowException ")
+ logger.debug("error mapping error, ignoring: " + ex)
+ logger.trace("End MapAdapterExecptionToWorkflowException ")
return buildException(response, execution)
- }
+ }
}
-
+
/**
* @param response
* @param execution
@@ -107,9 +111,9 @@ class TrinityExceptionUtil {
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
-
-
+ logger.trace('Entered ' + method)
+
+
try {
def errorCode = utils.getNodeText(response,"code")
def descr = utils.getNodeText(response, "description")
@@ -122,16 +126,16 @@ class TrinityExceptionUtil {
}
execution.setVariable(prefix+"err",mappedErr)
def message = buildException("Received error from AOTS: " + descr, execution)
- msoLogger.trace("End MapAOTSExecptionToCommonException ")
+ logger.trace("End MapAOTSExecptionToCommonException ")
return message
}catch (Exception ex) {
//Ignore the exception - cases include non xml payload
- msoLogger.debug("error mapping error, ignoring: " + ex)
- msoLogger.trace("End MapAOTSExecptionToCommonException ")
+ logger.debug("error mapping error, ignoring: " + ex)
+ logger.trace("End MapAOTSExecptionToCommonException ")
return buildException(response, execution)
}
}
-
+
String mapSDNCAdapterExceptionToErrorResponse(String sdncAdapterCallbackRequest, DelegateExecution execution) {
def utils=new MsoUtils()
def prefix=execution.getVariable("prefix")
@@ -139,15 +143,15 @@ class TrinityExceptionUtil {
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
-
+ logger.trace('Entered ' + method)
+
def sdncResponseCode
String responseCode = execution.getVariable(prefix+"ResponseCode")
- msoLogger.debug('responseCode to map: ' + responseCode)
+ logger.debug('responseCode to map: ' + responseCode)
def errorMessage
-
+
try {
-
+
if(utils.nodeExists(sdncAdapterCallbackRequest, "RequestData")) {
def reqDataXml = utils.getNodeXml(sdncAdapterCallbackRequest, "RequestData")
errorMessage = utils.getNodeText(reqDataXml, "response-message")
@@ -168,18 +172,18 @@ class TrinityExceptionUtil {
execution.setVariable(prefix+"err",mappedErr)
def message = buildException(modifiedErrorMessage, execution)
-
- msoLogger.trace("End MapSDNCAdapterException ")
+
+ logger.trace("End MapSDNCAdapterException ")
return message
}catch (Exception ex) {
//Ignore the exception - cases include non xml payload
- msoLogger.debug("error mapping sdnc error, ignoring: " + ex)
- msoLogger.trace("End MapSDNCAdapterException ")
+ logger.debug("error mapping sdnc error, ignoring: " + ex)
+ logger.trace("End MapSDNCAdapterException ")
return null
- }
-
+ }
+
}
-
+
/**
* @param response message from called component (ex: AAI)
* @param execution
@@ -193,11 +197,11 @@ class TrinityExceptionUtil {
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
def variables
def message
String errorCode = 'SVC0001'
- msoLogger.debug("response: " + response)
+ logger.debug("response: " + response)
//they use the same format we do, pass their error along
//TODO add Received error from A&AI at beg of text
try {
@@ -206,20 +210,20 @@ class TrinityExceptionUtil {
} catch (Exception ex) {
//Ignore the exception - cases include non xml payload
message = buildException("Received error from A&AI, unable to parse",execution)
- msoLogger.debug("error mapping error, ignoring: " + ex)
+ logger.debug("error mapping error, ignoring: " + ex)
}
-
- if(message != null) {
+
+ if(message != null) {
execution.setVariable(prefix+"ErrorResponse",message)
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Fault", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, execution.getVariable(prefix+"ErrorResponse"));
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Fault", "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(),
+ execution.getVariable(prefix+"ErrorResponse"));
return message
} else {
-
return null
-
}
}
-
+
/**
* @param execution
* @return an error response conforming to the common API with default text msg
@@ -239,21 +243,21 @@ class TrinityExceptionUtil {
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
def prefix=execution.getVariable("prefix")
def responseCode = String.valueOf(execution.getVariable(prefix+"ResponseCode"))
def variables
- msoLogger.debug("response: " + response)
-
+ logger.debug("response: " + response)
+
try {
- msoLogger.debug("formatting error message" )
+ logger.debug("formatting error message" )
def msgVars = execution.getVariable(prefix+"errVariables")
def myErr = execution.getVariable(prefix+"err")
def messageTxt = execution.getVariable(prefix+"errTxt")
def messageId = null
-
+
if(myErr == null){
- msoLogger.debug("mapping response code: " + responseCode)
+ logger.debug("mapping response code: " + responseCode)
myErr = mapErrorCodetoError(responseCode, response)
if(myErr == null){
//not a service or policy error, just return error code
@@ -261,7 +265,7 @@ class TrinityExceptionUtil {
}
}
messageId = myErr.getMsgId()
-
+
if(messageTxt == null){
if(myErr!=null){
messageTxt = myErr.getMsgTxt()
@@ -293,35 +297,37 @@ class TrinityExceptionUtil {
<tns:messageId>${MsoUtils.xmlEscape(messageId)}</tns:messageId>
<tns:text>${MsoUtils.xmlEscape(messageTxt)}</tns:text>${msgVarsBuff}
</tns:serviceException>
-</tns:requestError>"""
+</tns:requestError>"""
}else{
message ="""<tns:requestError xmlns:tns="http://org.onap/so/request/types/v1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://org.onap/so/request/types/v1 MsoServiceInstanceTypesV1.xsd">
<tns:policyException>
<tns:messageId>${MsoUtils.xmlEscape(messageId)}</tns:messageId>
<tns:text>${MsoUtils.xmlEscape(messageTxt)}</tns:text>${msgVarsBuff}
</tns:policyException>
-</tns:requestError>"""
+</tns:requestError>"""
}
- msoLogger.debug("message " + message)
+ logger.debug("message " + message)
execution.setVariable(prefix+"ErrorResponse",message)
execution.setVariable(prefix+"err", myErr)
execution.setVariable(prefix+"errTxt", messageTxt)
execution.setVariable(prefix+"errVariables", msgVars)
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Fault", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, execution.getVariable(prefix+"ErrorResponse"));
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Fault", "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(),
+ execution.getVariable(prefix+"ErrorResponse"));
return message
}catch(Exception ex) {
- msoLogger.debug("error mapping error, return null: " + ex)
+ logger.debug("error mapping error, return null: " + ex)
return null
}
}
-
+
String parseError(DelegateExecution execution){
def utils=new MsoUtils()
def prefix=execution.getVariable("prefix")
def text = execution.getVariable(prefix+"errTxt")
def msgVars = execution.getVariable(prefix+"errVariables")
- msoLogger.debug('parsing message: ' + text)
+ logger.debug('parsing message: ' + text)
if(text == null){
return 'failed'
}
@@ -330,15 +336,15 @@ class TrinityExceptionUtil {
text = text.replaceFirst("%"+(i+1), msgVars[i])
}
}
- msoLogger.debug('parsed message is: ' + text)
+ logger.debug('parsed message is: ' + text)
return text
}
-
-
+
+
Error mapErrorCodetoError(responseCode, descr)
{
-
+
if(responseCode==null || responseCode=='0' || responseCode=='500' || responseCode =='408'){
return Error.SVC_NO_SERVER_RESOURCES
}else if(responseCode == '401' || responseCode == '405' || responseCode == '409' || responseCode == '503'){
@@ -373,10 +379,4 @@ class TrinityExceptionUtil {
else
return Error.SVC_GENERAL_SERVICE_ERROR
}
-
-
-
-
-
-
-} \ No newline at end of file
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy
index f96e3bea0e..867065696e 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -30,12 +32,14 @@ import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.client.graphinventory.entities.uri.Depth
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, UpdateAAIGenericVnf.class)
+ private static final Logger logger = LoggerFactory.getLogger( UpdateAAIGenericVnf.class);
private XmlParser xmlParser = new XmlParser()
@@ -69,12 +73,12 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor {
def method = getClass().getSimpleName() + '.preProcessRequest(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
try {
def xml = execution.getVariable('UpdateAAIGenericVnfRequest')
- msoLogger.debug('Received request xml:\n' + xml)
- msoLogger.debug("UpdateAAIGenericVnf Request XML: " + xml)
+ logger.debug('Received request xml:\n' + xml)
+ logger.debug("UpdateAAIGenericVnf Request XML: " + xml)
initProcessVariables(execution)
def vnfId = getRequiredNodeText(execution, xml,'vnf-id')
@@ -99,17 +103,17 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor {
if (managementV6Address != null && !managementV6Address.isEmpty()) {
execution.setVariable('UAAIGenVnf_managementV6Address', managementV6Address)
}
-
+
def orchestrationStatus = getNodeTextForce(xml, 'orchestration-status')
if (orchestrationStatus != null && !orchestrationStatus.isEmpty()) {
execution.setVariable('UAAIGenVnf_orchestrationStatus', orchestrationStatus)
}
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
} catch (BpmnError e) {
throw e
} catch (Exception e) {
- msoLogger.error(e)
+ logger.error(e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preProcessRequest(): ' + e.getMessage())
}
}
@@ -124,7 +128,7 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor {
def method = getClass().getSimpleName() + '.getGenericVnf(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
try {
def vnfId = execution.getVariable('UAAIGenVnf_vnfId')
@@ -141,14 +145,14 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor {
execution.setVariable('UAAIGenVnf_getGenericVnfResponse', "Generic VNF not found for VNF ID: "+vnfId)
}
}catch (Exception ex) {
- msoLogger.error(ex.getMessage())
- msoLogger.debug('Exception occurred while executing AAI GET:' + ex.getMessage())
+ logger.error(ex.getMessage())
+ logger.debug('Exception occurred while executing AAI GET:' + ex.getMessage())
execution.setVariable('UAAIGenVnf_getGenericVnfResponseCode', 500)
execution.setVariable('UAAIGenVnf_getGenericVnfResponse', 'AAI GET Failed:' + ex.getMessage())
}
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
} catch (Exception e) {
- msoLogger.error(e)
+ logger.error(e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in getGenericVnf(): ' + e.getMessage())
}
}
@@ -162,14 +166,14 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor {
def method = getClass().getSimpleName() + '.updateGenericVnf(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
try {
def vnfId = execution.getVariable('UAAIGenVnf_vnfId')
GenericVnf genericVnf = execution.getVariable('UAAIGenVnf_getGenericVnfResponse')
def origRequest = execution.getVariable('UpdateAAIGenericVnfRequest')
- msoLogger.debug("UpdateGenericVnf Request: " + origRequest)
+ logger.debug("UpdateGenericVnf Request: " + origRequest)
// Handle persona-model-id/persona-model-version
String newPersonaModelId = execution.getVariable('UAAIGenVnf_personaModelId')
@@ -178,7 +182,8 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor {
if (newPersonaModelId != null || newPersonaModelVersion != null) {
if (newPersonaModelId != genericVnf.getModelInvariantId()) {
def msg = 'Can\'t update Generic VNF ' + vnfId + ' since there is \'persona-model-id\' mismatch between the current and new values'
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "")
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue())
throw new Exception(msg)
}
@@ -216,27 +221,27 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor {
payload.setIpv4OamAddress(ipv4OamAddressEntry)
payload.setManagementV6Address(managementV6AddressEntry)
payload.setOrchestrationStatus(orchestrationStatusEntry)
-
+
AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
try {
getAAIClient().update(uri,payload)
} catch (Exception ex) {
ex.printStackTrace()
- msoLogger.debug('Exception occurred while executing AAI PATCH:' + ex.getMessage())
+ logger.debug('Exception occurred while executing AAI PATCH:' + ex.getMessage())
execution.setVariable('UAAIGenVnf_updateGenericVnfResponseCode', 500)
execution.setVariable('UAAIGenVnf_updateGenericVnfResponse', 'AAI PATCH Failed:' + ex.getMessage())
}
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
} catch (Exception e) {
- msoLogger.error(e)
+ logger.error(e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in updateGenericVnf(): ' + e.getMessage())
}
}
/**
* Sets up json attributes for PATCH request for Update
- *
+ *
* @param origRequest Incoming update request with Generic VNF element(s) to be updated.
* @param genericVnf Current Generic VNF retrieved from AAI.
* @param element Name of element to be inserted.
@@ -267,16 +272,16 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor {
def method = getClass().getSimpleName() + '.handleAAIQueryFailure(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
- msoLogger.error( 'Error occurred attempting to query AAI, Response Code ' + execution.getVariable('UAAIGenVnf_getGenericVnfResponseCode'))
+ logger.error('Error occurred attempting to query AAI, Response Code ' + execution.getVariable('UAAIGenVnf_getGenericVnfResponseCode'))
String processKey = getProcessKey(execution)
WorkflowException exception = new WorkflowException(processKey, 5000,
execution.getVariable('UAAIGenVnf_getGenericVnfResponse'))
execution.setVariable('WorkflowException', exception)
- msoLogger.debug("Workflow Exception occurred when handling Quering AAI: " + exception.getErrorMessage())
- msoLogger.trace('Exited ' + method)
+ logger.debug("Workflow Exception occurred when handling Quering AAI: " + exception.getErrorMessage())
+ logger.trace('Exited ' + method)
}
/**
@@ -288,16 +293,16 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor {
def method = getClass().getSimpleName() + '.handleUpdateGenericVnfFailure(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
- msoLogger.error('Error occurred attempting to update Generic VNF in AAI, Response Code ' + execution.getVariable('UAAIGenVnf_updateGenericVnfResponseCode'))
+ logger.error('Error occurred attempting to update Generic VNF in AAI, Response Code ' + execution.getVariable('UAAIGenVnf_updateGenericVnfResponseCode'))
String processKey = getProcessKey(execution)
WorkflowException exception = new WorkflowException(processKey, 5000,
execution.getVariable('UAAIGenVnf_updateGenericVnfResponse'))
execution.setVariable('WorkflowException', exception)
- msoLogger.debug("Workflow Exception occurred when Updating GenericVnf: " + exception.getErrorMessage())
- msoLogger.trace('Exited ' + method)
+ logger.debug("Workflow Exception occurred when Updating GenericVnf: " + exception.getErrorMessage())
+ logger.trace('Exited ' + method)
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModule.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModule.groovy
index 3c4edd21ca..92a043e65a 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModule.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModule.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -29,10 +31,12 @@ 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.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
public class UpdateAAIVfModule extends AbstractServiceTaskProcessor {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, UpdateAAIVfModule.class);
+ private static final Logger logger = LoggerFactory.getLogger( UpdateAAIVfModule.class);
private XmlParser xmlParser = new XmlParser()
@@ -65,11 +69,11 @@ public class UpdateAAIVfModule extends AbstractServiceTaskProcessor {
def method = getClass().getSimpleName() + '.preProcessRequest(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
try {
def xml = execution.getVariable('UpdateAAIVfModuleRequest')
- msoLogger.debug('Received request xml:\n' + xml)
+ logger.debug('Received request xml:\n' + xml)
initProcessVariables(execution)
def vnfId = getRequiredNodeText(execution, xml,'vnf-id')
@@ -78,11 +82,11 @@ public class UpdateAAIVfModule extends AbstractServiceTaskProcessor {
def vfModuleId = getRequiredNodeText(execution, xml,'vf-module-id')
execution.setVariable('UAAIVfMod_vfModuleId', vfModuleId)
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(e);
+ logger.error(e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preProcessRequest(): ' + e.getMessage())
}
}
@@ -97,7 +101,7 @@ public class UpdateAAIVfModule extends AbstractServiceTaskProcessor {
def method = getClass().getSimpleName() + '.getVfModule(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
try {
def vnfId = execution.getVariable('UAAIVfMod_vnfId')
@@ -113,14 +117,14 @@ public class UpdateAAIVfModule extends AbstractServiceTaskProcessor {
execution.setVariable('UAAIVfMod_getVfModuleResponse', "VF Module not found in AAI")
}
} catch (Exception ex) {
- msoLogger.debug('Exception occurred while executing AAI GET:' + ex.getMessage())
+ logger.debug('Exception occurred while executing AAI GET:' + ex.getMessage())
execution.setVariable('UAAIVfMod_getVfModuleResponseCode', 500)
execution.setVariable('UAAIVfMod_getVfModuleResponse', 'AAI GET Failed:' + ex.getMessage())
}
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(e);
+ logger.error(e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in getVfModule(): ' + e.getMessage())
}
}
@@ -134,7 +138,7 @@ public class UpdateAAIVfModule extends AbstractServiceTaskProcessor {
def method = getClass().getSimpleName() + '.updateVfModule(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
try {
def vnfId = execution.getVariable('UAAIVfMod_vnfId')
@@ -142,7 +146,7 @@ public class UpdateAAIVfModule extends AbstractServiceTaskProcessor {
org.onap.aai.domain.yang.VfModule vfModule = execution.getVariable('UAAIVfMod_getVfModuleResponse')
def origRequest = execution.getVariable('UpdateAAIVfModuleRequest')
- msoLogger.debug("UpdateAAIVfModule request: " + origRequest)
+ logger.debug("UpdateAAIVfModule request: " + origRequest)
// Handle persona-model-id/persona-model-version
def boolean doPersonaModelVersion = true
def String newPersonaModelId = utils.getNodeText(origRequest, 'persona-model-id')
@@ -161,11 +165,11 @@ public class UpdateAAIVfModule extends AbstractServiceTaskProcessor {
}
if (!newPersonaModelId.equals(currPersonaModelId)) {
def msg = 'Can\'t update VF Module ' + vfModuleId + ' since there is \'persona-model-id\' mismatch between the current and new values'
- msoLogger.error(msg)
+ logger.error(msg)
throw new Exception(msg)
}
}
-
+
// Construct payload
String orchestrationStatusEntry = updateVfModuleNode(origRequest , 'orchestration-status')
String heatStackIdEntry = updateVfModuleNode(origRequest, 'heat-stack-id')
@@ -187,7 +191,7 @@ public class UpdateAAIVfModule extends AbstractServiceTaskProcessor {
execution.setVariable('UAAIVfMod_updateVfModuleResponseCode', 200)
execution.setVariable('UAAIVfMod_updateVfModuleResponse', "Success")
}catch(NotFoundException ignored){
- msoLogger.debug("VF-Module not found!!")
+ logger.debug("VF-Module not found!!")
execution.setVariable('UAAIVfMod_updateVfModuleResponseCode', 404)
execution.setVariable('UAAIVfMod_updateVfModuleResponse', ignored.getMessage())
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "vf-module " + vfModuleId + " not found for under vnf " + vnfId + " in A&AI!")
@@ -200,7 +204,7 @@ public class UpdateAAIVfModule extends AbstractServiceTaskProcessor {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(e);
+ logger.error(e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in updateVfModule(): ' + e.getMessage())
}
}
@@ -210,7 +214,7 @@ public class UpdateAAIVfModule extends AbstractServiceTaskProcessor {
*
* @param origRequest Incoming update request with VF Module elements to be updated.
* @param element Name of element to be inserted.
- */
+ */
private String updateVfModuleNode(String origRequest, String elementName) {
if (!utils.nodeExists(origRequest, elementName)) {
@@ -236,14 +240,14 @@ public class UpdateAAIVfModule extends AbstractServiceTaskProcessor {
def method = getClass().getSimpleName() + '.handleAAIQueryFailure(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
- msoLogger.error( 'Error occurred attempting to query AAI, Response Code ' + execution.getVariable('UAAIVfMod_getVfModuleResponseCode'));
+ logger.error('Error occurred attempting to query AAI, Response Code ' + execution.getVariable('UAAIVfMod_getVfModuleResponseCode'))
String processKey = getProcessKey(execution);
WorkflowException exception = new WorkflowException(processKey, 5000,
execution.getVariable('UAAIVfMod_getVfModuleResponse'))
execution.setVariable('WorkflowException', exception)
- msoLogger.debug("UpdateAAIVfModule query failure: " + exception.getErrorMessage())
- msoLogger.trace('Exited ' + method)
+ logger.debug("UpdateAAIVfModule query failure: " + exception.getErrorMessage())
+ logger.trace('Exited ' + method)
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VfModule.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VfModule.groovy
index b20cc38b8b..af0715cb11 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VfModule.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VfModule.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -20,16 +22,8 @@
package org.onap.so.bpmn.common.scripts;
-import org.apache.commons.lang3.*
-import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
-
-
public class VfModule implements Serializable {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, VfModule.class);
-
-
/**
* Class representing a VF Module Node. Fields of this class include indicators
* as to whether the VF Module is the only VF Module in its containing Generic VNF
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VfModuleBase.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VfModuleBase.groovy
index c1cd42e893..168ea1fdc9 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VfModuleBase.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VfModuleBase.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -30,16 +32,18 @@ import org.w3c.dom.NodeList
import org.xml.sax.InputSource
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
public abstract class VfModuleBase extends AbstractServiceTaskProcessor {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, VfModuleBase.class);
+ private static final Logger logger = LoggerFactory.getLogger( VfModuleBase.class);
+
-
protected XmlParser xmlParser = new XmlParser()
-
+
/**
* Get the XmlParser.
- *
+ *
* @return the XmlParser.
*/
protected XmlParser getXmlParser() {
@@ -105,11 +109,13 @@ public abstract class VfModuleBase extends AbstractServiceTaskProcessor {
}
}
} catch (Exception e) {
- msoLogger.warn(MessageEnum.BPMN_GENERAL_WARNING, 'Exception transforming network params to vnfNetworks', "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, 'Exception is: \n' + e);
+ logger.warn("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_WARNING.toString(),
+ 'Exception transforming network params to vnfNetworks', "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), 'Exception is: \n' + e);
}
return vnfNetworks
}
-
+
/**
* Transform the parameter specifications from the incoming '*-params' root element to
* a corresponding list of 'entry's (typically used when invoking the VNF Rest Adpater).
@@ -142,7 +148,9 @@ public abstract class VfModuleBase extends AbstractServiceTaskProcessor {
entries = entries + entry
}
} catch (Exception e) {
- msoLogger.warn(MessageEnum.BPMN_GENERAL_WARNING, 'Exception transforming params to entries', "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, 'Exception transforming params to entries', e);
+ logger.warn("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_WARNING.toString(),
+ 'Exception transforming params to entries', "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), 'Exception transforming params to entries' + e);
}
return entries
}
@@ -181,7 +189,9 @@ public abstract class VfModuleBase extends AbstractServiceTaskProcessor {
}
}
} catch (Exception e) {
- msoLogger.warn(MessageEnum.BPMN_GENERAL_WARNING, 'Exception transforming params to entries', "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, 'Exception transforming params to entries', e);
+ logger.warn("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_WARNING.toString(),
+ 'Exception transforming params to entries', "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), 'Exception transforming params to entries' + e);
}
return entries
}
@@ -877,15 +887,15 @@ public abstract class VfModuleBase extends AbstractServiceTaskProcessor {
<key>vf_module_name</key>
<value>${MsoUtils.xmlEscape(vfModuleName)}</value>
</entry>"""
-
- msoLogger.debug("vnfInfo: " + vnfInfo)
+
+ logger.debug("vnfInfo: " + vnfInfo)
InputSource source = new InputSource(new StringReader(data));
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
docFactory.setNamespaceAware(true)
DocumentBuilder docBuilder = docFactory.newDocumentBuilder()
Document responseXml = docBuilder.parse(source)
-
-
+
+
// Availability Zones Data
String aZones = ""
StringBuilder sbAZone = new StringBuilder()
@@ -1235,9 +1245,9 @@ public abstract class VfModuleBase extends AbstractServiceTaskProcessor {
${interfaceRoutePrefixes}
${vnfParams}
${sdncResponseParams}"""
-
+
return vfModuleParams
-
+
}
-
-} \ No newline at end of file
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VidUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VidUtils.groovy
index 40b0368eaa..259a7872a3 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VidUtils.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VidUtils.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -26,20 +28,20 @@ import groovy.json.JsonSlurper
import org.json.JSONObject
import org.json.XML
import org.onap.so.bpmn.core.xml.XmlTool
-import org.onap.so.logger.MsoLogger
-import org.onap.so.logger.MessageEnum
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
class VidUtils {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, VidUtils.class);
-
+ private static final Logger logger = LoggerFactory.getLogger( VidUtils.class);
+
public MsoUtils utils = new MsoUtils()
private AbstractServiceTaskProcessor taskProcessor
public VidUtils(AbstractServiceTaskProcessor taskProcessor) {
this.taskProcessor = taskProcessor
}
-
+
/**
* Create a volume-request XML using a JSON string
* @param jsonReq - JSON request from VID
@@ -259,7 +261,7 @@ class VidUtils {
<source>VID</source>
<service-instance-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-instance-id>
</request-info>
- <network-inputs>
+ <network-inputs>
<network-id>${MsoUtils.xmlEscape(networkId)}</network-id>
<network-name>${MsoUtils.xmlEscape(instanceName)}</network-name>
<network-type>${MsoUtils.xmlEscape(modelName)}</network-type>
@@ -269,25 +271,25 @@ class VidUtils {
<service-id>${MsoUtils.xmlEscape(serviceId)}</service-id>
<backout-on-failure>${MsoUtils.xmlEscape(backoutOnFailure)}</backout-on-failure>
<sdncVersion>${MsoUtils.xmlEscape(sdncVersion)}</sdncVersion>
- </network-inputs>
+ </network-inputs>
<network-params>
${userParamsNode}
- </network-params>
+ </network-params>
</network-request>
"""
// return a pretty-print of the volume-request xml without the preamble
return groovy.xml.XmlUtil.serialize(xmlReq.normalize().replaceAll("\t", "").replaceAll("\n", "")).replaceAll("(<\\?[^<]*\\?>\\s*[\\r\\n]*)?", "")
-
+
} catch(Exception e) {
- msoLogger.debug("Error in Vid Utils",e.getCause())
+ logger.debug("{} {}", "Error in Vid Utils", e.getCause())
e.printStackTrace();
throw e
}
}
-
+
/**
- * Create a network-request XML using a map,
- * @param execution
+ * Create a network-request XML using a map,
+ * @param execution
* @return
*/
public String createXmlNetworkRequestInstance(execution) {
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 78af8768f9..50a0fe44a6 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
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -30,6 +32,8 @@ import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.client.HttpClient
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
import org.onap.so.utils.TargetEntity
import java.util.UUID
@@ -37,7 +41,7 @@ import java.util.UUID
class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, VnfAdapterRestV1.class);
+ private static final Logger logger = LoggerFactory.getLogger( VnfAdapterRestV1.class);
ExceptionUtil exceptionUtil = new ExceptionUtil()
@@ -47,7 +51,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
def method = getClass().getSimpleName() + '.preProcessRequest(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
def prefix="VNFREST_"
execution.setVariable("prefix", prefix)
@@ -61,9 +65,9 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
Node root = new XmlParser().parseText(request)
String requestType = root.name()
execution.setVariable(prefix + 'requestType', requestType)
- msoLogger.debug(getProcessKey(execution) + ': ' + prefix + 'requestType = ' + requestType)
+ logger.debug(getProcessKey(execution) + ': ' + prefix + 'requestType = ' + requestType)
- msoLogger.debug('VnfAdapterRestV1, request: ' + request)
+ logger.debug('VnfAdapterRestV1, request: ' + request)
// Get the messageId from the request
String messageId = getChildText(root, 'messageId')
@@ -74,12 +78,13 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
if (messageId == null || messageId.isEmpty()) {
String msg = getProcessKey(execution) + ': no messageId in ' + requestType
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
execution.setVariable('VNFAResponse_CORRELATOR', messageId)
- msoLogger.debug(getProcessKey(execution) + ': VNFAResponse_CORRELATOR = ' + messageId)
+ logger.debug(getProcessKey(execution) + ': VNFAResponse_CORRELATOR = ' + messageId)
// Get the notificationUrl from the request
@@ -87,12 +92,13 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
if (notificationUrl == null || notificationUrl.isEmpty()) {
String msg = getProcessKey(execution) + ': no notificationUrl in ' + requestType
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
execution.setVariable(prefix + 'notificationUrl', notificationUrl)
- msoLogger.debug(getProcessKey(execution) + ': ' + prefix + 'notificationUrl = ' + notificationUrl)
+ logger.debug(getProcessKey(execution) + ': ' + prefix + 'notificationUrl = ' + notificationUrl)
// Determine the VnfAdapter endpoint
@@ -100,7 +106,8 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
if (vnfAdapterEndpoint == null || vnfAdapterEndpoint.isEmpty()) {
String msg = getProcessKey(execution) + ': mso:adapters:vnf:rest:endpoint URN mapping is not defined'
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -117,7 +124,8 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
if (vnfId == null || vnfId.isEmpty()) {
String msg = getProcessKey(execution) + ': no vnfId in ' + requestType
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -129,7 +137,8 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
if (vnfId == null || vnfId.isEmpty()) {
String msg = getProcessKey(execution) + ': no vnfId in ' + requestType
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -137,7 +146,8 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
if (vfModuleId == null || vfModuleId.isEmpty()) {
String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -150,7 +160,8 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
if (vnfId == null || vnfId.isEmpty()) {
String msg = getProcessKey(execution) + ': no vnfId in ' + requestType
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -158,7 +169,8 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
if (vfModuleId == null || vfModuleId.isEmpty()) {
String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -171,7 +183,8 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
if (vfModuleRollbackNode == null) {
String msg = getProcessKey(execution) + ': no vfModuleRollback in ' + requestType
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -179,7 +192,8 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
if (vnfId == null || vnfId.isEmpty()) {
String msg = getProcessKey(execution) + ': no vnfId in ' + requestType
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -187,7 +201,8 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
if (vfModuleId == null || vfModuleId.isEmpty()) {
String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -207,7 +222,8 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
if (volumeGroupId == null || volumeGroupId.isEmpty()) {
String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -222,7 +238,8 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
if (volumeGroupId == null || volumeGroupId.isEmpty()) {
String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -237,7 +254,8 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
if (volumeGroupId == null || volumeGroupId.isEmpty()) {
String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -249,39 +267,45 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
} else {
String msg = getProcessKey(execution) + ': Unsupported request type: ' + requestType
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
execution.setVariable(prefix + 'vnfAdapterMethod', vnfAdapterMethod)
- msoLogger.debug(getProcessKey(execution) + ': ' + prefix + 'vnfAdapterMethod = ' + vnfAdapterMethod)
+ logger.debug(getProcessKey(execution) + ': ' + prefix + 'vnfAdapterMethod = ' + vnfAdapterMethod)
execution.setVariable(prefix + 'vnfAdapterUrl', vnfAdapterUrl)
- msoLogger.debug(getProcessKey(execution) + ': ' + prefix + 'vnfAdapterUrl = ' + vnfAdapterUrl)
+ logger.debug(getProcessKey(execution) + ': ' + prefix + 'vnfAdapterUrl = ' + vnfAdapterUrl)
execution.setVariable(prefix + 'vnfAdapterRequest', vnfAdapterRequest)
- msoLogger.debug(getProcessKey(execution) + ': ' + prefix + 'vnfAdapterRequest = \n' + vnfAdapterRequest)
+ logger.debug(getProcessKey(execution) + ': ' + prefix + 'vnfAdapterRequest = \n' + vnfAdapterRequest)
// Get the Basic Auth credentials for the VnfAdapter
String basicAuthValue = UrnPropertiesReader.getVariable("mso.adapters.po.auth", execution)
if (basicAuthValue == null || basicAuthValue.isEmpty()) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined", "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
} else {
try {
def encodedString = utils.getBasicAuth(basicAuthValue, UrnPropertiesReader.getVariable("mso.msoKey", execution))
execution.setVariable(prefix + 'basicAuthHeaderValue', encodedString)
} catch (IOException ex) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, getProcessKey(execution) + ": Unable to encode BasicAuth credentials for VnfAdapter", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ getProcessKey(execution) + ": Unable to encode BasicAuth credentials for VnfAdapter",
+ "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
}
}
} catch (BpmnError e) {
- msoLogger.debug(" Rethrowing MSOWorkflowException")
+ logger.debug(" Rethrowing MSOWorkflowException")
throw e
} catch (Exception e) {
String msg = 'Caught exception in ' + method + ": " + e
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
- msoLogger.debug(msg)
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
}
@@ -302,7 +326,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
def method = getClass().getSimpleName() + '.sendRequestToVnfAdapter(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
String prefix = execution.getVariable('prefix')
@@ -331,7 +355,8 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
response = httpClient.delete(vnfAdapterRequest)
} else {
String msg = 'Unsupported HTTP method "' + vnfAdapterMethod + '" in ' + method + ": " + e
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -343,7 +368,8 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
throw e
} catch (Exception e) {
String msg = 'Caught exception in ' + method + ": " + e
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
}
@@ -352,12 +378,12 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
def method = getClass().getSimpleName() + '.processCallback(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
String callback = execution.getVariable('VNFAResponse_MESSAGE')
try {
- msoLogger.debug(getProcessKey(execution) + ": received callback:\n" + callback)
+ logger.debug(getProcessKey(execution) + ": received callback:\n" + callback)
// The XML callback is available to the calling flow in any case,
// even if a WorkflowException is generated.
@@ -372,7 +398,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
vnfAdapterWorkflowException(execution, callback)
}
} catch (Exception e) {
- msoLogger.debug("Error encountered within VnfAdapterRest ProcessCallback method", e)
+ logger.debug("Error encountered within VnfAdapterRest ProcessCallback method", e)
exceptionUtil.buildAndThrowWorkflowException(execution, 7020, "Error encountered within VnfAdapterRest ProcessCallback method")
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterUtils.groovy
index 8c979fca0b..f459b641eb 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterUtils.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterUtils.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -25,11 +27,13 @@ import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
class VnfAdapterUtils {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, VnfAdapterUtils.class);
+ private static final Logger logger = LoggerFactory.getLogger( VnfAdapterUtils.class);
private AbstractServiceTaskProcessor taskProcessor
@@ -47,7 +51,7 @@ class VnfAdapterUtils {
', responseCodeVar=' + responseCodeVar +
', errorResponseVar=' + errorResponseVar +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
try {
def prefix = execution.getVariable('prefix')
@@ -62,27 +66,29 @@ class VnfAdapterUtils {
if (response.contains("WorkflowException")) {
execution.setVariable(prefix + "ErrorResponse", response)
//execution.setVariable(prefix + "ResponseCode", responseCode)
- msoLogger.debug(" Sub Vnf flow Error WorkflowException Response - " + "\n" + response)
+ logger.debug(" Sub Vnf flow Error WorkflowException Response - " + "\n" + response)
throw new BpmnError("MSOWorkflowException")
} else if (errorResponse != null && errorResponse instanceof WorkflowException) {
// Not sure the variables with the associated prefix are still used
execution.setVariable(prefix + "ErrorResponse", errorResponse.getErrorMessage())
execution.setVariable(prefix + "ResponseCode", errorResponse.getErrorCode())
- msoLogger.debug("Sub Vnf flow Error WorkflowException " + prefix + "ErrorResponse" + " - " + errorResponse.getErrorMessage())
+ logger.debug("Sub Vnf flow Error WorkflowException " + prefix + "ErrorResponse" + " - " + errorResponse.getErrorMessage())
// this is the important part to ensure we hit the Fallout Handler
throw new BpmnError("MSOWorkflowException")
} else if (errorResponse != null && errorResponse instanceof WorkflowException) {
// Not sure the variables with the associated prefix are still used
execution.setVariable(prefix + "ErrorResponse", errorResponse.getErrorMessage())
execution.setVariable(prefix + "ResponseCode", errorResponse.getErrorCode())
- msoLogger.debug("Sub Vnf flow Error WorkflowException " + prefix + "ErrorResponse" + " - " + errorResponse.getErrorMessage())
+ logger.debug("Sub Vnf flow Error WorkflowException " + prefix + "ErrorResponse" + " - " + errorResponse.getErrorMessage())
// this is the important part to ensure we hit the Fallout Handler
throw new BpmnError("MSOWorkflowException")
}
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 5000, 'Internal Error- Unable to validate VNF Response ' + e.getMessage())
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/Skip.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/Skip.java
index 0148e8f10c..fe03a10795 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/Skip.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/Skip.java
@@ -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.common.validation;
import java.lang.annotation.Retention;
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowContextHolder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowContextHolder.java
index db7f1da10f..61f92313f7 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowContextHolder.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowContextHolder.java
@@ -131,7 +131,7 @@ public class WorkflowContextHolder {
Thread.currentThread().interrupt();
} catch (Exception e) {
logger.debug("WorkflowContextHolder timeout thread caught exception: ", e);
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), "Error in WorkflowContextHolder timeout thread");
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/InstanceGroup.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/InstanceGroup.java
index deb8c8e393..7a58f6db6b 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/InstanceGroup.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/InstanceGroup.java
@@ -30,6 +30,7 @@ import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.onap.so.bpmn.servicedecomposition.ShallowCopy;
import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup;
+import org.onap.so.db.catalog.beans.OrchestrationStatus;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;
@@ -48,10 +49,14 @@ public class InstanceGroup implements Serializable, ShallowCopy<InstanceGroup>
private String resourceVersion;
@JsonProperty("instance-group-name")
private String instanceGroupName;
+ @JsonProperty("orchestration-status")
+ private OrchestrationStatus orchestrationStatus = OrchestrationStatus.PRECREATED;
@JsonProperty("model-info-instance-group")
private ModelInfoInstanceGroup modelInfoInstanceGroup;
@JsonProperty("instance-group-function")
private String instanceGroupFunction;
+ @JsonProperty("vnfs")
+ private List<GenericVnf> vnfs = new ArrayList<>();
public String getId() {
return id;
@@ -76,6 +81,12 @@ public class InstanceGroup implements Serializable, ShallowCopy<InstanceGroup>
}
public void setInstanceGroupName(String instanceGroupName) {
this.instanceGroupName = instanceGroupName;
+ }
+ public OrchestrationStatus getOrchestrationStatus() {
+ return orchestrationStatus;
+ }
+ public void setOrchestrationStatus(OrchestrationStatus orchestrationStatus) {
+ this.orchestrationStatus = orchestrationStatus;
}
public ModelInfoInstanceGroup getModelInfoInstanceGroup() {
return modelInfoInstanceGroup;
@@ -89,6 +100,12 @@ public class InstanceGroup implements Serializable, ShallowCopy<InstanceGroup>
public void setInstanceGroupFunction(String instanceGroupFunction) {
this.instanceGroupFunction = instanceGroupFunction;
}
+ public List<GenericVnf> getVnfs() {
+ return vnfs;
+ }
+ public void setVnfs(List<GenericVnf> vnfs) {
+ this.vnfs = vnfs;
+ }
@Override
public boolean equals(final Object other) {
if (!(other instanceof InstanceGroup)) {
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceInstance.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceInstance.java
index 259a988262..e2a8688395 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceInstance.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceInstance.java
@@ -79,6 +79,8 @@ public class ServiceInstance implements Serializable, ShallowCopy<ServiceInstanc
private SolutionInfo solutionInfo;
@JsonProperty("model-info-service-instance")
private ModelInfoServiceInstance modelInfoServiceInstance;
+ @JsonProperty("instance-groups")
+ private List<InstanceGroup> instanceGroups = new ArrayList<>();
public List<GenericVnf> getVnfs() {
return vnfs;
@@ -191,6 +193,12 @@ public class ServiceInstance implements Serializable, ShallowCopy<ServiceInstanc
public void setSolutionInfo(SolutionInfo solutionInfo) {
this.solutionInfo = solutionInfo;
}
+ public List<InstanceGroup> getInstanceGroups() {
+ return instanceGroups;
+ }
+ public void setInstanceGroups(List<InstanceGroup> instanceGroups) {
+ this.instanceGroups = instanceGroups;
+ }
@Override
public boolean equals(final Object other) {
if (!(other instanceof ServiceInstance)) {
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Tenant.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Tenant.java
index a23f85bae9..d3f3dcd359 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Tenant.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Tenant.java
@@ -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.servicedecomposition.bbobjects;
import java.io.Serializable;
@@ -55,4 +75,4 @@ public class Tenant implements Serializable {
}
-} \ No newline at end of file
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/WorkflowResourceIds.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/WorkflowResourceIds.java
index 433315b2ed..15dfe85c1a 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/WorkflowResourceIds.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/WorkflowResourceIds.java
@@ -36,6 +36,7 @@ public class WorkflowResourceIds implements Serializable {
private String vfModuleId;
private String networkCollectionId;
private String configurationId;
+ private String instanceGroupId;
@Override
public String toString() {
@@ -100,4 +101,12 @@ public class WorkflowResourceIds implements Serializable {
public void setConfigurationId(String configurationId) {
this.configurationId = configurationId;
}
+
+ public String getInstanceGroupId() {
+ return instanceGroupId;
+ }
+
+ public void setInstanceGroupId(String instanceGroupId) {
+ this.instanceGroupId = instanceGroupId;
+ }
}
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 77372bcd88..c80cd3d2a0 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
@@ -59,6 +59,7 @@ import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds;
import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext;
import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.NoServiceInstanceFoundException;
import org.onap.so.client.aai.AAICommonObjectMapperProvider;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.entities.AAIResultWrapper;
@@ -225,6 +226,7 @@ public class BBInputSetup implements JavaDelegate {
lookupKeyMap.put(ResourceKey.VF_MODULE_ID, workflowResourceIds.getVfModuleId());
lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, workflowResourceIds.getVolumeGroupId());
lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, workflowResourceIds.getConfigurationId());
+ lookupKeyMap.put(ResourceKey.INSTANCE_GROUP_ID, workflowResourceIds.getInstanceGroupId());
}
protected GeneralBuildingBlock getGBBALaCarteNonService(ExecuteBuildingBlock executeBB,
@@ -244,7 +246,7 @@ public class BBInputSetup implements JavaDelegate {
ServiceInstance serviceInstance = this.getExistingServiceInstance(aaiServiceInstance);
serviceInstance.setModelInfoServiceInstance(this.mapperLayer.mapCatalogServiceIntoServiceInstance(service));
this.populateObjectsOnAssignAndCreateFlows(requestDetails, service, bbName, serviceInstance, lookupKeyMap,
- resourceId, vnfType);
+ resourceId, vnfType, executeBB.getBuildingBlock().getKey(), executeBB.getConfigurationResourceKeys());
return this.populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance, executeBB, requestAction, null);
} else {
logger.debug("Related Service Instance from AAI: {}", aaiServiceInstance);
@@ -255,25 +257,59 @@ public class BBInputSetup implements JavaDelegate {
protected GeneralBuildingBlock getGBBCM(ExecuteBuildingBlock executeBB,
RequestDetails requestDetails, Map<ResourceKey, String> lookupKeyMap, String requestAction,
- String resourceId) throws Exception {
+ String resourceId) throws Exception {
ServiceInstance serviceInstance = new ServiceInstance();
String serviceInstanceId = lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID);
- serviceInstance.setServiceInstanceId(serviceInstanceId);
-
+ serviceInstance.setServiceInstanceId(serviceInstanceId);
+ Customer customer = new Customer();
List<GenericVnf> genericVnfs = serviceInstance.getVnfs();
String vnfId = lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID);
- org.onap.aai.domain.yang.GenericVnf aaiGenericVnf = bbInputSetupUtils.getAAIGenericVnf(vnfId);
-
- GenericVnf genericVnf = this.mapperLayer.mapAAIGenericVnfIntoGenericVnf(aaiGenericVnf);
- genericVnfs.add(genericVnf);
-
- return this.populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance, executeBB, requestAction, new Customer());
+ if(vnfId != null) {
+ org.onap.aai.domain.yang.GenericVnf aaiGenericVnf = bbInputSetupUtils.getAAIGenericVnf(vnfId);
+ GenericVnf genericVnf = this.mapperLayer.mapAAIGenericVnfIntoGenericVnf(aaiGenericVnf);
+ genericVnfs.add(genericVnf);
+ }
+ String instanceGroupId = lookupKeyMap.get(ResourceKey.INSTANCE_GROUP_ID);
+ if(instanceGroupId != null) {
+ org.onap.aai.domain.yang.InstanceGroup aaiInstancegroup = bbInputSetupUtils.getAAIInstanceGroup(instanceGroupId);
+ InstanceGroup instanceGroup = this.mapperLayer.mapAAIInstanceGroupIntoInstanceGroup(aaiInstancegroup);
+ instanceGroup.setOrchestrationStatus(OrchestrationStatus.INVENTORIED);
+
+ if(serviceInstanceId == null) {
+ Optional<org.onap.aai.domain.yang.ServiceInstance> aaiServiceInstanceOpt = bbInputSetupUtils.getRelatedServiceInstanceFromInstanceGroup(instanceGroupId);
+ if(aaiServiceInstanceOpt.isPresent()) {
+ org.onap.aai.domain.yang.ServiceInstance aaiServiceInstance = aaiServiceInstanceOpt.get();
+ serviceInstance = this.mapperLayer.mapAAIServiceInstanceIntoServiceInstance(aaiServiceInstance);
+ WorkflowResourceIds workflowResourceIds = executeBB.getWorkflowResourceIds();
+ workflowResourceIds.setServiceInstanceId(serviceInstance.getServiceInstanceId());
+ lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, workflowResourceIds.getServiceInstanceId());
+ } else {
+ throw new NoServiceInstanceFoundException("Related ServiceInstance not found in A&AI.");
+ }
+ }
+ RelatedInstanceList[] relatedInstanceList = requestDetails.getRelatedInstanceList();
+ if (relatedInstanceList != null) {
+ for (RelatedInstanceList relatedInstList : relatedInstanceList) {
+ RelatedInstance relatedInstance = relatedInstList.getRelatedInstance();
+ if (relatedInstance.getModelInfo().getModelType().equals(ModelType.vnf)) {
+ org.onap.aai.domain.yang.GenericVnf aaiVnf = bbInputSetupUtils.getAAIGenericVnf(relatedInstance.getInstanceId());
+ GenericVnf vnf = this.mapperLayer.mapAAIGenericVnfIntoGenericVnf(aaiVnf);
+ instanceGroup.getVnfs().add(vnf);
+ }
+ }
+ }
+
+ serviceInstance.getInstanceGroups().add(instanceGroup);
+ customer.setServiceSubscription(new ServiceSubscription());
+ }
+ return this.populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance, executeBB, requestAction, customer);
}
protected void populateObjectsOnAssignAndCreateFlows(RequestDetails requestDetails, Service service, String bbName,
- ServiceInstance serviceInstance, Map<ResourceKey, String> lookupKeyMap, String resourceId, String vnfType)
+ ServiceInstance serviceInstance, Map<ResourceKey, String> lookupKeyMap, String resourceId, String vnfType,
+ String configurationKey, ConfigurationResourceKeys configurationResourceKeys)
throws Exception {
ModelInfo modelInfo = requestDetails.getModelInfo();
String instanceName = requestDetails.getRequestInfo().getInstanceName();
@@ -296,13 +332,36 @@ public class BBInputSetup implements JavaDelegate {
this.populateVolumeGroup(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId,
relatedInstanceList, instanceName, vnfType, null);
} else if (modelType.equals(ModelType.vfModule)) {
- lookupKeyMap.put(ResourceKey.VF_MODULE_ID, resourceId);
- this.populateVfModule(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId,
- relatedInstanceList, instanceName, null, requestDetails.getCloudConfiguration());
+ if(bbName.contains("Configuration")) {
+ ModelInfo configurationModelInfo = new ModelInfo();
+ configurationModelInfo.setModelCustomizationUuid(configurationKey);
+ populateConfiguration(configurationModelInfo, service, bbName, serviceInstance,
+ lookupKeyMap, resourceId, instanceName, configurationResourceKeys);
+ } else {
+ lookupKeyMap.put(ResourceKey.VF_MODULE_ID, resourceId);
+ this.populateVfModule(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId,
+ relatedInstanceList, instanceName, null, requestDetails.getCloudConfiguration());
+ }
+ } else if (modelType.equals(ModelType.instanceGroup)) {
+ lookupKeyMap.put(ResourceKey.INSTANCE_GROUP_ID, resourceId);
+ this.populateInstanceGroup(modelInfo, service, serviceInstance, resourceId, instanceName);
} else {
return;
}
}
+
+ protected void populateInstanceGroup(ModelInfo modelInfo, Service service, ServiceInstance serviceInstance, String instanceGroupId, String instanceName) {
+ InstanceGroup instanceGroup = new InstanceGroup();
+ instanceGroup.setId(instanceGroupId);
+ instanceGroup.setInstanceGroupName(instanceName);
+ mapCatalogInstanceGroup(instanceGroup, modelInfo, service);
+ serviceInstance.getInstanceGroups().add(instanceGroup);
+ }
+
+ protected void mapCatalogInstanceGroup(InstanceGroup instanceGroup, ModelInfo modelInfo, Service service) {
+ // @TODO: this will populate the instanceGroup model info.
+ // Dependent on MSO-5821 653458 US - MSO - Enhance Catalog DB Schema & Adapter to support VNF Groups
+ }
protected void populateConfiguration(ModelInfo modelInfo, Service service, String bbName,
ServiceInstance serviceInstance, Map<ResourceKey, String> lookupKeyMap, String resourceId, String instanceName, ConfigurationResourceKeys configurationResourceKeys) {
@@ -344,13 +403,19 @@ public class BBInputSetup implements JavaDelegate {
if (configurationResourceCustomization != null && vnfVfmoduleCvnfcConfigurationCustomization != null) {
configuration.setModelInfoConfiguration(this.mapperLayer.mapCatalogConfigurationToConfiguration(configurationResourceCustomization
, vnfVfmoduleCvnfcConfigurationCustomization));
+ } else {
+ logger.debug("for Fabric configuration mapping by VF MODULE CUST UUID: " + configurationResourceKeys.getVfModuleCustomizationUUID());
+ vnfVfmoduleCvnfcConfigurationCustomization = findVnfVfmoduleCvnfcConfigurationCustomization(configurationResourceKeys.getVfModuleCustomizationUUID(),
+ configurationResourceKeys.getVnfResourceCustomizationUUID(), configurationResourceKeys.getCvnfcCustomizationUUID());
+ if (vnfVfmoduleCvnfcConfigurationCustomization != null){
+ configuration.setModelInfoConfiguration(this.mapperLayer.mapCatalogConfigurationToConfiguration(vnfVfmoduleCvnfcConfigurationCustomization));
+ }
}
}
protected VnfVfmoduleCvnfcConfigurationCustomization findVnfVfmoduleCvnfcConfigurationCustomization(String vfModuleCustomizationUUID,
String vnfResourceCustomizationUUID, String cvnfcCustomizationUUID, ConfigurationResourceCustomization configurationResourceCustomization) {
-
- if(configurationResourceCustomization.getConfigurationResource() != null)
+ if(configurationResourceCustomization != null && configurationResourceCustomization.getConfigurationResource() != null)
for(VnfVfmoduleCvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization :
configurationResourceCustomization.getConfigurationResource().getVnfVfmoduleCvnfcConfigurationCustomization()) {
if(vnfVfmoduleCvnfcConfigurationCustomization.getVfModuleCustomization().getModelCustomizationUUID().equalsIgnoreCase(vfModuleCustomizationUUID)
@@ -370,6 +435,13 @@ public class BBInputSetup implements JavaDelegate {
}
return null;
}
+
+ protected VnfVfmoduleCvnfcConfigurationCustomization findVnfVfmoduleCvnfcConfigurationCustomization(String vnfResourceCustomizationUUID,
+ String vfModuleCustomizationUUID, String cvnfcCustomizationUUID) {
+ return bbInputSetupUtils.getVnfVfmoduleCvnfcConfigurationCustomizationByActionAndIsALaCarteAndRequestScopeAndCloudOwner(vnfResourceCustomizationUUID,
+ vfModuleCustomizationUUID, cvnfcCustomizationUUID);
+
+ }
protected void populateVfModule(ModelInfo modelInfo, Service service, String bbName,
ServiceInstance serviceInstance, Map<ResourceKey, String> lookupKeyMap, String resourceId,
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java
index a838ffdbae..fac2e9b8c3 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java
@@ -496,6 +496,16 @@ public class BBInputSetupMapperLayer {
modelInfoConfiguration.setPolicyName(vnfVfmoduleCvnfcConfigurationCustomization.getPolicyName());
return modelInfoConfiguration;
}
+
+ protected ModelInfoConfiguration mapCatalogConfigurationToConfiguration(
+ VnfVfmoduleCvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization) {
+ ModelInfoConfiguration modelInfoConfiguration = new ModelInfoConfiguration();
+ modelInfoConfiguration.setModelVersionId(vnfVfmoduleCvnfcConfigurationCustomization.getConfigurationResource().getModelUUID());
+ modelInfoConfiguration.setModelCustomizationId(vnfVfmoduleCvnfcConfigurationCustomization.getModelCustomizationUUID());
+ modelInfoConfiguration.setModelInvariantId(vnfVfmoduleCvnfcConfigurationCustomization.getConfigurationResource().getModelInvariantUUID());
+ modelInfoConfiguration.setPolicyName(vnfVfmoduleCvnfcConfigurationCustomization.getPolicyName());
+ return modelInfoConfiguration;
+ }
public NetworkResourceCustomization mapCollectionNetworkResourceCustToNetworkResourceCust(
CollectionNetworkResourceCustomization collectionNetworkResourceCust) {
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 486164e75f..a71c38f127 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
@@ -42,6 +42,8 @@ import org.onap.aai.domain.yang.VolumeGroup;
import org.onap.aai.domain.yang.VolumeGroups;
import org.onap.so.bpmn.common.InjectionHelper;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
+import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.MultipleObjectsFoundException;
+import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.NoServiceInstanceFoundException;
import org.onap.so.client.aai.AAIObjectPlurals;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.entities.AAIResultWrapper;
@@ -53,6 +55,8 @@ import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization;
import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization;
import org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization;
import org.onap.so.db.catalog.beans.Service;
+import org.onap.so.db.catalog.beans.VfModuleCustomization;
+import org.onap.so.db.catalog.beans.VnfVfmoduleCvnfcConfigurationCustomization;
import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization;
import org.onap.so.db.catalog.client.CatalogDbClient;
import org.onap.so.db.request.beans.InfraActiveRequests;
@@ -137,6 +141,16 @@ public class BBInputSetupUtils {
return catalogDbClient.getNetworkCollectionResourceCustomizationByID(collectionCustomizationId);
}
+ public VfModuleCustomization getVfModuleCustomizationByModelCuztomizationUUID(String modelCustomizationUUID) {
+ return catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID(modelCustomizationUUID);
+ }
+
+ public VnfVfmoduleCvnfcConfigurationCustomization getVnfVfmoduleCvnfcConfigurationCustomizationByActionAndIsALaCarteAndRequestScopeAndCloudOwner(String vnfCustomizationUuid,
+ String vfModuleCustomizationUuid, String cvnfcCustomizationUuid) {
+ return catalogDbClient.getVnfVfmoduleCvnfcConfigurationCustomizationByVnfCustomizationUuidAndVfModuleCustomizationUuidAndCvnfcCustomizationUuid(vnfCustomizationUuid,
+ vfModuleCustomizationUuid, cvnfcCustomizationUuid);
+ }
+
public List<VnfcInstanceGroupCustomization> getVnfcInstanceGroups(String modelCustomizationUUID) {
return catalogDbClient.getVnfcInstanceGroupsByVnfResourceCust(modelCustomizationUUID);
}
@@ -346,6 +360,26 @@ public class BBInputSetupUtils {
}
+ public Optional<ServiceInstance> getRelatedServiceInstanceFromInstanceGroup(String instanceGroupId) throws Exception {
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroupId);
+ uri.relatedTo(AAIObjectPlurals.SERVICE_INSTANCE);
+ Optional<ServiceInstances> serviceInstances = injectionHelper.getAaiClient().get(ServiceInstances.class, uri);
+ ServiceInstance serviceInstance = null;
+ if (!serviceInstances.isPresent()) {
+ logger.debug("No ServiceInstances were found");
+ return Optional.empty();
+ } else {
+ if (serviceInstances.get().getServiceInstance().isEmpty()) {
+ throw new NoServiceInstanceFoundException("No ServiceInstances Returned");
+ } else if (serviceInstances.get().getServiceInstance().size() > 1) {
+ throw new MultipleObjectsFoundException("Multiple ServiceInstances Returned");
+ } else {
+ serviceInstance = serviceInstances.get().getServiceInstance().get(0);
+ }
+ return Optional.of(serviceInstance);
+ }
+ }
+
public Optional<L3Network> getRelatedNetworkByNameFromServiceInstance(String serviceInstanceId, String networkName) throws Exception{
AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId);
uri.relatedTo(AAIObjectPlurals.L3_NETWORK).queryParam("network-name", networkName);
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java
index 79f4a07974..d2d321f8f4 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java
@@ -90,6 +90,10 @@ public class ExtractPojosForBB {
serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
result = lookupObjectInList(serviceInstance.getVpnBondingLinks(),value);
break;
+ case INSTANCE_GROUP_ID:
+ serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ result = lookupObjectInList(serviceInstance.getInstanceGroups(), value);
+ break;
default:
throw new BBObjectNotFoundException(key, value);
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/exceptions/MultipleObjectsFoundException.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/exceptions/MultipleObjectsFoundException.java
new file mode 100644
index 0000000000..d63f98b6ce
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/exceptions/MultipleObjectsFoundException.java
@@ -0,0 +1,47 @@
+/*-
+ * ============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.servicedecomposition.tasks.exceptions;
+
+public class MultipleObjectsFoundException extends Exception {
+
+ private static final long serialVersionUID = -5045275644426587447L;
+
+ public MultipleObjectsFoundException() {
+ super();
+ }
+
+ public MultipleObjectsFoundException(String message) {
+ super(message);
+ }
+
+ public MultipleObjectsFoundException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public MultipleObjectsFoundException(Throwable cause) {
+ super(cause);
+ }
+
+ public MultipleObjectsFoundException(String message, Throwable cause, boolean enableSuppression,
+ boolean writableStackTrace) {
+ super(message, cause, enableSuppression, writableStackTrace);
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/exceptions/NoServiceInstanceFoundException.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/exceptions/NoServiceInstanceFoundException.java
new file mode 100644
index 0000000000..2ef1a80cce
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/exceptions/NoServiceInstanceFoundException.java
@@ -0,0 +1,47 @@
+/*-
+ * ============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.servicedecomposition.tasks.exceptions;
+
+public class NoServiceInstanceFoundException extends Exception {
+
+ private static final long serialVersionUID = 3270499954054029908L;
+
+ public NoServiceInstanceFoundException() {
+ super();
+ }
+
+ public NoServiceInstanceFoundException(String message) {
+ super(message);
+ }
+
+ public NoServiceInstanceFoundException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public NoServiceInstanceFoundException(Throwable cause) {
+ super(cause);
+ }
+
+ public NoServiceInstanceFoundException(String message, Throwable cause, boolean enableSuppression,
+ boolean writableStackTrace) {
+ super(message, cause, enableSuppression, writableStackTrace);
+ }
+}
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 d43218c584..916d24e8dc 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
@@ -54,8 +54,8 @@ public class ExceptionBuilder {
}
}
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), msg.toString());
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.ErrorCode.UnknownError.getValue(), msg.toString());
execution.setVariable(errorVariable, exception.getMessage());
} catch (Exception ex){
//log trace, allow process to complete gracefully
@@ -83,8 +83,8 @@ public class ExceptionBuilder {
break;
}
}
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), msg.toString());
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.ErrorCode.UnknownError.getValue(), msg.toString());
execution.setVariable(errorVariable, exception.getMessage());
} catch (Exception ex){
//log trace, allow process to complete gracefully
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/CDSPropertiesImpl.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/CDSPropertiesImpl.java
index dfdef74886..1967e5a1ce 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/CDSPropertiesImpl.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/CDSPropertiesImpl.java
@@ -1,18 +1,23 @@
-/*
- * Copyright (C) 2019 Bell Canada.
- *
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 Bell Canada.
+ * ================================================================================
* 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.restproperties;
import java.net.URL;
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/ExtractPojosForBBTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/ExtractPojosForBBTest.java
index 634e0a6c9b..bc41b168ef 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/ExtractPojosForBBTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/ExtractPojosForBBTest.java
@@ -105,12 +105,18 @@ public class ExtractPojosForBBTest extends BaseTest{
allotedResourcePend.setId("abc");
allotedResourcesPend.add(allotedResourcePend);
lookupKeyMap.put(ResourceKey.ALLOTTED_RESOURCE_ID, allotedResourcePend.getId());
-
+
Configuration configurationPend = new Configuration();
configurationPend.setConfigurationId("abc");
serviceInstancePend.getConfigurations().add(configurationPend);
lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, configurationPend.getConfigurationId());
+ List<InstanceGroup> instanceGroupsPend = serviceInstancePend.getInstanceGroups();
+ InstanceGroup instanceGroupPend = new InstanceGroup();
+ instanceGroupPend.setId("test-instance-group-1");
+ instanceGroupsPend.add(instanceGroupPend);
+ lookupKeyMap.put(ResourceKey.INSTANCE_GROUP_ID, instanceGroupPend.getId());
+
customer.getServiceSubscription().getServiceInstances().add(serviceInstancePend);
gBBInput.setCustomer(customer);
@@ -136,6 +142,9 @@ public class ExtractPojosForBBTest extends BaseTest{
VpnBondingLink extractVpnBondingLinkPend = extractPojos.extractByKey(execution, ResourceKey.VPN_BONDING_LINK_ID, "testVpnBondingLink");
assertEquals(extractVpnBondingLinkPend.getVpnBondingLinkId(), vpnBondingLinkPend.getVpnBondingLinkId());
+
+ InstanceGroup extractInstanceGroupPend = extractPojos.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID, "test-instance-group-1");
+ assertEquals(instanceGroupPend.getId(), extractInstanceGroupPend.getId());
}
@Test
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java
index 7e4afb7a12..ff592f5603 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java
@@ -659,6 +659,34 @@ public class BBInputSetupMapperLayerTest {
}
@Test
+ public void testmapCatalogConfigurationToFabricConfiguration() {
+ String modelCustUUID = "modelCustomizationUUID";
+ String modelInvariantUUID = "modelInvariantUUID";
+ String modelVersionUUID = "modelUUID";
+ String policyName = "policyName";
+ ModelInfoConfiguration expected = new ModelInfoConfiguration();
+ expected.setModelCustomizationId(modelCustUUID);
+ expected.setModelInvariantId(modelInvariantUUID);
+ expected.setModelVersionId(modelVersionUUID);
+ expected.setPolicyName(policyName);
+
+ VnfVfmoduleCvnfcConfigurationCustomization fabricCustomization = new VnfVfmoduleCvnfcConfigurationCustomization();
+ fabricCustomization.setCvnfcCustomization(new CvnfcCustomization());
+ fabricCustomization.getCvnfcCustomization().setVnfcCustomization(new VnfcCustomization());
+ fabricCustomization.setPolicyName(policyName);
+ fabricCustomization.setModelCustomizationUUID(modelCustUUID);
+
+ ConfigurationResource configurationResource = new ConfigurationResource();
+ configurationResource.setModelUUID(modelVersionUUID);
+ configurationResource.setModelInvariantUUID(modelInvariantUUID);
+ fabricCustomization.setConfigurationResource(configurationResource);
+
+ ModelInfoConfiguration actual = bbInputSetupMapperLayer.mapCatalogConfigurationToConfiguration(fabricCustomization);
+
+ assertThat(actual, sameBeanAs(expected));
+ }
+
+ @Test
public void testMapNameValueUserParams() throws IOException {
RequestDetails requestDetails = mapper.readValue(new File(RESOURCE_PATH + "RequestDetailsInput_mapReqContext.json"), RequestDetails.class);
Map<String,Object> actual = bbInputSetupMapperLayer.mapNameValueUserParams(requestDetails.getRequestParameters());
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java
index d7c681b938..4b10d513d6 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java
@@ -93,6 +93,7 @@ import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization;
import org.onap.so.db.catalog.beans.CollectionResource;
import org.onap.so.db.catalog.beans.CollectionResourceCustomization;
import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization;
+import org.onap.so.db.catalog.beans.ConfigurationResource;
import org.onap.so.db.catalog.beans.ConfigurationResourceCustomization;
import org.onap.so.db.catalog.beans.InstanceGroupType;
import org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization;
@@ -101,6 +102,7 @@ import org.onap.so.db.catalog.beans.OrchestrationStatus;
import org.onap.so.db.catalog.beans.Service;
import org.onap.so.db.catalog.beans.VfModuleCustomization;
import org.onap.so.db.catalog.beans.VnfResourceCustomization;
+import org.onap.so.db.catalog.beans.VnfVfmoduleCvnfcConfigurationCustomization;
import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.serviceinstancebeans.CloudConfiguration;
@@ -356,13 +358,61 @@ public class BBInputSetupTest {
String resourceId = "123";
String requestAction = "createInstance";
- doReturn(null).when(bbInputSetupMapperLayer).mapAAIGenericVnfIntoGenericVnf(ArgumentMatchers.isNull());
+ lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, "vnf-001");
+
+ doReturn(new org.onap.aai.domain.yang.GenericVnf()).when(SPY_bbInputSetupUtils).getAAIGenericVnf(ArgumentMatchers.isA(String.class));
+ doReturn(null).when(bbInputSetupMapperLayer).mapAAIGenericVnfIntoGenericVnf(ArgumentMatchers.isA(org.onap.aai.domain.yang.GenericVnf.class));
GeneralBuildingBlock actual = SPY_bbInputSetup.getGBBCM(executeBB, requestDetails, lookupKeyMap, requestAction,
resourceId);
-
assertThat(actual, sameBeanAs(expected));
}
+
+ @Test
+ public void testGetGBBCMAddMembersAction() throws Exception {
+ GeneralBuildingBlock expected = mapper.readValue(new File(RESOURCE_PATH + "GeneralBuildingBlockInstanceGroupExpected.json"),
+ GeneralBuildingBlock.class);
+ ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"),
+ ExecuteBuildingBlock.class);
+ RequestDetails requestDetails = mapper.readValue(
+ new File(RESOURCE_PATH + "RequestDetailsInput_instanceGroupAddMembers.json"), RequestDetails.class);
+ Map<ResourceKey, String> lookupKeyMap = new HashMap<>();
+ String requestAction = "addMembers";
+ String instanceGroupId = "instance-group-001";
+
+ WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds();
+ workflowResourceIds.setInstanceGroupId(instanceGroupId);
+ executeBB.setWorkflowResourceIds(workflowResourceIds);
+
+ lookupKeyMap.put(ResourceKey.INSTANCE_GROUP_ID, instanceGroupId);
+
+ org.onap.aai.domain.yang.InstanceGroup aaiInstanceGroup = new org.onap.aai.domain.yang.InstanceGroup();
+ aaiInstanceGroup.setId(instanceGroupId);
+ aaiInstanceGroup.setInstanceGroupName("test instance group 1");
+
+ org.onap.aai.domain.yang.ServiceInstance aaiServiceInstance = new org.onap.aai.domain.yang.ServiceInstance();
+ aaiServiceInstance.setServiceInstanceId("service-instance-001");
+ aaiServiceInstance.setServiceInstanceName("test service instance 1");
+ Optional<org.onap.aai.domain.yang.ServiceInstance> optSI = Optional.of(aaiServiceInstance);
+
+ org.onap.aai.domain.yang.GenericVnf vnf1 = new org.onap.aai.domain.yang.GenericVnf();
+ vnf1.setVnfId("vnf-001");
+ vnf1.setVnfName("test vnf 1");
+
+ org.onap.aai.domain.yang.GenericVnf vnf2 = new org.onap.aai.domain.yang.GenericVnf();
+ vnf2.setVnfId("vnf-002");
+ vnf2.setVnfName("test vnf 2");
+
+ doReturn(aaiInstanceGroup).when(SPY_bbInputSetupUtils).getAAIInstanceGroup(instanceGroupId);
+ doReturn(optSI).when(SPY_bbInputSetupUtils).getRelatedServiceInstanceFromInstanceGroup(instanceGroupId);
+ doReturn(vnf1).when(SPY_bbInputSetupUtils).getAAIGenericVnf("vnf-001");
+ doReturn(vnf2).when(SPY_bbInputSetupUtils).getAAIGenericVnf("vnf-002");
+
+ GeneralBuildingBlock actual = SPY_bbInputSetup.getGBBCM(executeBB, requestDetails, lookupKeyMap,
+ requestAction, instanceGroupId);
+ assertThat(actual, sameBeanAs(expected));
+ }
+
@Test
public void testGetGBBALaCarteNonService() throws Exception {
GeneralBuildingBlock expected = mapper.readValue(new File(RESOURCE_PATH + "GeneralBuildingBlockExpected.json"),
@@ -385,7 +435,7 @@ public class BBInputSetupTest {
doReturn(aaiServiceInstance).when(SPY_bbInputSetupUtils).getAAIServiceInstanceById("instanceId");
doNothing().when(SPY_bbInputSetup).populateObjectsOnAssignAndCreateFlows(requestDetails, service, "bbName",
- serviceInstance, lookupKeyMap, resourceId, vnfType);
+ serviceInstance, lookupKeyMap, resourceId, vnfType, null, null);
doReturn(serviceInstance).when(SPY_bbInputSetup).getExistingServiceInstance(aaiServiceInstance);
doReturn(expected).when(SPY_bbInputSetup).populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance,
executeBB, requestAction, null);
@@ -435,7 +485,7 @@ public class BBInputSetupTest {
doReturn(aaiServiceInstance).when(SPY_bbInputSetupUtils).getAAIServiceInstanceById("instanceId");
doNothing().when(SPY_bbInputSetup).populateObjectsOnAssignAndCreateFlows(requestDetails, service, "bbName",
- serviceInstance, lookupKeyMap, resourceId, vnfType);
+ serviceInstance, lookupKeyMap, resourceId, vnfType, null, null);
doReturn(serviceInstance).when(SPY_bbInputSetup).getExistingServiceInstance(aaiServiceInstance);
doReturn(expected).when(SPY_bbInputSetup).populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance,
@@ -738,7 +788,7 @@ public class BBInputSetupTest {
doReturn(ModelType.network).when(modelInfo).getModelType();
SPY_bbInputSetup.populateObjectsOnAssignAndCreateFlows(requestDetails, service, bbName, serviceInstance,
- lookupKeyMap, resourceId, vnfType);
+ lookupKeyMap, resourceId, vnfType, null, null);
verify(SPY_bbInputSetup, times(1)).populateL3Network(instanceName, modelInfo, service, bbName, serviceInstance,
lookupKeyMap, resourceId, null);
assertEquals("NetworkId populated", true, lookupKeyMap.get(ResourceKey.NETWORK_ID).equalsIgnoreCase(resourceId));
@@ -748,7 +798,7 @@ public class BBInputSetupTest {
doNothing().when(SPY_bbInputSetup).populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness,
service, bbName, serviceInstance, lookupKeyMap, relatedInstanceList, resourceId, vnfType, null, productFamilyId);
SPY_bbInputSetup.populateObjectsOnAssignAndCreateFlows(requestDetails, service, bbName, serviceInstance,
- lookupKeyMap, resourceId, vnfType);
+ lookupKeyMap, resourceId, vnfType, null, null);
verify(SPY_bbInputSetup, times(1)).populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness,
service, bbName, serviceInstance, lookupKeyMap, relatedInstanceList, resourceId, vnfType, null, productFamilyId);
assertEquals("VnfId populated", true, lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID).equalsIgnoreCase(resourceId));
@@ -758,7 +808,7 @@ public class BBInputSetupTest {
doNothing().when(SPY_bbInputSetup).populateVolumeGroup(modelInfo, service, bbName, serviceInstance,
lookupKeyMap, resourceId, relatedInstanceList, instanceName, vnfType, null);
SPY_bbInputSetup.populateObjectsOnAssignAndCreateFlows(requestDetails, service, bbName, serviceInstance,
- lookupKeyMap, resourceId, vnfType);
+ lookupKeyMap, resourceId, vnfType, null, null);
verify(SPY_bbInputSetup, times(1)).populateVolumeGroup(modelInfo, service, bbName, serviceInstance,
lookupKeyMap, resourceId, relatedInstanceList, instanceName, vnfType, null);
assertEquals("VolumeGroupId populated", true, lookupKeyMap.get(ResourceKey.VOLUME_GROUP_ID).equalsIgnoreCase(resourceId));
@@ -768,7 +818,7 @@ public class BBInputSetupTest {
doNothing().when(SPY_bbInputSetup).populateVfModule(modelInfo, service, bbName, serviceInstance, lookupKeyMap,
resourceId, relatedInstanceList, instanceName, null, cloudConfiguration);
SPY_bbInputSetup.populateObjectsOnAssignAndCreateFlows(requestDetails, service, bbName, serviceInstance,
- lookupKeyMap, resourceId, vnfType);
+ lookupKeyMap, resourceId, vnfType, null, null);
verify(SPY_bbInputSetup, times(1)).populateVfModule(modelInfo, service, bbName, serviceInstance, lookupKeyMap,
resourceId, relatedInstanceList, instanceName, null, cloudConfiguration);
assertEquals("VfModuleId populated", true, lookupKeyMap.get(ResourceKey.VF_MODULE_ID).equalsIgnoreCase(resourceId));
@@ -966,6 +1016,21 @@ public class BBInputSetupTest {
}
@Test
+ public void testPopulateInstanceGroup() throws Exception {
+ ModelInfo modelInfo = Mockito.mock(ModelInfo.class);
+ Service service = Mockito.mock(Service.class);
+ List<InstanceGroup> instanceGroups = Mockito.spy(new ArrayList<>());
+ ServiceInstance serviceInstance = Mockito.spy(new ServiceInstance());
+ serviceInstance.setServiceInstanceId("si-001");
+ serviceInstance.setServiceInstanceName("test service instance");
+ serviceInstance.setInstanceGroups(instanceGroups);
+
+ SPY_bbInputSetup.populateInstanceGroup(modelInfo, service, serviceInstance, "instance-group-001", "test instance group");
+ verify(SPY_bbInputSetup, times(1)).mapCatalogInstanceGroup(isA(InstanceGroup.class), isA(ModelInfo.class), isA(Service.class));
+ verify(instanceGroups, times(1)).add(isA(InstanceGroup.class));
+ }
+
+ @Test
public void testIsVlanTagging() throws Exception {
boolean expected = true;
Service service = Mockito.mock(Service.class);
@@ -1186,6 +1251,43 @@ public class BBInputSetupTest {
assertEquals(modelInfoNetwork, network.getModelInfoNetwork());
}
+
+ @Test
+ public void testPopulateFabricConfiguration() throws JsonParseException, JsonMappingException, IOException {
+ String instanceName = "configurationName";
+ ModelInfo modelInfo = new ModelInfo();
+ modelInfo.setModelCustomizationUuid("72d9d1cd-f46d-447a-abdb-451d6fb05fa9");
+
+ ServiceInstance serviceInstance = new ServiceInstance();
+ Configuration configuration = new Configuration();
+ configuration.setConfigurationId("configurationId");
+ configuration.setConfigurationName("configurationName");
+ serviceInstance.getConfigurations().add(configuration);
+ String resourceId = "configurationId";
+ // Mock service
+ Service service = mapper.readValue(
+ new File(RESOURCE_PATH + "CatalogDBService_getServiceInstanceNOAAIInput.json"), Service.class);
+ Map<ResourceKey, String> lookupKeyMap = new HashMap<>();
+ lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, "configurationId");
+ String bbName = AssignFlows.FABRIC_CONFIGURATION.toString();
+ ConfigurationResourceKeys configResourceKeys = new ConfigurationResourceKeys();
+ configResourceKeys.setCvnfcCustomizationUUID("cvnfcCustomizationUUID");
+ configResourceKeys.setVfModuleCustomizationUUID("vfModuleCustomizationUUID");
+ configResourceKeys.setVnfResourceCustomizationUUID("vnfResourceCustomizationUUID");
+
+ VnfVfmoduleCvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization = new VnfVfmoduleCvnfcConfigurationCustomization();
+ ConfigurationResource configurationResource = new ConfigurationResource();
+ configurationResource.setModelUUID("modelUUID");
+ configurationResource.setModelInvariantUUID("modelInvariantUUID");
+ vnfVfmoduleCvnfcConfigurationCustomization.setConfigurationResource(configurationResource);
+
+ doReturn(null).when(SPY_bbInputSetup).findConfigurationResourceCustomization(modelInfo, service);
+ doReturn(vnfVfmoduleCvnfcConfigurationCustomization).when(SPY_bbInputSetup).findVnfVfmoduleCvnfcConfigurationCustomization("vfModuleCustomizationUUID","vnfResourceCustomizationUUID","cvnfcCustomizationUUID");
+
+ SPY_bbInputSetup.populateConfiguration(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId,
+ instanceName, configResourceKeys);
+ verify(SPY_bbInputSetup, times(1)).mapCatalogConfiguration(configuration, modelInfo, service, configResourceKeys);
+ }
@Test
public void testPopulateGenericVnf() throws JsonParseException, JsonMappingException, IOException {
@@ -1717,6 +1819,7 @@ public class BBInputSetupTest {
String vfModuleId = "vfModuleId";
String volumeGroupId = "volumeGroupId";
String configurationId = "configurationId";
+ String instanceGroupId = "instancegroupId";
expected.put(ResourceKey.SERVICE_INSTANCE_ID, serviceInstanceId);
expected.put(ResourceKey.NETWORK_ID, networkId);
@@ -1724,6 +1827,7 @@ public class BBInputSetupTest {
expected.put(ResourceKey.VF_MODULE_ID, vfModuleId);
expected.put(ResourceKey.VOLUME_GROUP_ID, volumeGroupId);
expected.put(ResourceKey.CONFIGURATION_ID, configurationId);
+ expected.put(ResourceKey.INSTANCE_GROUP_ID, instanceGroupId);
WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds();
workflowResourceIds.setServiceInstanceId(serviceInstanceId);
@@ -1732,7 +1836,8 @@ public class BBInputSetupTest {
workflowResourceIds.setVfModuleId(vfModuleId);
workflowResourceIds.setVolumeGroupId(volumeGroupId);
workflowResourceIds.setConfigurationId(configurationId);
-
+ workflowResourceIds.setInstanceGroupId(instanceGroupId);
+
SPY_bbInputSetup.populateLookupKeyMapWithIds(workflowResourceIds, actual);
assertThat(actual, sameBeanAs(expected));
@@ -2602,4 +2707,4 @@ public class BBInputSetupTest {
assertEquals("Lookup Key Map populated with VolumeGroup Id", volumeGroupId, lookupKeyMap.get(ResourceKey.VOLUME_GROUP_ID));
}
-}
+} \ No newline at end of file
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java
index d1d66ae28d..54e513e7d9 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java
@@ -44,6 +44,7 @@ import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
+import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.aai.domain.yang.CloudRegion;
import org.onap.aai.domain.yang.Configuration;
@@ -58,6 +59,8 @@ import org.onap.aai.domain.yang.VolumeGroups;
import org.onap.so.bpmn.common.InjectionHelper;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription;
+import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.MultipleObjectsFoundException;
+import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.NoServiceInstanceFoundException;
import org.onap.so.client.aai.AAIObjectPlurals;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.AAIResourcesClient;
@@ -636,6 +639,41 @@ public class BBInputSetupUtilsTest {
}
@Test
+ public void getRelatedServiceInstanceFromInstanceGroupTest() throws Exception {
+ Optional<ServiceInstances> expected = Optional.of(new ServiceInstances());
+ ServiceInstance serviceInstance = new ServiceInstance();
+ serviceInstance.setServiceInstanceId("serviceInstanceId");
+ serviceInstance.setServiceInstanceName("serviceInstanceName");
+ expected.get().getServiceInstance().add(serviceInstance);
+
+ doReturn(expected).when(MOCK_aaiResourcesClient).get(eq(ServiceInstances.class), any(AAIResourceUri.class));
+ Optional<ServiceInstance> actual = this.bbInputSetupUtils.getRelatedServiceInstanceFromInstanceGroup("ig-001");
+ assertEquals(actual.get().getServiceInstanceId(), expected.get().getServiceInstance().get(0).getServiceInstanceId());
+ }
+
+ @Test
+ public void getRelatedServiceInstanceFromInstanceGroupMultipleTest() throws Exception {
+ expectedException.expect(MultipleObjectsFoundException.class);
+ Optional<ServiceInstances> serviceInstances = Optional.of(new ServiceInstances());
+ ServiceInstance si1 = Mockito.mock(ServiceInstance.class);
+ ServiceInstance si2 = Mockito.mock(ServiceInstance.class);
+ serviceInstances.get().getServiceInstance().add(si1);
+ serviceInstances.get().getServiceInstance().add(si2);
+
+ doReturn(serviceInstances).when(MOCK_aaiResourcesClient).get(eq(ServiceInstances.class), any(AAIResourceUri.class));
+ this.bbInputSetupUtils.getRelatedServiceInstanceFromInstanceGroup("ig-001");
+ }
+
+ @Test
+ public void getRelatedServiceInstanceFromInstanceGroupNotFoundTest() throws Exception {
+ expectedException.expect(NoServiceInstanceFoundException.class);
+ Optional<ServiceInstances> serviceInstances = Optional.of(new ServiceInstances());
+
+ doReturn(serviceInstances).when(MOCK_aaiResourcesClient).get(eq(ServiceInstances.class), any(AAIResourceUri.class));
+ this.bbInputSetupUtils.getRelatedServiceInstanceFromInstanceGroup("ig-001");
+ }
+
+ @Test
public void getRelatedVnfByNameFromServiceInstanceTest() throws Exception {
Optional<GenericVnfs> expected = Optional.of(new GenericVnfs());
GenericVnf vnf = new GenericVnf();
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/exceptions/MultipleObjectsFoundExceptionTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/exceptions/MultipleObjectsFoundExceptionTest.java
new file mode 100644
index 0000000000..1cf70d050a
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/exceptions/MultipleObjectsFoundExceptionTest.java
@@ -0,0 +1,67 @@
+/*-
+ * ============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.servicedecomposition.tasks.exceptions;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.MultipleObjectsFoundException;
+
+public class MultipleObjectsFoundExceptionTest {
+ private static final String MESSAGE = "message";
+ private static final Throwable CAUSE = new Throwable();
+ private MultipleObjectsFoundException MultipleObjectsFoundException;
+
+ @Test
+ public void defaultConstructorTest() {
+ MultipleObjectsFoundException = new MultipleObjectsFoundException();
+ assertEquals(null, MultipleObjectsFoundException.getMessage());
+ assertEquals(null, MultipleObjectsFoundException.getCause());
+ }
+
+ @Test
+ public void messageConstructorTest() {
+ MultipleObjectsFoundException = new MultipleObjectsFoundException(MESSAGE);
+ assertEquals(MESSAGE, MultipleObjectsFoundException.getMessage());
+ assertEquals(null, MultipleObjectsFoundException.getCause());
+ }
+
+ @Test
+ public void causeConstructorTest() {
+ MultipleObjectsFoundException = new MultipleObjectsFoundException(CAUSE);
+ assertEquals(CAUSE.toString(), MultipleObjectsFoundException.getMessage());
+ assertEquals(CAUSE, MultipleObjectsFoundException.getCause());
+ }
+
+ @Test
+ public void messageAndCauseConstructorTest() {
+ MultipleObjectsFoundException = new MultipleObjectsFoundException(MESSAGE, CAUSE);
+ assertEquals(MESSAGE, MultipleObjectsFoundException.getMessage());
+ assertEquals(CAUSE, MultipleObjectsFoundException.getCause());
+ }
+
+ @Test
+ public void messageAndCauseAndFlagsConstructorTest() {
+ MultipleObjectsFoundException = new MultipleObjectsFoundException(MESSAGE, CAUSE, true, true);
+ assertEquals(MESSAGE, MultipleObjectsFoundException.getMessage());
+ assertEquals(CAUSE, MultipleObjectsFoundException.getCause());
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/exceptions/NoServiceInstanceFoundExceptionTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/exceptions/NoServiceInstanceFoundExceptionTest.java
new file mode 100644
index 0000000000..344481dbed
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/exceptions/NoServiceInstanceFoundExceptionTest.java
@@ -0,0 +1,66 @@
+/*-
+ * ============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.servicedecomposition.tasks.exceptions;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+
+public class NoServiceInstanceFoundExceptionTest {
+ private static final String MESSAGE = "message";
+ private static final Throwable CAUSE = new Throwable();
+ private NoServiceInstanceFoundException NoObjectFoundException;
+
+ @Test
+ public void defaultConstructorTest() {
+ NoObjectFoundException = new NoServiceInstanceFoundException();
+ assertEquals(null, NoObjectFoundException.getMessage());
+ assertEquals(null, NoObjectFoundException.getCause());
+ }
+
+ @Test
+ public void messageConstructorTest() {
+ NoObjectFoundException = new NoServiceInstanceFoundException(MESSAGE);
+ assertEquals(MESSAGE, NoObjectFoundException.getMessage());
+ assertEquals(null, NoObjectFoundException.getCause());
+ }
+
+ @Test
+ public void causeConstructorTest() {
+ NoObjectFoundException = new NoServiceInstanceFoundException(CAUSE);
+ assertEquals(CAUSE.toString(), NoObjectFoundException.getMessage());
+ assertEquals(CAUSE, NoObjectFoundException.getCause());
+ }
+
+ @Test
+ public void messageAndCauseConstructorTest() {
+ NoObjectFoundException = new NoServiceInstanceFoundException(MESSAGE, CAUSE);
+ assertEquals(MESSAGE, NoObjectFoundException.getMessage());
+ assertEquals(CAUSE, NoObjectFoundException.getCause());
+ }
+
+ @Test
+ public void messageAndCauseAndFlagsConstructorTest() {
+ NoObjectFoundException = new NoServiceInstanceFoundException(MESSAGE, CAUSE, true, true);
+ assertEquals(MESSAGE, NoObjectFoundException.getMessage());
+ assertEquals(CAUSE, NoObjectFoundException.getCause());
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GeneralBuildingBlockInstanceGroupExpected.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GeneralBuildingBlockInstanceGroupExpected.json
new file mode 100644
index 0000000000..f55717fc91
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GeneralBuildingBlockInstanceGroupExpected.json
@@ -0,0 +1,323 @@
+{
+ "requestContext": {
+ "product-family-id": null,
+ "source": "VID",
+ "requestor-id": "az2016",
+ "subscription-service-type": null,
+ "user-params": {
+
+ },
+ "action": "addMembers",
+ "callback-url": null,
+ "service-uri": null,
+ "mso-request-id": "requestId",
+ "requestParameters": {
+
+ },
+ "configurationParameters": []
+ },
+ "orchContext": {
+ "is-rollback-enabled": true
+ },
+ "userInput": null,
+ "tenant": {
+ },
+ "cloudRegion": {
+ "lcp-cloud-region-id": null,
+ "cloud-owner": null,
+ "tenant-id": null,
+ "complex": null,
+ "cloud-region-version": null
+ },
+ "customer": {
+ "global-customer-id": null,
+ "subscriber-name": null,
+ "subscriber-type": null,
+ "subscriber-common-site-id": null,
+ "service-subscription": {
+ "service-type": null,
+ "temp-ub-sub-account-id": null,
+ "service-instances": [
+ {
+ "service-instance-id": "service-instance-001",
+ "service-instance-name": "test service instance 1",
+ "orchestration-status": null,
+ "owning-entity": null,
+ "project": null,
+ "collection": null,
+ "vnfs": [],
+ "pnfs": [],
+ "allotted-resources": [],
+ "networks": [],
+ "vpn-bonding-links": [],
+ "vhn-portal-url": null,
+ "service-instance-location-id": null,
+ "selflink": null,
+ "metadata": null,
+ "configurations": [],
+ "solution-info": null,
+ "model-info-service-instance": null,
+ "instance-groups": [
+ {
+ "id": "instance-group-001",
+ "description": null,
+ "resource-version": null,
+ "instance-group-name": "test instance group 1",
+ "orchestration-status": "INVENTORIED",
+ "model-info-instance-group": null,
+ "instance-group-function": null,
+ "vnfs": [
+ {
+ "vnf-id": "vnf-001",
+ "vnf-name": "test vnf 1",
+ "vnf-type": null,
+ "orchestration-status": null,
+ "vf-modules": [],
+ "volume-groups": [],
+ "line-of-business": null,
+ "platform": null,
+ "cascaded": null,
+ "cloud-params": {
+
+ },
+ "cloud-context": null,
+ "solution": null,
+ "vnf-name-2": null,
+ "service-id": null,
+ "regional-resource-zone": null,
+ "prov-status": null,
+ "operational-status": null,
+ "equipment-role": null,
+ "management-option": null,
+ "ipv4-oam-address": null,
+ "ipv4-loopback0-address": null,
+ "nm-lan-v6-address": null,
+ "management-v6-address": null,
+ "vcpu": null,
+ "vcpu-units": null,
+ "vmemory": null,
+ "vmemory-units": null,
+ "vdisk": null,
+ "vdisk-units": null,
+ "in-maint": null,
+ "is-closed-loop-disabled": null,
+ "summary-status": null,
+ "encrypted-access-flag": null,
+ "as-number": null,
+ "regional-resource-subzone": null,
+ "self-link": null,
+ "ipv4-oam-gateway-address": null,
+ "ipv4-oam-gateway-address-prefix-length": null,
+ "vlan-id-outer": null,
+ "nm-profile-name": null,
+ "l-interfaces": [],
+ "lag-interfaces": [],
+ "license": null,
+ "entitlements": [],
+ "model-info-generic-vnf": null,
+ "instance-groups": [],
+ "call-homing": null,
+ "nf-function": null,
+ "nf-role": null
+ },
+ {
+ "vnf-id": "vnf-002",
+ "vnf-name": "test vnf 2",
+ "vnf-type": null,
+ "orchestration-status": null,
+ "vf-modules": [],
+ "volume-groups": [],
+ "line-of-business": null,
+ "platform": null,
+ "cascaded": null,
+ "cloud-params": {
+
+ },
+ "cloud-context": null,
+ "solution": null,
+ "vnf-name-2": null,
+ "service-id": null,
+ "regional-resource-zone": null,
+ "prov-status": null,
+ "operational-status": null,
+ "equipment-role": null,
+ "management-option": null,
+ "ipv4-oam-address": null,
+ "ipv4-loopback0-address": null,
+ "nm-lan-v6-address": null,
+ "management-v6-address": null,
+ "vcpu": null,
+ "vcpu-units": null,
+ "vmemory": null,
+ "vmemory-units": null,
+ "vdisk": null,
+ "vdisk-units": null,
+ "in-maint": null,
+ "is-closed-loop-disabled": null,
+ "summary-status": null,
+ "encrypted-access-flag": null,
+ "as-number": null,
+ "regional-resource-subzone": null,
+ "self-link": null,
+ "ipv4-oam-gateway-address": null,
+ "ipv4-oam-gateway-address-prefix-length": null,
+ "vlan-id-outer": null,
+ "nm-profile-name": null,
+ "l-interfaces": [],
+ "lag-interfaces": [],
+ "license": null,
+ "entitlements": [],
+ "model-info-generic-vnf": null,
+ "instance-groups": [],
+ "call-homing": null,
+ "nf-function": null,
+ "nf-role": null
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ },
+ "vpn-bindings": []
+ },
+ "serviceInstance": {
+ "service-instance-id": "service-instance-001",
+ "service-instance-name": "test service instance 1",
+ "orchestration-status": null,
+ "owning-entity": null,
+ "project": null,
+ "collection": null,
+ "vnfs": [],
+ "pnfs": [],
+ "allotted-resources": [],
+ "networks": [],
+ "vpn-bonding-links": [],
+ "vhn-portal-url": null,
+ "service-instance-location-id": null,
+ "selflink": null,
+ "metadata": null,
+ "configurations": [],
+ "solution-info": null,
+ "model-info-service-instance": null,
+ "instance-groups": [
+ {
+ "id": "instance-group-001",
+ "description": null,
+ "resource-version": null,
+ "instance-group-name": "test instance group 1",
+ "orchestration-status": "INVENTORIED",
+ "model-info-instance-group": null,
+ "instance-group-function": null,
+ "vnfs": [
+ {
+ "vnf-id": "vnf-001",
+ "vnf-name": "test vnf 1",
+ "vnf-type": null,
+ "orchestration-status": null,
+ "vf-modules": [],
+ "volume-groups": [],
+ "line-of-business": null,
+ "platform": null,
+ "cascaded": null,
+ "cloud-params": {
+
+ },
+ "cloud-context": null,
+ "solution": null,
+ "vnf-name-2": null,
+ "service-id": null,
+ "regional-resource-zone": null,
+ "prov-status": null,
+ "operational-status": null,
+ "equipment-role": null,
+ "management-option": null,
+ "ipv4-oam-address": null,
+ "ipv4-loopback0-address": null,
+ "nm-lan-v6-address": null,
+ "management-v6-address": null,
+ "vcpu": null,
+ "vcpu-units": null,
+ "vmemory": null,
+ "vmemory-units": null,
+ "vdisk": null,
+ "vdisk-units": null,
+ "in-maint": null,
+ "is-closed-loop-disabled": null,
+ "summary-status": null,
+ "encrypted-access-flag": null,
+ "as-number": null,
+ "regional-resource-subzone": null,
+ "self-link": null,
+ "ipv4-oam-gateway-address": null,
+ "ipv4-oam-gateway-address-prefix-length": null,
+ "vlan-id-outer": null,
+ "nm-profile-name": null,
+ "l-interfaces": [],
+ "lag-interfaces": [],
+ "license": null,
+ "entitlements": [],
+ "model-info-generic-vnf": null,
+ "instance-groups": [],
+ "call-homing": null,
+ "nf-function": null,
+ "nf-role": null
+ },
+ {
+ "vnf-id": "vnf-002",
+ "vnf-name": "test vnf 2",
+ "vnf-type": null,
+ "orchestration-status": null,
+ "vf-modules": [],
+ "volume-groups": [],
+ "line-of-business": null,
+ "platform": null,
+ "cascaded": null,
+ "cloud-params": {
+
+ },
+ "cloud-context": null,
+ "solution": null,
+ "vnf-name-2": null,
+ "service-id": null,
+ "regional-resource-zone": null,
+ "prov-status": null,
+ "operational-status": null,
+ "equipment-role": null,
+ "management-option": null,
+ "ipv4-oam-address": null,
+ "ipv4-loopback0-address": null,
+ "nm-lan-v6-address": null,
+ "management-v6-address": null,
+ "vcpu": null,
+ "vcpu-units": null,
+ "vmemory": null,
+ "vmemory-units": null,
+ "vdisk": null,
+ "vdisk-units": null,
+ "in-maint": null,
+ "is-closed-loop-disabled": null,
+ "summary-status": null,
+ "encrypted-access-flag": null,
+ "as-number": null,
+ "regional-resource-subzone": null,
+ "self-link": null,
+ "ipv4-oam-gateway-address": null,
+ "ipv4-oam-gateway-address-prefix-length": null,
+ "vlan-id-outer": null,
+ "nm-profile-name": null,
+ "l-interfaces": [],
+ "lag-interfaces": [],
+ "license": null,
+ "entitlements": [],
+ "model-info-generic-vnf": null,
+ "instance-groups": [],
+ "call-homing": null,
+ "nf-function": null,
+ "nf-role": null
+ }
+ ]
+ }
+ ]
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_instanceGroupAddMembers.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_instanceGroupAddMembers.json
new file mode 100644
index 0000000000..96684b6680
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_instanceGroupAddMembers.json
@@ -0,0 +1,27 @@
+{
+ "requestInfo": {
+ "source": "VID",
+ "requestorId": "az2016"
+ },
+ "relatedInstanceList": [
+ {
+ "relatedInstance": {
+ "instanceId": "vnf-001",
+ "modelInfo": {
+ "modelType": "vnf"
+ }
+ }
+ },
+ {
+ "relatedInstance": {
+ "instanceId": "vnf-002",
+ "modelInfo": {
+ "modelType": "vnf"
+ }
+ }
+ }
+ ],
+ "requestParameters": {
+ "userParams": []
+ }
+} \ No newline at end of file
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerService.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerService.java
index f4617f9978..4ab22f4616 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerService.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerService.java
@@ -220,7 +220,7 @@ public class CallbackHandlerService {
+ " = '" + correlationValue + "'; last exception was:"
+ queryException;
logger.debug(msg);
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), msg, queryException);
}
@@ -263,8 +263,8 @@ public class CallbackHandlerService {
+ " with " + correlationVariable + " = '" + correlationValue
+ "': " + ole;
logger.debug(msg);
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN CORRELATION ERROR -",
- MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), msg, ole);
+ logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN CORRELATION ERROR -",
+ MsoLogger.ErrorCode.UnknownError.getValue(), msg, ole);
//Retry for OptimisticLocking Exceptions
int retryCount = 0;
@@ -296,14 +296,14 @@ public class CallbackHandlerService {
//oleFlag = ex instanceof org.camunda.bpm.engine.OptimisticLockingException;
String strMsg = "Received exception, OptimisticLockingException retry failed, retryCount:" + retryCount + " | exception returned: " + olex;
logger.debug(strMsg);
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), strMsg, olex);
} catch (Exception excep) {
retryCount = 0;
//oleFlag = ex instanceof org.camunda.bpm.engine.OptimisticLockingException;
String strMsg = "Received exception, OptimisticLockingException retry failed, retryCount:" + retryCount + " | exception returned: " + excep;
logger.debug(strMsg);
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), strMsg, excep);
}
@@ -317,7 +317,7 @@ public class CallbackHandlerService {
+ " with " + correlationVariable + " = '" + correlationValue
+ "': " + e;
logger.debug(msg);
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), msg, e);
}
} catch (Exception e) {
@@ -327,8 +327,8 @@ public class CallbackHandlerService {
+ " with " + correlationVariable + " = '" + correlationValue
+ "': " + e;
logger.debug(msg);
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN CORRELATION ERROR -",
- MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), msg, e);
+ logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN CORRELATION ERROR -",
+ MsoLogger.ErrorCode.UnknownError.getValue(), msg, e);
}
return true;
@@ -363,10 +363,10 @@ public class CallbackHandlerService {
*/
protected void logCallbackError(String method, long startTime, String msg, Exception e) {
if (e == null) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_CALLBACK_EXCEPTION.toString(), "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {}", MessageEnum.BPMN_CALLBACK_EXCEPTION.toString(), "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), msg);
} else {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_CALLBACK_EXCEPTION.toString(), "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {}", MessageEnum.BPMN_CALLBACK_EXCEPTION.toString(), "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), msg, e);
}
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/SDNCAdapterCallbackServiceImpl.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/SDNCAdapterCallbackServiceImpl.java
index 710144dbb9..267e24fec4 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/SDNCAdapterCallbackServiceImpl.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/SDNCAdapterCallbackServiceImpl.java
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -63,7 +65,6 @@ public class SDNCAdapterCallbackServiceImpl extends ProcessEngineAwareService im
String correlationVariable = "SDNCA_requestId";
String correlationValue = sdncAdapterCallbackRequest.getCallbackHeader().getRequestId();
- MsoLogger.setServiceName("MSO." + method);
MsoLogger.setLogContext(correlationValue, "N/A");
CallbackResult result = callback.handleCallback(method, message, messageEventName,
@@ -88,4 +89,4 @@ public class SDNCAdapterCallbackServiceImpl extends ProcessEngineAwareService im
return error;
}
}
-} \ No newline at end of file
+}
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 96a11d21a7..65cc70d5f4 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
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -116,7 +118,6 @@ public class VnfAdapterNotifyServiceImpl extends ProcessEngineAwareService imple
String correlationVariable = "VNFQ_messageId";
String correlationValue = messageId;
- MsoLogger.setServiceName("MSO." + method);
MsoLogger.setLogContext(correlationValue, "N/A");
QueryVnfNotification message = new QueryVnfNotification();
@@ -160,7 +161,6 @@ public class VnfAdapterNotifyServiceImpl extends ProcessEngineAwareService imple
String correlationVariable = "VNFC_messageId";
String correlationValue = messageId;
- MsoLogger.setServiceName("MSO." + method);
MsoLogger.setLogContext(correlationValue, "N/A");
CreateVnfNotification message = new CreateVnfNotification();
@@ -201,7 +201,6 @@ public class VnfAdapterNotifyServiceImpl extends ProcessEngineAwareService imple
String correlationVariable = "VNFU_messageId";
String correlationValue = messageId;
- MsoLogger.setServiceName("MSO." + method);
MsoLogger.setLogContext(correlationValue, "N/A");
UpdateVnfNotification message = new UpdateVnfNotification();
@@ -237,7 +236,6 @@ public class VnfAdapterNotifyServiceImpl extends ProcessEngineAwareService imple
String correlationVariable = "VNFDEL_uuid";
String correlationValue = messageId;
- MsoLogger.setServiceName("MSO." + method);
MsoLogger.setLogContext(correlationValue, "N/A");
DeleteVnfNotification message = new DeleteVnfNotification();
@@ -250,4 +248,4 @@ public class VnfAdapterNotifyServiceImpl extends ProcessEngineAwareService imple
callback.handleCallback(method, message, messageEventName, messageVariable,
correlationVariable, correlationValue, logMarker);
}
-} \ No newline at end of file
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowMessageResource.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowMessageResource.java
index 8b35f0e6d6..a5af553e1c 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowMessageResource.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowMessageResource.java
@@ -79,7 +79,6 @@ public class WorkflowMessageResource{
String message) {
String method = "receiveWorkflowMessage";
- MsoLogger.setServiceName("MSO." + method);
MsoLogger.setLogContext(correlator, "N/A");
logger.debug(LOGMARKER + " Received workflow message"
@@ -91,7 +90,7 @@ public class WorkflowMessageResource{
if (messageType == null || messageType.isEmpty()) {
String msg = "Missing message type";
logger.debug(LOGMARKER + " " + msg);
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN",
MsoLogger.ErrorCode.DataError.getValue(), LOGMARKER + ":" + msg);
return Response.status(400).entity(msg).build();
}
@@ -99,7 +98,7 @@ public class WorkflowMessageResource{
if (correlator == null || correlator.isEmpty()) {
String msg = "Missing correlator";
logger.debug(LOGMARKER + " " + msg);
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN",
MsoLogger.ErrorCode.DataError.getValue(), LOGMARKER + ":" + msg);
return Response.status(400).entity(msg).build();
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowResource.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowResource.java
index 92f1b7a816..d10ecd1ce2 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowResource.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowResource.java
@@ -237,7 +237,6 @@ public class WorkflowResource extends ProcessEngineAwareService {
}
private void setLogContext(String processKey, Map<String, Object> inputVariables) {
- MsoLogger.setServiceName("MSO." + processKey);
if (inputVariables != null) {
MsoLogger.setLogContext(getValueFromInputVariables(inputVariables, "mso-request-id"),
getValueFromInputVariables(inputVariables, "mso-service-instance-id"));
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java
index 62aad7e345..04059557ae 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java
@@ -314,7 +314,6 @@ public class LoggingAndURNMappingPlugin extends AbstractProcessEnginePlugin {
.getName();
- MsoLogger.setServiceName(processName);
String requestId = (String) execution.getVariable("mso-request-id");
String svcid = (String) execution.getVariable("mso-service-instance-id");
MsoLogger.setLogContext(requestId, svcid);
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/adapter/sdnc/ObjectFactoryTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/adapter/sdnc/ObjectFactoryTest.java
new file mode 100644
index 0000000000..bdc48392af
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/adapter/sdnc/ObjectFactoryTest.java
@@ -0,0 +1,63 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.
+ * 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.adapter.sdnc;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Before;
+import org.junit.Test;
+
+public class ObjectFactoryTest {
+
+ ObjectFactory objectFactory;
+
+ @Before
+ public void setUp() {
+ objectFactory = new ObjectFactory();
+ }
+
+ @Test
+ public void testCreateRequestHeader() {
+ assertEquals(RequestHeader.class.getName(), objectFactory.createRequestHeader().getClass().getName());
+ }
+
+ @Test
+ public void testCreateSDNCAdapterResponse() {
+ assertEquals(SDNCAdapterResponse.class.getName(),
+ objectFactory.createSDNCAdapterResponse().getClass().getName());
+ }
+
+ @Test
+ public void testSDNCAdapterCallbackRequest() {
+ assertEquals(SDNCAdapterCallbackRequest.class.getName(),
+ objectFactory.createSDNCAdapterCallbackRequest().getClass().getName());
+ }
+
+ @Test
+ public void testCreateCallbackHeader() {
+ assertEquals(CallbackHeader.class.getName(), objectFactory.createCallbackHeader().getClass().getName());
+ }
+
+ @Test
+ public void testCreateSDNCAdapterRequest() {
+ assertEquals(SDNCAdapterRequest.class.getName(), objectFactory.createSDNCAdapterRequest().getClass().getName());
+ }
+
+}
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteInstanceGroupBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteInstanceGroupBB.bpmn
new file mode 100644
index 0000000000..d16f4405b2
--- /dev/null
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteInstanceGroupBB.bpmn
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0">
+ <bpmn:process id="DeleteInstanceGroupBB" name="DeleteInstanceGroupBB" isExecutable="true">
+ <bpmn:startEvent id="DeleteInstanceGroupBB_Start">
+ <bpmn:outgoing>SequenceFlow_0wlfmtw</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:endEvent id="DeleteInstanceGroupBB_End">
+ <bpmn:incoming>SequenceFlow_068apyw</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_0wlfmtw" sourceRef="DeleteInstanceGroupBB_Start" targetRef="DeleteInstanceGroupNaming" />
+ <bpmn:sequenceFlow id="SequenceFlow_18azuvq" sourceRef="DeleteInstanceGroupNaming" targetRef="DeleteInstanceGroupAAI" />
+ <bpmn:sequenceFlow id="SequenceFlow_068apyw" sourceRef="DeleteInstanceGroupAAI" targetRef="DeleteInstanceGroupBB_End" />
+ <bpmn:serviceTask id="DeleteInstanceGroupNaming" name="Delete Instance Group from Naming mS" camunda:expression="${NamingServiceDeleteTasks.deleteInstanceGroupName(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:incoming>SequenceFlow_0wlfmtw</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_18azuvq</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:serviceTask id="DeleteInstanceGroupAAI" name="Delete Instance Group from A&#38;AI" camunda:expression="${AAIDeleteTasks.deleteInstanceGroup(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:incoming>SequenceFlow_18azuvq</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_068apyw</bpmn:outgoing>
+ </bpmn:serviceTask>
+ </bpmn:process>
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DeleteInstanceGroupBB">
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="DeleteInstanceGroupBB_Start">
+ <dc:Bounds x="173" y="102" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_1fy6x5e_di" bpmnElement="DeleteInstanceGroupBB_End">
+ <dc:Bounds x="645" y="102" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="663" y="138" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0wlfmtw_di" bpmnElement="SequenceFlow_0wlfmtw">
+ <di:waypoint xsi:type="dc:Point" x="209" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="280" y="120" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="245" y="105" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_18azuvq_di" bpmnElement="SequenceFlow_18azuvq">
+ <di:waypoint xsi:type="dc:Point" x="380" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="460" y="120" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="420" y="105" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_068apyw_di" bpmnElement="SequenceFlow_068apyw">
+ <di:waypoint xsi:type="dc:Point" x="560" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="645" y="120" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="603" y="105" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_0nh16a5_di" bpmnElement="DeleteInstanceGroupNaming">
+ <dc:Bounds x="280" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_0ybtwi8_di" bpmnElement="DeleteInstanceGroupAAI">
+ <dc:Bounds x="460" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/BaseBPMNTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/BaseBPMNTest.java
index 79bade3cf3..f4b528c4be 100644
--- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/BaseBPMNTest.java
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/BaseBPMNTest.java
@@ -61,6 +61,8 @@ import org.onap.so.bpmn.infrastructure.flowspecific.tasks.CreateNetworkCollectio
import org.onap.so.bpmn.infrastructure.flowspecific.tasks.GenericVnfHealthCheck;
import org.onap.so.bpmn.infrastructure.flowspecific.tasks.UnassignNetworkBB;
import org.onap.so.bpmn.infrastructure.flowspecific.tasks.UnassignVnf;
+import org.onap.so.bpmn.infrastructure.namingservice.tasks.NamingServiceCreateTasks;
+import org.onap.so.bpmn.infrastructure.namingservice.tasks.NamingServiceDeleteTasks;
import org.onap.so.bpmn.infrastructure.sdnc.tasks.SDNCActivateTasks;
import org.onap.so.bpmn.infrastructure.sdnc.tasks.SDNCAssignTasks;
import org.onap.so.bpmn.infrastructure.sdnc.tasks.SDNCChangeAssignTasks;
@@ -230,6 +232,12 @@ public abstract class BaseBPMNTest {
protected SniroHomingV2 sniroHoming;
@MockBean
+ protected NamingServiceDeleteTasks namingServiceDeleteTasks;
+
+ @MockBean
+ protected NamingServiceCreateTasks namingServiceCreateTasks;
+
+ @MockBean
protected WorkflowActionBBFailure workflowActionBBFailure;
@MockBean
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteInstanceGroupBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteInstanceGroupBBTest.java
new file mode 100644
index 0000000000..6dc36ae100
--- /dev/null
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteInstanceGroupBBTest.java
@@ -0,0 +1,53 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.bpmn.infrastructure.bpmn.subprocess;
+import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.doThrow;
+
+import java.io.IOException;
+
+import org.camunda.bpm.engine.delegate.BpmnError;
+import org.camunda.bpm.engine.runtime.ProcessInstance;
+import org.junit.Test;
+import org.onap.so.bpmn.BaseBPMNTest;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+
+public class DeleteInstanceGroupBBTest extends BaseBPMNTest{
+ @Test
+ public void sunnyDay() throws InterruptedException, IOException {
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeleteInstanceGroupBB", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassedInOrder("DeleteInstanceGroupBB_Start", "DeleteInstanceGroupNaming", "DeleteInstanceGroupAAI",
+ "DeleteInstanceGroupBB_End");
+ assertThat(pi).isEnded();
+ }
+
+ @Test
+ public void rainyDay() throws Exception {
+ doThrow(BpmnError.class).when(aaiDeleteTasks).deleteInstanceGroup(any(BuildingBlockExecution.class));
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeleteInstanceGroupBB", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted()
+ .hasPassedInOrder("DeleteInstanceGroupBB_Start", "DeleteInstanceGroupNaming", "DeleteInstanceGroupAAI")
+ .hasNotPassed("DeleteInstanceGroupBB_End");
+ assertThat(pi).isEnded();
+ }
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSDNCNetworkResource.groovy
index a8da95aa7c..f4bdde5e80 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSDNCNetworkResource.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSDNCNetworkResource.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2018 Huawei Technologies Co., Ltd. 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
@@ -33,14 +35,15 @@ import org.onap.so.bpmn.common.scripts.MsoUtils
import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils
import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.bpmn.core.UrnPropertiesReader
-import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
/**
* This groovy class supports the <class>ActivateSDNCCNetworkResource.bpmn</class> process.
* flow for SDNC Network Resource Activate
*/
public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, ActivateSDNCNetworkResource.class);
+ private static final Logger logger = LoggerFactory.getLogger( ActivateSDNCNetworkResource.class);
String Prefix = "ACTSDNCRES_"
@@ -53,7 +56,7 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor {
MsoUtils msoUtils = new MsoUtils()
public void preProcessRequest(DelegateExecution execution) {
- msoLogger.info(" ***** Started preProcessRequest *****")
+ logger.info(" ***** Started preProcessRequest *****")
try {
//get bpmn inputs from resource request.
@@ -125,13 +128,13 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor {
throw e;
} catch (Exception ex){
String msg = "Exception in preProcessRequest " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
}
public void prepareUpdateAfterActivateSDNCResource(DelegateExecution execution) {
- msoLogger.info("started prepareUpdateAfterActivateSDNCResource ")
+ logger.info("started prepareUpdateAfterActivateSDNCResource ")
ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(execution.getVariable(Prefix + "resourceInput"), ResourceInput.class)
String operType = resourceInputObj.getOperationType()
@@ -188,7 +191,7 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor {
}
public void prepareSDNCRequest (DelegateExecution execution) {
- msoLogger.info("Started prepareSDNCRequest ")
+ logger.info("Started prepareSDNCRequest ")
try {
// get variables
@@ -397,38 +400,38 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor {
} catch (Exception ex) {
String exceptionMessage = " Bpmn error encountered in CreateSDNCCNetworkResource flow. prepareSDNCRequest() - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
- msoLogger.info(" ***** Exit prepareSDNCRequest *****")
+ logger.info(" ***** Exit prepareSDNCRequest *****")
}
public void postActivateSDNCCall(DelegateExecution execution) {
- msoLogger.info("started postCreateSDNCCall ")
+ logger.info("started postCreateSDNCCall ")
String responseCode = execution.getVariable(Prefix + "sdncCreateReturnCode")
String responseObj = execution.getVariable(Prefix + "SuccessIndicator")
- msoLogger.info("response from sdnc, response code :" + responseCode + " response object :" + responseObj)
+ logger.info("response from sdnc, response code :" + responseCode + " response object :" + responseObj)
}
public void sendSyncResponse(DelegateExecution execution) {
- msoLogger.info("started sendsyncResp")
+ logger.info("started sendsyncResp")
try {
String operationStatus = "finished"
// RESTResponse for main flow
String resourceOperationResp = """{"operationStatus":"${operationStatus}"}""".trim()
- msoLogger.debug(" sendSyncResponse to APIH:" + "\n" + resourceOperationResp)
+ logger.debug(" sendSyncResponse to APIH:" + "\n" + resourceOperationResp)
sendWorkflowResponse(execution, 202, resourceOperationResp)
execution.setVariable("sentSyncResponse", true)
} catch (Exception ex) {
String msg = "Exception in sendSyncResponse:" + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.info("exited send sync Resp")
+ logger.info("exited send sync Resp")
}
-} \ No newline at end of file
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CompareModelofE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CompareModelofE2EServiceInstance.groovy
index 880a44c1b2..608bf66da9 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CompareModelofE2EServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CompareModelofE2EServiceInstance.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2018 Huawei Technologies Co., Ltd. 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
@@ -31,7 +33,8 @@ import org.onap.so.bpmn.common.scripts.VidUtils
import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.bpmn.core.domain.CompareModelsResult
import org.onap.so.bpmn.core.json.JsonUtils
-import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
import groovy.json.*
@@ -52,7 +55,7 @@ import groovy.json.*
* @param - WorkflowException
*/
public class CompareModelofE2EServiceInstance extends AbstractServiceTaskProcessor {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CompareModelofE2EServiceInstance.class);
+ private static final Logger logger = LoggerFactory.getLogger( CompareModelofE2EServiceInstance.class);
String Prefix="CMPMDSI_"
private static final String DebugFlag = "isDebugEnabled"
@@ -65,17 +68,17 @@ public class CompareModelofE2EServiceInstance extends AbstractServiceTaskProcess
execution.setVariable("prefix",Prefix)
String msg = ""
- msoLogger.trace("preProcessRequest Request ")
+ logger.trace("preProcessRequest Request ")
try {
// check for incoming json message/input
String siRequest = execution.getVariable("bpmnRequest")
- msoLogger.debug(siRequest)
+ logger.debug(siRequest)
String requestId = execution.getVariable("mso-request-id")
execution.setVariable("msoRequestId", requestId)
- msoLogger.info("Input Request:" + siRequest + " reqId:" + requestId)
+ logger.info("Input Request:" + siRequest + " reqId:" + requestId)
String serviceInstanceId = execution.getVariable("serviceInstanceId")
if (isBlank(serviceInstanceId)) {
@@ -87,7 +90,7 @@ public class CompareModelofE2EServiceInstance extends AbstractServiceTaskProcess
String globalSubscriberId = jsonUtil.getJsonValue(siRequest, "globalSubscriberId")
if (isBlank(globalSubscriberId)) {
msg = "Input globalSubscriberId' is null"
- utils.log("INFO", msg, isDebugEnabled)
+ logger.info( msg)
} else {
execution.setVariable("globalSubscriberId", globalSubscriberId)
}
@@ -96,7 +99,7 @@ public class CompareModelofE2EServiceInstance extends AbstractServiceTaskProcess
String subscriptionServiceType = jsonUtil.getJsonValue(siRequest, "serviceType")
if (isBlank(subscriptionServiceType)) {
msg = "Input subscriptionServiceType is null"
- utils.log("DEBUG", msg, isDebugEnabled)
+ logger.debug( msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
} else {
execution.setVariable("serviceType", subscriptionServiceType)
@@ -106,7 +109,7 @@ public class CompareModelofE2EServiceInstance extends AbstractServiceTaskProcess
String modelInvariantIdTarget = jsonUtil.getJsonValue(siRequest, "modelInvariantIdTarget")
if (isBlank(modelInvariantIdTarget)) {
msg = "Input modelInvariantIdTarget' is null"
- utils.log("INFO", msg, isDebugEnabled)
+ logger.info( msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
} else {
execution.setVariable("modelInvariantIdTarget", modelInvariantIdTarget)
@@ -116,7 +119,7 @@ public class CompareModelofE2EServiceInstance extends AbstractServiceTaskProcess
String modelVersionIdTarget = jsonUtil.getJsonValue(siRequest, "modelVersionIdTarget")
if (isBlank(modelVersionIdTarget)) {
msg = "Input modelVersionIdTarget is null"
- utils.log("DEBUG", msg, isDebugEnabled)
+ logger.debug( msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
} else {
execution.setVariable("modelVersionIdTarget", modelVersionIdTarget)
@@ -128,32 +131,32 @@ public class CompareModelofE2EServiceInstance extends AbstractServiceTaskProcess
throw e;
} catch (Exception ex){
msg = "Exception in preProcessRequest " + ex.getMessage()
- msoLogger.info(msg)
+ logger.info(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("Exit preProcessRequest ")
+ logger.trace("Exit preProcessRequest ")
}
public void sendSyncResponse (DelegateExecution execution) {
- msoLogger.trace("sendSyncResponse ")
+ logger.trace("sendSyncResponse ")
try {
CompareModelsResult compareModelsResult = execution.getVariable("compareModelsResult")
// RESTResponse (for API Handler(APIH) Reply Task)
String syncResponse = compareModelsResult.toJsonStringNoRootName()
- msoLogger.info(" sendSynchResponse: xmlSyncResponse - " + "\n" + syncResponse)
+ logger.info(" sendSynchResponse: xmlSyncResponse - " + "\n" + syncResponse)
sendWorkflowResponse(execution, 202, syncResponse)
} catch (Exception ex) {
String msg = "Exception in sendSyncResponse: " + ex.getMessage()
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("Exit sendSyncResopnse ")
+ logger.trace("Exit sendSyncResopnse ")
}
public void sendSyncError (DelegateExecution execution) {
- msoLogger.trace("sendSyncError ")
+ logger.trace("sendSyncError ")
try {
String errorMessage = ""
@@ -170,17 +173,17 @@ public class CompareModelofE2EServiceInstance extends AbstractServiceTaskProcess
<aetgt:ErrorCode>7000</aetgt:ErrorCode>
</aetgt:WorkflowException>"""
- msoLogger.debug(buildworkflowException)
+ logger.debug(buildworkflowException)
sendWorkflowResponse(execution, 500, buildworkflowException)
} catch (Exception ex) {
- msoLogger.info(" Sending Sync Error Activity Failed. " + "\n" + ex.getMessage())
+ logger.info(" Sending Sync Error Activity Failed. " + "\n" + ex.getMessage())
}
}
public void prepareCompletionRequest (DelegateExecution execution) {
- msoLogger.trace("prepareCompletion ")
+ logger.trace("prepareCompletion ")
try {
String requestId = execution.getVariable("msoRequestId")
@@ -201,22 +204,22 @@ public class CompareModelofE2EServiceInstance extends AbstractServiceTaskProcess
String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest)
execution.setVariable("completionRequest", xmlMsoCompletionRequest)
- msoLogger.info(" Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest)
+ logger.info(" Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest)
} catch (Exception ex) {
String msg = " Exception in prepareCompletion:" + ex.getMessage()
- msoLogger.info(msg)
+ logger.info(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("Exit prepareCompletionRequest ")
+ logger.trace("Exit prepareCompletionRequest ")
}
public void prepareFalloutRequest(DelegateExecution execution){
- msoLogger.trace("prepareFalloutRequest ")
+ logger.trace("prepareFalloutRequest ")
try {
WorkflowException wfex = execution.getVariable("WorkflowException")
- msoLogger.info(" Input Workflow Exception: " + wfex.toString())
+ logger.info(" Input Workflow Exception: " + wfex.toString())
String requestId = execution.getVariable("msoRequestId")
String source = execution.getVariable("source")
String requestInfo =
@@ -229,7 +232,7 @@ public class CompareModelofE2EServiceInstance extends AbstractServiceTaskProcess
String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo)
execution.setVariable("falloutRequest", falloutRequest)
} catch (Exception ex) {
- msoLogger.info("Exception prepareFalloutRequest:" + ex.getMessage())
+ logger.info("Exception prepareFalloutRequest:" + ex.getMessage())
String errorException = " Bpmn error encountered in CompareModelofE2EServiceInstance flow. FalloutHandlerRequest, buildErrorResponse() - " + ex.getMessage()
String requestId = execution.getVariable("msoRequestId")
String falloutRequest =
@@ -249,7 +252,7 @@ public class CompareModelofE2EServiceInstance extends AbstractServiceTaskProcess
execution.setVariable("falloutRequest", falloutRequest)
}
- msoLogger.trace("Exit prepareFalloutRequest ")
+ logger.trace("Exit prepareFalloutRequest ")
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy
index 05fd517e47..c8b48c6703 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2018 Huawei Technologies Co., Ltd. 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
@@ -47,7 +49,8 @@ import org.onap.so.bpmn.infrastructure.workflow.service.ServicePluginFactory
import java.util.Map
import java.util.UUID
import javax.ws.rs.core.Response
-import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
import org.camunda.bpm.engine.runtime.Execution
import org.camunda.bpm.engine.delegate.BpmnError
@@ -68,19 +71,19 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
JsonUtils jsonUtil = new JsonUtils()
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, Create3rdONAPE2EServiceInstance.class)
+ private static final Logger logger = LoggerFactory.getLogger( Create3rdONAPE2EServiceInstance.class);
public void checkSPPartnerInfo (DelegateExecution execution) {
- msoLogger.info(" ***** Started checkSPPartnerInfo *****")
+ logger.info(" ***** Started checkSPPartnerInfo *****")
try {
//get bpmn inputs from resource request.
String requestId = execution.getVariable("mso-request-id")
String requestAction = execution.getVariable("requestAction")
- msoLogger.info("The requestAction is: " + requestAction)
+ logger.info("The requestAction is: " + requestAction)
String recipeParamsFromRequest = execution.getVariable("recipeParams")
- msoLogger.info("The recipeParams is: " + recipeParamsFromRequest)
+ logger.info("The recipeParams is: " + recipeParamsFromRequest)
String resourceInput = execution.getVariable("resourceInput")
- msoLogger.info("The resourceInput is: " + resourceInput)
+ logger.info("The resourceInput is: " + resourceInput)
//Get ResourceInput Object
ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class)
String resourceInputPrameters = resourceInputObj.getResourceParameters()
@@ -102,7 +105,7 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
else {
is3rdONAPExist = false
String msg = "sppartner Url is blank."
- msoLogger.debug(msg)
+ logger.debug(msg)
}
}
if(inputParameters.has("sppartner_providingServiceUuid"))
@@ -114,7 +117,7 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
else {
is3rdONAPExist = false
String msg = "sppartner providingServiceUuid is blank."
- msoLogger.debug(msg)
+ logger.debug(msg)
}
if(inputParameters.has("sppartner_providingServiceInvariantUuid"))
{
@@ -125,7 +128,7 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
else {
is3rdONAPExist = false
String msg = "sppartner providingServiceInvarianteUuid is blank."
- msoLogger.debug(msg)
+ logger.debug(msg)
}
if(inputParameters.has("sppartner_handoverMode"))
@@ -137,7 +140,7 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
else {
is3rdONAPExist = false
String msg = "sppartner handoverMode is blank."
- msoLogger.debug(msg)
+ logger.debug(msg)
}
execution.setVariable("Is3rdONAPExist", is3rdONAPExist)
@@ -147,13 +150,13 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
} catch (Exception ex){
String msg = "Exception in checkSPPartnerInfo " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
// exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
}
public void checkLocallCall (DelegateExecution execution) {
- msoLogger.info(" ***** Started checkLocallCall *****")
+ logger.info(" ***** Started checkLocallCall *****")
try {
//Get ResourceInput Object
@@ -179,19 +182,19 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
}
}
execution.setVariable(Prefix + "CallSource", callSource)
- msoLogger.debug("callSource is: " + callSource )
+ logger.debug("callSource is: " + callSource )
execution.setVariable("IsLocalCall", isLocalCall)
} catch (Exception ex){
String msg = "Exception in checkLocallCall " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
// exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
}
public void preProcessRequest(DelegateExecution execution){
- msoLogger.info(" ***** Started preProcessRequest *****")
+ logger.info(" ***** Started preProcessRequest *****")
String msg = ""
try {
@@ -200,27 +203,27 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
String globalSubscriberId = resourceInputObj.getGlobalSubscriberId()
if (isBlank(globalSubscriberId)) {
msg = "Input globalSubscriberId is null"
- msoLogger.error(msg)
+ logger.error(msg)
}
//set local variable
execution.setVariable("globalSubscriberId", globalSubscriberId)
- msoLogger.info("globalSubscriberId:" + globalSubscriberId)
+ logger.info("globalSubscriberId:" + globalSubscriberId)
String serviceType = resourceInputObj.getServiceType()
if (isBlank(serviceType)) {
msg = "Input serviceType is null"
- msoLogger.error(msg)
+ logger.error(msg)
}
execution.setVariable("serviceType", serviceType)
- msoLogger.info("serviceType:" + serviceType)
+ logger.info("serviceType:" + serviceType)
String resourceName = resourceInputObj.getResourceInstanceName()
if (isBlank(resourceName)) {
msg = "Input resourceName is null"
- msoLogger.error(msg)
+ logger.error(msg)
}
execution.setVariable("resourceName", resourceName)
- msoLogger.info("resourceName:" + resourceName)
+ logger.info("resourceName:" + resourceName)
int beginIndex = resourceName.indexOf("_") + 1
String serviceInstanceName = resourceName.substring(beginIndex)
@@ -229,44 +232,44 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
String serviceInstanceId = resourceInputObj.getServiceInstanceId()
if (isBlank(serviceInstanceId)) {
msg = "Input serviceInstanceId is null"
- msoLogger.error(msg)
+ logger.error(msg)
}
execution.setVariable(Prefix + "ServiceInstanceId", serviceInstanceId)
- msoLogger.info("serviceInstanceId:" + serviceInstanceId)
+ logger.info("serviceInstanceId:" + serviceInstanceId)
String resourceModelInvariantUuid = resourceInputObj.getResourceModelInfo().getModelInvariantUuid()
if (isBlank(resourceModelInvariantUuid)) {
msg = "Input resourceModelInvariantUuid is null"
- msoLogger.error(msg)
+ logger.error(msg)
}
execution.setVariable(Prefix + "ResourceModelInvariantUuid", resourceModelInvariantUuid)
- msoLogger.info("resourceModelInvariantUuid:" + resourceModelInvariantUuid)
+ logger.info("resourceModelInvariantUuid:" + resourceModelInvariantUuid)
String resourceModelUuid = resourceInputObj.getResourceModelInfo().getModelUuid()
if (isBlank(resourceModelUuid)) {
msg = "Input resourceModelUuid is null"
- msoLogger.error(msg)
+ logger.error(msg)
}
execution.setVariable(Prefix + "ResourceModelUuid", resourceModelUuid)
- msoLogger.info("resourceModelUuid:" + resourceModelUuid)
+ logger.info("resourceModelUuid:" + resourceModelUuid)
String resourceModelCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid()
if (isBlank(resourceModelCustomizationUuid)) {
msg = "Input resourceModelCustomizationUuid is null"
- msoLogger.error(msg)
+ logger.error(msg)
}
execution.setVariable(Prefix + "ResourceModelCustomizationUuid", resourceModelCustomizationUuid)
- msoLogger.info("resourceModelCustomizationUuid:" + resourceModelCustomizationUuid)
+ logger.info("resourceModelCustomizationUuid:" + resourceModelCustomizationUuid)
} catch (Exception ex){
msg = "Exception in preProcessRequest " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
// exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
}
public void prepareUpdateProgress(DelegateExecution execution) {
- msoLogger.info(" ***** Started prepareUpdateProgress *****")
+ logger.info(" ***** Started prepareUpdateProgress *****")
ResourceInput resourceInputObj = execution.getVariable(Prefix + "ResourceInput")
String operType = resourceInputObj.getOperationType()
String resourceCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid()
@@ -295,11 +298,11 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
</soapenv:Envelope>"""
setProgressUpdateVariables(execution, body)
- msoLogger.info(" ***** Exit prepareUpdateProgress *****")
+ logger.info(" ***** Exit prepareUpdateProgress *****")
}
public void allocateCrossONAPResource(DelegateExecution execution) {
- msoLogger.info(" ***** Started allocateCrossONAPResource *****")
+ logger.info(" ***** Started allocateCrossONAPResource *****")
//get TP links from AAI for SOTN handoverMode only
String handoverMode = execution.getVariable(Prefix + "HandoverMode")
@@ -333,15 +336,15 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
execution.setVariable(Prefix + "ServiceParameters", inputParameters)
}
else {
- msoLogger.error("No allocated CrossONAPResource found in ServiceParameters")
+ logger.error("No allocated CrossONAPResource found in ServiceParameters")
}
}
- msoLogger.info("Exit " + allocateCrossONAPResource)
+ logger.info("Exit " + allocateCrossONAPResource)
}
public void prepare3rdONAPRequest(DelegateExecution execution) {
- msoLogger.info(" ***** Started prepare3rdONAPRequest *****")
+ logger.info(" ***** Started prepare3rdONAPRequest *****")
String sppartnerUrl = execution.getVariable(Prefix + "SppartnerUrl")
String extAPIPath = sppartnerUrl + '/serviceOrder'
@@ -416,16 +419,16 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
String payload = externalAPIUtil.setTemplate(ExternalAPIUtil.PostServiceOrderRequestsTemplate, valueMap)
execution.setVariable(Prefix + "Payload", payload)
- msoLogger.info("Exit " + prepare3rdONAPRequest)
+ logger.info("Exit " + prepare3rdONAPRequest)
}
public void doCreateE2ESIin3rdONAP(DelegateExecution execution) {
- msoLogger.info(" ***** Started doCreateE2ESIin3rdONAP *****")
+ logger.info(" ***** Started doCreateE2ESIin3rdONAP *****")
try {
String extAPIPath = execution.getVariable("ExternalAPIURL")
String payload = execution.getVariable(Prefix + "Payload")
- msoLogger.debug("doCreateE2ESIin3rdONAP externalAPIURL is: " + extAPIPath)
- msoLogger.debug("doCreateE2ESIin3rdONAP payload is: " + payload)
+ logger.debug("doCreateE2ESIin3rdONAP externalAPIURL is: " + extAPIPath)
+ logger.debug("doCreateE2ESIin3rdONAP payload is: " + payload)
ExternalAPIUtil externalAPIUtil = new ExternalAPIUtilFactory().create()
execution.setVariable("ServiceOrderId", "")
@@ -434,43 +437,43 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
int responseCode = response.getStatus()
execution.setVariable(Prefix + "PostServiceOrderResponseCode", responseCode)
- msoLogger.debug("Post ServiceOrder response code is: " + responseCode)
+ logger.debug("Post ServiceOrder response code is: " + responseCode)
String extApiResponse = response.readEntity(String.class)
JSONObject responseObj = new JSONObject(extApiResponse)
execution.setVariable(Prefix + "PostServiceOrderResponse", extApiResponse)
- msoLogger.debug("doCreateE2ESIin3rdONAP response body is: " + extApiResponse)
+ logger.debug("doCreateE2ESIin3rdONAP response body is: " + extApiResponse)
//Process Response
if(responseCode == 200 || responseCode == 201 || responseCode == 202 )
//200 OK 201 CREATED 202 ACCEPTED
{
- msoLogger.debug("Post ServiceOrder Received a Good Response")
+ logger.debug("Post ServiceOrder Received a Good Response")
String serviceOrderId = responseObj.get("id")
execution.setVariable(Prefix + "SuccessIndicator", true)
execution.setVariable("ServiceOrderId", serviceOrderId)
- msoLogger.info("Post ServiceOrderid is: " + serviceOrderId)
+ logger.info("Post ServiceOrderid is: " + serviceOrderId)
}
else{
- msoLogger.error("Post ServiceOrder Received a Bad Response Code. Response Code is: " + responseCode)
+ logger.error("Post ServiceOrder Received a Bad Response Code. Response Code is: " + responseCode)
// exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Post ServiceOrder Received a bad response from 3rdONAP External API")
}
}catch(Exception e){
- msoLogger.error("doCreateE2ESIin3rdONAP exception:" + e.getMessage())
+ logger.error("doCreateE2ESIin3rdONAP exception:" + e.getMessage())
}
- msoLogger.info("Exit " + doCreateE2ESIin3rdONAP)
+ logger.info("Exit " + doCreateE2ESIin3rdONAP)
}
public void getE2ESIProgressin3rdONAP(DelegateExecution execution) {
- msoLogger.info(" ***** Started getE2ESIProgressin3rdONAP *****")
+ logger.info(" ***** Started getE2ESIProgressin3rdONAP *****")
try {
String extAPIPath = execution.getVariable("ExternalAPIURL")
extAPIPath += "/" + execution.getVariable("ServiceOrderId")
- msoLogger.debug("getE2ESIProgressin3rdONAP create externalAPIURL is: " + extAPIPath)
+ logger.debug("getE2ESIProgressin3rdONAP create externalAPIURL is: " + extAPIPath)
ExternalAPIUtil externalAPIUtil = new ExternalAPIUtilFactory().create()
@@ -478,18 +481,18 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
int responseCode = response.getStatus()
execution.setVariable(Prefix + "GetServiceOrderResponseCode", responseCode)
- msoLogger.debug("Get ServiceOrder response code is: " + responseCode)
+ logger.debug("Get ServiceOrder response code is: " + responseCode)
String extApiResponse = response.readEntity(String.class)
JSONObject responseObj = new JSONObject(extApiResponse)
execution.setVariable(Prefix + "GetServiceOrderResponse", extApiResponse)
- msoLogger.debug("getE2ESIProgressin3rdONAP create response body is: " + extApiResponse)
+ logger.debug("getE2ESIProgressin3rdONAP create response body is: " + extApiResponse)
//Process Response //200 OK 201 CREATED 202 ACCEPTED
if(responseCode == 200 || responseCode == 201 || responseCode == 202 )
{
- msoLogger.debug("Get Create ServiceOrder Received a Good Response")
+ logger.debug("Get Create ServiceOrder Received a Good Response")
String orderState = responseObj.get("state")
if("REJECTED".equalsIgnoreCase(orderState)) {
@@ -507,7 +510,7 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
execution.setVariable("progress", 100)
execution.setVariable("status", "error")
execution.setVariable("statusDescription", "Create Service Order Status get null sppartnerServiceId")
- msoLogger.error("null sppartnerServiceId while getting progress from externalAPI")
+ logger.error("null sppartnerServiceId while getting progress from externalAPI")
return
}
@@ -545,7 +548,7 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
}
}
else{
- msoLogger.debug("Get ServiceOrder Received a Bad Response Code. Response Code is: " + responseCode)
+ logger.debug("Get ServiceOrder Received a Bad Response Code. Response Code is: " + responseCode)
execution.setVariable("progress", 100)
execution.setVariable("status", "error")
execution.setVariable("statusDescription", "Get Create ServiceOrder Received a bad response")
@@ -556,9 +559,9 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
execution.setVariable("progress", 100)
execution.setVariable("status", "error")
execution.setVariable("statusDescription", "Get Create ServiceOrder Exception")
- msoLogger.error("getE2ESIProgressin3rdONAP exception:" + e.getMessage())
+ logger.error("getE2ESIProgressin3rdONAP exception:" + e.getMessage())
}
- msoLogger.info("Exit " + getE2ESIProgressin3rdONAP)
+ logger.info("Exit " + getE2ESIProgressin3rdONAP)
}
/**
@@ -568,12 +571,12 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
try {
Thread.sleep(5000)
} catch(InterruptedException e) {
- msoLogger.error("Time Delay exception" + e)
+ logger.error("Time Delay exception" + e)
}
}
public void saveSPPartnerInAAI(DelegateExecution execution) {
- msoLogger.info(" ***** Started saveSPPartnerInAAI *****")
+ logger.info(" ***** Started saveSPPartnerInAAI *****")
try {
String sppartnerId = execution.getVariable(Prefix + "SppartnerServiceId")
String sppartnerUrl = execution.getVariable(Prefix + "SppartnerUrl")
@@ -601,10 +604,10 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
client.connect(uri, siUri)
} catch (Exception ex) {
String msg = "Exception in Create3rdONAPE2EServiceInstance.saveSPPartnerInAAI. " + ex.getMessage()
- msoLogger.info(msg)
+ logger.info(msg)
// throw new BpmnError("MSOWorkflowException")
}
- msoLogger.info("Exit " + saveSPPartnerInAAI)
+ logger.info("Exit " + saveSPPartnerInAAI)
}
private void setProgressUpdateVariables(DelegateExecution execution, String body) {
@@ -614,30 +617,30 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
}
public void postProcess(DelegateExecution execution){
- msoLogger.info(" ***** Started postProcess *****")
+ logger.info(" ***** Started postProcess *****")
String responseCode = execution.getVariable(Prefix + "PutSppartnerResponseCode")
String responseObj = execution.getVariable(Prefix + "PutSppartnerResponse")
- msoLogger.info("response from AAI for put sppartner, response code :" + responseCode + " response object :" + responseObj)
- msoLogger.info(" ***** Exit postProcess *****")
+ logger.info("response from AAI for put sppartner, response code :" + responseCode + " response object :" + responseObj)
+ logger.info(" ***** Exit postProcess *****")
}
public void sendSyncResponse (DelegateExecution execution) {
- msoLogger.debug(" *** sendSyncResponse *** ")
+ logger.debug(" *** sendSyncResponse *** ")
try {
String operationStatus = "finished"
// RESTResponse for main flow
String resourceOperationResp = """{"operationStatus":"${operationStatus}"}""".trim()
- msoLogger.debug(" sendSyncResponse to APIH:" + "\n" + resourceOperationResp)
+ logger.debug(" sendSyncResponse to APIH:" + "\n" + resourceOperationResp)
sendWorkflowResponse(execution, 202, resourceOperationResp)
execution.setVariable("sentSyncResponse", true)
} catch (Exception ex) {
String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
// exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.debug(" ***** Exit sendSyncResopnse *****")
+ logger.debug(" ***** Exit sendSyncResopnse *****")
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy
index 02ae6a6f48..0c8477ca20 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy
@@ -5,6 +5,8 @@
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* Copyright (C) 2017 Huawei Technologies Co., Ltd. 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
@@ -34,6 +36,8 @@ import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
import org.springframework.web.util.UriUtils
import groovy.json.*
@@ -47,27 +51,27 @@ public class CreateCustomE2EServiceInstance extends AbstractServiceTaskProcessor
String Prefix="CRESI_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtil = new JsonUtils()
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CreateCustomE2EServiceInstance.class);
+ private static final Logger logger = LoggerFactory.getLogger( CreateCustomE2EServiceInstance.class);
public void preProcessRequest (DelegateExecution execution) {
- msoLogger.trace("start preProcessRequest")
+ logger.trace("start preProcessRequest")
execution.setVariable("prefix",Prefix)
String msg = ""
try {
String siRequest = execution.getVariable("bpmnRequest")
- msoLogger.debug(siRequest)
+ logger.debug(siRequest)
String requestId = execution.getVariable("mso-request-id")
execution.setVariable("msoRequestId", requestId)
- msoLogger.debug("Input Request:" + siRequest + " reqId:" + requestId)
+ logger.debug("Input Request:" + siRequest + " reqId:" + requestId)
String serviceInstanceId = execution.getVariable("serviceInstanceId")
if (isBlank(serviceInstanceId)) {
serviceInstanceId = UUID.randomUUID().toString()
}
- msoLogger.debug("Generated new Service Instance:" + serviceInstanceId)
+ logger.debug("Generated new Service Instance:" + serviceInstanceId)
serviceInstanceId = UriUtils.encode(serviceInstanceId,"UTF-8")
execution.setVariable("serviceInstanceId", serviceInstanceId)
@@ -88,7 +92,7 @@ public class CreateCustomE2EServiceInstance extends AbstractServiceTaskProcessor
if (isBlank(productFamilyId))
{
msg = "Input productFamilyId is null"
- msoLogger.debug(msg)
+ logger.debug(msg)
//exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
} else {
execution.setVariable("productFamilyId", productFamilyId)
@@ -98,20 +102,20 @@ public class CreateCustomE2EServiceInstance extends AbstractServiceTaskProcessor
String serviceModelInfo = jsonUtil.getJsonValue(siRequest, "requestDetails.modelInfo")
if (isBlank(serviceModelInfo)) {
msg = "Input serviceModelInfo is null"
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
} else
{
execution.setVariable("serviceModelInfo", serviceModelInfo)
}
- msoLogger.debug("modelInfo: " + serviceModelInfo)
+ logger.debug("modelInfo: " + serviceModelInfo)
//requestParameters
String subscriptionServiceType = jsonUtil.getJsonValue(siRequest, "requestDetails.requestParameters.subscriptionServiceType")
if (isBlank(subscriptionServiceType)) {
msg = "Input subscriptionServiceType is null"
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
} else {
execution.setVariable("subscriptionServiceType", subscriptionServiceType)
@@ -137,7 +141,7 @@ public class CreateCustomE2EServiceInstance extends AbstractServiceTaskProcessor
}
}
- msoLogger.debug("User Input Parameters map: " + inputMap.toString())
+ logger.debug("User Input Parameters map: " + inputMap.toString())
execution.setVariable("serviceInputParams", inputMap)
execution.setVariable("uuiRequest", inputMap.get("UUIRequest"))
@@ -148,33 +152,33 @@ public class CreateCustomE2EServiceInstance extends AbstractServiceTaskProcessor
throw e;
} catch (Exception ex){
msg = "Exception in preProcessRequest " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("finished preProcessRequest")
+ logger.trace("finished preProcessRequest")
}
public void sendSyncResponse (DelegateExecution execution) {
- msoLogger.trace("start sendSyncResponse")
+ logger.trace("start sendSyncResponse")
try {
String operationId = execution.getVariable("operationId")
String serviceInstanceId = execution.getVariable("serviceInstanceId")
// RESTResponse for API Handler (APIH) Reply Task
String createServiceRestRequest = """{"service":{"serviceId":"${serviceInstanceId}","operationId":"${operationId}"}}""".trim()
- msoLogger.debug(" sendSyncResponse to APIH:" + "\n" + createServiceRestRequest)
+ logger.debug(" sendSyncResponse to APIH:" + "\n" + createServiceRestRequest)
sendWorkflowResponse(execution, 202, createServiceRestRequest)
execution.setVariable("sentSyncResponse", true)
} catch (Exception ex) {
String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("finished sendSyncResponse")
+ logger.trace("finished sendSyncResponse")
}
public void sendSyncError (DelegateExecution execution) {
- msoLogger.trace("start sendSyncError")
+ logger.trace("start sendSyncError")
try {
String errorMessage = ""
if (execution.getVariable("WorkflowException") instanceof WorkflowException) {
@@ -190,17 +194,17 @@ public class CreateCustomE2EServiceInstance extends AbstractServiceTaskProcessor
<aetgt:ErrorCode>7000</aetgt:ErrorCode>
</aetgt:WorkflowException>"""
- msoLogger.debug(buildworkflowException)
+ logger.debug(buildworkflowException)
sendWorkflowResponse(execution, 500, buildworkflowException)
} catch (Exception ex) {
- msoLogger.debug("Sending Sync Error Activity Failed. " + "\n" + ex.getMessage())
+ logger.debug("Sending Sync Error Activity Failed. " + "\n" + ex.getMessage())
}
- msoLogger.trace("finished sendSyncError")
+ logger.trace("finished sendSyncError")
}
public void prepareCompletionRequest (DelegateExecution execution) {
- msoLogger.trace("start prepareCompletionRequest")
+ logger.trace("start prepareCompletionRequest")
try {
String requestId = execution.getVariable("msoRequestId")
String serviceInstanceId = execution.getVariable("serviceInstanceId")
@@ -223,21 +227,21 @@ public class CreateCustomE2EServiceInstance extends AbstractServiceTaskProcessor
String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest)
execution.setVariable("completionRequest", xmlMsoCompletionRequest)
- msoLogger.debug("Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest)
+ logger.debug("Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest)
} catch (Exception ex) {
String msg = " Exception in prepareCompletion:" + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("finished prepareCompletionRequest")
+ logger.trace("finished prepareCompletionRequest")
}
public void prepareFalloutRequest(DelegateExecution execution){
- msoLogger.trace("start prepareFalloutRequest")
+ logger.trace("start prepareFalloutRequest")
try {
WorkflowException wfex = execution.getVariable("WorkflowException")
- msoLogger.debug("Input Workflow Exception: " + wfex.toString())
+ logger.debug("Input Workflow Exception: " + wfex.toString())
String requestId = execution.getVariable("msoRequestId")
String source = execution.getVariable("source")
String requestInfo =
@@ -250,7 +254,7 @@ public class CreateCustomE2EServiceInstance extends AbstractServiceTaskProcessor
String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo)
execution.setVariable("falloutRequest", falloutRequest)
} catch (Exception ex) {
- msoLogger.debug("Exception prepareFalloutRequest:" + ex.getMessage())
+ logger.debug("Exception prepareFalloutRequest:" + ex.getMessage())
String errorException = " Bpmn error encountered in CreateGenericALaCarteServiceInstance flow. FalloutHandlerRequest, buildErrorResponse() - " + ex.getMessage()
String requestId = execution.getVariable("msoRequestId")
String falloutRequest =
@@ -270,14 +274,14 @@ public class CreateCustomE2EServiceInstance extends AbstractServiceTaskProcessor
execution.setVariable("falloutRequest", falloutRequest)
}
- msoLogger.trace("finished prepareFalloutRequest")
+ logger.trace("finished prepareFalloutRequest")
}
/**
* Init the service Operation Status
*/
public void prepareInitServiceOperationStatus(DelegateExecution execution){
- msoLogger.trace("start prepareInitServiceOperationStatus")
+ logger.trace("start prepareInitServiceOperationStatus")
try{
String serviceId = execution.getVariable("serviceInstanceId")
String operationId = UUID.randomUUID().toString()
@@ -287,7 +291,7 @@ public class CreateCustomE2EServiceInstance extends AbstractServiceTaskProcessor
String progress = "0"
String reason = ""
String operationContent = "Prepare service creation"
- msoLogger.debug("Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId)
+ logger.debug("Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId)
serviceId = UriUtils.encode(serviceId,"UTF-8")
execution.setVariable("serviceInstanceId", serviceId)
execution.setVariable("operationId", operationId)
@@ -295,7 +299,7 @@ public class CreateCustomE2EServiceInstance extends AbstractServiceTaskProcessor
def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint",execution)
execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint)
- msoLogger.debug("DB Adapter Endpoint is: " + dbAdapterEndpoint)
+ logger.debug("DB Adapter Endpoint is: " + dbAdapterEndpoint)
String payload =
"""<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
@@ -317,15 +321,16 @@ public class CreateCustomE2EServiceInstance extends AbstractServiceTaskProcessor
payload = utils.formatXml(payload)
execution.setVariable("CVFMI_updateServiceOperStatusRequest", payload)
- msoLogger.debug("Outgoing updateServiceOperStatusRequest: \n" + payload)
- msoLogger.debug("CreateVfModuleInfra Outgoing updateServiceOperStatusRequest Request: " + payload)
+ logger.debug("Outgoing updateServiceOperStatusRequest: \n" + payload)
+ logger.debug("CreateVfModuleInfra Outgoing updateServiceOperStatusRequest Request: " + payload)
}catch(Exception e){
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing prepareInitServiceOperationStatus.", "BPMN", MsoLogger.getServiceName(),
- MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Occured Processing prepareInitServiceOperationStatus.", "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during prepareInitServiceOperationStatus Method:\n" + e.getMessage())
}
- msoLogger.trace("finished prepareInitServiceOperationStatus")
+ logger.trace("finished prepareInitServiceOperationStatus")
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateDeviceResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateDeviceResource.groovy
index 489e77e88e..493af2de6a 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateDeviceResource.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateDeviceResource.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2018 Huawei Technologies Co., Ltd. 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
@@ -36,7 +38,8 @@ import org.onap.so.bpmn.core.domain.VnfResource
import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.builder.AbstractBuilder
-import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils
import java.util.UUID;
@@ -59,21 +62,21 @@ public class CreateDeviceResource extends AbstractServiceTaskProcessor {
JsonUtils jsonUtil = new JsonUtils()
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CreateDeviceResource.class)
+ private static final Logger logger = LoggerFactory.getLogger( CreateDeviceResource.class);
public void preProcessRequest(DelegateExecution execution){
- msoLogger.info(" ***** Started preProcessRequest *****")
+ logger.info(" ***** Started preProcessRequest *****")
String msg = ""
try {
//get bpmn inputs from resource request.
String requestId = execution.getVariable("mso-request-id")
String requestAction = execution.getVariable("requestAction")
- msoLogger.info("The requestAction is: " + requestAction)
+ logger.info("The requestAction is: " + requestAction)
String recipeParamsFromRequest = execution.getVariable("recipeParams")
- msoLogger.info("The recipeParams is: " + recipeParamsFromRequest)
+ logger.info("The recipeParams is: " + recipeParamsFromRequest)
String resourceInput = execution.getVariable("resourceInput")
- msoLogger.info("The resourceInput is: " + resourceInput)
+ logger.info("The resourceInput is: " + resourceInput)
//Get ResourceInput Object
ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class)
execution.setVariable(Prefix + "ResourceInput", resourceInputObj)
@@ -94,47 +97,47 @@ public class CreateDeviceResource extends AbstractServiceTaskProcessor {
String resourceName = resourceInputObj.getResourceInstanceName()
if (isBlank(resourceName)) {
msg = "Input resourceName is null"
- msoLogger.error(msg)
+ logger.error(msg)
}
execution.setVariable("resourceName", resourceName)
- msoLogger.info("resourceName:" + resourceName)
+ logger.info("resourceName:" + resourceName)
String resourceModelInvariantUuid = resourceInputObj.getResourceModelInfo().getModelInvariantUuid()
if (isBlank(resourceModelInvariantUuid)) {
msg = "Input resourceModelInvariantUuid is null"
- msoLogger.error(msg)
+ logger.error(msg)
}
execution.setVariable(Prefix + "ResourceModelInvariantUuid", resourceModelInvariantUuid)
- msoLogger.info("resourceModelInvariantUuid:" + resourceModelInvariantUuid)
+ logger.info("resourceModelInvariantUuid:" + resourceModelInvariantUuid)
String resourceModelUuid = resourceInputObj.getResourceModelInfo().getModelUuid()
if (isBlank(resourceModelUuid)) {
msg = "Input resourceModelUuid is null"
- msoLogger.error(msg)
+ logger.error(msg)
}
execution.setVariable(Prefix + "ResourceModelUuid", resourceModelUuid)
- msoLogger.info("resourceModelUuid:" + resourceModelUuid)
+ logger.info("resourceModelUuid:" + resourceModelUuid)
String resourceModelCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid()
if (isBlank(resourceModelCustomizationUuid)) {
msg = "Input resourceModelCustomizationUuid is null"
- msoLogger.error(msg)
+ logger.error(msg)
}
execution.setVariable(Prefix + "ResourceModelCustomizationUuid", resourceModelCustomizationUuid)
- msoLogger.info("resourceModelCustomizationUuid:" + resourceModelCustomizationUuid)
+ logger.info("resourceModelCustomizationUuid:" + resourceModelCustomizationUuid)
execution.setVariable(Prefix + "serviceInstanceId", resourceInputObj.getServiceInstanceId())
execution.setVariable("mso-request-id", requestId)
} catch (Exception ex){
msg = "Exception in preProcessRequest " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
// exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
}
public void checkDevType(DelegateExecution execution){
- msoLogger.info(" ***** Started checkDevType *****")
+ logger.info(" ***** Started checkDevType *****")
try {
JSONObject resourceInputParameters = execution.getVariable(Prefix + "ResourceRequestInputs")
@@ -148,7 +151,7 @@ public class CreateDeviceResource extends AbstractServiceTaskProcessor {
} catch (Exception ex){
String msg = "Exception in checkDevType " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
// exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
}
@@ -160,7 +163,7 @@ public class CreateDeviceResource extends AbstractServiceTaskProcessor {
}
public void prepareUpdateProgress(DelegateExecution execution) {
- msoLogger.info(" ***** Started prepareUpdateProgress *****")
+ logger.info(" ***** Started prepareUpdateProgress *****")
ResourceInput resourceInputObj = execution.getVariable(Prefix + "ResourceInput")
String operType = resourceInputObj.getOperationType()
String resourceCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid()
@@ -189,25 +192,25 @@ public class CreateDeviceResource extends AbstractServiceTaskProcessor {
</soapenv:Envelope>"""
setProgressUpdateVariables(execution, body)
- msoLogger.info(" ***** Exit prepareUpdateProgress *****")
+ logger.info(" ***** Exit prepareUpdateProgress *****")
}
private void getVNFTemplatefromSDC(DelegateExecution execution){
- msoLogger.info(" ***** Started getVNFTemplatefromSDC *****")
+ logger.info(" ***** Started getVNFTemplatefromSDC *****")
try {
// To do
} catch (Exception ex){
String msg = "Exception in getVNFTemplatefromSDC " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
// exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
}
public void prepareVnfAndModulesCreate(DelegateExecution execution) {
try {
- msoLogger.trace("Inside prepareVnfAndModulesCreate of CreateDeviceResource ")
+ logger.trace("Inside prepareVnfAndModulesCreate of CreateDeviceResource ")
JSONObject resourceInputParameters = execution.getVariable(Prefix + "ResourceRequestInputs")
String devType = resourceInputParameters.get("device_type")
@@ -221,30 +224,30 @@ public class CreateDeviceResource extends AbstractServiceTaskProcessor {
String vnfModelInfoString = null;
if (vnf != null) {
- msoLogger.debug("getting model info for vnf # " + vnfsCreatedCount)
+ logger.debug("getting model info for vnf # " + vnfsCreatedCount)
ModelInfo vnfModelInfo = vnf.getModelInfo()
vnfModelInfoString = vnfModelInfo.toString()
} else {
- msoLogger.debug("vnf is null")
+ logger.debug("vnf is null")
vnfModelInfoString = execution.getVariable("vnfModelInfo")
}
- msoLogger.debug(" vnfModelInfoString :" + vnfModelInfoString)
+ logger.debug(" vnfModelInfoString :" + vnfModelInfoString)
// extract cloud configuration
// String vimId = jsonUtil.getJsonValue(createVcpeServiceRequest,
// "requestDetails.cloudConfiguration.lcpCloudRegionId")
// def cloudRegion = vimId.split("_")
// execution.setVariable("cloudOwner", cloudRegion[0])
-// msoLogger.debug("cloudOwner: "+ cloudRegion[0])
+// logger.debug("cloudOwner: "+ cloudRegion[0])
// execution.setVariable("cloudRegionId", cloudRegion[1])
-// msoLogger.debug("cloudRegionId: "+ cloudRegion[1])
+// logger.debug("cloudRegionId: "+ cloudRegion[1])
// execution.setVariable("lcpCloudRegionId", cloudRegion[1])
-// msoLogger.debug("lcpCloudRegionId: "+ cloudRegion[1])
+// logger.debug("lcpCloudRegionId: "+ cloudRegion[1])
// String tenantId = jsonUtil.getJsonValue(createVcpeServiceRequest,
// "requestDetails.cloudConfiguration.tenantId")
// execution.setVariable("tenantId", tenantId)
-// msoLogger.debug("tenantId: " + tenantId)
+// logger.debug("tenantId: " + tenantId)
execution.setVariable("cloudOwner", "")
@@ -256,13 +259,13 @@ public class CreateDeviceResource extends AbstractServiceTaskProcessor {
execution.setVariable("tenantId", "")
String sdncVersion = execution.getVariable("sdncVersion")
- msoLogger.debug("sdncVersion: " + sdncVersion)
+ logger.debug("sdncVersion: " + sdncVersion)
- msoLogger.trace("Completed prepareVnfAndModulesCreate of CreateVcpeResCustService ")
+ logger.trace("Completed prepareVnfAndModulesCreate of CreateVcpeResCustService ")
} catch (Exception ex) {
// try error in method block
String exceptionMessage = "Bpmn error encountered in CreateDeviceResource flow. Unexpected Error from method prepareVnfAndModulesCreate() - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
}
}
@@ -272,7 +275,7 @@ public class CreateDeviceResource extends AbstractServiceTaskProcessor {
public void validateVnfCreate(DelegateExecution execution) {
try {
- msoLogger.trace("Inside validateVnfCreate of CreateDeviceResource ")
+ logger.trace("Inside validateVnfCreate of CreateDeviceResource ")
//Update Relationship between VNF to Device
addVNFAAIRelationShip(execution)
@@ -282,45 +285,45 @@ public class CreateDeviceResource extends AbstractServiceTaskProcessor {
execution.setVariable(Prefix + "VnfsCreatedCount", vnfsCreatedCount)
- msoLogger.debug(" ***** Completed validateVnfCreate of CreateDeviceResource ***** " + " vnf # " + vnfsCreatedCount)
+ logger.debug(" ***** Completed validateVnfCreate of CreateDeviceResource ***** " + " vnf # " + vnfsCreatedCount)
} catch (Exception ex) {
// try error in method block
String exceptionMessage = "Bpmn error encountered in CreateDeviceResource flow. Unexpected Error from method validateVnfCreate() - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
}
}
public void addVNFAAIRelationShip(DelegateExecution execution) {
try {
- msoLogger.trace("Inside addVNFAAIRelationShip of CreateDeviceResource ")
+ logger.trace("Inside addVNFAAIRelationShip of CreateDeviceResource ")
- msoLogger.debug(" ***** Completed addVNFAAIRelationShip of CreateDeviceResource ***** ")
+ logger.debug(" ***** Completed addVNFAAIRelationShip of CreateDeviceResource ***** ")
} catch (Exception ex) {
// try error in method block
String exceptionMessage = "Bpmn error encountered in CreateDeviceResource flow. Unexpected Error from method addVNFAAIRelationShip() - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
}
}
public void sendSyncResponse (DelegateExecution execution) {
- msoLogger.debug(" *** sendSyncResponse *** ")
+ logger.debug(" *** sendSyncResponse *** ")
try {
String operationStatus = "finished"
// RESTResponse for main flow
String resourceOperationResp = """{"operationStatus":"${operationStatus}"}""".trim()
- msoLogger.debug(" sendSyncResponse to APIH:" + "\n" + resourceOperationResp)
+ logger.debug(" sendSyncResponse to APIH:" + "\n" + resourceOperationResp)
sendWorkflowResponse(execution, 202, resourceOperationResp)
execution.setVariable("sentSyncResponse", true)
} catch (Exception ex) {
String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
// exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- utils.log("DEBUG"," ***** Exit sendSyncResopnse *****")
+ logger.debug(" ***** Exit sendSyncResopnse *****")
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateGenericALaCarteServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateGenericALaCarteServiceInstance.groovy
index 848785e5f3..6f5f5b3290 100755
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateGenericALaCarteServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateGenericALaCarteServiceInstance.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -35,7 +37,8 @@ import org.onap.so.bpmn.common.scripts.MsoUtils
import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.bpmn.core.domain.ServiceDecomposition
import org.onap.so.bpmn.core.json.JsonUtils
-import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
import org.springframework.web.util.UriUtils
import groovy.json.*
@@ -49,7 +52,7 @@ public class CreateGenericALaCarteServiceInstance extends AbstractServiceTaskPro
String Prefix="CRESI_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtil = new JsonUtils()
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CreateGenericALaCarteServiceInstance.class);
+ private static final Logger logger = LoggerFactory.getLogger( CreateGenericALaCarteServiceInstance.class);
public void preProcessRequest (DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
@@ -59,18 +62,18 @@ public class CreateGenericALaCarteServiceInstance extends AbstractServiceTaskPro
try {
String siRequest = execution.getVariable("bpmnRequest")
- msoLogger.debug(siRequest)
+ logger.debug(siRequest)
String requestId = execution.getVariable("mso-request-id")
execution.setVariable("msoRequestId", requestId)
- msoLogger.debug("Input Request:" + siRequest + " reqId:" + requestId)
+ logger.debug("Input Request:" + siRequest + " reqId:" + requestId)
String serviceInstanceId = execution.getVariable("serviceInstanceId")
if (isBlank(serviceInstanceId)) {
serviceInstanceId = UUID.randomUUID().toString()
- msoLogger.debug("Generated new Service Instance ID:" + serviceInstanceId)
+ logger.debug("Generated new Service Instance ID:" + serviceInstanceId)
} else {
- msoLogger.debug("Using provided Service Instance ID:" + serviceInstanceId)
+ logger.debug("Using provided Service Instance ID:" + serviceInstanceId)
}
serviceInstanceId = UriUtils.encode(serviceInstanceId,"UTF-8")
@@ -98,7 +101,7 @@ public class CreateGenericALaCarteServiceInstance extends AbstractServiceTaskPro
if (isBlank(productFamilyId))
{
msg = "Input productFamilyId is null"
- msoLogger.debug(msg)
+ logger.debug(msg)
//exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
} else {
execution.setVariable("productFamilyId", productFamilyId)
@@ -108,20 +111,20 @@ public class CreateGenericALaCarteServiceInstance extends AbstractServiceTaskPro
String serviceModelInfo = jsonUtil.getJsonValue(siRequest, "requestDetails.modelInfo")
if (isBlank(serviceModelInfo)) {
msg = "Input serviceModelInfo is null"
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
} else
{
execution.setVariable("serviceModelInfo", serviceModelInfo)
}
- msoLogger.debug("modelInfo" + serviceModelInfo)
+ logger.debug("modelInfo" + serviceModelInfo)
//requestParameters
String subscriptionServiceType = jsonUtil.getJsonValue(siRequest, "requestDetails.requestParameters.subscriptionServiceType")
if (isBlank(subscriptionServiceType)) {
msg = "Input subscriptionServiceType is null"
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
} else {
execution.setVariable("subscriptionServiceType", subscriptionServiceType)
@@ -144,7 +147,7 @@ public class CreateGenericALaCarteServiceInstance extends AbstractServiceTaskPro
userParams.each {
userParam ->
if ("Customer_Location".equals(userParam?.name)) {
- msoLogger.debug("User Input customerLocation: " + userParam.value.toString())
+ logger.debug("User Input customerLocation: " + userParam.value.toString())
Map<String, String> customerMap = [:]
userParam.value.each {
param ->
@@ -155,14 +158,14 @@ public class CreateGenericALaCarteServiceInstance extends AbstractServiceTaskPro
execution.setVariable("customerLocation", customerMap)
}
if ("Homing_Solution".equals(userParam?.name)) {
- msoLogger.debug("User Input Homing_Solution: " + userParam.value.toString())
+ logger.debug("User Input Homing_Solution: " + userParam.value.toString())
execution.setVariable("homingService", userParam.value)
execution.setVariable("callHoming", true)
inputMap.put("Homing_Solution", userParam.value)
}
if (!"Homing_Solution".equals(userParam?.name) && !"Customer_Location".equals(userParam?.name))
{
- msoLogger.debug("User Input Parameter " + userParam.name + ": " + userParam.value.toString())
+ logger.debug("User Input Parameter " + userParam.name + ": " + userParam.value.toString())
inputMap.put(userParam.name, userParam.value)
}
if ("Orchestrator".equalsIgnoreCase(userParam?.name)) {
@@ -172,8 +175,8 @@ public class CreateGenericALaCarteServiceInstance extends AbstractServiceTaskPro
}
}
- msoLogger.debug("User Input Parameters map: " + userParams.toString())
- msoLogger.debug("User Input Map: " + inputMap.toString())
+ logger.debug("User Input Parameters map: " + userParams.toString())
+ logger.debug("User Input Map: " + inputMap.toString())
if (inputMap.toString() != "[:]") {
execution.setVariable("serviceInputParams", inputMap)
}
@@ -185,37 +188,37 @@ public class CreateGenericALaCarteServiceInstance extends AbstractServiceTaskPro
throw e;
} catch (Exception ex){
msg = "Exception in preProcessRequest " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("Exit preProcessRequest")
+ logger.trace("Exit preProcessRequest")
}
public void sendSyncResponse (DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- msoLogger.trace("Start sendSyncResponse")
+ logger.trace("Start sendSyncResponse")
try {
String requestId = execution.getVariable("msoRequestId")
String serviceInstanceId = execution.getVariable("serviceInstanceId")
// RESTResponse for API Handler (APIH) Reply Task
String createServiceRestRequest = """{"requestReferences":{"instanceId":"${serviceInstanceId}","requestId":"${requestId}"}}""".trim()
- msoLogger.debug(" sendSyncResponse to APIH:" + "\n" + createServiceRestRequest)
+ logger.debug(" sendSyncResponse to APIH:" + "\n" + createServiceRestRequest)
sendWorkflowResponse(execution, 202, createServiceRestRequest)
execution.setVariable("sentSyncResponse", true)
} catch (Exception ex) {
String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("Exit sendSyncResopnse")
+ logger.trace("Exit sendSyncResopnse")
}
public void sendSyncError (DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- msoLogger.trace("Start sendSyncError")
+ logger.trace("Start sendSyncError")
try {
String errorMessage = ""
@@ -232,11 +235,11 @@ public class CreateGenericALaCarteServiceInstance extends AbstractServiceTaskPro
<aetgt:ErrorCode>7000</aetgt:ErrorCode>
</aetgt:WorkflowException>"""
- msoLogger.debug(buildworkflowException)
+ logger.debug(buildworkflowException)
sendWorkflowResponse(execution, 500, buildworkflowException)
} catch (Exception ex) {
- msoLogger.debug(" Sending Sync Error Activity Failed. " + "\n" + ex.getMessage())
+ logger.debug(" Sending Sync Error Activity Failed. " + "\n" + ex.getMessage())
}
}
@@ -246,7 +249,7 @@ public class CreateGenericALaCarteServiceInstance extends AbstractServiceTaskPro
// *******************************
public void prepareDecomposeService(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- msoLogger.trace("Inside prepareDecomposeService of CreateGenericALaCarteServiceInstance ")
+ logger.trace("Inside prepareDecomposeService of CreateGenericALaCarteServiceInstance ")
try {
String siRequest = execution.getVariable("bpmnRequest")
String serviceModelInfo = jsonUtil.getJsonValue(siRequest, "requestDetails.modelInfo")
@@ -256,13 +259,13 @@ public class CreateGenericALaCarteServiceInstance extends AbstractServiceTaskPro
String exceptionMessage = "Bpmn error encountered in CreateGenericALaCarteServiceInstance flow. Unexpected Error from method prepareDecomposeService() - " + ex.getMessage()
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
- msoLogger.trace("Completed prepareDecomposeService of CreateGenericALaCarteServiceInstance")
+ logger.trace("Completed prepareDecomposeService of CreateGenericALaCarteServiceInstance")
}
public void processDecomposition(DelegateExecution execution) {
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
- msoLogger.trace("Inside processDecomposition() of CreateGenericALaCarteServiceInstance ")
+ logger.trace("Inside processDecomposition() of CreateGenericALaCarteServiceInstance ")
try {
@@ -278,7 +281,7 @@ public class CreateGenericALaCarteServiceInstance extends AbstractServiceTaskPro
String vnfModelInfoString = ""
if (vnfList != null && vnfList.size() > 0) {
execution.setVariable(Prefix + "VNFsCount", vnfList.size())
- msoLogger.debug("vnfs to create: " + vnfList.size())
+ logger.debug("vnfs to create: " + vnfList.size())
ModelInfo vnfModelInfo = vnfList[0].getModelInfo()
vnfModelInfoString = vnfModelInfo.toString()
@@ -286,18 +289,18 @@ public class CreateGenericALaCarteServiceInstance extends AbstractServiceTaskPro
vnfModelInfoString = jsonUtil.getJsonValue(vnfModelInfoWithRoot, "modelInfo")
} else {
execution.setVariable(Prefix + "VNFsCount", 0)
- msoLogger.debug("no vnfs to create based upon serviceDecomposition content")
+ logger.debug("no vnfs to create based upon serviceDecomposition content")
}
execution.setVariable("vnfModelInfo", vnfModelInfoString)
execution.setVariable("vnfModelInfoString", vnfModelInfoString)
- msoLogger.debug(" vnfModelInfoString :" + vnfModelInfoString)
+ logger.debug(" vnfModelInfoString :" + vnfModelInfoString)
- msoLogger.trace("Completed processDecomposition() of CreateGenericALaCarteServiceInstance ")
+ logger.trace("Completed processDecomposition() of CreateGenericALaCarteServiceInstance ")
} catch (Exception ex) {
sendSyncError(execution)
String exceptionMessage = "Bpmn error encountered in CreateGenericALaCarteServiceInstance flow. processDecomposition() - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
}
@@ -309,7 +312,7 @@ public class CreateGenericALaCarteServiceInstance extends AbstractServiceTaskPro
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
try {
- msoLogger.trace("Inside prepareCreateServiceInstance of CreateGenericALaCarteServiceInstance")
+ logger.trace("Inside prepareCreateServiceInstance of CreateGenericALaCarteServiceInstance")
/*
* Extracting User Parameters from incoming Request and converting into a Map
@@ -327,7 +330,7 @@ public class CreateGenericALaCarteServiceInstance extends AbstractServiceTaskPro
userParams.each {
userParam ->
if ("Customer_Location".equals(userParam?.name)) {
- msoLogger.debug("User Input customerLocation: " + userParam.value.toString())
+ logger.debug("User Input customerLocation: " + userParam.value.toString())
Map<String, String> customerMap = [:]
userParam.value.each {
param ->
@@ -338,14 +341,14 @@ public class CreateGenericALaCarteServiceInstance extends AbstractServiceTaskPro
execution.setVariable("customerLocation", customerMap)
}
if ("Homing_Solution".equals(userParam?.name)) {
- msoLogger.debug("User Input Homing_Solution: " + userParam.value.toString())
+ logger.debug("User Input Homing_Solution: " + userParam.value.toString())
execution.setVariable("homingService", userParam.value)
execution.setVariable("callHoming", true)
inputMap.put("Homing_Solution", userParam.value)
}
if (!"Homing_Solution".equals(userParam?.name) && !"Customer_Location".equals(userParam?.name))
{
- msoLogger.debug("User Input Parameter " + userParam.name + ": " + userParam.value.toString())
+ logger.debug("User Input Parameter " + userParam.name + ": " + userParam.value.toString())
inputMap.put(userParam.name, userParam.value)
}
if ("Orchestrator".equalsIgnoreCase(userParam?.name)) {
@@ -355,8 +358,8 @@ public class CreateGenericALaCarteServiceInstance extends AbstractServiceTaskPro
}
}
- msoLogger.debug("User Input Parameters map: " + userParams.toString())
- msoLogger.debug("User Input Map: " + inputMap.toString())
+ logger.debug("User Input Parameters map: " + userParams.toString())
+ logger.debug("User Input Map: " + inputMap.toString())
if (inputMap.toString() != "[:]") {
execution.setVariable("serviceInputParams", inputMap)
}
@@ -370,9 +373,9 @@ public class CreateGenericALaCarteServiceInstance extends AbstractServiceTaskPro
execution.setVariable("serviceInstanceName", serviceInstanceName)
execution.setVariable("serviceDecomposition", serviceDecomposition)
execution.setVariable("serviceDecompositionString", serviceDecomposition.toJsonString())
- msoLogger.debug("serviceDecomposition.serviceInstanceName: " + serviceDecomposition.getServiceInstance().getInstanceName())
+ logger.debug("serviceDecomposition.serviceInstanceName: " + serviceDecomposition.getServiceInstance().getInstanceName())
- msoLogger.trace("Completed prepareCreateServiceInstance of CreateGenericALaCarteServiceInstance ***** ")
+ logger.trace("Completed prepareCreateServiceInstance of CreateGenericALaCarteServiceInstance ***** ")
} catch (Exception ex) {
// try error in method block
String exceptionMessage = "Bpmn error encountered in CreateGenericALaCarteServiceInstance flow. Unexpected Error from method prepareCreateServiceInstance() - " + ex.getMessage()
@@ -383,7 +386,7 @@ public class CreateGenericALaCarteServiceInstance extends AbstractServiceTaskPro
public void prepareCompletionRequest (DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- msoLogger.trace("prepareCompletion *** ")
+ logger.trace("prepareCompletion *** ")
try {
String requestId = execution.getVariable("msoRequestId")
@@ -407,23 +410,23 @@ public class CreateGenericALaCarteServiceInstance extends AbstractServiceTaskPro
String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest)
execution.setVariable("completionRequest", xmlMsoCompletionRequest)
- msoLogger.debug(" Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest)
+ logger.debug(" Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest)
} catch (Exception ex) {
String msg = " Exception in prepareCompletion:" + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("Exit prepareCompletionRequest")
+ logger.trace("Exit prepareCompletionRequest")
}
public void prepareFalloutRequest(DelegateExecution execution){
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- msoLogger.trace("prepareFalloutRequest")
+ logger.trace("prepareFalloutRequest")
try {
WorkflowException wfex = execution.getVariable("WorkflowException")
- msoLogger.debug(" Input Workflow Exception: " + wfex.toString())
+ logger.debug(" Input Workflow Exception: " + wfex.toString())
String requestId = execution.getVariable("msoRequestId")
String source = execution.getVariable("source")
String requestInfo =
@@ -436,7 +439,7 @@ public class CreateGenericALaCarteServiceInstance extends AbstractServiceTaskPro
String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo)
execution.setVariable("falloutRequest", falloutRequest)
} catch (Exception ex) {
- msoLogger.debug("Exception prepareFalloutRequest:" + ex.getMessage())
+ logger.debug("Exception prepareFalloutRequest:" + ex.getMessage())
String errorException = " Bpmn error encountered in CreateGenericALaCarteServiceInstance flow. FalloutHandlerRequest, buildErrorResponse() - " + ex.getMessage()
String requestId = execution.getVariable("msoRequestId")
String falloutRequest =
@@ -456,6 +459,6 @@ public class CreateGenericALaCarteServiceInstance extends AbstractServiceTaskPro
execution.setVariable("falloutRequest", falloutRequest)
}
- msoLogger.trace("Exit prepareFalloutRequest")
+ logger.trace("Exit prepareFalloutRequest")
}
-} \ No newline at end of file
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateNetworkInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateNetworkInstance.groovy
index bdb44ca3e2..16f7d53087 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateNetworkInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateNetworkInstance.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -29,6 +31,8 @@ import org.onap.so.bpmn.common.scripts.MsoUtils
import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
import groovy.json.*
@@ -37,7 +41,7 @@ import groovy.json.*
*
*/
public class CreateNetworkInstance extends AbstractServiceTaskProcessor {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CreateNetworkInstance.class);
+ private static final Logger logger = LoggerFactory.getLogger( CreateNetworkInstance.class);
String Prefix="CRENI_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
@@ -71,7 +75,7 @@ public class CreateNetworkInstance extends AbstractServiceTaskProcessor {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix",Prefix)
- msoLogger.trace("Start preProcessRequest")
+ logger.trace("Start preProcessRequest")
try {
// initialize flow variables
@@ -87,20 +91,20 @@ public class CreateNetworkInstance extends AbstractServiceTaskProcessor {
String disableRollback = jsonUtil.getJsonValue(bpmnRequest, "requestDetails.requestInfo.suppressRollback")
if (disableRollback != null) {
execution.setVariable("disableRollback", disableRollback)
- msoLogger.debug("Received 'suppressRollback': " + disableRollback )
+ logger.debug("Received 'suppressRollback': " + disableRollback )
} else {
execution.setVariable("disableRollback", false)
}
- msoLogger.debug(" Set 'disableRollback' : " + execution.getVariable("disableRollback") )
+ logger.debug(" Set 'disableRollback' : " + execution.getVariable("disableRollback") )
} else {
String dataErrorMessage = " Invalid 'bpmnRequest' request."
- msoLogger.debug(dataErrorMessage)
+ logger.debug(dataErrorMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage)
}
} else {
// 'macro' TEST ONLY, sdncVersion = '1702'
- msoLogger.debug(" 'disableRollback' : " + execution.getVariable("disableRollback") )
+ logger.debug(" 'disableRollback' : " + execution.getVariable("disableRollback") )
}
// get/set 'msoRequestId' and 'mso-request-id'
@@ -146,7 +150,7 @@ public class CreateNetworkInstance extends AbstractServiceTaskProcessor {
sendSyncError(execution)
// caught exception
String exceptionMessage = "Exception Encountered in CreateNetworkInstance, PreProcessRequest() - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
@@ -156,7 +160,7 @@ public class CreateNetworkInstance extends AbstractServiceTaskProcessor {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix",Prefix)
- msoLogger.trace("Start sendSyncResponse")
+ logger.trace("Start sendSyncResponse")
try {
String requestId = execution.getVariable("mso-request-id")
@@ -164,12 +168,12 @@ public class CreateNetworkInstance extends AbstractServiceTaskProcessor {
// RESTResponse (for API Handler (APIH) Reply Task)
String createNetworkRestRequest = """{"requestReferences":{"instanceId":"","requestId":"${requestId}"}}""".trim()
- msoLogger.debug(" sendSyncResponse to APIH - " + "\n" + createNetworkRestRequest)
+ logger.debug(" sendSyncResponse to APIH - " + "\n" + createNetworkRestRequest)
sendWorkflowResponse(execution, 202, createNetworkRestRequest)
} catch (Exception ex) {
String exceptionMessage = "Bpmn error encountered in CreateNetworkInstance flow. sendSyncResponse() - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
@@ -180,7 +184,7 @@ public class CreateNetworkInstance extends AbstractServiceTaskProcessor {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix", Prefix)
- msoLogger.trace("Start getNetworkModelInfo")
+ logger.trace("Start getNetworkModelInfo")
try {
@@ -193,7 +197,7 @@ public class CreateNetworkInstance extends AbstractServiceTaskProcessor {
} catch (Exception ex) {
sendSyncError(execution)
String exceptionMessage = "Bpmn error encountered in CreateNetworkInstance flow. getNetworkModelInfo() - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
@@ -205,7 +209,7 @@ public class CreateNetworkInstance extends AbstractServiceTaskProcessor {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix", Prefix)
- msoLogger.trace("Start sendSyncError")
+ logger.trace("Start sendSyncError")
try {
@@ -217,7 +221,7 @@ public class CreateNetworkInstance extends AbstractServiceTaskProcessor {
sendWorkflowResponse(execution, 500, syncError)
} catch (Exception ex) {
- msoLogger.debug(" Bpmn error encountered in CreateNetworkInstance flow. sendSyncError() - " + ex.getMessage())
+ logger.debug(" Bpmn error encountered in CreateNetworkInstance flow. sendSyncError() - " + ex.getMessage())
}
}
@@ -227,7 +231,7 @@ public class CreateNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable("prefix",Prefix)
try {
- msoLogger.trace("Start prepareDBRequestError")
+ logger.trace("Start prepareDBRequestError")
// set DB Header Authorization
setBasicDBAuthHeader(execution, isDebugEnabled)
@@ -258,12 +262,12 @@ public class CreateNetworkInstance extends AbstractServiceTaskProcessor {
</soapenv:Envelope>"""
execution.setVariable(Prefix + "createDBRequest", dbRequest)
- msoLogger.debug(" DB Adapter Request - " + "\n" + dbRequest)
- msoLogger.debug(dbRequest)
+ logger.debug(" DB Adapter Request - " + "\n" + dbRequest)
+ logger.debug(dbRequest)
} catch (Exception ex) {
String exceptionMessage = " Bpmn error encountered in CreateNetworkInstance flow. prepareDBRequestError() - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage)
}
@@ -274,7 +278,7 @@ public class CreateNetworkInstance extends AbstractServiceTaskProcessor {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix",Prefix)
- msoLogger.trace("Start prepareCompletion")
+ logger.trace("Start prepareCompletion")
try {
@@ -301,11 +305,11 @@ public class CreateNetworkInstance extends AbstractServiceTaskProcessor {
// normal path
execution.setVariable(Prefix + "Success", true)
execution.setVariable(Prefix + "CompleteMsoProcessRequest", xmlMsoCompletionRequest)
- msoLogger.debug(" Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest)
+ logger.debug(" Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest)
} catch (Exception ex) {
String exceptionMessage = " Bpmn error encountered in CreateNetworkInstance flow. prepareCompletion() - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
@@ -324,25 +328,25 @@ public class CreateNetworkInstance extends AbstractServiceTaskProcessor {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix", Prefix)
- msoLogger.trace("Start postProcessResponse")
+ logger.trace("Start postProcessResponse")
try {
if (execution.getVariable("CMSO_ResponseCode") == "200") {
execution.setVariable(Prefix + "Success", true)
- msoLogger.trace("CreateNetworkInstance Success ****")
+ logger.trace("CreateNetworkInstance Success ****")
// Place holder for additional code.
} else {
execution.setVariable(Prefix + "Success", false)
- msoLogger.trace("CreateNetworkInstance Failed in CompletionMsoProces flow!. ****")
+ logger.trace("CreateNetworkInstance Failed in CompletionMsoProces flow!. ****")
}
} catch (Exception ex) {
String exceptionMessage = " Bpmn error encountered in CreateNetworkInstance flow. postProcessResponse() - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
@@ -358,7 +362,7 @@ public class CreateNetworkInstance extends AbstractServiceTaskProcessor {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix", Prefix)
- msoLogger.trace("Start processRollbackData")
+ logger.trace("Start processRollbackData")
try {
//execution.getVariable("orchestrationStatus")
@@ -369,7 +373,7 @@ public class CreateNetworkInstance extends AbstractServiceTaskProcessor {
//rolledBack
} catch (Exception ex) {
- msoLogger.debug(" Bpmn error encountered in CreateNetworkInstance flow. callDBCatalog() - " + ex.getMessage())
+ logger.debug(" Bpmn error encountered in CreateNetworkInstance flow. callDBCatalog() - " + ex.getMessage())
}
}
@@ -379,10 +383,10 @@ public class CreateNetworkInstance extends AbstractServiceTaskProcessor {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix", Prefix)
- msoLogger.debug("DB updateInfraRequest ResponseCode: " + execution.getVariable(Prefix + "dbReturnCode"))
- msoLogger.debug("DB updateInfraRequest Response: " + execution.getVariable(Prefix + "createDBResponse"))
+ logger.debug("DB updateInfraRequest ResponseCode: " + execution.getVariable(Prefix + "dbReturnCode"))
+ logger.debug("DB updateInfraRequest Response: " + execution.getVariable(Prefix + "createDBResponse"))
- msoLogger.trace("Prepare for FalloutHandler. FAILURE - prepare request for sub-process FalloutHandler.")
+ logger.trace("Prepare for FalloutHandler. FAILURE - prepare request for sub-process FalloutHandler.")
String falloutHandlerRequest = ""
String requestId = execution.getVariable("mso-request-id")
@@ -407,13 +411,13 @@ public class CreateNetworkInstance extends AbstractServiceTaskProcessor {
</aetgt:WorkflowException>
</aetgt:FalloutHandlerRequest>"""
- msoLogger.debug(falloutHandlerRequest)
+ logger.debug(falloutHandlerRequest)
execution.setVariable(Prefix + "FalloutHandlerRequest", falloutHandlerRequest)
- msoLogger.debug(" Overall Error Response going to FalloutHandler: " + "\n" + falloutHandlerRequest)
+ logger.debug(" Overall Error Response going to FalloutHandler: " + "\n" + falloutHandlerRequest)
} catch (Exception ex) {
String errorException = " Bpmn error encountered in CreateNetworkInstance flow. FalloutHandlerRequest, buildErrorResponse()"
- msoLogger.debug("Exception error in CreateNetworkInstance flow, buildErrorResponse(): " + ex.getMessage())
+ logger.debug("Exception error in CreateNetworkInstance flow, buildErrorResponse(): " + ex.getMessage())
falloutHandlerRequest =
"""<aetgt:FalloutHandlerRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
xmlns:ns="http://org.onap/so/request/types/v1"
@@ -430,7 +434,7 @@ public class CreateNetworkInstance extends AbstractServiceTaskProcessor {
</aetgt:FalloutHandlerRequest>"""
execution.setVariable(Prefix + "FalloutHandlerRequest", falloutHandlerRequest)
- msoLogger.debug(" Overall Error Response going to FalloutHandler: " + "\n" + falloutHandlerRequest)
+ logger.debug(" Overall Error Response going to FalloutHandler: " + "\n" + falloutHandlerRequest)
}
@@ -440,18 +444,18 @@ public class CreateNetworkInstance extends AbstractServiceTaskProcessor {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix",Prefix)
try{
- msoLogger.debug("Caught a Java Exception in " + Prefix)
- msoLogger.debug("Started processJavaException Method")
- msoLogger.debug("Variables List: " + execution.getVariables())
+ logger.debug("Caught a Java Exception in " + Prefix)
+ logger.debug("Started processJavaException Method")
+ logger.debug("Variables List: " + execution.getVariables())
execution.setVariable("UnexpectedError", "Caught a Java Lang Exception - " + Prefix) // Adding this line temporarily until this flows error handling gets updated
exceptionUtil.buildWorkflowException(execution, 500, "Caught a Java Lang Exception")
}catch(Exception e){
- msoLogger.debug("Caught Exception during processJavaException Method: " + e)
+ logger.debug("Caught Exception during processJavaException Method: " + e)
execution.setVariable("UnexpectedError", "Exception in processJavaException method - " + Prefix) // Adding this line temporarily until this flows error handling gets updated
exceptionUtil.buildWorkflowException(execution, 500, "Exception in processJavaException method" + Prefix)
}
- msoLogger.debug("Completed processJavaException Method in " + Prefix)
+ logger.debug("Completed processJavaException Method in " + Prefix)
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy
index 9301f3d508..bb2116acb9 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2018 Huawei Technologies Co., Ltd. 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
@@ -39,7 +41,8 @@ import org.onap.so.client.aai.AAIObjectPlurals
import org.onap.so.client.aai.AAIResourcesClient
import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
-import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
import static org.apache.commons.lang3.StringUtils.*
@@ -49,7 +52,7 @@ import static org.apache.commons.lang3.StringUtils.*
*/
public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CreateSDNCNetworkResource.class);
+ private static final Logger logger = LoggerFactory.getLogger( CreateSDNCNetworkResource.class);
String Prefix="CRESDNCRES_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
@@ -60,17 +63,17 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
public void preProcessRequest(DelegateExecution execution){
- msoLogger.info(" ***** Started preProcessRequest *****")
+ logger.info(" ***** Started preProcessRequest *****")
try {
//get bpmn inputs from resource request.
String requestId = execution.getVariable("mso-request-id")
String requestAction = execution.getVariable("requestAction")
- msoLogger.info("The requestAction is: " + requestAction)
+ logger.info("The requestAction is: " + requestAction)
String recipeParamsFromRequest = execution.getVariable("recipeParams")
- msoLogger.info("The recipeParams is: " + recipeParamsFromRequest)
+ logger.info("The recipeParams is: " + recipeParamsFromRequest)
String resourceInput = execution.getVariable("resourceInput")
- msoLogger.info("The resourceInput is: " + resourceInput)
+ logger.info("The resourceInput is: " + resourceInput)
//Get ResourceInput Object
ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class)
execution.setVariable(Prefix + "resourceInput", resourceInputObj.toString())
@@ -158,7 +161,7 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
throw e;
} catch (Exception ex){
msg = "Exception in preProcessRequest " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
}
@@ -238,7 +241,7 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
* generate the nsParameters
*/
public void prepareSDNCRequest (DelegateExecution execution) {
- msoLogger.info(" ***** Started prepareSDNCRequest *****")
+ logger.info(" ***** Started prepareSDNCRequest *****")
try {
// get variables
@@ -440,15 +443,15 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
String sndcTopologyCreateRequesAsString = utils.formatXml(sdncTopologyCreateRequest)
utils.logAudit(sndcTopologyCreateRequesAsString)
execution.setVariable("sdncAdapterWorkflowRequest", sndcTopologyCreateRequesAsString)
- msoLogger.debug("sdncAdapterWorkflowRequest - " + "\n" + sndcTopologyCreateRequesAsString)
+ logger.debug("sdncAdapterWorkflowRequest - " + "\n" + sndcTopologyCreateRequesAsString)
} catch (Exception ex) {
String exceptionMessage = " Bpmn error encountered in CreateSDNCCNetworkResource flow. prepareSDNCRequest() - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
- msoLogger.info(" ***** Exit prepareSDNCRequest *****")
+ logger.info(" ***** Exit prepareSDNCRequest *****")
}
private void setProgressUpdateVariables(DelegateExecution execution, String body) {
@@ -523,7 +526,7 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
}
public void afterCreateSDNCCall(DelegateExecution execution){
- msoLogger.info(" ***** Started prepareSDNCRequest *****")
+ logger.info(" ***** Started prepareSDNCRequest *****")
String responseCode = execution.getVariable(Prefix + "sdncCreateReturnCode")
String responseObj = execution.getVariable(Prefix + "SuccessIndicator")
@@ -533,8 +536,8 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
execution.setVariable("networkInstanceId", instnaceId)
}
- msoLogger.info("response from sdnc, response code :" + responseCode + " response object :" + responseObj)
- msoLogger.info(" ***** Exit prepareSDNCRequest *****")
+ logger.info("response from sdnc, response code :" + responseCode + " response object :" + responseObj)
+ logger.info(" ***** Exit prepareSDNCRequest *****")
}
private def getInstnaceId(DelegateExecution execution) {
@@ -566,21 +569,21 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
}
public void sendSyncResponse (DelegateExecution execution) {
- msoLogger.debug(" *** sendSyncResponse *** ")
+ logger.debug(" *** sendSyncResponse *** ")
try {
String operationStatus = "finished"
// RESTResponse for main flow
String resourceOperationResp = """{"operationStatus":"${operationStatus}"}""".trim()
- msoLogger.debug(" sendSyncResponse to APIH:" + "\n" + resourceOperationResp)
+ logger.debug(" sendSyncResponse to APIH:" + "\n" + resourceOperationResp)
sendWorkflowResponse(execution, 202, resourceOperationResp)
execution.setVariable("sentSyncResponse", true)
} catch (Exception ex) {
String msg = "Exception in sendSyncResponse:" + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.debug(" ***** Exit sendSyncResponse *****")
+ logger.debug(" ***** Exit sendSyncResponse *****")
}
}
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 6222214108..433a8d0bb9 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
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 Huawei Technologies Co., Ltd. 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
@@ -30,7 +32,8 @@ import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.onap.so.bpmn.common.scripts.ExceptionUtil
import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.client.HttpClient
-import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
import org.onap.so.bpmn.core.UrnPropertiesReader
import javax.ws.rs.core.Response
@@ -41,7 +44,7 @@ import org.onap.so.utils.TargetEntity
* flow for VFC Network Service Create
*/
public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CreateVFCNSResource.class);
+ private static final Logger logger = LoggerFactory.getLogger( CreateVFCNSResource.class);
ExceptionUtil exceptionUtil = new ExceptionUtil()
@@ -58,7 +61,7 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
JsonUtils jsonUtil = new JsonUtils()
String msg = ""
- msoLogger.trace("preProcessRequest() ")
+ logger.trace("preProcessRequest() ")
try {
//deal with nsName and Description
String resourceInput = execution.getVariable("resourceInput")
@@ -69,24 +72,24 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
execution.setVariable("nsServiceName", resourceName)
String nsServiceDescription = execution.getVariable("nsServiceDescription")
- msoLogger.info("nsServiceName:" + resourceName + " nsServiceDescription:" + nsServiceDescription)
+ logger.info("nsServiceName:" + resourceName + " nsServiceDescription:" + nsServiceDescription)
//deal with operation key
String globalSubscriberId = jsonUtil.getJsonValue(resourceInput, "globalSubscriberId")
- msoLogger.info("globalSubscriberId:" + globalSubscriberId)
+ logger.info("globalSubscriberId:" + globalSubscriberId)
//set local globalSubscriberId variable
execution.setVariable("globalSubscriberId", globalSubscriberId);
String serviceType = execution.getVariable("serviceType")
- msoLogger.info("serviceType:" + serviceType)
+ logger.info("serviceType:" + serviceType)
String serviceId = execution.getVariable("serviceInstanceId")
- msoLogger.info("serviceId:" + serviceId)
+ logger.info("serviceId:" + serviceId)
String operationId = jsonUtil.getJsonValue(resourceInput, "operationId")
- msoLogger.info("serviceType:" + serviceType)
+ logger.info("serviceType:" + serviceType)
String nodeTemplateUUID = jsonUtil.getJsonValue(resourceInput, "resourceModelInfo.modelCustomizationUuid")
String nsServiceModelUUID = jsonUtil.getJsonValue(resourceParameters, "requestInputs.nsd0_providing_service_uuid")
- msoLogger.info("nodeTemplateUUID:" + nodeTemplateUUID)
+ logger.info("nodeTemplateUUID:" + nodeTemplateUUID)
/*
* segmentInformation needed as a object of segment
* {
@@ -99,7 +102,7 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
* }
*/
String nsParameters = jsonUtil.getJsonValue(resourceInput, "resourceParameters")
- msoLogger.info("nsParameters:" + nsParameters)
+ logger.info("nsParameters:" + nsParameters)
String nsOperationKey = """{
"globalSubscriberId":"${globalSubscriberId}",
"serviceType":"${serviceType}",
@@ -115,7 +118,7 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
if (vfcAdapterUrl == null || vfcAdapterUrl.isEmpty()) {
msg = getProcessKey(execution) + ': mso:adapters:vfcc:rest:endpoint URN mapping is not defined'
- msoLogger.debug(msg)
+ logger.debug(msg)
}
while (vfcAdapterUrl.endsWith('/')) {
@@ -128,17 +131,17 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
throw e;
} catch (Exception ex){
msg = "Exception in preProcessRequest " + ex.getMessage()
- msoLogger.info(msg)
+ logger.info(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("Exit preProcessRequest ")
+ logger.trace("Exit preProcessRequest ")
}
/**
* create NS task
*/
public void createNetworkService(DelegateExecution execution) {
- msoLogger.trace("createNetworkService ")
+ logger.trace("createNetworkService ")
String vfcAdapterUrl = execution.getVariable("vfcAdapterUrl")
String nsOperationKey = execution.getVariable("nsOperationKey");
String nsServiceModelUUID = execution.getVariable("nsServiceModelUUID");
@@ -165,14 +168,14 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
nsInstanceId = jsonUtil.getJsonValue(aaiResponseAsString, "nsInstanceId")
}
execution.setVariable("nsInstanceId", nsInstanceId)
- msoLogger.info(" *****Exit createNetworkService *****")
+ logger.info(" *****Exit createNetworkService *****")
}
/**
* instantiate NS task
*/
public void instantiateNetworkService(DelegateExecution execution) {
- msoLogger.trace("instantiateNetworkService ")
+ logger.trace("instantiateNetworkService ")
String vfcAdapterUrl = execution.getVariable("vfcAdapterUrl")
String nsOperationKey = execution.getVariable("nsOperationKey");
String nsParameters = execution.getVariable("nsParameters");
@@ -194,14 +197,14 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
jobId = jsonUtil.getJsonValue(aaiResponseAsString, "jobId")
}
execution.setVariable("jobId", jobId)
- msoLogger.info(" *****Exit instantiateNetworkService *****")
+ logger.info(" *****Exit instantiateNetworkService *****")
}
/**
* query NS task
*/
public void queryNSProgress(DelegateExecution execution) {
- msoLogger.trace("queryNSProgress ")
+ logger.trace("queryNSProgress ")
String vfcAdapterUrl = execution.getVariable("vfcAdapterUrl")
String jobId = execution.getVariable("jobId")
String nsOperationKey = execution.getVariable("nsOperationKey");
@@ -214,7 +217,7 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
operationStatus = jsonUtil.getJsonValue(aaiResponseAsString, "responseDescriptor.status")
}
execution.setVariable("operationStatus", operationStatus)
- msoLogger.info(" *****Exit queryNSProgress *****")
+ logger.info(" *****Exit queryNSProgress *****")
}
/**
@@ -224,7 +227,7 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
try {
Thread.sleep(5000);
} catch(InterruptedException e) {
- msoLogger.error( "Time Delay exception" + e.getMessage());
+ logger.error("Time Delay exception" + e.getMessage());
}
}
@@ -232,10 +235,10 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
* finish NS task
*/
public void addNSRelationship(DelegateExecution execution) {
- msoLogger.trace("addNSRelationship ")
+ logger.trace("addNSRelationship ")
String nsInstanceId = execution.getVariable("nsInstanceId")
if(nsInstanceId == null || nsInstanceId == ""){
- msoLogger.info(" create NS failed, so do not need to add relationship")
+ logger.info(" create NS failed, so do not need to add relationship")
return
}
String globalSubscriberId = execution.getVariable("globalSubscriberId")
@@ -247,9 +250,9 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
try{
getAAIClient().connect(nsUri,relatedServiceUri)
- msoLogger.info("NS relationship to Service added successfully")
+ logger.info("NS relationship to Service added successfully")
}catch(Exception e){
- msoLogger.error("Exception occured while Creating NS relationship."+ e.getMessage());
+ logger.error("Exception occured while Creating NS relationship."+ e.getMessage());
throw new BpmnError("MSOWorkflowException")
}
}
@@ -260,8 +263,8 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
* requestBody: the body of the request
*/
private Response postRequest(DelegateExecution execution, String urlString, String requestBody){
- msoLogger.trace("Started Execute VFC adapter Post Process ")
- msoLogger.info("url:" + urlString +"\nrequestBody:"+ requestBody)
+ logger.trace("Started Execute VFC adapter Post Process ")
+ logger.info("url:" + urlString +"\nrequestBody:"+ requestBody)
Response apiResponse = null
try{
@@ -276,36 +279,36 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
apiResponse = httpClient.post(requestBody)
- msoLogger.debug("response code:"+ apiResponse.getStatus() +"\nresponse body:"+ apiResponse.readEntity(String.class))
+ logger.debug("response code:"+ apiResponse.getStatus() +"\nresponse body:"+ apiResponse.readEntity(String.class))
}catch(Exception e){
- msoLogger.error("VFC Aatpter Post Call Exception:" + e.getMessage());
+ logger.error("VFC Aatpter Post Call Exception:" + e.getMessage());
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "VFC Aatpter Post Call Exception")
}
- msoLogger.trace("Completed Execute VF-C adapter Post Process ")
+ logger.trace("Completed Execute VF-C adapter Post Process ")
return apiResponse
}
public void sendSyncResponse (DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- utils.log("DEBUG", " *** sendSyncResponse *** ", isDebugEnabled)
+ logger.debug( " *** sendSyncResponse *** ")
try {
String operationStatus = execution.getVariable("operationStatus")
// RESTResponse for main flow
String resourceOperationResp = """{"operationStatus":"${operationStatus}"}""".trim()
- utils.log("DEBUG", " sendSyncResponse to APIH:" + "\n" + resourceOperationResp, isDebugEnabled)
+ logger.debug( " sendSyncResponse to APIH:" + "\n" + resourceOperationResp)
sendWorkflowResponse(execution, 202, resourceOperationResp)
execution.setVariable("sentSyncResponse", true)
} catch (Exception ex) {
String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage()
- utils.log("DEBUG", msg, isDebugEnabled)
+ logger.debug( msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- utils.log("DEBUG"," ***** Exit sendSyncResopnse *****", isDebugEnabled)
+ logger.debug(" ***** Exit sendSyncResopnse *****")
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleInfra.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleInfra.groovy
index ffac4c0174..e3ac04e9e3 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleInfra.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleInfra.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -36,6 +38,8 @@ import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.bpmn.infrastructure.aai.AAICreateResources;
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
import org.w3c.dom.*
import javax.xml.parsers.*
import org.xml.sax.InputSource
@@ -43,7 +47,7 @@ import groovy.json.JsonOutput
import groovy.json.JsonSlurper
public class CreateVfModuleInfra extends AbstractServiceTaskProcessor {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CreateVfModuleInfra.class);
+ private static final Logger logger = LoggerFactory.getLogger( CreateVfModuleInfra.class);
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtil = new JsonUtils()
@@ -63,7 +67,7 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor {
'execution=' + execution.getId() +
')'
- msoLogger.debug('Started ' + method)
+ logger.debug('Started ' + method)
def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
execution.setVariable("CVFMI_sentSyncResponse", false)
@@ -79,8 +83,8 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor {
execution.setVariable("RollbackData", rollbackData)
def incomingRequest = execution.getVariable('bpmnRequest')
- msoLogger.debug("Incoming Infra Request: " + incomingRequest)
- msoLogger.debug("CreateVfModule Infra incoming Request: " + incomingRequest)
+ logger.debug("Incoming Infra Request: " + incomingRequest)
+ logger.debug("CreateVfModule Infra incoming Request: " + incomingRequest)
setBasicDBAuthHeader(execution, isDebugLogEnabled)
@@ -89,7 +93,7 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor {
def jsonSlurper = new JsonSlurper()
def jsonOutput = new JsonOutput()
Map reqMap = jsonSlurper.parseText(incomingRequest)
- msoLogger.debug(" Request is in JSON format.")
+ logger.debug(" Request is in JSON format.")
def serviceInstanceId = execution.getVariable('serviceInstanceId')
def vnfId = execution.getVariable('vnfId')
@@ -140,7 +144,7 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor {
}
}
- msoLogger.debug('Processed user params: ' + userParamsMap)
+ logger.debug('Processed user params: ' + userParamsMap)
execution.setVariable(prefix + 'vfModuleInputParams', userParamsMap)
@@ -232,24 +236,25 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor {
execution.setVariable(prefix + 'controllerType', controllerType)
execution.setVariable('healthCheckIndex0', 0)
- msoLogger.debug('RequestInfo: ' + execution.getVariable("CVFMI_requestInfo"))
+ logger.debug('RequestInfo: ' + execution.getVariable("CVFMI_requestInfo"))
- msoLogger.debug('rollbackEnabled: ' + execution.getVariable("CVFMI_rollbackEnabled"))
+ logger.debug('rollbackEnabled: ' + execution.getVariable("CVFMI_rollbackEnabled"))
- msoLogger.trace('Finished ' + method)
+ logger.trace('Finished ' + method)
} catch (BpmnError bpmnError) {
throw bpmnError
}
catch(groovy.json.JsonException je) {
- msoLogger.debug("Request is not in JSON format.")
+ logger.debug("Request is not in JSON format.")
exceptionUtil.buildAndThrowWorkflowException(execution, 400, "Internal Error - During PreProcessRequest")
}
catch(Exception e) {
String restFaultMessage = e.getMessage()
//execution.setVariable("CVFMODVOL2_RESTFault", restFaultMessage)
//execution.setVariable("CVFMODVOL2_isDataOk", false)
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Exception Encountered - " + "\n" + restFaultMessage, "BPMN", MsoLogger.getServiceName(),
- MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ " Exception Encountered - " + "\n" + restFaultMessage, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 400, "Internal Error - During PreProcessRequest")
}
@@ -278,7 +283,7 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor {
'execution=' + execution.getId() +
')'
- msoLogger.trace('Started ' + method)
+ logger.trace('Started ' + method)
try {
def requestInfo = execution.getVariable('CVFMI_requestInfo')
@@ -292,13 +297,14 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor {
sendWorkflowResponse(execution, 200, synchResponse)
execution.setVariable("CVFMI_sentSyncResponse", true)
- msoLogger.debug("CreateVfModule Infra Response: " + synchResponse)
- msoLogger.trace('Finished ' + method)
+ logger.debug("CreateVfModule Infra Response: " + synchResponse)
+ logger.trace('Finished ' + method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Exception Encountered ", "BPMN", MsoLogger.getServiceName(),
- MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Encountered ", "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage())
}
}
@@ -371,13 +377,13 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor {
* @param execution the execution
*/
public void postProcessResponse(DelegateExecution execution){
- msoLogger.trace("STARTED PostProcessResponse Process")
+ logger.trace("STARTED PostProcessResponse Process")
try{
def requestInfo = execution.getVariable("CVFMI_requestInfo")
def action = utils.getNodeText(requestInfo, "action")
- msoLogger.debug("requestInfo is: " + requestInfo)
- msoLogger.debug("action is: " + action)
+ logger.debug("requestInfo is: " + requestInfo)
+ logger.debug("action is: " + action)
String payload =
""" <aetgt:MsoCompletionRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
@@ -393,15 +399,16 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor {
payload = utils.formatXml(payload)
execution.setVariable("CVFMI_SuccessFlag", true)
execution.setVariable("CVFMI_msoCompletionRequest", payload)
- msoLogger.debug("CreateVfModuleInfra completion request: " + payload)
- msoLogger.debug("Outgoing MsoCompletionRequest: \n" + payload)
+ logger.debug("CreateVfModuleInfra completion request: " + payload)
+ logger.debug("Outgoing MsoCompletionRequest: \n" + payload)
}catch(Exception e){
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Exception Occured Processing PostProcessResponse - " + "\n", "BPMN", MsoLogger.getServiceName(),
- MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Occured Processing PostProcessResponse - " + "\n", "BPMN",
+ MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
execution.setVariable("CVFMI_ErrorResponse", "Error Occured during PostProcessResponse Method:\n" + e.getMessage())
}
- msoLogger.trace("COMPLETED PostProcessResponse Process")
+ logger.trace("COMPLETED PostProcessResponse Process")
}
@@ -420,7 +427,7 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor {
'execution=' + execution.getId() +
')'
- msoLogger.trace('Started ' + method)
+ logger.trace('Started ' + method)
String processKey = getProcessKey(execution);
def prefix = execution.getVariable("prefix")
@@ -466,20 +473,22 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor {
utils.logContext(requestId, serviceInstanceId)
*/
- msoLogger.debug("CreateVfModule incoming request: " + request)
- msoLogger.debug('Incoming message: ' + System.lineSeparator() + request)
- msoLogger.trace('Finished ' + method)
+ logger.debug("CreateVfModule incoming request: " + request)
+ logger.debug('Incoming message: ' + System.lineSeparator() + request)
+ logger.trace('Finished ' + method)
return request
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Caught exception in " + method , "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Caught exception in " + method , "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Invalid Message")
}
}
public void prepareUpdateInfraRequest(DelegateExecution execution){
- msoLogger.trace("STARTED prepareUpdateInfraRequest Process")
+ logger.trace("STARTED prepareUpdateInfraRequest Process")
try{
String requestInfo = execution.getVariable("CVFMI_requestInfo")
@@ -493,7 +502,7 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor {
def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint",execution)
execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint)
- msoLogger.debug("DB Adapter Endpoint is: " + dbAdapterEndpoint)
+ logger.debug("DB Adapter Endpoint is: " + dbAdapterEndpoint)
String payload =
"""<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
@@ -516,15 +525,16 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor {
payload = utils.formatXml(payload)
execution.setVariable("CVFMI_updateInfraRequest", payload)
- msoLogger.debug("Outgoing UpdateInfraRequest: \n" + payload)
- msoLogger.debug("CreateVfModuleInfra Outgoing UpdateInfra Request: " + payload)
+ logger.debug("Outgoing UpdateInfraRequest: \n" + payload)
+ logger.debug("CreateVfModuleInfra Outgoing UpdateInfra Request: " + payload)
}catch(Exception e){
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing prepareUpdateInfraRequest.", "BPMN", MsoLogger.getServiceName(),
- MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Occured Processing prepareUpdateInfraRequest.", "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during prepareUpdateInfraRequest Method:\n" + e.getMessage())
}
- msoLogger.trace("COMPLETED prepareUpdateInfraRequest Process")
+ logger.trace("COMPLETED prepareUpdateInfraRequest Process")
}
/**
@@ -539,7 +549,7 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor {
', resultVar=' + resultVar +
')'
- msoLogger.trace("Started " + method)
+ logger.trace("Started " + method)
try {
@@ -565,17 +575,19 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor {
</aetgt:FalloutHandlerRequest>
"""
- msoLogger.debug("CONTENT before translation: " + content)
+ logger.debug("CONTENT before translation: " + content)
content = utils.formatXml(content)
- msoLogger.debug(resultVar + ' = ' + System.lineSeparator() + content)
- msoLogger.debug("CreateVfModuleInfra FallOutHander Request: " + content)
+ logger.debug(resultVar + ' = ' + System.lineSeparator() + content)
+ logger.debug("CreateVfModuleInfra FallOutHander Request: " + content)
execution.setVariable(resultVar, content)
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Caught exception in " + method , "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Caught exception in " + method , "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildWorkflowException(execution, 2000, 'Internal Error')
}
}
@@ -584,7 +596,7 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor {
def method = getClass().getSimpleName() + '.validateRollbackResponse(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
logWorkflowException(execution, 'CreateVfModuleInfra caught an event')
saveWorkflowException(execution, 'CVFMI_originalWorkflowException')
@@ -594,7 +606,7 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor {
def method = getClass().getSimpleName() + '.validateRollbackResponse(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
def originalException = execution.getVariable("CVFMI_originalWorkflowException")
execution.setVariable("WorkflowException", originalException)
@@ -603,23 +615,23 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor {
}
public void sendErrorResponse(DelegateExecution execution){
- msoLogger.trace("STARTED CreateVfModulenfra sendErrorResponse Process")
+ logger.trace("STARTED CreateVfModulenfra sendErrorResponse Process")
try {
def sentSyncResponse = execution.getVariable("CVFMI_sentSyncResponse")
if(sentSyncResponse == false){
WorkflowException wfex = execution.getVariable("WorkflowException")
String response = exceptionUtil.buildErrorResponseXml(wfex)
- msoLogger.debug(response)
+ logger.debug(response)
sendWorkflowResponse(execution, 500, response)
}else{
- msoLogger.debug("Not Sending Error Response. Sync Response Already Sent")
+ logger.debug("Not Sending Error Response. Sync Response Already Sent")
}
} catch (Exception ex) {
- msoLogger.debug("Error Occured in CreateVfModuleInfra sendErrorResponse Process " + ex.getMessage())
+ logger.debug("Error Occured in CreateVfModuleInfra sendErrorResponse Process " + ex.getMessage())
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in CreateVfModuleInfra sendErrorResponse Process")
}
- msoLogger.trace("COMPLETED CreateVfModuleInfra sendErrorResponse Process")
+ logger.trace("COMPLETED CreateVfModuleInfra sendErrorResponse Process")
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1.groovy
index 05c8246311..d85ea481d5 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -35,6 +37,8 @@ import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
import groovy.json.JsonOutput
import groovy.json.JsonSlurper
@@ -42,7 +46,7 @@ import groovy.json.JsonSlurper
class CreateVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CreateVfModuleVolumeInfraV1.class);
+ private static final Logger logger = LoggerFactory.getLogger( CreateVfModuleVolumeInfraV1.class);
public static final String prefix='CVMVINFRAV1_'
/**
@@ -68,13 +72,13 @@ class CreateVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor {
execution.setVariable(prefix+'syncResponseSent', false)
String createVolumeIncoming = validateRequest(execution, 'vnfId')
- msoLogger.debug(createVolumeIncoming)
+ logger.debug(createVolumeIncoming)
try {
def jsonSlurper = new JsonSlurper()
Map reqMap = jsonSlurper.parseText(createVolumeIncoming)
setupVariables(execution, reqMap, isDebugEnabled)
- msoLogger.debug("XML request:\n" + createVolumeIncoming)
+ logger.debug("XML request:\n" + createVolumeIncoming)
}
catch(groovy.json.JsonException je) {
(new ExceptionUtil()).buildAndThrowWorkflowException(execution, 2500, 'Request is not a valid JSON document')
@@ -100,7 +104,7 @@ class CreateVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor {
// volumeGroupId - is generated
String volumeGroupId = UUID.randomUUID()
execution.setVariable('volumeGroupId', volumeGroupId)
- msoLogger.debug("Generated volumeGroupId: " + volumeGroupId)
+ logger.debug("Generated volumeGroupId: " + volumeGroupId)
// volumeGroupName
def volGrpName = requestMap.requestDetails.requestInfo?.instanceName ?: ''
@@ -159,7 +163,7 @@ class CreateVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor {
// disableRollback (true or false)
def disableRollback = requestMap.requestDetails.requestInfo.suppressRollback
execution.setVariable('disableRollback', disableRollback)
- msoLogger.debug('disableRollback (suppressRollback) from request: ' + disableRollback)
+ logger.debug('disableRollback (suppressRollback) from request: ' + disableRollback)
}
@@ -172,7 +176,7 @@ class CreateVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor {
String syncResponse = """{"requestReferences":{"instanceId":"${volumeGroupId}","requestId":"${requestId}"}}""".trim()
- msoLogger.debug("Sync Response: " + "\n" + syncResponse)
+ logger.debug("Sync Response: " + "\n" + syncResponse)
sendWorkflowResponse(execution, 200, syncResponse)
execution.setVariable(prefix+'syncResponseSent', true)
@@ -194,7 +198,7 @@ class CreateVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor {
* @param isDebugEnabled
*/
public void buildWorkflowException(DelegateExecution execution, int errorCode, errorMessage, isDebugEnabled) {
- msoLogger.debug(errorMessage)
+ logger.debug(errorMessage)
(new ExceptionUtil()).buildWorkflowException(execution, 2500, errorMessage)
}
@@ -237,7 +241,7 @@ class CreateVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor {
String buildDBRequestAsString = utils.formatXml(dbRequest)
execution.setVariable(prefix+"createDBRequest", buildDBRequestAsString)
- msoLogger.debug("DB Infra Request: " + buildDBRequestAsString)
+ logger.debug("DB Infra Request: " + buildDBRequestAsString)
}
@@ -251,8 +255,8 @@ class CreateVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor {
def dbReturnCode = execution.getVariable(prefix+'dbReturnCode')
def createDBResponse = execution.getVariable(prefix+'createDBResponse')
- msoLogger.debug('DB return code: ' + dbReturnCode)
- msoLogger.debug('DB response: ' + createDBResponse)
+ logger.debug('DB return code: ' + dbReturnCode)
+ logger.debug('DB response: ' + createDBResponse)
def requestId = execution.getVariable("mso-request-id")
def source = execution.getVariable(prefix+'source')
@@ -273,7 +277,7 @@ class CreateVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor {
execution.setVariable(prefix+'Success', true)
execution.setVariable(prefix+'CompleteMsoProcessRequest', xmlMsoCompletionRequest)
- msoLogger.debug(" Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest)
+ logger.debug(" Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest)
}
@@ -306,7 +310,7 @@ class CreateVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor {
String xmlHandlerRequest = utils.formatXml(falloutHandlerRequest)
execution.setVariable(prefix+'FalloutHandlerRequest', xmlHandlerRequest)
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Overall Error Response going to FalloutHandler", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "\n" + xmlHandlerRequest);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Overall Error Response going to FalloutHandler", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "\n" + xmlHandlerRequest);
}
@@ -324,10 +328,10 @@ class CreateVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor {
AAIResourceUri uri = AAIUriFactory.createNodesUri(AAIObjectType.SERVICE_INSTANCE,serviceInstanceId)
if(getAAIClient().exists(uri)){
- msoLogger.debug('Service instance ' + serviceInstanceId + ' found in AAI.')
+ logger.debug('Service instance ' + serviceInstanceId + ' found in AAI.')
}else{
def message = 'Service instance ' + serviceInstanceId + ' was not found in AAI. Return code: 404.'
- msoLogger.debug(message)
+ logger.debug(message)
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, message)
}
}catch(BpmnError bpmnError){
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVnfInfra.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVnfInfra.groovy
index af46bf65b8..29eb47c1e7 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVnfInfra.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVnfInfra.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -41,6 +43,8 @@ import org.onap.so.bpmn.core.json.JsonUtils;
import org.onap.so.bpmn.infrastructure.aai.groovyflows.AAICreateResources;
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
/**
@@ -50,7 +54,7 @@ import org.onap.so.logger.MsoLogger
*/
class CreateVnfInfra extends AbstractServiceTaskProcessor {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CreateVnfInfra.class);
+ private static final Logger logger = LoggerFactory.getLogger( CreateVnfInfra.class);
String Prefix="CREVI_"
@@ -69,7 +73,7 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor {
public void preProcessRequest(DelegateExecution execution) {
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix",Prefix)
- msoLogger.trace("STARTED CreateVnfInfra PreProcessRequest Process")
+ logger.trace("STARTED CreateVnfInfra PreProcessRequest Process")
setBasicDBAuthHeader(execution, isDebugEnabled)
execution.setVariable("CREVI_sentSyncResponse", false)
@@ -78,59 +82,59 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor {
// Get Variables
String createVnfRequest = execution.getVariable("bpmnRequest")
execution.setVariable("CREVI_createVnfRequest", createVnfRequest)
- msoLogger.debug("Incoming CreateVnfInfra Request is: \n" + createVnfRequest)
+ logger.debug("Incoming CreateVnfInfra Request is: \n" + createVnfRequest)
if(createVnfRequest != null){
String requestId = execution.getVariable("mso-request-id")
execution.setVariable("CREVI_requestId", requestId)
- msoLogger.debug("Incoming Request Id is: " + requestId)
+ logger.debug("Incoming Request Id is: " + requestId)
String serviceInstanceId = execution.getVariable("serviceInstanceId")
execution.setVariable("CREVI_serviceInstanceId", serviceInstanceId)
- msoLogger.debug("Incoming Service Instance Id is: " + serviceInstanceId)
+ logger.debug("Incoming Service Instance Id is: " + serviceInstanceId)
String vnfType = execution.getVariable("vnfType")
execution.setVariable("CREVI_vnfType", vnfType)
- msoLogger.debug("Incoming Vnf Type is: " + vnfType)
+ logger.debug("Incoming Vnf Type is: " + vnfType)
String vnfName = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.requestInfo.instanceName")
execution.setVariable("CREVI_vnfName", vnfName)
- msoLogger.debug("Incoming Vnf Name is: " + vnfName)
+ logger.debug("Incoming Vnf Name is: " + vnfName)
String serviceId = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.requestInfo.productFamilyId")
execution.setVariable("CREVI_serviceId", serviceId)
- msoLogger.debug("Incoming Service Id is: " + serviceId)
+ logger.debug("Incoming Service Id is: " + serviceId)
String source = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.requestInfo.source")
execution.setVariable("CREVI_source", source)
- msoLogger.debug("Incoming Source is: " + source)
+ logger.debug("Incoming Source is: " + source)
String suppressRollback = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.requestInfo.suppressRollback")
execution.setVariable("CREVI_suppressRollback", suppressRollback)
- msoLogger.debug("Incoming Suppress Rollback is: " + suppressRollback)
+ logger.debug("Incoming Suppress Rollback is: " + suppressRollback)
def vnfModelInfo = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.modelInfo")
execution.setVariable("CREVI_vnfModelInfo", vnfModelInfo)
String modelInvariantId = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.modelInfo.modelInvariantUuid")
execution.setVariable("CREVI_modelInvariantId", modelInvariantId)
- msoLogger.debug("Incoming Invariant Id is: " + modelInvariantId)
+ logger.debug("Incoming Invariant Id is: " + modelInvariantId)
String modelVersion = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.modelInfo.modelVersion")
execution.setVariable("CREVI_modelVersion", modelVersion)
- msoLogger.debug("Incoming Model Version is: " + modelVersion)
+ logger.debug("Incoming Model Version is: " + modelVersion)
def cloudConfiguration = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.cloudConfiguration")
execution.setVariable("CREVI_cloudConfiguration", cloudConfiguration)
String cloudSiteId = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.cloudConfiguration.lcpCloudRegionId")
execution.setVariable("CREVI_cloudSiteId", cloudSiteId)
- msoLogger.debug("Incoming Cloud Site Id is: " + cloudSiteId)
+ logger.debug("Incoming Cloud Site Id is: " + cloudSiteId)
String tenantId = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.cloudConfiguration.tenantId")
execution.setVariable("CREVI_tenantId", tenantId)
- msoLogger.debug("Incoming Tenant Id is: " + tenantId)
+ logger.debug("Incoming Tenant Id is: " + tenantId)
//For Completion Handler & Fallout Handler
String requestInfo =
@@ -153,7 +157,7 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor {
String vnfId = execution.getVariable("testVnfId") // for junits
if(isBlank(vnfId)){
vnfId = UUID.randomUUID().toString()
- msoLogger.debug("Generated Vnf Id is: " + vnfId)
+ logger.debug("Generated Vnf Id is: " + vnfId)
}
execution.setVariable("CREVI_vnfId", vnfId)
@@ -164,7 +168,7 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor {
String sdncCallbackUrl = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution)
if (sdncCallbackUrl == null || sdncCallbackUrl.trim().isEmpty()) {
def msg = 'Required variable \'mso.workflow.sdncadapter.callback\' is missing'
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError);
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -175,31 +179,31 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor {
vnfInputParameters = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.requestParameters.userParams")
}
catch (Exception e) {
- msoLogger.debug("userParams are not present in the request")
+ logger.debug("userParams are not present in the request")
}
execution.setVariable("CREVI_vnfInputParameters", vnfInputParameters)
- msoLogger.debug("SDNC Callback URL: " + sdncCallbackUrl)
+ logger.debug("SDNC Callback URL: " + sdncCallbackUrl)
}else{
exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Bpmn Request is Null.")
}
}catch(BpmnError b){
- msoLogger.debug("Rethrowing MSOWorkflowException")
+ logger.debug("Rethrowing MSOWorkflowException")
throw b
}catch(Exception e){
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Error Occurred in CreateVnfInfra PreProcessRequest method", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e)
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), " Error Occurred in CreateVnfInfra PreProcessRequest method", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e)
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occurred in CreateVnfInfra PreProcessRequest")
}
- msoLogger.trace("COMPLETED CreateVnfInfra PreProcessRequest Process")
+ logger.trace("COMPLETED CreateVnfInfra PreProcessRequest Process")
}
public void sendSyncResponse (DelegateExecution execution) {
execution.setVariable("prefix",Prefix)
- msoLogger.trace("STARTED CreateVnfInfra SendSyncResponse Process")
+ logger.trace("STARTED CreateVnfInfra SendSyncResponse Process")
try {
String requestId = execution.getVariable("CREVI_requestId")
@@ -207,28 +211,28 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor {
String createVnfResponse = """{"requestReferences":{"instanceId":"${vnfId}","requestId":"${requestId}"}}""".trim()
- msoLogger.debug("CreateVnfInfra Sync Response is: \n" + createVnfResponse)
+ logger.debug("CreateVnfInfra Sync Response is: \n" + createVnfResponse)
sendWorkflowResponse(execution, 202, createVnfResponse)
execution.setVariable("CREVI_sentSyncResponse", true)
} catch (Exception ex) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Error Occurred in CreateVnfInfra SendSyncResponse Process", "BPMN", MsoLogger.getServiceName(),
- MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e)
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), " Error Occurred in CreateVnfInfra SendSyncResponse Process", "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e)
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in CreateVnfInfra SendSyncResponse Process")
}
- msoLogger.trace("COMPLETED CreateVnfInfra SendSyncResponse Process")
+ logger.trace("COMPLETED CreateVnfInfra SendSyncResponse Process")
}
public void preProcessSDNCAssignRequest(DelegateExecution execution){
execution.setVariable("prefix", Prefix)
- msoLogger.trace("STARTED preProcessSDNCAssignRequest")
+ logger.trace("STARTED preProcessSDNCAssignRequest")
def vnfId = execution.getVariable("CREVI_vnfId")
def serviceInstanceId = execution.getVariable("CREVI_serviceInstanceId")
- msoLogger.debug("NEW VNF ID: " + vnfId)
+ logger.debug("NEW VNF ID: " + vnfId)
try{
//Build SDNC Request
@@ -237,23 +241,23 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor {
assignSDNCRequest = utils.formatXml(assignSDNCRequest)
execution.setVariable("CREVI_assignSDNCRequest", assignSDNCRequest)
- msoLogger.debug("Outgoing AssignSDNCRequest is: \n" + assignSDNCRequest)
+ logger.debug("Outgoing AssignSDNCRequest is: \n" + assignSDNCRequest)
}catch(Exception e){
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occurred Processing preProcessSDNCAssignRequest", "BPMN", MsoLogger.getServiceName(),
- MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e)
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occurred Processing preProcessSDNCAssignRequest", "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during prepareProvision Method:\n" + e.getMessage())
}
- msoLogger.trace("COMPLETED preProcessSDNCAssignRequest")
+ logger.trace("COMPLETED preProcessSDNCAssignRequest")
}
public void preProcessSDNCActivateRequest(DelegateExecution execution) {
def method = getClass().getSimpleName() + '.preProcessSDNCActivateRequest(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
execution.setVariable("prefix", Prefix)
- msoLogger.trace("STARTED preProcessSDNCActivateRequest Process")
+ logger.trace("STARTED preProcessSDNCActivateRequest Process")
try{
String vnfId = execution.getVariable("CREVI_vnfId")
String serviceInstanceId = execution.getVariable("CREVI_serviceInstanceId")
@@ -261,13 +265,13 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor {
String activateSDNCRequest = buildSDNCRequest(execution, serviceInstanceId, "activate")
execution.setVariable("CREVI_activateSDNCRequest", activateSDNCRequest)
- msoLogger.debug("Outgoing CommitSDNCRequest is: \n" + activateSDNCRequest)
+ logger.debug("Outgoing CommitSDNCRequest is: \n" + activateSDNCRequest)
}catch(Exception e){
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing preProcessSDNCActivateRequest", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e)
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing preProcessSDNCActivateRequest", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessSDNCActivateRequest Method:\n" + e.getMessage())
}
- msoLogger.trace("COMPLETED preProcessSDNCActivateRequest Process")
+ logger.trace("COMPLETED preProcessSDNCActivateRequest Process")
}
public String buildSDNCRequest(DelegateExecution execution, String svcInstId, String action){
@@ -329,39 +333,39 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor {
</sdncadapterworkflow:SDNCRequestData>
</sdncadapterworkflow:SDNCAdapterWorkflowRequest>"""
- msoLogger.debug("sdncRequest: " + sdncRequest)
+ logger.debug("sdncRequest: " + sdncRequest)
return sdncRequest
}
public void validateSDNCResponse(DelegateExecution execution, String response, String method){
execution.setVariable("prefix",Prefix)
- msoLogger.debug("STARTED ValidateSDNCResponse Process")
+ logger.debug("STARTED ValidateSDNCResponse Process")
WorkflowException workflowException = execution.getVariable("WorkflowException")
boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator")
- msoLogger.debug("workflowException: " + workflowException)
+ logger.debug("workflowException: " + workflowException)
SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this)
sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator)
- msoLogger.debug("SDNCResponse: " + response)
+ logger.debug("SDNCResponse: " + response)
String sdncResponse = response
if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){
- msoLogger.trace("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + sdncResponse)
+ logger.trace("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + sdncResponse)
}else{
- msoLogger.debug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.")
+ logger.debug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.")
throw new BpmnError("MSOWorkflowException")
}
- msoLogger.trace("COMPLETED ValidateSDNCResponse Process")
+ logger.trace("COMPLETED ValidateSDNCResponse Process")
}
public void prepareCompletionHandlerRequest(DelegateExecution execution){
execution.setVariable("prefix",Prefix)
- msoLogger.trace("STARTED CreateVnfInfra PrepareCompletionHandlerRequest Process")
+ logger.trace("STARTED CreateVnfInfra PrepareCompletionHandlerRequest Process")
try {
String requestInfo = execution.getVariable("CREVI_requestInfo")
@@ -378,52 +382,52 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor {
</aetgt:MsoCompletionRequest>"""
execution.setVariable("CREVI_completionHandlerRequest", request)
- msoLogger.debug("Completion Handler Request is: " + request)
+ logger.debug("Completion Handler Request is: " + request)
execution.setVariable("WorkflowResponse", "Success") // for junits
} catch (Exception ex) {
- msoLogger.debug("Error Occured in CreateVnfInfra PrepareCompletionHandlerRequest Process " + ex.getMessage())
+ logger.debug("Error Occured in CreateVnfInfra PrepareCompletionHandlerRequest Process " + ex.getMessage())
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in CreateVnfInfra PrepareCompletionHandlerRequest Process")
}
- msoLogger.trace("COMPLETED CreateVnfInfra PrepareCompletionHandlerRequest Process")
+ logger.trace("COMPLETED CreateVnfInfra PrepareCompletionHandlerRequest Process")
}
public void sendErrorResponse(DelegateExecution execution){
execution.setVariable("prefix",Prefix)
- msoLogger.trace("STARTED CreateVnfInfra sendErrorResponse Process")
+ logger.trace("STARTED CreateVnfInfra sendErrorResponse Process")
try {
def sentSyncResponse = execution.getVariable("CREVI_sentSyncResponse")
if(sentSyncResponse == false){
WorkflowException wfex = execution.getVariable("WorkflowException")
String response = exceptionUtil.buildErrorResponseXml(wfex)
- msoLogger.debug(response)
+ logger.debug(response)
sendWorkflowResponse(execution, 500, response)
}else{
- msoLogger.debug("Not Sending Error Response. Sync Response Already Sent")
+ logger.debug("Not Sending Error Response. Sync Response Already Sent")
}
} catch (Exception ex) {
- msoLogger.debug("Error Occured in CreateVnfInfra sendErrorResponse Process " + ex.getMessage())
+ logger.debug("Error Occured in CreateVnfInfra sendErrorResponse Process " + ex.getMessage())
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in CreateVnfInfra sendErrorResponse Process")
}
- msoLogger.trace("COMPLETED CreateVnfInfra sendErrorResponse Process")
+ logger.trace("COMPLETED CreateVnfInfra sendErrorResponse Process")
}
public void prepareFalloutRequest(DelegateExecution execution){
execution.setVariable("prefix",Prefix)
- msoLogger.trace("STARTED CreateVnfInfra prepareFalloutRequest Process")
+ logger.trace("STARTED CreateVnfInfra prepareFalloutRequest Process")
try {
WorkflowException wfex = execution.getVariable("WorkflowException")
- msoLogger.debug(" Incoming Workflow Exception: " + wfex.toString())
+ logger.debug(" Incoming Workflow Exception: " + wfex.toString())
String requestInfo = execution.getVariable("CREVI_requestInfo")
- msoLogger.debug(" Incoming Request Info: " + requestInfo)
+ logger.debug(" Incoming Request Info: " + requestInfo)
String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo)
@@ -431,30 +435,30 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor {
} catch (Exception ex) {
- msoLogger.debug("Error Occured in CreateVnfInfra prepareFalloutRequest Process " + ex.getMessage())
+ logger.debug("Error Occured in CreateVnfInfra prepareFalloutRequest Process " + ex.getMessage())
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in CreateVnfInfra prepareFalloutRequest Process")
}
- msoLogger.trace("COMPLETED CreateVnfInfra prepareFalloutRequest Process")
+ logger.trace("COMPLETED CreateVnfInfra prepareFalloutRequest Process")
}
public void queryCatalogDB (DelegateExecution execution) {
execution.setVariable("prefix",Prefix)
- msoLogger.trace("STARTED CreateVnfInfra QueryCatalogDB Process")
+ logger.trace("STARTED CreateVnfInfra QueryCatalogDB Process")
try {
//Get Vnf Info
String vnfModelInfo = execution.getVariable("CREVI_vnfModelInfo")
String vnfModelCustomizationUuid = jsonUtil.getJsonValueForKey(vnfModelInfo, "modelCustomizationUuid")
- msoLogger.debug("querying Catalog DB by vnfModelCustomizationUuid: " + vnfModelCustomizationUuid)
+ logger.debug("querying Catalog DB by vnfModelCustomizationUuid: " + vnfModelCustomizationUuid)
JSONArray vnfs = catalogDbUtils.getAllVnfsByVnfModelCustomizationUuid(execution,
vnfModelCustomizationUuid, "v2")
- msoLogger.debug("obtained VNF list: " + vnfs)
+ logger.debug("obtained VNF list: " + vnfs)
if (vnfs == null) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "No matching VNFs in Catalog DB for vnfModelCustomizationUuid=" + vnfModelCustomizationUuid, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "No matching VNFs in Catalog DB for vnfModelCustomizationUuid=" + vnfModelCustomizationUuid, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "");
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "No matching VNFs in Catalog DB for vnfModelCustomizationUuid=" + vnfModelCustomizationUuid)
}
@@ -462,7 +466,7 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor {
JSONObject vnf = vnfs.get(0)
if (vnf == null) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "No matching VNF in Catalog DB for vnfModelCustomizationUuid=" + vnfModelCustomizationUuid, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "No matching VNF in Catalog DB for vnfModelCustomizationUuid=" + vnfModelCustomizationUuid, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "");
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "No matching VNF in Catalog DB for vnfModelCustomizationUuid=" + vnfModelCustomizationUuid)
}
@@ -481,63 +485,63 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor {
}catch(BpmnError e) {
throw e;
}catch(Exception ex) {
- msoLogger.debug("Error Occurred in CreateVnfInfra QueryCatalogDB Process " + ex.getMessage())
+ logger.debug("Error Occurred in CreateVnfInfra QueryCatalogDB Process " + ex.getMessage())
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occurred in CreateVnfInfra QueryCatalogDB Process")
}
- msoLogger.trace("COMPLETED CreateVnfInfra QueryCatalogDb Process")
+ logger.trace("COMPLETED CreateVnfInfra QueryCatalogDb Process")
}
public void createPlatform (DelegateExecution execution) {
- msoLogger.trace("START createPlatform")
+ logger.trace("START createPlatform")
String request = execution.getVariable("bpmnRequest")
String platformName = jsonUtil.getJsonValue(request, "requestDetails.platform.platformName")
String vnfId = execution.getVariable("CREVI_vnfId")
- msoLogger.debug("Platform NAME: " + platformName)
- msoLogger.debug("VnfID: " + vnfId)
+ logger.debug("Platform NAME: " + platformName)
+ logger.debug("VnfID: " + vnfId)
if(platformName == null||platformName.equals("")){
String msg = "Exception in createPlatform. platformName was not found in the request.";
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}else{
- msoLogger.debug("platformName was found.")
+ logger.debug("platformName was found.")
try{
AAICreateResources aaiCR = new AAICreateResources()
aaiCR.createAAIPlatform(platformName, vnfId)
}catch(Exception ex){
String msg = "Exception in createPlatform. " + ex.getMessage();
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
}
- msoLogger.trace("Exit createPlatform")
+ logger.trace("Exit createPlatform")
}
public void createLineOfBusiness (DelegateExecution execution) {
- msoLogger.trace("START createLineOfBusiness")
+ logger.trace("START createLineOfBusiness")
String request = execution.getVariable("bpmnRequest")
String lineOfBusiness = jsonUtil.getJsonValue(request, "requestDetails.lineOfBusiness.lineOfBusinessName")
String vnfId = execution.getVariable("CREVI_vnfId")
- msoLogger.debug("LineOfBusiness NAME: " + lineOfBusiness)
- msoLogger.debug("VnfID: " + vnfId)
+ logger.debug("LineOfBusiness NAME: " + lineOfBusiness)
+ logger.debug("VnfID: " + vnfId)
if(lineOfBusiness == null || lineOfBusiness.equals("")){
- msoLogger.debug("LineOfBusiness was not found. Continuing on with flow...")
+ logger.debug("LineOfBusiness was not found. Continuing on with flow...")
}else{
- msoLogger.debug("LineOfBusiness was found.")
+ logger.debug("LineOfBusiness was found.")
try{
AAICreateResources aaiCR = new AAICreateResources()
aaiCR.createAAILineOfBusiness(lineOfBusiness, vnfId)
}catch(Exception ex){
String msg = "Exception in LineOfBusiness. " + ex.getMessage();
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + ex)
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + ex)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
}
- msoLogger.trace("Exit createLineOfBusiness")
+ logger.trace("Exit createLineOfBusiness")
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeActivateSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeActivateSDNCNetworkResource.groovy
index 66479be973..ccdb5d77cd 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeActivateSDNCNetworkResource.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeActivateSDNCNetworkResource.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2018 Huawei Technologies Co., Ltd. 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
@@ -31,14 +33,15 @@ import org.onap.so.bpmn.common.scripts.MsoUtils
import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils
import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.bpmn.core.UrnPropertiesReader
-import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
/**
* This groovy class supports the <class>ActivateSDNCCNetworkResource.bpmn</class> process.
* flow for SDNC Network Resource Activate
*/
public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DeActivateSDNCNetworkResource.class);
+ private static final Logger logger = LoggerFactory.getLogger( DeActivateSDNCNetworkResource.class);
String Prefix = "DEACTSDNCRES_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
@@ -51,7 +54,7 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor
public void preProcessRequest(DelegateExecution execution) {
- msoLogger.info(" ***** Started preProcessRequest *****")
+ logger.info(" ***** Started preProcessRequest *****")
try {
@@ -126,13 +129,13 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor
throw e;
} catch (Exception ex){
msg = "Exception in preProcessRequest " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
}
public void prepareSDNCRequest(DelegateExecution execution) {
- msoLogger.info(" ***** Started prepareSDNCRequest *****")
+ logger.info(" ***** Started prepareSDNCRequest *****")
try {
// get variables
@@ -327,15 +330,15 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor
String sdncTopologyDeleteRequesAsString = utils.formatXml(sdncTopologyDeleteRequest)
utils.logAudit(sdncTopologyDeleteRequesAsString)
execution.setVariable("sdncAdapterWorkflowRequest", sdncTopologyDeleteRequesAsString)
- msoLogger.info("sdncAdapterWorkflowRequest - " + "\n" + sdncTopologyDeleteRequesAsString)
+ logger.info("sdncAdapterWorkflowRequest - " + "\n" + sdncTopologyDeleteRequesAsString)
} catch (Exception ex) {
String exceptionMessage = " Bpmn error encountered in DeleteSDNCCNetworkResource flow. prepareSDNCRequest() - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
- msoLogger.info(" ***** Exit prepareSDNCRequest *****")
+ logger.info(" ***** Exit prepareSDNCRequest *****")
}
public void prepareUpdateAfterDeActivateSDNCResource(DelegateExecution execution) {
@@ -377,31 +380,31 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor
}
public void postDeactivateSDNCCall(DelegateExecution execution) {
- msoLogger.info(" ***** Started prepareSDNCRequest *****")
+ logger.info(" ***** Started prepareSDNCRequest *****")
String responseCode = execution.getVariable(Prefix + "sdncDeleteReturnCode")
String responseObj = execution.getVariable(Prefix + "SuccessIndicator")
- msoLogger.info("response from sdnc, response code :" + responseCode + " response object :" + responseObj)
- msoLogger.info(" ***** Exit prepareSDNCRequest *****")
+ logger.info("response from sdnc, response code :" + responseCode + " response object :" + responseObj)
+ logger.info(" ***** Exit prepareSDNCRequest *****")
}
public void sendSyncResponse(DelegateExecution execution) {
- msoLogger.debug(" *** sendSyncResponse *** ")
+ logger.debug(" *** sendSyncResponse *** ")
try {
String operationStatus = "finished"
// RESTResponse for main flow
String resourceOperationResp = """{"operationStatus":"${operationStatus}"}""".trim()
- msoLogger.debug(" sendSyncResponse to APIH:" + "\n" + resourceOperationResp)
+ logger.debug(" sendSyncResponse to APIH:" + "\n" + resourceOperationResp)
sendWorkflowResponse(execution, 202, resourceOperationResp)
execution.setVariable("sentSyncResponse", true)
} catch (Exception ex) {
String msg = "Exception in sendSyncResponse:" + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.debug(" ***** Exit sendSyncResponse *****")
+ logger.debug(" ***** Exit sendSyncResponse *****")
}
-} \ No newline at end of file
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Delete3rdONAPE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Delete3rdONAPE2EServiceInstance.groovy
index b718e4a2e0..443c8f6616 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Delete3rdONAPE2EServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Delete3rdONAPE2EServiceInstance.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2018 Huawei Technologies Co., Ltd. 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
@@ -43,7 +45,8 @@ import org.onap.so.client.aai.AAIObjectType
import org.onap.so.client.aai.AAIResourcesClient
import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
-import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
/**
* This groovy class supports the <class>Delete3rdONAPE2EServiceInstance.bpmn</class> process.
@@ -57,19 +60,19 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
JsonUtils jsonUtil = new JsonUtils()
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, Delete3rdONAPE2EServiceInstance.class)
+ private static final Logger logger = LoggerFactory.getLogger( Delete3rdONAPE2EServiceInstance.class);
public void checkSPPartnerInfoFromAAI (DelegateExecution execution) {
- msoLogger.info(" ***** Started checkSPPartnerInfo *****")
+ logger.info(" ***** Started checkSPPartnerInfo *****")
try {
//get bpmn inputs from resource request.
String requestId = execution.getVariable("mso-request-id")
String requestAction = execution.getVariable("requestAction")
- msoLogger.info("The requestAction is: " + requestAction)
+ logger.info("The requestAction is: " + requestAction)
String recipeParamsFromRequest = execution.getVariable("recipeParams")
- msoLogger.info("The recipeParams is: " + recipeParamsFromRequest)
+ logger.info("The recipeParams is: " + recipeParamsFromRequest)
String resourceInput = execution.getVariable("resourceInput")
- msoLogger.info("The resourceInput is: " + resourceInput)
+ logger.info("The resourceInput is: " + resourceInput)
//Get ResourceInput Object
ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class)
// set local resourceInput
@@ -101,13 +104,13 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
} catch (Exception ex){
String msg = "Exception in checkSPPartnerInfoFromAAI " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
// exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
}
public void checkLocallCall (DelegateExecution execution) {
- msoLogger.info(" ***** Started checkLocallCall *****")
+ logger.info(" ***** Started checkLocallCall *****")
boolean isLocalCall = true
String callSource = execution.getVariable(Prefix + "CallSource")
@@ -118,7 +121,7 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
}
public void preProcessRequest(DelegateExecution execution){
- msoLogger.info(" ***** Started preProcessRequest *****")
+ logger.info(" ***** Started preProcessRequest *****")
String msg = ""
try {
@@ -127,53 +130,53 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
String globalSubscriberId = resourceInputObj.getGlobalSubscriberId()
if (isBlank(globalSubscriberId)) {
msg = "Input globalSubscriberId is null"
- msoLogger.error( msg)
+ logger.error(msg)
}
//set local variable
execution.setVariable("globalSubscriberId", globalSubscriberId)
- msoLogger.info( "globalSubscriberId:" + globalSubscriberId)
+ logger.info( "globalSubscriberId:" + globalSubscriberId)
String serviceType = resourceInputObj.getServiceType()
if (isBlank(serviceType)) {
msg = "Input serviceType is null"
- msoLogger.error( msg)
+ logger.error(msg)
}
execution.setVariable("serviceType", serviceType)
- msoLogger.info( "serviceType:" + serviceType)
+ logger.info( "serviceType:" + serviceType)
String operationId = resourceInputObj.getOperationId()
if (isBlank(operationId)) {
msg = "Input operationId is null"
- msoLogger.error( msg)
+ logger.error(msg)
}
execution.setVariable("operationId", operationId)
- msoLogger.info( "operationId:" + operationId)
+ logger.info( "operationId:" + operationId)
String resourceName = resourceInputObj.getResourceInstanceName()
if (isBlank(resourceName)) {
msg = "Input resourceName is null"
- msoLogger.error( msg)
+ logger.error(msg)
}
execution.setVariable("resourceName", resourceName)
- msoLogger.info("resourceName:" + resourceName)
+ logger.info("resourceName:" + resourceName)
String resourceTemplateId = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid()
if (isBlank(resourceTemplateId)) {
msg = "Input resourceTemplateId is null"
- msoLogger.error( msg)
+ logger.error(msg)
}
execution.setVariable("resourceTemplateId", resourceTemplateId)
- msoLogger.info( "resourceTemplateId:" + resourceTemplateId)
+ logger.info( "resourceTemplateId:" + resourceTemplateId)
} catch (Exception ex){
msg = "Exception in preProcessRequest " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
// exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
}
public void prepareUpdateProgress(DelegateExecution execution) {
- msoLogger.info(" ***** Started prepareUpdateProgress *****")
+ logger.info(" ***** Started prepareUpdateProgress *****")
ResourceInput resourceInputObj = execution.getVariable(Prefix + "ResourceInput")
String operType = resourceInputObj.getOperationType()
String resourceCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid()
@@ -202,11 +205,11 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
</soapenv:Envelope>"""
setProgressUpdateVariables(execution, body)
- msoLogger.info(" ***** End prepareUpdateProgress *****")
+ logger.info(" ***** End prepareUpdateProgress *****")
}
public void prepare3rdONAPRequest(DelegateExecution execution) {
- msoLogger.info(" ***** Started prepare3rdONAPRequest *****")
+ logger.info(" ***** Started prepare3rdONAPRequest *****")
String sppartnerUrl = execution.getVariable(Prefix + "SppartnerUrl")
String extAPIPath = sppartnerUrl + '/serviceOrder'
@@ -257,12 +260,12 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
String payload = externalAPIUtil.setTemplate(ExternalAPIUtil.PostServiceOrderRequestsTemplate, valueMap)
execution.setVariable(Prefix + "Payload", payload)
- msoLogger.info( "Exit " + prepare3rdONAPRequest)
+ logger.info( "Exit " + prepare3rdONAPRequest)
}
private void queryServicefrom3rdONAP(DelegateExecution execution)
{
- msoLogger.info(" ***** Started queryServicefrom3rdONAP *****")
+ logger.info(" ***** Started queryServicefrom3rdONAP *****")
try {
String globalSubscriberId = execution.getVariable("globalSubscriberId")
@@ -271,7 +274,7 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
//https://{api_url}/nbi/api/v1/service?relatedParty.id=${globalSubscriberId}
String sppartnerUrl = execution.getVariable(Prefix + "SppartnerUrl")
String extAPIPath = sppartnerUrl + "/service?relatedParty.id=" + globalSubscriberId
- msoLogger.debug("queryServicefrom3rdONAP externalAPIURL is: " + extAPIPath)
+ logger.debug("queryServicefrom3rdONAP externalAPIURL is: " + extAPIPath)
ExternalAPIUtil externalAPIUtil = new ExternalAPIUtilFactory().create()
@@ -279,17 +282,17 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
int responseCode = response.getStatus()
execution.setVariable(Prefix + "GetServiceResponseCode", responseCode)
- msoLogger.debug("Get Service response code is: " + responseCode)
+ logger.debug("Get Service response code is: " + responseCode)
String extApiResponse = response.readEntity(String.class)
execution.setVariable(Prefix + "GetServiceResponse", extApiResponse)
- msoLogger.debug("queryServicefrom3rdONAP response body is: " + extApiResponse)
+ logger.debug("queryServicefrom3rdONAP response body is: " + extApiResponse)
//Process Response //200 OK 201 CREATED 202 ACCEPTED
if(responseCode == 200 || responseCode == 201 || responseCode == 202 )
{
- msoLogger.debug("Get Service Received a Good Response")
+ logger.debug("Get Service Received a Good Response")
JSONArray responseList = new JSONArray(extApiResponse)
for(JSONObject obj : responseList) {
String svcId = obj.get("id")
@@ -302,22 +305,22 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
}
}
else{
- msoLogger.error("Get Service Received a Bad Response Code. Response Code is: " + responseCode)
+ logger.error("Get Service Received a Bad Response Code. Response Code is: " + responseCode)
// exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Get Service Received a bad response from 3rdONAP External API")
}
}catch(Exception e) {
- msoLogger.error("queryServicefrom3rdONAP exception:" + e.getMessage())
+ logger.error("queryServicefrom3rdONAP exception:" + e.getMessage())
}
- msoLogger.info( "Exit " + queryServicefrom3rdONAP)
+ logger.info( "Exit " + queryServicefrom3rdONAP)
}
public void doDeleteE2ESIin3rdONAP(DelegateExecution execution) {
- msoLogger.info(" ***** Started doDeleteE2ESIin3rdONAP *****")
+ logger.info(" ***** Started doDeleteE2ESIin3rdONAP *****")
try {
String extAPIPath = execution.getVariable("ExternalAPIURL")
String payload = execution.getVariable(Prefix + "Payload")
- msoLogger.debug("doDeleteE2ESIin3rdONAP externalAPIURL is: " + extAPIPath)
- msoLogger.debug("doDeleteE2ESIin3rdONAP payload is: " + payload)
+ logger.debug("doDeleteE2ESIin3rdONAP externalAPIURL is: " + extAPIPath)
+ logger.debug("doDeleteE2ESIin3rdONAP payload is: " + payload)
ExternalAPIUtil externalAPIUtil = new ExternalAPIUtilFactory().create()
execution.setVariable("ServiceOrderId", "")
@@ -326,42 +329,42 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
int responseCode = response.getStatus()
execution.setVariable(Prefix + "PostServiceOrderResponseCode", responseCode)
- msoLogger.debug("Post ServiceOrder response code is: " + responseCode)
+ logger.debug("Post ServiceOrder response code is: " + responseCode)
String extApiResponse = response.readEntity(String.class)
JSONObject responseObj = new JSONObject(extApiResponse)
execution.setVariable(Prefix + "PostServiceOrderResponse", extApiResponse)
- msoLogger.debug("doDeleteE2ESIin3rdONAP response body is: " + extApiResponse)
+ logger.debug("doDeleteE2ESIin3rdONAP response body is: " + extApiResponse)
//Process Response
if(responseCode == 200 || responseCode == 201 || responseCode == 202 )
//200 OK 201 CREATED 202 ACCEPTED
{
- msoLogger.debug("Post ServiceOrder Received a Good Response")
+ logger.debug("Post ServiceOrder Received a Good Response")
String serviceOrderId = responseObj.get("id")
execution.setVariable(Prefix + "SuccessIndicator", true)
execution.setVariable("ServiceOrderId", serviceOrderId)
- msoLogger.info("Post ServiceOrderid is: " + serviceOrderId)
+ logger.info("Post ServiceOrderid is: " + serviceOrderId)
}
else{
- msoLogger.error("Post ServiceOrder Received a Bad Response Code. Response Code is: " + responseCode)
+ logger.error("Post ServiceOrder Received a Bad Response Code. Response Code is: " + responseCode)
// exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Post ServiceOrder Received a bad response from 3rdONAP External API")
}
}catch(Exception e) {
- msoLogger.error("doDeleteE2ESIin3rdONAP exception:" + e.getMessage())
+ logger.error("doDeleteE2ESIin3rdONAP exception:" + e.getMessage())
}
- msoLogger.info( "Exit " + doDeleteE2ESIin3rdONAP)
+ logger.info( "Exit " + doDeleteE2ESIin3rdONAP)
}
public void getE2ESIProgressin3rdONAP(DelegateExecution execution) {
- msoLogger.info(" ***** Started getE2ESIProgressin3rdONAP *****")
+ logger.info(" ***** Started getE2ESIProgressin3rdONAP *****")
try {
String extAPIPath = execution.getVariable("ExternalAPIURL")
extAPIPath += "/" + execution.getVariable("ServiceOrderId")
- msoLogger.debug("getE2ESIProgressin3rdONAP delete externalAPIURL is: " + extAPIPath)
+ logger.debug("getE2ESIProgressin3rdONAP delete externalAPIURL is: " + extAPIPath)
ExternalAPIUtil externalAPIUtil = new ExternalAPIUtilFactory().create()
@@ -369,18 +372,18 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
int responseCode = response.getStatus()
execution.setVariable(Prefix + "GetServiceOrderResponseCode", responseCode)
- msoLogger.debug("Get ServiceOrder response code is: " + responseCode)
+ logger.debug("Get ServiceOrder response code is: " + responseCode)
String extApiResponse = response.readEntity(String.class)
JSONObject responseObj = new JSONObject(extApiResponse)
execution.setVariable(Prefix + "GetServiceOrderResponse", extApiResponse)
- utils.log("DEBUG", "getE2ESIProgressin3rdONAP delete response body is: " + extApiResponse)
+ logger.debug( "getE2ESIProgressin3rdONAP delete response body is: " + extApiResponse)
//Process Response //200 OK 201 CREATED 202 ACCEPTED
if(responseCode == 200 || responseCode == 201 || responseCode == 202 )
{
- msoLogger.debug("Get ServiceOrder Received a Good Response")
+ logger.debug("Get ServiceOrder Received a Good Response")
String orderState = responseObj.get("state")
if("REJECTED".equalsIgnoreCase(orderState)) {
@@ -398,7 +401,7 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
execution.setVariable("progress", 100)
execution.setVariable("status", "error")
execution.setVariable("statusDescription", "Delete Service Order Status get null sppartnerServiceId")
- msoLogger.error("null sppartnerServiceId while getting progress from externalAPI")
+ logger.error("null sppartnerServiceId while getting progress from externalAPI")
return
}
execution.setVariable(Prefix + "SppartnerServiceId", sppartnerServiceId)
@@ -435,7 +438,7 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
}
}
else{
- msoLogger.debug("Get ServiceOrder Received a Bad Response Code. Response Code is: " + responseCode)
+ logger.debug("Get ServiceOrder Received a Bad Response Code. Response Code is: " + responseCode)
execution.setVariable("progress", 100)
execution.setVariable("status", "error")
execution.setVariable("statusDescription", "Get Delete ServiceOrder Received a bad response")
@@ -445,9 +448,9 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
execution.setVariable("progress", 100)
execution.setVariable("status", "error")
execution.setVariable("statusDescription", "Get Delete ServiceOrder Exception")
- msoLogger.error("getE2ESIProgressin3rdONAP exception:" + e.getMessage())
+ logger.error("getE2ESIProgressin3rdONAP exception:" + e.getMessage())
}
- msoLogger.info( "Exit " + getE2ESIProgressin3rdONAP)
+ logger.info( "Exit " + getE2ESIProgressin3rdONAP)
}
/**
@@ -457,12 +460,12 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
try {
Thread.sleep(5000)
} catch(InterruptedException e) {
- msoLogger.error("Time Delay exception" + e )
+ logger.error("Time Delay exception" + e )
}
}
private void getSPPartnerInAAI(DelegateExecution execution) {
- msoLogger.info(" ***** Started getSPPartnerInAAI *****")
+ logger.info(" ***** Started getSPPartnerInAAI *****")
try {
String id = execution.getVariable(Prefix + "SppartnerId")
@@ -470,33 +473,33 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SP_PARTNER, id)
SpPartner sp = client.get(uri).asBean(SpPartner.class).get()
- msoLogger.debug("GET sppartner Received a Good Response")
+ logger.debug("GET sppartner Received a Good Response")
execution.setVariable(Prefix + "SuccessIndicator", true)
execution.setVariable(Prefix + "FoundIndicator", true)
// String sppartnerId = sp.getSpPartnerId()
// execution.setVariable(Prefix + "SppartnerId", sppartnerId)
-// msoLogger.debug(" SppartnerId is: " + sppartnerId)
+// logger.debug(" SppartnerId is: " + sppartnerId)
String sppartnerUrl = sp.getUrl()
execution.setVariable(Prefix + "SppartnerUrl", sppartnerUrl)
- msoLogger.debug(" SppartnerUrl is: " + sppartnerUrl)
+ logger.debug(" SppartnerUrl is: " + sppartnerUrl)
String callSource = sp.getCallsource()
execution.setVariable(Prefix + "CallSource", callSource)
- msoLogger.debug(" CallSource is: " + callSource)
+ logger.debug(" CallSource is: " + callSource)
String sppartnerVersion = sp.getResourceVersion()
execution.setVariable(Prefix + "SppartnerVersion", sppartnerVersion)
- msoLogger.debug(" Resource Version is: " + sppartnerVersion)
+ logger.debug(" Resource Version is: " + sppartnerVersion)
} catch (Exception ex) {
String msg = "Exception in Delete3rdONAPE2EServiceInstance.saveSPPartnerInAAI. " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
// throw new BpmnError("MSOWorkflowException")
}
- msoLogger.info( "Exit " + getSPPartnerInAAI)
+ logger.info( "Exit " + getSPPartnerInAAI)
}
public void deleteSPPartnerInAAI(DelegateExecution execution) {
- msoLogger.info(" ***** Started deleteSPPartnerInAAI *****")
+ logger.info(" ***** Started deleteSPPartnerInAAI *****")
try {
String sppartnerId = execution.getVariable(Prefix + "SppartnerId")
@@ -504,16 +507,16 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
AAIResourcesClient client = new AAIResourcesClient()
AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SP_PARTNER, sppartnerId)
client.delete(uri)
- msoLogger.debug("Delete sppartner Received a Good Response")
+ logger.debug("Delete sppartner Received a Good Response")
execution.setVariable(Prefix + "SuccessIndicator", true)
} catch (Exception ex) {
String msg = "Exception in Delete3rdONAPE2EServiceInstance.deleteSPPartnerInAAI. " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
// throw new BpmnError("MSOWorkflowException")
}
- msoLogger.info( "Exit " + deleteSPPartnerInAAI)
+ logger.info( "Exit " + deleteSPPartnerInAAI)
}
private void setProgressUpdateVariables(DelegateExecution execution, String body) {
@@ -523,30 +526,30 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
}
public void postProcess(DelegateExecution execution){
- msoLogger.info(" ***** Started postProcess *****")
+ logger.info(" ***** Started postProcess *****")
String responseCode = execution.getVariable(Prefix + "PutSppartnerResponseCode")
String responseObj = execution.getVariable(Prefix + "PutSppartnerResponse")
- msoLogger.info("response from AAI for put sppartner, response code :" + responseCode + " response object :" + responseObj)
- msoLogger.info(" ***** Exit postProcess *****")
+ logger.info("response from AAI for put sppartner, response code :" + responseCode + " response object :" + responseObj)
+ logger.info(" ***** Exit postProcess *****")
}
public void sendSyncResponse (DelegateExecution execution) {
- msoLogger.debug(" *** sendSyncResponse *** ")
+ logger.debug(" *** sendSyncResponse *** ")
try {
String operationStatus = "finished"
// RESTResponse for main flow
String resourceOperationResp = """{"operationStatus":"${operationStatus}"}""".trim()
- msoLogger.debug(" sendSyncResponse to APIH:" + "\n" + resourceOperationResp)
+ logger.debug(" sendSyncResponse to APIH:" + "\n" + resourceOperationResp)
sendWorkflowResponse(execution, 202, resourceOperationResp)
execution.setVariable("sentSyncResponse", true)
} catch (Exception ex) {
String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
// exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.debug(" ***** Exit sendSyncResopnse *****")
+ logger.debug(" ***** Exit sendSyncResopnse *****")
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCustomE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCustomE2EServiceInstance.groovy
index 5bb8c83628..a9b1fdaac3 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCustomE2EServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCustomE2EServiceInstance.groovy
@@ -6,6 +6,8 @@
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* Copyright (C) 2017 Huawei Technologies Co., Ltd. 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
@@ -34,7 +36,8 @@ import org.onap.so.bpmn.common.scripts.VidUtils
import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.bpmn.core.UrnPropertiesReader
-import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
import org.springframework.web.util.UriUtils;
import groovy.json.*
@@ -49,23 +52,23 @@ public class DeleteCustomE2EServiceInstance extends AbstractServiceTaskProcessor
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtil = new JsonUtils()
VidUtils vidUtils = new VidUtils()
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DeleteCustomE2EServiceInstance.class);
+ private static final Logger logger = LoggerFactory.getLogger( DeleteCustomE2EServiceInstance.class);
public void preProcessRequest (DelegateExecution execution) {
execution.setVariable("prefix",Prefix)
String msg = ""
- msoLogger.info("Starting preProcessRequest")
+ logger.info("Starting preProcessRequest")
try {
// check for incoming json message/input
String siRequest = execution.getVariable("bpmnRequest")
- msoLogger.debug(siRequest)
+ logger.debug(siRequest)
String requestId = execution.getVariable("mso-request-id")
execution.setVariable("msoRequestId", requestId)
- msoLogger.info("Input Request:" + siRequest + " reqId:" + requestId)
+ logger.info("Input Request:" + siRequest + " reqId:" + requestId)
String serviceInstanceId = execution.getVariable("serviceInstanceId")
if (isBlank(serviceInstanceId)) {
@@ -79,7 +82,7 @@ public class DeleteCustomE2EServiceInstance extends AbstractServiceTaskProcessor
// if (isBlank(productFamilyId))
// {
// msg = "Input productFamilyId is null"
-// utils.log("INFO", msg, isDebugEnabled)
+// logger.info( msg)
// //exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
// } else {
// execution.setVariable("productFamilyId", productFamilyId)
@@ -91,7 +94,7 @@ public class DeleteCustomE2EServiceInstance extends AbstractServiceTaskProcessor
String globalSubscriberId = jsonUtil.getJsonValue(siRequest, "globalSubscriberId")
if (isBlank(globalSubscriberId)) {
msg = "Input globalSubscriberId' is null"
- msoLogger.info(msg)
+ logger.info(msg)
} else {
execution.setVariable("globalSubscriberId", globalSubscriberId)
}
@@ -100,7 +103,7 @@ public class DeleteCustomE2EServiceInstance extends AbstractServiceTaskProcessor
String subscriptionServiceType = jsonUtil.getJsonValue(siRequest, "serviceType")
if (isBlank(subscriptionServiceType)) {
msg = "Input subscriptionServiceType is null"
- msoLogger.debug(msg)
+ logger.debug(msg)
//exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
} else {
execution.setVariable("subscriptionServiceType", subscriptionServiceType)
@@ -113,31 +116,31 @@ public class DeleteCustomE2EServiceInstance extends AbstractServiceTaskProcessor
throw e
} catch (Exception ex){
msg = "Exception in preProcessRequest " + ex.getMessage()
- msoLogger.info(msg)
+ logger.info(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("Exit preProcessRequest")
+ logger.trace("Exit preProcessRequest")
}
public void sendSyncResponse (DelegateExecution execution) {
- msoLogger.trace("Staring sendSyncResponse")
+ logger.trace("Staring sendSyncResponse")
try {
String operationId = execution.getVariable("operationId")
String syncResponse = """{"operationId":"${operationId}"}""".trim()
- msoLogger.info("sendSynchResponse: xmlSyncResponse - " + "\n" + syncResponse)
+ logger.info("sendSynchResponse: xmlSyncResponse - " + "\n" + syncResponse)
sendWorkflowResponse(execution, 202, syncResponse)
} catch (Exception ex) {
String msg = "Exception in sendSyncResponse: " + ex.getMessage()
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
- msoLogger.trace("Exit sendSyncResopnse")
+ logger.trace("Exit sendSyncResopnse")
}
public void sendSyncError (DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- msoLogger.info("Starting sendSyncError")
+ logger.info("Starting sendSyncError")
try {
String errorMessage = ""
@@ -154,17 +157,17 @@ public class DeleteCustomE2EServiceInstance extends AbstractServiceTaskProcessor
<aetgt:ErrorCode>7000</aetgt:ErrorCode>
</aetgt:WorkflowException>"""
- msoLogger.info(buildworkflowException)
+ logger.info(buildworkflowException)
sendWorkflowResponse(execution, 500, buildworkflowException)
} catch (Exception ex) {
- msoLogger.info("Sending Sync Error Activity Failed. " + "\n" + ex.getMessage())
+ logger.info("Sending Sync Error Activity Failed. " + "\n" + ex.getMessage())
}
}
public void prepareCompletionRequest (DelegateExecution execution) {
- msoLogger.trace("Starting prepareCompletion")
+ logger.trace("Starting prepareCompletion")
try {
String requestId = execution.getVariable("msoRequestId")
@@ -185,23 +188,23 @@ public class DeleteCustomE2EServiceInstance extends AbstractServiceTaskProcessor
String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest)
execution.setVariable("completionRequest", xmlMsoCompletionRequest)
- msoLogger.info(" Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest)
+ logger.info(" Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest)
} catch (Exception ex) {
String msg = " Exception in prepareCompletion:" + ex.getMessage()
- msoLogger.info(msg)
+ logger.info(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("Exit prepareCompletionRequest")
+ logger.trace("Exit prepareCompletionRequest")
}
public void prepareFalloutRequest(DelegateExecution execution){
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- msoLogger.trace("Starting prepareFalloutRequest ")
+ logger.trace("Starting prepareFalloutRequest ")
try {
WorkflowException wfex = execution.getVariable("WorkflowException")
- msoLogger.info(" Input Workflow Exception: " + wfex.toString())
+ logger.info(" Input Workflow Exception: " + wfex.toString())
String requestId = execution.getVariable("msoRequestId")
String source = execution.getVariable("source")
String requestInfo =
@@ -214,7 +217,7 @@ public class DeleteCustomE2EServiceInstance extends AbstractServiceTaskProcessor
String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo)
execution.setVariable("falloutRequest", falloutRequest)
} catch (Exception ex) {
- msoLogger.info("Exception prepareFalloutRequest:" + ex.getMessage())
+ logger.info("Exception prepareFalloutRequest:" + ex.getMessage())
String errorException = " Bpmn error encountered in CreateServiceInstance flow. FalloutHandlerRequest, buildErrorResponse() - " + ex.getMessage()
String requestId = execution.getVariable("msoRequestId")
String falloutRequest =
@@ -234,7 +237,7 @@ public class DeleteCustomE2EServiceInstance extends AbstractServiceTaskProcessor
execution.setVariable("falloutRequest", falloutRequest)
}
- msoLogger.trace("Exit prepareFalloutRequest")
+ logger.trace("Exit prepareFalloutRequest")
}
@@ -246,7 +249,7 @@ public class DeleteCustomE2EServiceInstance extends AbstractServiceTaskProcessor
execution.setVariable("prefix", Prefix)
try {
- msoLogger.info("Starting prepareDBRequest")
+ logger.info("Starting prepareDBRequest")
String requestId = execution.getVariable("DELSI_requestId")
String statusMessage = "E2E Service Instance successfully deleted."
@@ -269,7 +272,7 @@ public class DeleteCustomE2EServiceInstance extends AbstractServiceTaskProcessor
String buildDeleteDBRequestAsString = utils.formatXml(dbRequest)
execution.setVariable("DELSI_createDBRequest", buildDeleteDBRequestAsString)
- msoLogger.info(buildDeleteDBRequestAsString)
+ logger.info(buildDeleteDBRequestAsString)
} catch (Exception ex) {
// try error in method block
@@ -287,7 +290,7 @@ public class DeleteCustomE2EServiceInstance extends AbstractServiceTaskProcessor
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix", Prefix)
- msoLogger.trace("Start prepareDBRequestError")
+ logger.trace("Start prepareDBRequestError")
try {
String requestId = execution.getVariable("DELSI_requestId")
@@ -317,7 +320,7 @@ public class DeleteCustomE2EServiceInstance extends AbstractServiceTaskProcessor
String buildDBRequestAsString = utils.formatXml(dbRequest)
execution.setVariable("DELSI_createDBInfraErrorRequest", buildDBRequestAsString)
- msoLogger.info(buildDBRequestAsString)
+ logger.info(buildDBRequestAsString)
} catch (Exception ex) {
// try error in method block
@@ -336,7 +339,7 @@ public class DeleteCustomE2EServiceInstance extends AbstractServiceTaskProcessor
* Init the service Operation Status
*/
public void prepareInitServiceOperationStatus(DelegateExecution execution){
- msoLogger.debug("======== STARTED prepareInitServiceOperationStatus Process ======== ")
+ logger.debug("======== STARTED prepareInitServiceOperationStatus Process ======== ")
try{
String serviceId = execution.getVariable("serviceInstanceId")
String operationId = execution.getVariable("operationId")
@@ -345,12 +348,12 @@ public class DeleteCustomE2EServiceInstance extends AbstractServiceTaskProcessor
String progress = "0"
String reason = ""
String operationContent = "Prepare service creation"
- msoLogger.debug("Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId)
+ logger.debug("Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId)
serviceId = UriUtils.encode(serviceId,"UTF-8")
def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution)
execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint)
- msoLogger.debug("DB Adapter Endpoint is: " + dbAdapterEndpoint)
+ logger.debug("DB Adapter Endpoint is: " + dbAdapterEndpoint)
String payload =
"""<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
@@ -372,12 +375,12 @@ public class DeleteCustomE2EServiceInstance extends AbstractServiceTaskProcessor
payload = utils.formatXml(payload)
execution.setVariable("CVFMI_updateServiceOperStatusRequest", payload)
- msoLogger.debug("Outgoing updateServiceOperStatusRequest: \n" + payload)
+ logger.debug("Outgoing updateServiceOperStatusRequest: \n" + payload)
}catch(Exception e){
- msoLogger.error("Exception Occured Processing prepareInitServiceOperationStatus. Exception is:\n" + e)
+ logger.error("Exception Occured Processing prepareInitServiceOperationStatus. Exception is:\n" + e)
execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during prepareInitServiceOperationStatus Method:\n" + e.getMessage())
}
- msoLogger.debug("======== COMPLETED prepareInitServiceOperationStatus Process ======== ")
+ logger.debug("======== COMPLETED prepareInitServiceOperationStatus Process ======== ")
}
}
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 05e0f23925..7abdd49d1d 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
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2018 Huawei Technologies Co., Ltd. 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
@@ -39,7 +41,8 @@ import org.onap.so.client.aai.AAIObjectType
import org.onap.so.client.aai.AAIResourcesClient
import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
-import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils
import java.util.UUID;
@@ -64,20 +67,20 @@ public class DeleteDeviceResource extends AbstractServiceTaskProcessor {
JsonUtils jsonUtil = new JsonUtils()
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DeleteDeviceResource.class)
+ private static final Logger logger = LoggerFactory.getLogger( DeleteDeviceResource.class);
public void preProcessRequest(DelegateExecution execution){
- msoLogger.info(" ***** Started preProcessRequest *****")
+ logger.info(" ***** Started preProcessRequest *****")
try {
//get bpmn inputs from resource request.
String requestId = execution.getVariable("mso-request-id")
String requestAction = execution.getVariable("requestAction")
- msoLogger.info("The requestAction is: " + requestAction)
+ logger.info("The requestAction is: " + requestAction)
String recipeParamsFromRequest = execution.getVariable("recipeParams")
- msoLogger.info("The recipeParams is: " + recipeParamsFromRequest)
+ logger.info("The recipeParams is: " + recipeParamsFromRequest)
String resourceInput = execution.getVariable("resourceInput")
- msoLogger.info("The resourceInput is: " + resourceInput)
+ logger.info("The resourceInput is: " + resourceInput)
//Get ResourceInput Object
ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class)
execution.setVariable(Prefix + "ResourceInput", resourceInputObj)
@@ -101,13 +104,13 @@ public class DeleteDeviceResource extends AbstractServiceTaskProcessor {
} catch (Exception ex){
String msg = "Exception in preProcessRequest " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
// exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
}
private void getDeviceInAAI(DelegateExecution execution) {
- msoLogger.info(" ***** Started getDeviceInAAI *****")
+ logger.info(" ***** Started getDeviceInAAI *****")
try {
String deviceId = execution.getVariable(Prefix + "DeviceId")
@@ -117,19 +120,19 @@ public class DeleteDeviceResource extends AbstractServiceTaskProcessor {
String devClass = dev.getClass ()
execution.setVariable(Prefix + "DeviceClass", devClass)
- msoLogger.debug(" DeviceClass is: " + devClass)
+ logger.debug(" DeviceClass is: " + devClass)
} catch (Exception ex){
String msg = "Exception in getDeviceInAAI " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
// exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.info(" ***** Exit getDeviceInAAI *****")
+ logger.info(" ***** Exit getDeviceInAAI *****")
}
public void checkDevType(DelegateExecution execution){
- msoLogger.info(" ***** Started checkDevType *****")
+ logger.info(" ***** Started checkDevType *****")
try {
String devType = execution.getVariable(Prefix + "DeviceClass")
@@ -142,7 +145,7 @@ public class DeleteDeviceResource extends AbstractServiceTaskProcessor {
} catch (Exception ex){
String msg = "Exception in checkDevType " + ex.getMessage()
- msoLogger.debug( msg)
+ logger.debug( msg)
// exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
}
@@ -154,7 +157,7 @@ public class DeleteDeviceResource extends AbstractServiceTaskProcessor {
}
public void prepareUpdateProgress(DelegateExecution execution) {
- msoLogger.info(" ***** Started prepareUpdateProgress *****")
+ logger.info(" ***** Started prepareUpdateProgress *****")
ResourceInput resourceInputObj = execution.getVariable(Prefix + "ResourceInput")
String operType = resourceInputObj.getOperationType()
String resourceCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid()
@@ -183,51 +186,51 @@ public class DeleteDeviceResource extends AbstractServiceTaskProcessor {
</soapenv:Envelope>"""
setProgressUpdateVariables(execution, body)
- msoLogger.info(" ***** Exit prepareUpdateProgress *****")
+ logger.info(" ***** Exit prepareUpdateProgress *****")
}
public void getVNFTemplatefromSDC(DelegateExecution execution){
- msoLogger.info(" ***** Started getVNFTemplatefromSDC *****")
+ logger.info(" ***** Started getVNFTemplatefromSDC *****")
try {
// To do
} catch (Exception ex){
String msg = "Exception in getVNFTemplatefromSDC " + ex.getMessage()
- msoLogger.debug( msg)
+ logger.debug( msg)
// exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
}
public void postVNFInfoProcess(DelegateExecution execution){
- msoLogger.info(" ***** Started postVNFInfoProcess *****")
+ logger.info(" ***** Started postVNFInfoProcess *****")
try {
// To do
} catch (Exception ex){
String msg = "Exception in postVNFInfoProcess " + ex.getMessage()
- msoLogger.debug( msg)
+ logger.debug( msg)
// exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
}
public void sendSyncResponse (DelegateExecution execution) {
- msoLogger.debug( " *** sendSyncResponse *** ")
+ logger.debug( " *** sendSyncResponse *** ")
try {
String operationStatus = "finished"
// RESTResponse for main flow
String resourceOperationResp = """{"operationStatus":"${operationStatus}"}""".trim()
- msoLogger.debug( " sendSyncResponse to APIH:" + "\n" + resourceOperationResp)
+ logger.debug( " sendSyncResponse to APIH:" + "\n" + resourceOperationResp)
sendWorkflowResponse(execution, 202, resourceOperationResp)
execution.setVariable("sentSyncResponse", true)
} catch (Exception ex) {
String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage()
- msoLogger.debug( msg)
+ logger.debug( msg)
// exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.debug(" ***** Exit sendSyncResopnse *****")
+ logger.debug(" ***** Exit sendSyncResopnse *****")
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteGenericALaCarteServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteGenericALaCarteServiceInstance.groovy
index ec2fed50c3..3542828a98 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteGenericALaCarteServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteGenericALaCarteServiceInstance.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -31,7 +33,8 @@ import org.onap.so.bpmn.common.scripts.MsoUtils
import org.onap.so.bpmn.common.scripts.VidUtils
import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.bpmn.core.json.JsonUtils
-import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
import groovy.json.*
@@ -46,14 +49,14 @@ public class DeleteGenericALaCarteServiceInstance extends AbstractServiceTaskPro
JsonUtils jsonUtil = new JsonUtils()
VidUtils vidUtils = new VidUtils()
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DeleteGenericALaCarteServiceInstance.class);
+ private static final Logger logger = LoggerFactory.getLogger( DeleteGenericALaCarteServiceInstance.class);
public void preProcessRequest (DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix",Prefix)
String msg = ""
- msoLogger.trace("Start preProcessRequest")
+ logger.trace("Start preProcessRequest")
try {
// check for incoming json message/input
@@ -61,7 +64,7 @@ public class DeleteGenericALaCarteServiceInstance extends AbstractServiceTaskPro
String requestId = execution.getVariable("mso-request-id")
execution.setVariable("msoRequestId", requestId)
- msoLogger.debug("Input Request:" + siRequest + " reqId:" + requestId)
+ logger.debug("Input Request:" + siRequest + " reqId:" + requestId)
String serviceInstanceId = execution.getVariable("serviceInstanceId")
if (isBlank(serviceInstanceId)) {
@@ -76,11 +79,11 @@ public class DeleteGenericALaCarteServiceInstance extends AbstractServiceTaskPro
String serviceModelInfo = jsonUtil.getJsonValue(siRequest, "requestDetails.modelInfo")
if (isBlank(serviceModelInfo)) {
msg = "Input serviceModelInfo is null"
- msoLogger.debug(msg)
+ logger.debug(msg)
} else
{
execution.setVariable("serviceModelInfo", serviceModelInfo)
- //msoLogger.debug("modelInfo" + serviceModelInfo)
+ //logger.debug("modelInfo" + serviceModelInfo)
}
//requestInfo
@@ -88,7 +91,7 @@ public class DeleteGenericALaCarteServiceInstance extends AbstractServiceTaskPro
if (isBlank(productFamilyId))
{
msg = "Input productFamilyId is null"
- msoLogger.debug(msg)
+ logger.debug(msg)
//exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
} else {
execution.setVariable("productFamilyId", productFamilyId)
@@ -100,7 +103,7 @@ public class DeleteGenericALaCarteServiceInstance extends AbstractServiceTaskPro
String globalSubscriberId = jsonUtil.getJsonValue(siRequest, "requestDetails.subscriberInfo.globalSubscriberId")
if (isBlank(globalSubscriberId)) {
msg = "Input globalSubscriberId' is null"
- msoLogger.debug(msg)
+ logger.debug(msg)
} else {
execution.setVariable("globalSubscriberId", globalSubscriberId)
}
@@ -109,7 +112,7 @@ public class DeleteGenericALaCarteServiceInstance extends AbstractServiceTaskPro
String subscriptionServiceType = jsonUtil.getJsonValue(siRequest, "requestDetails.requestParameters.subscriptionServiceType")
if (isBlank(subscriptionServiceType)) {
msg = "Input subscriptionServiceType is null"
- msoLogger.debug(msg)
+ logger.debug(msg)
//exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
} else {
execution.setVariable("subscriptionServiceType", subscriptionServiceType)
@@ -133,22 +136,22 @@ public class DeleteGenericALaCarteServiceInstance extends AbstractServiceTaskPro
}
}
- msoLogger.debug("User Input Parameters map: " + userParams.toString())
+ logger.debug("User Input Parameters map: " + userParams.toString())
execution.setVariable("serviceInputParams", inputMap)
} catch (BpmnError e) {
throw e;
} catch (Exception ex){
msg = "Exception in preProcessRequest " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("Exit preProcessRequest")
+ logger.trace("Exit preProcessRequest")
}
public void sendSyncResponse (DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- msoLogger.trace("Start sendSyncResponse")
+ logger.trace("Start sendSyncResponse")
try {
String requestId = execution.getVariable("msoRequestId")
@@ -156,19 +159,19 @@ public class DeleteGenericALaCarteServiceInstance extends AbstractServiceTaskPro
// RESTResponse (for API Handler (APIH) Reply Task)
String syncResponse = """{"requestReferences":{"instanceId":"${serviceInstanceId}","requestId":"${requestId}"}}""".trim()
- msoLogger.debug(" sendSynchResponse: xmlSyncResponse - " + "\n" + syncResponse)
+ logger.debug(" sendSynchResponse: xmlSyncResponse - " + "\n" + syncResponse)
sendWorkflowResponse(execution, 202, syncResponse)
} catch (Exception ex) {
String msg = "Exception in sendSyncResponse: " + ex.getMessage()
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
- msoLogger.trace("Exit sendSyncResopnse")
+ logger.trace("Exit sendSyncResopnse")
}
public void sendSyncError (DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- msoLogger.trace("Start sendSyncError")
+ logger.trace("Start sendSyncError")
try {
String errorMessage = ""
@@ -185,18 +188,18 @@ public class DeleteGenericALaCarteServiceInstance extends AbstractServiceTaskPro
<aetgt:ErrorCode>7000</aetgt:ErrorCode>
</aetgt:WorkflowException>"""
- MsoLogger.info(buildworkflowException)
+ logger.info(buildworkflowException)
sendWorkflowResponse(execution, 500, buildworkflowException)
} catch (Exception ex) {
- msoLogger.debug(" Sending Sync Error Activity Failed. " + "\n" + ex.getMessage())
+ logger.debug(" Sending Sync Error Activity Failed. " + "\n" + ex.getMessage())
}
}
public void prepareCompletionRequest (DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- msoLogger.trace("Start prepareCompletion")
+ logger.trace("Start prepareCompletion")
try {
String requestId = execution.getVariable("msoRequestId")
@@ -219,23 +222,23 @@ public class DeleteGenericALaCarteServiceInstance extends AbstractServiceTaskPro
String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest)
execution.setVariable("completionRequest", xmlMsoCompletionRequest)
- msoLogger.debug(" Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest)
+ logger.debug(" Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest)
} catch (Exception ex) {
String msg = " Exception in prepareCompletion:" + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("Exit prepareCompletionRequest")
+ logger.trace("Exit prepareCompletionRequest")
}
public void prepareFalloutRequest(DelegateExecution execution){
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- msoLogger.trace("Start prepareFalloutRequest")
+ logger.trace("Start prepareFalloutRequest")
try {
WorkflowException wfex = execution.getVariable("WorkflowException")
- msoLogger.debug(" Input Workflow Exception: " + wfex.toString())
+ logger.debug(" Input Workflow Exception: " + wfex.toString())
String requestId = execution.getVariable("msoRequestId")
String source = execution.getVariable("source")
String requestInfo =
@@ -248,7 +251,7 @@ public class DeleteGenericALaCarteServiceInstance extends AbstractServiceTaskPro
String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo)
execution.setVariable("falloutRequest", falloutRequest)
} catch (Exception ex) {
- msoLogger.debug("Exception prepareFalloutRequest:" + ex.getMessage())
+ logger.debug("Exception prepareFalloutRequest:" + ex.getMessage())
String errorException = " Bpmn error encountered in CreateServiceInstance flow. FalloutHandlerRequest, buildErrorResponse() - " + ex.getMessage()
String requestId = execution.getVariable("msoRequestId")
String falloutRequest =
@@ -268,7 +271,7 @@ public class DeleteGenericALaCarteServiceInstance extends AbstractServiceTaskPro
execution.setVariable("falloutRequest", falloutRequest)
}
- msoLogger.trace("Exit prepareFalloutRequest ")
+ logger.trace("Exit prepareFalloutRequest ")
}
@@ -280,7 +283,7 @@ public class DeleteGenericALaCarteServiceInstance extends AbstractServiceTaskPro
execution.setVariable("prefix", Prefix)
try {
- msoLogger.trace("Inside prepareDBRequest of DeleteGenericALaCarteServiceInstance ")
+ logger.trace("Inside prepareDBRequest of DeleteGenericALaCarteServiceInstance ")
String requestId = execution.getVariable("DELSI_requestId")
String statusMessage = "Service Instance successfully deleted."
@@ -303,7 +306,7 @@ public class DeleteGenericALaCarteServiceInstance extends AbstractServiceTaskPro
String buildDeleteDBRequestAsString = utils.formatXml(dbRequest)
execution.setVariable("DELSI_createDBRequest", buildDeleteDBRequestAsString)
- msoLogger.info(buildDeleteDBRequestAsString)
+ logger.info(buildDeleteDBRequestAsString)
} catch (Exception ex) {
// try error in method block
@@ -321,7 +324,7 @@ public class DeleteGenericALaCarteServiceInstance extends AbstractServiceTaskPro
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix", Prefix)
- msoLogger.trace("Inside prepareDBRequestError of DeleteGenericALaCarteServiceInstance ")
+ logger.trace("Inside prepareDBRequestError of DeleteGenericALaCarteServiceInstance ")
try {
String requestId = execution.getVariable("DELSI_requestId")
@@ -351,7 +354,7 @@ public class DeleteGenericALaCarteServiceInstance extends AbstractServiceTaskPro
String buildDBRequestAsString = utils.formatXml(dbRequest)
execution.setVariable("DELSI_createDBInfraErrorRequest", buildDBRequestAsString)
- msoLogger.info(buildDBRequestAsString)
+ logger.info(buildDBRequestAsString)
} catch (Exception ex) {
// try error in method block
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteNetworkInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteNetworkInstance.groovy
index 816ba859ee..0008f6fd65 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteNetworkInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteNetworkInstance.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -31,6 +33,8 @@ import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.bpmn.core.json.JsonUtils;
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
import groovy.json.*
@@ -42,7 +46,7 @@ public class DeleteNetworkInstance extends AbstractServiceTaskProcessor {
VidUtils vidUtils = new VidUtils(this)
NetworkUtils networkUtils = new NetworkUtils()
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DeleteNetworkInstance.class);
+ private static final Logger logger = LoggerFactory.getLogger( DeleteNetworkInstance.class);
public InitializeProcessVariables(DelegateExecution execution){
@@ -63,7 +67,7 @@ public class DeleteNetworkInstance extends AbstractServiceTaskProcessor {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix",Prefix)
- msoLogger.trace("Inside preProcessRequest() of " + groovyClassName + "")
+ logger.trace("Inside preProcessRequest() of " + groovyClassName + "")
try {
// initialize flow variables
@@ -79,20 +83,20 @@ public class DeleteNetworkInstance extends AbstractServiceTaskProcessor {
String disableRollback = jsonUtil.getJsonValue(bpmnRequest, "requestDetails.requestInfo.suppressRollback")
if (disableRollback != null) {
execution.setVariable("disableRollback", disableRollback)
- msoLogger.debug("Received 'suppressRollback': " + disableRollback )
+ logger.debug("Received 'suppressRollback': " + disableRollback )
} else {
execution.setVariable("disableRollback", false)
}
- msoLogger.debug(" Set 'disableRollback' : " + execution.getVariable("disableRollback") )
+ logger.debug(" Set 'disableRollback' : " + execution.getVariable("disableRollback") )
} else {
String dataErrorMessage = " Invalid 'bpmnRequest' request."
- msoLogger.debug(dataErrorMessage)
+ logger.debug(dataErrorMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage)
}
} else {
// 'macro' test ONLY, sdncVersion = '1702'
- msoLogger.debug(" 'disableRollback' : " + execution.getVariable("disableRollback") )
+ logger.debug(" 'disableRollback' : " + execution.getVariable("disableRollback") )
}
// get/set 'msoRequestId' and 'mso-request-id'
@@ -138,7 +142,7 @@ public class DeleteNetworkInstance extends AbstractServiceTaskProcessor {
} catch (Exception ex){
sendSyncError(execution)
String exceptionMessage = "Exception Encountered in " + groovyClassName + ", PreProcessRequest() - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
@@ -149,7 +153,7 @@ public class DeleteNetworkInstance extends AbstractServiceTaskProcessor {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix", Prefix)
- msoLogger.trace("Inside getNetworkModelInfo() of DeleteNetworkInstance")
+ logger.trace("Inside getNetworkModelInfo() of DeleteNetworkInstance")
try {
@@ -162,7 +166,7 @@ public class DeleteNetworkInstance extends AbstractServiceTaskProcessor {
} catch (Exception ex) {
sendSyncError(execution)
String exceptionMessage = "Bpmn error encountered in DeleteNetworkInstance flow. getNetworkModelInfo() - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
@@ -173,7 +177,7 @@ public class DeleteNetworkInstance extends AbstractServiceTaskProcessor {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix",Prefix)
- msoLogger.trace("Inside sendSyncResponse() of DeleteNetworkInstance")
+ logger.trace("Inside sendSyncResponse() of DeleteNetworkInstance")
try {
String requestId = execution.getVariable("mso-request-id")
@@ -182,14 +186,14 @@ public class DeleteNetworkInstance extends AbstractServiceTaskProcessor {
// RESTResponse (for API Handler (APIH) Reply Task)
String deleteNetworkRestRequest = """{"requestReferences":{"instanceId":"${serviceInstanceId}","requestId":"${requestId}"}}""".trim()
- msoLogger.debug(" sendSyncResponse to APIH - " + "\n" + deleteNetworkRestRequest)
+ logger.debug(" sendSyncResponse to APIH - " + "\n" + deleteNetworkRestRequest)
sendWorkflowResponse(execution, 202, deleteNetworkRestRequest)
} catch (Exception ex) {
// caught exception
String exceptionMessage = "Exception Encountered in DeleteNetworkInstance, sendSyncResponse() - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
@@ -200,7 +204,7 @@ public class DeleteNetworkInstance extends AbstractServiceTaskProcessor {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix",Prefix)
- msoLogger.trace("Inside prepareCompletion() of CreateNetworkInstance")
+ logger.trace("Inside prepareCompletion() of CreateNetworkInstance")
try {
@@ -224,11 +228,11 @@ public class DeleteNetworkInstance extends AbstractServiceTaskProcessor {
// normal path
execution.setVariable(Prefix + "CompleteMsoProcessRequest", xmlMsoCompletionRequest)
- msoLogger.debug(" Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest)
+ logger.debug(" Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest)
} catch (Exception ex) {
String exceptionMessage = " Bpmn error encountered in CreateNetworkInstance flow. prepareCompletion() - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
@@ -241,7 +245,7 @@ public class DeleteNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable("prefix", Prefix)
try {
- msoLogger.trace("Inside prepareDBRequestError of DeleteNetworkInstance")
+ logger.trace("Inside prepareDBRequestError of DeleteNetworkInstance")
// set DB Header Authorization
setBasicDBAuthHeader(execution, isDebugEnabled)
@@ -267,12 +271,12 @@ public class DeleteNetworkInstance extends AbstractServiceTaskProcessor {
</soapenv:Envelope>"""
execution.setVariable(Prefix + "deleteDBRequest", dbRequest)
- msoLogger.debug(" DB Adapter Request - " + "\n" + dbRequest)
+ logger.debug(" DB Adapter Request - " + "\n" + dbRequest)
} catch (Exception ex) {
// caught exception
String exceptionMessage = "Bpmn error encountered in DeleteNetworkInstance, prepareDBRequestError() - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage)
}
@@ -287,24 +291,24 @@ public class DeleteNetworkInstance extends AbstractServiceTaskProcessor {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix", Prefix)
- msoLogger.trace("Inside postProcessResponse() of DeleteNetworkInstance")
+ logger.trace("Inside postProcessResponse() of DeleteNetworkInstance")
try {
if (execution.getVariable("CMSO_ResponseCode") == "200") {
execution.setVariable(Prefix + "Success", true)
- msoLogger.trace("DeleteNetworkInstance Success")
+ logger.trace("DeleteNetworkInstance Success")
// Place holder for additional code.
} else {
execution.setVariable(Prefix + "Success", false)
- msoLogger.trace("DeleteNetworkInstance Failed in CompletionMsoProces flow!.")
+ logger.trace("DeleteNetworkInstance Failed in CompletionMsoProces flow!.")
}
} catch (Exception ex) {
String exceptionMessage = " Bpmn error encountered in DeleteNetworkInstance flow. postProcessResponse() - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
@@ -321,11 +325,11 @@ public class DeleteNetworkInstance extends AbstractServiceTaskProcessor {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix", Prefix)
- msoLogger.trace("Prepare for FalloutHandler. FAILURE - prepare request for sub-process FalloutHandler.")
+ logger.trace("Prepare for FalloutHandler. FAILURE - prepare request for sub-process FalloutHandler.")
String dbReturnCode = execution.getVariable(Prefix + "dbReturnCode")
- msoLogger.debug("DB Update Response Code : " + dbReturnCode)
- msoLogger.debug("DB Update Response String: " + '\n' + execution.getVariable(Prefix + "deleteDBResponse"))
+ logger.debug("DB Update Response Code : " + dbReturnCode)
+ logger.debug("DB Update Response String: " + '\n' + execution.getVariable(Prefix + "deleteDBResponse"))
String falloutHandlerRequest = ""
String requestId = execution.getVariable("mso-request-id")
@@ -351,14 +355,16 @@ public class DeleteNetworkInstance extends AbstractServiceTaskProcessor {
</aetgt:WorkflowException>
</aetgt:FalloutHandlerRequest>"""
- msoLogger.debug(falloutHandlerRequest)
+ logger.debug(falloutHandlerRequest)
execution.setVariable(Prefix + "FalloutHandlerRequest", falloutHandlerRequest)
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG,"Overall Error Response going to FalloutHandler: " + "\n" + falloutHandlerRequest,"BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "")
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Overall Error Response going to FalloutHandler: " + "\n" + falloutHandlerRequest, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue())
} catch (Exception ex) {
// caught exception
String exceptionMessage = "Bpmn error encountered in DeleteNetworkInstance, buildErrorResponse() - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
falloutHandlerRequest =
"""<aetgt:FalloutHandlerRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
xmlns:ns="http://org.onap/so/request/types/v1"
@@ -374,7 +380,9 @@ public class DeleteNetworkInstance extends AbstractServiceTaskProcessor {
</aetgt:WorkflowException>
</aetgt:FalloutHandlerRequest>"""
execution.setVariable(Prefix + "FalloutHandlerRequest", falloutHandlerRequest)
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG,"Overall Error Response going to FalloutHandler: " + "\n" + falloutHandlerRequest,"BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + ex)
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Overall Error Response going to FalloutHandler: " + "\n" + falloutHandlerRequest,"BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + ex)
}
}
@@ -390,12 +398,12 @@ public class DeleteNetworkInstance extends AbstractServiceTaskProcessor {
// RESTResponse (for API Handler (APIH) Reply Task)
String deleteNetworkRestError = """{"requestReferences":{"instanceId":"${serviceInstanceId}","requestId":"${requestId}"}}""".trim()
- msoLogger.debug(" sendSyncResponse to APIH - " + "\n" + deleteNetworkRestError)
+ logger.debug(" sendSyncResponse to APIH - " + "\n" + deleteNetworkRestError)
sendWorkflowResponse(execution, 500, deleteNetworkRestError)
} catch (Exception ex) {
- msoLogger.debug(" Sending Sync Error Activity Failed - DeleteNetworkInstance, sendSyncError(): " + "\n" + ex.getMessage())
+ logger.debug(" Sending Sync Error Activity Failed - DeleteNetworkInstance, sendSyncError(): " + "\n" + ex.getMessage())
}
}
@@ -403,18 +411,18 @@ public class DeleteNetworkInstance extends AbstractServiceTaskProcessor {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix",Prefix)
try{
- msoLogger.debug("Caught a Java Exception")
- msoLogger.debug("Started processJavaException Method")
- msoLogger.debug("Variables List: " + execution.getVariables())
+ logger.debug("Caught a Java Exception")
+ logger.debug("Started processJavaException Method")
+ logger.debug("Variables List: " + execution.getVariables())
execution.setVariable("UnexpectedError", "Caught a Java Lang Exception") // Adding this line temporarily until this flows error handling gets updated
exceptionUtil.buildWorkflowException(execution, 500, "Caught a Java Lang Exception")
}catch(Exception e){
- msoLogger.debug("Caught Exception during processJavaException Method: " + e)
+ logger.debug("Caught Exception during processJavaException Method: " + e)
execution.setVariable("UnexpectedError", "Exception in processJavaException method") // Adding this line temporarily until this flows error handling gets updated
exceptionUtil.buildWorkflowException(execution, 500, "Exception in processJavaException method")
}
- msoLogger.debug("Completed processJavaException Method of " + Prefix)
+ logger.debug("Completed processJavaException Method of " + Prefix)
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy
index cf781933f6..0dc86632e2 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2018 Huawei Technologies Co., Ltd. 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
@@ -31,7 +33,8 @@ import org.onap.so.bpmn.common.scripts.MsoUtils
import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils
import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.bpmn.core.UrnPropertiesReader
-import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
import static org.apache.commons.lang3.StringUtils.*
@@ -40,7 +43,7 @@ import static org.apache.commons.lang3.StringUtils.*
* flow for SDNC Network Resource
*/
public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DeleteSDNCNetworkResource.class);
+ private static final Logger logger = LoggerFactory.getLogger( DeleteSDNCNetworkResource.class);
String Prefix="DELSDNCRES_"
@@ -53,17 +56,17 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor {
MsoUtils msoUtils = new MsoUtils()
public void preProcessRequest(DelegateExecution execution){
- msoLogger.info(" ***** Started preProcessRequest *****")
+ logger.info(" ***** Started preProcessRequest *****")
try {
//get bpmn inputs from resource request.
String requestId = execution.getVariable("mso-request-id")
String requestAction = execution.getVariable("requestAction")
- msoLogger.info("The requestAction is: " + requestAction)
+ logger.info("The requestAction is: " + requestAction)
String recipeParamsFromRequest = execution.getVariable("recipeParams")
- msoLogger.info("The recipeParams is: " + recipeParamsFromRequest)
+ logger.info("The recipeParams is: " + recipeParamsFromRequest)
String resourceInput = execution.getVariable("resourceInput")
- msoLogger.info("The resourceInput is: " + resourceInput)
+ logger.info("The resourceInput is: " + resourceInput)
//Get ResourceInput Object
ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class)
execution.setVariable(Prefix + "resourceInput", resourceInputObj)
@@ -146,7 +149,7 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor {
throw e;
} catch (Exception ex){
msg = "Exception in preProcessRequest " + ex.getMessage()
- msoLogger.debug( msg)
+ logger.debug( msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
}
@@ -158,7 +161,7 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor {
* generate the nsParameters
*/
public void prepareSDNCRequest (DelegateExecution execution) {
- msoLogger.info(" ***** Started prepareSDNCRequest *****")
+ logger.info(" ***** Started prepareSDNCRequest *****")
try {
// get variables
@@ -353,15 +356,15 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor {
String sdncTopologyDeleteRequesAsString = utils.formatXml(sdncTopologyDeleteRequest)
utils.logAudit(sdncTopologyDeleteRequesAsString)
execution.setVariable("sdncAdapterWorkflowRequest", sdncTopologyDeleteRequesAsString)
- msoLogger.info("sdncAdapterWorkflowRequest - " + "\n" + sdncTopologyDeleteRequesAsString)
+ logger.info("sdncAdapterWorkflowRequest - " + "\n" + sdncTopologyDeleteRequesAsString)
} catch (Exception ex) {
String exceptionMessage = " Bpmn error encountered in DeleteSDNCCNetworkResource flow. prepareSDNCRequest() - " + ex.getMessage()
- msoLogger.debug( exceptionMessage)
+ logger.debug( exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
- msoLogger.info(" ***** Exit prepareSDNCRequest *****")
+ logger.info(" ***** Exit prepareSDNCRequest *****")
}
private void setProgressUpdateVariables(DelegateExecution execution, String body) {
@@ -436,30 +439,30 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor {
}
public void postDeleteSDNCCall(DelegateExecution execution){
- msoLogger.info(" ***** Started prepareSDNCRequest *****")
+ logger.info(" ***** Started prepareSDNCRequest *****")
String responseCode = execution.getVariable(Prefix + "sdncDeleteReturnCode")
String responseObj = execution.getVariable(Prefix + "SuccessIndicator")
- msoLogger.info("response from sdnc, response code :" + responseCode + " response object :" + responseObj)
- msoLogger.info(" ***** Exit prepareSDNCRequest *****")
+ logger.info("response from sdnc, response code :" + responseCode + " response object :" + responseObj)
+ logger.info(" ***** Exit prepareSDNCRequest *****")
}
public void sendSyncResponse (DelegateExecution execution) {
- msoLogger.debug( " *** sendSyncResponse *** ")
+ logger.debug( " *** sendSyncResponse *** ")
try {
String operationStatus = "finished"
// RESTResponse for main flow
String resourceOperationResp = """{"operationStatus":"${operationStatus}"}""".trim()
- msoLogger.debug( " sendSyncResponse to APIH:" + "\n" + resourceOperationResp)
+ logger.debug( " sendSyncResponse to APIH:" + "\n" + resourceOperationResp)
sendWorkflowResponse(execution, 202, resourceOperationResp)
execution.setVariable("sentSyncResponse", true)
} catch (Exception ex) {
String msg = "Exception in sendSyncResponse:" + ex.getMessage()
- msoLogger.debug( msg)
+ logger.debug( msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.debug(" ***** Exit sendSyncResponse *****")
+ logger.debug(" ***** Exit sendSyncResponse *****")
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVFCNSResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVFCNSResource.groovy
index 536783bc33..9b269c734f 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVFCNSResource.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVFCNSResource.groovy
@@ -5,6 +5,8 @@
* ================================================================================
* Copyright (C) 2018 Huawei Technologies Co., Ltd. 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
@@ -26,6 +28,8 @@ import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.bpmn.common.scripts.ExceptionUtil
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
public class DeleteVFCNSResource extends AbstractServiceTaskProcessor {
@@ -34,9 +38,11 @@ public class DeleteVFCNSResource extends AbstractServiceTaskProcessor {
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtil = new JsonUtils()
+ private static final Logger logger = LoggerFactory.getLogger( DeleteVFCNSResource.class);
+
public void preProcessRequest (DelegateExecution execution) {
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
- utils.log("INFO"," ***** start preProcessRequest *****", isDebugEnabled)
+ logger.info(" ***** start preProcessRequest *****")
String resourceInputStr = execution.getVariable("resourceInput")
ResourceInput resourceInput = new ObjectMapper().readValue(resourceInputStr, ResourceInput.class)
@@ -54,34 +60,34 @@ public class DeleteVFCNSResource extends AbstractServiceTaskProcessor {
execution.setVariable("resourceTemplateId", resourceModeluuid)
execution.setVariable("resourceInstanceId", resourceInstanceId)
- utils.log("INFO"," ***** end preProcessRequest *****", isDebugEnabled)
+ logger.info(" ***** end preProcessRequest *****")
}
public void postProcessRequest (DelegateExecution execution) {
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
- utils.log("INFO"," ***** start postProcessRequest *****", isDebugEnabled)
+ logger.info(" ***** start postProcessRequest *****")
- utils.log("INFO"," ***** end postProcessRequest *****", isDebugEnabled)
+ logger.info(" ***** end postProcessRequest *****")
}
public void sendSyncResponse (DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- utils.log("DEBUG", " *** sendSyncResponse *** ", isDebugEnabled)
+ logger.debug( " *** sendSyncResponse *** ")
try {
String nsInstanceId = execution.getVariable("nsInstanceId")
String operationStatus = execution.getVariable("operationStatus")
// RESTResponse for main flow
String createVFCResourceRestRsp = """{"nsInstanceId":"${nsInstanceId}","operationStatus":"${operationStatus}"}""".trim()
- utils.log("DEBUG", " sendSyncResponse to APIH:" + "\n" + createVFCResourceRestRsp, isDebugEnabled)
+ logger.debug( " sendSyncResponse to APIH:" + "\n" + createVFCResourceRestRsp)
sendWorkflowResponse(execution, 202, createVFCResourceRestRsp)
execution.setVariable("sentSyncResponse", true)
} catch (Exception ex) {
String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage()
- utils.log("DEBUG", msg, isDebugEnabled)
+ logger.debug( msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- utils.log("DEBUG"," ***** Exit sendSyncResopnse *****", isDebugEnabled)
+ logger.debug(" ***** Exit sendSyncResopnse *****")
}
-} \ No newline at end of file
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleInfra.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleInfra.groovy
index 682421e806..357ce69d50 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleInfra.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleInfra.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -30,6 +32,8 @@ import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.bpmn.core.json.JsonUtils;
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
import groovy.json.JsonSlurper
@@ -37,7 +41,7 @@ import groovy.json.JsonSlurper
public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DeleteVfModuleInfra.class);
+ private static final Logger logger = LoggerFactory.getLogger( DeleteVfModuleInfra.class);
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtil = new JsonUtils()
/**
@@ -70,7 +74,7 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor {
def method = getClass().getSimpleName() + '.preProcessRequest(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
execution.setVariable("isVidRequest", "false")
initProcessVariables(execution)
@@ -79,25 +83,25 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor {
def incomingRequest = execution.getVariable('bpmnRequest')
def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- msoLogger.debug("Incoming Infra Request: " + incomingRequest)
+ logger.debug("Incoming Infra Request: " + incomingRequest)
// check if request is xml or json
try {
def jsonSlurper = new JsonSlurper()
Map reqMap = jsonSlurper.parseText(incomingRequest)
- msoLogger.debug(" Request is in JSON format.")
+ logger.debug(" Request is in JSON format.")
def serviceInstanceId = execution.getVariable('serviceInstanceId')
- msoLogger.debug("serviceInstanceId is: " + serviceInstanceId)
+ logger.debug("serviceInstanceId is: " + serviceInstanceId)
def vnfId = execution.getVariable('vnfId')
- msoLogger.debug("vnfId is: " + vnfId)
+ logger.debug("vnfId is: " + vnfId)
def cloudConfiguration = jsonUtil.getJsonValue(incomingRequest, "requestDetails.cloudConfiguration")
execution.setVariable("cloudConfiguration", cloudConfiguration)
- msoLogger.debug("CloudConfiguration is: " + cloudConfiguration)
+ logger.debug("CloudConfiguration is: " + cloudConfiguration)
def vfModuleModelInfo = jsonUtil.getJsonValue(incomingRequest, "requestDetails.modelInfo")
execution.setVariable("vfModuleModelInfo", vfModuleModelInfo)
- msoLogger.debug("VfModuleModelInfo is: " + vfModuleModelInfo)
+ logger.debug("VfModuleModelInfo is: " + vfModuleModelInfo)
// This is aLaCarte flow, so aLaCarte flag is always on
execution.setVariable('aLaCarte', true)
@@ -106,7 +110,7 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor {
String requestInXmlFormat = vidUtils.createXmlVfModuleRequest(execution, reqMap, 'DELETE_VF_MODULE', serviceInstanceId)
- msoLogger.debug(" Request in XML format: " + requestInXmlFormat)
+ logger.debug(" Request in XML format: " + requestInXmlFormat)
setBasicDBAuthHeader(execution, isDebugLogEnabled)
@@ -116,13 +120,15 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor {
}
catch(groovy.json.JsonException je) {
- msoLogger.debug(" Request is not in JSON format.")
+ logger.debug(" Request is not in JSON format.")
exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Internal Error - During PreProcess Request")
}
catch(Exception e) {
String restFaultMessage = e.getMessage()
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG,"Caught exception", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Caught exception",
+ "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(),
+ "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Internal Error - During PreProcess Request")
}
@@ -131,7 +137,7 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor {
String request = validateRequest(execution)
execution.setVariable('DeleteVfModuleRequest', request)
- msoLogger.debug("DeleteVfModuleInfra Request: " + request)
+ logger.debug("DeleteVfModuleInfra Request: " + request)
def requestInfo = getRequiredNodeXml(execution, request, 'request-info')
execution.setVariable('DELVfModI_requestInfo', requestInfo)
@@ -149,11 +155,13 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor {
def vnfParams = utils.getNodeXml(request, 'vnf-params')
execution.setVariable('DELVfModI_vnfParams', vnfParams)
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG,"Caught exception in "+method, "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Caught exception in " + method, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preProcessRequest(): ' + e.getMessage())
}
}
@@ -168,7 +176,7 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor {
'execution=' + execution.getId() +
')'
def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
try {
def requestInfo = execution.getVariable('DELVfModI_requestInfo')
@@ -187,14 +195,16 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor {
def vfModuleId = execution.getVariable('DELVfModI_vfModuleId')
String synchResponse = """{"requestReferences":{"instanceId":"${vfModuleId}","requestId":"${requestId}"}}""".trim()
- msoLogger.debug("DeleteVfModuleInfra Synch Response: " + synchResponse)
+ logger.debug("DeleteVfModuleInfra Synch Response: " + synchResponse)
sendWorkflowResponse(execution, 200, synchResponse)
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG,"Caught exception in "+method, "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Caught exception in " + method, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage())
}
}
@@ -211,15 +221,15 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor {
'execution=' + execution.getId() +
')'
def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
try {
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepDoDeleteVfModule(): ' + e.getMessage())
}
}
@@ -234,7 +244,7 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor {
'execution=' + execution.getId() +
')'
def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
try {
def requestId = execution.getVariable('DELVfModI_requestId')
@@ -260,13 +270,15 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor {
updateInfraRequest = utils.formatXml(updateInfraRequest)
execution.setVariable('DELVfModI_updateInfraRequest', updateInfraRequest)
- msoLogger.debug('Request for Update Infra Request:\n' + updateInfraRequest)
+ logger.debug('Request for Update Infra Request:\n' + updateInfraRequest)
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepInfraRequest(): ' + e.getMessage())
}
}
@@ -283,7 +295,7 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor {
', resultVar=' + resultVar +
')'
def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
try {
def request = execution.getVariable("DeleteVfModuleRequest")
@@ -302,14 +314,16 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor {
</aetgt:MsoCompletionRequest>"""
content = utils.formatXml(content)
- msoLogger.debug(resultVar + ' = ' + System.lineSeparator() + content)
+ logger.debug(resultVar + ' = ' + System.lineSeparator() + content)
execution.setVariable(resultVar, content)
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, 'Internal Error')
}
}
@@ -326,7 +340,7 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor {
', resultVar=' + resultVar +
')'
def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
try {
def prefix = execution.getVariable('prefix')
@@ -353,14 +367,16 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor {
</sdncadapterworkflow:FalloutHandlerRequest>
"""
content = utils.formatXml(content)
- msoLogger.debug(resultVar + ' = ' + System.lineSeparator() + content)
+ logger.debug(resultVar + ' = ' + System.lineSeparator() + content)
execution.setVariable(resultVar, content)
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildWorkflowException(execution, 2000, 'Internal Error')
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy
index 8c9ab3fe45..9675e89249 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -39,6 +41,8 @@ import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.constants.Defaults
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
import org.springframework.web.util.UriUtils
@@ -50,7 +54,7 @@ import javax.ws.rs.NotFoundException
* This groovy class supports the <class>DeleteVfModuleVolume.bpmn</class> process.
*/
public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DeleteVfModuleVolumeInfraV1.class);
+ private static final Logger logger = LoggerFactory.getLogger( DeleteVfModuleVolumeInfraV1.class);
private XmlParser xmlParser = new XmlParser()
/**
@@ -107,7 +111,7 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor {
try {
def jsonSlurper = new JsonSlurper()
Map reqMap = jsonSlurper.parseText(createVolumeIncoming)
- msoLogger.debug(" Request is in JSON format.")
+ logger.debug(" Request is in JSON format.")
def serviceInstanceId = execution.getVariable('serviceInstanceId')
def volumeGroupId = execution.getVariable('volumeGroupId')
@@ -116,7 +120,7 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor {
execution.setVariable("DELVfModVol_isVidRequest", true)
}
catch(groovy.json.JsonException je) {
- msoLogger.debug(" Request is in XML format.")
+ logger.debug(" Request is in XML format.")
// assume request is in XML format - proceed as usual to process XML request
}
@@ -145,13 +149,13 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor {
setBasicDBAuthHeader(execution, isDebugLogEnabled)
- msoLogger.debug('Request: ' + createVolumeIncoming)
+ logger.debug('Request: ' + createVolumeIncoming)
}
public void sendSyncResponse (DelegateExecution execution, isDebugEnabled) {
String volumeRequest = execution.getVariable("DELVfModVol_volumeRequest")
- msoLogger.debug(" DELVfModVol_volumeRequest - " + "\n" + volumeRequest)
+ logger.debug(" DELVfModVol_volumeRequest - " + "\n" + volumeRequest)
// RESTResponse (for API Handler (APIH) Reply Task)
String deleteVolumeRequest =
"""<rest:RESTResponse xmlns:rest="http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd" statusCode="200">
@@ -214,12 +218,12 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor {
execution.setVariable("DELVfModVol_isCloudRegionGood", true)
} else {
- msoLogger.debug("AAI Query Cloud Region Unsuccessful.")
+ logger.debug("AAI Query Cloud Region Unsuccessful.")
execution.setVariable("DELVfModVol_isCloudRegionGood", false)
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "AAI Query Cloud Region Unsuccessful. Return Code: " + execution.getVariable("DELVfModVol_queryCloudRegionReturnCode"))
}
- msoLogger.debug(" is Cloud Region Good: " + execution.getVariable("DELVfModVol_isCloudRegionGood"))
+ logger.debug(" is Cloud Region Good: " + execution.getVariable("DELVfModVol_isCloudRegionGood"))
}
/**
@@ -248,20 +252,20 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor {
execution.setVariable('DELVfModVol_volumeGroupHeatStackId', heatStackId)
if ( volumeGroupWrapper.getRelationships().isPresent() && !volumeGroupWrapper.getRelationships().get().getRelatedAAIUris(AAIObjectType.VF_MODULE).isEmpty()) {
- msoLogger.debug('Volume Group ' + volumeGroupId + ' currently in use')
+ logger.debug('Volume Group ' + volumeGroupId + ' currently in use')
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Volume Group ${volumeGroupId} currently in use - found vf-module relationship.")
}
def volumeGroupTenantId = getTenantIdFromVolumeGroup(volumeGroupWrapper)
if (volumeGroupTenantId == null) {
- msoLogger.debug("Could not find Tenant Id element in Volume Group with Volume Group Id ${volumeGroupId}")
+ logger.debug("Could not find Tenant Id element in Volume Group with Volume Group Id ${volumeGroupId}")
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Could not find Tenant Id element in Volume Group with Volume Group Id ${volumeGroupId}")
}
execution.setVariable('DELVfModVol_volumeGroupTenantId', volumeGroupTenantId)
- msoLogger.debug('Received Tenant Id ' + volumeGroupTenantId + ' from AAI for Volume Group with Volume Group Id ' + volumeGroupId)
+ logger.debug('Received Tenant Id ' + volumeGroupTenantId + ' from AAI for Volume Group with Volume Group Id ' + volumeGroupId)
} else {
- msoLogger.debug("Volume Group ${volumeGroupId} not found in AAI")
+ logger.debug("Volume Group ${volumeGroupId} not found in AAI")
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Volume Group ${volumeGroupId} not found in AAI. Response code: 404")
}
}catch (BpmnError e){
@@ -339,7 +343,7 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor {
"""
vnfAdapterRestRequest = utils.formatXml(vnfAdapterRestRequest)
execution.setVariable('DELVfModVol_deleteVnfARequest', vnfAdapterRestRequest)
- msoLogger.debug('Request for VNFAdapter Rest:\n' + vnfAdapterRestRequest)
+ logger.debug('Request for VNFAdapter Rest:\n' + vnfAdapterRestRequest)
}
@@ -354,7 +358,7 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor {
try {
AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, Defaults.CLOUD_OWNER.toString(), cloudRegion, groupId)
getAAIClient().delete(uri)
- msoLogger.debug("Volume group $groupId deleted.")
+ logger.debug("Volume group $groupId deleted.")
}catch(NotFoundException e){
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Volume group $groupId not found for delete in AAI Response code: 404")
}catch(Exception e1){
@@ -401,7 +405,7 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor {
updateInfraRequest = utils.formatXml(updateInfraRequest)
execution.setVariable('DELVfModVol_updateInfraRequest', updateInfraRequest)
- msoLogger.debug('Request for Update Infra Request:\n' + updateInfraRequest)
+ logger.debug('Request for Update Infra Request:\n' + updateInfraRequest)
}
@@ -424,13 +428,13 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor {
String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest)
execution.setVariable('DELVfModVol_CompleteMsoProcessRequest', xmlMsoCompletionRequest)
- msoLogger.debug(" Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest)
+ logger.debug(" Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest)
}
- public void prepareFalloutHandler (DelegateExecution execution, isDebugEnabled) {
+ public void prepareFalloutHandler (DelegateExecution execution) {
execution.setVariable("DELVfModVol_Success", false)
String requestId = execution.getVariable("DELVfModVol_requestId")
@@ -457,11 +461,12 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor {
// Format Response
String xmlHandlerRequest = utils.formatXml(falloutHandlerRequest)
- msoLogger.debug(xmlHandlerRequest)
+ logger.debug(xmlHandlerRequest)
execution.setVariable("DELVfModVol_FalloutHandlerRequest", xmlHandlerRequest)
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Overall Error Response going to FalloutHandler", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "\n" + xmlHandlerRequest);
-
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Overall Error Response going to FalloutHandler", "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "\n" + xmlHandlerRequest);
}
@@ -480,7 +485,9 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor {
def String errorMessage = 'TenantId ' + tenantId + ' in incoming request does not match Tenant Id ' + volumeGroupTenantId +
' retrieved from AAI for Volume Group Id ' + volumeGroupId
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Error in DeleteVfModuleVolume: " + "\n" + errorMessage, "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError);
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Error in DeleteVfModuleVolume: " + "\n" + errorMessage, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
ExceptionUtil exceptionUtil = new ExceptionUtil()
exceptionUtil.buildWorkflowException(execution, 5000, errorMessage)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVnfInfra.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVnfInfra.groovy
index 9dfb9107b2..f22b11c44a 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVnfInfra.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVnfInfra.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -30,7 +32,8 @@ import org.onap.so.bpmn.common.scripts.MsoUtils
import org.onap.so.bpmn.common.scripts.VidUtils;
import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.bpmn.core.json.JsonUtils;
-import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
/**
@@ -40,7 +43,7 @@ import org.onap.so.logger.MsoLogger
*/
class DeleteVnfInfra extends AbstractServiceTaskProcessor {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DeleteVnfInfra.class);
+ private static final Logger logger = LoggerFactory.getLogger( DeleteVnfInfra.class);
String Prefix="DELVI_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
@@ -55,7 +58,7 @@ class DeleteVnfInfra extends AbstractServiceTaskProcessor {
*/
public void preProcessRequest(DelegateExecution execution) {
execution.setVariable("prefix",Prefix)
- msoLogger.trace("STARTED DeleteVnfInfra PreProcessRequest Process")
+ logger.trace("STARTED DeleteVnfInfra PreProcessRequest Process")
execution.setVariable("DELVI_SuccessIndicator", false)
execution.setVariable("DELVI_vnfInUse", false)
@@ -64,7 +67,7 @@ class DeleteVnfInfra extends AbstractServiceTaskProcessor {
// Get Variables
String deleteVnfRequest = execution.getVariable("bpmnRequest")
execution.setVariable("DELVI_DeleteVnfRequest", deleteVnfRequest)
- msoLogger.debug("Incoming DeleteVnfInfra Request is: \n" + deleteVnfRequest)
+ logger.debug("Incoming DeleteVnfInfra Request is: \n" + deleteVnfRequest)
if(deleteVnfRequest != null){
@@ -73,15 +76,15 @@ class DeleteVnfInfra extends AbstractServiceTaskProcessor {
String serviceInstanceId = execution.getVariable("serviceInstanceId")
execution.setVariable("DELVI_serviceInstanceId", serviceInstanceId)
- msoLogger.debug("Incoming Service Instance Id is: " + serviceInstanceId)
+ logger.debug("Incoming Service Instance Id is: " + serviceInstanceId)
String vnfId = execution.getVariable("vnfId")
execution.setVariable("DELVI_vnfId", vnfId)
- msoLogger.debug("Incoming Vnf(Instance) Id is: " + vnfId)
+ logger.debug("Incoming Vnf(Instance) Id is: " + vnfId)
String source = jsonUtil.getJsonValue(deleteVnfRequest, "requestDetails.requestInfo.source")
execution.setVariable("DELVI_source", source)
- msoLogger.debug("Incoming Source is: " + source)
+ logger.debug("Incoming Source is: " + source)
def cloudConfiguration = jsonUtil.getJsonValue(deleteVnfRequest, "requestDetails.cloudConfiguration")
execution.setVariable("DELVI_cloudConfiguration", cloudConfiguration)
@@ -92,7 +95,7 @@ class DeleteVnfInfra extends AbstractServiceTaskProcessor {
cascadeDelete = cascadeDeleteObj.booleanValue()
}
execution.setVariable("DELVI_cascadeDelete", cascadeDelete)
- msoLogger.debug("Incoming cascadeDelete is: " + cascadeDelete)
+ logger.debug("Incoming cascadeDelete is: " + cascadeDelete)
//For Completion Handler & Fallout Handler
String requestInfo =
@@ -112,20 +115,20 @@ class DeleteVnfInfra extends AbstractServiceTaskProcessor {
}
}catch(BpmnError b){
- msoLogger.debug("Rethrowing MSOWorkflowException")
+ logger.debug("Rethrowing MSOWorkflowException")
throw b
}catch(Exception e){
- msoLogger.debug(" Error Occured in DeleteVnfInfra PreProcessRequest method!" + e)
+ logger.debug(" Error Occured in DeleteVnfInfra PreProcessRequest method!" + e)
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DeleteVnfInfra PreProcessRequest")
}
- msoLogger.trace("COMPLETED DeleteVnfInfra PreProcessRequest Process")
+ logger.trace("COMPLETED DeleteVnfInfra PreProcessRequest Process")
}
public void sendSyncResponse (DelegateExecution execution) {
execution.setVariable("prefix",Prefix)
- msoLogger.trace("STARTED DeleteVnfInfra SendSyncResponse Process")
+ logger.trace("STARTED DeleteVnfInfra SendSyncResponse Process")
try {
String requestId = execution.getVariable("DELVI_requestId")
@@ -133,23 +136,23 @@ class DeleteVnfInfra extends AbstractServiceTaskProcessor {
String DeleteVnfResponse = """{"requestReferences":{"instanceId":"${vnfId}","requestId":"${requestId}"}}""".trim()
- msoLogger.debug("DeleteVnfInfra Sync Response is: \n" + DeleteVnfResponse)
+ logger.debug("DeleteVnfInfra Sync Response is: \n" + DeleteVnfResponse)
execution.setVariable("DELVI_sentSyncResponse", true)
sendWorkflowResponse(execution, 202, DeleteVnfResponse)
} catch (Exception ex) {
- msoLogger.debug("Error Occured in DeleteVnfInfra SendSyncResponse Process " + ex.getMessage())
+ logger.debug("Error Occured in DeleteVnfInfra SendSyncResponse Process " + ex.getMessage())
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DeleteVnfInfra SendSyncResponse Process")
}
- msoLogger.trace("COMPLETED DeleteVnfInfra SendSyncResponse Process")
+ logger.trace("COMPLETED DeleteVnfInfra SendSyncResponse Process")
}
public void prepareCompletionHandlerRequest(DelegateExecution execution){
execution.setVariable("prefix",Prefix)
- msoLogger.trace("STARTED DeleteVnfInfra PrepareCompletionHandlerRequest Process")
+ logger.trace("STARTED DeleteVnfInfra PrepareCompletionHandlerRequest Process")
try {
String requestInfo = execution.getVariable("DELVI_requestInfo")
@@ -166,40 +169,40 @@ class DeleteVnfInfra extends AbstractServiceTaskProcessor {
</aetgt:MsoCompletionRequest>"""
execution.setVariable("DELVI_completionHandlerRequest", request)
- msoLogger.debug("Completion Handler Request is: " + request)
+ logger.debug("Completion Handler Request is: " + request)
execution.setVariable("WorkflowResponse", "Success") // for junits
} catch (Exception ex) {
- msoLogger.debug("Error Occured in DeleteVnfInfra PrepareCompletionHandlerRequest Process " + ex.getMessage())
+ logger.debug("Error Occured in DeleteVnfInfra PrepareCompletionHandlerRequest Process " + ex.getMessage())
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DeleteVnfInfra PrepareCompletionHandlerRequest Process")
}
- msoLogger.trace("COMPLETED DeleteVnfInfra PrepareCompletionHandlerRequest Process")
+ logger.trace("COMPLETED DeleteVnfInfra PrepareCompletionHandlerRequest Process")
}
public void sendErrorResponse(DelegateExecution execution){
execution.setVariable("prefix",Prefix)
- msoLogger.trace("STARTED DeleteVnfInfra sendErrorResponse Process")
+ logger.trace("STARTED DeleteVnfInfra sendErrorResponse Process")
try {
def sentSyncResponse = execution.getVariable("DELVI_sentSyncResponse")
if(sentSyncResponse == false){
- msoLogger.debug("Sending a Sync Error Response")
+ logger.debug("Sending a Sync Error Response")
WorkflowException wfex = execution.getVariable("WorkflowException")
String response = exceptionUtil.buildErrorResponseXml(wfex)
- msoLogger.debug(response)
+ logger.debug(response)
sendWorkflowResponse(execution, 500, response)
}else{
- msoLogger.debug("A Sync Response has already been sent. Skipping Send Sync Error Response.")
+ logger.debug("A Sync Response has already been sent. Skipping Send Sync Error Response.")
}
} catch(Exception ex) {
- msoLogger.debug("Error Occured in DeleteVnfInfra sendErrorResponse Process " + ex.getMessage())
+ logger.debug("Error Occured in DeleteVnfInfra sendErrorResponse Process " + ex.getMessage())
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DeleteVnfInfra sendErrorResponse Process")
}
- msoLogger.trace("COMPLETED DeleteVnfInfra sendErrorResponse Process")
+ logger.trace("COMPLETED DeleteVnfInfra sendErrorResponse Process")
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelVersions.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelVersions.groovy
index 24071d38f6..fff2503308 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelVersions.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelVersions.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2018 Huawei Technologies Co., Ltd. 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
@@ -26,6 +28,8 @@ import org.onap.so.bpmn.core.domain.Resource
import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.onap.so.bpmn.common.scripts.ExceptionUtil
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
import org.camunda.bpm.engine.delegate.DelegateExecution
@@ -48,11 +52,12 @@ public class DoCompareModelVersions extends AbstractServiceTaskProcessor {
String Prefix="DCMPMDV_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtil = new JsonUtils()
+ private static final Logger logger = LoggerFactory.getLogger( DoCompareModelVersions.class);
public void preProcessRequest (DelegateExecution execution) {
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
String msg = ""
- utils.log("INFO"," ***** preProcessRequest *****", isDebugEnabled)
+ logger.info(" ***** preProcessRequest *****")
try {
execution.setVariable("prefix", Prefix)
@@ -61,58 +66,58 @@ public class DoCompareModelVersions extends AbstractServiceTaskProcessor {
String modelInvariantUuid_target = execution.getVariable("model-invariant-id-target")
if (isBlank(modelInvariantUuid_target)) {
msg = "Input model-invariant-id-target is null"
- utils.log("INFO", msg, isDebugEnabled)
+ logger.info( msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
}
String modelUuid_target = execution.getVariable("model-version-id-target")
if (isBlank(modelUuid_target)) {
msg = "Input model-version-id-target is null"
- utils.log("INFO", msg, isDebugEnabled)
+ logger.info( msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
}
String modelInvariantUuid_original = execution.getVariable("model-invariant-id-original")
if (isBlank(modelInvariantUuid_original)) {
msg = "Input model-invariant-id-original is null"
- utils.log("INFO", msg, isDebugEnabled)
+ logger.info( msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
}
String modelUuid_original = execution.getVariable("model-version-id-original")
if (isBlank(modelUuid_original)) {
msg = "Input model-version-id-original is null"
- utils.log("INFO", msg, isDebugEnabled)
+ logger.info( msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
}
// Target and original modelInvariantUuid must to be the same
if(modelInvariantUuid_target != modelInvariantUuid_original){
msg = "Input model-invariant-id-target and model-invariant-id-original must to be the same"
- utils.log("INFO", msg, isDebugEnabled)
+ logger.info( msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
}
// Target and original modelUuid must not to be the same
if(modelUuid_target == modelUuid_original){
msg = "Input model-version-id-target and model-version-id-original must not to be the same"
- utils.log("INFO", msg, isDebugEnabled)
+ logger.info( msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
}
} catch (Exception ex){
msg = "Exception in preProcessRequest " + ex.getMessage()
- utils.log("INFO", msg, isDebugEnabled)
+ logger.info( msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- utils.log("INFO"," ***** Exit preProcessRequest *****", isDebugEnabled)
+ logger.info(" ***** Exit preProcessRequest *****")
}
public void prepareDecomposeService_Target(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
try {
- utils.log("DEBUG", " ***** Inside prepareDecomposeService_Target of update generic e2e service ***** ", isDebugEnabled)
+ logger.debug( " ***** Inside prepareDecomposeService_Target of update generic e2e service ***** ")
String modelInvariantUuid = execution.getVariable("model-invariant-id-target")
String modelUuid = execution.getVariable("model-version-id-target")
//here modelVersion is not set, we use modelUuid to decompose the service.
@@ -124,7 +129,7 @@ public class DoCompareModelVersions extends AbstractServiceTaskProcessor {
execution.setVariable("serviceModelInfo_Target", serviceModelInfo)
- utils.log("DEBUG", " ***** Completed prepareDecomposeService_Target of update generic e2e service ***** ", isDebugEnabled)
+ logger.debug( " ***** Completed prepareDecomposeService_Target of update generic e2e service ***** ")
} catch (Exception ex) {
// try error in method block
String exceptionMessage = "Bpmn error encountered in update generic e2e service flow. Unexpected Error from method prepareDecomposeService_Target() - " + ex.getMessage()
@@ -135,13 +140,13 @@ public class DoCompareModelVersions extends AbstractServiceTaskProcessor {
public void processDecomposition_Target(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- utils.log("DEBUG", " ***** Inside processDecomposition_Target() of update generic e2e service flow ***** ", isDebugEnabled)
+ logger.debug( " ***** Inside processDecomposition_Target() of update generic e2e service flow ***** ")
try {
ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
execution.setVariable("serviceDecomposition_Target", serviceDecomposition)
} catch (Exception ex) {
String exceptionMessage = "Bpmn error encountered in update generic e2e service flow. Unexpected Error from method processDecomposition_Target() - " + ex.getMessage()
- utils.log("DEBUG", exceptionMessage, isDebugEnabled)
+ logger.debug( exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
}
@@ -150,7 +155,7 @@ public class DoCompareModelVersions extends AbstractServiceTaskProcessor {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
try {
- utils.log("DEBUG", " ***** Inside prepareDecomposeService_Original of update generic e2e service ***** ", isDebugEnabled)
+ logger.debug( " ***** Inside prepareDecomposeService_Original of update generic e2e service ***** ")
String modelInvariantUuid = execution.getVariable("model-invariant-id-original")
String modelUuid = execution.getVariable("model-version-id-original")
//here modelVersion is not set, we use modelUuid to decompose the service.
@@ -162,7 +167,7 @@ public class DoCompareModelVersions extends AbstractServiceTaskProcessor {
execution.setVariable("serviceModelInfo_Original", serviceModelInfo)
- utils.log("DEBUG", " ***** Completed prepareDecomposeService_Original of update generic e2e service ***** ", isDebugEnabled)
+ logger.debug( " ***** Completed prepareDecomposeService_Original of update generic e2e service ***** ")
} catch (Exception ex) {
// try error in method block
String exceptionMessage = "Bpmn error encountered in update generic e2e service flow. Unexpected Error from method prepareDecomposeService_Original() - " + ex.getMessage()
@@ -173,20 +178,20 @@ public class DoCompareModelVersions extends AbstractServiceTaskProcessor {
public void processDecomposition_Original(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- utils.log("DEBUG", " ***** Inside processDecomposition_Original() of update generic e2e service flow ***** ", isDebugEnabled)
+ logger.debug( " ***** Inside processDecomposition_Original() of update generic e2e service flow ***** ")
try {
ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
execution.setVariable("serviceDecomposition_Original", serviceDecomposition)
} catch (Exception ex) {
String exceptionMessage = "Bpmn error encountered in update generic e2e service flow. processDecomposition_Original() - " + ex.getMessage()
- utils.log("DEBUG", exceptionMessage, isDebugEnabled)
+ logger.debug( exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
}
public void doCompareModelVersions(DelegateExecution execution){
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- utils.log("INFO", "======== Start doCompareModelVersions Process ======== ", isDebugEnabled)
+ logger.info( "======== Start doCompareModelVersions Process ======== ")
ServiceDecomposition serviceDecomposition_Target = execution.getVariable("serviceDecomposition_Target")
ServiceDecomposition serviceDecomposition_Original = execution.getVariable("serviceDecomposition_Original")
@@ -217,10 +222,10 @@ public class DoCompareModelVersions extends AbstractServiceTaskProcessor {
execution.setVariable("addResourceList", addResourceList)
execution.setVariable("delResourceList", delResourceList)
- utils.log("INFO", "addResourceList: " + addResourceList, isDebugEnabled)
- utils.log("INFO", "delResourceList: " + delResourceList, isDebugEnabled)
+ logger.info( "addResourceList: " + addResourceList)
+ logger.info( "delResourceList: " + delResourceList)
- utils.log("INFO", "======== COMPLETED doCompareModelVersions Process ======== ", isDebugEnabled)
+ logger.info( "======== COMPLETED doCompareModelVersions Process ======== ")
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelofE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelofE2EServiceInstance.groovy
index 589bbe9c4f..7ad929b1c2 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelofE2EServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelofE2EServiceInstance.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2018 Huawei Technologies Co., Ltd. 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
@@ -40,6 +42,8 @@ import org.onap.so.client.aai.AAIResourcesClient
import org.onap.so.client.aai.entities.AAIResultWrapper
import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
import groovy.json.*
@@ -62,6 +66,7 @@ public class DoCompareModelofE2EServiceInstance extends AbstractServiceTaskProce
String Prefix="DCMPMDSI_"
private static final String DebugFlag = "isDebugEnabled"
+ private static final Logger logger = LoggerFactory.getLogger( DeleteNetworkInstance.class);
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtil = new JsonUtils()
@@ -70,50 +75,50 @@ public class DoCompareModelofE2EServiceInstance extends AbstractServiceTaskProce
def method = getClass().getSimpleName() + '.preProcessRequest(' +'execution=' + execution.getId() +')'
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
- utils.log("INFO","Entered " + method, isDebugEnabled)
+ logger.info("Entered " + method)
String msg = ""
- utils.log("INFO"," ***** Enter DoCompareModelofE2EServiceInstance preProcessRequest *****", isDebugEnabled)
+ logger.info(" ***** Enter DoCompareModelofE2EServiceInstance preProcessRequest *****")
execution.setVariable("prefix", Prefix)
//Inputs
//subscriberInfo. for AAI GET
String globalSubscriberId = execution.getVariable("globalSubscriberId")
- utils.log("INFO"," ***** globalSubscriberId *****" + globalSubscriberId, isDebugEnabled)
+ logger.info(" ***** globalSubscriberId *****" + globalSubscriberId)
String serviceType = execution.getVariable("serviceType")
- utils.log("INFO"," ***** serviceType *****" + serviceType, isDebugEnabled)
+ logger.info(" ***** serviceType *****" + serviceType)
if (isBlank(globalSubscriberId)) {
msg = "Input globalSubscriberId is null"
- utils.log("INFO", msg, isDebugEnabled)
+ logger.info( msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
}
if (isBlank(serviceType)) {
msg = "Input serviceType is null"
- utils.log("INFO", msg, isDebugEnabled)
+ logger.info( msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
}
String serviceInstanceId = execution.getVariable("serviceInstanceId")
if (isBlank(serviceInstanceId)){
msg = "Input serviceInstanceId is null"
- utils.log("INFO", msg, isDebugEnabled)
+ logger.info( msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
}
String modelInvariantUuid = execution.getVariable("modelInvariantIdTarget")
if (isBlank(modelInvariantUuid)){
msg = "Input modelInvariantUuid is null"
- utils.log("INFO", msg, isDebugEnabled)
+ logger.info( msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
}
String modelUuid = execution.getVariable("modelVersionIdTarget")
if (isBlank(modelUuid)){
msg = "Input modelUuid is null"
- utils.log("INFO", msg, isDebugEnabled)
+ logger.info( msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
}
@@ -122,7 +127,7 @@ public class DoCompareModelofE2EServiceInstance extends AbstractServiceTaskProce
execution.setVariable("model-version-id-target", modelUuid)
- utils.log("INFO", "Exited " + method, isDebugEnabled)
+ logger.info( "Exited " + method)
}
/**
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy
index 2168dab736..aac4b72b06 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy
@@ -5,6 +5,8 @@
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* Copyright (C) 2017 Huawei Technologies Co., Ltd. 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
@@ -43,6 +45,8 @@ import org.onap.so.bpmn.infrastructure.workflow.service.ServicePluginFactory
import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
import org.springframework.web.util.UriUtils
import org.onap.so.bpmn.core.UrnPropertiesReader
@@ -73,7 +77,7 @@ import org.onap.so.bpmn.core.UrnPropertiesReader
*
*/
public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCreateE2EServiceInstance.class);
+ private static final Logger logger = LoggerFactory.getLogger( DoCreateE2EServiceInstance.class);
String Prefix="DCRESI_"
@@ -82,29 +86,29 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
public void preProcessRequest (DelegateExecution execution) {
String msg = ""
- msoLogger.trace("preProcessRequest ")
+ logger.trace("preProcessRequest ")
try {
execution.setVariable("prefix", Prefix)
//Inputs
//requestDetails.subscriberInfo. for AAI GET & PUT & SDNC assignToplology
String globalSubscriberId = execution.getVariable("globalSubscriberId") //globalCustomerId
- msoLogger.info(" ***** globalSubscriberId *****" + globalSubscriberId)
+ logger.info(" ***** globalSubscriberId *****" + globalSubscriberId)
//requestDetails.requestParameters. for AAI PUT & SDNC assignTopology
String serviceType = execution.getVariable("serviceType")
- msoLogger.info(" ***** serviceType *****" + serviceType)
+ logger.info(" ***** serviceType *****" + serviceType)
//requestDetails.requestParameters. for SDNC assignTopology
String productFamilyId = execution.getVariable("productFamilyId") //AAI productFamilyId
if (isBlank(globalSubscriberId)) {
msg = "Input globalSubscriberId is null"
- msoLogger.info(msg)
+ logger.info(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
}
if (isBlank(serviceType)) {
msg = "Input serviceType is null"
- msoLogger.info(msg)
+ logger.info(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
}
@@ -115,11 +119,11 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
String sdncCallbackUrl = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback", execution)
if (isBlank(sdncCallbackUrl)) {
msg = "URN_mso_workflow_sdncadapter_callback is null"
- msoLogger.info(msg)
+ logger.info(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
}
execution.setVariable("sdncCallbackUrl", sdncCallbackUrl)
- msoLogger.info("SDNC Callback URL: " + sdncCallbackUrl)
+ logger.info("SDNC Callback URL: " + sdncCallbackUrl)
//requestDetails.modelInfo.for AAI PUT servieInstanceData
//requestDetails.requestInfo. for AAI GET/PUT serviceInstanceData
@@ -158,15 +162,15 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
throw e;
} catch (Exception ex){
msg = "Exception in preProcessRequest " + ex.getMessage()
- msoLogger.info(msg)
+ logger.info(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("Exit preProcessRequest ")
+ logger.trace("Exit preProcessRequest ")
}
public void prepareDecomposeService(DelegateExecution execution) {
try {
- msoLogger.trace("Inside prepareDecomposeService of create generic e2e service ")
+ logger.trace("Inside prepareDecomposeService of create generic e2e service ")
String modelInvariantUuid = execution.getVariable("modelInvariantUuid")
String modelUuid = execution.getVariable("modelUuid")
//here modelVersion is not set, we use modelUuid to decompose the service.
@@ -177,7 +181,7 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
}"""
execution.setVariable("serviceModelInfo", serviceModelInfo)
- msoLogger.trace("Completed prepareDecomposeService of create generic e2e service ")
+ logger.trace("Completed prepareDecomposeService of create generic e2e service ")
} catch (Exception ex) {
// try error in method block
String exceptionMessage = "Bpmn error encountered in create generic e2e service flow. Unexpected Error from method prepareDecomposeService() - " + ex.getMessage()
@@ -186,12 +190,12 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
}
public void processDecomposition(DelegateExecution execution) {
- msoLogger.trace("Inside processDecomposition() of create generic e2e service flow ")
+ logger.trace("Inside processDecomposition() of create generic e2e service flow ")
try {
ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
} catch (Exception ex) {
String exceptionMessage = "Bpmn error encountered in create generic e2e service flow. processDecomposition() - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
}
@@ -213,23 +217,23 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
}
public void postProcessAAIGET(DelegateExecution execution) {
- msoLogger.trace("postProcessAAIGET ")
+ logger.trace("postProcessAAIGET ")
String msg = ""
try {
String serviceInstanceName = execution.getVariable("serviceInstanceName")
boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator")
if(!succInAAI){
- msoLogger.info("Error getting Service-instance from AAI", + serviceInstanceName)
+ logger.info("Error getting Service-instance from AAI", + serviceInstanceName)
WorkflowException workflowException = execution.getVariable("WorkflowException")
- msoLogger.debug("workflowException: " + workflowException)
+ logger.debug("workflowException: " + workflowException)
if(workflowException != null){
exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage())
}
else
{
msg = "Failure in postProcessAAIGET GENGS_SuccessIndicator:" + succInAAI
- msoLogger.info(msg)
+ logger.info(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
}
}
@@ -237,9 +241,9 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
{
boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator")
if(foundInAAI){
- msoLogger.info("Found Service-instance in AAI")
+ logger.info("Found Service-instance in AAI")
msg = "ServiceInstance already exists in AAI:" + serviceInstanceName
- msoLogger.info(msg)
+ logger.info(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
}
}
@@ -247,15 +251,15 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
throw e;
} catch (Exception ex) {
msg = "Exception in DoCreateServiceInstance.postProcessAAIGET. " + ex.getMessage()
- msoLogger.info(msg)
+ logger.info(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("Exit postProcessAAIGET ")
+ logger.trace("Exit postProcessAAIGET ")
}
//TODO use create if not exist
public void createServiceInstance(DelegateExecution execution) {
- msoLogger.trace("createServiceInstance ")
+ logger.trace("createServiceInstance ")
String msg = ""
String serviceInstanceId = execution.getVariable("serviceInstanceId")
try {
@@ -279,10 +283,10 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
execution.setVariable("rollbackData", rollbackData)
msg = "Exception in DoCreateServiceInstance.createServiceInstance. " + ex.getMessage()
- msoLogger.info(msg)
+ logger.info(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("Exit createServiceInstance ")
+ logger.trace("Exit createServiceInstance ")
}
/**
@@ -310,23 +314,23 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
}
public void postProcessAAIGET2(DelegateExecution execution) {
- msoLogger.trace("postProcessAAIGET2 ")
+ logger.trace("postProcessAAIGET2 ")
String msg = ""
try {
String serviceInstanceName = execution.getVariable("serviceInstanceName")
boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator")
if(!succInAAI){
- msoLogger.info("Error getting Service-instance from AAI in postProcessAAIGET2", + serviceInstanceName)
+ logger.info("Error getting Service-instance from AAI in postProcessAAIGET2", + serviceInstanceName)
WorkflowException workflowException = execution.getVariable("WorkflowException")
- msoLogger.debug("workflowException: " + workflowException)
+ logger.debug("workflowException: " + workflowException)
if(workflowException != null){
exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage())
}
else
{
msg = "Failure in postProcessAAIGET2 GENGS_SuccessIndicator:" + succInAAI
- msoLogger.info(msg)
+ logger.info(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
}
}
@@ -337,7 +341,7 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
String aaiService = execution.getVariable("GENGS_service")
if (!isBlank(aaiService) && (utils.nodeExists(aaiService, "service-instance-name"))) {
execution.setVariable("serviceInstanceName", utils.getNodeText(aaiService, "service-instance-name"))
- msoLogger.info("Found Service-instance in AAI.serviceInstanceName:" + execution.getVariable("serviceInstanceName"))
+ logger.info("Found Service-instance in AAI.serviceInstanceName:" + execution.getVariable("serviceInstanceName"))
}
}
}
@@ -345,54 +349,54 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
throw e;
} catch (Exception ex) {
msg = "Exception in DoCreateServiceInstance.postProcessAAIGET2 " + ex.getMessage()
- msoLogger.info(msg)
+ logger.info(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("Exit postProcessAAIGET2 ")
+ logger.trace("Exit postProcessAAIGET2 ")
}
public void preProcessRollback (DelegateExecution execution) {
- msoLogger.trace("preProcessRollback ")
+ logger.trace("preProcessRollback ")
try {
Object workflowException = execution.getVariable("WorkflowException");
if (workflowException instanceof WorkflowException) {
- msoLogger.info("Prev workflowException: " + workflowException.getErrorMessage())
+ logger.info("Prev workflowException: " + workflowException.getErrorMessage())
execution.setVariable("prevWorkflowException", workflowException);
//execution.setVariable("WorkflowException", null);
}
} catch (BpmnError e) {
- msoLogger.info("BPMN Error during preProcessRollback")
+ logger.info("BPMN Error during preProcessRollback")
} catch(Exception ex) {
String msg = "Exception in preProcessRollback. " + ex.getMessage()
- msoLogger.info(msg)
+ logger.info(msg)
}
- msoLogger.trace("Exit preProcessRollback ")
+ logger.trace("Exit preProcessRollback ")
}
public void postProcessRollback (DelegateExecution execution) {
- msoLogger.trace("postProcessRollback ")
+ logger.trace("postProcessRollback ")
String msg = ""
try {
Object workflowException = execution.getVariable("prevWorkflowException");
if (workflowException instanceof WorkflowException) {
- msoLogger.info("Setting prevException to WorkflowException: ")
+ logger.info("Setting prevException to WorkflowException: ")
execution.setVariable("WorkflowException", workflowException);
}
execution.setVariable("rollbackData", null)
} catch (BpmnError b) {
- msoLogger.info("BPMN Error during postProcessRollback")
+ logger.info("BPMN Error during postProcessRollback")
throw b;
} catch(Exception ex) {
msg = "Exception in postProcessRollback. " + ex.getMessage()
- msoLogger.info(msg)
+ logger.info(msg)
}
- msoLogger.trace("Exit postProcessRollback ")
+ logger.trace("Exit postProcessRollback ")
}
public void preInitResourcesOperStatus(DelegateExecution execution){
- msoLogger.trace("STARTED preInitResourcesOperStatus Process ")
+ logger.trace("STARTED preInitResourcesOperStatus Process ")
try{
String serviceId = execution.getVariable("serviceInstanceId")
String operationId = execution.getVariable("operationId")
@@ -402,7 +406,7 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
String progress = "0"
String reason = ""
String operationContent = "Prepare service creation"
- msoLogger.info("Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId + " operationType:" + operationType)
+ logger.info("Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId + " operationType:" + operationType)
serviceId = UriUtils.encode(serviceId,"UTF-8")
execution.setVariable("serviceInstanceId", serviceId)
execution.setVariable("operationId", operationId)
@@ -416,7 +420,7 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.db.endpoint")
execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint)
- msoLogger.info("DB Adapter Endpoint is: " + dbAdapterEndpoint)
+ logger.info("DB Adapter Endpoint is: " + dbAdapterEndpoint)
String payload =
"""<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
@@ -434,48 +438,50 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
payload = utils.formatXml(payload)
execution.setVariable("CVFMI_initResOperStatusRequest", payload)
- msoLogger.info("Outgoing initResourceOperationStatus: \n" + payload)
- msoLogger.debug("CreateVfModuleInfra Outgoing initResourceOperationStatus Request: " + payload)
+ logger.info("Outgoing initResourceOperationStatus: \n" + payload)
+ logger.debug("CreateVfModuleInfra Outgoing initResourceOperationStatus Request: " + payload)
}catch(Exception e){
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing preInitResourcesOperStatus.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Occured Processing preInitResourcesOperStatus.", "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), e);
execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preInitResourcesOperStatus Method:\n" + e.getMessage())
}
- msoLogger.trace("COMPLETED preInitResourcesOperStatus Process ")
+ logger.trace("COMPLETED preInitResourcesOperStatus Process ")
}
// if site location is in local Operator, create all resources in local ONAP;
// if site location is in 3rd Operator, only process sp-partner to create all resources in 3rd ONAP
public void doProcessSiteLocation(DelegateExecution execution){
- msoLogger.trace("======== Start doProcessSiteLocation Process ======== ")
+ logger.trace("======== Start doProcessSiteLocation Process ======== ")
ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
String uuiRequest = execution.getVariable("uuiRequest")
uuiRequest = ServicePluginFactory.getInstance().doProcessSiteLocation(serviceDecomposition, uuiRequest);
execution.setVariable("uuiRequest", uuiRequest)
execution.setVariable("serviceDecomposition", serviceDecomposition)
- msoLogger.trace("======== COMPLETED doProcessSiteLocation Process ======== ")
+ logger.trace("======== COMPLETED doProcessSiteLocation Process ======== ")
}
// Allocate cross link TPs(terminal points) for sotn network only
public void doTPResourcesAllocation(DelegateExecution execution){
- msoLogger.trace("======== Start doTPResourcesAllocation Process ======== ")
+ logger.trace("======== Start doTPResourcesAllocation Process ======== ")
ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
String uuiRequest = execution.getVariable("uuiRequest")
uuiRequest = ServicePluginFactory.getInstance().doTPResourcesAllocation(execution, uuiRequest);
execution.setVariable("uuiRequest", uuiRequest)
- msoLogger.trace("======== COMPLETED doTPResourcesAllocation Process ======== ")
+ logger.trace("======== COMPLETED doTPResourcesAllocation Process ======== ")
}
// prepare input param for using DoCreateResources.bpmn
public void preProcessForAddResource(DelegateExecution execution) {
- msoLogger.trace("STARTED preProcessForAddResource Process ")
+ logger.trace("STARTED preProcessForAddResource Process ")
ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
List<Resource> addResourceList = serviceDecomposition.getServiceResources()
execution.setVariable("addResourceList", addResourceList)
- msoLogger.trace("COMPLETED preProcessForAddResource Process ")
+ logger.trace("COMPLETED preProcessForAddResource Process ")
}
public void postProcessForAddResource(DelegateExecution execution) {
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstanceRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstanceRollback.groovy
index 4f00a64ecb..ce9df87799 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstanceRollback.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstanceRollback.groovy
@@ -5,6 +5,8 @@
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* Copyright (C) 2017 Huawei Technologies Co., Ltd. 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
@@ -32,7 +34,8 @@ import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils
import org.onap.so.bpmn.core.RollbackData
import org.onap.so.bpmn.core.WorkflowException
-import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
import org.onap.so.logger.MessageEnum
import org.onap.so.bpmn.common.scripts.ExceptionUtil;
import org.onap.so.client.aai.entities.uri.AAIResourceUri
@@ -70,20 +73,20 @@ import org.springframework.web.util.UriUtils;
*/
public class DoCreateE2EServiceInstanceRollback extends AbstractServiceTaskProcessor{
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCreateE2EServiceInstanceRollback.class);
+ private static final Logger logger = LoggerFactory.getLogger( DoCreateE2EServiceInstanceRollback.class);
String Prefix="DCRESIRB_"
public void preProcessRequest(DelegateExecution execution) {
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix",Prefix)
String msg = ""
- msoLogger.trace("Start preProcessRequest")
+ logger.trace("Start preProcessRequest")
execution.setVariable("rollbackAAI",false)
execution.setVariable("rollbackSDNC",false)
try {
def rollbackData = execution.getVariable("rollbackData")
- msoLogger.debug("RollbackData:" + rollbackData)
+ logger.debug("RollbackData:" + rollbackData)
if (rollbackData != null) {
if (rollbackData.hasType("SERVICEINSTANCE")) {
@@ -118,8 +121,8 @@ public class DoCreateE2EServiceInstanceRollback extends AbstractServiceTaskProce
execution.setVariable("sdncDelete", sdncDelete)
def sdncDeactivate = rollbackData.get("SERVICEINSTANCE", "sdncDeactivate")
execution.setVariable("sdncDeactivate", sdncDeactivate)
- msoLogger.debug("sdncDeactivate:\n" + sdncDeactivate)
- msoLogger.debug("sdncDelete:\n" + sdncDelete)
+ logger.debug("sdncDeactivate:\n" + sdncDeactivate)
+ logger.debug("sdncDelete:\n" + sdncDelete)
}
else {
execution.setVariable("skipRollback", true)
@@ -137,50 +140,50 @@ public class DoCreateE2EServiceInstanceRollback extends AbstractServiceTaskProce
throw e;
} catch (Exception ex){
msg = "Exception in Create ServiceInstance Rollback preProcessRequest " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) //TODO how does this even compile without exceptionUtil being declared
}
- msoLogger.trace("Exit preProcessRequest ")
+ logger.trace("Exit preProcessRequest ")
}
public void validateSDNCResponse(DelegateExecution execution, String response, String method) {
- msoLogger.trace("validateSDNCResponse")
+ logger.trace("validateSDNCResponse")
String msg = ""
try {
WorkflowException workflowException = execution.getVariable("WorkflowException")
boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator")
- msoLogger.debug("SDNCResponse: " + response)
- msoLogger.debug("workflowException: " + workflowException)
+ logger.debug("SDNCResponse: " + response)
+ logger.debug("workflowException: " + workflowException)
SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this)
sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator)
if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){
msg = "SDNC Adapter service-instance rollback successful for " + method
- msoLogger.debug(msg)
+ logger.debug(msg)
}else{
execution.setVariable("rolledBack", false)
msg = "Error Response from SDNC Adapter service-instance rollback for " + method
execution.setVariable("rollbackError", msg)
- msoLogger.debug(msg)
+ logger.debug(msg)
throw new BpmnError("MSOWorkflowException")
}
} catch (BpmnError e) {
throw e;
} catch (Exception ex){
msg = "Exception in Create ServiceInstance rollback for " + method + " Exception:" + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("Exit validateSDNCResponse ")
+ logger.trace("Exit validateSDNCResponse ")
}
/**
* Deletes the service instance in aai
*/
public void deleteServiceInstance(DelegateExecution execution) {
- msoLogger.trace("Started Delete Service Instance")
+ logger.trace("Started Delete Service Instance")
try {
String globalCustId = execution.getVariable("globalSubscriberId")
String serviceType = execution.getVariable("subscriptionServiceType")
@@ -190,15 +193,15 @@ public class DoCreateE2EServiceInstanceRollback extends AbstractServiceTaskProce
AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalCustId, serviceType, serviceInstanceId)
resourceClient.delete(serviceInstanceUri)
- msoLogger.trace("Completed Delete Service Instance")
+ logger.trace("Completed Delete Service Instance")
}catch(Exception e){
- msoLogger.debug("Error occured within deleteServiceInstance method: " + e)
+ logger.debug("Error occured within deleteServiceInstance method: " + e)
}
}
public void postProcessRequest(DelegateExecution execution) {
- msoLogger.trace("postProcessRequest")
+ logger.trace("postProcessRequest")
String msg = ""
try {
execution.setVariable("rollbackData", null)
@@ -215,51 +218,51 @@ public class DoCreateE2EServiceInstanceRollback extends AbstractServiceTaskProce
if(!succInAAI){
execution.setVariable("rolledBack", false) //both sdnc and aai must be successful to declare rollback Succesful
execution.setVariable("rollbackError", "Error deleting service-instance in AAI for rollback")
- msoLogger.debug("Error deleting service-instance in AAI for rollback", + serviceInstanceId)
+ logger.debug("Error deleting service-instance in AAI for rollback", + serviceInstanceId)
}
}
- msoLogger.trace("Exit postProcessRequest ")
+ logger.trace("Exit postProcessRequest ")
} catch (BpmnError e) {
msg = "Exception in Create ServiceInstance Rollback postProcessRequest. " + e.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
} catch (Exception ex) {
msg = "Exception in Create ServiceInstance Rollback postProcessRequest. " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
}
}
public void processRollbackException(DelegateExecution execution){
- msoLogger.trace("processRollbackException")
+ logger.trace("processRollbackException")
try{
- msoLogger.debug("Caught an Exception in DoCreateServiceInstanceRollback")
+ logger.debug("Caught an Exception in DoCreateServiceInstanceRollback")
execution.setVariable("rollbackData", null)
execution.setVariable("rollbackError", "Caught exception in ServiceInstance Create Rollback")
execution.setVariable("WorkflowException", null)
}catch(BpmnError b){
- msoLogger.debug("BPMN Error during processRollbackExceptions Method: ")
+ logger.debug("BPMN Error during processRollbackExceptions Method: ")
}catch(Exception e){
- msoLogger.debug("Caught Exception during processRollbackExceptions Method: " + e.getMessage())
+ logger.debug("Caught Exception during processRollbackExceptions Method: " + e.getMessage())
}
- msoLogger.trace(" Exit processRollbackException")
+ logger.trace(" Exit processRollbackException")
}
public void processRollbackJavaException(DelegateExecution execution){
- msoLogger.trace("processRollbackJavaException")
+ logger.trace("processRollbackJavaException")
try{
execution.setVariable("rollbackData", null)
execution.setVariable("rollbackError", "Caught Java exception in ServiceInstance Create Rollback")
- msoLogger.debug("Caught Exception in processRollbackJavaException")
+ logger.debug("Caught Exception in processRollbackJavaException")
}catch(Exception e){
- msoLogger.debug("Caught Exception in processRollbackJavaException " + e.getMessage())
+ logger.debug("Caught Exception in processRollbackJavaException " + e.getMessage())
}
- msoLogger.trace("Exit processRollbackJavaException")
+ logger.trace("Exit processRollbackJavaException")
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy
index 1b64671163..41bae326a5 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -45,7 +47,8 @@ import org.onap.so.client.aai.entities.AAIResultWrapper
import org.onap.so.client.aai.entities.Relationships
import org.onap.so.client.graphinventory.entities.uri.Depth
import org.onap.so.constants.Defaults
-import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
import org.springframework.web.util.UriUtils
import org.w3c.dom.Document
import org.w3c.dom.Element
@@ -72,7 +75,7 @@ import groovy.xml.XmlUtil
*
*/
public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCreateNetworkInstance.class);
+ private static final Logger logger = LoggerFactory.getLogger( DoCreateNetworkInstance.class);
String Prefix="CRENWKI_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
@@ -203,7 +206,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
public void preProcessRequest (DelegateExecution execution) {
execution.setVariable("prefix",Prefix)
- msoLogger.trace("Inside preProcessRequest() of " + className + ".groovy")
+ logger.trace("Inside preProcessRequest() of " + className + ".groovy")
try {
// initialize flow variables
@@ -217,12 +220,12 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
// JSON format request is sent, create xml
try {
def prettyJson = JsonOutput.prettyPrint(networkRequest.toString())
- msoLogger.debug(" Incoming message formatted . . . : " + '\n' + prettyJson)
+ logger.debug(" Incoming message formatted . . . : " + '\n' + prettyJson)
networkRequest = vidUtils.createXmlNetworkRequestInfra(execution, networkRequest)
} catch (Exception ex) {
String dataErrorMessage = " Invalid json format Request - " + ex.getMessage()
- msoLogger.debug(dataErrorMessage)
+ logger.debug(dataErrorMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage)
}
} else {
@@ -236,36 +239,36 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
networkRequest = utils.formatXml(networkRequest)
execution.setVariable(Prefix + "networkRequest", networkRequest)
- msoLogger.debug(Prefix + "networkRequest - " + '\n' + networkRequest)
+ logger.debug(Prefix + "networkRequest - " + '\n' + networkRequest)
// validate 'backout-on-failure' to override 'mso.rollback'
boolean rollbackEnabled = networkUtils.isRollbackEnabled(execution, networkRequest)
execution.setVariable(Prefix + "rollbackEnabled", rollbackEnabled)
- msoLogger.debug(Prefix + "rollbackEnabled - " + rollbackEnabled)
+ logger.debug(Prefix + "rollbackEnabled - " + rollbackEnabled)
String networkInputs = utils.getNodeXml(networkRequest, "network-inputs", false).replace("tag0:","").replace(":tag0","")
execution.setVariable(Prefix + "networkInputs", networkInputs)
- msoLogger.debug(Prefix + "networkInputs - " + '\n' + networkInputs)
+ logger.debug(Prefix + "networkInputs - " + '\n' + networkInputs)
// prepare messageId
String messageId = execution.getVariable("testMessageId") // for testing
if (messageId == null || messageId == "") {
messageId = UUID.randomUUID()
- msoLogger.debug(Prefix + "messageId, random generated: " + messageId)
+ logger.debug(Prefix + "messageId, random generated: " + messageId)
} else {
- msoLogger.debug(Prefix + "messageId, pre-assigned: " + messageId)
+ logger.debug(Prefix + "messageId, pre-assigned: " + messageId)
}
execution.setVariable(Prefix + "messageId", messageId)
String source = utils.getNodeText(networkRequest, "source")
execution.setVariable(Prefix + "source", source)
- msoLogger.debug(Prefix + "source - " + source)
+ logger.debug(Prefix + "source - " + source)
// validate cloud region
String lcpCloudRegionId = utils.getNodeText(networkRequest, "aic-cloud-region")
if ((lcpCloudRegionId == null) || (lcpCloudRegionId == "") || (lcpCloudRegionId == "null")) {
String dataErrorMessage = "Missing value/element: 'lcpCloudRegionId' or 'cloudConfiguration' or 'aic-cloud-region'."
- msoLogger.debug(" Invalid Request - " + dataErrorMessage)
+ logger.debug(" Invalid Request - " + dataErrorMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage)
}
@@ -273,7 +276,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
String serviceInstanceId = utils.getNodeText(networkRequest, "service-instance-id")
if ((serviceInstanceId == null) || (serviceInstanceId == "") || (serviceInstanceId == "null")) {
String dataErrorMessage = "Missing value/element: 'serviceInstanceId'."
- msoLogger.debug(" Invalid Request - " + dataErrorMessage)
+ logger.debug(" Invalid Request - " + dataErrorMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage)
}
@@ -288,20 +291,20 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
} catch (IOException ex) {
String exceptionMessage = "Exception Encountered in DoCreateNetworkInstance, PreProcessRequest() - "
String dataErrorMessage = exceptionMessage + " Unable to encode PO/SDNC user/password string - " + ex.getMessage()
- msoLogger.debug(dataErrorMessage)
+ logger.debug(dataErrorMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage)
}
// Set variables for Generic Get Sub Flow use
execution.setVariable(Prefix + "serviceInstanceId", serviceInstanceId)
- msoLogger.debug(Prefix + "serviceInstanceId - " + serviceInstanceId)
+ logger.debug(Prefix + "serviceInstanceId - " + serviceInstanceId)
execution.setVariable("GENGS_type", "service-instance")
- msoLogger.debug("GENGS_type - " + "service-instance")
- msoLogger.debug(" Url for SDNC adapter: " + UrnPropertiesReader.getVariable("mso.adapters.sdnc.endpoint",execution))
+ logger.debug("GENGS_type - " + "service-instance")
+ logger.debug(" Url for SDNC adapter: " + UrnPropertiesReader.getVariable("mso.adapters.sdnc.endpoint",execution))
String sdncVersion = execution.getVariable("sdncVersion")
- msoLogger.debug("sdncVersion? : " + sdncVersion)
+ logger.debug("sdncVersion? : " + sdncVersion)
// build 'networkOutputs'
String networkId = utils.getNodeText(networkRequest, "network-id")
@@ -318,7 +321,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
<network-name>${MsoUtils.xmlEscape(networkName)}</network-name>
</network-outputs>"""
execution.setVariable(Prefix + "networkOutputs", networkOutputs)
- msoLogger.debug(Prefix + "networkOutputs - " + '\n' + networkOutputs)
+ logger.debug(Prefix + "networkOutputs - " + '\n' + networkOutputs)
execution.setVariable(Prefix + "networkId", networkId)
execution.setVariable(Prefix + "networkName", networkName)
@@ -329,7 +332,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
sendSyncError(execution)
// caught exception
String exceptionMessage = "Exception Encountered in PreProcessRequest() of " + className + ".groovy ***** : " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
@@ -358,7 +361,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
throw e;
}catch (Exception ex){
String msg = "Exception in getServiceInstance. " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
}
@@ -368,7 +371,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable("prefix",Prefix)
- msoLogger.debug(" ***** Inside callRESTQueryAAINetworkName() of DoCreateNetworkInstance ***** " )
+ logger.debug(" ***** Inside callRESTQueryAAINetworkName() of DoCreateNetworkInstance ***** " )
try{
// get variables
@@ -383,18 +386,18 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable(Prefix + "isAAIqueryNameGood", true)
String orchestrationStatus = network.getOrchestrationStatus()
execution.setVariable(Prefix + "orchestrationStatus", orchestrationStatus.toUpperCase())
- msoLogger.debug(Prefix + "orchestrationStatus - " + orchestrationStatus.toUpperCase())
+ logger.debug(Prefix + "orchestrationStatus - " + orchestrationStatus.toUpperCase())
execution.setVariable("orchestrationStatus", orchestrationStatus)
- msoLogger.debug(Prefix + "isAAIqueryNameGood? : " + execution.getVariable(Prefix + "isAAIqueryNameGood"))
+ logger.debug(Prefix + "isAAIqueryNameGood? : " + execution.getVariable(Prefix + "isAAIqueryNameGood"))
} catch (NotFoundException e) {
- msoLogger.debug(" QueryAAINetworkName return code = '404' (Not Found). Proceed with the Create !!! ")
+ logger.debug(" QueryAAINetworkName return code = '404' (Not Found). Proceed with the Create !!! ")
} catch (Exception ex) {
// try error
String exceptionMessage = "Bpmn error encountered in DoCreateNetworkInstance flow - callRESTQueryAAINetworkName() - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
@@ -405,7 +408,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable("prefix",Prefix)
- msoLogger.debug(" ***** Inside callRESTQueryAAICloudRegion() of DoCreateNetworkInstance ***** " )
+ logger.debug(" ***** Inside callRESTQueryAAICloudRegion() of DoCreateNetworkInstance ***** " )
try {
String networkInputs = execution.getVariable(Prefix + "networkInputs")
@@ -429,12 +432,12 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
} else {
String dataErrorMessage = "QueryAAICloudRegion Unsuccessful. Return Code: " + execution.getVariable(Prefix + "queryCloudRegionReturnCode")
- msoLogger.debug(dataErrorMessage)
+ logger.debug(dataErrorMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage)
}
- msoLogger.debug(" is Cloud Region Good: " + execution.getVariable(Prefix + "isCloudRegionGood"))
+ logger.debug(" is Cloud Region Good: " + execution.getVariable(Prefix + "isCloudRegionGood"))
} catch (BpmnError e) {
throw e;
@@ -442,7 +445,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
} catch (Exception ex) {
// try error
String exceptionMessage = "Bpmn error encountered in DoCreateNetworkInstance flow - callRESTQueryAAICloudRegion() - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
@@ -453,7 +456,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable("prefix",Prefix)
- msoLogger.debug(" ***** Inside callRESTQueryAAINetworkId() of DoCreateNetworkInstance ***** " )
+ logger.debug(" ***** Inside callRESTQueryAAINetworkId() of DoCreateNetworkInstance ***** " )
try {
// get variables
@@ -466,7 +469,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
networkId = utils.getNodeText(networkResponseInformation, "instance-id")
} catch (Exception ex) {
String dataErrorMessage = " SNDC Response network validation for 'instance-id' (network-id) failed: Empty <network-response-information>"
- msoLogger.debug(dataErrorMessage)
+ logger.debug(dataErrorMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage)
}
@@ -475,10 +478,10 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
}
if (networkId == null || networkId == "null") {
String dataErrorMessage = "SNDC Response did not contains 'instance-id' or 'network-id' element, or the value is null."
- msoLogger.debug(dataErrorMessage)
+ logger.debug(dataErrorMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage)
} else {
- msoLogger.debug(" SNDC Response network validation for 'instance-id' (network-id)' is good: " + networkId)
+ logger.debug(" SNDC Response network validation for 'instance-id' (network-id)' is good: " + networkId)
}
@@ -499,12 +502,12 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
} catch (NotFoundException e) {
String dataErrorMessage = "Response Error from QueryAAINetworkId is 404 (Not Found)."
- msoLogger.debug(" AAI Query Failed. " + dataErrorMessage)
+ logger.debug(" AAI Query Failed. " + dataErrorMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage)
} catch (Exception ex) {
String exceptionMessage = "Bpmn error encountered in DoCreateNetworkInstance flow. callRESTQueryAAINetworkId() - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
@@ -515,7 +518,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable("prefix",Prefix)
- msoLogger.debug(" ***** Inside callRESTReQueryAAINetworkId() of DoCreateNetworkInstance ***** " )
+ logger.debug(" ***** Inside callRESTReQueryAAINetworkId() of DoCreateNetworkInstance ***** " )
try {
// get variables
@@ -536,17 +539,17 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
<network-name>${MsoUtils.xmlEscape(netName)}</network-name>
</network-outputs>"""
execution.setVariable(Prefix + "networkOutputs", networkOutputs)
- msoLogger.debug(" networkOutputs - " + '\n' + networkOutputs)
+ logger.debug(" networkOutputs - " + '\n' + networkOutputs)
} catch (NotFoundException e) {
String dataErrorMessage = "Response Error from ReQueryAAINetworkId is 404 (Not Found)."
- msoLogger.debug(" AAI ReQuery Failed. - " + dataErrorMessage)
+ logger.debug(" AAI ReQuery Failed. - " + dataErrorMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage)
} catch (Exception ex) {
String exceptionMessage = "Bpmn error encountered in DoCreateNetworkInstance flow. callRESTReQueryAAINetworkId() - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
@@ -557,7 +560,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable("prefix",Prefix)
- msoLogger.debug(" ***** Inside callRESTQueryAAINetworkVpnBinding() of DoCreateNetworkInstance ***** " )
+ logger.debug(" ***** Inside callRESTQueryAAINetworkVpnBinding() of DoCreateNetworkInstance ***** " )
try {
@@ -567,7 +570,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
if(relationships.isPresent()){
List<AAIResourceUri> uris = relationships.get().getRelatedAAIUris(AAIObjectType.VPN_BINDING)
- msoLogger.debug(Prefix + "vpnCount - " + uris.size())
+ logger.debug(Prefix + "vpnCount - " + uris.size())
if (uris.size() > 0) {
String routeTargets = ""
@@ -593,7 +596,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
} // end loop
execution.setVariable(Prefix + "routeCollection", routeTargets)
- msoLogger.debug(Prefix + "routeCollection - " + '\n' + routeTargets)
+ logger.debug(Prefix + "routeCollection - " + '\n' + routeTargets)
} else {
// reset return code to success
@@ -609,17 +612,17 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
String aaiStubResponseAsXml = utils.formatXml(aaiStubResponse)
execution.setVariable(Prefix + "queryVpnBindingAAIResponse", aaiStubResponseAsXml)
execution.setVariable(Prefix + "routeCollection", "<routeTargets/>")
- msoLogger.debug(" No vpnBinding, using this stub as response - " + '\n' + aaiStubResponseAsXml)
+ logger.debug(" No vpnBinding, using this stub as response - " + '\n' + aaiStubResponseAsXml)
}
}
} catch (NotFoundException e) {
- msoLogger.debug("Response Error from AAINetworkVpnBinding is 404 (Not Found).")
+ logger.debug("Response Error from AAINetworkVpnBinding is 404 (Not Found).")
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Response Error from AAINetworkVpnBinding is 404 (Not Found).")
} catch (Exception ex) {
String exceptionMessage = "Bpmn error encountered in DoCreateNetworkInstance flow. callRESTQueryAAINetworkVpnBinding() - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
@@ -630,7 +633,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable("prefix",Prefix)
- msoLogger.debug(" ***** Inside callRESTQueryAAINetworkPolicy() of DoCreateNetworkInstance ***** " )
+ logger.debug(" ***** Inside callRESTQueryAAINetworkPolicy() of DoCreateNetworkInstance ***** " )
try {
AAIResourcesClient client = new AAIResourcesClient()
@@ -640,7 +643,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
List<AAIResourceUri> uris = relationships.get().getRelatedAAIUris(AAIObjectType.NETWORK_POLICY)
execution.setVariable(Prefix + "networkPolicyCount", uris.size())
- msoLogger.debug(Prefix + "networkPolicyCount - " + uris.size())
+ logger.debug(Prefix + "networkPolicyCount - " + uris.size())
if (uris.size() > 0) {
@@ -658,7 +661,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
} // end loop
execution.setVariable(Prefix + "networkCollection", networkPolicies)
- msoLogger.debug(Prefix + "networkCollection - " + '\n' + networkPolicies)
+ logger.debug(Prefix + "networkCollection - " + '\n' + networkPolicies)
} else {
// reset return code to success
@@ -674,18 +677,18 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
String aaiStubResponseAsXml = utils.formatXml(aaiStubResponse)
execution.setVariable(Prefix + "queryNetworkPolicyAAIResponse", aaiStubResponseAsXml)
execution.setVariable(Prefix + "networkCollection", "<policyFqdns/>")
- msoLogger.debug(" No net policies, using this stub as response - " + '\n' + aaiStubResponseAsXml)
+ logger.debug(" No net policies, using this stub as response - " + '\n' + aaiStubResponseAsXml)
}
}
} catch (NotFoundException e) {
String dataErrorMessage = "Response Error from QueryAAINetworkPolicy is 404 (Not Found)."
- msoLogger.debug(dataErrorMessage)
+ logger.debug(dataErrorMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage)
} catch (Exception ex) {
String exceptionMessage = "Bpmn error encountered in DoCreateNetworkInstance flow. callRESTQueryAAINetworkPolicy() - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
@@ -696,7 +699,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable("prefix",Prefix)
- msoLogger.debug(" ***** Inside callRESTQueryAAINetworkTableRef() of DoCreateNetworkInstance ***** " )
+ logger.debug(" ***** Inside callRESTQueryAAINetworkTableRef() of DoCreateNetworkInstance ***** " )
try {
@@ -707,7 +710,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
List<AAIResourceUri> uris = relationships.get().getRelatedAAIUris(AAIObjectType.ROUTE_TABLE_REFERENCE)
execution.setVariable(Prefix + "networkTableRefCount", uris.size())
- msoLogger.debug(Prefix + "networkTableRefCount - " + uris.size())
+ logger.debug(Prefix + "networkTableRefCount - " + uris.size())
if (uris.size() > 0) {
@@ -725,7 +728,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
} // end loop
execution.setVariable(Prefix + "tableRefCollection", networkTableRefs)
- msoLogger.debug(Prefix + "tableRefCollection - " + '\n' + networkTableRefs)
+ logger.debug(Prefix + "tableRefCollection - " + '\n' + networkTableRefs)
} else {
// reset return code to success
@@ -741,19 +744,19 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
String aaiStubResponseAsXml = utils.formatXml(aaiStubResponse)
execution.setVariable(Prefix + "queryNetworkTableRefAAIResponse", aaiStubResponseAsXml)
execution.setVariable(Prefix + "tableRefCollection", "<routeTableFqdns/>")
- msoLogger.debug(" No net table references, using this stub as response - " + '\n' + aaiStubResponseAsXml)
+ logger.debug(" No net table references, using this stub as response - " + '\n' + aaiStubResponseAsXml)
}
}
} catch (NotFoundException e) {
String dataErrorMessage = "Response Error from QueryAAINetworkTableRef is 404 (Not Found)."
- msoLogger.debug(dataErrorMessage)
+ logger.debug(dataErrorMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage)
} catch (Exception ex) {
String exceptionMessage = "Bpmn error encountered in DoCreateNetworkInstance flow. callRESTQueryAAINetworkTableRef() - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
@@ -765,7 +768,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable("prefix",Prefix)
- msoLogger.trace(" ***** Inside callRESTUpdateContrailAAINetwork() of DoCreateNetworkInstance ***** " )
+ logger.trace(" ***** Inside callRESTUpdateContrailAAINetwork() of DoCreateNetworkInstance ***** " )
try {
// get variables
@@ -797,7 +800,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
l3Network.setOrchestrationStatus("Active")
}
- msoLogger.debug("Updating l3-network in AAI" )
+ logger.debug("Updating l3-network in AAI" )
AAIResourcesClient client = new AAIResourcesClient()
AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, networkId)
@@ -815,7 +818,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
subnet.setOrchestrationStatus("Active")
}
- msoLogger.debug("Updating subnet in AAI" )
+ logger.debug("Updating subnet in AAI" )
AAIResourceUri subUri = AAIUriFactory.createResourceUri(AAIObjectType.SUBNET, networkId, subnetId)
client.update(subUri, subnet)
@@ -828,17 +831,17 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
} else {
execution.setVariable(Prefix + "isPONR", true)
}
- msoLogger.debug(Prefix + "isPONR" + ": " + execution.getVariable(Prefix + "isPONR"))
+ logger.debug(Prefix + "isPONR" + ": " + execution.getVariable(Prefix + "isPONR"))
} catch (BpmnError e) {
throw e;
} catch (NotFoundException e) {
String dataErrorMessage = " Response Error from UpdateContrailAAINetwork is 404 (Not Found)."
- msoLogger.debug(dataErrorMessage)
+ logger.debug(dataErrorMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage)
} catch (Exception ex) {
String exceptionMessage = "Bpmn error encountered in DoCreateNetworkInstance flow. callRESTUpdateContrailAAINetwork() - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
}
@@ -847,7 +850,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable("prefix",Prefix)
- msoLogger.trace("Inside prepareCreateNetworkRequest() of DoCreateNetworkInstance")
+ logger.trace("Inside prepareCreateNetworkRequest() of DoCreateNetworkInstance")
try {
@@ -874,11 +877,11 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
buildDeleteNetworkRequestAsString = buildDeleteNetworkRequestAsString.replace(":w1aac13n0", "").replace("w1aac13n0:", "")
execution.setVariable(Prefix + "createNetworkRequest", buildDeleteNetworkRequestAsString)
- msoLogger.debug(Prefix + "createNetworkRequest - " + "\n" + buildDeleteNetworkRequestAsString)
+ logger.debug(Prefix + "createNetworkRequest - " + "\n" + buildDeleteNetworkRequestAsString)
} catch (Exception ex) {
String exceptionMessage = " Bpmn error encountered in DoCreateNetworkInstance flow. prepareCreateNetworkRequest() - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
@@ -889,7 +892,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable("prefix",Prefix)
- msoLogger.trace("Inside prepareSDNCRequest() of DoCreateNetworkInstance")
+ logger.trace("Inside prepareSDNCRequest() of DoCreateNetworkInstance")
try {
// get variables
@@ -914,12 +917,12 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
String sndcTopologyCreateRequesAsString = utils.formatXml(sndcTopologyCreateRequest)
execution.setVariable(Prefix + "assignSDNCRequest", sndcTopologyCreateRequesAsString)
- msoLogger.debug(Prefix + "assignSDNCRequest - " + "\n" + sndcTopologyCreateRequesAsString)
+ logger.debug(Prefix + "assignSDNCRequest - " + "\n" + sndcTopologyCreateRequesAsString)
} catch (Exception ex) {
String exceptionMessage = " Bpmn error encountered in DoCreateNetworkInstance flow. prepareSDNCRequest() - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
@@ -930,7 +933,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable("prefix",Prefix)
- msoLogger.trace("Inside prepareRpcSDNCRequest() of DoCreateNetworkInstance")
+ logger.trace("Inside prepareRpcSDNCRequest() of DoCreateNetworkInstance")
try {
// get variables
@@ -947,11 +950,11 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
String sndcTopologyCreateRequesAsString = utils.formatXml(sndcTopologyCreateRequest)
execution.setVariable(Prefix + "assignSDNCRequest", sndcTopologyCreateRequesAsString)
- msoLogger.debug(Prefix + "assignSDNCRequest - " + "\n" + sndcTopologyCreateRequesAsString)
+ logger.debug(Prefix + "assignSDNCRequest - " + "\n" + sndcTopologyCreateRequesAsString)
} catch (Exception ex) {
String exceptionMessage = " Bpmn error encountered in DoCreateNetworkInstance flow. prepareRpcSDNCRequest() - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
@@ -962,7 +965,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable("prefix",Prefix)
- msoLogger.trace("Inside prepareRpcSDNCActivateRequest() of DoCreateNetworkInstance")
+ logger.trace("Inside prepareRpcSDNCActivateRequest() of DoCreateNetworkInstance")
try {
// get variables
@@ -977,12 +980,12 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
String sndcTopologyCreateRequesAsString = utils.formatXml(sndcTopologyCreateRequest)
execution.setVariable(Prefix + "activateSDNCRequest", sndcTopologyCreateRequesAsString)
- msoLogger.debug(Prefix + "activateSDNCRequest - " + "\n" + sndcTopologyCreateRequesAsString)
+ logger.debug(Prefix + "activateSDNCRequest - " + "\n" + sndcTopologyCreateRequesAsString)
} catch (Exception ex) {
String exceptionMessage = " Bpmn error encountered in DoCreateNetworkInstance flow. prepareRpcSDNCActivateRequest() - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
@@ -1000,7 +1003,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable("prefix",Prefix)
- msoLogger.trace("Inside validateNetworkResponse() of DoCreateNetworkInstance")
+ logger.trace("Inside validateNetworkResponse() of DoCreateNetworkInstance")
try {
String returnCode = execution.getVariable(Prefix + "networkReturnCode")
@@ -1009,13 +1012,13 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
networkResponse="" // reset
}
- msoLogger.debug(" Network Adapter create responseCode: " + returnCode)
+ logger.debug(" Network Adapter create responseCode: " + returnCode)
String errorMessage = ""
if (returnCode == "200") {
execution.setVariable(Prefix + "isNetworkRollbackNeeded", true)
execution.setVariable(Prefix + "createNetworkResponse", networkResponse)
- msoLogger.debug(" Network Adapter create Success Response - " + "\n" + networkResponse)
+ logger.debug(" Network Adapter create Success Response - " + "\n" + networkResponse)
// prepare rollback data
String rollbackData = utils.getNodeXml(networkResponse, "rollback", false).replace("tag0:","").replace(":tag0","")
@@ -1026,7 +1029,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
</rollbackNetworkRequest>"""
String rollbackNetworkXml = utils.formatXml(rollbackNetwork)
execution.setVariable(Prefix + "rollbackNetworkRequest", rollbackNetworkXml)
- msoLogger.debug(" Network Adapter rollback data - " + "\n" + rollbackNetworkXml)
+ logger.debug(" Network Adapter rollback data - " + "\n" + rollbackNetworkXml)
} else { // network error
if (returnCode.toInteger() > 399 && returnCode.toInteger() < 600) { //4xx, 5xx
@@ -1060,7 +1063,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
} catch (Exception ex) {
String exceptionMessage = " Bpmn error encountered in DoCreateNetworkInstance flow. validateCreateNetworkResponse() - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
@@ -1072,7 +1075,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable("prefix",Prefix)
- msoLogger.trace("Inside validateSDNCResponse() of DoCreateNetworkInstance")
+ logger.trace("Inside validateSDNCResponse() of DoCreateNetworkInstance")
String response = execution.getVariable(Prefix + "assignSDNCResponse")
boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator")
@@ -1087,10 +1090,10 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
if (execution.getVariable(Prefix + "sdncResponseSuccess") == true) { // from sdnc util, Prefix+'sdncResponseSuccess'
execution.setVariable(Prefix + "isSdncRollbackNeeded", true)
- msoLogger.debug("Successfully Validated SDNC Response")
+ logger.debug("Successfully Validated SDNC Response")
} else {
- msoLogger.debug("Did NOT Successfully Validated SDNC Response")
+ logger.debug("Did NOT Successfully Validated SDNC Response")
throw new BpmnError("MSOWorkflowException")
}
@@ -1100,7 +1103,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable("prefix",Prefix)
- msoLogger.trace("Inside validateRpcSDNCActivateResponse() of DoCreateNetworkInstance")
+ logger.trace("Inside validateRpcSDNCActivateResponse() of DoCreateNetworkInstance")
String response = execution.getVariable(Prefix + "activateSDNCResponse")
boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator")
@@ -1115,10 +1118,10 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
if (execution.getVariable(Prefix + "sdncResponseSuccess") == true) { // from sdnc util, Prefix+'sdncResponseSuccess'
execution.setVariable(Prefix + "isSdncActivateRollbackNeeded", true)
- msoLogger.debug("Successfully Validated Rpc SDNC Activate Response")
+ logger.debug("Successfully Validated Rpc SDNC Activate Response")
} else {
- msoLogger.debug("Did NOT Successfully Validated Rpc SDNC Activate Response")
+ logger.debug("Did NOT Successfully Validated Rpc SDNC Activate Response")
throw new BpmnError("MSOWorkflowException")
}
@@ -1129,7 +1132,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable("prefix",Prefix)
- msoLogger.trace("Inside prepareSDNCRollbackRequest() of DoCreateNetworkInstance")
+ logger.trace("Inside prepareSDNCRollbackRequest() of DoCreateNetworkInstance")
try {
// get variables
@@ -1145,12 +1148,12 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
String sndcTopologyRollbackRequest = sdncAdapterUtils.sdncTopologyRequestV2(execution, createNetworkInput, serviceInstanceId, sdncCallback, "rollback", "NetworkActivateRequest", cloudRegionId, networkId, null, null)
String sndcTopologyRollbackRequestAsString = utils.formatXml(sndcTopologyRollbackRequest)
execution.setVariable(Prefix + "rollbackSDNCRequest", sndcTopologyRollbackRequestAsString)
- msoLogger.debug(" Preparing request for SDNC Topology 'rollback-NetworkActivateRequest' rollback . . . - " + "\n" + sndcTopologyRollbackRequestAsString)
+ logger.debug(" Preparing request for SDNC Topology 'rollback-NetworkActivateRequest' rollback . . . - " + "\n" + sndcTopologyRollbackRequestAsString)
} catch (Exception ex) {
String exceptionMessage = " Bpmn error encountered in DoCreateNetworkInstance flow. prepareSDNCRollbackRequest() - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage)
}
@@ -1161,7 +1164,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable("prefix",Prefix)
- msoLogger.trace("Inside prepareRpcSDNCRollbackRequest() of DoCreateNetworkInstance")
+ logger.trace("Inside prepareRpcSDNCRollbackRequest() of DoCreateNetworkInstance")
try {
// get variables
@@ -1177,12 +1180,12 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
String sndcTopologyRollbackRpcRequest = sdncAdapterUtils.sdncTopologyRequestRsrc(execution, createNetworkInput, serviceInstanceId, sdncCallback, "unassign", "DeleteNetworkInstance", cloudRegionId, networkId, null)
String sndcTopologyRollbackRpcRequestAsString = utils.formatXml(sndcTopologyRollbackRpcRequest)
execution.setVariable(Prefix + "rollbackSDNCRequest", sndcTopologyRollbackRpcRequestAsString)
- msoLogger.debug(" Preparing request for SDNC Topology 'unassign-DeleteNetworkInstance' rollback . . . - " + "\n" + sndcTopologyRollbackRpcRequestAsString)
+ logger.debug(" Preparing request for SDNC Topology 'unassign-DeleteNetworkInstance' rollback . . . - " + "\n" + sndcTopologyRollbackRpcRequestAsString)
} catch (Exception ex) {
String exceptionMessage = " Bpmn error encountered in DoCreateNetworkInstance flow. prepareRpcSDNCRollbackRequest() - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage)
}
@@ -1193,7 +1196,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable("prefix",Prefix)
- msoLogger.trace("Inside prepareRpcSDNCActivateRollback() of DoCreateNetworkInstance")
+ logger.trace("Inside prepareRpcSDNCActivateRollback() of DoCreateNetworkInstance")
try {
@@ -1210,12 +1213,12 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
String sndcTopologyRollbackRpcRequest = sdncAdapterUtils.sdncTopologyRequestRsrc(execution, createNetworkInput, serviceInstanceId, sdncCallback, "deactivate", "DeleteNetworkInstance", cloudRegionId, networkId, null)
String sndcTopologyRollbackRpcRequestAsString = utils.formatXml(sndcTopologyRollbackRpcRequest)
execution.setVariable(Prefix + "rollbackActivateSDNCRequest", sndcTopologyRollbackRpcRequestAsString)
- msoLogger.debug(" Preparing request for RPC SDNC Topology 'deactivate-DeleteNetworkInstance' rollback . . . - " + "\n" + sndcTopologyRollbackRpcRequestAsString)
+ logger.debug(" Preparing request for RPC SDNC Topology 'deactivate-DeleteNetworkInstance' rollback . . . - " + "\n" + sndcTopologyRollbackRpcRequestAsString)
} catch (Exception ex) {
String exceptionMessage = " Bpmn error encountered in DoCreateNetworkInstance flow. prepareRpcSDNCActivateRollback() - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage)
}
@@ -1226,7 +1229,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable("prefix",Prefix)
- msoLogger.trace("Inside prepareRollbackData() of DoCreateNetworkInstance")
+ logger.trace("Inside prepareRollbackData() of DoCreateNetworkInstance")
try {
@@ -1250,14 +1253,14 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
}
}
execution.setVariable("rollbackData", rollbackData)
- msoLogger.debug("** rollbackData : " + rollbackData)
+ logger.debug("** rollbackData : " + rollbackData)
execution.setVariable("WorkflowException", execution.getVariable(Prefix + "WorkflowException"))
- msoLogger.debug("** WorkflowException : " + execution.getVariable("WorkflowException"))
+ logger.debug("** WorkflowException : " + execution.getVariable("WorkflowException"))
} catch (Exception ex) {
String exceptionMessage = " Bpmn error encountered in DoCreateNetworkInstance flow. prepareRollbackData() - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage)
}
@@ -1268,7 +1271,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable("prefix",Prefix)
- msoLogger.trace("Inside postProcessResponse() of DoCreateNetworkInstance")
+ logger.trace("Inside postProcessResponse() of DoCreateNetworkInstance")
try {
@@ -1277,7 +1280,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
// 2. Success: execution.getVariable("WorkflowException") == null (NULL)
// 3. WorkflowException: execution.getVariable("WorkflowException") != null (NOT NULL)
- msoLogger.debug(" ***** Is Exception Encountered (isException)? : " + execution.getVariable(Prefix + "isException"))
+ logger.debug(" ***** Is Exception Encountered (isException)? : " + execution.getVariable(Prefix + "isException"))
// successful flow
if (execution.getVariable(Prefix + "isException") == false) {
// set rollback data
@@ -1287,14 +1290,14 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
prepareSuccessRollbackData(execution) // populate rollbackData
execution.setVariable("WorkflowException", null)
execution.setVariable(Prefix + "Success", true)
- msoLogger.debug(" ***** postProcessResponse(), GOOD !!!")
+ logger.debug(" ***** postProcessResponse(), GOOD !!!")
} else {
// inside sub-flow logic
execution.setVariable(Prefix + "Success", false)
execution.setVariable("rollbackData", null)
String exceptionMessage = " Exception encountered in MSO Bpmn. "
if (execution.getVariable("workflowException") != null) { // Output of Rollback flow.
- msoLogger.debug(" ***** workflowException: " + execution.getVariable("workflowException"))
+ logger.debug(" ***** workflowException: " + execution.getVariable("workflowException"))
WorkflowException wfex = execution.getVariable("workflowException")
exceptionMessage = wfex.getErrorMessage()
} else {
@@ -1304,18 +1307,18 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
}
}
// going to the Main flow: a-la-carte or macro
- msoLogger.debug(" ***** postProcessResponse(), BAD !!!")
+ logger.debug(" ***** postProcessResponse(), BAD !!!")
exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage)
throw new BpmnError("MSOWorkflowException")
}
} catch(BpmnError b){
- msoLogger.debug("Rethrowing MSOWorkflowException")
+ logger.debug("Rethrowing MSOWorkflowException")
throw b
} catch (Exception ex) {
String exceptionMessage = " Bpmn error encountered in DoCreateNetworkInstance flow. postProcessResponse() - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage)
throw new BpmnError("MSOWorkflowException")
@@ -1329,7 +1332,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable("prefix",Prefix)
- msoLogger.trace("Inside prepareSuccessRollbackData() of DoCreateNetworkInstance")
+ logger.trace("Inside prepareSuccessRollbackData() of DoCreateNetworkInstance")
try {
@@ -1361,13 +1364,13 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
}
execution.setVariable("rollbackData", rollbackData)
- msoLogger.debug("** 'rollbackData' for Full Rollback : " + rollbackData)
+ logger.debug("** 'rollbackData' for Full Rollback : " + rollbackData)
execution.setVariable("WorkflowException", null)
} catch (Exception ex) {
String exceptionMessage = " Bpmn error encountered in DoCreateNetworkInstance flow. prepareSuccessRollbackData() - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage)
}
@@ -1378,7 +1381,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable("prefix",Prefix)
- msoLogger.trace("Inside setExceptionFlag() of DoCreateNetworkInstance")
+ logger.trace("Inside setExceptionFlag() of DoCreateNetworkInstance")
try {
@@ -1389,11 +1392,11 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
} else {
execution.setVariable(Prefix + "WorkflowException", execution.getVariable("WorkflowException"))
}
- msoLogger.debug(Prefix + "WorkflowException - " +execution.getVariable(Prefix + "WorkflowException"))
+ logger.debug(Prefix + "WorkflowException - " +execution.getVariable(Prefix + "WorkflowException"))
} catch(Exception ex){
String exceptionMessage = "Bpmn error encountered in DoCreateNetworkInstance flow. setExceptionFlag(): " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage)
}
@@ -1411,18 +1414,18 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable("prefix",Prefix)
try{
- msoLogger.debug( "Caught a Java Exception in " + Prefix)
- msoLogger.debug("Started processJavaException Method")
- msoLogger.debug("Variables List: " + execution.getVariables())
+ logger.debug( "Caught a Java Exception in " + Prefix)
+ logger.debug("Started processJavaException Method")
+ logger.debug("Variables List: " + execution.getVariables())
execution.setVariable("UnexpectedError", "Caught a Java Lang Exception - " + Prefix) // Adding this line temporarily until this flows error handling gets updated
exceptionUtil.buildWorkflowException(execution, 500, "Caught a Java Lang Exception")
}catch(Exception e){
- msoLogger.debug("Caught Exception during processJavaException Method: " + e)
+ logger.debug("Caught Exception during processJavaException Method: " + e)
execution.setVariable("UnexpectedError", "Exception in processJavaException method - " + Prefix) // Adding this line temporarily until this flows error handling gets updated
exceptionUtil.buildWorkflowException(execution, 500, "Exception in processJavaException method" + Prefix)
}
- msoLogger.debug( "Completed processJavaException Method in " + Prefix)
+ logger.debug( "Completed processJavaException Method in " + Prefix)
}
}
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 fd6a4a1cde..c144dc0f46 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
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -25,7 +27,8 @@ 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.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.onap.so.bpmn.common.scripts.ExceptionUtil
import org.onap.so.bpmn.common.scripts.NetworkUtils
@@ -43,7 +46,7 @@ import org.camunda.bpm.engine.delegate.DelegateExecution
*
*/
public class DoCreateNetworkInstanceRollback extends AbstractServiceTaskProcessor {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCreateNetworkInstanceRollback.class);
+ private static final Logger logger = LoggerFactory.getLogger( DoCreateNetworkInstanceRollback.class);
String Prefix="CRENWKIR_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
@@ -96,7 +99,7 @@ public class DoCreateNetworkInstanceRollback extends AbstractServiceTaskProcesso
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix",Prefix)
- msoLogger.trace("Inside preProcessRequest() of " + className + ".groovy")
+ logger.trace("Inside preProcessRequest() of " + className + ".groovy")
try {
// initialize flow variables
@@ -128,10 +131,10 @@ public class DoCreateNetworkInstanceRollback extends AbstractServiceTaskProcesso
execution.setVariable(Prefix + "rollbackNetworkRequest", rollbackNetworkRequest)
execution.setVariable(Prefix + "rollbackSDNCRequest", rollbackSDNCRequest)
execution.setVariable(Prefix + "rollbackActivateSDNCRequest", rollbackActivateSDNCRequest)
- msoLogger.debug("'rollbackData': " + '\n' + execution.getVariable("rollbackData"))
+ logger.debug("'rollbackData': " + '\n' + execution.getVariable("rollbackData"))
String sdncVersion = execution.getVariable("sdncVersion")
- msoLogger.debug("sdncVersion? : " + sdncVersion)
+ logger.debug("sdncVersion? : " + sdncVersion)
// PO Authorization Info / headers Authorization=
String basicAuthValuePO = UrnPropertiesReader.getVariable("mso.adapters.po.auth",execution)
@@ -143,7 +146,7 @@ public class DoCreateNetworkInstanceRollback extends AbstractServiceTaskProcesso
} catch (IOException ex) {
String exceptionMessage = "Exception Encountered in DoCreateNetworkInstance, PreProcessRequest() - "
String dataErrorMessage = exceptionMessage + " Unable to encode PO/SDNC user/password string - " + ex.getMessage()
- msoLogger.debug(dataErrorMessage )
+ logger.debug(dataErrorMessage )
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage)
}
@@ -152,7 +155,7 @@ public class DoCreateNetworkInstanceRollback extends AbstractServiceTaskProcesso
} else {
execution.setVariable(Prefix + "WorkflowException", execution.getVariable("WorkflowException"))
}
- msoLogger.debug("*** WorkflowException : " + execution.getVariable(Prefix + "WorkflowException"))
+ logger.debug("*** WorkflowException : " + execution.getVariable(Prefix + "WorkflowException"))
if(execution.getVariable(Prefix + "WorkflowException") != null) {
// called by: DoCreateNetworkInstance, partial rollback
execution.setVariable(Prefix + "fullRollback", false)
@@ -162,7 +165,7 @@ public class DoCreateNetworkInstanceRollback extends AbstractServiceTaskProcesso
execution.setVariable(Prefix + "fullRollback", true)
}
- msoLogger.debug("*** fullRollback? : " + execution.getVariable(Prefix + "fullRollback"))
+ logger.debug("*** fullRollback? : " + execution.getVariable(Prefix + "fullRollback"))
} catch (BpmnError e) {
@@ -171,7 +174,7 @@ public class DoCreateNetworkInstanceRollback extends AbstractServiceTaskProcesso
} catch (Exception ex) {
// caught exception
String exceptionMessage = "Exception Encountered in PreProcessRequest() of " + className + ".groovy ***** : " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
@@ -182,7 +185,7 @@ public class DoCreateNetworkInstanceRollback extends AbstractServiceTaskProcesso
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix",Prefix)
- msoLogger.trace("Inside callPONetworkAdapter() of " + className + "")
+ logger.trace("Inside callPONetworkAdapter() of " + className + "")
try {
String poUrl = UrnPropertiesReader.getVariable("mso.adapters.network.rest.endpoint",execution)
@@ -192,7 +195,7 @@ public class DoCreateNetworkInstanceRollback extends AbstractServiceTaskProcesso
String rollbackNetworkRequest = execution.getVariable(Prefix + "rollbackNetworkRequest")
String urlRollbackPoNetwork = poUrl+ "/" + networkId + "/rollback"
- msoLogger.debug("'urlRollbackPoNetwork': " + urlRollbackPoNetwork)
+ logger.debug("'urlRollbackPoNetwork': " + urlRollbackPoNetwork)
execution.setVariable(Prefix + "urlRollbackPoNetwork", urlRollbackPoNetwork)
URL url = new URL(urlRollbackPoNetwork)
@@ -202,12 +205,12 @@ public class DoCreateNetworkInstanceRollback extends AbstractServiceTaskProcesso
execution.setVariable(Prefix + "rollbackNetworkReturnCode", response.getStatus())
- msoLogger.debug(" Network Adapter rollback responseCode: " + response.getStatus())
+ logger.debug(" Network Adapter rollback responseCode: " + response.getStatus())
} catch (Exception ex) {
String exceptionMessage = "Exception Encountered in callPONetworkAdapter() of DoCreateNetworkInstanceRollback flow - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
@@ -218,7 +221,7 @@ public class DoCreateNetworkInstanceRollback extends AbstractServiceTaskProcesso
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix",Prefix)
- msoLogger.trace("Inside validateRollbackResponses() of DoCreateNetworkInstanceRollback")
+ logger.trace("Inside validateRollbackResponses() of DoCreateNetworkInstanceRollback")
try {
// validate PO network rollback response
@@ -226,7 +229,7 @@ public class DoCreateNetworkInstanceRollback extends AbstractServiceTaskProcesso
String rollbackNetworkReturnCode = "200"
if (execution.getVariable(Prefix + "rollbackNetworkRequest") != null) {
rollbackNetworkReturnCode = execution.getVariable(Prefix + "rollbackNetworkReturnCode")
- msoLogger.debug(" NetworkRollback Code - " + rollbackNetworkReturnCode)
+ logger.debug(" NetworkRollback Code - " + rollbackNetworkReturnCode)
if (rollbackNetworkReturnCode != "200") {
rollbackNetworkErrorMessages = " + PO Network rollback failed. "
} else {
@@ -258,8 +261,8 @@ public class DoCreateNetworkInstanceRollback extends AbstractServiceTaskProcesso
} else {
rollbackSdncErrorMessages = " + SDNC assign rollback failed. "
}
- msoLogger.debug(" SDNC assign rollback Code - " + rollbackSDNCReturnCode)
- msoLogger.debug(" SDNC assign rollback Response - " + rollbackSDNCResponse)
+ logger.debug(" SDNC assign rollback Code - " + rollbackSDNCReturnCode)
+ logger.debug(" SDNC assign rollback Response - " + rollbackSDNCResponse)
}
// validate SDNC activate rollback response
@@ -285,14 +288,14 @@ public class DoCreateNetworkInstanceRollback extends AbstractServiceTaskProcesso
} else {
rollbackActivateSdncErrorMessages = " + SDNC activate rollback failed. "
}
- msoLogger.debug(" SDNC activate rollback Code - " + rollbackActivateSDNCReturnCode)
- msoLogger.debug(" SDNC activate rollback Response - " + rollbackActivateSDNCResponse)
+ logger.debug(" SDNC activate rollback Code - " + rollbackActivateSDNCReturnCode)
+ logger.debug(" SDNC activate rollback Response - " + rollbackActivateSDNCResponse)
}
String statusMessage = ""
int errorCode = 7000
- msoLogger.debug("*** fullRollback? : " + execution.getVariable(Prefix + "fullRollback"))
+ logger.debug("*** fullRollback? : " + execution.getVariable(Prefix + "fullRollback"))
if (execution.getVariable(Prefix + "fullRollback") == false) {
// original WorkflowException,
WorkflowException wfe = execution.getVariable(Prefix + "WorkflowException")
@@ -316,7 +319,7 @@ public class DoCreateNetworkInstanceRollback extends AbstractServiceTaskProcesso
}
statusMessage = statusMessage + rollbackActivateSdncErrorMessages + rollbackNetworkErrorMessages + rollbackSdncErrorMessages
- msoLogger.debug("Final DoCreateNetworkInstanceRollback status message: " + statusMessage)
+ logger.debug("Final DoCreateNetworkInstanceRollback status message: " + statusMessage)
String processKey = getProcessKey(execution);
WorkflowException exception = new WorkflowException(processKey, errorCode, statusMessage);
execution.setVariable("workflowException", exception);
@@ -329,7 +332,7 @@ public class DoCreateNetworkInstanceRollback extends AbstractServiceTaskProcesso
execution.setVariable("rollbackError", false)
} else {
String exceptionMessage = "Network Create Rollback was not Successful. "
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
execution.setVariable("rollbackSuccessful", false)
execution.setVariable("rollbackError", true)
exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage)
@@ -342,7 +345,7 @@ public class DoCreateNetworkInstanceRollback extends AbstractServiceTaskProcesso
} catch (Exception ex) {
String errorMessage = "See Previous Camunda flows for cause of Error: Undetermined Exception."
String exceptionMessage = " Bpmn error encountered in DoCreateNetworkInstanceRollback flow. validateRollbackResponses() - " + errorMessage + ": " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage)
}
@@ -360,18 +363,18 @@ public class DoCreateNetworkInstanceRollback extends AbstractServiceTaskProcesso
execution.setVariable("prefix",Prefix)
try{
- msoLogger.debug("Caught a Java Exception in " + Prefix)
- msoLogger.debug("Started processJavaException Method")
- msoLogger.debug("Variables List: " + execution.getVariables())
+ logger.debug("Caught a Java Exception in " + Prefix)
+ logger.debug("Started processJavaException Method")
+ logger.debug("Variables List: " + execution.getVariables())
execution.setVariable("UnexpectedError", "Caught a Java Lang Exception - " + Prefix) // Adding this line temporarily until this flows error handling gets updated
exceptionUtil.buildWorkflowException(execution, 500, "Caught a Java Lang Exception")
}catch(Exception e){
- msoLogger.debug("Caught Exception during processJavaException Method: " + e)
+ logger.debug("Caught Exception during processJavaException Method: " + e)
execution.setVariable("UnexpectedError", "Exception in processJavaException method - " + Prefix) // Adding this line temporarily until this flows error handling gets updated
exceptionUtil.buildWorkflowException(execution, 500, "Exception in processJavaException method" + Prefix)
}
- msoLogger.debug("Completed processJavaException Method in " + Prefix)
+ logger.debug("Completed processJavaException Method in " + Prefix)
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy
index 6096f16b18..98def612de 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2018 Huawei Technologies Co., Ltd. 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
@@ -39,7 +41,8 @@ import org.onap.so.bpmn.core.domain.ServiceDecomposition
import org.onap.so.bpmn.core.domain.VnfResource
import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.bpmn.common.resource.ResourceRequestBuilder
-import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
@@ -61,31 +64,31 @@ import org.onap.so.logger.MsoLogger
* @param - WorkflowException
*/
public class DoCreateResources extends AbstractServiceTaskProcessor{
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCreateResources.class);
+ private static final Logger logger = LoggerFactory.getLogger( DoCreateResources.class);
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtil = new JsonUtils()
CatalogDbUtils catalogDbUtils = new CatalogDbUtilsFactory().create()
public void preProcessRequest(DelegateExecution execution) {
- msoLogger.trace("preProcessRequest ")
+ logger.trace("preProcessRequest ")
String msg = ""
List addResourceList = execution.getVariable("addResourceList")
if (addResourceList == null) {
msg = "Input addResourceList is null"
- msoLogger.info(msg)
+ logger.info(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
}
else if (addResourceList.size() == 0) {
msg = "No resource in addResourceList"
- msoLogger.info(msg)
+ logger.info(msg)
}
- msoLogger.trace("Exit preProcessRequest ")
+ logger.trace("Exit preProcessRequest ")
}
public void sequenceResoure(DelegateExecution execution) {
- msoLogger.trace("Start sequenceResoure Process ")
+ logger.trace("Start sequenceResoure Process ")
String incomingRequest = execution.getVariable("uuiRequest")
String serviceModelUuid = jsonUtil.getJsonValue(incomingRequest,"service.serviceUuid")
@@ -105,7 +108,7 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{
// get Sequence from csar(model)
if(resourceSequence == null) {
resourceSequence = ResourceRequestBuilder.getResourceSequence(serviceModelUuid)
- msoLogger.info("Get Sequence from csar : " + resourceSequence)
+ logger.info("Get Sequence from csar : " + resourceSequence)
}
if(resourceSequence != null) {
@@ -151,13 +154,13 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{
execution.setVariable("isContainsWanResource", isContainsWanResource)
execution.setVariable("currentResourceIndex", 0)
execution.setVariable("sequencedResourceList", sequencedResourceList)
- msoLogger.info("sequencedResourceList: " + sequencedResourceList)
- msoLogger.trace("COMPLETED sequenceResoure Process ")
+ logger.info("sequencedResourceList: " + sequencedResourceList)
+ logger.trace("COMPLETED sequenceResoure Process ")
}
public prepareServiceTopologyRequest(DelegateExecution execution) {
- msoLogger.trace("======== Start prepareServiceTopologyRequest Process ======== ")
+ logger.trace("======== Start prepareServiceTopologyRequest Process ======== ")
String serviceDecompose = execution.getVariable("serviceDecomposition")
@@ -172,21 +175,21 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{
execution.setVariable("modelUuid", serviceUuid)
execution.setVariable("serviceModelName", serviceModelName)
- msoLogger.trace("======== End prepareServiceTopologyRequest Process ======== ")
+ logger.trace("======== End prepareServiceTopologyRequest Process ======== ")
}
public void getCurrentResoure(DelegateExecution execution){
- msoLogger.trace("Start getCurrentResoure Process ")
+ logger.trace("Start getCurrentResoure Process ")
def currentIndex = execution.getVariable("currentResourceIndex")
List<Resource> sequencedResourceList = execution.getVariable("sequencedResourceList")
Resource currentResource = sequencedResourceList.get(currentIndex)
execution.setVariable("resourceType", currentResource.getModelInfo().getModelName())
- msoLogger.info("Now we deal with resouce:" + currentResource.getModelInfo().getModelName())
- msoLogger.trace("COMPLETED getCurrentResoure Process ")
+ logger.info("Now we deal with resouce:" + currentResource.getModelInfo().getModelName())
+ logger.trace("COMPLETED getCurrentResoure Process ")
}
public void parseNextResource(DelegateExecution execution){
- msoLogger.trace("Start parseNextResource Process ")
+ logger.trace("Start parseNextResource Process ")
def currentIndex = execution.getVariable("currentResourceIndex")
def nextIndex = currentIndex + 1
execution.setVariable("currentResourceIndex", nextIndex)
@@ -196,17 +199,17 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{
}else{
execution.setVariable("allResourceFinished", "false")
}
- msoLogger.trace("COMPLETED parseNextResource Process ")
+ logger.trace("COMPLETED parseNextResource Process ")
}
public void prepareResourceRecipeRequest(DelegateExecution execution){
- msoLogger.trace("Start prepareResourceRecipeRequest Process ")
+ logger.trace("Start prepareResourceRecipeRequest Process ")
ResourceInput resourceInput = new ResourceInput()
String serviceInstanceName = execution.getVariable("serviceInstanceName")
String resourceType = execution.getVariable("resourceType")
String resourceInstanceName = resourceType + "_" + serviceInstanceName
resourceInput.setResourceInstanceName(resourceInstanceName)
- msoLogger.info("Prepare Resource Request resourceInstanceName:" + resourceInstanceName)
+ logger.info("Prepare Resource Request resourceInstanceName:" + resourceInstanceName)
String globalSubscriberId = execution.getVariable("globalSubscriberId")
String serviceType = execution.getVariable("serviceType")
String serviceInstanceId = execution.getVariable("serviceInstanceId")
@@ -234,11 +237,11 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{
resourceInput.setRequestsInputs(incomingRequest)
execution.setVariable("resourceInput", resourceInput.toString())
execution.setVariable("resourceModelUUID", resourceInput.getResourceModelInfo().getModelUuid())
- msoLogger.trace("COMPLETED prepareResourceRecipeRequest Process ")
+ logger.trace("COMPLETED prepareResourceRecipeRequest Process ")
}
public void executeResourceRecipe(DelegateExecution execution){
- msoLogger.trace("Start executeResourceRecipe Process ")
+ logger.trace("Start executeResourceRecipe Process ")
try {
String requestId = execution.getVariable("msoRequestId")
@@ -261,16 +264,16 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{
HttpResponse resp = bpmnRestClient.post(recipeURL, requestId, recipeTimeOut, requestAction, serviceInstanceId, serviceType, resourceInput, recipeParamXsd)
} else {
String exceptionMessage = "Resource receipe is not found for resource modeluuid: " + resourceModelUUID
- msoLogger.trace(exceptionMessage)
+ logger.trace(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, exceptionMessage)
}
- msoLogger.trace("======== end executeResourceRecipe Process ======== ")
+ logger.trace("======== end executeResourceRecipe Process ======== ")
}catch(BpmnError b){
- msoLogger.debug("Rethrowing MSOWorkflowException")
+ logger.debug("Rethrowing MSOWorkflowException")
throw b
}catch(Exception e){
- msoLogger.debug("Error occured within DoCreateResources executeResourceRecipe method: " + e)
+ logger.debug("Error occured within DoCreateResources executeResourceRecipe method: " + e)
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured during DoCreateResources executeResourceRecipe Catalog")
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy
index c04bbd4806..163bd0f583 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -44,7 +46,8 @@ import org.onap.so.client.aai.AAIResourcesClient
import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
-import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
/**
* This groovy class supports the <class>DoCreateServiceInstance.bpmn</class> process.
@@ -74,7 +77,7 @@ import org.onap.so.logger.MsoLogger
*/
public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCreateServiceInstance.class);
+ private static final Logger logger = LoggerFactory.getLogger( DoCreateServiceInstance.class);
String Prefix="DCRESI_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtil = new JsonUtils()
@@ -83,7 +86,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
public void preProcessRequest (DelegateExecution execution) {
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
String msg = ""
- msoLogger.trace("preProcessRequest")
+ logger.trace("preProcessRequest")
try {
String requestId = execution.getVariable("msoRequestId")
@@ -108,13 +111,13 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
if (isBlank(globalSubscriberId)) {
msg = "Input globalSubscriberId is null"
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
}
if (isBlank(subscriptionServiceType)) {
msg = "Input subscriptionServiceType is null"
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
}
@@ -125,11 +128,11 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
String sdncCallbackUrl = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution)
if (isBlank(sdncCallbackUrl)) {
msg = "mso.workflow.sdncadapter.callback is null"
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
}
execution.setVariable("sdncCallbackUrl", sdncCallbackUrl)
- msoLogger.debug("SDNC Callback URL: " + sdncCallbackUrl)
+ logger.debug("SDNC Callback URL: " + sdncCallbackUrl)
//requestDetails.modelInfo.for AAI PUT servieInstanceData & SDNC assignTopology
String modelInvariantUuid = ""
@@ -146,7 +149,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
if (serviceDecomp != null)
{
serviceType = serviceDecomp.getServiceType() ?: ""
- msoLogger.debug("serviceType:" + serviceType)
+ logger.debug("serviceType:" + serviceType)
serviceRole = serviceDecomp.getServiceRole() ?: ""
ServiceInstance serviceInstance = serviceDecomp.getServiceInstance()
@@ -169,7 +172,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
else
{
msg = "Input serviceModelInfo is null"
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
}
}
@@ -182,7 +185,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
String serviceModelInfo = execution.getVariable("serviceModelInfo")
if (isBlank(serviceModelInfo)) {
msg = "Input serviceModelInfo is null"
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
}
modelInvariantUuid = jsonUtil.getJsonValue(serviceModelInfo, "modelInvariantUuid") ?: ""
@@ -204,7 +207,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
//alacarte SIs are NOT sent to sdnc. exceptions are listed in config variable
String svcTypes = UrnPropertiesReader.getVariable("sdnc.si.svc.types",execution) ?: ""
- msoLogger.debug("SDNC SI serviceTypes:" + svcTypes)
+ logger.debug("SDNC SI serviceTypes:" + svcTypes)
List<String> svcList = Arrays.asList(svcTypes.split("\\s*,\\s*"));
boolean isSdncService= false
for (String listEntry : svcList){
@@ -225,15 +228,15 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
if (isBlank(execution.getVariable("serviceInstanceName" )))
{
msg = "Input serviceInstanceName must be provided for alacarte"
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
}
}
}
- msoLogger.debug("isSdncService: " + isSdncService)
- msoLogger.debug("Send To SDNC: " + execution.getVariable("sendToSDNC"))
- msoLogger.debug("Service Type: " + execution.getVariable("serviceType"))
+ logger.debug("isSdncService: " + isSdncService)
+ logger.debug("Send To SDNC: " + execution.getVariable("sendToSDNC"))
+ logger.debug("Service Type: " + execution.getVariable("serviceType"))
//macro may provide name and alacarte-portm may provide name
execution.setVariable("checkAAI", false)
@@ -244,7 +247,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
if (isBlank(serviceInstanceId)){
msg = "Input serviceInstanceId is null"
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
}
@@ -277,10 +280,10 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
throw e;
} catch (Exception ex){
msg = "Exception in preProcessRequest " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("Exit preProcessRequest")
+ logger.trace("Exit preProcessRequest")
}
public void getAAICustomerById (DelegateExecution execution) {
@@ -288,7 +291,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
try {
String globalCustomerId = execution.getVariable("globalSubscriberId") //VID to AAI name map
- msoLogger.debug(" ***** getAAICustomerById ***** globalCustomerId:" + globalCustomerId)
+ logger.debug(" ***** getAAICustomerById ***** globalCustomerId:" + globalCustomerId)
AAIUri uri = AAIUriFactory.createResourceUri(AAIObjectType.CUSTOMER, globalCustomerId)
if(!getAAIClient().exists(uri)){
@@ -299,13 +302,13 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Exception in getAAICustomerById. " + ex.getMessage())
}
- msoLogger.trace("Exit getAAICustomerById")
+ logger.trace("Exit getAAICustomerById")
}
public void putServiceInstance(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- msoLogger.trace("putServiceInstance")
+ logger.trace("putServiceInstance")
String msg = ""
String serviceInstanceId = execution.getVariable("serviceInstanceId")
try {
@@ -326,17 +329,17 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
try{
String json = catalogDbUtils.getServiceResourcesByServiceModelInvariantUuidString(execution,modelInvariantUuid )
- msoLogger.debug("JSON IS: "+json)
+ logger.debug("JSON IS: "+json)
environmentContext = jsonUtil.getJsonValue(json, "serviceResources.environmentContext") ?: ""
workloadContext = jsonUtil.getJsonValue(json, "serviceResources.workloadContext") ?: ""
- msoLogger.debug("Env Context is: "+ environmentContext)
- msoLogger.debug("Workload Context is: "+ workloadContext)
+ logger.debug("Env Context is: "+ environmentContext)
+ logger.debug("Workload Context is: "+ workloadContext)
}catch(BpmnError e){
throw e
} catch (Exception ex){
msg = "Exception in preProcessRequest " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
@@ -371,16 +374,16 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
execution.setVariable("rollbackData", rollbackData)
msg = "Exception in DoCreateServiceInstance.putServiceInstance. " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("Exit putServiceInstance")
+ logger.trace("Exit putServiceInstance")
}
public void preProcessSDNCAssignRequest(DelegateExecution execution) {
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
String msg = ""
- msoLogger.trace("preProcessSDNCAssignRequest")
+ logger.trace("preProcessSDNCAssignRequest")
try {
def serviceInstanceId = execution.getVariable("serviceInstanceId")
@@ -448,10 +451,10 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
</sdncadapterworkflow:SDNCRequestData>
</sdncadapterworkflow:SDNCAdapterWorkflowRequest>"""
- msoLogger.debug("sdncAssignRequest:\n" + sdncAssignRequest)
+ logger.debug("sdncAssignRequest:\n" + sdncAssignRequest)
sdncAssignRequest = utils.formatXml(sdncAssignRequest)
execution.setVariable("sdncAssignRequest", sdncAssignRequest)
- msoLogger.debug("sdncAssignRequest: " + sdncAssignRequest)
+ logger.debug("sdncAssignRequest: " + sdncAssignRequest)
def sdncRequestId2 = UUID.randomUUID().toString()
String sdncDelete = sdncAssignRequest.replace(">assign<", ">delete<").replace(">CreateServiceInstance<", ">DeleteServiceInstance<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<")
@@ -463,36 +466,36 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
rollbackData.put("SERVICEINSTANCE", "sdncDelete", sdncDelete)
execution.setVariable("rollbackData", rollbackData)
- msoLogger.debug("rollbackData:\n" + rollbackData.toString())
+ logger.debug("rollbackData:\n" + rollbackData.toString())
}
} catch (BpmnError e) {
throw e;
} catch(Exception ex) {
msg = "Exception in preProcessSDNCAssignRequest. " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("Exit preProcessSDNCAssignRequest")
+ logger.trace("Exit preProcessSDNCAssignRequest")
}
public void postProcessSDNCAssign (DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- msoLogger.trace("postProcessSDNCAssign")
+ logger.trace("postProcessSDNCAssign")
try {
WorkflowException workflowException = execution.getVariable("WorkflowException")
- msoLogger.debug("workflowException: " + workflowException)
+ logger.debug("workflowException: " + workflowException)
boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator")
String response = execution.getVariable("sdncAdapterResponse")
- msoLogger.debug("SDNCResponse: " + response)
+ logger.debug("SDNCResponse: " + response)
SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this)
sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator)
if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){
- msoLogger.debug("Good response from SDNC Adapter for service-instance topology assign: \n" + response)
+ logger.debug("Good response from SDNC Adapter for service-instance topology assign: \n" + response)
def rollbackData = execution.getVariable("rollbackData")
if (rollbackData != null) {
@@ -501,7 +504,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
}
}else{
- msoLogger.debug("Bad Response from SDNC Adapter for service-instance assign")
+ logger.debug("Bad Response from SDNC Adapter for service-instance assign")
throw new BpmnError("MSOWorkflowException")
}
@@ -509,31 +512,31 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
throw e;
} catch(Exception ex) {
msg = "Exception in postProcessSDNCAssign. " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("Exit postProcessSDNCAssign")
+ logger.trace("Exit postProcessSDNCAssign")
}
public void postProcessAAIGET2(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- msoLogger.trace("postProcessAAIGET2")
+ logger.trace("postProcessAAIGET2")
String msg = ""
try {
String serviceInstanceName = execution.getVariable("serviceInstanceName")
boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator")
if(!succInAAI){
- msoLogger.debug("Error getting Service-instance from AAI in postProcessAAIGET2", + serviceInstanceName)
+ logger.debug("Error getting Service-instance from AAI in postProcessAAIGET2", + serviceInstanceName)
WorkflowException workflowException = execution.getVariable("WorkflowException")
- msoLogger.debug("workflowException: " + workflowException)
+ logger.debug("workflowException: " + workflowException)
if(workflowException != null){
exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage())
}
else
{
msg = "Failure in postProcessAAIGET2 GENGS_SuccessIndicator:" + succInAAI
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
}
}
@@ -544,7 +547,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
String aaiService = execution.getVariable("GENGS_service")
if (!isBlank(aaiService) && (utils.nodeExists(aaiService, "service-instance-name"))) {
execution.setVariable("serviceInstanceName", utils.getNodeText(aaiService, "service-instance-name"))
- msoLogger.debug("Found Service-instance in AAI.serviceInstanceName:" + execution.getVariable("serviceInstanceName"))
+ logger.debug("Found Service-instance in AAI.serviceInstanceName:" + execution.getVariable("serviceInstanceName"))
}
}
}
@@ -552,94 +555,94 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
throw e;
} catch (Exception ex) {
msg = "Exception in DoCreateServiceInstance.postProcessAAIGET2 " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("Exit postProcessAAIGET2")
+ logger.trace("Exit postProcessAAIGET2")
}
public void preProcessRollback (DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- msoLogger.trace("preProcessRollback")
+ logger.trace("preProcessRollback")
try {
Object workflowException = execution.getVariable("WorkflowException");
if (workflowException instanceof WorkflowException) {
- msoLogger.debug("Prev workflowException: " + workflowException.getErrorMessage())
+ logger.debug("Prev workflowException: " + workflowException.getErrorMessage())
execution.setVariable("prevWorkflowException", workflowException);
//execution.setVariable("WorkflowException", null);
}
} catch (BpmnError e) {
- msoLogger.debug("BPMN Error during preProcessRollback")
+ logger.debug("BPMN Error during preProcessRollback")
} catch(Exception ex) {
String msg = "Exception in preProcessRollback. " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
}
- msoLogger.trace("Exit preProcessRollback")
+ logger.trace("Exit preProcessRollback")
}
public void postProcessRollback (DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- msoLogger.trace("postProcessRollback")
+ logger.trace("postProcessRollback")
String msg = ""
try {
Object workflowException = execution.getVariable("prevWorkflowException");
if (workflowException instanceof WorkflowException) {
- msoLogger.debug("Setting prevException to WorkflowException: ")
+ logger.debug("Setting prevException to WorkflowException: ")
execution.setVariable("WorkflowException", workflowException);
}
execution.setVariable("rollbackData", null)
} catch (BpmnError b) {
- msoLogger.debug("BPMN Error during postProcessRollback")
+ logger.debug("BPMN Error during postProcessRollback")
throw b;
} catch(Exception ex) {
msg = "Exception in postProcessRollback. " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
}
- msoLogger.trace("Exit postProcessRollback")
+ logger.trace("Exit postProcessRollback")
}
public void createProject(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- msoLogger.trace("createProject")
+ logger.trace("createProject")
String bpmnRequest = execution.getVariable("requestJson")
String projectName = jsonUtil.getJsonValue(bpmnRequest, "requestDetails.project.projectName")
String serviceInstance = execution.getVariable("serviceInstanceId")
- msoLogger.debug("BPMN REQUEST IS: "+ bpmnRequest)
- msoLogger.debug("PROJECT NAME: " + projectName)
- msoLogger.debug("Service Instance: " + serviceInstance)
+ logger.debug("BPMN REQUEST IS: "+ bpmnRequest)
+ logger.debug("PROJECT NAME: " + projectName)
+ logger.debug("Service Instance: " + serviceInstance)
if(projectName == null||projectName.equals("")){
- msoLogger.debug("Project Name was not found in input. Skipping task...")
+ logger.debug("Project Name was not found in input. Skipping task...")
}else{
try{
AAICreateResources aaiCR = new AAICreateResources()
aaiCR.createAAIProject(projectName, serviceInstance)
}catch(Exception ex){
String msg = "Exception in createProject. " + ex.getMessage();
- msoLogger.debug(msg)
- msoLogger.error(ex);
+ logger.debug(msg)
+ logger.error(ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
}
- msoLogger.trace("Exit createProject")
+ logger.trace("Exit createProject")
}
public void createOwningEntity(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- msoLogger.trace("createOwningEntity")
+ logger.trace("createOwningEntity")
String msg = "";
String bpmnRequest = execution.getVariable("requestJson")
String owningEntityId = jsonUtil.getJsonValue(bpmnRequest, "requestDetails.owningEntity.owningEntityId")
String owningEntityName = jsonUtil.getJsonValue(bpmnRequest,"requestDetails.owningEntity.owningEntityName");
String serviceInstance = execution.getVariable("serviceInstanceId")
- msoLogger.debug("owningEntity: " + owningEntityId)
- msoLogger.debug("OwningEntityName: "+ owningEntityName)
- msoLogger.debug("Service Instance: " + serviceInstance)
+ logger.debug("owningEntity: " + owningEntityId)
+ logger.debug("OwningEntityName: "+ owningEntityName)
+ logger.debug("Service Instance: " + serviceInstance)
try{
AAICreateResources aaiCR = new AAICreateResources()
@@ -665,11 +668,11 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
}
}
}catch(Exception ex){
- msoLogger.debug(msg)
- msoLogger.error(ex);
+ logger.debug(msg)
+ logger.error(ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("Exit createOwningEntity")
+ logger.trace("Exit createOwningEntity")
}
// *******************************
@@ -680,18 +683,18 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
try{
- msoLogger.debug("Caught a Java Exception in DoCreateServiceInstance")
- msoLogger.debug("Started processJavaException Method")
- msoLogger.debug("Variables List: " + execution.getVariables())
+ logger.debug("Caught a Java Exception in DoCreateServiceInstance")
+ logger.debug("Started processJavaException Method")
+ logger.debug("Variables List: " + execution.getVariables())
execution.setVariable("UnexpectedError", "Caught a Java Lang Exception in DoCreateServiceInstance") // Adding this line temporarily until this flows error handling gets updated
exceptionUtil.buildWorkflowException(execution, 500, "Caught a Java Lang Exception in DoCreateServiceInstance")
}catch(Exception e){
- msoLogger.debug("Caught Exception during processJavaException Method: " + e)
+ logger.debug("Caught Exception during processJavaException Method: " + e)
execution.setVariable("UnexpectedError", "Exception in processJavaException") // Adding this line temporarily until this flows error handling gets updated
exceptionUtil.buildWorkflowException(execution, 500, "Exception in processJavaException method")
}
- msoLogger.trace("Completed processJavaException Method in DoCreateServiceInstance")
+ logger.trace("Completed processJavaException Method in DoCreateServiceInstance")
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstanceRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstanceRollback.groovy
index e80941e212..a337087105 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstanceRollback.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstanceRollback.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -30,8 +32,8 @@ import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils
import org.onap.so.bpmn.core.RollbackData
import org.onap.so.bpmn.core.WorkflowException
-import org.onap.so.logger.MsoLogger
-import org.onap.so.logger.MessageEnum
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
import java.util.UUID;
@@ -62,7 +64,7 @@ import org.springframework.web.util.UriUtils;
*
*/
public class DoCreateServiceInstanceRollback extends AbstractServiceTaskProcessor{
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCreateServiceInstanceRollback.class);
+ private static final Logger logger = LoggerFactory.getLogger( DoCreateServiceInstanceRollback.class);
String Prefix="DCRESIRB_"
@@ -71,13 +73,13 @@ public class DoCreateServiceInstanceRollback extends AbstractServiceTaskProcesso
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix",Prefix)
String msg = ""
- msoLogger.trace("preProcessRequest")
+ logger.trace("preProcessRequest")
execution.setVariable("rollbackAAI",false)
execution.setVariable("rollbackSDNC",false)
try {
def rollbackData = execution.getVariable("rollbackData")
- msoLogger.debug("RollbackData:" + rollbackData)
+ logger.debug("RollbackData:" + rollbackData)
if (rollbackData != null) {
if (rollbackData.hasType("SERVICEINSTANCE")) {
@@ -112,8 +114,8 @@ public class DoCreateServiceInstanceRollback extends AbstractServiceTaskProcesso
execution.setVariable("sdncDelete", sdncDelete)
def sdncDeactivate = rollbackData.get("SERVICEINSTANCE", "sdncDeactivate")
execution.setVariable("sdncDeactivate", sdncDeactivate)
- msoLogger.debug("sdncDeactivate:\n" + sdncDeactivate)
- msoLogger.debug("sdncDelete:\n" + sdncDelete)
+ logger.debug("sdncDeactivate:\n" + sdncDeactivate)
+ logger.debug("sdncDelete:\n" + sdncDelete)
}
else {
execution.setVariable("skipRollback", true)
@@ -131,48 +133,48 @@ public class DoCreateServiceInstanceRollback extends AbstractServiceTaskProcesso
throw e;
} catch (Exception ex){
msg = "Exception in Create ServiceInstance Rollback preProcessRequest " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("Exit preProcessRequest")
+ logger.trace("Exit preProcessRequest")
}
public void validateSDNCResponse(DelegateExecution execution, String response, String method) {
- msoLogger.trace("validateSDNCResponse")
+ logger.trace("validateSDNCResponse")
String msg = ""
try {
WorkflowException workflowException = execution.getVariable("WorkflowException")
boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator")
- msoLogger.debug("SDNCResponse: " + response)
- msoLogger.debug("workflowException: " + workflowException)
+ logger.debug("SDNCResponse: " + response)
+ logger.debug("workflowException: " + workflowException)
SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this)
sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator)
if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){
msg = "SDNC Adapter service-instance rollback successful for " + method
- msoLogger.debug(msg)
+ logger.debug(msg)
}else{
execution.setVariable("rolledBack", false)
msg = "Error Response from SDNC Adapter service-instance rollback for " + method
execution.setVariable("rollbackError", msg)
- msoLogger.debug(msg)
+ logger.debug(msg)
throw new BpmnError("MSOWorkflowException")
}
} catch (BpmnError e) {
throw e;
} catch (Exception ex){
msg = "Exception in Create ServiceInstance rollback for " + method + " Exception:" + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("Exit validateSDNCResponse")
+ logger.trace("Exit validateSDNCResponse")
}
public void postProcessRequest(DelegateExecution execution) {
- msoLogger.trace("postProcessRequest")
+ logger.trace("postProcessRequest")
String msg = ""
try {
execution.setVariable("rollbackData", null)
@@ -189,51 +191,51 @@ public class DoCreateServiceInstanceRollback extends AbstractServiceTaskProcesso
if(!succInAAI){
execution.setVariable("rolledBack", false) //both sdnc and aai must be successful to declare rollback Succesful
execution.setVariable("rollbackError", "Error deleting service-instance in AAI for rollback")
- msoLogger.debug("Error deleting service-instance in AAI for rollback", + serviceInstanceId)
+ logger.debug("Error deleting service-instance in AAI for rollback", + serviceInstanceId)
}
}
- msoLogger.trace("Exit postProcessRequest")
+ logger.trace("Exit postProcessRequest")
} catch (BpmnError e) {
msg = "Exception in Create ServiceInstance Rollback postProcessRequest. " + e.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
} catch (Exception ex) {
msg = "Exception in Create ServiceInstance Rollback postProcessRequest. " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
}
}
public void processRollbackException(DelegateExecution execution){
- msoLogger.trace("processRollbackException")
+ logger.trace("processRollbackException")
try{
- msoLogger.debug("Caught an Exception in DoCreateServiceInstanceRollback")
+ logger.debug("Caught an Exception in DoCreateServiceInstanceRollback")
execution.setVariable("rollbackData", null)
execution.setVariable("rollbackError", "Caught exception in ServiceInstance Create Rollback")
execution.setVariable("WorkflowException", null)
}catch(BpmnError b){
- msoLogger.debug("BPMN Error during processRollbackExceptions Method: ")
+ logger.debug("BPMN Error during processRollbackExceptions Method: ")
}catch(Exception e){
- msoLogger.debug("Caught Exception during processRollbackExceptions Method: " + e.getMessage())
+ logger.debug("Caught Exception during processRollbackExceptions Method: " + e.getMessage())
}
- msoLogger.debug("Exit processRollbackException")
+ logger.debug("Exit processRollbackException")
}
public void processRollbackJavaException(DelegateExecution execution){
- msoLogger.trace("processRollbackJavaException")
+ logger.trace("processRollbackJavaException")
try{
execution.setVariable("rollbackData", null)
execution.setVariable("rollbackError", "Caught Java exception in ServiceInstance Create Rollback")
- msoLogger.debug("Caught Exception in processRollbackJavaException")
+ logger.debug("Caught Exception in processRollbackJavaException")
}catch(Exception e){
- msoLogger.debug("Caught Exception in processRollbackJavaException " + e.getMessage())
+ logger.debug("Caught Exception in processRollbackJavaException " + e.getMessage())
}
- msoLogger.trace("Exit processRollbackJavaException")
+ logger.trace("Exit processRollbackJavaException")
}
}
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 33d0e25d7d..b17b0a37b7 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
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 Huawei Technologies Co., Ltd. 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
@@ -32,6 +34,8 @@ import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.client.HttpClient
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.utils.TargetEntity
@@ -43,7 +47,7 @@ import javax.ws.rs.core.Response
* flow for VFC Network Service Create
*/
public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProcessor {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCreateVFCNetworkServiceInstance.class);
+ private static final Logger logger = LoggerFactory.getLogger( DoCreateVFCNetworkServiceInstance.class);
ExceptionUtil exceptionUtil = new ExceptionUtil()
@@ -58,23 +62,23 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces
*/
public void preProcessRequest (DelegateExecution execution) {
String msg = ""
- msoLogger.trace("preProcessRequest()")
+ logger.trace("preProcessRequest()")
try {
//deal with nsName and Description
String nsServiceName = execution.getVariable("nsServiceName")
String nsServiceDescription = execution.getVariable("nsServiceDescription")
- msoLogger.debug("nsServiceName:" + nsServiceName + " nsServiceDescription:" + nsServiceDescription)
+ logger.debug("nsServiceName:" + nsServiceName + " nsServiceDescription:" + nsServiceDescription)
//deal with operation key
String globalSubscriberId = execution.getVariable("globalSubscriberId")
- msoLogger.debug("globalSubscriberId:" + globalSubscriberId)
+ logger.debug("globalSubscriberId:" + globalSubscriberId)
String serviceType = execution.getVariable("serviceType")
- msoLogger.debug("serviceType:" + serviceType)
+ logger.debug("serviceType:" + serviceType)
String serviceId = execution.getVariable("serviceId")
- msoLogger.debug("serviceId:" + serviceId)
+ logger.debug("serviceId:" + serviceId)
String operationId = execution.getVariable("operationId")
- msoLogger.debug("serviceType:" + serviceType)
+ logger.debug("serviceType:" + serviceType)
String nodeTemplateUUID = execution.getVariable("resourceUUID")
- msoLogger.debug("nodeTemplateUUID:" + nodeTemplateUUID)
+ logger.debug("nodeTemplateUUID:" + nodeTemplateUUID)
/*
* segmentInformation needed as a object of segment
* {
@@ -87,7 +91,7 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces
* }
*/
String nsParameters = execution.getVariable("resourceParameters")
- msoLogger.debug("nsParameters:" + nsParameters)
+ logger.debug("nsParameters:" + nsParameters)
String nsOperationKey = """{
"globalSubscriberId":"${globalSubscriberId}",
"serviceType":"${serviceType}",
@@ -102,7 +106,7 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces
if (vfcAdapterUrl == null || vfcAdapterUrl.isEmpty()) {
msg = getProcessKey(execution) + ': mso:adapters:vfcc:rest:endpoint URN mapping is not defined'
- msoLogger.debug(msg)
+ logger.debug(msg)
}
while (vfcAdapterUrl.endsWith('/')) {
@@ -116,17 +120,17 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces
throw e;
} catch (Exception ex){
msg = "Exception in preProcessRequest " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("Exit preProcessRequest")
+ logger.trace("Exit preProcessRequest")
}
/**
* create NS task
*/
public void createNetworkService(DelegateExecution execution) {
- msoLogger.trace("createNetworkService")
+ logger.trace("createNetworkService")
String vfcAdapterUrl = execution.getVariable("vfcAdapterUrl")
String nsOperationKey = execution.getVariable("nsOperationKey");
String nsParameters = execution.getVariable("nsParameters");
@@ -146,14 +150,14 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces
nsInstanceId = jsonUtil.getJsonValue(aaiResponseAsString, "nsInstanceId")
}
execution.setVariable("nsInstanceId", nsInstanceId)
- msoLogger.trace("Exit createNetworkService")
+ logger.trace("Exit createNetworkService")
}
/**
* instantiate NS task
*/
public void instantiateNetworkService(DelegateExecution execution) {
- msoLogger.trace("instantiateNetworkService")
+ logger.trace("instantiateNetworkService")
String vfcAdapterUrl = execution.getVariable("vfcAdapterUrl")
String nsOperationKey = execution.getVariable("nsOperationKey");
String nsParameters = execution.getVariable("nsParameters");
@@ -175,14 +179,14 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces
jobId = jsonUtil.getJsonValue(aaiResponseAsString, "jobId")
}
execution.setVariable("jobId", jobId)
- msoLogger.trace("Exit instantiateNetworkService")
+ logger.trace("Exit instantiateNetworkService")
}
/**
* query NS task
*/
public void queryNSProgress(DelegateExecution execution) {
- msoLogger.trace("queryNSProgress")
+ logger.trace("queryNSProgress")
String vfcAdapterUrl = execution.getVariable("vfcAdapterUrl")
String jobId = execution.getVariable("jobId")
String nsOperationKey = execution.getVariable("nsOperationKey");
@@ -195,7 +199,7 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces
operationStatus = jsonUtil.getJsonValue(aaiResponseAsString, "responseDescriptor.status")
}
execution.setVariable("operationStatus", operationStatus)
- msoLogger.trace("Exit queryNSProgress")
+ logger.trace("Exit queryNSProgress")
}
/**
@@ -205,7 +209,7 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces
try {
Thread.sleep(5000);
} catch(InterruptedException e) {
- msoLogger.debug("Time Delay exception" + e )
+ logger.debug("Time Delay exception" + e )
}
}
@@ -213,10 +217,10 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces
* finish NS task
*/
public void addNSRelationship(DelegateExecution execution) {
- msoLogger.trace("addNSRelationship")
+ logger.trace("addNSRelationship")
String nsInstanceId = execution.getVariable("nsInstanceId")
if(nsInstanceId == null || nsInstanceId == ""){
- msoLogger.debug(" create NS failed, so do not need to add relationship")
+ logger.debug(" create NS failed, so do not need to add relationship")
return
}
String globalSubscriberId = execution.getVariable("globalSubscriberId")
@@ -228,9 +232,11 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces
try{
getAAIClient().connect(nsUri,relatedServiceUri)
- msoLogger.info("NS relationship to Service added successfully")
+ logger.info("NS relationship to Service added successfully")
}catch(Exception e){
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception occured while executing AAI Put Call", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception occured while executing AAI Put Call", "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
throw new BpmnError("MSOWorkflowException")
}
}
@@ -241,8 +247,8 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces
* requestBody: the body of the request
*/
private Response postRequest(DelegateExecution execution, String urlString, String requestBody){
- msoLogger.trace("Started Execute VFC adapter Post Process")
- msoLogger.debug("url:"+urlString +"\nrequestBody:"+ requestBody)
+ logger.trace("Started Execute VFC adapter Post Process")
+ logger.debug("url:"+urlString +"\nrequestBody:"+ requestBody)
Response apiResponse = null
try{
@@ -257,10 +263,10 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces
apiResponse = httpClient.post(requestBody)
- msoLogger.debug("response code:"+ apiResponse.getStatus() +"\nresponse body:"+ apiResponse.readEntity(String.class))
- msoLogger.trace("Completed Execute VF-C adapter Post Process")
+ logger.debug("response code:"+ apiResponse.getStatus() +"\nresponse body:"+ apiResponse.readEntity(String.class))
+ logger.trace("Completed Execute VF-C adapter Post Process")
}catch(Exception e){
- msoLogger.error("Exception occured while executing VFC Adapter Post Call" + e.getMessage ());
+ logger.error("Exception occured while executing VFC Adapter Post Call" + e.getMessage ());
throw new BpmnError("MSOWorkflowException")
}
return apiResponse
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 53e3525036..9ee8ff8b67 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
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -61,6 +63,8 @@ import org.onap.so.constants.Defaults
import org.onap.so.db.catalog.beans.HomingInstance
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
import org.onap.so.utils.TargetEntity
import org.w3c.dom.Document
@@ -75,7 +79,7 @@ import com.fasterxml.jackson.databind.ObjectMapper
public class DoCreateVfModule extends VfModuleBase {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCreateVfModule.class);
+ private static final Logger logger = LoggerFactory.getLogger( DoCreateVfModule.class);
String Prefix="DCVFM_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
@@ -95,7 +99,7 @@ public class DoCreateVfModule extends VfModuleBase {
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
execution.setVariable('prefix', Prefix)
try{
@@ -116,9 +120,9 @@ public class DoCreateVfModule extends VfModuleBase {
String vfModuleModelInfo = execution.getVariable("vfModuleModelInfo")
def serviceModelInfo = execution.getVariable("serviceModelInfo")
- msoLogger.debug("serviceModelInfo: " + serviceModelInfo)
+ logger.debug("serviceModelInfo: " + serviceModelInfo)
String modelInvariantUuid = jsonUtil.getJsonValue(serviceModelInfo, "modelInvariantUuid")
- msoLogger.debug("modelInvariantUuid: " + modelInvariantUuid)
+ logger.debug("modelInvariantUuid: " + modelInvariantUuid)
def vnfModelInfo = execution.getVariable("vnfModelInfo")
@@ -136,66 +140,66 @@ public class DoCreateVfModule extends VfModuleBase {
def cloudSiteId = execution.getVariable("lcpCloudRegionId")
execution.setVariable("DCVFM_cloudSiteId", cloudSiteId)
rollbackData.put("VFMODULE", "aiccloudregion", cloudSiteId)
- msoLogger.debug("cloudSiteId: " + cloudSiteId)
+ logger.debug("cloudSiteId: " + cloudSiteId)
//cloudOwner
def cloudOwner = execution.getVariable("cloudOwner")
execution.setVariable("DCVFM_cloudOwner", cloudOwner)
rollbackData.put("VFMODULE", "cloudOwner", cloudOwner)
- msoLogger.debug("cloudOwner: " + cloudOwner)
+ logger.debug("cloudOwner: " + cloudOwner)
//vnfType
def vnfType = execution.getVariable("vnfType")
execution.setVariable("DCVFM_vnfType", vnfType)
rollbackData.put("VFMODULE", "vnftype", vnfType)
- msoLogger.debug("vnfType: " + vnfType)
+ logger.debug("vnfType: " + vnfType)
//vnfName
def vnfName = execution.getVariable("vnfName")
execution.setVariable("DCVFM_vnfName", vnfName)
rollbackData.put("VFMODULE", "vnfname", vnfName)
- msoLogger.debug("vnfName: " + vnfName)
+ logger.debug("vnfName: " + vnfName)
//vnfId
def vnfId = execution.getVariable("vnfId")
execution.setVariable("DCVFM_vnfId", vnfId)
rollbackData.put("VFMODULE", "vnfid", vnfId)
- msoLogger.debug("vnfId: " + vnfId)
+ logger.debug("vnfId: " + vnfId)
//vfModuleName
def vfModuleName = execution.getVariable("vfModuleName")
execution.setVariable("DCVFM_vfModuleName", vfModuleName)
rollbackData.put("VFMODULE", "vfmodulename", vfModuleName)
- msoLogger.debug("vfModuleName: " + vfModuleName)
+ logger.debug("vfModuleName: " + vfModuleName)
//vfModuleModelName
def vfModuleModelName = jsonUtil.getJsonValue(vfModuleModelInfo, "modelName")
execution.setVariable("DCVFM_vfModuleModelName", vfModuleModelName)
rollbackData.put("VFMODULE", "vfmodulemodelname", vfModuleModelName)
- msoLogger.debug("vfModuleModelName: " + vfModuleModelName)
+ logger.debug("vfModuleModelName: " + vfModuleModelName)
//modelCustomizationUuid
def modelCustomizationUuid = jsonUtil.getJsonValue(vfModuleModelInfo, "modelCustomizationUuid")
execution.setVariable("DCVFM_modelCustomizationUuid", modelCustomizationUuid)
rollbackData.put("VFMODULE", "modelcustomizationuuid", modelCustomizationUuid)
- msoLogger.debug("modelCustomizationUuid: " + modelCustomizationUuid)
+ logger.debug("modelCustomizationUuid: " + modelCustomizationUuid)
//vfModuleId
def vfModuleId = execution.getVariable("vfModuleId")
execution.setVariable("DCVFM_vfModuleId", vfModuleId)
- msoLogger.debug("vfModuleId: " + vfModuleId)
+ logger.debug("vfModuleId: " + vfModuleId)
def requestId = execution.getVariable("msoRequestId")
execution.setVariable("DCVFM_requestId", requestId)
- msoLogger.debug("requestId: " + requestId)
+ logger.debug("requestId: " + requestId)
rollbackData.put("VFMODULE", "msorequestid", requestId)
// Set mso-request-id to request-id for VNF Adapter interface
execution.setVariable("mso-request-id", requestId)
//serviceId
def serviceId = execution.getVariable("serviceId")
execution.setVariable("DCVFM_serviceId", serviceId)
- msoLogger.debug("serviceId: " + serviceId)
+ logger.debug("serviceId: " + serviceId)
//serviceInstanceId
def serviceInstanceId = execution.getVariable("serviceInstanceId")
execution.setVariable("DCVFM_serviceInstanceId", serviceInstanceId)
rollbackData.put("VFMODULE", "serviceInstanceId", serviceInstanceId)
- msoLogger.debug("serviceInstanceId: " + serviceInstanceId)
+ logger.debug("serviceInstanceId: " + serviceInstanceId)
//source - HARDCODED
def source = "VID"
execution.setVariable("DCVFM_source", source)
rollbackData.put("VFMODULE", "source", source)
- msoLogger.debug("source: " + source)
+ logger.debug("source: " + source)
//backoutOnFailure
def disableRollback = execution.getVariable("disableRollback")
def backoutOnFailure = true
@@ -203,15 +207,15 @@ public class DoCreateVfModule extends VfModuleBase {
backoutOnFailure = false
}
execution.setVariable("DCVFM_backoutOnFailure", backoutOnFailure)
- msoLogger.debug("backoutOnFailure: " + backoutOnFailure)
+ logger.debug("backoutOnFailure: " + backoutOnFailure)
//isBaseVfModule
def isBaseVfModule = execution.getVariable("isBaseVfModule")
execution.setVariable("DCVFM_isBaseVfModule", isBaseVfModule)
- msoLogger.debug("isBaseVfModule: " + isBaseVfModule)
+ logger.debug("isBaseVfModule: " + isBaseVfModule)
//asdcServiceModelVersion
def asdcServiceModelVersion = execution.getVariable("asdcServiceModelVersion")
execution.setVariable("DCVFM_asdcServiceModelVersion", asdcServiceModelVersion)
- msoLogger.debug("asdcServiceModelVersion: " + asdcServiceModelVersion)
+ logger.debug("asdcServiceModelVersion: " + asdcServiceModelVersion)
//personaModelId
execution.setVariable("DCVFM_personaModelId", jsonUtil.getJsonValue(vfModuleModelInfo, "modelInvariantUuid"))
//personaModelVersion
@@ -220,15 +224,15 @@ public class DoCreateVfModule extends VfModuleBase {
def vfModuleLabel = execution.getVariable("vfModuleLabel")
if (vfModuleLabel != null) {
execution.setVariable("DCVFM_vfModuleLabel", vfModuleLabel)
- msoLogger.debug("vfModuleLabel: " + vfModuleLabel)
+ logger.debug("vfModuleLabel: " + vfModuleLabel)
}
//Get or Generate UUID
String uuid = execution.getVariable("DCVFM_uuid")
if(uuid == null){
uuid = UUID.randomUUID()
- msoLogger.debug("Generated messageId (UUID) is: " + uuid)
+ logger.debug("Generated messageId (UUID) is: " + uuid)
}else{
- msoLogger.debug("Found messageId (UUID) is: " + uuid)
+ logger.debug("Found messageId (UUID) is: " + uuid)
}
//isVidRequest
String isVidRequest = execution.getVariable("isVidRequest")
@@ -239,7 +243,7 @@ public class DoCreateVfModule extends VfModuleBase {
//globalSubscriberId
String globalSubscriberId = execution.getVariable("globalSubscriberId")
execution.setVariable("DCVFM_globalSubscriberId", globalSubscriberId)
- msoLogger.debug("globalSubsrciberId: " + globalSubscriberId)
+ logger.debug("globalSubsrciberId: " + globalSubscriberId)
// Set Homing Info
String oofDirectives = null
@@ -248,26 +252,26 @@ public class DoCreateVfModule extends VfModuleBase {
if (homingInstance != null) {
execution.setVariable("DCVFM_cloudSiteId", homingInstance.getCloudRegionId())
rollbackData.put("VFMODULE", "aiccloudregion", homingInstance.getCloudRegionId())
- msoLogger.debug("Overwriting cloudSiteId with homing cloudSiteId: " +
+ logger.debug("Overwriting cloudSiteId with homing cloudSiteId: " +
homingInstance.getCloudRegionId())
execution.setVariable("DCVFM_cloudOwner", homingInstance.getCloudOwner())
rollbackData.put("VFMODULE", "cloudOwner", homingInstance.getCloudOwner())
- msoLogger.debug("Overwriting cloudOwner with homing cloudOwner: " +
+ logger.debug("Overwriting cloudOwner with homing cloudOwner: " +
homingInstance.getCloudOwner())
oofDirectives = homingInstance.getOofDirectives()
execution.setVariable("DCVFM_oofDirectives", oofDirectives)
}
} catch (Exception exception) {
- msoLogger.debug("Could not find homing information for service instance: " + serviceInstanceId +
+ logger.debug("Could not find homing information for service instance: " + serviceInstanceId +
"... continuing")
- msoLogger.debug("Could not find homing information for service instance error: " + exception)
+ logger.debug("Could not find homing information for service instance error: " + exception)
}
//OofDirectives to Input Params
Map<String,String> vfModuleInputParams = execution.getVariable("vfModuleInputParams")
if (oofDirectives != null && vfModuleInputParams != null) {
vfModuleInputParams.put("oof_directives", oofDirectives)
vfModuleInputParams.put("sdnc_directives", "{}")
- msoLogger.debug("OofDirectives are: " + oofDirectives)
+ logger.debug("OofDirectives are: " + oofDirectives)
} else if (vfModuleInputParams != null) {
vfModuleInputParams.put("oof_directives", "{}")
vfModuleInputParams.put("sdnc_directives", "{}")
@@ -279,11 +283,11 @@ public class DoCreateVfModule extends VfModuleBase {
//usePreload
def usePreload = execution.getVariable("usePreload")
execution.setVariable("DCVFM_usePreload", usePreload)
- msoLogger.debug("usePreload: " + usePreload)
+ logger.debug("usePreload: " + usePreload)
//aLaCarte
def aLaCarte = execution.getVariable("aLaCarte")
execution.setVariable("DCVFM_aLaCarte", aLaCarte)
- msoLogger.debug("aLaCarte: " + aLaCarte)
+ logger.debug("aLaCarte: " + aLaCarte)
//get workload and environment context from parent SI
String environmentContext = ""
@@ -297,7 +301,7 @@ public class DoCreateVfModule extends VfModuleBase {
throw e
} catch (Exception ex){
String msg = "Exception in preProcessRequest " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
@@ -310,7 +314,7 @@ public class DoCreateVfModule extends VfModuleBase {
workloadContext = aaiJson.getOrDefault("workload-context","")
}catch (Exception ex) {
- msoLogger.debug("Error retreiving parent service instance information")
+ logger.debug("Error retreiving parent service instance information")
}
execution.setVariable("DCVFM_environmentContext",environmentContext)
@@ -319,7 +323,7 @@ public class DoCreateVfModule extends VfModuleBase {
}
else {
// The info is inside the request - DEAD CODE
- msoLogger.debug("DoCreateVfModule request: " + request)
+ logger.debug("DoCreateVfModule request: " + request)
//tenantId
def tenantId = ""
@@ -347,7 +351,7 @@ public class DoCreateVfModule extends VfModuleBase {
}
execution.setVariable("DCVFM_cloudSiteId", cloudSiteId)
rollbackData.put("VFMODULE", "aiccloudregion", cloudSiteId)
- msoLogger.debug("cloudSiteId: " + cloudSiteId)
+ logger.debug("cloudSiteId: " + cloudSiteId)
//vnfType
def vnfType = ""
if (utils.nodeExists(request, "vnf-type")) {
@@ -355,7 +359,7 @@ public class DoCreateVfModule extends VfModuleBase {
}
execution.setVariable("DCVFM_vnfType", vnfType)
rollbackData.put("VFMODULE", "vnftype", vnfType)
- msoLogger.debug("vnfType: " + vnfType)
+ logger.debug("vnfType: " + vnfType)
//vnfName
def vnfName = ""
if (utils.nodeExists(request, "vnf-name")) {
@@ -363,7 +367,7 @@ public class DoCreateVfModule extends VfModuleBase {
}
execution.setVariable("DCVFM_vnfName", vnfName)
rollbackData.put("VFMODULE", "vnfname", vnfName)
- msoLogger.debug("vnfName: " + vnfName)
+ logger.debug("vnfName: " + vnfName)
//vnfId
def vnfId = ""
if (utils.nodeExists(request, "vnf-id")) {
@@ -371,7 +375,7 @@ public class DoCreateVfModule extends VfModuleBase {
}
execution.setVariable("DCVFM_vnfId", vnfId)
rollbackData.put("VFMODULE", "vnfid", vnfId)
- msoLogger.debug("vnfId: " + vnfId)
+ logger.debug("vnfId: " + vnfId)
//vfModuleName
def vfModuleName = ""
if (utils.nodeExists(request, "vf-module-name")) {
@@ -379,7 +383,7 @@ public class DoCreateVfModule extends VfModuleBase {
}
execution.setVariable("DCVFM_vfModuleName", vfModuleName)
rollbackData.put("VFMODULE", "vfmodulename", vfModuleName)
- msoLogger.debug("vfModuleName: " + vfModuleName)
+ logger.debug("vfModuleName: " + vfModuleName)
//vfModuleModelName
def vfModuleModelName = ""
if (utils.nodeExists(request, "vf-module-model-name")) {
@@ -387,7 +391,7 @@ public class DoCreateVfModule extends VfModuleBase {
}
execution.setVariable("DCVFM_vfModuleModelName", vfModuleModelName)
rollbackData.put("VFMODULE", "vfmodulemodelname", vfModuleModelName)
- msoLogger.debug("vfModuleModelName: " + vfModuleModelName)
+ logger.debug("vfModuleModelName: " + vfModuleModelName)
//modelCustomizationUuid
def modelCustomizationUuid = ""
if (utils.nodeExists(request, "model-customization-id")) {
@@ -395,27 +399,27 @@ public class DoCreateVfModule extends VfModuleBase {
}
execution.setVariable("DCVFM_modelCustomizationUuid", modelCustomizationUuid)
rollbackData.put("VFMODULE", "modelcustomizationuuid", modelCustomizationUuid)
- msoLogger.debug("modelCustomizationUuid: " + modelCustomizationUuid)
+ logger.debug("modelCustomizationUuid: " + modelCustomizationUuid)
//vfModuleId
def vfModuleId = ""
if (utils.nodeExists(request, "vf-module-id")) {
vfModuleId = utils.getNodeText(request, "vf-module-id")
}
execution.setVariable("DCVFM_vfModuleId", vfModuleId)
- msoLogger.debug("vfModuleId: " + vfModuleId)
+ logger.debug("vfModuleId: " + vfModuleId)
def requestId = ""
if (utils.nodeExists(request, "request-id")) {
requestId = utils.getNodeText(request, "request-id")
}
execution.setVariable("DCVFM_requestId", requestId)
- msoLogger.debug("requestId: " + requestId)
+ logger.debug("requestId: " + requestId)
//serviceId
def serviceId = ""
if (utils.nodeExists(request, "service-id")) {
serviceId = utils.getNodeText(request, "service-id")
}
execution.setVariable("DCVFM_serviceId", serviceId)
- msoLogger.debug("serviceId: " + serviceId)
+ logger.debug("serviceId: " + serviceId)
//serviceInstanceId
def serviceInstanceId = ""
if (utils.nodeExists(request, "service-instance-id")) {
@@ -423,7 +427,7 @@ public class DoCreateVfModule extends VfModuleBase {
}
execution.setVariable("DCVFM_serviceInstanceId", serviceInstanceId)
rollbackData.put("VFMODULE", "serviceInstanceId", serviceInstanceId)
- msoLogger.debug("serviceInstanceId: " + serviceInstanceId)
+ logger.debug("serviceInstanceId: " + serviceInstanceId)
//source
def source = ""
if (utils.nodeExists(request, "source")) {
@@ -431,26 +435,26 @@ public class DoCreateVfModule extends VfModuleBase {
}
execution.setVariable("DCVFM_source", source)
rollbackData.put("VFMODULE", "source", source)
- msoLogger.debug("source: " + source)
+ logger.debug("source: " + source)
//backoutOnFailure
NetworkUtils networkUtils = new NetworkUtils()
def backoutOnFailure = networkUtils.isRollbackEnabled(execution,request)
execution.setVariable("DCVFM_backoutOnFailure", backoutOnFailure)
- msoLogger.debug("backoutOnFailure: " + backoutOnFailure)
+ logger.debug("backoutOnFailure: " + backoutOnFailure)
//isBaseVfModule
def isBaseVfModule = "false"
if (utils.nodeExists(request, "is-base-vf-module")) {
isBaseVfModule = utils.getNodeText(request, "is-base-vf-module")
}
execution.setVariable("DCVFM_isBaseVfModule", isBaseVfModule)
- msoLogger.debug("isBaseVfModule: " + isBaseVfModule)
+ logger.debug("isBaseVfModule: " + isBaseVfModule)
//asdcServiceModelVersion
def asdcServiceModelVersion = ""
if (utils.nodeExists(request, "asdc-service-model-version")) {
asdcServiceModelVersion = utils.getNodeText(request, "asdc-service-model-version")
}
execution.setVariable("DCVFM_asdcServiceModelVersion", asdcServiceModelVersion)
- msoLogger.debug("asdcServiceModelVersion: " + asdcServiceModelVersion)
+ logger.debug("asdcServiceModelVersion: " + asdcServiceModelVersion)
//personaModelId
def personaModelId = ""
@@ -458,7 +462,7 @@ public class DoCreateVfModule extends VfModuleBase {
personaModelId = utils.getNodeText(request, "persona-model-id")
}
execution.setVariable("DCVFM_personaModelId", personaModelId)
- msoLogger.debug("personaModelId: " + personaModelId)
+ logger.debug("personaModelId: " + personaModelId)
//personaModelVersion
def personaModelVersion = ""
@@ -466,15 +470,15 @@ public class DoCreateVfModule extends VfModuleBase {
personaModelVersion = utils.getNodeText(request, "persona-model-version")
}
execution.setVariable("DCVFM_personaModelVersion", personaModelVersion)
- msoLogger.debug("personaModelVersion: " + personaModelVersion)
+ logger.debug("personaModelVersion: " + personaModelVersion)
// Process the parameters
String vnfParamsChildNodes = utils.getChildNodes(request, "vnf-params")
if(vnfParamsChildNodes == null || vnfParamsChildNodes.length() < 1){
- msoLogger.debug("Request contains NO VNF Params")
+ logger.debug("Request contains NO VNF Params")
}else{
- msoLogger.debug("Request does contain VNF Params")
+ logger.debug("Request does contain VNF Params")
execution.setVariable("DCVFM_vnfParamsExistFlag", true)
InputSource xmlSource = new InputSource(new StringReader(request));
@@ -503,24 +507,24 @@ public class DoCreateVfModule extends VfModuleBase {
if (homingInstance != null) {
execution.setVariable("DCVFM_cloudSiteId", homingInstance.getCloudRegionId())
rollbackData.put("VFMODULE", "aiccloudregion", homingInstance.getCloudRegionId())
- msoLogger.debug("Overwriting cloudSiteId with homing cloudSiteId: " +
+ logger.debug("Overwriting cloudSiteId with homing cloudSiteId: " +
homingInstance.getCloudRegionId())
execution.setVariable("DCVFM_cloudOwner", homingInstance.getCloudOwner())
rollbackData.put("VFMODULE", "cloudOwner", homingInstance.getCloudOwner())
- msoLogger.debug("Overwriting cloudOwner with homing cloudOwner: " +
+ logger.debug("Overwriting cloudOwner with homing cloudOwner: " +
homingInstance.getCloudOwner())
oofDirectives = homingInstance.getOofDirectives()
execution.setVariable("DCVFM_oofDirectives", oofDirectives)
}
} catch (Exception exception) {
- msoLogger.debug("Could not find homing information for service instance: " + serviceInstanceId +
+ logger.debug("Could not find homing information for service instance: " + serviceInstanceId +
"... continuing")
- msoLogger.debug("Could not find homing information for service instance error: " + exception)
+ logger.debug("Could not find homing information for service instance error: " + exception)
}
if (oofDirectives != null) {
Map<String, String> paramsMap = execution.getVariable("DCVFM_vnfParamsMap")
paramsMap.put("oofDirectives", oofDirectives)
- msoLogger.debug("OofDirectives are: " + oofDirectives)
+ logger.debug("OofDirectives are: " + oofDirectives)
execution.setVariable("DCVFM_vnfParamsMap", paramsMap)
}
}
@@ -530,16 +534,16 @@ public class DoCreateVfModule extends VfModuleBase {
String uuid = execution.getVariable("DCVFM_uuid")
if(uuid == null){
uuid = UUID.randomUUID()
- msoLogger.debug("Generated messageId (UUID) is: " + uuid)
+ logger.debug("Generated messageId (UUID) is: " + uuid)
}else{
- msoLogger.debug("Found messageId (UUID) is: " + uuid)
+ logger.debug("Found messageId (UUID) is: " + uuid)
}
// Get sdncVersion, default to empty
String sdncVersion = execution.getVariable("sdncVersion")
if (sdncVersion == null) {
sdncVersion = ""
}
- msoLogger.debug("sdncVersion: " + sdncVersion)
+ logger.debug("sdncVersion: " + sdncVersion)
execution.setVariable("DCVFM_sdncVersion", sdncVersion)
execution.setVariable("DCVFM_uuid", uuid)
@@ -564,24 +568,25 @@ public class DoCreateVfModule extends VfModuleBase {
String sdncCallbackUrl = (String) UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution)
if (sdncCallbackUrl == null || sdncCallbackUrl.trim().isEmpty()) {
def msg = 'Required variable \'mso.workflow.sdncadapter.callback\' is missing'
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, msg);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), msg);
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
execution.setVariable("DCVFM_sdncCallbackUrl", sdncCallbackUrl)
- msoLogger.debug("SDNC Callback URL is: " + sdncCallbackUrl)
+ logger.debug("SDNC Callback URL is: " + sdncCallbackUrl)
execution.setVariable("rollbackData", rollbackData)
}catch(BpmnError b){
- msoLogger.error(b);
+ logger.error(b);
throw b
}catch(Exception e){
- msoLogger.error(e);
+ logger.error(e);
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error encountered in PreProcess method!")
}
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
}
/**
@@ -607,15 +612,17 @@ public class DoCreateVfModule extends VfModuleBase {
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
try {
sendWorkflowResponse(execution, 200, "")
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Internal Error')
}
@@ -633,28 +640,28 @@ public class DoCreateVfModule extends VfModuleBase {
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
try {
def createResponse = execution.getVariable('DCVFM_createVfModuleResponse')
- msoLogger.debug("createVfModule Response: " + createResponse)
+ logger.debug("createVfModule Response: " + createResponse)
def rollbackData = execution.getVariable("rollbackData")
String vnfName = utils.getNodeText(createResponse, 'vnf-name')
if (vnfName != null) {
execution.setVariable('DCVFM_vnfName', vnfName)
- msoLogger.debug("vnfName retrieved from AAI is: " + vnfName)
+ logger.debug("vnfName retrieved from AAI is: " + vnfName)
rollbackData.put("VFMODULE", "vnfname", vnfName)
}
String vnfId = utils.getNodeText(createResponse, 'vnf-id')
execution.setVariable('DCVFM_vnfId', vnfId)
- msoLogger.debug("vnfId is: " + vnfId)
+ logger.debug("vnfId is: " + vnfId)
String vfModuleId = utils.getNodeText(createResponse, 'vf-module-id')
execution.setVariable('DCVFM_vfModuleId', vfModuleId)
- msoLogger.debug("vfModuleId is: " + vfModuleId)
+ logger.debug("vfModuleId is: " + vfModuleId)
String vfModuleIndex= utils.getNodeText(createResponse, 'vf-module-index')
execution.setVariable('DCVFM_vfModuleIndex', vfModuleIndex)
- msoLogger.debug("vfModuleIndex is: " + vfModuleIndex)
+ logger.debug("vfModuleIndex is: " + vfModuleIndex)
rollbackData.put("VFMODULE", "vnfid", vnfId)
rollbackData.put("VFMODULE", "vfmoduleid", vfModuleId)
rollbackData.put("VFMODULE", "rollbackCreateAAIVfModule", "true")
@@ -662,10 +669,10 @@ public class DoCreateVfModule extends VfModuleBase {
execution.setVariable("rollbackData", rollbackData)
} catch (Exception ex) {
ex.printStackTrace()
- msoLogger.debug('Exception occurred while postProcessing CreateAAIVfModule request:' + ex.getMessage())
+ logger.debug('Exception occurred while postProcessing CreateAAIVfModule request:' + ex.getMessage())
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Bad response from CreateAAIVfModule' + ex.getMessage())
}
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
}
@@ -680,7 +687,7 @@ public class DoCreateVfModule extends VfModuleBase {
def method = getClass().getSimpleName() + '.getVfModule(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
try {
def vnfId = execution.getVariable('DCVFM_vnfId')
@@ -697,22 +704,22 @@ public class DoCreateVfModule extends VfModuleBase {
client.addAdditionalHeader('Content-Type', MediaType.APPLICATION_XML)
client.addAdditionalHeader('Accept', MediaType.APPLICATION_XML)
- msoLogger.debug('sending GET to AAI endpoint \'' + endPoint + '\'')
+ logger.debug('sending GET to AAI endpoint \'' + endPoint + '\'')
Response response = client.get()
String responseData = response.readEntity(String.class)
if (responseData != null) {
- msoLogger.debug("Received generic VNF data: " + responseData)
+ logger.debug("Received generic VNF data: " + responseData)
}
execution.setVariable('DCVFM_queryAAIVfModuleResponseCode', response.getStatus())
execution.setVariable('DCVFM_queryAAIVfModuleResponse', responseData)
- msoLogger.debug('Response code:' + response.getStatus())
- msoLogger.debug('Response:' + System.lineSeparator() + responseData)
+ logger.debug('Response code:' + response.getStatus())
+ logger.debug('Response:' + System.lineSeparator() + responseData)
if (response.getStatus() == 200) {
// Parse the VNF record from A&AI to find base module info
- msoLogger.debug('Parsing the VNF data to find base module info')
+ logger.debug('Parsing the VNF data to find base module info')
if (responseData != null) {
def vfModulesText = utils.getNodeXml(responseData, "vf-modules")
def xmlVfModules= new XmlSlurper().parseText(vfModulesText)
@@ -725,24 +732,26 @@ public class DoCreateVfModule extends VfModuleBase {
if (isBaseVfModule == "true") {
String baseModuleId = utils.getNodeText(vfModuleXml, "vf-module-id")
execution.setVariable("DCVFM_baseVfModuleId", baseModuleId)
- msoLogger.debug('Received baseVfModuleId: ' + baseModuleId)
+ logger.debug('Received baseVfModuleId: ' + baseModuleId)
String baseModuleHeatStackId = utils.getNodeText(vfModuleXml, "heat-stack-id")
execution.setVariable("DCVFM_baseVfModuleHeatStackId", baseModuleHeatStackId)
- msoLogger.debug('Received baseVfModuleHeatStackId: ' + baseModuleHeatStackId)
+ logger.debug('Received baseVfModuleHeatStackId: ' + baseModuleHeatStackId)
}
}
}
}
} catch (Exception ex) {
ex.printStackTrace()
- msoLogger.debug('Exception occurred while executing AAI GET:' + ex.getMessage())
+ logger.debug('Exception occurred while executing AAI GET:' + ex.getMessage())
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'AAI GET Failed:' + ex.getMessage())
}
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIVfModule(): ' + e.getMessage())
}
}
@@ -761,7 +770,7 @@ public class DoCreateVfModule extends VfModuleBase {
def method = getClass().getSimpleName() + '.queryAAIVfModuleForStatus(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
execution.setVariable('DCVFM_orchestrationStatus', '')
@@ -782,24 +791,24 @@ public class DoCreateVfModule extends VfModuleBase {
try {
def responseData = ''
- msoLogger.debug('sending GET to AAI endpoint \'' + endPoint + '\'')
+ logger.debug('sending GET to AAI endpoint \'' + endPoint + '\'')
Response response = client.get()
- msoLogger.debug("createVfModule - invoking httpGet() to AAI")
+ logger.debug("createVfModule - invoking httpGet() to AAI")
responseData = response.readEntity(String.class)
if (responseData != null) {
- msoLogger.debug("Received generic VNF data: " + responseData)
+ logger.debug("Received generic VNF data: " + responseData)
}
execution.setVariable('DCVFM_queryAAIVfModuleForStatusResponseCode', response.getStatus())
execution.setVariable('DCVFM_queryAAIVfModuleForStatusResponse', responseData)
- msoLogger.debug('Response code:' + response.getStatus())
- msoLogger.debug('Response:' + System.lineSeparator() + responseData)
+ logger.debug('Response code:' + response.getStatus())
+ logger.debug('Response:' + System.lineSeparator() + responseData)
// Retrieve VF Module info and its orchestration status; if not found, do nothing
if (response.getStatus() == 200) {
// Parse the VNF record from A&AI to find base module info
- msoLogger.debug('Parsing the VNF data to find orchestration status')
+ logger.debug('Parsing the VNF data to find orchestration status')
if (responseData != null) {
def vfModuleText = utils.getNodeXml(responseData, "vf-module")
//def xmlVfModule= new XmlSlurper().parseText(vfModuleText)
@@ -808,20 +817,22 @@ public class DoCreateVfModule extends VfModuleBase {
// Also retrieve vfModuleId
def vfModuleId = utils.getNodeText(vfModuleText, "vf-module-id")
execution.setVariable("DCVFM_vfModuleId", vfModuleId)
- msoLogger.debug("Received orchestration status from A&AI: " + orchestrationStatus)
+ logger.debug("Received orchestration status from A&AI: " + orchestrationStatus)
}
}
} catch (Exception ex) {
ex.printStackTrace()
- msoLogger.debug('Exception occurred while executing AAI GET:' + ex.getMessage())
+ logger.debug('Exception occurred while executing AAI GET:' + ex.getMessage())
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'AAI GET Failed:' + ex.getMessage())
}
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIVfModuleForStatus(): ' + e.getMessage())
}
}
@@ -830,11 +841,11 @@ public class DoCreateVfModule extends VfModuleBase {
public void preProcessSDNCAssignRequest(DelegateExecution execution){
execution.setVariable("prefix", Prefix)
- msoLogger.trace("STARTED preProcessSDNCAssignRequest")
+ logger.trace("STARTED preProcessSDNCAssignRequest")
def vnfId = execution.getVariable("DCVFM_vnfId")
def vfModuleId = execution.getVariable("DCVFM_vfModuleId")
def serviceInstanceId = execution.getVariable("DCVFM_serviceInstanceId")
- msoLogger.debug("NEW VNF ID: " + vnfId)
+ logger.debug("NEW VNF ID: " + vnfId)
try{
@@ -852,20 +863,22 @@ public class DoCreateVfModule extends VfModuleBase {
assignSDNCRequest = utils.formatXml(assignSDNCRequest)
execution.setVariable("DCVFM_assignSDNCRequest", assignSDNCRequest)
- msoLogger.debug("Outgoing AssignSDNCRequest is: \n" + assignSDNCRequest)
+ logger.debug("Outgoing AssignSDNCRequest is: \n" + assignSDNCRequest)
}catch(Exception e){
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Exception Occurred Processing preProcessSDNCAssignRequest", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Occurred Processing preProcessSDNCAssignRequest", "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during prepareProvision Method:\n" + e.getMessage())
}
- msoLogger.trace("COMPLETED preProcessSDNCAssignRequest")
+ logger.trace("COMPLETED preProcessSDNCAssignRequest")
}
public void preProcessSDNCGetRequest(DelegateExecution execution, String element){
String sdncVersion = execution.getVariable("DCVFM_sdncVersion")
execution.setVariable("prefix", Prefix)
- msoLogger.trace("STARTED preProcessSDNCGetRequest Process")
+ logger.trace("STARTED preProcessSDNCGetRequest Process")
try{
def serviceInstanceId = execution.getVariable('DCVFM_serviceInstanceId')
@@ -875,7 +888,7 @@ public class DoCreateVfModule extends VfModuleBase {
}
def callbackUrl = execution.getVariable("DCVFM_sdncCallbackUrl")
- msoLogger.debug("callbackUrl:" + callbackUrl)
+ logger.debug("callbackUrl:" + callbackUrl)
def vfModuleId = execution.getVariable('DCVFM_vfModuleId')
@@ -907,21 +920,21 @@ public class DoCreateVfModule extends VfModuleBase {
Optional<GenericVnf> vnf = wrapper.asBean(GenericVnf.class)
serviceOperation = vnf.get().getSelflink()
- msoLogger.debug("VNF - service operation: " + serviceOperation)
+ logger.debug("VNF - service operation: " + serviceOperation)
}
else if (element.equals("vfmodule")) {
String response = execution.getVariable("DCVFM_assignSDNCAdapterResponse")
- msoLogger.debug("DCVFM_assignSDNCAdapterResponse is: \n" + response)
+ logger.debug("DCVFM_assignSDNCAdapterResponse is: \n" + response)
if (!sdncVersion.equals("1707")) {
serviceOperation = "/VNF-API:vnfs/vnf-list/" + vfModuleId
- msoLogger.debug("VF Module with sdncVersion before 1707 - service operation: " + serviceOperation)
+ logger.debug("VF Module with sdncVersion before 1707 - service operation: " + serviceOperation)
}
else {
String data = utils.getNodeXml(response, "response-data")
- msoLogger.debug("responseData: " + data)
+ logger.debug("responseData: " + data)
serviceOperation = utils.getNodeText(data, "object-path")
- msoLogger.debug("VF Module with sdncVersion of 1707 - service operation: " + serviceOperation)
+ logger.debug("VF Module with sdncVersion of 1707 - service operation: " + serviceOperation)
}
}
@@ -944,13 +957,15 @@ public class DoCreateVfModule extends VfModuleBase {
</sdncadapterworkflow:SDNCAdapterWorkflowRequest>"""
execution.setVariable("DCVFM_getSDNCRequest", SDNCGetRequest)
- msoLogger.debug("Outgoing GetSDNCRequest is: \n" + SDNCGetRequest)
+ logger.debug("Outgoing GetSDNCRequest is: \n" + SDNCGetRequest)
}catch(Exception e){
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occurred Processing preProcessSDNCGetRequest", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Occurred Processing preProcessSDNCGetRequest", "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during prepareProvision Method:\n" + e.getMessage())
}
- msoLogger.trace("COMPLETED preProcessSDNCGetRequest Process")
+ logger.trace("COMPLETED preProcessSDNCGetRequest Process")
}
@@ -959,10 +974,10 @@ public class DoCreateVfModule extends VfModuleBase {
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
//def xml = execution.getVariable("DoCreateVfModuleRequest")
- //msoLogger.debug('VNF REQUEST is: ' + xml)
+ //logger.debug('VNF REQUEST is: ' + xml)
//Get variables
//cloudSiteId
@@ -1007,8 +1022,8 @@ public class DoCreateVfModule extends VfModuleBase {
String environmentContext = execution.getVariable("DCVFM_environmentContext")
//workloadContext
String workloadContext = execution.getVariable("DCVFM_workloadContext")
- msoLogger.debug("workloadContext: " + workloadContext)
- msoLogger.debug("environmentContext: " + environmentContext)
+ logger.debug("workloadContext: " + workloadContext)
+ logger.debug("environmentContext: " + environmentContext)
def messageId = execution.getVariable('mso-request-id') + '-' +
System.currentTimeMillis()
@@ -1016,8 +1031,8 @@ public class DoCreateVfModule extends VfModuleBase {
def notificationUrl = createCallbackURL(execution, "VNFAResponse", messageId)
def useQualifiedHostName = UrnPropertiesReader.getVariable("mso.use.qualified.host",execution)
- msoLogger.debug("notificationUrl: " + notificationUrl)
- msoLogger.debug("QualifiedHostName: " + useQualifiedHostName)
+ logger.debug("notificationUrl: " + notificationUrl)
+ logger.debug("QualifiedHostName: " + useQualifiedHostName)
if ('true'.equals(useQualifiedHostName)) {
notificationUrl = utils.getQualifiedHostNameForCallback(notificationUrl)
@@ -1027,7 +1042,7 @@ public class DoCreateVfModule extends VfModuleBase {
String vfModuleParams = ""
//Get SDNC Response Data for VF Module Topology
String vfModuleSdncGetResponse = execution.getVariable('DCVFM_getSDNCAdapterResponse')
- msoLogger.debug("sdncGetResponse: " + vfModuleSdncGetResponse)
+ logger.debug("sdncGetResponse: " + vfModuleSdncGetResponse)
def sdncVersion = execution.getVariable("sdncVersion")
if (!sdncVersion.equals("1707")) {
@@ -1038,7 +1053,7 @@ public class DoCreateVfModule extends VfModuleBase {
else {
//Get SDNC Response Data for Vnf Topology
String vnfSdncGetResponse = execution.getVariable('DCVFM_getVnfSDNCAdapterResponse')
- msoLogger.debug("vnfSdncGetResponse: " + vnfSdncGetResponse)
+ logger.debug("vnfSdncGetResponse: " + vnfSdncGetResponse)
vfModuleParams = buildVfModuleParamsFromCombinedTopologies(vnfParamsMap, vnfSdncGetResponse, vfModuleSdncGetResponse, vnfId, vnfName,
vfModuleId, vfModuleName, vfModuleIndex, environmentContext, workloadContext)
@@ -1083,7 +1098,7 @@ public class DoCreateVfModule extends VfModuleBase {
<notificationUrl>${MsoUtils.xmlEscape(notificationUrl)}</notificationUrl>
</createVfModuleRequest>"""
- msoLogger.debug("Create VfModule Request to VNF Adapter: " + createVnfARequest)
+ logger.debug("Create VfModule Request to VNF Adapter: " + createVnfARequest)
execution.setVariable("DCVFM_createVnfARequest", createVnfARequest)
}
@@ -1099,7 +1114,7 @@ public class DoCreateVfModule extends VfModuleBase {
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
String processKey = getProcessKey(execution);
def prefix = execution.getVariable("prefix")
@@ -1126,7 +1141,7 @@ public class DoCreateVfModule extends VfModuleBase {
if (request == null) {
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, processKey + " request is null")
}
- msoLogger.debug("DoCreateVfModule Request: " + request)
+ logger.debug("DoCreateVfModule Request: " + request)
/*
@@ -1144,13 +1159,15 @@ public class DoCreateVfModule extends VfModuleBase {
utils.logContext(requestId, serviceInstanceId)
*/
- msoLogger.debug('Incoming message: ' + System.lineSeparator() + request)
- msoLogger.trace('Exited ' + method)
+ logger.debug('Incoming message: ' + System.lineSeparator() + request)
+ logger.trace('Exited ' + method)
return request
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Invalid Message")
}
}
@@ -1161,16 +1178,16 @@ public class DoCreateVfModule extends VfModuleBase {
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
def request = execution.getVariable('DoCreateVfModuleRequest')
String volumeGroupId = utils.getNodeText(request, "volume-group-id")
if (volumeGroupId == null || volumeGroupId.isEmpty()) {
- msoLogger.debug('No volume group id is present')
+ logger.debug('No volume group id is present')
return false
}
else {
- msoLogger.debug('Volume group id is present')
+ logger.debug('Volume group id is present')
return true
}
@@ -1182,16 +1199,16 @@ public class DoCreateVfModule extends VfModuleBase {
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
def request = execution.getVariable('DoCreateVfModuleRequest')
String volumeGroupName = utils.getNodeText(request, "volume-group-name")
if (volumeGroupName == null || volumeGroupName.isEmpty()) {
- msoLogger.debug('No volume group name is present')
+ logger.debug('No volume group name is present')
return false
}
else {
- msoLogger.debug('Volume group name is present')
+ logger.debug('Volume group name is present')
return true
}
@@ -1386,7 +1403,7 @@ public class DoCreateVfModule extends VfModuleBase {
}
- msoLogger.debug("sdncRequest: " + sdncRequest)
+ logger.debug("sdncRequest: " + sdncRequest)
return sdncRequest
}
@@ -1396,9 +1413,9 @@ public class DoCreateVfModule extends VfModuleBase {
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
execution.setVariable("prefix", Prefix)
- msoLogger.trace("STARTED preProcessSDNCActivateRequest Process")
+ logger.trace("STARTED preProcessSDNCActivateRequest Process")
try{
String vnfId = execution.getVariable("DCVFM_vnfId")
String vfModuleId = execution.getVariable("DCVFM_vfModuleId")
@@ -1414,13 +1431,13 @@ public class DoCreateVfModule extends VfModuleBase {
String activateSDNCRequest = buildSDNCRequest(execution, svcInstId, "activate")
execution.setVariable("DCVFM_activateSDNCRequest", activateSDNCRequest)
- msoLogger.debug("Outgoing CommitSDNCRequest is: \n" + activateSDNCRequest)
+ logger.debug("Outgoing CommitSDNCRequest is: \n" + activateSDNCRequest)
}catch(Exception e){
- msoLogger.debug("Exception Occured Processing preProcessSDNCActivateRequest. Exception is:\n" + e)
+ logger.debug("Exception Occured Processing preProcessSDNCActivateRequest. Exception is:\n" + e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessSDNCActivateRequest Method:\n" + e.getMessage())
}
- msoLogger.trace("COMPLETED preProcessSDNCActivateRequest Process")
+ logger.trace("COMPLETED preProcessSDNCActivateRequest Process")
}
public void postProcessVNFAdapterRequest(DelegateExecution execution) {
@@ -1428,23 +1445,23 @@ public class DoCreateVfModule extends VfModuleBase {
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
execution.setVariable("prefix",Prefix)
try{
- msoLogger.debug("STARTED postProcessVNFAdapterRequest Process")
+ logger.debug("STARTED postProcessVNFAdapterRequest Process")
String vnfResponse = execution.getVariable("DCVFM_createVnfAResponse")
- msoLogger.debug("VNF Adapter Response is: " + vnfResponse)
+ logger.debug("VNF Adapter Response is: " + vnfResponse)
RollbackData rollbackData = execution.getVariable("rollbackData")
if(vnfResponse != null){
if(vnfResponse.contains("createVfModuleResponse")){
- msoLogger.debug("Received a Good Response from VNF Adapter for CREATE_VF_MODULE Call.")
+ logger.debug("Received a Good Response from VNF Adapter for CREATE_VF_MODULE Call.")
execution.setVariable("DCVFM_vnfVfModuleCreateCompleted", true)
String heatStackId = utils.getNodeText(vnfResponse, "vfModuleStackId")
execution.setVariable("DCVFM_heatStackId", heatStackId)
- msoLogger.debug("Received heat stack id from VNF Adapter: " + heatStackId)
+ logger.debug("Received heat stack id from VNF Adapter: " + heatStackId)
rollbackData.put("VFMODULE", "heatstackid", heatStackId)
// Parse vnfOutputs for network_fqdn
if (vnfResponse.contains("vfModuleOutputs")) {
@@ -1464,22 +1481,22 @@ public class DoCreateVfModule extends VfModuleBase {
String key = element.getElementsByTagNameNS("*", "key").item(0).getTextContent()
if (key.equals("contrail-service-instance-fqdn")) {
String contrailServiceInstanceFqdn = element.getElementsByTagNameNS("*", "value").item(0).getTextContent()
- msoLogger.debug("Obtained contrailServiceInstanceFqdn: " + contrailServiceInstanceFqdn)
+ logger.debug("Obtained contrailServiceInstanceFqdn: " + contrailServiceInstanceFqdn)
execution.setVariable("DCVFM_contrailServiceInstanceFqdn", contrailServiceInstanceFqdn)
}
else if (key.endsWith("contrail_network_policy_fqdn")) {
String contrailNetworkPolicyFqdn = element.getElementsByTagNameNS("*", "value").item(0).getTextContent()
- msoLogger.debug("Obtained contrailNetworkPolicyFqdn: " + contrailNetworkPolicyFqdn)
+ logger.debug("Obtained contrailNetworkPolicyFqdn: " + contrailNetworkPolicyFqdn)
contrailNetworkPolicyFqdnList.add(contrailNetworkPolicyFqdn)
}
else if (key.equals("oam_management_v4_address")) {
String oamManagementV4Address = element.getElementsByTagNameNS("*", "value").item(0).getTextContent()
- msoLogger.debug("Obtained oamManagementV4Address: " + oamManagementV4Address)
+ logger.debug("Obtained oamManagementV4Address: " + oamManagementV4Address)
execution.setVariable("DCVFM_oamManagementV4Address", oamManagementV4Address)
}
else if (key.equals("oam_management_v6_address")) {
String oamManagementV6Address = element.getElementsByTagNameNS("*", "value").item(0).getTextContent()
- msoLogger.debug("Obtained oamManagementV6Address: " + oamManagementV6Address)
+ logger.debug("Obtained oamManagementV6Address: " + oamManagementV6Address)
execution.setVariable("DCVFM_oamManagementV6Address", oamManagementV6Address)
}
@@ -1490,11 +1507,11 @@ public class DoCreateVfModule extends VfModuleBase {
}
}
}else{
- msoLogger.debug("Received a BAD Response from VNF Adapter for CREATE_VF_MODULE Call.")
+ logger.debug("Received a BAD Response from VNF Adapter for CREATE_VF_MODULE Call.")
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "VNF Adapter Error")
}
}else{
- msoLogger.debug("Response from VNF Adapter is Null for CREATE_VF_MODULE Call.")
+ logger.debug("Response from VNF Adapter is Null for CREATE_VF_MODULE Call.")
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Empty response from VNF Adapter")
}
@@ -1504,10 +1521,10 @@ public class DoCreateVfModule extends VfModuleBase {
}catch(BpmnError b){
throw b
}catch(Exception e){
- msoLogger.debug("Internal Error Occured in PostProcess Method")
+ logger.debug("Internal Error Occured in PostProcess Method")
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Internal Error Occured in PostProcess Method")
}
- msoLogger.trace("COMPLETED postProcessVnfAdapterResponse Process")
+ logger.trace("COMPLETED postProcessVnfAdapterResponse Process")
}
@@ -1516,9 +1533,9 @@ public class DoCreateVfModule extends VfModuleBase {
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
execution.setVariable("prefix", Prefix)
- msoLogger.trace("STARTED preProcessUpdateAAIVfModuleRequestOrch")
+ logger.trace("STARTED preProcessUpdateAAIVfModuleRequestOrch")
try{
@@ -1535,13 +1552,15 @@ public class DoCreateVfModule extends VfModuleBase {
updateAAIVfModuleRequest = utils.formatXml(updateAAIVfModuleRequest)
execution.setVariable("DCVFM_updateAAIVfModuleRequest", updateAAIVfModuleRequest)
- msoLogger.debug("Outgoing UpdateAAIVfModuleRequest is: \n" + updateAAIVfModuleRequest)
+ logger.debug("Outgoing UpdateAAIVfModuleRequest is: \n" + updateAAIVfModuleRequest)
}catch(Exception e){
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing preProcessUpdateAAIVfModuleRequestOrch", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Occured Processing preProcessUpdateAAIVfModuleRequestOrch", "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessUpdateAAIVfModuleRequestOrch Method:\n" + e.getMessage())
}
- msoLogger.trace("COMPLETED preProcessUpdateAAIVfModuleRequestOrch")
+ logger.trace("COMPLETED preProcessUpdateAAIVfModuleRequestOrch")
}
@@ -1550,9 +1569,9 @@ public class DoCreateVfModule extends VfModuleBase {
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
execution.setVariable("prefix", Prefix)
- msoLogger.trace("STARTED preProcessUpdateAAIVfModuleStatus")
+ logger.trace("STARTED preProcessUpdateAAIVfModuleStatus")
try{
@@ -1563,13 +1582,15 @@ public class DoCreateVfModule extends VfModuleBase {
updateAAIVfModuleRequest = utils.formatXml(updateAAIVfModuleRequest)
execution.setVariable("DCVFM_updateAAIVfModuleRequest", updateAAIVfModuleRequest)
- msoLogger.debug("Outgoing UpdateAAIVfModuleRequest is: \n" + updateAAIVfModuleRequest)
+ logger.debug("Outgoing UpdateAAIVfModuleRequest is: \n" + updateAAIVfModuleRequest)
}catch(Exception e){
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing preProcessUpdateAAIVfModuleStatus", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Occured Processing preProcessUpdateAAIVfModuleStatus", "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessUpdateAAIVfModuleStatus Method:\n" + e.getMessage())
}
- msoLogger.trace("COMPLETED preProcessUpdateAAIVfModuleStatus")
+ logger.trace("COMPLETED preProcessUpdateAAIVfModuleStatus")
}
@@ -1579,9 +1600,9 @@ public class DoCreateVfModule extends VfModuleBase {
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
execution.setVariable("prefix", Prefix)
- msoLogger.trace("STARTED preProcessUpdateAAIVfModuleRequestGroup")
+ logger.trace("STARTED preProcessUpdateAAIVfModuleRequestGroup")
try{
@@ -1591,32 +1612,34 @@ public class DoCreateVfModule extends VfModuleBase {
updateAAIVfModuleRequest = utils.formatXml(updateAAIVfModuleRequest)
execution.setVariable("DCVFM_updateAAIVfModuleRequest", updateAAIVfModuleRequest)
- msoLogger.debug("Outgoing UpdateAAIVfModuleRequest is: \n" + updateAAIVfModuleRequest)
+ logger.debug("Outgoing UpdateAAIVfModuleRequest is: \n" + updateAAIVfModuleRequest)
}catch(Exception e){
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing preProcessUpdateAAIVfModuleRequestGroup", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Occured Processing preProcessUpdateAAIVfModuleRequestGroup", "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessUpdateAAIVfModuleRequestGroup Method:\n" + e.getMessage())
}
- msoLogger.trace("COMPLETED preProcessUpdateAAIVfModuleRequestGroup")
+ logger.trace("COMPLETED preProcessUpdateAAIVfModuleRequestGroup")
}
public void validateSDNCResponse(DelegateExecution execution, String response, String method){
execution.setVariable("prefix",Prefix)
- msoLogger.debug("STARTED ValidateSDNCResponse Process")
+ logger.debug("STARTED ValidateSDNCResponse Process")
WorkflowException workflowException = execution.getVariable("WorkflowException")
boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator")
- msoLogger.debug("workflowException: " + workflowException)
+ logger.debug("workflowException: " + workflowException)
SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this)
sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator)
String sdncResponse = response
if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){
- msoLogger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + sdncResponse)
+ logger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + sdncResponse)
RollbackData rollbackData = execution.getVariable("rollbackData")
if(method.equals("assign")){
@@ -1628,19 +1651,19 @@ public class DoCreateVfModule extends VfModuleBase {
}
execution.setVariable("rollbackData", rollbackData)
}else{
- msoLogger.debug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.")
+ logger.debug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.")
throw new BpmnError("MSOWorkflowException")
}
- msoLogger.trace("COMPLETED ValidateSDNCResponse Process")
+ logger.trace("COMPLETED ValidateSDNCResponse Process")
}
public void preProcessUpdateAfterCreateRequest(DelegateExecution execution){
execution.setVariable("prefix", Prefix)
- msoLogger.trace("STARTED preProcessRequest Process")
+ logger.trace("STARTED preProcessRequest Process")
try{
String response = execution.getVariable("DCVFM_assignSDNCAdapterResponse")
- msoLogger.debug("DCVFM_assignSDNCAdapterResponse: " + response)
+ logger.debug("DCVFM_assignSDNCAdapterResponse: " + response)
String data = utils.getNodeXml(response, "response-data")
String vnfId = utils.getNodeText(data, "vnf-id")
@@ -1652,7 +1675,7 @@ public class DoCreateVfModule extends VfModuleBase {
String serviceOperation = "/VNF-API:vnfs/vnf-list/" + vnfId
def callbackUrl = execution.getVariable("DCVFM_sdncCallbackUrl")
- msoLogger.debug("callbackUrl: " + callbackUrl)
+ logger.debug("callbackUrl: " + callbackUrl)
String SDNCGetRequest =
"""<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.onap/so/request/types/v1"
@@ -1669,13 +1692,15 @@ public class DoCreateVfModule extends VfModuleBase {
</sdncadapterworkflow:SDNCAdapterWorkflowRequest>"""
execution.setVariable("DCVFM_getSDNCRequest", SDNCGetRequest)
- msoLogger.debug("Outgoing GetSDNCRequest is: \n" + SDNCGetRequest)
+ logger.debug("Outgoing GetSDNCRequest is: \n" + SDNCGetRequest)
}catch(Exception e){
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing preProcessSDNCGetRequest", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Occured Processing preProcessSDNCGetRequest", "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during prepareProvision Method:\n" + e.getMessage())
}
- msoLogger.trace("COMPLETED preProcessSDNCGetRequest Process")
+ logger.trace("COMPLETED preProcessSDNCGetRequest Process")
}
public String buildUpdateAAIVfModuleRequest(DelegateExecution execution, boolean updateVolumeGroupId,
@@ -1712,7 +1737,7 @@ public class DoCreateVfModule extends VfModuleBase {
${contrailFqdnString}
</UpdateAAIVfModuleRequest>"""
- msoLogger.trace("updateAAIVfModule Request: " + updateAAIVfModuleRequest)
+ logger.trace("updateAAIVfModule Request: " + updateAAIVfModuleRequest)
return updateAAIVfModuleRequest
}
@@ -1761,7 +1786,7 @@ public class DoCreateVfModule extends VfModuleBase {
public void queryCloudRegion (DelegateExecution execution) {
execution.setVariable("prefix", Prefix)
- msoLogger.trace("STARTED queryCloudRegion")
+ logger.trace("STARTED queryCloudRegion")
try {
String cloudRegion = execution.getVariable("DCVFM_cloudSiteId")
@@ -1785,19 +1810,23 @@ public class DoCreateVfModule extends VfModuleBase {
execution.setVariable("DCVFM_isCloudRegionGood", true)
} else {
String errorMessage = "AAI Query Cloud Region Unsuccessful. AAI Response Code: " + execution.getVariable("DCVFM_queryCloudRegionReturnCode")
- msoLogger.debug(errorMessage)
+ logger.debug(errorMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, errorMessage)
execution.setVariable("DCVFM_isCloudRegionGood", false)
}
- msoLogger.debug(" is Cloud Region Good: " + execution.getVariable("DCVFM_isCloudRegionGood"))
+ logger.debug(" is Cloud Region Good: " + execution.getVariable("DCVFM_isCloudRegionGood"))
} catch(BpmnError b){
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Rethrowing MSOWorkflowException", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + b.getMessage());
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Rethrowing MSOWorkflowException", "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + b.getMessage());
throw b
}catch (Exception ex) {
// try error
String errorMessage = "Bpmn error encountered in CreateVfModule flow. Unexpected Response from AAI - " + ex.getMessage()
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "AAI Query Cloud Region Failed "+errorMessage, "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + ex);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "AAI Query Cloud Region Failed " + errorMessage, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Exception occured during queryCloudRegion method")
}
}
@@ -1812,17 +1841,17 @@ public class DoCreateVfModule extends VfModuleBase {
execution.setVariable("prefix",Prefix)
try{
- msoLogger.debug("Caught a BPMN Exception")
- msoLogger.debug("Started processBPMNException Method")
- msoLogger.debug("Variables List: " + execution.getVariables())
+ logger.debug("Caught a BPMN Exception")
+ logger.debug("Started processBPMNException Method")
+ logger.debug("Variables List: " + execution.getVariables())
if(execution.getVariable("WorkflowException") == null){
exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Exception occured during DoCreateVfModule Sub Process")
}
}catch(Exception e){
- msoLogger.debug("Caught Exception during processBPMNException Method: " + e)
+ logger.debug("Caught Exception during processBPMNException Method: " + e)
}
- msoLogger.debug("Completed processBPMNException Method")
+ logger.debug("Completed processBPMNException Method")
}
public void prepareCreateAAIVfModuleVolumeGroupRequest(DelegateExecution execution) {
@@ -1830,9 +1859,9 @@ public class DoCreateVfModule extends VfModuleBase {
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
execution.setVariable("prefix", Prefix)
- msoLogger.trace("STARTED prepareCreateAAIVfModuleVolumeGroupRequest")
+ logger.trace("STARTED prepareCreateAAIVfModuleVolumeGroupRequest")
try{
@@ -1855,13 +1884,15 @@ public class DoCreateVfModule extends VfModuleBase {
createAAIVfModuleVolumeGroupRequest = utils.formatXml(createAAIVfModuleVolumeGroupRequest)
execution.setVariable("DCVFM_createAAIVfModuleVolumeGroupRequest", createAAIVfModuleVolumeGroupRequest)
- msoLogger.debug("Outgoing CreateAAIVfModuleVolumeGroupRequest is: \n" + createAAIVfModuleVolumeGroupRequest)
+ logger.debug("Outgoing CreateAAIVfModuleVolumeGroupRequest is: \n" + createAAIVfModuleVolumeGroupRequest)
}catch(Exception e){
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Exception Occured Processing prepareCreateAAIVfModuleVolumeGroupRequest', "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Exception Occured Processing prepareCreateAAIVfModuleVolumeGroupRequest', "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during prepareCreateAAIVfModuleVolumeGroupRequest Method:\n" + e.getMessage())
}
- msoLogger.trace("COMPLETED prepareCreateAAIVfModuleVolumeGroupRequest")
+ logger.trace("COMPLETED prepareCreateAAIVfModuleVolumeGroupRequest")
}
@@ -1870,9 +1901,9 @@ public class DoCreateVfModule extends VfModuleBase {
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
execution.setVariable("prefix", Prefix)
- msoLogger.trace("STARTED createNetworkPoliciesInAAI")
+ logger.trace("STARTED createNetworkPoliciesInAAI")
try {
// get variables
@@ -1881,7 +1912,7 @@ public class DoCreateVfModule extends VfModuleBase {
def rollbackData = execution.getVariable("rollbackData")
execution.setVariable("DCVFM_networkPolicyFqdnCount", fqdnCount)
- msoLogger.debug("DCVFM_networkPolicyFqdnCount - " + fqdnCount)
+ logger.debug("DCVFM_networkPolicyFqdnCount - " + fqdnCount)
AaiUtil aaiUriUtil = new AaiUtil(this)
@@ -1902,14 +1933,14 @@ public class DoCreateVfModule extends VfModuleBase {
if (resourceClient.exists(uri)) {
- msoLogger.debug(" QueryAAINetworkPolicyByFQDN Success REST Response, , NetworkPolicy #" + counting)
+ logger.debug(" QueryAAINetworkPolicyByFQDN Success REST Response, , NetworkPolicy #" + counting)
} else {
// This network policy FQDN is not in AAI yet. Add it now
- msoLogger.debug("This network policy FQDN is not in AAI yet: " + fqdn)
+ logger.debug("This network policy FQDN is not in AAI yet: " + fqdn)
// Add the network policy with this FQDN to AAI
def networkPolicyId = UUID.randomUUID().toString()
- msoLogger.debug("Adding network-policy with network-policy-id " + networkPolicyId)
+ logger.debug("Adding network-policy with network-policy-id " + networkPolicyId)
NetworkPolicy policy = new NetworkPolicy()
policy.setNetworkPolicyId(networkPolicyId)
@@ -1928,7 +1959,7 @@ public class DoCreateVfModule extends VfModuleBase {
} else {
- msoLogger.debug("No contrail network policies to query/create")
+ logger.debug("No contrail network policies to query/create")
}
@@ -1936,7 +1967,7 @@ public class DoCreateVfModule extends VfModuleBase {
throw e;
} catch (Exception ex) {
String exceptionMessage = "Bpmn error encountered in DoCreateVfModule flow. createNetworkPoliciesInAAI() - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
@@ -1952,7 +1983,7 @@ public class DoCreateVfModule extends VfModuleBase {
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
try {
def rollbackData = execution.getVariable("rollbackData")
@@ -1982,14 +2013,16 @@ public class DoCreateVfModule extends VfModuleBase {
"""
updateAAIGenericVnfRequest = utils.formatXml(updateAAIGenericVnfRequest)
execution.setVariable('DCVM_updateAAIGenericVnfRequest', updateAAIGenericVnfRequest)
- msoLogger.debug('Request for UpdateAAIGenericVnf:\n' + updateAAIGenericVnfRequest)
+ logger.debug('Request for UpdateAAIGenericVnf:\n' + updateAAIGenericVnfRequest)
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Exception Encountered in " + method, "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Encountered in " + method, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepUpdateAAIGenericVnf(): ' + e.getMessage())
}
@@ -2005,7 +2038,7 @@ public class DoCreateVfModule extends VfModuleBase {
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
try {
def rollbackData = execution.getVariable("rollbackData")
@@ -2028,11 +2061,13 @@ public class DoCreateVfModule extends VfModuleBase {
execution.setVariable("rollbackData", rollbackData)
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in postProcessUpdateAAIGenericVnf(): ' + e.getMessage())
}
}
@@ -2040,22 +2075,22 @@ public class DoCreateVfModule extends VfModuleBase {
public void queryCatalogDB (DelegateExecution execution) {
String msg = ""
- msoLogger.trace("queryCatalogDB ")
+ logger.trace("queryCatalogDB ")
try {
boolean twoPhaseDesign = false
// check for input
String vfModuleModelName = execution.getVariable("DCVFM_vfModuleModelName")
- msoLogger.debug("vfModuleModelName: " + vfModuleModelName)
+ logger.debug("vfModuleModelName: " + vfModuleModelName)
def vnfModelInfo = execution.getVariable("vnfModelInfo")
def vnfModelCustomizationUuid = jsonUtil.getJsonValue(vnfModelInfo, "modelCustomizationUuid")
- msoLogger.debug("vnfModelCustomizationUuid: " + vnfModelCustomizationUuid)
+ logger.debug("vnfModelCustomizationUuid: " + vnfModelCustomizationUuid)
JSONArray vnfs = catalogDbUtils.getAllVnfsByVnfModelCustomizationUuid(execution, vnfModelCustomizationUuid, "v2")
- msoLogger.debug("Incoming Query Catalog DB for Vnf Response is: " + vnfModelCustomizationUuid)
+ logger.debug("Incoming Query Catalog DB for Vnf Response is: " + vnfModelCustomizationUuid)
// Only one match here
if (vnfs != null) {
JSONObject vnfObject = vnfs.get(0)
@@ -2068,7 +2103,7 @@ public class DoCreateVfModule extends VfModuleBase {
// Get multiStageDesign flag
String multiStageDesignValue = vnf.getMultiStageDesign()
- msoLogger.debug("multiStageDesign value from Catalog DB is: " + multiStageDesignValue)
+ logger.debug("multiStageDesign value from Catalog DB is: " + multiStageDesignValue)
if (multiStageDesignValue != null) {
if (multiStageDesignValue.equalsIgnoreCase("true")) {
twoPhaseDesign = true
@@ -2077,13 +2112,15 @@ public class DoCreateVfModule extends VfModuleBase {
}
}
- msoLogger.debug("setting twoPhaseDesign flag to: " + twoPhaseDesign)
+ logger.debug("setting twoPhaseDesign flag to: " + twoPhaseDesign)
execution.setVariable("DCVFM_twoPhaseDesign", twoPhaseDesign)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in queryCatalogDB', "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in queryCatalogDB', "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryCatalogDB(): ' + e.getMessage())
}
}
@@ -2091,44 +2128,44 @@ public class DoCreateVfModule extends VfModuleBase {
public void preProcessRollback (DelegateExecution execution) {
- msoLogger.trace("preProcessRollback")
+ logger.trace("preProcessRollback")
try {
Object workflowException = execution.getVariable("WorkflowException");
if (workflowException instanceof WorkflowException) {
- msoLogger.debug("Prev workflowException: " + workflowException.getErrorMessage())
+ logger.debug("Prev workflowException: " + workflowException.getErrorMessage())
execution.setVariable("prevWorkflowException", workflowException);
//execution.setVariable("WorkflowException", null);
}
} catch (BpmnError e) {
- msoLogger.debug("BPMN Error during preProcessRollback")
+ logger.debug("BPMN Error during preProcessRollback")
} catch(Exception ex) {
String msg = "Exception in preProcessRollback. " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
}
- msoLogger.trace("Exit preProcessRollback")
+ logger.trace("Exit preProcessRollback")
}
public void postProcessRollback (DelegateExecution execution) {
- msoLogger.trace("postProcessRollback")
+ logger.trace("postProcessRollback")
String msg = ""
try {
Object workflowException = execution.getVariable("prevWorkflowException");
if (workflowException instanceof WorkflowException) {
- msoLogger.debug("Setting prevException to WorkflowException: ")
+ logger.debug("Setting prevException to WorkflowException: ")
execution.setVariable("WorkflowException", workflowException);
}
execution.setVariable("rollbackData", null)
} catch (BpmnError b) {
- msoLogger.debug("BPMN Error during postProcessRollback")
+ logger.debug("BPMN Error during postProcessRollback")
throw b;
} catch(Exception ex) {
msg = "Exception in postProcessRollback. " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
}
- msoLogger.trace("Exit postProcessRollback")
+ logger.trace("Exit postProcessRollback")
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy
index 55a84575f4..d9989606e0 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -36,6 +38,8 @@ import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
import org.springframework.web.util.UriUtils
@@ -43,7 +47,7 @@ import javax.ws.rs.NotFoundException
public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCreateVfModuleRollback.class);
+ private static final Logger logger = LoggerFactory.getLogger( DoCreateVfModuleRollback.class);
def Prefix="DCVFMR_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
@@ -65,7 +69,7 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{
execution.setVariable("rollbackError", null)
def rollbackData = execution.getVariable("rollbackData")
- msoLogger.debug("RollbackData:" + rollbackData)
+ logger.debug("RollbackData:" + rollbackData)
if (rollbackData != null) {
String vnfId = rollbackData.get("VFMODULE", "vnfid")
@@ -104,7 +108,7 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{
break
}
createdNetworkPolicyFqdnList.add(fqdn)
- msoLogger.debug("got fqdn # " + i + ": " + fqdn)
+ logger.debug("got fqdn # " + i + ": " + fqdn)
i = i + 1
}
@@ -131,7 +135,7 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{
<vf-module-id>${MsoUtils.xmlEscape(vfModuleId)}</vf-module-id>
<orchestration-status>pending-delete</orchestration-status>
</PrepareUpdateAAIVfModuleRequest>""" as String
- msoLogger.debug("PrepareUpdateAAIVfModuleRequest :" + request)
+ logger.debug("PrepareUpdateAAIVfModuleRequest :" + request)
execution.setVariable("PrepareUpdateAAIVfModuleRequest", request)
} else {
execution.setVariable("skipRollback", true)
@@ -145,7 +149,7 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{
throw e;
} catch (Exception ex){
def msg = "Exception in DoCreateVfModuleRollback preProcessRequest " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
}
@@ -238,14 +242,14 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{
</sdncadapterworkflow:SDNCRequestData>
</sdncadapterworkflow:SDNCAdapterWorkflowRequest>"""
- msoLogger.debug("sdncAdapterWorkflowRequest: " + request)
+ logger.debug("sdncAdapterWorkflowRequest: " + request)
execution.setVariable("sdncAdapterWorkflowRequest", request)
}
public void preProcessSDNCDeactivateRequest(DelegateExecution execution){
execution.setVariable("prefix", Prefix)
- msoLogger.trace("STARTED preProcessSDNCDeactivateRequest")
+ logger.trace("STARTED preProcessSDNCDeactivateRequest")
def serviceInstanceId = execution.getVariable("DCVFMR_serviceInstanceId")
@@ -256,13 +260,15 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{
deactivateSDNCRequest = utils.formatXml(deactivateSDNCRequest)
execution.setVariable("DCVFMR_deactivateSDNCRequest", deactivateSDNCRequest)
- msoLogger.debug("Outgoing DeactivateSDNCRequest is: \n" + deactivateSDNCRequest)
+ logger.debug("Outgoing DeactivateSDNCRequest is: \n" + deactivateSDNCRequest)
}catch(Exception e){
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing preProcessSDNCDeactivateRequest.", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Occured Processing preProcessSDNCDeactivateRequest.", "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessSDNCDeactivateRequest Method:\n" + e.getMessage())
}
- msoLogger.trace("COMPLETED preProcessSDNCDeactivateRequest")
+ logger.trace("COMPLETED preProcessSDNCDeactivateRequest")
}
public void preProcessSDNCUnassignRequest(DelegateExecution execution) {
@@ -270,22 +276,22 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{
'execution=' + execution.getId() +
')'
def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
execution.setVariable("prefix", Prefix)
- msoLogger.trace("STARTED preProcessSDNCUnassignRequest Process")
+ logger.trace("STARTED preProcessSDNCUnassignRequest Process")
try{
String serviceInstanceId = execution.getVariable("DCVFMR_serviceInstanceId")
String unassignSDNCRequest = buildSDNCRequest(execution, serviceInstanceId, "unassign")
execution.setVariable("DCVFMR_unassignSDNCRequest", unassignSDNCRequest)
- msoLogger.debug("Outgoing UnassignSDNCRequest is: \n" + unassignSDNCRequest)
+ logger.debug("Outgoing UnassignSDNCRequest is: \n" + unassignSDNCRequest)
}catch(Exception e){
- msoLogger.debug("Exception Occured Processing preProcessSDNCUnassignRequest. Exception is:\n" + e)
+ logger.debug("Exception Occured Processing preProcessSDNCUnassignRequest. Exception is:\n" + e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessSDNCUnassignRequest Method:\n" + e.getMessage())
}
- msoLogger.trace("COMPLETED preProcessSDNCUnassignRequest Process")
+ logger.trace("COMPLETED preProcessSDNCUnassignRequest Process")
}
public String buildSDNCRequest(DelegateExecution execution, String svcInstId, String action){
@@ -342,7 +348,7 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{
</sdncadapterworkflow:SDNCRequestData>
</sdncadapterworkflow:SDNCAdapterWorkflowRequest>"""
- msoLogger.debug("sdncRequest: " + sdncRequest)
+ logger.debug("sdncRequest: " + sdncRequest)
return sdncRequest
}
@@ -383,7 +389,7 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{
</deleteVfModuleRequest>
""" as String
- msoLogger.debug("vnfAdapterRestV1Request: " + request)
+ logger.debug("vnfAdapterRestV1Request: " + request)
execution.setVariable("vnfAdapterRestV1Request", request)
}
@@ -400,7 +406,7 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{
<heat-stack-id>DELETE</heat-stack-id>
<orchestration-status>deleted</orchestration-status>
</UpdateAAIVfModuleRequest>""" as String
- msoLogger.debug("UpdateAAIVfModuleRequest :" + request)
+ logger.debug("UpdateAAIVfModuleRequest :" + request)
execution.setVariable("UpdateAAIVfModuleRequest", request)
}
@@ -417,7 +423,7 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{
<heat-stack-id></heat-stack-id>
<orchestration-status>Assigned</orchestration-status>
</UpdateAAIVfModuleRequest>""" as String
- msoLogger.debug("UpdateAAIVfModuleRequest :" + request)
+ logger.debug("UpdateAAIVfModuleRequest :" + request)
execution.setVariable("UpdateAAIVfModuleRequest", request)
}
@@ -432,7 +438,7 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{
<vnf-id>${MsoUtils.xmlEscape(vnfId)}</vnf-id>
<vf-module-id>${MsoUtils.xmlEscape(vfModuleId)}</vf-module-id>
</DeleteAAIVfModuleRequest>""" as String
- msoLogger.debug("DeleteAAIVfModuleRequest :" + request)
+ logger.debug("DeleteAAIVfModuleRequest :" + request)
execution.setVariable("DeleteAAIVfModuleRequest", request)
}
@@ -440,7 +446,9 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{
// -
public void handleDoDeleteVfModuleFailure(DelegateExecution execution) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "AAI error occurred deleting the Generic Vnf"+ execution.getVariable("DoDVfMod_deleteGenericVnfResponse"), "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "AAI error occurred deleting the Generic Vnf" + execution.getVariable("DoDVfMod_deleteGenericVnfResponse"),
+ "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
String processKey = getProcessKey(execution);
exceptionUtil.buildWorkflowException(execution, 5000, "Failure in DoDeleteVfModule")
@@ -457,7 +465,7 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{
sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator)
if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){
- msoLogger.debug("Successfully Validated SDNC Response")
+ logger.debug("Successfully Validated SDNC Response")
}else{
throw new BpmnError("MSOWorkflowException")
}
@@ -468,21 +476,21 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{
'execution=' + execution.getId() +
')'
def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
execution.setVariable("prefix", Prefix)
- msoLogger.trace("STARTED deleteNetworkPoliciesFromAAI")
+ logger.trace("STARTED deleteNetworkPoliciesFromAAI")
try {
// get variables
List fqdnList = execution.getVariable(Prefix + "createdNetworkPolicyFqdnList")
if (fqdnList == null) {
- msoLogger.debug("No network policies to delete")
+ logger.debug("No network policies to delete")
return
}
int fqdnCount = fqdnList.size()
execution.setVariable(Prefix + "networkPolicyFqdnCount", fqdnCount)
- msoLogger.debug("networkPolicyFqdnCount - " + fqdnCount)
+ logger.debug("networkPolicyFqdnCount - " + fqdnCount)
AaiUtil aaiUriUtil = new AaiUtil(this)
@@ -507,24 +515,24 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{
AAIResourceUri delUri = AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, networkPolicy.getNetworkPolicyId())
getAAIClient().delete(delUri)
execution.setVariable(Prefix + "aaiDeleteNetworkPolicyReturnCode", 200)
- msoLogger.debug("AAI delete network policy Response Code, NetworkPolicy #" + counting + " : " + 200)
- msoLogger.debug("The return code from deleting network policy is: " + 200)
+ logger.debug("AAI delete network policy Response Code, NetworkPolicy #" + counting + " : " + 200)
+ logger.debug("The return code from deleting network policy is: " + 200)
// This network policy was deleted from AAI successfully
- msoLogger.debug(" DelAAINetworkPolicy Success REST Response, , NetworkPolicy #" + counting + " : ")
+ logger.debug(" DelAAINetworkPolicy Success REST Response, , NetworkPolicy #" + counting + " : ")
}catch(NotFoundException ne){
// This network policy FQDN is not in AAI. No need to delete.
execution.setVariable(Prefix + "aaiDeleteNetworkPolicyReturnCode", 404)
- msoLogger.debug("The return code is: " + 404)
- msoLogger.debug("This network policy FQDN is not in AAI: " + fqdn)
+ logger.debug("The return code is: " + 404)
+ logger.debug("This network policy FQDN is not in AAI: " + fqdn)
}catch(Exception e){
// aai all errors
String delErrorMessage = "Unable to delete network-policy to AAI deleteNetworkPoliciesFromAAI - " + e.getMessage()
- msoLogger.debug(delErrorMessage)
+ logger.debug(delErrorMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, delErrorMessage)
}
} else {
// This network policy FQDN is not in AAI. No need to delete.
- msoLogger.debug("This network policy FQDN is not in AAI: " + fqdn)
+ logger.debug("This network policy FQDN is not in AAI: " + fqdn)
}
}catch (BpmnError e){
throw e
@@ -532,14 +540,14 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{
catch (Exception e) {
// aai all errors
String dataErrorMessage = "Unexpected Response from deleteNetworkPoliciesFromAAI - " + e.getMessage()
- msoLogger.debug(dataErrorMessage)
+ logger.debug(dataErrorMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage)
}
} // end loop
} else {
- msoLogger.debug("No contrail network policies to query/create")
+ logger.debug("No contrail network policies to query/create")
}
@@ -548,7 +556,7 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{
} catch (Exception ex) {
String exceptionMessage = "Bpmn error encountered in DoCreateVfModuleRollback flow. deleteNetworkPoliciesFromAAI() - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
@@ -565,7 +573,7 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{
'execution=' + execution.getId() +
')'
def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
try {
def vnfId = execution.getVariable('DCVFMR_vnfId')
@@ -592,14 +600,16 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{
"""
updateAAIGenericVnfRequest = utils.formatXml(updateAAIGenericVnfRequest)
execution.setVariable(Prefix + 'updateAAIGenericVnfRequest', updateAAIGenericVnfRequest)
- msoLogger.debug('Request for UpdateAAIGenericVnf:\n' + updateAAIGenericVnfRequest)
+ logger.debug('Request for UpdateAAIGenericVnf:\n' + updateAAIGenericVnfRequest)
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preProcessUpdateAAIGenericVnf((): ' + e.getMessage())
}
}
@@ -607,7 +617,7 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{
public void setSuccessfulRollbackStatus (DelegateExecution execution){
execution.setVariable("prefix", Prefix)
- msoLogger.trace("STARTED setSuccessfulRollbackStatus")
+ logger.trace("STARTED setSuccessfulRollbackStatus")
try{
// Set rolledBack to true, rollbackError to null
@@ -615,16 +625,18 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{
execution.setVariable("rollbackError", null)
}catch(Exception e){
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing setSuccessfulRollbackStatus.", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Occured Processing setSuccessfulRollbackStatus.", "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during setSuccessfulRollbackStatus Method:\n" + e.getMessage())
}
- msoLogger.trace("COMPLETED setSuccessfulRollbackStatus")
+ logger.trace("COMPLETED setSuccessfulRollbackStatus")
}
public void setFailedRollbackStatus (DelegateExecution execution){
execution.setVariable("prefix", Prefix)
- msoLogger.trace("STARTED setFailedRollbackStatus")
+ logger.trace("STARTED setFailedRollbackStatus")
try{
// Set rolledBack to false, rollbackError to actual value, rollbackData to null
@@ -633,9 +645,11 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{
execution.setVariable("rollbackData", null)
}catch(Exception e){
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing setFailedRollbackStatus.", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Occured Processing setFailedRollbackStatus.", "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during setFailedRollbackStatus Method:\n" + e.getMessage())
}
- msoLogger.trace("COMPLETED setFailedRollbackStatus")
+ logger.trace("COMPLETED setFailedRollbackStatus")
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeRollback.groovy
index f61d2b98e3..a233a0a02e 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeRollback.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeRollback.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -33,12 +35,13 @@ 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.constants.Defaults
-import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
import javax.ws.rs.NotFoundException
public class DoCreateVfModuleVolumeRollback extends AbstractServiceTaskProcessor {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCreateVfModuleVolumeRollback.class);
+ private static final Logger logger = LoggerFactory.getLogger( DoCreateVfModuleVolumeRollback.class);
String Prefix="DCVFMODVOLRBK_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
@@ -171,18 +174,18 @@ public class DoCreateVfModuleVolumeRollback extends AbstractServiceTaskProcessor
execution.setVariable("prefix",Prefix)
try{
- msoLogger.debug("Caught a Java Exception in " + Prefix)
- msoLogger.debug("Started processJavaException Method")
- msoLogger.debug("Variables List: " + execution.getVariables())
+ logger.debug("Caught a Java Exception in " + Prefix)
+ logger.debug("Started processJavaException Method")
+ logger.debug("Variables List: " + execution.getVariables())
execution.setVariable("UnexpectedError", "Caught a Java Lang Exception - " + Prefix) // Adding this line temporarily until this flows error handling gets updated
exceptionUtil.buildWorkflowException(execution, 500, "Caught a Java Lang Exception")
}catch(Exception e){
- msoLogger.debug("Caught Exception during processJavaException Method: " + e)
+ logger.debug("Caught Exception during processJavaException Method: " + e)
execution.setVariable("UnexpectedError", "Exception in processJavaException method - " + Prefix) // Adding this line temporarily until this flows error handling gets updated
exceptionUtil.buildWorkflowException(execution, 500, "Exception in processJavaException method" + Prefix)
}
- msoLogger.debug("Completed processJavaException Method in " + Prefix)
+ logger.debug("Completed processJavaException Method in " + Prefix)
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2.groovy
index 87f598db5d..b2006c45d7 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -40,13 +42,14 @@ import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.constants.Defaults
import org.onap.so.db.catalog.beans.OrchestrationStatus
-import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
import javax.ws.rs.NotFoundException
class DoCreateVfModuleVolumeV2 extends VfModuleBase {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCreateVfModuleVolumeV2.class)
+ private static final Logger logger = LoggerFactory.getLogger( DoCreateVfModuleVolumeV2.class);
String prefix='DCVFMODVOLV2_'
JsonUtils jsonUtil = new JsonUtils()
private ExceptionUtil exceptionUtil = new ExceptionUtil()
@@ -94,12 +97,12 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase {
//modelCustomizationUuid
def modelCustomizationUuid = jsonUtil.getJsonValue(vfModuleModelInfo, "modelCustomizationUuid")
execution.setVariable("modelCustomizationId", modelCustomizationUuid)
- msoLogger.debug("modelCustomizationId: " + modelCustomizationUuid)
+ logger.debug("modelCustomizationId: " + modelCustomizationUuid)
//modelName
def modelName = jsonUtil.getJsonValue(vfModuleModelInfo, "modelName")
execution.setVariable("modelName", modelName)
- msoLogger.debug("modelName: " + modelName)
+ logger.debug("modelName: " + modelName)
// The following is used on the get Generic Service Instance call
execution.setVariable('GENGS_type', 'service-instance')
@@ -116,11 +119,11 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase {
'vnfId', 'vnfName', 'tenantId', 'volumeGroupId', 'volumeGroupName', 'lcpCloudRegionId', 'vnfType', 'vfModuleModelInfo', 'asdcServiceModelVersion',
'test-volume-group-name', 'test-volume-group-id', 'vfModuleInputParams']
- msoLogger.debug('Begin input: ')
+ logger.debug('Begin input: ')
input.each {
- msoLogger.debug(it + ': ' + execution.getVariable(it))
+ logger.debug(it + ': ' + execution.getVariable(it))
}
- msoLogger.debug('End input.')
+ logger.debug('End input.')
}
@@ -158,7 +161,7 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase {
throw e
}catch (Exception ex){
String msg = "Exception in getServiceInstance. " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
(new ExceptionUtil()).buildAndThrowWorkflowException(execution, 2500, msg)
}
}
@@ -171,7 +174,7 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase {
public void callRESTQueryAAICloudRegion (DelegateExecution execution, isDebugEnabled) {
def cloudRegion = execution.getVariable("lcpCloudRegionId")
- msoLogger.debug('Request cloud region is: ' + cloudRegion)
+ logger.debug('Request cloud region is: ' + cloudRegion)
AaiUtil aaiUtil = new AaiUtil(this)
@@ -183,20 +186,20 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase {
def aaiCloudRegion = aaiUtil.getAAICloudReqion(execution, queryCloudRegionRequest, "AAI", cloudRegion)
if ((aaiCloudRegion != "ERROR")) {
execution.setVariable("lcpCloudRegionId", aaiCloudRegion)
- msoLogger.debug("AIC Cloud Region for AAI: " + aaiCloudRegion)
+ logger.debug("AIC Cloud Region for AAI: " + aaiCloudRegion)
} else {
String errorMessage = "AAI Query Cloud Region Unsuccessful. Return Code: " + execution.getVariable(prefix+"queryCloudRegionReturnCode")
- msoLogger.debug(errorMessage)
+ logger.debug(errorMessage)
(new ExceptionUtil()).buildAndThrowWorkflowException(execution, 2500, errorMessage)
}
def poCloudRegion = aaiUtil.getAAICloudReqion(execution, queryCloudRegionRequest, "PO", cloudRegion)
if ((poCloudRegion != "ERROR")) {
execution.setVariable("poLcpCloudRegionId", poCloudRegion)
- msoLogger.debug("AIC Cloud Region for PO: " + poCloudRegion)
+ logger.debug("AIC Cloud Region for PO: " + poCloudRegion)
} else {
String errorMessage = "AAI Query Cloud Region Unsuccessful. Return Code: " + execution.getVariable(prefix+"queryCloudRegionReturnCode")
- msoLogger.debug(errorMessage)
+ logger.debug(errorMessage)
(new ExceptionUtil()).buildAndThrowWorkflowException(execution, 2500, errorMessage)
}
@@ -222,7 +225,7 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase {
VolumeGroup volumeGroup = volumeGroups.get().getVolumeGroup().get(0);
execution.setVariable(prefix+'AaiReturnCode', 200)
execution.setVariable("queriedVolumeGroupId",volumeGroup.getVolumeGroupId())
- msoLogger.debug("Volume Group Name $volumeGroupName exists in AAI.")
+ logger.debug("Volume Group Name $volumeGroupName exists in AAI.")
}else{
execution.setVariable(prefix+'AaiReturnCode', 404)
exceptionUtil.buildAndThrowWorkflowException(execution,25000, "Volume Group Name $volumeGroupName does not exist in AAI.")
@@ -241,8 +244,8 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase {
* @param execution
* @param isDebugEnabled
*/
- public void buildWorkflowException(DelegateExecution execution, int errorCode, errorMessage, isDebugEnabled) {
- msoLogger.debug(errorMessage)
+ public void buildWorkflowException(DelegateExecution execution, int errorCode, errorMessage) {
+ logger.debug(errorMessage)
(new ExceptionUtil()).buildWorkflowException(execution, 2500, errorMessage)
}
@@ -279,7 +282,7 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase {
def testGroupId = execution.getVariable('test-volume-group-id')
if (testGroupId != null && testGroupId.trim() != '') {
- msoLogger.debug("test volumeGroupId is present: " + testGroupId)
+ logger.debug("test volumeGroupId is present: " + testGroupId)
volumeGroupId = testGroupId
execution.setVariable("test-volume-group-name", "MSOTESTVOL101a-vSAMP12_base_vol_module-0")
}
@@ -291,7 +294,7 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase {
volumeGroup.setOrchestrationStatus(OrchestrationStatus.PENDING.toString())
volumeGroup.setModelCustomizationId(modelCustomizationId)
- msoLogger.debug("volumeGroupId to be used: " + volumeGroupId)
+ logger.debug("volumeGroupId to be used: " + volumeGroupId)
AAIResourceUri volumeGroupUri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, cloudOwner, cloudRegion, volumeGroupId)
AAIResourceUri tenantUri = AAIUriFactory.createResourceUri(AAIObjectType.TENANT, cloudOwner, cloudRegion, tenantId)
@@ -336,14 +339,14 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase {
def modelCustomizationId = execution.getVariable("modelCustomizationId")
// for testing
- msoLogger.debug("volumeGroupId: " + volumeGroupId)
+ logger.debug("volumeGroupId: " + volumeGroupId)
def testGroupId = execution.getVariable('test-volume-group-id')
if (testGroupId != null && testGroupId.trim() != '') {
- msoLogger.debug("test volumeGroupId is present: " + testGroupId)
+ logger.debug("test volumeGroupId is present: " + testGroupId)
volumeGroupId = testGroupId
execution.setVariable("test-volume-group-name", "MSOTESTVOL101a-vSAMP12_base_vol_module-0")
}
- msoLogger.debug("volumeGroupId to be used: " + volumeGroupId)
+ logger.debug("volumeGroupId to be used: " + volumeGroupId)
// volume group parameters
@@ -364,10 +367,10 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase {
}
volumeGroupParams = sbParams.toString()
- msoLogger.debug("volumeGroupParams: "+ volumeGroupParams)
+ logger.debug("volumeGroupParams: "+ volumeGroupParams)
def backoutOnFailure = execution.getVariable(prefix+"backoutOnFailure")
- msoLogger.debug("backoutOnFailure: "+ backoutOnFailure)
+ logger.debug("backoutOnFailure: "+ backoutOnFailure)
def failIfExists = execution.getVariable("failIfExists")
if(failIfExists == null) {
@@ -375,14 +378,14 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase {
}
String messageId = UUID.randomUUID()
- msoLogger.debug("messageId to be used is generated: " + messageId)
+ logger.debug("messageId to be used is generated: " + messageId)
def notificationUrl = createCallbackURL(execution, "VNFAResponse", messageId)
def useQualifiedHostName = UrnPropertiesReader.getVariable("mso.use.qualified.host",execution)
if ('true'.equals(useQualifiedHostName)) {
notificationUrl = utils.getQualifiedHostNameForCallback(notificationUrl)
}
- msoLogger.debug("CreateVfModuleVolume - notificationUrl: "+ notificationUrl)
+ logger.debug("CreateVfModuleVolume - notificationUrl: "+ notificationUrl)
// build request
String vnfSubCreateWorkflowRequest =
@@ -430,14 +433,14 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase {
"""
String vnfSubCreateWorkflowRequestAsString = utils.formatXml(vnfSubCreateWorkflowRequest)
- msoLogger.debug(vnfSubCreateWorkflowRequestAsString)
- msoLogger.debug(vnfSubCreateWorkflowRequestAsString)
+ logger.debug(vnfSubCreateWorkflowRequestAsString)
+ logger.debug(vnfSubCreateWorkflowRequestAsString)
execution.setVariable(prefix+"createVnfARequest", vnfSubCreateWorkflowRequestAsString)
// build rollback request for use later if needed
String vnfSubRollbackWorkflowRequest = buildRollbackVolumeGroupRequestXml(volumeGroupId, cloudSiteId, tenantId, requestId, serviceId, messageId, notificationUrl)
- msoLogger.debug("Sub Vnf flow rollback request: vnfSubRollbackWorkflowRequest " + "\n" + vnfSubRollbackWorkflowRequest)
+ logger.debug("Sub Vnf flow rollback request: vnfSubRollbackWorkflowRequest " + "\n" + vnfSubRollbackWorkflowRequest)
String vnfSubRollbackWorkflowRequestAsString = utils.formatXml(vnfSubRollbackWorkflowRequest)
execution.setVariable(prefix+"rollbackVnfARequest", vnfSubRollbackWorkflowRequestAsString)
@@ -478,13 +481,13 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase {
*/
public void validateVnfResponse(DelegateExecution execution, isDebugEnabled) {
def vnfSuccess = execution.getVariable('VNFREST_SuccessIndicator')
- msoLogger.debug("vnfAdapterSuccessIndicator: "+ vnfSuccess)
+ logger.debug("vnfAdapterSuccessIndicator: "+ vnfSuccess)
if(vnfSuccess==true) {
String createVnfAResponse = execution.getVariable(prefix+"createVnfAResponse")
String heatStackID = utils.getNodeText(createVnfAResponse, "volumeGroupStackId")
String vnfRollbackRequest = execution.getVariable(prefix+"rollbackVnfARequest")
String updatedVnfRollbackRequest = updateRollbackVolumeGroupRequestXml(vnfRollbackRequest, heatStackID)
- msoLogger.debug("vnfAdapter rollback request: "+ updatedVnfRollbackRequest)
+ logger.debug("vnfAdapter rollback request: "+ updatedVnfRollbackRequest)
RollbackData rollbackData = execution.getVariable("rollbackData")
rollbackData.put("DCVFMODULEVOL", "rollbackVnfARequest", updatedVnfRollbackRequest)
rollbackData.put("DCVFMODULEVOL", "isCreateVnfRollbackNeeded", "true")
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy
index deb0bffaf9..2c433863aa 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -41,6 +43,8 @@ import org.onap.so.bpmn.core.domain.VnfResource
import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.AAIResourcesClient
import org.onap.so.client.aai.entities.AAIResultWrapper
@@ -58,7 +62,7 @@ import org.json.JSONObject
*/
class DoCreateVnf extends AbstractServiceTaskProcessor {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCreateVnf.class);
+ private static final Logger logger = LoggerFactory.getLogger( DoCreateVnf.class);
String Prefix="DoCVNF_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtil = new JsonUtils()
@@ -76,7 +80,7 @@ class DoCreateVnf extends AbstractServiceTaskProcessor {
public void preProcessRequest(DelegateExecution execution) {
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix",Prefix)
- msoLogger.debug("STARTED DoCreateVnf PreProcessRequest Process")
+ logger.debug("STARTED DoCreateVnf PreProcessRequest Process")
// DISABLE SDNC INTERACTION FOR NOW
execution.setVariable("SDNCInteractionEnabled", false)
@@ -97,16 +101,16 @@ class DoCreateVnf extends AbstractServiceTaskProcessor {
String requestId = execution.getVariable("msoRequestId")
execution.setVariable("DoCVNF_requestId", requestId)
execution.setVariable("mso-request-id", requestId)
- msoLogger.debug("Incoming Request Id is: " + requestId)
+ logger.debug("Incoming Request Id is: " + requestId)
String serviceInstanceId = execution.getVariable("serviceInstanceId")
execution.setVariable("DoCVNF_serviceInstanceId", serviceInstanceId)
rollbackData.put("VNF", "serviceInstanceId", serviceInstanceId)
- msoLogger.debug("Incoming Service Instance Id is: " + serviceInstanceId)
+ logger.debug("Incoming Service Instance Id is: " + serviceInstanceId)
String vnfType = execution.getVariable("vnfType")
execution.setVariable("DoCVNF_vnfType", vnfType)
- msoLogger.debug("Incoming Vnf Type is: " + vnfType)
+ logger.debug("Incoming Vnf Type is: " + vnfType)
String vnfName = execution.getVariable("vnfName")
if (vnfName.equals("") || vnfName.equals("null")) {
@@ -119,70 +123,70 @@ class DoCreateVnf extends AbstractServiceTaskProcessor {
}
execution.setVariable("DoCVNF_vnfName", vnfName)
- msoLogger.debug("Incoming Vnf Name is: " + vnfName)
+ logger.debug("Incoming Vnf Name is: " + vnfName)
String serviceId = execution.getVariable("productFamilyId")
execution.setVariable("DoCVNF_serviceId", serviceId)
- msoLogger.debug("Incoming Service Id is: " + serviceId)
+ logger.debug("Incoming Service Id is: " + serviceId)
String source = "VID"
execution.setVariable("DoCVNF_source", source)
rollbackData.put("VNF", "source", source)
- msoLogger.debug("Incoming Source is: " + source)
+ logger.debug("Incoming Source is: " + source)
String suppressRollback = execution.getVariable("disableRollback")
execution.setVariable("DoCVNF_suppressRollback", suppressRollback)
- msoLogger.debug("Incoming Suppress Rollback is: " + suppressRollback)
+ logger.debug("Incoming Suppress Rollback is: " + suppressRollback)
String modelInvariantId = jsonUtil.getJsonValue(vnfModelInfo, "modelInvariantUuid")
execution.setVariable("DoCVNF_modelInvariantId", modelInvariantId)
- msoLogger.debug("Incoming Invariant Id is: " + modelInvariantId)
+ logger.debug("Incoming Invariant Id is: " + modelInvariantId)
String modelVersionId = jsonUtil.getJsonValue(vnfModelInfo, "modelUuid")
if (modelVersionId == null) {
modelVersionId = ""
}
execution.setVariable("DoCVNF_modelVersionId", modelVersionId)
- msoLogger.debug("Incoming Version Id is: " + modelVersionId)
+ logger.debug("Incoming Version Id is: " + modelVersionId)
String modelVersion = jsonUtil.getJsonValue(vnfModelInfo, "modelVersion")
execution.setVariable("DoCVNF_modelVersion", modelVersion)
- msoLogger.debug("Incoming Model Version is: " + modelVersion)
+ logger.debug("Incoming Model Version is: " + modelVersion)
String modelName = jsonUtil.getJsonValue(vnfModelInfo, "modelName")
execution.setVariable("DoCVNF_modelName", modelName)
- msoLogger.debug("Incoming Model Name is: " + modelName)
+ logger.debug("Incoming Model Name is: " + modelName)
String modelCustomizationId = jsonUtil.getJsonValue(vnfModelInfo, "modelCustomizationUuid")
if (modelCustomizationId == null) {
modelCustomizationId = ""
}
execution.setVariable("DoCVNF_modelCustomizationId", modelCustomizationId)
- msoLogger.debug("Incoming Model Customization Id is: " + modelCustomizationId)
+ logger.debug("Incoming Model Customization Id is: " + modelCustomizationId)
String cloudSiteId = execution.getVariable("lcpCloudRegionId")
execution.setVariable("DoCVNF_cloudSiteId", cloudSiteId)
rollbackData.put("VNF", "cloudSiteId", cloudSiteId)
- msoLogger.debug("Incoming Cloud Site Id is: " + cloudSiteId)
+ logger.debug("Incoming Cloud Site Id is: " + cloudSiteId)
String tenantId = execution.getVariable("tenantId")
execution.setVariable("DoCVNF_tenantId", tenantId)
rollbackData.put("VNF", "tenantId", tenantId)
- msoLogger.debug("Incoming Tenant Id is: " + tenantId)
+ logger.debug("Incoming Tenant Id is: " + tenantId)
String globalSubscriberId = execution.getVariable("globalSubscriberId")
if (globalSubscriberId == null) {
globalSubscriberId = ""
}
execution.setVariable("DoCVNF_globalSubscriberId", globalSubscriberId)
- msoLogger.debug("Incoming Global Subscriber Id is: " + globalSubscriberId)
+ logger.debug("Incoming Global Subscriber Id is: " + globalSubscriberId)
String sdncVersion = execution.getVariable("sdncVersion")
if (sdncVersion == null) {
sdncVersion = "1702"
}
execution.setVariable("DoCVNF_sdncVersion", sdncVersion)
- msoLogger.debug("Incoming Sdnc Version is: " + sdncVersion)
+ logger.debug("Incoming Sdnc Version is: " + sdncVersion)
//For Completion Handler & Fallout Handler
String requestInfo =
@@ -205,7 +209,7 @@ class DoCreateVnf extends AbstractServiceTaskProcessor {
vnfId = execution.getVariable("vnfId")
if (isBlank(vnfId)) {
vnfId = UUID.randomUUID().toString()
- msoLogger.debug("Generated Vnf Id is: " + vnfId)
+ logger.debug("Generated Vnf Id is: " + vnfId)
}
}
execution.setVariable("DoCVNF_vnfId", vnfId)
@@ -217,30 +221,31 @@ class DoCreateVnf extends AbstractServiceTaskProcessor {
String sdncCallbackUrl = (String) UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution)
if (sdncCallbackUrl == null || sdncCallbackUrl.trim().isEmpty()) {
def msg = 'Required variable \'mso.workflow.sdncadapter.callback\' is missing'
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError);
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
execution.setVariable("DoCVNF_sdncCallbackUrl", sdncCallbackUrl)
rollbackData.put("VNF", "sdncCallbackUrl", sdncCallbackUrl)
- msoLogger.debug("SDNC Callback URL is: " + sdncCallbackUrl)
+ logger.debug("SDNC Callback URL is: " + sdncCallbackUrl)
VnfResource vnfResource = (VnfResource) execution.getVariable((String)"vnfResourceDecomposition")
String nfRole = vnfResource.getNfRole()
execution.setVariable("DoCVNF_nfRole", nfRole)
- msoLogger.debug("NF Role is: " + nfRole)
+ logger.debug("NF Role is: " + nfRole)
String nfNamingCode = vnfResource.getNfNamingCode()
execution.setVariable("DoCVNF_nfNamingCode", nfNamingCode)
- msoLogger.debug("NF Naming Code is: " + nfNamingCode)
+ logger.debug("NF Naming Code is: " + nfNamingCode)
String nfType = vnfResource.getNfType()
execution.setVariable("DoCVNF_nfType", nfType)
- msoLogger.debug("NF Type is: " + nfType)
+ logger.debug("NF Type is: " + nfType)
String nfFunction = vnfResource.getNfFunction()
execution.setVariable("DoCVNF_nfFunction", nfFunction)
- msoLogger.debug("NF Function is: " + nfFunction)
+ logger.debug("NF Function is: " + nfFunction)
// Set Homing Info
try {
@@ -248,13 +253,13 @@ class DoCreateVnf extends AbstractServiceTaskProcessor {
if (homingInstance != null) {
execution.setVariable("DoCVNF_cloudSiteId", homingInstance.getCloudRegionId())
rollbackData.put("VNF", "cloudSiteId", homingInstance.getCloudRegionId())
- msoLogger.debug("Overwriting cloudSiteId with homing cloudSiteId: " +
+ logger.debug("Overwriting cloudSiteId with homing cloudSiteId: " +
homingInstance.getCloudRegionId())
}
} catch (Exception exception) {
- msoLogger.debug("Could not find homing information for service instance: " + serviceInstanceId +
+ logger.debug("Could not find homing information for service instance: " + serviceInstanceId +
"... continuing")
- msoLogger.debug("Could not find homing information for service instance error: " + exception)
+ logger.debug("Could not find homing information for service instance error: " + exception)
}
rollbackData.put("VNF", "rollbackSDNCAssign", "false")
@@ -264,14 +269,14 @@ class DoCreateVnf extends AbstractServiceTaskProcessor {
execution.setVariable("rollbackData", rollbackData)
}catch(BpmnError b){
- msoLogger.debug("Rethrowing MSOWorkflowException")
+ logger.debug("Rethrowing MSOWorkflowException")
throw b
}catch(Exception e){
- msoLogger.debug(" Error Occured in DoCreateVnf PreProcessRequest method!" + e.getMessage())
+ logger.debug(" Error Occured in DoCreateVnf PreProcessRequest method!" + e.getMessage())
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DoCreateVnf PreProcessRequest")
}
- msoLogger.trace("COMPLETED DoCreateVnf PreProcessRequest Process")
+ logger.trace("COMPLETED DoCreateVnf PreProcessRequest Process")
}
/**
@@ -298,7 +303,7 @@ class DoCreateVnf extends AbstractServiceTaskProcessor {
throw e;
}catch(Exception ex) {
String msg = "Exception in getServiceInstance. " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
}
@@ -313,14 +318,14 @@ class DoCreateVnf extends AbstractServiceTaskProcessor {
public void createGenericVnf (DelegateExecution execution) {
execution.setVariable("prefix",Prefix)
- msoLogger.trace("STARTED DoCreateVnf CreateGenericVnf Process")
+ logger.trace("STARTED DoCreateVnf CreateGenericVnf Process")
try {
//Get Vnf Info
String vnfId = getVariableEnforced(execution, "DoCVNF_vnfId")
String vnfName = getVariableEnforced(execution, "DoCVNF_vnfName")
if (vnfName == null) {
vnfName = "sdncGenerated"
- msoLogger.debug("Sending a dummy VNF name to AAI - the name will be generated by SDNC: " + vnfName)
+ logger.debug("Sending a dummy VNF name to AAI - the name will be generated by SDNC: " + vnfName)
}
String vnfType = getVariableEnforced(execution, "DoCVNF_vnfType")
String serviceId = getVariableEnforced(execution, "DoCVNF_serviceId")
@@ -363,17 +368,17 @@ class DoCreateVnf extends AbstractServiceTaskProcessor {
resourceClient.connect(uri, siUri)
}catch(Exception ex) {
- msoLogger.debug("Error Occured in DoCreateVnf CreateGenericVnf Process ", ex)
+ logger.debug("Error Occured in DoCreateVnf CreateGenericVnf Process ", ex)
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DoCreateVnf CreateGenericVnf Process")
}
- msoLogger.trace("COMPLETED DoCreateVnf CreateGenericVnf Process")
+ logger.trace("COMPLETED DoCreateVnf CreateGenericVnf Process")
}
public void postProcessCreateGenericVnf (DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix",Prefix)
- msoLogger.trace("STARTED DoCreateVnf PostProcessCreateGenericVnf Process")
+ logger.trace("STARTED DoCreateVnf PostProcessCreateGenericVnf Process")
try {
//Get Vnf Info
String vnfId = execution.getVariable("DoCVNF_vnfId")
@@ -382,20 +387,20 @@ class DoCreateVnf extends AbstractServiceTaskProcessor {
rollbackData.put("VNF", "rollbackVnfCreate", "true")
execution.setVariable("rollbackData", rollbackData)
}catch(Exception ex) {
- msoLogger.debug("Error Occured in DoCreateVnf PostProcessCreateGenericVnf Process " + ex.getMessage())
+ logger.debug("Error Occured in DoCreateVnf PostProcessCreateGenericVnf Process " + ex.getMessage())
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DoCreateVnf PostProcessCreateGenericVnf Process")
}
- msoLogger.trace("COMPLETED DoCreateVnf PostProcessCreateGenericVnf Process")
+ logger.trace("COMPLETED DoCreateVnf PostProcessCreateGenericVnf Process")
}
public void preProcessSDNCAssignRequest(DelegateExecution execution){
def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix", Prefix)
- msoLogger.trace("STARTED preProcessSDNCAssignRequest")
+ logger.trace("STARTED preProcessSDNCAssignRequest")
def vnfId = execution.getVariable("DoCVNF_vnfId")
def serviceInstanceId = execution.getVariable("DoCVNF_serviceInstanceId")
- msoLogger.debug("NEW VNF ID: " + vnfId)
+ logger.debug("NEW VNF ID: " + vnfId)
try{
//Build SDNC Request
@@ -404,13 +409,15 @@ class DoCreateVnf extends AbstractServiceTaskProcessor {
assignSDNCRequest = utils.formatXml(assignSDNCRequest)
execution.setVariable("DoCVNF_assignSDNCRequest", assignSDNCRequest)
- msoLogger.debug("Outgoing AssignSDNCRequest is: \n" + assignSDNCRequest)
+ logger.debug("Outgoing AssignSDNCRequest is: \n" + assignSDNCRequest)
}catch(Exception e){
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing preProcessSDNCAssignRequest" , "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e)
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Occured Processing preProcessSDNCAssignRequest", "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessSDNCAssignRequest Method:\n" + e.getMessage())
}
- msoLogger.trace("COMPLETED preProcessSDNCAssignRequest")
+ logger.trace("COMPLETED preProcessSDNCAssignRequest")
}
public void preProcessSDNCActivateRequest(DelegateExecution execution) {
@@ -418,9 +425,9 @@ class DoCreateVnf extends AbstractServiceTaskProcessor {
'execution=' + execution.getId() +
')'
def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
execution.setVariable("prefix", Prefix)
- msoLogger.trace("STARTED preProcessSDNCActivateRequest Process")
+ logger.trace("STARTED preProcessSDNCActivateRequest Process")
try{
String vnfId = execution.getVariable("DoCVNF_vnfId")
String serviceInstanceId = execution.getVariable("DoCVNF_serviceInstanceId")
@@ -428,13 +435,13 @@ class DoCreateVnf extends AbstractServiceTaskProcessor {
String activateSDNCRequest = buildSDNCRequest(execution, serviceInstanceId, "activate")
execution.setVariable("DoCVNF_activateSDNCRequest", activateSDNCRequest)
- msoLogger.debug("Outgoing CommitSDNCRequest is: \n" + activateSDNCRequest)
+ logger.debug("Outgoing CommitSDNCRequest is: \n" + activateSDNCRequest)
}catch(Exception e){
- msoLogger.debug("Exception Occured Processing preProcessSDNCActivateRequest. Exception is:\n" + e)
+ logger.debug("Exception Occured Processing preProcessSDNCActivateRequest. Exception is:\n" + e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessSDNCActivateRequest Method:\n" + e.getMessage())
}
- msoLogger.trace("COMPLETED preProcessSDNCActivateRequest Process")
+ logger.trace("COMPLETED preProcessSDNCActivateRequest Process")
}
public String buildSDNCRequest(DelegateExecution execution, String svcInstId, String action){
@@ -515,34 +522,34 @@ class DoCreateVnf extends AbstractServiceTaskProcessor {
</sdncadapterworkflow:SDNCRequestData>
</sdncadapterworkflow:SDNCAdapterWorkflowRequest>"""
- msoLogger.debug("sdncRequest: " + sdncRequest)
+ logger.debug("sdncRequest: " + sdncRequest)
return sdncRequest
}
public void validateSDNCResponse(DelegateExecution execution, String response, String method){
def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix",Prefix)
- msoLogger.debug("STARTED ValidateSDNCResponse Process")
+ logger.debug("STARTED ValidateSDNCResponse Process")
WorkflowException workflowException = execution.getVariable("WorkflowException")
boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator")
- msoLogger.debug("workflowException: " + workflowException)
+ logger.debug("workflowException: " + workflowException)
SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this)
sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator)
- msoLogger.debug("SDNCResponse: " + response)
+ logger.debug("SDNCResponse: " + response)
String sdncResponse = response
if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){
- msoLogger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + sdncResponse)
+ logger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + sdncResponse)
if(method.equals("get")){
String topologyGetResponse = execution.getVariable("DoCVNF_getSDNCAdapterResponse")
String data = utils.getNodeXml(topologyGetResponse, "response-data")
- msoLogger.debug("topologyGetResponseData: " + data)
+ logger.debug("topologyGetResponseData: " + data)
String vnfName = utils.getNodeText(data, "vnf-name")
- msoLogger.debug("vnfName received from SDNC: " + vnfName)
+ logger.debug("vnfName received from SDNC: " + vnfName)
execution.setVariable("vnfName", vnfName)
execution.setVariable("DoCVNF_vnfName", vnfName)
}
@@ -557,16 +564,16 @@ class DoCreateVnf extends AbstractServiceTaskProcessor {
}else{
- msoLogger.debug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.")
+ logger.debug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.")
throw new BpmnError("MSOWorkflowException")
}
- msoLogger.debug("COMPLETED ValidateSDNCResponse Process")
+ logger.debug("COMPLETED ValidateSDNCResponse Process")
}
public void preProcessSDNCGetRequest(DelegateExecution execution){
def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix", Prefix)
- msoLogger.trace("STARTED preProcessSDNCGetRequest Process")
+ logger.trace("STARTED preProcessSDNCGetRequest Process")
try{
def serviceInstanceId = execution.getVariable('DoCVNF_serviceInstanceId')
@@ -576,7 +583,7 @@ class DoCreateVnf extends AbstractServiceTaskProcessor {
}
def callbackUrl = execution.getVariable("DoCVFM_sdncCallbackUrl")
- msoLogger.debug("callbackUrl:" + callbackUrl)
+ logger.debug("callbackUrl:" + callbackUrl)
def vnfId = execution.getVariable('DCVFM_vnfId')
@@ -590,14 +597,14 @@ class DoCreateVnf extends AbstractServiceTaskProcessor {
// serviceOperation will be retrieved from "object-path" element
// in SDNC Assign Response for VNF
String response = execution.getVariable("DoCVNF_assignSDNCAdapterResponse")
- msoLogger.debug("DoCVNF_assignSDNCAdapterResponse is: \n" + response)
+ logger.debug("DoCVNF_assignSDNCAdapterResponse is: \n" + response)
String serviceOperation = ""
String data = utils.getNodeXml(response, "response-data")
- msoLogger.debug("responseData: " + data)
+ logger.debug("responseData: " + data)
serviceOperation = utils.getNodeText(data, "object-path")
- msoLogger.debug("VNF with sdncVersion of 1707 or later - service operation: " + serviceOperation)
+ logger.debug("VNF with sdncVersion of 1707 or later - service operation: " + serviceOperation)
//!!!! TEMPORARY WORKAROUND FOR SDNC REPLICATION ISSUE
@@ -620,13 +627,15 @@ class DoCreateVnf extends AbstractServiceTaskProcessor {
execution.setVariable("DoCVNF_getSDNCRequest", SDNCGetRequest)
- msoLogger.debug("Outgoing GetSDNCRequest is: \n" + SDNCGetRequest)
+ logger.debug("Outgoing GetSDNCRequest is: \n" + SDNCGetRequest)
}catch(Exception e){
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occurred Processing preProcessSDNCGetRequest. ", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Occurred Processing preProcessSDNCGetRequest. ", "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during prepareProvision Method:\n" + e.getMessage())
}
- msoLogger.trace("COMPLETED preProcessSDNCGetRequest Process")
+ logger.trace("COMPLETED preProcessSDNCGetRequest Process")
}
/**
@@ -639,11 +648,11 @@ class DoCreateVnf extends AbstractServiceTaskProcessor {
'execution=' + execution.getId() +
')'
def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
try {
def vnfId = execution.getVariable('DoCVNF_vnfId')
- msoLogger.debug("VNF ID: " + vnfId)
+ logger.debug("VNF ID: " + vnfId)
String updateAAIGenericVnfRequest = """
<UpdateAAIGenericVnfRequest>
@@ -653,14 +662,16 @@ class DoCreateVnf extends AbstractServiceTaskProcessor {
"""
updateAAIGenericVnfRequest = utils.formatXml(updateAAIGenericVnfRequest)
execution.setVariable('DoCVNF_updateAAIGenericVnfRequest', updateAAIGenericVnfRequest)
- msoLogger.debug('Request for UpdateAAIGenericVnf:\n' + updateAAIGenericVnfRequest)
+ logger.debug('Request for UpdateAAIGenericVnf:\n' + updateAAIGenericVnfRequest)
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Caught exception in " + method , "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Caught exception in " + method, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepUpdateAAIGenericVnf(): ' + e.getMessage())
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy
index 88e7b34dcd..4730462ac6 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -39,6 +41,8 @@ import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.onap.so.bpmn.infrastructure.aai.groovyflows.AAICreateResources;
import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
import org.onap.so.logger.MessageEnum
import static org.apache.commons.lang3.StringUtils.*;
@@ -51,7 +55,7 @@ import static org.apache.commons.lang3.StringUtils.*;
*/
class DoCreateVnfAndModules extends AbstractServiceTaskProcessor {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCreateVnfAndModules.class);
+ private static final Logger logger = LoggerFactory.getLogger( DoCreateVnfAndModules.class);
String Prefix="DCVAM_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtil = new JsonUtils()
@@ -67,7 +71,7 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor {
public void preProcessRequest(DelegateExecution execution) {
execution.setVariable("prefix",Prefix)
- msoLogger.trace("STARTED DoCreateVnfAndModules PreProcessRequest Process")
+ logger.trace("STARTED DoCreateVnfAndModules PreProcessRequest Process")
def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
setBasicDBAuthHeader(execution, isDebugLogEnabled)
@@ -81,46 +85,46 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor {
String requestId = execution.getVariable("msoRequestId")
execution.setVariable("requestId", requestId)
execution.setVariable("mso-request-id", requestId)
- msoLogger.debug("Incoming Request Id is: " + requestId)
+ logger.debug("Incoming Request Id is: " + requestId)
String serviceInstanceId = execution.getVariable("serviceInstanceId")
- msoLogger.debug("Incoming Service Instance Id is: " + serviceInstanceId)
+ logger.debug("Incoming Service Instance Id is: " + serviceInstanceId)
String vnfName = execution.getVariable("vnfName")
execution.setVariable("CREVI_vnfName", vnfName)
- msoLogger.debug("Incoming Vnf Name is: " + vnfName)
+ logger.debug("Incoming Vnf Name is: " + vnfName)
String productFamilyId = execution.getVariable("productFamilyId")
- msoLogger.debug("Incoming Product Family Id is: " + productFamilyId)
+ logger.debug("Incoming Product Family Id is: " + productFamilyId)
String source = "VID"
execution.setVariable("source", source)
- msoLogger.debug("Incoming Source is: " + source)
+ logger.debug("Incoming Source is: " + source)
String lcpCloudRegionId = execution.getVariable("lcpCloudRegionId")
- msoLogger.debug("Incoming LCP Cloud Region Id is: " + lcpCloudRegionId)
+ logger.debug("Incoming LCP Cloud Region Id is: " + lcpCloudRegionId)
String tenantId = execution.getVariable("tenantId")
- msoLogger.debug("Incoming Tenant Id is: " + tenantId)
+ logger.debug("Incoming Tenant Id is: " + tenantId)
String disableRollback = execution.getVariable("disableRollback")
- msoLogger.debug("Incoming Disable Rollback is: " + disableRollback)
+ logger.debug("Incoming Disable Rollback is: " + disableRollback)
String asdcServiceModelVersion = execution.getVariable("asdcServiceModelVersion")
- msoLogger.debug("Incoming asdcServiceModelVersion: " + asdcServiceModelVersion)
+ logger.debug("Incoming asdcServiceModelVersion: " + asdcServiceModelVersion)
String vnfId = execution.getVariable("testVnfId") // for junits
if(isBlank(vnfId)){
vnfId = execution.getVariable("vnfId")
if (isBlank(vnfId)) {
vnfId = UUID.randomUUID().toString()
- msoLogger.debug("Generated Vnf Id is: " + vnfId)
+ logger.debug("Generated Vnf Id is: " + vnfId)
}
}
execution.setVariable("vnfId", vnfId)
Map<String,String> vfModuleNames = execution.getVariable("vfModuleNames")
- msoLogger.debug("Incoming vfModuleNames: " + vfModuleNames)
+ logger.debug("Incoming vfModuleNames: " + vfModuleNames)
// Set aLaCarte to false
execution.setVariable("aLaCarte", false)
@@ -148,72 +152,72 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor {
}
if (longDelayMS > 0) {
- msoLogger.debug("Delaying workflow " + longDelayMS + "ms");
+ logger.debug("Delaying workflow " + longDelayMS + "ms");
sleep(longDelayMS)
}
}catch(BpmnError b){
- msoLogger.debug("Rethrowing MSOWorkflowException")
+ logger.debug("Rethrowing MSOWorkflowException")
throw b
}catch(Exception e){
- msoLogger.debug(" Error Occured in DoCreateVnfAndModules PreProcessRequest method!" + e.getMessage())
+ logger.debug(" Error Occured in DoCreateVnfAndModules PreProcessRequest method!" + e.getMessage())
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DoCreateVnf PreProcessRequest")
}
- msoLogger.trace("COMPLETED DoCreateVnfAndModules PreProcessRequest Process")
+ logger.trace("COMPLETED DoCreateVnfAndModules PreProcessRequest Process")
}
public void queryCatalogDB (DelegateExecution execution) {
execution.setVariable("prefix",Prefix)
- msoLogger.trace("STARTED DoCreateVnfAndModules QueryCatalogDB Process")
+ logger.trace("STARTED DoCreateVnfAndModules QueryCatalogDB Process")
try {
VnfResource vnf = null
// if serviceDecomposition is specified, get info from serviceDecomposition
ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
if (serviceDecomposition != null) {
- msoLogger.debug("Getting Catalog DB data from ServiceDecomposition object: " + serviceDecomposition.toJsonString())
+ logger.debug("Getting Catalog DB data from ServiceDecomposition object: " + serviceDecomposition.toJsonString())
List<VnfResource> vnfs = serviceDecomposition.getVnfResources()
- msoLogger.debug("Read vnfs")
+ logger.debug("Read vnfs")
if (vnfs == null) {
- msoLogger.debug("Error - vnfs are empty in serviceDecomposition object")
+ logger.debug("Error - vnfs are empty in serviceDecomposition object")
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DoCreateVnf queryCatalogDB, vnfs are empty")
}
vnf = vnfs[0]
String serviceModelName = serviceDecomposition.getModelInfo().getModelName()
vnf.constructVnfType(serviceModelName)
String vnfType = vnf.getVnfType()
- msoLogger.debug("Incoming Vnf Type is: " + vnfType)
+ logger.debug("Incoming Vnf Type is: " + vnfType)
execution.setVariable("vnfType", vnfType)
}
else {
//Get Vnf Info
String vnfModelInfo = execution.getVariable("vnfModelInfo")
- msoLogger.debug("vnfModelInfo: " + vnfModelInfo)
+ logger.debug("vnfModelInfo: " + vnfModelInfo)
String vnfModelCustomizationUuid = jsonUtil.getJsonValueForKey(vnfModelInfo, "modelCustomizationUuid")
if (vnfModelCustomizationUuid == null) {
vnfModelCustomizationUuid = ""
}
- msoLogger.debug("querying Catalog DB by vnfModelCustomizationUuid: " + vnfModelCustomizationUuid)
+ logger.debug("querying Catalog DB by vnfModelCustomizationUuid: " + vnfModelCustomizationUuid)
JSONArray vnfs = catalogDbUtils.getAllVnfsByVnfModelCustomizationUuid(execution,
vnfModelCustomizationUuid, "v1")
- msoLogger.debug("obtained VNF list")
+ logger.debug("obtained VNF list")
// Only one match here
JSONObject vnfObject = vnfs[0]
vnf = DecomposeJsonUtil.jsonToVnfResource(vnfObject.toString())
}
- msoLogger.debug("Read vnfResource")
+ logger.debug("Read vnfResource")
if (vnf == null) {
- msoLogger.debug("Error - vnf is empty in serviceDecomposition object")
+ logger.debug("Error - vnf is empty in serviceDecomposition object")
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DoCreateVnf queryCatalogDB, vnf is null")
}
execution.setVariable("vnfResourceDecomposition", vnf)
List<ModuleResource> vfModules = vnf.getAllVfModuleObjects()
- msoLogger.debug("Read vfModules")
+ logger.debug("Read vfModules")
if (vfModules == null) {
- msoLogger.debug("Error - vfModules are empty in serviceDecomposition object")
+ logger.debug("Error - vfModules are empty in serviceDecomposition object")
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DoCreateVnf queryCatalogDB, vf modules are empty")
}
@@ -221,7 +225,7 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor {
Map<String,String> vfModuleNames = execution.getVariable("vfModuleNames")
for (int i = 0; i < vfModules.size; i++) {
- msoLogger.debug("handling VF Module ")
+ logger.debug("handling VF Module ")
ModuleResource vfModule = vfModules[i]
boolean isBase = vfModule.getIsBase()
if (isBase) {
@@ -254,7 +258,7 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor {
execution.setVariable("addOnModulesDeployed", 0)
}catch(Exception ex) {
- msoLogger.debug("Error Occured in DoCreateVnfAndModules QueryCatalogDB Process " + ex.getMessage())
+ logger.debug("Error Occured in DoCreateVnfAndModules QueryCatalogDB Process " + ex.getMessage())
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DoCreateVnfAndModules QueryCatalogDB Process")
}
@@ -267,13 +271,13 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor {
execution.setVariable("vnfId", "skask")
}
- msoLogger.trace("COMPLETED DoCreateVnfAndModules QueryCatalogDB Process")
+ logger.trace("COMPLETED DoCreateVnfAndModules QueryCatalogDB Process")
}
public void preProcessAddOnModule(DelegateExecution execution){
execution.setVariable("prefix", Prefix)
- msoLogger.debug("STARTED preProcessAddOnModule")
+ logger.debug("STARTED preProcessAddOnModule")
try {
List<ModuleResource>addOnModules = execution.getVariable("addOnModules")
@@ -281,7 +285,7 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor {
ModuleResource addOnModule = addOnModules[addOnIndex]
- msoLogger.debug("Got addon module")
+ logger.debug("Got addon module")
def newVfModuleId = UUID.randomUUID().toString()
execution.setVariable("addOnVfModuleId", newVfModuleId)
@@ -304,32 +308,36 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor {
}catch(Exception e){
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing preProcessAddOnModule ", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Occured Processing preProcessAddOnModule ", "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessAddOnModule Method:\n" + e.getMessage())
}
- msoLogger.trace("COMPLETED preProcessAddOnModule")
+ logger.trace("COMPLETED preProcessAddOnModule")
}
public void postProcessAddOnModule(DelegateExecution execution){
execution.setVariable("prefix", Prefix)
- msoLogger.trace("STARTED postProcessAddOnModule")
+ logger.trace("STARTED postProcessAddOnModule")
try {
int addOnModulesDeployed = execution.getVariable("addOnModulesDeployed")
execution.setVariable("addOnModulesDeployed", addOnModulesDeployed + 1)
}catch(Exception e){
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing postProcessAddOnModule ", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Occured Processing postProcessAddOnModule ", "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during postProcessAddOnModule Method:\n" + e.getMessage())
}
- msoLogger.trace("COMPLETED postProcessAddOnModule")
+ logger.trace("COMPLETED postProcessAddOnModule")
}
public void validateBaseModule(DelegateExecution execution){
execution.setVariable("prefix", Prefix)
- msoLogger.trace("STARTED validateBaseModule")
+ logger.trace("STARTED validateBaseModule")
try {
def baseRollbackData = execution.getVariable("DCVAM_baseRollbackData")
@@ -338,26 +346,28 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor {
def baseModuleMap = baseRollbackData.get("VFMODULE")
baseModuleMap.each{ k, v -> rollbackData.put("VFMODULE_BASE", "${k}","${v}") }
execution.setVariable("rollbackData", rollbackData)
- msoLogger.debug("addOnModulesDeployed: " + execution.getVariable("addOnModulesDeployed"))
- msoLogger.debug("addOnModulesToDeploy: " + execution.getVariable("addOnModulesToDeploy"))
+ logger.debug("addOnModulesDeployed: " + execution.getVariable("addOnModulesDeployed"))
+ logger.debug("addOnModulesToDeploy: " + execution.getVariable("addOnModulesToDeploy"))
if (execution.getVariable("addOnModulesDeployed") < execution.getVariable("addOnModulesToDeploy")) {
- msoLogger.debug("More add on modules to deploy")
+ logger.debug("More add on modules to deploy")
}
else {
- msoLogger.debug("No more add on modules to deploy")
+ logger.debug("No more add on modules to deploy")
}
}catch(Exception e){
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing validateBaseModule ", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Occured Processing validateBaseModule ", "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during validateBaseModule Method:\n" + e.getMessage())
}
- msoLogger.trace("COMPLETED validateBaseModule")
+ logger.trace("COMPLETED validateBaseModule")
}
public void validateAddOnModule(DelegateExecution execution){
execution.setVariable("prefix", Prefix)
- msoLogger.trace("STARTED validateAddOnModule")
+ logger.trace("STARTED validateAddOnModule")
try {
int instancesOfThisModuleDeployed = execution.getVariable("instancesOfThisModuleDeployed")
@@ -377,102 +387,104 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor {
rollbackData.put("VNFANDMODULES", "numOfCreatedAddOnModules", "${numOfCreatedAddOnModules}")
execution.setVariable("rollbackData", rollbackData)
}catch(Exception e){
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing preProcessAddOnModule ", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Occured Processing preProcessAddOnModule ", "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessAddOnModule Method:\n" + e.getMessage())
}
- msoLogger.trace("COMPLETED validateAddOnModule")
+ logger.trace("COMPLETED validateAddOnModule")
}
public void preProcessRollback (DelegateExecution execution) {
- msoLogger.trace("preProcessRollback")
+ logger.trace("preProcessRollback")
try {
Object workflowException = execution.getVariable("WorkflowException");
if (workflowException instanceof WorkflowException) {
- msoLogger.debug("Prev workflowException: " + workflowException.getErrorMessage())
+ logger.debug("Prev workflowException: " + workflowException.getErrorMessage())
execution.setVariable("prevWorkflowException", workflowException);
//execution.setVariable("WorkflowException", null);
}
} catch (BpmnError e) {
- msoLogger.debug("BPMN Error during preProcessRollback")
+ logger.debug("BPMN Error during preProcessRollback")
} catch(Exception ex) {
String msg = "Exception in preProcessRollback. " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
}
- msoLogger.trace("Exit preProcessRollback")
+ logger.trace("Exit preProcessRollback")
}
public void postProcessRollback (DelegateExecution execution) {
- msoLogger.trace("postProcessRollback")
+ logger.trace("postProcessRollback")
String msg = ""
try {
Object workflowException = execution.getVariable("prevWorkflowException");
if (workflowException instanceof WorkflowException) {
- msoLogger.debug("Setting prevException to WorkflowException: ")
+ logger.debug("Setting prevException to WorkflowException: ")
execution.setVariable("WorkflowException", workflowException);
}
execution.setVariable("rollbackData", null)
} catch (BpmnError b) {
- msoLogger.debug("BPMN Error during postProcessRollback")
+ logger.debug("BPMN Error during postProcessRollback")
throw b;
} catch(Exception ex) {
msg = "Exception in postProcessRollback. " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
}
- msoLogger.trace("Exit postProcessRollback")
+ logger.trace("Exit postProcessRollback")
}
public void createPlatform (DelegateExecution execution) {
- msoLogger.trace("START createPlatform")
+ logger.trace("START createPlatform")
String platformName = execution.getVariable("platformName")
String vnfId = execution.getVariable("vnfId")
- msoLogger.debug("Platform NAME: " + platformName)
- msoLogger.debug("VnfID: " + vnfId)
+ logger.debug("Platform NAME: " + platformName)
+ logger.debug("VnfID: " + vnfId)
if(isBlank(platformName)){
- msoLogger.debug("platformName was not found. Continuing on with flow...")
+ logger.debug("platformName was not found. Continuing on with flow...")
}else{
- msoLogger.debug("platformName was found.")
+ logger.debug("platformName was found.")
try{
AAICreateResources aaiCR = new AAICreateResources()
aaiCR.createAAIPlatform(platformName, vnfId)
}catch(Exception ex){
String msg = "Exception in createPlatform. " + ex.getMessage();
- msoLogger.debug(msg)
+ logger.debug(msg)
}
}
- msoLogger.trace("Exit createPlatform")
+ logger.trace("Exit createPlatform")
}
public void createLineOfBusiness (DelegateExecution execution) {
- msoLogger.trace("START createLineOfBusiness")
+ logger.trace("START createLineOfBusiness")
String lineOfBusiness = execution.getVariable("lineOfBusiness")
String vnfId = execution.getVariable("vnfId")
- msoLogger.debug("LineOfBusiness NAME: " + lineOfBusiness)
- msoLogger.debug("VnfID: " + vnfId)
+ logger.debug("LineOfBusiness NAME: " + lineOfBusiness)
+ logger.debug("VnfID: " + vnfId)
if(isBlank(lineOfBusiness)){
- msoLogger.debug("LineOfBusiness was not found. Continuing on with flow...")
+ logger.debug("LineOfBusiness was not found. Continuing on with flow...")
}else{
- msoLogger.debug("LineOfBusiness was found.")
+ logger.debug("LineOfBusiness was found.")
try{
AAICreateResources aaiCR = new AAICreateResources()
aaiCR.createAAILineOfBusiness(lineOfBusiness, vnfId)
}catch(Exception ex){
String msg = "Exception in LineOfBusiness. " + ex.getMessage();
- msoLogger.debug(msg)
+ logger.debug(msg)
}
}
- msoLogger.trace("Exit createLineOfBusiness")
+ logger.trace("Exit createLineOfBusiness")
}
public String getPredefinedVfModuleName(DelegateExecution execution, String vfModuleModelInvariantUuid) {
@@ -485,7 +497,7 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor {
String vfModuleName = vfModuleNames.get(vfModuleModelInvariantUuid)
if (vfModuleName != null) {
- msoLogger.debug("Using vfModuleName='" + vfModuleName + "' for vfModuleModelInvariantUuid=" + vfModuleModelInvariantUuid)
+ logger.debug("Using vfModuleName='" + vfModuleName + "' for vfModuleModelInvariantUuid=" + vfModuleModelInvariantUuid)
}
return vfModuleName
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModulesRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModulesRollback.groovy
index eafc39b1dd..2de7314a98 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModulesRollback.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModulesRollback.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -33,6 +35,8 @@ import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
/**
* This class supports the macro VID Flow
@@ -40,7 +44,7 @@ import org.onap.so.logger.MsoLogger
*/
class DoCreateVnfAndModulesRollback extends AbstractServiceTaskProcessor {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCreateVnfAndModulesRollback.class);
+ private static final Logger logger = LoggerFactory.getLogger( DoCreateVnfAndModulesRollback.class);
String Prefix="DCVAMR_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtil = new JsonUtils()
@@ -56,13 +60,13 @@ class DoCreateVnfAndModulesRollback extends AbstractServiceTaskProcessor {
public void preProcessRequest(DelegateExecution execution) {
execution.setVariable("prefix",Prefix)
- msoLogger.debug("STARTED DoCreateVnfAndModulesRollback PreProcessRequest Process")
+ logger.debug("STARTED DoCreateVnfAndModulesRollback PreProcessRequest Process")
try{
// Get Rollback Variables
def rollbackData = execution.getVariable("rollbackData")
- msoLogger.debug("Incoming RollbackData is: " + rollbackData.toString())
+ logger.debug("Incoming RollbackData is: " + rollbackData.toString())
execution.setVariable("rolledBack", null)
execution.setVariable("rollbackError", null)
@@ -72,7 +76,7 @@ class DoCreateVnfAndModulesRollback extends AbstractServiceTaskProcessor {
}
String vnfId = rollbackData.get("VNF", "vnfId")
- msoLogger.debug("Rollback vnfId is: " + vnfId)
+ logger.debug("Rollback vnfId is: " + vnfId)
execution.setVariable("DCVAMR_vnfId", vnfId)
execution.setVariable("mso-request-id", execution.getVariable("msoRequestId"))
@@ -82,23 +86,23 @@ class DoCreateVnfAndModulesRollback extends AbstractServiceTaskProcessor {
execution.setVariable("DCVAMR_rollbackVnfCreate", rollbackData.get("VNF", "rollbackVnfCreate"))
String sdncCallbackUrl = rollbackData.get("VNF", "sdncCallbackUrl")
- msoLogger.debug("Rollback sdncCallbackUrl is: " + sdncCallbackUrl)
+ logger.debug("Rollback sdncCallbackUrl is: " + sdncCallbackUrl)
execution.setVariable("DCVAMR_sdncCallbackUrl", sdncCallbackUrl)
String tenantId= rollbackData.get("VNF", "tenantId")
- msoLogger.debug("Rollback tenantId is: " + tenantId)
+ logger.debug("Rollback tenantId is: " + tenantId)
execution.setVariable("DCVAMR_tenantId", tenantId)
String source= rollbackData.get("VNF", "source")
- msoLogger.debug("Rollback source is: " + source)
+ logger.debug("Rollback source is: " + source)
execution.setVariable("DCVAMR_source", source)
String serviceInstanceId = rollbackData.get("VNF", "serviceInstanceId")
- msoLogger.debug("Rollback serviceInstanceId is: " + serviceInstanceId)
+ logger.debug("Rollback serviceInstanceId is: " + serviceInstanceId)
execution.setVariable("DCVAMR_serviceInstanceId", serviceInstanceId)
String cloudSiteId = rollbackData.get("VNF", "cloudSiteId")
- msoLogger.debug("Rollback cloudSiteId is: " + cloudSiteId)
+ logger.debug("Rollback cloudSiteId is: " + cloudSiteId)
execution.setVariable("DCVAMR_cloudSiteId", cloudSiteId)
def numOfAddOnModulesString = rollbackData.get("VNFANDMODULES", "numOfCreatedAddOnModules")
@@ -121,14 +125,14 @@ class DoCreateVnfAndModulesRollback extends AbstractServiceTaskProcessor {
execution.setVariable("DCVAMR_aLaCarte", false)
}catch(BpmnError b){
- msoLogger.debug("Rethrowing MSOWorkflowException")
+ logger.debug("Rethrowing MSOWorkflowException")
throw b
}catch(Exception e){
- msoLogger.debug(" Error Occured in DoCreateVnfAndModulesRollback PreProcessRequest method!" + e.getMessage())
+ logger.debug(" Error Occured in DoCreateVnfAndModulesRollback PreProcessRequest method!" + e.getMessage())
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DoCreateVnfAndModulesRollback PreProcessRequest")
}
- msoLogger.trace("COMPLETED DoCreateVnfAndModulesRollback PreProcessRequest Process")
+ logger.trace("COMPLETED DoCreateVnfAndModulesRollback PreProcessRequest Process")
}
@@ -136,7 +140,7 @@ class DoCreateVnfAndModulesRollback extends AbstractServiceTaskProcessor {
public void preProcessCreateVfModuleRollback(DelegateExecution execution){
execution.setVariable("prefix", Prefix)
- msoLogger.trace("STARTED preProcessCreateVfModuleRollback")
+ logger.trace("STARTED preProcessCreateVfModuleRollback")
try {
@@ -145,33 +149,35 @@ class DoCreateVnfAndModulesRollback extends AbstractServiceTaskProcessor {
def vfModuleRollbackData = new RollbackData()
def numOfModulesToDelete = execution.getVariable("DCVAMR_numOfModulesToDelete")
- msoLogger.debug("numOfModulesToDelete: " + numOfModulesToDelete)
+ logger.debug("numOfModulesToDelete: " + numOfModulesToDelete)
def moduleMap = null
if (numOfModulesToDelete > 1) {
int addOnModuleIndex = numOfModulesToDelete - 1
moduleMap = rollbackData.get("VFMODULE_ADDON_" + addOnModuleIndex)
- msoLogger.debug("Removing ADDON VF module # " + addOnModuleIndex)
+ logger.debug("Removing ADDON VF module # " + addOnModuleIndex)
}
else {
moduleMap = rollbackData.get("VFMODULE_BASE")
- msoLogger.debug("Removing BASE VF module")
+ logger.debug("Removing BASE VF module")
}
moduleMap.each{ k, v -> vfModuleRollbackData.put("VFMODULE", "${k}","${v}") }
execution.setVariable("DCVAMR_RollbackData", vfModuleRollbackData)
}catch(Exception e){
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing preProcessCreateVfModuleRollback ", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Occured Processing preProcessCreateVfModuleRollback ", "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessCreateVfModuleRollback Method:\n" + e.getMessage())
}
- msoLogger.trace("COMPLETED preProcessCreateVfModuleRollback")
+ logger.trace("COMPLETED preProcessCreateVfModuleRollback")
}
public void postProcessCreateVfModuleRollback(DelegateExecution execution){
execution.setVariable("prefix", Prefix)
- msoLogger.trace("STARTED postProcessCreateVfModuleRollback")
+ logger.trace("STARTED postProcessCreateVfModuleRollback")
def rolledBack = false
try {
@@ -179,22 +185,26 @@ class DoCreateVnfAndModulesRollback extends AbstractServiceTaskProcessor {
def numOfModulesToDelete = execution.getVariable("DCVAMR_numOfModulesToDelete")
execution.setVariable("DCVAMR_numOfModulesToDelete", numOfModulesToDelete - 1)
}catch(Exception e){
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing postProcessCreateVfModuleRollback ", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Occured Processing postProcessCreateVfModuleRollback ", "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during postProcessCreateVfModuleRollback Method:\n" + e.getMessage())
}
if (rolledBack == false) {
- msoLogger.debug("Failure on DoCreateVfModuleRollback")
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Unsuccessful rollback of DoCreateVfModule ", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError);
+ logger.debug("Failure on DoCreateVfModuleRollback")
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Unsuccessful rollback of DoCreateVfModule ", "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during rollback of DoCreateVfModule")
}
- msoLogger.trace("COMPLETED postProcessCreateVfModuleRollback")
+ logger.trace("COMPLETED postProcessCreateVfModuleRollback")
}
public void preProcessSDNCDeactivateRequest(DelegateExecution execution){
execution.setVariable("prefix", Prefix)
- msoLogger.trace("STARTED preProcessSDNCDeactivateRequest")
+ logger.trace("STARTED preProcessSDNCDeactivateRequest")
def vnfId = execution.getVariable("vnfId")
def serviceInstanceId = execution.getVariable("serviceInstanceId")
@@ -205,13 +215,15 @@ class DoCreateVnfAndModulesRollback extends AbstractServiceTaskProcessor {
deactivateSDNCRequest = utils.formatXml(deactivateSDNCRequest)
execution.setVariable(Prefix + "deactivateSDNCRequest", deactivateSDNCRequest)
- msoLogger.debug("Outgoing DeactivateSDNCRequest is: \n" + deactivateSDNCRequest)
+ logger.debug("Outgoing DeactivateSDNCRequest is: \n" + deactivateSDNCRequest)
}catch(Exception e){
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing preProcessSDNCDeactivateRequest ", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Occured Processing preProcessSDNCDeactivateRequest ", "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessSDNCDeactivateRequest Method:\n" + e.getMessage())
}
- msoLogger.trace("COMPLETED preProcessSDNCDeactivateRequest")
+ logger.trace("COMPLETED preProcessSDNCDeactivateRequest")
}
public void preProcessSDNCUnassignRequest(DelegateExecution execution) {
@@ -219,9 +231,9 @@ class DoCreateVnfAndModulesRollback extends AbstractServiceTaskProcessor {
'execution=' + execution.getId() +
')'
def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
execution.setVariable("prefix", Prefix)
- msoLogger.trace("STARTED preProcessSDNCUnassignRequest Process")
+ logger.trace("STARTED preProcessSDNCUnassignRequest Process")
try{
String vnfId = execution.getVariable("vnfId")
String serviceInstanceId = execution.getVariable("serviceInstanceId")
@@ -229,13 +241,13 @@ class DoCreateVnfAndModulesRollback extends AbstractServiceTaskProcessor {
String unassignSDNCRequest = buildSDNCRequest(execution, serviceInstanceId, "unassign")
execution.setVariable(Prefix + "unassignSDNCRequest", unassignSDNCRequest)
- msoLogger.debug("Outgoing UnassignSDNCRequest is: \n" + unassignSDNCRequest)
+ logger.debug("Outgoing UnassignSDNCRequest is: \n" + unassignSDNCRequest)
}catch(Exception e){
- msoLogger.debug("Exception Occured Processing preProcessSDNCUnassignRequest. Exception is:\n" + e)
+ logger.debug("Exception Occured Processing preProcessSDNCUnassignRequest. Exception is:\n" + e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessSDNCUnassignRequest Method:\n" + e.getMessage())
}
- msoLogger.trace("COMPLETED preProcessSDNCUnassignRequest Process")
+ logger.trace("COMPLETED preProcessSDNCUnassignRequest Process")
}
public String buildSDNCRequest(DelegateExecution execution, String svcInstId, String action){
@@ -291,37 +303,37 @@ class DoCreateVnfAndModulesRollback extends AbstractServiceTaskProcessor {
</sdncadapterworkflow:SDNCRequestData>
</sdncadapterworkflow:SDNCAdapterWorkflowRequest>"""
- msoLogger.debug("sdncRequest: " + sdncRequest)
+ logger.debug("sdncRequest: " + sdncRequest)
return sdncRequest
}
public void validateSDNCResponse(DelegateExecution execution, String response, String method){
execution.setVariable("prefix",Prefix)
- msoLogger.debug("STARTED ValidateSDNCResponse Process")
+ logger.debug("STARTED ValidateSDNCResponse Process")
WorkflowException workflowException = execution.getVariable("WorkflowException")
boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator")
- msoLogger.debug("workflowException: " + workflowException)
+ logger.debug("workflowException: " + workflowException)
SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this)
sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator)
String sdncResponse = response
if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){
- msoLogger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + sdncResponse)
+ logger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + sdncResponse)
}else{
- msoLogger.debug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.")
+ logger.debug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.")
throw new BpmnError("MSOWorkflowException")
}
- msoLogger.debug("COMPLETED ValidateSDNCResponse Process")
+ logger.debug("COMPLETED ValidateSDNCResponse Process")
}
public void setSuccessfulRollbackStatus (DelegateExecution execution){
execution.setVariable("prefix", Prefix)
- msoLogger.trace("STARTED setSuccessfulRollbackStatus")
+ logger.trace("STARTED setSuccessfulRollbackStatus")
try{
// Set rolledBack to true, rollbackError to null
@@ -329,16 +341,16 @@ class DoCreateVnfAndModulesRollback extends AbstractServiceTaskProcessor {
execution.setVariable("rollbackError", null)
}catch(Exception e){
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing setSuccessfulRollbackStatus ", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing setSuccessfulRollbackStatus ", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during setSuccessfulRollbackStatus Method:\n" + e.getMessage())
}
- msoLogger.trace("COMPLETED setSuccessfulRollbackStatus")
+ logger.trace("COMPLETED setSuccessfulRollbackStatus")
}
public void setFailedRollbackStatus (DelegateExecution execution){
execution.setVariable("prefix", Prefix)
- msoLogger.trace("STARTED setFailedRollbackStatus")
+ logger.trace("STARTED setFailedRollbackStatus")
try{
// Set rolledBack to false, rollbackError to actual value, rollbackData to null
@@ -350,10 +362,10 @@ class DoCreateVnfAndModulesRollback extends AbstractServiceTaskProcessor {
execution.setVariable("rollbackData", null)
}catch(Exception e){
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing setFailedRollbackStatus. ", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing setFailedRollbackStatus. ", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during setFailedRollbackStatus Method:\n" + e.getMessage())
}
- msoLogger.trace("COMPLETED setFailedRollbackStatus")
+ logger.trace("COMPLETED setFailedRollbackStatus")
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy
index b30929d6bd..5b83ca6641 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy
@@ -5,6 +5,8 @@
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* Copyright (C) 2017 Huawei Technologies Co., Ltd. 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
@@ -38,6 +40,8 @@ import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
import org.springframework.web.util.UriUtils;
import org.w3c.dom.Document
import org.w3c.dom.Element
@@ -73,7 +77,7 @@ import groovy.json.*
* Rollback - Deferred
*/
public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCustomDeleteE2EServiceInstance.class);
+ private static final Logger logger = LoggerFactory.getLogger( DoCustomDeleteE2EServiceInstance.class);
String Prefix="DDELSI_"
@@ -81,7 +85,7 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess
JsonUtils jsonUtil = new JsonUtils()
public void preProcessRequest (DelegateExecution execution) {
- msoLogger.trace("preProcessRequest ")
+ logger.trace("preProcessRequest ")
String msg = ""
try {
@@ -107,18 +111,18 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess
String serviceInstanceId = execution.getVariable("serviceInstanceId")
if (isBlank(serviceInstanceId)){
msg = "Input serviceInstanceId is null"
- msoLogger.info(msg)
+ logger.info(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
}
String sdncCallbackUrl = UrnPropertiesReader.getVariable('mso.workflow.sdncadapter.callback',execution)
if (isBlank(sdncCallbackUrl)) {
msg = "URN_mso_workflow_sdncadapter_callback is null"
- msoLogger.info(msg)
+ logger.info(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
}
execution.setVariable("sdncCallbackUrl", sdncCallbackUrl)
- msoLogger.info("SDNC Callback URL: " + sdncCallbackUrl)
+ logger.info("SDNC Callback URL: " + sdncCallbackUrl)
StringBuilder sbParams = new StringBuilder()
Map<String, String> paramsMap = execution.getVariable("serviceInputParams")
@@ -148,10 +152,10 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess
throw e;
} catch (Exception ex){
msg = "Exception in preProcessRequest " + ex.getMessage()
- msoLogger.info(msg)
+ logger.info(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("Exit preProcessRequest ")
+ logger.trace("Exit preProcessRequest ")
}
@@ -162,7 +166,7 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess
}
public void preProcessSDNCDelete (DelegateExecution execution) {
- msoLogger.trace("preProcessSDNCDelete ")
+ logger.trace("preProcessSDNCDelete ")
String msg = ""
try {
@@ -261,52 +265,52 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess
String sdncDeactivate = sdncDelete.replace(">delete<", ">deactivate<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<")
execution.setVariable("sdncDelete", sdncDelete)
execution.setVariable("sdncDeactivate", sdncDeactivate)
- msoLogger.info("sdncDeactivate:\n" + sdncDeactivate)
- msoLogger.info("sdncDelete:\n" + sdncDelete)
+ logger.info("sdncDeactivate:\n" + sdncDeactivate)
+ logger.info("sdncDelete:\n" + sdncDelete)
} catch (BpmnError e) {
throw e;
} catch(Exception ex) {
msg = "Exception in preProcessSDNCDelete. " + ex.getMessage()
- msoLogger.info(msg)
+ logger.info(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Exception Occured in preProcessSDNCDelete.\n" + ex.getMessage())
}
- msoLogger.info(" *****Exit preProcessSDNCDelete *****")
+ logger.info(" *****Exit preProcessSDNCDelete *****")
}
public void postProcessSDNCDelete(DelegateExecution execution, String response, String method) {
- msoLogger.trace("postProcessSDNC " + method + " ")
+ logger.trace("postProcessSDNC " + method + " ")
String msg = ""
/*try {
WorkflowException workflowException = execution.getVariable("WorkflowException")
boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator")
- msoLogger.info("SDNCResponse: " + response)
- msoLogger.info("workflowException: " + workflowException)
+ logger.info("SDNCResponse: " + response)
+ logger.info("workflowException: " + workflowException)
SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this)
sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator)
if(execution.getVariable(Prefix + 'sdncResponseSuccess') == "true"){
- msoLogger.info("Good response from SDNC Adapter for service-instance " + method + "response:\n" + response)
+ logger.info("Good response from SDNC Adapter for service-instance " + method + "response:\n" + response)
}else{
msg = "Bad Response from SDNC Adapter for service-instance " + method
- msoLogger.info(msg)
+ logger.info(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 3500, msg)
}
} catch (BpmnError e) {
throw e;
} catch(Exception ex) {
msg = "Exception in postProcessSDNC " + method + " Exception:" + ex.getMessage()
- msoLogger.info(msg)
+ logger.info(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}*/
- msoLogger.trace("Exit postProcessSDNC " + method + " ")
+ logger.trace("Exit postProcessSDNC " + method + " ")
}
public void postProcessAAIGET(DelegateExecution execution) {
- msoLogger.trace("postProcessAAIGET ")
+ logger.trace("postProcessAAIGET ")
String msg = ""
try {
@@ -315,22 +319,22 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess
String serviceType = ""
if(foundInAAI){
- msoLogger.info("Found Service-instance in AAI")
+ logger.info("Found Service-instance in AAI")
String siData = execution.getVariable("GENGS_service")
- msoLogger.info("SI Data")
+ logger.info("SI Data")
if (isBlank(siData))
{
msg = "Could not retrive ServiceInstance data from AAI to delete id:" + serviceInstanceId
- msoLogger.info(msg)
+ logger.info(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
}
else
{
- msoLogger.info("SI Data" + siData)
+ logger.info("SI Data" + siData)
//Confirm there are no related service instances (vnf/network or volume)
if (utils.nodeExists(siData, "relationship-list")) {
- msoLogger.info("SI Data relationship-list exists:")
+ logger.info("SI Data relationship-list exists:")
InputSource source = new InputSource(new StringReader(siData));
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = docFactory.newDocumentBuilder()
@@ -346,7 +350,7 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess
def e = eElement.getElementsByTagName("related-to").item(0).getTextContent() //for ns
if(e.equals("service-instance")){
def relatedObject = eElement.getElementsByTagName("related-link").item(0).getTextContent()
- msoLogger.info("ServiceInstance Related NS :" + relatedObject)
+ logger.info("ServiceInstance Related NS :" + relatedObject)
NodeList dataList = node.getChildNodes()
if(null != dataList) {
JSONObject jObj = new JSONObject()
@@ -369,13 +373,13 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess
}
}
}
- msoLogger.info("Relationship related to Resource:" + jObj.toString())
+ logger.info("Relationship related to Resource:" + jObj.toString())
jArray.put(jObj)
}
//for overlay/underlay
}else if (e.equals("configuration")){
def relatedObject = eElement.getElementsByTagName("related-link").item(0).getTextContent()
- msoLogger.info("ServiceInstance Related Configuration :" + relatedObject)
+ logger.info("ServiceInstance Related Configuration :" + relatedObject)
NodeList dataList = node.getChildNodes()
if(null != dataList) {
JSONObject jObj = new JSONObject()
@@ -398,7 +402,7 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess
}
}
}
- msoLogger.info("Relationship related to Resource:" + jObj.toString())
+ logger.info("Relationship related to Resource:" + jObj.toString())
jArray.put(jObj)
}
}
@@ -410,37 +414,37 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess
}else{
boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator")
if(!succInAAI){
- msoLogger.info("Error getting Service-instance from AAI", + serviceInstanceId)
+ logger.info("Error getting Service-instance from AAI", + serviceInstanceId)
WorkflowException workflowException = execution.getVariable("WorkflowException")
- msoLogger.debug("workflowException: " + workflowException)
+ logger.debug("workflowException: " + workflowException)
if(workflowException != null){
exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage())
}
else
{
msg = "Failure in postProcessAAIGET GENGS_SuccessIndicator:" + succInAAI
- msoLogger.info(msg)
+ logger.info(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
}
}
- msoLogger.info("Service-instance NOT found in AAI. Silent Success")
+ logger.info("Service-instance NOT found in AAI. Silent Success")
}
}catch (BpmnError e) {
throw e;
} catch (Exception ex) {
msg = "Exception in DoDeleteE2EServiceInstance.postProcessAAIGET. " + ex.getMessage()
- msoLogger.info(msg)
+ logger.info(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("Exit postProcessAAIGET ")
+ logger.trace("Exit postProcessAAIGET ")
}
/**
* Deletes the service instance in aai
*/
public void deleteServiceInstance(DelegateExecution execution) {
- msoLogger.trace("Entered deleteServiceInstance")
+ logger.trace("Entered deleteServiceInstance")
try {
String globalCustId = execution.getVariable("globalSubscriberId")
String serviceType = execution.getVariable("serviceType")
@@ -450,15 +454,15 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess
AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalCustId, serviceType, serviceInstanceId)
resourceClient.delete(serviceInstanceUri)
- msoLogger.trace("Exited deleteServiceInstance")
+ logger.trace("Exited deleteServiceInstance")
}catch(Exception e){
- msoLogger.debug("Error occured within deleteServiceInstance method: " + e)
+ logger.debug("Error occured within deleteServiceInstance method: " + e)
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Error occured during deleteServiceInstance from aai")
}
}
public void preInitResourcesOperStatus(DelegateExecution execution){
- msoLogger.trace("STARTED preInitResourcesOperStatus Process ")
+ logger.trace("STARTED preInitResourcesOperStatus Process ")
try{
String serviceId = execution.getVariable("serviceInstanceId")
String operationId = execution.getVariable("operationId")
@@ -468,7 +472,7 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess
String progress = "0"
String reason = ""
String operationContent = "Prepare service creation"
- msoLogger.info("Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId + " operationType:" + operationType)
+ logger.info("Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId + " operationType:" + operationType)
serviceId = UriUtils.encode(serviceId,"UTF-8")
execution.setVariable("serviceInstanceId", serviceId)
execution.setVariable("operationId", operationId)
@@ -523,14 +527,16 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess
payload = utils.formatXml(payload)
execution.setVariable("CVFMI_initResOperStatusRequest", payload)
- msoLogger.info("Outgoing initResourceOperationStatus: \n" + payload)
- msoLogger.debug("CreateVfModuleInfra Outgoing initResourceOperationStatus Request: " + payload)
+ logger.info("Outgoing initResourceOperationStatus: \n" + payload)
+ logger.debug("CreateVfModuleInfra Outgoing initResourceOperationStatus Request: " + payload)
}catch(Exception e){
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing preInitResourcesOperStatus.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Occured Processing preInitResourcesOperStatus.", "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), e);
execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preInitResourcesOperStatus Method:\n" + e.getMessage())
}
- msoLogger.trace("COMPLETED preInitResourcesOperStatus Process ")
+ logger.trace("COMPLETED preInitResourcesOperStatus Process ")
}
/**
@@ -556,7 +562,7 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess
"resourceType":"underlay"
}
]*/
- msoLogger.trace("STARTED preResourceDelete Process ")
+ logger.trace("STARTED preResourceDelete Process ")
String serviceRelationShip = execution.getVariable("serviceRelationShip")
def jsonSlurper = new JsonSlurper()
def jsonOutput = new JsonOutput()
@@ -570,15 +576,15 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess
execution.setVariable("resourceTemplateId", resourceTemplateUUID)
execution.setVariable("resourceInstanceId", resourceInstanceUUID)
execution.setVariable("resourceType", resourceName)
- msoLogger.info("Delete Resource Info resourceTemplate Id :" + resourceTemplateUUID + " resourceInstanceId: " + resourceInstanceUUID + " resourceType: " + resourceName)
+ logger.info("Delete Resource Info resourceTemplate Id :" + resourceTemplateUUID + " resourceInstanceId: " + resourceInstanceUUID + " resourceType: " + resourceName)
}
}
}
- msoLogger.trace("END preResourceDelete Process ")
+ logger.trace("END preResourceDelete Process ")
}
public void sequenceResource(execution){
- msoLogger.trace("STARTED sequenceResource Process ")
+ logger.trace("STARTED sequenceResource Process ")
List<String> nsResources = new ArrayList<String>()
List<String> wanResources = new ArrayList<String>()
List<String> resourceSequence = new ArrayList<String>()
@@ -605,13 +611,13 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess
execution.setVariable("isContainsWanResource", isContainsWanResource)
execution.setVariable("currentResourceIndex", 0)
execution.setVariable("resourceSequence", resourceSequence)
- msoLogger.info("resourceSequence: " + resourceSequence)
+ logger.info("resourceSequence: " + resourceSequence)
execution.setVariable("wanResources", wanResources)
- msoLogger.trace("END sequenceResource Process ")
+ logger.trace("END sequenceResource Process ")
}
public void getCurrentResource(execution){
- msoLogger.trace("Start getCurrentResoure Process ")
+ logger.trace("Start getCurrentResoure Process ")
def currentIndex = execution.getVariable("currentResourceIndex")
List<String> resourceSequence = execution.getVariable("resourceSequence")
List<String> wanResources = execution.getVariable("wanResources")
@@ -622,11 +628,11 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess
}else{
execution.setVariable("controllerInfo", "VF-C")
}
- msoLogger.trace("COMPLETED getCurrentResoure Process ")
+ logger.trace("COMPLETED getCurrentResoure Process ")
}
public void parseNextResource(execution){
- msoLogger.trace("Start parseNextResource Process ")
+ logger.trace("Start parseNextResource Process ")
def currentIndex = execution.getVariable("currentResourceIndex")
def nextIndex = currentIndex + 1
execution.setVariable("currentResourceIndex", nextIndex)
@@ -636,7 +642,7 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess
}else{
execution.setVariable("allResourceFinished", "false")
}
- msoLogger.trace("COMPLETED parseNextResource Process ")
+ logger.trace("COMPLETED parseNextResource Process ")
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy
index 59ea5c236f..b16ccaa8fd 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy
@@ -5,6 +5,8 @@
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* Copyright (C) 2017 Huawei Technologies Co., Ltd. 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
@@ -38,6 +40,8 @@ import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
import org.springframework.web.util.UriUtils;
import org.onap.so.client.aai.AAIResourcesClient
@@ -71,7 +75,7 @@ import groovy.json.*
* Rollback - Deferred
*/
public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProcessor {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCustomDeleteE2EServiceInstanceV2.class);
+ private static final Logger logger = LoggerFactory.getLogger( DoCustomDeleteE2EServiceInstanceV2.class);
String Prefix="DDELSI_"
@@ -82,8 +86,8 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce
public void preProcessRequest (DelegateExecution execution) {
def method = getClass().getSimpleName() + '.buildAPPCRequest(' +'execution=' + execution.getId() +')'
- msoLogger.info("Entered " + method)
- msoLogger.trace("preProcessRequest ")
+ logger.info("Entered " + method)
+ logger.trace("preProcessRequest ")
String msg = ""
try {
@@ -109,18 +113,18 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce
String serviceInstanceId = execution.getVariable("serviceInstanceId")
if (isBlank(serviceInstanceId)){
msg = "Input serviceInstanceId is null"
- msoLogger.info(msg)
+ logger.info(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
}
String sdncCallbackUrl = execution.getVariable('URN_mso_workflow_sdncadapter_callback')
if (isBlank(sdncCallbackUrl)) {
msg = "URN_mso_workflow_sdncadapter_callback is null"
- msoLogger.info(msg)
+ logger.info(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
}
execution.setVariable("sdncCallbackUrl", sdncCallbackUrl)
- msoLogger.info("SDNC Callback URL: " + sdncCallbackUrl)
+ logger.info("SDNC Callback URL: " + sdncCallbackUrl)
StringBuilder sbParams = new StringBuilder()
Map<String, String> paramsMap = execution.getVariable("serviceInputParams")
@@ -152,10 +156,10 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce
throw e;
} catch (Exception ex){
msg = "Exception in preProcessRequest " + ex.getMessage()
- msoLogger.info(msg)
+ logger.info(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.info("Exited " + method)
+ logger.info("Exited " + method)
}
/**
@@ -179,7 +183,7 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce
}catch(BpmnError e) {
throw e;
}catch(NotFoundException e) {
- msoLogger.info("SI not found in aai. Silent Success ")
+ logger.info("SI not found in aai. Silent Success ")
}catch(Exception ex) {
String msg = "Internal Error in getServiceInstance: " + ex.getMessage()
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
@@ -189,41 +193,41 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce
private void loadResourcesProperties(DelegateExecution execution) {
def method = getClass().getSimpleName() + '.loadResourcesProperties(' +'execution=' + execution.getId() +')'
def isDebugEnabled = execution.getVariable("isDebugEnabled")
- msoLogger.info("Entered " + method)
+ logger.info("Entered " + method)
String loadFilePath = "/etc/mso/config.d/reources.json"
try{
def jsonPayload = new File(loadFilePath).text
- msoLogger.info("jsonPayload: " + jsonPayload)
+ logger.info("jsonPayload: " + jsonPayload)
String resourcesProperties = jsonUtil.prettyJson(jsonPayload.toString())
- msoLogger.info("resourcesProperties: " + resourcesProperties)
+ logger.info("resourcesProperties: " + resourcesProperties)
String createResourceSort = jsonUtil.getJsonValue(resourcesProperties, "CreateResourceSort")
- msoLogger.info("createResourceSort: " + createResourceSort)
+ logger.info("createResourceSort: " + createResourceSort)
execution.setVariable("createResourceSort", createResourceSort)
String deleteResourceSort = jsonUtil.getJsonValue(resourcesProperties, "DeleteResourceSort")
- msoLogger.info("deleteResourceSort: " + deleteResourceSort)
+ logger.info("deleteResourceSort: " + deleteResourceSort)
execution.setVariable("deleteResourceSort", deleteResourceSort)
String resourceControllerType = jsonUtil.getJsonValue(resourcesProperties, "ResourceControllerType")
- msoLogger.info("resourceControllerType: " + resourceControllerType)
+ logger.info("resourceControllerType: " + resourceControllerType)
execution.setVariable("resourceControllerType", resourceControllerType)
}catch(Exception ex){
// try error in method block
String exceptionMessage = "Bpmn error encountered in " + method + " - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
- msoLogger.info("Exited " + method)
+ logger.info("Exited " + method)
}
private void sortDeleteResource(DelegateExecution execution) {
def method = getClass().getSimpleName() + '.sortDeleteResource(' +'execution=' + execution.getId() +')'
def isDebugEnabled = execution.getVariable("isDebugEnabled")
- msoLogger.info("Entered " + method)
+ logger.info("Entered " + method)
String deleteResourceSortDef = """[
{
"resourceType":"GRE_SAR"
@@ -267,7 +271,7 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce
}
List<String> sortResourceList = jsonUtil.StringArrayToList(execution, deleteResourceSort)
- msoLogger.info("sortResourceList : " + sortResourceList)
+ logger.info("sortResourceList : " + sortResourceList)
JSONArray newResourceList = new JSONArray()
int resSortCount = sortResourceList.size()
@@ -278,14 +282,14 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce
List<String> resourceList = execution.getVariable(Prefix+"resourceList")
for (String resource : resourceList) {
- msoLogger.info("resource : " + resource)
+ logger.info("resource : " + resource)
String resourceType = jsonUtil.getJsonValue(resource, "resourceType")
if (StringUtils.containsIgnoreCase(resourceType, sortResourceType)) {
JSONObject jsonObj = new JSONObject(resource)
newResourceList.put(jsonObj)
}
- msoLogger.info("Get next sort type " )
+ logger.info("Get next sort type " )
}
}
@@ -293,20 +297,20 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce
List<String> newResourceListStr = jsonUtil.StringArrayToList(execution, newResourceStr)
execution.setVariable(Prefix+"resourceList", newResourceListStr)
- msoLogger.info("newResourceList : " + newResourceListStr)
+ logger.info("newResourceList : " + newResourceListStr)
}catch(Exception ex){
// try error in method block
String exceptionMessage = "Bpmn error encountered in " + method + " - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
- msoLogger.info("Exited " + method)
+ logger.info("Exited " + method)
}
public void prepareServiceDeleteResource(DelegateExecution execution) {
def method = getClass().getSimpleName() + '.prepareServiceDeleteResource(' +'execution=' + execution.getId() +')'
- msoLogger.info("Entered " + method)
+ logger.info("Entered " + method)
try {
@@ -319,9 +323,9 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce
execution.setVariable(Prefix+"resourceFinish", true)
String aaiJsonRecord = execution.getVariable("serviceInstance");
- msoLogger.info("serviceInstanceAaiRecord: " +aaiJsonRecord)
+ logger.info("serviceInstanceAaiRecord: " +aaiJsonRecord)
- msoLogger.info("aaiJsonRecord: " +aaiJsonRecord)
+ logger.info("aaiJsonRecord: " +aaiJsonRecord)
def serviceInstanceName = jsonUtil.getJsonValue(aaiJsonRecord, "service-instance.service-instance-name")
execution.setVariable("serviceInstanceName",serviceInstanceName)
@@ -330,11 +334,11 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce
String relationshipList = jsonUtil.getJsonValue(aaiJsonRecord, "service-instance.relationship-list")
- msoLogger.info("relationship-list:" + relationshipList)
+ logger.info("relationship-list:" + relationshipList)
if (! isBlank(relationshipList)){
- msoLogger.info("relationship-list exists" )
+ logger.info("relationship-list exists" )
String relationShip = jsonUtil.getJsonValue(relationshipList, "relationship")
- msoLogger.info("relationship: " + relationShip)
+ logger.info("relationship: " + relationShip)
JSONArray allResources = new JSONArray()
JSONArray serviceResources = new JSONArray()
JSONArray networkResources = new JSONArray()
@@ -349,32 +353,32 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce
} else if (relationShip.startsWith("[") && relationShip.endsWith("]")) {
jsonArray = new JSONArray(relationShip);
} else {
- msoLogger.info("The relationShip fomart is error" )
+ logger.info("The relationShip fomart is error" )
}
List<String> relationList = jsonUtil.StringArrayToList(execution, jsonArray.toString())
- msoLogger.info("relationList: " + relationList)
+ logger.info("relationList: " + relationList)
int relationNum =relationList.size()
- msoLogger.info("**************relationList size: " + relationNum)
+ logger.info("**************relationList size: " + relationNum)
for ( int currentRelation = 0 ; currentRelation < relationNum ; currentRelation++ ) {
- msoLogger.info("current Relation num: " + currentRelation)
+ logger.info("current Relation num: " + currentRelation)
String relation = relationList[currentRelation]
- msoLogger.info("relation: " + relation)
+ logger.info("relation: " + relation)
String relatedTo = jsonUtil.getJsonValue(relation, "related-to")
- msoLogger.info("relatedTo: " + relatedTo)
+ logger.info("relatedTo: " + relatedTo)
String relatedLink = jsonUtil.getJsonValue(relation, "related-link")
- msoLogger.info("relatedLink: " + relatedLink)
+ logger.info("relatedLink: " + relatedLink)
if (StringUtils.equalsIgnoreCase(relatedTo, "allotted-resource")) {
- msoLogger.info("allotted-resource exists ")
+ logger.info("allotted-resource exists ")
Optional<AllottedResource> aaiArRsp = getAaiAr(execution, relatedLink)
- msoLogger.info("aaiArRsp: " + aaiArRsp)
+ logger.info("aaiArRsp: " + aaiArRsp)
if (aaiArRsp.isPresent()) {
JSONObject jObject = new JSONObject()
@@ -384,22 +388,22 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce
jObject.put("resourceVersion", aaiArRsp.get().getResourceVersion())
allResources.put(jObject)
- msoLogger.info("allResources: " + allResources)
+ logger.info("allResources: " + allResources)
allottedResources.put(jObject)
- msoLogger.info("allottedResources: " + allottedResources)
+ logger.info("allottedResources: " + allottedResources)
}
}
else if (StringUtils.equalsIgnoreCase(relatedTo, "service-instance")){
- msoLogger.info("service-instance exists ")
+ logger.info("service-instance exists ")
JSONObject jObject = new JSONObject()
//relationship-data
String rsDataStr = jsonUtil.getJsonValue(relation, "relationship-data")
- msoLogger.info("rsDataStr: " + rsDataStr)
+ logger.info("rsDataStr: " + rsDataStr)
List<String> rsDataList = jsonUtil.StringArrayToList(execution, rsDataStr)
- msoLogger.info("rsDataList: " + rsDataList)
+ logger.info("rsDataList: " + rsDataList)
for(String rsData : rsDataList){
- msoLogger.info("rsData: " + rsData)
+ logger.info("rsData: " + rsData)
def eKey = jsonUtil.getJsonValue(rsData, "relationship-key")
def eValue = jsonUtil.getJsonValue(rsData, "relationship-value")
if(eKey.equals("service-instance.service-instance-id")){
@@ -412,11 +416,11 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce
//related-to-property
String rPropertyStr = jsonUtil.getJsonValue(relation, "related-to-property")
- msoLogger.info("related-to-property: " + rPropertyStr)
+ logger.info("related-to-property: " + rPropertyStr)
if (rPropertyStr instanceof JSONArray){
List<String> rPropertyList = jsonUtil.StringArrayToList(execution, rPropertyStr)
for (String rProperty : rPropertyList) {
- msoLogger.info("rProperty: " + rProperty)
+ logger.info("rProperty: " + rProperty)
def eKey = jsonUtil.getJsonValue(rProperty, "property-key")
def eValue = jsonUtil.getJsonValue(rProperty, "property-value")
if(eKey.equals("service-instance.service-instance-name")){
@@ -426,7 +430,7 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce
}
else {
String rProperty = rPropertyStr
- msoLogger.info("rProperty: " + rProperty)
+ logger.info("rProperty: " + rProperty)
def eKey = jsonUtil.getJsonValue(rProperty, "property-key")
def eValue = jsonUtil.getJsonValue(rProperty, "property-value")
if (eKey.equals("service-instance.service-instance-name")) {
@@ -435,22 +439,22 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce
}
allResources.put(jObject)
- msoLogger.info("allResources: " + allResources)
+ logger.info("allResources: " + allResources)
serviceResources.put(jObject)
- msoLogger.info("serviceResources: " + serviceResources)
+ logger.info("serviceResources: " + serviceResources)
}
else if (StringUtils.equalsIgnoreCase(relatedTo, "configuration")) {
- msoLogger.info("configuration ")
+ logger.info("configuration ")
JSONObject jObject = new JSONObject()
//relationship-data
String rsDataStr = jsonUtil.getJsonValue(relation, "relationship-data")
- msoLogger.info("rsDataStr: " + rsDataStr)
+ logger.info("rsDataStr: " + rsDataStr)
List<String> rsDataList = jsonUtil.StringArrayToList(execution, rsDataStr)
- msoLogger.info("rsDataList: " + rsDataList)
+ logger.info("rsDataList: " + rsDataList)
for (String rsData : rsDataList) {
- msoLogger.info("rsData: " + rsData)
+ logger.info("rsData: " + rsData)
def eKey = jsonUtil.getJsonValue(rsData, "relationship-key")
def eValue = jsonUtil.getJsonValue(rsData, "relationship-value")
if(eKey.equals("configuration.configuration-id")){
@@ -461,11 +465,11 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce
//related-to-property
String rPropertyStr = jsonUtil.getJsonValue(relation, "related-to-property")
- msoLogger.info("related-to-property: " + rPropertyStr)
+ logger.info("related-to-property: " + rPropertyStr)
if (rPropertyStr instanceof JSONArray){
List<String> rPropertyList = jsonUtil.StringArrayToList(execution, rPropertyStr)
for(String rProperty : rPropertyList){
- msoLogger.info("rProperty: " + rProperty)
+ logger.info("rProperty: " + rProperty)
def eKey = jsonUtil.getJsonValue(rProperty, "property-key")
def eValue = jsonUtil.getJsonValue(rProperty, "property-value")
if(eKey.equals("configuration.configuration-type")){
@@ -475,7 +479,7 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce
}
else {
String rProperty = rPropertyStr
- msoLogger.info("rProperty: " + rProperty)
+ logger.info("rProperty: " + rProperty)
def eKey = jsonUtil.getJsonValue(rProperty, "property-key")
def eValue = jsonUtil.getJsonValue(rProperty, "property-value")
if(eKey.equals("configuration.configuration-type")){
@@ -483,34 +487,34 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce
}
}
allResources.put(jObject)
- msoLogger.info("allResources: " + allResources)
+ logger.info("allResources: " + allResources)
networkResources.put(jObject)
- msoLogger.info("networkResources: " + networkResources)
+ logger.info("networkResources: " + networkResources)
}
- msoLogger.info("Get Next releation resource " )
+ logger.info("Get Next releation resource " )
}
- msoLogger.info("Get releation finished. " )
+ logger.info("Get releation finished. " )
}
execution.setVariable("serviceRelationShip", allResources.toString())
- msoLogger.info("allResources: " + allResources.toString())
+ logger.info("allResources: " + allResources.toString())
String serviceRelationShip = execution.getVariable("serviceRelationShip")
- msoLogger.info("serviceRelationShip: " + serviceRelationShip)
+ logger.info("serviceRelationShip: " + serviceRelationShip)
if ((! isBlank(serviceRelationShip)) && (! serviceRelationShip.isEmpty())) {
List<String> relationShipList = jsonUtil.StringArrayToList(execution, serviceRelationShip)
- msoLogger.info("relationShipList: " + relationShipList)
+ logger.info("relationShipList: " + relationShipList)
execution.setVariable(Prefix+"resourceList", relationShipList)
int resourceCount = relationShipList.size()
- msoLogger.info("resourceCount: " + resourceCount)
+ logger.info("resourceCount: " + resourceCount)
execution.setVariable(Prefix+"resourceCount",resourceCount )
int resourceNum = 0
execution.setVariable(Prefix+"nextResource", resourceNum)
- msoLogger.info("start sort delete resource: ")
+ logger.info("start sort delete resource: ")
sortDeleteResource(execution)
@@ -520,48 +524,48 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce
else {
execution.setVariable(Prefix+"resourceFinish", true)
}
- msoLogger.info("Resource list set end : " + resourceCount)
+ logger.info("Resource list set end : " + resourceCount)
}
execution.setVariable("serviceResources", serviceResources.toString())
- msoLogger.info("serviceResources: " + serviceResources)
+ logger.info("serviceResources: " + serviceResources)
String serviceResourcesShip = execution.getVariable("serviceResources")
- msoLogger.info("serviceResourcesShip: " + serviceResourcesShip)
+ logger.info("serviceResourcesShip: " + serviceResourcesShip)
if ((! isBlank(serviceResourcesShip)) && (! serviceResourcesShip.isEmpty())) {
List<String> serviceResourcesList = jsonUtil.StringArrayToList(execution, serviceResourcesShip)
- msoLogger.info("serviceResourcesList: " + serviceResourcesList)
+ logger.info("serviceResourcesList: " + serviceResourcesList)
execution.setVariable(Prefix+"serviceResourceList", serviceResourcesList)
execution.setVariable(Prefix+"serviceResourceCount", serviceResourcesList.size())
execution.setVariable(Prefix+"nextServiceResource", 0)
- msoLogger.info("Service Resource list set end : " + serviceResourcesList.size())
+ logger.info("Service Resource list set end : " + serviceResourcesList.size())
}
execution.setVariable("allottedResources", allottedResources.toString())
- msoLogger.info("allottedResources: " + allottedResources)
+ logger.info("allottedResources: " + allottedResources)
String allottedResourcesShip = execution.getVariable("allottedResources")
- msoLogger.info("allottedResourcesShip: " + allottedResourcesShip)
+ logger.info("allottedResourcesShip: " + allottedResourcesShip)
if ((! isBlank(allottedResourcesShip)) && (! allottedResourcesShip.isEmpty())) {
List<String> allottedResourcesList = jsonUtil.StringArrayToList(execution, allottedResourcesShip)
- msoLogger.info("allottedResourcesList: " + allottedResourcesList)
+ logger.info("allottedResourcesList: " + allottedResourcesList)
execution.setVariable(Prefix+"allottedResourcesList", allottedResourcesList)
execution.setVariable(Prefix+"allottedResourcesListCount", allottedResourcesList.size())
execution.setVariable(Prefix+"nextAllottedResourcesList", 0)
- msoLogger.info("Allotted Resource list set end : " + allottedResourcesList.size())
+ logger.info("Allotted Resource list set end : " + allottedResourcesList.size())
}
execution.setVariable("networkResources", networkResources.toString())
- msoLogger.info("networkResources: " + networkResources)
+ logger.info("networkResources: " + networkResources)
String networkResourcesShip = execution.getVariable("networkResources")
- msoLogger.info("networkResourcesShip: " + networkResourcesShip)
+ logger.info("networkResourcesShip: " + networkResourcesShip)
if ((! isBlank(networkResourcesShip)) && (! networkResourcesShip.isEmpty())) {
List<String> networkResourcesList = jsonUtil.StringArrayToList(execution, networkResourcesShip)
- msoLogger.info("networkResourcesList: " + networkResourcesList)
+ logger.info("networkResourcesList: " + networkResourcesList)
execution.setVariable(Prefix+"networkResourcesList", networkResourcesList)
execution.setVariable(Prefix+"networkResourcesListCount", networkResourcesList.size())
execution.setVariable(Prefix+"nextNetworkResourcesList", 0)
- msoLogger.info("Network Resource list set end : " + networkResourcesList.size())
+ logger.info("Network Resource list set end : " + networkResourcesList.size())
}
}
@@ -569,15 +573,15 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce
throw e;
} catch (Exception ex) {
String exceptionMessage = "Bpmn error encountered in DeleteMobileAPNCustService flow. prepareServiceDeleteResource() - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
- msoLogger.info("Exited " + method)
+ logger.info("Exited " + method)
}
private Optional<AllottedResource> getAaiAr(DelegateExecution execution, String relink) {
def method = getClass().getSimpleName() + '.getAaiAr(' +'execution=' + execution.getId() +')'
- msoLogger.info("Entered " + method)
+ logger.info("Entered " + method)
AAIResourceUri uri = AAIUriFactory.createResourceFromExistingURI(AAIObjectType.ALLOTTED_RESOURCE, UriBuilder.fromPath(relink).build())
return getAAIClient().get(AllottedResource.class,uri)
}
@@ -586,39 +590,39 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce
*/
public void preProcessDecomposeNextResource(DelegateExecution execution){
def method = getClass().getSimpleName() + '.getAaiAr(' +'execution=' + execution.getId() +')'
- msoLogger.info("Entered " + method)
- msoLogger.trace("STARTED preProcessDecomposeNextResource Process ")
+ logger.info("Entered " + method)
+ logger.trace("STARTED preProcessDecomposeNextResource Process ")
try{
int resourceNum = execution.getVariable(Prefix+"nextServiceResource")
List<String> serviceResourceList = execution.getVariable(Prefix+"serviceResourceList")
- msoLogger.info("Service Resource List : " + serviceResourceList)
+ logger.info("Service Resource List : " + serviceResourceList)
String serviceResource = serviceResourceList[resourceNum]
execution.setVariable(Prefix+"serviceResource", serviceResource)
- msoLogger.info("Current Service Resource : " + serviceResource)
+ logger.info("Current Service Resource : " + serviceResource)
String resourceType = jsonUtil.getJsonValue(serviceResource, "resourceType")
execution.setVariable("resourceType", resourceType)
- msoLogger.info("resourceType : " + resourceType)
+ logger.info("resourceType : " + resourceType)
String resourceInstanceId = jsonUtil.getJsonValue(serviceResource, "resourceInstanceId")
execution.setVariable("resourceInstanceId", resourceInstanceId)
- msoLogger.info("resourceInstanceId : " + resourceInstanceId)
+ logger.info("resourceInstanceId : " + resourceInstanceId)
String resourceRole = jsonUtil.getJsonValue(serviceResource, "resourceRole")
execution.setVariable("resourceRole", resourceRole)
- msoLogger.info("resourceRole : " + resourceRole)
+ logger.info("resourceRole : " + resourceRole)
String resourceVersion = jsonUtil.getJsonValue(serviceResource, "resourceVersion")
execution.setVariable("resourceVersion", resourceVersion)
- msoLogger.info("resourceVersion : " + resourceVersion)
+ logger.info("resourceVersion : " + resourceVersion)
String resourceName = jsonUtil.getJsonValue(serviceResource, "resourceName")
if (isBlank(resourceName)){
resourceName = resourceInstanceId
}
execution.setVariable(Prefix+"resourceName", resourceName)
- msoLogger.info("resource Name : " + resourceName)
+ logger.info("resource Name : " + resourceName)
execution.setVariable(Prefix+"nextServiceResource", resourceNum + 1)
@@ -633,25 +637,25 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce
}catch(Exception e){
// try error in method block
String exceptionMessage = "Bpmn error encountered in CreateMobileAPNCustService flow. Unexpected Error from method preProcessDecomposeNextResource() - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
- msoLogger.info("Exited " + method)
+ logger.info("Exited " + method)
}
/**
* post Decompose next resource to create request
*/
public void postProcessDecomposeNextResource(DelegateExecution execution){
def method = getClass().getSimpleName() + '.postProcessDecomposeNextResource(' +'execution=' + execution.getId() +')'
- msoLogger.info("Entered " + method)
- msoLogger.trace("STARTED postProcessDecomposeNextResource Process ")
+ logger.info("Entered " + method)
+ logger.trace("STARTED postProcessDecomposeNextResource Process ")
try{
String resourceName = execution.getVariable(Prefix+"resourceName")
int resourceNum = execution.getVariable(Prefix+"nextServiceResource")
- msoLogger.debug("Current Resource count:"+ execution.getVariable(Prefix+"nextServiceResource"))
+ logger.debug("Current Resource count:"+ execution.getVariable(Prefix+"nextServiceResource"))
int resourceCount = execution.getVariable(Prefix+"serviceResourceCount")
- msoLogger.debug("Total Resource count:"+ execution.getVariable(Prefix+"serviceResourceCount"))
+ logger.debug("Total Resource count:"+ execution.getVariable(Prefix+"serviceResourceCount"))
if (resourceNum < resourceCount) {
execution.setVariable(Prefix+"resourceFinish", false)
@@ -660,13 +664,13 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce
execution.setVariable(Prefix+"resourceFinish", true)
}
- msoLogger.debug("Resource Finished:"+ execution.getVariable(Prefix+"resourceFinish"))
+ logger.debug("Resource Finished:"+ execution.getVariable(Prefix+"resourceFinish"))
if (resourceCount >0 ){
int progress = (resourceNum*100) / resourceCount
execution.setVariable("progress", progress.toString() )
- msoLogger.trace(":"+ execution.getVariable(""))
+ logger.trace(":"+ execution.getVariable(""))
}
execution.setVariable("operationStatus", resourceName )
@@ -674,10 +678,10 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce
}catch(Exception e){
// try error in method block
String exceptionMessage = "Bpmn error encountered in CreateMobileAPNCustService flow. Unexpected Error from method postProcessDecomposeNextResource() - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
- msoLogger.info("Exited " + method)
+ logger.info("Exited " + method)
}
/**
* prepare post Unkown Resource Type
@@ -685,7 +689,7 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce
public void postOtherControllerType(DelegateExecution execution){
def method = getClass().getSimpleName() + '.postOtherControllerType(' +'execution=' + execution.getId() +')'
def isDebugEnabled = execution.getVariable("isDebugEnabled")
- msoLogger.info("Entered " + method)
+ logger.info("Entered " + method)
try{
@@ -694,15 +698,15 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce
String controllerType = execution.getVariable("controllerType")
String msg = "Resource name: "+ resourceName + " resource Type: " + resourceType+ " controller Type: " + controllerType + " can not be processed n the workflow"
- msoLogger.debug(msg)
+ logger.debug(msg)
}catch(Exception e){
// try error in method block
String exceptionMessage = "Bpmn error encountered in DoCreateMobileAPNServiceInstance flow. Unexpected Error from method postOtherControllerType() - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
- msoLogger.info("Exited " + method)
+ logger.info("Exited " + method)
}
/**
@@ -712,9 +716,9 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce
// we use resource instance ids for delete flow as resourceTemplateUUIDs
def method = getClass().getSimpleName() + '.preSDNCResourceDelete(' +'execution=' + execution.getId() +')'
- msoLogger.info("Entered " + method)
+ logger.info("Entered " + method)
- msoLogger.trace("STARTED preSDNCResourceDelete Process ")
+ logger.trace("STARTED preSDNCResourceDelete Process ")
String networkResources = execution.getVariable("networkResources")
@@ -730,16 +734,16 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce
execution.setVariable("resourceInstanceId", resourceInstanceUUID)
execution.setVariable("resourceType", resourceName)
execution.setVariable("foundResource", true)
- msoLogger.info("Delete Resource Info resourceTemplate Id :" + resourceTemplateUUID + " resourceInstanceId: " + resourceInstanceUUID + " resourceType: " + resourceName)
+ logger.info("Delete Resource Info resourceTemplate Id :" + resourceTemplateUUID + " resourceInstanceId: " + resourceInstanceUUID + " resourceType: " + resourceName)
}
}
}
- msoLogger.info("Exited " + method)
+ logger.info("Exited " + method)
}
public void preProcessSDNCDelete (DelegateExecution execution) {
def method = getClass().getSimpleName() + '.preProcessSDNCDelete(' +'execution=' + execution.getId() +')'
- msoLogger.info("Entered " + method)
- msoLogger.trace("preProcessSDNCDelete ")
+ logger.info("Entered " + method)
+ logger.trace("preProcessSDNCDelete ")
String msg = ""
try {
@@ -838,50 +842,50 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce
String sdncDeactivate = sdncDelete.replace(">delete<", ">deactivate<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<")
execution.setVariable("sdncDelete", sdncDelete)
execution.setVariable("sdncDeactivate", sdncDeactivate)
- msoLogger.info("sdncDeactivate:\n" + sdncDeactivate)
- msoLogger.info("sdncDelete:\n" + sdncDelete)
+ logger.info("sdncDeactivate:\n" + sdncDeactivate)
+ logger.info("sdncDelete:\n" + sdncDelete)
} catch (BpmnError e) {
throw e;
} catch(Exception ex) {
msg = "Exception in preProcessSDNCDelete. " + ex.getMessage()
- msoLogger.info(msg)
+ logger.info(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Exception Occured in preProcessSDNCDelete.\n" + ex.getMessage())
}
- msoLogger.info("Exited " + method)
+ logger.info("Exited " + method)
}
public void postProcessSDNCDelete(DelegateExecution execution, String response, String action) {
def method = getClass().getSimpleName() + '.postProcessSDNCDelete(' +'execution=' + execution.getId() +')'
- msoLogger.info("Entered " + method)
- msoLogger.trace("postProcessSDNC " + action + " ")
+ logger.info("Entered " + method)
+ logger.trace("postProcessSDNC " + action + " ")
String msg = ""
/*try {
WorkflowException workflowException = execution.getVariable("WorkflowException")
boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator")
- msoLogger.info("SDNCResponse: " + response)
- msoLogger.info("workflowException: " + workflowException)
+ logger.info("SDNCResponse: " + response)
+ logger.info("workflowException: " + workflowException)
SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this)
sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator)
if(execution.getVariable(Prefix + 'sdncResponseSuccess') == "true"){
- msoLogger.info("Good response from SDNC Adapter for service-instance " + action + "response:\n" + response)
+ logger.info("Good response from SDNC Adapter for service-instance " + action + "response:\n" + response)
}else{
msg = "Bad Response from SDNC Adapter for service-instance " + action
- msoLogger.info(msg)
+ logger.info(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 3500, msg)
}
} catch (BpmnError e) {
throw e;
} catch(Exception ex) {
msg = "Exception in postProcessSDNC " + action + " Exception:" + ex.getMessage()
- msoLogger.info(msg)
+ logger.info(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}*/
- msoLogger.info("Exited " + method)
+ logger.info("Exited " + method)
}
/**
@@ -889,7 +893,7 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce
*/
public void preUpdateServiceOperationStatus(DelegateExecution execution){
def method = getClass().getSimpleName() + '.preUpdateServiceOperationStatus(' +'execution=' + execution.getId() +')'
- msoLogger.info("Entered " + method)
+ logger.info("Entered " + method)
try{
String serviceId = execution.getVariable("serviceInstanceId")
@@ -899,14 +903,14 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce
String userId = ""
String result = "processing"
String progress = execution.getVariable("progress")
- msoLogger.info("progress: " + progress )
+ logger.info("progress: " + progress )
if ("100".equalsIgnoreCase(progress))
{
result = "finished"
}
String reason = ""
String operationContent = "Prepare service delete: " + execution.getVariable("operationStatus")
- msoLogger.info("Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId)
+ logger.info("Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId)
serviceId = UriUtils.encode(serviceId,"UTF-8")
execution.setVariable("serviceInstanceId", serviceId)
execution.setVariable("operationId", operationId)
@@ -914,7 +918,7 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce
def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution)
execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint)
- msoLogger.info("DB Adapter Endpoint is: " + dbAdapterEndpoint)
+ logger.info("DB Adapter Endpoint is: " + dbAdapterEndpoint)
String payload =
"""<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
@@ -937,22 +941,24 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce
payload = utils.formatXml(payload)
execution.setVariable("CVFMI_updateServiceOperStatusRequest", payload)
- msoLogger.info("Outgoing preUpdateServiceOperationStatus: \n" + payload)
+ logger.info("Outgoing preUpdateServiceOperationStatus: \n" + payload)
}catch(Exception e){
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing preUpdateServiceOperationStatus.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Occured Processing preUpdateServiceOperationStatus.", "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), e);
execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preUpdateServiceOperationStatus Method:\n" + e.getMessage())
}
- msoLogger.trace("COMPLETED preUpdateServiceOperationStatus Process ")
- msoLogger.info("Exited " + method)
+ logger.trace("COMPLETED preUpdateServiceOperationStatus Process ")
+ logger.info("Exited " + method)
}
public void preInitResourcesOperStatus(DelegateExecution execution){
def method = getClass().getSimpleName() + '.preInitResourcesOperStatus(' +'execution=' + execution.getId() +')'
- msoLogger.info("Entered " + method)
+ logger.info("Entered " + method)
- msoLogger.trace("STARTED preInitResourcesOperStatus Process ")
+ logger.trace("STARTED preInitResourcesOperStatus Process ")
String msg=""
try{
String serviceId = execution.getVariable("serviceInstanceId")
@@ -963,14 +969,14 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce
String progress = "0"
String reason = ""
String operationContent = "Prepare service delete"
- msoLogger.info("Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId + " operationType:" + operationType)
+ logger.info("Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId + " operationType:" + operationType)
serviceId = UriUtils.encode(serviceId,"UTF-8")
execution.setVariable("serviceInstanceId", serviceId)
execution.setVariable("operationId", operationId)
execution.setVariable("operationType", operationType)
String serviceRelationShip = execution.getVariable("serviceRelationShip")
- msoLogger.info("serviceRelationShip: " + serviceRelationShip)
+ logger.info("serviceRelationShip: " + serviceRelationShip)
if (! isBlank(serviceRelationShip)) {
def jsonSlurper = new JsonSlurper()
def jsonOutput = new JsonOutput()
@@ -985,7 +991,7 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce
def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution)
execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint)
- msoLogger.info("DB Adapter Endpoint is: " + dbAdapterEndpoint)
+ logger.info("DB Adapter Endpoint is: " + dbAdapterEndpoint)
String payload =
"""<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
@@ -1003,17 +1009,17 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce
payload = utils.formatXml(payload)
execution.setVariable("CVFMI_initResOperStatusRequest", payload)
- msoLogger.info("Outgoing initResourceOperationStatus: \n" + payload)
- msoLogger.debug("DoCustomDeleteE2EServiceInstanceV2 Outgoing initResourceOperationStatus Request: " + payload)
+ logger.info("Outgoing initResourceOperationStatus: \n" + payload)
+ logger.debug("DoCustomDeleteE2EServiceInstanceV2 Outgoing initResourceOperationStatus Request: " + payload)
}catch (BpmnError e) {
throw e;
} catch (Exception ex) {
msg = "Exception in DoCustomDeleteE2EServiceInstanceV2.preInitResourcesOperStatus. " + ex.getMessage()
- msoLogger.info(msg)
+ logger.info(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.info("Exited " + method)
+ logger.info("Exited " + method)
}
@@ -1025,21 +1031,21 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce
// we use resource instance ids for delete flow as resourceTemplateUUIDs
def method = getClass().getSimpleName() + '.preProcessVFCResourceDelete(' +'execution=' + execution.getId() +')'
- msoLogger.info("Entered " + method)
+ logger.info("Entered " + method)
- msoLogger.trace("STARTED preProcessVFCResourceDelete Process ")
+ logger.trace("STARTED preProcessVFCResourceDelete Process ")
try{
String serviceResource = execution.getVariable("serviceResource")
- msoLogger.info("serviceResource : " + serviceResource)
+ logger.info("serviceResource : " + serviceResource)
String resourceInstanceId = execution.getVariable("resourceInstanceId")
- msoLogger.info("resourceInstanceId : " + resourceInstanceId)
+ logger.info("resourceInstanceId : " + resourceInstanceId)
execution.setVariable("resourceTemplateId", resourceInstanceId)
- msoLogger.info("resourceTemplateId : " + resourceInstanceId)
+ logger.info("resourceTemplateId : " + resourceInstanceId)
String resourceType = execution.getVariable("resourceType")
- msoLogger.info("resourceType : " + resourceType)
+ logger.info("resourceType : " + resourceType)
String resourceName = execution.getVariable(Prefix+"resourceName")
@@ -1047,34 +1053,34 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce
resourceName = resourceInstanceId
}
execution.setVariable("resourceName", resourceName)
- msoLogger.info("resource Name : " + resourceName)
+ logger.info("resource Name : " + resourceName)
- msoLogger.info("Delete Resource Info: resourceInstanceId :" + resourceInstanceId + " resourceTemplateId: " + resourceInstanceId + " resourceType: " + resourceType)
+ logger.info("Delete Resource Info: resourceInstanceId :" + resourceInstanceId + " resourceTemplateId: " + resourceInstanceId + " resourceType: " + resourceType)
}catch (BpmnError e) {
throw e;
} catch (Exception ex) {
msg = "Exception in DoDeleteE2EServiceInstance.preProcessVFCResourceDelete. " + ex.getMessage()
- msoLogger.info(msg)
+ logger.info(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.info("Exited " + method)
+ logger.info("Exited " + method)
}
public void postProcessVFCDelete(DelegateExecution execution, String response, String action) {
def method = getClass().getSimpleName() + '.postProcessVFCDelete(' +'execution=' + execution.getId() +')'
- msoLogger.info("Entered " + method)
+ logger.info("Entered " + method)
- msoLogger.trace("STARTED postProcessVFCDelete Process ")
+ logger.trace("STARTED postProcessVFCDelete Process ")
try{
}catch (BpmnError e) {
throw e;
} catch (Exception ex) {
msg = "Exception in DoDeleteE2EServiceInstance.postProcessVFCDelete. " + ex.getMessage()
- msoLogger.info(msg)
+ logger.info(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.info("Exited " + method)
+ logger.info("Exited " + method)
}
}
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 48f255bf91..f2af481f66 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
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2018 Huawei Technologies Co., Ltd. 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
@@ -36,7 +38,8 @@ import org.onap.so.bpmn.core.domain.ServiceDecomposition
import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.client.HttpClient
import org.onap.so.client.HttpClientFactory
-import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
import org.onap.so.utils.TargetEntity
import org.springframework.web.util.UriUtils
import org.w3c.dom.Document
@@ -76,11 +79,11 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
String Prefix="DDEESI_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtil = new JsonUtils()
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoDeleteE2EServiceInstance.class);
+ private static final Logger logger = LoggerFactory.getLogger( DoDeleteE2EServiceInstance.class);
public void preProcessRequest (DelegateExecution execution) {
- msoLogger.debug(" ***** preProcessRequest *****")
+ logger.debug(" ***** preProcessRequest *****")
String msg = ""
try {
@@ -106,18 +109,18 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
String serviceInstanceId = execution.getVariable("serviceInstanceId")
if (isBlank(serviceInstanceId)){
msg = "Input serviceInstanceId is null"
- msoLogger.info(msg)
+ logger.info(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
}
String sdncCallbackUrl = UrnPropertiesReader.getVariable('URN_mso_workflow_sdncadapter_callback', execution)
if (isBlank(sdncCallbackUrl)) {
msg = "URN_mso_workflow_sdncadapter_callback is null"
- msoLogger.info(msg)
+ logger.info(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
}
execution.setVariable("sdncCallbackUrl", sdncCallbackUrl)
- msoLogger.info("SDNC Callback URL: " + sdncCallbackUrl)
+ logger.info("SDNC Callback URL: " + sdncCallbackUrl)
StringBuilder sbParams = new StringBuilder()
Map<String, String> paramsMap = execution.getVariable("serviceInputParams")
@@ -147,14 +150,14 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
throw e;
} catch (Exception ex){
msg = "Exception in preProcessRequest " + ex.getMessage()
- msoLogger.error(msg)
+ logger.error(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.debug("***** Exit preProcessRequest *****")
+ logger.debug("***** Exit preProcessRequest *****")
}
public void postProcessAAIGET(DelegateExecution execution) {
- msoLogger.debug(" ***** postProcessAAIGET ***** ")
+ logger.debug(" ***** postProcessAAIGET ***** ")
String msg = ""
try {
@@ -163,14 +166,14 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
String serviceType = ""
if(foundInAAI){
- msoLogger.debug("Found Service-instance in AAI")
+ logger.debug("Found Service-instance in AAI")
String siData = execution.getVariable("GENGS_service")
- msoLogger.debug("SI Data")
+ logger.debug("SI Data")
if (isBlank(siData))
{
msg = "Could not retrive ServiceInstance data from AAI to delete id:" + serviceInstanceId
- msoLogger.error(msg)
+ logger.error(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
}
else
@@ -183,7 +186,7 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
// get model invariant id
// Get Template uuid and version
if (utils.nodeExists(siData, "model-invariant-id") && utils.nodeExists(siData, "model-version-id") ) {
- msoLogger.debug("SI Data model-invariant-id and model-version-id exist")
+ logger.debug("SI Data model-invariant-id and model-version-id exist")
def modelInvariantId = serviceXml.getElementsByTagName("model-invariant-id").item(0).getTextContent()
def modelVersionId = serviceXml.getElementsByTagName("model-version-id").item(0).getTextContent()
@@ -192,10 +195,10 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
execution.setVariable("model-version-id-original", modelVersionId)
}
- msoLogger.debug("SI Data" + siData)
+ logger.debug("SI Data" + siData)
//Confirm there are no related service instances (vnf/network or volume)
if (utils.nodeExists(siData, "relationship-list")) {
- msoLogger.debug("SI Data relationship-list exists")
+ logger.debug("SI Data relationship-list exists")
JSONArray jArray = new JSONArray()
XmlParser xmlParser = new XmlParser()
@@ -215,29 +218,29 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
}else{
boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator")
if(!succInAAI){
- msoLogger.debug("Error getting Service-instance from AAI :" + serviceInstanceId)
+ logger.debug("Error getting Service-instance from AAI :" + serviceInstanceId)
WorkflowException workflowException = execution.getVariable("WorkflowException")
if(workflowException != null){
- msoLogger.error("workflowException: " + workflowException)
+ logger.error("workflowException: " + workflowException)
exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage())
}
else {
msg = "Failure in postProcessAAIGET GENGS_SuccessIndicator:" + succInAAI
- msoLogger.error(msg)
+ logger.error(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
}
}
- msoLogger.debug("Service-instance NOT found in AAI. Silent Success")
+ logger.debug("Service-instance NOT found in AAI. Silent Success")
}
}catch (BpmnError e) {
throw e
} catch (Exception ex) {
msg = "Exception in DoDeleteE2EServiceInstance.postProcessAAIGET. " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.debug(" *** Exit postProcessAAIGET *** ")
+ logger.debug(" *** Exit postProcessAAIGET *** ")
}
private JSONObject getRelationShipData(node, isDebugEnabled){
@@ -247,7 +250,7 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
def rt = utils.getNodeText(relation, "related-to")
def rl = utils.getNodeText(relation, "related-link")
- msoLogger.debug("ServiceInstance Related NS/Configuration :" + rl)
+ logger.debug("ServiceInstance Related NS/Configuration :" + rl)
def rl_datas = utils.getIdenticalChildren(node, "relationship-data")
for(def rl_data : rl_datas) {
@@ -281,12 +284,12 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
}
}
- msoLogger.debug("Relationship related to Resource:" + jObj.toString())
+ logger.debug("Relationship related to Resource:" + jObj.toString())
return jObj
}
public void getCurrentNS(DelegateExecution execution){
- utils.log("INFO", "======== Start getCurrentNS Process ======== ", isDebugEnabled)
+ logger.info( "======== Start getCurrentNS Process ======== ")
def currentIndex = execution.getVariable("currentNSIndex")
List<String> nsSequence = execution.getVariable("nsSequence")
@@ -297,12 +300,12 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
execution.setVariable("GENGS_serviceInstanceId", "")
execution.setVariable("GENGS_serviceInstanceName", nsResourceType)
- msoLogger.debug("======== COMPLETED getCurrentNS Process ======== ")
+ logger.debug("======== COMPLETED getCurrentNS Process ======== ")
}
public void prepareDecomposeService(DelegateExecution execution) {
try {
- msoLogger.debug(" ***** Inside prepareDecomposeService of create generic e2e service ***** ")
+ logger.debug(" ***** Inside prepareDecomposeService of create generic e2e service ***** ")
String modelInvariantUuid = execution.getVariable("model-invariant-id-original")
String modelVersionId = execution.getVariable("model-version-id-original")
@@ -313,11 +316,11 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
}"""
execution.setVariable("serviceModelInfo", serviceModelInfo)
- msoLogger.debug(" ***** Completed prepareDecomposeService of create generic e2e service ***** ")
+ logger.debug(" ***** Completed prepareDecomposeService of create generic e2e service ***** ")
} catch (Exception ex) {
// try error in method block
String exceptionMessage = "Bpmn error encountered in create generic e2e service flow. Unexpected Error from method prepareDecomposeService() - " + ex.getMessage()
- msoLogger.error(exceptionMessage)
+ logger.error(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
}
@@ -336,7 +339,7 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
private JSONObject getRelatedResourceInAAI (DelegateExecution execution, JSONObject jObj)
{
- msoLogger.debug(" ***** Started getRelatedResourceInAAI *****")
+ logger.debug(" ***** Started getRelatedResourceInAAI *****")
String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution)
String urlLink = jObj.get("resourceLinkUrl")
@@ -349,7 +352,7 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
Response response = client.get()
int responseCode = response.getStatus()
execution.setVariable(Prefix + "GeRelatedResourceResponseCode", responseCode)
- msoLogger.debug(" Get RelatedResource code is: " + responseCode)
+ logger.debug(" Get RelatedResource code is: " + responseCode)
String aaiResponse = response.readEntity(String.class)
execution.setVariable(Prefix + "GetRelatedResourceResponse", aaiResponse)
@@ -358,7 +361,7 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
if(responseCode == 200 || responseCode == 201 || responseCode == 202 )
//200 OK 201 CREATED 202 ACCEPTED
{
- msoLogger.debug("GET RelatedResource Received a Good Response")
+ logger.debug("GET RelatedResource Received a Good Response")
execution.setVariable(Prefix + "SuccessIndicator", true)
execution.setVariable(Prefix + "FoundIndicator", true)
@@ -380,16 +383,16 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
}
else {
String exceptionMessage = "Get RelatedResource Received a Bad Response Code. Response Code is: " + responseCode
- msoLogger.error(exceptionMessage)
+ logger.error(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
- msoLogger.debug(" ***** Exit getRelatedResourceInAAI *****")
+ logger.debug(" ***** Exit getRelatedResourceInAAI *****")
return jObj
}
public void postDecomposeService(DelegateExecution execution) {
- msoLogger.debug(" ***** Inside processDecomposition() of delete generic e2e service flow ***** ")
+ logger.debug(" ***** Inside processDecomposition() of delete generic e2e service flow ***** ")
try {
ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
@@ -443,17 +446,17 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
}
execution.setVariable("isDeleteResourceListValid", isDeleteResourceListValid)
- msoLogger.debug("delete resource list : " + deleteRealResourceList)
+ logger.debug("delete resource list : " + deleteRealResourceList)
} catch (Exception ex) {
String exceptionMessage = "Bpmn error encountered in create generic e2e service flow. processDecomposition() - " + ex.getMessage()
- msoLogger.error(exceptionMessage)
+ logger.error(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
- utils.log("DEBUG", " ***** exit processDecomposition() of delete generic e2e service flow ***** ", isDebugEnabled)
+ logger.debug( " ***** exit processDecomposition() of delete generic e2e service flow ***** ")
}
public void preInitResourcesOperStatus(DelegateExecution execution){
- msoLogger.debug(" ======== STARTED preInitResourcesOperStatus Process ======== ")
+ logger.debug(" ======== STARTED preInitResourcesOperStatus Process ======== ")
try{
String serviceId = execution.getVariable("serviceInstanceId")
String operationId = execution.getVariable("operationId")
@@ -463,7 +466,7 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
String progress = "0"
String reason = ""
String operationContent = "Prepare service creation"
- msoLogger.debug("Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId + " operationType:" + operationType)
+ logger.debug("Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId + " operationType:" + operationType)
serviceId = UriUtils.encode(serviceId,"UTF-8")
execution.setVariable("serviceInstanceId", serviceId)
execution.setVariable("operationId", operationId)
@@ -494,18 +497,18 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
payload = utils.formatXml(payload)
execution.setVariable("CVFMI_initResOperStatusRequest", payload)
- msoLogger.debug("Outgoing initResourceOperationStatus: \n" + payload)
- msoLogger.debug("CreateVfModuleInfra Outgoing initResourceOperationStatus Request: " + payload)
+ logger.debug("Outgoing initResourceOperationStatus: \n" + payload)
+ logger.debug("CreateVfModuleInfra Outgoing initResourceOperationStatus Request: " + payload)
}catch(Exception e){
- msoLogger.debug("Exception Occured Processing preInitResourcesOperStatus. Exception is:\n" + e)
+ logger.debug("Exception Occured Processing preInitResourcesOperStatus. Exception is:\n" + e)
execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preInitResourcesOperStatus Method:\n" + e.getMessage())
}
- msoLogger.debug("======== COMPLETED preInitResourcesOperStatus Process ======== ")
+ logger.debug("======== COMPLETED preInitResourcesOperStatus Process ======== ")
}
public void prepareUpdateServiceOperationStatus(DelegateExecution execution){
- msoLogger.debug(" ======== STARTED prepareUpdateServiceOperationStatus Process ======== ")
+ logger.debug(" ======== STARTED prepareUpdateServiceOperationStatus Process ======== ")
try{
String serviceId = execution.getVariable("serviceInstanceId")
String operationId = execution.getVariable("operationId")
@@ -519,7 +522,7 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution)
execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint)
- msoLogger.debug("DB Adapter Endpoint is: " + dbAdapterEndpoint)
+ logger.debug("DB Adapter Endpoint is: " + dbAdapterEndpoint)
String payload =
"""<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
@@ -541,13 +544,13 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
payload = utils.formatXml(payload)
execution.setVariable("CVFMI_updateServiceOperStatusRequest", payload)
- msoLogger.debug("Outgoing updateServiceOperStatusRequest: \n" + payload)
+ logger.debug("Outgoing updateServiceOperStatusRequest: \n" + payload)
}catch(Exception e){
- msoLogger.error("Exception Occured Processing prepareUpdateServiceOperationStatus. Exception is:\n" + e)
+ logger.error("Exception Occured Processing prepareUpdateServiceOperationStatus. Exception is:\n" + e)
execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during prepareUpdateServiceOperationStatus Method:\n" + e.getMessage())
}
- msoLogger.debug("======== COMPLETED prepareUpdateServiceOperationStatus Process ======== ")
+ logger.debug("======== COMPLETED prepareUpdateServiceOperationStatus Process ======== ")
}
/**
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 67fbb97797..002e20e6d7 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
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -44,6 +46,8 @@ import org.onap.so.client.graphinventory.entities.uri.Depth
import org.onap.so.constants.Defaults
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
import org.springframework.web.util.UriUtils
import org.onap.so.utils.TargetEntity
@@ -52,7 +56,7 @@ import groovy.json.JsonOutput
import javax.ws.rs.core.Response
public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoDeleteNetworkInstance.class);
+ private static final Logger logger = LoggerFactory.getLogger( DoDeleteNetworkInstance.class);
String Prefix= "DELNWKI_"
String groovyClassName = "DoDeleteNetworkInstance"
@@ -116,7 +120,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable("prefix",Prefix)
- msoLogger.trace("Inside preProcessRequest() of " + groovyClassName + " Request ")
+ logger.trace("Inside preProcessRequest() of " + groovyClassName + " Request ")
// initialize flow variables
InitializeProcessVariables(execution)
@@ -130,12 +134,12 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
// JSON format request is sent, create xml
try {
def prettyJson = JsonOutput.prettyPrint(deleteNetwork.toString())
- msoLogger.debug(" Incoming message formatted . . . : " + '\n' + prettyJson)
+ logger.debug(" Incoming message formatted . . . : " + '\n' + prettyJson)
deleteNetwork = vidUtils.createXmlNetworkRequestInfra(execution, deleteNetwork)
} catch (Exception ex) {
String dataErrorMessage = " Invalid json format Request - " + ex.getMessage()
- msoLogger.debug(dataErrorMessage)
+ logger.debug(dataErrorMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage)
}
} else {
@@ -148,14 +152,14 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
}
deleteNetwork = utils.formatXml(deleteNetwork)
- msoLogger.debug(deleteNetwork)
+ logger.debug(deleteNetwork)
execution.setVariable(Prefix + "networkRequest", deleteNetwork)
- msoLogger.debug(Prefix + "networkRequest - " + '\n' + deleteNetwork)
+ logger.debug(Prefix + "networkRequest - " + '\n' + deleteNetwork)
// validate 'backout-on-failure' to override 'mso.rollback'
boolean rollbackEnabled = networkUtils.isRollbackEnabled(execution, deleteNetwork)
execution.setVariable(Prefix + "rollbackEnabled", rollbackEnabled)
- msoLogger.debug(Prefix + "rollbackEnabled - " + rollbackEnabled)
+ logger.debug(Prefix + "rollbackEnabled - " + rollbackEnabled)
String networkInputs = utils.getNodeXml(deleteNetwork, "network-inputs", false).replace("tag0:","").replace(":tag0","")
execution.setVariable(Prefix + "networkInputs", networkInputs)
@@ -164,15 +168,15 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
String messageId = execution.getVariable("testMessageId") // for testing
if (messageId == null || messageId == "") {
messageId = UUID.randomUUID()
- msoLogger.debug(Prefix + "messageId, random generated: " + messageId)
+ logger.debug(Prefix + "messageId, random generated: " + messageId)
} else {
- msoLogger.debug(Prefix + "messageId, pre-assigned: " + messageId)
+ logger.debug(Prefix + "messageId, pre-assigned: " + messageId)
}
execution.setVariable(Prefix + "messageId", messageId)
String source = utils.getNodeText(deleteNetwork, "source")
execution.setVariable(Prefix + "source", source)
- msoLogger.debug(Prefix + "source - " + source)
+ logger.debug(Prefix + "source - " + source)
String networkId = ""
if (utils.nodeExists(networkInputs, "network-id")) {
@@ -181,7 +185,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
sendSyncError(execution)
// missing value of network-id
String dataErrorMessage = "network-request has missing 'network-id' element/value."
- msoLogger.debug(" Invalid Request - " + dataErrorMessage)
+ logger.debug(" Invalid Request - " + dataErrorMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage)
}
}
@@ -195,7 +199,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
}
}
execution.setVariable(Prefix + "lcpCloudRegion", lcpCloudRegion)
- msoLogger.debug("lcpCloudRegion : " + lcpCloudRegion)
+ logger.debug("lcpCloudRegion : " + lcpCloudRegion)
String tenantId = null
if (utils.nodeExists(networkInputs, "tenant-id")) {
@@ -206,10 +210,10 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
}
execution.setVariable(Prefix + "tenantId", tenantId)
- msoLogger.debug("tenantId : " + tenantId)
+ logger.debug("tenantId : " + tenantId)
String sdncVersion = execution.getVariable("sdncVersion")
- msoLogger.debug("sdncVersion? : " + sdncVersion)
+ logger.debug("sdncVersion? : " + sdncVersion)
// PO Authorization Info / headers Authorization=
String basicAuthValuePO = UrnPropertiesReader.getVariable("mso.adapters.po.auth", execution)
@@ -221,7 +225,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
} catch (IOException ex) {
String dataErrorMessage = " Unable to encode PO/SDNC user/password string - " + ex.getMessage()
- msoLogger.debug(dataErrorMessage )
+ logger.debug(dataErrorMessage )
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage)
}
@@ -231,7 +235,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
} catch (Exception ex){
// caught exception
String exceptionMessage = "Exception Encountered in DoDeleteNetworkInstance, PreProcessRequest() - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
@@ -243,7 +247,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable("prefix",Prefix)
- msoLogger.debug(" ***** Inside callRESTQueryAAI() of DoDoDeleteNetworkInstance ***** " )
+ logger.debug(" ***** Inside callRESTQueryAAI() of DoDoDeleteNetworkInstance ***** " )
// get variables
String networkInputs = execution.getVariable(Prefix + "networkInputs")
@@ -273,7 +277,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
if(execution.getVariable(Prefix + "tenantId") == null) {
String tenantId = tenantURI.getURIKeys().get("tenant-id")
execution.setVariable(Prefix + "tenantId", tenantId)
- msoLogger.debug(" Get AAI getTenantId() : " + tenantId)
+ logger.debug(" Get AAI getTenantId() : " + tenantId)
}
}
List<AAIResourceUri> cloudRegionURIList = relationships.get().getRelatedAAIUris(AAIObjectType.CLOUD_REGION)
@@ -281,24 +285,24 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
if(execution.getVariable(Prefix + "lcpCloudRegion") == null) {
String lcpCloudRegion = tenantURI.getURIKeys().get("cloud-region-id")
execution.setVariable(Prefix + "lcpCloudRegion", lcpCloudRegion)
- msoLogger.debug(" Get AAI getCloudRegion() : " + lcpCloudRegion)
+ logger.debug(" Get AAI getCloudRegion() : " + lcpCloudRegion)
}
}
}
}
- msoLogger.debug(Prefix + "isVfRelationshipExist - " + isVfRelationshipExist)
+ logger.debug(Prefix + "isVfRelationshipExist - " + isVfRelationshipExist)
} else {
// not found // empty aai response
execution.setVariable(Prefix + "aaiReturnCode", 404)
execution.setVariable(Prefix + "isAAIGood", false)
execution.setVariable(Prefix + "isSilentSuccess", true)
- msoLogger.debug(" AAI Query is Silent Success")
+ logger.debug(" AAI Query is Silent Success")
}
- msoLogger.debug(" AAI Query call, isAAIGood? : " + execution.getVariable(Prefix + "isAAIGood"))
+ logger.debug(" AAI Query call, isAAIGood? : " + execution.getVariable(Prefix + "isAAIGood"))
} catch (Exception ex) {
// caught exception
String exceptionMessage = "Exception Encountered in DoDeleteNetworkInstance, callRESTQueryAAI() - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
@@ -309,7 +313,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable("prefix", Prefix)
- msoLogger.debug(" ***** Inside callRESTQueryAAICloudRegion of DoDeleteNetworkInstance ***** " )
+ logger.debug(" ***** Inside callRESTQueryAAICloudRegion of DoDeleteNetworkInstance ***** " )
try {
String networkInputs = execution.getVariable(Prefix + "networkInputs")
@@ -332,7 +336,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
} else {
String dataErrorMessage = "QueryAAICloudRegion Unsuccessful. Return Code: " + execution.getVariable(Prefix + "queryCloudRegionReturnCode")
- msoLogger.debug(dataErrorMessage)
+ logger.debug(dataErrorMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage)
}
@@ -343,7 +347,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
} catch (Exception ex) {
// caught exception
String exceptionMessage = "Bpmn error encountered in DoDeleteNetworkInstance, callRESTQueryAAICloudRegion(). Unexpected Response from AAI - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
@@ -354,7 +358,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable("prefix", Prefix)
- msoLogger.trace("Inside prepareNetworkRequest of DoDeleteNetworkInstance ")
+ logger.trace("Inside prepareNetworkRequest of DoDeleteNetworkInstance ")
ExceptionUtil exceptionUtil = new ExceptionUtil()
try {
// get variables
@@ -411,23 +415,23 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
</deleteNetworkRequest>
""".trim()
- msoLogger.debug(Prefix + "deleteNetworkRequest - " + "\n" + deleteNetworkRequest)
+ logger.debug(Prefix + "deleteNetworkRequest - " + "\n" + deleteNetworkRequest)
// Format Response
String buildDeleteNetworkRequestAsString = utils.formatXml(deleteNetworkRequest)
- msoLogger.debug(buildDeleteNetworkRequestAsString)
- msoLogger.debug(Prefix + "deleteNetworkRequestAsString - " + "\n" + buildDeleteNetworkRequestAsString)
+ logger.debug(buildDeleteNetworkRequestAsString)
+ logger.debug(Prefix + "deleteNetworkRequestAsString - " + "\n" + buildDeleteNetworkRequestAsString)
String restURL = UrnPropertiesReader.getVariable("mso.adapters.network.rest.endpoint", execution)
execution.setVariable("mso.adapters.network.rest.endpoint", restURL + "/" + networkId)
- msoLogger.debug("mso.adapters.network.rest.endpoint - " + "\n" + restURL + "/" + networkId)
+ logger.debug("mso.adapters.network.rest.endpoint - " + "\n" + restURL + "/" + networkId)
execution.setVariable(Prefix + "deleteNetworkRequest", buildDeleteNetworkRequestAsString)
- msoLogger.debug(Prefix + "deleteNetworkRequest - " + "\n" + buildDeleteNetworkRequestAsString)
+ logger.debug(Prefix + "deleteNetworkRequest - " + "\n" + buildDeleteNetworkRequestAsString)
}
catch (Exception ex) {
// caught exception
String exceptionMessage = "Bpmn error encountered in DoDeleteNetworkInstance, prepareNetworkRequest(). Unexpected Response from AAI - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
@@ -442,7 +446,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
try {
@@ -461,8 +465,10 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
} catch (Exception ex) {
// caught exception
String exceptionMessage = "Bpmn error encountered in DoDeleteNetworkInstance, sendRequestToVnfAdapter() - " + ex.getMessage()
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, exceptionMessage, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + ex);
- msoLogger.debug(exceptionMessage)
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), exceptionMessage,
+ "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(),
+ "Exception is:\n" + ex);
+ logger.debug(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
@@ -473,7 +479,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable("prefix", Prefix)
- msoLogger.trace("Inside prepareSDNCRequest of DoDeleteNetworkInstance ")
+ logger.trace("Inside prepareSDNCRequest of DoDeleteNetworkInstance ")
try {
// get variables
@@ -496,7 +502,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
requestId = execution.getVariable("mso-request-id")
}
execution.setVariable(Prefix + "requestId", requestId)
- msoLogger.debug(Prefix + "requestId " + requestId)
+ logger.debug(Prefix + "requestId " + requestId)
L3Network queryAAIResponse = execution.getVariable(Prefix + "queryAAIResponse")
SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils()
@@ -504,15 +510,17 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
// 1. prepare delete topology via SDNC Adapter SUBFLOW call
String sndcTopologyDeleteRequest = sdncAdapterUtils.sdncTopologyRequestV2(execution, deleteNetworkInput, serviceInstanceId, sdncCallback, "delete", "DisconnectNetworkRequest", cloudRegionId, networkId, queryAAIResponse, null)
String sndcTopologyDeleteRequesAsString = utils.formatXml(sndcTopologyDeleteRequest)
- msoLogger.debug(sndcTopologyDeleteRequesAsString)
+ logger.debug(sndcTopologyDeleteRequesAsString)
execution.setVariable(Prefix + "deleteSDNCRequest", sndcTopologyDeleteRequesAsString)
- msoLogger.debug(Prefix + "deleteSDNCRequest - " + "\n" + sndcTopologyDeleteRequesAsString)
+ logger.debug(Prefix + "deleteSDNCRequest - " + "\n" + sndcTopologyDeleteRequesAsString)
} catch (Exception ex) {
// caught exception
String exceptionMessage = "Bpmn error encountered in DoDeleteNetworkInstance, prepareSDNCRequest() - " + ex.getMessage()
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, exceptionMessage, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + ex);
- msoLogger.debug(exceptionMessage)
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), exceptionMessage,
+ "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(),
+ "Exception is:\n" + ex);
+ logger.debug(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
@@ -523,7 +531,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable("prefix", Prefix)
- msoLogger.trace("Inside prepareRpcSDNCRequest of DoDeleteNetworkInstance ")
+ logger.trace("Inside prepareRpcSDNCRequest of DoDeleteNetworkInstance ")
try {
// get variables
@@ -543,15 +551,17 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
// 1. prepare delete topology via SDNC Adapter SUBFLOW call
String sndcTopologyRollbackRpcRequest = sdncAdapterUtils.sdncTopologyRequestRsrc(execution, deleteNetworkInput, serviceInstanceId, sdncCallback, "unassign", "DeleteNetworkInstance", cloudRegionId, networkId, null)
String sndcTopologyDeleteRequesAsString = utils.formatXml(sndcTopologyRollbackRpcRequest)
- msoLogger.debug(sndcTopologyDeleteRequesAsString)
+ logger.debug(sndcTopologyDeleteRequesAsString)
execution.setVariable(Prefix + "deleteSDNCRequest", sndcTopologyDeleteRequesAsString)
- msoLogger.debug(Prefix + "deleteSDNCRequest - " + "\n" + sndcTopologyDeleteRequesAsString)
+ logger.debug(Prefix + "deleteSDNCRequest - " + "\n" + sndcTopologyDeleteRequesAsString)
} catch (Exception ex) {
// caught exception
String exceptionMessage = "Bpmn error encountered in DoDeleteNetworkInstance, prepareSDNCRequest() - " + ex.getMessage()
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, exceptionMessage, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + ex);
- msoLogger.debug(exceptionMessage)
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), exceptionMessage,
+ "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(),
+ "Exception is:\n" + ex);
+ logger.debug(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
@@ -563,7 +573,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable("prefix",Prefix)
- msoLogger.trace("Inside prepareRpcSDNCDeactivate() of DoDeleteNetworkInstance ")
+ logger.trace("Inside prepareRpcSDNCDeactivate() of DoDeleteNetworkInstance ")
try {
@@ -581,12 +591,12 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
String sndcTopologyRollbackRpcRequest = sdncAdapterUtils.sdncTopologyRequestRsrc(execution, deleteNetworkInput, serviceInstanceId, sdncCallback, "deactivate", "DeleteNetworkInstance", cloudRegionId, networkId, null)
String sndcTopologyRollbackRpcRequestAsString = utils.formatXml(sndcTopologyRollbackRpcRequest)
execution.setVariable(Prefix + "deactivateSDNCRequest", sndcTopologyRollbackRpcRequestAsString)
- msoLogger.debug(" Preparing request for RPC SDNC Topology deactivate - " + "\n" + sndcTopologyRollbackRpcRequestAsString)
+ logger.debug(" Preparing request for RPC SDNC Topology deactivate - " + "\n" + sndcTopologyRollbackRpcRequestAsString)
} catch (Exception ex) {
String exceptionMessage = " Bpmn error encountered in DoDeleteNetworkInstance flow. prepareRpcSDNCActivateRollback() - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage)
}
@@ -601,24 +611,24 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable("prefix", Prefix)
- msoLogger.trace("Inside validateNetworkResponse of DoDeleteNetworkInstance ")
+ logger.trace("Inside validateNetworkResponse of DoDeleteNetworkInstance ")
try {
String returnCode = execution.getVariable(Prefix + "networkReturnCode")
String networkResponse = execution.getVariable(Prefix + "deleteNetworkResponse")
- msoLogger.debug(" Network Adapter responseCode: " + returnCode)
- msoLogger.debug("Network Adapter Response - " + "\n" + networkResponse)
- msoLogger.debug(networkResponse)
+ logger.debug(" Network Adapter responseCode: " + returnCode)
+ logger.debug("Network Adapter Response - " + "\n" + networkResponse)
+ logger.debug(networkResponse)
String errorMessage = ""
if (returnCode == "200") {
- msoLogger.debug(" Network Adapter Response is successful - " + "\n" + networkResponse)
+ logger.debug(" Network Adapter Response is successful - " + "\n" + networkResponse)
// prepare rollback data
String rollbackData = utils.getNodeXml(networkResponse, "rollback", false).replace("tag0:","").replace(":tag0","")
if ((rollbackData == null) || (rollbackData.isEmpty())) {
- msoLogger.debug(" Network Adapter 'rollback' data is not Sent: " + "\n" + networkResponse)
+ logger.debug(" Network Adapter 'rollback' data is not Sent: " + "\n" + networkResponse)
execution.setVariable(Prefix + "rollbackNetworkRequest", "")
} else {
String rollbackNetwork =
@@ -627,7 +637,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
</NetworkAdapter:rollbackNetwork>"""
String rollbackNetworkXml = utils.formatXml(rollbackNetwork)
execution.setVariable(Prefix + "rollbackNetworkRequest", rollbackNetworkXml)
- msoLogger.debug(" Network Adapter rollback data - " + "\n" + rollbackNetworkXml)
+ logger.debug(" Network Adapter rollback data - " + "\n" + rollbackNetworkXml)
}
@@ -664,7 +674,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
} catch (Exception ex) {
// caught exception
String exceptionMessage = "Bpmn error encountered in DoDeleteNetworkInstance, validateNetworkResponse() - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
@@ -675,7 +685,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable("prefix", Prefix)
- msoLogger.trace("Inside validateSDNCResponse of DoDeleteNetworkInstance ")
+ logger.trace("Inside validateSDNCResponse of DoDeleteNetworkInstance ")
String response = execution.getVariable(Prefix + "deleteSDNCResponse")
boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator")
@@ -691,9 +701,9 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
if (execution.getVariable(Prefix + "sdncResponseSuccess") == true) { // from sdnc util, prefix+'sdncResponseSuccess'
execution.setVariable(Prefix + "isSdncRollbackNeeded", true) //
execution.setVariable(Prefix + "isPONR", true)
- msoLogger.debug("Successfully Validated SDNC Response")
+ logger.debug("Successfully Validated SDNC Response")
} else {
- msoLogger.debug("Did NOT Successfully Validated SDNC Response")
+ logger.debug("Did NOT Successfully Validated SDNC Response")
throw new BpmnError("MSOWorkflowException")
}
@@ -703,7 +713,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable("prefix",Prefix)
- msoLogger.trace("Inside validateRpcSDNCDeactivateResponse() of DoDeleteNetworkInstance ")
+ logger.trace("Inside validateRpcSDNCDeactivateResponse() of DoDeleteNetworkInstance ")
String response = execution.getVariable(Prefix + "deactivateSDNCResponse")
boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator")
@@ -718,10 +728,10 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
if (execution.getVariable(Prefix + "sdncResponseSuccess") == true) { // from sdnc util, Prefix+'sdncResponseSuccess'
execution.setVariable(Prefix + "isSdncDeactivateRollbackNeeded", true)
- msoLogger.debug("Successfully Validated Rpc SDNC Activate Response")
+ logger.debug("Successfully Validated Rpc SDNC Activate Response")
} else {
- msoLogger.debug("Did NOT Successfully Validated Rpc SDNC Deactivate Response")
+ logger.debug("Did NOT Successfully Validated Rpc SDNC Deactivate Response")
throw new BpmnError("MSOWorkflowException")
}
@@ -731,7 +741,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable("prefix",Prefix)
- msoLogger.trace("Inside prepareRpcSDNCDeactivateRollback() of DoDeleteNetworkInstance ")
+ logger.trace("Inside prepareRpcSDNCDeactivateRollback() of DoDeleteNetworkInstance ")
try {
@@ -748,12 +758,12 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
String sndcTopologyRollbackRpcRequest = sdncAdapterUtils.sdncTopologyRequestRsrc(execution, deleteNetworkInput, serviceInstanceId, sdncCallback, "activate", "CreateNetworkInstance", cloudRegionId, networkId, null)
String sndcTopologyRollbackRpcRequestAsString = utils.formatXml(sndcTopologyRollbackRpcRequest)
execution.setVariable(Prefix + "rollbackDeactivateSDNCRequest", sndcTopologyRollbackRpcRequestAsString)
- msoLogger.debug(" Preparing request for RPC SDNC Topology 'activate-CreateNetworkInstance' rollback . . . - " + "\n" + sndcTopologyRollbackRpcRequestAsString)
+ logger.debug(" Preparing request for RPC SDNC Topology 'activate-CreateNetworkInstance' rollback . . . - " + "\n" + sndcTopologyRollbackRpcRequestAsString)
} catch (Exception ex) {
String exceptionMessage = " Bpmn error encountered in DoDeleteNetworkInstance flow. prepareRpcSDNCDeactivateRollback() - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage)
}
@@ -764,7 +774,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable("prefix",Prefix)
- msoLogger.trace("Inside prepareRollbackData() of DoDeleteNetworkInstance ")
+ logger.trace("Inside prepareRollbackData() of DoDeleteNetworkInstance ")
try {
@@ -782,14 +792,14 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
}
}
execution.setVariable("rollbackData", rollbackData)
- msoLogger.debug("** rollbackData : " + rollbackData)
+ logger.debug("** rollbackData : " + rollbackData)
execution.setVariable("WorkflowException", execution.getVariable("WorkflowException"))
- msoLogger.debug("** WorkflowException : " + execution.getVariable("WorkflowException"))
+ logger.debug("** WorkflowException : " + execution.getVariable("WorkflowException"))
} catch (Exception ex) {
String exceptionMessage = " Bpmn error encountered in DoDeleteNetworkInstance flow. prepareRollbackData() - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage)
}
@@ -800,11 +810,11 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable("prefix", Prefix)
- msoLogger.trace("Inside postProcessResponse of DoDeleteNetworkInstance ")
+ logger.trace("Inside postProcessResponse of DoDeleteNetworkInstance ")
try {
- msoLogger.debug(" ***** Is Exception Encountered (isException)? : " + execution.getVariable(Prefix + "isException"))
+ logger.debug(" ***** Is Exception Encountered (isException)? : " + execution.getVariable(Prefix + "isException"))
if (execution.getVariable(Prefix + "isException") == false) {
execution.setVariable(Prefix + "Success", true)
execution.setVariable("WorkflowException", null)
@@ -820,7 +830,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable("rollbackData", null)
String exceptionMessage = " Exception encountered in MSO Bpmn. "
if (execution.getVariable("workflowException") != null) { // Output of Rollback flow.
- msoLogger.debug(" ***** workflowException: " + execution.getVariable("workflowException"))
+ logger.debug(" ***** workflowException: " + execution.getVariable("workflowException"))
WorkflowException wfex = execution.getVariable("workflowException")
exceptionMessage = wfex.getErrorMessage()
} else {
@@ -836,20 +846,20 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
}
// going to the Main flow: a-la-carte or macro
- msoLogger.debug(" ***** postProcessResponse(), BAD !!!")
+ logger.debug(" ***** postProcessResponse(), BAD !!!")
exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage)
throw new BpmnError("MSOWorkflowException")
}
} catch(BpmnError b){
- msoLogger.debug("Rethrowing MSOWorkflowException")
+ logger.debug("Rethrowing MSOWorkflowException")
throw b
} catch (Exception ex) {
// caught exception
String exceptionMessage = "Bpmn error encountered in DoDeleteNetworkInstance, postProcessResponse() - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage)
throw new BpmnError("MSOWorkflowException")
@@ -861,7 +871,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable("prefix",Prefix)
- msoLogger.trace("Inside prepareSuccessRollbackData() of DoDeleteNetworkInstance ")
+ logger.trace("Inside prepareSuccessRollbackData() of DoDeleteNetworkInstance ")
try {
@@ -893,13 +903,13 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
}
execution.setVariable("rollbackData", rollbackData)
- msoLogger.debug("** rollbackData : " + rollbackData)
+ logger.debug("** rollbackData : " + rollbackData)
execution.setVariable("WorkflowException", null)
} catch (Exception ex) {
String exceptionMessage = " Bpmn error encountered in DoDeleteNetworkInstance flow. prepareSuccessRollbackData() - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage)
}
@@ -910,7 +920,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable("prefix",Prefix)
- msoLogger.trace("Inside prepareRpcSDNCUnassignRollbac() of DoDeleteNetworkInstance ")
+ logger.trace("Inside prepareRpcSDNCUnassignRollbac() of DoDeleteNetworkInstance ")
try {
@@ -928,15 +938,15 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
// 1. prepare delete topology via SDNC Adapter SUBFLOW call
String sndcTopologyRollbackRpcRequest = sdncAdapterUtils.sdncTopologyRequestRsrc(execution, deleteNetworkInput, serviceInstanceId, sdncCallback, "assign", "CreateNetworkInstance", cloudRegionId, networkId, null)
String sndcTopologyDeleteRequesAsString = utils.formatXml(sndcTopologyRollbackRpcRequest)
- msoLogger.debug(sndcTopologyDeleteRequesAsString)
+ logger.debug(sndcTopologyDeleteRequesAsString)
execution.setVariable(Prefix + "rollbackSDNCRequest", sndcTopologyDeleteRequesAsString)
- msoLogger.debug(Prefix + "rollbackSDNCRequest" + "\n" + sndcTopologyDeleteRequesAsString)
- msoLogger.debug(" Preparing request for RPC SDNC Topology 'assign-CreateNetworkInstance' rollback . . . - " + "\n" + sndcTopologyDeleteRequesAsString)
+ logger.debug(Prefix + "rollbackSDNCRequest" + "\n" + sndcTopologyDeleteRequesAsString)
+ logger.debug(" Preparing request for RPC SDNC Topology 'assign-CreateNetworkInstance' rollback . . . - " + "\n" + sndcTopologyDeleteRequesAsString)
} catch (Exception ex) {
String exceptionMessage = " Bpmn error encountered in DoDeleteNetworkInstance flow. prepareRpcSDNCUnassignRollback() - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage)
}
@@ -947,7 +957,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable("prefix", Prefix)
- msoLogger.trace("Inside prepareSDNCRollback of DoDeleteNetworkInstance ")
+ logger.trace("Inside prepareSDNCRollback of DoDeleteNetworkInstance ")
try {
@@ -979,17 +989,19 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
// 1. prepare delete topology via SDNC Adapter SUBFLOW call
String sndcTopologyDeleteRequest = sdncAdapterUtils.sdncTopologyRequestV2(execution, deleteNetworkInput, serviceInstanceId, sdncCallback, "rollback", "DisconnectNetworkRequest", cloudRegionId, networkId, queryAAIResponse, null)
String sndcTopologyDeleteRequesAsString = utils.formatXml(sndcTopologyDeleteRequest)
- msoLogger.debug(sndcTopologyDeleteRequesAsString)
+ logger.debug(sndcTopologyDeleteRequesAsString)
execution.setVariable(Prefix + "rollbackSDNCRequest", sndcTopologyDeleteRequesAsString)
- msoLogger.debug(Prefix + "rollbackSDNCRequest - " + "\n" + sndcTopologyDeleteRequesAsString)
- msoLogger.debug(" Preparing request for RPC SDNC Topology 'rollback-DisconnectNetworkRequest' rollback . . . - " + "\n" + sndcTopologyDeleteRequesAsString)
+ logger.debug(Prefix + "rollbackSDNCRequest - " + "\n" + sndcTopologyDeleteRequesAsString)
+ logger.debug(" Preparing request for RPC SDNC Topology 'rollback-DisconnectNetworkRequest' rollback . . . - " + "\n" + sndcTopologyDeleteRequesAsString)
} catch (Exception ex) {
// caught exception
String exceptionMessage = "Bpmn error encountered in DoDeleteNetworkInstance, prepareSDNCRollback() - " + ex.getMessage()
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, exceptionMessage, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + ex);
- msoLogger.debug(exceptionMessage)
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), exceptionMessage,
+ "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(),
+ "Exception is:\n" + ex);
+ logger.debug(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
@@ -1000,7 +1012,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable("prefix",Prefix)
- msoLogger.trace("Inside setExceptionFlag() of DoDeleteNetworkInstance ")
+ logger.trace("Inside setExceptionFlag() of DoDeleteNetworkInstance ")
try {
@@ -1011,11 +1023,11 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
} else {
execution.setVariable(Prefix + "WorkflowException", execution.getVariable("WorkflowException"))
}
- msoLogger.debug(Prefix + "WorkflowException - " +execution.getVariable(Prefix + "WorkflowException"))
+ logger.debug(Prefix + "WorkflowException - " +execution.getVariable(Prefix + "WorkflowException"))
} catch(Exception ex){
String exceptionMessage = "Bpmn error encountered in DoDeleteNetworkInstance flow. setExceptionFlag(): " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage)
}
@@ -1030,18 +1042,18 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable("prefix",Prefix)
try{
- msoLogger.debug("Caught a Java Exception")
- msoLogger.debug("Started processJavaException Method")
- msoLogger.debug("Variables List: " + execution.getVariables())
+ logger.debug("Caught a Java Exception")
+ logger.debug("Started processJavaException Method")
+ logger.debug("Variables List: " + execution.getVariables())
execution.setVariable("UnexpectedError", "Caught a Java Lang Exception") // Adding this line temporarily until this flows error handling gets updated
exceptionUtil.buildWorkflowException(execution, 500, "Caught a Java Lang Exception")
}catch(Exception e){
- msoLogger.debug("Caught Exception during processJavaException Method: " + e)
+ logger.debug("Caught Exception during processJavaException Method: " + e)
execution.setVariable("UnexpectedError", "Exception in processJavaException method") // Adding this line temporarily until this flows error handling gets updated
exceptionUtil.buildWorkflowException(execution, 500, "Exception in processJavaException method")
}
- msoLogger.debug("Completed processJavaException Method of " + Prefix)
+ logger.debug("Completed processJavaException Method of " + Prefix)
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstanceRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstanceRollback.groovy
index 1db7475cba..d09fb03445 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstanceRollback.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstanceRollback.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -40,15 +42,15 @@ import org.apache.commons.lang3.*
import org.apache.commons.codec.binary.Base64;
import org.springframework.web.util.UriUtils
-import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
/**
* This groovy class supports the <class>DoCreateNetworkInstanceRollback.bpmn</class> process.
*
*/
public class DoDeleteNetworkInstanceRollback extends AbstractServiceTaskProcessor {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoDeleteNetworkInstanceRollback.class);
+ private static final Logger logger = LoggerFactory.getLogger( DoDeleteNetworkInstanceRollback.class);
String Prefix="DELNWKIR_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
@@ -96,7 +98,7 @@ public class DoDeleteNetworkInstanceRollback extends AbstractServiceTaskProcesso
execution.setVariable("prefix",Prefix)
- msoLogger.trace("Inside preProcessRequest() of " + className + ".groovy ")
+ logger.trace("Inside preProcessRequest() of " + className + ".groovy ")
try {
// initialize flow variables
@@ -126,10 +128,10 @@ public class DoDeleteNetworkInstanceRollback extends AbstractServiceTaskProcesso
execution.setVariable(Prefix + "rollbackNetworkRequest", rollbackNetworkRequest)
execution.setVariable(Prefix + "rollbackSDNCRequest", rollbackSDNCRequest)
execution.setVariable(Prefix + "rollbackDeactivateSDNCRequest", rollbackDeactivateSDNCRequest)
- msoLogger.debug("'rollbackData': " + '\n' + execution.getVariable("rollbackData"))
+ logger.debug("'rollbackData': " + '\n' + execution.getVariable("rollbackData"))
String sdncVersion = execution.getVariable("sdncVersion")
- msoLogger.debug("sdncVersion? : " + sdncVersion)
+ logger.debug("sdncVersion? : " + sdncVersion)
// PO Authorization Info / headers Authorization=
String basicAuthValuePO = UrnPropertiesReader.getVariable("mso.adapters.po.auth",execution)
@@ -141,7 +143,7 @@ public class DoDeleteNetworkInstanceRollback extends AbstractServiceTaskProcesso
} catch (IOException ex) {
String exceptionMessage = "Exception Encountered in DoCreateNetworkInstance, PreProcessRequest() - "
String dataErrorMessage = exceptionMessage + " Unable to encode PO/SDNC user/password string - " + ex.getMessage()
- msoLogger.debug(dataErrorMessage )
+ logger.debug(dataErrorMessage )
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage)
}
@@ -150,7 +152,7 @@ public class DoDeleteNetworkInstanceRollback extends AbstractServiceTaskProcesso
} else {
execution.setVariable(Prefix + "WorkflowException", execution.getVariable("WorkflowException"))
}
- msoLogger.debug("*** WorkflowException : " + execution.getVariable(Prefix + "WorkflowException"))
+ logger.debug("*** WorkflowException : " + execution.getVariable(Prefix + "WorkflowException"))
if(execution.getVariable(Prefix + "WorkflowException") != null) {
// called by: DoCreateNetworkInstance, partial rollback
execution.setVariable(Prefix + "fullRollback", false)
@@ -161,7 +163,7 @@ public class DoDeleteNetworkInstanceRollback extends AbstractServiceTaskProcesso
}
- msoLogger.debug("*** fullRollback? : " + execution.getVariable(Prefix + "fullRollback"))
+ logger.debug("*** fullRollback? : " + execution.getVariable(Prefix + "fullRollback"))
} catch (BpmnError e) {
throw e;
@@ -170,7 +172,7 @@ public class DoDeleteNetworkInstanceRollback extends AbstractServiceTaskProcesso
sendSyncError(execution)
// caught exception
String exceptionMessage = "Exception Encountered in PreProcessRequest() of " + className + ".groovy ***** : " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
@@ -181,7 +183,7 @@ public class DoDeleteNetworkInstanceRollback extends AbstractServiceTaskProcesso
execution.setVariable("prefix",Prefix)
- msoLogger.trace("Inside validateRollbackResponses() of DoDeleteNetworkInstanceRollback ")
+ logger.trace("Inside validateRollbackResponses() of DoDeleteNetworkInstanceRollback ")
try {
@@ -207,8 +209,8 @@ public class DoDeleteNetworkInstanceRollback extends AbstractServiceTaskProcesso
} else {
rollbackDeactivateSDNCMessages = " + SDNC deactivate rollback failed. "
}
- msoLogger.debug(" SDNC deactivate rollback Code - " + rollbackDeactivateSDNCReturnCode)
- msoLogger.debug(" SDNC deactivate rollback Response - " + rollbackDeactivateSDNCResponse)
+ logger.debug(" SDNC deactivate rollback Code - " + rollbackDeactivateSDNCReturnCode)
+ logger.debug(" SDNC deactivate rollback Response - " + rollbackDeactivateSDNCResponse)
}
// validate SDNC rollback response
@@ -234,8 +236,8 @@ public class DoDeleteNetworkInstanceRollback extends AbstractServiceTaskProcesso
} else {
rollbackSdncErrorMessages = " + SDNC unassign rollback failed. "
}
- msoLogger.debug(" SDNC assign rollback Code - " + rollbackSDNCReturnCode)
- msoLogger.debug(" SDNC assign rollback Response - " + rollbackSDNCResponse)
+ logger.debug(" SDNC assign rollback Code - " + rollbackSDNCReturnCode)
+ logger.debug(" SDNC assign rollback Response - " + rollbackSDNCResponse)
}
// validate PO network rollback response
@@ -250,13 +252,13 @@ public class DoDeleteNetworkInstanceRollback extends AbstractServiceTaskProcesso
rollbackNetworkErrorMessages = " + PO Network rollback completed."
}
- msoLogger.debug(" NetworkRollback Code - " + rollbackNetworkReturnCode)
- msoLogger.debug(" NetworkRollback Response - " + rollbackNetworkResponse)
+ logger.debug(" NetworkRollback Code - " + rollbackNetworkReturnCode)
+ logger.debug(" NetworkRollback Response - " + rollbackNetworkResponse)
}
String statusMessage = ""
int errorCode = 7000
- msoLogger.debug("*** fullRollback? : " + execution.getVariable(Prefix + "fullRollback"))
+ logger.debug("*** fullRollback? : " + execution.getVariable(Prefix + "fullRollback"))
if (execution.getVariable(Prefix + "fullRollback") == false) {
WorkflowException wfe = execution.getVariable(Prefix + "WorkflowException") // original WorkflowException
if (wfe != null) {
@@ -278,7 +280,7 @@ public class DoDeleteNetworkInstanceRollback extends AbstractServiceTaskProcesso
}
statusMessage = statusMessage + rollbackDeactivateSDNCMessages + rollbackNetworkErrorMessages + rollbackSdncErrorMessages
- msoLogger.debug("Final DoDeleteNetworkInstanceRollback status message: " + statusMessage)
+ logger.debug("Final DoDeleteNetworkInstanceRollback status message: " + statusMessage)
String processKey = getProcessKey(execution);
WorkflowException exception = new WorkflowException(processKey, errorCode, statusMessage);
execution.setVariable("workflowException", exception);
@@ -290,7 +292,7 @@ public class DoDeleteNetworkInstanceRollback extends AbstractServiceTaskProcesso
execution.setVariable("rollbackError", false)
} else {
String exceptionMessage = "Network Delete Rollback was not Successful. "
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
execution.setVariable("rollbackSuccessful", false)
execution.setVariable("rollbackError", true)
exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage)
@@ -301,7 +303,7 @@ public class DoDeleteNetworkInstanceRollback extends AbstractServiceTaskProcesso
} catch (Exception ex) {
String errorMessage = "See Previous Camunda flows for cause of Error: Undetermined Exception."
String exceptionMessage = " Bpmn error encountered in DoDeleteNetworkInstanceRollback flow. validateRollbackResponses() - " + errorMessage + ": " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage)
}
@@ -319,18 +321,18 @@ public class DoDeleteNetworkInstanceRollback extends AbstractServiceTaskProcesso
execution.setVariable("prefix",Prefix)
try{
- msoLogger.debug("Caught a Java Exception in " + Prefix)
- msoLogger.debug("Started processJavaException Method")
- msoLogger.debug("Variables List: " + execution.getVariables())
+ logger.debug("Caught a Java Exception in " + Prefix)
+ logger.debug("Started processJavaException Method")
+ logger.debug("Variables List: " + execution.getVariables())
execution.setVariable("UnexpectedError", "Caught a Java Lang Exception - " + Prefix) // Adding this line temporarily until this flows error handling gets updated
exceptionUtil.buildWorkflowException(execution, 500, "Caught a Java Lang Exception")
}catch(Exception e){
- msoLogger.debug("Caught Exception during processJavaException Method: " + e)
+ logger.debug("Caught Exception during processJavaException Method: " + e)
execution.setVariable("UnexpectedError", "Exception in processJavaException method - " + Prefix) // Adding this line temporarily until this flows error handling gets updated
exceptionUtil.buildWorkflowException(execution, 500, "Exception in processJavaException method" + Prefix)
}
- msoLogger.debug("Completed processJavaException Method in " + Prefix)
+ logger.debug("Completed processJavaException Method in " + Prefix)
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy
index 6a31095920..7e194657fb 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy
@@ -5,6 +5,8 @@
* ================================================================================
* Copyright (C) 2018 Huawei Technologies Co., Ltd. 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
@@ -43,7 +45,8 @@ import org.onap.so.bpmn.core.domain.VnfResource
import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.bpmn.infrastructure.properties.BPMNProperties
-import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
/**
* input for script :
@@ -62,7 +65,7 @@ import org.onap.so.logger.MsoLogger
*/
public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoDeleteResourcesV1.class);
+ private static final Logger logger = LoggerFactory.getLogger( DoDeleteResourcesV1.class);
String Prefix="DDR_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
@@ -70,7 +73,7 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor {
CatalogDbUtils catalogDbUtils = new CatalogDbUtilsFactory().create()
public void preProcessRequest (DelegateExecution execution) {
- msoLogger.debug(" ***** preProcessRequest *****")
+ logger.debug(" ***** preProcessRequest *****")
String msg = ""
try {
@@ -95,18 +98,18 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor {
String serviceInstanceId = execution.getVariable("serviceInstanceId")
if (isBlank(serviceInstanceId)){
msg = "Input serviceInstanceId is null"
- msoLogger.error(msg)
+ logger.error(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
}
String sdncCallbackUrl = UrnPropertiesReader.getVariable('URN_mso_workflow_sdncadapter_callback', execution)
if (isBlank(sdncCallbackUrl)) {
msg = "URN_mso_workflow_sdncadapter_callback is null"
- msoLogger.error(msg)
+ logger.error(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
}
execution.setVariable("sdncCallbackUrl", sdncCallbackUrl)
- msoLogger.debug("SDNC Callback URL: " + sdncCallbackUrl)
+ logger.debug("SDNC Callback URL: " + sdncCallbackUrl)
StringBuilder sbParams = new StringBuilder()
Map<String, String> paramsMap = execution.getVariable("serviceInputParams")
@@ -136,14 +139,14 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor {
throw e;
} catch (Exception ex){
msg = "Exception in preProcessRequest " + ex.getMessage()
- msoLogger.error(msg)
+ logger.error(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.debug(" ***** Exit preProcessRequest *****",)
+ logger.debug(" ***** Exit preProcessRequest *****",)
}
public void sequenceResource(DelegateExecution execution){
- msoLogger.debug(" ======== STARTED sequenceResource Process ======== ")
+ logger.debug(" ======== STARTED sequenceResource Process ======== ")
List<Resource> sequencedResourceList = new ArrayList<Resource>()
List<Resource> wanResources = new ArrayList<Resource>()
@@ -196,15 +199,15 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor {
execution.setVariable("isContainsWanResource", isContainsWanResource)
execution.setVariable("currentResourceIndex", 0)
execution.setVariable("sequencedResourceList", sequencedResourceList)
- msoLogger.debug("resourceSequence: " + resourceSequence)
- msoLogger.debug(" ======== END sequenceResource Process ======== ")
+ logger.debug("resourceSequence: " + resourceSequence)
+ logger.debug(" ======== END sequenceResource Process ======== ")
}
/**
* prepare delete parameters
*/
public void preResourceDelete(DelegateExecution execution){
- msoLogger.debug(" ======== STARTED preResourceDelete Process ======== ")
+ logger.debug(" ======== STARTED preResourceDelete Process ======== ")
List<Resource> sequencedResourceList = execution.getVariable("sequencedResourceList")
@@ -216,14 +219,14 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor {
String resourceTemplateUUID = curResource.getModelInfo().getModelUuid()
execution.setVariable("resourceInstanceId", resourceInstanceUUID)
execution.setVariable("currentResource", curResource)
- msoLogger.debug("Delete Resource Info resourceTemplate Id :" + resourceTemplateUUID + " resourceInstanceId: "
+ logger.debug("Delete Resource Info resourceTemplate Id :" + resourceTemplateUUID + " resourceInstanceId: "
+ resourceInstanceUUID + " resourceModelName: " + curResource.getModelInfo().getModelName())
}
else {
execution.setVariable("resourceInstanceId", "")
}
- msoLogger.debug(" ======== END preResourceDelete Process ======== ")
+ logger.debug(" ======== END preResourceDelete Process ======== ")
}
@@ -231,7 +234,7 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor {
* Execute delete workflow for resource
*/
public void executeResourceDelete(DelegateExecution execution) {
- msoLogger.debug("======== Start executeResourceDelete Process ======== ")
+ logger.debug("======== Start executeResourceDelete Process ======== ")
try {
String requestId = execution.getVariable("msoRequestId")
String serviceInstanceId = execution.getVariable("serviceInstanceId")
@@ -263,19 +266,19 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor {
String recipeURL = BPMNProperties.getProperty("bpelURL", "http://mso:8080") + recipeUri
HttpResponse resp = BpmnRestClient.post(recipeURL, requestId, recipeTimeout, action, serviceInstanceId, serviceType, resourceInput.toString(), recipeParamXsd)
- msoLogger.debug(" ======== END executeResourceDelete Process ======== ")
+ logger.debug(" ======== END executeResourceDelete Process ======== ")
}catch(BpmnError b){
- msoLogger.error("Rethrowing MSOWorkflowException")
+ logger.error("Rethrowing MSOWorkflowException")
throw b
}catch(Exception e){
- msoLogger.error("Error occured within DoDeleteResourcesV1 executeResourceDelete method: " + e)
+ logger.error("Error occured within DoDeleteResourcesV1 executeResourceDelete method: " + e)
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured during DoDeleteResourcesV1 executeResourceDelete Catalog")
}
}
public void parseNextResource(DelegateExecution execution){
- msoLogger.debug("======== Start parseNextResource Process ======== ")
+ logger.debug("======== Start parseNextResource Process ======== ")
def currentIndex = execution.getVariable("currentResourceIndex")
def nextIndex = currentIndex + 1
execution.setVariable("currentResourceIndex", nextIndex)
@@ -285,7 +288,7 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor {
}else{
execution.setVariable("allResourceFinished", "false")
}
- msoLogger.debug("======== COMPLETED parseNextResource Process ======== ")
+ logger.debug("======== COMPLETED parseNextResource Process ======== ")
}
public void prepareFinishedProgressForResource(DelegateExecution execution) {
@@ -333,7 +336,7 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor {
}
public void prepareSDNCServiceRequest (DelegateExecution execution, String svcAction) {
- msoLogger.debug(" ***** Started prepareSDNCServiceRequest for " + svcAction + "*****")
+ logger.debug(" ***** Started prepareSDNCServiceRequest for " + svcAction + "*****")
try {
// get variables
@@ -391,16 +394,16 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor {
</aetgt:SDNCAdapterWorkflowRequest>""".trim()
String sndcTopologyDeleteRequesAsString = utils.formatXml(sndcTopologyDeleteRequest)
- msoLogger.debug(sndcTopologyDeleteRequesAsString)
+ logger.debug(sndcTopologyDeleteRequesAsString)
execution.setVariable("sdncAdapterWorkflowRequest", sndcTopologyDeleteRequesAsString)
- msoLogger.debug("sdncAdapterWorkflowRequest - " + "\n" + sndcTopologyDeleteRequesAsString)
+ logger.debug("sdncAdapterWorkflowRequest - " + "\n" + sndcTopologyDeleteRequesAsString)
} catch (Exception ex) {
String exceptionMessage = " Bpmn error encountered in DoDeleteResourcesV1 flow. prepareSDNCServiceRequest() - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
- msoLogger.debug("***** Exit prepareSDNCServiceRequest for " + svcAction + "*****")
+ logger.debug("***** Exit prepareSDNCServiceRequest for " + svcAction + "*****")
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteServiceInstance.groovy
index eb736f8ffe..2e1cca54a6 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteServiceInstance.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -38,7 +40,8 @@ import org.onap.so.client.aai.AAIResourcesClient
import org.onap.so.client.aai.entities.AAIResultWrapper
import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
-import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
import org.springframework.web.util.UriUtils;
import groovy.json.*
@@ -65,7 +68,7 @@ import groovy.json.*
* Rollback - Deferred
*/
public class DoDeleteServiceInstance extends AbstractServiceTaskProcessor {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoDeleteServiceInstance.class);
+ private static final Logger logger = LoggerFactory.getLogger( DoDeleteServiceInstance.class);
String Prefix="DDELSI_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
@@ -73,7 +76,7 @@ public class DoDeleteServiceInstance extends AbstractServiceTaskProcessor {
public void preProcessRequest (DelegateExecution execution) {
- msoLogger.trace("preProcessRequest ")
+ logger.trace("preProcessRequest ")
String msg = ""
try {
@@ -99,18 +102,18 @@ public class DoDeleteServiceInstance extends AbstractServiceTaskProcessor {
String serviceInstanceId = execution.getVariable("serviceInstanceId")
if (isBlank(serviceInstanceId)){
msg = "Input serviceInstanceId is null"
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
}
String sdncCallbackUrl = UrnPropertiesReader.getVariable('mso.workflow.sdncadapter.callback',execution)
if (isBlank(sdncCallbackUrl)) {
msg = "mso.workflow.sdncadapter.callback is null"
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
}
execution.setVariable("sdncCallbackUrl", sdncCallbackUrl)
- msoLogger.debug("SDNC Callback URL: " + sdncCallbackUrl)
+ logger.debug("SDNC Callback URL: " + sdncCallbackUrl)
StringBuilder sbParams = new StringBuilder()
Map<String, String> paramsMap = execution.getVariable("serviceInputParams")
@@ -140,15 +143,15 @@ public class DoDeleteServiceInstance extends AbstractServiceTaskProcessor {
throw e;
} catch (Exception ex){
msg = "Exception in preProcessRequest " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("Exit preProcessRequest ")
+ logger.trace("Exit preProcessRequest ")
}
public void preProcessSDNCDelete (DelegateExecution execution) {
- msoLogger.trace("preProcessSDNCDelete ")
+ logger.trace("preProcessSDNCDelete ")
String msg = ""
try {
@@ -230,57 +233,57 @@ public class DoDeleteServiceInstance extends AbstractServiceTaskProcessor {
String sdncDeactivate = sdncDelete.replace(">delete<", ">deactivate<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<")
execution.setVariable("sdncDelete", sdncDelete)
execution.setVariable("sdncDeactivate", sdncDeactivate)
- msoLogger.debug("sdncDeactivate:\n" + sdncDeactivate)
- msoLogger.debug("sdncDelete:\n" + sdncDelete)
+ logger.debug("sdncDeactivate:\n" + sdncDeactivate)
+ logger.debug("sdncDelete:\n" + sdncDelete)
} catch (BpmnError e) {
throw e;
} catch(Exception ex) {
msg = "Exception in preProcessSDNCDelete. " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Exception Occured in preProcessSDNCDelete.\n" + ex.getMessage())
}
- msoLogger.debug(" *****Exit preProcessSDNCDelete *****")
+ logger.debug(" *****Exit preProcessSDNCDelete *****")
}
public void postProcessSDNCDelete(DelegateExecution execution, String response, String method) {
- msoLogger.trace("postProcessSDNC " + method + " ")
+ logger.trace("postProcessSDNC " + method + " ")
String msg = ""
try {
WorkflowException workflowException = execution.getVariable("WorkflowException")
boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator")
- msoLogger.debug("SDNCResponse: " + response)
- msoLogger.debug("workflowException: " + workflowException)
+ logger.debug("SDNCResponse: " + response)
+ logger.debug("workflowException: " + workflowException)
SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this)
sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator)
if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){
- msoLogger.debug("Good response from SDNC Adapter for service-instance " + method + "response:\n" + response)
+ logger.debug("Good response from SDNC Adapter for service-instance " + method + "response:\n" + response)
}else{
msg = "Bad Response from SDNC Adapter for service-instance " + method
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 3500, msg)
}
} catch (BpmnError e) {
throw e;
} catch(Exception ex) {
msg = "Exception in postProcessSDNC " + method + " Exception:" + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("Exit postProcessSDNC " + method + " ")
+ logger.trace("Exit postProcessSDNC " + method + " ")
}
/**
* Gets the service instance uri from aai
*/
public void getServiceInstance(DelegateExecution execution) {
- msoLogger.trace("getServiceInstance ")
+ logger.trace("getServiceInstance ")
try {
String serviceInstanceId = execution.getVariable('serviceInstanceId')
@@ -343,7 +346,7 @@ public class DoDeleteServiceInstance extends AbstractServiceTaskProcessor {
}else{
execution.setVariable("siInUse", true)
- msoLogger.debug("Stopped deleting Service Instance, it has dependencies")
+ logger.debug("Stopped deleting Service Instance, it has dependencies")
exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Stopped deleting Service Instance, it has dependencies")
}
}
@@ -355,7 +358,7 @@ public class DoDeleteServiceInstance extends AbstractServiceTaskProcessor {
throw e;
}catch (Exception ex){
String msg = "Exception in getServiceInstance. " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
}
@@ -364,7 +367,7 @@ public class DoDeleteServiceInstance extends AbstractServiceTaskProcessor {
* Deletes the service instance in aai
*/
public void deleteServiceInstance(DelegateExecution execution) {
- msoLogger.trace("Entered deleteServiceInstance")
+ logger.trace("Entered deleteServiceInstance")
try {
String globalCustId = execution.getVariable("globalSubscriberId")
String serviceType = execution.getVariable("subscriptionServiceType")
@@ -374,9 +377,9 @@ public class DoDeleteServiceInstance extends AbstractServiceTaskProcessor {
AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalCustId, serviceType, serviceInstanceId)
resourceClient.delete(serviceInstanceUri)
- msoLogger.trace("Exited deleteServiceInstance")
+ logger.trace("Exited deleteServiceInstance")
}catch(Exception e){
- msoLogger.debug("Error occured within deleteServiceInstance method: " + e)
+ logger.debug("Error occured within deleteServiceInstance method: " + e)
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Error occured during deleteServiceInstance from aai")
}
}
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 7c8a1d70e1..00244aded0 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
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 Huawei Technologies Co., Ltd. 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
@@ -30,7 +32,8 @@ import org.onap.so.client.HttpClientFactory
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.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
import org.onap.so.utils.TargetEntity
import org.onap.so.bpmn.core.UrnPropertiesReader
@@ -40,7 +43,7 @@ import javax.ws.rs.core.Response
* flow for E2E ServiceInstance Delete
*/
public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProcessor {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoDeleteVFCNetworkServiceInstance.class);
+ private static final Logger logger = LoggerFactory.getLogger( DoDeleteVFCNetworkServiceInstance.class);
ExceptionUtil exceptionUtil = new ExceptionUtil()
@@ -55,21 +58,21 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces
public void preProcessRequest (DelegateExecution execution) {
String msg = ""
- msoLogger.trace("preProcessRequest() ")
+ logger.trace("preProcessRequest() ")
try {
//deal with operation key
String globalSubscriberId = execution.getVariable("globalSubscriberId")
- msoLogger.info("globalSubscriberId:" + globalSubscriberId)
+ logger.info("globalSubscriberId:" + globalSubscriberId)
String serviceType = execution.getVariable("serviceType")
- msoLogger.info("serviceType:" + serviceType)
+ logger.info("serviceType:" + serviceType)
String serviceId = execution.getVariable("serviceId")
- msoLogger.info("serviceId:" + serviceId)
+ logger.info("serviceId:" + serviceId)
String operationId = execution.getVariable("operationId")
- msoLogger.info("serviceType:" + serviceType)
+ logger.info("serviceType:" + serviceType)
String nodeTemplateUUID = execution.getVariable("resourceTemplateId")
- msoLogger.info("nodeTemplateUUID:" + nodeTemplateUUID)
+ logger.info("nodeTemplateUUID:" + nodeTemplateUUID)
String nsInstanceId = execution.getVariable("resourceInstanceId")
- msoLogger.info("nsInstanceId:" + nsInstanceId)
+ logger.info("nsInstanceId:" + nsInstanceId)
execution.setVariable("nsInstanceId",nsInstanceId)
String nsOperationKey = """{
"globalSubscriberId":"${globalSubscriberId}",
@@ -79,13 +82,13 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces
"nodeTemplateUUID":"${nodeTemplateUUID}"
}"""
execution.setVariable("nsOperationKey", nsOperationKey);
- msoLogger.info("nsOperationKey:" + nsOperationKey)
+ logger.info("nsOperationKey:" + nsOperationKey)
String vfcAdapterUrl = UrnPropertiesReader.getVariable("mso.adapters.vfc.rest.endpoint", execution)
if (vfcAdapterUrl == null || vfcAdapterUrl.isEmpty()) {
msg = getProcessKey(execution) + ': mso:adapters:vfcc:rest:endpoint URN mapping is not defined'
- msoLogger.debug(msg)
+ logger.debug(msg)
}
while (vfcAdapterUrl.endsWith('/')) {
@@ -98,10 +101,10 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces
throw e;
} catch (Exception ex){
msg = "Exception in preProcessRequest " + ex.getMessage()
- msoLogger.info(msg)
+ logger.info(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("Exit preProcessRequest ")
+ logger.trace("Exit preProcessRequest ")
}
/**
@@ -109,10 +112,10 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces
*/
public void deleteNSRelationship(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- utils.log("INFO"," ***** deleteNSRelationship *****", isDebugEnabled)
+ logger.info(" ***** deleteNSRelationship *****")
String nsInstanceId = execution.getVariable("resourceInstanceId")
if(nsInstanceId == null || nsInstanceId == ""){
- utils.log("INFO"," Delete NS failed", isDebugEnabled)
+ logger.info(" Delete NS failed")
return
}
String globalSubscriberId = execution.getVariable("globalSubscriberId")
@@ -125,7 +128,7 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces
}catch(Exception e){
exceptionUtil.buildAndThrowWorkflowException(execution,25000,"Exception occured while NS disconnect call: " + e.getMessage())
}
- utils.log("INFO"," *****Exit deleteNSRelationship *****", isDebugEnabled)
+ logger.info(" *****Exit deleteNSRelationship *****")
}
/**
@@ -133,7 +136,7 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces
*/
public void deleteNetworkService(DelegateExecution execution) {
- msoLogger.trace("deleteNetworkService start ")
+ logger.trace("deleteNetworkService start ")
String vfcAdapterUrl = execution.getVariable("vfcAdapterUrl")
String nsOperationKey = execution.getVariable("nsOperationKey");
String url = vfcAdapterUrl + "/ns/" + execution.getVariable("nsInstanceId")
@@ -145,7 +148,7 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces
}
execution.setVariable("operationStatus", operationStatus)
- msoLogger.trace("deleteNetworkService end ")
+ logger.trace("deleteNetworkService end ")
}
/**
@@ -153,7 +156,7 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces
*/
public void terminateNetworkService(DelegateExecution execution) {
- msoLogger.trace("terminateNetworkService start ")
+ logger.trace("terminateNetworkService start ")
String vfcAdapterUrl = execution.getVariable("vfcAdapterUrl")
String nsOperationKey = execution.getVariable("nsOperationKey")
String url = vfcAdapterUrl + "/ns/" + execution.getVariable("nsInstanceId") + "/terminate"
@@ -165,7 +168,7 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces
jobId = jsonUtil.getJsonValue(aaiResponseAsString, "jobId")
}
execution.setVariable("jobId", jobId)
- msoLogger.trace("terminateNetworkService end ")
+ logger.trace("terminateNetworkService end ")
}
/**
@@ -173,7 +176,7 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces
*/
public void queryNSProgress(DelegateExecution execution) {
- msoLogger.trace("queryNSProgress start ")
+ logger.trace("queryNSProgress start ")
String vfcAdapterUrl = execution.getVariable("vfcAdapterUrl")
String jobId = execution.getVariable("jobId")
String nsOperationKey = execution.getVariable("nsOperationKey");
@@ -186,7 +189,7 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces
operationProgress = jsonUtil.getJsonValue(apiResponseAsString, "responseDescriptor.progress")
}
execution.setVariable("operationProgress", operationProgress)
- msoLogger.trace("queryNSProgress end ")
+ logger.trace("queryNSProgress end ")
}
/**
@@ -196,7 +199,7 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces
try {
Thread.sleep(5000);
} catch(InterruptedException e) {
- msoLogger.info("Time Delay exception" + e)
+ logger.info("Time Delay exception" + e)
}
}
@@ -214,8 +217,8 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces
*/
private Response postRequest(DelegateExecution execution, String urlString, String requestBody){
- msoLogger.trace("Started Execute VFC adapter Post Process ")
- msoLogger.info("url:"+urlString +"\nrequestBody:"+ requestBody)
+ logger.trace("Started Execute VFC adapter Post Process ")
+ logger.info("url:"+urlString +"\nrequestBody:"+ requestBody)
Response apiResponse = null
try{
URL url = new URL(urlString);
@@ -229,11 +232,11 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces
apiResponse = httpClient.post(requestBody)
- msoLogger.debug("response code:"+ apiResponse.getStatus() +"\nresponse body:"+ apiResponse.readEntity(String.class))
+ logger.debug("response code:"+ apiResponse.getStatus() +"\nresponse body:"+ apiResponse.readEntity(String.class))
- msoLogger.trace("Completed Execute VF-C adapter Post Process ")
+ logger.trace("Completed Execute VF-C adapter Post Process ")
}catch(Exception e){
- msoLogger.error("Exception occured while executing VF-C Post Call. Exception is: \n" + e.getMessage());
+ logger.error("Exception occured while executing VF-C Post Call. Exception is: \n" + e.getMessage());
throw new BpmnError("MSOWorkflowException")
}
return apiResponse
@@ -245,8 +248,8 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces
*/
private Response deleteRequest(DelegateExecution execution, String url, String requestBody){
- msoLogger.trace("Started Execute VFC adapter Delete Process ")
- msoLogger.info("url:"+url +"\nrequestBody:"+ requestBody)
+ logger.trace("Started Execute VFC adapter Delete Process ")
+ logger.info("url:"+url +"\nrequestBody:"+ requestBody)
Response r
try{
@@ -260,9 +263,9 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces
httpClient.addAdditionalHeader("Content-Type", "application/json")
r = httpClient.delete(requestBody)
- msoLogger.trace("Completed Execute VF-C adapter Delete Process ")
+ logger.trace("Completed Execute VF-C adapter Delete Process ")
}catch(Exception e){
- msoLogger.error("Exception occured while executing VF-C Post Call. Exception is: \n" + e.getMessage());
+ logger.error("Exception occured while executing VF-C Post Call. Exception is: \n" + e.getMessage());
throw new BpmnError("MSOWorkflowException")
}
return r
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy
index 3bc481ab01..2e0b69066e 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -43,6 +45,8 @@ import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
import org.springframework.web.util.UriUtils
import org.w3c.dom.Document
import org.w3c.dom.Element
@@ -71,7 +75,7 @@ import org.xml.sax.InputSource
*
*/
public class DoDeleteVfModule extends AbstractServiceTaskProcessor{
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoDeleteVfModule.class);
+ private static final Logger logger = LoggerFactory.getLogger( DoDeleteVfModule.class);
def Prefix="DoDVfMod_"
@@ -138,9 +142,9 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{
}
else {
- msoLogger.debug("DoDeleteVfModule Request: " + xml)
+ logger.debug("DoDeleteVfModule Request: " + xml)
- msoLogger.debug("input request xml: " + xml)
+ logger.debug("input request xml: " + xml)
vnfId = utils.getNodeText(xml,"vnf-id")
execution.setVariable("vnfId", vnfId)
@@ -183,8 +187,8 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{
<vf-module-id>${MsoUtils.xmlEscape(vfModuleId)}</vf-module-id>
<orchestration-status>pending-delete</orchestration-status>
</PrepareUpdateAAIVfModuleRequest>""" as String
- msoLogger.debug("PrepareUpdateAAIVfModuleRequest :" + request)
- msoLogger.debug("UpdateAAIVfModule Request: " + request)
+ logger.debug("PrepareUpdateAAIVfModuleRequest :" + request)
+ logger.debug("UpdateAAIVfModule Request: " + request)
execution.setVariable("PrepareUpdateAAIVfModuleRequest", request)
execution.setVariable("vfModuleFromAAI", null)
}catch(BpmnError b){
@@ -267,8 +271,8 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{
</sdncadapterworkflow:SDNCRequestData>
</sdncadapterworkflow:SDNCAdapterWorkflowRequest>"""
- msoLogger.debug("sdncAdapterWorkflowRequest: " + request)
- msoLogger.debug("DoDeleteVfModule - SDNCAdapterWorkflowRequest: " + request)
+ logger.debug("sdncAdapterWorkflowRequest: " + request)
+ logger.debug("DoDeleteVfModule - SDNCAdapterWorkflowRequest: " + request)
execution.setVariable("sdncAdapterWorkflowRequest", request)
}
@@ -309,8 +313,8 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{
</deleteVfModuleRequest>
""" as String
- msoLogger.debug("vnfAdapterRestV1Request: " + request)
- msoLogger.debug("deleteVfModuleRequest: " + request)
+ logger.debug("vnfAdapterRestV1Request: " + request)
+ logger.debug("deleteVfModuleRequest: " + request)
execution.setVariable("vnfAdapterRestV1Request", request)
}
@@ -327,8 +331,8 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{
<heat-stack-id>DELETE</heat-stack-id>
<orchestration-status>deleted</orchestration-status>
</UpdateAAIVfModuleRequest>""" as String
- msoLogger.debug("UpdateAAIVfModuleRequest :" + request)
- msoLogger.debug("UpdateAAIVfModuleRequest: " + request)
+ logger.debug("UpdateAAIVfModuleRequest :" + request)
+ logger.debug("UpdateAAIVfModuleRequest: " + request)
execution.setVariable("UpdateAAIVfModuleRequest", request)
}
@@ -344,15 +348,17 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{
<vnf-id>${MsoUtils.xmlEscape(vnfId)}</vnf-id>
<vf-module-id>${MsoUtils.xmlEscape(vfModuleId)}</vf-module-id>
</DeleteAAIVfModuleRequest>""" as String
- msoLogger.debug("DeleteAAIVfModuleRequest :" + request)
- msoLogger.debug("DeleteAAIVfModuleRequest: " + request)
+ logger.debug("DeleteAAIVfModuleRequest :" + request)
+ logger.debug("DeleteAAIVfModuleRequest: " + request)
execution.setVariable("DeleteAAIVfModuleRequest", request)
}
// generates a WorkflowException if
// -
public void handleDoDeleteVfModuleFailure(DelegateExecution execution) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "AAI error occurred deleting the Generic Vnf: " + execution.getVariable("DoDVfMod_deleteGenericVnfResponse"), "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception");
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "AAI error occurred deleting the Generic Vnf: " + execution.getVariable("DoDVfMod_deleteGenericVnfResponse"),
+ "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception");
String processKey = getProcessKey(execution);
WorkflowException exception = new WorkflowException(processKey, 5000,
execution.getVariable("DoDVfMod_deleteGenericVnfResponse"))
@@ -370,7 +376,7 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{
sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator)
if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){
- msoLogger.debug("Successfully Validated SDNC Response")
+ logger.debug("Successfully Validated SDNC Response")
}else{
throw new BpmnError("MSOWorkflowException")
}
@@ -381,19 +387,19 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
execution.setVariable("prefix",Prefix)
try{
- msoLogger.trace("STARTED postProcessVNFAdapterRequest Process")
+ logger.trace("STARTED postProcessVNFAdapterRequest Process")
String vnfResponse = execution.getVariable("DoDVfMod_doDeleteVfModuleResponse")
- msoLogger.debug("VNF Adapter Response is: " + vnfResponse)
- msoLogger.debug("deleteVnfAResponse is: \n" + vnfResponse)
+ logger.debug("VNF Adapter Response is: " + vnfResponse)
+ logger.debug("deleteVnfAResponse is: \n" + vnfResponse)
if(vnfResponse != null){
if(vnfResponse.contains("deleteVfModuleResponse")){
- msoLogger.debug("Received a Good Response from VNF Adapter for DELETE_VF_MODULE Call.")
+ logger.debug("Received a Good Response from VNF Adapter for DELETE_VF_MODULE Call.")
execution.setVariable("DoDVfMod_vnfVfModuleDeleteCompleted", true)
// Parse vnfOutputs for contrail network polcy FQDNs
@@ -414,43 +420,43 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{
String key = element.getElementsByTagNameNS("*", "key").item(0).getTextContent()
if (key.endsWith("contrail_network_policy_fqdn")) {
String contrailNetworkPolicyFqdn = element.getElementsByTagNameNS("*", "value").item(0).getTextContent()
- msoLogger.debug("Obtained contrailNetworkPolicyFqdn: " + contrailNetworkPolicyFqdn)
+ logger.debug("Obtained contrailNetworkPolicyFqdn: " + contrailNetworkPolicyFqdn)
contrailNetworkPolicyFqdnList.add(contrailNetworkPolicyFqdn)
}
else if (key.equals("oam_management_v4_address")) {
String oamManagementV4Address = element.getElementsByTagNameNS("*", "value").item(0).getTextContent()
- msoLogger.debug("Obtained oamManagementV4Address: " + oamManagementV4Address)
+ logger.debug("Obtained oamManagementV4Address: " + oamManagementV4Address)
execution.setVariable(Prefix + "oamManagementV4Address", oamManagementV4Address)
}
else if (key.equals("oam_management_v6_address")) {
String oamManagementV6Address = element.getElementsByTagNameNS("*", "value").item(0).getTextContent()
- msoLogger.debug("Obtained oamManagementV6Address: " + oamManagementV6Address)
+ logger.debug("Obtained oamManagementV6Address: " + oamManagementV6Address)
execution.setVariable(Prefix + "oamManagementV6Address", oamManagementV6Address)
}
}
}
if (!contrailNetworkPolicyFqdnList.isEmpty()) {
- msoLogger.debug("Setting the fqdn list")
+ logger.debug("Setting the fqdn list")
execution.setVariable("DoDVfMod_contrailNetworkPolicyFqdnList", contrailNetworkPolicyFqdnList)
}
}
}else{
- msoLogger.debug("Received a BAD Response from VNF Adapter for DELETE_VF_MODULE Call.")
+ logger.debug("Received a BAD Response from VNF Adapter for DELETE_VF_MODULE Call.")
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "VNF Adapter Error")
}
}else{
- msoLogger.debug("Response from VNF Adapter is Null for DELETE_VF_MODULE Call.")
+ logger.debug("Response from VNF Adapter is Null for DELETE_VF_MODULE Call.")
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Empty response from VNF Adapter")
}
}catch(BpmnError b){
throw b
}catch(Exception e){
- msoLogger.debug("Internal Error Occured in PostProcess Method")
+ logger.debug("Internal Error Occured in PostProcess Method")
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Internal Error Occured in PostProcess Method")
}
- msoLogger.trace("COMPLETED postProcessVnfAdapterResponse Process")
+ logger.trace("COMPLETED postProcessVnfAdapterResponse Process")
}
public void deleteNetworkPoliciesFromAAI(DelegateExecution execution) {
@@ -458,21 +464,21 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
execution.setVariable("prefix", Prefix)
- msoLogger.trace("STARTED deleteNetworkPoliciesFromAAI ")
+ logger.trace("STARTED deleteNetworkPoliciesFromAAI ")
try {
// get variables
List fqdnList = execution.getVariable("DoDVfMod_contrailNetworkPolicyFqdnList")
if (fqdnList == null) {
- msoLogger.debug("No network policies to delete")
+ logger.debug("No network policies to delete")
return
}
int fqdnCount = fqdnList.size()
execution.setVariable("DoDVfMod_networkPolicyFqdnCount", fqdnCount)
- msoLogger.debug("DoDVfMod_networkPolicyFqdnCount - " + fqdnCount)
+ logger.debug("DoDVfMod_networkPolicyFqdnCount - " + fqdnCount)
if (fqdnCount > 0) {
// AII loop call over contrail network policy fqdn list
@@ -489,7 +495,7 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{
execution.setVariable("DCVFM_aaiQueryNetworkPolicyByFqdnReturnCode", 200)
// Retrieve the network policy id for this FQDN
def networkPolicyId = networkPolicy.getNetworkPolicyId()
- msoLogger.debug("Deleting network-policy with network-policy-id " + networkPolicyId)
+ logger.debug("Deleting network-policy with network-policy-id " + networkPolicyId)
try {
AAIResourceUri delUri = AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, networkPolicyId)
getAAIClient().delete(delUri)
@@ -497,30 +503,30 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{
} catch (Exception e) {
execution.setVariable("DoDVfMod_aaiDeleteNetworkPolicyReturnCode", 500)
String delErrorMessage = "Unable to delete network-policy to AAI deleteNetworkPoliciesFromAAI - " + e.getMessage()
- msoLogger.debug(delErrorMessage)
+ logger.debug(delErrorMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, delErrorMessage)
}
} else {
execution.setVariable("DCVFM_aaiQueryNetworkPolicyByFqdnReturnCode", 404)
// This network policy FQDN is not in AAI. No need to delete.
- msoLogger.debug("The return code is: " + 404)
- msoLogger.debug("This network policy FQDN is not in AAI: " + fqdn)
- msoLogger.debug("Network policy FQDN is not in AAI")
+ logger.debug("The return code is: " + 404)
+ logger.debug("This network policy FQDN is not in AAI: " + fqdn)
+ logger.debug("Network policy FQDN is not in AAI")
}
}catch(Exception e ) {
// aai all errors
String dataErrorMessage = "Unexpected Response from deleteNetworkPoliciesFromAAI - " + e.getMessage()
- msoLogger.debug(dataErrorMessage)
+ logger.debug(dataErrorMessage)
}
} // end loop
} else {
- msoLogger.debug("No contrail network policies to query/create")
+ logger.debug("No contrail network policies to query/create")
}
} catch (BpmnError e) {
throw e;
} catch (Exception ex) {
String exceptionMessage = "Bpmn error encountered in DoDeletVfModule flow. deleteNetworkPoliciesFromAAI() - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
@@ -536,7 +542,7 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
try {
def vnfId = execution.getVariable('vnfId')
@@ -563,15 +569,17 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{
"""
updateAAIGenericVnfRequest = utils.formatXml(updateAAIGenericVnfRequest)
execution.setVariable(Prefix + 'updateAAIGenericVnfRequest', updateAAIGenericVnfRequest)
- msoLogger.debug("updateAAIGenericVnfRequest : " + updateAAIGenericVnfRequest)
- msoLogger.debug('Request for UpdateAAIGenericVnf:\n' + updateAAIGenericVnfRequest)
+ logger.debug("updateAAIGenericVnfRequest : " + updateAAIGenericVnfRequest)
+ logger.debug('Request for UpdateAAIGenericVnf:\n' + updateAAIGenericVnfRequest)
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepUpdateAAIGenericVnf(): ' + e.getMessage())
}
}
@@ -589,7 +597,7 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{
def method = getClass().getSimpleName() + '.queryAAIVfModuleForStatus(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
execution.setVariable(Prefix + 'orchestrationStatus', '')
@@ -607,18 +615,20 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{
execution.setVariable(Prefix + 'queryAAIVfModuleForStatusResponse', vfModule.get())
def orchestrationStatus = vfModule.get().getOrchestrationStatus()
execution.setVariable(Prefix + "orchestrationStatus", orchestrationStatus)
- msoLogger.debug("Received orchestration status from A&AI: " + orchestrationStatus)
+ logger.debug("Received orchestration status from A&AI: " + orchestrationStatus)
}
} catch (Exception ex) {
ex.printStackTrace()
- msoLogger.debug('Exception occurred while executing AAI GET:' + ex.getMessage())
+ logger.debug('Exception occurred while executing AAI GET:' + ex.getMessage())
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'AAI GET Failed:' + ex.getMessage())
}
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIVfModuleForStatus(): ' + e.getMessage())
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy
index abc83b2784..655d6ec958 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -43,9 +45,11 @@ import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
public class DoDeleteVfModuleFromVnf extends VfModuleBase {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoDeleteVfModuleFromVnf.class);
+ private static final Logger logger = LoggerFactory.getLogger( DoDeleteVfModuleFromVnf.class);
def Prefix="DDVFMV_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
@@ -69,12 +73,12 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase {
String requestId = execution.getVariable("msoRequestId")
execution.setVariable("mso-request-id", requestId)
execution.setVariable("requestId", requestId)
- msoLogger.debug("msoRequestId: " + requestId)
+ logger.debug("msoRequestId: " + requestId)
String tenantId = execution.getVariable("tenantId")
- msoLogger.debug("tenantId: " + tenantId)
+ logger.debug("tenantId: " + tenantId)
String cloudSiteId = execution.getVariable("lcpCloudRegionId")
execution.setVariable("cloudSiteId", cloudSiteId)
- msoLogger.debug("cloudSiteId: " + cloudSiteId)
+ logger.debug("cloudSiteId: " + cloudSiteId)
// Source is HARDCODED
String source = "VID"
execution.setVariable("source", source)
@@ -85,11 +89,11 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase {
// ServiceId is hardcoded to empty
execution.setVariable("serviceId", "")
String serviceInstanceId = execution.getVariable("serviceInstanceId")
- msoLogger.debug("serviceInstanceId: " + serviceInstanceId)
+ logger.debug("serviceInstanceId: " + serviceInstanceId)
String vnfId = execution.getVariable("vnfId")
- msoLogger.debug("vnfId: " + vnfId)
+ logger.debug("vnfId: " + vnfId)
String vfModuleId = execution.getVariable("vfModuleId")
- msoLogger.debug("vfModuleId: " + vfModuleId)
+ logger.debug("vfModuleId: " + vfModuleId)
if (serviceInstanceId == null || serviceInstanceId.isEmpty()) {
execution.setVariable(Prefix + "serviceInstanceIdToSdnc", vfModuleId)
}
@@ -102,24 +106,25 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase {
sdncVersion = "1707"
}
execution.setVariable(Prefix + "sdncVersion", sdncVersion)
- msoLogger.debug("Incoming Sdnc Version is: " + sdncVersion)
+ logger.debug("Incoming Sdnc Version is: " + sdncVersion)
String sdncCallbackUrl = (String) UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution)
if (sdncCallbackUrl == null || sdncCallbackUrl.trim().isEmpty()) {
def msg = 'Required variable \'mso.workflow.sdncadapter.callback\' is missing'
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception");
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception");
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
execution.setVariable("sdncCallbackUrl", sdncCallbackUrl)
- msoLogger.debug("SDNC Callback URL: " + sdncCallbackUrl)
- msoLogger.debug("SDNC Callback URL is: " + sdncCallbackUrl)
+ logger.debug("SDNC Callback URL: " + sdncCallbackUrl)
+ logger.debug("SDNC Callback URL is: " + sdncCallbackUrl)
}catch(BpmnError b){
throw b
}catch(Exception e){
- msoLogger.debug("Exception is: " + e.getMessage())
+ logger.debug("Exception is: " + e.getMessage())
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error encountered in PreProcess method!")
}
}
@@ -129,7 +134,7 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase {
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
try {
def vnfId = execution.getVariable('vnfId')
@@ -147,15 +152,17 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase {
}
} catch (Exception ex) {
ex.printStackTrace()
- msoLogger.debug('Exception occurred while executing AAI GET:' + ex.getMessage())
+ logger.debug('Exception occurred while executing AAI GET:' + ex.getMessage())
execution.setVariable('DDVMFV_getVnfResponseCode', 500)
execution.setVariable('DDVFMV_getVnfResponse', 'AAI GET Failed:' + ex.getMessage())
}
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIForVfModule(): ' + e.getMessage())
}
}
@@ -173,7 +180,7 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase {
'execution=' + execution.getId() +
')'
def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
try {
GenericVnf genericVnf = execution.getVariable('DDVMFV_getVnfResponse')
@@ -185,28 +192,30 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase {
}
if (!vfModule.isPresent()) {
String msg = 'VF Module \'' + vfModuleId + '\' does not exist in Generic VNF \'' + vnfId + '\''
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, msg)
} else {
Boolean isOnlyVfModule = (genericVnf.getVfModules().getVfModule().size() == 1)
if (isDebugLogEnabled) {
- msoLogger.debug('VF Module \'' + vfModuleId + '\': isBaseVfModule=' + vfModule.get().isIsBaseVfModule() + ', isOnlyVfModule=' + isOnlyVfModule)
+ logger.debug('VF Module \'' + vfModuleId + '\': isBaseVfModule=' + vfModule.get().isIsBaseVfModule() + ', isOnlyVfModule=' + isOnlyVfModule)
}
if (vfModule.get().isIsBaseVfModule() && !isOnlyVfModule) {
String msg = 'Cannot delete VF Module \'' + vfModuleId +
'\'since it is the base VF Module and it\'s not the only VF Module in Generic VNF \'' + vnfId + '\''
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002,msg)
}
def heatStackId = vfModule.get().getHeatStackId()
execution.setVariable('DDVMFV_heatStackId', heatStackId)
- msoLogger.debug('VF Module heatStackId retrieved from AAI: ' + heatStackId)
+ logger.debug('VF Module heatStackId retrieved from AAI: ' + heatStackId)
}
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in validateVfModule(): ' + e.getMessage())
}
}
@@ -215,7 +224,7 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase {
public void preProcessSDNCDeactivateRequest(DelegateExecution execution){
execution.setVariable("prefix", Prefix)
- msoLogger.trace("STARTED preProcessSDNCDeactivateRequest ")
+ logger.trace("STARTED preProcessSDNCDeactivateRequest ")
def serviceInstanceId = execution.getVariable("serviceInstanceId")
@@ -226,14 +235,16 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase {
deactivateSDNCRequest = utils.formatXml(deactivateSDNCRequest)
execution.setVariable("DDVMFV_deactivateSDNCRequest", deactivateSDNCRequest)
- msoLogger.debug("Outgoing DeactivateSDNCRequest is: \n" + deactivateSDNCRequest)
+ logger.debug("Outgoing DeactivateSDNCRequest is: \n" + deactivateSDNCRequest)
}catch(Exception e){
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing preProcessSDNCDeactivateRequest. Exception is:\n" + e, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Occured Processing preProcessSDNCDeactivateRequest. Exception is:\n" + e, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessSDNCDeactivateRequest Method:\n" + e.getMessage())
}
- msoLogger.trace("COMPLETED preProcessSDNCDeactivateRequest ")
+ logger.trace("COMPLETED preProcessSDNCDeactivateRequest ")
}
public void preProcessSDNCUnassignRequest(DelegateExecution execution) {
@@ -241,23 +252,23 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase {
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
execution.setVariable("prefix", Prefix)
- msoLogger.trace("STARTED preProcessSDNCUnassignRequest Process ")
+ logger.trace("STARTED preProcessSDNCUnassignRequest Process ")
try{
String serviceInstanceId = execution.getVariable("serviceInstanceId")
String unassignSDNCRequest = buildSDNCRequest(execution, serviceInstanceId, "unassign")
execution.setVariable("DDVMFV_unassignSDNCRequest", unassignSDNCRequest)
- msoLogger.debug("Outgoing UnassignSDNCRequest is: \n" + unassignSDNCRequest)
+ logger.debug("Outgoing UnassignSDNCRequest is: \n" + unassignSDNCRequest)
}catch(Exception e){
- msoLogger.debug("Exception Occured Processing preProcessSDNCUnassignRequest. Exception is:\n" + e)
+ logger.debug("Exception Occured Processing preProcessSDNCUnassignRequest. Exception is:\n" + e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessSDNCUnassignRequest Method:\n" + e.getMessage())
}
- msoLogger.trace("COMPLETED preProcessSDNCUnassignRequest Process ")
+ logger.trace("COMPLETED preProcessSDNCUnassignRequest Process ")
}
public String buildSDNCRequest(DelegateExecution execution, String svcInstId, String action){
@@ -314,33 +325,33 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase {
</sdncadapterworkflow:SDNCRequestData>
</sdncadapterworkflow:SDNCAdapterWorkflowRequest>"""
- msoLogger.debug("sdncRequest: " + sdncRequest)
+ logger.debug("sdncRequest: " + sdncRequest)
return sdncRequest
}
public void validateSDNCResponse(DelegateExecution execution, String response, String method){
execution.setVariable("prefix",Prefix)
- msoLogger.trace("STARTED ValidateSDNCResponse Process")
+ logger.trace("STARTED ValidateSDNCResponse Process")
WorkflowException workflowException = execution.getVariable("WorkflowException")
boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator")
- msoLogger.debug("workflowException: " + workflowException)
+ logger.debug("workflowException: " + workflowException)
SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this)
sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator)
- msoLogger.debug("SDNCResponse: " + response)
+ logger.debug("SDNCResponse: " + response)
String sdncResponse = response
if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){
- msoLogger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + sdncResponse)
+ logger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + sdncResponse)
}else{
- msoLogger.debug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.")
+ logger.debug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.")
throw new BpmnError("MSOWorkflowException")
}
- msoLogger.trace("COMPLETED ValidateSDNCResponse Process")
+ logger.trace("COMPLETED ValidateSDNCResponse Process")
}
@@ -381,8 +392,8 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase {
</deleteVfModuleRequest>
""" as String
- msoLogger.debug("vnfAdapterRestV1Request: " + request)
- msoLogger.debug("deleteVfModuleRequest: " + request)
+ logger.debug("vnfAdapterRestV1Request: " + request)
+ logger.debug("deleteVfModuleRequest: " + request)
execution.setVariable("vnfAdapterRestV1Request", request)
}
@@ -390,7 +401,9 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase {
// generates a WorkflowException if
// -
public void handleDoDeleteVfModuleFailure(DelegateExecution execution) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "AAI error occurred deleting the Generic Vnf: " + execution.getVariable("DDVFMV_deleteGenericVnfResponse"), "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception");
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "AAI error occurred deleting the Generic Vnf: " + execution.getVariable("DDVFMV_deleteGenericVnfResponse"),
+ "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception");
String processKey = getProcessKey(execution);
WorkflowException exception = new WorkflowException(processKey, 5000,
execution.getVariable("DDVFMV_deleteGenericVnfResponse"))
@@ -402,19 +415,19 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase {
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
execution.setVariable("prefix",Prefix)
try{
- msoLogger.trace("STARTED postProcessVNFAdapterRequest Process")
+ logger.trace("STARTED postProcessVNFAdapterRequest Process")
String vnfResponse = execution.getVariable("DDVMFV_doDeleteVfModuleResponse")
- msoLogger.debug("VNF Adapter Response is: " + vnfResponse)
- msoLogger.debug("deleteVnfAResponse is: \n" + vnfResponse)
+ logger.debug("VNF Adapter Response is: " + vnfResponse)
+ logger.debug("deleteVnfAResponse is: \n" + vnfResponse)
if(vnfResponse != null){
if(vnfResponse.contains("deleteVfModuleResponse")){
- msoLogger.debug("Received a Good Response from VNF Adapter for DELETE_VF_MODULE Call.")
+ logger.debug("Received a Good Response from VNF Adapter for DELETE_VF_MODULE Call.")
execution.setVariable("DDVFMV_vnfVfModuleDeleteCompleted", true)
// Parse vnfOutputs for contrail network polcy FQDNs
@@ -428,41 +441,41 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase {
} else if (key.endsWith("contrail_network_policy_fqdn")) {
String contrailNetworkPolicyFqdn = utils.getChildNodeText(node, "value")
- msoLogger.debug("Obtained contrailNetworkPolicyFqdn: " + contrailNetworkPolicyFqdn)
+ logger.debug("Obtained contrailNetworkPolicyFqdn: " + contrailNetworkPolicyFqdn)
contrailNetworkPolicyFqdnList.add(contrailNetworkPolicyFqdn)
}
else if (key.equals("oam_management_v4_address")) {
String oamManagementV4Address = utils.getChildNodeText(node, "value")
- msoLogger.debug("Obtained oamManagementV4Address: " + oamManagementV4Address)
+ logger.debug("Obtained oamManagementV4Address: " + oamManagementV4Address)
execution.setVariable(Prefix + "oamManagementV4Address", oamManagementV4Address)
}
else if (key.equals("oam_management_v6_address")) {
String oamManagementV6Address = utils.getChildNodeText(node, "value")
- msoLogger.debug("Obtained oamManagementV6Address: " + oamManagementV6Address)
+ logger.debug("Obtained oamManagementV6Address: " + oamManagementV6Address)
execution.setVariable(Prefix + "oamManagementV6Address", oamManagementV6Address)
}
}
if (!contrailNetworkPolicyFqdnList.isEmpty()) {
- msoLogger.debug("Setting the fqdn list")
+ logger.debug("Setting the fqdn list")
execution.setVariable("DDVFMV_contrailNetworkPolicyFqdnList", contrailNetworkPolicyFqdnList)
}
}
}else{
- msoLogger.debug("Received a BAD Response from VNF Adapter for DELETE_VF_MODULE Call.")
+ logger.debug("Received a BAD Response from VNF Adapter for DELETE_VF_MODULE Call.")
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "VNF Adapter Error")
}
}else{
- msoLogger.debug("Response from VNF Adapter is Null for DELETE_VF_MODULE Call.")
+ logger.debug("Response from VNF Adapter is Null for DELETE_VF_MODULE Call.")
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Empty response from VNF Adapter")
}
}catch(BpmnError b){
throw b
}catch(Exception e){
- msoLogger.debug("Internal Error Occured in PostProcess Method")
+ logger.debug("Internal Error Occured in PostProcess Method")
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Internal Error Occured in PostProcess Method")
}
- msoLogger.trace("COMPLETED postProcessVnfAdapterResponse Process")
+ logger.trace("COMPLETED postProcessVnfAdapterResponse Process")
}
public void deleteNetworkPoliciesFromAAI(DelegateExecution execution) {
@@ -470,21 +483,21 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase {
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
execution.setVariable("prefix", Prefix)
- msoLogger.trace("STARTED deleteNetworkPoliciesFromAAI ")
+ logger.trace("STARTED deleteNetworkPoliciesFromAAI ")
try {
// get variables
List fqdnList = execution.getVariable("DDVFMV_contrailNetworkPolicyFqdnList")
if (fqdnList == null) {
- msoLogger.debug("No network policies to delete")
+ logger.debug("No network policies to delete")
return
}
int fqdnCount = fqdnList.size()
execution.setVariable("DDVFMV_networkPolicyFqdnCount", fqdnCount)
- msoLogger.debug("DDVFMV_networkPolicyFqdnCount - " + fqdnCount)
+ logger.debug("DDVFMV_networkPolicyFqdnCount - " + fqdnCount)
AaiUtil aaiUriUtil = new AaiUtil(this)
@@ -509,37 +522,37 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase {
// This network policy FQDN exists in AAI - need to delete it now
// Retrieve the network policy id for this FQDN
def networkPolicyId = networkPolicy.getNetworkPolicyId()
- msoLogger.debug("Deleting network-policy with network-policy-id " + networkPolicyId)
+ logger.debug("Deleting network-policy with network-policy-id " + networkPolicyId)
// Retrieve the resource version for this network policy
try {
AAIResourceUri delUri = AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, networkPolicyId)
getAAIClient().delete(delUri)
execution.setVariable("DDVFMV_aaiDeleteNetworkPolicyReturnCode", 200)
- msoLogger.debug(" ***** AAI delete network policy Response Code, NetworkPolicy #" + counting + " : " + 200)
+ logger.debug(" ***** AAI delete network policy Response Code, NetworkPolicy #" + counting + " : " + 200)
// This network policy was deleted from AAI successfully
- msoLogger.debug(" DelAAINetworkPolicy Success REST Response, , NetworkPolicy #" + counting + " : ")
+ logger.debug(" DelAAINetworkPolicy Success REST Response, , NetworkPolicy #" + counting + " : ")
} catch (Exception e) {
// aai all errors
String delErrorMessage = "Unable to delete network-policy to AAI deleteNetworkPoliciesFromAAI - " + e.getMessage()
- msoLogger.debug(delErrorMessage)
+ logger.debug(delErrorMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, delErrorMessage)
}
} else {
execution.setVariable("DCVFM_aaiQueryNetworkPolicyByFqdnReturnCode", 404)
// This network policy FQDN is not in AAI. No need to delete.
- msoLogger.debug("This network policy FQDN is not in AAI: " + fqdn)
- msoLogger.debug("Network policy FQDN is not in AAI")
+ logger.debug("This network policy FQDN is not in AAI: " + fqdn)
+ logger.debug("Network policy FQDN is not in AAI")
}
} catch (Exception e) {
// aai all errors
String dataErrorMessage = "Unexpected Response from deleteNetworkPoliciesFromAAI - " + e.getMessage()
- msoLogger.debug(dataErrorMessage)
+ logger.debug(dataErrorMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage)
}
} // end loop
} else {
- msoLogger.debug("No contrail network policies to query/create")
+ logger.debug("No contrail network policies to query/create")
}
@@ -548,7 +561,7 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase {
} catch (Exception ex) {
String exceptionMessage = "Bpmn error encountered in DoDeletVfModule flow. deleteNetworkPoliciesFromAAI() - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
@@ -565,7 +578,7 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase {
<vnf-id>${MsoUtils.xmlEscape(vnfId)}</vnf-id>
<vf-module-id>${MsoUtils.xmlEscape(vfModuleId)}</vf-module-id>
</DeleteAAIVfModuleRequest>""" as String
- msoLogger.debug("DeleteAAIVfModuleRequest :" + request)
+ logger.debug("DeleteAAIVfModuleRequest :" + request)
execution.setVariable("DeleteAAIVfModuleRequest", request)
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2.groovy
index 710d13470f..787b582808 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -39,11 +41,12 @@ import org.onap.so.client.aai.entities.Relationships
import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.constants.Defaults
-import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
import javax.ws.rs.NotFoundException
class DoDeleteVfModuleVolumeV2 extends AbstractServiceTaskProcessor{
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoDeleteVfModuleVolumeV2.class);
+ private static final Logger logger = LoggerFactory.getLogger( DoDeleteVfModuleVolumeV2.class);
String prefix="DDVMV_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
@@ -89,7 +92,7 @@ class DoDeleteVfModuleVolumeV2 extends AbstractServiceTaskProcessor{
// if tenantId or lcpCloudregionId is not passed, get it from cloudRegionConfiguration variable
if(!tenantId || !cloudSiteId) {
def cloudConfiguration = execution.getVariable("cloudConfiguration")
- msoLogger.debug("Using cloudConfiguration variable to get tenantId and lcpCloudRegionId - " + cloudConfiguration)
+ logger.debug("Using cloudConfiguration variable to get tenantId and lcpCloudRegionId - " + cloudConfiguration)
tenantId = jsonUtil.getJsonValue(cloudConfiguration, "tenantId")
execution.setVariable("tenantId", tenantId)
cloudSiteId = jsonUtil.getJsonValue(cloudConfiguration, "lcpCloudRegionId")
@@ -135,7 +138,7 @@ class DoDeleteVfModuleVolumeV2 extends AbstractServiceTaskProcessor{
}
}
else {
- msoLogger.debug("AAI Query Cloud Region Unsuccessful.")
+ logger.debug("AAI Query Cloud Region Unsuccessful.")
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "AAI Query Cloud Region Unsuccessful. Return Code: " + execution.getVariable(prefix+"queryCloudRegionReturnCode"))
}
}
@@ -166,14 +169,14 @@ class DoDeleteVfModuleVolumeV2 extends AbstractServiceTaskProcessor{
def heatStackId = volumeGroup.getHeatStackId()==null ? '' : volumeGroup.getHeatStackId()
execution.setVariable(prefix+'volumeGroupHeatStackId', heatStackId)
- msoLogger.debug('Heat stack id from AAI response: ' + heatStackId)
+ logger.debug('Heat stack id from AAI response: ' + heatStackId)
AAIResultWrapper wrapper = getAAIClient().get(uri);
Optional<Relationships> relationships = wrapper.getRelationships()
String volumeGroupTenantId = null
if(relationships.isPresent()){
if(relationships.get().getRelatedAAIUris(AAIObjectType.VF_MODULE)){
- msoLogger.debug('Volume Group ' + volumeGroupId + ' currently in use')
+ logger.debug('Volume Group ' + volumeGroupId + ' currently in use')
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Volume Group ${volumeGroupId} currently in use - found vf-module relationship.")
}
for(AAIResourceUri aaiResourceUri: relationships.get().getRelatedAAIUris(AAIObjectType.TENANT)){
@@ -181,22 +184,22 @@ class DoDeleteVfModuleVolumeV2 extends AbstractServiceTaskProcessor{
}
}
- msoLogger.debug('Tenant ID from AAI response: ' + volumeGroupTenantId)
+ logger.debug('Tenant ID from AAI response: ' + volumeGroupTenantId)
if (volumeGroupTenantId == null) {
- msoLogger.debug("Could not find Tenant Id element in Volume Group with Volume Group Id ${volumeGroupId}")
+ logger.debug("Could not find Tenant Id element in Volume Group with Volume Group Id ${volumeGroupId}")
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Could not find Tenant Id element in Volume Group with Volume Group Id ${volumeGroupId}")
}
if (volumeGroupTenantId != tenantId) {
def String errorMessage = 'TenantId ' + tenantId + ' in incoming request does not match Tenant Id ' + volumeGroupTenantId + ' retrieved from AAI for Volume Group Id ' + volumeGroupId
- msoLogger.debug("Error in DeleteVfModuleVolume: " + errorMessage)
+ logger.debug("Error in DeleteVfModuleVolume: " + errorMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 5000, errorMessage)
}
- msoLogger.debug('Received Tenant Id ' + volumeGroupTenantId + ' from AAI for Volume Group with Volume Group Id ' + volumeGroupId )
+ logger.debug('Received Tenant Id ' + volumeGroupTenantId + ' from AAI for Volume Group with Volume Group Id ' + volumeGroupId )
}else{
execution.setVariable(prefix + "queryAAIVolGrpResponse", "Volume Group ${volumeGroupId} not found in AAI. Response code: 404")
- msoLogger.debug("Volume Group ${volumeGroupId} not found in AAI")
+ logger.debug("Volume Group ${volumeGroupId} not found in AAI")
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Volume Group ${volumeGroupId} not found in AAI. Response code: 404")
}
}catch (Exception ex) {
@@ -244,7 +247,7 @@ class DoDeleteVfModuleVolumeV2 extends AbstractServiceTaskProcessor{
"""
vnfAdapterRestRequest = utils.formatXml(vnfAdapterRestRequest)
execution.setVariable(prefix+'deleteVnfARequest', vnfAdapterRestRequest)
- msoLogger.debug('Request for VNFAdapter Rest:\n' + vnfAdapterRestRequest)
+ logger.debug('Request for VNFAdapter Rest:\n' + vnfAdapterRestRequest)
}
@@ -263,7 +266,7 @@ class DoDeleteVfModuleVolumeV2 extends AbstractServiceTaskProcessor{
try {
AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP,Defaults.CLOUD_OWNER.toString(), cloudRegion, volumeGroupId)
getAAIClient().delete(resourceUri)
- msoLogger.debug("Volume group $volumeGroupId deleted.")
+ logger.debug("Volume group $volumeGroupId deleted.")
}catch (NotFoundException ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Volume group $volumeGroupId not found for delete in AAI Response code: 404")
}catch (Exception ex) {
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnf.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnf.groovy
index 47a4d55e0c..25303473c7 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnf.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnf.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -44,8 +46,8 @@ import org.w3c.dom.Node
import org.w3c.dom.NodeList
import org.xml.sax.InputSource
-import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
/**
* This class supports the DoDeleteVnf subFlow
@@ -54,7 +56,7 @@ import org.onap.so.logger.MsoLogger
*
*/
class DoDeleteVnf extends AbstractServiceTaskProcessor {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoDeleteVnf.class);
+ private static final Logger logger = LoggerFactory.getLogger( DoDeleteVnf.class);
String Prefix="DoDVNF_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
@@ -71,7 +73,7 @@ class DoDeleteVnf extends AbstractServiceTaskProcessor {
public void preProcessRequest(DelegateExecution execution) {
execution.setVariable("prefix",Prefix)
- msoLogger.trace("STARTED DoDeleteVnf PreProcessRequest Process")
+ logger.trace("STARTED DoDeleteVnf PreProcessRequest Process")
execution.setVariable("DoDVNF_SuccessIndicator", false)
execution.setVariable("DoDVNF_vnfInUse", false)
@@ -81,24 +83,24 @@ class DoDeleteVnf extends AbstractServiceTaskProcessor {
String vnfId = execution.getVariable("vnfId")
execution.setVariable("DoDVNF_vnfId", vnfId)
- msoLogger.debug("Incoming Vnf(Instance) Id is: " + vnfId)
+ logger.debug("Incoming Vnf(Instance) Id is: " + vnfId)
}catch(BpmnError b){
- msoLogger.debug("Rethrowing MSOWorkflowException")
+ logger.debug("Rethrowing MSOWorkflowException")
throw b
}catch(Exception e){
- msoLogger.debug(" Error Occured in DoDeleteVnf PreProcessRequest method!" + e)
+ logger.debug(" Error Occured in DoDeleteVnf PreProcessRequest method!" + e)
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DoDeleteVnf PreProcessRequest")
}
- msoLogger.trace("COMPLETED DoDeleteVnf PreProcessRequest Process ")
+ logger.trace("COMPLETED DoDeleteVnf PreProcessRequest Process ")
}
public void getVnf(DelegateExecution execution){
execution.setVariable("prefix",Prefix)
- msoLogger.trace("STARTED DoDeleteVnf getVnf Process ")
+ logger.trace("STARTED DoDeleteVnf getVnf Process ")
try {
AAIResourcesClient resourceClient = new AAIResourcesClient()
@@ -113,7 +115,7 @@ class DoDeleteVnf extends AbstractServiceTaskProcessor {
if(!relationships.isEmpty()){
execution.setVariable("DoDVNF_vnfInUse", true)
}else{
- msoLogger.debug("Relationship NOT related to OpenStack")
+ logger.debug("Relationship NOT related to OpenStack")
}
}
@@ -130,18 +132,18 @@ class DoDeleteVnf extends AbstractServiceTaskProcessor {
}
} catch (Exception ex) {
- msoLogger.debug("Error Occured in DoDeleteVnf getVnf Process " + ex.getMessage())
+ logger.debug("Error Occured in DoDeleteVnf getVnf Process " + ex.getMessage())
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DoDeleteVnf getVnf Process")
}
- msoLogger.trace("COMPLETED DoDeleteVnf getVnf Process ")
+ logger.trace("COMPLETED DoDeleteVnf getVnf Process ")
}
/**
* Deletes the generic vnf from aai
*/
public void deleteVnf(DelegateExecution execution) {
- msoLogger.trace("STARTED deleteVnf")
+ logger.trace("STARTED deleteVnf")
try {
String vnfId = execution.getVariable("DoDVNF_vnfId")
@@ -149,9 +151,9 @@ class DoDeleteVnf extends AbstractServiceTaskProcessor {
AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
resourceClient.delete(uri)
- msoLogger.trace("COMPLETED deleteVnf")
+ logger.trace("COMPLETED deleteVnf")
} catch (Exception ex) {
- msoLogger.debug("Error Occured in DoDeleteVnf deleteVnf Process " + ex.getMessage())
+ logger.debug("Error Occured in DoDeleteVnf deleteVnf Process " + ex.getMessage())
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DoDeleteVnf deleteVnf Process")
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy
index 6e0c6bb002..3b23a03589 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -44,13 +46,15 @@ import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.client.aai.AAIObjectType
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
/**
* This class supports the macro VID Flow
* with the deletion of a generic vnf and related VF modules.
*/
class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoDeleteVnfAndModules.class);
+ private static final Logger logger = LoggerFactory.getLogger( DoDeleteVnfAndModules.class);
String Prefix="DDVAM_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
@@ -68,28 +72,28 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor {
public void preProcessRequest(DelegateExecution execution) {
execution.setVariable("prefix",Prefix)
- msoLogger.trace("STARTED DoDeleteVnfAndModules PreProcessRequest Process")
+ logger.trace("STARTED DoDeleteVnfAndModules PreProcessRequest Process")
try{
// Get Variables
String cloudConfiguration = execution.getVariable("cloudConfiguration")
- msoLogger.debug("Cloud Configuration: " + cloudConfiguration)
+ logger.debug("Cloud Configuration: " + cloudConfiguration)
String requestId = execution.getVariable("msoRequestId")
execution.setVariable("requestId", requestId)
execution.setVariable("mso-request-id", requestId)
- msoLogger.debug("Incoming Request Id is: " + requestId)
+ logger.debug("Incoming Request Id is: " + requestId)
String serviceInstanceId = execution.getVariable("serviceInstanceId")
- msoLogger.debug("Incoming Service Instance Id is: " + serviceInstanceId)
+ logger.debug("Incoming Service Instance Id is: " + serviceInstanceId)
String vnfId = execution.getVariable("vnfId")
- msoLogger.debug("Incoming Vnf Id is: " + vnfId)
+ logger.debug("Incoming Vnf Id is: " + vnfId)
String source = "VID"
execution.setVariable("DDVAM_source", source)
- msoLogger.debug("Incoming Source is: " + source)
+ logger.debug("Incoming Source is: " + source)
execution.setVariable("DDVAM_isVidRequest", "true")
@@ -98,7 +102,7 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor {
sdncVersion = "1702"
}
execution.setVariable("DDVAM_sdncVersion", sdncVersion)
- msoLogger.debug("Incoming Sdnc Version is: " + sdncVersion)
+ logger.debug("Incoming Sdnc Version is: " + sdncVersion)
// Set aLaCarte flag to false
execution.setVariable("aLaCarte", false)
@@ -106,12 +110,13 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor {
String sdncCallbackUrl = (String) UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback", execution)
if (sdncCallbackUrl == null || sdncCallbackUrl.trim().isEmpty()) {
def msg = 'Required variable \'mso.workflow.sdncadapter.callback\' is missing'
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception");
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception");
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
execution.setVariable("sdncCallbackUrl", sdncCallbackUrl)
- msoLogger.debug("SDNC Callback URL: " + sdncCallbackUrl)
- msoLogger.debug("SDNC Callback URL is: " + sdncCallbackUrl)
+ logger.debug("SDNC Callback URL: " + sdncCallbackUrl)
+ logger.debug("SDNC Callback URL is: " + sdncCallbackUrl)
if (!sdncVersion.equals("1702")) {
@@ -120,66 +125,66 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor {
String serviceId = execution.getVariable("productFamilyId")
execution.setVariable("DDVAM_serviceId", serviceId)
- msoLogger.debug("Incoming Service Id is: " + serviceId)
+ logger.debug("Incoming Service Id is: " + serviceId)
//String modelInvariantId = jsonUtil.getJsonValue(vnfModelInfo, "modelInvariantId")
//execution.setVariable("DDVAM_modelInvariantId", modelInvariantId)
- //msoLogger.debug("Incoming Invariant Id is: " + modelInvariantId)
+ //logger.debug("Incoming Invariant Id is: " + modelInvariantId)
//String modelVersionId = jsonUtil.getJsonValue(vnfModelInfo, "modelVersionId")
//if (modelVersionId == null) {
// modelVersionId = ""
//}
//execution.setVariable("DDVAM_modelVersionId", modelVersionId)
- //msoLogger.debug("Incoming Version Id is: " + modelVersionId)
+ //logger.debug("Incoming Version Id is: " + modelVersionId)
//String modelVersion = jsonUtil.getJsonValue(vnfModelInfo, "modelVersion")
//execution.setVariable("DDVAM_modelVersion", modelVersion)
- //msoLogger.debug("Incoming Model Version is: " + modelVersion)
+ //logger.debug("Incoming Model Version is: " + modelVersion)
//String modelName = jsonUtil.getJsonValue(vnfModelInfo, "modelName")
//execution.setVariable("DDVAM_modelName", modelName)
- //msoLogger.debug("Incoming Model Name is: " + modelName)
+ //logger.debug("Incoming Model Name is: " + modelName)
//String modelCustomizationId = jsonUtil.getJsonValue(vnfModelInfo, "modelCustomizationId")
//if (modelCustomizationId == null) {
// modelCustomizationId = ""
//}
//execution.setVariable("DDVAM_modelCustomizationId", modelCustomizationId)
- //msoLogger.debug("Incoming Model Customization Id is: " + modelCustomizationId)
+ //logger.debug("Incoming Model Customization Id is: " + modelCustomizationId)
String cloudSiteId = execution.getVariable("lcpCloudRegionId")
execution.setVariable("DDVAM_cloudSiteId", cloudSiteId)
- msoLogger.debug("Incoming Cloud Site Id is: " + cloudSiteId)
+ logger.debug("Incoming Cloud Site Id is: " + cloudSiteId)
String tenantId = execution.getVariable("tenantId")
execution.setVariable("DDVAM_tenantId", tenantId)
- msoLogger.debug("Incoming Tenant Id is: " + tenantId)
+ logger.debug("Incoming Tenant Id is: " + tenantId)
String globalSubscriberId = execution.getVariable("globalSubscriberId")
if (globalSubscriberId == null) {
globalSubscriberId = ""
}
execution.setVariable("DDVAM_globalSubscriberId", globalSubscriberId)
- msoLogger.debug("Incoming Global Subscriber Id is: " + globalSubscriberId)
+ logger.debug("Incoming Global Subscriber Id is: " + globalSubscriberId)
}
execution.setVariable("DDVAM_vfModulesFromDecomposition", null)
// Retrieve serviceDecomposition if present
ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
if (serviceDecomposition != null) {
- msoLogger.debug("Getting Catalog DB data from ServiceDecomposition object: " + serviceDecomposition.toJsonString())
+ logger.debug("Getting Catalog DB data from ServiceDecomposition object: " + serviceDecomposition.toJsonString())
List<VnfResource> vnfs = serviceDecomposition.getVnfResources()
- msoLogger.debug("Read vnfs")
+ logger.debug("Read vnfs")
if (vnfs == null) {
- msoLogger.debug("Error - vnfs are empty in serviceDecomposition object")
+ logger.debug("Error - vnfs are empty in serviceDecomposition object")
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in preProcessRequest - vnfs are empty")
}
VnfResource vnf = vnfs[0]
if (vnf == null) {
- msoLogger.debug("Error - vnf is empty in serviceDecomposition object")
+ logger.debug("Error - vnf is empty in serviceDecomposition object")
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in preProcessRequest - vnf is empty")
}
@@ -193,14 +198,14 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor {
}catch(BpmnError b){
- msoLogger.debug("Rethrowing MSOWorkflowException")
+ logger.debug("Rethrowing MSOWorkflowException")
throw b
}catch(Exception e){
- msoLogger.debug(" Error Occured in DoCreateVnfAndModules PreProcessRequest method!" + e.getMessage())
+ logger.debug(" Error Occured in DoCreateVnfAndModules PreProcessRequest method!" + e.getMessage())
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DoCreateVnf PreProcessRequest")
}
- msoLogger.trace("COMPLETED DoDeleteVnfAndModules PreProcessRequest Process ")
+ logger.trace("COMPLETED DoDeleteVnfAndModules PreProcessRequest Process ")
}
@@ -208,7 +213,7 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor {
public void preProcessAddOnModule(DelegateExecution execution){
execution.setVariable("prefix", Prefix)
- msoLogger.trace("STARTED preProcessAddOnModule ")
+ logger.trace("STARTED preProcessAddOnModule ")
try {
JSONArray addOnModules = (JSONArray) execution.getVariable("addOnModules")
@@ -233,10 +238,12 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor {
}catch(Exception e){
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing preProcessAddOnModule." + e, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Occured Processing preProcessAddOnModule." + e, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessAddOnModule Method:\n" + e.getMessage())
}
- msoLogger.trace("COMPLETED preProcessSDNCAssignRequest ")
+ logger.trace("COMPLETED preProcessSDNCAssignRequest ")
}
/**
@@ -250,7 +257,7 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor {
def method = getClass().getSimpleName() + '.queryAAIVfModule(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
try {
def vnfId = execution.getVariable('vnfId')
@@ -279,16 +286,16 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor {
// Find the model for this vf module in decomposition if specified
if (vfModulesFromDecomposition != null) {
- msoLogger.debug("vfModulesFromDecomposition is not null")
+ logger.debug("vfModulesFromDecomposition is not null")
def vfModuleUuid = vfModule.getModelVersionId()
if (vfModuleUuid == null) {
vfModuleUuid = vfModule.getPersonaModelVersion()
}
- msoLogger.debug("vfModule UUID is: " + vfModuleUuid)
+ logger.debug("vfModule UUID is: " + vfModuleUuid)
for (j in 0..vfModulesFromDecomposition.size()-1) {
ModuleResource mr = vfModulesFromDecomposition[j]
if (mr.getModelInfo().getModelUuid() == vfModuleUuid) {
- msoLogger.debug("Found modelInfo")
+ logger.debug("Found modelInfo")
vfModuleModelInfo = mr.getModelInfo()
break
}
@@ -325,14 +332,16 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor {
execution.setVariable("DDVAM_vfModules", vfModulesList)
} catch (Exception ex) {
ex.printStackTrace()
- msoLogger.debug('Exception occurred while executing AAI GET:' + ex.getMessage())
+ logger.debug('Exception occurred while executing AAI GET:' + ex.getMessage())
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'AAI GET Failed:' + ex.getMessage())
}
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIVfModule(): ' + e.getMessage())
}
}
@@ -340,7 +349,7 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor {
public void prepareNextModuleToDelete(DelegateExecution execution){
execution.setVariable("prefix", Prefix)
- msoLogger.trace("STARTED prepareNextModuleToDelete ")
+ logger.trace("STARTED prepareNextModuleToDelete ")
try {
int i = execution.getVariable("DDVAM_nextModule")
@@ -354,20 +363,22 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor {
execution.setVariable("DDVAM_vfModuleName", vfModuleName)
def vfModuleModelInfo = vfModule.get("vfModuleModelInfo")
- msoLogger.debug("vfModuleModelInfo for module delete: " + vfModuleModelInfo)
+ logger.debug("vfModuleModelInfo for module delete: " + vfModuleModelInfo)
execution.setVariable("DDVAM_vfModuleModelInfo", vfModuleModelInfo)
}catch(Exception e){
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing preProcessAddOnModule." + e, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Occured Processing preProcessAddOnModule." + e, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during prepareNextModuleToDelete Method:\n" + e.getMessage())
}
- msoLogger.trace("COMPLETED prepareNextModuleToDelete ")
+ logger.trace("COMPLETED prepareNextModuleToDelete ")
}
public void preProcessSDNCDeactivateRequest(DelegateExecution execution){
execution.setVariable("prefix", Prefix)
- msoLogger.trace("STARTED preProcessSDNCDeactivateRequest ")
+ logger.trace("STARTED preProcessSDNCDeactivateRequest ")
def vnfId = execution.getVariable("vnfId")
def serviceInstanceId = execution.getVariable("serviceInstanceId")
@@ -378,14 +389,16 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor {
deactivateSDNCRequest = utils.formatXml(deactivateSDNCRequest)
execution.setVariable("DDVAM_deactivateSDNCRequest", deactivateSDNCRequest)
- msoLogger.debug("Outgoing DeactivateSDNCRequest is: \n" + deactivateSDNCRequest)
- msoLogger.debug("Outgoing DeactivateSDNCRequest is: \n" + deactivateSDNCRequest)
+ logger.debug("Outgoing DeactivateSDNCRequest is: \n" + deactivateSDNCRequest)
+ logger.debug("Outgoing DeactivateSDNCRequest is: \n" + deactivateSDNCRequest)
}catch(Exception e){
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing preProcessSDNCDeactivateRequest." + e, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Occured Processing preProcessSDNCDeactivateRequest." + e, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessSDNCDeactivateRequest Method:\n" + e.getMessage())
}
- msoLogger.trace("COMPLETED preProcessSDNCDeactivateRequest ")
+ logger.trace("COMPLETED preProcessSDNCDeactivateRequest ")
}
public void preProcessSDNCUnassignRequest(DelegateExecution execution) {
@@ -393,9 +406,9 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor {
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
execution.setVariable("prefix", Prefix)
- msoLogger.trace("STARTED preProcessSDNCUnassignRequest Process ")
+ logger.trace("STARTED preProcessSDNCUnassignRequest Process ")
try{
String vnfId = execution.getVariable("vnfId")
String serviceInstanceId = execution.getVariable("serviceInstanceId")
@@ -403,14 +416,14 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor {
String unassignSDNCRequest = buildSDNCRequest(execution, serviceInstanceId, "unassign")
execution.setVariable("DDVAM_unassignSDNCRequest", unassignSDNCRequest)
- msoLogger.debug("Outgoing UnassignSDNCRequest is: \n" + unassignSDNCRequest)
- msoLogger.debug("Outgoing UnassignSDNCRequest is: \n" + unassignSDNCRequest)
+ logger.debug("Outgoing UnassignSDNCRequest is: \n" + unassignSDNCRequest)
+ logger.debug("Outgoing UnassignSDNCRequest is: \n" + unassignSDNCRequest)
}catch(Exception e){
- msoLogger.debug("Exception Occured Processing preProcessSDNCUnassignRequest. Exception is:\n" + e)
+ logger.debug("Exception Occured Processing preProcessSDNCUnassignRequest. Exception is:\n" + e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessSDNCUnassignRequest Method:\n" + e.getMessage())
}
- msoLogger.trace("COMPLETED preProcessSDNCUnassignRequest Process ")
+ logger.trace("COMPLETED preProcessSDNCUnassignRequest Process ")
}
public String buildSDNCRequest(DelegateExecution execution, String svcInstId, String action){
@@ -474,33 +487,33 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor {
</sdncadapterworkflow:SDNCRequestData>
</sdncadapterworkflow:SDNCAdapterWorkflowRequest>"""
- msoLogger.debug("sdncRequest: " + sdncRequest)
+ logger.debug("sdncRequest: " + sdncRequest)
return sdncRequest
}
public void validateSDNCResponse(DelegateExecution execution, String response, String method){
execution.setVariable("prefix",Prefix)
- msoLogger.trace("STARTED ValidateSDNCResponse Process")
+ logger.trace("STARTED ValidateSDNCResponse Process")
WorkflowException workflowException = execution.getVariable("WorkflowException")
boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator")
- msoLogger.debug("workflowException: " + workflowException)
+ logger.debug("workflowException: " + workflowException)
SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this)
sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator)
- msoLogger.debug("SDNCResponse: " + response)
+ logger.debug("SDNCResponse: " + response)
String sdncResponse = response
if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){
- msoLogger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + sdncResponse)
+ logger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + sdncResponse)
}else{
- msoLogger.debug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.")
+ logger.debug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.")
throw new BpmnError("MSOWorkflowException")
}
- msoLogger.trace("COMPLETED ValidateSDNCResponse Process")
+ logger.trace("COMPLETED ValidateSDNCResponse Process")
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleE2EServiceInstance.groovy
index 41d9384f52..e04cf35c54 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleE2EServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleE2EServiceInstance.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2018 CMCC 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
@@ -31,6 +33,8 @@ import org.onap.so.bpmn.common.scripts.MsoUtils
import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
import org.springframework.web.util.UriUtils;
@@ -40,7 +44,7 @@ import org.springframework.web.util.UriUtils;
*
*/
public class DoScaleE2EServiceInstance extends AbstractServiceTaskProcessor {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoScaleE2EServiceInstance.class);
+ private static final Logger logger = LoggerFactory.getLogger( DoScaleE2EServiceInstance.class);
String Prefix = "DCRESI_"
@@ -49,7 +53,7 @@ public class DoScaleE2EServiceInstance extends AbstractServiceTaskProcessor {
public void preProcessRequest(DelegateExecution execution) {
String msg = ""
- msoLogger.trace("preProcessRequest ")
+ logger.trace("preProcessRequest ")
try {
String requestId = execution.getVariable("msoRequestId")
@@ -82,22 +86,22 @@ public class DoScaleE2EServiceInstance extends AbstractServiceTaskProcessor {
}
if (isBlank(serviceInstanceId)) {
msg = "Input serviceInstanceId is null"
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
}
} catch (BpmnError e) {
throw e;
} catch (Exception ex) {
msg = "Exception in preProcessRequest " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("Exit preProcessRequest ")
+ logger.trace("Exit preProcessRequest ")
}
public void preInitResourcesOperStatus(DelegateExecution execution){
- msoLogger.trace("STARTED preInitResourcesOperStatus Process ")
+ logger.trace("STARTED preInitResourcesOperStatus Process ")
try{
String serviceId = execution.getVariable("serviceInstanceId")
String operationId = execution.getVariable("operationId")
@@ -105,7 +109,7 @@ public class DoScaleE2EServiceInstance extends AbstractServiceTaskProcessor {
// resourceTemplateUUIDs should be created ??
String resourceTemplateUUIDs = execution.getVariable("resourceTemplateUUIDs")
- msoLogger.info("Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId + " operationType:" + operationType)
+ logger.info("Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId + " operationType:" + operationType)
serviceId = UriUtils.encode(serviceId,"UTF-8")
execution.setVariable("serviceInstanceId", serviceId)
execution.setVariable("operationId", operationId)
@@ -129,14 +133,16 @@ public class DoScaleE2EServiceInstance extends AbstractServiceTaskProcessor {
payload = utils.formatXml(payload)
execution.setVariable("CVFMI_initResOperStatusRequest", payload)
- msoLogger.info("Outgoing initResourceOperationStatus: \n" + payload)
- msoLogger.debug("CreateVfModuleInfra Outgoing initResourceOperationStatus Request: " + payload)
+ logger.info("Outgoing initResourceOperationStatus: \n" + payload)
+ logger.debug("CreateVfModuleInfra Outgoing initResourceOperationStatus Request: " + payload)
}catch(Exception e){
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing preInitResourcesOperStatus.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Occured Processing preInitResourcesOperStatus.", "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), e);
execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preInitResourcesOperStatus Method:\n" + e.getMessage())
}
- msoLogger.trace("COMPLETED preInitResourcesOperStatus Process ")
+ logger.trace("COMPLETED preInitResourcesOperStatus Process ")
}
}
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 19d30bb9b1..671eb5cdc0 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
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2018 CMCC. 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
@@ -46,6 +48,8 @@ import org.onap.so.bpmn.infrastructure.vfcmodel.NsParameters
import org.onap.so.bpmn.infrastructure.vfcmodel.LocationConstraint
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
import org.onap.so.utils.TargetEntity
@@ -56,7 +60,7 @@ import org.onap.so.utils.TargetEntity
* flow for VFC Network Service Scale
*/
public class DoScaleVFCNetworkServiceInstance extends AbstractServiceTaskProcessor {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoScaleVFCNetworkServiceInstance.class);
+ private static final Logger logger = LoggerFactory.getLogger( DoScaleVFCNetworkServiceInstance.class);
String host = "http://mso.mso.testlab.openecomp.org:8080"
@@ -76,7 +80,7 @@ public class DoScaleVFCNetworkServiceInstance extends AbstractServiceTaskProcess
* generate the nsParameters
*/
public void preProcessRequest(DelegateExecution execution) {
- msoLogger.trace("preProcessRequest() ")
+ logger.trace("preProcessRequest() ")
List<NSResourceInputParameter> nsRIPList = convertScaleNsReq2NSResInputParamList(execution)
String requestJsonStr = ""
@@ -93,7 +97,7 @@ public class DoScaleVFCNetworkServiceInstance extends AbstractServiceTaskProcess
execution.setVariable("reqBody", requestJsonStr)
- msoLogger.trace("Exit preProcessRequest ")
+ logger.trace("Exit preProcessRequest ")
}
/**
@@ -122,7 +126,7 @@ public class DoScaleVFCNetworkServiceInstance extends AbstractServiceTaskProcess
if (returnCode == "200" || returnCode == "202") {
jobId = jsonUtil.getJsonValue(aaiResponseAsString, "jobId")
}
- utils.log("INFO", "scaleNetworkService get a ns scale job Id:" + jobId, isDebugEnabled)
+ logger.info( "scaleNetworkService get a ns scale job Id:" + jobId)
execution.setVariable("jobId", jobId)
execution.setVariable("nodeTemplateUUID", nodeTemplateUUID)
@@ -178,7 +182,9 @@ public class DoScaleVFCNetworkServiceInstance extends AbstractServiceTaskProcess
try {
Thread.sleep(5000)
} catch (InterruptedException e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Time Delay exception" + e, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Time Delay exception" + e, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue());
}
}
@@ -196,8 +202,8 @@ public class DoScaleVFCNetworkServiceInstance extends AbstractServiceTaskProcess
* requestBody: the body of the request
*/
private Response postRequest(DelegateExecution execution, String urlString, String requestBody){
- msoLogger.trace("Started Execute VFC adapter Post Process ")
- msoLogger.info("url:"+urlString +"\nrequestBody:"+ requestBody)
+ logger.trace("Started Execute VFC adapter Post Process ")
+ logger.info("url:"+urlString +"\nrequestBody:"+ requestBody)
Response apiResponse = null
try{
URL url = new URL(urlString);
@@ -207,10 +213,10 @@ public class DoScaleVFCNetworkServiceInstance extends AbstractServiceTaskProcess
apiResponse = httpClient.post(requestBody)
- msoLogger.info("response code:"+ apiResponse.getStatus() +"\nresponse body:"+ apiResponse.readEntity(String.class))
- msoLogger.trace("Completed Execute VF-C adapter Post Process ")
+ logger.info("response code:"+ apiResponse.getStatus() +"\nresponse body:"+ apiResponse.readEntity(String.class))
+ logger.trace("Completed Execute VF-C adapter Post Process ")
}catch(Exception e){
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception occured while executing VFC Post Call.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception occured while executing VFC Post Call.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), e);
throw new BpmnError("MSOWorkflowException")
}
return apiResponse
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy
index baa695af09..4fe30803c4 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2018 Huawei Technologies Co., Ltd. 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
@@ -40,6 +42,8 @@ import org.onap.so.client.aai.entities.AAIResultWrapper
import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.springframework.web.util.UriUtils;
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
import groovy.json.*
@@ -67,6 +71,7 @@ import groovy.json.*
* @param - WorkflowException
*/
public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor {
+ private static final Logger logger = LoggerFactory.getLogger( DoUpdateE2EServiceInstance.class);
String Prefix="DUPDSI_"
private static final String DebugFlag = "isDebugEnabled"
@@ -76,7 +81,7 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor {
public void preProcessRequest (DelegateExecution execution) {
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
- utils.log("INFO"," ***** Enter DoUpdateE2EServiceInstance preProcessRequest *****", isDebugEnabled)
+ logger.info(" ***** Enter DoUpdateE2EServiceInstance preProcessRequest *****")
String msg = ""
@@ -85,24 +90,24 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor {
//Inputs
//for AAI GET & PUT & SDNC assignToplology
String globalSubscriberId = execution.getVariable("globalSubscriberId") //globalCustomerId
- utils.log("INFO"," ***** globalSubscriberId *****" + globalSubscriberId, isDebugEnabled)
+ logger.info(" ***** globalSubscriberId *****" + globalSubscriberId)
//for AAI PUT & SDNC assignTopology
String serviceType = execution.getVariable("serviceType")
- utils.log("INFO"," ***** serviceType *****" + serviceType, isDebugEnabled)
+ logger.info(" ***** serviceType *****" + serviceType)
//for SDNC assignTopology
String productFamilyId = execution.getVariable("productFamilyId") //AAI productFamilyId
if (isBlank(globalSubscriberId)) {
msg = "Input globalSubscriberId is null"
- utils.log("INFO", msg, isDebugEnabled)
+ logger.info( msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
}
if (isBlank(serviceType)) {
msg = "Input serviceType is null"
- utils.log("INFO", msg, isDebugEnabled)
+ logger.info( msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
}
@@ -110,7 +115,7 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor {
String serviceInstanceId = execution.getVariable("serviceInstanceId")
if (isBlank(serviceInstanceId)){
msg = "Input serviceInstanceId is null"
- utils.log("INFO", msg, isDebugEnabled)
+ logger.info( msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
}
@@ -122,29 +127,29 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor {
// target model Invariant uuid
String modelInvariantUuid = jsonUtil.getJsonValue(uuiRequest, "service.serviceInvariantUuid")
execution.setVariable("modelInvariantUuid", modelInvariantUuid)
- utils.log("INFO", "modelInvariantUuid: " + modelInvariantUuid, isDebugEnabled)
+ logger.info( "modelInvariantUuid: " + modelInvariantUuid)
// target model uuid
String modelUuid = jsonUtil.getJsonValue(uuiRequest, "service.serviceUuid")
execution.setVariable("modelUuid", modelUuid)
- utils.log("INFO","modelUuid: " + modelUuid, isDebugEnabled)
+ logger.info("modelUuid: " + modelUuid)
} catch (BpmnError e) {
throw e;
} catch (Exception ex){
msg = "Exception in preProcessRequest " + ex.getMessage()
- utils.log("INFO", msg, isDebugEnabled)
+ logger.info( msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- utils.log("INFO", "======== COMPLETED preProcessRequest Process ======== ", isDebugEnabled)
+ logger.info( "======== COMPLETED preProcessRequest Process ======== ")
}
public void preInitResourcesOperStatus(DelegateExecution execution){
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
- utils.log("INFO", " ======== STARTED preInitResourcesOperStatus Process ======== ", isDebugEnabled)
+ logger.info( " ======== STARTED preInitResourcesOperStatus Process ======== ")
try{
String serviceId = execution.getVariable("serviceInstanceId")
String operationId = execution.getVariable("operationId")
@@ -154,7 +159,7 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor {
String progress = "0"
String reason = ""
String operationContent = "Prepare service updating"
- utils.log("INFO", "Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId + " operationType:" + operationType, isDebugEnabled)
+ logger.info( "Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId + " operationType:" + operationType)
serviceId = UriUtils.encode(serviceId,"UTF-8")
execution.setVariable("serviceInstanceId", serviceId)
execution.setVariable("operationId", operationId)
@@ -171,7 +176,7 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor {
def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution)
execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint)
- utils.log("INFO", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled)
+ logger.info( "DB Adapter Endpoint is: " + dbAdapterEndpoint)
String payload =
"""<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
@@ -189,20 +194,20 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor {
payload = utils.formatXml(payload)
execution.setVariable("CVFMI_initResOperStatusRequest", payload)
- utils.log("INFO", "Outgoing initResourceOperationStatus: \n" + payload, isDebugEnabled)
+ logger.info( "Outgoing initResourceOperationStatus: \n" + payload)
utils.logAudit("CreateVfModuleInfra Outgoing initResourceOperationStatus Request: " + payload)
}catch(Exception e){
- utils.log("ERROR", "Exception Occured Processing preInitResourcesOperStatus. Exception is:\n" + e, isDebugEnabled)
+ logger.info( "Exception Occured Processing preInitResourcesOperStatus. Exception is:\n" + e)
execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preInitResourcesOperStatus Method:\n" + e.getMessage())
}
- utils.log("INFO", "======== COMPLETED preInitResourcesOperStatus Process ======== ", isDebugEnabled)
+ logger.info( "======== COMPLETED preInitResourcesOperStatus Process ======== ")
}
public void preProcessForAddResource(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- utils.log("INFO"," ***** preProcessForAddResource ***** ", isDebugEnabled)
+ logger.info(" ***** preProcessForAddResource ***** ")
execution.setVariable("operationType", "create")
@@ -212,21 +217,21 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor {
execution.setVariable("hasResourcetoAdd", true)
}
- utils.log("INFO"," *** Exit preProcessForAddResource *** ", isDebugEnabled)
+ logger.info(" *** Exit preProcessForAddResource *** ")
}
public void postProcessForAddResource(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- utils.log("INFO"," ***** postProcessForAddResource ***** ", isDebugEnabled)
+ logger.info(" ***** postProcessForAddResource ***** ")
execution.setVariable("operationType", "update")
- utils.log("INFO"," *** Exit postProcessForAddResource *** ", isDebugEnabled)
+ logger.info(" *** Exit postProcessForAddResource *** ")
}
public void preProcessForDeleteResource(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- utils.log("INFO"," ***** preProcessForDeleteResource ***** ", isDebugEnabled)
+ logger.info(" ***** preProcessForDeleteResource ***** ")
execution.setVariable("operationType", "delete")
@@ -259,22 +264,22 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor {
execution.setVariable("deleteResourceList", delResourceList)
- utils.log("INFO"," *** Exit preProcessForDeleteResource *** ", isDebugEnabled)
+ logger.info(" *** Exit preProcessForDeleteResource *** ")
}
public void postProcessForDeleteResource(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- utils.log("INFO"," ***** postProcessForDeleteResource ***** ", isDebugEnabled)
+ logger.info(" ***** postProcessForDeleteResource ***** ")
execution.setVariable("operationType", "update")
- utils.log("INFO"," *** Exit postProcessForDeleteResource *** ", isDebugEnabled)
+ logger.info(" *** Exit postProcessForDeleteResource *** ")
}
public void preProcessAAIPUT(DelegateExecution execution) {
def method = getClass().getSimpleName() + '.preProcessRequest(' +'execution=' + execution.getId() +')'
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
- utils.log("INFO","Entered " + method, isDebugEnabled)
+ logger.info("Entered " + method)
String msg = ""
String serviceInstanceVersion = execution.getVariable("serviceInstanceVersion")
@@ -299,12 +304,12 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor {
execution.setVariable("serviceInstanceData", si)
- utils.log("INFO", "Exited " + method, isDebugEnabled)
+ logger.info( "Exited " + method)
}
public void updateServiceInstance(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- utils.log("INFO"," ***** createServiceInstance ***** ", isDebugEnabled)
+ logger.info(" ***** createServiceInstance ***** ")
String msg = ""
String serviceInstanceId = execution.getVariable("serviceInstanceId")
try {
@@ -327,52 +332,52 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor {
execution.setVariable("rollbackData", rollbackData)
msg = "Exception in DoCreateServiceInstance.createServiceInstance. " + ex.getMessage()
- utils.log("INFO", msg, isDebugEnabled)
+ logger.info( msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- utils.log("INFO"," *** Exit createServiceInstance *** ", isDebugEnabled)
+ logger.info(" *** Exit createServiceInstance *** ")
}
public void preProcessRollback (DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- utils.log("INFO"," ***** preProcessRollback ***** ", isDebugEnabled)
+ logger.info(" ***** preProcessRollback ***** ")
try {
Object workflowException = execution.getVariable("WorkflowException");
if (workflowException instanceof WorkflowException) {
- utils.log("INFO", "Prev workflowException: " + workflowException.getErrorMessage(), isDebugEnabled)
+ logger.info( "Prev workflowException: " + workflowException.getErrorMessage())
execution.setVariable("prevWorkflowException", workflowException);
//execution.setVariable("WorkflowException", null);
}
} catch (BpmnError e) {
- utils.log("INFO", "BPMN Error during preProcessRollback", isDebugEnabled)
+ logger.info( "BPMN Error during preProcessRollback")
} catch(Exception ex) {
String msg = "Exception in preProcessRollback. " + ex.getMessage()
- utils.log("INFO", msg, isDebugEnabled)
+ logger.info( msg)
}
- utils.log("INFO"," *** Exit preProcessRollback *** ", isDebugEnabled)
+ logger.info(" *** Exit preProcessRollback *** ")
}
public void postProcessRollback (DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- utils.log("INFO"," ***** postProcessRollback ***** ", isDebugEnabled)
+ logger.info(" ***** postProcessRollback ***** ")
String msg = ""
try {
Object workflowException = execution.getVariable("prevWorkflowException");
if (workflowException instanceof WorkflowException) {
- utils.log("INFO", "Setting prevException to WorkflowException: ", isDebugEnabled)
+ logger.info( "Setting prevException to WorkflowException: ")
execution.setVariable("WorkflowException", workflowException);
}
execution.setVariable("rollbackData", null)
} catch (BpmnError b) {
- utils.log("INFO", "BPMN Error during postProcessRollback", isDebugEnabled)
+ logger.info( "BPMN Error during postProcessRollback")
throw b;
} catch(Exception ex) {
msg = "Exception in postProcessRollback. " + ex.getMessage()
- utils.log("INFO", msg, isDebugEnabled)
+ logger.info( msg)
}
- utils.log("INFO"," *** Exit postProcessRollback *** ", isDebugEnabled)
+ logger.info(" *** Exit postProcessRollback *** ")
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstanceRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstanceRollback.groovy
index 949a566711..0a635c6bc6 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstanceRollback.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstanceRollback.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2018 Huawei Technologies Co., Ltd. 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
@@ -35,7 +37,8 @@ import org.onap.so.client.aai.AAIResourcesClient
import org.onap.so.client.aai.entities.AAIResultWrapper
import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
-import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
import org.onap.so.bpmn.common.scripts.ExceptionUtil;
import groovy.json.*
import org.onap.so.bpmn.common.scripts.AaiUtil;
@@ -61,7 +64,7 @@ import org.onap.so.bpmn.common.scripts.AaiUtil;
*
*/
public class DoUpdateE2EServiceInstanceRollback extends AbstractServiceTaskProcessor{
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoUpdateE2EServiceInstanceRollback.class);
+ private static final Logger logger = LoggerFactory.getLogger( DoUpdateE2EServiceInstanceRollback.class);
String Prefix="DUPDSIRB_"
@@ -70,7 +73,7 @@ public class DoUpdateE2EServiceInstanceRollback extends AbstractServiceTaskProce
public void preProcessRequest(DelegateExecution execution) {
execution.setVariable("prefix",Prefix)
String msg = ""
- msoLogger.trace("preProcessRequest ")
+ logger.trace("preProcessRequest ")
execution.setVariable("rollbackAAI",false)
execution.setVariable("rollbackAdded",false)
execution.setVariable("rollbackDeleted",false)
@@ -85,7 +88,7 @@ public class DoUpdateE2EServiceInstanceRollback extends AbstractServiceTaskProce
try {
def rollbackData = execution.getVariable("rollbackData")
- msoLogger.debug("RollbackData:" + rollbackData)
+ logger.debug("RollbackData:" + rollbackData)
if (rollbackData != null) {
if (rollbackData.hasType("SERVICEINSTANCE")) {
@@ -140,14 +143,14 @@ public class DoUpdateE2EServiceInstanceRollback extends AbstractServiceTaskProce
throw e;
} catch (Exception ex){
msg = "Exception in Update ServiceInstance Rollback preProcessRequest " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("Exit preProcessRequest ")
+ logger.trace("Exit preProcessRequest ")
}
public void postProcessRequest(DelegateExecution execution) {
- msoLogger.trace("postProcessRequest ")
+ logger.trace("postProcessRequest ")
String msg = ""
try {
execution.setVariable("rollbackData", null)
@@ -171,17 +174,17 @@ public class DoUpdateE2EServiceInstanceRollback extends AbstractServiceTaskProce
if(!succInAAI){
execution.setVariable("rolledBack", false) //both sdnc and aai must be successful to declare rollback Succesful
execution.setVariable("rollbackError", "Error deleting service-instance in AAI for rollback")
- msoLogger.debug("Error deleting service-instance in AAI for rollback", + serviceInstanceId)
+ logger.debug("Error deleting service-instance in AAI for rollback", + serviceInstanceId)
}
}
- msoLogger.trace("Exit postProcessRequest ")
+ logger.trace("Exit postProcessRequest ")
} catch (BpmnError e) {
msg = "Exception in Create ServiceInstance Rollback postProcessRequest. " + e.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
} catch (Exception ex) {
msg = "Exception in Create ServiceInstance Rollback postProcessRequest. " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
}
}
@@ -200,9 +203,9 @@ public class DoUpdateE2EServiceInstanceRollback extends AbstractServiceTaskProce
public void preProcessAAIPUT(DelegateExecution execution) {
def method = getClass().getSimpleName() + '.preProcessRequest(' +'execution=' + execution.getId() +')'
- msoLogger.info("Entered " + method)
+ logger.info("Entered " + method)
String msg = ""
- msoLogger.trace("preProcessAAIPUT ")
+ logger.trace("preProcessAAIPUT ")
String serviceInstanceVersion = execution.getVariable("serviceInstanceVersion_n")
// execution.setVariable("GENPS_serviceResourceVersion", serviceInstanceVersion)
@@ -227,11 +230,11 @@ public class DoUpdateE2EServiceInstanceRollback extends AbstractServiceTaskProce
execution.setVariable("serviceInstanceData", si)
- msoLogger.info("Exited " + method)
+ logger.info("Exited " + method)
}
public void updateServiceInstance(DelegateExecution execution) {
- msoLogger.trace("updateServiceInstance ")
+ logger.trace("updateServiceInstance ")
String msg = ""
try {
String serviceInstanceId = execution.getVariable("serviceInstanceId")
@@ -245,40 +248,40 @@ public class DoUpdateE2EServiceInstanceRollback extends AbstractServiceTaskProce
throw e;
} catch (Exception ex) {
msg = "Exception in DoCreateServiceInstance.updateServiceInstance. " + ex.getMessage()
- msoLogger.info(msg)
+ logger.info(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("Exit updateServiceInstance ")
+ logger.trace("Exit updateServiceInstance ")
}
public void processRollbackException(DelegateExecution execution){
- msoLogger.trace("processRollbackException ")
+ logger.trace("processRollbackException ")
try{
- msoLogger.debug("Caught an Exception in DoUpdateE2EServiceInstanceRollback")
+ logger.debug("Caught an Exception in DoUpdateE2EServiceInstanceRollback")
execution.setVariable("rollbackData", null)
execution.setVariable("rollbackError", "Caught exception in ServiceInstance Update Rollback")
execution.setVariable("WorkflowException", null)
}catch(BpmnError b){
- msoLogger.debug("BPMN Error during processRollbackExceptions Method: ")
+ logger.debug("BPMN Error during processRollbackExceptions Method: ")
}catch(Exception e){
- msoLogger.debug("Caught Exception during processRollbackExceptions Method: " + e.getMessage())
+ logger.debug("Caught Exception during processRollbackExceptions Method: " + e.getMessage())
}
- msoLogger.debug(" Exit processRollbackException")
+ logger.debug(" Exit processRollbackException")
}
public void processRollbackJavaException(DelegateExecution execution){
- msoLogger.trace("processRollbackJavaException ")
+ logger.trace("processRollbackJavaException ")
try{
execution.setVariable("rollbackData", null)
execution.setVariable("rollbackError", "Caught Java exception in ServiceInstance Update Rollback")
- msoLogger.debug("Caught Exception in processRollbackJavaException")
+ logger.debug("Caught Exception in processRollbackJavaException")
}catch(Exception e){
- msoLogger.debug("Caught Exception in processRollbackJavaException " + e.getMessage())
+ logger.debug("Caught Exception in processRollbackJavaException " + e.getMessage())
}
- msoLogger.trace("Exit processRollbackJavaException ")
+ logger.trace("Exit processRollbackJavaException ")
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstance.groovy
index 6dd8085bae..ce61595680 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstance.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -43,7 +45,8 @@ import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.client.aai.entities.AAIResultWrapper
import org.onap.so.client.graphinventory.entities.uri.Depth
import org.onap.so.constants.Defaults
-import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
import org.springframework.web.util.UriUtils
import org.w3c.dom.Document
@@ -68,7 +71,7 @@ import groovy.xml.XmlUtil
*
*/
public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoUpdateNetworkInstance.class);
+ private static final Logger logger = LoggerFactory.getLogger( DoUpdateNetworkInstance.class);
String Prefix="UPDNETI_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
@@ -176,7 +179,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable("prefix",Prefix)
- msoLogger.trace("Inside preProcessRequest DoUpdateNetworkInstance Request ")
+ logger.trace("Inside preProcessRequest DoUpdateNetworkInstance Request ")
try {
// initialize flow variables
@@ -190,12 +193,12 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor {
// JSON format request is sent, create xml
try {
def prettyJson = JsonOutput.prettyPrint(networkRequest.toString())
- msoLogger.debug(" Incoming message formatted . . . : " + '\n' + prettyJson)
+ logger.debug(" Incoming message formatted . . . : " + '\n' + prettyJson)
networkRequest = vidUtils.createXmlNetworkRequestInfra(execution, networkRequest)
} catch (Exception ex) {
String dataErrorMessage = " Invalid json format Request - " + ex.getMessage()
- msoLogger.debug(dataErrorMessage)
+ logger.debug(dataErrorMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage)
}
} else {
@@ -208,32 +211,32 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor {
}
networkRequest = utils.formatXml(networkRequest)
- msoLogger.debug(networkRequest)
+ logger.debug(networkRequest)
execution.setVariable(Prefix + "networkRequest", networkRequest)
- msoLogger.debug(" network-request - " + '\n' + networkRequest)
+ logger.debug(" network-request - " + '\n' + networkRequest)
// validate 'disableRollback' (aka, 'suppressRollback')
boolean rollbackEnabled = networkUtils.isRollbackEnabled(execution, networkRequest)
execution.setVariable(Prefix + "rollbackEnabled", rollbackEnabled)
- msoLogger.debug(Prefix + "rollbackEnabled - " + rollbackEnabled)
+ logger.debug(Prefix + "rollbackEnabled - " + rollbackEnabled)
String networkInputs = utils.getNodeXml(networkRequest, "network-inputs", false).replace("tag0:","").replace(":tag0","")
execution.setVariable(Prefix + "networkInputs", networkInputs)
- msoLogger.debug(Prefix + "networkInputs - " + '\n' + networkInputs)
+ logger.debug(Prefix + "networkInputs - " + '\n' + networkInputs)
// prepare messageId
String messageId = execution.getVariable(Prefix + "messageId") // for testing
if (messageId == null || messageId == "") {
messageId = UUID.randomUUID()
- msoLogger.debug(" UPDNETI_messageId, random generated: " + messageId)
+ logger.debug(" UPDNETI_messageId, random generated: " + messageId)
} else {
- msoLogger.debug(" UPDNETI_messageId, pre-assigned: " + messageId)
+ logger.debug(" UPDNETI_messageId, pre-assigned: " + messageId)
}
execution.setVariable(Prefix + "messageId", messageId)
String source = utils.getNodeText(networkRequest, "source")
execution.setVariable(Prefix + "source", source)
- msoLogger.debug(Prefix + "source - " + source)
+ logger.debug(Prefix + "source - " + source)
String networkId = ""
if (utils.nodeExists(networkRequest, "network-id")) {
@@ -242,7 +245,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor {
sendSyncError(execution)
// missing value of networkId
String dataErrorMessage = "Variable 'network-id' value/element is missing."
- msoLogger.debug(" Invalid Request - " + dataErrorMessage)
+ logger.debug(" Invalid Request - " + dataErrorMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage)
}
@@ -254,7 +257,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor {
if ((lcpCloudRegion == 'null') || (lcpCloudRegion == "")) {
sendSyncError(execution)
String dataErrorMessage = "requestDetails has missing 'aic-cloud-region' value/element."
- msoLogger.debug(" Invalid Request - " + dataErrorMessage)
+ logger.debug(" Invalid Request - " + dataErrorMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage)
}
}
@@ -265,7 +268,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor {
if ((serviceInstanceId == 'null') || (lcpCloudRegion == "")) {
sendSyncError(execution)
String dataErrorMessage = "Variable 'serviceInstanceId' value/element is missing."
- msoLogger.debug(" Invalid Request - " + dataErrorMessage)
+ logger.debug(" Invalid Request - " + dataErrorMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage)
}
}
@@ -282,18 +285,18 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor {
} catch (IOException ex) {
String exceptionMessage = "Exception Encountered in DoUpdateNetworkInstance, PreProcessRequest() - "
String dataErrorMessage = exceptionMessage + " Unable to encode PO/SDNC user/password string - " + ex.getMessage()
- msoLogger.debug(dataErrorMessage)
+ logger.debug(dataErrorMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage)
}
// Set variables for Generic Get Sub Flow use
execution.setVariable(Prefix + "serviceInstanceId", serviceInstanceId)
- msoLogger.debug(Prefix + "serviceInstanceId - " + serviceInstanceId)
+ logger.debug(Prefix + "serviceInstanceId - " + serviceInstanceId)
- msoLogger.debug(" Url for SDNC adapter: " + UrnPropertiesReader.getVariable("mso.adapters.sdnc.endpoint",execution))
+ logger.debug(" Url for SDNC adapter: " + UrnPropertiesReader.getVariable("mso.adapters.sdnc.endpoint",execution))
String sdncVersion = execution.getVariable("sdncVersion")
- msoLogger.debug("sdncVersion? : " + sdncVersion)
+ logger.debug("sdncVersion? : " + sdncVersion)
// build 'networkOutputs'
networkId = utils.getNodeText(networkRequest, "network-id")
@@ -310,7 +313,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor {
<network-name>${MsoUtils.xmlEscape(networkName)}</network-name>
</network-outputs>"""
execution.setVariable(Prefix + "networkOutputs", networkOutputs)
- msoLogger.debug(Prefix + "networkOutputs - " + '\n' + networkOutputs)
+ logger.debug(Prefix + "networkOutputs - " + '\n' + networkOutputs)
execution.setVariable(Prefix + "networkId", networkId)
execution.setVariable(Prefix + "networkName", networkName)
@@ -322,7 +325,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor {
sendSyncError(execution)
// caught exception
String exceptionMessage = "Exception Encountered in DoUpdateNetworkInstance, PreProcessRequest() - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
@@ -333,7 +336,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor {
*
*/
public void getServiceInstance(DelegateExecution execution) {
- msoLogger.trace("getServiceInstance ")
+ logger.trace("getServiceInstance ")
try {
String serviceInstanceId = execution.getVariable('serviceInstanceId')
@@ -352,7 +355,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor {
throw e;
}catch (Exception ex){
String msg = "Exception in getServiceInstance. " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
}
@@ -361,7 +364,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable("prefix", Prefix)
- msoLogger.debug(" ***** Inside callRESTQueryAAICloudRegion of DoUpdateNetworkInstance ***** " )
+ logger.debug(" ***** Inside callRESTQueryAAICloudRegion of DoUpdateNetworkInstance ***** " )
try {
String networkInputs = execution.getVariable(Prefix + "networkInputs")
@@ -386,12 +389,12 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor {
} else {
String dataErrorMessage = "QueryAAICloudRegion Unsuccessful. Return Code: " + execution.getVariable(Prefix + "queryCloudRegionReturnCode")
- msoLogger.debug(dataErrorMessage)
+ logger.debug(dataErrorMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage)
}
- msoLogger.debug(" is Cloud Region Good: " + execution.getVariable(Prefix + "isCloudRegionGood"))
+ logger.debug(" is Cloud Region Good: " + execution.getVariable(Prefix + "isCloudRegionGood"))
} catch (BpmnError e) {
throw e;
@@ -399,7 +402,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor {
} catch (Exception ex) {
// try error
String exceptionMessage = "Bpmn error encountered in DoUpdateNetworkInstance flow - callRESTQueryAAICloudRegion() - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
@@ -410,7 +413,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable("prefix", Prefix)
- msoLogger.debug(" ***** Inside callRESTQueryAAINetworkId of DoUpdateNetworkInstance ***** " )
+ logger.debug(" ***** Inside callRESTQueryAAINetworkId of DoUpdateNetworkInstance ***** " )
try {
// get variables
@@ -429,11 +432,11 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor {
} catch (NotFoundException e) {
String dataErrorMessage = "Response Error from QueryAAINetworkId is 404 (Not Found)."
- msoLogger.debug(" AAI Query Failed. " + dataErrorMessage)
+ logger.debug(" AAI Query Failed. " + dataErrorMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage)
} catch (Exception ex) {
String exceptionMessage = "Bpmn error encountered in DoUpdateNetworkInstance flow. callRESTQueryAAINetworkId() - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
@@ -444,7 +447,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable("prefix", Prefix)
- msoLogger.debug(" ***** Inside callRESTReQueryAAINetworkId of DoUpdateNetworkInstance ***** " )
+ logger.debug(" ***** Inside callRESTReQueryAAINetworkId of DoUpdateNetworkInstance ***** " )
try {
// get variables
@@ -467,15 +470,15 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor {
<network-name>${MsoUtils.xmlEscape(netName)}</network-name>
</network-outputs>"""
execution.setVariable(Prefix + "networkOutputs", networkOutputs)
- msoLogger.debug(" networkOutputs - " + '\n' + networkOutputs)
+ logger.debug(" networkOutputs - " + '\n' + networkOutputs)
} catch (NotFoundException e) {
String dataErrorMessage = "Response Error from ReQueryAAINetworkId is 404 (Not Found)."
- msoLogger.debug(" AAI ReQuery Failed. - " + dataErrorMessage)
+ logger.debug(" AAI ReQuery Failed. - " + dataErrorMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage)
} catch (Exception ex) {
String exceptionMessage = "Bpmn error encountered in DoUpdateNetworkInstance flow. callRESTReQueryAAINetworkId() - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
@@ -486,7 +489,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable("prefix", Prefix)
- msoLogger.debug(" ***** Inside callRESTQueryAAINetworkVpnBinding of DoUpdateNetworkInstance ***** " )
+ logger.debug(" ***** Inside callRESTQueryAAINetworkVpnBinding of DoUpdateNetworkInstance ***** " )
try {
@@ -495,7 +498,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor {
if(queryIdAAIResponse.getRelationships().isPresent()){
List<AAIResourceUri> uris = queryIdAAIResponse.getRelationships().get().getRelatedAAIUris(AAIObjectType.VPN_BINDING)
- msoLogger.debug(Prefix + "vpnCount - " + uris.size())
+ logger.debug(Prefix + "vpnCount - " + uris.size())
if (uris.size() > 0) {
String routeTargets = ""
@@ -522,7 +525,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor {
} // end loop
execution.setVariable(Prefix + "routeCollection", routeTargets)
- msoLogger.debug(" UPDNETI_routeCollection - " + '\n' + routeTargets)
+ logger.debug(" UPDNETI_routeCollection - " + '\n' + routeTargets)
} else {
// reset return code to success
@@ -538,17 +541,17 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor {
String aaiStubResponseAsXml = utils.formatXml(aaiStubResponse)
execution.setVariable(Prefix + "queryVpnBindingAAIResponse", aaiStubResponseAsXml)
execution.setVariable(Prefix + "routeCollection", "<routeTargets/>")
- msoLogger.debug(" No vpnBinding, using this stub as response - " + '\n' + aaiStubResponseAsXml)
+ logger.debug(" No vpnBinding, using this stub as response - " + '\n' + aaiStubResponseAsXml)
}
}
} catch (NotFoundException e) {
- msoLogger.debug("Response Error from AAINetworkVpnBinding is 404 (Not Found).")
+ logger.debug("Response Error from AAINetworkVpnBinding is 404 (Not Found).")
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Response Error from AAINetworkVpnBinding is 404 (Not Found).")
} catch (Exception ex) {
String exceptionMessage = "Bpmn error encountered in DoUpdateNetworkInstance flow. callRESTQueryAAINetworkVpnBinding() - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
@@ -559,7 +562,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable("prefix", Prefix)
- msoLogger.debug(" ***** Inside callRESTQueryAAINetworkPolicy of DoUpdateNetworkInstance ***** " )
+ logger.debug(" ***** Inside callRESTQueryAAINetworkPolicy of DoUpdateNetworkInstance ***** " )
try {
// get variables
@@ -568,7 +571,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor {
List<AAIResourceUri> uris = queryIdAAIResponse.getRelationships().get().getRelatedAAIUris(AAIObjectType.NETWORK_POLICY)
execution.setVariable(Prefix + "networkPolicyCount", uris.size())
- msoLogger.debug(Prefix + "networkPolicyCount - " + uris.size())
+ logger.debug(Prefix + "networkPolicyCount - " + uris.size())
if (uris.size() > 0) {
@@ -587,7 +590,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor {
} // end loop
execution.setVariable(Prefix + "networkCollection", networkPolicies)
- msoLogger.debug(" UPDNETI_networkCollection - " + '\n' + networkPolicies)
+ logger.debug(" UPDNETI_networkCollection - " + '\n' + networkPolicies)
} else {
// reset return code to success
@@ -603,18 +606,18 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor {
String aaiStubResponseAsXml = utils.formatXml(aaiStubResponse)
execution.setVariable(Prefix + "queryNetworkPolicyAAIResponse", aaiStubResponseAsXml)
execution.setVariable(Prefix + "networkCollection", "<policyFqdns/>")
- msoLogger.debug(" No net policies, using this stub as response - " + '\n' + aaiStubResponseAsXml)
+ logger.debug(" No net policies, using this stub as response - " + '\n' + aaiStubResponseAsXml)
}
}
} catch (NotFoundException e) {
String dataErrorMessage = "Response Error from QueryAAINetworkPolicy is 404 (Not Found)."
- msoLogger.debug(dataErrorMessage)
+ logger.debug(dataErrorMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage)
} catch (Exception ex) {
String exceptionMessage = "Bpmn error encountered in DoUpdateNetworkInstance flow. callRESTQueryAAINetworkPolicy() - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
@@ -625,7 +628,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable("prefix", Prefix)
- msoLogger.debug(" ***** Inside callRESTQueryAAINetworkTableRef of DoUpdateNetworkInstance ***** " )
+ logger.debug(" ***** Inside callRESTQueryAAINetworkTableRef of DoUpdateNetworkInstance ***** " )
try {
AAIResultWrapper queryIdAAIResponse = execution.getVariable(Prefix + "requeryIdAAIResponse")
@@ -633,9 +636,9 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor {
List<AAIResourceUri> uris = queryIdAAIResponse.getRelationships().get().getRelatedAAIUris(AAIObjectType.ROUTE_TABLE_REFERENCE)
execution.setVariable(Prefix + "networkTableRefCount", uris.size())
- msoLogger.debug(Prefix + "networkTableRefCount - " + uris.size())
+ logger.debug(Prefix + "networkTableRefCount - " + uris.size())
- msoLogger.debug(" UPDNETI_networkTableRefCount - " + uris.size())
+ logger.debug(" UPDNETI_networkTableRefCount - " + uris.size())
if (uris.size() > 0) {
execution.setVariable(Prefix + "aaiQqueryNetworkTableRefReturnCode", "200")
@@ -653,7 +656,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor {
} // end loop
execution.setVariable(Prefix + "tableRefCollection", networkTableRefs)
- msoLogger.debug(" UPDNETI_tableRefCollection - " + '\n' + networkTableRefs)
+ logger.debug(" UPDNETI_tableRefCollection - " + '\n' + networkTableRefs)
} else {
// reset return code to success
@@ -669,19 +672,19 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor {
String aaiStubResponseAsXml = utils.formatXml(aaiStubResponse)
execution.setVariable(Prefix + "queryNetworkTableRefAAIResponse", aaiStubResponseAsXml)
execution.setVariable(Prefix + "tableRefCollection", "<routeTableFqdns/>")
- msoLogger.debug(" No net table references, using this stub as response - " + '\n' + aaiStubResponseAsXml)
+ logger.debug(" No net table references, using this stub as response - " + '\n' + aaiStubResponseAsXml)
}
}
} catch (NotFoundException e) {
String dataErrorMessage = "Response Error from QueryAAINetworkTableRef is 404 (Not Found)."
- msoLogger.debug(dataErrorMessage)
+ logger.debug(dataErrorMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage)
} catch (Exception ex) {
String exceptionMessage = "Bpmn error encountered in DoUpdateNetworkInstance flow. callRESTQueryAAINetworkTableRef() - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
@@ -690,7 +693,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor {
public void callRESTUpdateContrailAAINetwork(DelegateExecution execution) {
execution.setVariable("prefix", Prefix)
- msoLogger.debug(" ***** Inside callRESTUpdateContrailAAINetwork of DoUpdateNetworkInstance ***** " )
+ logger.debug(" ***** Inside callRESTUpdateContrailAAINetwork of DoUpdateNetworkInstance ***** " )
try {
// get variables
String networkRequest = execution.getVariable(Prefix + "networkRequest")
@@ -754,11 +757,11 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor {
throw e;
} catch (NotFoundException e) {
String dataErrorMessage = " Response Error from UpdateContrailAAINetwork is 404 (Not Found)."
- msoLogger.debug(dataErrorMessage)
+ logger.debug(dataErrorMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage)
} catch (Exception ex) {
String exceptionMessage = "Bpmn error encountered in DoUpdateNetworkInstance flow. callRESTUpdateContrailAAINetwork() - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
@@ -769,7 +772,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable("prefix", Prefix)
- msoLogger.trace("Inside prepareUpdateNetworkRequest of DoUpdateNetworkInstance ")
+ logger.trace("Inside prepareUpdateNetworkRequest of DoUpdateNetworkInstance ")
try {
@@ -791,14 +794,14 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor {
// Format Response
String buildUpdateNetworkRequestAsString = utils.formatXml(updateNetworkRequest)
buildUpdateNetworkRequestAsString = buildUpdateNetworkRequestAsString.replace(":w1aac13n0", "").replace("w1aac13n0:", "")
- msoLogger.debug(buildUpdateNetworkRequestAsString)
+ logger.debug(buildUpdateNetworkRequestAsString)
execution.setVariable(Prefix + "updateNetworkRequest", buildUpdateNetworkRequestAsString)
- msoLogger.debug(" UPDNETI_updateNetworkRequest - " + "\n" + buildUpdateNetworkRequestAsString)
+ logger.debug(" UPDNETI_updateNetworkRequest - " + "\n" + buildUpdateNetworkRequestAsString)
} catch (Exception ex) {
String exceptionMessage = " Bpmn error encountered in DoUpdateNetworkInstance flow. prepareUpdateNetworkRequest() - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
@@ -809,7 +812,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable("prefix", Prefix)
- msoLogger.trace("Inside prepareSDNCRequest of DoUpdateNetworkInstance ")
+ logger.trace("Inside prepareSDNCRequest of DoUpdateNetworkInstance ")
try {
// get variables
@@ -832,14 +835,14 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor {
String sndcTopologyCreateRequest = sdncAdapterUtils.sdncTopologyRequestV2(execution, updateNetworkInput, serviceInstanceId, sdncCallback, "changeassign", "NetworkActivateRequest", cloudRegionId, networkId, queryAAIResponse, null)
String sndcTopologyUpdateRequesAsString = utils.formatXml(sndcTopologyCreateRequest)
- msoLogger.debug(sndcTopologyUpdateRequesAsString)
+ logger.debug(sndcTopologyUpdateRequesAsString)
execution.setVariable(Prefix + "changeAssignSDNCRequest", sndcTopologyUpdateRequesAsString)
- msoLogger.debug(" UPDNETI_changeAssignSDNCRequest - " + "\n" + sndcTopologyUpdateRequesAsString)
+ logger.debug(" UPDNETI_changeAssignSDNCRequest - " + "\n" + sndcTopologyUpdateRequesAsString)
} catch (Exception ex) {
String exceptionMessage = " Bpmn error encountered in DoUpdateNetworkInstance flow. prepareSDNCRequest() - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
@@ -857,7 +860,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable("prefix", Prefix)
- msoLogger.trace("Inside validateUpdateNetworkResponse of DoUpdateNetworkInstance ")
+ logger.trace("Inside validateUpdateNetworkResponse of DoUpdateNetworkInstance ")
try {
String returnCode = execution.getVariable(Prefix + "networkReturnCode")
@@ -866,14 +869,14 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor {
networkResponse="" // reset
}
- msoLogger.debug(" Network Adapter update responseCode: " + returnCode)
+ logger.debug(" Network Adapter update responseCode: " + returnCode)
String errorMessage = ""
if (returnCode == "200") {
execution.setVariable(Prefix + "isNetworkRollbackNeeded", true)
- msoLogger.debug(networkResponse)
+ logger.debug(networkResponse)
execution.setVariable(Prefix + "updateNetworkResponse", networkResponse)
- msoLogger.debug(" Network Adapter update Success Response - " + "\n" + networkResponse)
+ logger.debug(" Network Adapter update Success Response - " + "\n" + networkResponse)
// prepare rollback data
String rollbackData = utils.getNodeXml(networkResponse, "rollback", false).replace("tag0:","").replace(":tag0","")
@@ -884,7 +887,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor {
</rollbackNetworkRequest>"""
String rollbackNetworkXml = utils.formatXml(rollbackNetwork)
execution.setVariable(Prefix + "rollbackNetworkRequest", rollbackNetworkXml)
- msoLogger.debug(" Network Adapter rollback data - " + "\n" + rollbackNetworkXml)
+ logger.debug(" Network Adapter rollback data - " + "\n" + rollbackNetworkXml)
} else { // network error
if (returnCode.toInteger() > 399 && returnCode.toInteger() < 600) { //4xx, 5xx
@@ -918,7 +921,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor {
} catch (Exception ex) {
String exceptionMessage = " Bpmn error encountered in DoUpdateNetworkInstance flow. validateUpdateNetworkResponse() - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
@@ -930,7 +933,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable("prefix", Prefix)
- msoLogger.trace("Inside validateSDNCResponse of DoUpdateNetworkInstance ")
+ logger.trace("Inside validateSDNCResponse of DoUpdateNetworkInstance ")
String response = execution.getVariable(Prefix + "changeAssignSDNCResponse")
WorkflowException workflowException = null
@@ -938,7 +941,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor {
workflowException = execution.getVariable(Prefix + "WorkflowException")
//execution.setVariable("WorkflowException", workflowException)
} catch (Exception ex) {
- msoLogger.debug(" Sdnc 'WorkflowException' object is empty or null. ")
+ logger.debug(" Sdnc 'WorkflowException' object is empty or null. ")
}
boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator")
@@ -952,10 +955,10 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor {
if (execution.getVariable(Prefix + "sdncResponseSuccess") == true) { // from sdnc util, prefix+'sdncResponseSuccess'
execution.setVariable(Prefix + "isSdncRollbackNeeded", true)
- msoLogger.debug("Successfully Validated SDNC Response")
+ logger.debug("Successfully Validated SDNC Response")
} else {
- msoLogger.debug("Did NOT Successfully Validated SDNC Response")
+ logger.debug("Did NOT Successfully Validated SDNC Response")
throw new BpmnError("MSOWorkflowException")
}
@@ -966,10 +969,10 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable("prefix", Prefix)
- msoLogger.trace("Inside postProcessResponse of DoUpdateNetworkInstance ")
+ logger.trace("Inside postProcessResponse of DoUpdateNetworkInstance ")
try {
- msoLogger.debug(" ***** Is Exception Encountered (isException)? : " + execution.getVariable(Prefix + "isException"))
+ logger.debug(" ***** Is Exception Encountered (isException)? : " + execution.getVariable(Prefix + "isException"))
if (execution.getVariable(Prefix + "isException") == false) {
// set rollback data
execution.setVariable("orchestrationStatus", "")
@@ -978,13 +981,13 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor {
prepareSuccessRollbackData(execution) // populate rollbackData
execution.setVariable("WorkflowException", null)
execution.setVariable(Prefix + "Success", true)
- msoLogger.debug(" ***** postProcessResponse(), GOOD !!!")
+ logger.debug(" ***** postProcessResponse(), GOOD !!!")
} else {
execution.setVariable(Prefix + "Success", false)
execution.setVariable("rollbackData", null)
String exceptionMessage = " Exception encountered in MSO Bpmn. "
if (execution.getVariable("workflowException") != null) { // Output of Rollback flow.
- msoLogger.debug(" ***** workflowException: " + execution.getVariable("workflowException"))
+ logger.debug(" ***** workflowException: " + execution.getVariable("workflowException"))
WorkflowException wfex = execution.getVariable("workflowException")
exceptionMessage = wfex.getErrorMessage()
} else {
@@ -994,19 +997,19 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor {
}
}
// going to the Main flow: a-la-carte or macro
- msoLogger.debug(" ***** postProcessResponse(), BAD !!!")
+ logger.debug(" ***** postProcessResponse(), BAD !!!")
exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage)
throw new BpmnError("MSOWorkflowException")
}
} catch(BpmnError b){
- msoLogger.debug("Rethrowing MSOWorkflowException")
+ logger.debug("Rethrowing MSOWorkflowException")
throw b
} catch (Exception ex) {
String exceptionMessage = " Bpmn error encountered in DoUpdateNetworkInstance flow. postProcessResponse() - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
@@ -1018,7 +1021,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable("prefix", Prefix)
- msoLogger.trace("Inside prepareSDNCRollbackRequest of DoUpdateNetworkInstance ")
+ logger.trace("Inside prepareSDNCRollbackRequest of DoUpdateNetworkInstance ")
try {
// for some reason the WorkflowException object is null after the sdnc rollback call task, need to save WorkflowException.
@@ -1036,11 +1039,11 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor {
String sndcTopologyRollbackRequest = sdncAdapterUtils.sdncTopologyRequestV2(execution, updateNetworkInput, serviceInstanceId, sdncCallback, "rollback", "NetworkActivateRequest", cloudRegionId, networkId, null, null)
String sndcTopologyRollbackRequestAsString = utils.formatXml(sndcTopologyRollbackRequest)
execution.setVariable(Prefix + "rollbackSDNCRequest", sndcTopologyRollbackRequestAsString)
- msoLogger.debug(" Preparing request for SDNC Topology assign's rollback/compensation . . . - " + "\n" + sndcTopologyRollbackRequestAsString)
+ logger.debug(" Preparing request for SDNC Topology assign's rollback/compensation . . . - " + "\n" + sndcTopologyRollbackRequestAsString)
} catch (Exception ex) {
String exceptionMessage = " Bpmn error encountered in DoUpdateNetworkInstance flow. prepareSDNCRollbackRequest() - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage)
}
@@ -1051,7 +1054,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable("prefix",Prefix)
- msoLogger.trace("Inside prepareRollbackData() of DoUpdateNetworkInstance ")
+ logger.trace("Inside prepareRollbackData() of DoUpdateNetworkInstance ")
try {
@@ -1069,14 +1072,14 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor {
}
}
execution.setVariable("rollbackData", rollbackData)
- msoLogger.debug("** rollbackData : " + rollbackData)
+ logger.debug("** rollbackData : " + rollbackData)
execution.setVariable("WorkflowException", execution.getVariable(Prefix + "WorkflowException"))
- msoLogger.debug("** WorkflowException : " + execution.getVariable("WorkflowException"))
+ logger.debug("** WorkflowException : " + execution.getVariable("WorkflowException"))
} catch (Exception ex) {
String exceptionMessage = " Bpmn error encountered in DoUpdateNetworkInstance flow. prepareRollbackData() - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage)
}
@@ -1087,7 +1090,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable("prefix",Prefix)
- msoLogger.trace("Inside prepareSuccessRollbackData() of DoUpdateNetworkInstance ")
+ logger.trace("Inside prepareSuccessRollbackData() of DoUpdateNetworkInstance ")
try {
@@ -1112,13 +1115,13 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor {
}
execution.setVariable("rollbackData", rollbackData)
- msoLogger.debug("** 'rollbackData' for Full Rollback : " + rollbackData)
+ logger.debug("** 'rollbackData' for Full Rollback : " + rollbackData)
execution.setVariable("WorkflowException", null)
} catch (Exception ex) {
String exceptionMessage = " Bpmn error encountered in DoUpdateNetworkInstance flow. prepareSuccessRollbackData() - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage)
}
@@ -1129,7 +1132,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable("prefix",Prefix)
- msoLogger.trace("Inside setExceptionFlag() of DoUpdateNetworkInstance ")
+ logger.trace("Inside setExceptionFlag() of DoUpdateNetworkInstance ")
try {
@@ -1140,11 +1143,11 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor {
} else {
execution.setVariable(Prefix + "WorkflowException", execution.getVariable("WorkflowException"))
}
- msoLogger.debug(Prefix + "WorkflowException - " +execution.getVariable(Prefix + "WorkflowException"))
+ logger.debug(Prefix + "WorkflowException - " +execution.getVariable(Prefix + "WorkflowException"))
} catch(Exception ex){
String exceptionMessage = "Bpmn error encountered in DoUpdateNetworkInstance flow. setExceptionFlag(): " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage)
}
@@ -1159,18 +1162,18 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable("prefix",Prefix)
try{
- msoLogger.debug("Caught a Java Exception")
- msoLogger.debug("Started processJavaException Method")
- msoLogger.debug("Variables List: " + execution.getVariables())
+ logger.debug("Caught a Java Exception")
+ logger.debug("Started processJavaException Method")
+ logger.debug("Variables List: " + execution.getVariables())
execution.setVariable("UnexpectedError", "Caught a Java Lang Exception - " + Prefix) // Adding this line temporarily until this flows error handling gets updated
exceptionUtil.buildWorkflowException(execution, 500, "Caught a Java Lang Exception")
}catch(Exception e){
- msoLogger.debug("Caught Exception during processJavaException Method: " + e)
+ logger.debug("Caught Exception during processJavaException Method: " + e)
execution.setVariable("UnexpectedError", "Exception in processJavaException method") // Adding this line temporarily until this flows error handling gets updated
exceptionUtil.buildWorkflowException(execution, 500, "Exception in processJavaException method")
}
- msoLogger.debug("Completed processJavaException Method")
+ logger.debug("Completed processJavaException Method")
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceRollback.groovy
index eaba51ac6f..1b98451fbe 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceRollback.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceRollback.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -42,15 +44,15 @@ import org.apache.commons.lang3.*
import org.apache.commons.codec.binary.Base64;
import org.springframework.web.util.UriUtils
-import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
/**
* This groovy class supports the <class>DoCreateNetworkInstance.bpmn</class> process.
*
*/
public class DoUpdateNetworkInstanceRollback extends AbstractServiceTaskProcessor {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoUpdateNetworkInstanceRollback.class);
+ private static final Logger logger = LoggerFactory.getLogger( DoUpdateNetworkInstanceRollback.class);
String Prefix="UPDNETIR_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
@@ -96,7 +98,7 @@ public class DoUpdateNetworkInstanceRollback extends AbstractServiceTaskProcesso
execution.setVariable("prefix",Prefix)
- msoLogger.trace("Inside preProcessRequest() of " + className + ".groovy ")
+ logger.trace("Inside preProcessRequest() of " + className + ".groovy ")
try {
// initialize flow variables
@@ -121,10 +123,10 @@ public class DoUpdateNetworkInstanceRollback extends AbstractServiceTaskProcesso
execution.setVariable(Prefix + "rollbackNetworkRequest", rollbackNetworkRequest)
execution.setVariable(Prefix + "rollbackSDNCRequest", rollbackSDNCRequest)
- msoLogger.debug("'rollbackData': " + '\n' + execution.getVariable("rollbackData"))
+ logger.debug("'rollbackData': " + '\n' + execution.getVariable("rollbackData"))
String sdncVersion = execution.getVariable("sdncVersion")
- msoLogger.debug("sdncVersion? : " + sdncVersion)
+ logger.debug("sdncVersion? : " + sdncVersion)
// PO Authorization Info / headers Authorization=
String basicAuthValuePO = UrnPropertiesReader.getVariable("mso.adapters.po.auth",execution)
@@ -137,7 +139,7 @@ public class DoUpdateNetworkInstanceRollback extends AbstractServiceTaskProcesso
} catch (IOException ex) {
String exceptionMessage = "Exception Encountered in DoCreateNetworkInstance, PreProcessRequest() - "
String dataErrorMessage = exceptionMessage + " Unable to encode PO/SDNC user/password string - " + ex.getMessage()
- msoLogger.debug(dataErrorMessage )
+ logger.debug(dataErrorMessage )
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage)
}
@@ -146,7 +148,7 @@ public class DoUpdateNetworkInstanceRollback extends AbstractServiceTaskProcesso
} else {
execution.setVariable(Prefix + "WorkflowException", execution.getVariable("WorkflowException"))
}
- msoLogger.debug("*** WorkflowException : " + execution.getVariable(Prefix + "WorkflowException"))
+ logger.debug("*** WorkflowException : " + execution.getVariable(Prefix + "WorkflowException"))
if(execution.getVariable(Prefix + "WorkflowException") != null) {
// called by: DoCreateNetworkInstance, partial rollback
execution.setVariable(Prefix + "fullRollback", false)
@@ -156,7 +158,7 @@ public class DoUpdateNetworkInstanceRollback extends AbstractServiceTaskProcesso
execution.setVariable(Prefix + "fullRollback", true)
}
- msoLogger.debug("*** fullRollback? : " + execution.getVariable(Prefix + "fullRollback"))
+ logger.debug("*** fullRollback? : " + execution.getVariable(Prefix + "fullRollback"))
} catch (BpmnError e) {
@@ -166,7 +168,7 @@ public class DoUpdateNetworkInstanceRollback extends AbstractServiceTaskProcesso
sendSyncError(execution)
// caught exception
String exceptionMessage = "Exception Encountered in PreProcessRequest() of " + className + ".groovy ***** : " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
@@ -177,7 +179,7 @@ public class DoUpdateNetworkInstanceRollback extends AbstractServiceTaskProcesso
execution.setVariable("prefix",Prefix)
- msoLogger.trace("Inside validateRollbackResponses() of DoUpdateNetworkInstanceRollback ")
+ logger.trace("Inside validateRollbackResponses() of DoUpdateNetworkInstanceRollback ")
try {
// validate PO network rollback response
@@ -186,8 +188,8 @@ public class DoUpdateNetworkInstanceRollback extends AbstractServiceTaskProcesso
if (execution.getVariable(Prefix + "rollbackNetworkRequest") != null) {
rollbackNetworkReturnCode = execution.getVariable(Prefix + "rollbackNetworkReturnCode")
String rollbackNetworkResponse = execution.getVariable(Prefix + "rollbackNetworkResponse")
- msoLogger.debug(" NetworkRollback Code - " + rollbackNetworkReturnCode)
- msoLogger.debug(" NetworkRollback Response - " + rollbackNetworkResponse)
+ logger.debug(" NetworkRollback Code - " + rollbackNetworkReturnCode)
+ logger.debug(" NetworkRollback Response - " + rollbackNetworkResponse)
if (rollbackNetworkReturnCode != "200") {
rollbackNetworkErrorMessages = " + PO Network rollback failed. "
} else {
@@ -218,13 +220,13 @@ public class DoUpdateNetworkInstanceRollback extends AbstractServiceTaskProcesso
} else {
rollbackSdncErrorMessages = " + SDNC changeassign rollback failed. "
}
- msoLogger.debug(" SDNC changeassign rollback Code - " + rollbackSDNCReturnCode)
- msoLogger.debug(" SDNC changeassign rollback Response - " + rollbackSDNCResponse)
+ logger.debug(" SDNC changeassign rollback Code - " + rollbackSDNCReturnCode)
+ logger.debug(" SDNC changeassign rollback Response - " + rollbackSDNCResponse)
}
String statusMessage = ""
int errorCode = 7000
- msoLogger.debug("*** fullRollback? : " + execution.getVariable(Prefix + "fullRollback"))
+ logger.debug("*** fullRollback? : " + execution.getVariable(Prefix + "fullRollback"))
if (execution.getVariable(Prefix + "fullRollback") == false) {
// original WorkflowException,
WorkflowException wfe = execution.getVariable(Prefix + "WorkflowException")
@@ -247,7 +249,7 @@ public class DoUpdateNetworkInstanceRollback extends AbstractServiceTaskProcesso
}
statusMessage = statusMessage + rollbackNetworkErrorMessages + rollbackSdncErrorMessages
- msoLogger.debug("Final DoUpdateNetworkInstanceRollback status message: " + statusMessage)
+ logger.debug("Final DoUpdateNetworkInstanceRollback status message: " + statusMessage)
String processKey = getProcessKey(execution);
WorkflowException exception = new WorkflowException(processKey, errorCode, statusMessage);
execution.setVariable("workflowException", exception);
@@ -260,7 +262,7 @@ public class DoUpdateNetworkInstanceRollback extends AbstractServiceTaskProcesso
execution.setVariable("rollbackError", false)
} else {
String exceptionMessage = "Network Update Rollback was not Successful. "
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
execution.setVariable("rollbackSuccessful", false)
execution.setVariable("rollbackError", true)
exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage)
@@ -274,7 +276,7 @@ public class DoUpdateNetworkInstanceRollback extends AbstractServiceTaskProcesso
execution.setVariable("WorkflowException", null)
String errorMessage = "See Previous Camunda flows for cause of Error: Undetermined Exception."
String exceptionMessage = " Bpmn error encountered in DoUpdateNetworkInstanceRollback flow. validateRollbackResponses() - " + errorMessage + ": " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage)
execution.setVariable("WorkflowException", execution.getVariable("WorkflowException"))
@@ -293,18 +295,18 @@ public class DoUpdateNetworkInstanceRollback extends AbstractServiceTaskProcesso
execution.setVariable("prefix",Prefix)
try{
- msoLogger.debug("Caught a Java Exception in " + Prefix)
- msoLogger.debug("Started processJavaException Method")
- msoLogger.debug("Variables List: " + execution.getVariables())
+ logger.debug("Caught a Java Exception in " + Prefix)
+ logger.debug("Started processJavaException Method")
+ logger.debug("Variables List: " + execution.getVariables())
execution.setVariable("UnexpectedError", "Caught a Java Lang Exception - " + Prefix) // Adding this line temporarily until this flows error handling gets updated
exceptionUtil.buildWorkflowException(execution, 500, "Caught a Java Lang Exception")
}catch(Exception e){
- msoLogger.debug("Caught Exception during processJavaException Method: " + e)
+ logger.debug("Caught Exception during processJavaException Method: " + e)
execution.setVariable("UnexpectedError", "Exception in processJavaException method - " + Prefix) // Adding this line temporarily until this flows error handling gets updated
exceptionUtil.buildWorkflowException(execution, 500, "Exception in processJavaException method" + Prefix)
}
- msoLogger.trace("Completed processJavaException Method in " + Prefix)
+ logger.trace("Completed processJavaException Method in " + Prefix)
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy
index 06c7002dff..641878be8e 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -44,9 +46,11 @@ import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.constants.Defaults
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
public class DoUpdateVfModule extends VfModuleBase {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoUpdateVfModule.class);
+ private static final Logger logger = LoggerFactory.getLogger( DoUpdateVfModule.class);
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtil = new JsonUtils()
@@ -106,13 +110,13 @@ public class DoUpdateVfModule extends VfModuleBase {
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
try {
initProcessVariables(execution)
def xml = getVariable(execution, 'DoUpdateVfModuleRequest')
- msoLogger.debug("DoUpdateVfModule request: " + xml)
- msoLogger.debug('Received request xml:\n' + xml)
+ logger.debug("DoUpdateVfModule request: " + xml)
+ logger.debug('Received request xml:\n' + xml)
if (xml == null || xml.isEmpty()) {
// Building Block-type request
@@ -121,9 +125,9 @@ public class DoUpdateVfModule extends VfModuleBase {
String vfModuleModelInfo = execution.getVariable("vfModuleModelInfo")
def serviceModelInfo = execution.getVariable("serviceModelInfo")
- msoLogger.debug("serviceModelInfo: " + serviceModelInfo)
+ logger.debug("serviceModelInfo: " + serviceModelInfo)
String modelInvariantUuid = jsonUtil.getJsonValue(serviceModelInfo, "modelInvariantUuid")
- msoLogger.debug("modelInvariantUuid: " + modelInvariantUuid)
+ logger.debug("modelInvariantUuid: " + modelInvariantUuid)
def vnfModelInfo = execution.getVariable("vnfModelInfo")
//tenantId
@@ -138,32 +142,32 @@ public class DoUpdateVfModule extends VfModuleBase {
def cloudSiteId = execution.getVariable("lcpCloudRegionId")
execution.setVariable("DOUPVfMod_aicCloudRegion", cloudSiteId)
- msoLogger.debug("cloudSiteId: " + cloudSiteId)
+ logger.debug("cloudSiteId: " + cloudSiteId)
//vnfType
def vnfType = execution.getVariable("vnfType")
execution.setVariable("DOUPVfMod_vnfType", vnfType)
- msoLogger.debug("vnfType: " + vnfType)
+ logger.debug("vnfType: " + vnfType)
//vnfName
def vnfName = execution.getVariable("vnfName")
execution.setVariable("DOUPVfMod_vnfName", vnfName)
- msoLogger.debug("vnfName: " + vnfName)
+ logger.debug("vnfName: " + vnfName)
//vnfId
def vnfId = execution.getVariable("vnfId")
execution.setVariable("DOUPVfMod_vnfId", vnfId)
- msoLogger.debug("vnfId: " + vnfId)
+ logger.debug("vnfId: " + vnfId)
//vfModuleName
def vfModuleName = execution.getVariable("vfModuleName")
execution.setVariable("DOUPVfMod_vfModuleName", vfModuleName)
- msoLogger.debug("vfModuleName: " + vfModuleName)
+ logger.debug("vfModuleName: " + vfModuleName)
//vfModuleModelName
def vfModuleModelName = jsonUtil.getJsonValue(vfModuleModelInfo, "modelName")
execution.setVariable("DOUPVfMod_vfModuleModelName", vfModuleModelName)
- msoLogger.debug("vfModuleModelName: " + vfModuleModelName)
+ logger.debug("vfModuleModelName: " + vfModuleModelName)
//modelCustomizationUuid
def modelCustomizationUuid = jsonUtil.getJsonValue(vfModuleModelInfo, "modelCustomizationUuid")
if (modelCustomizationUuid == null) {
@@ -171,30 +175,30 @@ public class DoUpdateVfModule extends VfModuleBase {
}
execution.setVariable("DOUPVfMod_modelCustomizationUuid", modelCustomizationUuid)
- msoLogger.debug("modelCustomizationUuid: " + modelCustomizationUuid)
+ logger.debug("modelCustomizationUuid: " + modelCustomizationUuid)
//vfModuleId
def vfModuleId = execution.getVariable("vfModuleId")
execution.setVariable("DOUPVfMod_vfModuleId", vfModuleId)
- msoLogger.debug("vfModuleId: " + vfModuleId)
+ logger.debug("vfModuleId: " + vfModuleId)
def requestId = execution.getVariable("msoRequestId")
execution.setVariable("DOUPVfMod_requestId", requestId)
- msoLogger.debug("requestId: " + requestId)
+ logger.debug("requestId: " + requestId)
// Set mso-request-id to request-id for VNF Adapter interface
execution.setVariable("mso-request-id", requestId)
//serviceId
def serviceId = execution.getVariable("serviceId")
execution.setVariable("DOUPVfMod_serviceId", serviceId)
- msoLogger.debug("serviceId: " + serviceId)
+ logger.debug("serviceId: " + serviceId)
//serviceInstanceId
def serviceInstanceId = execution.getVariable("serviceInstanceId")
execution.setVariable("DOUPVfMod_serviceInstanceId", serviceInstanceId)
- msoLogger.debug("serviceInstanceId: " + serviceInstanceId)
+ logger.debug("serviceInstanceId: " + serviceInstanceId)
//source - HARDCODED
def source = "VID"
execution.setVariable("DOUPVfMod_source", source)
- msoLogger.debug("source: " + source)
+ logger.debug("source: " + source)
//backoutOnFailure
def disableRollback = execution.getVariable("disableRollback")
def backoutOnFailure = true
@@ -202,15 +206,15 @@ public class DoUpdateVfModule extends VfModuleBase {
backoutOnFailure = false
}
execution.setVariable("DOUPVfMod_backoutOnFailure", backoutOnFailure)
- msoLogger.debug("backoutOnFailure: " + backoutOnFailure)
+ logger.debug("backoutOnFailure: " + backoutOnFailure)
//isBaseVfModule
def isBaseVfModule = execution.getVariable("isBaseVfModule")
execution.setVariable("DOUPVfMod_isBaseVfModule", isBaseVfModule)
- msoLogger.debug("isBaseVfModule: " + isBaseVfModule)
+ logger.debug("isBaseVfModule: " + isBaseVfModule)
//asdcServiceModelVersion
def asdcServiceModelVersion = execution.getVariable("asdcServiceModelVersion")
execution.setVariable("DOUPVfMod_asdcServiceModelVersion", asdcServiceModelVersion)
- msoLogger.debug("asdcServiceModelVersion: " + asdcServiceModelVersion)
+ logger.debug("asdcServiceModelVersion: " + asdcServiceModelVersion)
//personaModelId
execution.setVariable("DOUPVfMod_personaModelId", jsonUtil.getJsonValue(vfModuleModelInfo, "modelInvariantUuid"))
//personaModelVersion
@@ -219,9 +223,9 @@ public class DoUpdateVfModule extends VfModuleBase {
String uuid = execution.getVariable("DOUPVfMod_uuid")
if(uuid == null){
uuid = UUID.randomUUID()
- msoLogger.debug("Generated messageId (UUID) is: " + uuid)
+ logger.debug("Generated messageId (UUID) is: " + uuid)
}else{
- msoLogger.debug("Found messageId (UUID) is: " + uuid)
+ logger.debug("Found messageId (UUID) is: " + uuid)
}
//isVidRequest
String isVidRequest = execution.getVariable("isVidRequest")
@@ -232,15 +236,15 @@ public class DoUpdateVfModule extends VfModuleBase {
//usePreload
def usePreload = execution.getVariable("usePreload")
execution.setVariable("DOUPVfMod_usePreload", usePreload)
- msoLogger.debug("usePreload: " + usePreload)
+ logger.debug("usePreload: " + usePreload)
//globalSubscriberId
String globalSubscriberId = execution.getVariable("globalSubscriberId")
execution.setVariable("DOUPVfMod_globalSubscriberId", globalSubscriberId)
- msoLogger.debug("globalSubsrciberId: " + globalSubscriberId)
+ logger.debug("globalSubsrciberId: " + globalSubscriberId)
//vnfQueryPath
String vnfQueryPath = execution.getVariable("vnfQueryPath")
execution.setVariable("DOUPVfMod_vnfQueryPath", vnfQueryPath)
- msoLogger.debug("vnfQueryPath: " + vnfQueryPath)
+ logger.debug("vnfQueryPath: " + vnfQueryPath)
Map<String,String> vfModuleInputParams = execution.getVariable("vfModuleInputParams")
if (vfModuleInputParams != null) {
@@ -258,7 +262,7 @@ public class DoUpdateVfModule extends VfModuleBase {
throw e
} catch (Exception ex){
String msg = "Exception in preProcessRequest " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
@@ -271,7 +275,7 @@ public class DoUpdateVfModule extends VfModuleBase {
workloadContext = aaiJson.getOrDefault("workload-context","")
}catch (Exception ex) {
- msoLogger.debug("Error retreiving parent service instance information")
+ logger.debug("Error retreiving parent service instance information")
}
execution.setVariable("DCVFM_environmentContext",environmentContext)
@@ -307,7 +311,7 @@ public class DoUpdateVfModule extends VfModuleBase {
isBaseVfModule = utils.getNodeText(xml, "is-base-vf-module")
execution.setVariable("DOUPVfMod_isBaseVfModule", isBaseVfModule)
}
- msoLogger.debug("isBaseVfModule: " + isBaseVfModule)
+ logger.debug("isBaseVfModule: " + isBaseVfModule)
NetworkUtils networkUtils = new NetworkUtils()
def backoutOnFailure = networkUtils.isRollbackEnabled(execution, xml)
@@ -322,15 +326,18 @@ public class DoUpdateVfModule extends VfModuleBase {
def sdncCallbackUrl = (String) UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution)
if (sdncCallbackUrl == null || sdncCallbackUrl.trim().isEmpty()) {
def msg = 'Required variable \'mso.workflow.sdncadapter.callback\' is missing'
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preProcessRequest(): ' + e.getMessage())
}
}
@@ -346,7 +353,7 @@ public class DoUpdateVfModule extends VfModuleBase {
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
try {
def vnfId = execution.getVariable('DOUPVfMod_vnfId')
@@ -362,14 +369,16 @@ public class DoUpdateVfModule extends VfModuleBase {
"""
prepareUpdateAAIVfModuleRequest = utils.formatXml(prepareUpdateAAIVfModuleRequest)
execution.setVariable('DOUPVfMod_prepareUpdateAAIVfModuleRequest', prepareUpdateAAIVfModuleRequest)
- msoLogger.debug("DoUpdateAAIVfModule request: " + prepareUpdateAAIVfModuleRequest)
- msoLogger.debug('Request for PrepareUpdateAAIVfModule:\n' + prepareUpdateAAIVfModuleRequest)
+ logger.debug("DoUpdateAAIVfModule request: " + prepareUpdateAAIVfModuleRequest)
+ logger.debug('Request for PrepareUpdateAAIVfModule:\n' + prepareUpdateAAIVfModuleRequest)
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preparePrepareUpdateAAIVfModule(): ' + e.getMessage())
}
}
@@ -387,7 +396,7 @@ public class DoUpdateVfModule extends VfModuleBase {
def prefix = execution.getVariable("prefix")
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
try {
String cloudRegion = execution.getVariable(prefix + "aicCloudRegion")
@@ -411,22 +420,26 @@ public class DoUpdateVfModule extends VfModuleBase {
execution.setVariable(prefix + "isCloudRegionGood", true)
} else {
String errorMessage = "AAI Query Cloud Region Unsuccessful. AAI Response Code: " + execution.getVariable(prefix + "queryCloudRegionReturnCode")
- msoLogger.debug(errorMessage)
+ logger.debug(errorMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, errorMessage)
execution.setVariable(prefix + "isCloudRegionGood", false)
}
- msoLogger.debug(" is Cloud Region Good: " + execution.getVariable(prefix + "isCloudRegionGood"))
+ logger.debug(" is Cloud Region Good: " + execution.getVariable(prefix + "isCloudRegionGood"))
} catch(BpmnError b){
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Rethrowing MSOWorkflowException", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + b);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Rethrowing MSOWorkflowException", "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + b);
throw b
}catch (Exception e) {
// try error
String errorMessage = "Bpmn error encountered in CreateVfModule flow. Unexpected Response from AAI - " + e.getMessage()
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " AAI Query Cloud Region Failed. Exception - " + "\n" + errorMessage, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "AAI Query Cloud Region Failed. Exception - " + "\n" + errorMessage, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Exception occured during prepConfirmVolumeGroupTenant(): " + e.getMessage())
}
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
}
@@ -441,7 +454,7 @@ public class DoUpdateVfModule extends VfModuleBase {
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
try {
def requestId = execution.getVariable('DOUPVfMod_requestId')
@@ -521,14 +534,16 @@ public class DoUpdateVfModule extends VfModuleBase {
"""
sdncTopologyRequest = utils.formatXml(sdncTopologyRequest)
execution.setVariable('DOUPVfMod_sdncChangeAssignRequest', sdncTopologyRequest)
- msoLogger.debug("sdncChangeAssignRequest : " + sdncTopologyRequest)
- msoLogger.debug('Request for SDNCAdapter topology/changeassign:\n' + sdncTopologyRequest)
+ logger.debug("sdncChangeAssignRequest : " + sdncTopologyRequest)
+ logger.debug('Request for SDNCAdapter topology/changeassign:\n' + sdncTopologyRequest)
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepSDNCTopologyChg(): ' + e.getMessage())
}
}
@@ -544,7 +559,7 @@ public class DoUpdateVfModule extends VfModuleBase {
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
try {
String uuid = execution.getVariable('testReqId') // for junits
@@ -583,14 +598,16 @@ public class DoUpdateVfModule extends VfModuleBase {
"""
sdncTopologyRequest = utils.formatXml(sdncTopologyRequest)
execution.setVariable('DOUPVfMod_sdncTopologyRequest', sdncTopologyRequest)
- msoLogger.debug("sdncTopologyRequest : " + sdncTopologyRequest)
- msoLogger.debug('Request for SDNCAdapter query:\n' + sdncTopologyRequest)
+ logger.debug("sdncTopologyRequest : " + sdncTopologyRequest)
+ logger.debug('Request for SDNCAdapter query:\n' + sdncTopologyRequest)
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepSDNCTopologyQuery(): ' + e.getMessage())
}
}
@@ -605,7 +622,7 @@ public class DoUpdateVfModule extends VfModuleBase {
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
try {
def requestId = execution.getVariable('DOUPVfMod_requestId')
@@ -641,8 +658,8 @@ public class DoUpdateVfModule extends VfModuleBase {
String environmentContext = execution.getVariable("DOUPVEnvironment_context")
String workloadContext = execution.getVariable("DOUPVWorkload_context")
- msoLogger.debug("workloadContext: " + workloadContext)
- msoLogger.debug("environmentContext: " + environmentContext)
+ logger.debug("workloadContext: " + workloadContext)
+ logger.debug("environmentContext: " + environmentContext)
Map<String, String> vnfParamsMap = execution.getVariable("DOUPVfMod_vnfParamsMap")
@@ -683,14 +700,16 @@ public class DoUpdateVfModule extends VfModuleBase {
"""
vnfAdapterRestRequest = utils.formatXml(vnfAdapterRestRequest)
execution.setVariable('DOUPVfMod_vnfAdapterRestRequest', vnfAdapterRestRequest)
- msoLogger.debug("vnfAdapterRestRequest : " + vnfAdapterRestRequest)
- msoLogger.debug('Request for VNFAdapter Rest:\n' + vnfAdapterRestRequest)
+ logger.debug("vnfAdapterRestRequest : " + vnfAdapterRestRequest)
+ logger.debug('Request for VNFAdapter Rest:\n' + vnfAdapterRestRequest)
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepVnfAdapterRest(): ' + e.getMessage())
}
}
@@ -704,7 +723,7 @@ public class DoUpdateVfModule extends VfModuleBase {
def method = getClass().getSimpleName() + '.prepUpdateAAIGenericVnf(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
try {
def vnfId = execution.getVariable('DOUPVfMod_vnfId')
@@ -713,7 +732,7 @@ public class DoUpdateVfModule extends VfModuleBase {
def personaModelId = utils.getNodeText(vnfInputs, 'vnf-persona-model-id')
def personaModelVersion = utils.getNodeText(vnfInputs, 'vnf-persona-model-version')
if ((personaModelId == null) || (personaModelVersion == null)) {
- msoLogger.debug("Skipping update for Generic VNF ' + vnfId + ' because either \'vnf-persona-model-id\' or \'vnf-persona-model-version\' is absent")
+ logger.debug("Skipping update for Generic VNF ' + vnfId + ' because either \'vnf-persona-model-id\' or \'vnf-persona-model-version\' is absent")
execution.setVariable('DOUPVfMod_skipUpdateGenericVnf', true)
} else {
def personaModelIdElement = '<model-invariant-id>' + personaModelId + '</model-invariant-id>'
@@ -728,15 +747,17 @@ public class DoUpdateVfModule extends VfModuleBase {
"""
updateAAIGenericVnfRequest = utils.formatXml(updateAAIGenericVnfRequest)
execution.setVariable('DOUPVfMod_updateAAIGenericVnfRequest', updateAAIGenericVnfRequest)
- msoLogger.debug("updateAAIGenericVnfRequest : " + updateAAIGenericVnfRequest)
- msoLogger.debug('Request for UpdateAAIGenericVnf:\n' + updateAAIGenericVnfRequest)
+ logger.debug("updateAAIGenericVnfRequest : " + updateAAIGenericVnfRequest)
+ logger.debug('Request for UpdateAAIGenericVnf:\n' + updateAAIGenericVnfRequest)
}
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepUpdateAAIGenericVnf(): ' + e.getMessage())
}
}
@@ -751,7 +772,7 @@ public class DoUpdateVfModule extends VfModuleBase {
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
try {
def vnfId = execution.getVariable('DOUPVfMod_vnfId')
@@ -798,17 +819,19 @@ public class DoUpdateVfModule extends VfModuleBase {
</UpdateAAIVfModuleRequest>
"""
- msoLogger.debug('Unformatted updateAAIVfModuleRequest: ' + updateAAIVfModuleRequest)
+ logger.debug('Unformatted updateAAIVfModuleRequest: ' + updateAAIVfModuleRequest)
updateAAIVfModuleRequest = utils.formatXml(updateAAIVfModuleRequest)
execution.setVariable('DOUPVfMod_updateAAIVfModuleRequest', updateAAIVfModuleRequest)
- msoLogger.debug("updateAAIVfModuleRequest : " + updateAAIVfModuleRequest)
- msoLogger.debug('Request for UpdateAAIVfModule:\n' + updateAAIVfModuleRequest)
+ logger.debug("updateAAIVfModuleRequest : " + updateAAIVfModuleRequest)
+ logger.debug('Request for UpdateAAIVfModule:\n' + updateAAIVfModuleRequest)
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepUpdateAAIVfModule(): ' + e.getMessage())
}
}
@@ -824,7 +847,7 @@ public class DoUpdateVfModule extends VfModuleBase {
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
try {
String uuid = execution.getVariable('testReqId') // for junits
@@ -901,15 +924,17 @@ public class DoUpdateVfModule extends VfModuleBase {
"""
sdncTopologyRequest = utils.formatXml(sdncTopologyRequest)
execution.setVariable('DOUPVfMod_sdncActivateRequest', sdncTopologyRequest)
- msoLogger.debug("sdncActivateRequest : " + sdncTopologyRequest)
- msoLogger.debug('Request for SDNCAdapter topology/activate:\n' + sdncTopologyRequest)
+ logger.debug("sdncActivateRequest : " + sdncTopologyRequest)
+ logger.debug('Request for SDNCAdapter topology/activate:\n' + sdncTopologyRequest)
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepSDNCTopologyAct(): ' + e.getMessage())
}
}
@@ -924,17 +949,21 @@ public class DoUpdateVfModule extends VfModuleBase {
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
try {
def WorkflowException workflowException = (WorkflowException) execution.getVariable('WorkflowException')
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, method + ' caught WorkflowException: ' + workflowException.getErrorMessage(), "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ method + ' caught WorkflowException: ' + workflowException.getErrorMessage(), "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildWorkflowException(execution, 1002, 'Error in handleWorkflowException(): ' + e.getMessage())
}
}
@@ -943,26 +972,26 @@ public class DoUpdateVfModule extends VfModuleBase {
def prefix = execution.getVariable("prefix")
- msoLogger.trace("STARTED ValidateSDNCResponse Process")
+ logger.trace("STARTED ValidateSDNCResponse Process")
WorkflowException workflowException = execution.getVariable("WorkflowException")
boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator")
- msoLogger.debug("workflowException: " + workflowException)
+ logger.debug("workflowException: " + workflowException)
SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this)
sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator)
- msoLogger.debug("SDNCResponse: " + response)
+ logger.debug("SDNCResponse: " + response)
String sdncResponse = response
if(execution.getVariable(prefix + 'sdncResponseSuccess') == true){
- msoLogger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + sdncResponse)
+ logger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + sdncResponse)
}else{
- msoLogger.debug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.")
+ logger.debug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.")
throw new BpmnError("MSOWorkflowException")
}
- msoLogger.trace("COMPLETED ValidateSDNCResponse Process")
+ logger.trace("COMPLETED ValidateSDNCResponse Process")
}
/**
@@ -976,7 +1005,7 @@ public class DoUpdateVfModule extends VfModuleBase {
def method = getClass().getSimpleName() + '.getVfModule(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
try {
def vnfId = execution.getVariable('DOUPVfMod_vnfId')
@@ -988,30 +1017,32 @@ public class DoUpdateVfModule extends VfModuleBase {
execution.setVariable('DOUPVfMod_queryAAIVfModuleResponseCode', 200)
execution.setVariable('DOUPVfMod_queryAAIVfModuleResponse', genericVnf.get())
// Parse the VNF record from A&AI to find base module info
- msoLogger.debug('Parsing the VNF data to find base module info')
+ logger.debug('Parsing the VNF data to find base module info')
if (genericVnf.get().getVfModules()!=null && !genericVnf.get().getVfModules().getVfModule().isEmpty()) {
Optional<org.onap.aai.domain.yang.VfModule> vfmodule = genericVnf.get().getVfModules().getVfModule().stream().
filter{v-> v.isIsBaseVfModule()}.findFirst()
if (vfmodule.isPresent()) {
String baseModuleId = vfmodule.get().getVfModuleId()
execution.setVariable("DOUPVfMod_baseVfModuleId", baseModuleId)
- msoLogger.debug('Received baseVfModuleId: ' + baseModuleId)
+ logger.debug('Received baseVfModuleId: ' + baseModuleId)
String baseModuleHeatStackId = vfmodule.get().getHeatStackId()
execution.setVariable("DOUPVfMod_baseVfModuleHeatStackId", baseModuleHeatStackId)
- msoLogger.debug('Received baseVfModuleHeatStackId: ' + baseModuleHeatStackId)
+ logger.debug('Received baseVfModuleHeatStackId: ' + baseModuleHeatStackId)
}
}
}
} catch (Exception ex) {
ex.printStackTrace()
- msoLogger.debug('Exception occurred while executing AAI GET:' + ex.getMessage())
+ logger.debug('Exception occurred while executing AAI GET:' + ex.getMessage())
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'AAI GET Failed:' + ex.getMessage())
}
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIVfModule(): ' + e.getMessage())
}
}
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 9eb05cf64a..0781553879 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
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -40,6 +42,8 @@ import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
import org.onap.so.utils.TargetEntity
/**
@@ -47,7 +51,7 @@ import org.onap.so.utils.TargetEntity
* with the update of a generic vnf and related VF modules.
*/
class DoUpdateVnfAndModules extends AbstractServiceTaskProcessor {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoUpdateVnfAndModules.class);
+ private static final Logger logger = LoggerFactory.getLogger( DoUpdateVnfAndModules.class);
String Prefix="DUVAM_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
@@ -63,7 +67,7 @@ class DoUpdateVnfAndModules extends AbstractServiceTaskProcessor {
public void preProcessRequest(DelegateExecution execution) {
execution.setVariable("prefix",Prefix)
- msoLogger.trace("STARTED DoUpdateVnfAndModules PreProcessRequest Process")
+ logger.trace("STARTED DoUpdateVnfAndModules PreProcessRequest Process")
try{
// Get Variables
@@ -71,24 +75,24 @@ class DoUpdateVnfAndModules extends AbstractServiceTaskProcessor {
String requestId = execution.getVariable("msoRequestId")
execution.setVariable("requestId", requestId)
execution.setVariable("mso-request-id", requestId)
- msoLogger.debug("Incoming Request Id is: " + requestId)
+ logger.debug("Incoming Request Id is: " + requestId)
String serviceInstanceId = execution.getVariable("serviceInstanceId")
- msoLogger.debug("Incoming Service Instance Id is: " + serviceInstanceId)
+ logger.debug("Incoming Service Instance Id is: " + serviceInstanceId)
String vnfId = execution.getVariable("vnfId")
- msoLogger.debug("Incoming Vnf Id is: " + vnfId)
+ logger.debug("Incoming Vnf Id is: " + vnfId)
String source = "VID"
execution.setVariable("DUVAM_source", source)
- msoLogger.debug("Incoming Source is: " + source)
+ logger.debug("Incoming Source is: " + source)
String sdncVersion = execution.getVariable("sdncVersion")
if (sdncVersion == null) {
sdncVersion = "1702"
}
execution.setVariable("DUVAM_sdncVersion", sdncVersion)
- msoLogger.debug("Incoming Sdnc Version is: " + sdncVersion)
+ logger.debug("Incoming Sdnc Version is: " + sdncVersion)
VnfResource vnfResource = (VnfResource) execution.getVariable("vnfResourceDecomposition")
@@ -97,44 +101,44 @@ class DoUpdateVnfAndModules extends AbstractServiceTaskProcessor {
String serviceId = execution.getVariable("productFamilyId")
execution.setVariable("DUVAM_serviceId", serviceId)
- msoLogger.debug("Incoming Service Id is: " + serviceId)
+ logger.debug("Incoming Service Id is: " + serviceId)
String modelUuid = jsonUtil.getJsonValue(vnfModelInfo, "modelUuid")
execution.setVariable("DUVAM_modelUuid", modelUuid)
- msoLogger.debug("Incoming modelUuid is: " + modelUuid)
+ logger.debug("Incoming modelUuid is: " + modelUuid)
String modelCustomizationUuid = jsonUtil.getJsonValue(vnfModelInfo, "modelCustomizationUuid")
execution.setVariable("DUVAM_modelCustomizationUuid", modelCustomizationUuid)
- msoLogger.debug("Incoming Model Customization Uuid is: " + modelCustomizationUuid)
+ logger.debug("Incoming Model Customization Uuid is: " + modelCustomizationUuid)
String cloudSiteId = execution.getVariable("lcpCloudRegionId")
execution.setVariable("DUVAM_cloudSiteId", cloudSiteId)
- msoLogger.debug("Incoming Cloud Site Id is: " + cloudSiteId)
+ logger.debug("Incoming Cloud Site Id is: " + cloudSiteId)
String tenantId = execution.getVariable("tenantId")
execution.setVariable("DUVAM_tenantId", tenantId)
- msoLogger.debug("Incoming Tenant Id is: " + tenantId)
+ logger.debug("Incoming Tenant Id is: " + tenantId)
String globalSubscriberId = execution.getVariable("globalSubscriberId")
if (globalSubscriberId == null) {
globalSubscriberId = ""
}
execution.setVariable("DUVAM_globalSubscriberId", globalSubscriberId)
- msoLogger.debug("Incoming Global Subscriber Id is: " + globalSubscriberId)
+ logger.debug("Incoming Global Subscriber Id is: " + globalSubscriberId)
execution.setVariable("DUVAM_moduleCount", 0)
execution.setVariable("DUVAM_nextModule", 0)
}catch(BpmnError b){
- msoLogger.debug("Rethrowing MSOWorkflowException")
+ logger.debug("Rethrowing MSOWorkflowException")
throw b
}catch(Exception e){
- msoLogger.debug(" Error Occured in DoUpdateVnfAndModules PreProcessRequest method!" + e.getMessage())
+ logger.debug(" Error Occured in DoUpdateVnfAndModules PreProcessRequest method!" + e.getMessage())
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DoUpdateVnfAndModules PreProcessRequest")
}
- msoLogger.trace("COMPLETED DoUpdateVnfAndModules PreProcessRequest Process ")
+ logger.trace("COMPLETED DoUpdateVnfAndModules PreProcessRequest Process ")
}
/**
@@ -148,7 +152,7 @@ class DoUpdateVnfAndModules extends AbstractServiceTaskProcessor {
def method = getClass().getSimpleName() + '.queryAAIVfModule(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
try {
def vnfId = execution.getVariable('vnfId')
@@ -156,7 +160,7 @@ class DoUpdateVnfAndModules extends AbstractServiceTaskProcessor {
AaiUtil aaiUriUtil = new AaiUtil(this)
AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId).depth(Depth.ONE)
String endPoint = aaiUriUtil.createAaiUri(uri)
- msoLogger.debug("AAI endPoint: " + endPoint)
+ logger.debug("AAI endPoint: " + endPoint)
try {
HttpClient client = new HttpClientFactory().newXmlClient(new URL(endPoint), TargetEntity.AAI)
@@ -167,33 +171,33 @@ class DoUpdateVnfAndModules extends AbstractServiceTaskProcessor {
def responseData = ''
- msoLogger.debug('sending GET to AAI endpoint \'' + endPoint + '\'')
+ logger.debug('sending GET to AAI endpoint \'' + endPoint + '\'')
Response response = client.get()
- msoLogger.debug("createVfModule - invoking httpGet() to AAI")
+ logger.debug("createVfModule - invoking httpGet() to AAI")
responseData = response.readEntity(String.class)
if (responseData != null) {
- msoLogger.debug("Received generic VNF data: " + responseData)
+ logger.debug("Received generic VNF data: " + responseData)
}
- msoLogger.debug("createVfModule - queryAAIVfModule Response: " + responseData)
- msoLogger.debug("createVfModule - queryAAIVfModule ResponseCode: " + response.getStatus())
+ logger.debug("createVfModule - queryAAIVfModule Response: " + responseData)
+ logger.debug("createVfModule - queryAAIVfModule ResponseCode: " + response.getStatus())
execution.setVariable('DUVAM_queryAAIVfModuleResponseCode', response.getStatus())
execution.setVariable('DUVAM_queryAAIVfModuleResponse', responseData)
- msoLogger.debug('Response code:' + response.getStatus())
- msoLogger.debug('Response:' + System.lineSeparator() + responseData)
+ logger.debug('Response code:' + response.getStatus())
+ logger.debug('Response:' + System.lineSeparator() + responseData)
//Map<String, String>[] vfModules = new HashMap<String,String>[]
def vfModulesList = new ArrayList<Map<String,String>>()
def vfModules = null
def vfModuleBaseEntry = null
if (response.getStatus() == 200) {
// Parse the VNF record from A&AI to find base module info
- msoLogger.debug('Parsing the VNF data to find base module info')
+ logger.debug('Parsing the VNF data to find base module info')
if (responseData != null) {
def vfModulesText = utils.getNodeXml(responseData, "vf-modules")
- msoLogger.debug("vModulesText: " + vfModulesText)
+ logger.debug("vModulesText: " + vfModulesText)
if (vfModulesText != null && !vfModulesText.trim().isEmpty()) {
def xmlVfModules= new XmlSlurper().parseText(vfModulesText)
vfModules = xmlVfModules.'**'.findAll {it.name() == "vf-module"}
@@ -219,7 +223,7 @@ class DoUpdateVnfAndModules extends AbstractServiceTaskProcessor {
String volumeGroupId = ''
- msoLogger.debug("Next module!")
+ logger.debug("Next module!")
def vfModuleRelationships = vfModules[i].'**'.findAll {it.name() == 'relationship-data'}
if (vfModuleRelationships.size() > 0) {
for (j in 0..vfModuleRelationships.size()-1) {
@@ -237,7 +241,7 @@ class DoUpdateVnfAndModules extends AbstractServiceTaskProcessor {
}
vfModuleEntry.put("volumeGroupId", volumeGroupId)
- msoLogger.debug("volumeGroupId is: " + volumeGroupId)
+ logger.debug("volumeGroupId is: " + volumeGroupId)
// Save base vf module to add it to the start of the list later
if (isBaseVfModule == "true") {
@@ -256,20 +260,22 @@ class DoUpdateVnfAndModules extends AbstractServiceTaskProcessor {
}
}
else {
- msoLogger.debug('Response code from AAI GET is: ' + response.getStatusCode())
+ logger.debug('Response code from AAI GET is: ' + response.getStatusCode())
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Response code from AAI GET is: ' + response.getStatusCode())
}
execution.setVariable("DUVAM_vfModules", vfModulesList)
} catch (Exception ex) {
ex.printStackTrace()
- msoLogger.debug('Exception occurred while executing AAI GET:' + ex.getMessage())
+ logger.debug('Exception occurred while executing AAI GET:' + ex.getMessage())
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'AAI GET Failed:' + ex.getMessage())
}
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIVfModule(): ' + e.getMessage())
}
}
@@ -277,7 +283,7 @@ class DoUpdateVnfAndModules extends AbstractServiceTaskProcessor {
public void prepareNextModuleToUpdate(DelegateExecution execution){
execution.setVariable("prefix", Prefix)
- msoLogger.trace("STARTED prepareNextModuleToUpdate ")
+ logger.trace("STARTED prepareNextModuleToUpdate ")
try {
int i = execution.getVariable("DUVAM_nextModule")
@@ -294,7 +300,7 @@ class DoUpdateVnfAndModules extends AbstractServiceTaskProcessor {
execution.setVariable("DUVAM_isBaseVfModule", isBaseVfModule)
String modelInvariantUuid = vfModule.get("modelInvariantUuid")
- msoLogger.debug("ModelInvariantUuid: " + modelInvariantUuid)
+ logger.debug("ModelInvariantUuid: " + modelInvariantUuid)
def volumeGroupId = vfModule.get("volumeGroupId")
execution.setVariable("DUVAM_volumeGroupId", volumeGroupId)
@@ -309,13 +315,13 @@ class DoUpdateVnfAndModules extends AbstractServiceTaskProcessor {
for (j in 0..moduleResources.size()-1) {
ModelInfo modelInfo = moduleResources[j].getModelInfo()
String modelInvariantUuidFromDecomposition = modelInfo.getModelInvariantUuid()
- msoLogger.debug("modelInvariantUuidFromDecomposition: " + modelInvariantUuidFromDecomposition)
+ logger.debug("modelInvariantUuidFromDecomposition: " + modelInvariantUuidFromDecomposition)
if (modelInvariantUuid.equals(modelInvariantUuidFromDecomposition)) {
String vfModuleModelInfo = modelInfo.toJsonString()
String vfModuleModelInfoValue = jsonUtil.getJsonValue(vfModuleModelInfo, "modelInfo")
execution.setVariable("DUVAM_vfModuleModelInfo", vfModuleModelInfoValue)
- msoLogger.debug("vfModuleModelInfo: " + vfModuleModelInfoValue)
+ logger.debug("vfModuleModelInfo: " + vfModuleModelInfoValue)
break
}
@@ -323,10 +329,12 @@ class DoUpdateVnfAndModules extends AbstractServiceTaskProcessor {
}
}catch(Exception e){
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing preProcessAddOnModule. Exception is:\n" + e, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Occured Processing preProcessAddOnModule. Exception is:\n" + e, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during prepareNextModuleToUpdate Method:\n" + e.getMessage())
}
- msoLogger.trace("COMPLETED prepareNextModuleToUpdate ")
+ logger.trace("COMPLETED prepareNextModuleToUpdate ")
}
@@ -340,7 +348,7 @@ class DoUpdateVnfAndModules extends AbstractServiceTaskProcessor {
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
try {
def vnfId = execution.getVariable('vnfId')
@@ -389,15 +397,17 @@ class DoUpdateVnfAndModules extends AbstractServiceTaskProcessor {
"""
updateAAIGenericVnfRequest = utils.formatXml(updateAAIGenericVnfRequest)
execution.setVariable('DUVAM_updateAAIGenericVnfRequest', updateAAIGenericVnfRequest)
- msoLogger.debug("updateAAIGenericVnfRequest : " + updateAAIGenericVnfRequest)
- msoLogger.debug('Request for UpdateAAIGenericVnf:\n' + updateAAIGenericVnfRequest)
+ logger.debug("updateAAIGenericVnfRequest : " + updateAAIGenericVnfRequest)
+ logger.debug('Request for UpdateAAIGenericVnf:\n' + updateAAIGenericVnfRequest)
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepUpdateAAIGenericVnf(): ' + e.getMessage())
}
}
@@ -412,6 +422,6 @@ class DoUpdateVnfAndModules extends AbstractServiceTaskProcessor {
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/HealchCheckActivate.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/HealchCheckActivate.groovy
index 4deb53f0ce..dfd021702a 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/HealchCheckActivate.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/HealchCheckActivate.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -24,15 +26,11 @@ import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor;
import org.apache.commons.lang3.*
-import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
public class HealthCheckActivate extends AbstractServiceTaskProcessor {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, HealthCheckActivate.class);
-
/**
* Validates the request message and sets up the workflow.
* @param execution the execution
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ReplaceVnfInfra.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ReplaceVnfInfra.groovy
index 671796f27f..0454bb4876 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ReplaceVnfInfra.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ReplaceVnfInfra.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -34,12 +36,14 @@ import org.onap.so.client.appc.ApplicationControllerOrchestrator
import org.onap.so.client.appc.ApplicationControllerSupport
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
import groovy.json.JsonOutput
import groovy.json.JsonSlurper
public class ReplaceVnfInfra extends VnfCmBase {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, ReplaceVnfInfra.class);
+ private static final Logger logger = LoggerFactory.getLogger( ReplaceVnfInfra.class);
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtils = new JsonUtils()
@@ -93,18 +97,18 @@ public class ReplaceVnfInfra extends VnfCmBase {
')'
initProcessVariables(execution)
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
initProcessVariables(execution)
def incomingRequest = execution.getVariable('bpmnRequest')
- msoLogger.debug("Incoming Infra Request: " + incomingRequest)
+ logger.debug("Incoming Infra Request: " + incomingRequest)
try {
def jsonSlurper = new JsonSlurper()
def jsonOutput = new JsonOutput()
Map reqMap = jsonSlurper.parseText(incomingRequest)
- msoLogger.debug(" Request is in JSON format.")
+ logger.debug(" Request is in JSON format.")
def serviceInstanceId = execution.getVariable('serviceInstanceId')
def vnfId = execution.getVariable('vnfId')
@@ -129,12 +133,12 @@ public class ReplaceVnfInfra extends VnfCmBase {
if (relatedInstanceList != null) {
relatedInstanceList.each {
if (it.relatedInstance.modelInfo?.modelType == 'service') {
- msoLogger.debug("PROCESSING SERVICE INFO")
+ logger.debug("PROCESSING SERVICE INFO")
asdcServiceModelVersion = it.relatedInstance.modelInfo?.modelVersion
serviceModelInfo = jsonOutput.toJson(it.relatedInstance.modelInfo)
- msoLogger.debug("ServiceModelInfo: " + serviceModelInfo)
+ logger.debug("ServiceModelInfo: " + serviceModelInfo)
def modelInvariant = jsonUtils.getJsonValue(serviceModelInfo, "modelInvariantUuid")
- msoLogger.debug("modelInvariant: " + modelInvariant)
+ logger.debug("modelInvariant: " + modelInvariant)
}
}
@@ -146,7 +150,7 @@ public class ReplaceVnfInfra extends VnfCmBase {
execution.setVariable('vnfModelInfo', vnfModelInfo)
def vnfModelInvariantUuid = jsonUtils.getJsonValue(vnfModelInfo, "modelInvariantUuid")
execution.setVariable('vnfModelInvariantUuid', vnfModelInvariantUuid)
- msoLogger.debug("vnfModelInvariantUuid: " + vnfModelInvariantUuid)
+ logger.debug("vnfModelInvariantUuid: " + vnfModelInvariantUuid)
def vnfType = execution.getVariable('vnfType')
execution.setVariable('vnfType', vnfType)
@@ -155,7 +159,7 @@ public class ReplaceVnfInfra extends VnfCmBase {
def controllerType = reqMap.requestDetails?.requestParameters?.controllerType
execution.setVariable('controllerType', controllerType)
- msoLogger.debug('Controller Type: ' + controllerType)
+ logger.debug('Controller Type: ' + controllerType)
def userParams = reqMap.requestDetails?.requestParameters?.userParams
@@ -166,13 +170,13 @@ public class ReplaceVnfInfra extends VnfCmBase {
}
}
- msoLogger.debug('Processed user params: ' + userParamsMap)
+ logger.debug('Processed user params: ' + userParamsMap)
execution.setVariable('vfModuleInputParams', userParamsMap)
def requestId = execution.getVariable("requestId")
execution.setVariable('msoRequestId', requestId)
- msoLogger.debug("requestId is: " + requestId)
+ logger.debug("requestId is: " + requestId)
def vnfName = reqMap.requestDetails?.requestInfo?.instanceName ?: null
execution.setVariable('vnfName', vnfName)
@@ -217,19 +221,21 @@ public class ReplaceVnfInfra extends VnfCmBase {
execution.setVariable("requestInfo", requestInfo)
- msoLogger.debug('RequestInfo: ' + execution.getVariable("requestInfo"))
+ logger.debug('RequestInfo: ' + execution.getVariable("requestInfo"))
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
}
catch(groovy.json.JsonException je) {
- msoLogger.debug(" Request is not in JSON format.")
+ logger.debug(" Request is not in JSON format.")
exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Invalid request format")
}
catch(Exception e) {
String restFaultMessage = e.getMessage()
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Exception Encountered - " + "\n" + restFaultMessage, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Encountered - " + "\n" + restFaultMessage, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 5000, restFaultMessage)
}
}
@@ -244,7 +250,7 @@ public class ReplaceVnfInfra extends VnfCmBase {
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
try {
@@ -266,11 +272,13 @@ public class ReplaceVnfInfra extends VnfCmBase {
sendWorkflowResponse(execution, 200, synchResponse)
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage())
}
}
@@ -288,25 +296,25 @@ public class ReplaceVnfInfra extends VnfCmBase {
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
try {
ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
String vnfModelInvariantUuid = execution.getVariable('vnfModelInvariantUuid')
- msoLogger.debug("vnfModelInvariantUuid: " + vnfModelInvariantUuid)
+ logger.debug("vnfModelInvariantUuid: " + vnfModelInvariantUuid)
List<VnfResource> vnfResources = serviceDecomposition.getVnfResources()
for (i in 0..vnfResources.size()-1) {
ModelInfo modelInfo = vnfResources[i].getModelInfo()
String modelInvariantUuidFromDecomposition = modelInfo.getModelInvariantUuid()
- msoLogger.debug("modelInvariantUuidFromDecomposition: " + modelInvariantUuidFromDecomposition)
+ logger.debug("modelInvariantUuidFromDecomposition: " + modelInvariantUuidFromDecomposition)
if (vnfModelInvariantUuid.equals(modelInvariantUuidFromDecomposition)) {
VnfResource vnfResourceDecomposition = vnfResources[i]
execution.setVariable('vnfResourceDecomposition', vnfResourceDecomposition)
def nfRole = vnfResourceDecomposition.getNfRole()
execution.setVariable('nfRole', nfRole)
- msoLogger.debug("vnfResourceDecomposition: " + vnfResourceDecomposition.toJsonString())
+ logger.debug("vnfResourceDecomposition: " + vnfResourceDecomposition.toJsonString())
break
}
else {
@@ -315,11 +323,13 @@ public class ReplaceVnfInfra extends VnfCmBase {
}
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in getVnfResourceDecomposition(): ' + e.getMessage())
}
}
@@ -338,7 +348,7 @@ public class ReplaceVnfInfra extends VnfCmBase {
execution.setVariable('errorCode', "0")
execution.setVariable("workStep", "checkIfVnfInMaintInAAI")
execution.setVariable("failedActivity", "AAI")
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
try {
AAIRestClientImpl client = new AAIRestClientImpl()
@@ -346,7 +356,7 @@ public class ReplaceVnfInfra extends VnfCmBase {
aaiValidator.setClient(client)
def vnfId = execution.getVariable("vnfId")
boolean isInMaint = aaiValidator.isVNFLocked(vnfId)
- msoLogger.debug("isInMaint result: " + isInMaint)
+ logger.debug("isInMaint result: " + isInMaint)
execution.setVariable('isVnfInMaintenance', isInMaint)
if (isInMaint) {
@@ -355,11 +365,13 @@ public class ReplaceVnfInfra extends VnfCmBase {
}
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
//exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfVnfInMaintInAAI(): ' + e.getMessage())
@@ -379,7 +391,7 @@ public class ReplaceVnfInfra extends VnfCmBase {
')'
execution.setVariable('errorCode', "0")
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
execution.setVariable("workStep", "checkIfPserversInMaintInAAI")
execution.setVariable("failedActivity", "AAI")
@@ -389,7 +401,7 @@ public class ReplaceVnfInfra extends VnfCmBase {
aaiValidator.setClient(client)
def vnfId = execution.getVariable("vnfId")
boolean areLocked = aaiValidator.isPhysicalServerLocked(vnfId)
- msoLogger.debug("areLocked result: " + areLocked)
+ logger.debug("areLocked result: " + areLocked)
execution.setVariable('arePserversLocked', areLocked)
if (areLocked) {
@@ -397,11 +409,13 @@ public class ReplaceVnfInfra extends VnfCmBase {
execution.setVariable("errorText", "pServers are locked in A&AI")
}
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
//exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfPserversInMaintInAAI(): ' + e.getMessage())
@@ -421,7 +435,7 @@ public class ReplaceVnfInfra extends VnfCmBase {
')'
execution.setVariable('errorCode', "0")
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
if (inMaint) {
execution.setVariable("workStep", "setVnfInMaintFlagInAAI")
}
@@ -443,11 +457,13 @@ public class ReplaceVnfInfra extends VnfCmBase {
aaiUpdator.updateVnfToUnLocked(vnfId)
}
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
}
@@ -466,10 +482,10 @@ public class ReplaceVnfInfra extends VnfCmBase {
')'
execution.setVariable('errorCode', "0")
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
try {
- msoLogger.debug("Running APP-C action: " + action.toString())
+ logger.debug("Running APP-C action: " + action.toString())
String vnfId = execution.getVariable('vnfId')
String msoRequestId = execution.getVariable('requestId')
execution.setVariable('msoRequestId', msoRequestId)
@@ -504,26 +520,32 @@ public class ReplaceVnfInfra extends VnfCmBase {
default:
break
}
- msoLogger.debug("Completed AppC request")
+ logger.debug("Completed AppC request")
int appcCode = appcStatus.getCode()
- msoLogger.debug("AppC status code is: " + appcCode)
- msoLogger.debug("AppC status message is: " + appcStatus.getMessage())
+ logger.debug("AppC status code is: " + appcCode)
+ logger.debug("AppC status message is: " + appcStatus.getMessage())
if (support.getCategoryOf(appcStatus) == ApplicationControllerSupport.StatusCategory.ERROR) {
execution.setVariable("errorCode", Integer.toString(appcCode))
execution.setVariable("errorText", appcStatus.getMessage())
}
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
} catch (BpmnError e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
} catch (java.lang.NoSuchMethodError e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
}
@@ -543,10 +565,10 @@ public class ReplaceVnfInfra extends VnfCmBase {
')'
execution.setVariable('errorCode', "0")
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
execution.setVariable("workStep", "doDeleteVnfAndModules")
execution.setVariable("failedActivity", "MSO Delete VNF")
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
}
@@ -562,10 +584,10 @@ public class ReplaceVnfInfra extends VnfCmBase {
')'
execution.setVariable('errorCode', "0")
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
execution.setVariable("workStep", "doCreateVnfAndModules")
execution.setVariable("failedActivity", "MSO Create VNF")
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
}
@@ -580,7 +602,7 @@ public class ReplaceVnfInfra extends VnfCmBase {
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
def errorText = execution.getVariable("errorText")
def errorCode = execution.getVariable("errorCode")
@@ -598,7 +620,7 @@ public class ReplaceVnfInfra extends VnfCmBase {
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
def taskId = execution.getVariable("taskId")
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/RollbackVnf.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/RollbackVnf.groovy
index 22b44c9ead..5b0b92415d 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/RollbackVnf.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/RollbackVnf.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -54,9 +56,11 @@ import org.onap.appc.client.lcm.model.Action;
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
public class RollbackVnf extends VnfCmBase {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, RollbackVnf.class);
+ private static final Logger logger = LoggerFactory.getLogger( RollbackVnf.class);
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtils = new JsonUtils()
@@ -92,7 +96,7 @@ public class RollbackVnf extends VnfCmBase {
')'
initProcessVariables(execution)
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
initProcessVariables(execution)
@@ -101,16 +105,18 @@ public class RollbackVnf extends VnfCmBase {
execution.setVariable("rollbackErrorCode", "0")
if (execution.getVariable("rollbackSetClosedLoopDisabledFlag") == true) {
- msoLogger.debug("Will call setClosedLoopDisabledFlag")
+ logger.debug("Will call setClosedLoopDisabledFlag")
}
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
}
catch(Exception e) {
String restFaultMessage = e.getMessage()
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Exception Encountered - " + "\n" + restFaultMessage, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Encountered - " + "\n" + restFaultMessage, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
execution.setVariable("rollbackErrorCode", "1")
exceptionUtil.buildAndThrowWorkflowException(execution, 5000, restFaultMessage)
}
@@ -127,19 +133,19 @@ public class RollbackVnf extends VnfCmBase {
')'
initProcessVariables(execution)
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
def rollbackErrorCode = execution.getVariable('rollbackErrorCode')
if (rollbackErrorCode == "0") {
execution.setVariable('rollbackSuccessful', true)
- msoLogger.debug("rollback successful")
+ logger.debug("rollback successful")
}
else {
execution.setVariable('rollbackSuccessful', false)
- msoLogger.debug("rollback unsuccessful")
+ logger.debug("rollback unsuccessful")
}
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstance.groovy
index 687ac215a5..2c573c8223 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstance.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2018 CMCC. 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
@@ -32,6 +34,8 @@ import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
import org.onap.so.utils.UUIDChecker
import org.springframework.web.util.UriUtils
@@ -41,7 +45,7 @@ import org.springframework.web.util.UriUtils
*
*/
public class ScaleCustomE2EServiceInstance extends AbstractServiceTaskProcessor {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, ScaleCustomE2EServiceInstance.class);
+ private static final Logger logger = LoggerFactory.getLogger( ScaleCustomE2EServiceInstance.class);
String Prefix = "CRESI_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
@@ -50,22 +54,22 @@ public class ScaleCustomE2EServiceInstance extends AbstractServiceTaskProcessor
public void preProcessRequest(DelegateExecution execution) {
execution.setVariable("prefix", Prefix)
String msg = ""
- msoLogger.trace("preProcessRequest() ")
+ logger.trace("preProcessRequest() ")
try {
String siRequest = execution.getVariable("bpmnRequest")
- msoLogger.debug(siRequest)
+ logger.debug(siRequest)
String requestId = execution.getVariable("mso-request-id")
execution.setVariable("msoRequestId", requestId)
- msoLogger.debug("Input Request:" + siRequest + " reqId:" + requestId)
+ logger.debug("Input Request:" + siRequest + " reqId:" + requestId)
String serviceInstanceId = execution.getVariable("serviceInstanceId")
if (isBlank(serviceInstanceId)) {
serviceInstanceId = "NULL".toString()
}
- msoLogger.debug("Generated new Service Instance:" + serviceInstanceId)
+ logger.debug("Generated new Service Instance:" + serviceInstanceId)
serviceInstanceId = UriUtils.encode(serviceInstanceId, "UTF-8")
execution.setVariable("serviceInstanceId", serviceInstanceId)
@@ -83,14 +87,14 @@ public class ScaleCustomE2EServiceInstance extends AbstractServiceTaskProcessor
//String operationKey = UUIDChecker.generateUUID(msoLogger)
String operationId = jsonUtil.getJsonValue(siRequest, "operationId")
execution.setVariable("operationId", operationId)
- msoLogger.debug("Input Request:" + siRequest + " operationId:" + operationId)
+ logger.debug("Input Request:" + siRequest + " operationId:" + operationId)
String resources = jsonUtil.getJsonValue(siRequest, "service.resources")
execution.setVariable("resources", resources)
// node template UUID
- String nodeTemplateUUID = UUIDChecker.generateUUID(msoLogger)
+ String nodeTemplateUUID = UUIDChecker.getUUID();
execution.setVariable("nodeTemplateUUID", nodeTemplateUUID)
//subscriberInfo
@@ -110,35 +114,35 @@ public class ScaleCustomE2EServiceInstance extends AbstractServiceTaskProcessor
throw e;
} catch (Exception ex) {
msg = "Exception in preProcessRequest " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("Exit preProcessRequest ")
+ logger.trace("Exit preProcessRequest ")
}
public void sendSyncResponse(DelegateExecution execution) {
- msoLogger.trace("sendSyncResponse ")
+ logger.trace("sendSyncResponse ")
try {
String operationId = execution.getVariable("operationId")
String serviceInstanceId = execution.getVariable("serviceInstanceId")
// RESTResponse for API Handler (APIH) Reply Task
String scaleServiceRestRequest = """{"operationId":"${operationId}"}""".trim()
- msoLogger.debug(" sendSyncResponse to APIH:" + "\n" + scaleServiceRestRequest)
+ logger.debug(" sendSyncResponse to APIH:" + "\n" + scaleServiceRestRequest)
sendWorkflowResponse(execution, 202, scaleServiceRestRequest)
execution.setVariable("sentSyncResponse", true)
} catch (Exception ex) {
String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("Exit sendSyncResopnse ")
+ logger.trace("Exit sendSyncResopnse ")
}
public void sendSyncError(DelegateExecution execution) {
- msoLogger.trace("sendSyncError ")
+ logger.trace("sendSyncError ")
try {
String errorMessage = ""
@@ -155,17 +159,17 @@ public class ScaleCustomE2EServiceInstance extends AbstractServiceTaskProcessor
<aetgt:ErrorCode>7000</aetgt:ErrorCode>
</aetgt:WorkflowException>"""
- msoLogger.debug(buildworkflowException)
+ logger.debug(buildworkflowException)
sendWorkflowResponse(execution, 500, buildworkflowException)
} catch (Exception ex) {
- msoLogger.debug(" Sending Sync Error Activity Failed. " + "\n" + ex.getMessage())
+ logger.debug(" Sending Sync Error Activity Failed. " + "\n" + ex.getMessage())
}
}
public void prepareCompletionRequest(DelegateExecution execution) {
- msoLogger.trace("prepareCompletion ")
+ logger.trace("prepareCompletion ")
try {
String requestId = execution.getVariable("msoRequestId")
@@ -189,22 +193,22 @@ public class ScaleCustomE2EServiceInstance extends AbstractServiceTaskProcessor
String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest)
execution.setVariable("CompleteMsoProcessRequest", xmlMsoCompletionRequest)
- msoLogger.debug(" Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest)
+ logger.debug(" Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest)
} catch (Exception ex) {
String msg = " Exception in prepareCompletion:" + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("Exit prepareCompletionRequest ")
+ logger.trace("Exit prepareCompletionRequest ")
}
public void prepareFalloutRequest(DelegateExecution execution) {
- msoLogger.trace("prepareFalloutRequest ")
+ logger.trace("prepareFalloutRequest ")
try {
WorkflowException wfex = execution.getVariable("WorkflowException")
- msoLogger.debug(" Input Workflow Exception: " + wfex.toString())
+ logger.debug(" Input Workflow Exception: " + wfex.toString())
String requestId = execution.getVariable("msoRequestId")
String source = execution.getVariable("source")
String requestInfo =
@@ -217,7 +221,7 @@ public class ScaleCustomE2EServiceInstance extends AbstractServiceTaskProcessor
String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo)
execution.setVariable("falloutRequest", falloutRequest)
} catch (Exception ex) {
- msoLogger.debug("Exception prepareFalloutRequest:" + ex.getMessage())
+ logger.debug("Exception prepareFalloutRequest:" + ex.getMessage())
String errorException = " Bpmn error encountered in ScaleGenericALaCarteServiceInstance flow. FalloutHandlerRequest, buildErrorResponse() - " + ex.getMessage()
String requestId = execution.getVariable("msoRequestId")
String falloutRequest =
@@ -237,7 +241,7 @@ public class ScaleCustomE2EServiceInstance extends AbstractServiceTaskProcessor
execution.setVariable("falloutRequest", falloutRequest)
}
- msoLogger.trace("Exit prepareFalloutRequest ")
+ logger.trace("Exit prepareFalloutRequest ")
}
@@ -245,7 +249,7 @@ public class ScaleCustomE2EServiceInstance extends AbstractServiceTaskProcessor
* Init the service Operation Status
*/
public void prepareInitServiceOperationStatus(DelegateExecution execution){
- msoLogger.trace("STARTED prepareInitServiceOperationStatus Process ")
+ logger.trace("STARTED prepareInitServiceOperationStatus Process ")
try{
String serviceId = execution.getVariable("serviceInstanceId")
//String serviceName = execution.getVariable("serviceInstanceName")
@@ -262,7 +266,7 @@ public class ScaleCustomE2EServiceInstance extends AbstractServiceTaskProcessor
def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution)
execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint)
- msoLogger.info("DB Adapter Endpoint is: " + dbAdapterEndpoint)
+ logger.info("DB Adapter Endpoint is: " + dbAdapterEndpoint)
String payload =
"""<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
@@ -285,13 +289,15 @@ public class ScaleCustomE2EServiceInstance extends AbstractServiceTaskProcessor
payload = utils.formatXml(payload)
execution.setVariable("CVFMI_updateServiceOperStatusRequest", payload)
- msoLogger.info("Outgoing updateServiceOperStatusRequest: \n" + payload)
- msoLogger.debug("Scale network service updateServiceOperStatusRequest Request: " + payload)
+ logger.info("Outgoing updateServiceOperStatusRequest: \n" + payload)
+ logger.debug("Scale network service updateServiceOperStatusRequest Request: " + payload)
}catch(Exception e){
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing prepareInitServiceOperationStatus.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Occured Processing prepareInitServiceOperationStatus.", "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), e);
execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during prepareInitServiceOperationStatus Method:\n" + e.getMessage())
}
- msoLogger.trace("COMPLETED prepareInitServiceOperationStatus Process ")
+ logger.trace("COMPLETED prepareInitServiceOperationStatus Process ")
}
-} \ No newline at end of file
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy
index 4127c3a913..4e3517e5b5 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2018 Huawei Technologies Co., Ltd. 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
@@ -43,6 +45,8 @@ import org.onap.so.client.aai.entities.AAIResultWrapper
import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.springframework.web.util.UriUtils
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
import groovy.json.*
@@ -52,6 +56,8 @@ import groovy.json.*
*
*/
public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor {
+ private static final Logger logger = LoggerFactory.getLogger( UpdateCustomE2EServiceInstance.class);
+
String Prefix="UPDSI_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtil = new JsonUtils()
@@ -61,7 +67,7 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix",Prefix)
String msg = ""
- utils.log("INFO", " *** preProcessRequest() *** ", isDebugEnabled)
+ logger.info( " *** preProcessRequest() *** ")
try {
@@ -70,7 +76,7 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor
String requestId = execution.getVariable("mso-request-id")
execution.setVariable("msoRequestId", requestId)
- utils.log("INFO", "Input Request:" + siRequest + " reqId:" + requestId, isDebugEnabled)
+ logger.info( "Input Request:" + siRequest + " reqId:" + requestId)
String serviceInstanceId = execution.getVariable("serviceInstanceId")
if (isBlank(serviceInstanceId)) {
@@ -95,32 +101,32 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor
if (isBlank(productFamilyId))
{
msg = "Input productFamilyId is null"
- utils.log("INFO", msg, isDebugEnabled)
+ logger.info( msg)
} else {
execution.setVariable("productFamilyId", productFamilyId)
}
//user params
String userParams = jsonUtil.getJsonValue(siRequest, "requestDetails.requestParameters.userParams")
- utils.log("INFO", "userParams:" + userParams, isDebugEnabled)
+ logger.info( "userParams:" + userParams)
List<String> paramList = jsonUtil.StringArrayToList(execution, userParams)
String uuiRequest = jsonUtil.getJsonValue(paramList.get(0), "UUIRequest")
if (isBlank(uuiRequest)) {
msg = "Input uuiRequest is null"
- utils.log("INFO", msg, isDebugEnabled)
+ logger.info( msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
} else
{
execution.setVariable("uuiRequest", uuiRequest)
}
- utils.log("INFO", "uuiRequest:\n" + uuiRequest, isDebugEnabled)
+ logger.info( "uuiRequest:\n" + uuiRequest)
//serviceType for aai
String serviceType = jsonUtil.getJsonValue(uuiRequest, "service.serviceType")
if (isBlank(serviceType)) {
msg = "Input serviceType is null"
- utils.log("INFO", msg, isDebugEnabled)
+ logger.info( msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
} else {
execution.setVariable("serviceType", serviceType)
@@ -128,17 +134,17 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor
// target model info
String modelInvariantUuid = jsonUtil.getJsonValue(uuiRequest, "service.serviceInvariantUuid")
- utils.log("INFO","modelInvariantUuid: " + modelInvariantUuid, isDebugEnabled)
+ logger.info("modelInvariantUuid: " + modelInvariantUuid)
execution.setVariable("modelInvariantUuid", modelInvariantUuid)
execution.setVariable("model-invariant-id-target", modelInvariantUuid)
String modelUuid = jsonUtil.getJsonValue(uuiRequest, "service.serviceUuid")
- utils.log("INFO","modelUuid: " + modelUuid, isDebugEnabled)
+ logger.info("modelUuid: " + modelUuid)
execution.setVariable("modelUuid", modelUuid)
execution.setVariable("model-version-id-target", modelUuid)
String serviceModelName = jsonUtil.getJsonValue(uuiRequest, "service.parameters.templateName")
- utils.log("INFO","serviceModelName: " + serviceModelName, isDebugEnabled)
+ logger.info("serviceModelName: " + serviceModelName)
if(serviceModelName == null) {
serviceModelName = ""
}
@@ -157,10 +163,10 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor
throw e;
} catch (Exception ex){
msg = "Exception in preProcessRequest " + ex.getMessage()
- utils.log("INFO", msg, isDebugEnabled)
+ logger.info( msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- utils.log("INFO"," ***** Exit preProcessRequest *****", isDebugEnabled)
+ logger.info(" ***** Exit preProcessRequest *****")
}
/**
@@ -203,7 +209,7 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor
public void postCompareModelVersions(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- utils.log("DEBUG", " ======== STARTED postCompareModelVersions Process ======== ", isDebugEnabled)
+ logger.debug( " ======== STARTED postCompareModelVersions Process ======== ")
def hasResourcetoUpdate = false
def hasResourcetoAdd = false
@@ -222,7 +228,7 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor
hasResourcetoUpdate = hasResourcetoAdd || hasResourcetoDelete
execution.setVariable("hasResourcetoUpdate", hasResourcetoUpdate)
- utils.log("DEBUG", "======== COMPLETED postCompareModelVersions Process ======== ", isDebugEnabled)
+ logger.debug( "======== COMPLETED postCompareModelVersions Process ======== ")
}
/**
@@ -230,7 +236,7 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor
*/
public void prepareInitServiceOperationStatus(DelegateExecution execution){
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
- utils.log("DEBUG", " ======== STARTED prepareInitServiceOperationStatus Process ======== ", isDebugEnabled)
+ logger.debug( " ======== STARTED prepareInitServiceOperationStatus Process ======== ")
try{
String serviceId = execution.getVariable("serviceInstanceId")
String operationId = execution.getVariable("operationId")
@@ -240,7 +246,7 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor
String progress = "0"
String reason = ""
String operationContent = "Prepare service updating"
- utils.log("DEBUG", "Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId, isDebugEnabled)
+ logger.debug( "Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId)
serviceId = UriUtils.encode(serviceId,"UTF-8")
execution.setVariable("serviceInstanceId", serviceId)
execution.setVariable("operationId", operationId)
@@ -248,7 +254,7 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor
def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution)
execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint)
- utils.log("DEBUG", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled)
+ logger.debug( "DB Adapter Endpoint is: " + dbAdapterEndpoint)
String payload =
"""<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
@@ -270,14 +276,14 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor
payload = utils.formatXml(payload)
execution.setVariable("CVFMI_updateServiceOperStatusRequest", payload)
- utils.log("DEBUG", "Outgoing updateServiceOperStatusRequest: \n" + payload, isDebugEnabled)
+ logger.error( "Outgoing updateServiceOperStatusRequest: \n" + payload)
utils.logAudit("CreateVfModuleInfra Outgoing updateServiceOperStatusRequest Request: " + payload)
}catch(Exception e){
- utils.log("ERROR", "Exception Occured Processing prepareInitServiceOperationStatus. Exception is:\n" + e, isDebugEnabled)
+ logger.debug( "Exception Occured Processing prepareInitServiceOperationStatus. Exception is:\n" + e)
execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during prepareInitServiceOperationStatus Method:\n" + e.getMessage())
}
- utils.log("DEBUG", "======== COMPLETED prepareInitServiceOperationStatus Process ======== ", isDebugEnabled)
+ logger.debug( "======== COMPLETED prepareInitServiceOperationStatus Process ======== ")
}
/**
@@ -286,7 +292,7 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor
public void preUpdateServiceOperationStatus(DelegateExecution execution){
def method = getClass().getSimpleName() + '.preUpdateServiceOperationStatus(' +'execution=' + execution.getId() +')'
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
- utils.log("INFO","Entered " + method, isDebugEnabled)
+ logger.info("Entered " + method)
try{
String serviceId = execution.getVariable("serviceInstanceId")
@@ -297,11 +303,11 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor
String progress = execution.getVariable("progress")
String reason = execution.getVariable("operationReason")
String userId = ""
- utils.log("INFO", "progress: " + progress , isDebugEnabled)
+ logger.info( "progress: " + progress )
String operationContent = "Prepare service : " + execution.getVariable("operationStatus")
- utils.log("INFO", "Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId, isDebugEnabled)
+ logger.info( "Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId)
serviceId = UriUtils.encode(serviceId,"UTF-8")
execution.setVariable("serviceInstanceId", serviceId)
execution.setVariable("operationId", operationId)
@@ -309,7 +315,7 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor
def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution)
execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint)
- utils.log("INFO", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled)
+ logger.info( "DB Adapter Endpoint is: " + dbAdapterEndpoint)
String payload =
"""<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
@@ -331,20 +337,20 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor
payload = utils.formatXml(payload)
execution.setVariable("CVFMI_updateServiceOperStatusRequest", payload)
- utils.log("INFO", "Outgoing preUpdateServiceOperationStatus: \n" + payload, isDebugEnabled)
+ logger.error( "Outgoing preUpdateServiceOperationStatus: \n" + payload)
}catch(Exception e){
- utils.log("ERROR", "Exception Occured Processing preUpdateServiceOperationStatus. Exception is:\n" + e, isDebugEnabled)
+ logger.info( "Exception Occured Processing preUpdateServiceOperationStatus. Exception is:\n" + e)
execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preUpdateServiceOperationStatus Method:\n" + e.getMessage())
}
- utils.log("INFO", "======== COMPLETED preUpdateServiceOperationStatus Process ======== ", isDebugEnabled)
- utils.log("INFO", "Exited " + method, isDebugEnabled)
+ logger.info( "======== COMPLETED preUpdateServiceOperationStatus Process ======== ")
+ logger.info( "Exited " + method)
}
public void sendSyncResponse (DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- utils.log("INFO", " *** sendSyncResponse *** ", isDebugEnabled)
+ logger.info( " *** sendSyncResponse *** ")
try {
String operationId = execution.getVariable("operationId")
@@ -359,21 +365,21 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor
updateServiceResp = """{"OperationResult":"No Resource to Add or Delete or Service Instance not found in AAI."}"""
}
- utils.log("INFO", " sendSyncResponse to APIH:" + "\n" + updateServiceResp, isDebugEnabled)
+ logger.info( " sendSyncResponse to APIH:" + "\n" + updateServiceResp)
sendWorkflowResponse(execution, 202, updateServiceResp)
execution.setVariable("sentSyncResponse", true)
} catch (Exception ex) {
String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage()
- utils.log("INFO", msg, isDebugEnabled)
+ logger.info( msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- utils.log("INFO"," ***** Exit sendSyncResopnse *****", isDebugEnabled)
+ logger.info(" ***** Exit sendSyncResopnse *****")
}
public void sendSyncError (DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- utils.log("INFO", " *** sendSyncError *** ", isDebugEnabled)
+ logger.info( " *** sendSyncError *** ")
try {
String errorMessage = ""
@@ -396,14 +402,14 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor
sendWorkflowResponse(execution, 500, buildworkflowException)
} catch (Exception ex) {
- utils.log("INFO", " Sending Sync Error Activity Failed. " + "\n" + ex.getMessage(), isDebugEnabled)
+ logger.info( " Sending Sync Error Activity Failed. " + "\n" + ex.getMessage())
}
}
public void prepareCompletionRequest (DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- utils.log("INFO", " *** prepareCompletion *** ", isDebugEnabled)
+ logger.info( " *** prepareCompletion *** ")
try {
String requestId = execution.getVariable("msoRequestId")
@@ -427,23 +433,23 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor
String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest)
execution.setVariable("completionRequest", xmlMsoCompletionRequest)
- utils.log("INFO", " Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest, isDebugEnabled)
+ logger.info( " Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest)
} catch (Exception ex) {
String msg = " Exception in prepareCompletion:" + ex.getMessage()
- utils.log("INFO", msg, isDebugEnabled)
+ logger.info( msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- utils.log("INFO", "*** Exit prepareCompletionRequest ***", isDebugEnabled)
+ logger.info( "*** Exit prepareCompletionRequest ***")
}
public void prepareFalloutRequest(DelegateExecution execution){
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- utils.log("INFO", " *** prepareFalloutRequest *** ", isDebugEnabled)
+ logger.info( " *** prepareFalloutRequest *** ")
try {
WorkflowException wfex = execution.getVariable("WorkflowException")
- utils.log("INFO", " Input Workflow Exception: " + wfex.toString(), isDebugEnabled)
+ logger.info( " Input Workflow Exception: " + wfex.toString())
String requestId = execution.getVariable("msoRequestId")
String source = execution.getVariable("source")
String requestInfo =
@@ -456,7 +462,7 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor
String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo)
execution.setVariable("falloutRequest", falloutRequest)
} catch (Exception ex) {
- utils.log("INFO", "Exception prepareFalloutRequest:" + ex.getMessage(), isDebugEnabled)
+ logger.info( "Exception prepareFalloutRequest:" + ex.getMessage())
String errorException = " Bpmn error encountered in UpdateCustomE2EServiceInstance flow. FalloutHandlerRequest, buildErrorResponse() - " + ex.getMessage()
String requestId = execution.getVariable("msoRequestId")
String falloutRequest =
@@ -476,6 +482,6 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor
execution.setVariable("falloutRequest", falloutRequest)
}
- utils.log("INFO", "*** Exit prepareFalloutRequest ***", isDebugEnabled)
+ logger.info( "*** Exit prepareFalloutRequest ***")
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateNetworkInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateNetworkInstance.groovy
index 329d58aa58..0b46a5a849 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateNetworkInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateNetworkInstance.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -28,7 +30,8 @@ import org.onap.so.bpmn.common.scripts.ExceptionUtil
import org.onap.so.bpmn.common.scripts.MsoUtils
import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.bpmn.core.json.JsonUtils
-import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
import groovy.json.*
@@ -37,7 +40,7 @@ import groovy.json.*
*
*/
public class UpdateNetworkInstance extends AbstractServiceTaskProcessor {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, UpdateNetworkInstance.class);
+ private static final Logger logger = LoggerFactory.getLogger( UpdateNetworkInstance.class);
String Prefix="UPDNI_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
@@ -70,7 +73,7 @@ public class UpdateNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable("prefix",Prefix)
- msoLogger.trace("Inside preProcessRequest() of UpdateNetworkInstance Request")
+ logger.trace("Inside preProcessRequest() of UpdateNetworkInstance Request")
try {
// initialize flow variables
@@ -85,20 +88,20 @@ public class UpdateNetworkInstance extends AbstractServiceTaskProcessor {
String disableRollback = jsonUtil.getJsonValue(bpmnRequest, "requestDetails.requestInfo.suppressRollback")
if (disableRollback != null) {
execution.setVariable("disableRollback", disableRollback)
- msoLogger.debug("Received 'suppressRollback': " + disableRollback )
+ logger.debug("Received 'suppressRollback': " + disableRollback )
} else {
execution.setVariable("disableRollback", false)
}
- msoLogger.debug(" Set 'disableRollback' : " + execution.getVariable("disableRollback") )
+ logger.debug(" Set 'disableRollback' : " + execution.getVariable("disableRollback") )
} else {
String dataErrorMessage = " Invalid 'bpmnRequest' request."
- msoLogger.debug(dataErrorMessage)
+ logger.debug(dataErrorMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage)
}
} else {
// 'macro' TEST ONLY, sdncVersion = '1702'
- msoLogger.debug(" \'disableRollback\' : " + execution.getVariable("disableRollback") )
+ logger.debug(" \'disableRollback\' : " + execution.getVariable("disableRollback") )
}
String requestId = execution.getVariable("msoRequestId")
@@ -143,7 +146,7 @@ public class UpdateNetworkInstance extends AbstractServiceTaskProcessor {
sendSyncError(execution)
// caught exception
String exceptionMessage = "Exception Encountered in UpdateNetworkInstance, PreProcessRequest() - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
@@ -153,7 +156,7 @@ public class UpdateNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable("prefix",Prefix)
- msoLogger.trace("Inside sendSyncResponse() of UpdateNetworkInstance")
+ logger.trace("Inside sendSyncResponse() of UpdateNetworkInstance")
try {
String requestId = execution.getVariable("mso-request-id")
@@ -162,12 +165,12 @@ public class UpdateNetworkInstance extends AbstractServiceTaskProcessor {
// RESTResponse (for API Handler (APIH) Reply Task)
String updateNetworkRestRequest = """{"requestReferences":{"instanceId":"${serviceInstanceId}","requestId":"${requestId}"}}""".trim()
- msoLogger.debug(" sendSyncResponse to APIH - " + "\n" + updateNetworkRestRequest)
+ logger.debug(" sendSyncResponse to APIH - " + "\n" + updateNetworkRestRequest)
sendWorkflowResponse(execution, 202, updateNetworkRestRequest)
} catch (Exception ex) {
String exceptionMessage = "Bpmn error encountered in UpdateNetworkInstance flow. sendSyncResponse() - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
@@ -178,7 +181,7 @@ public class UpdateNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable("prefix", Prefix)
- msoLogger.trace("Inside getNetworkModelInfo() of UpdateNetworkInstance")
+ logger.trace("Inside getNetworkModelInfo() of UpdateNetworkInstance")
try {
@@ -191,7 +194,7 @@ public class UpdateNetworkInstance extends AbstractServiceTaskProcessor {
} catch (Exception ex) {
sendSyncError(execution)
String exceptionMessage = "Bpmn error encountered in UpdateNetworkInstance flow. getNetworkModelInfo() - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
@@ -203,7 +206,7 @@ public class UpdateNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable("prefix", Prefix)
- msoLogger.trace("Inside sendSyncError() of UpdateNetworkInstance")
+ logger.trace("Inside sendSyncError() of UpdateNetworkInstance")
try {
@@ -216,7 +219,7 @@ public class UpdateNetworkInstance extends AbstractServiceTaskProcessor {
sendWorkflowResponse(execution, 500, syncError)
} catch (Exception ex) {
- msoLogger.debug(" Bpmn error encountered in UpdateNetworkInstance flow. sendSyncError() - " + ex.getMessage())
+ logger.debug(" Bpmn error encountered in UpdateNetworkInstance flow. sendSyncError() - " + ex.getMessage())
}
}
@@ -225,7 +228,7 @@ public class UpdateNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable("prefix",Prefix)
- msoLogger.trace("Inside prepareCompletion() of UpdateNetworkInstance")
+ logger.trace("Inside prepareCompletion() of UpdateNetworkInstance")
try {
@@ -250,11 +253,11 @@ public class UpdateNetworkInstance extends AbstractServiceTaskProcessor {
// normal path
execution.setVariable(Prefix + "Success", true)
execution.setVariable(Prefix + "CompleteMsoProcessRequest", xmlMsoCompletionRequest)
- msoLogger.debug(" Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest)
+ logger.debug(" Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest)
} catch (Exception ex) {
String exceptionMessage = " Bpmn error encountered in UpdateNetworkInstance flow. prepareCompletion() - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
@@ -273,25 +276,25 @@ public class UpdateNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable("prefix", Prefix)
- msoLogger.trace("Inside postProcessResponse() of UpdateNetworkInstance")
+ logger.trace("Inside postProcessResponse() of UpdateNetworkInstance")
try {
if (execution.getVariable("CMSO_ResponseCode") == "200") {
execution.setVariable(Prefix + "Success", true)
- msoLogger.trace("UpdateNetworkInstance Success ")
+ logger.trace("UpdateNetworkInstance Success ")
// Place holder for additional code.
} else {
execution.setVariable(Prefix + "Success", false)
- msoLogger.trace("UpdateNetworkInstance Failed in CompletionMsoProces flow!. ")
+ logger.trace("UpdateNetworkInstance Failed in CompletionMsoProces flow!. ")
}
} catch (Exception ex) {
String exceptionMessage = " Bpmn error encountered in UpdateNetworkInstance flow. postProcessResponse() - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
@@ -307,7 +310,7 @@ public class UpdateNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable("prefix", Prefix)
- msoLogger.trace("Inside processRollbackData() of UpdateNetworkInstance")
+ logger.trace("Inside processRollbackData() of UpdateNetworkInstance")
try {
//execution.getVariable("orchestrationStatus")
@@ -318,7 +321,7 @@ public class UpdateNetworkInstance extends AbstractServiceTaskProcessor {
//rolledBack
} catch (Exception ex) {
- msoLogger.debug(" Bpmn error encountered in UpdateNetworkInstance flow. callDBCatalog() - " + ex.getMessage())
+ logger.debug(" Bpmn error encountered in UpdateNetworkInstance flow. callDBCatalog() - " + ex.getMessage())
}
}
@@ -328,7 +331,7 @@ public class UpdateNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable("prefix", Prefix)
- msoLogger.trace("Prepare for FalloutHandler. FAILURE - prepare request for sub-process FalloutHandler. ")
+ logger.trace("Prepare for FalloutHandler. FAILURE - prepare request for sub-process FalloutHandler. ")
String falloutHandlerRequest = ""
String requestId = execution.getVariable("mso-request-id")
@@ -353,13 +356,13 @@ public class UpdateNetworkInstance extends AbstractServiceTaskProcessor {
</aetgt:WorkflowException>
</aetgt:FalloutHandlerRequest>"""
- msoLogger.debug(falloutHandlerRequest)
+ logger.debug(falloutHandlerRequest)
execution.setVariable(Prefix + "FalloutHandlerRequest", falloutHandlerRequest)
- msoLogger.debug(" Overall Error Response going to FalloutHandler: " + "\n" + falloutHandlerRequest)
+ logger.debug(" Overall Error Response going to FalloutHandler: " + "\n" + falloutHandlerRequest)
} catch (Exception ex) {
String errorException = " Bpmn error encountered in UpdateNetworkInstance flow. FalloutHandlerRequest, buildErrorResponse() - "
- msoLogger.debug("Exception error in UpdateNetworkInstance flow, buildErrorResponse(): " + ex.getMessage())
+ logger.debug("Exception error in UpdateNetworkInstance flow, buildErrorResponse(): " + ex.getMessage())
falloutHandlerRequest =
"""<aetgt:FalloutHandlerRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
xmlns:ns="http://org.onap/so/request/types/v1"
@@ -376,7 +379,7 @@ public class UpdateNetworkInstance extends AbstractServiceTaskProcessor {
</aetgt:FalloutHandlerRequest>"""
execution.setVariable(Prefix + "FalloutHandlerRequest", falloutHandlerRequest)
- msoLogger.debug(" Overall Error Response going to FalloutHandler: " + "\n" + falloutHandlerRequest)
+ logger.debug(" Overall Error Response going to FalloutHandler: " + "\n" + falloutHandlerRequest)
}
@@ -386,18 +389,18 @@ public class UpdateNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable("prefix",Prefix)
try{
- msoLogger.debug("Caught a Java Exception in " + Prefix)
- msoLogger.debug("Started processJavaException Method")
- msoLogger.debug("Variables List: " + execution.getVariables())
+ logger.debug("Caught a Java Exception in " + Prefix)
+ logger.debug("Started processJavaException Method")
+ logger.debug("Variables List: " + execution.getVariables())
execution.setVariable("UnexpectedError", "Caught a Java Lang Exception - " + Prefix) // Adding this line temporarily until this flows error handling gets updated
exceptionUtil.buildWorkflowException(execution, 500, "Caught a Java Lang Exception")
}catch(Exception e){
- msoLogger.debug("Caught Exception during processJavaException Method: " + e)
+ logger.debug("Caught Exception during processJavaException Method: " + e)
execution.setVariable("UnexpectedError", "Exception in processJavaException method - " + Prefix) // Adding this line temporarily until this flows error handling gets updated
exceptionUtil.buildWorkflowException(execution, 500, "Exception in processJavaException method" + Prefix)
}
- msoLogger.debug("Completed processJavaException Method in " + Prefix)
+ logger.debug("Completed processJavaException Method in " + Prefix)
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModule.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModule.groovy
index b1aaf5ea5f..35947ee4da 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModule.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModule.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -28,10 +30,12 @@ import org.onap.so.bpmn.common.scripts.MsoUtils
import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
public class UpdateVfModule extends AbstractServiceTaskProcessor {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, UpdateVfModule.class);
+ private static final Logger logger = LoggerFactory.getLogger( UpdateVfModule.class);
ExceptionUtil exceptionUtil = new ExceptionUtil()
@@ -66,13 +70,13 @@ public class UpdateVfModule extends AbstractServiceTaskProcessor {
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
try {
initProcessVariables(execution)
String request = validateRequest(execution)
- msoLogger.debug("UpdateVfModule request: " + request)
+ logger.debug("UpdateVfModule request: " + request)
def requestInfo = getRequiredNodeXml(execution, request, 'request-info')
execution.setVariable('UPDVfMod_requestInfo', requestInfo)
execution.setVariable('UPDVfMod_requestId', getRequiredNodeText(execution, requestInfo, 'request-id'))
@@ -88,11 +92,13 @@ public class UpdateVfModule extends AbstractServiceTaskProcessor {
def vnfParams = utils.getNodeXml(request, 'vnf-params')
execution.setVariable('UPDVfMod_vnfParams', vnfParams)
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preProcessRequest(): ' + e.getMessage())
}
}
@@ -107,7 +113,7 @@ public class UpdateVfModule extends AbstractServiceTaskProcessor {
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
try {
def requestInfo = execution.getVariable('UPDVfMod_requestInfo')
@@ -140,12 +146,14 @@ public class UpdateVfModule extends AbstractServiceTaskProcessor {
synchResponse = utils.formatXml(synchResponse)
sendWorkflowResponse(execution, 200, synchResponse)
- msoLogger.debug("UpdateVfModule Synch Response: " + synchResponse)
- msoLogger.trace('Exited ' + method)
+ logger.debug("UpdateVfModule Synch Response: " + synchResponse)
+ logger.trace('Exited ' + method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendSynchResponse(): ' + e.getMessage())
}
}
@@ -165,15 +173,17 @@ public class UpdateVfModule extends AbstractServiceTaskProcessor {
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
try {
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepDoUpdateVfModule(): ' + e.getMessage())
}
}
@@ -188,7 +198,7 @@ public class UpdateVfModule extends AbstractServiceTaskProcessor {
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
try {
def requestId = execution.getVariable('UPDVfMod_requestId')
@@ -220,14 +230,16 @@ public class UpdateVfModule extends AbstractServiceTaskProcessor {
updateInfraRequest = utils.formatXml(updateInfraRequest)
execution.setVariable('UPDVfMod_updateInfraRequest', updateInfraRequest)
- msoLogger.debug('Request for Update Infra Request:\n' + updateInfraRequest)
+ logger.debug('Request for Update Infra Request:\n' + updateInfraRequest)
- msoLogger.debug("UpdateVfModule Infra Request: " + updateInfraRequest)
- msoLogger.trace('Exited ' + method)
+ logger.debug("UpdateVfModule Infra Request: " + updateInfraRequest)
+ logger.trace('Exited ' + method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepUpdateInfraRequest(): ' + e.getMessage())
}
}
@@ -244,7 +256,7 @@ public class UpdateVfModule extends AbstractServiceTaskProcessor {
', resultVar=' + resultVar +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
try {
def requestInfo = getVariable(execution, 'UPDVfMod_requestInfo')
@@ -258,15 +270,17 @@ public class UpdateVfModule extends AbstractServiceTaskProcessor {
"""
content = utils.formatXml(content)
- msoLogger.debug(resultVar + ' = ' + System.lineSeparator() + content)
+ logger.debug(resultVar + ' = ' + System.lineSeparator() + content)
execution.setVariable(resultVar, content)
- msoLogger.debug("UpdateVfModule CompletionHandler Request: " + content)
- msoLogger.trace('Exited ' + method)
+ logger.debug("UpdateVfModule CompletionHandler Request: " + content)
+ logger.trace('Exited ' + method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, 'Internal Error')
}
}
@@ -283,7 +297,7 @@ public class UpdateVfModule extends AbstractServiceTaskProcessor {
', resultVar=' + resultVar +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
try {
def prefix = execution.getVariable('prefix')
@@ -311,15 +325,17 @@ public class UpdateVfModule extends AbstractServiceTaskProcessor {
</sdncadapterworkflow:FalloutHandlerRequest>
"""
content = utils.formatXml(content)
- msoLogger.debug(resultVar + ' = ' + System.lineSeparator() + content)
+ logger.debug(resultVar + ' = ' + System.lineSeparator() + content)
execution.setVariable(resultVar, content)
- msoLogger.debug("UpdateVfModule fallOutHandler Request: " + content)
- msoLogger.trace('Exited ' + method)
+ logger.debug("UpdateVfModule fallOutHandler Request: " + content)
+ logger.trace('Exited ' + method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildWorkflowException(execution, 2000, 'Internal Error')
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleInfra.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleInfra.groovy
index 566afb0d9c..b4914c8cd5 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleInfra.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleInfra.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -20,20 +22,21 @@
package org.onap.so.bpmn.infrastructure.scripts
+import groovy.json.JsonOutput
+import groovy.json.JsonSlurper
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
-import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor;
+import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.onap.so.bpmn.common.scripts.ExceptionUtil
import org.onap.so.bpmn.common.scripts.MsoUtils
import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
-
-import groovy.json.JsonOutput
-import groovy.json.JsonSlurper
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
public class UpdateVfModuleInfra extends AbstractServiceTaskProcessor {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, UpdateVfModuleInfra.class);
+ private static final Logger logger = LoggerFactory.getLogger(UpdateVfModuleInfra.class)
ExceptionUtil exceptionUtil = new ExceptionUtil()
@@ -69,7 +72,7 @@ public class UpdateVfModuleInfra extends AbstractServiceTaskProcessor {
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered {}', method)
initProcessVariables(execution)
@@ -77,12 +80,12 @@ public class UpdateVfModuleInfra extends AbstractServiceTaskProcessor {
def incomingRequest = execution.getVariable('bpmnRequest')
- msoLogger.debug("Incoming Infra Request: " + incomingRequest)
+ logger.debug("Incoming Infra Request: {}", incomingRequest)
try {
def jsonSlurper = new JsonSlurper()
def jsonOutput = new JsonOutput()
Map reqMap = jsonSlurper.parseText(incomingRequest)
- msoLogger.debug(" Request is in JSON format.")
+ logger.debug(" Request is in JSON format.")
def serviceInstanceId = execution.getVariable('serviceInstanceId')
def vnfId = execution.getVariable('vnfId')
@@ -130,9 +133,9 @@ public class UpdateVfModuleInfra extends AbstractServiceTaskProcessor {
userParams.each { userParam ->
userParamsMap.put(userParam.name, userParam.value.toString())
}
- }
-
- msoLogger.debug('Processed user params: ' + userParamsMap)
+ }
+
+ logger.debug('Processed user params: {}', userParamsMap)
execution.setVariable(prefix + 'vfModuleInputParams', userParamsMap)
@@ -207,19 +210,20 @@ public class UpdateVfModuleInfra extends AbstractServiceTaskProcessor {
//backoutOnFailure
- msoLogger.debug('RequestInfo: ' + execution.getVariable(prefix + "requestInfo"))
-
- msoLogger.trace('Exited ' + method)
+ logger.debug('RequestInfo: {}', execution.getVariable(prefix + "requestInfo"))
+
+ logger.trace('Exited {}', method)
}
catch(groovy.json.JsonException je) {
- msoLogger.debug(" Request is not in JSON format.")
+ logger.debug(" Request is not in JSON format.")
exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Invalid request format")
}
catch(Exception e) {
String restFaultMessage = e.getMessage()
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Exception Encountered - " + "\n" + restFaultMessage, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} Exception Encountered - \n{}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), restFaultMessage, e)
exceptionUtil.buildAndThrowWorkflowException(execution, 5000, restFaultMessage)
}
}
@@ -234,8 +238,7 @@ public class UpdateVfModuleInfra extends AbstractServiceTaskProcessor {
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
-
+ logger.trace('Entered {}', method)
try {
def requestInfo = execution.getVariable('UPDVfModI_requestInfo')
@@ -256,11 +259,12 @@ public class UpdateVfModuleInfra extends AbstractServiceTaskProcessor {
sendWorkflowResponse(execution, 200, synchResponse)
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited {}', method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage())
}
}
@@ -280,15 +284,16 @@ public class UpdateVfModuleInfra extends AbstractServiceTaskProcessor {
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered {}', method)
try {
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited {}', method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepDoUpdateVfModule(): ' + e.getMessage())
}
}
@@ -303,7 +308,7 @@ public class UpdateVfModuleInfra extends AbstractServiceTaskProcessor {
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered {}', method)
try {
def requestId = execution.getVariable('UPDVfModI_requestId')
@@ -335,13 +340,14 @@ public class UpdateVfModuleInfra extends AbstractServiceTaskProcessor {
updateInfraRequest = utils.formatXml(updateInfraRequest)
execution.setVariable('UPDVfModI_updateInfraRequest', updateInfraRequest)
- msoLogger.debug('Request for Update Infra Request:\n' + updateInfraRequest)
+ logger.debug('Request for Update Infra Request:\n{}', updateInfraRequest)
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited {}', method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepUpdateInfraRequest(): ' + e.getMessage())
}
}
@@ -358,7 +364,7 @@ public class UpdateVfModuleInfra extends AbstractServiceTaskProcessor {
', resultVar=' + resultVar +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered {}', method)
try {
def requestInfo = getVariable(execution, 'UPDVfModI_requestInfo')
@@ -372,14 +378,15 @@ public class UpdateVfModuleInfra extends AbstractServiceTaskProcessor {
"""
content = utils.formatXml(content)
- msoLogger.debug(resultVar + ' = ' + System.lineSeparator() + content)
+ logger.debug('{} = {}{}', resultVar, System.lineSeparator(), content)
execution.setVariable(resultVar, content)
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited {}', method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, 'Internal Error')
}
}
@@ -396,7 +403,7 @@ public class UpdateVfModuleInfra extends AbstractServiceTaskProcessor {
', resultVar=' + resultVar +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered {}', method)
try {
def prefix = execution.getVariable('prefix')
@@ -424,14 +431,15 @@ public class UpdateVfModuleInfra extends AbstractServiceTaskProcessor {
</sdncadapterworkflow:FalloutHandlerRequest>
"""
content = utils.formatXml(content)
- msoLogger.debug(resultVar + ' = ' + System.lineSeparator() + content)
+ logger.debug('{} = {}{}', resultVar, System.lineSeparator(), content)
execution.setVariable(resultVar, content)
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited {}', method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
exceptionUtil.buildWorkflowException(execution, 2000, 'Internal Error')
}
}
@@ -448,7 +456,7 @@ public class UpdateVfModuleInfra extends AbstractServiceTaskProcessor {
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered {}', method)
String processKey = getProcessKey(execution);
def prefix = execution.getVariable("prefix")
@@ -494,13 +502,14 @@ public class UpdateVfModuleInfra extends AbstractServiceTaskProcessor {
utils.logContext(requestId, serviceInstanceId)
*/
- msoLogger.debug('Incoming message: ' + System.lineSeparator() + request)
- msoLogger.trace('Exited ' + method)
+ logger.debug('Incoming message: {}{}', System.lineSeparator(), request)
+ logger.trace('Exited {}', method)
return request
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Invalid Message")
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleInfraV2.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleInfraV2.groovy
index 1a8df1664f..f04fa002fe 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleInfraV2.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleInfraV2.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -19,8 +21,9 @@
*/
package org.onap.so.bpmn.infrastructure.scripts
-
+import groovy.json.JsonOutput
+import groovy.json.JsonSlurper
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.so.bpmn.common.scripts.ExceptionUtil
@@ -28,13 +31,11 @@ import org.onap.so.bpmn.common.scripts.MsoUtils
import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.client.aai.AAIValidatorImpl
import org.onap.so.client.appc.ApplicationControllerClient
-import org.onap.so.logger.MsoLogger
-
-import groovy.json.JsonOutput
-import groovy.json.JsonSlurper
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
public class UpdateVfModuleInfraV2 {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, UpdateVfModuleInfraV2.class);
+ private static final Logger logger = LoggerFactory.getLogger(UpdateVfModuleInfraV2.class)
ExceptionUtil exceptionUtil = new ExceptionUtil()
@@ -79,13 +80,13 @@ public class UpdateVfModuleInfraV2 {
* @param execution The flow's execution instance.
*/
public void preProcessRequest(DelegateExecution execution) {
- System.out.print("*****************************PreProcessRequest**************************")
+ logger.debug("*****************************PreProcessRequest**************************")
def method = getClass().getSimpleName() + '.preProcessRequest(' +
'execution=' + execution.getId() +
')'
- //msoLogger.trace('Entered ' + method)
+ //logger.trace('Entered ' + method)
initProcessVariables(execution)
@@ -93,12 +94,12 @@ public class UpdateVfModuleInfraV2 {
def incomingRequest = execution.getVariable('bpmnRequest')
- //msoLogger.debug("Incoming Infra Request: " + incomingRequest)
+ //logger.debug("Incoming Infra Request: " + incomingRequest)
try {
def jsonSlurper = new JsonSlurper()
def jsonOutput = new JsonOutput()
Map reqMap = jsonSlurper.parseText(incomingRequest)
- //msoLogger.debug(" Request is in JSON format.")
+ //logger.debug(" Request is in JSON format.")
def serviceInstanceId = execution.getVariable('serviceInstanceId')
def vnfId = execution.getVariable('vnfId')
@@ -148,7 +149,7 @@ public class UpdateVfModuleInfraV2 {
}
}
- //msoLogger.debug('Processed user params: ' + userParamsMap)
+ //logger.debug('Processed user params: ' + userParamsMap)
execution.setVariable(prefix + 'vfModuleInputParams', userParamsMap)
@@ -223,18 +224,18 @@ public class UpdateVfModuleInfraV2 {
//backoutOnFailure
- //msoLogger.debug('RequestInfo: ' + execution.getVariable(prefix + "requestInfo"))
+ //logger.debug('RequestInfo: ' + execution.getVariable(prefix + "requestInfo"))
- //msoLogger.trace('Exited ' + method)
+ //logger.trace('Exited ' + method)
}
catch(groovy.json.JsonException je) {
- //msoLogger.debug(" Request is not in JSON format.")
+ //logger.debug(" Request is not in JSON format.")
exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Invalid request format")
}
catch(Exception e) {
String restFaultMessage = e.getMessage()
- //msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Exception Encountered - " + "\n" + restFaultMessage, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ //logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), " Exception Encountered - " + "\n" + restFaultMessage, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 5000, restFaultMessage)
}
}
@@ -245,13 +246,13 @@ public class UpdateVfModuleInfraV2 {
* @param execution The flow's execution instance.
*/
public void sendSynchResponse(DelegateExecution execution) {
- System.out.print("*****************************SendSynchResponse**************************")
+ logger.debug("*****************************SendSynchResponse**************************")
def method = getClass().getSimpleName() + '.sendSynchResponse(' +
'execution=' + execution.getId() +
')'
- //msoLogger.trace('Entered ' + method)
+ //logger.trace('Entered ' + method)
try {
@@ -271,11 +272,11 @@ public class UpdateVfModuleInfraV2 {
def vfModuleId = execution.getVariable("vfModuleId")
String synchResponse = """{"requestReferences":{"instanceId":"${vfModuleId}","requestId":"${requestId}"}}""".trim()
sendWorkflowResponse(execution, 200, synchResponse)
- //msoLogger.trace('Exited ' + method)
+ //logger.trace('Exited ' + method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- //msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ //logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage())
}
}
@@ -283,7 +284,7 @@ public class UpdateVfModuleInfraV2 {
//check to see if the Pserver Flag is locked
public void checkPserverFlag(DelegateExecution execution) {
- System.out.println("*****************************CheckingPserverFlag*************************")
+ logger.debug("*****************************CheckingPserverFlag*************************")
String vnfId = (String)execution.getVariable('vnfId')
AAIValidatorImpl aaiVI = new AAIValidatorImpl()
boolean flag = aaiVI.isPhysicalServerLocked(vnfId)
@@ -292,7 +293,7 @@ public class UpdateVfModuleInfraV2 {
//check to see if the VFFlag is locked
public void vfFlagCheck(DelegateExecution execution) {
- System.out.print("*****************************VfFlagCheck*************************")
+ logger.debug("*****************************VfFlagCheck*************************")
String vnfId = (String)execution.getVariable('vnfId')
AAIValidatorImpl aaiVI = new AAIValidatorImpl()
boolean flag = aaiVI.isVNFLocked(vnfId)
@@ -301,7 +302,7 @@ public class UpdateVfModuleInfraV2 {
//lock the VF Flag
public void vfFlagSet(DelegateExecution execution) {
- System.out.print("*****************************VfFlagSet*************************")
+ logger.debug("*****************************VfFlagSet*************************")
String vnfId = (String)execution.getVariable('vnfId')
String uuid = (String)execution.getVariable('moduleUuid')
AAIValidatorImpl aaiVI = new AAIValidatorImpl()
@@ -312,7 +313,7 @@ public class UpdateVfModuleInfraV2 {
//Lock AppC
public void lockAppC(DelegateExecution execution) {
- System.out.print("*****************************lockAppC*************************")
+ logger.debug("*****************************lockAppC*************************")
def vfModuleId = ""
ApplicationControllerClient aCC = new ApplicationControllerClient(getLCMProperties())
def status = aCC.runCommand("Lock",vfModuleId)
@@ -322,7 +323,7 @@ public class UpdateVfModuleInfraV2 {
//run health check
public void healthCheckAppC(DelegateExecution execution) {
- System.out.print("*****************************healthCheckAppC*************************")
+ logger.debug("*****************************healthCheckAppC*************************")
def vfModuleId = ""
ApplicationControllerClient aCC = new ApplicationControllerClient(getLCMProperties())
def status = aCC.runCommand("HealthCheck",vfModuleId)
@@ -331,14 +332,14 @@ public class UpdateVfModuleInfraV2 {
//SDNO health diagnostic
public void healthDiagnosticSDNO(DelegateExecution execution) {
- System.out.print("*****************************healthDiagnosticSDNO is currently ignored*************************")
+ logger.debug("*****************************healthDiagnosticSDNO is currently ignored*************************")
//SDNOValidatorImpl.healthDiagnostic("","");
}
//stop VF module controller
public void stopVfModuleController(DelegateExecution execution) {
- System.out.print("*****************************stopVfModuleController*************************")
+ logger.debug("*****************************stopVfModuleController*************************")
def vfModuleId = ""
ApplicationControllerClient aCC = new ApplicationControllerClient(getLCMProperties())
def status = aCC.runCommand("Stop",vfModuleId)
@@ -348,20 +349,20 @@ public class UpdateVfModuleInfraV2 {
public void doUpdateVfModulePrep(DelegateExecution execution) {
- System.out.print("*****************************doUpdateVfModulePrep*************************")
+ logger.debug("*****************************doUpdateVfModulePrep*************************")
def method = getClass().getSimpleName() + '.prepDoUpdateVfModule(' +
'execution=' + execution.getId() +
')'
- //msoLogger.trace('Entered ' + method)
+ //logger.trace('Entered ' + method)
try {
- //msoLogger.trace('Exited ' + method)
+ //logger.trace('Exited ' + method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- //msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ //logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepDoUpdateVfModule(): ' + e.getMessage())
}
@@ -370,13 +371,13 @@ public class UpdateVfModuleInfraV2 {
public void completionHandlerPrep(DelegateExecution execution,String resultVar) {
- System.out.print("*****************************completionHandlerPrep*************************")
+ logger.debug("*****************************completionHandlerPrep*************************")
def method = getClass().getSimpleName() + '.completionHandlerPrep(' +
'execution=' + execution.getId() +
', resultVar=' + resultVar +
')'
- //msoLogger.trace('Entered ' + method)
+ //logger.trace('Entered ' + method)
try {
def requestInfo = getVariable(execution, 'UPDVfModI_requestInfo')
@@ -390,14 +391,14 @@ public class UpdateVfModuleInfraV2 {
"""
content = utils.formatXml(content)
- //msoLogger.debug(resultVar + ' = ' + System.lineSeparator() + content)
+ //logger.debug(resultVar + ' = ' + System.lineSeparator() + content)
execution.setVariable(resultVar, content)
- //msoLogger.trace('Exited ' + method)
+ //logger.trace('Exited ' + method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- //msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ //logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, 'Internal Error')
}
@@ -406,7 +407,7 @@ public class UpdateVfModuleInfraV2 {
public void healthCheckController(DelegateExecution execution) {
- System.out.print("*****************************healthCheckController*************************")
+ logger.debug("*****************************healthCheckController*************************")
def vfModuleId = ""
ApplicationControllerClient aCC = new ApplicationControllerClient(getLCMProperties())
def status = aCC.runCommand("HealthCheck",vfModuleId)
@@ -415,7 +416,7 @@ public class UpdateVfModuleInfraV2 {
public void startVfModuleController(DelegateExecution execution) {
- System.out.print("*****************************startVfModuleController*************************")
+ logger.debug("*****************************startVfModuleController*************************")
def vfModuleId = ""
ApplicationControllerClient aCC = new ApplicationControllerClient(getLCMProperties())
def status = aCC.runCommand("Start",vfModuleId)
@@ -424,7 +425,7 @@ public class UpdateVfModuleInfraV2 {
public void vFFlagUnset(DelegateExecution execution) {
- System.out.print("*****************************vFFlagUnset*************************")
+ logger.debug("*****************************vFFlagUnset*************************")
String vnfId = (String)execution.getVariable('vnfId')
String uuid = (String)execution.getVariable('moduleUuid')
AAIValidatorImpl aaiVI = new AAIValidatorImpl()
@@ -435,7 +436,7 @@ public class UpdateVfModuleInfraV2 {
public void unlockAppC(DelegateExecution execution) {
- System.out.print("*****************************unlockAppC*************************")
+ logger.debug("*****************************unlockAppC*************************")
def vfModuleId = ""
ApplicationControllerClient aCC = new ApplicationControllerClient(getLCMProperties())
def status = aCC.runCommand("Unlock",vfModuleId)
@@ -444,7 +445,7 @@ public class UpdateVfModuleInfraV2 {
public void postUpgradeHealthCheckController(DelegateExecution execution) {
- System.out.print("*****************************postUpgradeHealthCheckController*************************")
+ logger.debug("*****************************postUpgradeHealthCheckController*************************")
def vfModuleId = ""
ApplicationControllerClient aCC = new ApplicationControllerClient(getLCMProperties())
def status = aCC.runCommand("HealthCheck",vfModuleId)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolume.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolume.groovy
index 5b1270a947..69bb4fd0c4 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolume.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolume.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -37,10 +39,13 @@ import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.constants.Defaults
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
-import static org.apache.commons.lang.StringUtils.isEmpty
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+
+import static org.apache.commons.lang.StringUtils.isEmpty
class UpdateVfModuleVolume extends VfModuleBase {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, UpdateVfModuleVolume.class)
+ private static final Logger logger = LoggerFactory.getLogger(UpdateVfModuleVolume.class)
ExceptionUtil exceptionUtil = new ExceptionUtil()
@@ -78,7 +83,7 @@ class UpdateVfModuleVolume extends VfModuleBase {
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered {}', method)
try {
initProcessVariables(execution)
@@ -100,12 +105,13 @@ class UpdateVfModuleVolume extends VfModuleBase {
def volumeParams = utils.getNodeXml(request, 'volume-params')
execution.setVariable('UPDVfModVol_volumeParams', volumeParams)
- msoLogger.trace('Exited ' + method)
- msoLogger.debug("UpdateVfModuleVolume request: " + request)
+ logger.trace('Exited {}', method)
+ logger.debug("UpdateVfModuleVolume request: {}", request)
} catch (BpmnError bpmnError) {
throw bpmnError
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e)
+ logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preProcessRequest(): ' + e.getMessage())
}
}
@@ -120,7 +126,7 @@ class UpdateVfModuleVolume extends VfModuleBase {
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered {}', method)
try {
def requestInfo = execution.getVariable('UPDVfModVol_requestInfo')
@@ -152,11 +158,12 @@ class UpdateVfModuleVolume extends VfModuleBase {
synchResponse = utils.formatXml(synchResponse)
sendWorkflowResponse(execution, 200, synchResponse)
- msoLogger.debug("UpdateVfModuleVolume Synch Response: " + synchResponse)
+ logger.debug("UpdateVfModuleVolume Synch Response: {}", synchResponse)
} catch (BpmnError e) {
throw e
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e)
+ logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendSynchResponse(): ' + e.getMessage())
}
}
@@ -172,7 +179,7 @@ class UpdateVfModuleVolume extends VfModuleBase {
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered {}', method)
try {
def volumeGroupId = execution.getVariable('UPDVfModVol_volumeGroupId')
@@ -193,7 +200,8 @@ class UpdateVfModuleVolume extends VfModuleBase {
exceptionUtil.buildAndThrowWorkflowException(execution,2500,"Could not find Tenant Id element in Volume Group with Volume Group Id" + volumeGroupId + ", AIC Cloud Region" + aicCloudRegion)
}
execution.setVariable('UPDVfModVol_volumeGroupTenantId', volumeGroupTenantId)
- msoLogger.debug("Received Tenant Id: " + volumeGroupTenantId + "from AAI for Volume Group with Volume Group Id: " + volumeGroupId + ", AIC Cloud Region" + aicCloudRegion)
+ logger.debug("Received Tenant Id: {} from AAI for Volume Group with Volume Group Id: {}, AIC Cloud Region",
+ volumeGroupTenantId, volumeGroupId, aicCloudRegion)
}else{
exceptionUtil.buildAndThrowWorkflowException(execution,2500,"Could not find Tenant Id element in Volume Group with Volume Group Id" + volumeGroupId + ", AIC Cloud Region" + aicCloudRegion)
}
@@ -201,11 +209,12 @@ class UpdateVfModuleVolume extends VfModuleBase {
}else{
exceptionUtil.buildAndThrowWorkflowException(execution,2500,"Volume Group" + volumeGroupId + " not found at AAI")
}
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited {}', method)
} catch (BpmnError e) {
throw e
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e)
+ logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIForVolumeGroup(): ' + e.getMessage())
}
}
@@ -221,7 +230,7 @@ class UpdateVfModuleVolume extends VfModuleBase {
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered {}', method)
try {
def aicCloudRegion = execution.getVariable('UPDVfModVol_aicCloudRegion')
@@ -266,14 +275,15 @@ class UpdateVfModuleVolume extends VfModuleBase {
"""
vnfAdapterRestRequest = utils.formatXml(vnfAdapterRestRequest)
execution.setVariable('UPDVfModVol_vnfAdapterRestRequest', vnfAdapterRestRequest)
- msoLogger.debug('Request for VNFAdapter Rest:\n' + vnfAdapterRestRequest)
+ logger.debug('Request for VNFAdapter Rest:\n{}', vnfAdapterRestRequest)
- msoLogger.debug("UpdateVfModuleVolume Request for VNFAdapter Rest: " + vnfAdapterRestRequest)
- msoLogger.trace('Exited ' + method)
+ logger.debug("UpdateVfModuleVolume Request for VNFAdapter Rest: {}", vnfAdapterRestRequest)
+ logger.trace('Exited {}', method)
} catch (BpmnError e) {
throw e
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e)
+ logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepVnfAdapterRest(): ' + e.getMessage())
}
}
@@ -288,7 +298,7 @@ class UpdateVfModuleVolume extends VfModuleBase {
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered {}', method)
try {
def requestId = execution.getVariable('UPDVfMod_requestId')
@@ -310,14 +320,15 @@ class UpdateVfModuleVolume extends VfModuleBase {
updateInfraRequest = utils.formatXml(updateInfraRequest)
execution.setVariable('UPDVfModVol_updateInfraRequest', updateInfraRequest)
- msoLogger.debug('Request for Update Infra Request:\n' + updateInfraRequest)
+ logger.debug('Request for Update Infra Request:\n{}', updateInfraRequest)
- msoLogger.debug("UpdateVfModuleVolume Request for Updating DB for Infra: " + updateInfraRequest)
- msoLogger.trace('Exited ' + method)
+ logger.debug("UpdateVfModuleVolume Request for Updating DB for Infra: {}", updateInfraRequest)
+ logger.trace('Exited {}', method)
} catch (BpmnError e) {
throw e
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e)
+ logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
exceptionUtil.buildWorkflowException(execution, 1002, 'Error in prepDbInfraDbRequest(): ' + e.getMessage())
}
}
@@ -332,7 +343,7 @@ class UpdateVfModuleVolume extends VfModuleBase {
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered {}', method)
try {
def requestInfo = execution.getVariable('UPDVfModVol_requestInfo')
@@ -346,15 +357,16 @@ class UpdateVfModuleVolume extends VfModuleBase {
"""
content = utils.formatXml(content)
- msoLogger.debug('Request for Completion Handler:\n' + content)
- msoLogger.debug("UpdateVfModuleVolume Completion Handler request: " + content)
+ logger.debug('Request for Completion Handler:\n{}', content)
+ logger.debug("UpdateVfModuleVolume Completion Handler request: {}", content)
execution.setVariable('UPDVfModVol_CompletionHandlerRequest', content)
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited {}', method)
} catch (BpmnError e) {
throw e
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e)
+ logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepCompletionHandlerRequest(): ' + e.getMessage())
}
}
@@ -369,7 +381,7 @@ class UpdateVfModuleVolume extends VfModuleBase {
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered {}', method)
try {
def requestInfo = execution.getVariable('UPDVfModVol_requestInfo')
@@ -395,15 +407,16 @@ class UpdateVfModuleVolume extends VfModuleBase {
</sdncadapterworkflow:FalloutHandlerRequest>
"""
content = utils.formatXml(content)
- msoLogger.debug('Request for Fallout Handler:\n' + content)
- msoLogger.debug("UpdateVfModuleVolume Fallout request: " + content)
+ logger.debug('Request for Fallout Handler:\n{}', content)
+ logger.debug("UpdateVfModuleVolume Fallout request: {}", content)
execution.setVariable('UPDVfModVol_FalloutHandlerRequest', content)
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited {}', method)
} catch (BpmnError e) {
throw e
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e)
+ logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
exceptionUtil.buildWorkflowException(execution, 1002, 'Error in prepFalloutHandler(): ' + e.getMessage())
}
}
@@ -419,7 +432,7 @@ class UpdateVfModuleVolume extends VfModuleBase {
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered {}', method)
String processKey = getProcessKey(execution)
def volumeGroupId = execution.getVariable('UPDVfModVol_volumeGroupId')
@@ -430,12 +443,13 @@ class UpdateVfModuleVolume extends VfModuleBase {
def String errorMessage = 'TenantId \'' + tenantId + '\' in incoming request does not match Tenant Id \'' + volumeGroupTenantId +
'\' retrieved from AAI for Volume Group Id \'' + volumeGroupId + '\', AIC Cloud Region \'' + aicCloudRegion + '\''
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Error in UpdateVfModuleVol: ' + errorMessage, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception")
+ logger.error("{} {} {} Error in UpdateVfModuleVol: {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), errorMessage)
WorkflowException exception = new WorkflowException(processKey, 5000, errorMessage)
execution.setVariable("WorkflowException", exception)
- msoLogger.trace('Exited ' + method)
- msoLogger.debug("UpdateVfModuleVolume workflowException in Tenant Mismatch: " + errorMessage)
+ logger.trace('Exited ' + method)
+ logger.debug("UpdateVfModuleVolume workflowException in Tenant Mismatch: " + errorMessage)
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy
index 49da398a87..e9121aa420 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -21,6 +23,7 @@
package org.onap.so.bpmn.infrastructure.scripts
import groovy.json.JsonException
+import groovy.json.JsonSlurper
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.aai.domain.yang.GenericVnf
@@ -40,14 +43,15 @@ import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.constants.Defaults
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
-import static org.apache.cxf.common.util.CollectionUtils.isEmpty
-
-import groovy.json.JsonSlurper
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
import javax.ws.rs.core.UriBuilder
+import static org.apache.cxf.common.util.CollectionUtils.isEmpty
+
class UpdateVfModuleVolumeInfraV1 extends VfModuleBase {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, UpdateVfModuleVolumeInfraV1.class)
+ private static final Logger logger = LoggerFactory.getLogger(UpdateVfModuleVolumeInfraV1.class)
private ExceptionUtil exceptionUtil = new ExceptionUtil()
/**
@@ -108,11 +112,11 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase {
def modelInvariantId = reqMap.requestDetails.modelInfo.modelInvariantUuid ?: ''
execution.setVariable('UPDVfModVol_modelInvariantId', modelInvariantId)
- msoLogger.debug("modelInvariantId from request: " + modelInvariantId)
- msoLogger.debug("XML request:\n" + request)
+ logger.debug("modelInvariantId from request: {}", modelInvariantId)
+ logger.debug("XML request:\n{}", request)
}
catch (JsonException je) {
- msoLogger.debug(" Request is in XML format.")
+ logger.debug(" Request is in XML format.")
// assume request is in XML format - proceed as usual to process XML request
}
@@ -186,7 +190,7 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase {
syncResponse = utils.formatXml(xmlSyncResponse)
}
- msoLogger.debug('Sync response: ' + syncResponse)
+ logger.debug('Sync response: {}', syncResponse)
execution.setVariable('UPDVfModVol_syncResponseSent', true)
sendWorkflowResponse(execution, 200, syncResponse)
}
@@ -213,7 +217,8 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase {
if (!isEmpty(tenantURIList)) {
String volumeGroupTenantId = tenantURIList.get(0).getURIKeys().get("tenant-id")
execution.setVariable('UPDVfModVol_volumeGroupTenantId', volumeGroupTenantId)
- msoLogger.debug("Received Tenant Id " + volumeGroupTenantId + " from AAI for Volume Group with Volume Group Id " + volumeGroupId + ", AIC Cloud Region " + aicCloudRegion)
+ logger.debug("Received Tenant Id {} from AAI for Volume Group with Volume Group Id {}, AIC Cloud Region ",
+ volumeGroupTenantId, volumeGroupId, aicCloudRegion)
} else {
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Could not find Tenant Id element in Volume Group with Volume Group Id " + volumeGroupId
+ ", AIC Cloud Region " + aicCloudRegion)
@@ -363,7 +368,7 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase {
"""
vnfAdapterRestRequest = utils.formatXml(vnfAdapterRestRequest)
execution.setVariable('UPDVfModVol_vnfAdapterRestRequest', vnfAdapterRestRequest)
- msoLogger.debug('Request for VNFAdapter Rest:\n' + vnfAdapterRestRequest)
+ logger.debug('Request for VNFAdapter Rest:\n' + vnfAdapterRestRequest)
}
/**
@@ -392,7 +397,7 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase {
updateInfraRequest = utils.formatXml(updateInfraRequest)
execution.setVariable('UPDVfModVol_updateInfraRequest', updateInfraRequest)
- msoLogger.debug('Request for Update Infra Request:\n' + updateInfraRequest)
+ logger.debug('Request for Update Infra Request:\n' + updateInfraRequest)
}
/**
@@ -414,7 +419,7 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase {
"""
content = utils.formatXml(content)
- msoLogger.debug('Request for Completion Handler:\n' + content)
+ logger.debug('Request for Completion Handler:\n' + content)
execution.setVariable('UPDVfModVol_CompletionHandlerRequest', content)
}
@@ -454,7 +459,7 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase {
</sdncadapterworkflow:FalloutHandlerRequest>
"""
content = utils.formatXml(content)
- msoLogger.debug('Request for Fallout Handler:\n' + content)
+ logger.debug('Request for Fallout Handler:\n' + content)
execution.setVariable('UPDVfModVol_FalloutHandlerRequest', content)
}
@@ -474,7 +479,7 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase {
" retrieved from AAI for Volume Group Id " + volumeGroupId + ", AIC Cloud Region " + aicCloudRegion
ExceptionUtil exceptionUtil = new ExceptionUtil()
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Error in UpdateVfModuleVol: ' + errorMessage, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception")
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Error in UpdateVfModuleVol: ' + errorMessage, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception")
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, errorMessage)
}
@@ -492,7 +497,7 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase {
" retrieved from AAI for Volume Group Id "
ExceptionUtil exceptionUtil = new ExceptionUtil()
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Error in UpdateVfModuleVol: ' + errorMessage, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception")
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Error in UpdateVfModuleVol: ' + errorMessage, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception")
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, errorMessage)
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVnfInfra.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVnfInfra.groovy
index f8d73ce020..1a62ad60f9 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVnfInfra.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVnfInfra.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -19,24 +21,27 @@
package org.onap.so.bpmn.infrastructure.scripts
+import groovy.json.JsonOutput
+import groovy.json.JsonSlurper
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
-import org.onap.appc.client.lcm.model.Action;
+import org.onap.appc.client.lcm.model.Action
import org.onap.so.bpmn.common.scripts.ExceptionUtil
import org.onap.so.bpmn.common.scripts.MsoUtils
import org.onap.so.bpmn.core.domain.ModelInfo
import org.onap.so.bpmn.core.domain.ServiceDecomposition
import org.onap.so.bpmn.core.domain.VnfResource
import org.onap.so.bpmn.core.json.JsonUtils
-import org.onap.so.client.aai.*
+import org.onap.so.client.aai.AAIRestClientImpl
+import org.onap.so.client.aai.AAIUpdatorImpl
+import org.onap.so.client.aai.AAIValidatorImpl
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
-
-import groovy.json.JsonOutput
-import groovy.json.JsonSlurper
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
public class UpdateVnfInfra extends VnfCmBase {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, UpdateVnfInfra.class);
+ private static final Logger logger = LoggerFactory.getLogger(UpdateVnfInfra.class)
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtils = new JsonUtils()
@@ -83,18 +88,18 @@ public class UpdateVnfInfra extends VnfCmBase {
')'
initProcessVariables(execution)
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered {}', method)
initProcessVariables(execution)
def incomingRequest = execution.getVariable('bpmnRequest')
- msoLogger.debug("Incoming Infra Request: " + incomingRequest)
+ logger.debug("Incoming Infra Request: {}", incomingRequest)
try {
def jsonSlurper = new JsonSlurper()
def jsonOutput = new JsonOutput()
Map reqMap = jsonSlurper.parseText(incomingRequest)
- msoLogger.debug(" Request is in JSON format.")
+ logger.debug(" Request is in JSON format.")
execution.setVariable("isVidRequest", "true")
execution.setVariable('serviceType', 'Mobility')
@@ -112,12 +117,12 @@ public class UpdateVnfInfra extends VnfCmBase {
if (relatedInstanceList != null) {
relatedInstanceList.each {
if (it.relatedInstance.modelInfo?.modelType == 'service') {
- msoLogger.debug("PROCESSING SERVICE INFO")
+ logger.debug("PROCESSING SERVICE INFO")
asdcServiceModelVersion = it.relatedInstance.modelInfo?.modelVersion
serviceModelInfo = jsonOutput.toJson(it.relatedInstance.modelInfo)
- msoLogger.debug("ServiceModelInfo: " + serviceModelInfo)
+ logger.debug("ServiceModelInfo: {}", serviceModelInfo)
def modelInvariant = jsonUtils.getJsonValue(serviceModelInfo, "modelInvariantUuid")
- msoLogger.debug("modelInvariant: " + modelInvariant)
+ logger.debug("modelInvariant: {}", modelInvariant)
}
}
@@ -128,8 +133,8 @@ public class UpdateVnfInfra extends VnfCmBase {
def vnfModelInfo = jsonOutput.toJson(reqMap.requestDetails?.modelInfo)
execution.setVariable('vnfModelInfo', vnfModelInfo)
def vnfModelInvariantUuid = jsonUtils.getJsonValue(vnfModelInfo, "modelInvariantUuid")
- execution.setVariable('vnfModelInvariantUuid', vnfModelInvariantUuid)
- msoLogger.debug("vnfModelInvariantUuid: " + vnfModelInvariantUuid)
+ execution.setVariable('vnfModelInvariantUuid', vnfModelInvariantUuid)
+ logger.debug("vnfModelInvariantUuid: {}", vnfModelInvariantUuid)
def vnfType = execution.getVariable('vnfType')
execution.setVariable('vnfType', vnfType)
@@ -137,8 +142,8 @@ public class UpdateVnfInfra extends VnfCmBase {
def controllerType = reqMap.requestDetails?.requestParameters?.controllerType
execution.setVariable('controllerType', controllerType)
-
- msoLogger.debug('Controller Type: ' + controllerType)
+
+ logger.debug('Controller Type: {}', controllerType)
def userParams = reqMap.requestDetails?.requestParameters?.userParams
@@ -147,9 +152,9 @@ public class UpdateVnfInfra extends VnfCmBase {
userParams.each { userParam ->
userParamsMap.put(userParam.name, userParam.value.toString())
}
- }
-
- msoLogger.debug('Processed user params: ' + userParamsMap)
+ }
+
+ logger.debug('Processed user params: {}', userParamsMap)
execution.setVariable('vfModuleInputParams', userParamsMap)
@@ -195,21 +200,21 @@ public class UpdateVnfInfra extends VnfCmBase {
<source>${MsoUtils.xmlEscape(source)}</source>
</request-info>"""
- execution.setVariable("requestInfo", requestInfo)
-
- msoLogger.debug('RequestInfo: ' + execution.getVariable("requestInfo"))
-
- msoLogger.trace('Exited ' + method)
+ execution.setVariable("requestInfo", requestInfo)
+
+ logger.debug('RequestInfo: {}', execution.getVariable("requestInfo"))
+ logger.trace('Exited {}', method)
}
catch(groovy.json.JsonException je) {
- msoLogger.debug(" Request is not in JSON format.")
+ logger.debug(" Request is not in JSON format.")
exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Invalid request format")
}
catch(Exception e) {
String restFaultMessage = e.getMessage()
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Exception Encountered - " + "\n" + restFaultMessage, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} Exception Encountered - \n{}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), restFaultMessage, e)
exceptionUtil.buildAndThrowWorkflowException(execution, 5000, restFaultMessage)
}
}
@@ -224,8 +229,7 @@ public class UpdateVnfInfra extends VnfCmBase {
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
-
+ logger.trace('Entered {}', method)
try {
def requestInfo = execution.getVariable('requestInfo')
@@ -246,11 +250,12 @@ public class UpdateVnfInfra extends VnfCmBase {
sendWorkflowResponse(execution, 200, synchResponse)
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited {}', method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage())
}
}
@@ -268,25 +273,25 @@ public class UpdateVnfInfra extends VnfCmBase {
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered {}', method)
try {
ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
String vnfModelInvariantUuid = execution.getVariable('vnfModelInvariantUuid')
- msoLogger.debug("vnfModelInvariantUuid: " + vnfModelInvariantUuid)
+ logger.debug("vnfModelInvariantUuid: {}", vnfModelInvariantUuid)
List<VnfResource> vnfResources = serviceDecomposition.getVnfResources()
for (i in 0..vnfResources.size()-1) {
ModelInfo modelInfo = vnfResources[i].getModelInfo()
String modelInvariantUuidFromDecomposition = modelInfo.getModelInvariantUuid()
- msoLogger.debug("modelInvariantUuidFromDecomposition: " + modelInvariantUuidFromDecomposition)
-
+ logger.debug("modelInvariantUuidFromDecomposition: {}", modelInvariantUuidFromDecomposition)
+
if (vnfModelInvariantUuid.equals(modelInvariantUuidFromDecomposition)) {
VnfResource vnfResourceDecomposition = vnfResources[i]
execution.setVariable('vnfResourceDecomposition', vnfResourceDecomposition)
def nfRole = vnfResourceDecomposition.getNfRole()
execution.setVariable('nfRole', nfRole)
- msoLogger.debug("vnfResourceDecomposition: " + vnfResourceDecomposition.toJsonString())
+ logger.debug("vnfResourceDecomposition: {}", vnfResourceDecomposition.toJsonString())
break
}
else {
@@ -295,11 +300,12 @@ public class UpdateVnfInfra extends VnfCmBase {
}
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited {}', method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in getVnfResourceDecomposition(): ' + e.getMessage())
}
}
@@ -318,7 +324,7 @@ public class UpdateVnfInfra extends VnfCmBase {
execution.setVariable('errorCode', "0")
execution.setVariable("workStep", "checkIfVnfInMaintInAAI")
execution.setVariable("failedActivity", "AAI")
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered {}', method)
try {
AAIRestClientImpl client = new AAIRestClientImpl()
@@ -326,7 +332,7 @@ public class UpdateVnfInfra extends VnfCmBase {
aaiValidator.setClient(client)
def vnfId = execution.getVariable("vnfId")
boolean isInMaint = aaiValidator.isVNFLocked(vnfId)
- msoLogger.debug("isInMaint result: " + isInMaint)
+ logger.debug("isInMaint result: {}", isInMaint)
execution.setVariable('isVnfInMaintenance', isInMaint)
if (isInMaint) {
@@ -335,11 +341,12 @@ public class UpdateVnfInfra extends VnfCmBase {
}
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited {}', method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
//exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfVnfInMaintInAAI(): ' + e.getMessage())
@@ -359,7 +366,7 @@ public class UpdateVnfInfra extends VnfCmBase {
')'
execution.setVariable('errorCode', "0")
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered {}', method)
execution.setVariable("workStep", "checkIfPserversInMaintInAAI")
execution.setVariable("failedActivity", "AAI")
@@ -369,7 +376,7 @@ public class UpdateVnfInfra extends VnfCmBase {
aaiValidator.setClient(client)
def vnfId = execution.getVariable("vnfId")
boolean areLocked = aaiValidator.isPhysicalServerLocked(vnfId)
- msoLogger.debug("areLocked result: " + areLocked)
+ logger.debug("areLocked result: {}", areLocked)
execution.setVariable('arePserversLocked', areLocked)
if (areLocked) {
@@ -377,11 +384,12 @@ public class UpdateVnfInfra extends VnfCmBase {
execution.setVariable("errorText", "pServers are locked in A&AI")
}
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited {}', method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
//exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfPserversInMaintInAAI(): ' + e.getMessage())
@@ -401,7 +409,7 @@ public class UpdateVnfInfra extends VnfCmBase {
')'
execution.setVariable('errorCode', "0")
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered {}', method)
if (inMaint) {
execution.setVariable("workStep", "setVnfInMaintFlagInAAI")
}
@@ -422,12 +430,13 @@ public class UpdateVnfInfra extends VnfCmBase {
else {
aaiUpdator.updateVnfToUnLocked(vnfId)
}
-
- msoLogger.trace('Exited ' + method)
+
+ logger.trace('Exited {}', method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
}
@@ -447,11 +456,10 @@ public class UpdateVnfInfra extends VnfCmBase {
')'
execution.setVariable('errorCode', "0")
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered {}', method)
execution.setVariable("workStep", "doUpdateVnfAndModules")
execution.setVariable("failedActivity", "MSO Update VNF")
- msoLogger.trace('Exited ' + method)
-
+ logger.trace('Exited {}', method)
}
@@ -465,7 +473,7 @@ public class UpdateVnfInfra extends VnfCmBase {
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
def errorText = execution.getVariable("errorText")
def errorCode = execution.getVariable("errorCode")
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfCmBase.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfCmBase.groovy
index 32fc46a84f..01f0e246af 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfCmBase.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfCmBase.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -19,15 +21,16 @@
package org.onap.so.bpmn.infrastructure.scripts
+import groovy.json.JsonSlurper
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.json.JSONArray
import org.json.JSONObject
-import org.onap.appc.client.lcm.model.Action;
+import org.onap.appc.client.lcm.model.Action
import org.onap.appc.client.lcm.model.ActionIdentifiers
import org.onap.appc.client.lcm.model.Flags
import org.onap.appc.client.lcm.model.Status
-import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor;
+import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.onap.so.bpmn.common.scripts.ExceptionUtil
import org.onap.so.bpmn.common.scripts.MsoUtils
import org.onap.so.bpmn.core.WorkflowException
@@ -41,18 +44,18 @@ import org.onap.so.client.aai.entities.Relationships
import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
-import org.onap.so.client.appc.ApplicationControllerClient;
-import org.onap.so.client.appc.ApplicationControllerSupport;
+import org.onap.so.client.appc.ApplicationControllerClient
+import org.onap.so.client.appc.ApplicationControllerSupport
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
-
-import groovy.json.JsonSlurper
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
public abstract class VnfCmBase extends AbstractServiceTaskProcessor {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, VnfCmBase.class);
+ private static final Logger logger = LoggerFactory.getLogger(VnfCmBase.class)
ExceptionUtil exceptionUtil = new ExceptionUtil()
- JsonUtils jsonUtils = new JsonUtils()
+ JsonUtils jsonUtils = new JsonUtils()
def prefix = "VnfIPU_"
/**
@@ -71,8 +74,7 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor {
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
-
+ logger.trace('Entered {}', method)
try {
def requestInfo = execution.getVariable('requestInfo')
@@ -93,11 +95,12 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor {
sendWorkflowResponse(execution, 200, synchResponse)
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited {}', method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage())
}
}
@@ -114,25 +117,25 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor {
def method = getClass().getSimpleName() + '.getVnfResourceDecomposition(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered {}', method)
try {
ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
String vnfModelInvariantUuid = execution.getVariable('vnfModelInvariantUuid')
- msoLogger.debug("vnfModelInvariantUuid: " + vnfModelInvariantUuid)
+ logger.debug("vnfModelInvariantUuid: {}", vnfModelInvariantUuid)
List<VnfResource> vnfResources = serviceDecomposition.getVnfResources()
for (i in 0..vnfResources.size()-1) {
ModelInfo modelInfo = vnfResources[i].getModelInfo()
String modelInvariantUuidFromDecomposition = modelInfo.getModelInvariantUuid()
- msoLogger.debug("modelInvariantUuidFromDecomposition: " + modelInvariantUuidFromDecomposition)
+ logger.debug("modelInvariantUuidFromDecomposition: {}", modelInvariantUuidFromDecomposition)
if (vnfModelInvariantUuid.equals(modelInvariantUuidFromDecomposition)) {
VnfResource vnfResourceDecomposition = vnfResources[i]
execution.setVariable('vnfResourceDecomposition', vnfResourceDecomposition)
- def nfRole = vnfResourceDecomposition.getNfRole()
+ def nfRole = vnfResourceDecomposition.getNfRole()
execution.setVariable('nfRole', nfRole)
- msoLogger.debug("vnfResourceDecomposition: " + vnfResourceDecomposition.toJsonString())
+ logger.debug("vnfResourceDecomposition: {}", vnfResourceDecomposition.toJsonString())
break
}
else {
@@ -141,11 +144,12 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor {
}
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited {}', method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in getVnfResourceDecomposition(): ' + e.getMessage())
}
}
@@ -164,7 +168,7 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor {
execution.setVariable('errorCode', "0")
execution.setVariable("workStep", "checkIfVnfInMaintInAAI")
execution.setVariable("failedActivity", "AAI")
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered {}', method)
try {
AAIRestClientImpl client = new AAIRestClientImpl()
@@ -172,7 +176,7 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor {
aaiValidator.setClient(client)
def vnfId = execution.getVariable("vnfId")
boolean isInMaint = aaiValidator.isVNFLocked(vnfId)
- msoLogger.debug("isInMaint result: " + isInMaint)
+ logger.debug("isInMaint result: {}", isInMaint)
execution.setVariable('isVnfInMaintenance', isInMaint)
if (isInMaint) {
@@ -181,11 +185,12 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor {
}
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited {}', method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
//exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfVnfInMaintInAAI(): ' + e.getMessage())
@@ -203,20 +208,20 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor {
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered {}', method)
try {
def transactionLoggingUuid = UUID.randomUUID().toString()
def vnfId = execution.getVariable("vnfId")
- msoLogger.debug("vnfId is: " + vnfId)
+ logger.debug("vnfId is: {}", vnfId)
def cloudRegionId = execution.getVariable("lcpCloudRegionId")
- msoLogger.debug("cloudRegionId is: " + cloudRegionId)
+ logger.debug("cloudRegionId is: {}", cloudRegionId)
AAIResourcesClient client = new AAIResourcesClient()
AAIUri genericVnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
// Check if this VNF exists
if (!client.exists(genericVnfUri)) {
- msoLogger.debug("VNF with vnfId " + vnfId + " does not exist in A&AI")
+ logger.debug("VNF with vnfId {} does not exist in A&AI", vnfId)
exceptionUtil.buildAndThrowWorkflowException(execution, 404, "VNF with vnfId " + vnfId + " does not exist in A&AI")
}
@@ -225,13 +230,13 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor {
Map<String, Object> result = aaiRW.asMap()
String vnfName = result.get("vnf-name")
- msoLogger.debug("vnfName from A&AI is: " + vnfName)
+ logger.debug("vnfName from A&AI is: {}", vnfName)
execution.setVariable("vnfName", vnfName)
String nfRole = result.get("nf-role")
- msoLogger.debug("nfRole from A&AI is: " + nfRole)
+ logger.debug("nfRole from A&AI is: {}", nfRole)
execution.setVariable("nfRole", nfRole)
String vnfHostIpAddress = result.get("ipv4-oam-address")
- msoLogger.debug("vnfHostIpAddress from A&AI is: " + vnfHostIpAddress)
+ logger.debug("vnfHostIpAddress from A&AI is: {}", vnfHostIpAddress)
execution.setVariable("vnfHostIpAddress", vnfHostIpAddress)
execution.setVariable("vmIdList", null)
if (aaiRW.getRelationships() != null) {
@@ -246,8 +251,8 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor {
String vserverId = j.getURIKeys().get('vserver-id')
String vserverJson = client.get(j).getJson()
- msoLogger.debug("Retrieved vserverJson from AAI: " + vserverJson)
- String vserverSelfLink = jsonUtils.getJsonValue(vserverJson, "vserver-selflink")
+ logger.debug("Retrieved vserverJson from AAI: {}", vserverJson)
+ String vserverSelfLink = jsonUtils.getJsonValue(vserverJson, "vserver-selflink")
vserverIds.put(vserverId)
vserverSelfLinks.put(vserverSelfLink)
@@ -256,10 +261,10 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor {
JSONObject vmidsArray = new JSONObject()
JSONObject vserveridsArray = new JSONObject()
vmidsArray.put("vmIds", vserverSelfLinks.toString())
- vserveridsArray.put("vserverIds", vserverIds.toString())
-
- msoLogger.debug("vmidsArray is: " + vmidsArray.toString())
- msoLogger.debug("vserveridsArray is: " + vserveridsArray.toString())
+ vserveridsArray.put("vserverIds", vserverIds.toString())
+
+ logger.debug("vmidsArray is: {}", vmidsArray.toString())
+ logger.debug("vserveridsArray is: {}", vserveridsArray.toString())
execution.setVariable("vmIdList", vmidsArray.toString())
execution.setVariable("vserverIdList", vserveridsArray.toString())
@@ -270,7 +275,7 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor {
Optional<Relationships> relationships = aaiRW.getRelationships()
if(relationships.isPresent()) {
- msoLogger.debug("relationships are present")
+ logger.debug("relationships are present")
String rs = relationships.get().getJson()
def jsonSlurper = new JsonSlurper()
def map = jsonSlurper.parseText(rs)
@@ -280,25 +285,25 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor {
final String relatedTo = (String)relationship.get("related-to");
if (relatedTo.equals("platform")) {
List<Map<String, Object>> relationshipDataList = (List<Map<String, Object>>)relationship.get("relationship-data")
- msoLogger.debug("Found platform entry")
+ logger.debug("Found platform entry")
for (Map<String, Object> relationshipData : relationshipDataList) {
String relationshipKey = (String)relationshipData.get("relationship-key");
if (relationshipKey.equals("platform.platform-name")) {
String platformName = (String) relationshipData.get("relationship-value")
- msoLogger.debug("platform from A&AI is: " + platformName)
+ logger.debug("platform from A&AI is: {}", platformName)
execution.setVariable("platform", platformName)
- break
+ break
}
- }
+ }
}
if (relatedTo.equals("line-of-business")) {
List<Map<String, Object>> relationshipDataList = (List<Map<String, Object>>)relationship.get("relationship-data")
- msoLogger.debug("Found line-of-business entry")
+ logger.debug("Found line-of-business entry")
for (Map<String, Object> relationshipData : relationshipDataList) {
String relationshipKey = (String)relationshipData.get("relationship-key");
if (relationshipKey.equals("line-of-business.line-of-business-name")) {
String lineOfBusinessName = (String) relationshipData.get("relationship-value")
- msoLogger.debug("lineOfBusiness from A&AI is: " + lineOfBusinessName)
+ logger.debug("lineOfBusiness from A&AI is: {}", lineOfBusinessName)
execution.setVariable("lineOfBusiness", lineOfBusinessName)
break
}
@@ -310,11 +315,12 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor {
}
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited {}', method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIForVnf(): ' + e.getMessage())
}
}
@@ -333,7 +339,7 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor {
')'
execution.setVariable('errorCode', "0")
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered {}', method)
execution.setVariable("workStep", "checkIfPserversInMaintInAAI")
execution.setVariable("failedActivity", "AAI")
@@ -341,21 +347,22 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor {
AAIRestClientImpl client = new AAIRestClientImpl()
AAIValidatorImpl aaiValidator = new AAIValidatorImpl()
aaiValidator.setClient(client)
- def vnfId = execution.getVariable("vnfId")
+ def vnfId = execution.getVariable("vnfId")
boolean areLocked = aaiValidator.isPhysicalServerLocked(vnfId)
- msoLogger.debug("areLocked result: " + areLocked)
+ logger.debug("areLocked result: {}", areLocked)
execution.setVariable('arePserversLocked', areLocked)
if (areLocked) {
execution.setVariable("errorCode", "1003")
execution.setVariable("errorText", "pServers are locked in A&AI")
- }
+ }
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited {}', method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
//exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfPserversInMaintInAAI(): ' + e.getMessage())
@@ -375,7 +382,7 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor {
')'
execution.setVariable('errorCode', "0")
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered {}', method)
if (inMaint) {
execution.setVariable("workStep", "setVnfInMaintFlagInAAI")
}
@@ -396,12 +403,13 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor {
else {
aaiUpdator.updateVnfToUnLocked(vnfId)
}
-
- msoLogger.trace('Exited ' + method)
+
+ logger.trace('Exited {}', method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
}
@@ -421,19 +429,19 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor {
execution.setVariable('errorCode', "0")
execution.setVariable("workStep", "checkClosedLoopDisabledFlagInAAI")
execution.setVariable("failedActivity", "AAI")
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered {}', method)
try {
- def transactionLoggingUuid = UUID.randomUUID().toString()
+ def transactionLoggingUuid = UUID.randomUUID().toString()
def vnfId = execution.getVariable("vnfId")
- msoLogger.debug("vnfId is: " + vnfId)
- AAIResourcesClient client = new AAIResourcesClient()
+ logger.debug("vnfId is: {}", vnfId)
+ AAIResourcesClient client = new AAIResourcesClient()
AAIUri genericVnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
AAIResultWrapper aaiRW = client.get(genericVnfUri)
Map<String, Object> result = aaiRW.asMap()
boolean isClosedLoopDisabled = result.getOrDefault("is-closed-loop-disabled", false)
-
- msoLogger.debug("isClosedLoopDisabled result: " + isClosedLoopDisabled)
+
+ logger.debug("isClosedLoopDisabled result: {}", isClosedLoopDisabled)
execution.setVariable('isClosedLoopDisabled', isClosedLoopDisabled)
if (isClosedLoopDisabled) {
@@ -441,11 +449,12 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor {
execution.setVariable("errorText", "closedLoop is disabled in A&AI")
}
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited {}', method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
}
@@ -473,26 +482,27 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor {
}
execution.setVariable("failedActivity", "AAI")
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered {}', method)
try {
def transactionLoggingUuid = UUID.randomUUID().toString()
def vnfId = execution.getVariable("vnfId")
- AAIResourcesClient client = new AAIResourcesClient()
+ AAIResourcesClient client = new AAIResourcesClient()
AAIUri genericVnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
Map<String, Boolean> request = new HashMap<>()
request.put("is-closed-loop-disabled", setDisabled)
client.update(genericVnfUri, request)
- msoLogger.debug("set isClosedLoop to: " + setDisabled)
+ logger.debug("set isClosedLoop to: {}", setDisabled)
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited {}', method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
execution.setVariable("errorCode", "1002")
- execution.setVariable("errorText", e.getMessage())
+ execution.setVariable("errorText", e.getMessage())
}
}
@@ -512,12 +522,12 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor {
')'
execution.setVariable('errorCode', "0")
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered {}', method)
ApplicationControllerClient appcClient = null
try {
- msoLogger.debug("Running APP-C action: " + action.toString())
+ logger.debug("Running APP-C action: {}", action.toString())
String vnfId = execution.getVariable('vnfId')
String msoRequestId = execution.getVariable('requestId')
execution.setVariable('msoRequestId', msoRequestId)
@@ -557,28 +567,31 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor {
default:
break
}
- msoLogger.debug("Completed AppC request")
+ logger.debug("Completed AppC request")
int appcCode = appcStatus.getCode()
- msoLogger.debug("AppC status code is: " + appcCode)
- msoLogger.debug("AppC status message is: " + appcStatus.getMessage())
+ logger.debug("AppC status code is: {}", appcCode)
+ logger.debug("AppC status message is: {}", appcStatus.getMessage())
if (support.getCategoryOf(appcStatus) == ApplicationControllerSupport.StatusCategory.ERROR) {
execution.setVariable("errorCode", Integer.toString(appcCode))
execution.setVariable("errorText", appcStatus.getMessage())
}
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
} catch (BpmnError e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
} catch (java.lang.NoSuchMethodError e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
@@ -598,7 +611,7 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor {
')'
execution.setVariable('errorCode', "0")
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered {}', method)
execution.setVariable("failedActivity", "APP-C")
execution.setVariable("workStep", action)
}
@@ -621,7 +634,7 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor {
', resultVar=' + resultVar +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered {}', method)
try {
@@ -637,14 +650,15 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor {
"""
content = utils.formatXml(content)
- msoLogger.debug(resultVar + ' = ' + System.lineSeparator() + content)
+ logger.debug('{} = {}{}', resultVar, System.lineSeparator(), content)
execution.setVariable(resultVar, content)
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited {}', method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, 'Internal Error')
}
}
@@ -661,10 +675,10 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor {
')'
execution.setVariable('errorCode', "0")
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered {}', method)
execution.setVariable("workStep", "doUpdateVnfAndModules")
execution.setVariable("failedActivity", "MSO Update VNF")
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited {}', method)
}
@@ -680,7 +694,7 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor {
', resultVar=' + resultVar +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered {}', method)
try {
def prefix = execution.getVariable('prefix')
@@ -707,14 +721,15 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor {
</sdncadapterworkflow:FalloutHandlerRequest>
"""
content = utils.formatXml(content)
- msoLogger.debug(resultVar + ' = ' + System.lineSeparator() + content)
+ logger.debug('{} = {}{}', resultVar, System.lineSeparator(), content)
execution.setVariable(resultVar, content)
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited {}', method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
exceptionUtil.buildWorkflowException(execution, 2000, 'Internal Error')
}
}
@@ -729,7 +744,7 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor {
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered {}', method)
def errorText = execution.getVariable("errorText")
def errorCode = execution.getVariable("errorCode")
@@ -747,7 +762,7 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor {
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered {}', method)
String retryCountVariableName = execution.getVariable("workStep") + "RetryCount"
execution.setVariable("retryCountVariableName", retryCountVariableName)
@@ -762,52 +777,48 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor {
retryCount += 1
execution.setVariable(retryCountVariableName, retryCount)
-
- msoLogger.debug("value of " + retryCountVariableName + " is " + retryCount)
- msoLogger.trace('Exited ' + method)
-
-
- }
+
+ logger.debug("value of {} is {}", retryCountVariableName, retryCount)
+ logger.trace('Exited {}', method)
+ }
- public void preProcessRollback (DelegateExecution execution) {
- msoLogger.trace("preProcessRollback ")
+ public void preProcessRollback (DelegateExecution execution) {
+ logger.trace("preProcessRollback ")
try {
Object workflowException = execution.getVariable("WorkflowException");
if (workflowException instanceof WorkflowException) {
- msoLogger.debug("Prev workflowException: " + workflowException.getErrorMessage())
+ logger.debug("Prev workflowException: {}", workflowException.getErrorMessage())
execution.setVariable("prevWorkflowException", workflowException);
//execution.setVariable("WorkflowException", null);
}
} catch (BpmnError e) {
- msoLogger.debug("BPMN Error during preProcessRollback")
+ logger.debug("BPMN Error during preProcessRollback")
} catch(Exception ex) {
- String msg = "Exception in preProcessRollback. " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug("Exception in preProcessRollback. {}", ex.getMessage())
}
- msoLogger.trace("Exit preProcessRollback ")
+ logger.trace("Exit preProcessRollback ")
}
public void postProcessRollback (DelegateExecution execution) {
- msoLogger.trace("postProcessRollback ")
+ logger.trace("postProcessRollback ")
String msg = ""
try {
Object workflowException = execution.getVariable("prevWorkflowException");
if (workflowException instanceof WorkflowException) {
- msoLogger.debug("Setting prevException to WorkflowException: ")
+ logger.debug("Setting prevException to WorkflowException: ")
execution.setVariable("WorkflowException", workflowException);
}
} catch (BpmnError b) {
- msoLogger.debug("BPMN Error during postProcessRollback")
+ logger.debug("BPMN Error during postProcessRollback")
throw b;
} catch(Exception ex) {
- msg = "Exception in postProcessRollback. " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug("Exception in postProcessRollback. {}", ex.getMessage())
}
- msoLogger.trace("Exit postProcessRollback ")
- }
-
-}
+ logger.trace("Exit postProcessRollback ")
+ }
+
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfConfigUpdate.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfConfigUpdate.groovy
index 89f40ed680..6075f0df96 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfConfigUpdate.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfConfigUpdate.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -19,9 +21,11 @@
package org.onap.so.bpmn.infrastructure.scripts
+import groovy.json.JsonOutput
+import groovy.json.JsonSlurper
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
-import org.onap.appc.client.lcm.model.Action;
+import org.onap.appc.client.lcm.model.Action
import org.onap.so.bpmn.common.scripts.ExceptionUtil
import org.onap.so.bpmn.common.scripts.MsoUtils
import org.onap.so.bpmn.core.json.JsonUtils
@@ -31,15 +35,14 @@ import org.onap.so.client.aai.entities.uri.AAIUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
-
-import groovy.json.JsonOutput
-import groovy.json.JsonSlurper
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
public class VnfConfigUpdate extends VnfCmBase {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, VnfConfigUpdate.class);
+ private static final Logger logger = LoggerFactory.getLogger( VnfConfigUpdate.class)
ExceptionUtil exceptionUtil = new ExceptionUtil()
- JsonUtils jsonUtils = new JsonUtils()
+ JsonUtils jsonUtils = new JsonUtils()
def prefix = "VnfIPU_"
/**
@@ -49,9 +52,9 @@ public class VnfConfigUpdate extends VnfCmBase {
*/
public void initProcessVariables(DelegateExecution execution) {
execution.setVariable('prefix', 'VnfCU_')
- execution.setVariable('Request', null)
- execution.setVariable('source', null)
- execution.setVariable('controllerType', null)
+ execution.setVariable('Request', null)
+ execution.setVariable('source', null)
+ execution.setVariable('controllerType', null)
execution.setVariable('UpdateVnfSuccessIndicator', false)
execution.setVariable('serviceType', null)
execution.setVariable('nfRole', null)
@@ -83,56 +86,56 @@ public class VnfConfigUpdate extends VnfCmBase {
')'
initProcessVariables(execution)
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered {}', method)
- initProcessVariables(execution)
+ initProcessVariables(execution)
def incomingRequest = execution.getVariable('bpmnRequest')
- msoLogger.debug("Incoming Infra Request: " + incomingRequest)
+ logger.debug("Incoming Infra Request: {}", incomingRequest)
try {
def jsonSlurper = new JsonSlurper()
def jsonOutput = new JsonOutput()
Map reqMap = jsonSlurper.parseText(incomingRequest)
- msoLogger.debug(" Request is in JSON format.")
+ logger.debug(" Request is in JSON format.")
def serviceInstanceId = execution.getVariable('serviceInstanceId')
def vnfId = execution.getVariable('vnfId')
-
+
execution.setVariable('serviceInstanceId', serviceInstanceId)
- execution.setVariable('vnfId', vnfId)
+ execution.setVariable('vnfId', vnfId)
execution.setVariable('serviceType', 'Mobility')
execution.setVariable('payload', "")
execution.setVariable('actionHealthCheck', Action.HealthCheck)
- execution.setVariable('actionConfigModify', Action.ConfigModify)
-
+ execution.setVariable('actionConfigModify', Action.ConfigModify)
+
def controllerType = reqMap.requestDetails?.requestParameters?.controllerType
execution.setVariable('controllerType', controllerType)
-
- msoLogger.debug('Controller Type: ' + controllerType)
-
+
+ logger.debug('Controller Type: {}', controllerType)
+
def payload = reqMap.requestDetails?.requestParameters?.payload
execution.setVariable('payload', payload)
-
- msoLogger.debug('Processed payload: ' + payload)
-
+
+ logger.debug('Processed payload: {}', payload)
+
def requestId = execution.getVariable("mso-request-id")
execution.setVariable('requestId', requestId)
- execution.setVariable('msoRequestId', requestId)
-
+ execution.setVariable('msoRequestId', requestId)
+
def requestorId = reqMap.requestDetails?.requestInfo?.requestorId ?: null
execution.setVariable('requestorId', requestorId)
-
+
execution.setVariable('sdncVersion', '1702')
execution.setVariable("UpdateVnfInfraSuccessIndicator", false)
-
-
+
+
def source = reqMap.requestDetails?.requestInfo?.source
execution.setVariable("source", source)
-
+
//For Completion Handler & Fallout Handler
String requestInfo =
"""<request-info xmlns="http://org.onap/so/infra/vnf-request/v1">
@@ -140,24 +143,25 @@ public class VnfConfigUpdate extends VnfCmBase {
<action>UPDATE</action>
<source>${MsoUtils.xmlEscape(source)}</source>
</request-info>"""
-
- execution.setVariable("requestInfo", requestInfo)
-
- msoLogger.debug('RequestInfo: ' + execution.getVariable("requestInfo"))
-
- msoLogger.trace('Exited ' + method)
+
+ execution.setVariable("requestInfo", requestInfo)
+
+ logger.debug('RequestInfo: {}', execution.getVariable("requestInfo"))
+
+ logger.trace('Exited {}', method)
}
catch(groovy.json.JsonException je) {
- msoLogger.debug(" Request is not in JSON format.")
+ logger.debug(" Request is not in JSON format.")
exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Invalid request format")
}
catch(Exception e) {
String restFaultMessage = e.getMessage()
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Exception Encountered - " + "\n" + restFaultMessage, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} Exception Encountered - \n {} \n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), restFaultMessage, e)
exceptionUtil.buildAndThrowWorkflowException(execution, 5000, restFaultMessage)
- }
+ }
}
/**
@@ -170,7 +174,7 @@ public class VnfConfigUpdate extends VnfCmBase {
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered {}', method)
try {
@@ -192,16 +196,17 @@ public class VnfConfigUpdate extends VnfCmBase {
sendWorkflowResponse(execution, 200, synchResponse)
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited {}', method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage())
}
- }
-
-
+ }
+
+
/**
* Check if this VNF is already in maintenance in A&AI.
*
@@ -216,7 +221,7 @@ public class VnfConfigUpdate extends VnfCmBase {
execution.setVariable('errorCode', "0")
execution.setVariable("workStep", "checkIfVnfInMaintInAAI")
execution.setVariable("failedActivity", "AAI")
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered {}', method)
try {
AAIRestClientImpl client = new AAIRestClientImpl()
@@ -224,26 +229,27 @@ public class VnfConfigUpdate extends VnfCmBase {
aaiValidator.setClient(client)
def vnfId = execution.getVariable("vnfId")
boolean isInMaint = aaiValidator.isVNFLocked(vnfId)
- msoLogger.debug("isInMaint result: " + isInMaint)
+ logger.debug("isInMaint result: {}", isInMaint)
execution.setVariable('isVnfInMaintenance', isInMaint)
-
+
if (isInMaint) {
execution.setVariable("errorCode", "1003")
execution.setVariable("errorText", "VNF is in maintenance in A&AI")
}
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited {}', method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
//exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfVnfInMaintInAAI(): ' + e.getMessage())
}
}
-
-
+
+
/**
* Check if this VNF's pservers are locked in A&AI.
*
@@ -256,7 +262,7 @@ public class VnfConfigUpdate extends VnfCmBase {
')'
execution.setVariable('errorCode', "0")
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered {}', method)
execution.setVariable("workStep", "checkIfPserversInMaintInAAI")
execution.setVariable("failedActivity", "AAI")
@@ -264,28 +270,28 @@ public class VnfConfigUpdate extends VnfCmBase {
AAIRestClientImpl client = new AAIRestClientImpl()
AAIValidatorImpl aaiValidator = new AAIValidatorImpl()
aaiValidator.setClient(client)
- def vnfId = execution.getVariable("vnfId")
+ def vnfId = execution.getVariable("vnfId")
boolean areLocked = aaiValidator.isPhysicalServerLocked(vnfId)
- msoLogger.debug("areLocked result: " + areLocked)
+ logger.debug("areLocked result: {}", areLocked)
execution.setVariable('arePserversLocked', areLocked)
-
+
if (areLocked) {
execution.setVariable("errorCode", "1003")
execution.setVariable("errorText", "pServers are locked in A&AI")
}
-
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited {}', method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
//exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfPserversInMaintInAAI(): ' + e.getMessage())
}
}
-
+
/**
* Set inMaint flag for this VNF to the specified value in A&AI.
*
@@ -299,7 +305,7 @@ public class VnfConfigUpdate extends VnfCmBase {
')'
execution.setVariable('errorCode', "0")
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered {}', method)
if (inMaint) {
execution.setVariable("workStep", "setVnfInMaintFlagInAAI")
execution.setVariable("rollbackSetVnfInMaintenanceFlag", true)
@@ -321,17 +327,18 @@ public class VnfConfigUpdate extends VnfCmBase {
else {
aaiUpdator.updateVnfToUnLocked(vnfId)
}
-
- msoLogger.trace('Exited ' + method)
+
+ logger.trace('Exited {}', method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
}
}
-
+
/**
* Check if VF Closed Loop Disabled in A&AI.
*
@@ -346,37 +353,38 @@ public class VnfConfigUpdate extends VnfCmBase {
execution.setVariable('errorCode', "0")
execution.setVariable("workStep", "checkClosedLoopDisabledFlagInAAI")
execution.setVariable("failedActivity", "AAI")
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered {}', method)
try {
def transactionLoggingUuid = UUID.randomUUID().toString()
def vnfId = execution.getVariable("vnfId")
- msoLogger.debug("vnfId is: " + vnfId)
- AAIResourcesClient client = new AAIResourcesClient()
+ logger.debug("vnfId is: {}", vnfId)
+ AAIResourcesClient client = new AAIResourcesClient()
AAIUri genericVnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
AAIResultWrapper aaiRW = client.get(genericVnfUri)
Map<String, Object> result = aaiRW.asMap()
boolean isClosedLoopDisabled = result.getOrDefault("is-closed-loop-disabled", false)
-
- msoLogger.debug("isClosedLoopDisabled result: " + isClosedLoopDisabled)
+
+ logger.debug("isClosedLoopDisabled result: {}", isClosedLoopDisabled)
execution.setVariable('isClosedLoopDisabled', isClosedLoopDisabled)
-
+
if (isClosedLoopDisabled) {
execution.setVariable("errorCode", "1004")
execution.setVariable("errorText", "closedLoop is disabled in A&AI")
}
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited {}', method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
//exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfVnfInMaintInAAI(): ' + e.getMessage())
}
}
-
+
/**
* Set VF Closed Loop Disabled Flag in A&AI.
*
@@ -396,52 +404,52 @@ public class VnfConfigUpdate extends VnfCmBase {
else {
execution.setVariable("workStep", "unsetClosedLoopDisabledFlagInAAI")
}
-
+
execution.setVariable("failedActivity", "AAI")
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered {}', method)
try {
def transactionLoggingUuid = UUID.randomUUID().toString()
def vnfId = execution.getVariable("vnfId")
- AAIResourcesClient client = new AAIResourcesClient()
+ AAIResourcesClient client = new AAIResourcesClient()
AAIUri genericVnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
-
+
Map<String, Boolean> request = new HashMap<>()
request.put("is-closed-loop-disabled", setDisabled)
client.update(genericVnfUri, request)
- msoLogger.debug("set isClosedLoop to: " + setDisabled)
+ logger.debug("set isClosedLoop to: {}", setDisabled)
-
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited {}', method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
//exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfVnfInMaintInAAI(): ' + e.getMessage())
}
- }
+ }
+
-
/**
* Handle Abort disposition from RainyDayHandler
*
- * @param execution The flow's execution instance.
+ * @param execution The flow's execution instance.
*/
public void abortProcessing(DelegateExecution execution) {
def method = getClass().getSimpleName() + '.abortProcessing(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
-
+ logger.trace('Entered {}', method)
+
def errorText = execution.getVariable("errorText")
def errorCode = execution.getVariable("errorCode")
-
+
exceptionUtil.buildAndThrowWorkflowException(execution, errorCode as Integer, errorText)
}
-
+
/**
* Increment Retry Count for Current Work Step
*
@@ -452,28 +460,24 @@ public class VnfConfigUpdate extends VnfCmBase {
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
-
+ logger.trace('Entered {}', method)
+
String retryCountVariableName = execution.getVariable("workStep") + "RetryCount"
execution.setVariable("retryCountVariableName", retryCountVariableName)
-
+
def retryCountVariable = execution.getVariable(retryCountVariableName)
int retryCount = 0
-
+
if (retryCountVariable != null) {
retryCount = (int) retryCountVariable
- }
-
+ }
+
retryCount += 1
-
+
execution.setVariable(retryCountVariableName, retryCount)
-
- msoLogger.debug("value of " + retryCountVariableName + " is " + retryCount)
- msoLogger.trace('Exited ' + method)
-
-
- }
-
-
-
+
+ logger.debug("value of {} is {}", retryCountVariableName, retryCount)
+ logger.trace('Exited {}', method)
+ }
+
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfInPlaceUpdate.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfInPlaceUpdate.groovy
index 84668a5c61..cd89d2a2ef 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfInPlaceUpdate.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfInPlaceUpdate.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -19,6 +21,8 @@
package org.onap.so.bpmn.infrastructure.scripts
+import groovy.json.JsonOutput
+import groovy.json.JsonSlurper
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.appc.client.lcm.model.Action
@@ -32,16 +36,15 @@ import org.onap.so.client.aai.*
import org.onap.so.client.aai.entities.AAIResultWrapper
import org.onap.so.client.aai.entities.uri.AAIUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
-import org.onap.so.client.appc.ApplicationControllerClient;
-import org.onap.so.client.appc.ApplicationControllerSupport;
+import org.onap.so.client.appc.ApplicationControllerClient
+import org.onap.so.client.appc.ApplicationControllerSupport
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
-
-import groovy.json.JsonOutput
-import groovy.json.JsonSlurper
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
public class VnfInPlaceUpdate extends VnfCmBase {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, VnfInPlaceUpdate.class);
+ private static final Logger logger = LoggerFactory.getLogger(VnfInPlaceUpdate.class)
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtils = new JsonUtils()
@@ -90,18 +93,18 @@ public class VnfInPlaceUpdate extends VnfCmBase {
')'
initProcessVariables(execution)
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered {}', method)
initProcessVariables(execution)
def incomingRequest = execution.getVariable('bpmnRequest')
- msoLogger.debug("Incoming Infra Request: " + incomingRequest)
+ logger.debug("Incoming Infra Request: {}", incomingRequest)
try {
def jsonSlurper = new JsonSlurper()
def jsonOutput = new JsonOutput()
Map reqMap = jsonSlurper.parseText(incomingRequest)
- msoLogger.debug(" Request is in JSON format.")
+ logger.debug(" Request is in JSON format.")
def serviceInstanceId = execution.getVariable('serviceInstanceId')
def vnfId = execution.getVariable('vnfId')
@@ -124,14 +127,13 @@ public class VnfInPlaceUpdate extends VnfCmBase {
def controllerType = reqMap.requestDetails?.requestParameters?.controllerType
execution.setVariable('controllerType', controllerType)
-
- msoLogger.debug('Controller Type: ' + controllerType)
+
+ logger.debug('Controller Type: {}', controllerType)
def payload = reqMap.requestDetails?.requestParameters?.payload
execution.setVariable('payload', payload)
- msoLogger.debug('Processed payload: ' + payload)
-
+ logger.debug('Processed payload: {}', payload)
def requestId = execution.getVariable("mso-request-id")
execution.setVariable('requestId', requestId)
@@ -165,18 +167,19 @@ public class VnfInPlaceUpdate extends VnfCmBase {
execution.setVariable("requestInfo", requestInfo)
- msoLogger.debug('RequestInfo: ' + execution.getVariable("requestInfo"))
+ logger.debug('RequestInfo: {}', execution.getVariable("requestInfo"))
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited {}', method)
}
catch(groovy.json.JsonException je) {
- msoLogger.debug(" Request is not in JSON format.")
+ logger.debug(" Request is not in JSON format.")
exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Invalid request format")
}
catch(Exception e) {
String restFaultMessage = e.getMessage()
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Exception Encountered - " + "\n" + restFaultMessage, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} Exception Encountered - {} \n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), restFaultMessage, e)
exceptionUtil.buildAndThrowWorkflowException(execution, 5000, restFaultMessage)
}
}
@@ -191,8 +194,7 @@ public class VnfInPlaceUpdate extends VnfCmBase {
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
-
+ logger.trace('Entered {}', method)
try {
def requestInfo = execution.getVariable('requestInfo')
@@ -213,11 +215,12 @@ public class VnfInPlaceUpdate extends VnfCmBase {
sendWorkflowResponse(execution, 200, synchResponse)
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited {}', method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} Caught exception in {} \n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage())
}
}
@@ -237,7 +240,7 @@ public class VnfInPlaceUpdate extends VnfCmBase {
execution.setVariable('errorCode', "0")
execution.setVariable("workStep", "checkIfVnfInMaintInAAI")
execution.setVariable("failedActivity", "AAI")
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered {}', method)
try {
AAIRestClientImpl client = new AAIRestClientImpl()
@@ -245,7 +248,7 @@ public class VnfInPlaceUpdate extends VnfCmBase {
aaiValidator.setClient(client)
def vnfId = execution.getVariable("vnfId")
boolean isInMaint = aaiValidator.isVNFLocked(vnfId)
- msoLogger.debug("isInMaint result: " + isInMaint)
+ logger.debug("isInMaint result: {}", isInMaint)
execution.setVariable('isVnfInMaintenance', isInMaint)
if (isInMaint) {
@@ -254,11 +257,12 @@ public class VnfInPlaceUpdate extends VnfCmBase {
}
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited {}', method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} Caught exception in {} \n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
//exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfVnfInMaintInAAI(): ' + e.getMessage())
@@ -278,7 +282,7 @@ public class VnfInPlaceUpdate extends VnfCmBase {
')'
execution.setVariable('errorCode', "0")
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered {}', method)
execution.setVariable("workStep", "checkIfPserversInMaintInAAI")
execution.setVariable("failedActivity", "AAI")
@@ -288,7 +292,7 @@ public class VnfInPlaceUpdate extends VnfCmBase {
aaiValidator.setClient(client)
def vnfId = execution.getVariable("vnfId")
boolean areLocked = aaiValidator.isPhysicalServerLocked(vnfId)
- msoLogger.debug("areLocked result: " + areLocked)
+ logger.debug("areLocked result: {}", areLocked)
execution.setVariable('arePserversLocked', areLocked)
if (areLocked) {
@@ -296,11 +300,12 @@ public class VnfInPlaceUpdate extends VnfCmBase {
execution.setVariable("errorText", "pServers are locked in A&AI")
}
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited {}', method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} Caught exception in {} \n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
//exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfPserversInMaintInAAI(): ' + e.getMessage())
@@ -320,7 +325,7 @@ public class VnfInPlaceUpdate extends VnfCmBase {
')'
execution.setVariable('errorCode', "0")
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered {}', method)
if (inMaint) {
execution.setVariable("workStep", "setVnfInMaintFlagInAAI")
}
@@ -342,11 +347,11 @@ public class VnfInPlaceUpdate extends VnfCmBase {
aaiUpdator.updateVnfToUnLocked(vnfId)
}
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited {}', method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
}
@@ -366,19 +371,19 @@ public class VnfInPlaceUpdate extends VnfCmBase {
execution.setVariable('errorCode', "0")
execution.setVariable("workStep", "checkClosedLoopDisabledFlagInAAI")
execution.setVariable("failedActivity", "AAI")
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
try {
def transactionLoggingUuid = UUID.randomUUID().toString()
def vnfId = execution.getVariable("vnfId")
- msoLogger.debug("vnfId is: " + vnfId)
+ logger.debug("vnfId is: " + vnfId)
AAIResourcesClient client = new AAIResourcesClient()
AAIUri genericVnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
AAIResultWrapper aaiRW = client.get(genericVnfUri)
Map<String, Object> result = aaiRW.asMap()
boolean isClosedLoopDisabled = result.getOrDefault("is-closed-loop-disabled", false)
- msoLogger.debug("isClosedLoopDisabled result: " + isClosedLoopDisabled)
+ logger.debug("isClosedLoopDisabled result: " + isClosedLoopDisabled)
execution.setVariable('isClosedLoopDisabled', isClosedLoopDisabled)
if (isClosedLoopDisabled) {
@@ -386,11 +391,11 @@ public class VnfInPlaceUpdate extends VnfCmBase {
execution.setVariable("errorText", "closedLoop is disabled in A&AI")
}
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
}
@@ -417,7 +422,7 @@ public class VnfInPlaceUpdate extends VnfCmBase {
}
execution.setVariable("failedActivity", "AAI")
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
try {
def transactionLoggingUuid = UUID.randomUUID().toString()
@@ -428,13 +433,13 @@ public class VnfInPlaceUpdate extends VnfCmBase {
Map<String, Boolean> request = new HashMap<>()
request.put("is-closed-loop-disabled", setDisabled)
client.update(genericVnfUri, request)
- msoLogger.debug("set isClosedLoop to: " + setDisabled)
+ logger.debug("set isClosedLoop to: " + setDisabled)
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
}
@@ -456,12 +461,12 @@ public class VnfInPlaceUpdate extends VnfCmBase {
')'
execution.setVariable('errorCode', "0")
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
ApplicationControllerClient appcClient = null
try {
- msoLogger.debug("Running APP-C action: " + action.toString())
+ logger.debug("Running APP-C action: " + action.toString())
String vnfId = execution.getVariable('vnfId')
String msoRequestId = execution.getVariable('requestId')
execution.setVariable('msoRequestId', msoRequestId)
@@ -501,26 +506,26 @@ public class VnfInPlaceUpdate extends VnfCmBase {
default:
break
}
- msoLogger.debug("Completed AppC request")
+ logger.debug("Completed AppC request")
int appcCode = appcStatus.getCode()
- msoLogger.debug("AppC status code is: " + appcCode)
- msoLogger.debug("AppC status message is: " + appcStatus.getMessage())
+ logger.debug("AppC status code is: " + appcCode)
+ logger.debug("AppC status message is: " + appcStatus.getMessage())
if (support.getCategoryOf(appcStatus) == ApplicationControllerSupport.StatusCategory.ERROR) {
execution.setVariable("errorCode", Integer.toString(appcCode))
execution.setVariable("errorText", appcStatus.getMessage())
}
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
} catch (BpmnError e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
} catch (java.lang.NoSuchMethodError e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
}
@@ -539,7 +544,7 @@ public class VnfInPlaceUpdate extends VnfCmBase {
')'
execution.setVariable('errorCode', "0")
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
execution.setVariable("failedActivity", "APP-C")
execution.setVariable("workStep", action)
}
@@ -556,7 +561,7 @@ public class VnfInPlaceUpdate extends VnfCmBase {
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
def errorText = execution.getVariable("errorText")
def errorCode = execution.getVariable("errorCode")
@@ -574,7 +579,7 @@ public class VnfInPlaceUpdate extends VnfCmBase {
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
String retryCountVariableName = execution.getVariable("workStep") + "RetryCount"
execution.setVariable("retryCountVariableName", retryCountVariableName)
@@ -590,8 +595,8 @@ public class VnfInPlaceUpdate extends VnfCmBase {
execution.setVariable(retryCountVariableName, retryCount)
- msoLogger.debug("value of " + retryCountVariableName + " is " + retryCount)
- msoLogger.trace('Exited ' + method)
+ logger.debug("value of " + retryCountVariableName + " is " + retryCount)
+ logger.trace('Exited ' + method)
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy
index 13d5aad2b0..0af1bcb00e 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -33,7 +35,9 @@ import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
-import org.springframework.web.util.UriUtils;
+import org.springframework.web.util.UriUtils
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
import groovy.json.*
@@ -46,7 +50,7 @@ import groovy.json.*
*
*/
public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CreateVcpeResCustService.class);
+ private static final Logger logger = LoggerFactory.getLogger(CreateVcpeResCustService.class);
private static final String DebugFlag = "isDebugLogEnabled"
@@ -90,7 +94,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
def isDebugEnabled = execution.getVariable(DebugFlag)
execution.setVariable("prefix", Prefix)
- msoLogger.trace("Inside preProcessRequest CreateVcpeResCustService Request ")
+ logger.trace("Inside preProcessRequest CreateVcpeResCustService Request ")
try {
// initialize flow variables
@@ -100,15 +104,15 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
String aaiDistDelay = UrnPropertiesReader.getVariable("aai.workflowAaiDistributionDelay", execution)
if (isBlank(aaiDistDelay)) {
String msg = "workflowAaiDistributionDelay is null"
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
}
execution.setVariable("aaiDistDelay", aaiDistDelay)
- msoLogger.debug("AAI distribution delay: " + aaiDistDelay)
+ logger.debug("AAI distribution delay: " + aaiDistDelay)
// check for incoming json message/input
String createVcpeServiceRequest = execution.getVariable("bpmnRequest")
- msoLogger.debug(createVcpeServiceRequest)
+ logger.debug(createVcpeServiceRequest)
execution.setVariable("createVcpeServiceRequest", createVcpeServiceRequest);
println 'createVcpeServiceRequest - ' + createVcpeServiceRequest
@@ -120,18 +124,18 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
if ((serviceInstanceId == null) || (serviceInstanceId.isEmpty())) {
serviceInstanceId = UUID.randomUUID().toString()
- msoLogger.debug(" Generated new Service Instance: " + serviceInstanceId)
+ logger.debug(" Generated new Service Instance: " + serviceInstanceId)
} else {
- msoLogger.debug("Using provided Service Instance ID: " + serviceInstanceId)
+ logger.debug("Using provided Service Instance ID: " + serviceInstanceId)
}
serviceInstanceId = UriUtils.encode(serviceInstanceId, "UTF-8")
execution.setVariable("serviceInstanceId", serviceInstanceId)
- utils.log("DEBUG", "Incoming serviceInstanceId is: " + serviceInstanceId, isDebugEnabled)
+ logger.debug("Incoming serviceInstanceId is: " + serviceInstanceId)
String serviceInstanceName = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestInfo.instanceName")
execution.setVariable("serviceInstanceName", serviceInstanceName)
- utils.log("DEBUG", "Incoming serviceInstanceName is: " + serviceInstanceName, isDebugEnabled)
+ logger.debug("Incoming serviceInstanceName is: " + serviceInstanceName)
String requestAction = execution.getVariable("requestAction")
execution.setVariable("requestAction", requestAction)
@@ -160,19 +164,19 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
// extract subscriptionServiceType
String subscriptionServiceType = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestParameters.subscriptionServiceType")
execution.setVariable("subscriptionServiceType", subscriptionServiceType)
- msoLogger.debug("Incoming subscriptionServiceType is: " + subscriptionServiceType)
+ logger.debug("Incoming subscriptionServiceType is: " + subscriptionServiceType)
String suppressRollback = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestInfo.suppressRollback")
execution.setVariable("disableRollback", suppressRollback)
- msoLogger.debug("Incoming Suppress/Disable Rollback is: " + suppressRollback)
+ logger.debug("Incoming Suppress/Disable Rollback is: " + suppressRollback)
String productFamilyId = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestInfo.productFamilyId")
execution.setVariable("productFamilyId", productFamilyId)
- msoLogger.debug("Incoming productFamilyId is: " + productFamilyId)
+ logger.debug("Incoming productFamilyId is: " + productFamilyId)
String subscriberInfo = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.subscriberInfo")
execution.setVariable("subscriberInfo", subscriberInfo)
- msoLogger.debug("Incoming subscriberInfo is: " + subscriberInfo)
+ logger.debug("Incoming subscriberInfo is: " + subscriberInfo)
// extract cloud configuration - if underscore "_" is present treat as vimId else it's a cloudRegion
String vimId = jsonUtil.getJsonValue(createVcpeServiceRequest,
@@ -182,21 +186,21 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
def cloudOwner = cloudRegion[0]
def cloudRegionId = cloudRegion[1]
execution.setVariable("cloudOwner", cloudOwner)
- msoLogger.debug("cloudOwner: " + cloudOwner)
+ logger.debug("cloudOwner: " + cloudOwner)
execution.setVariable("cloudRegionId", cloudRegionId)
- msoLogger.debug("cloudRegionId: " + cloudRegionId)
+ logger.debug("cloudRegionId: " + cloudRegionId)
} else {
- msoLogger.debug("vimId is not present - setting cloudRegion/cloudOwner from request.")
+ logger.debug("vimId is not present - setting cloudRegion/cloudOwner from request.")
String cloudOwner = jsonUtil.getJsonValue(createVcpeServiceRequest,
"requestDetails.cloudConfiguration.cloudOwner")
if (!cloudOwner?.empty && cloudOwner != "")
{
execution.setVariable("cloudOwner", cloudOwner)
- msoLogger.debug("cloudOwner: " + cloudOwner)
+ logger.debug("cloudOwner: " + cloudOwner)
}
def cloudRegionId = vimId
execution.setVariable("cloudRegionId", cloudRegionId)
- msoLogger.debug("cloudRegionId: " + cloudRegionId)
+ logger.debug("cloudRegionId: " + cloudRegionId)
}
/*
* Extracting User Parameters from incoming Request and converting into a Map
@@ -222,8 +226,8 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
execution.setVariable("customerLocation", customerMap)
}
if ("Homing_Model_Ids".equals(userParam?.name)) {
- utils.log("DEBUG", "Homing_Model_Ids: " + userParam.value.toString() + " ---- Type is:" +
- userParam.value.getClass() , isDebugEnabled)
+ logger.debug("Homing_Model_Ids: " + userParam.value.toString() + " ---- Type is:" +
+ userParam.value.getClass())
def modelIdLst = []
userParam.value.each {
param ->
@@ -233,8 +237,8 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
valueMap.put(entry.key, entry.value)
}
modelIdLst.add(valueMap)
- utils.log("DEBUG", "Param: " + param.toString() + " ---- Type is:" +
- param.getClass() , isDebugEnabled)
+ logger.debug("Param: " + param.toString() + " ---- Type is:" +
+ param.getClass())
}
execution.setVariable("homingModelIds", modelIdLst)
}
@@ -252,7 +256,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
inputMap.put("orchestrator", userParam.value)
}
if ("VfModuleNames".equals(userParam?.name)) {
- utils.log("DEBUG", "VfModuleNames: " + userParam.value.toString(), isDebugEnabled)
+ logger.debug("VfModuleNames: " + userParam.value.toString())
def vfModuleNames = [:]
userParam.value.each {
entry ->
@@ -269,8 +273,8 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
if (vfModuleModelInvariantUuid != null && !vfModuleModelInvariantUuid.isEmpty() && vfModuleName != null && !vfModuleName.isEmpty()) {
vfModuleNames.put(vfModuleModelInvariantUuid, vfModuleName)
- utils.log("DEBUG", "VfModuleModelInvariantUuid: " + vfModuleModelInvariantUuid + " VfModuleName: " + vfModuleName, isDebugEnabled)
- }
+ logger.debug("VfModuleModelInvariantUuid: " + vfModuleModelInvariantUuid + " VfModuleName: " + vfModuleName)
+ }
}
execution.setVariable("vfModuleNames", vfModuleNames)
}
@@ -282,10 +286,10 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
execution.setVariable("homingService", "oof")
}
- msoLogger.debug("User Input Parameters map: " + userParams.toString())
+ logger.debug("User Input Parameters map: " + userParams.toString())
execution.setVariable("serviceInputParams", inputMap) // DOES NOT SEEM TO BE USED
- msoLogger.debug("Incoming brgWanMacAddress is: " + execution.getVariable('brgWanMacAddress'))
+ logger.debug("Incoming brgWanMacAddress is: " + execution.getVariable('brgWanMacAddress'))
//For Completion Handler & Fallout Handler
String requestInfo =
@@ -297,7 +301,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
execution.setVariable(Prefix + "requestInfo", requestInfo)
- msoLogger.trace("Completed preProcessRequest CreateVcpeResCustService Request ")
+ logger.trace("Completed preProcessRequest CreateVcpeResCustService Request ")
} catch (BpmnError e) {
throw e;
@@ -310,7 +314,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
public void sendSyncResponse(DelegateExecution execution) {
- msoLogger.trace("Inside sendSyncResponse of CreateVcpeResCustService ")
+ logger.trace("Inside sendSyncResponse of CreateVcpeResCustService ")
try {
String serviceInstanceId = execution.getVariable("serviceInstanceId")
@@ -321,7 +325,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
requestId
}"}}""".trim()
- msoLogger.debug(" sendSynchResponse: xmlSyncResponse - " + "\n" + syncResponse)
+ logger.debug(" sendSynchResponse: xmlSyncResponse - " + "\n" + syncResponse)
sendWorkflowResponse(execution, 202, syncResponse)
} catch (Exception ex) {
@@ -336,7 +340,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
public void prepareDecomposeService(DelegateExecution execution) {
try {
- msoLogger.trace("Inside prepareDecomposeService of CreateVcpeResCustService ")
+ logger.trace("Inside prepareDecomposeService of CreateVcpeResCustService ")
String createVcpeServiceRequest = execution.getVariable("createVcpeServiceRequest")
@@ -344,7 +348,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
String serviceModelInfo = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.modelInfo")
execution.setVariable("serviceModelInfo", serviceModelInfo)
- msoLogger.trace("Completed prepareDecomposeService of CreateVcpeResCustService ")
+ logger.trace("Completed prepareDecomposeService of CreateVcpeResCustService ")
} catch (Exception ex) {
// try error in method block
String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected Error from method prepareDecomposeService() - " + ex.getMessage()
@@ -358,7 +362,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
public void prepareCreateServiceInstance(DelegateExecution execution) {
try {
- msoLogger.trace("Inside prepareCreateServiceInstance of CreateVcpeResCustService ")
+ logger.trace("Inside prepareCreateServiceInstance of CreateVcpeResCustService ")
/*
* Service modelInfo is created in earlier step. This flow can use it as-is ... or, extract from DecompositionObject
@@ -377,7 +381,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
execution.setVariable("serviceDecompositionString", serviceDecomposition.toJsonStringNoRootName())
- msoLogger.trace("Completed prepareCreateServiceInstance of CreateVcpeResCustService ")
+ logger.trace("Completed prepareCreateServiceInstance of CreateVcpeResCustService ")
} catch (Exception ex) {
// try error in method block
String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected Error from method prepareCreateServiceInstance() - " + ex.getMessage()
@@ -387,7 +391,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
public void postProcessServiceInstanceCreate(DelegateExecution execution) {
def method = getClass().getSimpleName() + '.postProcessServiceInstanceCreate(' + 'execution=' + execution.getId() + ')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
String requestId = execution.getVariable("mso-request-id")
String serviceInstanceId = execution.getVariable("serviceInstanceId")
@@ -409,13 +413,15 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
</soapenv:Envelope>
"""
execution.setVariable(Prefix + "setUpdateDbInstancePayload", payload)
- msoLogger.debug(Prefix + "setUpdateDbInstancePayload: " + payload)
- msoLogger.trace('Exited ' + method)
+ logger.debug(Prefix + "setUpdateDbInstancePayload: " + payload)
+ logger.trace('Exited ' + method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method)
}
}
@@ -423,7 +429,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
public void processDecomposition(DelegateExecution execution) {
- msoLogger.trace("Inside processDecomposition() of CreateVcpeResCustService ")
+ logger.trace("Inside processDecomposition() of CreateVcpeResCustService ")
try {
@@ -440,7 +446,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
String vnfModelInfoString = ""
if (vnfList != null && vnfList.size() > 0) {
execution.setVariable(Prefix + "VNFsCount", vnfList.size())
- msoLogger.debug("vnfs to create: " + vnfList.size())
+ logger.debug("vnfs to create: " + vnfList.size())
ModelInfo vnfModelInfo = vnfList[0].getModelInfo()
vnfModelInfoString = vnfModelInfo.toString()
@@ -448,18 +454,18 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
vnfModelInfoString = jsonUtil.getJsonValue(vnfModelInfoWithRoot, "modelInfo")
} else {
execution.setVariable(Prefix + "VNFsCount", 0)
- msoLogger.debug("no vnfs to create based upon serviceDecomposition content")
+ logger.debug("no vnfs to create based upon serviceDecomposition content")
}
execution.setVariable("vnfModelInfo", vnfModelInfoString)
execution.setVariable("vnfModelInfoString", vnfModelInfoString)
- msoLogger.debug(" vnfModelInfoString :" + vnfModelInfoString)
+ logger.debug(" vnfModelInfoString :" + vnfModelInfoString)
- msoLogger.trace("Completed processDecomposition() of CreateVcpeResCustService ")
+ logger.trace("Completed processDecomposition() of CreateVcpeResCustService ")
} catch (Exception ex) {
sendSyncError(execution)
String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. processDecomposition() - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
}
@@ -486,7 +492,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
public void prepareCreateAllottedResourceTXC(DelegateExecution execution) {
try {
- msoLogger.trace("Inside prepareCreateAllottedResourceTXC of CreateVcpeResCustService ")
+ logger.trace("Inside prepareCreateAllottedResourceTXC of CreateVcpeResCustService ")
/*
* Service modelInfo is created in earlier step. This flow can use it as-is ... or, extract from DecompositionObject
@@ -506,8 +512,8 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
while (iter.hasNext()) {
AllottedResource allottedResource = (AllottedResource) iter.next();
- msoLogger.debug(" getting model info for AllottedResource # :" + allottedResource.toJsonStringNoRootName())
- msoLogger.debug(" allottedResource.getAllottedResourceType() :" + allottedResource.getAllottedResourceType())
+ logger.debug(" getting model info for AllottedResource # :" + allottedResource.toJsonStringNoRootName())
+ logger.debug(" allottedResource.getAllottedResourceType() :" + allottedResource.getAllottedResourceType())
if ("TunnelXConn".equalsIgnoreCase(allottedResource.getAllottedResourceType()) || "Tunnel XConn".equalsIgnoreCase(allottedResource.getAllottedResourceType())) {
//set create flag to true
execution.setVariable("createTXCAR", true)
@@ -525,9 +531,9 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
//unit test only
String allottedResourceId = execution.getVariable("allottedResourceId")
execution.setVariable("allottedResourceIdTXC", allottedResourceId)
- msoLogger.debug("setting allottedResourceId CreateVcpeResCustService " + allottedResourceId)
+ logger.debug("setting allottedResourceId CreateVcpeResCustService " + allottedResourceId)
- msoLogger.trace("Completed prepareCreateAllottedResourceTXC of CreateVcpeResCustService ")
+ logger.trace("Completed prepareCreateAllottedResourceTXC of CreateVcpeResCustService ")
} catch (Exception ex) {
// try error in method block
String exceptionMessage = "Bpmn error encountered in prepareCreateAllottedResourceTXC flow. Unexpected Error from method prepareCreateServiceInstance() - " + ex.getMessage()
@@ -538,7 +544,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
public void prepareCreateAllottedResourceBRG(DelegateExecution execution) {
try {
- msoLogger.trace("Inside prepareCreateAllottedResourceBRG of CreateVcpeResCustService ")
+ logger.trace("Inside prepareCreateAllottedResourceBRG of CreateVcpeResCustService ")
/*
* Service modelInfo is created in earlier step. This flow can use it as-is ... or, extract from DecompositionObject
@@ -558,8 +564,8 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
while (iter.hasNext()) {
AllottedResource allottedResource = (AllottedResource) iter.next();
- msoLogger.debug(" getting model info for AllottedResource # :" + allottedResource.toJsonStringNoRootName())
- msoLogger.debug(" allottedResource.getAllottedResourceType() :" + allottedResource.getAllottedResourceType())
+ logger.debug(" getting model info for AllottedResource # :" + allottedResource.toJsonStringNoRootName())
+ logger.debug(" allottedResource.getAllottedResourceType() :" + allottedResource.getAllottedResourceType())
if ("BRG".equalsIgnoreCase(allottedResource.getAllottedResourceType())) {
//set create flag to true
execution.setVariable("createBRGAR", true)
@@ -577,9 +583,9 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
//unit test only
String allottedResourceId = execution.getVariable("allottedResourceId")
execution.setVariable("allottedResourceIdBRG", allottedResourceId)
- msoLogger.debug("setting allottedResourceId CreateVcpeResCustService " + allottedResourceId)
+ logger.debug("setting allottedResourceId CreateVcpeResCustService " + allottedResourceId)
- msoLogger.trace("Completed prepareCreateAllottedResourceBRG of CreateVcpeResCustService ")
+ logger.trace("Completed prepareCreateAllottedResourceBRG of CreateVcpeResCustService ")
} catch (Exception ex) {
// try error in method block
String exceptionMessage = "Bpmn error encountered in prepareCreateAllottedResourceBRG flow. Unexpected Error from method prepareCreateServiceInstance() - " + ex.getMessage()
@@ -593,7 +599,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
public void prepareVnfAndModulesCreate(DelegateExecution execution) {
try {
- msoLogger.trace("Inside prepareVnfAndModulesCreate of CreateVcpeResCustService ")
+ logger.trace("Inside prepareVnfAndModulesCreate of CreateVcpeResCustService ")
// String disableRollback = execution.getVariable("disableRollback")
// def backoutOnFailure = ""
@@ -609,7 +615,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
String createVcpeServiceRequest = execution.getVariable("createVcpeServiceRequest")
String productFamilyId = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestInfo.productFamilyId")
execution.setVariable("productFamilyId", productFamilyId)
- msoLogger.debug("productFamilyId: " + productFamilyId)
+ logger.debug("productFamilyId: " + productFamilyId)
List<VnfResource> vnfList = execution.getVariable("vnfList")
@@ -617,9 +623,9 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
String vnfModelInfoString = null;
if (vnfList != null && vnfList.size() > 0) {
- msoLogger.debug("getting model info for vnf # " + vnfsCreatedCount)
+ logger.debug("getting model info for vnf # " + vnfsCreatedCount)
ModelInfo vnfModelInfo1 = vnfList[0].getModelInfo()
- msoLogger.debug("got 0 ")
+ logger.debug("got 0 ")
ModelInfo vnfModelInfo = vnfList[vnfsCreatedCount.intValue()].getModelInfo()
vnfModelInfoString = vnfModelInfo.toString()
} else {
@@ -627,7 +633,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
vnfModelInfoString = execution.getVariable("vnfModelInfo")
}
- msoLogger.debug(" vnfModelInfoString :" + vnfModelInfoString)
+ logger.debug(" vnfModelInfoString :" + vnfModelInfoString)
// extract cloud configuration - if underscore "_" is present treat as vimId else it's a cloudRegion
String vimId = jsonUtil.getJsonValue(createVcpeServiceRequest,
@@ -635,35 +641,35 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
if (vimId.contains("_") && vimId.split("_").length == 2 ) {
def cloudRegion = vimId.split("_")
execution.setVariable("cloudOwner", cloudRegion[0])
- msoLogger.debug("cloudOwner: " + cloudRegion[0])
+ logger.debug("cloudOwner: " + cloudRegion[0])
execution.setVariable("cloudRegionId", cloudRegion[1])
- msoLogger.debug("cloudRegionId: " + cloudRegion[1])
+ logger.debug("cloudRegionId: " + cloudRegion[1])
execution.setVariable("lcpCloudRegionId", cloudRegion[1])
- msoLogger.debug("lcpCloudRegionId: " + cloudRegion[1])
+ logger.debug("lcpCloudRegionId: " + cloudRegion[1])
} else {
- msoLogger.debug("vimId is not present - setting cloudRegion/cloudOwner from request.")
+ logger.debug("vimId is not present - setting cloudRegion/cloudOwner from request.")
String cloudOwner = jsonUtil.getJsonValue(createVcpeServiceRequest,
"requestDetails.cloudConfiguration.cloudOwner")
if (!cloudOwner?.empty && cloudOwner != "")
{
execution.setVariable("cloudOwner", cloudOwner)
- msoLogger.debug("cloudOwner: " + cloudOwner)
+ logger.debug("cloudOwner: " + cloudOwner)
}
execution.setVariable("cloudRegionId", vimId)
- msoLogger.debug("cloudRegionId: " + vimId)
+ logger.debug("cloudRegionId: " + vimId)
execution.setVariable("lcpCloudRegionId", vimId)
- msoLogger.debug("lcpCloudRegionId: " + vimId)
+ logger.debug("lcpCloudRegionId: " + vimId)
}
String tenantId = jsonUtil.getJsonValue(createVcpeServiceRequest,
"requestDetails.cloudConfiguration.tenantId")
execution.setVariable("tenantId", tenantId)
- msoLogger.debug("tenantId: " + tenantId)
+ logger.debug("tenantId: " + tenantId)
String sdncVersion = execution.getVariable("sdncVersion")
- msoLogger.debug("sdncVersion: " + sdncVersion)
+ logger.debug("sdncVersion: " + sdncVersion)
- msoLogger.trace("Completed prepareVnfAndModulesCreate of CreateVcpeResCustService ")
+ logger.trace("Completed prepareVnfAndModulesCreate of CreateVcpeResCustService ")
} catch (Exception ex) {
// try error in method block
String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected Error from method prepareVnfAndModulesCreate() - " + ex.getMessage()
@@ -677,14 +683,14 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
public void validateVnfCreate(DelegateExecution execution) {
try {
- msoLogger.trace("Inside validateVnfCreate of CreateVcpeResCustService ")
+ logger.trace("Inside validateVnfCreate of CreateVcpeResCustService ")
Integer vnfsCreatedCount = execution.getVariable(Prefix + "VnfsCreatedCount")
vnfsCreatedCount++
execution.setVariable(Prefix + "VnfsCreatedCount", vnfsCreatedCount)
- msoLogger.debug(" ***** Completed validateVnfCreate of CreateVcpeResCustService ***** " + " vnf # " + vnfsCreatedCount)
+ logger.debug(" ***** Completed validateVnfCreate of CreateVcpeResCustService ***** " + " vnf # " + vnfsCreatedCount)
} catch (Exception ex) {
// try error in method block
String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected Error from method validateVnfCreate() - " + ex.getMessage()
@@ -697,7 +703,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
// *****************************************
public void postProcessResponse(DelegateExecution execution) {
- msoLogger.trace("Inside postProcessResponse of CreateVcpeResCustService ")
+ logger.trace("Inside postProcessResponse of CreateVcpeResCustService ")
try {
String source = execution.getVariable("source")
@@ -720,10 +726,10 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
// Format Response
String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest)
- msoLogger.debug(xmlMsoCompletionRequest)
+ logger.debug(xmlMsoCompletionRequest)
execution.setVariable(Prefix + "Success", true)
execution.setVariable(Prefix + "CompleteMsoProcessRequest", xmlMsoCompletionRequest)
- msoLogger.debug(" SUCCESS flow, going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest)
+ logger.debug(" SUCCESS flow, going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest)
} catch (BpmnError e) {
throw e;
} catch (Exception ex) {
@@ -734,53 +740,53 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
}
public void preProcessRollback(DelegateExecution execution) {
- msoLogger.trace("preProcessRollback of CreateVcpeResCustService ")
+ logger.trace("preProcessRollback of CreateVcpeResCustService ")
try {
Object workflowException = execution.getVariable("WorkflowException");
if (workflowException instanceof WorkflowException) {
- msoLogger.debug("Prev workflowException: " + workflowException.getErrorMessage())
+ logger.debug("Prev workflowException: " + workflowException.getErrorMessage())
execution.setVariable("prevWorkflowException", workflowException);
//execution.setVariable("WorkflowException", null);
}
} catch (BpmnError e) {
- msoLogger.debug("BPMN Error during preProcessRollback")
+ logger.debug("BPMN Error during preProcessRollback")
} catch (Exception ex) {
String msg = "Exception in preProcessRollback. " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
}
- msoLogger.trace("Exit preProcessRollback of CreateVcpeResCustService ")
+ logger.trace("Exit preProcessRollback of CreateVcpeResCustService ")
}
public void postProcessRollback(DelegateExecution execution) {
- msoLogger.trace("postProcessRollback of CreateVcpeResCustService ")
+ logger.trace("postProcessRollback of CreateVcpeResCustService ")
String msg = ""
try {
Object workflowException = execution.getVariable("prevWorkflowException");
if (workflowException instanceof WorkflowException) {
- msoLogger.debug("Setting prevException to WorkflowException: ")
+ logger.debug("Setting prevException to WorkflowException: ")
execution.setVariable("WorkflowException", workflowException);
}
} catch (BpmnError b) {
- msoLogger.debug("BPMN Error during postProcessRollback")
+ logger.debug("BPMN Error during postProcessRollback")
throw b;
} catch (Exception ex) {
msg = "Exception in postProcessRollback. " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
}
- msoLogger.trace("Exit postProcessRollback of CreateVcpeResCustService ")
+ logger.trace("Exit postProcessRollback of CreateVcpeResCustService ")
}
public void prepareFalloutRequest(DelegateExecution execution) {
- msoLogger.trace("STARTED CreateVcpeResCustService prepareFalloutRequest Process ")
+ logger.trace("STARTED CreateVcpeResCustService prepareFalloutRequest Process ")
try {
WorkflowException wfex = execution.getVariable("WorkflowException")
- msoLogger.debug(" Incoming Workflow Exception: " + wfex.toString())
+ logger.debug(" Incoming Workflow Exception: " + wfex.toString())
String requestInfo = execution.getVariable(Prefix + "requestInfo")
- msoLogger.debug(" Incoming Request Info: " + requestInfo)
+ logger.debug(" Incoming Request Info: " + requestInfo)
//TODO. hmmm. there is no way to UPDATE error message.
// String errorMessage = wfex.getErrorMessage()
@@ -796,17 +802,17 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
execution.setVariable(Prefix + "falloutRequest", falloutRequest)
} catch (Exception ex) {
- msoLogger.debug("Error Occured in CreateVcpeResCustService prepareFalloutRequest Process " + ex.getMessage())
+ logger.debug("Error Occured in CreateVcpeResCustService prepareFalloutRequest Process " + ex.getMessage())
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in CreateVcpeResCustService prepareFalloutRequest Process")
}
- msoLogger.trace("COMPLETED CreateVcpeResCustService prepareFalloutRequest Process ")
+ logger.trace("COMPLETED CreateVcpeResCustService prepareFalloutRequest Process ")
}
public void sendSyncError(DelegateExecution execution) {
execution.setVariable("prefix", Prefix)
- msoLogger.trace("Inside sendSyncError() of CreateVcpeResCustService ")
+ logger.trace("Inside sendSyncError() of CreateVcpeResCustService ")
try {
String errorMessage = ""
@@ -823,31 +829,33 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
<aetgt:ErrorCode>7000</aetgt:ErrorCode>
</aetgt:WorkflowException>"""
- msoLogger.debug(buildworkflowException)
+ logger.debug(buildworkflowException)
sendWorkflowResponse(execution, 500, buildworkflowException)
} catch (Exception ex) {
- msoLogger.debug(" Sending Sync Error Activity Failed. " + "\n" + ex.getMessage())
+ logger.debug(" Sending Sync Error Activity Failed. " + "\n" + ex.getMessage())
}
}
public void processJavaException(DelegateExecution execution) {
execution.setVariable("prefix", Prefix)
try {
- msoLogger.debug("Caught a Java Exception")
- msoLogger.debug("Started processJavaException Method")
- msoLogger.debug("Variables List: " + execution.getVariables())
+ logger.debug("Caught a Java Exception")
+ logger.debug("Started processJavaException Method")
+ logger.debug("Variables List: " + execution.getVariables())
execution.setVariable(Prefix + "unexpectedError", "Caught a Java Lang Exception")
// Adding this line temporarily until this flows error handling gets updated
exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Caught a Java Lang Exception")
} catch (BpmnError b) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Rethrowing MSOWorkflowException", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Rethrowing MSOWorkflowException", "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue());
throw b
} catch (Exception e) {
- msoLogger.debug("Caught Exception during processJavaException Method: " + e)
+ logger.debug("Caught Exception during processJavaException Method: " + e)
execution.setVariable(Prefix + "unexpectedError", "Exception in processJavaException method")
// Adding this line temporarily until this flows error handling gets updated
exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Exception in processJavaException method")
}
- msoLogger.debug("Completed processJavaException Method")
+ logger.debug("Completed processJavaException Method")
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy
index 7a40ef978b..d2b727b537 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -23,12 +25,15 @@ import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.onap.so.bpmn.common.scripts.ExceptionUtil
+import org.onap.so.bpmn.common.scripts.MsoUtils
import org.onap.so.bpmn.common.scripts.NetworkUtils
import org.onap.so.bpmn.common.scripts.VidUtils
import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
import org.onap.so.client.aai.AAIResourcesClient
import org.onap.so.client.aai.AAIObjectType
@@ -45,7 +50,7 @@ import javax.ws.rs.NotFoundException
*
*/
public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DeleteVcpeResCustService.class);
+ private static final Logger logger = LoggerFactory.getLogger(DeleteVcpeResCustService.class);
private static final String DebugFlag = "isDebugLogEnabled"
@@ -79,7 +84,7 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor {
def isDebugEnabled=execution.getVariable(DebugFlag)
execution.setVariable("prefix",Prefix)
- msoLogger.trace("Inside preProcessRequest DeleteVcpeResCustService Request ")
+ logger.trace("Inside preProcessRequest DeleteVcpeResCustService Request ")
try {
// initialize flow variables
@@ -87,7 +92,7 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor {
// check for incoming json message/input
String DeleteVcpeResCustServiceRequest = execution.getVariable("bpmnRequest")
- msoLogger.debug(DeleteVcpeResCustServiceRequest)
+ logger.debug(DeleteVcpeResCustServiceRequest)
execution.setVariable("DeleteVcpeResCustServiceRequest", DeleteVcpeResCustServiceRequest);
println 'DeleteVcpeResCustServiceRequest - ' + DeleteVcpeResCustServiceRequest
@@ -120,34 +125,34 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor {
String suppressRollback = jsonUtil.getJsonValue(DeleteVcpeResCustServiceRequest, "requestDetails.requestInfo.suppressRollback")
execution.setVariable("disableRollback", suppressRollback)
- msoLogger.debug("Incoming Suppress/Disable Rollback is: " + suppressRollback)
+ logger.debug("Incoming Suppress/Disable Rollback is: " + suppressRollback)
String productFamilyId = jsonUtil.getJsonValue(DeleteVcpeResCustServiceRequest, "requestDetails.requestInfo.productFamilyId")
execution.setVariable("productFamilyId", productFamilyId)
- msoLogger.debug("Incoming productFamilyId is: " + productFamilyId)
+ logger.debug("Incoming productFamilyId is: " + productFamilyId)
// extract subscriptionServiceType
String subscriptionServiceType = jsonUtil.getJsonValue(DeleteVcpeResCustServiceRequest, "requestDetails.requestParameters.subscriptionServiceType")
execution.setVariable("subscriptionServiceType", subscriptionServiceType)
- msoLogger.debug("Incoming subscriptionServiceType is: " + subscriptionServiceType)
+ logger.debug("Incoming subscriptionServiceType is: " + subscriptionServiceType)
// extract cloud configuration
String cloudConfiguration = jsonUtil.getJsonValue(DeleteVcpeResCustServiceRequest, "requestDetails.cloudConfiguration")
execution.setVariable("cloudConfiguration", cloudConfiguration)
- msoLogger.debug("cloudConfiguration: "+ cloudConfiguration)
+ logger.debug("cloudConfiguration: "+ cloudConfiguration)
String lcpCloudRegionId = jsonUtil.getJsonValue(cloudConfiguration, "lcpCloudRegionId")
execution.setVariable("lcpCloudRegionId", lcpCloudRegionId)
- msoLogger.debug("lcpCloudRegionId: "+ lcpCloudRegionId)
+ logger.debug("lcpCloudRegionId: "+ lcpCloudRegionId)
String cloudOwner = jsonUtil.getJsonValue(cloudConfiguration, "cloudOwner")
execution.setVariable("cloudOwner", cloudOwner)
- msoLogger.debug("cloudOwner: "+ cloudOwner)
+ logger.debug("cloudOwner: "+ cloudOwner)
String tenantId = jsonUtil.getJsonValue(cloudConfiguration, "tenantId")
execution.setVariable("tenantId", tenantId)
- msoLogger.debug("tenantId: "+ tenantId)
+ logger.debug("tenantId: "+ tenantId)
String sdncVersion = "1707"
execution.setVariable("sdncVersion", sdncVersion)
- msoLogger.debug("sdncVersion: "+ sdncVersion)
+ logger.debug("sdncVersion: "+ sdncVersion)
//For Completion Handler & Fallout Handler
String requestInfo =
@@ -159,7 +164,7 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor {
execution.setVariable(Prefix+"requestInfo", requestInfo)
- msoLogger.trace("Completed preProcessRequest DeleteVcpeResCustServiceRequest Request ")
+ logger.trace("Completed preProcessRequest DeleteVcpeResCustServiceRequest Request ")
} catch (BpmnError e) {
throw e;
@@ -172,7 +177,7 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor {
public void sendSyncResponse(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable(DebugFlag)
- msoLogger.trace("Inside sendSyncResponse of DeleteVcpeResCustService ")
+ logger.trace("Inside sendSyncResponse of DeleteVcpeResCustService ")
try {
String serviceInstanceId = execution.getVariable("serviceInstanceId")
@@ -181,7 +186,7 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor {
// RESTResponse (for API Handler (APIH) Reply Task)
String syncResponse ="""{"requestReferences":{"instanceId":"${serviceInstanceId}","requestId":"${requestId}"}}""".trim()
- msoLogger.debug(" sendSynchResponse: xmlSyncResponse - " + "\n" + syncResponse)
+ logger.debug(" sendSynchResponse: xmlSyncResponse - " + "\n" + syncResponse)
sendWorkflowResponse(execution, 202, syncResponse)
} catch (Exception ex) {
String exceptionMessage = "Bpmn error encountered in DeleteVcpeResCustService flow. Unexpected from method preProcessRequest() - " + ex.getMessage()
@@ -225,23 +230,23 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor {
def id = jsonUtil.getJsonValue(ar, "id")
if(type == "TunnelXConn" || type == "Tunnel XConn") {
- msoLogger.debug("TunnelXConn AR found")
+ logger.debug("TunnelXConn AR found")
TXC_found = true
TXC_id = id
}else if(type == "BRG") {
- msoLogger.debug("BRG AR found")
+ logger.debug("BRG AR found")
BRG_found = true
BRG_id = id
}
execution.setVariable(Prefix+"TunnelXConn", TXC_found)
execution.setVariable("TXC_allottedResourceId", TXC_id)
- msoLogger.debug("TXC_allottedResourceId: " + TXC_id)
+ logger.debug("TXC_allottedResourceId: " + TXC_id)
execution.setVariable(Prefix+"BRG", BRG_found)
execution.setVariable("BRG_allottedResourceId", BRG_id)
- msoLogger.debug("BRG_allottedResourceId: " + BRG_id)
+ logger.debug("BRG_allottedResourceId: " + BRG_id)
}
}
@@ -258,11 +263,11 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor {
}catch(BpmnError e) {
throw e;
}catch(NotFoundException e) {
- msoLogger.debug("Service Instance does not exist AAI")
+ logger.debug("Service Instance does not exist AAI")
exceptionUtil.buildAndThrowWorkflowException(execution, 404, "Service Instance was not found in aai")
}catch(Exception ex) {
String msg = "Internal Error in getServiceInstance: " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
}
@@ -273,7 +278,7 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor {
// *******************************
public void prepareVnfAndModulesDelete (DelegateExecution execution) {
def isDebugEnabled=execution.getVariable(DebugFlag)
- msoLogger.trace("Inside prepareVnfAndModulesDelete of DeleteVcpeResCustService ")
+ logger.trace("Inside prepareVnfAndModulesDelete of DeleteVcpeResCustService ")
try {
List vnfList = execution.getVariable(Prefix+"relatedVnfIdList")
@@ -285,9 +290,9 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor {
}
execution.setVariable("vnfId", vnfId)
- msoLogger.debug("need to delete vnfId:" + vnfId)
+ logger.debug("need to delete vnfId:" + vnfId)
- msoLogger.trace("Completed prepareVnfAndModulesDelete of DeleteVcpeResCustService ")
+ logger.trace("Completed prepareVnfAndModulesDelete of DeleteVcpeResCustService ")
} catch (Exception ex) {
// try error in method block
String exceptionMessage = "Bpmn error encountered in DeleteVcpeResCustService flow. Unexpected Error from method prepareVnfAndModulesDelete() - " + ex.getMessage()
@@ -300,7 +305,7 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor {
// *******************************
public void validateVnfDelete (DelegateExecution execution) {
def isDebugEnabled=execution.getVariable(DebugFlag)
- msoLogger.trace("Inside validateVnfDelete of DeleteVcpeResCustService ")
+ logger.trace("Inside validateVnfDelete of DeleteVcpeResCustService ")
try {
int vnfsDeletedCount = execution.getVariable(Prefix+"vnfsDeletedCount")
@@ -308,7 +313,7 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor {
execution.setVariable(Prefix+"vnfsDeletedCount", vnfsDeletedCount)
- msoLogger.debug(" ***** Completed validateVnfDelete of DeleteVcpeResCustService ***** "+" vnf # "+vnfsDeletedCount)
+ logger.debug(" ***** Completed validateVnfDelete of DeleteVcpeResCustService ***** "+" vnf # "+vnfsDeletedCount)
} catch (Exception ex) {
// try error in method block
String exceptionMessage = "Bpmn error encountered in DeleteVcpeResCustService flow. Unexpected Error from method validateVnfDelete() - " + ex.getMessage()
@@ -322,7 +327,7 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor {
// *****************************************
public void postProcessResponse (DelegateExecution execution) {
def isDebugEnabled=execution.getVariable(DebugFlag)
- msoLogger.trace("Inside postProcessResponse of DeleteVcpeResCustService ")
+ logger.trace("Inside postProcessResponse of DeleteVcpeResCustService ")
try {
String source = execution.getVariable("source")
@@ -343,10 +348,10 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor {
// Format Response
String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest)
- msoLogger.debug(xmlMsoCompletionRequest)
+ logger.debug(xmlMsoCompletionRequest)
execution.setVariable(Prefix+"Success", true)
execution.setVariable(Prefix+"CompleteMsoProcessRequest", xmlMsoCompletionRequest)
- msoLogger.debug(" SUCCESS flow, going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest)
+ logger.debug(" SUCCESS flow, going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest)
} catch (BpmnError e) {
throw e;
@@ -359,28 +364,28 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor {
public void prepareFalloutRequest(DelegateExecution execution){
def isDebugEnabled=execution.getVariable(DebugFlag)
- msoLogger.trace("STARTED DeleteVcpeResCustService prepareFalloutRequest Process ")
+ logger.trace("STARTED DeleteVcpeResCustService prepareFalloutRequest Process ")
try {
WorkflowException wfex = execution.getVariable("WorkflowException")
- msoLogger.debug(" Incoming Workflow Exception: " + wfex.toString())
+ logger.debug(" Incoming Workflow Exception: " + wfex.toString())
String requestInfo = execution.getVariable(Prefix+"requestInfo")
- msoLogger.debug(" Incoming Request Info: " + requestInfo)
+ logger.debug(" Incoming Request Info: " + requestInfo)
String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo)
execution.setVariable(Prefix+"falloutRequest", falloutRequest)
} catch (Exception ex) {
- msoLogger.debug("Error Occured in DeleteVcpeResCustService prepareFalloutRequest Process " + ex.getMessage())
+ logger.debug("Error Occured in DeleteVcpeResCustService prepareFalloutRequest Process " + ex.getMessage())
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DeleteVcpeResCustService prepareFalloutRequest Process")
}
- msoLogger.trace("COMPLETED DeleteVcpeResCustService prepareFalloutRequest Process ")
+ logger.trace("COMPLETED DeleteVcpeResCustService prepareFalloutRequest Process ")
}
public void sendSyncError (DelegateExecution execution) {
def isDebugEnabled=execution.getVariable(DebugFlag)
- msoLogger.trace("Inside sendSyncError() of DeleteVcpeResCustService ")
+ logger.trace("Inside sendSyncError() of DeleteVcpeResCustService ")
try {
String errorMessage = ""
@@ -397,10 +402,10 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor {
<aetgt:ErrorCode>7000</aetgt:ErrorCode>
</aetgt:WorkflowException>"""
- msoLogger.debug(buildworkflowException)
+ logger.debug(buildworkflowException)
sendWorkflowResponse(execution, 500, buildworkflowException)
} catch (Exception ex) {
- msoLogger.debug(" Sending Sync Error Activity Failed. " + "\n" + ex.getMessage())
+ logger.debug(" Sending Sync Error Activity Failed. " + "\n" + ex.getMessage())
}
}
@@ -408,20 +413,22 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor {
def isDebugEnabled=execution.getVariable(DebugFlag)
execution.setVariable("prefix",Prefix)
try{
- msoLogger.debug("Caught a Java Exception")
- msoLogger.debug("Started processJavaException Method")
- msoLogger.debug("Variables List: " + execution.getVariables())
+ logger.debug("Caught a Java Exception")
+ logger.debug("Started processJavaException Method")
+ logger.debug("Variables List: " + execution.getVariables())
execution.setVariable(Prefix+"unexpectedError", "Caught a Java Lang Exception") // Adding this line temporarily until this flows error handling gets updated
exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Caught a Java Lang Exception")
}catch(BpmnError b){
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Rethrowing MSOWorkflowException", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Rethrowing MSOWorkflowException", "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue());
throw b
}catch(Exception e){
- msoLogger.debug("Caught Exception during processJavaException Method: " + e)
+ logger.debug("Caught Exception during processJavaException Method: " + e)
execution.setVariable(Prefix+"unexpectedError", "Exception in processJavaException method") // Adding this line temporarily until this flows error handling gets updated
exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Exception in processJavaException method")
}
- msoLogger.debug("Completed processJavaException Method")
+ logger.debug("Completed processJavaException Method")
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy
index e7baccd460..db8c993533 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -34,6 +36,8 @@ import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
import javax.ws.rs.NotFoundException
import javax.ws.rs.core.UriBuilder
@@ -71,7 +75,7 @@ import static org.apache.commons.lang3.StringUtils.isBlank
*
*/
public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCreateAllottedResourceBRG.class);
+ private static final Logger logger = LoggerFactory.getLogger(DoCreateAllottedResourceBRG.class);
String Prefix="DCARBRG_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
@@ -81,7 +85,7 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{
String msg = ""
- msoLogger.trace("start preProcessRequest")
+ logger.trace("start preProcessRequest")
try {
execution.setVariable("prefix", Prefix)
@@ -90,78 +94,78 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{
String sdncCallbackUrl = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution)
if (isBlank(sdncCallbackUrl)) {
msg = "mso.workflow.sdncadapter.callback is null"
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
}
execution.setVariable("sdncCallbackUrl", sdncCallbackUrl)
- msoLogger.debug("SDNC Callback URL: " + sdncCallbackUrl)
+ logger.debug("SDNC Callback URL: " + sdncCallbackUrl)
String sdncReplDelay = UrnPropertiesReader.getVariable("mso.workflow.sdnc.replication.delay",execution)
if (isBlank(sdncReplDelay)) {
msg = "mso.workflow.sdnc.replication.delay is null"
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
}
execution.setVariable("sdncReplDelay", sdncReplDelay)
- msoLogger.debug("SDNC replication delay: " + sdncReplDelay)
+ logger.debug("SDNC replication delay: " + sdncReplDelay)
//Request Inputs
if (isBlank(execution.getVariable("serviceInstanceId"))){
msg = "Input serviceInstanceId is null"
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
}
if (isBlank(execution.getVariable("parentServiceInstanceId"))) {
msg = "Input parentServiceInstanceId is null"
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
}
if (isBlank(execution.getVariable("allottedResourceModelInfo"))) {
msg = "Input allottedResourceModelInfo is null"
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
}
if (isBlank(execution.getVariable("vni"))) {
msg = "Input vni is null"
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
}
if (isBlank(execution.getVariable("vgmuxBearerIP"))) {
msg = "Input vgmuxBearerIP is null"
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
}
if (isBlank(execution.getVariable("brgWanMacAddress"))) {
msg = "Input brgWanMacAddress is null"
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
}
if (isBlank(execution.getVariable("allottedResourceRole"))) {
msg = "Input allottedResourceRole is null"
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
}
if (isBlank(execution.getVariable("allottedResourceType"))) {
msg = "Input allottedResourceType is null"
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
}
}catch(BpmnError b){
- msoLogger.debug("Rethrowing MSOWorkflowException")
+ logger.debug("Rethrowing MSOWorkflowException")
throw b
} catch (Exception ex){
msg = "Exception in preProcessRequest " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("end preProcessRequest")
+ logger.trace("end preProcessRequest")
}
/**
* Gets the service instance uri from aai
*/
public void getServiceInstance(DelegateExecution execution) {
- msoLogger.trace("getServiceInstance ")
+ logger.trace("getServiceInstance ")
try {
String serviceInstanceId = execution.getVariable('serviceInstanceId')
@@ -178,16 +182,16 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{
throw e;
}catch (Exception ex){
String msg = "Exception in getServiceInstance. " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("Exit getServiceInstance ")
+ logger.trace("Exit getServiceInstance ")
}
public void getAaiAR (DelegateExecution execution) {
- msoLogger.trace("start getAaiAR")
+ logger.trace("start getAaiAR")
String arType = execution.getVariable("allottedResourceType")
String arRole = execution.getVariable("allottedResourceRole")
@@ -216,14 +220,14 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{
}
}
if (!isBlank(errorMsg)) {
- msoLogger.debug(errorMsg)
+ logger.debug(errorMsg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, errorMsg)
}
- msoLogger.trace("end getAaiAR")
+ logger.trace("end getAaiAR")
}
public void getParentServiceInstance(DelegateExecution execution) {
- msoLogger.trace("getParentServiceInstance ")
+ logger.trace("getParentServiceInstance ")
try {
String serviceInstanceId = execution.getVariable('parentServiceInstanceId')
@@ -242,17 +246,17 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{
throw e;
}catch (Exception ex){
String msg = "Exception in getParentServiceInstance. " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("Exit getParentServiceInstance ")
+ logger.trace("Exit getParentServiceInstance ")
}
public void createAaiAR(DelegateExecution execution) {
- msoLogger.trace("start createAaiAR")
+ logger.trace("start createAaiAR")
String allottedResourceId = execution.getVariable("allottedResourceId")
if (isBlank(allottedResourceId))
@@ -297,14 +301,14 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{
rollbackData.put(Prefix, "serviceInstanceId", execution.getVariable("serviceInstanceId"))
rollbackData.put(Prefix, "parentServiceInstanceId", execution.getVariable("parentServiceInstanceId"))
execution.setVariable("rollbackData", rollbackData)
- msoLogger.trace("end createAaiAR")
+ logger.trace("end createAaiAR")
}
public String buildSDNCRequest(DelegateExecution execution, String action, String sdncRequestId) {
String msg = ""
- msoLogger.trace("start buildSDNCRequest")
+ logger.trace("start buildSDNCRequest")
String sdncReq = null
try {
@@ -392,15 +396,15 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{
</sdncadapterworkflow:SDNCRequestData>
</sdncadapterworkflow:SDNCAdapterWorkflowRequest>"""
- msoLogger.debug("sdncRequest:\n" + sdncReq)
+ logger.debug("sdncRequest:\n" + sdncReq)
sdncReq = utils.formatXml(sdncReq)
} catch(Exception ex) {
msg = "Exception in buildSDNCRequest. " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("end buildSDNCRequest")
+ logger.trace("end buildSDNCRequest")
return sdncReq
}
@@ -408,110 +412,110 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{
String msg = ""
- msoLogger.trace("start preProcessSDNCAssign")
+ logger.trace("start preProcessSDNCAssign")
try {
String sdncRequestId = UUID.randomUUID().toString()
String sdncAssignReq = buildSDNCRequest(execution, "assign", sdncRequestId)
execution.setVariable("sdncAssignRequest", sdncAssignReq)
- msoLogger.debug("sdncAssignRequest: " + sdncAssignReq)
+ logger.debug("sdncAssignRequest: " + sdncAssignReq)
def sdncRequestId2 = UUID.randomUUID().toString()
String sdncAssignRollbackReq = sdncAssignReq.replace(">assign<", ">unassign<").replace(">CreateBRGInstance<", ">DeleteBRGInstance<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<")
def rollbackData = execution.getVariable("rollbackData")
rollbackData.put(Prefix, "sdncAssignRollbackReq", sdncAssignRollbackReq)
execution.setVariable("rollbackData", rollbackData)
- msoLogger.debug("sdncAssignRollbackReq:\n" + sdncAssignRollbackReq)
- msoLogger.debug("rollbackData:\n" + rollbackData.toString())
+ logger.debug("sdncAssignRollbackReq:\n" + sdncAssignRollbackReq)
+ logger.debug("rollbackData:\n" + rollbackData.toString())
} catch (BpmnError e) {
throw e;
} catch(Exception ex) {
msg = "Exception in preProcessSDNCAssign. " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("end preProcessSDNCAssign")
+ logger.trace("end preProcessSDNCAssign")
}
public void preProcessSDNCCreate(DelegateExecution execution) {
String msg = ""
- msoLogger.trace("start preProcessSDNCCreate")
+ logger.trace("start preProcessSDNCCreate")
try {
String sdncRequestId = UUID.randomUUID().toString()
String sdncCreateReq = buildSDNCRequest(execution, "create", sdncRequestId)
execution.setVariable("sdncCreateRequest", sdncCreateReq)
- msoLogger.debug("sdncCreateReq: " + sdncCreateReq)
+ logger.debug("sdncCreateReq: " + sdncCreateReq)
def sdncRequestId2 = UUID.randomUUID().toString()
String sdncCreateRollbackReq = sdncCreateReq.replace(">create<", ">delete<").replace(">CreateBRGInstance<", ">DeleteBRGInstance<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<")
def rollbackData = execution.getVariable("rollbackData")
rollbackData.put(Prefix, "sdncCreateRollbackReq", sdncCreateRollbackReq)
execution.setVariable("rollbackData", rollbackData)
- msoLogger.debug("sdncCreateRollbackReq:\n" + sdncCreateRollbackReq)
- msoLogger.debug("rollbackData:\n" + rollbackData.toString())
+ logger.debug("sdncCreateRollbackReq:\n" + sdncCreateRollbackReq)
+ logger.debug("rollbackData:\n" + rollbackData.toString())
} catch (BpmnError e) {
throw e;
} catch(Exception ex) {
msg = "Exception in preProcessSDNCCreate. " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("end preProcessSDNCCreate")
+ logger.trace("end preProcessSDNCCreate")
}
public void preProcessSDNCActivate(DelegateExecution execution) {
String msg = ""
- msoLogger.trace("start preProcessSDNCActivate")
+ logger.trace("start preProcessSDNCActivate")
try {
String sdncRequestId = UUID.randomUUID().toString()
String sdncActivateReq = buildSDNCRequest(execution, "activate", sdncRequestId)
execution.setVariable("sdncActivateRequest", sdncActivateReq)
- msoLogger.debug("sdncActivateReq: " + sdncActivateReq)
+ logger.debug("sdncActivateReq: " + sdncActivateReq)
def sdncRequestId2 = UUID.randomUUID().toString()
String sdncActivateRollbackReq = sdncActivateReq.replace(">activate<", ">deactivate<").replace(">CreateBRGInstance<", ">DeleteBRGInstance<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<")
def rollbackData = execution.getVariable("rollbackData")
rollbackData.put(Prefix, "sdncActivateRollbackReq", sdncActivateRollbackReq)
execution.setVariable("rollbackData", rollbackData)
- msoLogger.debug("sdncActivateRollbackReq:\n" + sdncActivateRollbackReq)
- msoLogger.debug("rollbackData:\n" + rollbackData.toString())
+ logger.debug("sdncActivateRollbackReq:\n" + sdncActivateRollbackReq)
+ logger.debug("rollbackData:\n" + rollbackData.toString())
} catch (BpmnError e) {
throw e;
} catch(Exception ex) {
msg = "Exception in preProcessSDNCActivate. " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("end preProcessSDNCActivate")
+ logger.trace("end preProcessSDNCActivate")
}
public void validateSDNCResp(DelegateExecution execution, String response, String method){
- msoLogger.trace("ValidateSDNCResponse Process")
+ logger.trace("ValidateSDNCResponse Process")
String msg = ""
try {
WorkflowException workflowException = execution.getVariable("WorkflowException")
- msoLogger.debug("workflowException: " + workflowException)
+ logger.debug("workflowException: " + workflowException)
boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator")
- msoLogger.debug("SDNCResponse: " + response)
+ logger.debug("SDNCResponse: " + response)
SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this)
sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator)
if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){
- msoLogger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + response)
+ logger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + response)
if (!"get".equals(method))
{
@@ -521,22 +525,22 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{
}
}else{
- msoLogger.debug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.")
+ logger.debug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.")
throw new BpmnError("MSOWorkflowException")
}
} catch (BpmnError e) {
throw e;
} catch(Exception ex) {
msg = "Exception in validateSDNCResp. " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("End ValidateSDNCResp Process")
+ logger.trace("End ValidateSDNCResp Process")
}
public void preProcessSDNCGet(DelegateExecution execution){
- msoLogger.trace("start preProcessSDNCGet")
+ logger.trace("start preProcessSDNCGet")
try{
def callbackUrl = execution.getVariable("sdncCallbackUrl")
@@ -548,15 +552,15 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{
if (execution.getVariable("foundActiveAR")) {
def aaiQueryResponse = execution.getVariable("aaiARGetResponse")
serviceOperation = utils.getNodeText(aaiQueryResponse, "selflink")
- msoLogger.debug("AR service operation/aaiARSelfLink: " + serviceOperation)
+ logger.debug("AR service operation/aaiARSelfLink: " + serviceOperation)
}
else
{
String response = execution.getVariable("sdncAssignResponse")
String data = utils.getNodeXml(response, "response-data")
- msoLogger.debug("Assign responseData: " + data)
+ logger.debug("Assign responseData: " + data)
serviceOperation = utils.getNodeText(data, "object-path")
- msoLogger.debug("AR service operation:" + serviceOperation)
+ logger.debug("AR service operation:" + serviceOperation)
}
String serviceInstanceId = execution.getVariable("serviceInstanceId")
@@ -581,28 +585,30 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{
execution.setVariable("sdncGetRequest", SDNCGetRequest)
}catch(Exception e){
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occurred Processing preProcessSDNCGetRequest.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Occurred Processing preProcessSDNCGetRequest.", "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during SDNC GET Method:\n" + e.getMessage())
}
- msoLogger.trace("end preProcessSDNCGet")
+ logger.trace("end preProcessSDNCGet")
}
public void updateAaiAROrchStatus(DelegateExecution execution, String status){
- msoLogger.trace("start updateAaiAROrchStatus")
+ logger.trace("start updateAaiAROrchStatus")
String aaiARPath = execution.getVariable("aaiARPath") //set during query (existing AR) or create
AllottedResourceUtils arUtils = new AllottedResourceUtils(this)
String orchStatus = arUtils.updateAROrchStatus(execution, status, aaiARPath)
- msoLogger.trace("end updateAaiAROrchStatus")
+ logger.trace("end updateAaiAROrchStatus")
}
public void generateOutputs(DelegateExecution execution)
{
- msoLogger.trace("start generateOutputs")
+ logger.trace("start generateOutputs")
try {
String sdncGetResponse = execution.getVariable("enhancedCallbackRequestData") //unescaped
- msoLogger.debug("resp:" + sdncGetResponse)
+ logger.debug("resp:" + sdncGetResponse)
String arData = utils.getNodeXml(sdncGetResponse, "brg-topology")
arData = utils.removeXmlNamespaces(arData)
@@ -610,55 +616,55 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{
String ari = utils.getNodeXml(arData, "allotted-resource-identifiers")
execution.setVariable("allotedResourceName", utils.getNodeText(ari, "allotted-resource-name"))
} catch (BpmnError e) {
- msoLogger.debug("BPMN Error in generateOutputs ")
+ logger.debug("BPMN Error in generateOutputs ")
} catch(Exception ex) {
String msg = "Exception in generateOutputs " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
}
- msoLogger.trace("end generateOutputs")
+ logger.trace("end generateOutputs")
}
public void preProcessRollback (DelegateExecution execution) {
- msoLogger.trace("start preProcessRollback")
+ logger.trace("start preProcessRollback")
try {
Object workflowException = execution.getVariable("WorkflowException");
if (workflowException instanceof WorkflowException) {
- msoLogger.debug("Prev workflowException: " + workflowException.getErrorMessage())
+ logger.debug("Prev workflowException: " + workflowException.getErrorMessage())
execution.setVariable("prevWorkflowException", workflowException);
//execution.setVariable("WorkflowException", null);
}
} catch (BpmnError e) {
- msoLogger.debug("BPMN Error during preProcessRollback")
+ logger.debug("BPMN Error during preProcessRollback")
} catch(Exception ex) {
String msg = "Exception in preProcessRollback. " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
}
- msoLogger.trace("end preProcessRollback")
+ logger.trace("end preProcessRollback")
}
public void postProcessRollback (DelegateExecution execution) {
- msoLogger.trace("start postProcessRollback")
+ logger.trace("start postProcessRollback")
String msg = ""
try {
Object workflowException = execution.getVariable("prevWorkflowException");
if (workflowException instanceof WorkflowException) {
- msoLogger.debug("Setting prevException to WorkflowException: ")
+ logger.debug("Setting prevException to WorkflowException: ")
execution.setVariable("WorkflowException", workflowException);
}
execution.setVariable("rollbackData", null)
} catch (BpmnError b) {
- msoLogger.debug("BPMN Error during postProcessRollback")
+ logger.debug("BPMN Error during postProcessRollback")
throw b;
} catch(Exception ex) {
msg = "Exception in postProcessRollback. " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
}
- msoLogger.trace("end postProcessRollback")
+ logger.trace("end postProcessRollback")
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollback.groovy
index 856c893b47..03f795cadf 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollback.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollback.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -30,6 +32,8 @@ import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils
import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
import static org.apache.commons.lang3.StringUtils.isBlank
@@ -50,7 +54,7 @@ import static org.apache.commons.lang3.StringUtils.isBlank
*
*/
public class DoCreateAllottedResourceBRGRollback extends AbstractServiceTaskProcessor{
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCreateAllottedResourceBRGRollback.class);
+ private static final Logger logger = LoggerFactory.getLogger(DoCreateAllottedResourceBRGRollback.class);
String Prefix="DCARBRGRB_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
@@ -59,13 +63,13 @@ public class DoCreateAllottedResourceBRGRollback extends AbstractServiceTaskProc
String msg = ""
- msoLogger.trace("start preProcessRequest")
+ logger.trace("start preProcessRequest")
execution.setVariable("prefix", Prefix)
String rbType = "DCARBRG_"
try {
def rollbackData = execution.getVariable("rollbackData")
- msoLogger.debug("RollbackData:" + rollbackData)
+ logger.debug("RollbackData:" + rollbackData)
if (rollbackData != null) {
if (rollbackData.hasType(rbType)) {
@@ -90,9 +94,9 @@ public class DoCreateAllottedResourceBRGRollback extends AbstractServiceTaskProc
execution.setVariable("deleteSdnc", rollbackData.get(rbType, "rollbackSDNCcreate"))
execution.setVariable("unassignSdnc", rollbackData.get(rbType, "rollbackSDNCassign"))
- msoLogger.debug("sdncDeactivate:\n" + execution.getVariable("deactivateSdnc") )
- msoLogger.debug("sdncDelete:\n" + execution.getVariable("deleteSdnc"))
- msoLogger.debug("sdncUnassign:\n" + execution.getVariable("unassignSdnc"))
+ logger.debug("sdncDeactivate:\n" + execution.getVariable("deactivateSdnc") )
+ logger.debug("sdncDelete:\n" + execution.getVariable("deleteSdnc"))
+ logger.debug("sdncUnassign:\n" + execution.getVariable("unassignSdnc"))
execution.setVariable("sdncDeactivateRequest", rollbackData.get(rbType, "sdncActivateRollbackReq"))
execution.setVariable("sdncDeleteRequest", rollbackData.get(rbType, "sdncCreateRollbackReq"))
@@ -117,24 +121,24 @@ public class DoCreateAllottedResourceBRGRollback extends AbstractServiceTaskProc
}
}catch(BpmnError b){
- msoLogger.debug("Rethrowing MSOWorkflowException")
+ logger.debug("Rethrowing MSOWorkflowException")
throw b
} catch (Exception ex){
msg = "Exception in preProcessRequest " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("end preProcessRequest")
+ logger.trace("end preProcessRequest")
}
// aaiARPath set during query (existing AR)
public void updateAaiAROrchStatus(DelegateExecution execution, String status){
String msg = null;
- msoLogger.trace("start updateAaiAROrchStatus")
+ logger.trace("start updateAaiAROrchStatus")
AllottedResourceUtils arUtils = new AllottedResourceUtils(this)
String aaiARPath = execution.getVariable("aaiARPath")
- msoLogger.debug(" aaiARPath:" + aaiARPath)
+ logger.debug(" aaiARPath:" + aaiARPath)
Optional<AllottedResource> ar = Optional.empty(); //need this for getting resourceVersion for delete
if (!isBlank(aaiARPath))
{
@@ -143,73 +147,75 @@ public class DoCreateAllottedResourceBRGRollback extends AbstractServiceTaskProc
if(!ar.isPresent())
{
msg = "AR not found in AAI at:" + aaiARPath
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
}
String orchStatus = arUtils.updateAROrchStatus(execution, status, aaiARPath)
- msoLogger.trace("end updateAaiAROrchStatus")
+ logger.trace("end updateAaiAROrchStatus")
}
public void validateSDNCResp(DelegateExecution execution, String response, String method){
- msoLogger.trace("start ValidateSDNCResponse Process")
+ logger.trace("start ValidateSDNCResponse Process")
String msg = ""
try {
WorkflowException workflowException = execution.getVariable("WorkflowException")
- msoLogger.debug("workflowException: " + workflowException)
+ logger.debug("workflowException: " + workflowException)
boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator")
- msoLogger.debug("SDNCResponse: " + response)
+ logger.debug("SDNCResponse: " + response)
SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this)
sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator)
if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){
- msoLogger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + response)
+ logger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + response)
}else{
- msoLogger.debug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.")
+ logger.debug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.")
throw new BpmnError("MSOWorkflowException")
}
} catch (BpmnError e) {
if ("404".contentEquals(e.getErrorCode()))
{
msg = "SDNC rollback " + method + " returned a 404. Proceding with rollback"
- msoLogger.debug(msg)
+ logger.debug(msg)
}
else {
throw e;
}
} catch(Exception ex) {
msg = "Exception in validateSDNCResp. " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("end ValidateSDNCResp Process")
+ logger.trace("end ValidateSDNCResp Process")
}
public void deleteAaiAR(DelegateExecution execution){
try{
- msoLogger.trace("start deleteAaiAR")
+ logger.trace("start deleteAaiAR")
AllottedResourceUtils arUtils = new AllottedResourceUtils(this)
String arLink = execution.getVariable("aaiARPath")
arUtils.deleteAR(execution, arLink )
} catch (BpmnError e) {
throw e;
}catch(Exception ex){
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occurred Processing preProcessSDNCGetRequest.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + ex);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Occurred Processing preProcessSDNCGetRequest.", "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during SDNC GET Method:\n" + ex.getMessage())
}
- msoLogger.trace("end deleteAaiAR")
+ logger.trace("end deleteAaiAR")
}
public void postProcessRequest(DelegateExecution execution) {
- msoLogger.trace("start postProcessRequest")
+ logger.trace("start postProcessRequest")
String msg = ""
try {
execution.setVariable("rollbackData", null)
@@ -217,52 +223,52 @@ public class DoCreateAllottedResourceBRGRollback extends AbstractServiceTaskProc
if (skipRollback != true)
{
execution.setVariable("rolledBack", true)
- msoLogger.debug("rolledBack")
+ logger.debug("rolledBack")
}
- msoLogger.trace("end postProcessRequest")
+ logger.trace("end postProcessRequest")
} catch (BpmnError e) {
msg = "Bpmn Exception in postProcessRequest. "
- msoLogger.debug(msg)
+ logger.debug(msg)
} catch (Exception ex) {
msg = "Exception in postProcessRequest. " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
}
}
public void processRollbackException(DelegateExecution execution){
- msoLogger.trace("start processRollbackException")
+ logger.trace("start processRollbackException")
try{
- msoLogger.debug("Caught an Exception in DoCreateAllottedResourceRollback")
+ logger.debug("Caught an Exception in DoCreateAllottedResourceRollback")
execution.setVariable("rollbackData", null)
execution.setVariable("rolledBack", false)
execution.setVariable("rollbackError", "Caught exception in AllottedResource Create Rollback")
execution.setVariable("WorkflowException", null)
}catch(BpmnError b){
- msoLogger.debug("BPMN Error during processRollbackExceptions Method: ")
+ logger.debug("BPMN Error during processRollbackExceptions Method: ")
}catch(Exception e){
- msoLogger.debug("Caught Exception during processRollbackExceptions Method: " + e.getMessage())
+ logger.debug("Caught Exception during processRollbackExceptions Method: " + e.getMessage())
}
- msoLogger.trace("end processRollbackException")
+ logger.trace("end processRollbackException")
}
public void processRollbackJavaException(DelegateExecution execution){
- msoLogger.trace("start processRollbackJavaException")
+ logger.trace("start processRollbackJavaException")
try{
execution.setVariable("rollbackData", null)
execution.setVariable("rolledBack", false)
execution.setVariable("rollbackError", "Caught Java exception in AllottedResource Create Rollback")
- msoLogger.debug("Caught Exception in processRollbackJavaException")
+ logger.debug("Caught Exception in processRollbackJavaException")
}catch(Exception e){
- msoLogger.debug("Caught Exception in processRollbackJavaException " + e.getMessage())
+ logger.debug("Caught Exception in processRollbackJavaException " + e.getMessage())
}
- msoLogger.trace("end processRollbackJavaException")
+ logger.trace("end processRollbackJavaException")
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy
index 56fa3a6730..a5f0d7dc30 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -33,6 +35,8 @@ import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
import javax.ws.rs.core.UriBuilder
import static org.apache.commons.lang3.StringUtils.isBlank
@@ -69,7 +73,7 @@ import static org.apache.commons.lang3.StringUtils.isBlank
*
*/
public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCreateAllottedResourceTXC.class);
+ private static final Logger logger = LoggerFactory.getLogger(DoCreateAllottedResourceTXC.class);
String Prefix="DCARTXC_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
@@ -79,11 +83,11 @@ public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{
String msg = ""
- msoLogger.trace("start preProcessRequest")
+ logger.trace("start preProcessRequest")
try {
String msoRequestId = execution.getVariable("msoRequestId")
- msoLogger.debug(" msoRequestId = " + msoRequestId)
+ logger.debug(" msoRequestId = " + msoRequestId)
execution.setVariable("prefix", Prefix)
@@ -91,67 +95,67 @@ public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{
String sdncCallbackUrl = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution)
if (isBlank(sdncCallbackUrl)) {
msg = "mso.workflow.sdncadapter.callback is null"
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
}
execution.setVariable("sdncCallbackUrl", sdncCallbackUrl)
- msoLogger.debug("SDNC Callback URL: " + sdncCallbackUrl)
+ logger.debug("SDNC Callback URL: " + sdncCallbackUrl)
String sdncReplDelay = UrnPropertiesReader.getVariable("mso.workflow.sdnc.replication.delay",execution)
if (isBlank(sdncReplDelay)) {
msg = "mso.workflow.sdnc.replication.delay is null"
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
}
execution.setVariable("sdncReplDelay", sdncReplDelay)
- msoLogger.debug("SDNC replication delay: " + sdncReplDelay)
+ logger.debug("SDNC replication delay: " + sdncReplDelay)
//Request Inputs
if (isBlank(execution.getVariable("serviceInstanceId"))){
msg = "Input serviceInstanceId is null"
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
}
if (isBlank(execution.getVariable("parentServiceInstanceId"))) {
msg = "Input parentServiceInstanceId is null"
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
}
if (isBlank(execution.getVariable("allottedResourceModelInfo"))) {
msg = "Input allottedResourceModelInfo is null"
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
}
if (isBlank(execution.getVariable("brgWanMacAddress"))) {
msg = "Input brgWanMacAddress is null"
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
}
if (isBlank(execution.getVariable("allottedResourceRole"))) {
msg = "Input allottedResourceRole is null"
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
}
if (isBlank(execution.getVariable("allottedResourceType"))) {
msg = "Input allottedResourceType is null"
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
}
}catch(BpmnError b){
- msoLogger.debug("Rethrowing MSOWorkflowException")
+ logger.debug("Rethrowing MSOWorkflowException")
throw b
} catch (Exception ex){
msg = "Exception in preProcessRequest " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("end preProcessRequest")
+ logger.trace("end preProcessRequest")
}
public void getAaiAR (DelegateExecution execution) {
- msoLogger.trace("start getAaiAR")
+ logger.trace("start getAaiAR")
String arType = execution.getVariable("allottedResourceType")
String arRole = execution.getVariable("allottedResourceRole")
@@ -180,16 +184,16 @@ public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{
}
}
if (!isBlank(errorMsg)) {
- msoLogger.debug(errorMsg)
+ logger.debug(errorMsg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, errorMsg)
}
- msoLogger.trace("end getAaiAR")
+ logger.trace("end getAaiAR")
}
public void createAaiAR(DelegateExecution execution) {
- msoLogger.trace("start createAaiAR")
+ logger.trace("start createAaiAR")
String allottedResourceId = execution.getVariable("allottedResourceId")
if (isBlank(allottedResourceId))
@@ -208,7 +212,7 @@ public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{
String arRole = execution.getVariable("allottedResourceRole")
String CSI_resourceLink = execution.getVariable("CSI_resourceLink")
String arModelInfo = execution.getVariable("allottedResourceModelInfo")
- msoLogger.debug("arModelInfo is:\n" + arModelInfo)
+ logger.debug("arModelInfo is:\n" + arModelInfo)
String modelInvariantId = jsonUtil.getJsonValue(arModelInfo, "modelInvariantUuid")
String modelVersionId = jsonUtil.getJsonValue(arModelInfo, "modelUuid")
@@ -235,14 +239,14 @@ public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{
rollbackData.put(Prefix, "serviceInstanceId", execution.getVariable("serviceInstanceId"))
rollbackData.put(Prefix, "parentServiceInstanceId", execution.getVariable("parentServiceInstanceId"))
execution.setVariable("rollbackData", rollbackData)
- msoLogger.trace("end createAaiAR")
+ logger.trace("end createAaiAR")
}
public String buildSDNCRequest(DelegateExecution execution, String action, String sdncRequestId) {
String msg = ""
- msoLogger.trace("start buildSDNCRequest")
+ logger.trace("start buildSDNCRequest")
String sdncReq = null
try {
@@ -327,15 +331,15 @@ public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{
</sdncadapterworkflow:SDNCRequestData>
</sdncadapterworkflow:SDNCAdapterWorkflowRequest>"""
- msoLogger.debug("sdncRequest:\n" + sdncReq)
+ logger.debug("sdncRequest:\n" + sdncReq)
sdncReq = utils.formatXml(sdncReq)
} catch(Exception ex) {
msg = "Exception in buildSDNCRequest. " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("end buildSDNCRequest")
+ logger.trace("end buildSDNCRequest")
return sdncReq
}
@@ -343,110 +347,110 @@ public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{
String msg = ""
- msoLogger.trace("start preProcessSDNCAssign")
+ logger.trace("start preProcessSDNCAssign")
try {
String sdncRequestId = UUID.randomUUID().toString()
String sdncAssignReq = buildSDNCRequest(execution, "assign", sdncRequestId)
execution.setVariable("sdncAssignRequest", sdncAssignReq)
- msoLogger.debug("sdncAssignRequest: " + sdncAssignReq)
+ logger.debug("sdncAssignRequest: " + sdncAssignReq)
def sdncRequestId2 = UUID.randomUUID().toString()
String sdncAssignRollbackReq = sdncAssignReq.replace(">assign<", ">unassign<").replace(">CreateTunnelXConnInstance<", ">DeleteTunnelXConnInstance<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<")
def rollbackData = execution.getVariable("rollbackData")
rollbackData.put(Prefix, "sdncAssignRollbackReq", sdncAssignRollbackReq)
execution.setVariable("rollbackData", rollbackData)
- msoLogger.debug("sdncAssignRollbackReq:\n" + sdncAssignRollbackReq)
- msoLogger.debug("rollbackData:\n" + rollbackData.toString())
+ logger.debug("sdncAssignRollbackReq:\n" + sdncAssignRollbackReq)
+ logger.debug("rollbackData:\n" + rollbackData.toString())
} catch (BpmnError e) {
throw e;
} catch(Exception ex) {
msg = "Exception in preProcessSDNCAssign. " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.debug("end preProcessSDNCAssign")
+ logger.debug("end preProcessSDNCAssign")
}
public void preProcessSDNCCreate(DelegateExecution execution) {
String msg = ""
- msoLogger.trace("start preProcessSDNCCreate")
+ logger.trace("start preProcessSDNCCreate")
try {
String sdncRequestId = UUID.randomUUID().toString()
String sdncCreateReq = buildSDNCRequest(execution, "create", sdncRequestId)
execution.setVariable("sdncCreateRequest", sdncCreateReq)
- msoLogger.debug("sdncCreateReq: " + sdncCreateReq)
+ logger.debug("sdncCreateReq: " + sdncCreateReq)
def sdncRequestId2 = UUID.randomUUID().toString()
String sdncCreateRollbackReq = sdncCreateReq.replace(">create<", ">delete<").replace(">CreateTunnelXConnInstance<", ">DeleteTunnelXConnInstance<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<")
def rollbackData = execution.getVariable("rollbackData")
rollbackData.put(Prefix, "sdncCreateRollbackReq", sdncCreateRollbackReq)
execution.setVariable("rollbackData", rollbackData)
- msoLogger.debug("sdncCreateRollbackReq:\n" + sdncCreateRollbackReq)
- msoLogger.debug("rollbackData:\n" + rollbackData.toString())
+ logger.debug("sdncCreateRollbackReq:\n" + sdncCreateRollbackReq)
+ logger.debug("rollbackData:\n" + rollbackData.toString())
} catch (BpmnError e) {
throw e;
} catch(Exception ex) {
msg = "Exception in preProcessSDNCCreate. " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("end preProcessSDNCCreate")
+ logger.trace("end preProcessSDNCCreate")
}
public void preProcessSDNCActivate(DelegateExecution execution) {
String msg = ""
- msoLogger.trace("start preProcessSDNCActivate")
+ logger.trace("start preProcessSDNCActivate")
try {
String sdncRequestId = UUID.randomUUID().toString()
String sdncActivateReq = buildSDNCRequest(execution, "activate", sdncRequestId)
execution.setVariable("sdncActivateRequest", sdncActivateReq)
- msoLogger.debug("sdncActivateReq: " + sdncActivateReq)
+ logger.debug("sdncActivateReq: " + sdncActivateReq)
def sdncRequestId2 = UUID.randomUUID().toString()
String sdncActivateRollbackReq = sdncActivateReq.replace(">activate<", ">deactivate<").replace(">CreateTunnelXConnInstance<", ">DeleteTunnelXConnInstance<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<")
def rollbackData = execution.getVariable("rollbackData")
rollbackData.put(Prefix, "sdncActivateRollbackReq", sdncActivateRollbackReq)
execution.setVariable("rollbackData", rollbackData)
- msoLogger.debug("sdncActivateRollbackReq:\n" + sdncActivateRollbackReq)
- msoLogger.debug("rollbackData:\n" + rollbackData.toString())
+ logger.debug("sdncActivateRollbackReq:\n" + sdncActivateRollbackReq)
+ logger.debug("rollbackData:\n" + rollbackData.toString())
} catch (BpmnError e) {
throw e;
} catch(Exception ex) {
msg = "Exception in preProcessSDNCActivate. " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("end preProcessSDNCActivate")
+ logger.trace("end preProcessSDNCActivate")
}
public void validateSDNCResp(DelegateExecution execution, String response, String method){
- msoLogger.trace("start ValidateSDNCResponse Process")
+ logger.trace("start ValidateSDNCResponse Process")
String msg = ""
try {
WorkflowException workflowException = execution.getVariable("WorkflowException")
- msoLogger.debug("workflowException: " + workflowException)
+ logger.debug("workflowException: " + workflowException)
boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator")
- msoLogger.debug("SDNCResponse: " + response)
+ logger.debug("SDNCResponse: " + response)
SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this)
sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator)
if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){
- msoLogger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + response)
+ logger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + response)
if (!"get".equals(method))
{
@@ -456,22 +460,22 @@ public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{
}
}else{
- msoLogger.debug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.")
+ logger.debug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.")
throw new BpmnError("MSOWorkflowException")
}
} catch (BpmnError e) {
throw e;
} catch(Exception ex) {
msg = "Exception in validateSDNCResp. " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("end ValidateSDNCResp Process")
+ logger.trace("end ValidateSDNCResp Process")
}
public void preProcessSDNCGet(DelegateExecution execution){
- msoLogger.trace("start preProcessSDNCGet")
+ logger.trace("start preProcessSDNCGet")
try{
def callbackUrl = execution.getVariable("sdncCallbackUrl")
@@ -483,15 +487,15 @@ public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{
if (execution.getVariable("foundActiveAR")) {
def aaiQueryResponse = execution.getVariable("aaiARGetResponse")
serviceOperation = utils.getNodeText(aaiQueryResponse, "selflink")
- msoLogger.debug("AR service operation/aaiARSelfLink: " + serviceOperation)
+ logger.debug("AR service operation/aaiARSelfLink: " + serviceOperation)
}
else
{
String response = execution.getVariable("sdncAssignResponse")
String data = utils.getNodeXml(response, "response-data")
- msoLogger.debug("Assign responseData: " + data)
+ logger.debug("Assign responseData: " + data)
serviceOperation = utils.getNodeText(data, "object-path")
- msoLogger.debug("AR service operation:" + serviceOperation)
+ logger.debug("AR service operation:" + serviceOperation)
}
String serviceInstanceId = execution.getVariable("serviceInstanceId")
@@ -516,28 +520,30 @@ public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{
execution.setVariable("sdncGetRequest", SDNCGetRequest)
}catch(Exception e){
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occurred Processing preProcessSDNCGetRequest.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Occurred Processing preProcessSDNCGetRequest.", "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during SDNC GET Method:\n" + e.getMessage())
}
- msoLogger.trace("end preProcessSDNCGet")
+ logger.trace("end preProcessSDNCGet")
}
public void updateAaiAROrchStatus(DelegateExecution execution, String status){
- msoLogger.trace("start updateAaiAROrchStatus")
+ logger.trace("start updateAaiAROrchStatus")
String aaiARPath = execution.getVariable("aaiARPath") //set during query (existing AR) or create
AllottedResourceUtils arUtils = new AllottedResourceUtils(this)
String orchStatus = arUtils.updateAROrchStatus(execution, status, aaiARPath)
- msoLogger.trace("end updateAaiAROrchStatus")
+ logger.trace("end updateAaiAROrchStatus")
}
public void generateOutputs(DelegateExecution execution)
{
- msoLogger.trace("start generateOutputs")
+ logger.trace("start generateOutputs")
try {
String sdncGetResponse = execution.getVariable("enhancedCallbackRequestData") //unescaped
- msoLogger.debug("resp:" + sdncGetResponse)
+ logger.debug("resp:" + sdncGetResponse)
String arData = utils.getNodeXml(sdncGetResponse, "tunnelxconn-topology")
arData = utils.removeXmlNamespaces(arData)
@@ -549,55 +555,55 @@ public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{
String ari = utils.getNodeXml(arData, "allotted-resource-identifiers")
execution.setVariable("allotedResourceName", utils.getNodeText(ari, "allotted-resource-name"))
} catch (BpmnError e) {
- msoLogger.debug("BPMN Error in generateOutputs ")
+ logger.debug("BPMN Error in generateOutputs ")
} catch(Exception ex) {
String msg = "Exception in generateOutputs " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
}
- msoLogger.trace("end generateOutputs")
+ logger.trace("end generateOutputs")
}
public void preProcessRollback (DelegateExecution execution) {
- msoLogger.trace("start preProcessRollback")
+ logger.trace("start preProcessRollback")
try {
Object workflowException = execution.getVariable("WorkflowException");
if (workflowException instanceof WorkflowException) {
- msoLogger.debug("Prev workflowException: " + workflowException.getErrorMessage())
+ logger.debug("Prev workflowException: " + workflowException.getErrorMessage())
execution.setVariable("prevWorkflowException", workflowException);
//execution.setVariable("WorkflowException", null);
}
} catch (BpmnError e) {
- msoLogger.debug("BPMN Error during preProcessRollback")
+ logger.debug("BPMN Error during preProcessRollback")
} catch(Exception ex) {
String msg = "Exception in preProcessRollback. " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
}
- msoLogger.trace("end preProcessRollback")
+ logger.trace("end preProcessRollback")
}
public void postProcessRollback (DelegateExecution execution) {
- msoLogger.trace("start postProcessRollback")
+ logger.trace("start postProcessRollback")
String msg = ""
try {
Object workflowException = execution.getVariable("prevWorkflowException");
if (workflowException instanceof WorkflowException) {
- msoLogger.debug("Setting prevException to WorkflowException: ")
+ logger.debug("Setting prevException to WorkflowException: ")
execution.setVariable("WorkflowException", workflowException);
}
execution.setVariable("rollbackData", null)
} catch (BpmnError b) {
- msoLogger.debug("BPMN Error during postProcessRollback")
+ logger.debug("BPMN Error during postProcessRollback")
throw b;
} catch(Exception ex) {
msg = "Exception in postProcessRollback. " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
}
- msoLogger.trace("end postProcessRollback")
+ logger.trace("end postProcessRollback")
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollback.groovy
index 06d557532b..3d34e2de94 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollback.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollback.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -39,6 +41,8 @@ import static org.apache.commons.lang3.StringUtils.*
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
/**
* This groovy class supports the <class>CreateAllottedResourceTXCRollback.bpmn</class> process.
@@ -57,7 +61,7 @@ import org.onap.so.logger.MsoLogger
*
*/
public class DoCreateAllottedResourceTXCRollback extends AbstractServiceTaskProcessor{
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCreateAllottedResourceTXCRollback.class);
+ private static final Logger logger = LoggerFactory.getLogger(DoCreateAllottedResourceTXCRollback.class);
String Prefix="DCARTXCRB_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
@@ -66,13 +70,13 @@ public class DoCreateAllottedResourceTXCRollback extends AbstractServiceTaskProc
String msg = ""
- msoLogger.trace("start preProcessRequest")
+ logger.trace("start preProcessRequest")
execution.setVariable("prefix", Prefix)
String rbType = "DCARTXC_"
try {
def rollbackData = execution.getVariable("rollbackData")
- msoLogger.debug("RollbackData:" + rollbackData)
+ logger.debug("RollbackData:" + rollbackData)
if (rollbackData != null) {
if (rollbackData.hasType(rbType)) {
@@ -97,9 +101,9 @@ public class DoCreateAllottedResourceTXCRollback extends AbstractServiceTaskProc
execution.setVariable("deleteSdnc", rollbackData.get(rbType, "rollbackSDNCcreate"))
execution.setVariable("unassignSdnc", rollbackData.get(rbType, "rollbackSDNCassign"))
- msoLogger.debug("sdncDeactivate:\n" + execution.getVariable("deactivateSdnc") )
- msoLogger.debug("sdncDelete:\n" + execution.getVariable("deleteSdnc"))
- msoLogger.debug("sdncUnassign:\n" + execution.getVariable("unassignSdnc"))
+ logger.debug("sdncDeactivate:\n" + execution.getVariable("deactivateSdnc") )
+ logger.debug("sdncDelete:\n" + execution.getVariable("deleteSdnc"))
+ logger.debug("sdncUnassign:\n" + execution.getVariable("unassignSdnc"))
execution.setVariable("sdncDeactivateRequest", rollbackData.get(rbType, "sdncActivateRollbackReq"))
execution.setVariable("sdncDeleteRequest", rollbackData.get(rbType, "sdncCreateRollbackReq"))
@@ -124,24 +128,24 @@ public class DoCreateAllottedResourceTXCRollback extends AbstractServiceTaskProc
}
}catch(BpmnError b){
- msoLogger.debug("Rethrowing MSOWorkflowException")
+ logger.debug("Rethrowing MSOWorkflowException")
throw b
} catch (Exception ex){
msg = "Exception in preProcessRequest " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("end preProcessRequest")
+ logger.trace("end preProcessRequest")
}
// aaiARPath set during query (existing AR)
public void updateAaiAROrchStatus(DelegateExecution execution, String status){
String msg = null;
- msoLogger.trace("start updateAaiAROrchStatus")
+ logger.trace("start updateAaiAROrchStatus")
AllottedResourceUtils arUtils = new AllottedResourceUtils(this)
String aaiARPath = execution.getVariable("aaiARPath")
- msoLogger.debug(" aaiARPath:" + aaiARPath)
+ logger.debug(" aaiARPath:" + aaiARPath)
Optional<AllottedResource> ar = Optional.empty(); //need this for getting resourceVersion for delete
if (!isBlank(aaiARPath))
{
@@ -150,73 +154,75 @@ public class DoCreateAllottedResourceTXCRollback extends AbstractServiceTaskProc
if (!ar.isPresent())
{
msg = "AR not found in AAI at:" + aaiARPath
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
}
String orchStatus = arUtils.updateAROrchStatus(execution, status, aaiARPath)
- msoLogger.trace("end updateAaiAROrchStatus")
+ logger.trace("end updateAaiAROrchStatus")
}
public void validateSDNCResp(DelegateExecution execution, String response, String method){
- msoLogger.trace("start ValidateSDNCResponse Process")
+ logger.trace("start ValidateSDNCResponse Process")
String msg = ""
try {
WorkflowException workflowException = execution.getVariable("WorkflowException")
- msoLogger.debug("workflowException: " + workflowException)
+ logger.debug("workflowException: " + workflowException)
boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator")
- msoLogger.debug("SDNCResponse: " + response)
+ logger.debug("SDNCResponse: " + response)
SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this)
sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator)
if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){
- msoLogger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + response)
+ logger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + response)
}else{
- msoLogger.debug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.")
+ logger.debug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.")
throw new BpmnError("MSOWorkflowException")
}
} catch (BpmnError e) {
if ("404".contentEquals(e.getErrorCode()))
{
msg = "SDNC rollback " + method + " returned a 404. Proceding with rollback"
- msoLogger.debug(msg)
+ logger.debug(msg)
}
else {
throw e;
}
} catch(Exception ex) {
msg = "Exception in validateSDNCResp. " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("Exit ValidateSDNCResp Process")
+ logger.trace("Exit ValidateSDNCResp Process")
}
public void deleteAaiAR(DelegateExecution execution){
try{
- msoLogger.trace("start deleteAaiAR")
+ logger.trace("start deleteAaiAR")
AllottedResourceUtils arUtils = new AllottedResourceUtils(this)
String arLink = execution.getVariable("aaiARPath")
arUtils.deleteAR(execution, arLink)
} catch (BpmnError e) {
throw e;
}catch(Exception ex){
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occurred Processing preProcessSDNCGetRequest.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + ex);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Occurred Processing preProcessSDNCGetRequest.", "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during SDNC GET Method:\n" + ex.getMessage())
}
- msoLogger.trace("end deleteAaiAR")
+ logger.trace("end deleteAaiAR")
}
public void postProcessRequest(DelegateExecution execution) {
- msoLogger.trace("start postProcessRequest")
+ logger.trace("start postProcessRequest")
String msg = ""
try {
execution.setVariable("rollbackData", null)
@@ -224,51 +230,51 @@ public class DoCreateAllottedResourceTXCRollback extends AbstractServiceTaskProc
if (skipRollback != true)
{
execution.setVariable("rolledBack", true)
- msoLogger.debug("rolledBack")
+ logger.debug("rolledBack")
}
- msoLogger.trace("end postProcessRequest")
+ logger.trace("end postProcessRequest")
} catch (BpmnError e) {
- msoLogger.debug(msg)
+ logger.debug(msg)
} catch (Exception ex) {
msg = "Exception in postProcessRequest. " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
}
}
public void processRollbackException(DelegateExecution execution){
- msoLogger.trace("start processRollbackException")
+ logger.trace("start processRollbackException")
try{
- msoLogger.debug("Caught an Exception in DoCreateAllottedResourceRollback")
+ logger.debug("Caught an Exception in DoCreateAllottedResourceRollback")
execution.setVariable("rollbackData", null)
execution.setVariable("rolledBack", false)
execution.setVariable("rollbackError", "Caught exception in AllottedResource Create Rollback")
execution.setVariable("WorkflowException", null)
}catch(BpmnError b){
- msoLogger.debug("BPMN Error during processRollbackExceptions Method: ")
+ logger.debug("BPMN Error during processRollbackExceptions Method: ")
}catch(Exception e){
- msoLogger.debug("Caught Exception during processRollbackExceptions Method: " + e.getMessage())
+ logger.debug("Caught Exception during processRollbackExceptions Method: " + e.getMessage())
}
- msoLogger.trace("end processRollbackException")
+ logger.trace("end processRollbackException")
}
public void processRollbackJavaException(DelegateExecution execution){
- msoLogger.trace("start processRollbackJavaException")
+ logger.trace("start processRollbackJavaException")
try{
execution.setVariable("rollbackData", null)
execution.setVariable("rolledBack", false)
execution.setVariable("rollbackError", "Caught Java exception in AllottedResource Create Rollback")
- msoLogger.debug("Caught Exception in processRollbackJavaException")
+ logger.debug("Caught Exception in processRollbackJavaException")
}catch(Exception e){
- msoLogger.debug("Caught Exception in processRollbackJavaException " + e.getMessage())
+ logger.debug("Caught Exception in processRollbackJavaException " + e.getMessage())
}
- msoLogger.trace("end processRollbackJavaException")
+ logger.trace("end processRollbackJavaException")
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRG.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRG.groovy
index e39edffe68..3b80f3c468 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRG.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRG.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -31,6 +33,8 @@ import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
import static org.apache.commons.lang3.StringUtils.isBlank
@@ -58,7 +62,7 @@ import static org.apache.commons.lang3.StringUtils.isBlank
*
*/
public class DoDeleteAllottedResourceBRG extends AbstractServiceTaskProcessor{
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoDeleteAllottedResourceBRG.class);
+ private static final Logger logger = LoggerFactory.getLogger(DoDeleteAllottedResourceBRG.class);
String Prefix="DDARBRG_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
@@ -66,7 +70,7 @@ public class DoDeleteAllottedResourceBRG extends AbstractServiceTaskProcessor{
public void preProcessRequest (DelegateExecution execution) {
String msg = ""
- msoLogger.trace("start preProcessRequest")
+ logger.trace("start preProcessRequest")
try {
execution.setVariable("prefix", Prefix)
@@ -75,38 +79,38 @@ public class DoDeleteAllottedResourceBRG extends AbstractServiceTaskProcessor{
String sdncCallbackUrl = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution)
if (isBlank(sdncCallbackUrl)) {
msg = "mso.workflow.sdncadapter.callback is null"
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
}
execution.setVariable("sdncCallbackUrl", sdncCallbackUrl)
- msoLogger.debug("SDNC Callback URL: " + sdncCallbackUrl)
+ logger.debug("SDNC Callback URL: " + sdncCallbackUrl)
//Request Inputs
if (isBlank(execution.getVariable("serviceInstanceId"))){
msg = "Input serviceInstanceId is null"
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
}
if (isBlank(execution.getVariable("allottedResourceId"))){
msg = "Input allottedResourceId is null"
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
}
}catch(BpmnError b){
- msoLogger.debug("Rethrowing MSOWorkflowException")
+ logger.debug("Rethrowing MSOWorkflowException")
throw b
} catch (Exception ex){
msg = "Exception in preProcessRequest " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("end preProcessRequest")
+ logger.trace("end preProcessRequest")
}
public void getAaiAR (DelegateExecution execution) {
- msoLogger.trace("start getAaiAR end")
+ logger.trace("start getAaiAR end")
String allottedResourceId = execution.getVariable("allottedResourceId")
@@ -123,26 +127,26 @@ public class DoDeleteAllottedResourceBRG extends AbstractServiceTaskProcessor{
errorMsg = "Allotted resource not found in AAI with AllottedResourceId:" + allottedResourceId
}
if (!isBlank(errorMsg)) {
- msoLogger.debug(errorMsg)
+ logger.debug(errorMsg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, errorMsg)
}
- msoLogger.trace("end getAaiAR")
+ logger.trace("end getAaiAR")
}
// aaiARPath set during query (existing AR)
public void updateAaiAROrchStatus(DelegateExecution execution, String status){
- msoLogger.trace("start updateAaiAROrchStatus")
+ logger.trace("start updateAaiAROrchStatus")
AllottedResourceUtils arUtils = new AllottedResourceUtils(this)
String aaiARPath = execution.getVariable("aaiARPath") //set during query (existing AR)
String orchStatus = arUtils.updateAROrchStatus(execution, status, aaiARPath)
- msoLogger.trace("end updateAaiAROrchStatus")
+ logger.trace("end updateAaiAROrchStatus")
}
public String buildSDNCRequest(DelegateExecution execution, String action, String sdncRequestId) {
String msg = ""
- msoLogger.trace("start buildSDNCRequest")
+ logger.trace("start buildSDNCRequest")
String sdncReq = null
try {
@@ -214,106 +218,107 @@ public class DoDeleteAllottedResourceBRG extends AbstractServiceTaskProcessor{
</sdncadapterworkflow:SDNCRequestData>
</sdncadapterworkflow:SDNCAdapterWorkflowRequest>"""
- msoLogger.debug("sdncRequest:\n" + sdncReq)
+ logger.debug("sdncRequest:\n" + sdncReq)
sdncReq = utils.formatXml(sdncReq)
} catch(Exception ex) {
msg = "Exception in buildSDNCRequest. " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("end buildSDNCRequest")
+ logger.trace("end buildSDNCRequest")
return sdncReq
}
public void preProcessSDNCUnassign(DelegateExecution execution) {
String msg = ""
- msoLogger.trace("start preProcessSDNCUnassign")
+ logger.trace("start preProcessSDNCUnassign")
try {
String sdncRequestId = UUID.randomUUID().toString()
String sdncUnassignReq = buildSDNCRequest(execution, "unassign", sdncRequestId)
execution.setVariable("sdncUnassignRequest", sdncUnassignReq)
- msoLogger.debug("sdncUnassignRequest: " + sdncUnassignReq)
+ logger.debug("sdncUnassignRequest: " + sdncUnassignReq)
} catch (BpmnError e) {
throw e;
} catch(Exception ex) {
msg = "Exception in preProcessSDNCUnassign. " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("end preProcessSDNCUnassign")
+ logger.trace("end preProcessSDNCUnassign")
}
public void preProcessSDNCDelete(DelegateExecution execution) {
String msg = ""
- msoLogger.trace("start preProcessSDNCDelete")
+ logger.trace("start preProcessSDNCDelete")
try {
String sdncRequestId = UUID.randomUUID().toString()
String sdncDeleteReq = buildSDNCRequest(execution, "delete", sdncRequestId)
execution.setVariable("sdncDeleteRequest", sdncDeleteReq)
- msoLogger.debug("sdncDeleteReq: " + sdncDeleteReq)
+ logger.debug("sdncDeleteReq: " + sdncDeleteReq)
} catch (BpmnError e) {
throw e;
} catch(Exception ex) {
msg = "Exception in preProcessSDNCDelete. " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("end preProcessSDNCDelete")
+ logger.trace("end preProcessSDNCDelete")
}
public void preProcessSDNCDeactivate(DelegateExecution execution) {
String msg = ""
- msoLogger.trace("start preProcessSDNCDeactivate")
+ logger.trace("start preProcessSDNCDeactivate")
try {
String sdncRequestId = UUID.randomUUID().toString()
String sdncDeactivateReq = buildSDNCRequest(execution, "deactivate", sdncRequestId)
execution.setVariable("sdncDeactivateRequest", sdncDeactivateReq)
- msoLogger.debug("sdncDeactivateReq: " + sdncDeactivateReq)
+ logger.debug("sdncDeactivateReq: " + sdncDeactivateReq)
} catch (BpmnError e) {
throw e;
} catch(Exception ex) {
msg = "Exception in preProcessSDNCDeactivate. " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("end preProcessSDNCDeactivate")
+ logger.trace("end preProcessSDNCDeactivate")
}
public void validateSDNCResp(DelegateExecution execution, String response, String method){
- msoLogger.trace("start ValidateSDNCResponse Process")
+ logger.trace("start ValidateSDNCResponse Process")
String msg = ""
try {
WorkflowException workflowException = execution.getVariable("WorkflowException")
- msoLogger.debug("workflowException: " + workflowException)
+ logger.debug("workflowException: " + workflowException)
boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator")
- msoLogger.debug("SDNCResponse: " + response)
+ logger.debug("SDNCResponse: " + response)
SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this)
sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator)
if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){
- msoLogger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + response)
-
+ logger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n"
+ + response)
}else{
String sdncRespCode = execution.getVariable(Prefix + 'sdncRequestDataResponseCode')
- msoLogger.debug(method + " AllottedResource received error response from SDNC. ResponseCode:" + sdncRespCode)
+ logger.debug(method + " AllottedResource received error response from SDNC. ResponseCode:"
+ + sdncRespCode)
if (sdncRespCode.equals("404") && "deactivate".equals(method))
{
execution.setVariable("ARNotFoundInSDNC", true)
if ("true".equals(execution.getVariable("failNotFound")))
{
msg = "Allotted Resource Not found in SDNC"
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
else
@@ -330,14 +335,14 @@ public class DoDeleteAllottedResourceBRG extends AbstractServiceTaskProcessor{
throw e;
} catch(Exception ex) {
msg = "Exception in validateSDNCResp. " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("end ValidateSDNCResp Process")
+ logger.trace("end ValidateSDNCResp Process")
}
public void deleteAaiAR(DelegateExecution execution){
- msoLogger.trace("start deleteAaiAR")
+ logger.trace("start deleteAaiAR")
try{
AllottedResourceUtils arUtils = new AllottedResourceUtils(this)
@@ -346,10 +351,12 @@ public class DoDeleteAllottedResourceBRG extends AbstractServiceTaskProcessor{
} catch (BpmnError e) {
throw e;
}catch(Exception ex){
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occurred Processing preProcessSDNCGetRequest." + ex, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:" + ex);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Occurred Processing preProcessSDNCGetRequest." + ex, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:" + ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during SDNC GET Method:\n" + ex.getMessage())
}
- msoLogger.trace("end deleteAaiAR")
+ logger.trace("end deleteAaiAR")
}
public AllottedResourceUtils getAllottedResourceUtils(){
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXC.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXC.groovy
index f305a7ad0d..9b9f9f0388 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXC.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXC.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -31,6 +33,9 @@ import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+
import static org.apache.commons.lang3.StringUtils.isBlank
/**
@@ -57,7 +62,7 @@ import static org.apache.commons.lang3.StringUtils.isBlank
*
*/
public class DoDeleteAllottedResourceTXC extends AbstractServiceTaskProcessor{
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoDeleteAllottedResourceTXC.class);
+ private static final Logger logger = LoggerFactory.getLogger(DoDeleteAllottedResourceTXC.class);
String Prefix="DDARTXC_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
@@ -65,7 +70,7 @@ public class DoDeleteAllottedResourceTXC extends AbstractServiceTaskProcessor{
public void preProcessRequest (DelegateExecution execution) {
String msg = ""
- msoLogger.trace("start preProcessRequest")
+ logger.trace("start preProcessRequest")
try {
execution.setVariable("prefix", Prefix)
@@ -74,38 +79,38 @@ public class DoDeleteAllottedResourceTXC extends AbstractServiceTaskProcessor{
String sdncCallbackUrl = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution)
if (isBlank(sdncCallbackUrl)) {
msg = "mso.workflow.sdncadapter.callback is null"
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
}
execution.setVariable("sdncCallbackUrl", sdncCallbackUrl)
- msoLogger.debug("SDNC Callback URL: " + sdncCallbackUrl)
+ logger.debug("SDNC Callback URL: " + sdncCallbackUrl)
//Request Inputs
if (isBlank(execution.getVariable("serviceInstanceId"))){
msg = "Input serviceInstanceId is null"
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
}
if (isBlank(execution.getVariable("allottedResourceId"))){
msg = "Input allottedResourceId is null"
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
}
}catch(BpmnError b){
- msoLogger.debug("Rethrowing MSOWorkflowException")
+ logger.debug("Rethrowing MSOWorkflowException")
throw b
} catch (Exception ex){
msg = "Exception in preProcessRequest " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("end preProcessRequest")
+ logger.trace("end preProcessRequest")
}
public void getAaiAR (DelegateExecution execution) {
- msoLogger.trace("start getAaiAR")
+ logger.trace("start getAaiAR")
String allottedResourceId = execution.getVariable("allottedResourceId")
@@ -122,10 +127,10 @@ public class DoDeleteAllottedResourceTXC extends AbstractServiceTaskProcessor{
errorMsg = "Allotted resource not found in AAI with AllottedResourceId:" + allottedResourceId
}
if (!isBlank(errorMsg)) {
- msoLogger.debug(errorMsg)
+ logger.debug(errorMsg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, errorMsg)
}
- msoLogger.trace("end getAaiAR")
+ logger.trace("end getAaiAR")
}
@@ -135,17 +140,17 @@ public class DoDeleteAllottedResourceTXC extends AbstractServiceTaskProcessor{
// aaiARPath set during query (existing AR)
public void updateAaiAROrchStatus(DelegateExecution execution, String status){
- msoLogger.trace("start updateAaiAROrchStatus")
+ logger.trace("start updateAaiAROrchStatus")
AllottedResourceUtils arUtils = new AllottedResourceUtils(this)
String aaiARPath = execution.getVariable("aaiARPath") //set during query (existing AR)
String orchStatus = arUtils.updateAROrchStatus(execution, status, aaiARPath)
- msoLogger.trace("end updateAaiAROrchStatus")
+ logger.trace("end updateAaiAROrchStatus")
}
public String buildSDNCRequest(DelegateExecution execution, String action, String sdncRequestId) {
String msg = ""
- msoLogger.trace("start buildSDNCRequest")
+ logger.trace("start buildSDNCRequest")
String sdncReq = null
try {
@@ -217,106 +222,107 @@ public class DoDeleteAllottedResourceTXC extends AbstractServiceTaskProcessor{
</sdncadapterworkflow:SDNCRequestData>
</sdncadapterworkflow:SDNCAdapterWorkflowRequest>"""
- msoLogger.debug("sdncRequest:\n" + sdncReq)
+ logger.debug("sdncRequest:\n" + sdncReq)
sdncReq = utils.formatXml(sdncReq)
} catch(Exception ex) {
msg = "Exception in buildSDNCRequest. " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("end buildSDNCRequest")
+ logger.trace("end buildSDNCRequest")
return sdncReq
}
public void preProcessSDNCUnassign(DelegateExecution execution) {
String msg = ""
- msoLogger.trace("start preProcessSDNCUnassign")
+ logger.trace("start preProcessSDNCUnassign")
try {
String sdncRequestId = UUID.randomUUID().toString()
String sdncUnassignReq = buildSDNCRequest(execution, "unassign", sdncRequestId)
execution.setVariable("sdncUnassignRequest", sdncUnassignReq)
- msoLogger.debug("sdncUnassignRequest: " + sdncUnassignReq)
+ logger.debug("sdncUnassignRequest: " + sdncUnassignReq)
} catch (BpmnError e) {
throw e;
} catch(Exception ex) {
msg = "Exception in preProcessSDNCUnassign. " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("end preProcessSDNCUnassign")
+ logger.trace("end preProcessSDNCUnassign")
}
public void preProcessSDNCDelete(DelegateExecution execution) {
String msg = ""
- msoLogger.trace("start preProcessSDNCDelete")
+ logger.trace("start preProcessSDNCDelete")
try {
String sdncRequestId = UUID.randomUUID().toString()
String sdncDeleteReq = buildSDNCRequest(execution, "delete", sdncRequestId)
execution.setVariable("sdncDeleteRequest", sdncDeleteReq)
- msoLogger.debug("sdncDeleteReq: " + sdncDeleteReq)
+ logger.debug("sdncDeleteReq: " + sdncDeleteReq)
} catch (BpmnError e) {
throw e;
} catch(Exception ex) {
msg = "Exception in preProcessSDNCDelete. " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("end preProcessSDNCDelete")
+ logger.trace("end preProcessSDNCDelete")
}
public void preProcessSDNCDeactivate(DelegateExecution execution) {
String msg = ""
- msoLogger.trace("start preProcessSDNCDeactivate")
+ logger.trace("start preProcessSDNCDeactivate")
try {
String sdncRequestId = UUID.randomUUID().toString()
String sdncDeactivateReq = buildSDNCRequest(execution, "deactivate", sdncRequestId)
execution.setVariable("sdncDeactivateRequest", sdncDeactivateReq)
- msoLogger.debug("sdncDeactivateReq: " + sdncDeactivateReq)
+ logger.debug("sdncDeactivateReq: " + sdncDeactivateReq)
} catch (BpmnError e) {
throw e;
} catch(Exception ex) {
msg = "Exception in preProcessSDNCDeactivate. " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("end preProcessSDNCDeactivate")
+ logger.trace("end preProcessSDNCDeactivate")
}
public void validateSDNCResp(DelegateExecution execution, String response, String method){
- msoLogger.trace("start ValidateSDNCResponse Process")
+ logger.trace("start ValidateSDNCResponse Process")
String msg = ""
try {
WorkflowException workflowException = execution.getVariable("WorkflowException")
- msoLogger.debug("workflowException: " + workflowException)
+ logger.debug("workflowException: " + workflowException)
boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator")
- msoLogger.debug("SDNCResponse: " + response)
+ logger.debug("SDNCResponse: " + response)
SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this)
sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator)
if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){
- msoLogger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + response)
-
+ logger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n"
+ + response)
}else{
String sdncRespCode = execution.getVariable(Prefix + 'sdncRequestDataResponseCode')
- msoLogger.debug(method + " AllottedResource received error response from SDNC. ResponseCode:" + sdncRespCode)
+ logger.debug(method + " AllottedResource received error response from SDNC. ResponseCode:"
+ + sdncRespCode)
if (sdncRespCode.equals("404") && "deactivate".equals(method))
{
execution.setVariable("ARNotFoundInSDNC", true)
if ("true".equals(execution.getVariable("failNotFound")))
{
msg = "Allotted Resource Not found in SDNC"
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
else
@@ -333,14 +339,14 @@ public class DoDeleteAllottedResourceTXC extends AbstractServiceTaskProcessor{
throw e;
} catch(Exception ex) {
msg = "Exception in validateSDNCResp. " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("end Exit ValidateSDNCResp Process")
+ logger.trace("end Exit ValidateSDNCResp Process")
}
public void deleteAaiAR(DelegateExecution execution){
- msoLogger.trace("start deleteAaiAR")
+ logger.trace("start deleteAaiAR")
try{
AllottedResourceUtils arUtils = new AllottedResourceUtils(this)
@@ -349,11 +355,12 @@ public class DoDeleteAllottedResourceTXC extends AbstractServiceTaskProcessor{
} catch (BpmnError e) {
throw e;
}catch(Exception ex){
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occurred Processing preProcessSDNCGetRequest.", "BPMN", MsoLogger.getServiceName(),
- MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + ex);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Occurred Processing preProcessSDNCGetRequest.", "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during SDNC GET Method:\n" + ex.getMessage())
}
- msoLogger.trace("end deleteAaiAR")
+ logger.trace("end deleteAaiAR")
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustServiceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustServiceTest.groovy
index 160eee2337..93a7115add 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustServiceTest.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustServiceTest.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -19,1338 +21,1251 @@
*/
package org.onap.so.bpmn.vcpe.scripts
-
-import org.camunda.bpm.engine.ProcessEngineServices
-import org.camunda.bpm.engine.RepositoryService
+import com.github.tomakehurst.wiremock.junit.WireMockRule
+import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity
-import org.camunda.bpm.engine.repository.ProcessDefinition
import org.junit.Before
import org.junit.BeforeClass
import org.junit.Rule
import org.junit.Test
-import org.junit.Ignore
import org.mockito.MockitoAnnotations
-import org.camunda.bpm.engine.delegate.BpmnError
import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.bpmn.core.WorkflowException
-import org.onap.so.bpmn.core.domain.HomingSolution
+import org.onap.so.bpmn.core.domain.*
import org.onap.so.bpmn.mock.FileUtil
-import static com.github.tomakehurst.wiremock.client.WireMock.aResponse
-import static com.github.tomakehurst.wiremock.client.WireMock.get
-import static com.github.tomakehurst.wiremock.client.WireMock.patch
-import static com.github.tomakehurst.wiremock.client.WireMock.put
-import static com.github.tomakehurst.wiremock.client.WireMock.stubFor
-import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching
-import static org.junit.Assert.*;
+import static org.junit.Assert.*
+import static org.mockito.ArgumentMatchers.any
+import static org.mockito.ArgumentMatchers.endsWith
import static org.mockito.Mockito.*
-import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetAllottedResource
-import org.onap.so.bpmn.core.domain.ServiceDecomposition
-import org.onap.so.bpmn.core.domain.VnfResource
-import org.onap.so.bpmn.core.domain.AllottedResource
-import org.onap.so.bpmn.core.domain.ModelInfo
-import org.onap.so.bpmn.core.domain.HomingSolution
-import org.onap.so.bpmn.core.RollbackData
-import org.onap.so.bpmn.vcpe.scripts.MapGetter
-import org.onap.so.bpmn.vcpe.scripts.MapSetter
-
-import com.github.tomakehurst.wiremock.junit.WireMockRule
class CreateVcpeResCustServiceTest extends GroovyTestBase {
-
- private static String request
-
- @Rule
- public WireMockRule wireMockRule = new WireMockRule(PORT)
-
- String Prefix = "CVRCS_"
- String RbType = "DCRENI_"
-
- @BeforeClass
- public static void setUpBeforeClass() {
- request = FileUtil.readResourceFile("__files/VCPE/CreateVcpeResCustService/request.json")
- }
-
+
+ private static String request
+
+ @Rule
+ public WireMockRule wireMockRule = new WireMockRule(PORT)
+
+ String Prefix = "CVRCS_"
+
+ @BeforeClass
+ public static void setUpBeforeClass() {
+ request = FileUtil.readResourceFile("__files/VCPE/CreateVcpeResCustService/request.json")
+ }
+
@Before
- public void init()
- {
- MockitoAnnotations.initMocks(this)
- }
-
- public CreateVcpeResCustServiceTest() {
- super("CreateVcpeResCustService")
- }
-
-
- // ***** preProcessRequest *****
-
- @Test
- public void preProcessRequest() {
- ExecutionEntity mex = setupMock()
- def map = setupMap(mex)
-
- initPreProcess(mex)
-
- CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
- CreateVcpeResCustService.preProcessRequest(mex)
-
- verify(mex).getVariable(DBGFLAG)
- verify(mex).setVariable("prefix", Prefix)
- verify(mex).setVariable("createVcpeServiceRequest", request)
- verify(mex).setVariable("msoRequestId", "mri")
- assertEquals("sii", map.get("serviceInstanceId"))
- verify(mex).setVariable("requestAction", "ra")
- verify(mex).setVariable("source", "VID")
- verify(mex).setVariable("globalSubscriberId", CUST)
- verify(mex).setVariable("globalCustomerId", CUST)
- verify(mex).setVariable("subscriptionServiceType", SVC)
- verify(mex).setVariable("disableRollback", "false")
- verify(mex).setVariable("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb")
- assertTrue(map.containsKey("subscriberInfo"))
-
- verify(mex).setVariable("brgWanMacAddress", "brgmac")
- verify(mex).setVariable("customerLocation", ["customerLatitude":"32.897480", "customerLongitude":"-97.040443", "customerName":"some_company"])
- verify(mex).setVariable("homingService", "sniro")
- assertTrue(map.containsKey("serviceInputParams"))
- assertTrue(map.containsKey(Prefix+"requestInfo"))
-
- def reqinfo = map.get(Prefix+"requestInfo")
- assertTrue(reqinfo.indexOf("<request-id>mri</") >= 0)
- assertTrue(reqinfo.indexOf("<source>VID</") >= 0)
-
- assertTrue(map.containsKey("vfModuleNames"))
- }
-
- @Test
- // @Ignore
- public void preProcessRequest_MissingAaiDistDelay() {
- ExecutionEntity mex = setupMock()
- def map = setupMap(mex)
- initPreProcess(mex)
-
- when(mex.getVariable("aai.workflowAaiDistributionDelay")).thenReturn(null)
-
- CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
-
- assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.preProcessRequest(mex) }))
- }
-
- @Test
- @Ignore // 1802 merge
- public void preProcessRequest_EmptyParts() {
- ExecutionEntity mex = setupMock()
- def map = setupMap(mex)
- initPreProcess(mex)
-
- def req = request
- .replace('"source"', '"sourceXXX"')
- .replace('"BRG_WAN_MAC_Address"', '"BRG_WAN_MAC_AddressXXX"')
- .replace('"Customer_Location"', '"Customer_LocationXXX"')
-
- when(mex.getVariable("bpmnRequest")).thenReturn(req)
- when(mex.getVariable("serviceInstanceId")).thenReturn(null)
-
- CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
- CreateVcpeResCustService.preProcessRequest(mex)
-
- verify(mex).getVariable(DBGFLAG)
- verify(mex).setVariable("prefix", Prefix)
- verify(mex).setVariable("createVcpeServiceRequest", req)
- verify(mex).setVariable("msoRequestId", "mri")
- assertNotNull(map.get("serviceInstanceId"))
- assertFalse(map.get("serviceInstanceId").isEmpty())
- verify(mex).setVariable("requestAction", "ra")
- verify(mex).setVariable("source", "VID")
- verify(mex).setVariable("globalSubscriberId", CUST)
- verify(mex).setVariable("globalCustomerId", CUST)
- verify(mex).setVariable("subscriptionServiceType", SVC)
- verify(mex).setVariable("disableRollback", "false")
- verify(mex).setVariable("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb")
- assertTrue(map.containsKey("subscriberInfo"))
-
- assertEquals("", map.get("brgWanMacAddress"))
- assertEquals("", map.get("customerLocation"))
- assertEquals("oof", map.get("homingService"))
- assertTrue(map.containsKey("serviceInputParams"))
- assertTrue(map.containsKey(Prefix+"requestInfo"))
-
- def reqinfo = map.get(Prefix+"requestInfo")
- println reqinfo
- assertTrue(reqinfo.indexOf("<request-id>mri</") >= 0)
- assertTrue(reqinfo.indexOf("<source>VID</") >= 0)
- }
-
- @Test
- // @Ignore
- public void preProcessRequest_MissingSubscriberId() {
- ExecutionEntity mex = setupMock()
- def map = setupMap(mex)
- initPreProcess(mex)
-
- def req = request
- .replace('"globalSubscriberId"', '"globalSubscriberIdXXX"')
-
- when(mex.getVariable("bpmnRequest")).thenReturn(req)
- when(mex.getVariable("serviceInstanceId")).thenReturn(null)
-
- CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
-
- assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.preProcessRequest(mex) }))
- }
-
- @Test
- @Ignore
- public void preProcessRequest_vimId() {
- ExecutionEntity mex = setupMock()
- def map = setupMap(mex)
- initPreProcess(mex)
- UrnPropertiesReader
-
- def req = request
- .replace('"mdt1"', '"CloudOwner_CloudRegion1"')
-
- when(mex.getVariable("bpmnRequest")).thenReturn(req)
- when(mex.getVariable("aai.workflowAaiDistributionDelay")).thenReturn("PT5S")
-
- CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
- CreateVcpeResCustService.preProcessRequest(mex)
-
- verify(mex).setVariable("cloudRegionId", "CloudRegion1")
- verify(mex).setVariable("cloudOwner", "CloudOwner")
- }
-
- @Test
- @Ignore
- public void preProcessRequest_noVimId() {
- ExecutionEntity mex = setupMock()
- def map = setupMap(mex)
- initPreProcess(mex)
-
- def req = request
- .replace('"mdt1"', '"CloudRegion1_"')
-
- when(mex.getVariable("bpmnRequest")).thenReturn(req)
- when(mex.getVariable("aai.workflowAaiDistributionDelay")).thenReturn("PT5S")
-
- CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
- CreateVcpeResCustService.preProcessRequest(mex)
-
- verify(mex).setVariable("cloudRegionId", "CloudRegion1_")
- verify(mex).setVariable("cloudOwner", "my-cloud-owner")
-
- }
-
-
- @Test
- // @Ignore
- public void preProcessRequest_BpmnError() {
- ExecutionEntity mex = setupMock()
- initPreProcess(mex)
-
- when(mex.getVariable("bpmnRequest")).thenThrow(new BpmnError("expected exception"))
-
- CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
-
- assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.preProcessRequest(mex) }))
- }
-
- @Test
- // @Ignore
- public void preProcessRequest_Ex() {
- ExecutionEntity mex = setupMock()
- initPreProcess(mex)
-
- when(mex.getVariable("bpmnRequest")).thenThrow(new RuntimeException("expected exception"))
-
- CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
-
- assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.preProcessRequest(mex) }))
- }
-
- // ***** sendSyncResponse *****
-
- @Test
- // @Ignore
- public void sendSyncResponse() {
- ExecutionEntity mex = setupMock()
- def map = setupMap(mex)
- initSendSyncResponse(mex)
-
- CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
- CreateVcpeResCustService.sendSyncResponse(mex)
-
- verify(mex, times(2)).getVariable(DBGFLAG)
-
- verify(mex).setVariable(processName+"WorkflowResponseSent", "true")
-
- assertEquals("202", map.get(processName+"ResponseCode"))
- assertEquals("Success", map.get(processName+"Status"))
-
- def resp = map.get(processName+"Response")
-
- assertTrue(resp.indexOf('"instanceId":"sii"') >= 0)
- assertTrue(resp.indexOf('"requestId":"mri"') >= 0)
- }
-
- @Test
- // @Ignore
- public void sendSyncResponse_Ex() {
- ExecutionEntity mex = setupMock()
- initSendSyncResponse(mex)
-
- when(mex.getVariable("serviceInstanceId")).thenThrow(new RuntimeException("expected exception"))
-
- CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
-
- assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.sendSyncResponse(mex) }))
- }
-
-
- // ***** prepareDecomposeService *****
-
- @Test
- // @Ignore
- public void prepareDecomposeService() {
- ExecutionEntity mex = setupMock()
- initPrepareDecomposeService(mex)
-
- CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
- CreateVcpeResCustService.prepareDecomposeService(mex)
-
- verify(mex).getVariable(DBGFLAG)
- verify(mex).setVariable("serviceModelInfo", "mi")
- }
-
- @Test
- // @Ignore
- public void prepareDecomposeService_Ex() {
- ExecutionEntity mex = setupMock()
- initPrepareDecomposeService(mex)
-
- when(mex.getVariable("createVcpeServiceRequest")).thenThrow(new RuntimeException("expected exception"))
-
- CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
-
- assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.prepareDecomposeService(mex) }))
- }
-
-
- // ***** prepareCreateServiceInstance *****
-
- @Test
- // @Ignore
- public void prepareCreateServiceInstance() {
- ExecutionEntity mex = setupMock()
- initPrepareCreateServiceInstance(mex)
-
- CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
- CreateVcpeResCustService.prepareCreateServiceInstance(mex)
-
- verify(mex).getVariable(DBGFLAG)
- verify(mex).setVariable("serviceInstanceName", "VCPE1")
- verify(mex).setVariable("serviceDecompositionString", "mydecomp")
- }
-
- @Test
- // @Ignore
- public void prepareCreateServiceInstance_Ex() {
- ExecutionEntity mex = setupMock()
- initPrepareCreateServiceInstance(mex)
-
- when(mex.getVariable("createVcpeServiceRequest")).thenThrow(new RuntimeException("expected exception"))
-
- CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
-
- assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.prepareCreateServiceInstance(mex) }))
- }
-
-
- // ***** postProcessServiceInstanceCreate *****
-
- @Test
- // @Ignore
- public void postProcessServiceInstanceCreate() {
- ExecutionEntity mex = setupMock()
- def map = setupMap(mex)
- initPostProcessServiceInstanceCreate(mex)
-
- CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
- CreateVcpeResCustService.postProcessServiceInstanceCreate(mex)
-
- verify(mex).getVariable(DBGFLAG)
-
- def reqinfo = map.get(Prefix+"setUpdateDbInstancePayload")
-
- assertTrue(reqinfo.indexOf("<requestId>mri</") >= 0)
- assertTrue(reqinfo.indexOf("<serviceInstanceId>sii</") >= 0)
- assertTrue(reqinfo.indexOf("<serviceInstanceName>sin</") >= 0)
- }
-
- @Test
- // @Ignore
- public void postProcessServiceInstanceCreate_BpmnError() {
- ExecutionEntity mex = setupMock()
- initPostProcessServiceInstanceCreate(mex)
-
- doThrow(new BpmnError("expected exception")).when(mex).setVariable(endsWith("setUpdateDbInstancePayload"), any())
-
- CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
-
- assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.postProcessServiceInstanceCreate(mex) }))
- }
-
- @Test
- // @Ignore
- public void postProcessServiceInstanceCreate_Ex() {
- ExecutionEntity mex = setupMock()
- initPostProcessServiceInstanceCreate(mex)
-
- doThrow(new RuntimeException("expected exception")).when(mex).setVariable(endsWith("setUpdateDbInstancePayload"), any())
-
- CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
-
- assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.postProcessServiceInstanceCreate(mex) }))
- }
-
-
- // ***** processDecomposition *****
-
- @Test
- // @Ignore
- public void processDecomposition() {
- ExecutionEntity mex = setupMock()
- def svcdecomp = initProcessDecomposition(mex)
-
- CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
- CreateVcpeResCustService.processDecomposition(mex)
-
- verify(mex).getVariable(DBGFLAG)
-
- verify(mex).setVariable("vnfList", svcdecomp.getVnfResources())
- verify(mex).setVariable("vnfListString", '[myvnf]')
- verify(mex).setVariable(Prefix+"VNFsCount", 1)
-
- verify(mex).setVariable("vnfModelInfo", "mymodel")
- verify(mex).setVariable("vnfModelInfoString", "mymodel")
- }
-
- @Test
- // @Ignore
- public void processDecomposition_EmptyNet_EmptyVnf() {
- ExecutionEntity mex = setupMock()
- def svcdecomp = initProcessDecomposition(mex)
-
- when(svcdecomp.getVnfResources()).thenReturn(new LinkedList<VnfResource>())
-
- CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
- CreateVcpeResCustService.processDecomposition(mex)
-
- verify(mex).getVariable(DBGFLAG)
-
- verify(mex).setVariable("vnfList", svcdecomp.getVnfResources())
- verify(mex).setVariable("vnfListString", '[]')
- verify(mex).setVariable(Prefix+"VNFsCount", 0)
-
- verify(mex).setVariable("vnfModelInfo", "")
- verify(mex).setVariable("vnfModelInfoString", "")
- }
-
- @Test
- // @Ignore
- public void processDecomposition_Ex() {
- ExecutionEntity mex = setupMock()
- def svcdecomp = initProcessDecomposition(mex)
-
- when(svcdecomp.getVnfResources()).thenThrow(new RuntimeException("expected exception"))
-
- CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
-
- assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.processDecomposition(mex) }))
- }
-
-
- // ***** filterVnfs *****
-
- @Test
- // @Ignore
- public void filterVnfs() {
- ExecutionEntity mex = setupMock()
- def svcdecomp = initFilterVnfs(mex)
-
- CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
- CreateVcpeResCustService.processDecomposition(mex)
-
- verify(mex).setVariable("vnfListString", '[myvnf3, myvnf5]')
- }
-
- @Test
- // @Ignore
- public void filterVnfs_Null() {
- ExecutionEntity mex = setupMock()
- def svcdecomp = initFilterVnfs(mex)
-
- when(svcdecomp.getVnfResources()).thenReturn(null)
-
- CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
- CreateVcpeResCustService.processDecomposition(mex)
-
- // nothing more to check, as long as it didn't throw an exception
- }
-
-
- // ***** prepareCreateAllottedResourceTXC *****
-
- @Test
- // @Ignore
- public void prepareCreateAllottedResourceTXC() {
- ExecutionEntity mex = setupMock()
- initPrepareCreateAllottedResourceTXC(mex)
-
- CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
- CreateVcpeResCustService.prepareCreateAllottedResourceTXC(mex)
-
- verify(mex).getVariable(DBGFLAG)
-
- verify(mex).setVariable("createTXCAR", true)
- verify(mex).setVariable("allottedResourceModelInfoTXC", "modelB")
- verify(mex).setVariable("allottedResourceRoleTXC", "TXCr")
- verify(mex).setVariable("allottedResourceTypeTXC", "Tunnel XConn")
- verify(mex).setVariable("parentServiceInstanceIdTXC", "homeB")
- }
-
- @Test
- // @Ignore
- public void prepareCreateAllottedResourceTXC_NullArList() {
- ExecutionEntity mex = setupMock()
- def svcdecomp = initPrepareCreateAllottedResourceTXC(mex)
-
- when(svcdecomp.getAllottedResources()).thenReturn(null)
-
- CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
- CreateVcpeResCustService.prepareCreateAllottedResourceTXC(mex)
-
- verify(mex).getVariable(DBGFLAG)
-
- verify(mex, never()).setVariable("createTXCAR", true)
- verify(mex, never()).setVariable("allottedResourceModelInfoTXC", "modelB")
- verify(mex, never()).setVariable("allottedResourceRoleTXC", "TXCr")
- verify(mex, never()).setVariable("allottedResourceTypeTXC", "Tunnel XConn")
- verify(mex, never()).setVariable("parentServiceInstanceIdTXC", "homeB")
- }
-
- @Test
- // @Ignore
- public void prepareCreateAllottedResourceTXC_Ex() {
- ExecutionEntity mex = setupMock()
- initPrepareCreateAllottedResourceTXC(mex)
-
- when(mex.getVariable("createVcpeServiceRequest")).thenThrow(new RuntimeException("expected exception"))
-
- CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
-
- assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.prepareCreateAllottedResourceTXC(mex) }))
- }
-
-
- // ***** prepareCreateAllottedResourceBRG *****
-
- @Test
- // @Ignore
- public void prepareCreateAllottedResourceBRG() {
- ExecutionEntity mex = setupMock()
- initPrepareCreateAllottedResourceBRG(mex)
-
- CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
- CreateVcpeResCustService.prepareCreateAllottedResourceBRG(mex)
-
- verify(mex).getVariable(DBGFLAG)
-
- verify(mex).setVariable("createBRGAR", true)
- verify(mex).setVariable("allottedResourceModelInfoBRG", "modelB")
- verify(mex).setVariable("allottedResourceRoleBRG", "BRGr")
- verify(mex).setVariable("allottedResourceTypeBRG", "BRG")
- verify(mex).setVariable("parentServiceInstanceIdBRG", "homeB")
- }
-
- @Test
- // @Ignore
- public void prepareCreateAllottedResourceBRG_NullArList() {
- ExecutionEntity mex = setupMock()
- def svcdecomp = initPrepareCreateAllottedResourceBRG(mex)
-
- when(svcdecomp.getAllottedResources()).thenReturn(null)
-
- CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
- CreateVcpeResCustService.prepareCreateAllottedResourceBRG(mex)
-
- verify(mex).getVariable(DBGFLAG)
-
- verify(mex, never()).setVariable("createBRGAR", true)
- verify(mex, never()).setVariable("allottedResourceModelInfoBRG", "modelB")
- verify(mex, never()).setVariable("allottedResourceRoleBRG", "BRGr")
- verify(mex, never()).setVariable("allottedResourceTypeBRG", "BRG")
- verify(mex, never()).setVariable("parentServiceInstanceIdBRG", "homeB")
- }
-
- @Test
- // @Ignore
- public void prepareCreateAllottedResourceBRG_Ex() {
- ExecutionEntity mex = setupMock()
- initPrepareCreateAllottedResourceBRG(mex)
-
- when(mex.getVariable("createVcpeServiceRequest")).thenThrow(new RuntimeException("expected exception"))
-
- CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
-
- assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.prepareCreateAllottedResourceBRG(mex) }))
- }
-
-
- // ***** prepareVnfAndModulesCreate *****
-
- @Test
- // @Ignore
- public void prepareVnfAndModulesCreate() {
- ExecutionEntity mex = setupMock()
- initPrepareVnfAndModulesCreate(mex)
-
- CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
- CreateVcpeResCustService.prepareVnfAndModulesCreate(mex)
-
- verify(mex).getVariable(DBGFLAG)
-
- verify(mex).setVariable("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb")
- verify(mex).setVariable("lcpCloudRegionId", "mdt1")
- verify(mex).setVariable("cloudOwner", "my-cloud-owner")
- verify(mex).setVariable("tenantId", "8b1df54faa3b49078e3416e21370a3ba")
- }
-
- @Test
- public void prepareVnfAndModulesCreate_noVimId() {
- ExecutionEntity mex = setupMock()
- initPrepareVnfAndModulesCreate(mex)
-
- def req = request
- .replace('"mdt1"', '"CloudRegion1_"')
-
- when(mex.getVariable("createVcpeServiceRequest")).thenReturn(req)
-
- CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
- CreateVcpeResCustService.prepareVnfAndModulesCreate(mex)
-
- verify(mex).setVariable("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb")
- verify(mex).setVariable("cloudRegionId", "CloudRegion1_")
- verify(mex).setVariable("lcpCloudRegionId", "CloudRegion1_")
- verify(mex).setVariable("tenantId", "8b1df54faa3b49078e3416e21370a3ba")
- }
-
- @Test
- public void prepareVnfAndModulesCreate_vimId() {
- ExecutionEntity mex = setupMock()
- initPrepareVnfAndModulesCreate(mex)
-
- def req = request
- .replace('"mdt1"', '"CloudOwner_CloudRegion1"')
-
- when(mex.getVariable("createVcpeServiceRequest")).thenReturn(req)
-
- CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
- CreateVcpeResCustService.prepareVnfAndModulesCreate(mex)
-
- verify(mex).setVariable("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb")
- verify(mex).setVariable("cloudOwner", "CloudOwner")
- verify(mex).setVariable("cloudRegionId", "CloudRegion1")
- verify(mex).setVariable("lcpCloudRegionId", "CloudRegion1")
- verify(mex).setVariable("tenantId", "8b1df54faa3b49078e3416e21370a3ba")
- }
-
- @Test
- // @Ignore
- public void prepareVnfAndModulesCreate_EmptyList() {
- ExecutionEntity mex = setupMock()
- initPrepareVnfAndModulesCreate(mex)
-
- when(mex.getVariable("vnfList")).thenReturn(new LinkedList<VnfResource>())
-
- CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
- CreateVcpeResCustService.prepareVnfAndModulesCreate(mex)
-
- verify(mex).getVariable(DBGFLAG)
-
- verify(mex).setVariable("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb")
- verify(mex).setVariable("lcpCloudRegionId", "mdt1")
- verify(mex).setVariable("cloudOwner", "my-cloud-owner")
- verify(mex).setVariable("tenantId", "8b1df54faa3b49078e3416e21370a3ba")
- }
-
- @Test
- // @Ignore
- public void prepareVnfAndModulesCreate_NullList() {
- ExecutionEntity mex = setupMock()
- initPrepareVnfAndModulesCreate(mex)
-
- when(mex.getVariable("vnfList")).thenReturn(null)
-
- CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
- CreateVcpeResCustService.prepareVnfAndModulesCreate(mex)
-
- verify(mex).getVariable(DBGFLAG)
-
- verify(mex).setVariable("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb")
- verify(mex).setVariable("lcpCloudRegionId", "mdt1")
- verify(mex).setVariable("cloudOwner", "my-cloud-owner")
- verify(mex).setVariable("tenantId", "8b1df54faa3b49078e3416e21370a3ba")
- }
-
- @Test
- // @Ignore
- public void prepareVnfAndModulesCreate_Ex() {
- ExecutionEntity mex = setupMock()
- initPrepareVnfAndModulesCreate(mex)
-
- when(mex.getVariable("vnfList")).thenThrow(new RuntimeException("expected exception"))
-
- CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
-
- assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.prepareVnfAndModulesCreate(mex) }))
- }
-
-
- // ***** validateVnfCreate *****
-
- @Test
- // @Ignore
- public void validateVnfCreate() {
- ExecutionEntity mex = setupMock()
- initValidateVnfCreate(mex)
-
- CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
- CreateVcpeResCustService.validateVnfCreate(mex)
-
- verify(mex).getVariable(DBGFLAG)
-
- verify(mex).setVariable(Prefix+"VnfsCreatedCount", 3)
- }
-
- @Test
- // @Ignore
- public void validateVnfCreate_Ex() {
- ExecutionEntity mex = setupMock()
- initValidateVnfCreate(mex)
-
- when(mex.getVariable(Prefix+"VnfsCreatedCount")).thenThrow(new RuntimeException("expected exception"))
-
- CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
-
- assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.validateVnfCreate(mex) }))
- }
-
-
- // ***** postProcessResponse *****
-
- @Test
- // @Ignore
- public void postProcessResponse() {
- ExecutionEntity mex = setupMock()
- def map = setupMap(mex)
- initPostProcessResponse(mex)
-
- CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
- CreateVcpeResCustService.postProcessResponse(mex)
-
- verify(mex).getVariable(DBGFLAG)
-
- verify(mex).setVariable(Prefix+"Success", true)
-
- def reqinfo = map.get(Prefix+"CompleteMsoProcessRequest")
-
- assertTrue(reqinfo.indexOf("request-id>mri</") >= 0)
- assertTrue(reqinfo.indexOf("source>mysrc</") >= 0)
- assertTrue(reqinfo.indexOf("serviceInstanceId>sii</") >= 0)
- }
-
- @Test
- // @Ignore
- public void postProcessResponse_BpmnError() {
- ExecutionEntity mex = setupMock()
- def map = setupMap(mex)
- initPostProcessResponse(mex)
-
- when(mex.getVariable("source")).thenThrow(new BpmnError("expected exception"))
-
- CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
-
- assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.postProcessResponse(mex) }))
- }
-
- @Test
- // @Ignore
- public void postProcessResponse_Ex() {
- ExecutionEntity mex = setupMock()
- def map = setupMap(mex)
- initPostProcessResponse(mex)
-
- when(mex.getVariable("source")).thenThrow(new RuntimeException("expected exception"))
-
- CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
-
- assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.postProcessResponse(mex) }))
- }
-
-
- // ***** preProcessRollback *****
-
- @Test
- // @Ignore
- public void preProcessRollback() {
- ExecutionEntity mex = setupMock()
- def wfe = initPreProcessRollback(mex)
-
- CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
- CreateVcpeResCustService.preProcessRollback(mex)
-
- verify(mex).getVariable(DBGFLAG)
-
- verify(mex).setVariable("prevWorkflowException", wfe)
- }
-
- @Test
- // @Ignore
- public void preProcessRollback_NullWfe() {
- ExecutionEntity mex = setupMock()
- def map = setupMap(mex)
- def wfe = initPreProcessRollback(mex)
-
- when(mex.getVariable("WorkflowException")).thenReturn(null)
-
- CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
- CreateVcpeResCustService.preProcessRollback(mex)
-
- verify(mex).getVariable(DBGFLAG)
-
- assertFalse(map.containsKey("prevWorkflowException"))
- }
-
- @Test
- // @Ignore
- public void preProcessRollback_BpmnError() {
- ExecutionEntity mex = setupMock()
- def map = setupMap(mex)
- def wfe = initPreProcessRollback(mex)
-
- when(mex.getVariable("WorkflowException")).thenThrow(new BpmnError("expected exception"))
-
- CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
- CreateVcpeResCustService.preProcessRollback(mex)
-
- verify(mex).getVariable(DBGFLAG)
-
- assertFalse(map.containsKey("prevWorkflowException"))
- }
-
- @Test
- // @Ignore
- public void preProcessRollback_Ex() {
- ExecutionEntity mex = setupMock()
- def map = setupMap(mex)
- def wfe = initPreProcessRollback(mex)
-
- when(mex.getVariable("WorkflowException")).thenThrow(new RuntimeException("expected exception"))
-
- CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
- CreateVcpeResCustService.preProcessRollback(mex)
-
- verify(mex).getVariable(DBGFLAG)
-
- assertFalse(map.containsKey("prevWorkflowException"))
- }
-
-
- // ***** postProcessRollback *****
-
- @Test
- // @Ignore
- public void postProcessRollback() {
- ExecutionEntity mex = setupMock()
- def wfe = initPostProcessRollback(mex)
-
- CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
- CreateVcpeResCustService.postProcessRollback(mex)
-
- verify(mex).getVariable(DBGFLAG)
-
- verify(mex).setVariable("WorkflowException", wfe)
- }
-
- @Test
- // @Ignore
- public void postProcessRollback_NullWfe() {
- ExecutionEntity mex = setupMock()
- def map = setupMap(mex)
- def wfe = initPostProcessRollback(mex)
-
- when(mex.getVariable("prevWorkflowException")).thenReturn(null)
-
- CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
- CreateVcpeResCustService.postProcessRollback(mex)
-
- verify(mex).getVariable(DBGFLAG)
-
- assertFalse(map.containsKey("WorkflowException"))
- }
-
- @Test
- // @Ignore
- public void postProcessRollback_BpmnError() {
- ExecutionEntity mex = setupMock()
- def map = setupMap(mex)
- def wfe = initPostProcessRollback(mex)
-
- when(mex.getVariable("prevWorkflowException")).thenThrow(new BpmnError("expected exception"))
-
- CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
- assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.postProcessRollback(mex) }))
- }
-
- @Test
- // @Ignore
- public void postProcessRollback_Ex() {
- ExecutionEntity mex = setupMock()
- def map = setupMap(mex)
- def wfe = initPostProcessRollback(mex)
-
- when(mex.getVariable("prevWorkflowException")).thenThrow(new RuntimeException("expected exception"))
-
- CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
- CreateVcpeResCustService.postProcessRollback(mex)
-
- verify(mex).getVariable(DBGFLAG)
-
- assertFalse(map.containsKey("WorkflowException"))
- }
-
-
- // ***** prepareFalloutRequest *****
-
- @Test
- // @Ignore
- public void prepareFalloutRequest() {
- ExecutionEntity mex = setupMock()
- def map = setupMap(mex)
- initPrepareFalloutRequest(mex)
-
- CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
- CreateVcpeResCustService.prepareFalloutRequest(mex)
-
- verify(mex, times(2)).getVariable(DBGFLAG)
-
- def fo = map.get(Prefix+"falloutRequest")
-
- assertTrue(fo.indexOf("<hello>world</") >= 0)
- assertTrue(fo.indexOf("ErrorMessage>mymsg</") >= 0)
- assertTrue(fo.indexOf("ErrorCode>999</") >= 0)
- }
-
- @Test
- // @Ignore
- public void prepareFalloutRequest_Ex() {
- ExecutionEntity mex = setupMock()
- def map = setupMap(mex)
- initPrepareFalloutRequest(mex)
-
- when(mex.getVariable("WorkflowException")).thenThrow(new RuntimeException("expected exception"))
-
- CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
-
- assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.prepareFalloutRequest(mex) }))
- }
-
- // ***** sendSyncError *****
-
- @Test
- // @Ignore
- public void sendSyncError() {
- ExecutionEntity mex = setupMock()
- def map = setupMap(mex)
- initSendSyncError(mex)
-
- CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
- CreateVcpeResCustService.sendSyncError(mex)
-
- verify(mex, times(2)).getVariable(DBGFLAG)
-
- verify(mex).setVariable(processName+"WorkflowResponseSent", "true")
-
- assertEquals("500", map.get(processName+"ResponseCode"))
- assertEquals("Fail", map.get(processName+"Status"))
-
- def resp = map.get(processName+"Response")
-
- assertTrue(resp.indexOf("ErrorMessage>mymsg</") >= 0)
-
- verify(mex).setVariable("WorkflowResponse", resp)
- }
-
- @Test
- // @Ignore
- public void sendSyncError_NotWfe() {
- ExecutionEntity mex = setupMock()
- def map = setupMap(mex)
- initSendSyncError(mex)
-
- when(mex.getVariable("WorkflowException")).thenReturn("not a WFE")
-
- CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
- CreateVcpeResCustService.sendSyncError(mex)
-
- verify(mex, times(2)).getVariable(DBGFLAG)
-
- verify(mex).setVariable(processName+"WorkflowResponseSent", "true")
-
- assertEquals("500", map.get(processName+"ResponseCode"))
- assertEquals("Fail", map.get(processName+"Status"))
-
- def resp = map.get(processName+"Response")
-
- assertTrue(resp.indexOf("ErrorMessage>Sending Sync Error.</") >= 0)
-
- verify(mex).setVariable("WorkflowResponse", resp)
- }
-
- @Test
- // @Ignore
- public void sendSyncError_NullWfe() {
- ExecutionEntity mex = setupMock()
- def map = setupMap(mex)
- initSendSyncError(mex)
-
- when(mex.getVariable("WorkflowException")).thenReturn(null)
-
- CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
- CreateVcpeResCustService.sendSyncError(mex)
-
- verify(mex, times(2)).getVariable(DBGFLAG)
-
- verify(mex).setVariable(processName+"WorkflowResponseSent", "true")
-
- assertEquals("500", map.get(processName+"ResponseCode"))
- assertEquals("Fail", map.get(processName+"Status"))
-
- def resp = map.get(processName+"Response")
-
- assertTrue(resp.indexOf("ErrorMessage>Sending Sync Error.</") >= 0)
-
- verify(mex).setVariable("WorkflowResponse", resp)
- }
-
- @Test
- // @Ignore
- public void sendSyncError_Ex() {
- ExecutionEntity mex = setupMock()
- def map = setupMap(mex)
- initSendSyncError(mex)
-
- when(mex.getVariable("WorkflowException")).thenThrow(new RuntimeException("expected exception"))
-
- CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
-
- CreateVcpeResCustService.sendSyncError(mex)
-
- assertFalse(map.containsKey(processName+"ResponseCode"))
- }
-
-
- // ***** processJavaException *****
-
- @Test
- // @Ignore
- public void processJavaException() {
- ExecutionEntity mex = setupMock()
- def map = setupMap(mex)
- initProcessJavaException(mex)
-
- CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
-
- assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.processJavaException(mex) }))
-
- verify(mex, times(2)).getVariable(DBGFLAG)
-
- verify(mex).setVariable("prefix", Prefix)
-
- def wfe = map.get("WorkflowException")
-
- assertEquals("Caught a Java Lang Exception", wfe.getErrorMessage())
- }
-
- @Test
- // @Ignore
- public void processJavaException_BpmnError() {
- ExecutionEntity mex = setupMock()
- def map = setupMap(mex)
- initProcessJavaException(mex)
-
- when(mex.getVariables()).thenThrow(new BpmnError("expected exception"))
-
- CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
-
- assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.processJavaException(mex) }))
-
- assertFalse(map.containsKey("WorkflowException"))
- }
-
- @Test
- // @Ignore
- public void processJavaException_Ex() {
- ExecutionEntity mex = setupMock()
- def map = setupMap(mex)
- initProcessJavaException(mex)
-
- when(mex.getVariables()).thenThrow(new RuntimeException("expected exception"))
-
- CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
-
- assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.processJavaException(mex) }))
-
- def wfe = map.get("WorkflowException")
-
- assertEquals("Exception in processJavaException method", wfe.getErrorMessage())
- }
-
-
- private void initPreProcess(ExecutionEntity mex) {
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("bpmnRequest")).thenReturn(request)
- when(mex.getVariable("aai.workflowAaiDistributionDelay")).thenReturn("PT5S")
- when(mex.getVariable("mso-request-id")).thenReturn("mri")
- when(mex.getVariable("serviceInstanceId")).thenReturn("sii")
- when(mex.getVariable("requestAction")).thenReturn("ra")
- }
-
- private initSendSyncResponse(ExecutionEntity mex) {
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("mso-request-id")).thenReturn("mri")
- when(mex.getVariable("serviceInstanceId")).thenReturn("sii")
- }
-
- private void initPrepareDecomposeService(ExecutionEntity mex) {
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("createVcpeServiceRequest")).thenReturn('{"requestDetails":{"modelInfo":"mi"}}')
- }
-
- private void initPrepareCreateServiceInstance(ExecutionEntity mex) {
- ServiceDecomposition svcdecomp = mock(ServiceDecomposition.class)
-
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("createVcpeServiceRequest")).thenReturn(request)
- when(mex.getVariable("serviceDecomposition")).thenReturn(svcdecomp)
-
- when(svcdecomp.toJsonStringNoRootName()).thenReturn("mydecomp")
- }
-
- private void initPostProcessServiceInstanceCreate(ExecutionEntity mex) {
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("mso-request-id")).thenReturn("mri")
- when(mex.getVariable("serviceInstanceId")).thenReturn("sii")
- when(mex.getVariable("serviceInstanceName")).thenReturn("sin")
- }
-
- private ServiceDecomposition initProcessDecomposition(ExecutionEntity mex) {
- List<VnfResource> vnflst = new LinkedList<>()
- vnflst.add(makeVnf("", ""))
- vnflst.add(makeVnf("2", "BRG"))
- vnflst.add(makeVnf("3", "BRG"))
-
- ServiceDecomposition svcdecomp = mock(ServiceDecomposition.class)
- when(svcdecomp.getVnfResources()).thenReturn(vnflst)
-
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("serviceDecomposition")).thenReturn(svcdecomp)
- when(mex.getVariable("serviceInstanceId")).thenReturn("sii")
- when(mex.getVariable("serviceInstanceName")).thenReturn("sin")
-
- return svcdecomp
- }
-
- private ServiceDecomposition initFilterVnfs(ExecutionEntity mex) {
- List<VnfResource> vnflst = new LinkedList<>()
- vnflst.add(makeVnf("", "BRG"))
- vnflst.add(makeVnf("2", "Tunnel XConn"))
- vnflst.add(makeVnf("3", ""))
- vnflst.add(makeVnf("4", "BRG"))
- vnflst.add(makeVnf("5", "other"))
-
- ServiceDecomposition svcdecomp = mock(ServiceDecomposition.class)
- when(svcdecomp.getVnfResources()).thenReturn(vnflst)
-
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("serviceDecomposition")).thenReturn(svcdecomp)
- when(mex.getVariable("serviceInstanceId")).thenReturn("sii")
- when(mex.getVariable("serviceInstanceName")).thenReturn("sin")
-
- return svcdecomp
- }
-
- private initAwaitAaiDistribution(ExecutionEntity mex) {
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- }
-
- private ServiceDecomposition initPrepareCreateAllottedResourceTXC(ExecutionEntity mex) {
- ServiceDecomposition svcdecomp = mock(ServiceDecomposition.class)
- List<AllottedResource> arlst = new LinkedList<>()
-
- arlst.add(makeArBRG("A"))
- arlst.add(makeArTXC("B"))
- arlst.add(makeArBRG("C"))
-
- when(svcdecomp.getAllottedResources()).thenReturn(arlst)
-
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("createVcpeServiceRequest")).thenReturn(request)
- when(mex.getVariable("serviceDecomposition")).thenReturn(svcdecomp)
- when(mex.getVariable("allottedResourceId")).thenReturn(ARID)
-
- return svcdecomp
- }
-
- private ServiceDecomposition initPrepareCreateAllottedResourceBRG(ExecutionEntity mex) {
- ServiceDecomposition svcdecomp = mock(ServiceDecomposition.class)
- List<AllottedResource> arlst = new LinkedList<>()
-
- arlst.add(makeArTXC("A"))
- arlst.add(makeArBRG("B"))
- arlst.add(makeArTXC("C"))
-
- when(svcdecomp.getAllottedResources()).thenReturn(arlst)
-
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("createVcpeServiceRequest")).thenReturn(request)
- when(mex.getVariable("serviceDecomposition")).thenReturn(svcdecomp)
- when(mex.getVariable("allottedResourceId")).thenReturn(ARID)
-
- return svcdecomp
- }
-
- private AllottedResource makeArTXC(String id) {
- AllottedResource ar = mock(AllottedResource.class)
- ModelInfo mod = mock(ModelInfo.class)
- HomingSolution home = mock(HomingSolution.class)
-
- when(ar.toJsonStringNoRootName()).thenReturn("json"+id)
- when(ar.getAllottedResourceType()).thenReturn("Tunnel XConn")
- when(ar.getModelInfo()).thenReturn(mod)
- when(ar.getAllottedResourceRole()).thenReturn("TXCr")
- when(ar.getHomingSolution()).thenReturn(home)
-
- when(mod.toJsonStringNoRootName()).thenReturn("model"+id)
-
- when(home.getServiceInstanceId()).thenReturn("home"+id)
-
- return ar
- }
-
- private AllottedResource makeArBRG(String id) {
- AllottedResource ar = mock(AllottedResource.class)
- ModelInfo mod = mock(ModelInfo.class)
- HomingSolution home = mock(HomingSolution.class)
-
- when(ar.toJsonStringNoRootName()).thenReturn("json"+id)
- when(ar.getAllottedResourceType()).thenReturn("BRG")
- when(ar.getModelInfo()).thenReturn(mod)
- when(ar.getAllottedResourceRole()).thenReturn("BRGr")
- when(ar.getHomingSolution()).thenReturn(home)
-
- when(mod.toJsonStringNoRootName()).thenReturn("model"+id)
-
- when(home.getServiceInstanceId()).thenReturn("home"+id)
-
- return ar
- }
-
- private initPrepareVnfAndModulesCreate(ExecutionEntity mex) {
-
- List<VnfResource> vnflst = new LinkedList<>()
-
- vnflst.add(makeVnf("A", "BRG"))
- vnflst.add(makeVnf("B", ""))
- vnflst.add(makeVnf("C", ""))
- vnflst.add(makeVnf("D", "Tunnel XConn"))
-
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("createVcpeServiceRequest")).thenReturn(request)
- when(mex.getVariable("vnfList")).thenReturn(vnflst)
- when(mex.getVariable(Prefix+"VnfsCreatedCount")).thenReturn(2)
- when(mex.getVariable("vnfModelInfo")).thenReturn("nomodel")
- when(mex.getVariable("sdncVersion")).thenReturn("myvers")
- }
-
- private VnfResource makeVnf(String id, String role) {
- ModelInfo mod = mock(ModelInfo.class)
- VnfResource vnf = mock(VnfResource.class)
-
- when(mod.toString()).thenReturn('{"modelInfo":"mymodel'+id+'"}')
-
- when(vnf.toString()).thenReturn("myvnf"+id)
- when(vnf.getModelInfo()).thenReturn(mod)
- when(vnf.getNfRole()).thenReturn(role)
-
- return vnf
- }
-
- private initValidateVnfCreate(ExecutionEntity mex) {
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable(Prefix+"VnfsCreatedCount")).thenReturn(2)
- }
-
- private initPostProcessResponse(ExecutionEntity mex) {
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("source")).thenReturn("mysrc")
- when(mex.getVariable("mso-request-id")).thenReturn("mri")
- when(mex.getVariable("serviceInstanceId")).thenReturn("sii")
- }
-
- private WorkflowException initPreProcessRollback(ExecutionEntity mex) {
- WorkflowException wfe = mock(WorkflowException.class)
-
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("WorkflowException")).thenReturn(wfe)
-
- return wfe
- }
-
- private WorkflowException initPostProcessRollback(ExecutionEntity mex) {
- WorkflowException wfe = mock(WorkflowException.class)
-
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("prevWorkflowException")).thenReturn(wfe)
-
- return wfe
- }
-
- private initPrepareFalloutRequest(ExecutionEntity mex) {
- WorkflowException wfe = mock(WorkflowException.class)
-
- when(wfe.getErrorMessage()).thenReturn("mymsg")
- when(wfe.getErrorCode()).thenReturn(999)
-
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("WorkflowException")).thenReturn(wfe)
- when(mex.getVariable(Prefix+"requestInfo")).thenReturn("<hello>world</hello>")
-
- return wfe
- }
-
- private initSendSyncError(ExecutionEntity mex) {
- WorkflowException wfe = mock(WorkflowException.class)
-
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("mso-request-id")).thenReturn("mri")
- when(mex.getVariable("WorkflowException")).thenReturn(wfe)
-
- when(wfe.getErrorMessage()).thenReturn("mymsg")
- }
-
- private initProcessJavaException(ExecutionEntity mex) {
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- }
-
+ public void init() {
+ MockitoAnnotations.initMocks(this)
+ }
+
+ public CreateVcpeResCustServiceTest() {
+ super("CreateVcpeResCustService")
+ }
+
+ // ***** preProcessRequest *****
+
+ @Test
+ public void preProcessRequest() {
+ ExecutionEntity mex = setupMock()
+ def map = setupMap(mex)
+
+ initPreProcess(mex)
+
+ CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+ CreateVcpeResCustService.preProcessRequest(mex)
+
+ verify(mex).getVariable(DBGFLAG)
+ verify(mex).setVariable("prefix", Prefix)
+ verify(mex).setVariable("createVcpeServiceRequest", request)
+ verify(mex).setVariable("msoRequestId", "mri")
+ assertEquals("sii", map.get("serviceInstanceId"))
+ verify(mex).setVariable("requestAction", "ra")
+ verify(mex).setVariable("source", "VID")
+ verify(mex).setVariable("globalSubscriberId", CUST)
+ verify(mex).setVariable("globalCustomerId", CUST)
+ verify(mex).setVariable("subscriptionServiceType", SVC)
+ verify(mex).setVariable("disableRollback", "false")
+ verify(mex).setVariable("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb")
+ assertTrue(map.containsKey("subscriberInfo"))
+
+ verify(mex).setVariable("brgWanMacAddress", "brgmac")
+ verify(mex).setVariable("customerLocation", ["customerLatitude": "32.897480", "customerLongitude": "-97.040443", "customerName": "some_company"])
+ verify(mex).setVariable("homingService", "sniro")
+ assertTrue(map.containsKey("serviceInputParams"))
+ assertTrue(map.containsKey(Prefix + "requestInfo"))
+
+ def reqinfo = map.get(Prefix + "requestInfo")
+ assertTrue(reqinfo.indexOf("<request-id>mri</") >= 0)
+ assertTrue(reqinfo.indexOf("<source>VID</") >= 0)
+
+ assertTrue(map.containsKey("vfModuleNames"))
+ }
+
+ @Test
+ public void preProcessRequest_MissingAaiDistDelay() {
+ ExecutionEntity mex = setupMock()
+ setupMap(mex)
+ initPreProcess(mex)
+
+ when(mex.getVariable("aai.workflowAaiDistributionDelay")).thenReturn(null)
+
+ CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+
+ assertTrue(doBpmnError({ _ -> CreateVcpeResCustService.preProcessRequest(mex) }))
+ }
+
+ @Test
+ public void preProcessRequest_EmptyParts() {
+ ExecutionEntity mex = setupMock()
+ def map = setupMap(mex)
+ initPreProcess(mex)
+
+ def req = request
+ .replace('"source"', '"sourceXXX"')
+ .replace('"BRG_WAN_MAC_Address"', '"BRG_WAN_MAC_AddressXXX"')
+ .replace('"Customer_Location"', '"Customer_LocationXXX"')
+
+ when(mex.getVariable("bpmnRequest")).thenReturn(req)
+ when(mex.getVariable("serviceInstanceId")).thenReturn(null)
+
+ CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+ CreateVcpeResCustService.preProcessRequest(mex)
+
+ verify(mex).getVariable(DBGFLAG)
+ verify(mex).setVariable("prefix", Prefix)
+ verify(mex).setVariable("createVcpeServiceRequest", req)
+ verify(mex).setVariable("msoRequestId", "mri")
+ assertNotNull(map.get("serviceInstanceId"))
+ assertFalse(map.get("serviceInstanceId").isEmpty())
+ verify(mex).setVariable("requestAction", "ra")
+ verify(mex).setVariable("source", "VID")
+ verify(mex).setVariable("globalSubscriberId", CUST)
+ verify(mex).setVariable("globalCustomerId", CUST)
+ verify(mex).setVariable("subscriptionServiceType", SVC)
+ verify(mex).setVariable("disableRollback", "false")
+ verify(mex).setVariable("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb")
+ assertTrue(map.containsKey("subscriberInfo"))
+
+ assertEquals("", map.get("brgWanMacAddress"))
+ assertEquals("", map.get("customerLocation"))
+ assertEquals("sniro", map.get("homingService"))
+ assertTrue(map.containsKey("serviceInputParams"))
+ assertTrue(map.containsKey(Prefix + "requestInfo"))
+
+ def reqinfo = map.get(Prefix + "requestInfo")
+ println reqinfo
+ assertTrue(reqinfo.indexOf("<request-id>mri</") >= 0)
+ assertTrue(reqinfo.indexOf("<source>VID</") >= 0)
+ }
+
+ @Test
+ public void preProcessRequest_MissingSubscriberId() {
+ ExecutionEntity mex = setupMock()
+ def map = setupMap(mex)
+ initPreProcess(mex)
+
+ def req = request
+ .replace('"globalSubscriberId"', '"globalSubscriberIdXXX"')
+
+ when(mex.getVariable("bpmnRequest")).thenReturn(req)
+ when(mex.getVariable("serviceInstanceId")).thenReturn(null)
+
+ CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+
+ assertTrue(doBpmnError({ _ -> CreateVcpeResCustService.preProcessRequest(mex) }))
+ }
+
+ @Test
+ public void preProcessRequest_vimId() {
+ ExecutionEntity mex = setupMock()
+ def map = setupMap(mex)
+ initPreProcess(mex)
+ UrnPropertiesReader
+
+ def req = request
+ .replace('"mdt1"', '"CloudOwner_CloudRegion1"')
+
+ when(mex.getVariable("bpmnRequest")).thenReturn(req)
+ when(mex.getVariable("aai.workflowAaiDistributionDelay")).thenReturn("PT5S")
+
+ CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+ CreateVcpeResCustService.preProcessRequest(mex)
+
+ verify(mex).setVariable("cloudRegionId", "CloudRegion1")
+ verify(mex).setVariable("cloudOwner", "CloudOwner")
+ }
+
+ @Test
+ public void preProcessRequest_noVimId() {
+ ExecutionEntity mex = setupMock()
+ def map = setupMap(mex)
+ initPreProcess(mex)
+
+ def req = request
+ .replace('"mdt1"', '"CloudRegion1_"')
+
+ when(mex.getVariable("bpmnRequest")).thenReturn(req)
+ when(mex.getVariable("aai.workflowAaiDistributionDelay")).thenReturn("PT5S")
+
+ CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+ CreateVcpeResCustService.preProcessRequest(mex)
+
+ verify(mex).setVariable("prefix", Prefix)
+ verify(mex).setVariable("cloudRegionId", "CloudRegion1_")
+ verify(mex).setVariable("cloudOwner", "CloudOwner")
+
+ }
+
+
+ @Test
+ public void preProcessRequest_BpmnError() {
+ ExecutionEntity mex = setupMock()
+ initPreProcess(mex)
+
+ when(mex.getVariable("bpmnRequest")).thenThrow(new BpmnError("expected exception"))
+
+ CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+
+ assertTrue(doBpmnError({ _ -> CreateVcpeResCustService.preProcessRequest(mex) }))
+ }
+
+ @Test
+ public void preProcessRequest_Ex() {
+ ExecutionEntity mex = setupMock()
+ initPreProcess(mex)
+
+ when(mex.getVariable("bpmnRequest")).thenThrow(new RuntimeException("expected exception"))
+
+ CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+
+ assertTrue(doBpmnError({ _ -> CreateVcpeResCustService.preProcessRequest(mex) }))
+ }
+
+ // ***** sendSyncResponse *****
+
+ @Test
+ public void sendSyncResponse() {
+ ExecutionEntity mex = setupMock()
+ def map = setupMap(mex)
+ initSendSyncResponse(mex)
+
+ CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+ CreateVcpeResCustService.sendSyncResponse(mex)
+
+ verify(mex).getVariable(DBGFLAG)
+
+ verify(mex).setVariable(processName + "WorkflowResponseSent", "true")
+
+ assertEquals("202", map.get(processName + "ResponseCode"))
+ assertEquals("Success", map.get(processName + "Status"))
+
+ def resp = map.get(processName + "Response")
+
+ assertTrue(resp.indexOf('"instanceId":"sii"') >= 0)
+ assertTrue(resp.indexOf('"requestId":"mri"') >= 0)
+ }
+
+ @Test
+ public void sendSyncResponse_Ex() {
+ ExecutionEntity mex = setupMock()
+ initSendSyncResponse(mex)
+
+ when(mex.getVariable("serviceInstanceId")).thenThrow(new RuntimeException("expected exception"))
+
+ CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+
+ assertTrue(doBpmnError({ _ -> CreateVcpeResCustService.sendSyncResponse(mex) }))
+ }
+
+ // ***** prepareDecomposeService *****
+
+ @Test
+ public void prepareDecomposeService() {
+ ExecutionEntity mex = setupMock()
+ initPrepareDecomposeService(mex)
+
+ CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+ CreateVcpeResCustService.prepareDecomposeService(mex)
+
+ verify(mex).getVariable("createVcpeServiceRequest")
+ verify(mex).setVariable("serviceModelInfo", "mi")
+ }
+
+ @Test
+ public void prepareDecomposeService_Ex() {
+ ExecutionEntity mex = setupMock()
+ initPrepareDecomposeService(mex)
+
+ when(mex.getVariable("createVcpeServiceRequest")).thenThrow(new RuntimeException("expected exception"))
+
+ CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+
+ assertTrue(doBpmnError({ _ -> CreateVcpeResCustService.prepareDecomposeService(mex) }))
+ }
+
+ // ***** prepareCreateServiceInstance *****
+
+ @Test
+ public void prepareCreateServiceInstance() {
+ ExecutionEntity mex = setupMock()
+ ServiceDecomposition svcdecomp = initPrepareCreateServiceInstance(mex)
+ when(svcdecomp.toJsonStringNoRootName()).thenReturn("mydecomp")
+
+ CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+ CreateVcpeResCustService.prepareCreateServiceInstance(mex)
+
+ verify(mex).getVariable("createVcpeServiceRequest")
+ verify(mex).setVariable("serviceInstanceName", "VCPE1")
+ verify(mex).setVariable("serviceDecompositionString", "mydecomp")
+ }
+
+ @Test
+ public void prepareCreateServiceInstance_Ex() {
+ ExecutionEntity mex = setupMock()
+ initPrepareCreateServiceInstance(mex)
+
+ when(mex.getVariable("createVcpeServiceRequest")).thenThrow(new RuntimeException("expected exception"))
+
+ CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+
+ assertTrue(doBpmnError({ _ -> CreateVcpeResCustService.prepareCreateServiceInstance(mex) }))
+ }
+
+ // ***** postProcessServiceInstanceCreate *****
+
+ @Test
+ public void postProcessServiceInstanceCreate() {
+ ExecutionEntity mex = setupMock()
+ def map = setupMap(mex)
+ initPostProcessServiceInstanceCreate(mex)
+
+ CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+ CreateVcpeResCustService.postProcessServiceInstanceCreate(mex)
+
+ verify(mex).getVariable("mso-request-id")
+ verify(mex).getVariable("serviceInstanceId")
+ verify(mex).getVariable("serviceInstanceName")
+
+ def reqinfo = map.get(Prefix + "setUpdateDbInstancePayload")
+
+ assertTrue(reqinfo.indexOf("<requestId>mri</") >= 0)
+ assertTrue(reqinfo.indexOf("<serviceInstanceId>sii</") >= 0)
+ assertTrue(reqinfo.indexOf("<serviceInstanceName>sin</") >= 0)
+ }
+
+ @Test
+ public void postProcessServiceInstanceCreate_BpmnError() {
+ ExecutionEntity mex = setupMock()
+ initPostProcessServiceInstanceCreate(mex)
+
+ doThrow(new BpmnError("expected exception")).when(mex).setVariable(endsWith("setUpdateDbInstancePayload"), any())
+
+ CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+
+ assertTrue(doBpmnError({ _ -> CreateVcpeResCustService.postProcessServiceInstanceCreate(mex) }))
+ }
+
+ @Test
+ public void postProcessServiceInstanceCreate_Ex() {
+ ExecutionEntity mex = setupMock()
+ initPostProcessServiceInstanceCreate(mex)
+
+ doThrow(new RuntimeException("expected exception")).when(mex).setVariable(endsWith("setUpdateDbInstancePayload"), any())
+
+ CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+
+ assertTrue(doBpmnError({ _ -> CreateVcpeResCustService.postProcessServiceInstanceCreate(mex) }))
+ }
+
+ // ***** processDecomposition *****
+
+ @Test
+ public void processDecomposition() {
+ ExecutionEntity mex = setupMock()
+ def svcdecomp = initProcessDecomposition(mex)
+
+ CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+ CreateVcpeResCustService.processDecomposition(mex)
+
+ verify(mex).getVariable("serviceDecomposition")
+
+ verify(mex).setVariable("vnfList", svcdecomp.getVnfResources())
+ verify(mex).setVariable("vnfListString", '[myvnf]')
+ verify(mex).setVariable(Prefix + "VNFsCount", 1)
+
+ verify(mex).setVariable("vnfModelInfo", "mymodel")
+ verify(mex).setVariable("vnfModelInfoString", "mymodel")
+ }
+
+ @Test
+ public void processDecomposition_EmptyNet_EmptyVnf() {
+ ExecutionEntity mex = setupMock()
+ def svcdecomp = initProcessDecomposition(mex)
+
+ when(svcdecomp.getVnfResources()).thenReturn(new LinkedList<VnfResource>())
+
+ CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+ CreateVcpeResCustService.processDecomposition(mex)
+
+ verify(mex).getVariable("serviceDecomposition")
+
+ verify(mex).setVariable("vnfList", svcdecomp.getVnfResources())
+ verify(mex).setVariable("vnfListString", '[]')
+ verify(mex).setVariable(Prefix + "VNFsCount", 0)
+
+ verify(mex).setVariable("vnfModelInfo", "")
+ verify(mex).setVariable("vnfModelInfoString", "")
+ }
+
+ @Test
+ public void processDecomposition_Ex() {
+ ExecutionEntity mex = setupMock()
+ def svcdecomp = initProcessDecomposition(mex)
+
+ when(svcdecomp.getVnfResources()).thenThrow(new RuntimeException("expected exception"))
+
+ CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+
+ assertTrue(doBpmnError({ _ -> CreateVcpeResCustService.processDecomposition(mex) }))
+ }
+
+ // ***** filterVnfs *****
+
+ @Test
+ public void filterVnfs() {
+ ExecutionEntity mex = setupMock()
+ initFilterVnfs(mex)
+
+ CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+ CreateVcpeResCustService.processDecomposition(mex)
+
+ verify(mex).setVariable("vnfListString", '[myvnf3, myvnf5]')
+ }
+
+ @Test
+ public void filterVnfs_Null() {
+ ExecutionEntity mex = setupMock()
+ def svcdecomp = initFilterVnfs(mex)
+
+ when(svcdecomp.getVnfResources()).thenReturn(null)
+
+ CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+ CreateVcpeResCustService.processDecomposition(mex)
+
+ // nothing more to check, as long as it didn't throw an exception
+ }
+
+ // ***** prepareCreateAllottedResourceTXC *****
+
+ @Test
+ public void prepareCreateAllottedResourceTXC() {
+ ExecutionEntity mex = setupMock()
+ initPrepareCreateAllottedResourceTXC(mex)
+
+ CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+ CreateVcpeResCustService.prepareCreateAllottedResourceTXC(mex)
+
+ verify(mex).getVariable("serviceDecomposition")
+
+ verify(mex).setVariable("createTXCAR", true)
+ verify(mex).setVariable("allottedResourceModelInfoTXC", "modelB")
+ verify(mex).setVariable("allottedResourceRoleTXC", "TXCr")
+ verify(mex).setVariable("allottedResourceTypeTXC", "Tunnel XConn")
+ verify(mex).setVariable("parentServiceInstanceIdTXC", "homeB")
+ }
+
+ @Test
+ public void prepareCreateAllottedResourceTXC_NullArList() {
+ ExecutionEntity mex = setupMock()
+ def svcdecomp = initPrepareCreateAllottedResourceTXC(mex)
+
+ when(svcdecomp.getAllottedResources()).thenReturn(null)
+
+ CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+ CreateVcpeResCustService.prepareCreateAllottedResourceTXC(mex)
+
+ verify(mex).getVariable("serviceDecomposition")
+
+ verify(mex, never()).setVariable("createTXCAR", true)
+ verify(mex, never()).setVariable("allottedResourceModelInfoTXC", "modelB")
+ verify(mex, never()).setVariable("allottedResourceRoleTXC", "TXCr")
+ verify(mex, never()).setVariable("allottedResourceTypeTXC", "Tunnel XConn")
+ verify(mex, never()).setVariable("parentServiceInstanceIdTXC", "homeB")
+ }
+
+ @Test
+ public void prepareCreateAllottedResourceTXC_Ex() {
+ ExecutionEntity mex = setupMock()
+ initPrepareCreateAllottedResourceTXC(mex)
+
+ when(mex.getVariable("serviceDecomposition")).thenThrow(new RuntimeException("expected exception"))
+
+ CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+
+ assertTrue(doBpmnError({ _ -> CreateVcpeResCustService.prepareCreateAllottedResourceTXC(mex) }))
+ }
+
+ // ***** prepareCreateAllottedResourceBRG *****
+
+ @Test
+ public void prepareCreateAllottedResourceBRG() {
+ ExecutionEntity mex = setupMock()
+ initPrepareCreateAllottedResourceBRG(mex)
+
+ CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+ CreateVcpeResCustService.prepareCreateAllottedResourceBRG(mex)
+
+ verify(mex).getVariable("serviceDecomposition")
+
+ verify(mex).setVariable("createBRGAR", true)
+ verify(mex).setVariable("allottedResourceModelInfoBRG", "modelB")
+ verify(mex).setVariable("allottedResourceRoleBRG", "BRGr")
+ verify(mex).setVariable("allottedResourceTypeBRG", "BRG")
+ verify(mex).setVariable("parentServiceInstanceIdBRG", "homeB")
+ }
+
+ @Test
+ public void prepareCreateAllottedResourceBRG_NullArList() {
+ ExecutionEntity mex = setupMock()
+ def svcdecomp = initPrepareCreateAllottedResourceBRG(mex)
+
+ when(svcdecomp.getAllottedResources()).thenReturn(null)
+
+ CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+ CreateVcpeResCustService.prepareCreateAllottedResourceBRG(mex)
+
+ verify(mex).getVariable("serviceDecomposition")
+
+ verify(mex, never()).setVariable("createBRGAR", true)
+ verify(mex, never()).setVariable("allottedResourceModelInfoBRG", "modelB")
+ verify(mex, never()).setVariable("allottedResourceRoleBRG", "BRGr")
+ verify(mex, never()).setVariable("allottedResourceTypeBRG", "BRG")
+ verify(mex, never()).setVariable("parentServiceInstanceIdBRG", "homeB")
+ }
+
+ @Test
+ public void prepareCreateAllottedResourceBRG_Ex() {
+ ExecutionEntity mex = setupMock()
+ initPrepareCreateAllottedResourceBRG(mex)
+
+ when(mex.getVariable("serviceDecomposition")).thenThrow(new RuntimeException("expected exception"))
+
+ CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+
+ assertTrue(doBpmnError({ _ -> CreateVcpeResCustService.prepareCreateAllottedResourceBRG(mex) }))
+ }
+
+ // ***** prepareVnfAndModulesCreate *****
+
+ @Test
+ public void prepareVnfAndModulesCreate() {
+ ExecutionEntity mex = setupMock()
+ initPrepareVnfAndModulesCreate(mex)
+
+ CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+ CreateVcpeResCustService.prepareVnfAndModulesCreate(mex)
+
+ verify(mex).getVariable("createVcpeServiceRequest")
+
+ verify(mex).setVariable("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb")
+ verify(mex).setVariable("lcpCloudRegionId", "mdt1")
+ verify(mex).setVariable("cloudOwner", "CloudOwner")
+ verify(mex).setVariable("tenantId", "8b1df54faa3b49078e3416e21370a3ba")
+ }
+
+ @Test
+ public void prepareVnfAndModulesCreate_noVimId() {
+ ExecutionEntity mex = setupMock()
+ initPrepareVnfAndModulesCreate(mex)
+
+ def req = request
+ .replace('"mdt1"', '"CloudRegion1_"')
+
+ when(mex.getVariable("createVcpeServiceRequest")).thenReturn(req)
+
+ CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+ CreateVcpeResCustService.prepareVnfAndModulesCreate(mex)
+
+ verify(mex).setVariable("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb")
+ verify(mex).setVariable("cloudRegionId", "CloudRegion1_")
+ verify(mex).setVariable("lcpCloudRegionId", "CloudRegion1_")
+ verify(mex).setVariable("tenantId", "8b1df54faa3b49078e3416e21370a3ba")
+ }
+
+ @Test
+ public void prepareVnfAndModulesCreate_vimId() {
+ ExecutionEntity mex = setupMock()
+ initPrepareVnfAndModulesCreate(mex)
+
+ def req = request
+ .replace('"mdt1"', '"CloudOwner_CloudRegion1"')
+
+ when(mex.getVariable("createVcpeServiceRequest")).thenReturn(req)
+
+ CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+ CreateVcpeResCustService.prepareVnfAndModulesCreate(mex)
+
+ verify(mex).setVariable("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb")
+ verify(mex).setVariable("cloudOwner", "CloudOwner")
+ verify(mex).setVariable("cloudRegionId", "CloudRegion1")
+ verify(mex).setVariable("lcpCloudRegionId", "CloudRegion1")
+ verify(mex).setVariable("tenantId", "8b1df54faa3b49078e3416e21370a3ba")
+ }
+
+ @Test
+ public void prepareVnfAndModulesCreate_EmptyList() {
+ ExecutionEntity mex = setupMock()
+ initPrepareVnfAndModulesCreate(mex)
+
+ when(mex.getVariable("vnfList")).thenReturn(new LinkedList<VnfResource>())
+
+ CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+ CreateVcpeResCustService.prepareVnfAndModulesCreate(mex)
+
+ verify(mex).getVariable("createVcpeServiceRequest")
+
+ verify(mex).setVariable("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb")
+ verify(mex).setVariable("lcpCloudRegionId", "mdt1")
+ verify(mex).setVariable("cloudOwner", "CloudOwner")
+ verify(mex).setVariable("tenantId", "8b1df54faa3b49078e3416e21370a3ba")
+ }
+
+ @Test
+ public void prepareVnfAndModulesCreate_NullList() {
+ ExecutionEntity mex = setupMock()
+ initPrepareVnfAndModulesCreate(mex)
+
+ when(mex.getVariable("vnfList")).thenReturn(null)
+
+ CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+ CreateVcpeResCustService.prepareVnfAndModulesCreate(mex)
+
+ verify(mex).getVariable("createVcpeServiceRequest")
+
+ verify(mex).setVariable("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb")
+ verify(mex).setVariable("lcpCloudRegionId", "mdt1")
+ verify(mex).setVariable("cloudOwner", "CloudOwner")
+ verify(mex).setVariable("tenantId", "8b1df54faa3b49078e3416e21370a3ba")
+ }
+
+ @Test
+ public void prepareVnfAndModulesCreate_Ex() {
+ ExecutionEntity mex = setupMock()
+ initPrepareVnfAndModulesCreate(mex)
+
+ when(mex.getVariable("vnfList")).thenThrow(new RuntimeException("expected exception"))
+
+ CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+
+ assertTrue(doBpmnError({ _ -> CreateVcpeResCustService.prepareVnfAndModulesCreate(mex) }))
+ }
+
+ // ***** validateVnfCreate *****
+
+ @Test
+ public void validateVnfCreate() {
+ ExecutionEntity mex = setupMock()
+ initValidateVnfCreate(mex)
+
+ CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+ CreateVcpeResCustService.validateVnfCreate(mex)
+
+ verify(mex).getVariable(Prefix + "VnfsCreatedCount")
+
+ verify(mex).setVariable(Prefix + "VnfsCreatedCount", 3)
+ }
+
+ @Test
+ public void validateVnfCreate_Ex() {
+ ExecutionEntity mex = setupMock()
+ initValidateVnfCreate(mex)
+
+ when(mex.getVariable(Prefix + "VnfsCreatedCount")).thenThrow(new RuntimeException("expected exception"))
+
+ CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+
+ assertTrue(doBpmnError({ _ -> CreateVcpeResCustService.validateVnfCreate(mex) }))
+ }
+
+ // ***** postProcessResponse *****
+
+ @Test
+ public void postProcessResponse() {
+ ExecutionEntity mex = setupMock()
+ def map = setupMap(mex)
+ initPostProcessResponse(mex)
+
+ CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+ CreateVcpeResCustService.postProcessResponse(mex)
+
+ verify(mex).getVariable("source")
+ verify(mex).getVariable("mso-request-id")
+ verify(mex).getVariable("serviceInstanceId")
+
+ verify(mex).setVariable(Prefix + "Success", true)
+
+ def reqinfo = map.get(Prefix + "CompleteMsoProcessRequest")
+
+ assertTrue(reqinfo.indexOf("request-id>mri</") >= 0)
+ assertTrue(reqinfo.indexOf("source>mysrc</") >= 0)
+ assertTrue(reqinfo.indexOf("serviceInstanceId>sii</") >= 0)
+ }
+
+ @Test
+ public void postProcessResponse_BpmnError() {
+ ExecutionEntity mex = setupMock()
+ setupMap(mex)
+ initPostProcessResponse(mex)
+
+ when(mex.getVariable("source")).thenThrow(new BpmnError("expected exception"))
+
+ CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+
+ assertTrue(doBpmnError({ _ -> CreateVcpeResCustService.postProcessResponse(mex) }))
+ }
+
+ @Test
+ public void postProcessResponse_Ex() {
+ ExecutionEntity mex = setupMock()
+ setupMap(mex)
+ initPostProcessResponse(mex)
+
+ when(mex.getVariable("source")).thenThrow(new BpmnError("expected exception"))
+
+ CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+
+ assertTrue(doBpmnError({ _ -> CreateVcpeResCustService.postProcessResponse(mex) }))
+ }
+
+ // ***** preProcessRollback *****
+
+ @Test
+ public void preProcessRollback() {
+ ExecutionEntity mex = setupMock()
+ def wfe = initPreProcessRollback(mex)
+
+ CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+ CreateVcpeResCustService.preProcessRollback(mex)
+
+ verify(mex).getVariable("WorkflowException")
+
+ verify(mex).setVariable("prevWorkflowException", wfe)
+ }
+
+ @Test
+ public void preProcessRollback_NullWfe() {
+ ExecutionEntity mex = setupMock()
+ def map = setupMap(mex)
+ initPreProcessRollback(mex)
+
+ when(mex.getVariable("WorkflowException")).thenReturn(null)
+
+ CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+ CreateVcpeResCustService.preProcessRollback(mex)
+
+ verify(mex).getVariable("WorkflowException")
+
+ assertFalse(map.containsKey("prevWorkflowException"))
+ }
+
+ @Test
+ public void preProcessRollback_BpmnError() {
+ ExecutionEntity mex = setupMock()
+ def map = setupMap(mex)
+ initPreProcessRollback(mex)
+
+ when(mex.getVariable("WorkflowException")).thenThrow(new BpmnError("expected exception"))
+
+ CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+ CreateVcpeResCustService.preProcessRollback(mex)
+
+ verify(mex).getVariable("WorkflowException")
+
+ assertFalse(map.containsKey("prevWorkflowException"))
+ }
+
+ @Test
+ public void preProcessRollback_Ex() {
+ ExecutionEntity mex = setupMock()
+ def map = setupMap(mex)
+ initPreProcessRollback(mex)
+
+ when(mex.getVariable("WorkflowException")).thenThrow(new RuntimeException("expected exception"))
+
+ CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+ CreateVcpeResCustService.preProcessRollback(mex)
+
+ verify(mex).getVariable("WorkflowException")
+
+ assertFalse(map.containsKey("prevWorkflowException"))
+ }
+
+ // ***** postProcessRollback *****
+
+ @Test
+ public void postProcessRollback() {
+ ExecutionEntity mex = setupMock()
+ def wfe = initPostProcessRollback(mex)
+
+ CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+ CreateVcpeResCustService.postProcessRollback(mex)
+
+ verify(mex).getVariable("prevWorkflowException")
+
+ verify(mex).setVariable("WorkflowException", wfe)
+ }
+
+ @Test
+ public void postProcessRollback_NullWfe() {
+ ExecutionEntity mex = setupMock()
+ def map = setupMap(mex)
+ initPostProcessRollback(mex)
+
+ when(mex.getVariable("prevWorkflowException")).thenReturn(null)
+
+ CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+ CreateVcpeResCustService.postProcessRollback(mex)
+
+ verify(mex).getVariable("prevWorkflowException")
+
+ assertFalse(map.containsKey("WorkflowException"))
+ }
+
+ @Test
+ public void postProcessRollback_BpmnError() {
+ ExecutionEntity mex = setupMock()
+ setupMap(mex)
+ initPostProcessRollback(mex)
+
+ when(mex.getVariable("prevWorkflowException")).thenThrow(new BpmnError("expected exception"))
+
+ CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+ assertTrue(doBpmnError({ _ -> CreateVcpeResCustService.postProcessRollback(mex) }))
+ }
+
+
+ @Test
+ public void postProcessRollback_Ex() {
+ ExecutionEntity mex = setupMock()
+ def map = setupMap(mex)
+ initPostProcessRollback(mex)
+
+ when(mex.getVariable("prevWorkflowException")).thenThrow(new RuntimeException("expected exception"))
+
+ CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+ CreateVcpeResCustService.postProcessRollback(mex)
+
+ verify(mex).getVariable("prevWorkflowException")
+
+ assertFalse(map.containsKey("WorkflowException"))
+ }
+
+ // ***** prepareFalloutRequest *****
+
+ @Test
+ public void prepareFalloutRequest() {
+ ExecutionEntity mex = setupMock()
+ def map = setupMap(mex)
+ WorkflowException wfe = initPrepareFalloutRequest(mex)
+ when(wfe.getErrorMessage()).thenReturn("mymsg")
+ when(wfe.getErrorCode()).thenReturn(999)
+
+ CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+ CreateVcpeResCustService.prepareFalloutRequest(mex)
+
+ verify(mex, times(4)).getVariable("WorkflowException")
+
+ def fo = map.get(Prefix + "falloutRequest")
+
+ assertTrue(fo.indexOf("<hello>world</") >= 0)
+ assertTrue(fo.indexOf("ErrorMessage>mymsg</") >= 0)
+ assertTrue(fo.indexOf("ErrorCode>999</") >= 0)
+ }
+
+ @Test
+ public void prepareFalloutRequest_Ex() {
+ ExecutionEntity mex = setupMock()
+ setupMap(mex)
+ initPrepareFalloutRequest(mex)
+
+ when(mex.getVariable("WorkflowException")).thenThrow(new RuntimeException("expected exception"))
+
+ CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+
+ assertTrue(doBpmnError({ _ -> CreateVcpeResCustService.prepareFalloutRequest(mex) }))
+ }
+
+ // ***** sendSyncError *****
+
+ @Test
+ public void sendSyncError() {
+ ExecutionEntity mex = setupMock()
+ def map = setupMap(mex)
+ initSendSyncError(mex)
+
+ CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+ CreateVcpeResCustService.sendSyncError(mex)
+
+ verify(mex).getVariable(DBGFLAG)
+
+ verify(mex).setVariable(processName + "WorkflowResponseSent", "true")
+
+ assertEquals("500", map.get(processName + "ResponseCode"))
+ assertEquals("Fail", map.get(processName + "Status"))
+
+ def resp = map.get(processName + "Response")
+
+ assertTrue(resp.indexOf("ErrorMessage>mymsg</") >= 0)
+
+ verify(mex).setVariable("WorkflowResponse", resp)
+ }
+
+ @Test
+ public void sendSyncError_NotWfe() {
+ ExecutionEntity mex = setupMock()
+ def map = setupMap(mex)
+ initSendSyncError(mex)
+
+ when(mex.getVariable("WorkflowException")).thenReturn("not a WFE")
+
+ CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+ CreateVcpeResCustService.sendSyncError(mex)
+
+ verify(mex).getVariable(DBGFLAG)
+
+ verify(mex).setVariable(processName + "WorkflowResponseSent", "true")
+
+ assertEquals("500", map.get(processName + "ResponseCode"))
+ assertEquals("Fail", map.get(processName + "Status"))
+
+ def resp = map.get(processName + "Response")
+
+ assertTrue(resp.indexOf("ErrorMessage>Sending Sync Error.</") >= 0)
+
+ verify(mex).setVariable("WorkflowResponse", resp)
+ }
+
+ @Test
+ public void sendSyncError_NullWfe() {
+ ExecutionEntity mex = setupMock()
+ def map = setupMap(mex)
+ initSendSyncError(mex)
+
+ when(mex.getVariable("WorkflowException")).thenReturn(null)
+
+ CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+ CreateVcpeResCustService.sendSyncError(mex)
+
+ verify(mex).getVariable(DBGFLAG)
+
+ verify(mex).setVariable(processName + "WorkflowResponseSent", "true")
+
+ assertEquals("500", map.get(processName + "ResponseCode"))
+ assertEquals("Fail", map.get(processName + "Status"))
+
+ def resp = map.get(processName + "Response")
+
+ assertTrue(resp.indexOf("ErrorMessage>Sending Sync Error.</") >= 0)
+
+ verify(mex).setVariable("WorkflowResponse", resp)
+ }
+
+ @Test
+ public void sendSyncError_Ex() {
+ ExecutionEntity mex = setupMock()
+ def map = setupMap(mex)
+ initSendSyncError(mex)
+
+ when(mex.getVariable("WorkflowException")).thenThrow(new RuntimeException("expected exception"))
+
+ CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+
+ CreateVcpeResCustService.sendSyncError(mex)
+
+ assertFalse(map.containsKey(processName + "ResponseCode"))
+ }
+
+ // ***** processJavaException *****
+
+ @Test
+ public void processJavaException() {
+ ExecutionEntity mex = setupMock()
+ def map = setupMap(mex)
+ initProcessJavaException(mex)
+
+ CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+
+ assertTrue(doBpmnError({ _ -> CreateVcpeResCustService.processJavaException(mex) }))
+
+ verify(mex).getVariable("testProcessKey")
+
+ verify(mex).setVariable("prefix", Prefix)
+
+ def wfe = map.get("WorkflowException")
+
+ assertEquals("Caught a Java Lang Exception", wfe.getErrorMessage())
+ }
+
+ @Test
+ public void processJavaException_BpmnError() {
+ ExecutionEntity mex = setupMock()
+ def map = setupMap(mex)
+ initProcessJavaException(mex)
+
+ when(mex.getVariables()).thenThrow(new BpmnError("expected exception"))
+
+ CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+
+ assertTrue(doBpmnError({ _ -> CreateVcpeResCustService.processJavaException(mex) }))
+
+ assertFalse(map.containsKey("WorkflowException"))
+ }
+
+ @Test
+ public void processJavaException_Ex() {
+ ExecutionEntity mex = setupMock()
+ def map = setupMap(mex)
+ initProcessJavaException(mex)
+
+ when(mex.getVariables()).thenThrow(new RuntimeException("expected exception"))
+
+ CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+
+ assertTrue(doBpmnError({ _ -> CreateVcpeResCustService.processJavaException(mex) }))
+
+ def wfe = map.get("WorkflowException")
+
+ assertEquals("Exception in processJavaException method", wfe.getErrorMessage())
+ }
+
+
+ private void initPreProcess(ExecutionEntity mex) {
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("bpmnRequest")).thenReturn(request)
+ when(mex.getVariable("aai.workflowAaiDistributionDelay")).thenReturn("PT5S")
+ when(mex.getVariable("mso-request-id")).thenReturn("mri")
+ when(mex.getVariable("serviceInstanceId")).thenReturn("sii")
+ when(mex.getVariable("requestAction")).thenReturn("ra")
+ }
+
+ private initSendSyncResponse(ExecutionEntity mex) {
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("mso-request-id")).thenReturn("mri")
+ when(mex.getVariable("serviceInstanceId")).thenReturn("sii")
+ }
+
+ private void initPrepareDecomposeService(ExecutionEntity mex) {
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("createVcpeServiceRequest")).thenReturn('{"requestDetails":{"modelInfo":"mi"}}')
+ }
+
+ private ServiceDecomposition initPrepareCreateServiceInstance(ExecutionEntity mex) {
+ ServiceDecomposition svcdecomp = mock(ServiceDecomposition.class)
+
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("createVcpeServiceRequest")).thenReturn(request)
+ when(mex.getVariable("serviceDecomposition")).thenReturn(svcdecomp)
+
+ return svcdecomp
+ }
+
+ private void initPostProcessServiceInstanceCreate(ExecutionEntity mex) {
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("mso-request-id")).thenReturn("mri")
+ when(mex.getVariable("serviceInstanceId")).thenReturn("sii")
+ when(mex.getVariable("serviceInstanceName")).thenReturn("sin")
+ }
+
+ private ServiceDecomposition initProcessDecomposition(ExecutionEntity mex) {
+ List<VnfResource> vnflst = new LinkedList<>()
+ vnflst.add(makeVnf("", ""))
+ vnflst.add(makeVnf("2", "BRG"))
+ vnflst.add(makeVnf("3", "BRG"))
+
+ ServiceDecomposition svcdecomp = mock(ServiceDecomposition.class)
+ when(svcdecomp.getVnfResources()).thenReturn(vnflst)
+
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("serviceDecomposition")).thenReturn(svcdecomp)
+ when(mex.getVariable("serviceInstanceId")).thenReturn("sii")
+ when(mex.getVariable("serviceInstanceName")).thenReturn("sin")
+
+ return svcdecomp
+ }
+
+ private ServiceDecomposition initFilterVnfs(ExecutionEntity mex) {
+ List<VnfResource> vnflst = new LinkedList<>()
+ vnflst.add(makeVnf("", "BRG"))
+ vnflst.add(makeVnf("2", "Tunnel XConn"))
+ vnflst.add(makeVnf("3", ""))
+ vnflst.add(makeVnf("4", "BRG"))
+ vnflst.add(makeVnf("5", "other"))
+
+ ServiceDecomposition svcdecomp = mock(ServiceDecomposition.class)
+ when(svcdecomp.getVnfResources()).thenReturn(vnflst)
+
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("serviceDecomposition")).thenReturn(svcdecomp)
+ when(mex.getVariable("serviceInstanceId")).thenReturn("sii")
+ when(mex.getVariable("serviceInstanceName")).thenReturn("sin")
+
+ return svcdecomp
+ }
+
+ private ServiceDecomposition initPrepareCreateAllottedResourceTXC(ExecutionEntity mex) {
+ ServiceDecomposition svcdecomp = mock(ServiceDecomposition.class)
+ List<AllottedResource> arlst = new LinkedList<>()
+
+ arlst.add(makeArBRG("A"))
+ arlst.add(makeArTXC("B"))
+ arlst.add(makeArBRG("C"))
+
+ when(svcdecomp.getAllottedResources()).thenReturn(arlst)
+
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("createVcpeServiceRequest")).thenReturn(request)
+ when(mex.getVariable("serviceDecomposition")).thenReturn(svcdecomp)
+ when(mex.getVariable("allottedResourceId")).thenReturn(ARID)
+
+ return svcdecomp
+ }
+
+ private ServiceDecomposition initPrepareCreateAllottedResourceBRG(ExecutionEntity mex) {
+ ServiceDecomposition svcdecomp = mock(ServiceDecomposition.class)
+ List<AllottedResource> arlst = new LinkedList<>()
+
+ arlst.add(makeArTXC("A"))
+ arlst.add(makeArBRG("B"))
+ arlst.add(makeArTXC("C"))
+
+ when(svcdecomp.getAllottedResources()).thenReturn(arlst)
+
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("createVcpeServiceRequest")).thenReturn(request)
+ when(mex.getVariable("serviceDecomposition")).thenReturn(svcdecomp)
+ when(mex.getVariable("allottedResourceId")).thenReturn(ARID)
+
+ return svcdecomp
+ }
+
+ private AllottedResource makeArTXC(String id) {
+ AllottedResource ar = mock(AllottedResource.class)
+ ModelInfo mod = mock(ModelInfo.class)
+ HomingSolution home = mock(HomingSolution.class)
+
+ when(ar.toJsonStringNoRootName()).thenReturn("json" + id)
+ when(ar.getAllottedResourceType()).thenReturn("Tunnel XConn")
+ when(ar.getModelInfo()).thenReturn(mod)
+ when(ar.getAllottedResourceRole()).thenReturn("TXCr")
+ when(ar.getHomingSolution()).thenReturn(home)
+
+ when(mod.toJsonStringNoRootName()).thenReturn("model" + id)
+
+ when(home.getServiceInstanceId()).thenReturn("home" + id)
+
+ return ar
+ }
+
+ private AllottedResource makeArBRG(String id) {
+ AllottedResource ar = mock(AllottedResource.class)
+ ModelInfo mod = mock(ModelInfo.class)
+ HomingSolution home = mock(HomingSolution.class)
+
+ when(ar.toJsonStringNoRootName()).thenReturn("json" + id)
+ when(ar.getAllottedResourceType()).thenReturn("BRG")
+ when(ar.getModelInfo()).thenReturn(mod)
+ when(ar.getAllottedResourceRole()).thenReturn("BRGr")
+ when(ar.getHomingSolution()).thenReturn(home)
+
+ when(mod.toJsonStringNoRootName()).thenReturn("model" + id)
+
+ when(home.getServiceInstanceId()).thenReturn("home" + id)
+
+ return ar
+ }
+
+ private initPrepareVnfAndModulesCreate(ExecutionEntity mex) {
+
+ List<VnfResource> vnflst = new LinkedList<>()
+
+ vnflst.add(makeVnf("A", "BRG"))
+ vnflst.add(makeVnf("B", ""))
+ vnflst.add(makeVnf("C", ""))
+ vnflst.add(makeVnf("D", "Tunnel XConn"))
+
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("createVcpeServiceRequest")).thenReturn(request)
+ when(mex.getVariable("vnfList")).thenReturn(vnflst)
+ when(mex.getVariable(Prefix + "VnfsCreatedCount")).thenReturn(2)
+ when(mex.getVariable("vnfModelInfo")).thenReturn("nomodel")
+ when(mex.getVariable("sdncVersion")).thenReturn("myvers")
+ }
+
+ private VnfResource makeVnf(String id, String role) {
+ ModelInfo mod = mock(ModelInfo.class)
+ VnfResource vnf = mock(VnfResource.class)
+
+ when(mod.toString()).thenReturn('{"modelInfo":"mymodel' + id + '"}')
+
+ when(vnf.toString()).thenReturn("myvnf" + id)
+ when(vnf.getModelInfo()).thenReturn(mod)
+ when(vnf.getNfRole()).thenReturn(role)
+
+ return vnf
+ }
+
+ private initValidateVnfCreate(ExecutionEntity mex) {
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable(Prefix + "VnfsCreatedCount")).thenReturn(2)
+ }
+
+ private initPostProcessResponse(ExecutionEntity mex) {
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("source")).thenReturn("mysrc")
+ when(mex.getVariable("mso-request-id")).thenReturn("mri")
+ when(mex.getVariable("serviceInstanceId")).thenReturn("sii")
+ }
+
+ private WorkflowException initPreProcessRollback(ExecutionEntity mex) {
+ WorkflowException wfe = mock(WorkflowException.class)
+
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("WorkflowException")).thenReturn(wfe)
+
+ return wfe
+ }
+
+ private WorkflowException initPostProcessRollback(ExecutionEntity mex) {
+ WorkflowException wfe = mock(WorkflowException.class)
+
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("prevWorkflowException")).thenReturn(wfe)
+
+ return wfe
+ }
+
+ private initPrepareFalloutRequest(ExecutionEntity mex) {
+ WorkflowException wfe = mock(WorkflowException.class)
+
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("WorkflowException")).thenReturn(wfe)
+ when(mex.getVariable(Prefix + "requestInfo")).thenReturn("<hello>world</hello>")
+
+ return wfe
+ }
+
+ private initSendSyncError(ExecutionEntity mex) {
+ WorkflowException wfe = mock(WorkflowException.class)
+
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("mso-request-id")).thenReturn("mri")
+ when(mex.getVariable("WorkflowException")).thenReturn(wfe)
+
+ when(wfe.getErrorMessage()).thenReturn("mymsg")
+ }
+
+ private initProcessJavaException(ExecutionEntity mex) {
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ }
+
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustServiceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustServiceTest.groovy
index c2384b63a5..be8f2a2d2e 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustServiceTest.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustServiceTest.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -19,756 +21,543 @@
*/
package org.onap.so.bpmn.vcpe.scripts
-
-import org.camunda.bpm.engine.ProcessEngineServices
-import org.camunda.bpm.engine.RepositoryService
+import com.github.tomakehurst.wiremock.junit.WireMockRule
+import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity
-import org.camunda.bpm.engine.repository.ProcessDefinition
import org.junit.Before
import org.junit.BeforeClass
import org.junit.Rule
import org.junit.Test
-import org.junit.Ignore
import org.mockito.MockitoAnnotations
-import org.camunda.bpm.engine.delegate.BpmnError
import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.bpmn.mock.FileUtil
-import static com.github.tomakehurst.wiremock.client.WireMock.aResponse
-import static com.github.tomakehurst.wiremock.client.WireMock.get
-import static com.github.tomakehurst.wiremock.client.WireMock.patch
-import static com.github.tomakehurst.wiremock.client.WireMock.put
-import static com.github.tomakehurst.wiremock.client.WireMock.stubFor
-import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching
-import static org.junit.Assert.*;
+import static org.junit.Assert.*
import static org.mockito.Mockito.*
-import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetAllottedResource
-import org.onap.so.bpmn.core.domain.ServiceDecomposition
-import org.onap.so.bpmn.core.domain.VnfResource
-import org.onap.so.bpmn.core.domain.AllottedResource
-import org.onap.so.bpmn.core.domain.ModelInfo
-import org.onap.so.bpmn.core.RollbackData
-import org.onap.so.bpmn.vcpe.scripts.MapGetter
-import org.onap.so.bpmn.vcpe.scripts.MapSetter
+class DeleteVcpeResCustServiceTest extends GroovyTestBase {
-import com.github.tomakehurst.wiremock.junit.WireMockRule
+ private static String request
+
+ @Rule
+ public WireMockRule wireMockRule = new WireMockRule(PORT)
+
+ String Prefix = "DVRCS_"
+
+ @BeforeClass
+ public static void setUpBeforeClass() {
+ request = FileUtil.readResourceFile("__files/VCPE/DeleteVcpeResCustService/request.json")
+ }
-class DeleteVcpeResCustServiceTest extends GroovyTestBase {
-
- private static String request
-
- @Rule
- public WireMockRule wireMockRule = new WireMockRule(PORT)
-
- String Prefix = "DVRCS_"
- String RbType = "DCRENI_"
-
- @BeforeClass
- public static void setUpBeforeClass() {
- request = FileUtil.readResourceFile("__files/VCPE/DeleteVcpeResCustService/request.json")
- }
-
@Before
- public void init()
- {
- MockitoAnnotations.initMocks(this)
- }
-
- public DeleteVcpeResCustServiceTest() {
- super("DeleteVcpeResCustService")
- }
-
-
- // ***** preProcessRequest *****
-
- @Test
-// @Ignore
- public void preProcessRequest() {
- ExecutionEntity mex = setupMock()
- def map = setupMap(mex)
- initPreProcess(mex)
-
- DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
- DeleteVcpeResCustService.preProcessRequest(mex)
-
- verify(mex).getVariable(DBGFLAG)
-
- assertEquals(Prefix, map.get("prefix"))
- assertEquals(request, map.get("DeleteVcpeResCustServiceRequest"))
- assertEquals("mri", map.get("msoRequestId"))
- assertEquals("ra", map.get("requestAction"))
- assertEquals("VID", map.get("source"))
- assertEquals(CUST, map.get("globalSubscriberId"))
- assertEquals(CUST, map.get("globalCustomerId"))
- assertEquals("false", map.get("disableRollback"))
- assertEquals("a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", map.get("productFamilyId"))
- assertEquals(SVC, map.get("subscriptionServiceType"))
-
- assertEquals("mdt1", map.get("lcpCloudRegionId"))
- assertEquals("8b1df54faa3b49078e3416e21370a3ba", map.get("tenantId"))
- assertEquals("1707", map.get("sdncVersion"))
- assertEquals("service-instance", map.get("GENGS_type"))
- assertEquals("""{"tenantId":"8b1df54faa3b49078e3416e21370a3ba","lcpCloudRegionId":"mdt1"}""", map.get("cloudConfiguration"))
- assertTrue(map.containsKey(Prefix+"requestInfo"))
-
- def reqinfo = map.get(Prefix+"requestInfo")
- assertTrue(reqinfo.indexOf("<request-id>mri</") >= 0)
- assertTrue(reqinfo.indexOf("<source>VID</") >= 0)
- }
-
- @Test
-// @Ignore
- public void preProcessRequest_EmptyParts() {
- ExecutionEntity mex = setupMock()
- def map = setupMap(mex)
- initPreProcess(mex)
-
- def req = request
- .replace('"source"', '"sourceXXX"')
-
- when(mex.getVariable("bpmnRequest")).thenReturn(req)
-
- DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
- DeleteVcpeResCustService.preProcessRequest(mex)
-
- verify(mex).getVariable(DBGFLAG)
- verify(mex).setVariable("prefix", Prefix)
- verify(mex).setVariable("DeleteVcpeResCustServiceRequest", req)
- verify(mex).setVariable("msoRequestId", "mri")
- verify(mex).setVariable("requestAction", "ra")
- verify(mex).setVariable("source", "VID")
- verify(mex).setVariable("globalSubscriberId", CUST)
- verify(mex).setVariable("globalCustomerId", CUST)
- verify(mex).setVariable("disableRollback", "false")
- verify(mex).setVariable("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb")
- verify(mex).setVariable("subscriptionServiceType", SVC)
-
- verify(mex).setVariable("lcpCloudRegionId", "mdt1")
- verify(mex).setVariable("cloudOwner", "my-cloud-owner")
- verify(mex).setVariable("tenantId", "8b1df54faa3b49078e3416e21370a3ba")
- assertEquals("""{"tenantId":"8b1df54faa3b49078e3416e21370a3ba","lcpCloudRegionId":"mdt1"}""", map.get("cloudConfiguration"))
- verify(mex).setVariable("sdncVersion", "1707")
- verify(mex).setVariable("GENGS_type", "service-instance")
- assertTrue(map.containsKey(Prefix+"requestInfo"))
-
- def reqinfo = map.get(Prefix+"requestInfo")
- println reqinfo
- assertTrue(reqinfo.indexOf("<request-id>mri</") >= 0)
- assertTrue(reqinfo.indexOf("<source>VID</") >= 0)
- }
-
- @Test
-// @Ignore
- public void preProcessRequest_MissingServiceInstanceId() {
- ExecutionEntity mex = setupMock()
- initPreProcess(mex)
-
- when(mex.getVariable("serviceInstanceId")).thenReturn(null)
-
- DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
-
- assertTrue(doBpmnError( { _ -> DeleteVcpeResCustService.preProcessRequest(mex) }))
- }
-
- @Test
-// @Ignore
- public void preProcessRequest_BpmnError() {
- ExecutionEntity mex = setupMock()
- initPreProcess(mex)
-
- when(mex.getVariable("bpmnRequest")).thenThrow(new BpmnError("expected exception"))
-
- DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
-
- assertTrue(doBpmnError( { _ -> DeleteVcpeResCustService.preProcessRequest(mex) }))
- }
-
- @Test
-// @Ignore
- public void preProcessRequest_Ex() {
- ExecutionEntity mex = setupMock()
- initPreProcess(mex)
-
- when(mex.getVariable("bpmnRequest")).thenThrow(new RuntimeException("expected exception"))
-
- DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
-
- assertTrue(doBpmnError( { _ -> DeleteVcpeResCustService.preProcessRequest(mex) }))
- }
-
- private void initPreProcess(ExecutionEntity mex) {
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("bpmnRequest")).thenReturn(request)
- when(mex.getVariable("mso-request-id")).thenReturn("mri")
- when(mex.getVariable("serviceInstanceId")).thenReturn("sii")
- when(mex.getVariable("requestAction")).thenReturn("ra")
- }
-
- // ***** sendSyncResponse *****
-
- @Test
-// @Ignore
- public void sendSyncResponse() {
- ExecutionEntity mex = setupMock()
- def map = setupMap(mex)
- initSendSyncResponse(mex)
-
- DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
- DeleteVcpeResCustService.sendSyncResponse(mex)
-
- verify(mex, times(2)).getVariable(DBGFLAG)
-
- verify(mex).setVariable(processName+"WorkflowResponseSent", "true")
-
- assertEquals("202", map.get(processName+"ResponseCode"))
- assertEquals("Success", map.get(processName+"Status"))
-
- def resp = map.get(processName+"Response")
-
- assertTrue(resp.indexOf('"instanceId":"sii"') >= 0)
- assertTrue(resp.indexOf('"requestId":"mri"') >= 0)
- }
-
- @Test
-// @Ignore
- public void sendSyncResponse_Ex() {
- ExecutionEntity mex = setupMock()
- initSendSyncResponse(mex)
-
- when(mex.getVariable("serviceInstanceId")).thenThrow(new RuntimeException("expected exception"))
-
- DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
-
- assertTrue(doBpmnError( { _ -> DeleteVcpeResCustService.sendSyncResponse(mex) }))
- }
-
- private initSendSyncResponse(ExecutionEntity mex) {
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("mso-request-id")).thenReturn("mri")
- when(mex.getVariable("serviceInstanceId")).thenReturn("sii")
- }
-
- // ***** prepareServiceDelete *****
-
- @Test
-// @Ignore
- public void prepareServiceDelete() {
- ExecutionEntity mex = setupMock()
- def map = setupMap(mex)
- initPrepareServiceDelete(mex)
-
- myMockGetAr("/aai/v11/anytxc", 200, "arGetTXCById.xml");
- myMockGetAr("/aai/v11/anybrg", 200, "arGetBRGById.xml");
- myMockGetAr("/aai/v11/other", 200, "arGetOtherById.xml");
-
- DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
- DeleteVcpeResCustService.prepareServiceDelete(mex)
-
- verify(mex).setVariable(Prefix+"TunnelXConn", true)
- assertEquals("ar-txcA", map.get("TXC_allottedResourceId"))
-
- verify(mex).setVariable(Prefix+"BRG", true)
- assertEquals("ar-brgB", map.get("BRG_allottedResourceId"))
-
- verify(mex).setVariable(Prefix+"vnfsCount", 2)
- assertNotNull(map.get(Prefix+"relatedVnfIdList"))
- assertEquals("[vnfX, vnfY]", map.get(Prefix+"relatedVnfIdList").toString())
-
- verify(mex, never()).setVariable(processName+"WorkflowResponseSent", "true")
- }
-
- @Test
-// @Ignore
- public void prepareServiceDelete_NotFound() {
- ExecutionEntity mex = setupMock()
- initPrepareServiceDelete(mex)
-
- when(mex.getVariable("GENGS_FoundIndicator")).thenReturn(false)
-
- DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
-
- assertTrue(doBpmnError({ _ -> DeleteVcpeResCustService.prepareServiceDelete(mex) }))
-
- verify(mex, never()).setVariable(processName+"WorkflowResponseSent", "true")
- }
-
- @Test
-// @Ignore
- public void prepareServiceDelete_Empty() {
- ExecutionEntity mex = setupMock()
- def map = setupMap(mex)
- initPrepareServiceDelete(mex)
-
- when(mex.getVariable("GENGS_service")).thenReturn("<empty></empty>")
-
- DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
- DeleteVcpeResCustService.prepareServiceDelete(mex)
-
- verify(mex).getVariable(DBGFLAG)
-
- verify(mex).setVariable(Prefix+"TunnelXConn", false)
- assertNull(map.get("TXC_allottedResourceId"))
-
- verify(mex).setVariable(Prefix+"BRG", false)
- assertNull(map.get("BRG_allottedResourceId"))
-
- assertEquals(0, map.get(Prefix+"vnfsCount"))
- assertFalse(map.containsKey(Prefix+"relatedVnfIdList"))
-
- verify(mex, never()).setVariable(processName+"WorkflowResponseSent", "true")
- }
-
- @Test
-// @Ignore
- public void prepareServiceDelete_BpmnError() {
- ExecutionEntity mex = setupMock()
- initPrepareServiceDelete(mex)
-
- when(mex.getVariable("GENGS_FoundIndicator")).thenThrow(new BpmnError("expected exception"))
-
- DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
-
- assertTrue(doBpmnError({ _ -> DeleteVcpeResCustService.prepareServiceDelete(mex) }))
-
- verify(mex, never()).setVariable(processName+"WorkflowResponseSent", "true")
- }
-
- @Test
-// @Ignore
- public void prepareServiceDelete_Ex() {
- ExecutionEntity mex = setupMock()
- initPrepareServiceDelete(mex)
-
- when(mex.getVariable("GENGS_FoundIndicator")).thenThrow(new RuntimeException("expected exception"))
-
- DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
-
- assertTrue(doBpmnError({ _ -> DeleteVcpeResCustService.prepareServiceDelete(mex) }))
-
- verify(mex).setVariable(processName+"WorkflowResponseSent", "true")
- }
-
- private initPrepareServiceDelete(ExecutionEntity mex) {
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("serviceInstanceId")).thenReturn("sii")
- when(mex.getVariable("GENGS_FoundIndicator")).thenReturn(true)
- when(mex.getVariable("mso-request-id")).thenReturn("mri")
- when(mex.getVariable("DeleteVcpeResCustServiceRequest")).thenReturn(request)
- when(mex.getVariable("URN_aai_endpoint")).thenReturn(aaiUriPfx)
- when(mex.getVariable("GENGS_service")).thenReturn(FileUtil.readResourceFile("__files/VCPE/DeleteVcpeResCustService/serviceToDelete.xml"))
- }
-
- // ***** getAaiAr *****
-
- @Test
-// @Ignore
- public void getAaiAr() {
- myMockGetAr("/myurl/ar1", 200, "arGetBRGById.xml");
-
- ExecutionEntity mex = setupMock()
- initGetAaiAr(mex)
-
- DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
- def (type, id) = DeleteVcpeResCustService.getAaiAr(mex, "/myurl/ar1")
-
- assertEquals("BRG", type)
- assertEquals("ar-brgB", id)
- }
-
- @Test
-// @Ignore
- public void getAaiAr_401() {
- myMockGetAr("/myurl/ar1", 401, "arGetBRGById.xml");
-
- ExecutionEntity mex = setupMock()
- initGetAaiAr(mex)
-
- DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
- def (type, id) = DeleteVcpeResCustService.getAaiAr(mex, "/myurl/ar1")
-
- assertEquals(null, type)
- assertEquals(null, id)
- }
-
- @Test
-// @Ignore
- public void getAaiAr_EmptyResponse() {
- myMockGetAr("/myurl/ar1", 200, "empty.txt");
-
- ExecutionEntity mex = setupMock()
- initGetAaiAr(mex)
-
- DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
- def (type, id) = DeleteVcpeResCustService.getAaiAr(mex, "/myurl/ar1")
-
- assertEquals(null, type)
- assertEquals(null, id)
- }
-
- private void initGetAaiAr(ExecutionEntity mex) {
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("URN_aai_endpoint")).thenReturn(aaiUriPfx)
- }
-
- // ***** prepareVnfAndModulesDelete *****
-
- @Test
-// @Ignore
- public void prepareVnfAndModulesDelete() {
- ExecutionEntity mex = setupMock()
- initPrepareVnfAndModulesDelete(mex)
-
- DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
- DeleteVcpeResCustService.prepareVnfAndModulesDelete(mex)
-
- verify(mex).getVariable(DBGFLAG)
-
- verify(mex).setVariable("vnfId", "vnfB")
- }
-
- @Test
-// @Ignore
- public void prepareVnfAndModulesDelete_Empty() {
- ExecutionEntity mex = setupMock()
- initPrepareVnfAndModulesDelete(mex)
-
- when(mex.getVariable(Prefix+"relatedVnfIdList")).thenReturn(new LinkedList())
-
- DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
- DeleteVcpeResCustService.prepareVnfAndModulesDelete(mex)
-
- verify(mex).getVariable(DBGFLAG)
-
- verify(mex).setVariable("vnfId", "")
- }
-
- @Test
-// @Ignore
- public void prepareVnfAndModulesDelete_Ex() {
- ExecutionEntity mex = setupMock()
- initPrepareVnfAndModulesDelete(mex)
-
- when(mex.getVariable(Prefix+"relatedVnfIdList")).thenThrow(new RuntimeException("expected exception"))
-
- DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
-
- assertTrue(doBpmnError({ _ -> DeleteVcpeResCustService.prepareVnfAndModulesDelete(mex) }))
- }
-
- private initPrepareVnfAndModulesDelete(ExecutionEntity mex) {
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable(Prefix+"relatedVnfIdList")).thenReturn(Arrays.asList("vnfA", "vnfB", "vnfC"))
- when(mex.getVariable(Prefix+"vnfsDeletedCount")).thenReturn(1)
- }
-
- // ***** validateVnfDelete *****
-
- @Test
-// @Ignore
- public void validateVnfDelete() {
- ExecutionEntity mex = setupMock()
- initValidateVnfDelete(mex)
-
- DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
- DeleteVcpeResCustService.validateVnfDelete(mex)
-
- verify(mex).getVariable(DBGFLAG)
-
- verify(mex).setVariable(Prefix+"vnfsDeletedCount", 3)
- }
-
- @Test
-// @Ignore
- public void validateVnfDelete_Ex() {
- ExecutionEntity mex = setupMock()
- initValidateVnfDelete(mex)
-
- when(mex.getVariable(Prefix+"vnfsDeletedCount")).thenThrow(new RuntimeException("expected exception"))
-
- DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
-
- assertTrue(doBpmnError({ _ -> DeleteVcpeResCustService.validateVnfDelete(mex) }))
- }
-
- private initValidateVnfDelete(ExecutionEntity mex) {
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable(Prefix+"vnfsDeletedCount")).thenReturn(2)
- }
-
- // ***** postProcessResponse *****
-
- @Test
-// @Ignore
- public void postProcessResponse() {
- ExecutionEntity mex = setupMock()
- def map = setupMap(mex)
- initPostProcessResponse(mex)
-
- DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
- DeleteVcpeResCustService.postProcessResponse(mex)
-
- verify(mex).getVariable(DBGFLAG)
-
- assertEquals(true, map.get(Prefix+"Success"))
-
- def req = map.get(Prefix+"CompleteMsoProcessRequest")
-
- assertTrue(req.indexOf("<request-id>mri</") >= 0)
- assertTrue(req.indexOf("<source>mysrc</") >= 0)
- }
-
- @Test
-// @Ignore
- public void postProcessResponse_BpmnError() {
- ExecutionEntity mex = setupMock()
- initPostProcessResponse(mex)
-
- when(mex.getVariable("source")).thenThrow(new BpmnError("expected exception"))
-
- DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
-
- assertTrue(doBpmnError( { _ -> DeleteVcpeResCustService.postProcessResponse(mex) }))
- }
-
- @Test
-// @Ignore
- public void postProcessResponse_Ex() {
- ExecutionEntity mex = setupMock()
- initPostProcessResponse(mex)
-
- when(mex.getVariable("source")).thenThrow(new RuntimeException("expected exception"))
-
- DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
-
- assertTrue(doBpmnError( { _ -> DeleteVcpeResCustService.postProcessResponse(mex) }))
- }
-
- private initPostProcessResponse(ExecutionEntity mex) {
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("source")).thenReturn("mysrc")
- when(mex.getVariable("msoRequestId")).thenReturn("mri")
- }
-
-
- // ***** prepareFalloutRequest *****
-
- @Test
-// @Ignore
- public void prepareFalloutRequest() {
- ExecutionEntity mex = setupMock()
- def map = setupMap(mex)
- initPrepareFalloutRequest(mex)
-
- DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
- DeleteVcpeResCustService.prepareFalloutRequest(mex)
-
- verify(mex, times(2)).getVariable(DBGFLAG)
-
- def fo = map.get(Prefix+"falloutRequest")
-
- assertTrue(fo.indexOf("<hello>world</") >= 0)
- assertTrue(fo.indexOf("ErrorMessage>mymsg</") >= 0)
- assertTrue(fo.indexOf("ErrorCode>999</") >= 0)
- }
-
- @Test
-// @Ignore
- public void prepareFalloutRequest_Ex() {
- ExecutionEntity mex = setupMock()
- def map = setupMap(mex)
- initPrepareFalloutRequest(mex)
-
- when(mex.getVariable("WorkflowException")).thenThrow(new RuntimeException("expected exception"))
-
- DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
-
- assertTrue(doBpmnError( { _ -> DeleteVcpeResCustService.prepareFalloutRequest(mex) }))
- }
-
- private initPrepareFalloutRequest(ExecutionEntity mex) {
- WorkflowException wfe = mock(WorkflowException.class)
-
- when(wfe.getErrorMessage()).thenReturn("mymsg")
- when(wfe.getErrorCode()).thenReturn(999)
-
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("WorkflowException")).thenReturn(wfe)
- when(mex.getVariable(Prefix+"requestInfo")).thenReturn("<hello>world</hello>")
-
- return wfe
- }
-
- // ***** sendSyncError *****
-
- @Test
-// @Ignore
- public void sendSyncError() {
- ExecutionEntity mex = setupMock()
- def map = setupMap(mex)
- initSendSyncError(mex)
-
- DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
- DeleteVcpeResCustService.sendSyncError(mex)
-
- verify(mex, times(2)).getVariable(DBGFLAG)
-
- verify(mex).setVariable(processName+"WorkflowResponseSent", "true")
-
- assertEquals("500", map.get(processName+"ResponseCode"))
- assertEquals("Fail", map.get(processName+"Status"))
-
- def resp = map.get(processName+"Response")
-
- assertTrue(resp.indexOf("ErrorMessage>mymsg</") >= 0)
-
- verify(mex).setVariable("WorkflowResponse", resp)
- }
-
- @Test
-// @Ignore
- public void sendSyncError_NotWfe() {
- ExecutionEntity mex = setupMock()
- def map = setupMap(mex)
- initSendSyncError(mex)
-
- when(mex.getVariable("WorkflowException")).thenReturn("not a WFE")
-
- DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
- DeleteVcpeResCustService.sendSyncError(mex)
-
- verify(mex, times(2)).getVariable(DBGFLAG)
-
- verify(mex).setVariable(processName+"WorkflowResponseSent", "true")
-
- assertEquals("500", map.get(processName+"ResponseCode"))
- assertEquals("Fail", map.get(processName+"Status"))
-
- def resp = map.get(processName+"Response")
-
- assertTrue(resp.indexOf("ErrorMessage>Sending Sync Error.</") >= 0)
-
- verify(mex).setVariable("WorkflowResponse", resp)
- }
-
- @Test
-// @Ignore
- public void sendSyncError_NullWfe() {
- ExecutionEntity mex = setupMock()
- def map = setupMap(mex)
- initSendSyncError(mex)
-
- when(mex.getVariable("WorkflowException")).thenReturn(null)
-
- DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
- DeleteVcpeResCustService.sendSyncError(mex)
-
- verify(mex, times(2)).getVariable(DBGFLAG)
-
- verify(mex).setVariable(processName+"WorkflowResponseSent", "true")
-
- assertEquals("500", map.get(processName+"ResponseCode"))
- assertEquals("Fail", map.get(processName+"Status"))
-
- def resp = map.get(processName+"Response")
-
- assertTrue(resp.indexOf("ErrorMessage>Sending Sync Error.</") >= 0)
-
- verify(mex).setVariable("WorkflowResponse", resp)
- }
-
- @Test
-// @Ignore
- public void sendSyncError_Ex() {
- ExecutionEntity mex = setupMock()
- def map = setupMap(mex)
- initSendSyncError(mex)
-
- when(mex.getVariable("WorkflowException")).thenThrow(new RuntimeException("expected exception"))
-
- DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
-
- DeleteVcpeResCustService.sendSyncError(mex)
-
- assertFalse(map.containsKey(processName+"ResponseCode"))
- }
-
- private initSendSyncError(ExecutionEntity mex) {
- WorkflowException wfe = mock(WorkflowException.class)
-
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("mso-request-id")).thenReturn("mri")
- when(mex.getVariable("WorkflowException")).thenReturn(wfe)
-
- when(wfe.getErrorMessage()).thenReturn("mymsg")
- }
-
-
- // ***** processJavaException *****
-
- @Test
-// @Ignore
- public void processJavaException() {
- ExecutionEntity mex = setupMock()
- def map = setupMap(mex)
- initProcessJavaException(mex)
-
- DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
-
- assertTrue(doBpmnError( { _ -> DeleteVcpeResCustService.processJavaException(mex) }))
-
- verify(mex, times(2)).getVariable(DBGFLAG)
-
- verify(mex).setVariable("prefix", Prefix)
-
- def wfe = map.get("WorkflowException")
-
- assertEquals("Caught a Java Lang Exception", wfe.getErrorMessage())
- }
-
- @Test
-// @Ignore
- public void processJavaException_BpmnError() {
- ExecutionEntity mex = setupMock()
- def map = setupMap(mex)
- initProcessJavaException(mex)
-
- when(mex.getVariables()).thenThrow(new BpmnError("expected exception"))
-
- DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
-
- assertTrue(doBpmnError( { _ -> DeleteVcpeResCustService.processJavaException(mex) }))
-
- assertFalse(map.containsKey("WorkflowException"))
- }
-
- @Test
-// @Ignore
- public void processJavaException_Ex() {
- ExecutionEntity mex = setupMock()
- def map = setupMap(mex)
- initProcessJavaException(mex)
-
- when(mex.getVariables()).thenThrow(new RuntimeException("expected exception"))
-
- DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
-
- assertTrue(doBpmnError( { _ -> DeleteVcpeResCustService.processJavaException(mex) }))
-
- def wfe = map.get("WorkflowException")
-
- assertEquals("Exception in processJavaException method", wfe.getErrorMessage())
- }
-
- private initProcessJavaException(ExecutionEntity mex) {
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- }
-
- private void myMockGetAr(String url, int status, String fileResp) {
- stubFor(get(urlMatching(url))
- .willReturn(aResponse()
- .withStatus(status)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("VCPE/DeleteVcpeResCustService/" + fileResp)));
- }
-}
+ public void init() {
+ MockitoAnnotations.initMocks(this)
+ }
+
+ public DeleteVcpeResCustServiceTest() {
+ super("DeleteVcpeResCustService")
+ }
+
+ // ***** preProcessRequest *****
+
+ @Test
+ public void preProcessRequest() {
+ ExecutionEntity mex = setupMock()
+ def map = setupMap(mex)
+ initPreProcess(mex)
+
+ DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
+ DeleteVcpeResCustService.preProcessRequest(mex)
+
+ verify(mex).getVariable(DBGFLAG)
+
+ assertEquals(Prefix, map.get("prefix"))
+ assertEquals(request, map.get("DeleteVcpeResCustServiceRequest"))
+ assertEquals("mri", map.get("msoRequestId"))
+ assertEquals("ra", map.get("requestAction"))
+ assertEquals("VID", map.get("source"))
+ assertEquals(CUST, map.get("globalSubscriberId"))
+ assertEquals(CUST, map.get("globalCustomerId"))
+ assertEquals("false", map.get("disableRollback"))
+ assertEquals("a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", map.get("productFamilyId"))
+ assertEquals(SVC, map.get("subscriptionServiceType"))
+
+ assertEquals("mdt1", map.get("lcpCloudRegionId"))
+ assertEquals("8b1df54faa3b49078e3416e21370a3ba", map.get("tenantId"))
+ assertEquals("1707", map.get("sdncVersion"))
+ assertEquals(
+ """{"cloudOwner":"CloudOwner","tenantId":"8b1df54faa3b49078e3416e21370a3ba","lcpCloudRegionId":"mdt1"}""",
+ map.get("cloudConfiguration")
+ )
+ assertTrue(map.containsKey(Prefix + "requestInfo"))
+
+ def reqinfo = map.get(Prefix + "requestInfo")
+ assertTrue(reqinfo.indexOf("<request-id>mri</") >= 0)
+ assertTrue(reqinfo.indexOf("<source>VID</") >= 0)
+ }
+
+ @Test
+ public void preProcessRequest_EmptyParts() {
+ ExecutionEntity mex = setupMock()
+ def map = setupMap(mex)
+ initPreProcess(mex)
+
+ def req = request
+ .replace('"source"', '"sourceXXX"')
+
+ when(mex.getVariable("bpmnRequest")).thenReturn(req)
+
+ DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
+ DeleteVcpeResCustService.preProcessRequest(mex)
+
+ verify(mex).getVariable(DBGFLAG)
+ verify(mex).setVariable("prefix", Prefix)
+ verify(mex).setVariable("DeleteVcpeResCustServiceRequest", req)
+ verify(mex).setVariable("msoRequestId", "mri")
+ verify(mex).setVariable("requestAction", "ra")
+ verify(mex).setVariable("source", "VID")
+ verify(mex).setVariable("globalSubscriberId", CUST)
+ verify(mex).setVariable("globalCustomerId", CUST)
+ verify(mex).setVariable("disableRollback", "false")
+ verify(mex).setVariable("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb")
+ verify(mex).setVariable("subscriptionServiceType", SVC)
+
+ verify(mex).setVariable("lcpCloudRegionId", "mdt1")
+ verify(mex).setVariable("cloudOwner", "CloudOwner")
+ verify(mex).setVariable("tenantId", "8b1df54faa3b49078e3416e21370a3ba")
+ assertEquals(
+ """{"cloudOwner":"CloudOwner","tenantId":"8b1df54faa3b49078e3416e21370a3ba","lcpCloudRegionId":"mdt1"}""",
+ map.get("cloudConfiguration")
+ )
+ verify(mex).setVariable("sdncVersion", "1707")
+ assertTrue(map.containsKey(Prefix + "requestInfo"))
+
+ def reqinfo = map.get(Prefix + "requestInfo")
+ println reqinfo
+ assertTrue(reqinfo.indexOf("<request-id>mri</") >= 0)
+ assertTrue(reqinfo.indexOf("<source>VID</") >= 0)
+ }
+
+ @Test
+ public void preProcessRequest_MissingServiceInstanceId() {
+ ExecutionEntity mex = setupMock()
+ initPreProcess(mex)
+
+ when(mex.getVariable("serviceInstanceId")).thenReturn(null)
+
+ DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
+
+ assertTrue(doBpmnError({ _ -> DeleteVcpeResCustService.preProcessRequest(mex) }))
+ }
+
+ @Test
+ public void preProcessRequest_BpmnError() {
+ ExecutionEntity mex = setupMock()
+ initPreProcess(mex)
+
+ when(mex.getVariable("bpmnRequest")).thenThrow(new BpmnError("expected exception"))
+
+ DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
+
+ assertTrue(doBpmnError({ _ -> DeleteVcpeResCustService.preProcessRequest(mex) }))
+ }
+
+ @Test
+ public void preProcessRequest_Ex() {
+ ExecutionEntity mex = setupMock()
+ initPreProcess(mex)
+
+ when(mex.getVariable("bpmnRequest")).thenThrow(new RuntimeException("expected exception"))
+
+ DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
+
+ assertTrue(doBpmnError({ _ -> DeleteVcpeResCustService.preProcessRequest(mex) }))
+ }
+
+ private void initPreProcess(ExecutionEntity mex) {
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("bpmnRequest")).thenReturn(request)
+ when(mex.getVariable("mso-request-id")).thenReturn("mri")
+ when(mex.getVariable("serviceInstanceId")).thenReturn("sii")
+ when(mex.getVariable("requestAction")).thenReturn("ra")
+ }
+
+ // ***** sendSyncResponse *****
+
+ @Test
+ public void sendSyncResponse() {
+ ExecutionEntity mex = setupMock()
+ def map = setupMap(mex)
+ initSendSyncResponse(mex)
+
+ DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
+ DeleteVcpeResCustService.sendSyncResponse(mex)
+
+ verify(mex, times(2)).getVariable(DBGFLAG)
+
+ verify(mex).setVariable(processName + "WorkflowResponseSent", "true")
+
+ assertEquals("202", map.get(processName + "ResponseCode"))
+ assertEquals("Success", map.get(processName + "Status"))
+
+ def resp = map.get(processName + "Response")
+
+ assertTrue(resp.indexOf('"instanceId":"sii"') >= 0)
+ assertTrue(resp.indexOf('"requestId":"mri"') >= 0)
+ }
+
+ @Test
+ public void sendSyncResponse_Ex() {
+ ExecutionEntity mex = setupMock()
+ initSendSyncResponse(mex)
+
+ when(mex.getVariable("serviceInstanceId")).thenThrow(new RuntimeException("expected exception"))
+
+ DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
+
+ assertTrue(doBpmnError({ _ -> DeleteVcpeResCustService.sendSyncResponse(mex) }))
+ }
+
+ private initSendSyncResponse(ExecutionEntity mex) {
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("mso-request-id")).thenReturn("mri")
+ when(mex.getVariable("serviceInstanceId")).thenReturn("sii")
+ }
+
+ // ***** prepareVnfAndModulesDelete *****
+
+ @Test
+ public void prepareVnfAndModulesDelete() {
+ ExecutionEntity mex = setupMock()
+ initPrepareVnfAndModulesDelete(mex)
+
+ DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
+ DeleteVcpeResCustService.prepareVnfAndModulesDelete(mex)
+
+ verify(mex).getVariable(DBGFLAG)
+
+ verify(mex).setVariable("vnfId", "vnfB")
+ }
+
+ @Test
+ public void prepareVnfAndModulesDelete_Empty() {
+ ExecutionEntity mex = setupMock()
+ initPrepareVnfAndModulesDelete(mex)
+
+ when(mex.getVariable(Prefix + "relatedVnfIdList")).thenReturn(new LinkedList())
+
+ DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
+ DeleteVcpeResCustService.prepareVnfAndModulesDelete(mex)
+
+ verify(mex).getVariable(DBGFLAG)
+
+ verify(mex).setVariable("vnfId", "")
+ }
+
+ @Test
+ public void prepareVnfAndModulesDelete_Ex() {
+ ExecutionEntity mex = setupMock()
+ initPrepareVnfAndModulesDelete(mex)
+
+ when(mex.getVariable(Prefix + "relatedVnfIdList")).thenThrow(new RuntimeException("expected exception"))
+
+ DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
+
+ assertTrue(doBpmnError({ _ -> DeleteVcpeResCustService.prepareVnfAndModulesDelete(mex) }))
+ }
+
+ private initPrepareVnfAndModulesDelete(ExecutionEntity mex) {
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable(Prefix + "relatedVnfIdList")).thenReturn(Arrays.asList("vnfA", "vnfB", "vnfC"))
+ when(mex.getVariable(Prefix + "vnfsDeletedCount")).thenReturn(1)
+ }
+
+ // ***** validateVnfDelete *****
+
+ @Test
+ public void validateVnfDelete() {
+ ExecutionEntity mex = setupMock()
+ initValidateVnfDelete(mex)
+
+ DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
+ DeleteVcpeResCustService.validateVnfDelete(mex)
+
+ verify(mex).getVariable(DBGFLAG)
+
+ verify(mex).setVariable(Prefix + "vnfsDeletedCount", 3)
+ }
+
+ @Test
+ public void validateVnfDelete_Ex() {
+ ExecutionEntity mex = setupMock()
+ initValidateVnfDelete(mex)
+
+ when(mex.getVariable(Prefix + "vnfsDeletedCount")).thenThrow(new RuntimeException("expected exception"))
+
+ DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
+
+ assertTrue(doBpmnError({ _ -> DeleteVcpeResCustService.validateVnfDelete(mex) }))
+ }
+
+ private initValidateVnfDelete(ExecutionEntity mex) {
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable(Prefix + "vnfsDeletedCount")).thenReturn(2)
+ }
+
+ // ***** postProcessResponse *****
+
+ @Test
+ public void postProcessResponse() {
+ ExecutionEntity mex = setupMock()
+ def map = setupMap(mex)
+ initPostProcessResponse(mex)
+
+ DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
+ DeleteVcpeResCustService.postProcessResponse(mex)
+
+ verify(mex).getVariable(DBGFLAG)
+
+ verify(mex).setVariable(Prefix + "Success", true)
+
+ def req = map.get(Prefix + "CompleteMsoProcessRequest")
+
+ assertTrue(req.indexOf("<request-id>mri</") >= 0)
+ assertTrue(req.indexOf("<source>mysrc</") >= 0)
+ }
+
+ @Test
+ public void postProcessResponse_BpmnError() {
+ ExecutionEntity mex = setupMock()
+ initPostProcessResponse(mex)
+
+ when(mex.getVariable("source")).thenThrow(new BpmnError("expected exception"))
+
+ DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
+
+ assertTrue(doBpmnError({ _ -> DeleteVcpeResCustService.postProcessResponse(mex) }))
+ }
+
+ @Test
+ public void postProcessResponse_Ex() {
+ ExecutionEntity mex = setupMock()
+ initPostProcessResponse(mex)
+
+ when(mex.getVariable("source")).thenThrow(new RuntimeException("expected exception"))
+
+ DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
+
+ assertTrue(doBpmnError({ _ -> DeleteVcpeResCustService.postProcessResponse(mex) }))
+ }
+
+ private initPostProcessResponse(ExecutionEntity mex) {
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("source")).thenReturn("mysrc")
+ when(mex.getVariable("msoRequestId")).thenReturn("mri")
+ }
+
+ // ***** prepareFalloutRequest *****
+
+ @Test
+ public void prepareFalloutRequest() {
+ ExecutionEntity mex = setupMock()
+ def map = setupMap(mex)
+ WorkflowException wfe = initPrepareFalloutRequest(mex)
+ when(wfe.getErrorMessage()).thenReturn("mymsg")
+ when(wfe.getErrorCode()).thenReturn(999)
+
+ DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
+ DeleteVcpeResCustService.prepareFalloutRequest(mex)
+
+ verify(mex).getVariable(DBGFLAG)
+ verify(mex, times(4)).getVariable("WorkflowException")
+ verify(mex).getVariable(Prefix + "requestInfo")
+
+ def fo = map.get(Prefix + "falloutRequest")
+
+ assertTrue(fo.indexOf("<hello>world</") >= 0)
+ assertTrue(fo.indexOf("ErrorMessage>mymsg</") >= 0)
+ assertTrue(fo.indexOf("ErrorCode>999</") >= 0)
+ }
+
+ @Test
+ public void prepareFalloutRequest_Ex() {
+ ExecutionEntity mex = setupMock()
+ setupMap(mex)
+ initPrepareFalloutRequest(mex)
+
+ when(mex.getVariable("WorkflowException")).thenThrow(new RuntimeException("expected exception"))
+
+ DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
+
+ assertTrue(doBpmnError({ _ -> DeleteVcpeResCustService.prepareFalloutRequest(mex) }))
+ }
+
+ private initPrepareFalloutRequest(ExecutionEntity mex) {
+ WorkflowException wfe = mock(WorkflowException.class)
+
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("WorkflowException")).thenReturn(wfe)
+ when(mex.getVariable(Prefix + "requestInfo")).thenReturn("<hello>world</hello>")
+
+ return wfe
+ }
+
+ // ***** sendSyncError *****
+
+ @Test
+ public void sendSyncError() {
+ ExecutionEntity mex = setupMock()
+ def map = setupMap(mex)
+ initSendSyncError(mex)
+
+ DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
+ DeleteVcpeResCustService.sendSyncError(mex)
+
+ verify(mex, times(2)).getVariable(DBGFLAG)
+
+ verify(mex).setVariable(processName + "WorkflowResponseSent", "true")
+
+ assertEquals("500", map.get(processName + "ResponseCode"))
+ assertEquals("Fail", map.get(processName + "Status"))
+
+ def resp = map.get(processName + "Response")
+
+ assertTrue(resp.indexOf("ErrorMessage>mymsg</") >= 0)
+
+ verify(mex).setVariable("WorkflowResponse", resp)
+ }
+
+ @Test
+ public void sendSyncError_NotWfe() {
+ ExecutionEntity mex = setupMock()
+ def map = setupMap(mex)
+ initSendSyncError(mex)
+
+ when(mex.getVariable("WorkflowException")).thenReturn("not a WFE")
+
+ DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
+ DeleteVcpeResCustService.sendSyncError(mex)
+
+ verify(mex, times(2)).getVariable(DBGFLAG)
+ verify(mex, times(2)).getProcessEngineServices()
+ verify(mex, times(2)).getProcessDefinitionId()
+
+ verify(mex).setVariable(processName + "WorkflowResponseSent", "true")
+
+ assertEquals("500", map.get(processName + "ResponseCode"))
+ assertEquals("Fail", map.get(processName + "Status"))
+
+ def resp = map.get(processName + "Response")
+
+ assertTrue(resp.indexOf("ErrorMessage>Sending Sync Error.</") >= 0)
+
+ verify(mex).setVariable("WorkflowResponse", resp)
+ }
+
+ @Test
+ public void sendSyncError_NullWfe() {
+ ExecutionEntity mex = setupMock()
+ def map = setupMap(mex)
+ initSendSyncError(mex)
+
+ when(mex.getVariable("WorkflowException")).thenReturn(null)
+
+ DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
+ DeleteVcpeResCustService.sendSyncError(mex)
+
+ verify(mex, times(2)).getVariable(DBGFLAG)
+
+ verify(mex).setVariable(processName + "WorkflowResponseSent", "true")
+
+ assertEquals("500", map.get(processName + "ResponseCode"))
+ assertEquals("Fail", map.get(processName + "Status"))
+
+ def resp = map.get(processName + "Response")
+
+ assertTrue(resp.indexOf("ErrorMessage>Sending Sync Error.</") >= 0)
+
+ verify(mex).setVariable("WorkflowResponse", resp)
+ }
+
+ @Test
+ public void sendSyncError_Ex() {
+ ExecutionEntity mex = setupMock()
+ def map = setupMap(mex)
+ initSendSyncError(mex)
+
+ when(mex.getVariable("WorkflowException")).thenThrow(new RuntimeException("expected exception"))
+
+ DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
+
+ DeleteVcpeResCustService.sendSyncError(mex)
+
+ assertFalse(map.containsKey(processName + "ResponseCode"))
+ }
+
+ private initSendSyncError(ExecutionEntity mex) {
+ WorkflowException wfe = mock(WorkflowException.class)
+
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("mso-request-id")).thenReturn("mri")
+ when(mex.getVariable("WorkflowException")).thenReturn(wfe)
+
+ when(wfe.getErrorMessage()).thenReturn("mymsg")
+ }
+
+ // ***** processJavaException *****
+
+ @Test
+ public void processJavaException() {
+ ExecutionEntity mex = setupMock()
+ def map = setupMap(mex)
+ initProcessJavaException(mex)
+
+ DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
+
+ assertTrue(doBpmnError({ _ -> DeleteVcpeResCustService.processJavaException(mex) }))
+
+ verify(mex).getVariable(DBGFLAG)
+
+ verify(mex).setVariable("prefix", Prefix)
+
+ def wfe = map.get("WorkflowException")
+
+ assertEquals("Caught a Java Lang Exception", wfe.getErrorMessage())
+ }
+
+ @Test
+ public void processJavaException_BpmnError() {
+ ExecutionEntity mex = setupMock()
+ def map = setupMap(mex)
+ initProcessJavaException(mex)
+
+ when(mex.getVariables()).thenThrow(new BpmnError("expected exception"))
+
+ DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
+
+ assertTrue(doBpmnError({ _ -> DeleteVcpeResCustService.processJavaException(mex) }))
+
+ assertFalse(map.containsKey("WorkflowException"))
+ }
+
+ @Test
+ public void processJavaException_Ex() {
+ ExecutionEntity mex = setupMock()
+ def map = setupMap(mex)
+ initProcessJavaException(mex)
+
+ when(mex.getVariables()).thenThrow(new RuntimeException("expected exception"))
+
+ DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
+
+ assertTrue(doBpmnError({ _ -> DeleteVcpeResCustService.processJavaException(mex) }))
+
+ def wfe = map.get("WorkflowException")
+
+ assertEquals("Exception in processJavaException method", wfe.getErrorMessage())
+ }
+
+ private initProcessJavaException(ExecutionEntity mex) {
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ }
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollbackTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollbackTest.groovy
index 7982e4dd4b..41a862e00e 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollbackTest.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollbackTest.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -20,635 +22,577 @@
package org.onap.so.bpmn.vcpe.scripts
-
-import org.camunda.bpm.engine.ProcessEngineServices
-import org.camunda.bpm.engine.RepositoryService
+import com.github.tomakehurst.wiremock.junit.WireMockRule
+import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity
-import org.camunda.bpm.engine.repository.ProcessDefinition
-import org.camunda.bpm.engine.delegate.DelegateExecution
-import org.junit.Before
-import org.junit.BeforeClass
-import org.junit.Rule
-import org.junit.Test
-import org.junit.Ignore
+import org.junit.*
import org.mockito.MockitoAnnotations
-import org.camunda.bpm.engine.delegate.BpmnError
-import org.onap.so.bpmn.core.WorkflowException
-import org.onap.so.bpmn.mock.FileUtil
+import org.onap.so.bpmn.core.RollbackData
import static com.github.tomakehurst.wiremock.client.WireMock.aResponse
import static com.github.tomakehurst.wiremock.client.WireMock.get
-import static com.github.tomakehurst.wiremock.client.WireMock.stubFor
import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertTrue
import static org.mockito.Mockito.*
-import static org.onap.so.bpmn.mock.StubResponseAAI.MockDeleteAllottedResource
-import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetAllottedResource
-import static org.onap.so.bpmn.mock.StubResponseAAI.MockPatchAllottedResource
+import static org.onap.so.bpmn.mock.StubResponseAAI.*
-import org.onap.so.bpmn.core.RollbackData
+class DoCreateAllottedResourceBRGRollbackTest extends GroovyTestBase {
-import com.github.tomakehurst.wiremock.junit.WireMockRule
+ @Rule
+ public WireMockRule wireMockRule = new WireMockRule(PORT)
+
+ String Prefix = "DCARBRGRB_"
+ String RbType = "DCARBRG_"
+
+ @BeforeClass
+ public static void setUpBeforeClass() {
+ GroovyTestBase.setUpBeforeClass()
+ }
-class DoCreateAllottedResourceBRGRollbackTest extends GroovyTestBase {
-
- @Rule
- public WireMockRule wireMockRule = new WireMockRule(PORT)
-
- String Prefix = "DCARBRGRB_"
- String RbType = "DCARBRG_"
-
- @BeforeClass
- public static void setUpBeforeClass() {
- super.setUpBeforeClass()
- }
-
@Before
- public void init()
- {
- MockitoAnnotations.initMocks(this)
- }
-
- public DoCreateAllottedResourceBRGRollbackTest() {
- super("DoCreateAllottedResourceBRGRollback")
- }
-
-
- // ***** preProcessRequest *****
-
- @Test
-// @Ignore
- public void preProcessRequest() {
- ExecutionEntity mex = setupMock()
- initPreProcess(mex)
-
- DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
- DoCreateAllottedResourceBRGRollback.preProcessRequest(mex)
-
- ////verify(mex).getVariable(DBGFLAG)
- verify(mex).setVariable("prefix", Prefix)
- verify(mex).setVariable("serviceInstanceId", "sii")
- verify(mex).setVariable("parentServiceInstanceId", "psii")
- verify(mex).setVariable("allottedResourceId", "myid")
- verify(mex).setVariable("rollbackAAI", true)
- verify(mex).setVariable("aaiARPath", "mypath")
- verify(mex).setVariable("rollbackSDNC", true)
- verify(mex).setVariable("deactivateSdnc", "myactivate")
- verify(mex).setVariable("deleteSdnc", "mycreate")
- verify(mex).setVariable("unassignSdnc", "true")
- verify(mex).setVariable("sdncDeactivateRequest", "activatereq")
- verify(mex).setVariable("sdncDeleteRequest", "createreq")
- verify(mex).setVariable("sdncUnassignRequest", "assignreq")
-
- verify(mex, never()).setVariable("skipRollback", true)
- }
-
- @Test
-// @Ignore
- public void preProcessRequest_RollbackDisabled() {
- ExecutionEntity mex = setupMock()
- initPreProcess(mex)
-
- when(mex.getVariable("disableRollback")).thenReturn("true")
-
- DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
- DoCreateAllottedResourceBRGRollback.preProcessRequest(mex)
-
- ////verify(mex).getVariable(DBGFLAG)
- verify(mex).setVariable("prefix", Prefix)
- verify(mex).setVariable("serviceInstanceId", "sii")
- verify(mex).setVariable("parentServiceInstanceId", "psii")
- verify(mex).setVariable("allottedResourceId", "myid")
- verify(mex).setVariable("rollbackAAI", true)
- verify(mex).setVariable("aaiARPath", "mypath")
- verify(mex).setVariable("rollbackSDNC", true)
- verify(mex).setVariable("deactivateSdnc", "myactivate")
- verify(mex).setVariable("deleteSdnc", "mycreate")
- verify(mex).setVariable("unassignSdnc", "true")
- verify(mex).setVariable("sdncDeactivateRequest", "activatereq")
- verify(mex).setVariable("sdncDeleteRequest", "createreq")
- verify(mex).setVariable("sdncUnassignRequest", "assignreq")
-
- verify(mex).setVariable("skipRollback", true)
- }
-
- @Test
-// @Ignore
- public void preProcessRequest_NoAAI() {
- ExecutionEntity mex = setupMock()
- def data = initPreProcess(mex)
-
- when(mex.getVariable("rollbackAAI")).thenReturn(false)
- data.put(RbType, "rollbackAAI", "false")
-
- DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
- DoCreateAllottedResourceBRGRollback.preProcessRequest(mex)
-
- //verify(mex).getVariable(DBGFLAG)
- verify(mex).setVariable("prefix", Prefix)
- verify(mex).setVariable("serviceInstanceId", "sii")
- verify(mex).setVariable("parentServiceInstanceId", "psii")
- verify(mex).setVariable("allottedResourceId", "myid")
- verify(mex, never()).setVariable("rollbackAAI", true)
- verify(mex, never()).setVariable("aaiARPath", "mypath")
- verify(mex).setVariable("rollbackSDNC", true)
- verify(mex).setVariable("deactivateSdnc", "myactivate")
- verify(mex).setVariable("deleteSdnc", "mycreate")
- verify(mex).setVariable("unassignSdnc", "true")
- verify(mex).setVariable("sdncDeactivateRequest", "activatereq")
- verify(mex).setVariable("sdncDeleteRequest", "createreq")
- verify(mex).setVariable("sdncUnassignRequest", "assignreq")
-
- verify(mex, never()).setVariable("skipRollback", true)
- }
-
- @Test
-// @Ignore
- public void preProcessRequest_NoAssign() {
- ExecutionEntity mex = setupMock()
- def data = initPreProcess(mex)
-
- when(mex.getVariable("rollbackSDNC")).thenReturn(false)
- data.put(RbType, "rollbackSDNCassign", "false")
-
- DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
- DoCreateAllottedResourceBRGRollback.preProcessRequest(mex)
-
- //verify(mex).getVariable(DBGFLAG)
- verify(mex).setVariable("prefix", Prefix)
- verify(mex).setVariable("serviceInstanceId", "sii")
- verify(mex).setVariable("parentServiceInstanceId", "psii")
- verify(mex).setVariable("allottedResourceId", "myid")
- verify(mex).setVariable("rollbackAAI", true)
- verify(mex).setVariable("aaiARPath", "mypath")
- verify(mex, never()).setVariable("rollbackSDNC", true)
- verify(mex, never()).setVariable("deactivateSdnc", "myactivate")
- verify(mex, never()).setVariable("deleteSdnc", "mycreate")
- verify(mex, never()).setVariable("unassignSdnc", "true")
- verify(mex, never()).setVariable("sdncDeactivateRequest", "activatereq")
- verify(mex, never()).setVariable("sdncDeleteRequest", "createreq")
- verify(mex, never()).setVariable("sdncUnassignRequest", "assignreq")
-
- verify(mex, never()).setVariable("skipRollback", true)
- }
-
- @Test
-// @Ignore
- public void preProcessRequest_NoAAI_NoAssign() {
- ExecutionEntity mex = setupMock()
- initPreProcess(mex)
-
- when(mex.getVariable("rollbackAAI")).thenReturn(false)
- when(mex.getVariable("rollbackSDNC")).thenReturn(false)
-
- DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
- DoCreateAllottedResourceBRGRollback.preProcessRequest(mex)
-
- verify(mex).setVariable("skipRollback", true)
- }
-
- @Test
-// @Ignore
- public void preProcessRequest_NoRbStructure() {
- ExecutionEntity mex = setupMock()
- initPreProcess(mex)
-
- when(mex.getVariable("rollbackData")).thenReturn(new RollbackData())
-
- DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
- DoCreateAllottedResourceBRGRollback.preProcessRequest(mex)
-
- verify(mex).setVariable("skipRollback", true)
- }
-
- @Test
-// @Ignore
- public void preProcessRequest_NullRb() {
- ExecutionEntity mex = setupMock()
- initPreProcess(mex)
-
- when(mex.getVariable("rollbackData")).thenReturn(null)
-
- DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
- DoCreateAllottedResourceBRGRollback.preProcessRequest(mex)
-
- verify(mex).setVariable("skipRollback", true)
- }
-
- @Test
-// @Ignore
- public void preProcessRequest_BpmnError() {
- ExecutionEntity mex = setupMock()
- initPreProcess(mex)
-
- when(mex.getVariable("rollbackData")).thenThrow(new BpmnError("expected exception"))
-
- DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
-
- assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceBRGRollback.preProcessRequest(mex) }))
- }
-
- @Test
-// @Ignore
- public void preProcessRequest_Ex() {
- ExecutionEntity mex = setupMock()
- initPreProcess(mex)
-
- when(mex.getVariable("rollbackData")).thenThrow(new RuntimeException("expected exception"))
-
- DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
-
- assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceBRGRollback.preProcessRequest(mex) }))
- }
-
- @Test
- @Ignore
- public void updateAaiAROrchStatus() {
- ExecutionEntity mex = setupMock()
- initUpdateAaiAROrchStatus(mex)
-
- MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml")
- MockPatchAllottedResource(CUST, SVC, INST, ARID)
-
- DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
- DoCreateAllottedResourceBRGRollback.updateAaiAROrchStatus(mex, "success")
- }
-
- @Test
-// @Ignore
- public void updateAaiAROrchStatus_EmptyResponse() {
- ExecutionEntity mex = setupMock()
- initUpdateAaiAROrchStatus(mex)
-
- wireMockRule
- .stubFor(get(urlMatching("/aai/v[0-9]+/.*"))
- .willReturn(aResponse()
- .withStatus(200)))
-
- DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
-
- assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceBRGRollback.updateAaiAROrchStatus(mex, "success") }))
- }
-
- @Test
-// @Ignore
- public void updateAaiAROrchStatus_NoArPath() {
- ExecutionEntity mex = setupMock()
- initUpdateAaiAROrchStatus(mex)
-
- MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml")
- MockPatchAllottedResource(CUST, SVC, INST, ARID)
-
- when(mex.getVariable("aaiARPath")).thenReturn(null)
-
- DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
-
- assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceBRGRollback.updateAaiAROrchStatus(mex, "success") }))
- }
-
-
- // ***** validateSDNCResp *****
-
- @Test
-// @Ignore
- public void validateSDNCResp() {
- ExecutionEntity mex = setupMock()
- initValidateSDNCResp(mex)
- def resp = initValidateSDNCResp_Resp()
-
- when(mex.getVariable(Prefix+"sdncResponseSuccess")).thenReturn(true)
-
- DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
-
- DoCreateAllottedResourceBRGRollback.validateSDNCResp(mex, resp, "create")
-
- verify(mex).getVariable("WorkflowException")
- verify(mex).getVariable("SDNCA_SuccessIndicator")
- }
-
- @Test
-// @Ignore
- public void validateSDNCResp_Unsuccessful() {
- ExecutionEntity mex = setupMock()
- initValidateSDNCResp(mex)
- def resp = initValidateSDNCResp_Resp()
-
- when(mex.getVariable(Prefix+"sdncResponseSuccess")).thenReturn(false)
-
- DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
-
- assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceBRGRollback.validateSDNCResp(mex, resp, "create") }))
- }
-
- @Test
-// @Ignore
- public void validateSDNCResp_BpmnError404() {
- ExecutionEntity mex = setupMock()
- initValidateSDNCResp(mex)
- def resp = initValidateSDNCResp_Resp()
- when(mex.getVariable(Prefix+"sdncResponseSuccess")).thenReturn(true)
-
- when(mex.getVariable("WorkflowException")).thenThrow(new BpmnError("404", "expected exception"))
-
- DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
-
- DoCreateAllottedResourceBRGRollback.validateSDNCResp(mex, resp, "create")
- }
-
- @Test
-// @Ignore
- public void validateSDNCResp_BpmnError() {
- ExecutionEntity mex = setupMock()
- initValidateSDNCResp(mex)
- def resp = initValidateSDNCResp_Resp()
- when(mex.getVariable(Prefix+"sdncResponseSuccess")).thenReturn(true)
-
- when(mex.getVariable("WorkflowException")).thenThrow(new BpmnError("expected exception"))
-
- DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
-
- assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceBRGRollback.validateSDNCResp(mex, resp, "create") }))
- }
-
- @Test
-// @Ignore
- public void validateSDNCResp_Ex() {
- ExecutionEntity mex = setupMock()
- initValidateSDNCResp(mex)
- def resp = initValidateSDNCResp_Resp()
- when(mex.getVariable(Prefix+"sdncResponseSuccess")).thenReturn(true)
-
- when(mex.getVariable("WorkflowException")).thenThrow(new RuntimeException("expected exception"))
-
- DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
-
- assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceBRGRollback.validateSDNCResp(mex, resp, "create") }))
- }
-
- @Test
- @Ignore
- public void deleteAaiAR() {
- ExecutionEntity mex = setupMock()
- initDeleteAaiAR(mex)
-
- MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml")
- MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS)
-
- DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
- DoCreateAllottedResourceBRGRollback.deleteAaiAR(mex)
- }
-
- @Test
-// @Ignore
- public void deleteAaiAR_NoArPath() {
- ExecutionEntity mex = setupMock()
- initDeleteAaiAR(mex)
-
- MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml")
- MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS)
-
- when(mex.getVariable("aaiARPath")).thenReturn("")
-
- DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
-
- assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceBRGRollback.deleteAaiAR(mex) }))
- }
-
- @Test
-// @Ignore
- public void deleteAaiAR_BpmnError() {
- ExecutionEntity mex = setupMock()
- initDeleteAaiAR(mex)
-
- MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml")
- MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS)
-
- when(mex.getVariable("aaiARPath")).thenThrow(new BpmnError("expected exception"))
-
- DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
-
- assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceBRGRollback.deleteAaiAR(mex) }))
- }
-
- @Test
-// @Ignore
- public void deleteAaiAR_Ex() {
- ExecutionEntity mex = setupMock()
- initDeleteAaiAR(mex)
-
- MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml")
- MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS)
-
- when(mex.getVariable("aaiARPath")).thenThrow(new RuntimeException("expected exception"))
-
- DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
-
- assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceBRGRollback.deleteAaiAR(mex) }))
- }
-
- @Test
-// @Ignore
- public void postProcessRequest() {
- ExecutionEntity mex = setupMock()
- initPostProcessRequest(mex)
-
- DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
- DoCreateAllottedResourceBRGRollback.postProcessRequest(mex)
-
- //verify(mex).getVariable(DBGFLAG)
- verify(mex).setVariable("rollbackData", null)
- verify(mex).setVariable("rolledBack", true)
- }
-
- @Test
-// @Ignore
- public void postProcessRequest_RolledBack() {
- ExecutionEntity mex = setupMock()
- initPostProcessRequest(mex)
-
- when(mex.getVariable("skipRollback")).thenReturn(true)
-
- DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
- DoCreateAllottedResourceBRGRollback.postProcessRequest(mex)
-
- //verify(mex).getVariable(DBGFLAG)
- verify(mex).setVariable("rollbackData", null)
- verify(mex, never()).setVariable("rolledBack", true)
- }
-
- @Test
-// @Ignore
- public void postProcessRequest_BpmnError() {
- ExecutionEntity mex = setupMock()
- initPostProcessRequest(mex)
-
- when(mex.getVariable("skipRollback")).thenThrow(new BpmnError("expected exception"))
-
- DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
- DoCreateAllottedResourceBRGRollback.postProcessRequest(mex)
-
- //verify(mex).getVariable(DBGFLAG)
- verify(mex).setVariable("rollbackData", null)
- verify(mex, never()).setVariable("rolledBack", true)
- }
-
- @Test
-// @Ignore
- public void postProcessRequest_Ex() {
- ExecutionEntity mex = setupMock()
- initPostProcessRequest(mex)
-
- when(mex.getVariable("skipRollback")).thenThrow(new RuntimeException("expected exception"))
-
- DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
- DoCreateAllottedResourceBRGRollback.postProcessRequest(mex)
-
- //verify(mex).getVariable(DBGFLAG)
- verify(mex).setVariable("rollbackData", null)
- verify(mex, never()).setVariable("rolledBack", true)
- }
-
- @Test
-// @Ignore
- public void processRollbackException() {
- ExecutionEntity mex = setupMock()
- initProcessRollbackException(mex)
-
- DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
- DoCreateAllottedResourceBRGRollback.processRollbackException(mex)
-
- //verify(mex).getVariable(DBGFLAG)
- verify(mex).setVariable("rollbackData", null)
- verify(mex).setVariable("rolledBack", false)
- verify(mex).setVariable("rollbackError", "Caught exception in AllottedResource Create Rollback")
- verify(mex).setVariable("WorkflowException", null)
- }
-
- @Test
-// @Ignore
- public void processRollbackException_BpmnError() {
- ExecutionEntity mex = setupMock()
- initProcessRollbackException(mex)
-
- doThrow(new BpmnError("expected exception")).when(mex).setVariable("rollbackData", null)
-
- DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
- DoCreateAllottedResourceBRGRollback.processRollbackException(mex)
- }
-
- @Test
-// @Ignore
- public void processRollbackException_Ex() {
- ExecutionEntity mex = setupMock()
- initProcessRollbackException(mex)
-
- doThrow(new RuntimeException("expected exception")).when(mex).setVariable("rollbackData", null)
-
- DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
- DoCreateAllottedResourceBRGRollback.processRollbackException(mex)
- }
-
- @Test
-// @Ignore
- public void processRollbackJavaException() {
- ExecutionEntity mex = setupMock()
- initProcessRollbackException(mex)
-
- DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
- DoCreateAllottedResourceBRGRollback.processRollbackJavaException(mex)
-
- //verify(mex).getVariable(DBGFLAG)
- verify(mex).setVariable("rollbackData", null)
- verify(mex).setVariable("rolledBack", false)
- verify(mex).setVariable("rollbackError", "Caught Java exception in AllottedResource Create Rollback")
- verify(mex, never()).setVariable("WorkflowException", null)
- }
-
- @Test
-// @Ignore
- public void processRollbackJavaException_BpmnError() {
- ExecutionEntity mex = setupMock()
- initProcessRollbackException(mex)
-
- doThrow(new BpmnError("expected exception")).when(mex).setVariable("rollbackData", null)
-
- DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
- DoCreateAllottedResourceBRGRollback.processRollbackJavaException(mex)
- }
-
- @Test
-// @Ignore
- public void processRollbackJavaException_Ex() {
- ExecutionEntity mex = setupMock()
- initProcessRollbackException(mex)
-
- doThrow(new RuntimeException("expected exception")).when(mex).setVariable("rollbackData", null)
-
- DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
- DoCreateAllottedResourceBRGRollback.processRollbackJavaException(mex)
- }
-
- private RollbackData initPreProcess(ExecutionEntity mex) {
- def data = new RollbackData()
-
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("rollbackData")).thenReturn(data)
- when(mex.getVariable("rollbackAAI")).thenReturn(true)
- when(mex.getVariable("rollbackSDNC")).thenReturn(true)
- when(mex.getVariable("disableRollback")).thenReturn("false")
-
- data.put("SERVICEINSTANCE", "allottedResourceId", "myid")
-
- data.put(RbType, "serviceInstanceId", "sii")
- data.put(RbType, "parentServiceInstanceId", "psii")
-
- data.put(RbType, "rollbackAAI", "true")
- data.put(RbType, "aaiARPath", "mypath")
-
- data.put(RbType, "rollbackSDNCassign", "true")
- data.put(RbType, "rollbackSDNCactivate", "myactivate")
- data.put(RbType, "rollbackSDNCcreate", "mycreate")
- data.put(RbType, "sdncActivateRollbackReq", "activatereq")
- data.put(RbType, "sdncCreateRollbackReq", "createreq")
- data.put(RbType, "sdncAssignRollbackReq", "assignreq")
-
- return data
- }
-
- private initUpdateAaiAROrchStatus(ExecutionEntity mex) {
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("aaiARPath")).thenReturn("/business/customers/customer/"+CUST+"/service-subscriptions/service-subscription/"+SVC+"/service-instances/service-instance/"+INST+"/allotted-resources/allotted-resource/"+ARID)
- when(mex.getVariable("aai.endpoint")).thenReturn(aaiUriPfx)
- }
-
- private initValidateSDNCResp(ExecutionEntity mex) {
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("prefix")).thenReturn(Prefix)
- when(mex.getVariable("SDNCA_SuccessIndicator")).thenReturn(true)
- }
-
- private String initValidateSDNCResp_Resp() {
- return "<response-data>&lt;response-code&gt;200&lt;/response-code&gt;</response-data>"
- }
-
- private initDeleteAaiAR(ExecutionEntity mex) {
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("aaiARResourceVersion")).thenReturn(VERS)
- when(mex.getVariable("aaiARPath")).thenReturn("/business/customers/customer/"+CUST+"/service-subscriptions/service-subscription/"+SVC+"/service-instances/service-instance/"+INST+"/allotted-resources/allotted-resource/"+ARID)
- when(mex.getVariable("aai.endpoint")).thenReturn(aaiUriPfx)
- }
-
- private initPostProcessRequest(ExecutionEntity mex) {
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("skipRollback")).thenReturn(false)
- }
-
- private initProcessRollbackException(ExecutionEntity mex) {
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- }
-
- private initProcessRollbackJavaException(ExecutionEntity mex) {
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- }
-
+ public void init() {
+ MockitoAnnotations.initMocks(this)
+ }
+
+ public DoCreateAllottedResourceBRGRollbackTest() {
+ super("DoCreateAllottedResourceBRGRollback")
+ }
+
+ // ***** preProcessRequest *****
+
+ @Test
+ public void preProcessRequest() {
+ ExecutionEntity mex = setupMock()
+ initPreProcess(mex)
+
+ DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
+ DoCreateAllottedResourceBRGRollback.preProcessRequest(mex)
+
+ verify(mex).setVariable("prefix", Prefix)
+ verify(mex).setVariable("serviceInstanceId", "sii")
+ verify(mex).setVariable("parentServiceInstanceId", "psii")
+ verify(mex).setVariable("allottedResourceId", "myid")
+ verify(mex).setVariable("rollbackAAI", true)
+ verify(mex).setVariable("aaiARPath", "mypath")
+ verify(mex).setVariable("rollbackSDNC", true)
+ verify(mex).setVariable("deactivateSdnc", "myactivate")
+ verify(mex).setVariable("deleteSdnc", "mycreate")
+ verify(mex).setVariable("unassignSdnc", "true")
+ verify(mex).setVariable("sdncDeactivateRequest", "activatereq")
+ verify(mex).setVariable("sdncDeleteRequest", "createreq")
+ verify(mex).setVariable("sdncUnassignRequest", "assignreq")
+
+ verify(mex, never()).setVariable("skipRollback", true)
+ }
+
+ @Test
+ public void preProcessRequest_RollbackDisabled() {
+ ExecutionEntity mex = setupMock()
+ initPreProcess(mex)
+
+ when(mex.getVariable("disableRollback")).thenReturn("true")
+
+ DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
+ DoCreateAllottedResourceBRGRollback.preProcessRequest(mex)
+
+ verify(mex).setVariable("prefix", Prefix)
+ verify(mex).setVariable("serviceInstanceId", "sii")
+ verify(mex).setVariable("parentServiceInstanceId", "psii")
+ verify(mex).setVariable("allottedResourceId", "myid")
+ verify(mex).setVariable("rollbackAAI", true)
+ verify(mex).setVariable("aaiARPath", "mypath")
+ verify(mex).setVariable("rollbackSDNC", true)
+ verify(mex).setVariable("deactivateSdnc", "myactivate")
+ verify(mex).setVariable("deleteSdnc", "mycreate")
+ verify(mex).setVariable("unassignSdnc", "true")
+ verify(mex).setVariable("sdncDeactivateRequest", "activatereq")
+ verify(mex).setVariable("sdncDeleteRequest", "createreq")
+ verify(mex).setVariable("sdncUnassignRequest", "assignreq")
+
+ verify(mex).setVariable("skipRollback", true)
+ }
+
+ @Test
+ public void preProcessRequest_NoAAI() {
+ ExecutionEntity mex = setupMock()
+ def data = initPreProcess(mex)
+
+ when(mex.getVariable("rollbackAAI")).thenReturn(false)
+ data.put(RbType, "rollbackAAI", "false")
+
+ DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
+ DoCreateAllottedResourceBRGRollback.preProcessRequest(mex)
+
+ verify(mex).setVariable("prefix", Prefix)
+ verify(mex).setVariable("serviceInstanceId", "sii")
+ verify(mex).setVariable("parentServiceInstanceId", "psii")
+ verify(mex).setVariable("allottedResourceId", "myid")
+ verify(mex, never()).setVariable("rollbackAAI", true)
+ verify(mex, never()).setVariable("aaiARPath", "mypath")
+ verify(mex).setVariable("rollbackSDNC", true)
+ verify(mex).setVariable("deactivateSdnc", "myactivate")
+ verify(mex).setVariable("deleteSdnc", "mycreate")
+ verify(mex).setVariable("unassignSdnc", "true")
+ verify(mex).setVariable("sdncDeactivateRequest", "activatereq")
+ verify(mex).setVariable("sdncDeleteRequest", "createreq")
+ verify(mex).setVariable("sdncUnassignRequest", "assignreq")
+
+ verify(mex, never()).setVariable("skipRollback", true)
+ }
+
+ @Test
+ public void preProcessRequest_NoAssign() {
+ ExecutionEntity mex = setupMock()
+ def data = initPreProcess(mex)
+
+ when(mex.getVariable("rollbackSDNC")).thenReturn(false)
+ data.put(RbType, "rollbackSDNCassign", "false")
+
+ DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
+ DoCreateAllottedResourceBRGRollback.preProcessRequest(mex)
+
+ verify(mex).setVariable("prefix", Prefix)
+ verify(mex).setVariable("serviceInstanceId", "sii")
+ verify(mex).setVariable("parentServiceInstanceId", "psii")
+ verify(mex).setVariable("allottedResourceId", "myid")
+ verify(mex).setVariable("rollbackAAI", true)
+ verify(mex).setVariable("aaiARPath", "mypath")
+ verify(mex, never()).setVariable("rollbackSDNC", true)
+ verify(mex, never()).setVariable("deactivateSdnc", "myactivate")
+ verify(mex, never()).setVariable("deleteSdnc", "mycreate")
+ verify(mex, never()).setVariable("unassignSdnc", "true")
+ verify(mex, never()).setVariable("sdncDeactivateRequest", "activatereq")
+ verify(mex, never()).setVariable("sdncDeleteRequest", "createreq")
+ verify(mex, never()).setVariable("sdncUnassignRequest", "assignreq")
+
+ verify(mex, never()).setVariable("skipRollback", true)
+ }
+
+ @Test
+ public void preProcessRequest_NoAAI_NoAssign() {
+ ExecutionEntity mex = setupMock()
+ initPreProcess(mex)
+
+ when(mex.getVariable("rollbackAAI")).thenReturn(false)
+ when(mex.getVariable("rollbackSDNC")).thenReturn(false)
+
+ DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
+ DoCreateAllottedResourceBRGRollback.preProcessRequest(mex)
+
+ verify(mex).setVariable("skipRollback", true)
+ }
+
+ @Test
+ public void preProcessRequest_NoRbStructure() {
+ ExecutionEntity mex = setupMock()
+ initPreProcess(mex)
+
+ when(mex.getVariable("rollbackData")).thenReturn(new RollbackData())
+
+ DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
+ DoCreateAllottedResourceBRGRollback.preProcessRequest(mex)
+
+ verify(mex).setVariable("skipRollback", true)
+ }
+
+ @Test
+ public void preProcessRequest_NullRb() {
+ ExecutionEntity mex = setupMock()
+ initPreProcess(mex)
+
+ when(mex.getVariable("rollbackData")).thenReturn(null)
+
+ DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
+ DoCreateAllottedResourceBRGRollback.preProcessRequest(mex)
+
+ verify(mex).setVariable("skipRollback", true)
+ }
+
+ @Test
+ public void preProcessRequest_BpmnError() {
+ ExecutionEntity mex = setupMock()
+ initPreProcess(mex)
+
+ when(mex.getVariable("rollbackData")).thenThrow(new BpmnError("expected exception"))
+
+ DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
+
+ assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRGRollback.preProcessRequest(mex) }))
+ }
+
+ @Test
+ public void preProcessRequest_Ex() {
+ ExecutionEntity mex = setupMock()
+ initPreProcess(mex)
+
+ when(mex.getVariable("rollbackData")).thenThrow(new RuntimeException("expected exception"))
+
+ DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
+
+ assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRGRollback.preProcessRequest(mex) }))
+ }
+
+ @Test
+ @Ignore
+ public void updateAaiAROrchStatus() {
+ ExecutionEntity mex = setupMock()
+ initUpdateAaiAROrchStatus(mex)
+
+ MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml")
+ MockPatchAllottedResource(CUST, SVC, INST, ARID)
+
+ DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
+ DoCreateAllottedResourceBRGRollback.updateAaiAROrchStatus(mex, "success")
+ }
+
+ @Test
+ public void updateAaiAROrchStatus_EmptyResponse() {
+ ExecutionEntity mex = setupMock()
+ initUpdateAaiAROrchStatus(mex)
+
+ wireMockRule
+ .stubFor(get(urlMatching("/aai/v[0-9]+/.*"))
+ .willReturn(aResponse()
+ .withStatus(200)))
+
+ DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
+
+ assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRGRollback.updateAaiAROrchStatus(mex, "success") }))
+ }
+
+ @Test
+ public void updateAaiAROrchStatus_NoArPath() {
+ ExecutionEntity mex = setupMock()
+ initUpdateAaiAROrchStatus(mex)
+
+ MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml")
+ MockPatchAllottedResource(CUST, SVC, INST, ARID)
+
+ when(mex.getVariable("aaiARPath")).thenReturn(null)
+
+ DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
+
+ assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRGRollback.updateAaiAROrchStatus(mex, "success") }))
+ }
+
+ // ***** validateSDNCResp *****
+
+ @Test
+ public void validateSDNCResp() {
+ ExecutionEntity mex = setupMock()
+ initValidateSDNCResp(mex)
+ def resp = initValidateSDNCResp_Resp()
+
+ when(mex.getVariable(Prefix + "sdncResponseSuccess")).thenReturn(true)
+
+ DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
+
+ DoCreateAllottedResourceBRGRollback.validateSDNCResp(mex, resp, "create")
+
+ verify(mex).getVariable("WorkflowException")
+ verify(mex).getVariable("SDNCA_SuccessIndicator")
+ }
+
+ @Test
+ public void validateSDNCResp_Unsuccessful() {
+ ExecutionEntity mex = setupMock()
+ initValidateSDNCResp(mex)
+ def resp = initValidateSDNCResp_Resp()
+
+ when(mex.getVariable(Prefix + "sdncResponseSuccess")).thenReturn(false)
+
+ DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
+
+ assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRGRollback.validateSDNCResp(mex, resp, "create") }))
+ }
+
+ @Test
+ public void validateSDNCResp_BpmnError404() {
+ ExecutionEntity mex = setupMock()
+ initValidateSDNCResp(mex)
+ def resp = initValidateSDNCResp_Resp()
+ when(mex.getVariable(Prefix + "sdncResponseSuccess")).thenReturn(true)
+
+ when(mex.getVariable("WorkflowException")).thenThrow(new BpmnError("404", "expected exception"))
+
+ DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
+
+ DoCreateAllottedResourceBRGRollback.validateSDNCResp(mex, resp, "create")
+ }
+
+ @Test
+ public void validateSDNCResp_BpmnError() {
+ ExecutionEntity mex = setupMock()
+ initValidateSDNCResp(mex)
+ def resp = initValidateSDNCResp_Resp()
+ when(mex.getVariable(Prefix + "sdncResponseSuccess")).thenReturn(true)
+
+ when(mex.getVariable("WorkflowException")).thenThrow(new BpmnError("expected exception"))
+
+ DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
+
+ assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRGRollback.validateSDNCResp(mex, resp, "create") }))
+ }
+
+ @Test
+ public void validateSDNCResp_Ex() {
+ ExecutionEntity mex = setupMock()
+ initValidateSDNCResp(mex)
+ def resp = initValidateSDNCResp_Resp()
+ when(mex.getVariable(Prefix + "sdncResponseSuccess")).thenReturn(true)
+
+ when(mex.getVariable("WorkflowException")).thenThrow(new RuntimeException("expected exception"))
+
+ DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
+
+ assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRGRollback.validateSDNCResp(mex, resp, "create") }))
+ }
+
+ @Test
+ @Ignore
+ public void deleteAaiAR() {
+ ExecutionEntity mex = setupMock()
+ initDeleteAaiAR(mex)
+
+ MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml")
+ MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS)
+
+ DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
+ DoCreateAllottedResourceBRGRollback.deleteAaiAR(mex)
+ }
+
+ @Test
+ public void deleteAaiAR_NoArPath() {
+ ExecutionEntity mex = setupMock()
+ initDeleteAaiAR(mex)
+
+ MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml")
+ MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS)
+
+ when(mex.getVariable("aaiARPath")).thenReturn("")
+
+ DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
+
+ assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRGRollback.deleteAaiAR(mex) }))
+ }
+
+ @Test
+ public void deleteAaiAR_BpmnError() {
+ ExecutionEntity mex = setupMock()
+ initDeleteAaiAR(mex)
+
+ MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml")
+ MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS)
+
+ when(mex.getVariable("aaiARPath")).thenThrow(new BpmnError("expected exception"))
+
+ DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
+
+ assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRGRollback.deleteAaiAR(mex) }))
+ }
+
+ @Test
+ public void deleteAaiAR_Ex() {
+ ExecutionEntity mex = setupMock()
+ initDeleteAaiAR(mex)
+
+ MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml")
+ MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS)
+
+ when(mex.getVariable("aaiARPath")).thenThrow(new RuntimeException("expected exception"))
+
+ DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
+
+ assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRGRollback.deleteAaiAR(mex) }))
+ }
+
+ @Test
+ public void postProcessRequest() {
+ ExecutionEntity mex = setupMock()
+ initPostProcessRequest(mex)
+
+ DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
+ DoCreateAllottedResourceBRGRollback.postProcessRequest(mex)
+
+ verify(mex).setVariable("rollbackData", null)
+ verify(mex).setVariable("rolledBack", true)
+ }
+
+ @Test
+ public void postProcessRequest_RolledBack() {
+ ExecutionEntity mex = setupMock()
+ initPostProcessRequest(mex)
+
+ when(mex.getVariable("skipRollback")).thenReturn(true)
+
+ DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
+ DoCreateAllottedResourceBRGRollback.postProcessRequest(mex)
+
+ verify(mex).setVariable("rollbackData", null)
+ verify(mex, never()).setVariable("rolledBack", true)
+ }
+
+ @Test
+ public void postProcessRequest_BpmnError() {
+ ExecutionEntity mex = setupMock()
+ initPostProcessRequest(mex)
+
+ when(mex.getVariable("skipRollback")).thenThrow(new BpmnError("expected exception"))
+
+ DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
+ DoCreateAllottedResourceBRGRollback.postProcessRequest(mex)
+
+ verify(mex).setVariable("rollbackData", null)
+ verify(mex, never()).setVariable("rolledBack", true)
+ }
+
+ @Test
+ public void postProcessRequest_Ex() {
+ ExecutionEntity mex = setupMock()
+ initPostProcessRequest(mex)
+
+ when(mex.getVariable("skipRollback")).thenThrow(new RuntimeException("expected exception"))
+
+ DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
+ DoCreateAllottedResourceBRGRollback.postProcessRequest(mex)
+
+ verify(mex).setVariable("rollbackData", null)
+ verify(mex, never()).setVariable("rolledBack", true)
+ }
+
+ @Test
+ public void processRollbackException() {
+ ExecutionEntity mex = setupMock()
+ initProcessRollbackException(mex)
+
+ DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
+ DoCreateAllottedResourceBRGRollback.processRollbackException(mex)
+
+ verify(mex).setVariable("rollbackData", null)
+ verify(mex).setVariable("rolledBack", false)
+ verify(mex).setVariable("rollbackError", "Caught exception in AllottedResource Create Rollback")
+ verify(mex).setVariable("WorkflowException", null)
+ }
+
+ @Test
+ public void processRollbackException_BpmnError() {
+ ExecutionEntity mex = setupMock()
+ initProcessRollbackException(mex)
+
+ doThrow(new BpmnError("expected exception")).when(mex).setVariable("rollbackData", null)
+
+ DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
+ DoCreateAllottedResourceBRGRollback.processRollbackException(mex)
+ }
+
+ @Test
+ public void processRollbackException_Ex() {
+ ExecutionEntity mex = setupMock()
+ initProcessRollbackException(mex)
+
+ doThrow(new RuntimeException("expected exception")).when(mex).setVariable("rollbackData", null)
+
+ DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
+ DoCreateAllottedResourceBRGRollback.processRollbackException(mex)
+ }
+
+ @Test
+ public void processRollbackJavaException() {
+ ExecutionEntity mex = setupMock()
+ initProcessRollbackException(mex)
+
+ DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
+ DoCreateAllottedResourceBRGRollback.processRollbackJavaException(mex)
+
+ verify(mex).setVariable("rollbackData", null)
+ verify(mex).setVariable("rolledBack", false)
+ verify(mex).setVariable("rollbackError", "Caught Java exception in AllottedResource Create Rollback")
+ verify(mex, never()).setVariable("WorkflowException", null)
+ }
+
+ @Test
+ public void processRollbackJavaException_BpmnError() {
+ ExecutionEntity mex = setupMock()
+ initProcessRollbackException(mex)
+
+ doThrow(new BpmnError("expected exception")).when(mex).setVariable("rollbackData", null)
+
+ DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
+ DoCreateAllottedResourceBRGRollback.processRollbackJavaException(mex)
+ }
+
+ @Test
+ public void processRollbackJavaException_Ex() {
+ ExecutionEntity mex = setupMock()
+ initProcessRollbackException(mex)
+
+ doThrow(new RuntimeException("expected exception")).when(mex).setVariable("rollbackData", null)
+
+ DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
+ DoCreateAllottedResourceBRGRollback.processRollbackJavaException(mex)
+ }
+
+ private RollbackData initPreProcess(ExecutionEntity mex) {
+ def data = new RollbackData()
+
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("rollbackData")).thenReturn(data)
+ when(mex.getVariable("rollbackAAI")).thenReturn(true)
+ when(mex.getVariable("rollbackSDNC")).thenReturn(true)
+ when(mex.getVariable("disableRollback")).thenReturn("false")
+
+ data.put("SERVICEINSTANCE", "allottedResourceId", "myid")
+
+ data.put(RbType, "serviceInstanceId", "sii")
+ data.put(RbType, "parentServiceInstanceId", "psii")
+
+ data.put(RbType, "rollbackAAI", "true")
+ data.put(RbType, "aaiARPath", "mypath")
+
+ data.put(RbType, "rollbackSDNCassign", "true")
+ data.put(RbType, "rollbackSDNCactivate", "myactivate")
+ data.put(RbType, "rollbackSDNCcreate", "mycreate")
+ data.put(RbType, "sdncActivateRollbackReq", "activatereq")
+ data.put(RbType, "sdncCreateRollbackReq", "createreq")
+ data.put(RbType, "sdncAssignRollbackReq", "assignreq")
+
+ return data
+ }
+
+ private initUpdateAaiAROrchStatus(ExecutionEntity mex) {
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("aaiARPath")).thenReturn("/business/customers/customer/" + CUST + "/service-subscriptions/service-subscription/" + SVC + "/service-instances/service-instance/" + INST + "/allotted-resources/allotted-resource/" + ARID)
+ when(mex.getVariable("aai.endpoint")).thenReturn(aaiUriPfx)
+ }
+
+ private initValidateSDNCResp(ExecutionEntity mex) {
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("prefix")).thenReturn(Prefix)
+ when(mex.getVariable("SDNCA_SuccessIndicator")).thenReturn(true)
+ }
+
+ private String initValidateSDNCResp_Resp() {
+ return "<response-data>&lt;response-code&gt;200&lt;/response-code&gt;</response-data>"
+ }
+
+ private initDeleteAaiAR(ExecutionEntity mex) {
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("aaiARResourceVersion")).thenReturn(VERS)
+ when(mex.getVariable("aaiARPath")).thenReturn("/business/customers/customer/" + CUST + "/service-subscriptions/service-subscription/" + SVC + "/service-instances/service-instance/" + INST + "/allotted-resources/allotted-resource/" + ARID)
+ when(mex.getVariable("aai.endpoint")).thenReturn(aaiUriPfx)
+ }
+
+ private initPostProcessRequest(ExecutionEntity mex) {
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("skipRollback")).thenReturn(false)
+ }
+
+ private initProcessRollbackException(ExecutionEntity mex) {
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ }
+
+ private initProcessRollbackJavaException(ExecutionEntity mex) {
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ }
+
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGTest.groovy
index f5e48a02e4..f094ef25fa 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGTest.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGTest.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -20,15 +22,12 @@
package org.onap.so.bpmn.vcpe.scripts
-
+import com.github.tomakehurst.wiremock.junit.WireMockRule
+import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity
-import org.junit.Before
-import org.junit.BeforeClass
-import org.junit.Rule
-import org.junit.Test
-import org.junit.Ignore
+import org.junit.*
import org.mockito.MockitoAnnotations
-import org.camunda.bpm.engine.delegate.BpmnError
+import org.onap.so.bpmn.core.RollbackData
import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.bpmn.mock.FileUtil
@@ -41,945 +40,882 @@ import javax.ws.rs.core.UriBuilder
import static com.github.tomakehurst.wiremock.client.WireMock.aResponse
import static com.github.tomakehurst.wiremock.client.WireMock.put
import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching
-import static org.junit.Assert.*;
+import static org.junit.Assert.*
import static org.mockito.Mockito.*
-import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetAllottedResource
-import static org.onap.so.bpmn.mock.StubResponseAAI.MockPatchAllottedResource
-import static org.onap.so.bpmn.mock.StubResponseAAI.MockPutAllottedResource
-import static org.onap.so.bpmn.mock.StubResponseAAI.MockPutAllottedResource_500
+import static org.onap.so.bpmn.mock.StubResponseAAI.*
-import org.onap.so.bpmn.core.RollbackData
+class DoCreateAllottedResourceBRGTest extends GroovyTestBase {
-import com.github.tomakehurst.wiremock.junit.WireMockRule
+ @Rule
+ public WireMockRule wireMockRule = new WireMockRule(PORT)
-class DoCreateAllottedResourceBRGTest extends GroovyTestBase {
-
- @Rule
- public WireMockRule wireMockRule = new WireMockRule(PORT)
+ String Prefix = "DCARBRG_"
- String Prefix = "DCARBRG_"
+ @BeforeClass
+ public static void setUpBeforeClass() {
+ aaiUriPfx = UrnPropertiesReader.getVariable("aai.endpoint")
+ }
- @BeforeClass
- public static void setUpBeforeClass() {
- aaiUriPfx = UrnPropertiesReader.getVariable("aai.endpoint")
- }
-
@Before
- public void init()
- {
- MockitoAnnotations.initMocks(this)
- }
-
- public DoCreateAllottedResourceBRGTest() {
- super("DoCreateAllottedResourceBRG")
- }
-
-
- // ***** preProcessRequest *****
-
- @Test
-// @Ignore
- public void preProcessRequest() {
- ExecutionEntity mex = setupMock()
- initPreProcess(mex)
-
- DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
- DoCreateAllottedResourceBRG.preProcessRequest(mex)
-
- //verify(mex).getVariable(DBGFLAG)
- verify(mex).setVariable("prefix", Prefix)
-
- assertTrue(checkMissingPreProcessRequest("mso.workflow.sdncadapter.callback"))
- assertTrue(checkMissingPreProcessRequest("mso.workflow.sdnc.replication.delay"))
- assertTrue(checkMissingPreProcessRequest("serviceInstanceId"))
- assertTrue(checkMissingPreProcessRequest("parentServiceInstanceId"))
- assertTrue(checkMissingPreProcessRequest("allottedResourceModelInfo"))
- assertTrue(checkMissingPreProcessRequest("vni"))
- assertTrue(checkMissingPreProcessRequest("vgmuxBearerIP"))
- assertTrue(checkMissingPreProcessRequest("brgWanMacAddress"))
- assertTrue(checkMissingPreProcessRequest("allottedResourceRole"))
- assertTrue(checkMissingPreProcessRequest("allottedResourceType"))
- }
-
-
- // ***** getAaiAR *****
-
- @Test
- @Ignore
- public void getAaiAR() {
- MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRG/getArBrg.xml")
-
- ExecutionEntity mex = setupMock()
- initGetAaiAR(mex)
-
- DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
- DoCreateAllottedResourceBRG.getAaiAR(mex)
-
- verify(mex).setVariable("foundActiveAR", true)
- }
-
- @Test
-// @Ignore
- public void getAaiAR_Duplicate() {
- MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRG/getArBrg.xml")
-
- ExecutionEntity mex = setupMock()
- initGetAaiAR(mex)
-
- // fail if duplicate
- when(mex.getVariable("failExists")).thenReturn("true")
-
- DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
-
- assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceBRG.getAaiAR(mex) }))
- }
-
- @Test
-// @Ignore
- public void getAaiAR_NotActive() {
- MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRG/getArBrg.xml")
-
- ExecutionEntity mex = setupMock()
- initGetAaiAR(mex)
-
- // not active
- when(mex.getVariable("aaiAROrchStatus")).thenReturn("not-active")
-
- DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
-
- assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceBRG.getAaiAR(mex) }))
- }
-
- @Test
- @Ignore
- public void getAaiAR_NoStatus() {
- MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRG/getArBrg.xml")
-
- ExecutionEntity mex = setupMock()
- initGetAaiAR(mex)
-
- when(mex.getVariable("aaiAROrchStatus")).thenReturn(null)
-
- DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
- DoCreateAllottedResourceBRG.getAaiAR(mex)
-
- verify(mex, never()).setVariable("foundActiveAR", true)
- }
-
-
- // ***** createAaiAR *****
-
- @Test
- public void createAaiAR() {
- ExecutionEntity mockExecution = setupMock()
- AAIResourcesClient client = mock(AAIResourcesClient.class)
- when(mockExecution.getVariable("PSI_resourceLink")).thenReturn(AAIUriFactory.createResourceFromExistingURI(AAIObjectType.SERVICE_INSTANCE,UriBuilder.fromPath( "/aai/v9/business/customers/customer/"+CUST+"/service-subscriptions/service-subscription/"+SVC+"/service-instances/service-instance/"+INST).build()))
- when(mockExecution.getVariable("CSI_resourceLink")).thenReturn("/aai/v9/business/customers/customer/"+CUST+"/service-subscriptions/service-subscription/"+SVC+"/service-instances/service-instance/"+INST)
- when(mockExecution.getVariable("allottedResourceModelInfo")).thenReturn("{\n" +
- " \"modelInvariantUuid\":\"modelInvariantUuid\",\n" +
- " \"modelUuid\" : \"modelUuid\"\n" +
- "}")
- DoCreateAllottedResourceBRG doCreateAllottedResourceBRG = spy(DoCreateAllottedResourceBRG.class)
- when(doCreateAllottedResourceBRG.getAAIClient()).thenReturn(client)
- doCreateAllottedResourceBRG.createAaiAR(mockExecution)
- }
-
- @Test
- @Ignore
- public void createAaiAR_NoArid_NoModelUuids() {
- ExecutionEntity mex = setupMock()
- def map = setupMap(mex)
- initCreateAaiAr(mex)
-
- // no allottedResourceId - will be generated
-
- when(mex.getVariable("allottedResourceId")).thenReturn(null)
-
- wireMockRule
- .stubFor(put(urlMatching("/aai/.*/allotted-resource/.*"))
- .willReturn(aResponse()
- .withStatus(200)))
-
- DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
- DoCreateAllottedResourceBRG.createAaiAR(mex)
-
- def arid = map.get("allottedResourceId")
- assertNotNull(arid)
- assertFalse(arid.isEmpty())
-
- def data = map.get("rollbackData")
- assertNotNull(data)
- assertTrue(data instanceof RollbackData)
-
- assertEquals(arid, data.get(Prefix, "allottedResourceId"))
- }
-
- @Test
- public void createAaiAR_MissingPsiLink() {
- ExecutionEntity mex = setupMock()
- initCreateAaiAr(mex)
-
- when(mex.getVariable("PSI_resourceLink")).thenReturn(null)
-
- MockPutAllottedResource(CUST, SVC, INST, ARID)
-
- DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
-
- assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.createAaiAR(mex) }))
- }
-
- @Test
- public void createAaiAR_HttpFailed() {
- ExecutionEntity mex = setupMock()
- initCreateAaiAr(mex)
-
- MockPutAllottedResource_500(CUST, SVC, INST, ARID)
-
- DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
-
- assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.createAaiAR(mex) }))
- }
-
- @Test
- public void createAaiAR_BpmnError() {
- ExecutionEntity mex = setupMock()
- initCreateAaiAr(mex)
-
- when(mex.getVariable("aai.endpoint")).thenThrow(new BpmnError("expected exception"))
-
- MockPutAllottedResource(CUST, SVC, INST, ARID)
-
- DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
-
- assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.createAaiAR(mex) }))
- }
-
- @Test
- public void createAaiAR_Ex() {
- ExecutionEntity mex = setupMock()
- initCreateAaiAr(mex)
-
- when(mex.getVariable("aai.endpoint")).thenThrow(new RuntimeException("expected exception"))
-
- MockPutAllottedResource(CUST, SVC, INST, ARID)
-
- DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
-
- assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.createAaiAR(mex) }))
- }
-
-
- // ***** buildSDNCRequest *****
-
- @Test
-// @Ignore
- public void buildSDNCRequest() {
- ExecutionEntity mex = setupMock()
- initBuildSDNCRequest(mex)
-
- DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
-
- String result = DoCreateAllottedResourceBRG.buildSDNCRequest(mex, "myact", "myreq")
-
- assertTrue(result.indexOf("<sdncadapter:RequestId>myreq</") >= 0)
- assertTrue(result.indexOf("<sdncadapter:SvcAction>myact</") >= 0)
- assertTrue(result.indexOf("<allotted-resource-id>ari</") >= 0)
- assertTrue(result.indexOf("<sdncadapter:SvcInstanceId>sii</") >= 0)
- assertTrue(result.indexOf("<service-instance-id>sii</") >= 0)
- assertTrue(result.indexOf("<parent-service-instance-id>psii</") >= 0)
- assertTrue(result.indexOf("<subscription-service-type>sst</") >= 0)
- assertTrue(result.indexOf("<global-customer-id>gci</") >= 0)
- assertTrue(result.indexOf("<sdncadapter:CallbackUrl>scu</") >= 0)
- assertTrue(result.indexOf("<request-id>mri</") >= 0)
- assertTrue(result.indexOf("<brg-wan-mac-address>bwma</") >= 0)
- assertTrue(result.indexOf("<vni>myvni</") >= 0)
- assertTrue(result.indexOf("<vgmux-bearer-ip>vbi</") >= 0)
- assertTrue(result.indexOf("<model-invariant-uuid>miu</") >= 0)
- assertTrue(result.indexOf("<model-uuid>mu</") >= 0)
- assertTrue(result.indexOf("<model-customization-uuid>mcu</") >= 0)
- assertTrue(result.indexOf("<model-version>mv</") >= 0)
- assertTrue(result.indexOf("<model-name>mn</") >= 0)
- }
-
- @Test
-// @Ignore
- public void buildSDNCRequest_EmptyModelInfo() {
- ExecutionEntity mex = setupMock()
- initBuildSDNCRequest(mex)
-
- when(mex.getVariable("allottedResourceModelInfo")).thenReturn("{}")
-
- DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
-
- String result = DoCreateAllottedResourceBRG.buildSDNCRequest(mex, "myact", "myreq")
-
- assertTrue(result.indexOf("<sdncadapter:RequestId>myreq</") >= 0)
- assertTrue(result.indexOf("<sdncadapter:SvcAction>myact</") >= 0)
- assertTrue(result.indexOf("<allotted-resource-id>ari</") >= 0)
- assertTrue(result.indexOf("<sdncadapter:SvcInstanceId>sii</") >= 0)
- assertTrue(result.indexOf("<service-instance-id>sii</") >= 0)
- assertTrue(result.indexOf("<parent-service-instance-id>psii</") >= 0)
- assertTrue(result.indexOf("<subscription-service-type>sst</") >= 0)
- assertTrue(result.indexOf("<global-customer-id>gci</") >= 0)
- assertTrue(result.indexOf("<sdncadapter:CallbackUrl>scu</") >= 0)
- assertTrue(result.indexOf("<request-id>mri</") >= 0)
- assertTrue(result.indexOf("<brg-wan-mac-address>bwma</") >= 0)
- assertTrue(result.indexOf("<vni>myvni</") >= 0)
- assertTrue(result.indexOf("<vgmux-bearer-ip>vbi</") >= 0)
- assertTrue(result.indexOf("<model-invariant-uuid/>") >= 0)
- assertTrue(result.indexOf("<model-uuid/>") >= 0)
- assertTrue(result.indexOf("<model-customization-uuid/>") >= 0)
- assertTrue(result.indexOf("<model-version/>") >= 0)
- assertTrue(result.indexOf("<model-name/>") >= 0)
- }
-
- @Test
-// @Ignore
- public void buildSDNCRequest_Ex() {
- ExecutionEntity mex = setupMock()
- initBuildSDNCRequest(mex)
-
- when(mex.getVariable("allottedResourceId")).thenThrow(new RuntimeException("expected exception"))
-
- DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
-
- assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.buildSDNCRequest(mex, "myact", "myreq") }))
- }
-
-
- // ***** preProcessSDNCAssign *****
-
- @Test
-// @Ignore
- public void preProcessSDNCAssign() {
- ExecutionEntity mex = setupMock()
- def map = setupMap(mex)
- def data = initPreProcessSDNC(mex)
-
- DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
- DoCreateAllottedResourceBRG.preProcessSDNCAssign(mex)
-
- def req = map.get("sdncAssignRequest")
- assertNotNull(req)
-
- assertEquals(data, map.get("rollbackData"))
-
- def rbreq = data.get(Prefix, "sdncAssignRollbackReq")
-
- assertTrue(req.indexOf("<sdncadapter:SvcAction>assign</") >= 0)
- assertTrue(req.indexOf("<request-action>CreateBRGInstance</") >= 0)
- assertTrue(req.indexOf("<sdncadapter:RequestId>") >= 0)
-
- assertTrue(rbreq.indexOf("<sdncadapter:SvcAction>unassign</") >= 0)
- assertTrue(rbreq.indexOf("<request-action>DeleteBRGInstance</") >= 0)
- assertTrue(rbreq.indexOf("<sdncadapter:RequestId>") >= 0)
- }
-
- @Test
-// @Ignore
- public void preProcessSDNCAssign_BpmnError() {
- ExecutionEntity mex = setupMock()
- initPreProcessSDNC(mex)
-
- when(mex.getVariable("rollbackData")).thenThrow(new BpmnError("expected exception"))
-
- DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
-
- assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.preProcessSDNCAssign(mex) }))
- }
-
- @Test
-// @Ignore
- public void preProcessSDNCAssign_Ex() {
- ExecutionEntity mex = setupMock()
- initPreProcessSDNC(mex)
-
- when(mex.getVariable("rollbackData")).thenThrow(new RuntimeException("expected exception"))
-
- DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
-
- assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.preProcessSDNCAssign(mex) }))
- }
-
-
- // ***** preProcessSDNCCreate *****
-
- @Test
-// @Ignore
- public void preProcessSDNCCreate() {
- ExecutionEntity mex = setupMock()
- def map = setupMap(mex)
- def data = initPreProcessSDNC(mex)
-
- DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
- DoCreateAllottedResourceBRG.preProcessSDNCCreate(mex)
-
- def req = map.get("sdncCreateRequest")
- assertNotNull(req)
-
- assertEquals(data, map.get("rollbackData"))
-
- def rbreq = data.get(Prefix, "sdncCreateRollbackReq")
-
- assertTrue(req.indexOf("<sdncadapter:SvcAction>create</") >= 0)
- assertTrue(req.indexOf("<request-action>CreateBRGInstance</") >= 0)
- assertTrue(req.indexOf("<sdncadapter:RequestId>") >= 0)
-
- assertTrue(rbreq.indexOf("<sdncadapter:SvcAction>delete</") >= 0)
- assertTrue(rbreq.indexOf("<request-action>DeleteBRGInstance</") >= 0)
- assertTrue(rbreq.indexOf("<sdncadapter:RequestId>") >= 0)
-
- }
-
- @Test
-// @Ignore
- public void preProcessSDNCCreate_BpmnError() {
- ExecutionEntity mex = setupMock()
- initPreProcessSDNC(mex)
-
- when(mex.getVariable("rollbackData")).thenThrow(new BpmnError("expected exception"))
-
- DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
-
- assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.preProcessSDNCCreate(mex) }))
- }
-
- @Test
-// @Ignore
- public void preProcessSDNCCreate_Ex() {
- ExecutionEntity mex = setupMock()
- initPreProcessSDNC(mex)
-
- when(mex.getVariable("rollbackData")).thenThrow(new RuntimeException("expected exception"))
-
- DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
-
- assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.preProcessSDNCCreate(mex) }))
- }
-
-
- // ***** preProcessSDNCActivate *****
-
- @Test
-// @Ignore
- public void preProcessSDNCActivate() {
- ExecutionEntity mex = setupMock()
- def map = setupMap(mex)
- def data = initPreProcessSDNC(mex)
-
- DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
- DoCreateAllottedResourceBRG.preProcessSDNCActivate(mex)
-
- def req = map.get("sdncActivateRequest")
- assertNotNull(req)
-
- assertEquals(data, map.get("rollbackData"))
-
- def rbreq = data.get(Prefix, "sdncActivateRollbackReq")
-
- assertTrue(req.indexOf("<sdncadapter:SvcAction>activate</") >= 0)
- assertTrue(req.indexOf("<request-action>CreateBRGInstance</") >= 0)
- assertTrue(req.indexOf("<sdncadapter:RequestId>") >= 0)
-
- assertTrue(rbreq.indexOf("<sdncadapter:SvcAction>deactivate</") >= 0)
- assertTrue(rbreq.indexOf("<request-action>DeleteBRGInstance</") >= 0)
- assertTrue(rbreq.indexOf("<sdncadapter:RequestId>") >= 0)
-
- }
-
- @Test
-// @Ignore
- public void preProcessSDNCActivate_BpmnError() {
- ExecutionEntity mex = setupMock()
- initPreProcessSDNC(mex)
-
- when(mex.getVariable("rollbackData")).thenThrow(new BpmnError("expected exception"))
-
- DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
-
- assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.preProcessSDNCActivate(mex) }))
- }
-
- @Test
-// @Ignore
- public void preProcessSDNCActivate_Ex() {
- ExecutionEntity mex = setupMock()
- initPreProcessSDNC(mex)
-
- when(mex.getVariable("rollbackData")).thenThrow(new RuntimeException("expected exception"))
-
- DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
-
- assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.preProcessSDNCActivate(mex) }))
- }
-
-
- // ***** validateSDNCResp *****
-
- @Test
-// @Ignore
- public void validateSDNCResp() {
- ExecutionEntity mex = setupMock()
- def map = setupMap(mex)
- def data = initValidateSDNCResp(mex)
- def resp = initValidateSDNCResp_Resp()
-
- when(mex.getVariable(Prefix+"sdncResponseSuccess")).thenReturn(true)
-
- DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
-
- DoCreateAllottedResourceBRG.validateSDNCResp(mex, resp, "create")
-
- verify(mex).getVariable("WorkflowException")
- verify(mex).getVariable("SDNCA_SuccessIndicator")
- verify(mex).getVariable("rollbackData")
-
- assertEquals(data, map.get("rollbackData"))
-
- assertEquals("true", data.get(Prefix, "rollback" + "SDNCcreate"))
-
- }
-
- @Test
-// @Ignore
- public void validateSDNCResp_Get() {
- ExecutionEntity mex = setupMock()
- def data = initValidateSDNCResp(mex)
- def resp = initValidateSDNCResp_Resp()
-
- when(mex.getVariable(Prefix+"sdncResponseSuccess")).thenReturn(true)
-
- DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
-
- DoCreateAllottedResourceBRG.validateSDNCResp(mex, resp, "get")
-
- verify(mex).getVariable("WorkflowException")
- verify(mex).getVariable("SDNCA_SuccessIndicator")
-
- verify(mex, never()).getVariable("rollbackData")
- }
-
- @Test
-// @Ignore
- public void validateSDNCResp_Unsuccessful() {
- ExecutionEntity mex = setupMock()
- initValidateSDNCResp(mex)
- def resp = initValidateSDNCResp_Resp()
-
- // unsuccessful
- when(mex.getVariable(Prefix+"sdncResponseSuccess")).thenReturn(false)
-
- DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
-
- assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.validateSDNCResp(mex, resp, "create") }))
- }
-
- @Test
-// @Ignore
- public void validateSDNCResp_BpmnError() {
- ExecutionEntity mex = setupMock()
- initValidateSDNCResp(mex)
- def resp = initValidateSDNCResp_Resp()
-
- when(mex.getVariable("WorkflowException")).thenThrow(new BpmnError("expected exception"))
-
- DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
-
- assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.validateSDNCResp(mex, resp, "create") }))
- }
-
- @Test
-// @Ignore
- public void validateSDNCResp_Ex() {
- ExecutionEntity mex = setupMock()
- initValidateSDNCResp(mex)
- def resp = initValidateSDNCResp_Resp()
-
- when(mex.getVariable("WorkflowException")).thenThrow(new RuntimeException("expected exception"))
-
- DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
-
- assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.validateSDNCResp(mex, resp, "create") }))
- }
-
-
- // ***** preProcessSDNCGet *****
-
- @Test
-// @Ignore
- public void preProcessSDNCGet_FoundAR() {
- ExecutionEntity mex = setupMock()
- def map = setupMap(mex)
- initPreProcessSDNCGet(mex)
-
- DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
- DoCreateAllottedResourceBRG.preProcessSDNCGet(mex)
-
- String req = map.get("sdncGetRequest")
-
- assertTrue(req.indexOf("<sdncadapter:RequestId>") >= 0)
- assertTrue(req.indexOf("<sdncadapter:SvcInstanceId>sii</") >= 0)
- assertTrue(req.indexOf("<sdncadapter:SvcOperation>arlink</") >= 0)
- assertTrue(req.indexOf("<sdncadapter:CallbackUrl>myurl</") >= 0)
-
- }
-
- @Test
-// @Ignore
- public void preProcessSDNCGet_NotFoundAR() {
- ExecutionEntity mex = setupMock()
- def map = setupMap(mex)
- initPreProcessSDNCGet(mex)
-
- when(mex.getVariable("foundActiveAR")).thenReturn(false)
-
- DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
- DoCreateAllottedResourceBRG.preProcessSDNCGet(mex)
-
- String req = map.get("sdncGetRequest")
-
- assertTrue(req.indexOf("<sdncadapter:RequestId>") >= 0)
- assertTrue(req.indexOf("<sdncadapter:SvcInstanceId>sii</") >= 0)
- assertTrue(req.indexOf("<sdncadapter:SvcOperation>assignlink</") >= 0)
- assertTrue(req.indexOf("<sdncadapter:CallbackUrl>myurl</") >= 0)
-
- }
-
- @Test
-// @Ignore
- public void preProcessSDNCGet_Ex() {
- ExecutionEntity mex = setupMock()
- initPreProcessSDNCGet(mex)
-
- when(mex.getVariable("foundActiveAR")).thenThrow(new RuntimeException("expected exception"))
-
- DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
-
- assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.preProcessSDNCGet(mex) }))
- }
-
-
- // ***** updateAaiAROrchStatus *****
-
- @Test
- @Ignore
- public void updateAaiAROrchStatus() {
- MockPatchAllottedResource(CUST, SVC, INST, ARID)
-
- ExecutionEntity mex = setupMock()
- initUpdateAaiAROrchStatus(mex)
-
- DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
- DoCreateAllottedResourceBRG.updateAaiAROrchStatus(mex, "success")
- }
-
-
- // ***** generateOutputs *****
-
- @Test
-// @Ignore
- public void generateOutputs() {
- ExecutionEntity mex = setupMock()
- def brgtop = FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceBRG/SDNCTopologyQueryCallback.xml")
-
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("enhancedCallbackRequestData")).thenReturn(brgtop)
-
- DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
- DoCreateAllottedResourceBRG.generateOutputs(mex)
-
- verify(mex).setVariable("allotedResourceName", "namefromrequest")
-
- }
-
- @Test
-// @Ignore
- public void generateOutputs_BadXml() {
- ExecutionEntity mex = setupMock()
-
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("enhancedCallbackRequestData")).thenReturn("invalid xml")
-
- DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
- DoCreateAllottedResourceBRG.generateOutputs(mex)
-
- verify(mex, never()).setVariable(anyString(), anyString())
-
- }
-
- @Test
-// @Ignore
- public void generateOutputs_BpmnError() {
- ExecutionEntity mex = setupMock()
-
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("enhancedCallbackRequestData")).thenThrow(new BpmnError("expected exception"))
-
- DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
-
- DoCreateAllottedResourceBRG.generateOutputs(mex)
- verify(mex, never()).setVariable(anyString(), anyString())
-
- }
-
- @Test
-// @Ignore
- public void generateOutputs_Ex() {
- ExecutionEntity mex = setupMock()
-
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("enhancedCallbackRequestData")).thenThrow(new RuntimeException("expected exception"))
-
- DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
-
- DoCreateAllottedResourceBRG.generateOutputs(mex)
- verify(mex, never()).setVariable(anyString(), anyString())
-
- }
-
-
- // ***** preProcessRollback *****
-
- @Test
-// @Ignore
- public void preProcessRollback() {
- ExecutionEntity mex = setupMock()
- WorkflowException wfe = mock(WorkflowException.class)
-
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("WorkflowException")).thenReturn(wfe)
-
- DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
- DoCreateAllottedResourceBRG.preProcessRollback(mex)
-
- verify(mex).setVariable("prevWorkflowException", wfe)
-
- }
-
- @Test
-// @Ignore
- public void preProcessRollback_NotWFE() {
- ExecutionEntity mex = setupMock()
-
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("WorkflowException")).thenReturn("I'm not a WFE")
-
- DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
- DoCreateAllottedResourceBRG.preProcessRollback(mex)
-
-// verify(mex, never()).setVariable("prevWorkflowException", any())
-
- }
-
- @Test
-// @Ignore
- public void preProcessRollback_BpmnError() {
- ExecutionEntity mex = setupMock()
-
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("WorkflowException")).thenThrow(new BpmnError("expected exception"))
-
- DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
-
- DoCreateAllottedResourceBRG.preProcessRollback(mex)
-
- }
-
- @Test
-// @Ignore
- public void preProcessRollback_Ex() {
- ExecutionEntity mex = setupMock()
-
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("WorkflowException")).thenThrow(new RuntimeException("expected exception"))
-
- DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
-
- DoCreateAllottedResourceBRG.preProcessRollback(mex)
-
- }
-
-
- // ***** postProcessRollback *****
-
- @Test
-// @Ignore
- public void postProcessRollback() {
- ExecutionEntity mex = setupMock()
- WorkflowException wfe = mock(WorkflowException.class)
-
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("prevWorkflowException")).thenReturn(wfe)
-
- DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
- DoCreateAllottedResourceBRG.postProcessRollback(mex)
-
- verify(mex).setVariable("WorkflowException", wfe)
- verify(mex).setVariable("rollbackData", null)
-
- }
-
- @Test
-// @Ignore
- public void postProcessRollback_NotWFE() {
- ExecutionEntity mex = setupMock()
-
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("prevWorkflowException")).thenReturn("I'm not a WFE")
-
- DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
- DoCreateAllottedResourceBRG.postProcessRollback(mex)
-
-// verify(mex, never()).setVariable("WorkflowException", any())
- verify(mex).setVariable("rollbackData", null)
-
- }
-
- @Test
-// @Ignore
- public void postProcessRollback_BpmnError() {
- ExecutionEntity mex = setupMock()
-
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("prevWorkflowException")).thenThrow(new BpmnError("expected exception"))
-
- DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
-
- assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.postProcessRollback(mex) }))
- verify(mex, never()).setVariable("rollbackData", null)
-
- }
-
- @Test
-// @Ignore
- public void postProcessRollback_Ex() {
- ExecutionEntity mex = setupMock()
-
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("prevWorkflowException")).thenThrow(new RuntimeException("expected exception"))
-
- DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
-
- DoCreateAllottedResourceBRG.postProcessRollback(mex)
- verify(mex, never()).setVariable("rollbackData", null)
-
- }
-
- private boolean checkMissingPreProcessRequest(String fieldnm) {
- ExecutionEntity mex = setupMock()
- initPreProcess(mex)
-
- DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
-
- when(mex.getVariable(fieldnm)).thenReturn("")
-
- return doBpmnError( { _ -> DoCreateAllottedResourceBRG.preProcessRequest(mex) })
- }
-
- private void initPreProcess(ExecutionEntity mex) {
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("mso.workflow.sdncadapter.callback")).thenReturn("sdncurn")
- when(mex.getVariable("mso.workflow.sdnc.replication.delay")).thenReturn("sdncdelay")
- when(mex.getVariable("serviceInstanceId")).thenReturn("sii")
- when(mex.getVariable("parentServiceInstanceId")).thenReturn("psii")
- when(mex.getVariable("allottedResourceModelInfo")).thenReturn("armi")
- when(mex.getVariable("vni")).thenReturn("myvni")
- when(mex.getVariable("vgmuxBearerIP")).thenReturn("vbi")
- when(mex.getVariable("brgWanMacAddress")).thenReturn("bwma")
- when(mex.getVariable("allottedResourceRole")).thenReturn("arr")
- when(mex.getVariable("allottedResourceType")).thenReturn("art")
- }
-
- private void initGetAaiAR(ExecutionEntity mex) {
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("allottedResourceType")).thenReturn("BRGt")
- when(mex.getVariable("allottedResourceRole")).thenReturn("BRGr")
- when(mex.getVariable("CSI_service")).thenReturn(FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceBRG/getAR.xml"))
- when(mex.getVariable("aai.endpoint")).thenReturn(aaiUriPfx)
- when(mex.getVariable("aaiAROrchStatus")).thenReturn("Active")
- }
-
- private initCreateAaiAr(ExecutionEntity mex) {
- when(mex.getVariable("disableRollback")).thenReturn(45)
- when(mex.getVariable("serviceInstanceId")).thenReturn("sii")
- when(mex.getVariable("parentServiceInstanceId")).thenReturn("psii")
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("allottedResourceId")).thenReturn(ARID)
- when(mex.getVariable("aai.endpoint")).thenReturn(aaiUriPfx)
- when(mex.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn(UrnPropertiesReader.getVariable("mso.workflow.global.default.aai.namespace"))
- when(mex.getVariable("PSI_resourceLink")).thenReturn(AAIUriFactory.createResourceFromExistingURI(AAIObjectType.SERVICE_INSTANCE, UriBuilder.fromPath( "/business/customers/customer/"+CUST+"/service-subscriptions/service-subscription/"+SVC+"/service-instances/service-instance/"+INST).build()))
- when(mex.getVariable("allottedResourceType")).thenReturn("BRGt")
- when(mex.getVariable("allottedResourceRole")).thenReturn("BRGr")
- when(mex.getVariable("CSI_resourceLink")).thenReturn(aaiUriPfx+"/aai/v9/mycsi")
- when(mex.getVariable("allottedResourceModelInfo")).thenReturn("""
- {
- "modelInvariantUuid":"modelinvuuid",
- "modelUuid":"modeluuid",
- "modelCustomizationUuid":"modelcustuuid"
- }
- """)
- }
-
- private initBuildSDNCRequest(ExecutionEntity mex) {
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("allottedResourceId")).thenReturn("ari")
- when(mex.getVariable("serviceInstanceId")).thenReturn("sii")
- when(mex.getVariable("parentServiceInstanceId")).thenReturn("psii")
- when(mex.getVariable("subscriptionServiceType")).thenReturn("sst")
- when(mex.getVariable("globalCustomerId")).thenReturn("gci")
- when(mex.getVariable("sdncCallbackUrl")).thenReturn("scu")
- when(mex.getVariable("msoRequestId")).thenReturn("mri")
- when(mex.getVariable("brgWanMacAddress")).thenReturn("bwma")
- when(mex.getVariable("vni")).thenReturn("myvni")
- when(mex.getVariable("vgmuxBearerIP")).thenReturn("vbi")
- when(mex.getVariable("allottedResourceModelInfo")).thenReturn("""
- {
- "modelInvariantUuid":"miu",
- "modelUuid":"mu",
- "modelCustomizationUuid":"mcu",
- "modelVersion":"mv",
- "modelName":"mn"
- }
- """)
- }
-
- private RollbackData initPreProcessSDNC(ExecutionEntity mex) {
- def data = new RollbackData()
-
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("rollbackData")).thenReturn(data)
-
- return data
- }
-
- private initPreProcessSDNCGet(ExecutionEntity mex) {
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("sdncCallbackUrl")).thenReturn("myurl")
- when(mex.getVariable("foundActiveAR")).thenReturn(true)
- when(mex.getVariable("aaiARGetResponse")).thenReturn("<selflink>arlink</selflink>")
- when(mex.getVariable("sdncAssignResponse")).thenReturn("<response-data>&lt;object-path&gt;assignlink&lt;/object-path&gt;</response-data>")
- when(mex.getVariable("serviceInstanceId")).thenReturn("sii")
- when(mex.getVariable("sdncCallbackUrl")).thenReturn("myurl")
- }
-
- private RollbackData initValidateSDNCResp(ExecutionEntity mex) {
- def data = new RollbackData()
-
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("prefix")).thenReturn(Prefix)
- when(mex.getVariable("SDNCA_SuccessIndicator")).thenReturn(true)
- when(mex.getVariable("rollbackData")).thenReturn(data)
-
- return data
- }
-
- private String initValidateSDNCResp_Resp() {
- return "<response-data>&lt;response-code&gt;200&lt;/response-code&gt;</response-data>"
- }
-
- private initUpdateAaiAROrchStatus(ExecutionEntity mex) {
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("aaiARPath")).thenReturn("/business/customers/customer/"+CUST+"/service-subscriptions/service-subscription/"+SVC+"/service-instances/service-instance/"+INST+"/allotted-resources/allotted-resource/"+ARID)
- }
-
+ public void init() {
+ MockitoAnnotations.initMocks(this)
+ }
+
+ public DoCreateAllottedResourceBRGTest() {
+ super("DoCreateAllottedResourceBRG")
+ }
+
+ // ***** preProcessRequest *****
+
+ @Test
+ public void preProcessRequest() {
+ ExecutionEntity mex = setupMock()
+ initPreProcess(mex)
+
+ DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
+ DoCreateAllottedResourceBRG.preProcessRequest(mex)
+
+ verify(mex).setVariable("prefix", Prefix)
+
+ assertTrue(checkMissingPreProcessRequest("mso.workflow.sdncadapter.callback"))
+ assertTrue(checkMissingPreProcessRequest("mso.workflow.sdnc.replication.delay"))
+ assertTrue(checkMissingPreProcessRequest("serviceInstanceId"))
+ assertTrue(checkMissingPreProcessRequest("parentServiceInstanceId"))
+ assertTrue(checkMissingPreProcessRequest("allottedResourceModelInfo"))
+ assertTrue(checkMissingPreProcessRequest("vni"))
+ assertTrue(checkMissingPreProcessRequest("vgmuxBearerIP"))
+ assertTrue(checkMissingPreProcessRequest("brgWanMacAddress"))
+ assertTrue(checkMissingPreProcessRequest("allottedResourceRole"))
+ assertTrue(checkMissingPreProcessRequest("allottedResourceType"))
+ }
+
+ // ***** getAaiAR *****
+
+ @Test
+ @Ignore
+ public void getAaiAR() {
+ MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRG/getArBrg.xml")
+
+ ExecutionEntity mex = setupMock()
+ initGetAaiAR(mex)
+
+ DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
+ DoCreateAllottedResourceBRG.getAaiAR(mex)
+
+ verify(mex).setVariable("foundActiveAR", true)
+ }
+
+ @Test
+ public void getAaiAR_Duplicate() {
+ MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRG/getArBrg.xml")
+
+ ExecutionEntity mex = setupMock()
+ initGetAaiAR(mex)
+
+ // fail if duplicate
+ when(mex.getVariable("failExists")).thenReturn("true")
+
+ DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
+
+ assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.getAaiAR(mex) }))
+ }
+
+ @Test
+ public void getAaiAR_NotActive() {
+ MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRG/getArBrg.xml")
+
+ ExecutionEntity mex = setupMock()
+ initGetAaiAR(mex)
+
+ // not active
+ when(mex.getVariable("aaiAROrchStatus")).thenReturn("not-active")
+
+ DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
+
+ assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.getAaiAR(mex) }))
+ }
+
+ @Test
+ @Ignore
+ public void getAaiAR_NoStatus() {
+ MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRG/getArBrg.xml")
+
+ ExecutionEntity mex = setupMock()
+ initGetAaiAR(mex)
+
+ when(mex.getVariable("aaiAROrchStatus")).thenReturn(null)
+
+ DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
+ DoCreateAllottedResourceBRG.getAaiAR(mex)
+
+ verify(mex, never()).setVariable("foundActiveAR", true)
+ }
+
+ // ***** createAaiAR *****
+
+ @Test
+ public void createAaiAR() {
+ ExecutionEntity mockExecution = setupMock()
+ AAIResourcesClient client = mock(AAIResourcesClient.class)
+ when(mockExecution.getVariable("PSI_resourceLink")).thenReturn(AAIUriFactory.createResourceFromExistingURI(AAIObjectType.SERVICE_INSTANCE, UriBuilder.fromPath("/aai/v9/business/customers/customer/" + CUST + "/service-subscriptions/service-subscription/" + SVC + "/service-instances/service-instance/" + INST).build()))
+ when(mockExecution.getVariable("CSI_resourceLink")).thenReturn("/aai/v9/business/customers/customer/" + CUST + "/service-subscriptions/service-subscription/" + SVC + "/service-instances/service-instance/" + INST)
+ when(mockExecution.getVariable("allottedResourceModelInfo")).thenReturn("{\n" +
+ " \"modelInvariantUuid\":\"modelInvariantUuid\",\n" +
+ " \"modelUuid\" : \"modelUuid\"\n" +
+ "}")
+ DoCreateAllottedResourceBRG doCreateAllottedResourceBRG = spy(DoCreateAllottedResourceBRG.class)
+ when(doCreateAllottedResourceBRG.getAAIClient()).thenReturn(client)
+ doCreateAllottedResourceBRG.createAaiAR(mockExecution)
+ }
+
+ @Test
+ @Ignore
+ public void createAaiAR_NoArid_NoModelUuids() {
+ ExecutionEntity mex = setupMock()
+ def map = setupMap(mex)
+ initCreateAaiAr(mex)
+
+ // no allottedResourceId - will be generated
+
+ when(mex.getVariable("allottedResourceId")).thenReturn(null)
+
+ wireMockRule
+ .stubFor(put(urlMatching("/aai/.*/allotted-resource/.*"))
+ .willReturn(aResponse()
+ .withStatus(200)))
+
+ DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
+ DoCreateAllottedResourceBRG.createAaiAR(mex)
+
+ def arid = map.get("allottedResourceId")
+ assertNotNull(arid)
+ assertFalse(arid.isEmpty())
+
+ def data = map.get("rollbackData")
+ assertNotNull(data)
+ assertTrue(data instanceof RollbackData)
+
+ assertEquals(arid, data.get(Prefix, "allottedResourceId"))
+ }
+
+ @Test
+ public void createAaiAR_MissingPsiLink() {
+ ExecutionEntity mex = setupMock()
+ initCreateAaiAr(mex)
+
+ when(mex.getVariable("PSI_resourceLink")).thenReturn(null)
+
+ MockPutAllottedResource(CUST, SVC, INST, ARID)
+
+ DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
+
+ assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.createAaiAR(mex) }))
+ }
+
+ @Test
+ public void createAaiAR_HttpFailed() {
+ ExecutionEntity mex = setupMock()
+ initCreateAaiAr(mex)
+
+ MockPutAllottedResource_500(CUST, SVC, INST, ARID)
+
+ DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
+
+ assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.createAaiAR(mex) }))
+ }
+
+ @Test
+ public void createAaiAR_BpmnError() {
+ ExecutionEntity mex = setupMock()
+ initCreateAaiAr(mex)
+
+ when(mex.getVariable("aai.endpoint")).thenThrow(new BpmnError("expected exception"))
+
+ MockPutAllottedResource(CUST, SVC, INST, ARID)
+
+ DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
+
+ assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.createAaiAR(mex) }))
+ }
+
+ @Test
+ public void createAaiAR_Ex() {
+ ExecutionEntity mex = setupMock()
+ initCreateAaiAr(mex)
+
+ when(mex.getVariable("aai.endpoint")).thenThrow(new RuntimeException("expected exception"))
+
+ MockPutAllottedResource(CUST, SVC, INST, ARID)
+
+ DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
+
+ assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.createAaiAR(mex) }))
+ }
+
+ // ***** buildSDNCRequest *****
+
+ @Test
+ public void buildSDNCRequest() {
+ ExecutionEntity mex = setupMock()
+ initBuildSDNCRequest(mex)
+
+ DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
+
+ String result = DoCreateAllottedResourceBRG.buildSDNCRequest(mex, "myact", "myreq")
+
+ assertTrue(result.indexOf("<sdncadapter:RequestId>myreq</") >= 0)
+ assertTrue(result.indexOf("<sdncadapter:SvcAction>myact</") >= 0)
+ assertTrue(result.indexOf("<allotted-resource-id>ari</") >= 0)
+ assertTrue(result.indexOf("<sdncadapter:SvcInstanceId>sii</") >= 0)
+ assertTrue(result.indexOf("<service-instance-id>sii</") >= 0)
+ assertTrue(result.indexOf("<parent-service-instance-id>psii</") >= 0)
+ assertTrue(result.indexOf("<subscription-service-type>sst</") >= 0)
+ assertTrue(result.indexOf("<global-customer-id>gci</") >= 0)
+ assertTrue(result.indexOf("<sdncadapter:CallbackUrl>scu</") >= 0)
+ assertTrue(result.indexOf("<request-id>mri</") >= 0)
+ assertTrue(result.indexOf("<brg-wan-mac-address>bwma</") >= 0)
+ assertTrue(result.indexOf("<vni>myvni</") >= 0)
+ assertTrue(result.indexOf("<vgmux-bearer-ip>vbi</") >= 0)
+ assertTrue(result.indexOf("<model-invariant-uuid>miu</") >= 0)
+ assertTrue(result.indexOf("<model-uuid>mu</") >= 0)
+ assertTrue(result.indexOf("<model-customization-uuid>mcu</") >= 0)
+ assertTrue(result.indexOf("<model-version>mv</") >= 0)
+ assertTrue(result.indexOf("<model-name>mn</") >= 0)
+ }
+
+ @Test
+ public void buildSDNCRequest_EmptyModelInfo() {
+ ExecutionEntity mex = setupMock()
+ initBuildSDNCRequest(mex)
+
+ when(mex.getVariable("allottedResourceModelInfo")).thenReturn("{}")
+
+ DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
+
+ String result = DoCreateAllottedResourceBRG.buildSDNCRequest(mex, "myact", "myreq")
+
+ assertTrue(result.indexOf("<sdncadapter:RequestId>myreq</") >= 0)
+ assertTrue(result.indexOf("<sdncadapter:SvcAction>myact</") >= 0)
+ assertTrue(result.indexOf("<allotted-resource-id>ari</") >= 0)
+ assertTrue(result.indexOf("<sdncadapter:SvcInstanceId>sii</") >= 0)
+ assertTrue(result.indexOf("<service-instance-id>sii</") >= 0)
+ assertTrue(result.indexOf("<parent-service-instance-id>psii</") >= 0)
+ assertTrue(result.indexOf("<subscription-service-type>sst</") >= 0)
+ assertTrue(result.indexOf("<global-customer-id>gci</") >= 0)
+ assertTrue(result.indexOf("<sdncadapter:CallbackUrl>scu</") >= 0)
+ assertTrue(result.indexOf("<request-id>mri</") >= 0)
+ assertTrue(result.indexOf("<brg-wan-mac-address>bwma</") >= 0)
+ assertTrue(result.indexOf("<vni>myvni</") >= 0)
+ assertTrue(result.indexOf("<vgmux-bearer-ip>vbi</") >= 0)
+ assertTrue(result.indexOf("<model-invariant-uuid/>") >= 0)
+ assertTrue(result.indexOf("<model-uuid/>") >= 0)
+ assertTrue(result.indexOf("<model-customization-uuid/>") >= 0)
+ assertTrue(result.indexOf("<model-version/>") >= 0)
+ assertTrue(result.indexOf("<model-name/>") >= 0)
+ }
+
+ @Test
+ public void buildSDNCRequest_Ex() {
+ ExecutionEntity mex = setupMock()
+ initBuildSDNCRequest(mex)
+
+ when(mex.getVariable("allottedResourceId")).thenThrow(new RuntimeException("expected exception"))
+
+ DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
+
+ assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.buildSDNCRequest(mex, "myact", "myreq") }))
+ }
+
+ // ***** preProcessSDNCAssign *****
+
+ @Test
+ public void preProcessSDNCAssign() {
+ ExecutionEntity mex = setupMock()
+ def map = setupMap(mex)
+ def data = initPreProcessSDNC(mex)
+
+ DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
+ DoCreateAllottedResourceBRG.preProcessSDNCAssign(mex)
+
+ def req = map.get("sdncAssignRequest")
+ assertNotNull(req)
+
+ assertEquals(data, map.get("rollbackData"))
+
+ def rbreq = data.get(Prefix, "sdncAssignRollbackReq")
+
+ assertTrue(req.indexOf("<sdncadapter:SvcAction>assign</") >= 0)
+ assertTrue(req.indexOf("<request-action>CreateBRGInstance</") >= 0)
+ assertTrue(req.indexOf("<sdncadapter:RequestId>") >= 0)
+
+ assertTrue(rbreq.indexOf("<sdncadapter:SvcAction>unassign</") >= 0)
+ assertTrue(rbreq.indexOf("<request-action>DeleteBRGInstance</") >= 0)
+ assertTrue(rbreq.indexOf("<sdncadapter:RequestId>") >= 0)
+ }
+
+ @Test
+ public void preProcessSDNCAssign_BpmnError() {
+ ExecutionEntity mex = setupMock()
+ initPreProcessSDNC(mex)
+
+ when(mex.getVariable("rollbackData")).thenThrow(new BpmnError("expected exception"))
+
+ DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
+
+ assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.preProcessSDNCAssign(mex) }))
+ }
+
+ @Test
+ public void preProcessSDNCAssign_Ex() {
+ ExecutionEntity mex = setupMock()
+ initPreProcessSDNC(mex)
+
+ when(mex.getVariable("rollbackData")).thenThrow(new RuntimeException("expected exception"))
+
+ DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
+
+ assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.preProcessSDNCAssign(mex) }))
+ }
+
+ // ***** preProcessSDNCCreate *****
+
+ @Test
+ public void preProcessSDNCCreate() {
+ ExecutionEntity mex = setupMock()
+ def map = setupMap(mex)
+ def data = initPreProcessSDNC(mex)
+
+ DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
+ DoCreateAllottedResourceBRG.preProcessSDNCCreate(mex)
+
+ def req = map.get("sdncCreateRequest")
+ assertNotNull(req)
+
+ assertEquals(data, map.get("rollbackData"))
+
+ def rbreq = data.get(Prefix, "sdncCreateRollbackReq")
+
+ assertTrue(req.indexOf("<sdncadapter:SvcAction>create</") >= 0)
+ assertTrue(req.indexOf("<request-action>CreateBRGInstance</") >= 0)
+ assertTrue(req.indexOf("<sdncadapter:RequestId>") >= 0)
+
+ assertTrue(rbreq.indexOf("<sdncadapter:SvcAction>delete</") >= 0)
+ assertTrue(rbreq.indexOf("<request-action>DeleteBRGInstance</") >= 0)
+ assertTrue(rbreq.indexOf("<sdncadapter:RequestId>") >= 0)
+
+ }
+
+ @Test
+ public void preProcessSDNCCreate_BpmnError() {
+ ExecutionEntity mex = setupMock()
+ initPreProcessSDNC(mex)
+
+ when(mex.getVariable("rollbackData")).thenThrow(new BpmnError("expected exception"))
+
+ DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
+
+ assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.preProcessSDNCCreate(mex) }))
+ }
+
+ @Test
+ public void preProcessSDNCCreate_Ex() {
+ ExecutionEntity mex = setupMock()
+ initPreProcessSDNC(mex)
+
+ when(mex.getVariable("rollbackData")).thenThrow(new RuntimeException("expected exception"))
+
+ DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
+
+ assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.preProcessSDNCCreate(mex) }))
+ }
+
+ // ***** preProcessSDNCActivate *****
+
+ @Test
+ public void preProcessSDNCActivate() {
+ ExecutionEntity mex = setupMock()
+ def map = setupMap(mex)
+ def data = initPreProcessSDNC(mex)
+
+ DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
+ DoCreateAllottedResourceBRG.preProcessSDNCActivate(mex)
+
+ def req = map.get("sdncActivateRequest")
+ assertNotNull(req)
+
+ assertEquals(data, map.get("rollbackData"))
+
+ def rbreq = data.get(Prefix, "sdncActivateRollbackReq")
+
+ assertTrue(req.indexOf("<sdncadapter:SvcAction>activate</") >= 0)
+ assertTrue(req.indexOf("<request-action>CreateBRGInstance</") >= 0)
+ assertTrue(req.indexOf("<sdncadapter:RequestId>") >= 0)
+
+ assertTrue(rbreq.indexOf("<sdncadapter:SvcAction>deactivate</") >= 0)
+ assertTrue(rbreq.indexOf("<request-action>DeleteBRGInstance</") >= 0)
+ assertTrue(rbreq.indexOf("<sdncadapter:RequestId>") >= 0)
+
+ }
+
+ @Test
+ public void preProcessSDNCActivate_BpmnError() {
+ ExecutionEntity mex = setupMock()
+ initPreProcessSDNC(mex)
+
+ when(mex.getVariable("rollbackData")).thenThrow(new BpmnError("expected exception"))
+
+ DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
+
+ assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.preProcessSDNCActivate(mex) }))
+ }
+
+ @Test
+ public void preProcessSDNCActivate_Ex() {
+ ExecutionEntity mex = setupMock()
+ initPreProcessSDNC(mex)
+
+ when(mex.getVariable("rollbackData")).thenThrow(new RuntimeException("expected exception"))
+
+ DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
+
+ assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.preProcessSDNCActivate(mex) }))
+ }
+
+ // ***** validateSDNCResp *****
+
+ @Test
+ public void validateSDNCResp() {
+ ExecutionEntity mex = setupMock()
+ def map = setupMap(mex)
+ def data = initValidateSDNCResp(mex)
+ def resp = initValidateSDNCResp_Resp()
+
+ when(mex.getVariable(Prefix + "sdncResponseSuccess")).thenReturn(true)
+
+ DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
+
+ DoCreateAllottedResourceBRG.validateSDNCResp(mex, resp, "create")
+
+ verify(mex).getVariable("WorkflowException")
+ verify(mex).getVariable("SDNCA_SuccessIndicator")
+ verify(mex).getVariable("rollbackData")
+
+ assertEquals(data, map.get("rollbackData"))
+
+ assertEquals("true", data.get(Prefix, "rollback" + "SDNCcreate"))
+
+ }
+
+ @Test
+ public void validateSDNCResp_Get() {
+ ExecutionEntity mex = setupMock()
+ def data = initValidateSDNCResp(mex)
+ def resp = initValidateSDNCResp_Resp()
+
+ when(mex.getVariable(Prefix + "sdncResponseSuccess")).thenReturn(true)
+
+ DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
+
+ DoCreateAllottedResourceBRG.validateSDNCResp(mex, resp, "get")
+
+ verify(mex).getVariable("WorkflowException")
+ verify(mex).getVariable("SDNCA_SuccessIndicator")
+
+ verify(mex, never()).getVariable("rollbackData")
+ }
+
+ @Test
+ public void validateSDNCResp_Unsuccessful() {
+ ExecutionEntity mex = setupMock()
+ initValidateSDNCResp(mex)
+ def resp = initValidateSDNCResp_Resp()
+
+ // unsuccessful
+ when(mex.getVariable(Prefix + "sdncResponseSuccess")).thenReturn(false)
+
+ DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
+
+ assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.validateSDNCResp(mex, resp, "create") }))
+ }
+
+ @Test
+ public void validateSDNCResp_BpmnError() {
+ ExecutionEntity mex = setupMock()
+ initValidateSDNCResp(mex)
+ def resp = initValidateSDNCResp_Resp()
+
+ when(mex.getVariable("WorkflowException")).thenThrow(new BpmnError("expected exception"))
+
+ DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
+
+ assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.validateSDNCResp(mex, resp, "create") }))
+ }
+
+ @Test
+ public void validateSDNCResp_Ex() {
+ ExecutionEntity mex = setupMock()
+ initValidateSDNCResp(mex)
+ def resp = initValidateSDNCResp_Resp()
+
+ when(mex.getVariable("WorkflowException")).thenThrow(new RuntimeException("expected exception"))
+
+ DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
+
+ assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.validateSDNCResp(mex, resp, "create") }))
+ }
+
+ // ***** preProcessSDNCGet *****
+
+ @Test
+ public void preProcessSDNCGet_FoundAR() {
+ ExecutionEntity mex = setupMock()
+ def map = setupMap(mex)
+ initPreProcessSDNCGet(mex)
+
+ DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
+ DoCreateAllottedResourceBRG.preProcessSDNCGet(mex)
+
+ String req = map.get("sdncGetRequest")
+
+ assertTrue(req.indexOf("<sdncadapter:RequestId>") >= 0)
+ assertTrue(req.indexOf("<sdncadapter:SvcInstanceId>sii</") >= 0)
+ assertTrue(req.indexOf("<sdncadapter:SvcOperation>arlink</") >= 0)
+ assertTrue(req.indexOf("<sdncadapter:CallbackUrl>myurl</") >= 0)
+
+ }
+
+ @Test
+ public void preProcessSDNCGet_NotFoundAR() {
+ ExecutionEntity mex = setupMock()
+ def map = setupMap(mex)
+ initPreProcessSDNCGet(mex)
+
+ when(mex.getVariable("foundActiveAR")).thenReturn(false)
+
+ DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
+ DoCreateAllottedResourceBRG.preProcessSDNCGet(mex)
+
+ String req = map.get("sdncGetRequest")
+
+ assertTrue(req.indexOf("<sdncadapter:RequestId>") >= 0)
+ assertTrue(req.indexOf("<sdncadapter:SvcInstanceId>sii</") >= 0)
+ assertTrue(req.indexOf("<sdncadapter:SvcOperation>assignlink</") >= 0)
+ assertTrue(req.indexOf("<sdncadapter:CallbackUrl>myurl</") >= 0)
+
+ }
+
+ @Test
+ public void preProcessSDNCGet_Ex() {
+ ExecutionEntity mex = setupMock()
+ initPreProcessSDNCGet(mex)
+
+ when(mex.getVariable("foundActiveAR")).thenThrow(new RuntimeException("expected exception"))
+
+ DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
+
+ assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.preProcessSDNCGet(mex) }))
+ }
+
+ // ***** updateAaiAROrchStatus *****
+
+ @Test
+ @Ignore
+ public void updateAaiAROrchStatus() {
+ MockPatchAllottedResource(CUST, SVC, INST, ARID)
+
+ ExecutionEntity mex = setupMock()
+ initUpdateAaiAROrchStatus(mex)
+
+ DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
+ DoCreateAllottedResourceBRG.updateAaiAROrchStatus(mex, "success")
+ }
+
+ // ***** generateOutputs *****
+
+ @Test
+ public void generateOutputs() {
+ ExecutionEntity mex = setupMock()
+ def brgtop = FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceBRG/SDNCTopologyQueryCallback.xml")
+
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("enhancedCallbackRequestData")).thenReturn(brgtop)
+
+ DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
+ DoCreateAllottedResourceBRG.generateOutputs(mex)
+
+ verify(mex).setVariable("allotedResourceName", "namefromrequest")
+
+ }
+
+ @Test
+ public void generateOutputs_BadXml() {
+ ExecutionEntity mex = setupMock()
+
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("enhancedCallbackRequestData")).thenReturn("invalid xml")
+
+ DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
+ DoCreateAllottedResourceBRG.generateOutputs(mex)
+
+ verify(mex, never()).setVariable(anyString(), anyString())
+
+ }
+
+ @Test
+ public void generateOutputs_BpmnError() {
+ ExecutionEntity mex = setupMock()
+
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("enhancedCallbackRequestData")).thenThrow(new BpmnError("expected exception"))
+
+ DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
+
+ DoCreateAllottedResourceBRG.generateOutputs(mex)
+ verify(mex, never()).setVariable(anyString(), anyString())
+
+ }
+
+ @Test
+ public void generateOutputs_Ex() {
+ ExecutionEntity mex = setupMock()
+
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("enhancedCallbackRequestData")).thenThrow(new RuntimeException("expected exception"))
+
+ DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
+
+ DoCreateAllottedResourceBRG.generateOutputs(mex)
+ verify(mex, never()).setVariable(anyString(), anyString())
+
+ }
+
+ // ***** preProcessRollback *****
+
+ @Test
+ public void preProcessRollback() {
+ ExecutionEntity mex = setupMock()
+ WorkflowException wfe = mock(WorkflowException.class)
+
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("WorkflowException")).thenReturn(wfe)
+
+ DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
+ DoCreateAllottedResourceBRG.preProcessRollback(mex)
+
+ verify(mex).setVariable("prevWorkflowException", wfe)
+ }
+
+ @Test
+ public void preProcessRollback_NotWFE() {
+ ExecutionEntity mex = setupMock()
+
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("WorkflowException")).thenReturn("I'm not a WFE")
+
+ DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
+ DoCreateAllottedResourceBRG.preProcessRollback(mex)
+ }
+
+ @Test
+ public void preProcessRollback_BpmnError() {
+ ExecutionEntity mex = setupMock()
+
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("WorkflowException")).thenThrow(new BpmnError("expected exception"))
+
+ DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
+
+ DoCreateAllottedResourceBRG.preProcessRollback(mex)
+ }
+
+ @Test
+ public void preProcessRollback_Ex() {
+ ExecutionEntity mex = setupMock()
+
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("WorkflowException")).thenThrow(new RuntimeException("expected exception"))
+
+ DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
+
+ DoCreateAllottedResourceBRG.preProcessRollback(mex)
+
+ }
+
+ // ***** postProcessRollback *****
+
+ @Test
+ public void postProcessRollback() {
+ ExecutionEntity mex = setupMock()
+ WorkflowException wfe = mock(WorkflowException.class)
+
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("prevWorkflowException")).thenReturn(wfe)
+
+ DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
+ DoCreateAllottedResourceBRG.postProcessRollback(mex)
+
+ verify(mex).setVariable("WorkflowException", wfe)
+ verify(mex).setVariable("rollbackData", null)
+
+ }
+
+ @Test
+ public void postProcessRollback_NotWFE() {
+ ExecutionEntity mex = setupMock()
+
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("prevWorkflowException")).thenReturn("I'm not a WFE")
+
+ DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
+ DoCreateAllottedResourceBRG.postProcessRollback(mex)
+
+ verify(mex).setVariable("rollbackData", null)
+
+ }
+
+ @Test
+ public void postProcessRollback_BpmnError() {
+ ExecutionEntity mex = setupMock()
+
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("prevWorkflowException")).thenThrow(new BpmnError("expected exception"))
+
+ DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
+
+ assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.postProcessRollback(mex) }))
+ verify(mex, never()).setVariable("rollbackData", null)
+
+ }
+
+ @Test
+ public void postProcessRollback_Ex() {
+ ExecutionEntity mex = setupMock()
+
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("prevWorkflowException")).thenThrow(new RuntimeException("expected exception"))
+
+ DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
+
+ DoCreateAllottedResourceBRG.postProcessRollback(mex)
+ verify(mex, never()).setVariable("rollbackData", null)
+
+ }
+
+ private boolean checkMissingPreProcessRequest(String fieldnm) {
+ ExecutionEntity mex = setupMock()
+ initPreProcess(mex)
+
+ DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
+
+ when(mex.getVariable(fieldnm)).thenReturn("")
+
+ return doBpmnError({ _ -> DoCreateAllottedResourceBRG.preProcessRequest(mex) })
+ }
+
+ private void initPreProcess(ExecutionEntity mex) {
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("mso.workflow.sdncadapter.callback")).thenReturn("sdncurn")
+ when(mex.getVariable("mso.workflow.sdnc.replication.delay")).thenReturn("sdncdelay")
+ when(mex.getVariable("serviceInstanceId")).thenReturn("sii")
+ when(mex.getVariable("parentServiceInstanceId")).thenReturn("psii")
+ when(mex.getVariable("allottedResourceModelInfo")).thenReturn("armi")
+ when(mex.getVariable("vni")).thenReturn("myvni")
+ when(mex.getVariable("vgmuxBearerIP")).thenReturn("vbi")
+ when(mex.getVariable("brgWanMacAddress")).thenReturn("bwma")
+ when(mex.getVariable("allottedResourceRole")).thenReturn("arr")
+ when(mex.getVariable("allottedResourceType")).thenReturn("art")
+ }
+
+ private void initGetAaiAR(ExecutionEntity mex) {
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("allottedResourceType")).thenReturn("BRGt")
+ when(mex.getVariable("allottedResourceRole")).thenReturn("BRGr")
+ when(mex.getVariable("CSI_service")).thenReturn(FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceBRG/getAR.xml"))
+ when(mex.getVariable("aai.endpoint")).thenReturn(aaiUriPfx)
+ when(mex.getVariable("aaiAROrchStatus")).thenReturn("Active")
+ }
+
+ private initCreateAaiAr(ExecutionEntity mex) {
+ when(mex.getVariable("disableRollback")).thenReturn(45)
+ when(mex.getVariable("serviceInstanceId")).thenReturn("sii")
+ when(mex.getVariable("parentServiceInstanceId")).thenReturn("psii")
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("allottedResourceId")).thenReturn(ARID)
+ when(mex.getVariable("aai.endpoint")).thenReturn(aaiUriPfx)
+ when(mex.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn(UrnPropertiesReader.getVariable("mso.workflow.global.default.aai.namespace"))
+ when(mex.getVariable("PSI_resourceLink")).thenReturn(AAIUriFactory.createResourceFromExistingURI(AAIObjectType.SERVICE_INSTANCE, UriBuilder.fromPath("/business/customers/customer/" + CUST + "/service-subscriptions/service-subscription/" + SVC + "/service-instances/service-instance/" + INST).build()))
+ when(mex.getVariable("allottedResourceType")).thenReturn("BRGt")
+ when(mex.getVariable("allottedResourceRole")).thenReturn("BRGr")
+ when(mex.getVariable("CSI_resourceLink")).thenReturn(aaiUriPfx + "/aai/v9/mycsi")
+ when(mex.getVariable("allottedResourceModelInfo")).thenReturn("""
+ {
+ "modelInvariantUuid":"modelinvuuid",
+ "modelUuid":"modeluuid",
+ "modelCustomizationUuid":"modelcustuuid"
+ }
+ """)
+ }
+
+ private initBuildSDNCRequest(ExecutionEntity mex) {
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("allottedResourceId")).thenReturn("ari")
+ when(mex.getVariable("serviceInstanceId")).thenReturn("sii")
+ when(mex.getVariable("parentServiceInstanceId")).thenReturn("psii")
+ when(mex.getVariable("subscriptionServiceType")).thenReturn("sst")
+ when(mex.getVariable("globalCustomerId")).thenReturn("gci")
+ when(mex.getVariable("sdncCallbackUrl")).thenReturn("scu")
+ when(mex.getVariable("msoRequestId")).thenReturn("mri")
+ when(mex.getVariable("brgWanMacAddress")).thenReturn("bwma")
+ when(mex.getVariable("vni")).thenReturn("myvni")
+ when(mex.getVariable("vgmuxBearerIP")).thenReturn("vbi")
+ when(mex.getVariable("allottedResourceModelInfo")).thenReturn("""
+ {
+ "modelInvariantUuid":"miu",
+ "modelUuid":"mu",
+ "modelCustomizationUuid":"mcu",
+ "modelVersion":"mv",
+ "modelName":"mn"
+ }
+ """)
+ }
+
+ private RollbackData initPreProcessSDNC(ExecutionEntity mex) {
+ def data = new RollbackData()
+
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("rollbackData")).thenReturn(data)
+
+ return data
+ }
+
+ private initPreProcessSDNCGet(ExecutionEntity mex) {
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("sdncCallbackUrl")).thenReturn("myurl")
+ when(mex.getVariable("foundActiveAR")).thenReturn(true)
+ when(mex.getVariable("aaiARGetResponse")).thenReturn("<selflink>arlink</selflink>")
+ when(mex.getVariable("sdncAssignResponse")).thenReturn("<response-data>&lt;object-path&gt;assignlink&lt;/object-path&gt;</response-data>")
+ when(mex.getVariable("serviceInstanceId")).thenReturn("sii")
+ when(mex.getVariable("sdncCallbackUrl")).thenReturn("myurl")
+ }
+
+ private RollbackData initValidateSDNCResp(ExecutionEntity mex) {
+ def data = new RollbackData()
+
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("prefix")).thenReturn(Prefix)
+ when(mex.getVariable("SDNCA_SuccessIndicator")).thenReturn(true)
+ when(mex.getVariable("rollbackData")).thenReturn(data)
+
+ return data
+ }
+
+ private String initValidateSDNCResp_Resp() {
+ return "<response-data>&lt;response-code&gt;200&lt;/response-code&gt;</response-data>"
+ }
+
+ private initUpdateAaiAROrchStatus(ExecutionEntity mex) {
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("aaiARPath")).thenReturn("/business/customers/customer/" + CUST + "/service-subscriptions/service-subscription/" + SVC + "/service-instances/service-instance/" + INST + "/allotted-resources/allotted-resource/" + ARID)
+ }
+
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollbackTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollbackTest.groovy
index 50ce46e4a3..a877ce42e7 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollbackTest.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollbackTest.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -20,635 +22,573 @@
package org.onap.so.bpmn.vcpe.scripts
-
-import org.camunda.bpm.engine.ProcessEngineServices
-import org.camunda.bpm.engine.RepositoryService
+import com.github.tomakehurst.wiremock.junit.WireMockRule
+import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity
-import org.camunda.bpm.engine.repository.ProcessDefinition
-import org.camunda.bpm.engine.delegate.DelegateExecution
-import org.junit.Before
-import org.junit.BeforeClass
-import org.junit.Rule
-import org.junit.Test
-import org.junit.Ignore
+import org.junit.*
import org.mockito.MockitoAnnotations
-import org.camunda.bpm.engine.delegate.BpmnError
-import org.onap.so.bpmn.core.WorkflowException
-import org.onap.so.bpmn.mock.FileUtil
+import org.onap.so.bpmn.core.RollbackData
import static com.github.tomakehurst.wiremock.client.WireMock.aResponse
import static com.github.tomakehurst.wiremock.client.WireMock.get
-import static com.github.tomakehurst.wiremock.client.WireMock.stubFor
import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertTrue
import static org.mockito.Mockito.*
-import static org.onap.so.bpmn.mock.StubResponseAAI.MockDeleteAllottedResource
-import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetAllottedResource
-import static org.onap.so.bpmn.mock.StubResponseAAI.MockPatchAllottedResource
+import static org.onap.so.bpmn.mock.StubResponseAAI.*
-import org.onap.so.bpmn.core.RollbackData
+class DoCreateAllottedResourceTXCRollbackTest extends GroovyTestBase {
-import com.github.tomakehurst.wiremock.junit.WireMockRule
+ @Rule
+ public WireMockRule wireMockRule = new WireMockRule(PORT)
+
+ String Prefix = "DCARTXCRB_"
+ String RbType = "DCARTXC_"
+
+ @BeforeClass
+ public static void setUpBeforeClass() {
+ GroovyTestBase.setUpBeforeClass()
+ }
-class DoCreateAllottedResourceTXCRollbackTest extends GroovyTestBase {
-
- @Rule
- public WireMockRule wireMockRule = new WireMockRule(PORT)
-
- String Prefix = "DCARTXCRB_"
- String RbType = "DCARTXC_"
-
- @BeforeClass
- public static void setUpBeforeClass() {
- super.setUpBeforeClass()
- }
-
@Before
- public void init()
- {
- MockitoAnnotations.initMocks(this)
- }
-
- public DoCreateAllottedResourceTXCRollbackTest() {
- super("DoCreateAllottedResourceTXCRollback")
- }
-
-
- // ***** preProcessRequest *****
-
- @Test
-// @Ignore
- public void preProcessRequest() {
- ExecutionEntity mex = setupMock()
- initPreProcess(mex)
-
- DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
- DoCreateAllottedResourceTXCRollback.preProcessRequest(mex)
-
- //verify(mex).getVariable(DBGFLAG)
- verify(mex).setVariable("prefix", Prefix)
- verify(mex).setVariable("serviceInstanceId", "sii")
- verify(mex).setVariable("parentServiceInstanceId", "psii")
- verify(mex).setVariable("allottedResourceId", "myid")
- verify(mex).setVariable("rollbackAAI", true)
- verify(mex).setVariable("aaiARPath", "mypath")
- verify(mex).setVariable("rollbackSDNC", true)
- verify(mex).setVariable("deactivateSdnc", "myactivate")
- verify(mex).setVariable("deleteSdnc", "mycreate")
- verify(mex).setVariable("unassignSdnc", "true")
- verify(mex).setVariable("sdncDeactivateRequest", "activatereq")
- verify(mex).setVariable("sdncDeleteRequest", "createreq")
- verify(mex).setVariable("sdncUnassignRequest", "assignreq")
-
- verify(mex, never()).setVariable("skipRollback", true)
- }
-
- @Test
-// @Ignore
- public void preProcessRequest_RollbackDisabled() {
- ExecutionEntity mex = setupMock()
- initPreProcess(mex)
-
- when(mex.getVariable("disableRollback")).thenReturn("true")
-
- DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
- DoCreateAllottedResourceTXCRollback.preProcessRequest(mex)
-
- //verify(mex).getVariable(DBGFLAG)
- verify(mex).setVariable("prefix", Prefix)
- verify(mex).setVariable("serviceInstanceId", "sii")
- verify(mex).setVariable("parentServiceInstanceId", "psii")
- verify(mex).setVariable("allottedResourceId", "myid")
- verify(mex).setVariable("rollbackAAI", true)
- verify(mex).setVariable("aaiARPath", "mypath")
- verify(mex).setVariable("rollbackSDNC", true)
- verify(mex).setVariable("deactivateSdnc", "myactivate")
- verify(mex).setVariable("deleteSdnc", "mycreate")
- verify(mex).setVariable("unassignSdnc", "true")
- verify(mex).setVariable("sdncDeactivateRequest", "activatereq")
- verify(mex).setVariable("sdncDeleteRequest", "createreq")
- verify(mex).setVariable("sdncUnassignRequest", "assignreq")
-
- verify(mex).setVariable("skipRollback", true)
- }
-
- @Test
-// @Ignore
- public void preProcessRequest_NoAAI() {
- ExecutionEntity mex = setupMock()
- def data = initPreProcess(mex)
-
- when(mex.getVariable("rollbackAAI")).thenReturn(false)
- data.put(RbType, "rollbackAAI", "false")
-
- DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
- DoCreateAllottedResourceTXCRollback.preProcessRequest(mex)
-
- //verify(mex).getVariable(DBGFLAG)
- verify(mex).setVariable("prefix", Prefix)
- verify(mex).setVariable("serviceInstanceId", "sii")
- verify(mex).setVariable("parentServiceInstanceId", "psii")
- verify(mex).setVariable("allottedResourceId", "myid")
- verify(mex, never()).setVariable("rollbackAAI", true)
- verify(mex, never()).setVariable("aaiARPath", "mypath")
- verify(mex).setVariable("rollbackSDNC", true)
- verify(mex).setVariable("deactivateSdnc", "myactivate")
- verify(mex).setVariable("deleteSdnc", "mycreate")
- verify(mex).setVariable("unassignSdnc", "true")
- verify(mex).setVariable("sdncDeactivateRequest", "activatereq")
- verify(mex).setVariable("sdncDeleteRequest", "createreq")
- verify(mex).setVariable("sdncUnassignRequest", "assignreq")
-
- verify(mex, never()).setVariable("skipRollback", true)
- }
-
- @Test
-// @Ignore
- public void preProcessRequest_NoAssign() {
- ExecutionEntity mex = setupMock()
- def data = initPreProcess(mex)
-
- when(mex.getVariable("rollbackSDNC")).thenReturn(false)
- data.put(RbType, "rollbackSDNCassign", "false")
-
- DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
- DoCreateAllottedResourceTXCRollback.preProcessRequest(mex)
-
- //verify(mex).getVariable(DBGFLAG)
- verify(mex).setVariable("prefix", Prefix)
- verify(mex).setVariable("serviceInstanceId", "sii")
- verify(mex).setVariable("parentServiceInstanceId", "psii")
- verify(mex).setVariable("allottedResourceId", "myid")
- verify(mex).setVariable("rollbackAAI", true)
- verify(mex).setVariable("aaiARPath", "mypath")
- verify(mex, never()).setVariable("rollbackSDNC", true)
- verify(mex, never()).setVariable("deactivateSdnc", "myactivate")
- verify(mex, never()).setVariable("deleteSdnc", "mycreate")
- verify(mex, never()).setVariable("unassignSdnc", "true")
- verify(mex, never()).setVariable("sdncDeactivateRequest", "activatereq")
- verify(mex, never()).setVariable("sdncDeleteRequest", "createreq")
- verify(mex, never()).setVariable("sdncUnassignRequest", "assignreq")
-
- verify(mex, never()).setVariable("skipRollback", true)
- }
-
- @Test
-// @Ignore
- public void preProcessRequest_NoAAI_NoAssign() {
- ExecutionEntity mex = setupMock()
- initPreProcess(mex)
-
- when(mex.getVariable("rollbackAAI")).thenReturn(false)
- when(mex.getVariable("rollbackSDNC")).thenReturn(false)
-
- DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
- DoCreateAllottedResourceTXCRollback.preProcessRequest(mex)
-
- verify(mex).setVariable("skipRollback", true)
- }
-
- @Test
-// @Ignore
- public void preProcessRequest_NoRbStructure() {
- ExecutionEntity mex = setupMock()
- initPreProcess(mex)
-
- when(mex.getVariable("rollbackData")).thenReturn(new RollbackData())
-
- DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
- DoCreateAllottedResourceTXCRollback.preProcessRequest(mex)
-
- verify(mex).setVariable("skipRollback", true)
- }
-
- @Test
-// @Ignore
- public void preProcessRequest_NullRb() {
- ExecutionEntity mex = setupMock()
- initPreProcess(mex)
-
- when(mex.getVariable("rollbackData")).thenReturn(null)
-
- DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
- DoCreateAllottedResourceTXCRollback.preProcessRequest(mex)
-
- verify(mex).setVariable("skipRollback", true)
- }
-
- @Test
-// @Ignore
- public void preProcessRequest_BpmnError() {
- ExecutionEntity mex = setupMock()
- initPreProcess(mex)
-
- when(mex.getVariable("rollbackData")).thenThrow(new BpmnError("expected exception"))
-
- DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
-
- assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceTXCRollback.preProcessRequest(mex) }))
- }
-
- @Test
-// @Ignore
- public void preProcessRequest_Ex() {
- ExecutionEntity mex = setupMock()
- initPreProcess(mex)
-
- when(mex.getVariable("rollbackData")).thenThrow(new RuntimeException("expected exception"))
-
- DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
-
- assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceTXCRollback.preProcessRequest(mex) }))
- }
-
- @Test
- @Ignore
- public void updateAaiAROrchStatus() {
- ExecutionEntity mex = setupMock()
- initUpdateAaiAROrchStatus(mex)
-
- MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml")
- MockPatchAllottedResource(CUST, SVC, INST, ARID)
-
- DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
- DoCreateAllottedResourceTXCRollback.updateAaiAROrchStatus(mex, "success")
- }
-
- @Test
-// @Ignore
- public void updateAaiAROrchStatus_EmptyResponse() {
- ExecutionEntity mex = setupMock()
- initUpdateAaiAROrchStatus(mex)
-
- wireMockRule
- .stubFor(get(urlMatching("/aai/v[0-9]+/.*"))
- .willReturn(aResponse()
- .withStatus(200)))
-
- DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
-
- assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceTXCRollback.updateAaiAROrchStatus(mex, "success") }))
- }
-
- @Test
-// @Ignore
- public void updateAaiAROrchStatus_NoArPath() {
- ExecutionEntity mex = setupMock()
- initUpdateAaiAROrchStatus(mex)
-
- MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml")
- MockPatchAllottedResource(CUST, SVC, INST, ARID)
-
- when(mex.getVariable("aaiARPath")).thenReturn(null)
-
- DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
-
- assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceTXCRollback.updateAaiAROrchStatus(mex, "success") }))
- }
-
-
- // ***** validateSDNCResp *****
-
- @Test
-// @Ignore
- public void validateSDNCResp() {
- ExecutionEntity mex = setupMock()
- initValidateSDNCResp(mex)
- def resp = initValidateSDNCResp_Resp()
-
- when(mex.getVariable(Prefix+"sdncResponseSuccess")).thenReturn(true)
-
- DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
-
- DoCreateAllottedResourceTXCRollback.validateSDNCResp(mex, resp, "create")
-
- verify(mex).getVariable("WorkflowException")
- verify(mex).getVariable("SDNCA_SuccessIndicator")
- }
-
- @Test
-// @Ignore
- public void validateSDNCResp_Unsuccessful() {
- ExecutionEntity mex = setupMock()
- initValidateSDNCResp(mex)
- def resp = initValidateSDNCResp_Resp()
-
- when(mex.getVariable(Prefix+"sdncResponseSuccess")).thenReturn(false)
-
- DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
-
- assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceTXCRollback.validateSDNCResp(mex, resp, "create") }))
- }
-
- @Test
-// @Ignore
- public void validateSDNCResp_BpmnError404() {
- ExecutionEntity mex = setupMock()
- initValidateSDNCResp(mex)
- def resp = initValidateSDNCResp_Resp()
- when(mex.getVariable(Prefix+"sdncResponseSuccess")).thenReturn(true)
-
- when(mex.getVariable("WorkflowException")).thenThrow(new BpmnError("404", "expected exception"))
-
- DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
-
- DoCreateAllottedResourceTXCRollback.validateSDNCResp(mex, resp, "create")
- }
-
- @Test
-// @Ignore
- public void validateSDNCResp_BpmnError() {
- ExecutionEntity mex = setupMock()
- initValidateSDNCResp(mex)
- def resp = initValidateSDNCResp_Resp()
- when(mex.getVariable(Prefix+"sdncResponseSuccess")).thenReturn(true)
-
- when(mex.getVariable("WorkflowException")).thenThrow(new BpmnError("expected exception"))
-
- DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
-
- assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceTXCRollback.validateSDNCResp(mex, resp, "create") }))
- }
-
- @Test
-// @Ignore
- public void validateSDNCResp_Ex() {
- ExecutionEntity mex = setupMock()
- initValidateSDNCResp(mex)
- def resp = initValidateSDNCResp_Resp()
- when(mex.getVariable(Prefix+"sdncResponseSuccess")).thenReturn(true)
-
- when(mex.getVariable("WorkflowException")).thenThrow(new RuntimeException("expected exception"))
-
- DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
-
- assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceTXCRollback.validateSDNCResp(mex, resp, "create") }))
- }
-
- @Test
- @Ignore
- public void deleteAaiAR() {
- ExecutionEntity mex = setupMock()
- initDeleteAaiAR(mex)
-
- MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml")
- MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS)
-
- DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
- DoCreateAllottedResourceTXCRollback.deleteAaiAR(mex)
- }
-
- @Test
-// @Ignore
- public void deleteAaiAR_NoArPath() {
- ExecutionEntity mex = setupMock()
- initDeleteAaiAR(mex)
-
- MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml")
- MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS)
-
- when(mex.getVariable("aaiARPath")).thenReturn("")
-
- DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
-
- assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceTXCRollback.deleteAaiAR(mex) }))
- }
-
- @Test
-// @Ignore
- public void deleteAaiAR_BpmnError() {
- ExecutionEntity mex = setupMock()
- initDeleteAaiAR(mex)
-
- MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml")
- MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS)
-
- when(mex.getVariable("aaiARPath")).thenThrow(new BpmnError("expected exception"))
-
- DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
-
- assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceTXCRollback.deleteAaiAR(mex) }))
- }
-
- @Test
-// @Ignore
- public void deleteAaiAR_Ex() {
- ExecutionEntity mex = setupMock()
- initDeleteAaiAR(mex)
-
- MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml")
- MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS)
-
- when(mex.getVariable("aaiARPath")).thenThrow(new RuntimeException("expected exception"))
-
- DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
-
- assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceTXCRollback.deleteAaiAR(mex) }))
- }
-
- @Test
-// @Ignore
- public void postProcessRequest() {
- ExecutionEntity mex = setupMock()
- initPostProcessRequest(mex)
-
- DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
- DoCreateAllottedResourceTXCRollback.postProcessRequest(mex)
-
- //verify(mex).getVariable(DBGFLAG)
- verify(mex).setVariable("rollbackData", null)
- verify(mex).setVariable("rolledBack", true)
- }
-
- @Test
-// @Ignore
- public void postProcessRequest_RolledBack() {
- ExecutionEntity mex = setupMock()
- initPostProcessRequest(mex)
-
- when(mex.getVariable("skipRollback")).thenReturn(true)
-
- DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
- DoCreateAllottedResourceTXCRollback.postProcessRequest(mex)
-
- //verify(mex).getVariable(DBGFLAG)
- verify(mex).setVariable("rollbackData", null)
- verify(mex, never()).setVariable("rolledBack", true)
- }
-
- @Test
-// @Ignore
- public void postProcessRequest_BpmnError() {
- ExecutionEntity mex = setupMock()
- initPostProcessRequest(mex)
-
- when(mex.getVariable("skipRollback")).thenThrow(new BpmnError("expected exception"))
-
- DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
- DoCreateAllottedResourceTXCRollback.postProcessRequest(mex)
-
- //verify(mex).getVariable(DBGFLAG)
- verify(mex).setVariable("rollbackData", null)
- verify(mex, never()).setVariable("rolledBack", true)
- }
-
- @Test
-// @Ignore
- public void postProcessRequest_Ex() {
- ExecutionEntity mex = setupMock()
- initPostProcessRequest(mex)
-
- when(mex.getVariable("skipRollback")).thenThrow(new RuntimeException("expected exception"))
-
- DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
- DoCreateAllottedResourceTXCRollback.postProcessRequest(mex)
-
- //verify(mex).getVariable(DBGFLAG)
- verify(mex).setVariable("rollbackData", null)
- verify(mex, never()).setVariable("rolledBack", true)
- }
-
- @Test
-// @Ignore
- public void processRollbackException() {
- ExecutionEntity mex = setupMock()
- initProcessRollbackException(mex)
-
- DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
- DoCreateAllottedResourceTXCRollback.processRollbackException(mex)
-
- //verify(mex).getVariable(DBGFLAG)
- verify(mex).setVariable("rollbackData", null)
- verify(mex).setVariable("rolledBack", false)
- verify(mex).setVariable("rollbackError", "Caught exception in AllottedResource Create Rollback")
- verify(mex).setVariable("WorkflowException", null)
- }
-
- @Test
-// @Ignore
- public void processRollbackException_BpmnError() {
- ExecutionEntity mex = setupMock()
- initProcessRollbackException(mex)
-
- doThrow(new BpmnError("expected exception")).when(mex).setVariable("rollbackData", null)
-
- DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
- DoCreateAllottedResourceTXCRollback.processRollbackException(mex)
- }
-
- @Test
-// @Ignore
- public void processRollbackException_Ex() {
- ExecutionEntity mex = setupMock()
- initProcessRollbackException(mex)
-
- doThrow(new RuntimeException("expected exception")).when(mex).setVariable("rollbackData", null)
-
- DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
- DoCreateAllottedResourceTXCRollback.processRollbackException(mex)
- }
-
- @Test
-// @Ignore
- public void processRollbackJavaException() {
- ExecutionEntity mex = setupMock()
- initProcessRollbackException(mex)
-
- DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
- DoCreateAllottedResourceTXCRollback.processRollbackJavaException(mex)
-
- //verify(mex).getVariable(DBGFLAG)
- verify(mex).setVariable("rollbackData", null)
- verify(mex).setVariable("rolledBack", false)
- verify(mex).setVariable("rollbackError", "Caught Java exception in AllottedResource Create Rollback")
- verify(mex, never()).setVariable("WorkflowException", null)
- }
-
- @Test
-// @Ignore
- public void processRollbackJavaException_BpmnError() {
- ExecutionEntity mex = setupMock()
- initProcessRollbackException(mex)
-
- doThrow(new BpmnError("expected exception")).when(mex).setVariable("rollbackData", null)
-
- DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
- DoCreateAllottedResourceTXCRollback.processRollbackJavaException(mex)
- }
-
- @Test
-// @Ignore
- public void processRollbackJavaException_Ex() {
- ExecutionEntity mex = setupMock()
- initProcessRollbackException(mex)
-
- doThrow(new RuntimeException("expected exception")).when(mex).setVariable("rollbackData", null)
-
- DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
- DoCreateAllottedResourceTXCRollback.processRollbackJavaException(mex)
- }
-
- private RollbackData initPreProcess(ExecutionEntity mex) {
- def data = new RollbackData()
-
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("rollbackData")).thenReturn(data)
- when(mex.getVariable("rollbackAAI")).thenReturn(true)
- when(mex.getVariable("rollbackSDNC")).thenReturn(true)
- when(mex.getVariable("disableRollback")).thenReturn("false")
-
- data.put("SERVICEINSTANCE", "allottedResourceId", "myid")
-
- data.put(RbType, "serviceInstanceId", "sii")
- data.put(RbType, "parentServiceInstanceId", "psii")
-
- data.put(RbType, "rollbackAAI", "true")
- data.put(RbType, "aaiARPath", "mypath")
-
- data.put(RbType, "rollbackSDNCassign", "true")
- data.put(RbType, "rollbackSDNCactivate", "myactivate")
- data.put(RbType, "rollbackSDNCcreate", "mycreate")
- data.put(RbType, "sdncActivateRollbackReq", "activatereq")
- data.put(RbType, "sdncCreateRollbackReq", "createreq")
- data.put(RbType, "sdncAssignRollbackReq", "assignreq")
-
- return data
- }
-
- private initUpdateAaiAROrchStatus(ExecutionEntity mex) {
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("aaiARPath")).thenReturn("/business/customers/customer/"+CUST+"/service-subscriptions/service-subscription/"+SVC+"/service-instances/service-instance/"+INST+"/allotted-resources/allotted-resource/"+ARID)
- when(mex.getVariable("aai.endpoint")).thenReturn(aaiUriPfx)
- }
-
- private initValidateSDNCResp(ExecutionEntity mex) {
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("prefix")).thenReturn(Prefix)
- when(mex.getVariable("SDNCA_SuccessIndicator")).thenReturn(true)
- }
-
- private String initValidateSDNCResp_Resp() {
- return "<response-data>&lt;response-code&gt;200&lt;/response-code&gt;</response-data>"
- }
-
- private initDeleteAaiAR(ExecutionEntity mex) {
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("aaiARResourceVersion")).thenReturn(VERS)
- when(mex.getVariable("aaiARPath")).thenReturn("/business/customers/customer/"+CUST+"/service-subscriptions/service-subscription/"+SVC+"/service-instances/service-instance/"+INST+"/allotted-resources/allotted-resource/"+ARID)
- when(mex.getVariable("aai.endpoint")).thenReturn(aaiUriPfx)
- }
-
- private initPostProcessRequest(ExecutionEntity mex) {
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("skipRollback")).thenReturn(false)
- }
-
- private initProcessRollbackException(ExecutionEntity mex) {
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- }
-
- private initProcessRollbackJavaException(ExecutionEntity mex) {
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- }
-
+ public void init() {
+ MockitoAnnotations.initMocks(this)
+ }
+
+ public DoCreateAllottedResourceTXCRollbackTest() {
+ super("DoCreateAllottedResourceTXCRollback")
+ }
+
+ // ***** preProcessRequest *****
+
+ @Test
+ public void preProcessRequest() {
+ ExecutionEntity mex = setupMock()
+ initPreProcess(mex)
+
+ DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
+ DoCreateAllottedResourceTXCRollback.preProcessRequest(mex)
+
+ verify(mex).setVariable("prefix", Prefix)
+ verify(mex).setVariable("serviceInstanceId", "sii")
+ verify(mex).setVariable("parentServiceInstanceId", "psii")
+ verify(mex).setVariable("allottedResourceId", "myid")
+ verify(mex).setVariable("rollbackAAI", true)
+ verify(mex).setVariable("aaiARPath", "mypath")
+ verify(mex).setVariable("rollbackSDNC", true)
+ verify(mex).setVariable("deactivateSdnc", "myactivate")
+ verify(mex).setVariable("deleteSdnc", "mycreate")
+ verify(mex).setVariable("unassignSdnc", "true")
+ verify(mex).setVariable("sdncDeactivateRequest", "activatereq")
+ verify(mex).setVariable("sdncDeleteRequest", "createreq")
+ verify(mex).setVariable("sdncUnassignRequest", "assignreq")
+
+ verify(mex, never()).setVariable("skipRollback", true)
+ }
+
+ @Test
+ public void preProcessRequest_RollbackDisabled() {
+ ExecutionEntity mex = setupMock()
+ initPreProcess(mex)
+
+ when(mex.getVariable("disableRollback")).thenReturn("true")
+
+ DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
+ DoCreateAllottedResourceTXCRollback.preProcessRequest(mex)
+
+ verify(mex).setVariable("prefix", Prefix)
+ verify(mex).setVariable("serviceInstanceId", "sii")
+ verify(mex).setVariable("parentServiceInstanceId", "psii")
+ verify(mex).setVariable("allottedResourceId", "myid")
+ verify(mex).setVariable("rollbackAAI", true)
+ verify(mex).setVariable("aaiARPath", "mypath")
+ verify(mex).setVariable("rollbackSDNC", true)
+ verify(mex).setVariable("deactivateSdnc", "myactivate")
+ verify(mex).setVariable("deleteSdnc", "mycreate")
+ verify(mex).setVariable("unassignSdnc", "true")
+ verify(mex).setVariable("sdncDeactivateRequest", "activatereq")
+ verify(mex).setVariable("sdncDeleteRequest", "createreq")
+ verify(mex).setVariable("sdncUnassignRequest", "assignreq")
+
+ verify(mex).setVariable("skipRollback", true)
+ }
+
+ @Test
+ public void preProcessRequest_NoAAI() {
+ ExecutionEntity mex = setupMock()
+ def data = initPreProcess(mex)
+
+ when(mex.getVariable("rollbackAAI")).thenReturn(false)
+ data.put(RbType, "rollbackAAI", "false")
+
+ DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
+ DoCreateAllottedResourceTXCRollback.preProcessRequest(mex)
+
+ verify(mex).setVariable("prefix", Prefix)
+ verify(mex).setVariable("serviceInstanceId", "sii")
+ verify(mex).setVariable("parentServiceInstanceId", "psii")
+ verify(mex).setVariable("allottedResourceId", "myid")
+ verify(mex, never()).setVariable("rollbackAAI", true)
+ verify(mex, never()).setVariable("aaiARPath", "mypath")
+ verify(mex).setVariable("rollbackSDNC", true)
+ verify(mex).setVariable("deactivateSdnc", "myactivate")
+ verify(mex).setVariable("deleteSdnc", "mycreate")
+ verify(mex).setVariable("unassignSdnc", "true")
+ verify(mex).setVariable("sdncDeactivateRequest", "activatereq")
+ verify(mex).setVariable("sdncDeleteRequest", "createreq")
+ verify(mex).setVariable("sdncUnassignRequest", "assignreq")
+
+ verify(mex, never()).setVariable("skipRollback", true)
+ }
+
+ @Test
+ public void preProcessRequest_NoAssign() {
+ ExecutionEntity mex = setupMock()
+ def data = initPreProcess(mex)
+
+ when(mex.getVariable("rollbackSDNC")).thenReturn(false)
+ data.put(RbType, "rollbackSDNCassign", "false")
+
+ DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
+ DoCreateAllottedResourceTXCRollback.preProcessRequest(mex)
+
+ verify(mex).setVariable("prefix", Prefix)
+ verify(mex).setVariable("serviceInstanceId", "sii")
+ verify(mex).setVariable("parentServiceInstanceId", "psii")
+ verify(mex).setVariable("allottedResourceId", "myid")
+ verify(mex).setVariable("rollbackAAI", true)
+ verify(mex).setVariable("aaiARPath", "mypath")
+ verify(mex, never()).setVariable("rollbackSDNC", true)
+ verify(mex, never()).setVariable("deactivateSdnc", "myactivate")
+ verify(mex, never()).setVariable("deleteSdnc", "mycreate")
+ verify(mex, never()).setVariable("unassignSdnc", "true")
+ verify(mex, never()).setVariable("sdncDeactivateRequest", "activatereq")
+ verify(mex, never()).setVariable("sdncDeleteRequest", "createreq")
+ verify(mex, never()).setVariable("sdncUnassignRequest", "assignreq")
+
+ verify(mex, never()).setVariable("skipRollback", true)
+ }
+
+ @Test
+ public void preProcessRequest_NoAAI_NoAssign() {
+ ExecutionEntity mex = setupMock()
+ initPreProcess(mex)
+
+ when(mex.getVariable("rollbackAAI")).thenReturn(false)
+ when(mex.getVariable("rollbackSDNC")).thenReturn(false)
+
+ DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
+ DoCreateAllottedResourceTXCRollback.preProcessRequest(mex)
+
+ verify(mex).setVariable("skipRollback", true)
+ }
+
+ @Test
+ public void preProcessRequest_NoRbStructure() {
+ ExecutionEntity mex = setupMock()
+ initPreProcess(mex)
+
+ when(mex.getVariable("rollbackData")).thenReturn(new RollbackData())
+
+ DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
+ DoCreateAllottedResourceTXCRollback.preProcessRequest(mex)
+
+ verify(mex).setVariable("skipRollback", true)
+ }
+
+ @Test
+ public void preProcessRequest_NullRb() {
+ ExecutionEntity mex = setupMock()
+ initPreProcess(mex)
+
+ when(mex.getVariable("rollbackData")).thenReturn(null)
+
+ DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
+ DoCreateAllottedResourceTXCRollback.preProcessRequest(mex)
+
+ verify(mex).setVariable("skipRollback", true)
+ }
+
+ @Test
+ public void preProcessRequest_BpmnError() {
+ ExecutionEntity mex = setupMock()
+ initPreProcess(mex)
+
+ when(mex.getVariable("rollbackData")).thenThrow(new BpmnError("expected exception"))
+
+ DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
+
+ assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXCRollback.preProcessRequest(mex) }))
+ }
+
+ @Test
+ public void preProcessRequest_Ex() {
+ ExecutionEntity mex = setupMock()
+ initPreProcess(mex)
+
+ when(mex.getVariable("rollbackData")).thenThrow(new RuntimeException("expected exception"))
+
+ DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
+
+ assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXCRollback.preProcessRequest(mex) }))
+ }
+
+ @Test
+ @Ignore
+ public void updateAaiAROrchStatus() {
+ ExecutionEntity mex = setupMock()
+ initUpdateAaiAROrchStatus(mex)
+
+ MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml")
+ MockPatchAllottedResource(CUST, SVC, INST, ARID)
+
+ DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
+ DoCreateAllottedResourceTXCRollback.updateAaiAROrchStatus(mex, "success")
+ }
+
+ @Test
+ public void updateAaiAROrchStatus_EmptyResponse() {
+ ExecutionEntity mex = setupMock()
+ initUpdateAaiAROrchStatus(mex)
+
+ wireMockRule
+ .stubFor(get(urlMatching("/aai/v[0-9]+/.*"))
+ .willReturn(aResponse()
+ .withStatus(200)))
+
+ DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
+
+ assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXCRollback.updateAaiAROrchStatus(mex, "success") }))
+ }
+
+ @Test
+ public void updateAaiAROrchStatus_NoArPath() {
+ ExecutionEntity mex = setupMock()
+ initUpdateAaiAROrchStatus(mex)
+
+ MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml")
+ MockPatchAllottedResource(CUST, SVC, INST, ARID)
+
+ when(mex.getVariable("aaiARPath")).thenReturn(null)
+
+ DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
+
+ assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXCRollback.updateAaiAROrchStatus(mex, "success") }))
+ }
+
+ // ***** validateSDNCResp *****
+
+ @Test
+ public void validateSDNCResp() {
+ ExecutionEntity mex = setupMock()
+ initValidateSDNCResp(mex)
+ def resp = initValidateSDNCResp_Resp()
+
+ when(mex.getVariable(Prefix + "sdncResponseSuccess")).thenReturn(true)
+
+ DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
+
+ DoCreateAllottedResourceTXCRollback.validateSDNCResp(mex, resp, "create")
+
+ verify(mex).getVariable("WorkflowException")
+ verify(mex).getVariable("SDNCA_SuccessIndicator")
+ }
+
+ @Test
+ public void validateSDNCResp_Unsuccessful() {
+ ExecutionEntity mex = setupMock()
+ initValidateSDNCResp(mex)
+ def resp = initValidateSDNCResp_Resp()
+
+ when(mex.getVariable(Prefix + "sdncResponseSuccess")).thenReturn(false)
+
+ DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
+
+ assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXCRollback.validateSDNCResp(mex, resp, "create") }))
+ }
+
+ @Test
+ public void validateSDNCResp_BpmnError404() {
+ ExecutionEntity mex = setupMock()
+ initValidateSDNCResp(mex)
+ def resp = initValidateSDNCResp_Resp()
+ when(mex.getVariable(Prefix + "sdncResponseSuccess")).thenReturn(true)
+
+ when(mex.getVariable("WorkflowException")).thenThrow(new BpmnError("404", "expected exception"))
+
+ DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
+
+ DoCreateAllottedResourceTXCRollback.validateSDNCResp(mex, resp, "create")
+ }
+
+ @Test
+ public void validateSDNCResp_BpmnError() {
+ ExecutionEntity mex = setupMock()
+ initValidateSDNCResp(mex)
+ def resp = initValidateSDNCResp_Resp()
+ when(mex.getVariable(Prefix + "sdncResponseSuccess")).thenReturn(true)
+
+ when(mex.getVariable("WorkflowException")).thenThrow(new BpmnError("expected exception"))
+
+ DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
+
+ assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXCRollback.validateSDNCResp(mex, resp, "create") }))
+ }
+
+ @Test
+ public void validateSDNCResp_Ex() {
+ ExecutionEntity mex = setupMock()
+ initValidateSDNCResp(mex)
+ def resp = initValidateSDNCResp_Resp()
+ when(mex.getVariable(Prefix + "sdncResponseSuccess")).thenReturn(true)
+
+ when(mex.getVariable("WorkflowException")).thenThrow(new RuntimeException("expected exception"))
+
+ DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
+
+ assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXCRollback.validateSDNCResp(mex, resp, "create") }))
+ }
+
+ @Test
+ @Ignore
+ public void deleteAaiAR() {
+ ExecutionEntity mex = setupMock()
+ initDeleteAaiAR(mex)
+
+ MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml")
+ MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS)
+
+ DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
+ DoCreateAllottedResourceTXCRollback.deleteAaiAR(mex)
+ }
+
+ @Test
+ public void deleteAaiAR_NoArPath() {
+ ExecutionEntity mex = setupMock()
+ initDeleteAaiAR(mex)
+
+ MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml")
+ MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS)
+
+ when(mex.getVariable("aaiARPath")).thenReturn("")
+
+ DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
+
+ assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXCRollback.deleteAaiAR(mex) }))
+ }
+
+ @Test
+ public void deleteAaiAR_BpmnError() {
+ ExecutionEntity mex = setupMock()
+ initDeleteAaiAR(mex)
+
+ MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml")
+ MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS)
+
+ when(mex.getVariable("aaiARPath")).thenThrow(new BpmnError("expected exception"))
+
+ DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
+
+ assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXCRollback.deleteAaiAR(mex) }))
+ }
+
+ @Test
+ public void deleteAaiAR_Ex() {
+ ExecutionEntity mex = setupMock()
+ initDeleteAaiAR(mex)
+
+ MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml")
+ MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS)
+
+ when(mex.getVariable("aaiARPath")).thenThrow(new RuntimeException("expected exception"))
+
+ DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
+
+ assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXCRollback.deleteAaiAR(mex) }))
+ }
+
+ @Test
+ public void postProcessRequest() {
+ ExecutionEntity mex = setupMock()
+ initPostProcessRequest(mex)
+
+ DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
+ DoCreateAllottedResourceTXCRollback.postProcessRequest(mex)
+
+ verify(mex).setVariable("rollbackData", null)
+ verify(mex).setVariable("rolledBack", true)
+ }
+
+ @Test
+ public void postProcessRequest_RolledBack() {
+ ExecutionEntity mex = setupMock()
+ initPostProcessRequest(mex)
+
+ when(mex.getVariable("skipRollback")).thenReturn(true)
+
+ DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
+ DoCreateAllottedResourceTXCRollback.postProcessRequest(mex)
+
+ verify(mex).setVariable("rollbackData", null)
+ verify(mex, never()).setVariable("rolledBack", true)
+ }
+
+ @Test
+ public void postProcessRequest_BpmnError() {
+ ExecutionEntity mex = setupMock()
+ initPostProcessRequest(mex)
+
+ when(mex.getVariable("skipRollback")).thenThrow(new BpmnError("expected exception"))
+
+ DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
+ DoCreateAllottedResourceTXCRollback.postProcessRequest(mex)
+
+ verify(mex).setVariable("rollbackData", null)
+ verify(mex, never()).setVariable("rolledBack", true)
+ }
+
+ @Test
+ public void postProcessRequest_Ex() {
+ ExecutionEntity mex = setupMock()
+ initPostProcessRequest(mex)
+
+ when(mex.getVariable("skipRollback")).thenThrow(new RuntimeException("expected exception"))
+
+ DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
+ DoCreateAllottedResourceTXCRollback.postProcessRequest(mex)
+
+ verify(mex).setVariable("rollbackData", null)
+ verify(mex, never()).setVariable("rolledBack", true)
+ }
+
+ @Test
+ public void processRollbackException() {
+ ExecutionEntity mex = setupMock()
+ initProcessRollbackException(mex)
+
+ DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
+ DoCreateAllottedResourceTXCRollback.processRollbackException(mex)
+
+ verify(mex).setVariable("rollbackData", null)
+ verify(mex).setVariable("rolledBack", false)
+ verify(mex).setVariable("rollbackError", "Caught exception in AllottedResource Create Rollback")
+ verify(mex).setVariable("WorkflowException", null)
+ }
+
+ @Test
+ public void processRollbackException_BpmnError() {
+ ExecutionEntity mex = setupMock()
+ initProcessRollbackException(mex)
+
+ doThrow(new BpmnError("expected exception")).when(mex).setVariable("rollbackData", null)
+
+ DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
+ DoCreateAllottedResourceTXCRollback.processRollbackException(mex)
+ }
+
+ @Test
+ public void processRollbackException_Ex() {
+ ExecutionEntity mex = setupMock()
+ initProcessRollbackException(mex)
+
+ doThrow(new RuntimeException("expected exception")).when(mex).setVariable("rollbackData", null)
+
+ DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
+ DoCreateAllottedResourceTXCRollback.processRollbackException(mex)
+ }
+
+ @Test
+ public void processRollbackJavaException() {
+ ExecutionEntity mex = setupMock()
+ initProcessRollbackException(mex)
+
+ DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
+ DoCreateAllottedResourceTXCRollback.processRollbackJavaException(mex)
+
+ verify(mex).setVariable("rollbackData", null)
+ verify(mex).setVariable("rolledBack", false)
+ verify(mex).setVariable("rollbackError", "Caught Java exception in AllottedResource Create Rollback")
+ verify(mex, never()).setVariable("WorkflowException", null)
+ }
+
+ @Test
+ public void processRollbackJavaException_BpmnError() {
+ ExecutionEntity mex = setupMock()
+ initProcessRollbackException(mex)
+
+ doThrow(new BpmnError("expected exception")).when(mex).setVariable("rollbackData", null)
+
+ DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
+ DoCreateAllottedResourceTXCRollback.processRollbackJavaException(mex)
+ }
+
+ @Test
+ public void processRollbackJavaException_Ex() {
+ ExecutionEntity mex = setupMock()
+ initProcessRollbackException(mex)
+
+ doThrow(new RuntimeException("expected exception")).when(mex).setVariable("rollbackData", null)
+
+ DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
+ DoCreateAllottedResourceTXCRollback.processRollbackJavaException(mex)
+ }
+
+ private RollbackData initPreProcess(ExecutionEntity mex) {
+ def data = new RollbackData()
+
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("rollbackData")).thenReturn(data)
+ when(mex.getVariable("rollbackAAI")).thenReturn(true)
+ when(mex.getVariable("rollbackSDNC")).thenReturn(true)
+ when(mex.getVariable("disableRollback")).thenReturn("false")
+
+ data.put("SERVICEINSTANCE", "allottedResourceId", "myid")
+
+ data.put(RbType, "serviceInstanceId", "sii")
+ data.put(RbType, "parentServiceInstanceId", "psii")
+
+ data.put(RbType, "rollbackAAI", "true")
+ data.put(RbType, "aaiARPath", "mypath")
+
+ data.put(RbType, "rollbackSDNCassign", "true")
+ data.put(RbType, "rollbackSDNCactivate", "myactivate")
+ data.put(RbType, "rollbackSDNCcreate", "mycreate")
+ data.put(RbType, "sdncActivateRollbackReq", "activatereq")
+ data.put(RbType, "sdncCreateRollbackReq", "createreq")
+ data.put(RbType, "sdncAssignRollbackReq", "assignreq")
+
+ return data
+ }
+
+ private initUpdateAaiAROrchStatus(ExecutionEntity mex) {
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("aaiARPath")).thenReturn("/business/customers/customer/" + CUST + "/service-subscriptions/service-subscription/" + SVC + "/service-instances/service-instance/" + INST + "/allotted-resources/allotted-resource/" + ARID)
+ when(mex.getVariable("aai.endpoint")).thenReturn(aaiUriPfx)
+ }
+
+ private initValidateSDNCResp(ExecutionEntity mex) {
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("prefix")).thenReturn(Prefix)
+ when(mex.getVariable("SDNCA_SuccessIndicator")).thenReturn(true)
+ }
+
+ private String initValidateSDNCResp_Resp() {
+ return "<response-data>&lt;response-code&gt;200&lt;/response-code&gt;</response-data>"
+ }
+
+ private initDeleteAaiAR(ExecutionEntity mex) {
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("aaiARResourceVersion")).thenReturn(VERS)
+ when(mex.getVariable("aaiARPath")).thenReturn("/business/customers/customer/" + CUST + "/service-subscriptions/service-subscription/" + SVC + "/service-instances/service-instance/" + INST + "/allotted-resources/allotted-resource/" + ARID)
+ when(mex.getVariable("aai.endpoint")).thenReturn(aaiUriPfx)
+ }
+
+ private initPostProcessRequest(ExecutionEntity mex) {
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("skipRollback")).thenReturn(false)
+ }
+
+ private initProcessRollbackException(ExecutionEntity mex) {
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ }
+
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCTest.groovy
index b759ca1c20..b53e5fce21 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCTest.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCTest.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -20,15 +22,10 @@
package org.onap.so.bpmn.vcpe.scripts
-
+import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity
-import org.junit.Before
-import org.junit.BeforeClass
-import org.junit.Rule
-import org.junit.Test
-import org.junit.Ignore
+import org.junit.*
import org.mockito.MockitoAnnotations
-import org.camunda.bpm.engine.delegate.BpmnError
import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.bpmn.mock.FileUtil
@@ -38,7 +35,7 @@ import org.onap.so.client.aai.entities.uri.AAIUriFactory
import javax.ws.rs.core.UriBuilder
-import static org.junit.Assert.*;
+import static org.junit.Assert.*
import static org.mockito.Mockito.*
import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetAllottedResource
import static org.onap.so.bpmn.mock.StubResponseAAI.MockPatchAllottedResource
@@ -50,860 +47,808 @@ import org.onap.so.bpmn.core.RollbackData
import com.github.tomakehurst.wiremock.junit.WireMockRule
class DoCreateAllottedResourceTXCTest extends GroovyTestBase {
-
- @Rule
- public WireMockRule wireMockRule = new WireMockRule(PORT)
- String Prefix = "DCARTXC_"
+ @Rule
+ public WireMockRule wireMockRule = new WireMockRule(PORT)
+
+ String Prefix = "DCARTXC_"
+
+ @BeforeClass
+ public static void setUpBeforeClass() {
+ aaiUriPfx = UrnPropertiesReader.getVariable("aai.endpoint")
+ }
- @BeforeClass
- public static void setUpBeforeClass() {
- aaiUriPfx = UrnPropertiesReader.getVariable("aai.endpoint")
- }
-
@Before
- public void init()
- {
- MockitoAnnotations.initMocks(this)
- }
-
- public DoCreateAllottedResourceTXCTest() {
- super("DoCreateAllottedResourceTXC")
- }
-
-
- // ***** preProcessRequest *****
-
- @Test
-
- public void preProcessRequest() {
- ExecutionEntity mex = setupMock()
- initPreProcess(mex)
-
- DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
- DoCreateAllottedResourceTXC.preProcessRequest(mex)
-
- //verify(mex).getVariable(DBGFLAG)
- verify(mex).setVariable("prefix", Prefix)
-
- assertTrue(checkMissingPreProcessRequest("mso.workflow.sdncadapter.callback"))
- assertTrue(checkMissingPreProcessRequest("mso.workflow.sdnc.replication.delay"))
- assertTrue(checkMissingPreProcessRequest("serviceInstanceId"))
- assertTrue(checkMissingPreProcessRequest("parentServiceInstanceId"))
- assertTrue(checkMissingPreProcessRequest("allottedResourceModelInfo"))
- assertTrue(checkMissingPreProcessRequest("brgWanMacAddress"))
- assertTrue(checkMissingPreProcessRequest("allottedResourceRole"))
- assertTrue(checkMissingPreProcessRequest("allottedResourceType"))
- }
-
-
- // ***** getAaiAR *****
-
- @Test
- @Ignore
- public void getAaiAR() {
- MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXC/getArTxc.xml")
-
- ExecutionEntity mex = setupMock()
- initGetAaiAR(mex)
-
- DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
- DoCreateAllottedResourceTXC.getAaiAR(mex)
-
- verify(mex).setVariable("foundActiveAR", true)
- }
-
- @Test
-
- public void getAaiAR_Duplicate() {
- MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXC/getArTxc.xml")
-
- ExecutionEntity mex = setupMock()
- initGetAaiAR(mex)
-
- // fail if duplicate
- when(mex.getVariable("failExists")).thenReturn("true")
-
- DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
-
- assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceTXC.getAaiAR(mex) }))
- }
-
- @Test
-
- public void getAaiAR_NotActive() {
- MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXC/getArTxc.xml")
-
- ExecutionEntity mex = setupMock()
- initGetAaiAR(mex)
-
- // not active
- when(mex.getVariable("aaiAROrchStatus")).thenReturn("not-active")
-
- DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
-
- assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceTXC.getAaiAR(mex) }))
- }
-
- @Test
- @Ignore
- public void getAaiAR_NoStatus() {
- MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXC/getArTxc.xml")
-
- ExecutionEntity mex = setupMock()
- initGetAaiAR(mex)
-
- when(mex.getVariable("aaiAROrchStatus")).thenReturn(null)
-
- DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
- DoCreateAllottedResourceTXC.getAaiAR(mex)
-
- verify(mex, never()).setVariable("foundActiveAR", true)
- }
-
-
- // ***** createAaiAR *****
-
- @Test
- public void createAaiAR() {
- ExecutionEntity mex = setupMock()
- initCreateAaiAr(mex)
- when(mex.getVariable("PSI_resourceLink")).thenReturn(AAIUriFactory.createResourceFromExistingURI(AAIObjectType.SERVICE_INSTANCE, UriBuilder.fromPath( "/aai/v9/business/customers/customer/"+CUST+"/service-subscriptions/service-subscription/"+SVC+"/service-instances/service-instance/"+INST).build()))
- when(mex.getVariable("CSI_resourceLink")).thenReturn("/aai/v9/business/customers/customer/"+CUST+"/service-subscriptions/service-subscription/"+SVC+"/service-instances/service-instance/"+INST)
- when(mex.getVariable("allottedResourceModelInfo")).thenReturn("{\n" +
- " \"modelInvariantUuid\":\"modelInvariantUuid\",\n" +
- " \"modelUuid\" : \"modelUuid\"\n" +
- "}")
- AAIResourcesClient client = mock(AAIResourcesClient.class)
- DoCreateAllottedResourceTXC doCreateAllottedResourceTXC = spy(DoCreateAllottedResourceTXC.class)
- when(doCreateAllottedResourceTXC.getAAIClient()).thenReturn(client)
- doCreateAllottedResourceTXC.createAaiAR(mex)
- }
-
-
- @Test
- public void createAaiAR_MissingPsiLink() {
- ExecutionEntity mex = setupMock()
- initCreateAaiAr(mex)
-
- when(mex.getVariable("PSI_resourceLink")).thenReturn(null)
-
- MockPutAllottedResource(CUST, SVC, INST, ARID)
-
- DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
-
- assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXC.createAaiAR(mex) }))
- }
-
- @Test
-
- public void createAaiAR_HttpFailed() {
- ExecutionEntity mex = setupMock()
- initCreateAaiAr(mex)
-
- MockPutAllottedResource_500(CUST, SVC, INST, ARID)
-
- DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
-
- assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXC.createAaiAR(mex) }))
- }
-
- @Test
-
- public void createAaiAR_BpmnError() {
- ExecutionEntity mex = setupMock()
- initCreateAaiAr(mex)
-
- when(mex.getVariable("aai.endpoint")).thenThrow(new BpmnError("expected exception"))
-
- MockPutAllottedResource(CUST, SVC, INST, ARID)
-
- DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
-
- assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXC.createAaiAR(mex) }))
- }
-
- @Test
-
- public void createAaiAR_Ex() {
- ExecutionEntity mex = setupMock()
- initCreateAaiAr(mex)
-
- when(mex.getVariable("aai.endpoint")).thenThrow(new RuntimeException("expected exception"))
-
- MockPutAllottedResource(CUST, SVC, INST, ARID)
-
- DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
-
- assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXC.createAaiAR(mex) }))
- }
-
-
- // ***** buildSDNCRequest *****
-
- @Test
-
- public void buildSDNCRequest() {
- ExecutionEntity mex = setupMock()
- initBuildSDNCRequest(mex)
-
- DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
-
- String result = DoCreateAllottedResourceTXC.buildSDNCRequest(mex, "myact", "myreq")
-
- assertTrue(result.indexOf("<sdncadapter:RequestId>myreq</") >= 0)
- assertTrue(result.indexOf("<sdncadapter:SvcAction>myact</") >= 0)
- assertTrue(result.indexOf("<allotted-resource-id>ari</") >= 0)
- assertTrue(result.indexOf("<sdncadapter:SvcInstanceId>sii</") >= 0)
- assertTrue(result.indexOf("<service-instance-id>sii</") >= 0)
- assertTrue(result.indexOf("<parent-service-instance-id>psii</") >= 0)
- assertTrue(result.indexOf("<subscription-service-type>sst</") >= 0)
- assertTrue(result.indexOf("<global-customer-id>gci</") >= 0)
- assertTrue(result.indexOf("<sdncadapter:CallbackUrl>scu</") >= 0)
- assertTrue(result.indexOf("<request-id>mri</") >= 0)
- assertTrue(result.indexOf("<model-invariant-uuid/>") >= 0)
- assertTrue(result.indexOf("<model-uuid/>") >= 0)
- assertTrue(result.indexOf("<model-customization-uuid/>") >= 0)
- assertTrue(result.indexOf("<model-version/>") >= 0)
- assertTrue(result.indexOf("<model-name/>") >= 0)
- }
-
- @Test
-
- public void buildSDNCRequest_Ex() {
- ExecutionEntity mex = setupMock()
- initBuildSDNCRequest(mex)
-
- when(mex.getVariable("allottedResourceId")).thenThrow(new RuntimeException("expected exception"))
-
- DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
-
- assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXC.buildSDNCRequest(mex, "myact", "myreq") }))
- }
-
-
- // ***** preProcessSDNCAssign *****
-
- @Test
-
- public void preProcessSDNCAssign() {
- ExecutionEntity mex = setupMock()
- def map = setupMap(mex)
- def data = initPreProcessSDNC(mex)
-
- DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
- DoCreateAllottedResourceTXC.preProcessSDNCAssign(mex)
-
- def req = map.get("sdncAssignRequest")
- assertNotNull(req)
-
- assertEquals(data, map.get("rollbackData"))
-
- def rbreq = data.get(Prefix, "sdncAssignRollbackReq")
-
- assertTrue(req.indexOf("<sdncadapter:SvcAction>assign</") >= 0)
- assertTrue(req.indexOf("<request-action>CreateTunnelXConnInstance</") >= 0)
- assertTrue(req.indexOf("<sdncadapter:RequestId>") >= 0)
-
- assertTrue(rbreq.indexOf("<sdncadapter:SvcAction>unassign</") >= 0)
- assertTrue(rbreq.indexOf("<request-action>DeleteTunnelXConnInstance</") >= 0)
- assertTrue(rbreq.indexOf("<sdncadapter:RequestId>") >= 0)
- }
-
- @Test
-
- public void preProcessSDNCAssign_BpmnError() {
- ExecutionEntity mex = setupMock()
- initPreProcessSDNC(mex)
-
- when(mex.getVariable("rollbackData")).thenThrow(new BpmnError("expected exception"))
-
- DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
-
- assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXC.preProcessSDNCAssign(mex) }))
- }
-
- @Test
-
- public void preProcessSDNCAssign_Ex() {
- ExecutionEntity mex = setupMock()
- initPreProcessSDNC(mex)
-
- when(mex.getVariable("rollbackData")).thenThrow(new RuntimeException("expected exception"))
-
- DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
-
- assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXC.preProcessSDNCAssign(mex) }))
- }
-
-
- // ***** preProcessSDNCCreate *****
-
- @Test
-
- public void preProcessSDNCCreate() {
- ExecutionEntity mex = setupMock()
- def map = setupMap(mex)
- def data = initPreProcessSDNC(mex)
-
- DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
- DoCreateAllottedResourceTXC.preProcessSDNCCreate(mex)
-
- def req = map.get("sdncCreateRequest")
- assertNotNull(req)
-
- assertEquals(data, map.get("rollbackData"))
-
- def rbreq = data.get(Prefix, "sdncCreateRollbackReq")
-
- assertTrue(req.indexOf("<sdncadapter:SvcAction>create</") >= 0)
- assertTrue(req.indexOf("<request-action>CreateTunnelXConnInstance</") >= 0)
- assertTrue(req.indexOf("<sdncadapter:RequestId>") >= 0)
-
- assertTrue(rbreq.indexOf("<sdncadapter:SvcAction>delete</") >= 0)
- assertTrue(rbreq.indexOf("<request-action>DeleteTunnelXConnInstance</") >= 0)
- assertTrue(rbreq.indexOf("<sdncadapter:RequestId>") >= 0)
-
- }
-
- @Test
-
- public void preProcessSDNCCreate_BpmnError() {
- ExecutionEntity mex = setupMock()
- initPreProcessSDNC(mex)
-
- when(mex.getVariable("rollbackData")).thenThrow(new BpmnError("expected exception"))
-
- DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
-
- assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXC.preProcessSDNCCreate(mex) }))
- }
-
- @Test
-
- public void preProcessSDNCCreate_Ex() {
- ExecutionEntity mex = setupMock()
- initPreProcessSDNC(mex)
-
- when(mex.getVariable("rollbackData")).thenThrow(new RuntimeException("expected exception"))
-
- DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
-
- assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXC.preProcessSDNCCreate(mex) }))
- }
-
-
- // ***** preProcessSDNCActivate *****
-
- @Test
-
- public void preProcessSDNCActivate() {
- ExecutionEntity mex = setupMock()
- def map = setupMap(mex)
- def data = initPreProcessSDNC(mex)
-
- DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
- DoCreateAllottedResourceTXC.preProcessSDNCActivate(mex)
-
- def req = map.get("sdncActivateRequest")
- assertNotNull(req)
-
- assertEquals(data, map.get("rollbackData"))
-
- def rbreq = data.get(Prefix, "sdncActivateRollbackReq")
-
- assertTrue(req.indexOf("<sdncadapter:SvcAction>activate</") >= 0)
- assertTrue(req.indexOf("<request-action>CreateTunnelXConnInstance</") >= 0)
- assertTrue(req.indexOf("<sdncadapter:RequestId>") >= 0)
-
- assertTrue(rbreq.indexOf("<sdncadapter:SvcAction>deactivate</") >= 0)
- assertTrue(rbreq.indexOf("<request-action>DeleteTunnelXConnInstance</") >= 0)
- assertTrue(rbreq.indexOf("<sdncadapter:RequestId>") >= 0)
-
- }
-
- @Test
-
- public void preProcessSDNCActivate_BpmnError() {
- ExecutionEntity mex = setupMock()
- initPreProcessSDNC(mex)
-
- when(mex.getVariable("rollbackData")).thenThrow(new BpmnError("expected exception"))
-
- DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
-
- assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXC.preProcessSDNCActivate(mex) }))
- }
-
- @Test
-
- public void preProcessSDNCActivate_Ex() {
- ExecutionEntity mex = setupMock()
- initPreProcessSDNC(mex)
-
- when(mex.getVariable("rollbackData")).thenThrow(new RuntimeException("expected exception"))
-
- DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
-
- assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXC.preProcessSDNCActivate(mex) }))
- }
-
-
- // ***** validateSDNCResp *****
-
- @Test
-
- public void validateSDNCResp() {
- ExecutionEntity mex = setupMock()
- def map = setupMap(mex)
- def data = initValidateSDNCResp(mex)
- def resp = initValidateSDNCResp_Resp()
-
- when(mex.getVariable(Prefix+"sdncResponseSuccess")).thenReturn(true)
-
- DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
-
- DoCreateAllottedResourceTXC.validateSDNCResp(mex, resp, "create")
-
- verify(mex).getVariable("WorkflowException")
- verify(mex).getVariable("SDNCA_SuccessIndicator")
- verify(mex).getVariable("rollbackData")
-
- assertEquals(data, map.get("rollbackData"))
-
- assertEquals("true", data.get(Prefix, "rollback" + "SDNCcreate"))
-
- }
-
- @Test
-
- public void validateSDNCResp_Get() {
- ExecutionEntity mex = setupMock()
- def data = initValidateSDNCResp(mex)
- def resp = initValidateSDNCResp_Resp()
-
- when(mex.getVariable(Prefix+"sdncResponseSuccess")).thenReturn(true)
-
- DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
-
- DoCreateAllottedResourceTXC.validateSDNCResp(mex, resp, "get")
-
- verify(mex).getVariable("WorkflowException")
- verify(mex).getVariable("SDNCA_SuccessIndicator")
-
- verify(mex, never()).getVariable("rollbackData")
- }
-
- @Test
-
- public void validateSDNCResp_Unsuccessful() {
- ExecutionEntity mex = setupMock()
- initValidateSDNCResp(mex)
- def resp = initValidateSDNCResp_Resp()
-
- // unsuccessful
- when(mex.getVariable(Prefix+"sdncResponseSuccess")).thenReturn(false)
-
- DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
-
- assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXC.validateSDNCResp(mex, resp, "create") }))
- }
-
- @Test
-
- public void validateSDNCResp_BpmnError() {
- ExecutionEntity mex = setupMock()
- initValidateSDNCResp(mex)
- def resp = initValidateSDNCResp_Resp()
-
- when(mex.getVariable("WorkflowException")).thenThrow(new BpmnError("expected exception"))
-
- DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
-
- assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXC.validateSDNCResp(mex, resp, "create") }))
- }
-
- @Test
-
- public void validateSDNCResp_Ex() {
- ExecutionEntity mex = setupMock()
- initValidateSDNCResp(mex)
- def resp = initValidateSDNCResp_Resp()
-
- when(mex.getVariable("WorkflowException")).thenThrow(new RuntimeException("expected exception"))
-
- DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
-
- assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXC.validateSDNCResp(mex, resp, "create") }))
- }
-
-
- // ***** preProcessSDNCGet *****
-
- @Test
-
- public void preProcessSDNCGet_FoundAR() {
- ExecutionEntity mex = setupMock()
- def map = setupMap(mex)
- initPreProcessSDNCGet(mex)
-
- DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
- DoCreateAllottedResourceTXC.preProcessSDNCGet(mex)
-
- String req = map.get("sdncGetRequest")
-
- assertTrue(req.indexOf("<sdncadapter:RequestId>") >= 0)
- assertTrue(req.indexOf("<sdncadapter:SvcInstanceId>sii</") >= 0)
- assertTrue(req.indexOf("<sdncadapter:SvcOperation>arlink</") >= 0)
- assertTrue(req.indexOf("<sdncadapter:CallbackUrl>myurl</") >= 0)
-
- }
-
- @Test
-
- public void preProcessSDNCGet_NotFoundAR() {
- ExecutionEntity mex = setupMock()
- def map = setupMap(mex)
- initPreProcessSDNCGet(mex)
-
- when(mex.getVariable("foundActiveAR")).thenReturn(false)
-
- DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
- DoCreateAllottedResourceTXC.preProcessSDNCGet(mex)
-
- String req = map.get("sdncGetRequest")
-
- assertTrue(req.indexOf("<sdncadapter:RequestId>") >= 0)
- assertTrue(req.indexOf("<sdncadapter:SvcInstanceId>sii</") >= 0)
- assertTrue(req.indexOf("<sdncadapter:SvcOperation>assignlink</") >= 0)
- assertTrue(req.indexOf("<sdncadapter:CallbackUrl>myurl</") >= 0)
-
- }
-
- @Test
-
- public void preProcessSDNCGet_Ex() {
- ExecutionEntity mex = setupMock()
- initPreProcessSDNCGet(mex)
-
- when(mex.getVariable("foundActiveAR")).thenThrow(new RuntimeException("expected exception"))
-
- DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
-
- assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXC.preProcessSDNCGet(mex) }))
- }
-
-
- // ***** updateAaiAROrchStatus *****
-
- @Test
- @Ignore
- public void updateAaiAROrchStatus() {
- MockPatchAllottedResource(CUST, SVC, INST, ARID)
-
- ExecutionEntity mex = setupMock()
- initUpdateAaiAROrchStatus(mex)
-
- DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
- DoCreateAllottedResourceTXC.updateAaiAROrchStatus(mex, "success")
- }
-
-
- // ***** generateOutputs *****
-
- @Test
-
- public void generateOutputs() {
- ExecutionEntity mex = setupMock()
- def txctop = FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceTXC/SDNCTopologyQueryCallback.xml")
-
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("enhancedCallbackRequestData")).thenReturn(txctop)
-
- DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
- DoCreateAllottedResourceTXC.generateOutputs(mex)
-
- verify(mex).setVariable("allotedResourceName", "namefromrequest")
- verify(mex).setVariable("vni", "my-vni")
- verify(mex).setVariable("vgmuxBearerIP", "my-bearer-ip")
- verify(mex).setVariable("vgmuxLanIP", "my-lan-ip")
-
- }
-
- @Test
-
- public void generateOutputs_BadXml() {
- ExecutionEntity mex = setupMock()
-
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("enhancedCallbackRequestData")).thenReturn("invalid xml")
-
- DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
- DoCreateAllottedResourceTXC.generateOutputs(mex)
-
- verify(mex, never()).setVariable(anyString(), anyString())
-
- }
-
- @Test
-
- public void generateOutputs_BpmnError() {
- ExecutionEntity mex = setupMock()
-
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("enhancedCallbackRequestData")).thenThrow(new BpmnError("expected exception"))
-
- DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
-
- DoCreateAllottedResourceTXC.generateOutputs(mex)
- verify(mex, never()).setVariable(anyString(), anyString())
-
- }
-
- @Test
-
- public void generateOutputs_Ex() {
- ExecutionEntity mex = setupMock()
-
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("enhancedCallbackRequestData")).thenThrow(new RuntimeException("expected exception"))
-
- DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
-
- DoCreateAllottedResourceTXC.generateOutputs(mex)
- verify(mex, never()).setVariable(anyString(), anyString())
-
- }
-
-
- // ***** preProcessRollback *****
-
- @Test
-
- public void preProcessRollback() {
- ExecutionEntity mex = setupMock()
- WorkflowException wfe = mock(WorkflowException.class)
-
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("WorkflowException")).thenReturn(wfe)
-
- DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
- DoCreateAllottedResourceTXC.preProcessRollback(mex)
-
- verify(mex).setVariable("prevWorkflowException", wfe)
-
- }
-
- @Test
-
- public void preProcessRollback_NotWFE() {
- ExecutionEntity mex = setupMock()
-
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("WorkflowException")).thenReturn("I'm not a WFE")
-
- DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
- DoCreateAllottedResourceTXC.preProcessRollback(mex)
-
-// verify(mex, never()).setVariable("prevWorkflowException", any())
-
- }
-
- @Test
-
- public void preProcessRollback_BpmnError() {
- ExecutionEntity mex = setupMock()
-
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("WorkflowException")).thenThrow(new BpmnError("expected exception"))
-
- DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
-
- DoCreateAllottedResourceTXC.preProcessRollback(mex)
-
- }
-
- @Test
-
- public void preProcessRollback_Ex() {
- ExecutionEntity mex = setupMock()
-
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("WorkflowException")).thenThrow(new RuntimeException("expected exception"))
-
- DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
-
- DoCreateAllottedResourceTXC.preProcessRollback(mex)
-
- }
-
-
- // ***** postProcessRollback *****
-
- @Test
-
- public void postProcessRollback() {
- ExecutionEntity mex = setupMock()
- WorkflowException wfe = mock(WorkflowException.class)
-
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("prevWorkflowException")).thenReturn(wfe)
-
- DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
- DoCreateAllottedResourceTXC.postProcessRollback(mex)
-
- verify(mex).setVariable("WorkflowException", wfe)
- verify(mex).setVariable("rollbackData", null)
-
- }
-
- @Test
-
- public void postProcessRollback_NotWFE() {
- ExecutionEntity mex = setupMock()
-
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("prevWorkflowException")).thenReturn("I'm not a WFE")
-
- DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
- DoCreateAllottedResourceTXC.postProcessRollback(mex)
-
-// verify(mex, never()).setVariable("WorkflowException", any())
- verify(mex).setVariable("rollbackData", null)
-
- }
-
- @Test
-
- public void postProcessRollback_BpmnError() {
- ExecutionEntity mex = setupMock()
-
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("prevWorkflowException")).thenThrow(new BpmnError("expected exception"))
-
- DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
-
- assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXC.postProcessRollback(mex) }))
- verify(mex, never()).setVariable("rollbackData", null)
-
- }
-
- @Test
-
- public void postProcessRollback_Ex() {
- ExecutionEntity mex = setupMock()
-
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("prevWorkflowException")).thenThrow(new RuntimeException("expected exception"))
-
- DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
-
- DoCreateAllottedResourceTXC.postProcessRollback(mex)
- verify(mex, never()).setVariable("rollbackData", null)
-
- }
-
- private boolean checkMissingPreProcessRequest(String fieldnm) {
- ExecutionEntity mex = setupMock()
- initPreProcess(mex)
-
- DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
-
- when(mex.getVariable(fieldnm)).thenReturn("")
-
- return doBpmnError( { _ -> DoCreateAllottedResourceTXC.preProcessRequest(mex) })
- }
-
- private void initPreProcess(ExecutionEntity mex) {
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("mso.workflow.sdncadapter.callback")).thenReturn("sdncurn")
- when(mex.getVariable("mso.workflow.sdnc.replication.delay")).thenReturn("sdncdelay")
- when(mex.getVariable("serviceInstanceId")).thenReturn("sii")
- when(mex.getVariable("parentServiceInstanceId")).thenReturn("psii")
- when(mex.getVariable("allottedResourceModelInfo")).thenReturn("armi")
- when(mex.getVariable("brgWanMacAddress")).thenReturn("bwma")
- when(mex.getVariable("allottedResourceRole")).thenReturn("arr")
- when(mex.getVariable("allottedResourceType")).thenReturn("art")
- }
-
- private void initGetAaiAR(ExecutionEntity mex) {
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("allottedResourceType")).thenReturn("TXCt")
- when(mex.getVariable("allottedResourceRole")).thenReturn("TXCr")
- when(mex.getVariable("CSI_service")).thenReturn(FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceTXC/getAR.xml"))
- when(mex.getVariable("aai.endpoint")).thenReturn(aaiUriPfx)
- when(mex.getVariable("aaiAROrchStatus")).thenReturn("Active")
- }
-
- private initCreateAaiAr(ExecutionEntity mex) {
- when(mex.getVariable("disableRollback")).thenReturn(45)
- when(mex.getVariable("serviceInstanceId")).thenReturn("sii")
- when(mex.getVariable("parentServiceInstanceId")).thenReturn("psii")
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("allottedResourceId")).thenReturn(ARID)
- when(mex.getVariable("aai.endpoint")).thenReturn(aaiUriPfx)
- when(mex.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn(UrnPropertiesReader.getVariable("mso.workflow.global.default.aai.namespace"))
- when(mex.getVariable("PSI_resourceLink")).thenReturn(AAIUriFactory.createResourceFromExistingURI(AAIObjectType.SERVICE_INSTANCE, UriBuilder.fromPath( "/business/customers/customer/"+CUST+"/service-subscriptions/service-subscription/"+SVC+"/service-instances/service-instance/"+INST).build()))
- when(mex.getVariable("allottedResourceType")).thenReturn("TXCt")
- when(mex.getVariable("allottedResourceRole")).thenReturn("TXCr")
- when(mex.getVariable("CSI_resourceLink")).thenReturn(aaiUriPfx+"/aai/v9/mycsi")
- when(mex.getVariable("allottedResourceModelInfo")).thenReturn("""
- {
- "modelInvariantUuid":"modelinvuuid",
- "modelUuid":"modeluuid",
- "modelCustomizationUuid":"modelcustuuid"
- }
- """)
- }
-
- private initBuildSDNCRequest(ExecutionEntity mex) {
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("allottedResourceId")).thenReturn("ari")
- when(mex.getVariable("serviceInstanceId")).thenReturn("sii")
- when(mex.getVariable("parentServiceInstanceId")).thenReturn("psii")
- when(mex.getVariable("subscriptionServiceType")).thenReturn("sst")
- when(mex.getVariable("globalCustomerId")).thenReturn("gci")
- when(mex.getVariable("sdncCallbackUrl")).thenReturn("scu")
- when(mex.getVariable("msoRequestId")).thenReturn("mri")
- }
-
- private RollbackData initPreProcessSDNC(ExecutionEntity mex) {
- def data = new RollbackData()
-
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("rollbackData")).thenReturn(data)
-
- return data
- }
-
- private initPreProcessSDNCGet(ExecutionEntity mex) {
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("sdncCallbackUrl")).thenReturn("myurl")
- when(mex.getVariable("foundActiveAR")).thenReturn(true)
- when(mex.getVariable("aaiARGetResponse")).thenReturn("<selflink>arlink</selflink>")
- when(mex.getVariable("sdncAssignResponse")).thenReturn("<response-data>&lt;object-path&gt;assignlink&lt;/object-path&gt;</response-data>")
- when(mex.getVariable("serviceInstanceId")).thenReturn("sii")
- when(mex.getVariable("sdncCallbackUrl")).thenReturn("myurl")
- }
-
- private RollbackData initValidateSDNCResp(ExecutionEntity mex) {
- def data = new RollbackData()
-
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("prefix")).thenReturn(Prefix)
- when(mex.getVariable("SDNCA_SuccessIndicator")).thenReturn(true)
- when(mex.getVariable("rollbackData")).thenReturn(data)
-
- return data
- }
-
- private String initValidateSDNCResp_Resp() {
- return "<response-data>&lt;response-code&gt;200&lt;/response-code&gt;</response-data>"
- }
-
- private initUpdateAaiAROrchStatus(ExecutionEntity mex) {
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("aaiARPath")).thenReturn("/business/customers/customer/"+CUST+"/service-subscriptions/service-subscription/"+SVC+"/service-instances/service-instance/"+INST+"/allotted-resources/allotted-resource/"+ARID)
- }
-
+ public void init() {
+ MockitoAnnotations.initMocks(this)
+ }
+
+ public DoCreateAllottedResourceTXCTest() {
+ super("DoCreateAllottedResourceTXC")
+ }
+
+ // ***** preProcessRequest *****
+ @Test
+ public void preProcessRequest() {
+ ExecutionEntity mex = setupMock()
+ initPreProcess(mex)
+
+ DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+ DoCreateAllottedResourceTXC.preProcessRequest(mex)
+
+ verify(mex).setVariable("prefix", Prefix)
+
+ assertTrue(checkMissingPreProcessRequest("mso.workflow.sdncadapter.callback"))
+ assertTrue(checkMissingPreProcessRequest("mso.workflow.sdnc.replication.delay"))
+ assertTrue(checkMissingPreProcessRequest("serviceInstanceId"))
+ assertTrue(checkMissingPreProcessRequest("parentServiceInstanceId"))
+ assertTrue(checkMissingPreProcessRequest("allottedResourceModelInfo"))
+ assertTrue(checkMissingPreProcessRequest("brgWanMacAddress"))
+ assertTrue(checkMissingPreProcessRequest("allottedResourceRole"))
+ assertTrue(checkMissingPreProcessRequest("allottedResourceType"))
+ }
+
+ // ***** getAaiAR *****
+
+ @Test
+ @Ignore
+ public void getAaiAR() {
+ MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXC/getArTxc.xml")
+
+ ExecutionEntity mex = setupMock()
+ initGetAaiAR(mex)
+
+ DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+ DoCreateAllottedResourceTXC.getAaiAR(mex)
+
+ verify(mex).setVariable("foundActiveAR", true)
+ }
+
+ @Test
+
+ public void getAaiAR_Duplicate() {
+ MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXC/getArTxc.xml")
+
+ ExecutionEntity mex = setupMock()
+ initGetAaiAR(mex)
+
+ // fail if duplicate
+ when(mex.getVariable("failExists")).thenReturn("true")
+
+ DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+
+ assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXC.getAaiAR(mex) }))
+ }
+
+ @Test
+ public void getAaiAR_NotActive() {
+ MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXC/getArTxc.xml")
+
+ ExecutionEntity mex = setupMock()
+ initGetAaiAR(mex)
+
+ // not active
+ when(mex.getVariable("aaiAROrchStatus")).thenReturn("not-active")
+
+ DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+
+ assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXC.getAaiAR(mex) }))
+ }
+
+ @Test
+ @Ignore
+ public void getAaiAR_NoStatus() {
+ MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXC/getArTxc.xml")
+
+ ExecutionEntity mex = setupMock()
+ initGetAaiAR(mex)
+
+ when(mex.getVariable("aaiAROrchStatus")).thenReturn(null)
+
+ DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+ DoCreateAllottedResourceTXC.getAaiAR(mex)
+
+ verify(mex, never()).setVariable("foundActiveAR", true)
+ }
+
+ // ***** createAaiAR *****
+
+ @Test
+ public void createAaiAR() {
+ ExecutionEntity mex = setupMock()
+ initCreateAaiAr(mex)
+ when(mex.getVariable("PSI_resourceLink")).thenReturn(AAIUriFactory.createResourceFromExistingURI(AAIObjectType.SERVICE_INSTANCE, UriBuilder.fromPath("/aai/v9/business/customers/customer/" + CUST + "/service-subscriptions/service-subscription/" + SVC + "/service-instances/service-instance/" + INST).build()))
+ when(mex.getVariable("CSI_resourceLink")).thenReturn("/aai/v9/business/customers/customer/" + CUST + "/service-subscriptions/service-subscription/" + SVC + "/service-instances/service-instance/" + INST)
+ when(mex.getVariable("allottedResourceModelInfo")).thenReturn("{\n" +
+ " \"modelInvariantUuid\":\"modelInvariantUuid\",\n" +
+ " \"modelUuid\" : \"modelUuid\"\n" +
+ "}")
+ AAIResourcesClient client = mock(AAIResourcesClient.class)
+ DoCreateAllottedResourceTXC doCreateAllottedResourceTXC = spy(DoCreateAllottedResourceTXC.class)
+ when(doCreateAllottedResourceTXC.getAAIClient()).thenReturn(client)
+ doCreateAllottedResourceTXC.createAaiAR(mex)
+ }
+
+
+ @Test
+ public void createAaiAR_MissingPsiLink() {
+ ExecutionEntity mex = setupMock()
+ initCreateAaiAr(mex)
+
+ when(mex.getVariable("PSI_resourceLink")).thenReturn(null)
+
+ MockPutAllottedResource(CUST, SVC, INST, ARID)
+
+ DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+
+ assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXC.createAaiAR(mex) }))
+ }
+
+ @Test
+ public void createAaiAR_HttpFailed() {
+ ExecutionEntity mex = setupMock()
+ initCreateAaiAr(mex)
+
+ MockPutAllottedResource_500(CUST, SVC, INST, ARID)
+
+ DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+
+ assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXC.createAaiAR(mex) }))
+ }
+
+ @Test
+ public void createAaiAR_BpmnError() {
+ ExecutionEntity mex = setupMock()
+ initCreateAaiAr(mex)
+
+ when(mex.getVariable("aai.endpoint")).thenThrow(new BpmnError("expected exception"))
+
+ MockPutAllottedResource(CUST, SVC, INST, ARID)
+
+ DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+
+ assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXC.createAaiAR(mex) }))
+ }
+
+ @Test
+ public void createAaiAR_Ex() {
+ ExecutionEntity mex = setupMock()
+ initCreateAaiAr(mex)
+
+ when(mex.getVariable("aai.endpoint")).thenThrow(new RuntimeException("expected exception"))
+
+ MockPutAllottedResource(CUST, SVC, INST, ARID)
+
+ DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+
+ assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXC.createAaiAR(mex) }))
+ }
+
+ // ***** buildSDNCRequest *****
+
+ @Test
+ public void buildSDNCRequest() {
+ ExecutionEntity mex = setupMock()
+ initBuildSDNCRequest(mex)
+
+ DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+
+ String result = DoCreateAllottedResourceTXC.buildSDNCRequest(mex, "myact", "myreq")
+
+ assertTrue(result.indexOf("<sdncadapter:RequestId>myreq</") >= 0)
+ assertTrue(result.indexOf("<sdncadapter:SvcAction>myact</") >= 0)
+ assertTrue(result.indexOf("<allotted-resource-id>ari</") >= 0)
+ assertTrue(result.indexOf("<sdncadapter:SvcInstanceId>sii</") >= 0)
+ assertTrue(result.indexOf("<service-instance-id>sii</") >= 0)
+ assertTrue(result.indexOf("<parent-service-instance-id>psii</") >= 0)
+ assertTrue(result.indexOf("<subscription-service-type>sst</") >= 0)
+ assertTrue(result.indexOf("<global-customer-id>gci</") >= 0)
+ assertTrue(result.indexOf("<sdncadapter:CallbackUrl>scu</") >= 0)
+ assertTrue(result.indexOf("<request-id>mri</") >= 0)
+ assertTrue(result.indexOf("<model-invariant-uuid/>") >= 0)
+ assertTrue(result.indexOf("<model-uuid/>") >= 0)
+ assertTrue(result.indexOf("<model-customization-uuid/>") >= 0)
+ assertTrue(result.indexOf("<model-version/>") >= 0)
+ assertTrue(result.indexOf("<model-name/>") >= 0)
+ }
+
+ @Test
+ public void buildSDNCRequest_Ex() {
+ ExecutionEntity mex = setupMock()
+ initBuildSDNCRequest(mex)
+
+ when(mex.getVariable("allottedResourceId")).thenThrow(new RuntimeException("expected exception"))
+
+ DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+
+ assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXC.buildSDNCRequest(mex, "myact", "myreq") }))
+ }
+
+ // ***** preProcessSDNCAssign *****
+
+ @Test
+ public void preProcessSDNCAssign() {
+ ExecutionEntity mex = setupMock()
+ def map = setupMap(mex)
+ def data = initPreProcessSDNC(mex)
+
+ DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+ DoCreateAllottedResourceTXC.preProcessSDNCAssign(mex)
+
+ def req = map.get("sdncAssignRequest")
+ assertNotNull(req)
+
+ assertEquals(data, map.get("rollbackData"))
+
+ def rbreq = data.get(Prefix, "sdncAssignRollbackReq")
+
+ assertTrue(req.indexOf("<sdncadapter:SvcAction>assign</") >= 0)
+ assertTrue(req.indexOf("<request-action>CreateTunnelXConnInstance</") >= 0)
+ assertTrue(req.indexOf("<sdncadapter:RequestId>") >= 0)
+
+ assertTrue(rbreq.indexOf("<sdncadapter:SvcAction>unassign</") >= 0)
+ assertTrue(rbreq.indexOf("<request-action>DeleteTunnelXConnInstance</") >= 0)
+ assertTrue(rbreq.indexOf("<sdncadapter:RequestId>") >= 0)
+ }
+
+ @Test
+ public void preProcessSDNCAssign_BpmnError() {
+ ExecutionEntity mex = setupMock()
+ initPreProcessSDNC(mex)
+
+ when(mex.getVariable("rollbackData")).thenThrow(new BpmnError("expected exception"))
+
+ DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+
+ assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXC.preProcessSDNCAssign(mex) }))
+ }
+
+ @Test
+ public void preProcessSDNCAssign_Ex() {
+ ExecutionEntity mex = setupMock()
+ initPreProcessSDNC(mex)
+
+ when(mex.getVariable("rollbackData")).thenThrow(new RuntimeException("expected exception"))
+
+ DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+
+ assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXC.preProcessSDNCAssign(mex) }))
+ }
+
+ // ***** preProcessSDNCCreate *****
+
+ @Test
+ public void preProcessSDNCCreate() {
+ ExecutionEntity mex = setupMock()
+ def map = setupMap(mex)
+ def data = initPreProcessSDNC(mex)
+
+ DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+ DoCreateAllottedResourceTXC.preProcessSDNCCreate(mex)
+
+ def req = map.get("sdncCreateRequest")
+ assertNotNull(req)
+
+ assertEquals(data, map.get("rollbackData"))
+
+ def rbreq = data.get(Prefix, "sdncCreateRollbackReq")
+
+ assertTrue(req.indexOf("<sdncadapter:SvcAction>create</") >= 0)
+ assertTrue(req.indexOf("<request-action>CreateTunnelXConnInstance</") >= 0)
+ assertTrue(req.indexOf("<sdncadapter:RequestId>") >= 0)
+
+ assertTrue(rbreq.indexOf("<sdncadapter:SvcAction>delete</") >= 0)
+ assertTrue(rbreq.indexOf("<request-action>DeleteTunnelXConnInstance</") >= 0)
+ assertTrue(rbreq.indexOf("<sdncadapter:RequestId>") >= 0)
+
+ }
+
+ @Test
+ public void preProcessSDNCCreate_BpmnError() {
+ ExecutionEntity mex = setupMock()
+ initPreProcessSDNC(mex)
+
+ when(mex.getVariable("rollbackData")).thenThrow(new BpmnError("expected exception"))
+
+ DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+
+ assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXC.preProcessSDNCCreate(mex) }))
+ }
+
+ @Test
+ public void preProcessSDNCCreate_Ex() {
+ ExecutionEntity mex = setupMock()
+ initPreProcessSDNC(mex)
+
+ when(mex.getVariable("rollbackData")).thenThrow(new RuntimeException("expected exception"))
+
+ DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+
+ assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXC.preProcessSDNCCreate(mex) }))
+ }
+
+ // ***** preProcessSDNCActivate *****
+
+ @Test
+ public void preProcessSDNCActivate() {
+ ExecutionEntity mex = setupMock()
+ def map = setupMap(mex)
+ def data = initPreProcessSDNC(mex)
+
+ DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+ DoCreateAllottedResourceTXC.preProcessSDNCActivate(mex)
+
+ def req = map.get("sdncActivateRequest")
+ assertNotNull(req)
+
+ assertEquals(data, map.get("rollbackData"))
+
+ def rbreq = data.get(Prefix, "sdncActivateRollbackReq")
+
+ assertTrue(req.indexOf("<sdncadapter:SvcAction>activate</") >= 0)
+ assertTrue(req.indexOf("<request-action>CreateTunnelXConnInstance</") >= 0)
+ assertTrue(req.indexOf("<sdncadapter:RequestId>") >= 0)
+
+ assertTrue(rbreq.indexOf("<sdncadapter:SvcAction>deactivate</") >= 0)
+ assertTrue(rbreq.indexOf("<request-action>DeleteTunnelXConnInstance</") >= 0)
+ assertTrue(rbreq.indexOf("<sdncadapter:RequestId>") >= 0)
+
+ }
+
+ @Test
+ public void preProcessSDNCActivate_BpmnError() {
+ ExecutionEntity mex = setupMock()
+ initPreProcessSDNC(mex)
+
+ when(mex.getVariable("rollbackData")).thenThrow(new BpmnError("expected exception"))
+
+ DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+
+ assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXC.preProcessSDNCActivate(mex) }))
+ }
+
+ @Test
+ public void preProcessSDNCActivate_Ex() {
+ ExecutionEntity mex = setupMock()
+ initPreProcessSDNC(mex)
+
+ when(mex.getVariable("rollbackData")).thenThrow(new RuntimeException("expected exception"))
+
+ DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+
+ assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXC.preProcessSDNCActivate(mex) }))
+ }
+
+ // ***** validateSDNCResp *****
+
+ @Test
+ public void validateSDNCResp() {
+ ExecutionEntity mex = setupMock()
+ def map = setupMap(mex)
+ def data = initValidateSDNCResp(mex)
+ def resp = initValidateSDNCResp_Resp()
+
+ when(mex.getVariable(Prefix + "sdncResponseSuccess")).thenReturn(true)
+
+ DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+
+ DoCreateAllottedResourceTXC.validateSDNCResp(mex, resp, "create")
+
+ verify(mex).getVariable("WorkflowException")
+ verify(mex).getVariable("SDNCA_SuccessIndicator")
+ verify(mex).getVariable("rollbackData")
+
+ assertEquals(data, map.get("rollbackData"))
+
+ assertEquals("true", data.get(Prefix, "rollback" + "SDNCcreate"))
+
+ }
+
+ @Test
+ public void validateSDNCResp_Get() {
+ ExecutionEntity mex = setupMock()
+ initValidateSDNCResp(mex)
+ def resp = initValidateSDNCResp_Resp()
+
+ when(mex.getVariable(Prefix + "sdncResponseSuccess")).thenReturn(true)
+
+ DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+
+ DoCreateAllottedResourceTXC.validateSDNCResp(mex, resp, "get")
+
+ verify(mex).getVariable("WorkflowException")
+ verify(mex).getVariable("SDNCA_SuccessIndicator")
+
+ verify(mex, never()).getVariable("rollbackData")
+ }
+
+ @Test
+ public void validateSDNCResp_Unsuccessful() {
+ ExecutionEntity mex = setupMock()
+ initValidateSDNCResp(mex)
+ def resp = initValidateSDNCResp_Resp()
+
+ // unsuccessful
+ when(mex.getVariable(Prefix + "sdncResponseSuccess")).thenReturn(false)
+
+ DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+
+ assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXC.validateSDNCResp(mex, resp, "create") }))
+ }
+
+ @Test
+ public void validateSDNCResp_BpmnError() {
+ ExecutionEntity mex = setupMock()
+ initValidateSDNCResp(mex)
+ def resp = initValidateSDNCResp_Resp()
+
+ when(mex.getVariable("WorkflowException")).thenThrow(new BpmnError("expected exception"))
+
+ DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+
+ assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXC.validateSDNCResp(mex, resp, "create") }))
+ }
+
+ @Test
+ public void validateSDNCResp_Ex() {
+ ExecutionEntity mex = setupMock()
+ initValidateSDNCResp(mex)
+ def resp = initValidateSDNCResp_Resp()
+
+ when(mex.getVariable("WorkflowException")).thenThrow(new RuntimeException("expected exception"))
+
+ DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+
+ assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXC.validateSDNCResp(mex, resp, "create") }))
+ }
+
+ // ***** preProcessSDNCGet *****
+
+ @Test
+ public void preProcessSDNCGet_FoundAR() {
+ ExecutionEntity mex = setupMock()
+ def map = setupMap(mex)
+ initPreProcessSDNCGet(mex)
+
+ DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+ DoCreateAllottedResourceTXC.preProcessSDNCGet(mex)
+
+ String req = map.get("sdncGetRequest")
+
+ assertTrue(req.indexOf("<sdncadapter:RequestId>") >= 0)
+ assertTrue(req.indexOf("<sdncadapter:SvcInstanceId>sii</") >= 0)
+ assertTrue(req.indexOf("<sdncadapter:SvcOperation>arlink</") >= 0)
+ assertTrue(req.indexOf("<sdncadapter:CallbackUrl>myurl</") >= 0)
+
+ }
+
+ @Test
+ public void preProcessSDNCGet_NotFoundAR() {
+ ExecutionEntity mex = setupMock()
+ def map = setupMap(mex)
+ initPreProcessSDNCGet(mex)
+
+ when(mex.getVariable("foundActiveAR")).thenReturn(false)
+
+ DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+ DoCreateAllottedResourceTXC.preProcessSDNCGet(mex)
+
+ String req = map.get("sdncGetRequest")
+
+ assertTrue(req.indexOf("<sdncadapter:RequestId>") >= 0)
+ assertTrue(req.indexOf("<sdncadapter:SvcInstanceId>sii</") >= 0)
+ assertTrue(req.indexOf("<sdncadapter:SvcOperation>assignlink</") >= 0)
+ assertTrue(req.indexOf("<sdncadapter:CallbackUrl>myurl</") >= 0)
+
+ }
+
+ @Test
+ public void preProcessSDNCGet_Ex() {
+ ExecutionEntity mex = setupMock()
+ initPreProcessSDNCGet(mex)
+
+ when(mex.getVariable("foundActiveAR")).thenThrow(new RuntimeException("expected exception"))
+
+ DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+
+ assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXC.preProcessSDNCGet(mex) }))
+ }
+
+ // ***** updateAaiAROrchStatus *****
+
+ @Test
+ @Ignore
+ public void updateAaiAROrchStatus() {
+ MockPatchAllottedResource(CUST, SVC, INST, ARID)
+
+ ExecutionEntity mex = setupMock()
+ initUpdateAaiAROrchStatus(mex)
+
+ DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+ DoCreateAllottedResourceTXC.updateAaiAROrchStatus(mex, "success")
+ }
+
+ // ***** generateOutputs *****
+
+ @Test
+ public void generateOutputs() {
+ ExecutionEntity mex = setupMock()
+ def txctop = FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceTXC/SDNCTopologyQueryCallback.xml")
+
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("enhancedCallbackRequestData")).thenReturn(txctop)
+
+ DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+ DoCreateAllottedResourceTXC.generateOutputs(mex)
+
+ verify(mex).setVariable("allotedResourceName", "namefromrequest")
+ verify(mex).setVariable("vni", "my-vni")
+ verify(mex).setVariable("vgmuxBearerIP", "my-bearer-ip")
+ verify(mex).setVariable("vgmuxLanIP", "my-lan-ip")
+
+ }
+
+ @Test
+ public void generateOutputs_BadXml() {
+ ExecutionEntity mex = setupMock()
+
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("enhancedCallbackRequestData")).thenReturn("invalid xml")
+
+ DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+ DoCreateAllottedResourceTXC.generateOutputs(mex)
+
+ verify(mex, never()).setVariable(anyString(), anyString())
+
+ }
+
+ @Test
+ public void generateOutputs_BpmnError() {
+ ExecutionEntity mex = setupMock()
+
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("enhancedCallbackRequestData")).thenThrow(new BpmnError("expected exception"))
+
+ DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+
+ DoCreateAllottedResourceTXC.generateOutputs(mex)
+ verify(mex, never()).setVariable(anyString(), anyString())
+
+ }
+
+ @Test
+ public void generateOutputs_Ex() {
+ ExecutionEntity mex = setupMock()
+
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("enhancedCallbackRequestData")).thenThrow(new RuntimeException("expected exception"))
+
+ DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+
+ DoCreateAllottedResourceTXC.generateOutputs(mex)
+ verify(mex, never()).setVariable(anyString(), anyString())
+
+ }
+
+ // ***** preProcessRollback *****
+
+ @Test
+ public void preProcessRollback() {
+ ExecutionEntity mex = setupMock()
+ WorkflowException wfe = mock(WorkflowException.class)
+
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("WorkflowException")).thenReturn(wfe)
+
+ DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+ DoCreateAllottedResourceTXC.preProcessRollback(mex)
+
+ verify(mex).setVariable("prevWorkflowException", wfe)
+
+ }
+
+ @Test
+ public void preProcessRollback_NotWFE() {
+ ExecutionEntity mex = setupMock()
+
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("WorkflowException")).thenReturn("I'm not a WFE")
+
+ DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+ DoCreateAllottedResourceTXC.preProcessRollback(mex)
+
+ verify(mex, never()).setVariable(eq("prevWorkflowException"), any())
+
+ }
+
+ @Test
+ public void preProcessRollback_BpmnError() {
+ ExecutionEntity mex = setupMock()
+
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("WorkflowException")).thenThrow(new BpmnError("expected exception"))
+
+ DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+
+ DoCreateAllottedResourceTXC.preProcessRollback(mex)
+
+ }
+
+ @Test
+ public void preProcessRollback_Ex() {
+ ExecutionEntity mex = setupMock()
+
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("WorkflowException")).thenThrow(new RuntimeException("expected exception"))
+
+ DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+
+ DoCreateAllottedResourceTXC.preProcessRollback(mex)
+
+ }
+
+ // ***** postProcessRollback *****
+
+ @Test
+ public void postProcessRollback() {
+ ExecutionEntity mex = setupMock()
+ WorkflowException wfe = mock(WorkflowException.class)
+
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("prevWorkflowException")).thenReturn(wfe)
+
+ DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+ DoCreateAllottedResourceTXC.postProcessRollback(mex)
+
+ verify(mex).setVariable("WorkflowException", wfe)
+ verify(mex).setVariable("rollbackData", null)
+
+ }
+
+ @Test
+ public void postProcessRollback_NotWFE() {
+ ExecutionEntity mex = setupMock()
+
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("prevWorkflowException")).thenReturn("I'm not a WFE")
+
+ DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+ DoCreateAllottedResourceTXC.postProcessRollback(mex)
+
+ verify(mex, never()).setVariable(eq("WorkflowException"), any())
+ verify(mex).setVariable("rollbackData", null)
+
+ }
+
+ @Test
+ public void postProcessRollback_BpmnError() {
+ ExecutionEntity mex = setupMock()
+
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("prevWorkflowException")).thenThrow(new BpmnError("expected exception"))
+
+ DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+
+ assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXC.postProcessRollback(mex) }))
+ verify(mex, never()).setVariable("rollbackData", null)
+
+ }
+
+ @Test
+ public void postProcessRollback_Ex() {
+ ExecutionEntity mex = setupMock()
+
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("prevWorkflowException")).thenThrow(new RuntimeException("expected exception"))
+
+ DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+
+ DoCreateAllottedResourceTXC.postProcessRollback(mex)
+ verify(mex, never()).setVariable("rollbackData", null)
+
+ }
+
+ private boolean checkMissingPreProcessRequest(String fieldnm) {
+ ExecutionEntity mex = setupMock()
+ initPreProcess(mex)
+
+ DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+
+ when(mex.getVariable(fieldnm)).thenReturn("")
+
+ return doBpmnError({ _ -> DoCreateAllottedResourceTXC.preProcessRequest(mex) })
+ }
+
+ private void initPreProcess(ExecutionEntity mex) {
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("mso.workflow.sdncadapter.callback")).thenReturn("sdncurn")
+ when(mex.getVariable("mso.workflow.sdnc.replication.delay")).thenReturn("sdncdelay")
+ when(mex.getVariable("serviceInstanceId")).thenReturn("sii")
+ when(mex.getVariable("parentServiceInstanceId")).thenReturn("psii")
+ when(mex.getVariable("allottedResourceModelInfo")).thenReturn("armi")
+ when(mex.getVariable("brgWanMacAddress")).thenReturn("bwma")
+ when(mex.getVariable("allottedResourceRole")).thenReturn("arr")
+ when(mex.getVariable("allottedResourceType")).thenReturn("art")
+ }
+
+ private void initGetAaiAR(ExecutionEntity mex) {
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("allottedResourceType")).thenReturn("TXCt")
+ when(mex.getVariable("allottedResourceRole")).thenReturn("TXCr")
+ when(mex.getVariable("CSI_service")).thenReturn(FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceTXC/getAR.xml"))
+ when(mex.getVariable("aai.endpoint")).thenReturn(aaiUriPfx)
+ when(mex.getVariable("aaiAROrchStatus")).thenReturn("Active")
+ }
+
+ private initCreateAaiAr(ExecutionEntity mex) {
+ when(mex.getVariable("disableRollback")).thenReturn(45)
+ when(mex.getVariable("serviceInstanceId")).thenReturn("sii")
+ when(mex.getVariable("parentServiceInstanceId")).thenReturn("psii")
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("allottedResourceId")).thenReturn(ARID)
+ when(mex.getVariable("aai.endpoint")).thenReturn(aaiUriPfx)
+ when(mex.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn(UrnPropertiesReader.getVariable("mso.workflow.global.default.aai.namespace"))
+ when(mex.getVariable("PSI_resourceLink")).thenReturn(AAIUriFactory.createResourceFromExistingURI(AAIObjectType.SERVICE_INSTANCE, UriBuilder.fromPath("/business/customers/customer/" + CUST + "/service-subscriptions/service-subscription/" + SVC + "/service-instances/service-instance/" + INST).build()))
+ when(mex.getVariable("allottedResourceType")).thenReturn("TXCt")
+ when(mex.getVariable("allottedResourceRole")).thenReturn("TXCr")
+ when(mex.getVariable("CSI_resourceLink")).thenReturn(aaiUriPfx + "/aai/v9/mycsi")
+ when(mex.getVariable("allottedResourceModelInfo")).thenReturn("""
+ {
+ "modelInvariantUuid":"modelinvuuid",
+ "modelUuid":"modeluuid",
+ "modelCustomizationUuid":"modelcustuuid"
+ }
+ """)
+ }
+
+ private initBuildSDNCRequest(ExecutionEntity mex) {
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("allottedResourceId")).thenReturn("ari")
+ when(mex.getVariable("serviceInstanceId")).thenReturn("sii")
+ when(mex.getVariable("parentServiceInstanceId")).thenReturn("psii")
+ when(mex.getVariable("subscriptionServiceType")).thenReturn("sst")
+ when(mex.getVariable("globalCustomerId")).thenReturn("gci")
+ when(mex.getVariable("sdncCallbackUrl")).thenReturn("scu")
+ when(mex.getVariable("msoRequestId")).thenReturn("mri")
+ }
+
+ private RollbackData initPreProcessSDNC(ExecutionEntity mex) {
+ def data = new RollbackData()
+
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("rollbackData")).thenReturn(data)
+
+ return data
+ }
+
+ private initPreProcessSDNCGet(ExecutionEntity mex) {
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("sdncCallbackUrl")).thenReturn("myurl")
+ when(mex.getVariable("foundActiveAR")).thenReturn(true)
+ when(mex.getVariable("aaiARGetResponse")).thenReturn("<selflink>arlink</selflink>")
+ when(mex.getVariable("sdncAssignResponse")).thenReturn("<response-data>&lt;object-path&gt;assignlink&lt;/object-path&gt;</response-data>")
+ when(mex.getVariable("serviceInstanceId")).thenReturn("sii")
+ when(mex.getVariable("sdncCallbackUrl")).thenReturn("myurl")
+ }
+
+ private RollbackData initValidateSDNCResp(ExecutionEntity mex) {
+ def data = new RollbackData()
+
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("prefix")).thenReturn(Prefix)
+ when(mex.getVariable("SDNCA_SuccessIndicator")).thenReturn(true)
+ when(mex.getVariable("rollbackData")).thenReturn(data)
+
+ return data
+ }
+
+ private String initValidateSDNCResp_Resp() {
+ return "<response-data>&lt;response-code&gt;200&lt;/response-code&gt;</response-data>"
+ }
+
+ private initUpdateAaiAROrchStatus(ExecutionEntity mex) {
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("aaiARPath")).thenReturn("/business/customers/customer/" + CUST + "/service-subscriptions/service-subscription/" + SVC + "/service-instances/service-instance/" + INST + "/allotted-resources/allotted-resource/" + ARID)
+ }
+
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRGTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRGTest.groovy
index 0528529819..e77c1dd9ed 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRGTest.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRGTest.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -20,19 +22,15 @@
package org.onap.so.bpmn.vcpe.scripts
+import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity
-import org.junit.Before
-import org.junit.BeforeClass
-import org.junit.Rule
-import org.junit.Test
-import org.junit.Ignore
+import org.junit.*
import org.mockito.MockitoAnnotations
-import org.camunda.bpm.engine.delegate.BpmnError
import org.mockito.Spy
import org.onap.so.bpmn.core.UrnPropertiesReader
-import org.onap.so.bpmn.mock.FileUtil
-import org.onap.so.client.aai.entities.uri.AAIResourceUri
-import static org.junit.Assert.*;
+
+import static org.junit.Assert.assertTrue
+import static org.mockito.ArgumentMatchers.eq
import static org.mockito.Mockito.*
import static org.onap.so.bpmn.mock.StubResponseAAI.MockDeleteAllottedResource
import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetAllottedResource
@@ -41,533 +39,497 @@ import com.github.tomakehurst.wiremock.junit.WireMockRule
class DoDeleteAllottedResourceBRGTest extends GroovyTestBase {
- @Rule
- public WireMockRule wireMockRule = new WireMockRule(PORT)
+ @Rule
+ public WireMockRule wireMockRule = new WireMockRule(PORT)
+
+ String Prefix = "DDARBRG_"
- String Prefix = "DDARBRG_"
+ @BeforeClass
+ public static void setUpBeforeClass() {
+ GroovyTestBase.setUpBeforeClass()
+ }
- @BeforeClass
- public static void setUpBeforeClass() {
- super.setUpBeforeClass()
- }
+ @Spy
+ DoDeleteAllottedResourceBRG doDeleteAllottedResourceBRG
- @Spy
- DoDeleteAllottedResourceBRG doDeleteAllottedResourceBRG
-
@Before
- public void init()
- {
- MockitoAnnotations.initMocks(this)
- super.init()
- when(doDeleteAllottedResourceBRG.getAllottedResourceUtils()).thenReturn(allottedResourceUtils_MOCK)
- }
-
- public DoDeleteAllottedResourceBRGTest() {
- super("DoDeleteAllottedResourceBRG")
- }
-
-
- // ***** preProcessRequest *****
-
- @Test
-// @Ignore
- public void preProcessRequest() {
- ExecutionEntity mex = setupMock()
- initPreProcess(mex)
-
- DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
- DoDeleteAllottedResourceBRG.preProcessRequest(mex)
-
- //verify(mex).getVariable(DBGFLAG)
- verify(mex).setVariable("prefix", Prefix)
- verify(mex).setVariable("sdncCallbackUrl", "sdncurn")
-
- assertTrue(checkMissingPreProcessRequest("mso.workflow.sdncadapter.callback"))
- assertTrue(checkMissingPreProcessRequest("serviceInstanceId"))
- assertTrue(checkMissingPreProcessRequest("allottedResourceId"))
- }
-
- @Test
-// @Ignore
- public void preProcessRequest_BpmnError() {
- ExecutionEntity mex = setupMock()
- initPreProcess(mex)
-
- when(mex.getVariable("serviceInstanceId")).thenThrow(new BpmnError("expected exception"))
-
- DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
-
- assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceBRG.preProcessRequest(mex) }))
- }
-
- @Test
-// @Ignore
- public void preProcessRequest_Ex() {
- ExecutionEntity mex = setupMock()
- initPreProcess(mex)
-
- when(mex.getVariable("serviceInstanceId")).thenThrow(new RuntimeException("expected exception"))
-
- DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
-
- assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceBRG.preProcessRequest(mex) }))
- }
-
-
- // ***** getAaiAR *****
-
- @Test
+ public void init() {
+ MockitoAnnotations.initMocks(this)
+ initAllottedResourceMock()
+ }
+
+ public DoDeleteAllottedResourceBRGTest() {
+ super("DoDeleteAllottedResourceBRG")
+ }
+
+ // ***** preProcessRequest *****
+
+ @Test
+ public void preProcessRequest() {
+ ExecutionEntity mex = setupMock()
+ initPreProcess(mex)
+
+ DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
+ DoDeleteAllottedResourceBRG.preProcessRequest(mex)
+
+ verify(mex).setVariable("prefix", Prefix)
+ verify(mex).setVariable("sdncCallbackUrl", "sdncurn")
+
+ assertTrue(checkMissingPreProcessRequest("mso.workflow.sdncadapter.callback"))
+ assertTrue(checkMissingPreProcessRequest("serviceInstanceId"))
+ assertTrue(checkMissingPreProcessRequest("allottedResourceId"))
+ }
+
+ @Test
+ public void preProcessRequest_BpmnError() {
+ ExecutionEntity mex = setupMock()
+ initPreProcess(mex)
+
+ when(mex.getVariable("serviceInstanceId")).thenThrow(new BpmnError("expected exception"))
+
+ DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
+
+ assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceBRG.preProcessRequest(mex) }))
+ }
+
+ @Test
+ public void preProcessRequest_Ex() {
+ ExecutionEntity mex = setupMock()
+ initPreProcess(mex)
+
+ when(mex.getVariable("serviceInstanceId")).thenThrow(new RuntimeException("expected exception"))
+
+ DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
+
+ assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceBRG.preProcessRequest(mex) }))
+ }
+
+ // ***** getAaiAR *****
+
+ @Test
+ public void getAaiAR() {
+ ExecutionEntity mex = setupMock()
+ initGetAaiAR(mex)
+ when(doDeleteAllottedResourceBRG.getAllottedResourceUtils()).thenReturn(allottedResourceUtils_MOCK)
+ doReturn(true).when(allottedResourceUtils_MOCK).ifExistsAR(eq(mex), eq(ARID))
+ doDeleteAllottedResourceBRG.getAaiAR(mex)
+ verify(mex).setVariable("parentServiceInstanceId", INST)
+ }
+
+ @Test
+ public void getAaiAR_EmptyResponse() {
+ ExecutionEntity mex = setupMock()
+ initGetAaiAR(mex)
+ doReturn(false).when(allottedResourceUtils_MOCK).ifExistsAR(eq(mex), eq(ARID))
+ assertTrue(doBpmnError({ _ -> doDeleteAllottedResourceBRG.getAaiAR(mex) }))
+ }
+
+ // ***** updateAaiAROrchStatus *****
+
+ @Test
@Ignore
- public void getAaiAR() {
- ExecutionEntity mex = setupMock()
- initGetAaiAR(mex)
- when(client_MOCK.exists(any(AAIResourceUri.class))).thenReturn(true)
- doDeleteAllottedResourceBRG.getAaiAR(mex)
- verify(mex).setVariable("parentServiceInstanceId", INST)
- }
-
- @Test
- public void getAaiAR_EmptyResponse() {
- ExecutionEntity mex = setupMock()
- initGetAaiAR(mex)
- when(client_MOCK.exists(any(AAIResourceUri.class))).thenReturn(false)
- assertTrue(doBpmnError( { _ -> doDeleteAllottedResourceBRG.getAaiAR(mex) }))
- }
-
-
- // ***** updateAaiAROrchStatus *****
-
- @Test
- @Ignore
- public void updateAaiAROrchStatus() {
- ExecutionEntity mex = setupMock()
- initUpdateAaiAROrchStatus(mex)
-
- MockPatchAllottedResource(CUST, SVC, INST, ARID)
-
- DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
- DoDeleteAllottedResourceBRG.updateAaiAROrchStatus(mex, "success")
- }
-
-
- // ***** buildSDNCRequest *****
-
- @Test
-// @Ignore
- public void buildSDNCRequest() {
- ExecutionEntity mex = setupMock()
- initBuildSDNCRequest(mex)
-
- DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
-
- String result = DoDeleteAllottedResourceBRG.buildSDNCRequest(mex, "myact", "myreq")
-
- assertTrue(result.indexOf("<sdncadapter:RequestId>myreq</") >= 0)
- assertTrue(result.indexOf("<sdncadapter:SvcAction>myact</") >= 0)
- assertTrue(result.indexOf("<allotted-resource-id>ari</") >= 0)
- assertTrue(result.indexOf("<sdncadapter:SvcInstanceId>sii</") >= 0)
- assertTrue(result.indexOf("<service-instance-id>sii</") >= 0)
- assertTrue(result.indexOf("<parent-service-instance-id>psii</") >= 0)
- assertTrue(result.indexOf("<subscription-service-type>sst</") >= 0)
- assertTrue(result.indexOf("<global-customer-id>gci</") >= 0)
- assertTrue(result.indexOf("<sdncadapter:CallbackUrl>scu</") >= 0)
- assertTrue(result.indexOf("<request-id>mri</") >= 0)
- assertTrue(result.indexOf("<model-invariant-uuid/>") >= 0)
- assertTrue(result.indexOf("<model-uuid/>") >= 0)
- assertTrue(result.indexOf("<model-customization-uuid/>") >= 0)
- assertTrue(result.indexOf("<model-version/>") >= 0)
- assertTrue(result.indexOf("<model-name/>") >= 0)
- }
-
- @Test
-// @Ignore
- public void buildSDNCRequest_Ex() {
- ExecutionEntity mex = setupMock()
- initBuildSDNCRequest(mex)
-
- when(mex.getVariable("allottedResourceId")).thenThrow(new RuntimeException("expected exception"))
-
- DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
-
- assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceBRG.buildSDNCRequest(mex, "myact", "myreq") }))
- }
-
-
- // ***** preProcessSDNCUnassign *****
-
- @Test
-// @Ignore
- public void preProcessSDNCUnassign() {
- ExecutionEntity mex = setupMock()
- def map = setupMap(mex)
- initPreProcessSDNC(mex)
-
- DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
- DoDeleteAllottedResourceBRG.preProcessSDNCUnassign(mex)
-
- def req = map.get("sdncUnassignRequest")
-
- assertTrue(req.indexOf("<sdncadapter:SvcAction>unassign</") >= 0)
- assertTrue(req.indexOf("<request-action>DeleteBRGInstance</") >= 0)
- assertTrue(req.indexOf("<sdncadapter:RequestId>") >= 0)
- }
-
- @Test
-// @Ignore
- public void preProcessSDNCUnassign_BpmnError() {
- ExecutionEntity mex = setupMock()
- initPreProcessSDNC(mex)
-
- when(mex.getVariable("allottedResourceId")).thenThrow(new BpmnError("expected exception"))
-
- DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
-
- assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceBRG.preProcessSDNCUnassign(mex) }))
- }
-
- @Test
-// @Ignore
- public void preProcessSDNCUnassign_Ex() {
- ExecutionEntity mex = setupMock()
- initPreProcessSDNC(mex)
-
- when(mex.getVariable("allottedResourceId")).thenThrow(new RuntimeException("expected exception"))
-
- DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
-
- assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceBRG.preProcessSDNCUnassign(mex) }))
- }
-
-
- // ***** preProcessSDNCDelete *****
-
- @Test
-// @Ignore
- public void preProcessSDNCDelete() {
- ExecutionEntity mex = setupMock()
- def map = setupMap(mex)
- initPreProcessSDNC(mex)
-
- DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
- DoDeleteAllottedResourceBRG.preProcessSDNCDelete(mex)
-
- def req = map.get("sdncDeleteRequest")
-
- assertTrue(req.indexOf("<sdncadapter:SvcAction>delete</") >= 0)
- assertTrue(req.indexOf("<request-action>DeleteBRGInstance</") >= 0)
- assertTrue(req.indexOf("<sdncadapter:RequestId>") >= 0)
- }
-
- @Test
-// @Ignore
- public void preProcessSDNCDelete_BpmnError() {
- ExecutionEntity mex = setupMock()
- initPreProcessSDNC(mex)
-
- when(mex.getVariable("allottedResourceId")).thenThrow(new BpmnError("expected exception"))
-
- DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
-
- assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceBRG.preProcessSDNCDelete(mex) }))
- }
-
- @Test
-// @Ignore
- public void preProcessSDNCDelete_Ex() {
- ExecutionEntity mex = setupMock()
- initPreProcessSDNC(mex)
-
- when(mex.getVariable("allottedResourceId")).thenThrow(new RuntimeException("expected exception"))
-
- DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
-
- assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceBRG.preProcessSDNCDelete(mex) }))
- }
-
-
- // ***** preProcessSDNCDeactivate *****
-
- @Test
-// @Ignore
- public void preProcessSDNCDeactivate() {
- ExecutionEntity mex = setupMock()
- def map = setupMap(mex)
- initPreProcessSDNC(mex)
-
- DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
- DoDeleteAllottedResourceBRG.preProcessSDNCDeactivate(mex)
-
- def req = map.get("sdncDeactivateRequest")
-
- assertTrue(req.indexOf("<sdncadapter:SvcAction>deactivate</") >= 0)
- assertTrue(req.indexOf("<request-action>DeleteBRGInstance</") >= 0)
- assertTrue(req.indexOf("<sdncadapter:RequestId>") >= 0)
- }
-
- @Test
-// @Ignore
- public void preProcessSDNCDeactivate_BpmnError() {
- ExecutionEntity mex = setupMock()
- initPreProcessSDNC(mex)
-
- when(mex.getVariable("allottedResourceId")).thenThrow(new BpmnError("expected exception"))
-
- DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
-
- assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceBRG.preProcessSDNCDeactivate(mex) }))
- }
-
- @Test
-// @Ignore
- public void preProcessSDNCDeactivate_Ex() {
- ExecutionEntity mex = setupMock()
- initPreProcessSDNC(mex)
-
- when(mex.getVariable("allottedResourceId")).thenThrow(new RuntimeException("expected exception"))
-
- DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
-
- assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceBRG.preProcessSDNCDeactivate(mex) }))
- }
-
-
- // ***** validateSDNCResp *****
-
- @Test
-// @Ignore
- public void validateSDNCResp() {
- ExecutionEntity mex = setupMock()
- def data = initValidateSDNCResp(mex)
- def resp = initValidateSDNCResp_Resp(200)
-
- when(mex.getVariable(Prefix+"sdncResponseSuccess")).thenReturn(true)
-
- DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
-
- DoDeleteAllottedResourceBRG.validateSDNCResp(mex, resp, "create")
-
- verify(mex).getVariable("WorkflowException")
- verify(mex).getVariable("SDNCA_SuccessIndicator")
- verify(mex).getVariable(Prefix+"sdncResponseSuccess")
-
- verify(mex, never()).getVariable(Prefix + "sdncRequestDataResponseCode")
- verify(mex, never()).setVariable("wasDeleted", false)
- }
-
- @Test
-// @Ignore
- public void validateSDNCResp_Fail404_Deactivate_FailNotFound() {
- ExecutionEntity mex = setupMock()
- def data = initValidateSDNCResp(mex)
-
- def resp = initValidateSDNCResp_Resp(404)
- when(mex.getVariable(Prefix+"sdncRequestDataResponseCode")).thenReturn("404")
- when(mex.getVariable("failNotFound")).thenReturn("true")
-
- DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
-
- assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceBRG.validateSDNCResp(mex, resp, "deactivate")}))
- }
-
- @Test
-// @Ignore
- public void validateSDNCResp_Fail404_Deactivate() {
- ExecutionEntity mex = setupMock()
- def data = initValidateSDNCResp(mex)
-
- def resp = initValidateSDNCResp_Resp(404)
- when(mex.getVariable(Prefix+"sdncRequestDataResponseCode")).thenReturn("404")
-
- DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
-
- DoDeleteAllottedResourceBRG.validateSDNCResp(mex, resp, "deactivate")
-
- verify(mex).setVariable("ARNotFoundInSDNC", true)
- verify(mex).setVariable("wasDeleted", false)
- }
-
- @Test
-// @Ignore
- public void validateSDNCResp_Fail404() {
- ExecutionEntity mex = setupMock()
- def data = initValidateSDNCResp(mex)
-
- def resp = initValidateSDNCResp_Resp(404)
- when(mex.getVariable(Prefix+"sdncRequestDataResponseCode")).thenReturn("404")
-
- DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
-
- assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceBRG.validateSDNCResp(mex, resp, "create")}))
- }
-
- @Test
-// @Ignore
- public void validateSDNCResp_Deactivate() {
- ExecutionEntity mex = setupMock()
- def data = initValidateSDNCResp(mex)
- def resp = initValidateSDNCResp_Resp(200)
-
- DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
-
- assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceBRG.validateSDNCResp(mex, resp, "deactivate")}))
- }
-
- @Test
-// @Ignore
- public void validateSDNCResp_BpmnError() {
- ExecutionEntity mex = setupMock()
- initValidateSDNCResp(mex)
- def resp = initValidateSDNCResp_Resp(200)
-
- when(mex.getVariable("WorkflowException")).thenThrow(new BpmnError("expected exception"))
-
- DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
-
- assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceBRG.validateSDNCResp(mex, resp, "create") }))
- }
-
- @Test
-// @Ignore
- public void validateSDNCResp_Ex() {
- ExecutionEntity mex = setupMock()
- initValidateSDNCResp(mex)
- def resp = initValidateSDNCResp_Resp(200)
-
- when(mex.getVariable("WorkflowException")).thenThrow(new RuntimeException("expected exception"))
-
- DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
-
- assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceBRG.validateSDNCResp(mex, resp, "create") }))
- }
-
- @Test
- @Ignore
- public void deleteAaiAR() {
- ExecutionEntity mex = setupMock()
- initDeleteAaiAR(mex)
-
- MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml")
- MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS)
-
- DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
- DoDeleteAllottedResourceBRG.deleteAaiAR(mex)
- }
-
- @Test
-// @Ignore
- public void deleteAaiAR_NoArPath() {
- ExecutionEntity mex = setupMock()
- initDeleteAaiAR(mex)
-
- MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml")
- MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS)
-
- when(mex.getVariable("aaiARPath")).thenReturn("")
-
- DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
-
- assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceBRG.deleteAaiAR(mex) }))
- }
-
- @Test
-// @Ignore
- public void deleteAaiAR_BpmnError() {
- ExecutionEntity mex = setupMock()
- initDeleteAaiAR(mex)
-
- MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml")
- MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS)
-
- when(mex.getVariable("aaiARPath")).thenThrow(new BpmnError("expected exception"))
-
- DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
-
- assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceBRG.deleteAaiAR(mex) }))
- }
-
- @Test
-// @Ignore
- public void deleteAaiAR_Ex() {
- ExecutionEntity mex = setupMock()
- initDeleteAaiAR(mex)
-
- MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml")
- MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS)
-
- when(mex.getVariable("aaiARPath")).thenThrow(new RuntimeException("expected exception"))
-
- DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
-
- assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceBRG.deleteAaiAR(mex) }))
- }
-
- private boolean checkMissingPreProcessRequest(String fieldnm) {
- ExecutionEntity mex = setupMock()
- initPreProcess(mex)
-
- DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
-
- when(mex.getVariable(fieldnm)).thenReturn("")
-
- return doBpmnError( { _ -> DoDeleteAllottedResourceBRG.preProcessRequest(mex) })
- }
-
- private void initPreProcess(ExecutionEntity mex) {
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("mso.workflow.sdncadapter.callback")).thenReturn("sdncurn")
- when(mex.getVariable("serviceInstanceId")).thenReturn("sii")
- when(mex.getVariable("allottedResourceId")).thenReturn("ari")
- }
-
- private void initGetAaiAR(ExecutionEntity mex) {
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("allottedResourceType")).thenReturn("BRG")
- when(mex.getVariable("allottedResourceRole")).thenReturn("BRG")
- when(mex.getVariable("allottedResourceId")).thenReturn(ARID)
- when(mex.getVariable("CSI_service")).thenReturn(FileUtil.readResourceFile("__files/VCPE/DoDeleteAllottedResourceBRG/getAR.xml"))
- when(mex.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn(UrnPropertiesReader.getVariable("mso.workflow.global.default.aai.namespace"))
- when(mex.getVariable("mso.workflow.global.default.aai.version")).thenReturn(UrnPropertiesReader.getVariable("mso.workflow.global.default.aai.version"))
- when(mex.getVariable("mso.workflow.default.aai.v8.nodes.query.uri")).thenReturn(UrnPropertiesReader.getVariable("mso.workflow.default.aai.v8.nodes-query.uri"))
- when(mex.getVariable("aai.endpoint")).thenReturn(aaiUriPfx)
- when(mex.getVariable("aaiARPath")).thenReturn("/business/customers/customer/"+CUST+"/service-subscriptions/service-subscription/"+SVC+"/service-instances/service-instance/"+INST+"/allotted-resources/allotted-resource/"+ARID)
- when(mex.getVariable("aaiAROrchStatus")).thenReturn("Active")
- }
-
- private initUpdateAaiAROrchStatus(ExecutionEntity mex) {
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("aaiARPath")).thenReturn("/business/customers/customer/"+CUST+"/service-subscriptions/service-subscription/"+SVC+"/service-instances/service-instance/"+INST+"/allotted-resources/allotted-resource/"+ARID)
- }
-
- private initBuildSDNCRequest(ExecutionEntity mex) {
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("allottedResourceId")).thenReturn("ari")
- when(mex.getVariable("serviceInstanceId")).thenReturn("sii")
- when(mex.getVariable("parentServiceInstanceId")).thenReturn("psii")
- when(mex.getVariable("subscriptionServiceType")).thenReturn("sst")
- when(mex.getVariable("globalCustomerId")).thenReturn("gci")
- when(mex.getVariable("sdncCallbackUrl")).thenReturn("scu")
- when(mex.getVariable("msoRequestId")).thenReturn("mri")
- }
-
- private initPreProcessSDNC(ExecutionEntity mex) {
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- }
-
- private initValidateSDNCResp(ExecutionEntity mex) {
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("prefix")).thenReturn(Prefix)
- when(mex.getVariable("SDNCA_SuccessIndicator")).thenReturn(true)
- }
-
- private String initValidateSDNCResp_Resp(int code) {
- return "<response-data>&lt;response-code&gt;${code}&lt;/response-code&gt;</response-data>"
- }
-
- private initDeleteAaiAR(ExecutionEntity mex) {
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("aaiARPath")).thenReturn("/business/customers/customer/"+CUST+"/service-subscriptions/service-subscription/"+SVC+"/service-instances/service-instance/"+INST+"/allotted-resources/allotted-resource/"+ARID)
- when(mex.getVariable("aaiARResourceVersion")).thenReturn("myvers")
- when(mex.getVariable("aai.endpoint")).thenReturn(aaiUriPfx)
- }
-
+ public void updateAaiAROrchStatus() {
+ ExecutionEntity mex = setupMock()
+ initUpdateAaiAROrchStatus(mex)
+
+ MockPatchAllottedResource(CUST, SVC, INST, ARID)
+
+ DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
+ DoDeleteAllottedResourceBRG.updateAaiAROrchStatus(mex, "success")
+ }
+
+ // ***** buildSDNCRequest *****
+
+ @Test
+ public void buildSDNCRequest() {
+ ExecutionEntity mex = setupMock()
+ initBuildSDNCRequest(mex)
+
+ DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
+
+ String result = DoDeleteAllottedResourceBRG.buildSDNCRequest(mex, "myact", "myreq")
+
+ assertTrue(result.indexOf("<sdncadapter:RequestId>myreq</") >= 0)
+ assertTrue(result.indexOf("<sdncadapter:SvcAction>myact</") >= 0)
+ assertTrue(result.indexOf("<allotted-resource-id>ari</") >= 0)
+ assertTrue(result.indexOf("<sdncadapter:SvcInstanceId>sii</") >= 0)
+ assertTrue(result.indexOf("<service-instance-id>sii</") >= 0)
+ assertTrue(result.indexOf("<parent-service-instance-id>psii</") >= 0)
+ assertTrue(result.indexOf("<subscription-service-type>sst</") >= 0)
+ assertTrue(result.indexOf("<global-customer-id>gci</") >= 0)
+ assertTrue(result.indexOf("<sdncadapter:CallbackUrl>scu</") >= 0)
+ assertTrue(result.indexOf("<request-id>mri</") >= 0)
+ assertTrue(result.indexOf("<model-invariant-uuid/>") >= 0)
+ assertTrue(result.indexOf("<model-uuid/>") >= 0)
+ assertTrue(result.indexOf("<model-customization-uuid/>") >= 0)
+ assertTrue(result.indexOf("<model-version/>") >= 0)
+ assertTrue(result.indexOf("<model-name/>") >= 0)
+ }
+
+ @Test
+ public void buildSDNCRequest_Ex() {
+ ExecutionEntity mex = setupMock()
+ initBuildSDNCRequest(mex)
+
+ when(mex.getVariable("allottedResourceId")).thenThrow(new RuntimeException("expected exception"))
+
+ DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
+
+ assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceBRG.buildSDNCRequest(mex, "myact", "myreq") }))
+ }
+
+ // ***** preProcessSDNCUnassign *****
+
+ @Test
+ public void preProcessSDNCUnassign() {
+ ExecutionEntity mex = setupMock()
+ def map = setupMap(mex)
+ initPreProcessSDNC(mex)
+
+ DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
+ DoDeleteAllottedResourceBRG.preProcessSDNCUnassign(mex)
+
+ def req = map.get("sdncUnassignRequest")
+
+ assertTrue(req.indexOf("<sdncadapter:SvcAction>unassign</") >= 0)
+ assertTrue(req.indexOf("<request-action>DeleteBRGInstance</") >= 0)
+ assertTrue(req.indexOf("<sdncadapter:RequestId>") >= 0)
+ }
+
+ @Test
+ public void preProcessSDNCUnassign_BpmnError() {
+ ExecutionEntity mex = setupMock()
+ initPreProcessSDNC(mex)
+
+ when(mex.getVariable("allottedResourceId")).thenThrow(new BpmnError("expected exception"))
+
+ DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
+
+ assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceBRG.preProcessSDNCUnassign(mex) }))
+ }
+
+ @Test
+ public void preProcessSDNCUnassign_Ex() {
+ ExecutionEntity mex = setupMock()
+ initPreProcessSDNC(mex)
+
+ when(mex.getVariable("allottedResourceId")).thenThrow(new RuntimeException("expected exception"))
+
+ DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
+
+ assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceBRG.preProcessSDNCUnassign(mex) }))
+ }
+
+ // ***** preProcessSDNCDelete *****
+
+ @Test
+ public void preProcessSDNCDelete() {
+ ExecutionEntity mex = setupMock()
+ def map = setupMap(mex)
+ initPreProcessSDNC(mex)
+
+ DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
+ DoDeleteAllottedResourceBRG.preProcessSDNCDelete(mex)
+
+ def req = map.get("sdncDeleteRequest")
+
+ assertTrue(req.indexOf("<sdncadapter:SvcAction>delete</") >= 0)
+ assertTrue(req.indexOf("<request-action>DeleteBRGInstance</") >= 0)
+ assertTrue(req.indexOf("<sdncadapter:RequestId>") >= 0)
+ }
+
+ @Test
+ public void preProcessSDNCDelete_BpmnError() {
+ ExecutionEntity mex = setupMock()
+ initPreProcessSDNC(mex)
+
+ when(mex.getVariable("allottedResourceId")).thenThrow(new BpmnError("expected exception"))
+
+ DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
+
+ assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceBRG.preProcessSDNCDelete(mex) }))
+ }
+
+ @Test
+ public void preProcessSDNCDelete_Ex() {
+ ExecutionEntity mex = setupMock()
+ initPreProcessSDNC(mex)
+
+ when(mex.getVariable("allottedResourceId")).thenThrow(new RuntimeException("expected exception"))
+
+ DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
+
+ assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceBRG.preProcessSDNCDelete(mex) }))
+ }
+
+ // ***** preProcessSDNCDeactivate *****
+
+ @Test
+ public void preProcessSDNCDeactivate() {
+ ExecutionEntity mex = setupMock()
+ def map = setupMap(mex)
+ initPreProcessSDNC(mex)
+
+ DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
+ DoDeleteAllottedResourceBRG.preProcessSDNCDeactivate(mex)
+
+ def req = map.get("sdncDeactivateRequest")
+
+ assertTrue(req.indexOf("<sdncadapter:SvcAction>deactivate</") >= 0)
+ assertTrue(req.indexOf("<request-action>DeleteBRGInstance</") >= 0)
+ assertTrue(req.indexOf("<sdncadapter:RequestId>") >= 0)
+ }
+
+ @Test
+ public void preProcessSDNCDeactivate_BpmnError() {
+ ExecutionEntity mex = setupMock()
+ initPreProcessSDNC(mex)
+
+ when(mex.getVariable("allottedResourceId")).thenThrow(new BpmnError("expected exception"))
+
+ DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
+
+ assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceBRG.preProcessSDNCDeactivate(mex) }))
+ }
+
+ @Test
+ public void preProcessSDNCDeactivate_Ex() {
+ ExecutionEntity mex = setupMock()
+ initPreProcessSDNC(mex)
+
+ when(mex.getVariable("allottedResourceId")).thenThrow(new RuntimeException("expected exception"))
+
+ DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
+
+ assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceBRG.preProcessSDNCDeactivate(mex) }))
+ }
+
+ // ***** validateSDNCResp *****
+
+ @Test
+ public void validateSDNCResp() {
+ ExecutionEntity mex = setupMock()
+ initValidateSDNCResp(mex)
+ def resp = initValidateSDNCResp_Resp(200)
+
+ when(mex.getVariable(Prefix + "sdncResponseSuccess")).thenReturn(true)
+
+ DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
+
+ DoDeleteAllottedResourceBRG.validateSDNCResp(mex, resp, "create")
+
+ verify(mex).getVariable("WorkflowException")
+ verify(mex).getVariable("SDNCA_SuccessIndicator")
+ verify(mex).getVariable(Prefix + "sdncResponseSuccess")
+
+ verify(mex, never()).getVariable(Prefix + "sdncRequestDataResponseCode")
+ verify(mex, never()).setVariable("wasDeleted", false)
+ }
+
+ @Test
+ public void validateSDNCResp_Fail404_Deactivate_FailNotFound() {
+ ExecutionEntity mex = setupMock()
+ initValidateSDNCResp(mex)
+
+ def resp = initValidateSDNCResp_Resp(404)
+ when(mex.getVariable(Prefix + "sdncRequestDataResponseCode")).thenReturn("404")
+ when(mex.getVariable("failNotFound")).thenReturn("true")
+
+ DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
+
+ assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceBRG.validateSDNCResp(mex, resp, "deactivate") }))
+ }
+
+ @Test
+ public void validateSDNCResp_Fail404_Deactivate() {
+ ExecutionEntity mex = setupMock()
+ initValidateSDNCResp(mex)
+
+ def resp = initValidateSDNCResp_Resp(404)
+ when(mex.getVariable(Prefix + "sdncRequestDataResponseCode")).thenReturn("404")
+
+ DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
+
+ DoDeleteAllottedResourceBRG.validateSDNCResp(mex, resp, "deactivate")
+
+ verify(mex).setVariable("ARNotFoundInSDNC", true)
+ verify(mex).setVariable("wasDeleted", false)
+ }
+
+ @Test
+ public void validateSDNCResp_Fail404() {
+ ExecutionEntity mex = setupMock()
+ initValidateSDNCResp(mex)
+
+ def resp = initValidateSDNCResp_Resp(404)
+ when(mex.getVariable(Prefix + "sdncRequestDataResponseCode")).thenReturn("404")
+
+ DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
+
+ assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceBRG.validateSDNCResp(mex, resp, "create") }))
+ }
+
+ @Test
+ public void validateSDNCResp_Deactivate() {
+ ExecutionEntity mex = setupMock()
+ def data = initValidateSDNCResp(mex)
+ def resp = initValidateSDNCResp_Resp(200)
+
+ DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
+
+ assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceBRG.validateSDNCResp(mex, resp, "deactivate") }))
+ }
+
+ @Test
+ public void validateSDNCResp_BpmnError() {
+ ExecutionEntity mex = setupMock()
+ initValidateSDNCResp(mex)
+ def resp = initValidateSDNCResp_Resp(200)
+
+ when(mex.getVariable("WorkflowException")).thenThrow(new BpmnError("expected exception"))
+
+ DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
+
+ assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceBRG.validateSDNCResp(mex, resp, "create") }))
+ }
+
+ @Test
+ public void validateSDNCResp_Ex() {
+ ExecutionEntity mex = setupMock()
+ initValidateSDNCResp(mex)
+ def resp = initValidateSDNCResp_Resp(200)
+
+ when(mex.getVariable("WorkflowException")).thenThrow(new RuntimeException("expected exception"))
+
+ DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
+
+ assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceBRG.validateSDNCResp(mex, resp, "create") }))
+ }
+
+ @Test
+ @Ignore
+ public void deleteAaiAR() {
+ ExecutionEntity mex = setupMock()
+ initDeleteAaiAR(mex)
+
+ MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml")
+ MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS)
+
+ DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
+ DoDeleteAllottedResourceBRG.deleteAaiAR(mex)
+ }
+
+ @Test
+ public void deleteAaiAR_NoArPath() {
+ ExecutionEntity mex = setupMock()
+ initDeleteAaiAR(mex)
+
+ MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml")
+ MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS)
+
+ when(mex.getVariable("aaiARPath")).thenReturn("")
+
+ DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
+
+ assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceBRG.deleteAaiAR(mex) }))
+ }
+
+ @Test
+ public void deleteAaiAR_BpmnError() {
+ ExecutionEntity mex = setupMock()
+ initDeleteAaiAR(mex)
+
+ MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml")
+ MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS)
+
+ when(mex.getVariable("aaiARPath")).thenThrow(new BpmnError("expected exception"))
+
+ DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
+
+ assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceBRG.deleteAaiAR(mex) }))
+ }
+
+ @Test
+ public void deleteAaiAR_Ex() {
+ ExecutionEntity mex = setupMock()
+ initDeleteAaiAR(mex)
+
+ MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml")
+ MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS)
+
+ when(mex.getVariable("aaiARPath")).thenThrow(new RuntimeException("expected exception"))
+
+ DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
+
+ assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceBRG.deleteAaiAR(mex) }))
+ }
+
+ private boolean checkMissingPreProcessRequest(String fieldnm) {
+ ExecutionEntity mex = setupMock()
+ initPreProcess(mex)
+
+ DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
+
+ when(mex.getVariable(fieldnm)).thenReturn("")
+
+ return doBpmnError({ _ -> DoDeleteAllottedResourceBRG.preProcessRequest(mex) })
+ }
+
+ private void initPreProcess(ExecutionEntity mex) {
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("mso.workflow.sdncadapter.callback")).thenReturn("sdncurn")
+ when(mex.getVariable("serviceInstanceId")).thenReturn("sii")
+ when(mex.getVariable("allottedResourceId")).thenReturn("ari")
+ }
+
+ private void initGetAaiAR(ExecutionEntity mex) {
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("allottedResourceType")).thenReturn("BRG")
+ when(mex.getVariable("allottedResourceRole")).thenReturn("BRG")
+ when(mex.getVariable("allottedResourceId")).thenReturn(ARID)
+ when(mex.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn(UrnPropertiesReader.getVariable("mso.workflow.global.default.aai.namespace"))
+ when(mex.getVariable("mso.workflow.global.default.aai.version")).thenReturn(UrnPropertiesReader.getVariable("mso.workflow.global.default.aai.version"))
+ when(mex.getVariable("mso.workflow.default.aai.v8.nodes.query.uri")).thenReturn(UrnPropertiesReader.getVariable("mso.workflow.default.aai.v8.nodes-query.uri"))
+ when(mex.getVariable("aai.endpoint")).thenReturn(aaiUriPfx)
+ when(mex.getVariable("aaiARPath")).thenReturn("/business/customers/customer/" + CUST + "/service-subscriptions/service-subscription/" + SVC + "/service-instances/service-instance/" + INST + "/allotted-resources/allotted-resource/" + ARID)
+ when(mex.getVariable("aaiAROrchStatus")).thenReturn("Active")
+ }
+
+ private initUpdateAaiAROrchStatus(ExecutionEntity mex) {
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("aaiARPath")).thenReturn("/business/customers/customer/" + CUST + "/service-subscriptions/service-subscription/" + SVC + "/service-instances/service-instance/" + INST + "/allotted-resources/allotted-resource/" + ARID)
+ }
+
+ private initBuildSDNCRequest(ExecutionEntity mex) {
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("allottedResourceId")).thenReturn("ari")
+ when(mex.getVariable("serviceInstanceId")).thenReturn("sii")
+ when(mex.getVariable("parentServiceInstanceId")).thenReturn("psii")
+ when(mex.getVariable("subscriptionServiceType")).thenReturn("sst")
+ when(mex.getVariable("globalCustomerId")).thenReturn("gci")
+ when(mex.getVariable("sdncCallbackUrl")).thenReturn("scu")
+ when(mex.getVariable("msoRequestId")).thenReturn("mri")
+ }
+
+ private initPreProcessSDNC(ExecutionEntity mex) {
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ }
+
+ private initValidateSDNCResp(ExecutionEntity mex) {
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("prefix")).thenReturn(Prefix)
+ when(mex.getVariable("SDNCA_SuccessIndicator")).thenReturn(true)
+ }
+
+ private String initValidateSDNCResp_Resp(int code) {
+ return "<response-data>&lt;response-code&gt;${code}&lt;/response-code&gt;</response-data>"
+ }
+
+ private initDeleteAaiAR(ExecutionEntity mex) {
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("aaiARPath")).thenReturn("/business/customers/customer/" + CUST + "/service-subscriptions/service-subscription/" + SVC + "/service-instances/service-instance/" + INST + "/allotted-resources/allotted-resource/" + ARID)
+ when(mex.getVariable("aaiARResourceVersion")).thenReturn("myvers")
+ when(mex.getVariable("aai.endpoint")).thenReturn(aaiUriPfx)
+ }
+
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXCTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXCTest.groovy
index ad9b3d4f88..23115874a2 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXCTest.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXCTest.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -20,19 +22,15 @@
package org.onap.so.bpmn.vcpe.scripts
+import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity
-import org.junit.Before
-import org.junit.BeforeClass
-import org.junit.Rule
-import org.junit.Test
-import org.junit.Ignore
+import org.junit.*
import org.mockito.MockitoAnnotations
-import org.camunda.bpm.engine.delegate.BpmnError
import org.mockito.Spy
import org.onap.so.bpmn.core.UrnPropertiesReader
-import org.onap.so.bpmn.mock.FileUtil
-import org.onap.so.client.aai.entities.uri.AAIResourceUri
-import static org.junit.Assert.*;
+
+import static org.junit.Assert.assertTrue
+import static org.mockito.ArgumentMatchers.eq
import static org.mockito.Mockito.*
import static org.onap.so.bpmn.mock.StubResponseAAI.MockDeleteAllottedResource
import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetAllottedResource
@@ -40,534 +38,498 @@ import static org.onap.so.bpmn.mock.StubResponseAAI.MockPatchAllottedResource
import com.github.tomakehurst.wiremock.junit.WireMockRule
class DoDeleteAllottedResourceTXCTest extends GroovyTestBase {
-
- @Rule
- public WireMockRule wireMockRule = new WireMockRule(PORT)
- String Prefix = "DDARTXC_"
+ @Rule
+ public WireMockRule wireMockRule = new WireMockRule(PORT)
+
+ String Prefix = "DDARTXC_"
@Spy
DoDeleteAllottedResourceTXC doDeleteAllottedResourceTXC
- @BeforeClass
- public static void setUpBeforeClass() {
- super.setUpBeforeClass()
- }
-
+ @BeforeClass
+ public static void setUpBeforeClass() {
+ GroovyTestBase.setUpBeforeClass()
+ }
+
@Before
- public void init()
- {
+ public void init() {
MockitoAnnotations.initMocks(this)
- super.init()
+ initAllottedResourceMock()
+ }
+
+ public DoDeleteAllottedResourceTXCTest() {
+ super("DoDeleteAllottedResourceTXC")
+ }
+
+ // ***** preProcessRequest *****
+
+ @Test
+ public void preProcessRequest() {
+ ExecutionEntity mex = setupMock()
+ initPreProcess(mex)
+
+ DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
+ DoDeleteAllottedResourceTXC.preProcessRequest(mex)
+
+ verify(mex).setVariable("prefix", Prefix)
+ verify(mex).setVariable("sdncCallbackUrl", "sdncurn")
+
+ assertTrue(checkMissingPreProcessRequest("mso.workflow.sdncadapter.callback"))
+ assertTrue(checkMissingPreProcessRequest("serviceInstanceId"))
+ assertTrue(checkMissingPreProcessRequest("allottedResourceId"))
+ }
+
+ @Test
+ public void preProcessRequest_BpmnError() {
+ ExecutionEntity mex = setupMock()
+ initPreProcess(mex)
+
+ when(mex.getVariable("serviceInstanceId")).thenThrow(new BpmnError("expected exception"))
+
+ DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
+
+ assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceTXC.preProcessRequest(mex) }))
+ }
+
+ @Test
+ public void preProcessRequest_Ex() {
+ ExecutionEntity mex = setupMock()
+ initPreProcess(mex)
+
+ when(mex.getVariable("serviceInstanceId")).thenThrow(new RuntimeException("expected exception"))
+
+ DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
+
+ assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceTXC.preProcessRequest(mex) }))
+ }
+
+ // ***** getAaiAR *****
+ @Test
+ public void getAaiAR() {
+
+ ExecutionEntity mex = setupMock()
+ initGetAaiAR(mex)
when(doDeleteAllottedResourceTXC.getAllottedResourceUtils()).thenReturn(allottedResourceUtils_MOCK)
- }
-
- public DoDeleteAllottedResourceTXCTest() {
- super("DoDeleteAllottedResourceTXC")
- }
-
-
- // ***** preProcessRequest *****
-
- @Test
-// @Ignore
- public void preProcessRequest() {
- ExecutionEntity mex = setupMock()
- initPreProcess(mex)
-
- DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
- DoDeleteAllottedResourceTXC.preProcessRequest(mex)
-
- //verify(mex).getVariable(DBGFLAG)
- verify(mex).setVariable("prefix", Prefix)
- verify(mex).setVariable("sdncCallbackUrl", "sdncurn")
-
- assertTrue(checkMissingPreProcessRequest("mso.workflow.sdncadapter.callback"))
- assertTrue(checkMissingPreProcessRequest("serviceInstanceId"))
- assertTrue(checkMissingPreProcessRequest("allottedResourceId"))
- }
-
- @Test
-// @Ignore
- public void preProcessRequest_BpmnError() {
- ExecutionEntity mex = setupMock()
- initPreProcess(mex)
-
- when(mex.getVariable("serviceInstanceId")).thenThrow(new BpmnError("expected exception"))
-
- DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
-
- assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceTXC.preProcessRequest(mex) }))
- }
-
- @Test
-// @Ignore
- public void preProcessRequest_Ex() {
- ExecutionEntity mex = setupMock()
- initPreProcess(mex)
-
- when(mex.getVariable("serviceInstanceId")).thenThrow(new RuntimeException("expected exception"))
-
- DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
-
- assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceTXC.preProcessRequest(mex) }))
- }
-
-
- // ***** getAaiAR *****
- @Test
+ doReturn(true).when(allottedResourceUtils_MOCK).ifExistsAR(eq(mex), eq(ARID))
+ doDeleteAllottedResourceTXC.getAaiAR(mex)
+ verify(mex).setVariable("parentServiceInstanceId", INST)
+ }
+
+ @Test
+ public void getAaiAR_EmptyResponse() {
+ ExecutionEntity mex = setupMock()
+ initGetAaiAR(mex)
+ doReturn(false).when(allottedResourceUtils_MOCK).ifExistsAR(eq(mex), eq(ARID))
+ assertTrue(doBpmnError({ _ -> doDeleteAllottedResourceTXC.getAaiAR(mex) }))
+ }
+
+ // ***** updateAaiAROrchStatus *****
+
+ @Test
@Ignore
- public void getAaiAR() {
+ public void updateAaiAROrchStatus() {
+ ExecutionEntity mex = setupMock()
+ initUpdateAaiAROrchStatus(mex)
+
+ MockPatchAllottedResource(CUST, SVC, INST, ARID)
+
+ DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
+ DoDeleteAllottedResourceTXC.updateAaiAROrchStatus(mex, "success")
+ }
+
+ // ***** buildSDNCRequest *****
+
+ @Test
+ public void buildSDNCRequest() {
+ ExecutionEntity mex = setupMock()
+ initBuildSDNCRequest(mex)
+
+ DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
+
+ String result = DoDeleteAllottedResourceTXC.buildSDNCRequest(mex, "myact", "myreq")
+
+ assertTrue(result.indexOf("<sdncadapter:RequestId>myreq</") >= 0)
+ assertTrue(result.indexOf("<sdncadapter:SvcAction>myact</") >= 0)
+ assertTrue(result.indexOf("<allotted-resource-id>ari</") >= 0)
+ assertTrue(result.indexOf("<sdncadapter:SvcInstanceId>sii</") >= 0)
+ assertTrue(result.indexOf("<service-instance-id>sii</") >= 0)
+ assertTrue(result.indexOf("<parent-service-instance-id>psii</") >= 0)
+ assertTrue(result.indexOf("<subscription-service-type>sst</") >= 0)
+ assertTrue(result.indexOf("<global-customer-id>gci</") >= 0)
+ assertTrue(result.indexOf("<sdncadapter:CallbackUrl>scu</") >= 0)
+ assertTrue(result.indexOf("<request-id>mri</") >= 0)
+ assertTrue(result.indexOf("<model-invariant-uuid/>") >= 0)
+ assertTrue(result.indexOf("<model-uuid/>") >= 0)
+ assertTrue(result.indexOf("<model-customization-uuid/>") >= 0)
+ assertTrue(result.indexOf("<model-version/>") >= 0)
+ assertTrue(result.indexOf("<model-name/>") >= 0)
+ }
+
+ @Test
+ public void buildSDNCRequest_Ex() {
+ ExecutionEntity mex = setupMock()
+ initBuildSDNCRequest(mex)
+
+ when(mex.getVariable("allottedResourceId")).thenThrow(new RuntimeException("expected exception"))
+
+ DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
+
+ assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceTXC.buildSDNCRequest(mex, "myact", "myreq") }))
+ }
+
+ // ***** preProcessSDNCUnassign *****
+
+ @Test
+ public void preProcessSDNCUnassign() {
+ ExecutionEntity mex = setupMock()
+ def map = setupMap(mex)
+ initPreProcessSDNC(mex)
+
+ DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
+ DoDeleteAllottedResourceTXC.preProcessSDNCUnassign(mex)
+
+ def req = map.get("sdncUnassignRequest")
+
+ assertTrue(req.indexOf("<sdncadapter:SvcAction>unassign</") >= 0)
+ assertTrue(req.indexOf("<request-action>DeleteTunnelXConnInstance</") >= 0)
+ assertTrue(req.indexOf("<sdncadapter:RequestId>") >= 0)
+ }
+
+ @Test
+ public void preProcessSDNCUnassign_BpmnError() {
+ ExecutionEntity mex = setupMock()
+ initPreProcessSDNC(mex)
+
+ when(mex.getVariable("allottedResourceId")).thenThrow(new BpmnError("expected exception"))
+
+ DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
+
+ assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceTXC.preProcessSDNCUnassign(mex) }))
+ }
+
+ @Test
+ public void preProcessSDNCUnassign_Ex() {
+ ExecutionEntity mex = setupMock()
+ initPreProcessSDNC(mex)
+
+ when(mex.getVariable("allottedResourceId")).thenThrow(new RuntimeException("expected exception"))
+
+ DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
+
+ assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceTXC.preProcessSDNCUnassign(mex) }))
+ }
+
+ // ***** preProcessSDNCDelete *****
+
+ @Test
+ public void preProcessSDNCDelete() {
+ ExecutionEntity mex = setupMock()
+ def map = setupMap(mex)
+ initPreProcessSDNC(mex)
+
+ DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
+ DoDeleteAllottedResourceTXC.preProcessSDNCDelete(mex)
+
+ def req = map.get("sdncDeleteRequest")
+
+ assertTrue(req.indexOf("<sdncadapter:SvcAction>delete</") >= 0)
+ assertTrue(req.indexOf("<request-action>DeleteTunnelXConnInstance</") >= 0)
+ assertTrue(req.indexOf("<sdncadapter:RequestId>") >= 0)
+ }
+
+ @Test
+ public void preProcessSDNCDelete_BpmnError() {
+ ExecutionEntity mex = setupMock()
+ initPreProcessSDNC(mex)
+
+ when(mex.getVariable("allottedResourceId")).thenThrow(new BpmnError("expected exception"))
+
+ DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
+
+ assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceTXC.preProcessSDNCDelete(mex) }))
+ }
+
+ @Test
+ public void preProcessSDNCDelete_Ex() {
+ ExecutionEntity mex = setupMock()
+ initPreProcessSDNC(mex)
+
+ when(mex.getVariable("allottedResourceId")).thenThrow(new RuntimeException("expected exception"))
+
+ DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
+
+ assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceTXC.preProcessSDNCDelete(mex) }))
+ }
+
+ // ***** preProcessSDNCDeactivate *****
+
+ @Test
+ public void preProcessSDNCDeactivate() {
+ ExecutionEntity mex = setupMock()
+ def map = setupMap(mex)
+ initPreProcessSDNC(mex)
+
+ DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
+ DoDeleteAllottedResourceTXC.preProcessSDNCDeactivate(mex)
+
+ def req = map.get("sdncDeactivateRequest")
+
+ assertTrue(req.indexOf("<sdncadapter:SvcAction>deactivate</") >= 0)
+ assertTrue(req.indexOf("<request-action>DeleteTunnelXConnInstance</") >= 0)
+ assertTrue(req.indexOf("<sdncadapter:RequestId>") >= 0)
+ }
+
+ @Test
+ public void preProcessSDNCDeactivate_BpmnError() {
+ ExecutionEntity mex = setupMock()
+ initPreProcessSDNC(mex)
+
+ when(mex.getVariable("allottedResourceId")).thenThrow(new BpmnError("expected exception"))
+
+ DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
+
+ assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceTXC.preProcessSDNCDeactivate(mex) }))
+ }
+
+ @Test
+ public void preProcessSDNCDeactivate_Ex() {
+ ExecutionEntity mex = setupMock()
+ initPreProcessSDNC(mex)
+
+ when(mex.getVariable("allottedResourceId")).thenThrow(new RuntimeException("expected exception"))
+
+ DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
+
+ assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceTXC.preProcessSDNCDeactivate(mex) }))
+ }
+
+ // ***** validateSDNCResp *****
+
+ @Test
+ public void validateSDNCResp() {
+ ExecutionEntity mex = setupMock()
+ initValidateSDNCResp(mex)
+ def resp = initValidateSDNCResp_Resp(200)
+
+ when(mex.getVariable(Prefix + "sdncResponseSuccess")).thenReturn(true)
+
+ DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
+
+ DoDeleteAllottedResourceTXC.validateSDNCResp(mex, resp, "create")
+
+ verify(mex).getVariable("WorkflowException")
+ verify(mex).getVariable("SDNCA_SuccessIndicator")
+ verify(mex).getVariable(Prefix + "sdncResponseSuccess")
+
+ verify(mex, never()).getVariable(Prefix + "sdncRequestDataResponseCode")
+ verify(mex, never()).setVariable("wasDeleted", false)
+ }
+
+ @Test
+ public void validateSDNCResp_Fail404_Deactivate_FailNotFound() {
+ ExecutionEntity mex = setupMock()
+ initValidateSDNCResp(mex)
+
+ def resp = initValidateSDNCResp_Resp(404)
+ when(mex.getVariable(Prefix + "sdncRequestDataResponseCode")).thenReturn("404")
+ when(mex.getVariable("failNotFound")).thenReturn("true")
+
+ DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
+
+ assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceTXC.validateSDNCResp(mex, resp, "deactivate") }))
+ }
+
+ @Test
+ public void validateSDNCResp_Fail404_Deactivate() {
+ ExecutionEntity mex = setupMock()
+ initValidateSDNCResp(mex)
+
+ def resp = initValidateSDNCResp_Resp(404)
+ when(mex.getVariable(Prefix + "sdncRequestDataResponseCode")).thenReturn("404")
+
+ DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
+
+ DoDeleteAllottedResourceTXC.validateSDNCResp(mex, resp, "deactivate")
+
+ verify(mex).setVariable("ARNotFoundInSDNC", true)
+ verify(mex).setVariable("wasDeleted", false)
+ }
+
+ @Test
+ public void validateSDNCResp_Fail404() {
+ ExecutionEntity mex = setupMock()
+ initValidateSDNCResp(mex)
+
+ def resp = initValidateSDNCResp_Resp(404)
+ when(mex.getVariable(Prefix + "sdncRequestDataResponseCode")).thenReturn("404")
+
+ DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
+
+ assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceTXC.validateSDNCResp(mex, resp, "create") }))
+ }
+
+ @Test
+ public void validateSDNCResp_Deactivate() {
+ ExecutionEntity mex = setupMock()
+ initValidateSDNCResp(mex)
+ def resp = initValidateSDNCResp_Resp(200)
+
+ DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
+
+ assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceTXC.validateSDNCResp(mex, resp, "deactivate") }))
+ }
+
+ @Test
+ public void validateSDNCResp_BpmnError() {
+ ExecutionEntity mex = setupMock()
+ initValidateSDNCResp(mex)
+ def resp = initValidateSDNCResp_Resp(200)
+
+ when(mex.getVariable("WorkflowException")).thenThrow(new BpmnError("expected exception"))
+
+ DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
+
+ assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceTXC.validateSDNCResp(mex, resp, "create") }))
+ }
+
+ @Test
+ public void validateSDNCResp_Ex() {
+ ExecutionEntity mex = setupMock()
+ initValidateSDNCResp(mex)
+ def resp = initValidateSDNCResp_Resp(200)
+
+ when(mex.getVariable("WorkflowException")).thenThrow(new RuntimeException("expected exception"))
+
+ DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
+
+ assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceTXC.validateSDNCResp(mex, resp, "create") }))
+ }
+
+ @Test
+ @Ignore
+ public void deleteAaiAR() {
+ ExecutionEntity mex = setupMock()
+ initDeleteAaiAR(mex)
+
+ MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml")
+ MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS)
+
+ DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
+ DoDeleteAllottedResourceTXC.deleteAaiAR(mex)
+ }
+
+ @Test
+ public void deleteAaiAR_NoArPath() {
+ ExecutionEntity mex = setupMock()
+ initDeleteAaiAR(mex)
+
+ MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml")
+ MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS)
+
+ when(mex.getVariable("aaiARPath")).thenReturn("")
+
+ DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
+
+ assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceTXC.deleteAaiAR(mex) }))
+ }
+
+ @Test
+ public void deleteAaiAR_BpmnError() {
+ ExecutionEntity mex = setupMock()
+ initDeleteAaiAR(mex)
+
+ MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml")
+ MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS)
+
+ when(mex.getVariable("aaiARPath")).thenThrow(new BpmnError("expected exception"))
+
+ DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
+
+ assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceTXC.deleteAaiAR(mex) }))
+ }
+
+ @Test
+ public void deleteAaiAR_Ex() {
+ ExecutionEntity mex = setupMock()
+ initDeleteAaiAR(mex)
+
+ MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml")
+ MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS)
+
+ when(mex.getVariable("aaiARPath")).thenThrow(new RuntimeException("expected exception"))
+
+ DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
+
+ assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceTXC.deleteAaiAR(mex) }))
+ }
+
+ private boolean checkMissingPreProcessRequest(String fieldnm) {
+ ExecutionEntity mex = setupMock()
+ initPreProcess(mex)
+
+ DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
+
+ when(mex.getVariable(fieldnm)).thenReturn("")
+
+ return doBpmnError({ _ -> DoDeleteAllottedResourceTXC.preProcessRequest(mex) })
+ }
+
+ private void initPreProcess(ExecutionEntity mex) {
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("mso.workflow.sdncadapter.callback")).thenReturn("sdncurn")
+ when(mex.getVariable("serviceInstanceId")).thenReturn("sii")
+ when(mex.getVariable("allottedResourceId")).thenReturn("ari")
+ }
+
+ private void initGetAaiAR(ExecutionEntity mex) {
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("allottedResourceType")).thenReturn("TXC")
+ when(mex.getVariable("allottedResourceRole")).thenReturn("TXC")
+ when(mex.getVariable("allottedResourceId")).thenReturn(ARID)
+ when(mex.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn(UrnPropertiesReader.getVariable("mso.workflow.global.default.aai.namespace"))
+ when(mex.getVariable("mso.workflow.global.default.aai.version")).thenReturn(UrnPropertiesReader.getVariable("mso.workflow.global.default.aai.version"))
+ when(mex.getVariable("mso.workflow.default.aai.v8.nodes.query.uri")).thenReturn(UrnPropertiesReader.getVariable("mso.workflow.default.aai.v8.nodes-query.uri"))
+ when(mex.getVariable("aai.endpoint")).thenReturn(aaiUriPfx)
+ when(mex.getVariable("aaiARPath")).thenReturn("/business/customers/customer/" + CUST + "/service-subscriptions/service-subscription/" + SVC + "/service-instances/service-instance/" + INST + "/allotted-resources/allotted-resource/" + ARID)
+ when(mex.getVariable("aaiAROrchStatus")).thenReturn("Active")
+ }
+
+ private initUpdateAaiAROrchStatus(ExecutionEntity mex) {
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("aaiARPath")).thenReturn("/business/customers/customer/" + CUST + "/service-subscriptions/service-subscription/" + SVC + "/service-instances/service-instance/" + INST + "/allotted-resources/allotted-resource/" + ARID)
+ }
+
+ private initBuildSDNCRequest(ExecutionEntity mex) {
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("allottedResourceId")).thenReturn("ari")
+ when(mex.getVariable("serviceInstanceId")).thenReturn("sii")
+ when(mex.getVariable("parentServiceInstanceId")).thenReturn("psii")
+ when(mex.getVariable("subscriptionServiceType")).thenReturn("sst")
+ when(mex.getVariable("globalCustomerId")).thenReturn("gci")
+ when(mex.getVariable("sdncCallbackUrl")).thenReturn("scu")
+ when(mex.getVariable("msoRequestId")).thenReturn("mri")
+ }
+
+ private initPreProcessSDNC(ExecutionEntity mex) {
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ }
+
+ private initValidateSDNCResp(ExecutionEntity mex) {
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("prefix")).thenReturn(Prefix)
+ when(mex.getVariable("SDNCA_SuccessIndicator")).thenReturn(true)
+ }
+
+ private String initValidateSDNCResp_Resp(int code) {
+ return "<response-data>&lt;response-code&gt;${code}&lt;/response-code&gt;</response-data>"
+ }
+
+ private initDeleteAaiAR(ExecutionEntity mex) {
+ when(mex.getVariable(DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("aaiARPath")).thenReturn("/business/customers/customer/" + CUST + "/service-subscriptions/service-subscription/" + SVC + "/service-instances/service-instance/" + INST + "/allotted-resources/allotted-resource/" + ARID)
+ when(mex.getVariable("aaiARResourceVersion")).thenReturn("myvers")
+ when(mex.getVariable("aai.endpoint")).thenReturn(aaiUriPfx)
+ }
- ExecutionEntity mex = setupMock()
- initGetAaiAR(mex)
- when(client_MOCK.exists(any(AAIResourceUri.class))).thenReturn(true)
- doDeleteAllottedResourceTXC.getAaiAR(mex)
- verify(mex).setVariable("parentServiceInstanceId", INST)
- }
-
- @Test
- public void getAaiAR_EmptyResponse() {
- ExecutionEntity mex = setupMock()
- initGetAaiAR(mex)
- when(client_MOCK.exists(any(AAIResourceUri.class))).thenReturn(false)
- assertTrue(doBpmnError( { _ -> doDeleteAllottedResourceTXC.getAaiAR(mex) }))
- }
-
-
- // ***** updateAaiAROrchStatus *****
-
- @Test
- @Ignore
- public void updateAaiAROrchStatus() {
- ExecutionEntity mex = setupMock()
- initUpdateAaiAROrchStatus(mex)
-
- MockPatchAllottedResource(CUST, SVC, INST, ARID)
-
- DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
- DoDeleteAllottedResourceTXC.updateAaiAROrchStatus(mex, "success")
- }
-
-
- // ***** buildSDNCRequest *****
-
- @Test
-// @Ignore
- public void buildSDNCRequest() {
- ExecutionEntity mex = setupMock()
- initBuildSDNCRequest(mex)
-
- DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
-
- String result = DoDeleteAllottedResourceTXC.buildSDNCRequest(mex, "myact", "myreq")
-
- assertTrue(result.indexOf("<sdncadapter:RequestId>myreq</") >= 0)
- assertTrue(result.indexOf("<sdncadapter:SvcAction>myact</") >= 0)
- assertTrue(result.indexOf("<allotted-resource-id>ari</") >= 0)
- assertTrue(result.indexOf("<sdncadapter:SvcInstanceId>sii</") >= 0)
- assertTrue(result.indexOf("<service-instance-id>sii</") >= 0)
- assertTrue(result.indexOf("<parent-service-instance-id>psii</") >= 0)
- assertTrue(result.indexOf("<subscription-service-type>sst</") >= 0)
- assertTrue(result.indexOf("<global-customer-id>gci</") >= 0)
- assertTrue(result.indexOf("<sdncadapter:CallbackUrl>scu</") >= 0)
- assertTrue(result.indexOf("<request-id>mri</") >= 0)
- assertTrue(result.indexOf("<model-invariant-uuid/>") >= 0)
- assertTrue(result.indexOf("<model-uuid/>") >= 0)
- assertTrue(result.indexOf("<model-customization-uuid/>") >= 0)
- assertTrue(result.indexOf("<model-version/>") >= 0)
- assertTrue(result.indexOf("<model-name/>") >= 0)
- }
-
- @Test
-// @Ignore
- public void buildSDNCRequest_Ex() {
- ExecutionEntity mex = setupMock()
- initBuildSDNCRequest(mex)
-
- when(mex.getVariable("allottedResourceId")).thenThrow(new RuntimeException("expected exception"))
-
- DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
-
- assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceTXC.buildSDNCRequest(mex, "myact", "myreq") }))
- }
-
-
- // ***** preProcessSDNCUnassign *****
-
- @Test
-// @Ignore
- public void preProcessSDNCUnassign() {
- ExecutionEntity mex = setupMock()
- def map = setupMap(mex)
- initPreProcessSDNC(mex)
-
- DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
- DoDeleteAllottedResourceTXC.preProcessSDNCUnassign(mex)
-
- def req = map.get("sdncUnassignRequest")
-
- assertTrue(req.indexOf("<sdncadapter:SvcAction>unassign</") >= 0)
- assertTrue(req.indexOf("<request-action>DeleteTunnelXConnInstance</") >= 0)
- assertTrue(req.indexOf("<sdncadapter:RequestId>") >= 0)
- }
-
- @Test
-// @Ignore
- public void preProcessSDNCUnassign_BpmnError() {
- ExecutionEntity mex = setupMock()
- initPreProcessSDNC(mex)
-
- when(mex.getVariable("allottedResourceId")).thenThrow(new BpmnError("expected exception"))
-
- DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
-
- assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceTXC.preProcessSDNCUnassign(mex) }))
- }
-
- @Test
-// @Ignore
- public void preProcessSDNCUnassign_Ex() {
- ExecutionEntity mex = setupMock()
- initPreProcessSDNC(mex)
-
- when(mex.getVariable("allottedResourceId")).thenThrow(new RuntimeException("expected exception"))
-
- DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
-
- assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceTXC.preProcessSDNCUnassign(mex) }))
- }
-
-
- // ***** preProcessSDNCDelete *****
-
- @Test
-// @Ignore
- public void preProcessSDNCDelete() {
- ExecutionEntity mex = setupMock()
- def map = setupMap(mex)
- initPreProcessSDNC(mex)
-
- DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
- DoDeleteAllottedResourceTXC.preProcessSDNCDelete(mex)
-
- def req = map.get("sdncDeleteRequest")
-
- assertTrue(req.indexOf("<sdncadapter:SvcAction>delete</") >= 0)
- assertTrue(req.indexOf("<request-action>DeleteTunnelXConnInstance</") >= 0)
- assertTrue(req.indexOf("<sdncadapter:RequestId>") >= 0)
- }
-
- @Test
-// @Ignore
- public void preProcessSDNCDelete_BpmnError() {
- ExecutionEntity mex = setupMock()
- initPreProcessSDNC(mex)
-
- when(mex.getVariable("allottedResourceId")).thenThrow(new BpmnError("expected exception"))
-
- DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
-
- assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceTXC.preProcessSDNCDelete(mex) }))
- }
-
- @Test
-// @Ignore
- public void preProcessSDNCDelete_Ex() {
- ExecutionEntity mex = setupMock()
- initPreProcessSDNC(mex)
-
- when(mex.getVariable("allottedResourceId")).thenThrow(new RuntimeException("expected exception"))
-
- DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
-
- assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceTXC.preProcessSDNCDelete(mex) }))
- }
-
-
- // ***** preProcessSDNCDeactivate *****
-
- @Test
-// @Ignore
- public void preProcessSDNCDeactivate() {
- ExecutionEntity mex = setupMock()
- def map = setupMap(mex)
- initPreProcessSDNC(mex)
-
- DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
- DoDeleteAllottedResourceTXC.preProcessSDNCDeactivate(mex)
-
- def req = map.get("sdncDeactivateRequest")
-
- assertTrue(req.indexOf("<sdncadapter:SvcAction>deactivate</") >= 0)
- assertTrue(req.indexOf("<request-action>DeleteTunnelXConnInstance</") >= 0)
- assertTrue(req.indexOf("<sdncadapter:RequestId>") >= 0)
- }
-
- @Test
-// @Ignore
- public void preProcessSDNCDeactivate_BpmnError() {
- ExecutionEntity mex = setupMock()
- initPreProcessSDNC(mex)
-
- when(mex.getVariable("allottedResourceId")).thenThrow(new BpmnError("expected exception"))
-
- DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
-
- assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceTXC.preProcessSDNCDeactivate(mex) }))
- }
-
- @Test
-// @Ignore
- public void preProcessSDNCDeactivate_Ex() {
- ExecutionEntity mex = setupMock()
- initPreProcessSDNC(mex)
-
- when(mex.getVariable("allottedResourceId")).thenThrow(new RuntimeException("expected exception"))
-
- DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
-
- assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceTXC.preProcessSDNCDeactivate(mex) }))
- }
-
-
- // ***** validateSDNCResp *****
-
- @Test
-// @Ignore
- public void validateSDNCResp() {
- ExecutionEntity mex = setupMock()
- def data = initValidateSDNCResp(mex)
- def resp = initValidateSDNCResp_Resp(200)
-
- when(mex.getVariable(Prefix+"sdncResponseSuccess")).thenReturn(true)
-
- DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
-
- DoDeleteAllottedResourceTXC.validateSDNCResp(mex, resp, "create")
-
- verify(mex).getVariable("WorkflowException")
- verify(mex).getVariable("SDNCA_SuccessIndicator")
- verify(mex).getVariable(Prefix+"sdncResponseSuccess")
-
- verify(mex, never()).getVariable(Prefix + "sdncRequestDataResponseCode")
- verify(mex, never()).setVariable("wasDeleted", false)
- }
-
- @Test
-// @Ignore
- public void validateSDNCResp_Fail404_Deactivate_FailNotFound() {
- ExecutionEntity mex = setupMock()
- def data = initValidateSDNCResp(mex)
-
- def resp = initValidateSDNCResp_Resp(404)
- when(mex.getVariable(Prefix+"sdncRequestDataResponseCode")).thenReturn("404")
- when(mex.getVariable("failNotFound")).thenReturn("true")
-
- DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
-
- assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceTXC.validateSDNCResp(mex, resp, "deactivate")}))
- }
-
- @Test
-// @Ignore
- public void validateSDNCResp_Fail404_Deactivate() {
- ExecutionEntity mex = setupMock()
- def data = initValidateSDNCResp(mex)
-
- def resp = initValidateSDNCResp_Resp(404)
- when(mex.getVariable(Prefix+"sdncRequestDataResponseCode")).thenReturn("404")
-
- DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
-
- DoDeleteAllottedResourceTXC.validateSDNCResp(mex, resp, "deactivate")
-
- verify(mex).setVariable("ARNotFoundInSDNC", true)
- verify(mex).setVariable("wasDeleted", false)
- }
-
- @Test
-// @Ignore
- public void validateSDNCResp_Fail404() {
- ExecutionEntity mex = setupMock()
- def data = initValidateSDNCResp(mex)
-
- def resp = initValidateSDNCResp_Resp(404)
- when(mex.getVariable(Prefix+"sdncRequestDataResponseCode")).thenReturn("404")
-
- DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
-
- assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceTXC.validateSDNCResp(mex, resp, "create")}))
- }
-
- @Test
-// @Ignore
- public void validateSDNCResp_Deactivate() {
- ExecutionEntity mex = setupMock()
- def data = initValidateSDNCResp(mex)
- def resp = initValidateSDNCResp_Resp(200)
-
- DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
-
- assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceTXC.validateSDNCResp(mex, resp, "deactivate")}))
- }
-
- @Test
-// @Ignore
- public void validateSDNCResp_BpmnError() {
- ExecutionEntity mex = setupMock()
- initValidateSDNCResp(mex)
- def resp = initValidateSDNCResp_Resp(200)
-
- when(mex.getVariable("WorkflowException")).thenThrow(new BpmnError("expected exception"))
-
- DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
-
- assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceTXC.validateSDNCResp(mex, resp, "create") }))
- }
-
- @Test
-// @Ignore
- public void validateSDNCResp_Ex() {
- ExecutionEntity mex = setupMock()
- initValidateSDNCResp(mex)
- def resp = initValidateSDNCResp_Resp(200)
-
- when(mex.getVariable("WorkflowException")).thenThrow(new RuntimeException("expected exception"))
-
- DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
-
- assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceTXC.validateSDNCResp(mex, resp, "create") }))
- }
-
- @Test
- @Ignore
- public void deleteAaiAR() {
- ExecutionEntity mex = setupMock()
- initDeleteAaiAR(mex)
-
- MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml")
- MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS)
-
- DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
- DoDeleteAllottedResourceTXC.deleteAaiAR(mex)
- }
-
- @Test
-// @Ignore
- public void deleteAaiAR_NoArPath() {
- ExecutionEntity mex = setupMock()
- initDeleteAaiAR(mex)
-
- MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml")
- MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS)
-
- when(mex.getVariable("aaiARPath")).thenReturn("")
-
- DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
-
- assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceTXC.deleteAaiAR(mex) }))
- }
-
- @Test
-// @Ignore
- public void deleteAaiAR_BpmnError() {
- ExecutionEntity mex = setupMock()
- initDeleteAaiAR(mex)
-
- MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml")
- MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS)
-
- when(mex.getVariable("aaiARPath")).thenThrow(new BpmnError("expected exception"))
-
- DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
-
- assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceTXC.deleteAaiAR(mex) }))
- }
-
- @Test
-// @Ignore
- public void deleteAaiAR_Ex() {
- ExecutionEntity mex = setupMock()
- initDeleteAaiAR(mex)
-
- MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml")
- MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS)
-
- when(mex.getVariable("aaiARPath")).thenThrow(new RuntimeException("expected exception"))
-
- DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
-
- assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceTXC.deleteAaiAR(mex) }))
- }
-
- private boolean checkMissingPreProcessRequest(String fieldnm) {
- ExecutionEntity mex = setupMock()
- initPreProcess(mex)
-
- DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
-
- when(mex.getVariable(fieldnm)).thenReturn("")
-
- return doBpmnError( { _ -> DoDeleteAllottedResourceTXC.preProcessRequest(mex) })
- }
-
- private void initPreProcess(ExecutionEntity mex) {
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("mso.workflow.sdncadapter.callback")).thenReturn("sdncurn")
- when(mex.getVariable("serviceInstanceId")).thenReturn("sii")
- when(mex.getVariable("allottedResourceId")).thenReturn("ari")
- }
-
- private void initGetAaiAR(ExecutionEntity mex) {
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("allottedResourceType")).thenReturn("TXC")
- when(mex.getVariable("allottedResourceRole")).thenReturn("TXC")
- when(mex.getVariable("allottedResourceId")).thenReturn(ARID)
- when(mex.getVariable("CSI_service")).thenReturn(FileUtil.readResourceFile("__files/VCPE/DoDeleteAllottedResourceTXC/getAR.xml"))
- when(mex.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn(UrnPropertiesReader.getVariable("mso.workflow.global.default.aai.namespace"))
- when(mex.getVariable("mso.workflow.global.default.aai.version")).thenReturn(UrnPropertiesReader.getVariable("mso.workflow.global.default.aai.version"))
- when(mex.getVariable("mso.workflow.default.aai.v8.nodes.query.uri")).thenReturn(UrnPropertiesReader.getVariable("mso.workflow.default.aai.v8.nodes-query.uri"))
- when(mex.getVariable("aai.endpoint")).thenReturn(aaiUriPfx)
- when(mex.getVariable("aaiARPath")).thenReturn("/business/customers/customer/"+CUST+"/service-subscriptions/service-subscription/"+SVC+"/service-instances/service-instance/"+INST+"/allotted-resources/allotted-resource/"+ARID)
- when(mex.getVariable("aaiAROrchStatus")).thenReturn("Active")
- }
-
- private initUpdateAaiAROrchStatus(ExecutionEntity mex) {
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("aaiARPath")).thenReturn("/business/customers/customer/"+CUST+"/service-subscriptions/service-subscription/"+SVC+"/service-instances/service-instance/"+INST+"/allotted-resources/allotted-resource/"+ARID)
- }
-
- private initBuildSDNCRequest(ExecutionEntity mex) {
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("allottedResourceId")).thenReturn("ari")
- when(mex.getVariable("serviceInstanceId")).thenReturn("sii")
- when(mex.getVariable("parentServiceInstanceId")).thenReturn("psii")
- when(mex.getVariable("subscriptionServiceType")).thenReturn("sst")
- when(mex.getVariable("globalCustomerId")).thenReturn("gci")
- when(mex.getVariable("sdncCallbackUrl")).thenReturn("scu")
- when(mex.getVariable("msoRequestId")).thenReturn("mri")
- }
-
- private initPreProcessSDNC(ExecutionEntity mex) {
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- }
-
- private initValidateSDNCResp(ExecutionEntity mex) {
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("prefix")).thenReturn(Prefix)
- when(mex.getVariable("SDNCA_SuccessIndicator")).thenReturn(true)
- }
-
- private String initValidateSDNCResp_Resp(int code) {
- return "<response-data>&lt;response-code&gt;${code}&lt;/response-code&gt;</response-data>"
- }
-
- private initDeleteAaiAR(ExecutionEntity mex) {
- when(mex.getVariable(DBGFLAG)).thenReturn("true")
- when(mex.getVariable("aaiARPath")).thenReturn("/business/customers/customer/"+CUST+"/service-subscriptions/service-subscription/"+SVC+"/service-instances/service-instance/"+INST+"/allotted-resources/allotted-resource/"+ARID)
- when(mex.getVariable("aaiARResourceVersion")).thenReturn("myvers")
- when(mex.getVariable("aai.endpoint")).thenReturn(aaiUriPfx)
- }
-
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/GroovyTestBase.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/GroovyTestBase.groovy
index 8ce3bdb6c3..1ff098b940 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/GroovyTestBase.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/GroovyTestBase.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -20,97 +22,94 @@
package org.onap.so.bpmn.vcpe.scripts
-
import org.camunda.bpm.engine.ProcessEngineServices
import org.camunda.bpm.engine.RepositoryService
+import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity
import org.camunda.bpm.engine.repository.ProcessDefinition
import org.junit.runner.RunWith
import org.mockito.Mock
-import org.camunda.bpm.engine.delegate.BpmnError
-import org.mockito.runners.MockitoJUnitRunner
+import org.mockito.junit.MockitoJUnitRunner
import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.onap.so.bpmn.common.scripts.AllottedResourceUtils
import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.client.aai.AAIResourcesClient
+
+import static org.mockito.ArgumentMatchers.any
import static org.mockito.Mockito.*
@RunWith(MockitoJUnitRunner.class)
class GroovyTestBase {
-
- static final int PORT = 28090
- static final String LOCAL_URI = "http://localhost:" + PORT
-
- static final String CUST = "SDN-ETHERNET-INTERNET"
- static final String SVC = "123456789"
- static final String INST = "MIS%252F1604%252F0026%252FSW_INTERNET"
- static final String ARID = "arId-1"
- static final String VERS = "myvers"
-
- static final String DBGFLAG = "isDebugLogEnabled"
-
- static String aaiUriPfx
-
- String processName
+
+ static final int PORT = 28090
+ static final String LOCAL_URI = "http://localhost:" + PORT
+
+ static final String CUST = "SDN-ETHERNET-INTERNET"
+ static final String SVC = "123456789"
+ static final String INST = "MIS%252F1604%252F0026%252FSW_INTERNET"
+ static final String ARID = "arId-1"
+ static final String VERS = "myvers"
+
+ static final String DBGFLAG = "isDebugLogEnabled"
+
+ static String aaiUriPfx
+
+ String processName
AllottedResourceUtils allottedResourceUtils_MOCK
@Mock
AAIResourcesClient client_MOCK
- public static void setUpBeforeClass() {
- aaiUriPfx = UrnPropertiesReader.getVariable("aai.endpoint")
- }
-
- public GroovyTestBase(String processName) {
- this.processName = processName
- }
-
- public boolean doBpmnError(def func) {
-
- try {
- func()
- return false;
-
- } catch(BpmnError e) {
- return true;
- }
- }
-
- public ExecutionEntity setupMock() {
-
- ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class)
- when(mockProcessDefinition.getKey()).thenReturn(processName)
- RepositoryService mockRepositoryService = mock(RepositoryService.class)
- when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition)
- when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn(processName)
- when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100")
- ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class)
- when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService)
-
- ExecutionEntity mex = mock(ExecutionEntity.class)
-
- when(mex.getId()).thenReturn("100")
- when(mex.getProcessDefinitionId()).thenReturn(processName)
- when(mex.getProcessInstanceId()).thenReturn(processName)
- when(mex.getProcessEngineServices()).thenReturn(mockProcessEngineServices)
- when(mex.getProcessEngineServices().getRepositoryService().getProcessDefinition(mex.getProcessDefinitionId())).thenReturn(mockProcessDefinition)
-
- when(mex.getVariable("isAsyncProcess")).thenReturn("true")
- when(mex.getVariable(processName+"WorkflowResponseSent")).thenReturn("false")
-
- return mex
- }
-
- public Map<String,Object> setupMap(ExecutionEntity mex) {
- MapSetter mapset = new MapSetter();
- doAnswer(mapset).when(mex).setVariable(any(), any())
- return mapset.getMap();
- }
-
- void init(){
+ public static void setUpBeforeClass() {
+ aaiUriPfx = UrnPropertiesReader.getVariable("aai.endpoint")
+ }
+
+ public GroovyTestBase(String processName) {
+ this.processName = processName
+ }
+
+ public boolean doBpmnError(def func) {
+
+ try {
+ func()
+ return false;
+
+ } catch (BpmnError e) {
+ return true;
+ }
+ }
+
+ public ExecutionEntity setupMock() {
+
+ ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class)
+ when(mockProcessDefinition.getKey()).thenReturn(processName)
+ RepositoryService mockRepositoryService = mock(RepositoryService.class)
+ when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition)
+ when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn(processName)
+ ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class)
+ when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService)
+
+ ExecutionEntity mex = mock(ExecutionEntity.class)
+
+ when(mex.getProcessDefinitionId()).thenReturn(processName)
+ when(mex.getProcessEngineServices()).thenReturn(mockProcessEngineServices)
+ when(mex.getProcessEngineServices().getRepositoryService().getProcessDefinition(mex.getProcessDefinitionId())).thenReturn(mockProcessDefinition)
+
+ when(mex.getVariable("isAsyncProcess")).thenReturn("true")
+ when(mex.getVariable(processName + "WorkflowResponseSent")).thenReturn("false")
+
+ return mex
+ }
+
+ public Map<String, Object> setupMap(ExecutionEntity mex) {
+ MapSetter mapset = new MapSetter();
+ doAnswer(mapset).when(mex).setVariable(any(), any())
+ return mapset.getMap();
+ }
+
+ void initAllottedResourceMock() {
allottedResourceUtils_MOCK = spy(new AllottedResourceUtils(mock(AbstractServiceTaskProcessor.class)))
- when(allottedResourceUtils_MOCK.getAAIClient()).thenReturn(client_MOCK)
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/MapGetter.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/MapGetter.groovy
index fa5dcec4bc..9b29c43a9c 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/MapGetter.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/MapGetter.groovy
@@ -18,32 +18,29 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.bpmn.vcpe.scripts;
+package org.onap.so.bpmn.vcpe.scripts
-import java.util.HashMap;
-import java.util.Map;
-
-import org.mockito.invocation.InvocationOnMock;
-import org.mockito.stubbing.Answer;
+import org.mockito.invocation.InvocationOnMock
+import org.mockito.stubbing.Answer
class MapGetter implements Answer<Object> {
- final Map<String,Object> map;
-
- public MapGetter() {
- map = new HashMap<>();
- }
-
- public MapGetter(Map<String,Object> map) {
- this.map = map;
- }
-
- public Map<String, Object> getMap() {
- return map;
- }
-
- @Override
- public Object answer(InvocationOnMock invocation) throws Throwable {
- return map.get(invocation.getArgumentAt(0, String.class));
- }
-
-}
+ final Map<String, Object> map;
+
+ public MapGetter() {
+ map = new HashMap<>();
+ }
+
+ public MapGetter(Map<String, Object> map) {
+ this.map = map;
+ }
+
+ public Map<String, Object> getMap() {
+ return map;
+ }
+
+ @Override
+ public Object answer(InvocationOnMock invocation) throws Throwable {
+ return map.get(invocation.getArgumentAt(0, String.class));
+ }
+
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/MapSetter.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/MapSetter.groovy
index 7b50c616ea..06057cdd61 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/MapSetter.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/MapSetter.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -18,33 +20,30 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.bpmn.vcpe.scripts;
-
-import java.util.HashMap;
-import java.util.Map;
+package org.onap.so.bpmn.vcpe.scripts
-import org.mockito.invocation.InvocationOnMock;
-import org.mockito.stubbing.Answer;
+import org.mockito.invocation.InvocationOnMock
+import org.mockito.stubbing.Answer
class MapSetter implements Answer<Void> {
- final Map<String,Object> map;
-
- public MapSetter() {
- map = new HashMap<>();
- }
-
- public MapSetter(Map<String,Object> map) {
- this.map = map;
- }
-
- public Map<String, Object> getMap() {
- return map;
- }
-
- @Override
- public Void answer(InvocationOnMock invocation) throws Throwable {
- map.put(invocation.getArgumentAt(0, String.class), invocation.getArgumentAt(1, Object.class));
- return null;
- }
-
-}
+ final Map<String, Object> map;
+
+ public MapSetter() {
+ map = new HashMap<>();
+ }
+
+ public MapSetter(Map<String, Object> map) {
+ this.map = map;
+ }
+
+ public Map<String, Object> getMap() {
+ return map;
+ }
+
+ @Override
+ public Void answer(InvocationOnMock invocation) throws Throwable {
+ map.put((String) invocation.getArgument(0), invocation.getArgument(1))
+ return null
+ }
+
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/AllTestsTestSuite.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/AllTestsTestSuite.java
index 0c0f38c0f9..01f37ad655 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/AllTestsTestSuite.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/AllTestsTestSuite.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 - 2018 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
@@ -27,8 +29,8 @@ import com.googlecode.junittoolbox.WildcardPatternSuite;
@RunWith(WildcardPatternSuite.class)
@SuiteClasses({"!**/service/*Test.class", "!**/subprocess/*Test.class", "!**/process/*Test.class",
- "!**/tasks/*Test.class", "!**/infrastructure/aai/*Test.class",
- "!**/scripts/*Test.class", "**/*Test.class"})
+ "!**/tasks/*Test.class", "!**/infrastructure/aai/*Test.class",
+ "!**/infrastructure/scripts/*Test.class", "**/*Test.class"})
public class AllTestsTestSuite {
// the class remains empty,
// used only as a holder for the above annotations
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DeleteVcpeResCustService/request.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DeleteVcpeResCustService/request.json
index dc4669e8d9..7c60512c36 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DeleteVcpeResCustService/request.json
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/DeleteVcpeResCustService/request.json
@@ -23,6 +23,7 @@
},
"cloudConfiguration":
{
+ "cloudOwner":"CloudOwner",
"lcpCloudRegionId":"mdt1",
"tenantId":"8b1df54faa3b49078e3416e21370a3ba"
},
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java
index 8711f965fd..8dd55d9eac 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java
@@ -55,6 +55,7 @@ import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.exception.BBObjectNotFoundException;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.client.orchestration.AAIConfigurationResources;
+import org.onap.so.client.orchestration.AAIInstanceGroupResources;
import org.onap.so.client.orchestration.AAINetworkResources;
import org.onap.so.client.orchestration.AAIServiceInstanceResources;
import org.onap.so.client.orchestration.AAIVfModuleResources;
@@ -97,6 +98,8 @@ public class AAICreateTasks {
@Autowired
private AAIConfigurationResources aaiConfigurationResources;
@Autowired
+ private AAIInstanceGroupResources aaiInstanceGroupResources;
+ @Autowired
private Environment env;
public void createServiceInstance(BuildingBlockExecution execution) {
@@ -117,8 +120,8 @@ public class AAICreateTasks {
if (null == customer) {
String errorMessage = "Exception in creating ServiceSubscription. Customer not present for ServiceInstanceID: "
+ serviceInstance.getServiceInstanceId();
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), errorMessage, "BPMN",
- MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), errorMessage);
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), errorMessage, "BPMN",
+ MsoLogger.ErrorCode.UnknownError.getValue(), errorMessage);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, errorMessage);
}
aaiSIResources.createServiceSubscription(customer);
@@ -162,14 +165,14 @@ public class AAICreateTasks {
} else {
if (owningEntityName == null || "".equals(owningEntityName)) {
String msg = "Exception in AAICreateOwningEntity. Can't create an owningEntity with no owningEntityName.";
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), msg);
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.ErrorCode.UnknownError.getValue(), msg);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg);
} else {
if(aaiSIResources.existsOwningEntityName(owningEntityName)){
String msg = "Exception in AAICreateOwningEntity. Can't create OwningEntity as name already exists in AAI associated with a different owning-entity-id (name must be unique)";
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), msg);
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.ErrorCode.UnknownError.getValue(), msg);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg);
}else{
aaiSIResources.createOwningEntityandConnectServiceInstance(owningEntity, serviceInstance);
@@ -450,6 +453,16 @@ public class AAICreateTasks {
}
}
+ public void createInstanceGroupVnf(BuildingBlockExecution execution){
+ try{
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ InstanceGroup instanceGroup = extractPojosForBB.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID, execution.getLookupMap().get(ResourceKey.INSTANCE_GROUP_ID));
+ aaiInstanceGroupResources.createInstanceGroupandConnectServiceInstance(instanceGroup, serviceInstance);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
public void createNetworkPolicies(BuildingBlockExecution execution) {
try{
String fqdns = execution.getVariable(CONTRAIL_NETWORK_POLICY_FQDN_LIST);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java
index 4908cda26a..6e4a5f3d15 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java
@@ -32,6 +32,7 @@ import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup;
import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
@@ -43,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.exception.ExceptionBuilder;
import org.onap.so.client.orchestration.AAIConfigurationResources;
+import org.onap.so.client.orchestration.AAIInstanceGroupResources;
import org.onap.so.client.orchestration.AAINetworkResources;
import org.onap.so.client.orchestration.AAIServiceInstanceResources;
import org.onap.so.client.orchestration.AAIVfModuleResources;
@@ -76,6 +78,8 @@ public class AAIDeleteTasks {
private AAIVolumeGroupResources aaiVolumeGroupResources;
@Autowired
private AAIConfigurationResources aaiConfigurationResources;
+ @Autowired
+ private AAIInstanceGroupResources aaiInstanceGroupResources;
public void deleteVfModule(BuildingBlockExecution execution) throws Exception {
GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
@@ -162,6 +166,15 @@ public class AAIDeleteTasks {
}
}
+ public void deleteInstanceGroupVnf(BuildingBlockExecution execution) {
+ try {
+ InstanceGroup instanceGroup = extractPojosForBB.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID, execution.getLookupMap().get(ResourceKey.INSTANCE_GROUP_ID));
+ aaiInstanceGroupResources.deleteInstanceGroup(instanceGroup);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
public void deleteNetworkPolicies(BuildingBlockExecution execution) {
try{
String fqdns = execution.getVariable(CONTRAIL_NETWORK_POLICY_FQDN_LIST);
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 1402cebfbc..dc8f72c7a5 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
@@ -135,8 +135,8 @@ public class ExecuteActivity implements JavaDelegate {
}
protected void buildAndThrowException(DelegateExecution execution, String msg, Exception ex) {
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), msg, ex);
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.ErrorCode.UnknownError.getValue(), msg, ex);
execution.setVariable("ExecuteActivityErrorMessage", msg);
exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, msg);
}
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 85cbb755f8..4b4b3eca23 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
@@ -135,8 +135,8 @@ public class AppcRunTasks {
mapRollbackVariables(execution, action, appcCode);
}
catch (Exception e) {
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(),
- "Caught exception in runAppcCommand", "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(),
+ "Caught exception in runAppcCommand", "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), "APPC Error", e);
appcMessage = e.getMessage();
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOut.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOut.java
index ba04b16b14..6c0cdb39f6 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOut.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOut.java
@@ -153,9 +153,9 @@ public class ConfigurationScaleOut {
appcMessage = appCClient.getErrorMessage();
} catch (Exception e) {
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(),
"Caught exception in runAppcCommand in ConfigurationScaleOut", "BPMN",
- MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "APPC Error", e);
+ MsoLogger.ErrorCode.UnknownError.getValue(), "APPC Error", e);
appcMessage = e.getMessage();
}
logger.error("Error Message: " + appcMessage);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheck.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheck.java
index bb33b521d6..feb9fb81b4 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheck.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheck.java
@@ -110,23 +110,22 @@ public class GenericVnfHealthCheck {
appcCode = appCClient.getErrorCode();
appcMessage = appCClient.getErrorMessage();
} catch (BpmnError ex) {
- logger.error("", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Caught exception in GenericVnfHealthCheck", "BPMN",
- MsoLogger
- .getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), ex);
- appcMessage = ex.getMessage();
+ logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Caught exception in GenericVnfHealthCheck", "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), ex);
+ appcMessage = ex.getMessage();
exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(appcCode), appcMessage);
} catch (Exception e) {
if (e instanceof java.util.concurrent.TimeoutException )
{
appcMessage = "Request to APPC timed out. ";
- logger.error("{} {} {} {} {} {}", MessageEnum.RA_CONNECTION_EXCEPTION.toString(),
+ logger.error("{} {} {} {} {}", MessageEnum.RA_CONNECTION_EXCEPTION.toString(),
"Caught timedOut exception in runAppcCommand in GenericVnfHealthCheck", "BPMN",
- MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "APPC Error", e);
+ MsoLogger.ErrorCode.UnknownError.getValue(), "APPC Error", e);
throw e;
}
else {
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(),
- "Caught exception in runAppcCommand in GenericVnfHealthCheck", "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(),
+ "Caught exception in runAppcCommand in GenericVnfHealthCheck", "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), "APPC Error", e);
appcMessage = e.getMessage();
exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(appcCode), appcMessage);
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 c457034eca..3763fca34f 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
@@ -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.validations;
import java.util.Optional;
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 75f293655f..a622520a71 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
@@ -108,6 +108,10 @@ public class OrchestrationStatusValidator {
org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID, execution.getLookupMap().get(ResourceKey.CONFIGURATION_ID));
orchestrationStatus = configuration.getOrchestrationStatus();
break;
+ case INSTANCE_GROUP:
+ org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup instanceGroup = extractPojosForBB.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID, execution.getLookupMap().get(ResourceKey.INSTANCE_GROUP_ID));
+ orchestrationStatus = instanceGroup.getOrchestrationStatus();
+ break;
case NO_VALIDATE:
//short circuit and exit method
execution.setVariable(ORCHESTRATION_STATUS_VALIDATION_RESULT, OrchestrationStatusValidationDirective.VALIDATION_SKIPPED);
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 8a3a778b06..d87b11a1a6 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
@@ -108,7 +108,7 @@ public class WorkflowAction {
private static final String ASSIGNINSTANCE = "assignInstance";
private static final String CREATEINSTANCE = "createInstance";
private static final String USERPARAMSERVICE = "service";
- private static final String supportedTypes = "vnfs|vfModules|networks|networkCollections|volumeGroups|serviceInstances";
+ private static final String supportedTypes = "vnfs|vfModules|networks|networkCollections|volumeGroups|serviceInstances|instanceGroups";
private static final String HOMINGSOLUTION = "Homing_Solution";
private static final String FABRIC_CONFIGURATION = "FabricConfiguration";
private static final String G_SERVICE_TYPE = "serviceType";
@@ -202,17 +202,25 @@ public class WorkflowAction {
orchFlows = filterOrchFlows(sIRequest, orchFlows, resourceType, execution);
String key = "";
ModelInfo modelInfo = sIRequest.getRequestDetails().getModelInfo();
- if(modelInfo.getModelType().equals(ModelType.service)) {
- key = modelInfo.getModelVersionId();
- } else {
- key = modelInfo.getModelCustomizationId();
+ if(modelInfo != null) {
+ if(modelInfo.getModelType().equals(ModelType.service)) {
+ key = modelInfo.getModelVersionId();
+ } else {
+ key = modelInfo.getModelCustomizationId();
+ }
}
+ boolean isConfiguration = isConfiguration(orchFlows);
Resource resourceKey = new Resource(resourceType, key, aLaCarte);
+ List<ExecuteBuildingBlock> configBuildingBlocks = getConfigBuildingBlocks(sIRequest, orchFlows, requestId, resourceKey, apiVersion, resourceId, requestAction, aLaCarte, vnfType,
+ workflowResourceIds, requestDetails, isConfiguration);
for (OrchestrationFlow orchFlow : orchFlows) {
- ExecuteBuildingBlock ebb = buildExecuteBuildingBlock(orchFlow, requestId, resourceKey, apiVersion, resourceId,
- requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null, false);
- flowsToExecute.add(ebb);
+ if(!orchFlow.getFlowName().contains("Configuration")) {
+ ExecuteBuildingBlock ebb = buildExecuteBuildingBlock(orchFlow, requestId, resourceKey, apiVersion, resourceId,
+ requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null, false);
+ flowsToExecute.add(ebb);
+ }
}
+ flowsToExecute.addAll(configBuildingBlocks);
} else {
boolean foundRelated = false;
boolean containsService = false;
@@ -339,6 +347,53 @@ public class WorkflowAction {
buildAndThrowException(execution, "Exception in create execution list " + ex.getMessage(), ex);
}
}
+
+ protected boolean isConfiguration(List<OrchestrationFlow> orchFlows) {
+ for(OrchestrationFlow flow : orchFlows) {
+ if(flow.getFlowName().contains("Configuration")) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ protected List<ExecuteBuildingBlock> getConfigBuildingBlocks(ServiceInstancesRequest sIRequest, List<OrchestrationFlow> orchFlows, String requestId, Resource resourceKey,
+ String apiVersion, String resourceId, String requestAction, boolean aLaCarte, String vnfType,
+ WorkflowResourceIds workflowResourceIds, RequestDetails requestDetails, boolean isConfiguration) {
+ List<OrchestrationFlow> result = new ArrayList<>(orchFlows);
+ result = orchFlows.stream().filter(item -> item.getFlowName().contains(FABRIC_CONFIGURATION)).collect(Collectors.toList());
+ String vnfCustomizationUUID = "";
+ String vfModuleCustomizationUUID = sIRequest.getRequestDetails().getModelInfo().getModelCustomizationUuid();
+ RelatedInstanceList[] relatedInstanceList = sIRequest.getRequestDetails().getRelatedInstanceList();
+ if (relatedInstanceList != null) {
+ for (RelatedInstanceList relatedInstList : relatedInstanceList) {
+ RelatedInstance relatedInstance = relatedInstList.getRelatedInstance();
+ if (relatedInstance.getModelInfo().getModelType().equals(ModelType.vnf)) {
+ vnfCustomizationUUID = relatedInstance.getModelInfo().getModelCustomizationUuid();
+ }
+ }
+ }
+
+ List<VnfVfmoduleCvnfcConfigurationCustomization> fabricCustomizations = traverseCatalogDbForConfiguration(vnfCustomizationUUID, vfModuleCustomizationUUID);
+ List<ExecuteBuildingBlock> flowsToExecuteConfigs = new ArrayList<>();
+ for(VnfVfmoduleCvnfcConfigurationCustomization fabricConfig : fabricCustomizations) {
+
+ if (requestAction.equals(CREATEINSTANCE)) {
+ workflowResourceIds.setConfigurationId(UUID.randomUUID().toString());
+ } else {
+ //TODO AAI lookup for configuration update/delete
+ }
+ for(OrchestrationFlow orchFlow : result) {
+ resourceKey.setVfModuleCustomizationId(vfModuleCustomizationUUID);
+ resourceKey.setCvnfModuleCustomizationId(fabricConfig.getCvnfcCustomization().getModelCustomizationUUID());
+ resourceKey.setVnfCustomizationId(vnfCustomizationUUID);
+ ExecuteBuildingBlock ebb = buildExecuteBuildingBlock(orchFlow, requestId, resourceKey, apiVersion, resourceId,
+ requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null, true);
+ flowsToExecuteConfigs.add(ebb);
+ }
+ }
+ return flowsToExecuteConfigs;
+ }
protected List<Resource> sortVfModulesByBaseFirst(List<Resource> vfModuleResources) {
int count = 0;
@@ -698,9 +753,9 @@ public class WorkflowAction {
vfModuleCustomizationUUID = vfModule.getModelInfo().getModelCustomizationUuid();
}
if(!vnfCustomizationUUID.equals("")&&!vfModuleCustomizationUUID.equals("")){
- List<String> configs = traverseCatalogDbForConfiguration(vnfCustomizationUUID,vfModuleCustomizationUUID);
- for(String config : configs){
- Resource configResource = new Resource(WorkflowType.CONFIGURATION,config,false);
+ List<VnfVfmoduleCvnfcConfigurationCustomization> configs = traverseCatalogDbForConfiguration(vnfCustomizationUUID,vfModuleCustomizationUUID);
+ for(VnfVfmoduleCvnfcConfigurationCustomization config : configs){
+ Resource configResource = new Resource(WorkflowType.CONFIGURATION,config.getConfigurationResource().getModelUUID(),false);
resource.setVnfCustomizationId(vnf.getModelInfo().getModelCustomizationId());
resource.setVfModuleCustomizationId(vfModule.getModelInfo().getModelCustomizationId());
resourceCounter.add(configResource);
@@ -734,20 +789,19 @@ public class WorkflowAction {
}
return foundRelated;
}
-
- protected List<String> traverseCatalogDbForConfiguration(String vnfCustomizationUUID, String vfModuleCustomizationUUID) {
- List<String> configurations = new ArrayList<>();
+ protected List<VnfVfmoduleCvnfcConfigurationCustomization> traverseCatalogDbForConfiguration(String vnfCustomizationUUID, String vfModuleCustomizationUUID) {
+ List<VnfVfmoduleCvnfcConfigurationCustomization> configurations = new ArrayList<>();
try{
List<CvnfcCustomization> cvnfcCustomizations = catalogDbClient.getCvnfcCustomizationByVnfCustomizationUUIDAndVfModuleCustomizationUUID(vnfCustomizationUUID, vfModuleCustomizationUUID);
for(CvnfcCustomization cvnfc : cvnfcCustomizations){
for(VnfVfmoduleCvnfcConfigurationCustomization customization : cvnfc.getVnfVfmoduleCvnfcConfigurationCustomization()){
if(customization.getConfigurationResource().getToscaNodeType().contains(FABRIC_CONFIGURATION)){
- configurations.add(customization.getConfigurationResource().getModelUUID());
+ configurations.add(customization);
}
}
}
- logger.debug("found {} configurations" , configurations.size() );
+ logger.debug("found {} configuration(s)" , configurations.size() );
return configurations;
} catch (Exception ex){
logger.error("Error in finding configurations", ex);
@@ -774,6 +828,7 @@ public class WorkflowAction {
workflowResourceIds.setVfModuleId((String) execution.getVariable("vfModuleId"));
workflowResourceIds.setVnfId((String) execution.getVariable("vnfId"));
workflowResourceIds.setVolumeGroupId((String) execution.getVariable("volumeGroupId"));
+ workflowResourceIds.setInstanceGroupId((String) execution.getVariable("instanceGroupId"));
return workflowResourceIds;
}
@@ -1048,7 +1103,7 @@ public class WorkflowAction {
executeBuildingBlock.setRequestId(requestId);
executeBuildingBlock.setBuildingBlock(buildingBlock);
executeBuildingBlock.setRequestDetails(requestDetails);
- if(isConfiguration){
+ if(resource != null && (isConfiguration || resource.getResourceType().equals(WorkflowType.CONFIGURATION))){
ConfigurationResourceKeys configurationResourceKeys = new ConfigurationResourceKeys();
if (resource != null){
configurationResourceKeys.setCvnfcCustomizationUUID(resource.getCvnfModuleCustomizationId());
@@ -1120,7 +1175,7 @@ public class WorkflowAction {
}
if (resourceType.equals(WorkflowType.VFMODULE)) {
- List<String> fabricCustomizations = traverseCatalogDbForConfiguration(vnfCustomizationUUID, vfModuleCustomizationUUID);
+ List<VnfVfmoduleCvnfcConfigurationCustomization> fabricCustomizations = traverseCatalogDbForConfiguration(vnfCustomizationUUID, vfModuleCustomizationUUID);
if (fabricCustomizations.isEmpty()) {
result = orchFlows.stream().filter(item -> !item.getFlowName().contains(FABRIC_CONFIGURATION)).collect(Collectors.toList());
}
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 2e91a52f65..33a89e0b82 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
@@ -161,6 +161,7 @@ public class WorkflowActionBBTasks {
WorkflowContextHolder.getInstance().processCallback(processKey, execution.getProcessInstanceId(), requestId,
callbackResponse);
logger.info("Successfully sent sync ack.");
+ updateInstanceId(execution);
}
public void sendErrorSyncAck(DelegateExecution execution) {
@@ -303,100 +304,31 @@ public class WorkflowActionBBTasks {
workflowAction.buildAndThrowException(execution, "Rollback has already been called. Cannot rollback a request that is currently in the rollback state.");
}
}
-
- protected void updateRequestErrorStatusMessage(DelegateExecution execution) {
- try {
- String requestId = (String) execution.getVariable(G_REQUEST_ID);
- InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId);
- String errorMsg = retrieveErrorMessage(execution);
- if(errorMsg == null || errorMsg.equals("")){
- errorMsg = "Failed to determine error message";
- }
- request.setStatusMessage(errorMsg);
- logger.debug("Updating RequestDB to failed: errorMsg = " + errorMsg);
- requestDbclient.updateInfraActiveRequests(request);
- } catch (Exception e) {
- logger.error("Failed to update Request db with the status message after retry or rollback has been initialized.",e);
- }
- }
-
- public void abortCallErrorHandling(DelegateExecution execution) {
- String msg = "Flow has failed. Rainy day handler has decided to abort the process.";
- logger.error(msg);
- throw new BpmnError(msg);
- }
- public void updateRequestStatusToFailed(DelegateExecution execution) {
- try {
+ protected void updateInstanceId(DelegateExecution execution){
+ try{
String requestId = (String) execution.getVariable(G_REQUEST_ID);
+ String resourceId = (String) execution.getVariable("resourceId");
+ WorkflowType resourceType = (WorkflowType) execution.getVariable("resourceType");
InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId);
- String errorMsg = null;
- String rollbackErrorMsg = null;
- boolean rollbackCompleted = (boolean) execution.getVariable("isRollbackComplete");
- boolean isRollbackFailure = (boolean) execution.getVariable("isRollback");
- ExecuteBuildingBlock ebb = (ExecuteBuildingBlock) execution.getVariable("buildingBlock");
-
- if(rollbackCompleted){
- rollbackErrorMsg = "Rollback has been completed successfully.";
- request.setRollbackStatusMessage(rollbackErrorMsg);
- logger.debug("Updating RequestDB to failed: Rollback has been completed successfully");
- }else{
- if(isRollbackFailure){
- rollbackErrorMsg = retrieveErrorMessage(execution);
- if(rollbackErrorMsg == null || rollbackErrorMsg.equals("")){
- rollbackErrorMsg = "Failed to determine rollback error message.";
- }
- request.setRollbackStatusMessage(rollbackErrorMsg);
- logger.debug("Updating RequestDB to failed: rollbackErrorMsg = " + rollbackErrorMsg);
- }else{
- errorMsg = retrieveErrorMessage(execution);
- if(errorMsg == null || errorMsg.equals("")){
- errorMsg = "Failed to determine error message";
- }
- request.setStatusMessage(errorMsg);
- logger.debug("Updating RequestDB to failed: errorMsg = " + errorMsg);
- }
- }
- if(ebb!=null && ebb.getBuildingBlock()!=null){
- String flowStatus = ebb.getBuildingBlock().getBpmnFlowName() + " has failed.";
- request.setFlowStatus(flowStatus);
- execution.setVariable("flowStatus", flowStatus);
+ if(resourceType == WorkflowType.SERVICE){
+ request.setServiceInstanceId(resourceId);
+ }else if(resourceType == WorkflowType.VNF){
+ request.setVnfId(resourceId);
+ }else if(resourceType == WorkflowType.VFMODULE){
+ request.setVfModuleId(resourceId);
+ }else if(resourceType == WorkflowType.VOLUMEGROUP){
+ request.setVolumeGroupId(resourceId);
+ }else if(resourceType == WorkflowType.NETWORK){
+ request.setNetworkId(resourceId);
+ }else if(resourceType == WorkflowType.CONFIGURATION){
+ request.setConfigurationId(resourceId);
+ }else if(resourceType == WorkflowType.INSTANCE_GROUP){
+ request.setInstanceGroupId(resourceId);
}
-
- request.setProgress(Long.valueOf(100));
- request.setRequestStatus("FAILED");
- request.setLastModifiedBy("CamundaBPMN");
requestDbclient.updateInfraActiveRequests(request);
- } catch (Exception e) {
- workflowAction.buildAndThrowException(execution, "Error Updating Request Database", e);
+ }catch(Exception ex){
+ workflowAction.buildAndThrowException(execution, "Failed to update Request db with instanceId");
}
}
-
- private String retrieveErrorMessage (DelegateExecution execution){
- String errorMsg = "";
- try {
- WorkflowException exception = (WorkflowException) execution.getVariable("WorkflowException");
- if(exception != null && (exception.getErrorMessage()!=null || !exception.getErrorMessage().equals(""))){
- errorMsg = exception.getErrorMessage();
- }
- } catch (Exception ex) {
- //log error and attempt to extact WorkflowExceptionMessage
- logger.error("Failed to extract workflow exception from execution.",ex);
- }
-
- if (errorMsg == null || errorMsg.equals("")){
- try {
- errorMsg = (String) execution.getVariable("WorkflowExceptionErrorMessage");
- } catch (Exception ex) {
- logger.error("Failed to extract workflow exception message from WorkflowException",ex);
- errorMsg = "Unexpected Error in BPMN.";
- }
- }
- return errorMsg;
- }
-
- public void updateRequestStatusToFailedWithRollback(DelegateExecution execution) {
- execution.setVariable("isRollbackComplete", true);
- updateRequestStatusToFailed(execution);
- }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowType.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowType.java
index ff5ba152b9..304b4000bd 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowType.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowType.java
@@ -29,7 +29,8 @@ public enum WorkflowType {
NETWORK("Network"),
VIRTUAL_LINK("VirtualLink"),
NETWORKCOLLECTION("NetworkCollection"),
- CONFIGURATION("Configuration");
+ CONFIGURATION("Configuration"),
+ INSTANCE_GROUP("InstanceGroup");
private final String type;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClientResponseValidator.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClientResponseValidator.java
index 787b811501..17fa10a186 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClientResponseValidator.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClientResponseValidator.java
@@ -51,8 +51,8 @@ public class NamingClientResponseValidator {
public String validateNameGenResponse(ResponseEntity<NameGenResponse> response) throws BadResponseException {
if (response == null) {
- logger.error("{} {} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), NO_RESPONSE_FROM_NAMING_SERVICE,
- "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(),
+ logger.error("{} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), NO_RESPONSE_FROM_NAMING_SERVICE,
+ "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(),
NO_RESPONSE_FROM_NAMING_SERVICE);
throw new BadResponseException(NO_RESPONSE_FROM_NAMING_SERVICE);
}
@@ -61,8 +61,8 @@ public class NamingClientResponseValidator {
String generatedName = "";
NameGenResponse responseBody = response.getBody();
if (responseBody == null) {
- logger.error("{} {} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), NULL_RESPONSE_FROM_NAMING_SERVICE,
- "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(),
+ logger.error("{} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), NULL_RESPONSE_FROM_NAMING_SERVICE,
+ "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(),
NULL_RESPONSE_FROM_NAMING_SERVICE);
throw new BadResponseException(NULL_RESPONSE_FROM_NAMING_SERVICE);
}
@@ -91,16 +91,16 @@ public class NamingClientResponseValidator {
errorMessageString = error.getMessage();
}
String errorMessage = String.format(NAMING_SERVICE_ERROR, errorMessageString);
- logger.error("{} {} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), errorMessage, "BPMN",
- MsoLogger.getServiceName(), MsoLogger.ErrorCode.DataError.getValue(), errorMessage);
+ logger.error("{} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), errorMessage, "BPMN",
+ MsoLogger.ErrorCode.DataError.getValue(), errorMessage);
throw new BadResponseException(errorMessage);
}
}
public String validateNameGenDeleteResponse(ResponseEntity<NameGenDeleteResponse> response) throws BadResponseException {
if (response == null) {
- logger.error("{} {} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), NO_RESPONSE_FROM_NAMING_SERVICE,
- "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(),
+ logger.error("{} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), NO_RESPONSE_FROM_NAMING_SERVICE,
+ "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(),
NO_RESPONSE_FROM_NAMING_SERVICE);
throw new BadResponseException(NO_RESPONSE_FROM_NAMING_SERVICE);
}
@@ -109,8 +109,8 @@ public class NamingClientResponseValidator {
String responseMessage = "";
NameGenDeleteResponse responseBody = response.getBody();
if (responseBody == null) {
- logger.error("{} {} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), NULL_RESPONSE_FROM_NAMING_SERVICE,
- "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(),
+ logger.error("{} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), NULL_RESPONSE_FROM_NAMING_SERVICE,
+ "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(),
NULL_RESPONSE_FROM_NAMING_SERVICE);
throw new BadResponseException(NULL_RESPONSE_FROM_NAMING_SERVICE);
}
@@ -122,7 +122,7 @@ public class NamingClientResponseValidator {
String errorMessageString = NAMING_SERVICE_ERROR;
String errorMessage = String.format(NAMING_SERVICE_ERROR, errorMessageString);
- logger.error("{} {} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), errorMessage, "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), errorMessage, "BPMN",
MsoLogger.ErrorCode.DataError.getValue(), errorMessage);
throw new BadResponseException(errorMessage);
}
@@ -142,7 +142,7 @@ public class NamingClientResponseValidator {
errorMessageString = error.getMessage();
}
String errorMessage = String.format(NAMING_SERVICE_ERROR, errorMessageString);
- logger.error("{} {} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), errorMessage, "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), errorMessage, "BPMN",
MsoLogger.ErrorCode.DataError.getValue(), errorMessage);
return errorMessage;
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java
index a96f01c3d0..3bb1d81e27 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java
@@ -27,6 +27,7 @@ import javax.ws.rs.core.UriBuilder;
import org.onap.so.bpmn.common.InjectionHelper;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.aai.entities.AAIEdgeLabel;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.aai.mapper.AAIObjectMapper;
@@ -124,6 +125,20 @@ public class AAIConfigurationResources {
serviceInstanceId);
injectionHelper.getAaiClient().connect(configurationURI, serviceInstanceURI);
}
+
+ /**
+ * A&AI call to add configuration relationship with service instance
+ *
+ * @param configurationId
+ * @param serviceInstanceId
+ * @param aaiLabel
+ */
+ public void connectConfigurationToServiceInstance(String configurationId, String serviceInstanceId, AAIEdgeLabel aaiLabel) {
+ AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId);
+ AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
+ serviceInstanceId);
+ injectionHelper.getAaiClient().connect(configurationURI, serviceInstanceURI, aaiLabel);
+ }
/**
* A&AI call to add configuration relationship with generic-vnf
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIInstanceGroupResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIInstanceGroupResources.java
index 68f6e8ffa2..c325dd75ee 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIInstanceGroupResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIInstanceGroupResources.java
@@ -25,6 +25,7 @@ import java.util.Optional;
import org.onap.so.bpmn.common.InjectionHelper;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.entities.AAIEdgeLabel;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
@@ -68,5 +69,12 @@ public class AAIInstanceGroupResources {
AAIResourceUri instanceGroupUri = AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId());
return injectionHelper.getAaiClient().exists(instanceGroupUri);
}
-
+
+ public void createInstanceGroupandConnectServiceInstance(InstanceGroup instanceGroup, ServiceInstance serviceInstance) {
+ AAIResourceUri instanceGroupUri = AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId());
+ org.onap.aai.domain.yang.InstanceGroup aaiInstanceGroup = aaiObjectMapper.mapInstanceGroup(instanceGroup);
+ AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
+ serviceInstance.getServiceInstanceId());
+ injectionHelper.getAaiClient().createIfNotExists(instanceGroupUri, Optional.of(aaiInstanceGroup)).connect(instanceGroupUri, serviceInstanceURI);
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java
index 2f9c8da5f0..8513b26a5d 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java
@@ -67,9 +67,9 @@ public class SdnCommonTasks {
try {
jsonRequest = objMapper.writerWithDefaultPrettyPrinter().writeValueAsString(request);
} catch (JsonProcessingException e) {
- logger.error("{} {} {} {} {} {}", MessageEnum.JAXB_EXCEPTION.toString(),
+ logger.error("{} {} {} {} {}", MessageEnum.JAXB_EXCEPTION.toString(),
COULD_NOT_CONVERT_SDNC_POJO_TO_JSON,
- "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.DataError.getValue(), e.getMessage());
+ "BPMN", MsoLogger.ErrorCode.DataError.getValue(), e.getMessage());
throw new MapperException(COULD_NOT_CONVERT_SDNC_POJO_TO_JSON);
}
jsonRequest = "{\"input\":" + jsonRequest + "}";
@@ -100,8 +100,8 @@ public class SdnCommonTasks {
*/
public String validateSDNResponse(LinkedHashMap<String, Object> output) throws BadResponseException {
if (CollectionUtils.isEmpty(output)) {
- logger.error("{} {} {} {} {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), NO_RESPONSE_FROM_SDNC, "BPMN",
- MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), NO_RESPONSE_FROM_SDNC);
+ logger.error("{} {} {} {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), NO_RESPONSE_FROM_SDNC, "BPMN",
+ MsoLogger.ErrorCode.UnknownError.getValue(), NO_RESPONSE_FROM_SDNC);
throw new BadResponseException(NO_RESPONSE_FROM_SDNC);
}
LinkedHashMap<String, Object> embeddedResponse =(LinkedHashMap<String, Object>) output.get("output");
@@ -127,8 +127,8 @@ public class SdnCommonTasks {
return jsonResponse;
} else {
String errorMessage = String.format(SDNC_CODE_NOT_0_OR_IN_200_299, responseMessage);
- logger.error("{} {} {} {} {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), errorMessage, "BPMN",
- MsoLogger.getServiceName(), MsoLogger.ErrorCode.DataError.getValue(), errorMessage);
+ logger.error("{} {} {} {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), errorMessage, "BPMN",
+ MsoLogger.ErrorCode.DataError.getValue(), errorMessage);
throw new BadResponseException(errorMessage);
}
}
@@ -141,8 +141,8 @@ public class SdnCommonTasks {
*/
public String validateSDNGetResponse(LinkedHashMap<String, Object> output) throws BadResponseException {
if (CollectionUtils.isEmpty(output)) {
- logger.error("{} {} {} {} {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), NO_RESPONSE_FROM_SDNC, "BPMN",
- MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), NO_RESPONSE_FROM_SDNC);
+ logger.error("{} {} {} {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), NO_RESPONSE_FROM_SDNC, "BPMN",
+ MsoLogger.ErrorCode.UnknownError.getValue(), NO_RESPONSE_FROM_SDNC);
throw new BadResponseException(NO_RESPONSE_FROM_SDNC);
}
ObjectMapper objMapper = new ObjectMapper();
@@ -152,8 +152,8 @@ public class SdnCommonTasks {
stringOutput = objMapper.writeValueAsString(output);
}
catch (Exception e) {
- logger.error("{} {} {} {} {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), BAD_RESPONSE_FROM_SDNC,
- "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(),
+ logger.error("{} {} {} {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), BAD_RESPONSE_FROM_SDNC,
+ "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(),
BAD_RESPONSE_FROM_SDNC);
throw new BadResponseException(BAD_RESPONSE_FROM_SDNC);
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapper.java
index fedbde251e..b086b8a7ff 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapper.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapper.java
@@ -163,7 +163,7 @@ public class GeneralTopologyObjectMapper {
vfModuleInformation.setFromPreload(requestContext.getRequestParameters().getUsePreload());
}
else {
- vfModuleInformation.setFromPreload(false);
+ vfModuleInformation.setFromPreload(true);
}
return vfModuleInformation;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java
index f70ac8399f..5124435a79 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java
@@ -173,8 +173,8 @@ public class VfModuleTopologyOperationRequestMapper {
GenericResourceApiVfModuleResponseInformation assignResponseInfo = mapper.readValue(sdncAssignResponse, GenericResourceApiVfModuleResponseInformation.class);
objectPath = assignResponseInfo.getVfModuleResponseInformation().getObjectPath();
} catch (Exception e) {
- logger.error("{} {} {} {} {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), e.getMessage(), "BPMN",
- MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), e.getMessage());
+ logger.error("{} {} {} {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), e.getMessage(), "BPMN",
+ MsoLogger.ErrorCode.UnknownError.getValue(), e.getMessage());
}
}
return objectPath;
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/BaseTaskTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/BaseTaskTest.java
index 7715de9672..6dc0b1861d 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/BaseTaskTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/BaseTaskTest.java
@@ -24,6 +24,7 @@ import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.so.bpmn.common.InjectionHelper;
import org.onap.so.bpmn.common.data.TestDataSetup;
+import org.onap.so.bpmn.core.UrnPropertiesReader;
import org.onap.so.bpmn.infrastructure.flowspecific.tasks.AssignNetworkBBUtils;
import org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionExtractResourcesAAI;
import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetup;
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/data/TestDataSetup.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/data/TestDataSetup.java
index d8c7ebaff7..166319d32b 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/data/TestDataSetup.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/data/TestDataSetup.java
@@ -382,7 +382,24 @@ public class TestDataSetup{
}
collection.setInstanceGroup(instanceGroup);
+
+ return instanceGroup;
+ }
+
+ public InstanceGroup setInstanceGroupVnf() {
+ InstanceGroup instanceGroup = buildInstanceGroup();
+
+ ServiceInstance serviceInstance = null;
+
+ try {
+ serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ } catch(BBObjectNotFoundException e) {
+ serviceInstance = setServiceInstance();
+ }
+
+ serviceInstance.getInstanceGroups().add(instanceGroup);
+ lookupKeyMap.put(ResourceKey.INSTANCE_GROUP_ID, instanceGroup.getId());
return instanceGroup;
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java
index c48019af83..4e147a022c 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java
@@ -49,6 +49,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup;
import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
import org.onap.so.bpmn.servicedecomposition.bbobjects.NetworkPolicy;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
@@ -75,6 +76,7 @@ public class AAICreateTasksTest extends BaseTaskTest{
private VfModule vfModule;
private Customer customer;
private Configuration configuration;
+ private InstanceGroup instanceGroup;
@Captor
ArgumentCaptor<NetworkPolicy> networkPolicyCaptor;
@@ -92,6 +94,7 @@ public class AAICreateTasksTest extends BaseTaskTest{
cloudRegion = setCloudRegion();
vfModule = setVfModule();
configuration = setConfiguration();
+ instanceGroup = setInstanceGroupVnf();
when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID), any())).thenReturn(genericVnf);
when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID), any())).thenReturn(vfModule);
@@ -99,6 +102,7 @@ public class AAICreateTasksTest extends BaseTaskTest{
when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VOLUME_GROUP_ID), any())).thenReturn(volumeGroup);
when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID), any())).thenReturn(serviceInstance);
when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.CONFIGURATION_ID), any())).thenReturn(configuration);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.INSTANCE_GROUP_ID), any())).thenReturn(instanceGroup);
doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class));
@@ -467,6 +471,21 @@ public class AAICreateTasksTest extends BaseTaskTest{
aaiCreateTasks.connectVnfToTenant(execution);
verify(aaiVnfResources, times(1)).connectVnfToTenant(genericVnf, gBBInput.getCloudRegion());
}
+
+ @Test
+ public void createInstanceGroupVnfTest() throws Exception {
+ doNothing().when(aaiInstanceGroupResources).createInstanceGroupandConnectServiceInstance(instanceGroup, serviceInstance);
+ aaiCreateTasks.createInstanceGroupVnf(execution);
+ verify(aaiInstanceGroupResources, times(1)).createInstanceGroupandConnectServiceInstance(instanceGroup, serviceInstance);
+ }
+
+ @Test
+ public void createInstanceGroupVnfExceptionTest() throws Exception {
+ expectedException.expect(BpmnError.class);
+ doThrow(RuntimeException.class).when(aaiInstanceGroupResources).createInstanceGroupandConnectServiceInstance(instanceGroup, serviceInstance);
+ aaiCreateTasks.createInstanceGroupVnf(execution);
+ }
+
@Test
public void createNetworkPolicyNeedToCreateAllTest() throws Exception {
execution.setVariable("heatStackId", "testHeatStackId");
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasksTest.java
index 4984b2fbb5..94d886cdb5 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasksTest.java
@@ -48,6 +48,7 @@ import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup;
import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
@@ -71,6 +72,7 @@ public class AAIDeleteTasksTest extends BaseTaskTest {
private VolumeGroup volumeGroup;
private CloudRegion cloudRegion;
private Configuration configuration;
+ private InstanceGroup instanceGroup;
@Captor
ArgumentCaptor<String> stringCaptor;
@@ -84,6 +86,7 @@ public class AAIDeleteTasksTest extends BaseTaskTest {
volumeGroup = setVolumeGroup();
cloudRegion = setCloudRegion();
configuration = setConfiguration();
+ instanceGroup = setInstanceGroupVnf();
when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID), any())).thenReturn(genericVnf);
when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID), any())).thenReturn(vfModule);
@@ -91,6 +94,7 @@ public class AAIDeleteTasksTest extends BaseTaskTest {
when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VOLUME_GROUP_ID), any())).thenReturn(volumeGroup);
when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID), any())).thenReturn(serviceInstance);
when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.CONFIGURATION_ID), any())).thenReturn(configuration);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.INSTANCE_GROUP_ID), any())).thenReturn(instanceGroup);
doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class));
@@ -194,6 +198,13 @@ public class AAIDeleteTasksTest extends BaseTaskTest {
}
@Test
+ public void deleteInstanceGroupVnfTest() throws Exception {
+ doNothing().when(aaiInstanceGroupResources).deleteInstanceGroup(instanceGroup);
+ aaiDeleteTasks.deleteInstanceGroupVnf(execution);
+ verify(aaiInstanceGroupResources, times(1)).deleteInstanceGroup(instanceGroup);
+ }
+
+ @Test
public void deleteNetworkPolicyNeedToDeleteAllTest() throws Exception {
execution.setVariable("contrailNetworkPolicyFqdnList", "ABC123,DEF456");
final String content0 = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "queryAaiNetworkPoliciesForDelete0.json")));
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/validations/CloudRegionOrchestrationValidatorTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/validations/CloudRegionOrchestrationValidatorTest.java
index f6988fdcd4..81ec388649 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/validations/CloudRegionOrchestrationValidatorTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/validations/CloudRegionOrchestrationValidatorTest.java
@@ -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.validations;
import static org.junit.Assert.assertEquals;
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 17a37c873a..c2bca34fb6 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
@@ -137,26 +137,6 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest {
}
@Test
- public void updateRequestStatusToFailedFlowStatusTest() {
- String reqId = "reqId123";
- execution.setVariable("mso-request-id", reqId);
- execution.setVariable("isRollbackComplete", false);
- execution.setVariable("isRollback", false);
- ExecuteBuildingBlock ebb = new ExecuteBuildingBlock();
- BuildingBlock buildingBlock = new BuildingBlock();
- buildingBlock.setBpmnFlowName("CreateNetworkBB");
- ebb.setBuildingBlock(buildingBlock);
- execution.setVariable("buildingBlock", ebb);
- WorkflowException wfe = new WorkflowException("failure", 1, "failure");
- execution.setVariable("WorkflowException", wfe);
- InfraActiveRequests req = new InfraActiveRequests();
- doReturn(req).when(requestsDbClient).getInfraActiveRequestbyRequestId(reqId);
- doNothing().when(requestsDbClient).updateInfraActiveRequests(isA(InfraActiveRequests.class));
- workflowActionBBTasks.updateRequestStatusToFailed(execution);
- assertEquals("CreateNetworkBB has failed.",execution.getVariable("flowStatus"));
- }
-
- @Test
public void rollbackExecutionPathTest(){
execution.setVariable("handlingCode", "Rollback");
execution.setVariable("isRollback", false);
@@ -337,4 +317,17 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest {
workflowActionBBTasks.checkRetryStatus(execution);
assertEquals(0,execution.getVariable("retryCount"));
}
+
+ @Test
+ public void updateInstanceId(){
+ String reqId = "req123";
+ String instanceId = "123123123";
+ execution.setVariable("mso-request-id", reqId);
+ execution.setVariable("resourceId", instanceId);
+ execution.setVariable("resourceType", WorkflowType.SERVICE);
+ doReturn(reqMock).when(requestsDbClient).getInfraActiveRequestbyRequestId(reqId);
+ doNothing().when(requestsDbClient).updateInfraActiveRequests(isA(InfraActiveRequests.class));
+ workflowActionBBTasks.updateInstanceId(execution);
+ Mockito.verify( reqMock, Mockito.times(1)).setServiceInstanceId(instanceId);
+ }
}
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 93d4b413f8..8c0792e628 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
@@ -902,16 +902,32 @@ public class WorkflowActionTest extends BaseTaskTest {
ConfigurationResource configurationResource = new ConfigurationResource();
configurationResource.setToscaNodeType("FabricConfiguration");
vnfVfmoduleCvnfcConfigurationCustomization.setConfigurationResource(configurationResource);
+ vnfVfmoduleCvnfcConfigurationCustomization.setModelInstanceName("modelInstanceName1");
+ vnfVfmoduleCvnfcConfigurationCustomization.setCvnfcCustomization(cvnfcCustomization);
Set<VnfVfmoduleCvnfcConfigurationCustomization> custSet = new HashSet<VnfVfmoduleCvnfcConfigurationCustomization>();
custSet.add(vnfVfmoduleCvnfcConfigurationCustomization);
cvnfcCustomization.setVnfVfmoduleCvnfcConfigurationCustomization(custSet);
+ cvnfcCustomization.setDescription("description");
cvnfcCustomizations.add(cvnfcCustomization);
+ CvnfcCustomization cvnfcCustomization2 = new CvnfcCustomization();
+ VnfVfmoduleCvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization2 = new VnfVfmoduleCvnfcConfigurationCustomization();
+ ConfigurationResource configurationResource2 = new ConfigurationResource();
+ configurationResource2.setToscaNodeType("FabricConfiguration");
+ vnfVfmoduleCvnfcConfigurationCustomization2.setConfigurationResource(configurationResource2);
+ vnfVfmoduleCvnfcConfigurationCustomization2.setModelInstanceName("modelInstanceName2");
+ vnfVfmoduleCvnfcConfigurationCustomization2.setCvnfcCustomization(cvnfcCustomization2);
+ Set<VnfVfmoduleCvnfcConfigurationCustomization> custSet2 = new HashSet<VnfVfmoduleCvnfcConfigurationCustomization>();
+ custSet2.add(vnfVfmoduleCvnfcConfigurationCustomization2);
+ cvnfcCustomization2.setVnfVfmoduleCvnfcConfigurationCustomization(custSet2);
+ cvnfcCustomization2.setDescription("description2");
+ cvnfcCustomizations.add(cvnfcCustomization2);
+
when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction,resource,true,"my-custom-cloud-owner")).thenReturn(northBoundRequest);
when(catalogDbClient.getCvnfcCustomizationByVnfCustomizationUUIDAndVfModuleCustomizationUUID("fc25201d-36d6-43a3-8d39-fdae88e526ae", "9a6d01fd-19a7-490a-9800-460830a12e0b")).thenReturn(cvnfcCustomizations);
workflowAction.selectExecutionList(execution);
List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
- assertEqualsBulkFlowName(ebbs,"AssignVfModuleBB","CreateVfModuleBB","ActivateVfModuleBB","AssignFabricConfigurationBB","ActivateFabricConfigurationBB");
+ assertEqualsBulkFlowName(ebbs,"AssignVfModuleBB","CreateVfModuleBB","ActivateVfModuleBB","AssignFabricConfigurationBB","ActivateFabricConfigurationBB", "AssignFabricConfigurationBB","ActivateFabricConfigurationBB");
}
/**
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionUnitTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionUnitTest.java
index 2dd4033aa2..8195cd58c0 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionUnitTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionUnitTest.java
@@ -144,9 +144,9 @@ public class WorkflowActionUnitTest {
when(catalogDbClient.getCvnfcCustomizationByVnfCustomizationUUIDAndVfModuleCustomizationUUID(any(String.class), any(String.class)))
.thenReturn(cvnfcCustomizations);
- List<String> results = workflowAction.traverseCatalogDbForConfiguration("myVnfCustomizationId", "myVfModuleCustomizationId");
+ List<VnfVfmoduleCvnfcConfigurationCustomization> results = workflowAction.traverseCatalogDbForConfiguration("myVnfCustomizationId", "myVfModuleCustomizationId");
- assertThat(results, is(Arrays.asList("my-uuid")));
+ assertThat(results, is(Arrays.asList(vfModuleCustomization)));
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java
index a38c8be686..4aeed71177 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java
@@ -48,6 +48,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.AAIResourcesClient;
+import org.onap.so.client.aai.entities.AAIEdgeLabel;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.aai.mapper.AAIObjectMapper;
@@ -118,6 +119,13 @@ public class AAIConfigurationResourcesTest extends TestDataSetup{
}
@Test
+ public void connectConfigurationToServiceInstanceWithEdgeTest() {
+ doNothing().when(MOCK_aaiResourcesClient).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class), any(AAIEdgeLabel.class));
+ aaiConfigurationResources.connectConfigurationToServiceInstance(configuration.getConfigurationId(), serviceInstance.getServiceInstanceId(), AAIEdgeLabel.USES);
+ verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class), any(AAIResourceUri.class), any(AAIEdgeLabel.class));
+ }
+
+ @Test
public void disconnectConfigurationToServiceInstanceTest(){
doNothing().when(MOCK_aaiResourcesClient).disconnect(isA(AAIResourceUri.class), isA(AAIResourceUri.class));
aaiConfigurationResources.disconnectConfigurationToServiceInstance("TEST_CONFIGURATION_ID", "TEST_SERVICE_INSTANCE_ID");
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIInstanceGroupResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIInstanceGroupResourcesTest.java
index 10bbf39823..58bcc8b1aa 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIInstanceGroupResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIInstanceGroupResourcesTest.java
@@ -21,7 +21,10 @@
package org.onap.so.client.orchestration;
import static org.mockito.ArgumentMatchers.eq;
+import static org.junit.Assert.assertEquals;
+import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.isA;
+import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
@@ -38,11 +41,14 @@ import org.onap.so.bpmn.common.data.TestDataSetup;
import org.onap.so.bpmn.common.InjectionHelper;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.AAIResourcesClient;
import org.onap.so.client.aai.entities.AAIEdgeLabel;
+import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.aai.mapper.AAIObjectMapper;
+import org.onap.so.db.catalog.beans.OrchestrationStatus;
@RunWith(MockitoJUnitRunner.Silent.class)
public class AAIInstanceGroupResourcesTest extends TestDataSetup{
@@ -51,6 +57,7 @@ public class AAIInstanceGroupResourcesTest extends TestDataSetup{
private InstanceGroup instanceGroup;
private GenericVnf vnf;
+ private ServiceInstance serviceInstance;
@Mock
protected AAIResourcesClient MOCK_aaiResourcesClient;
@@ -65,6 +72,7 @@ public class AAIInstanceGroupResourcesTest extends TestDataSetup{
public void before() {
instanceGroup = buildInstanceGroup();
vnf = buildGenericVnf();
+ serviceInstance = buildServiceInstance();
doReturn(MOCK_aaiResourcesClient).when(MOCK_injectionHelper).getAaiClient();
}
@@ -99,4 +107,17 @@ public class AAIInstanceGroupResourcesTest extends TestDataSetup{
verify(MOCK_aaiResourcesClient, times(1)).exists(eq(AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId())));
}
+ @Test
+ public void createInstanceGroupandConnectServiceInstanceTest() {
+ doReturn(new org.onap.aai.domain.yang.InstanceGroup()).when(MOCK_aaiObjectMapper).mapInstanceGroup(instanceGroup);
+ doReturn(MOCK_aaiResourcesClient).when(MOCK_aaiResourcesClient).createIfNotExists(isA(AAIResourceUri.class), any(Optional.class));
+ doNothing().when(MOCK_aaiResourcesClient).connect(any(AAIResourceUri.class), any(AAIResourceUri.class));
+
+ aaiInstanceGroupResources.createInstanceGroupandConnectServiceInstance(instanceGroup, serviceInstance);
+
+ verify(MOCK_aaiObjectMapper, times(1)).mapInstanceGroup(instanceGroup);
+ verify(MOCK_aaiResourcesClient, times(1)).createIfNotExists(any(AAIResourceUri.class), any(Optional.class));
+ verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class), any(AAIResourceUri.class));
+ }
+
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapperTest.java
index 3bb54278b6..630bccee9d 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapperTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapperTest.java
@@ -362,7 +362,7 @@ public class GeneralTopologyObjectMapperTest extends TestDataSetup {
assertNull(gcRequestInput.getOnapModelInformation());
assertEquals(vfModule.getVfModuleId(),gcRequestInput.getVfModuleId());
assertNotNull(gcRequestInput.getVfModuleId());
- assertFalse(gcRequestInput.getFromPreload());
+ assertTrue(gcRequestInput.getFromPreload());
}
@Test
@@ -386,7 +386,7 @@ public class GeneralTopologyObjectMapperTest extends TestDataSetup {
assertNull(gcRequestInput.getOnapModelInformation());
assertEquals(vfModule.getVfModuleId(),gcRequestInput.getVfModuleId());
assertNotNull(gcRequestInput.getVfModuleId());
- assertFalse(gcRequestInput.getFromPreload());
+ assertTrue(gcRequestInput.getFromPreload());
}
@Test
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleOperationInformationUnassign.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleOperationInformationUnassign.json
index cecb4c1dc7..c28b0fa689 100644
--- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleOperationInformationUnassign.json
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleOperationInformationUnassign.json
@@ -22,7 +22,7 @@
},
"vf-module-information" : {
"vf-module-id" : "testVfModuleId",
- "from-preload": false
+ "from-preload": true
},
"vnf-information" : {
"vnf-id" : "testVnfId",
diff --git a/common/src/main/java/org/onap/so/client/aai/entities/AAIEdgeLabel.java b/common/src/main/java/org/onap/so/client/aai/entities/AAIEdgeLabel.java
index 434dbf946b..eb6d0d0b43 100644
--- a/common/src/main/java/org/onap/so/client/aai/entities/AAIEdgeLabel.java
+++ b/common/src/main/java/org/onap/so/client/aai/entities/AAIEdgeLabel.java
@@ -25,8 +25,8 @@ import org.onap.so.client.graphinventory.entities.GraphInventoryEdgeLabel;
public enum AAIEdgeLabel implements GraphInventoryEdgeLabel {
BELONGS_TO("org.onap.relationships.inventory.BelongsTo"),
- USES("org.onap.relationships.inventory.Uses");
-
+ USES("org.onap.relationships.inventory.Uses"),
+ COMPOSED_OF("org.onap.relationships.inventory.ComposedOf");
private final String label;
private AAIEdgeLabel(String label) {
diff --git a/common/src/main/java/org/onap/so/client/cds/BasicAuthClientInterceptor.java b/common/src/main/java/org/onap/so/client/cds/BasicAuthClientInterceptor.java
index 384d479501..edd4e6dfa4 100644
--- a/common/src/main/java/org/onap/so/client/cds/BasicAuthClientInterceptor.java
+++ b/common/src/main/java/org/onap/so/client/cds/BasicAuthClientInterceptor.java
@@ -1,18 +1,23 @@
-/*
- * Copyright (C) 2019 Bell Canada.
- *
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 Bell Canada.
+ * ================================================================================
* 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.cds;
import io.grpc.CallOptions;
diff --git a/common/src/main/java/org/onap/so/client/cds/CDSProcessingClient.java b/common/src/main/java/org/onap/so/client/cds/CDSProcessingClient.java
index 1e372112f1..756c26ddef 100644
--- a/common/src/main/java/org/onap/so/client/cds/CDSProcessingClient.java
+++ b/common/src/main/java/org/onap/so/client/cds/CDSProcessingClient.java
@@ -1,18 +1,23 @@
-/*
- * Copyright (C) 2019 Bell Canada.
- *
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 Bell Canada.
+ * ================================================================================
* 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.cds;
import io.grpc.ManagedChannel;
@@ -110,4 +115,4 @@ public class CDSProcessingClient implements AutoCloseable {
}
log.info("CDSProcessingClient stopped");
}
-} \ No newline at end of file
+}
diff --git a/common/src/main/java/org/onap/so/client/cds/CDSProcessingHandler.java b/common/src/main/java/org/onap/so/client/cds/CDSProcessingHandler.java
index 244b89a6f5..1791be2991 100644
--- a/common/src/main/java/org/onap/so/client/cds/CDSProcessingHandler.java
+++ b/common/src/main/java/org/onap/so/client/cds/CDSProcessingHandler.java
@@ -1,18 +1,23 @@
-/*
- * Copyright (C) 2019 Bell Canada.
- *
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 Bell Canada.
+ * ================================================================================
* 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.cds;
import io.grpc.ManagedChannel;
@@ -79,4 +84,4 @@ class CDSProcessingHandler {
}
return finishLatch;
}
-} \ No newline at end of file
+}
diff --git a/common/src/main/java/org/onap/so/client/cds/CDSProcessingListener.java b/common/src/main/java/org/onap/so/client/cds/CDSProcessingListener.java
index 2eae4ef5a7..8c92a5810c 100644
--- a/common/src/main/java/org/onap/so/client/cds/CDSProcessingListener.java
+++ b/common/src/main/java/org/onap/so/client/cds/CDSProcessingListener.java
@@ -1,18 +1,23 @@
-/*
- * Copyright (C) 2019 Bell Canada.
- *
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 Bell Canada.
+ * ================================================================================
* 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.cds;
import org.onap.ccsdk.apps.controllerblueprints.processing.api.ExecutionServiceOutput;
diff --git a/common/src/main/java/org/onap/so/client/cds/CDSProperties.java b/common/src/main/java/org/onap/so/client/cds/CDSProperties.java
index 52d1d614ed..42a4b47aa2 100644
--- a/common/src/main/java/org/onap/so/client/cds/CDSProperties.java
+++ b/common/src/main/java/org/onap/so/client/cds/CDSProperties.java
@@ -1,18 +1,23 @@
-/*
- * Copyright (C) 2019 Bell Canada.
- *
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 Bell Canada.
+ * ================================================================================
* 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.cds;
import org.onap.so.client.RestProperties;
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryResourcesClient.java b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryResourcesClient.java
index 39d2d01da9..e1519d61a2 100644
--- a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryResourcesClient.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryResourcesClient.java
@@ -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.client.graphinventory;
import java.lang.reflect.InvocationTargetException;
@@ -303,4 +323,4 @@ public abstract class GraphInventoryResourcesClient<Self, Uri extends GraphInven
return client.getRestProperties();
}
-} \ No newline at end of file
+}
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/TransactionBuilder.java b/common/src/main/java/org/onap/so/client/graphinventory/TransactionBuilder.java
index 2cab4b5654..88a6228d2b 100644
--- a/common/src/main/java/org/onap/so/client/graphinventory/TransactionBuilder.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/TransactionBuilder.java
@@ -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.client.graphinventory;
public interface TransactionBuilder {
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/Id.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/Id.java
index 76492dc38b..2951bc8d45 100644
--- a/common/src/main/java/org/onap/so/client/graphinventory/entities/Id.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/Id.java
@@ -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.client.graphinventory.entities;
public class Id extends Resource {
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/Pathed.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/Pathed.java
index a53bdc0259..b848f1c597 100644
--- a/common/src/main/java/org/onap/so/client/graphinventory/entities/Pathed.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/Pathed.java
@@ -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.client.graphinventory.entities;
public class Pathed extends Resource {
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/Resource.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/Resource.java
index 5c53f2cbf1..8d49fb5640 100644
--- a/common/src/main/java/org/onap/so/client/graphinventory/entities/Resource.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/Resource.java
@@ -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.client.graphinventory.entities;
import com.fasterxml.jackson.annotation.JsonInclude;
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/ResourceAndUrl.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/ResourceAndUrl.java
index e53fc02da7..6e7312c1f3 100644
--- a/common/src/main/java/org/onap/so/client/graphinventory/entities/ResourceAndUrl.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/ResourceAndUrl.java
@@ -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.client.graphinventory.entities;
import org.onap.so.client.graphinventory.GraphInventoryObjectType;
diff --git a/common/src/main/java/org/onap/so/logger/MsoLogger.java b/common/src/main/java/org/onap/so/logger/MsoLogger.java
index 39a23b5c3e..f8ff530c3b 100644
--- a/common/src/main/java/org/onap/so/logger/MsoLogger.java
+++ b/common/src/main/java/org/onap/so/logger/MsoLogger.java
@@ -96,12 +96,6 @@ public class MsoLogger {
public static final String PARTNER_NAME = "PartnerName";
-
-
-
-
-
-
// Audit/Metric log specific
public static final String BEGINTIME = "BeginTimestamp";
public static final String STARTTIME = "StartTimeMilis";
@@ -184,9 +178,7 @@ public class MsoLogger {
this.value = value;
}
}
-
- public static final Marker ENTRY = MarkerFactory.getMarker("ENTRY");
- public static final Marker EXIT = MarkerFactory.getMarker("EXIT");
+
private Logger logger;
private Logger metricsLogger;
@@ -194,9 +186,6 @@ public class MsoLogger {
private static String instanceUUID, serverIP, serverName;
private MessageEnum exceptionArg, defaultException, defaultWarning, defaultAudit, defaultMetrics;
- // For internal logging of the initialization of MSO logs
- private static final Logger initLOGGER = LoggerFactory.getLogger(MsoLogger.class.getName());
-
private MsoLogger() {
this(MsoLogger.Catalog.GENERAL);
}
@@ -236,12 +225,6 @@ public class MsoLogger {
* @param targetVEntity
* Target VNF or VM acted opon by the component, if available
*/
- public void recordMetricEvent() {
- metricsLogger.info("");
- MDC.remove(TIMER);
- MDC.remove(TARGETENTITY);
- MDC.remove(TARGETSERVICENAME);
- }
public void recordMetricEvent(Long startTime, StatusCode statusCode, ResponseCode responseCode, String responseDesc,
String targetEntity, String targetServiceName, String targetVEntity) {
@@ -266,10 +249,7 @@ public class MsoLogger {
* @param responseDesc
* Human redable description of the application response code
*/
- public void recordAuditEvent(){
- auditLogger.info("");
- }
-
+
public void recordAuditEvent(Long startTime, StatusCode statusCode, ResponseCode responseCode,
String responseDesc) {
if (StringUtils.isEmpty(MDC.get(MsoLogger.PARTNERNAME))) {
@@ -908,16 +888,6 @@ public class MsoLogger {
MDC.remove(TARGETSERVICENAME);
}
-
- public void logStackTrace(Exception ex){
- StringWriter errors = new StringWriter();
- ex.printStackTrace(new PrintWriter(errors));
- logger.error(errors.toString());
- }
-
- public boolean isDebugEnabled() {
- return logger.isDebugEnabled();
- }
private void prepareMsg(String loggingLevel) {
prepareMsg(loggingLevel, null, null);
@@ -979,7 +949,6 @@ public class MsoLogger {
MDC.put(ERRORDESC, errorDesc);
MDC.put(TARGETENTITY, targetEntity);
MDC.put(TARGETSERVICENAME, targetServiceName);
- MDC.put(SERVICE_NAME, getFinalServiceName(getServiceName()));
}
private void prepareMetricMsg(long startTime, StatusCode statusCode, int responseCode, String responseDesc,
@@ -1060,18 +1029,9 @@ public class MsoLogger {
return classArr[0].getMethodName();
}
- // Based on the discussion with Adrian, instanceUUID is used to identifiy
- // the mso instance,
- // it is generated during mso instance initialization period
- // The same mso instnace will use the same instanceUUID value, even after
- // restart
- private static String getInstanceUUID() {
- return System.getProperty("mso-instance-id");
- }
-
/**
* Set the requestId and serviceInstanceId
- *
+ *
* @param reqId
* The requestId
* @param svcId
@@ -1088,36 +1048,6 @@ public class MsoLogger {
}
/**
- * Set the remoteIp and the basic HTTP Authentication user
- *
- * @param remoteIpp
- * The remote ip address
- * @param userp
- * The basic http authencitation user
- */
- public static void setLoggerParameters(String remoteIpp, String userp) {
- if (null != remoteIpp) {
- MDC.put(REMOTE_HOST, remoteIpp);
- }
- if (null != userp) {
- MDC.put(USER, userp);
- }
- }
-
- /**
- * Set the serviceName
- *
- * @param serviceNamep
- * The service name
- */
- public static void setServiceName(String serviceNamep) {
- if (null != serviceNamep) {
- MDC.put(SERVICE_NAME, serviceNamep);
- MDC.remove(SERVICE_NAME_IS_METHOD_NAME);
- }
- }
-
- /**
* Get the serviceName
*
* @return The service name
@@ -1126,29 +1056,6 @@ public class MsoLogger {
return MDC.get(SERVICE_NAME);
}
- /**
- * Reset the serviceName
- */
- public static void resetServiceName() {
- MDC.remove(SERVICE_NAME);
- }
-
- /**
- * Set the requestId and serviceInstanceId based on the mso request
- *
- * @param msoRequest
- * The mso request
- */
- public static void setLogContext(MsoRequest msoRequest) {
- if (msoRequest != null) {
- MDC.put(REQUEST_ID, msoRequest.getRequestId());
- MDC.put(SERVICE_INSTANCE_ID, msoRequest.getServiceInstanceId());
- } else {
- MDC.put(REQUEST_ID, DUMMY_VALUE);
- MDC.put(SERVICE_INSTANCE_ID, DUMMY_VALUE);
- }
- }
-
private String normalize(String input) {
if (input == null) {
return null;
@@ -1191,14 +1098,4 @@ public class MsoLogger {
defaultMetrics = MessageEnum.GENERAL_METRICS;
}
}
-
- public void warnSimple(String message, Exception e) {
- logger.warn(message,e);
-
- }
-
-
-
-
-
}
diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/RequestStatus.java b/common/src/main/java/org/onap/so/serviceinstancebeans/RequestStatus.java
index 4c3597b2c1..710c820148 100644
--- a/common/src/main/java/org/onap/so/serviceinstancebeans/RequestStatus.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/RequestStatus.java
@@ -21,18 +21,22 @@
package org.onap.so.serviceinstancebeans;
import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import org.apache.commons.lang3.builder.ToStringBuilder;
@JsonInclude(Include.NON_DEFAULT)
public class RequestStatus {
- protected String requestState;
+ @JsonProperty("requestState")
+ protected String requestState;
+ @JsonProperty("statusMessage")
protected String statusMessage;
+ @JsonProperty("percentProgress")
protected Integer percentProgress;
+ @JsonProperty("timestamp")
protected String timeStamp;
-
public String getRequestState() {
return requestState;
}
@@ -60,6 +64,6 @@ public class RequestStatus {
@Override
public String toString() {
return new ToStringBuilder(this).append("requestState", requestState).append("statusMessage", statusMessage)
- .append("percentProgress", percentProgress).append("timeStamp", timeStamp).toString();
+ .append("percentProgress", percentProgress).append("timestamp", timeStamp).toString();
}
}
diff --git a/common/src/main/java/org/onap/so/utils/UUIDChecker.java b/common/src/main/java/org/onap/so/utils/UUIDChecker.java
index 36fa3d09ab..19a92b834c 100644
--- a/common/src/main/java/org/onap/so/utils/UUIDChecker.java
+++ b/common/src/main/java/org/onap/so/utils/UUIDChecker.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 Samsung
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -25,7 +26,6 @@ package org.onap.so.utils;
import java.util.UUID;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -35,9 +35,7 @@ public class UUIDChecker {
private static final Logger logger = LoggerFactory.getLogger(UUIDChecker.class);
-
private UUIDChecker() {
-
}
public static boolean isValidUUID (String id) {
@@ -54,31 +52,8 @@ public class UUIDChecker {
}
public static String getUUID () {
- return UUID.randomUUID().toString();
- }
-
- public static String verifyOldUUID (String oldId, MsoLogger msoLogger) {
- if (!UUIDChecker.isValidUUID(oldId)) {
- String newId = UUIDChecker.getUUID();
- MsoLogger.setLogContext(newId, null);
- msoLogger.info(MessageEnum.APIH_REPLACE_REQUEST_ID, oldId, "", "");
- return newId;
- }
- MsoLogger.setLogContext(oldId, null);
- return oldId;
- }
-
- public static String generateUUID (MsoLogger msoLogger) {
- String newId = UUIDChecker.getUUID();
- MsoLogger.setLogContext(newId, null);
- msoLogger.info(MessageEnum.APIH_GENERATED_REQUEST_ID, newId, "", "");
- return newId;
- }
-
- public static String generateServiceInstanceID (MsoLogger msoLogger) {
- String newId = UUIDChecker.getUUID();
- MsoLogger.setLogContext(null, newId);
- msoLogger.info(MessageEnum.APIH_GENERATED_SERVICE_INSTANCE_ID, newId, "", "");
- return newId;
+ String result = UUID.randomUUID().toString();
+ logger.info("{} {}", MessageEnum.APIH_GENERATED_REQUEST_ID, result);
+ return result;
}
}
diff --git a/common/src/test/java/org/onap/so/client/cds/CDSProcessingClientTest.java b/common/src/test/java/org/onap/so/client/cds/CDSProcessingClientTest.java
index 2bfa754f0e..135277fa47 100644
--- a/common/src/test/java/org/onap/so/client/cds/CDSProcessingClientTest.java
+++ b/common/src/test/java/org/onap/so/client/cds/CDSProcessingClientTest.java
@@ -1,18 +1,23 @@
-/*
- * Copyright (C) 2019 Bell Canada.
- *
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 Bell Canada.
+ * ================================================================================
* 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.cds;
@@ -159,4 +164,4 @@ public class CDSProcessingClientTest {
assertTrue(finishLatch.await(1, TimeUnit.SECONDS));
}
-} \ No newline at end of file
+}
diff --git a/common/src/test/java/org/onap/so/client/cds/TestCDSProcessingListener.java b/common/src/test/java/org/onap/so/client/cds/TestCDSProcessingListener.java
index df302f6e35..977f1d41be 100644
--- a/common/src/test/java/org/onap/so/client/cds/TestCDSProcessingListener.java
+++ b/common/src/test/java/org/onap/so/client/cds/TestCDSProcessingListener.java
@@ -1,18 +1,23 @@
-/*
- * Copyright (C) 2019 Bell Canada.
- *
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 Bell Canada.
+ * ================================================================================
* 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.cds;
import io.grpc.Status;
diff --git a/common/src/test/java/org/onap/so/client/cds/TestCDSPropertiesImpl.java b/common/src/test/java/org/onap/so/client/cds/TestCDSPropertiesImpl.java
index a2937869c8..514c595100 100644
--- a/common/src/test/java/org/onap/so/client/cds/TestCDSPropertiesImpl.java
+++ b/common/src/test/java/org/onap/so/client/cds/TestCDSPropertiesImpl.java
@@ -1,18 +1,23 @@
-/*
- * Copyright (C) 2019 Bell Canada.
- *
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 Bell Canada.
+ * ================================================================================
* 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.cds;
import java.net.MalformedURLException;
diff --git a/common/src/test/java/org/onap/so/serviceinstancebeans/RequestStatusTest.java b/common/src/test/java/org/onap/so/serviceinstancebeans/RequestStatusTest.java
new file mode 100644
index 0000000000..fa4d2f772d
--- /dev/null
+++ b/common/src/test/java/org/onap/so/serviceinstancebeans/RequestStatusTest.java
@@ -0,0 +1,43 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.serviceinstancebeans;
+
+import org.skyscreamer.jsonassert.JSONAssert;
+import org.junit.Test;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+public class RequestStatusTest {
+
+ @Test
+ public void requestStatusDefaultValues() throws Exception {
+ RequestStatus requestStatus = new RequestStatus();
+ requestStatus.setRequestState("COMPLETE");
+ requestStatus.setStatusMessage("STATUS: COMPLETED");
+ requestStatus.setPercentProgress(100);
+ requestStatus.setTimeStamp("Fri, 08 Mar 2019 04:41:42 GMT");
+ String expectedResponse = "{\"requestState\":\"COMPLETE\",\"statusMessage\":\"STATUS: COMPLETED\",\"percentProgress\":100,\"timestamp\":\"Fri, 08 Mar 2019 04:41:42 GMT\"}";
+
+ ObjectMapper mapper = new ObjectMapper();
+ String realResponse = mapper.writeValueAsString(requestStatus);
+
+ JSONAssert.assertEquals(expectedResponse, realResponse, false);
+ }
+}
diff --git a/common/src/test/java/org/onap/so/utils/UUIDCheckerTest.java b/common/src/test/java/org/onap/so/utils/UUIDCheckerTest.java
index b4058a7ba8..9c9f58710e 100644
--- a/common/src/test/java/org/onap/so/utils/UUIDCheckerTest.java
+++ b/common/src/test/java/org/onap/so/utils/UUIDCheckerTest.java
@@ -4,6 +4,8 @@
* ================================================================================
* 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
@@ -23,11 +25,9 @@ package org.onap.so.utils;
import static org.junit.Assert.*;
import org.junit.Test;
-import org.onap.so.logger.MsoLogger;
public class UUIDCheckerTest {
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.GENERAL, UUIDCheckerTest.class);
-
+
@Test
public void isValidUUIDTest(){
String nullID = null;
@@ -37,24 +37,4 @@ public class UUIDCheckerTest {
assertFalse(UUIDChecker.isValidUUID(badID));
assertTrue(UUIDChecker.isValidUUID(id));
}
-
- @Test
- public void verifyOldUUIDTest(){
- String oldID = UUIDChecker.getUUID();
- String invalidID = "This is not a UUID";
- assertEquals(UUIDChecker.verifyOldUUID(oldID,LOGGER),oldID);
- assertNotEquals(UUIDChecker.verifyOldUUID(invalidID,LOGGER),invalidID);
- }
-
- @Test
- public void generateTest(){
- String id = UUIDChecker.generateUUID(LOGGER);
- assertNotNull(id);
- assertTrue(UUIDChecker.isValidUUID(id));
-
- id = UUIDChecker.generateServiceInstanceID(LOGGER);
- assertNotNull(id);
- assertTrue(UUIDChecker.isValidUUID(id));
-
- }
}
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 24fb0e0d20..1dece5c341 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
@@ -80,6 +80,7 @@ public final class CommonConstants {
public static final String X_PATCH_VERSION = "X-PatchVersion";
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";
private CommonConstants () {
// prevent creating an instance of this class
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 be1131ed78..84cac6ce5c 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
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 Huawei Technologies Co., Ltd. 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
@@ -25,6 +27,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.UUID;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
@@ -69,7 +72,8 @@ import org.onap.so.serviceinstancebeans.RequestInfo;
import org.onap.so.serviceinstancebeans.RequestParameters;
import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
import org.onap.so.serviceinstancebeans.SubscriberInfo;
-import org.onap.so.utils.UUIDChecker;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -85,8 +89,7 @@ import io.swagger.annotations.ApiOperation;
public class E2EServiceInstances {
private HashMap<String, String> instanceIdMap = new HashMap<>();
- private static final MsoLogger msoLogger = MsoLogger
- .getMsoLogger(MsoLogger.Catalog.APIH, E2EServiceInstances.class);
+ private static final Logger logger = LoggerFactory.getLogger(E2EServiceInstances.class);
private static final String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA";
@@ -190,7 +193,7 @@ public class E2EServiceInstances {
@PathParam("version") String version,
@PathParam("serviceId") String serviceId) throws ApiException {
- msoLogger.debug("------------------scale begin------------------");
+ logger.debug("------------------scale begin------------------");
instanceIdMap.put("serviceId", serviceId);
return scaleE2EserviceInstances(request, Action.scaleInstance, instanceIdMap, version);
}
@@ -216,9 +219,8 @@ public class E2EServiceInstances {
private Response compareModelwithTargetVersion(String requestJSON, Action action,
HashMap<String, String> instanceIdMap, String version) throws ApiException {
- String requestId = UUIDChecker.generateUUID(msoLogger);
+ String requestId = UUID.randomUUID().toString();
long startTime = System.currentTimeMillis();
- msoLogger.debug("requestId is: " + requestId);
CompareModelsRequest e2eCompareModelReq;
@@ -228,15 +230,13 @@ public class E2EServiceInstances {
} catch (Exception e) {
- msoLogger.debug("Mapping of request to JSON object failed : ", e);
+ logger.debug("Mapping of request to JSON object failed : ", e);
Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST,
MsoException.ServiceException, "Mapping of request to JSON object failed. " + e.getMessage(),
ErrorNumbers.SVC_BAD_PARAMETER, null, version);
- msoLogger.error(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "",
- MsoLogger.ErrorCode.SchemaError, requestJSON, e);
- msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError,
- "Mapping of request to JSON object failed");
- msoLogger.debug(END_OF_THE_TRANSACTION + response.getEntity().toString());
+ logger.error("{} {} {} {}", MessageEnum.APIH_REQUEST_VALIDATION_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA,
+ MsoLogger.ErrorCode.SchemaError.getValue(), requestJSON, e);
+ logger.debug(END_OF_THE_TRANSACTION + response.getEntity().toString());
return response;
}
@@ -264,7 +264,7 @@ public class E2EServiceInstances {
String bpmnRequest = jjo.toString();
// Capture audit event
- msoLogger.debug("MSO API Handler Posting call to BPEL engine for url: " + requestClient.getUrl());
+ logger.debug("MSO API Handler Posting call to BPEL engine for url: " + requestClient.getUrl());
String serviceId = instanceIdMap.get("serviceId");
String serviceType = e2eCompareModelReq.getServiceType();
RequestClientParameter postParam = new RequestClientParameter.Builder()
@@ -277,32 +277,22 @@ public class E2EServiceInstances {
.setRequestDetails(bpmnRequest)
.setALaCarte(false).build();
response = requestClient.post(postParam);
-
- msoLogger.recordMetricEvent(subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- "Successfully received response from BPMN engine", "BPMN", workflowUrl, null);
} catch (Exception e) {
- msoLogger.recordMetricEvent(subStartTime, MsoLogger.StatusCode.ERROR,
- MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with BPMN engine", "BPMN",
- workflowUrl, null);
Response resp = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_GATEWAY,
MsoException.ServiceException, "Failed calling bpmn " + e.getMessage(),
ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version);
- msoLogger.error(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "",
+ logger.error("", MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "",
MsoLogger.ErrorCode.AvailabilityError, "Exception while communicate with BPMN engine",e);
- msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError,
- "Exception while communicate with BPMN engine");
- msoLogger.debug(END_OF_THE_TRANSACTION + resp.getEntity().toString());
+ logger.debug(END_OF_THE_TRANSACTION + resp.getEntity().toString());
return resp;
}
if (response == null) {
Response resp = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_GATEWAY, MsoException.ServiceException,
"bpelResponse is null", ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version);
- msoLogger.error(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "",
- MsoLogger.ErrorCode.BusinessProcesssError, "Null response from BPEL");
- msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError,
- "Null response from BPMN");
- msoLogger.debug(END_OF_THE_TRANSACTION + resp.getEntity().toString());
+ logger.error("{} {} {} {}", MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA,
+ MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Null response from BPEL");
+ logger.debug(END_OF_THE_TRANSACTION + resp.getEntity().toString());
return resp;
}
@@ -327,24 +317,14 @@ public class E2EServiceInstances {
operationStatus = requestsDbClient.getOneByServiceIdAndOperationId(serviceId,
operationId);
} catch (Exception e) {
- msoLogger
- .error(MessageEnum.APIH_DB_ACCESS_EXC,
- MSO_PROP_APIHANDLER_INFRA,
- "",
- "",
- MsoLogger.ErrorCode.AvailabilityError,
- "Exception while communciate with Request DB - Infra Request Lookup",
- e);
+ logger.error("{} {} {} {}", MessageEnum.APIH_DB_ACCESS_EXC.toString(), MSO_PROP_APIHANDLER_INFRA,
+ MsoLogger.ErrorCode.AvailabilityError.getValue(),
+ "Exception while communciate with Request DB - Infra Request Lookup", e);
Response response = msoRequest.buildServiceErrorResponse(
HttpStatus.SC_NOT_FOUND, MsoException.ServiceException,
e.getMessage(),
ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB, null, version);
-
- msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR,
- MsoLogger.ResponseCode.DBAccessError,
- "Exception while communciate with Request DB");
- msoLogger.debug(END_OF_THE_TRANSACTION
- + response.getEntity());
+ logger.debug(END_OF_THE_TRANSACTION + response.getEntity());
return response;
}
@@ -354,15 +334,10 @@ public class E2EServiceInstances {
HttpStatus.SC_NO_CONTENT, MsoException.ServiceException,
"E2E serviceId " + serviceId + " is not found in DB",
ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, null, version);
- msoLogger.error(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR,
- MSO_PROP_APIHANDLER_INFRA, "", "",
- MsoLogger.ErrorCode.BusinessProcesssError,
- "Null response from RequestDB when searching by serviceId");
- msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR,
- MsoLogger.ResponseCode.DataNotFound,
- "Null response from RequestDB when searching by serviceId");
- msoLogger.debug(END_OF_THE_TRANSACTION
- + resp.getEntity());
+ logger.error("{} {} {} {}", MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA,
+ MsoLogger.ErrorCode.BusinessProcesssError.getValue(),
+ "Null response from RequestDB when searching by serviceId");
+ logger.debug(END_OF_THE_TRANSACTION + resp.getEntity());
return resp;
}
@@ -375,9 +350,7 @@ public class E2EServiceInstances {
private Response deleteE2EserviceInstances(String requestJSON,
Action action, HashMap<String, String> instanceIdMap, String version) throws ApiException {
// TODO should be a new one or the same service instance Id
- String requestId = UUIDChecker.generateUUID(msoLogger);
long startTime = System.currentTimeMillis();
- msoLogger.debug("requestId is: " + requestId);
E2EServiceInstanceDeleteRequest e2eDelReq;
ObjectMapper mapper = new ObjectMapper();
@@ -387,63 +360,49 @@ public class E2EServiceInstances {
} catch (Exception e) {
- msoLogger.debug("Mapping of request to JSON object failed : ", e);
+ logger.debug("Mapping of request to JSON object failed : ", e);
Response response = msoRequest.buildServiceErrorResponse(
HttpStatus.SC_BAD_REQUEST,
MsoException.ServiceException,
"Mapping of request to JSON object failed. "
+ e.getMessage(), ErrorNumbers.SVC_BAD_PARAMETER,
null, version);
- msoLogger.error(MessageEnum.APIH_REQUEST_VALIDATION_ERROR,
- MSO_PROP_APIHANDLER_INFRA, "", "",
- MsoLogger.ErrorCode.SchemaError, requestJSON, e);
- msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR,
- MsoLogger.ResponseCode.SchemaError,
- "Mapping of request to JSON object failed");
- msoLogger.debug(END_OF_THE_TRANSACTION
- + response.getEntity());
+ logger.error("{} {} {} {}", MessageEnum.APIH_REQUEST_VALIDATION_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA,
+ MsoLogger.ErrorCode.SchemaError.getValue(), requestJSON, e);
+ logger.debug(END_OF_THE_TRANSACTION + response.getEntity());
return response;
}
+ String requestId = UUID.randomUUID().toString();
RecipeLookupResult recipeLookupResult;
try {
//TODO Get the service template model version uuid from AAI.
recipeLookupResult = getServiceInstanceOrchestrationURI(null, action);
} catch (Exception e) {
- msoLogger.error(MessageEnum.APIH_DB_ACCESS_EXC,
- MSO_PROP_APIHANDLER_INFRA, "", "",
- MsoLogger.ErrorCode.AvailabilityError,
- "Exception while communciate with Catalog DB", e);
+ logger.error(MessageEnum.APIH_DB_ACCESS_EXC.toString(), MSO_PROP_APIHANDLER_INFRA,
+ MsoLogger.ErrorCode.AvailabilityError.getValue(), "Exception while communciate with Catalog DB", e);
Response response = msoRequest.buildServiceErrorResponse(
HttpStatus.SC_NOT_FOUND, MsoException.ServiceException,
"No communication to catalog DB " + e.getMessage(),
ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version);
- msoRequest.createErrorRequestRecord(Status.FAILED, requestId, "Exception while communciate with Catalog DB", action, ModelType.service.name(), requestJSON);
- msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR,
- MsoLogger.ResponseCode.DBAccessError,
- "Exception while communciate with DB");
- msoLogger.debug(END_OF_THE_TRANSACTION
- + response.getEntity());
+ msoRequest.createErrorRequestRecord(Status.FAILED, requestId, "Exception while communciate with "
+ + "Catalog DB", action,
+ ModelType.service.name(), requestJSON);
+ logger.debug(END_OF_THE_TRANSACTION + response.getEntity());
return response;
}
if (recipeLookupResult == null) {
- msoLogger.error(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND,
- MSO_PROP_APIHANDLER_INFRA, "", "",
- MsoLogger.ErrorCode.DataError, "No recipe found in DB");
+ logger.error("{} {} {} {}", MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND.toString(), MSO_PROP_APIHANDLER_INFRA,
+ MsoLogger.ErrorCode.DataError.getValue(), "No recipe found in DB");
Response response = msoRequest.buildServiceErrorResponse(
HttpStatus.SC_NOT_FOUND, MsoException.ServiceException,
"Recipe does not exist in catalog DB",
ErrorNumbers.SVC_GENERAL_SERVICE_ERROR, null, version);
msoRequest.createErrorRequestRecord(Status.FAILED, requestId,"Recipe does not exist in catalog DB", action, ModelType.service.name(), requestJSON);
-
- msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR,
- MsoLogger.ResponseCode.DataNotFound,
- "No recipe found in DB");
- msoLogger.debug(END_OF_THE_TRANSACTION
- + response.getEntity());
+ logger.debug(END_OF_THE_TRANSACTION + response.getEntity());
return response;
}
@@ -455,14 +414,12 @@ public class E2EServiceInstances {
requestClient = requestClientFactory.getRequestClient(recipeLookupResult.getOrchestrationURI());
JSONObject jjo = new JSONObject(requestJSON);
- jjo.put("operationId", UUIDChecker.generateUUID(msoLogger));
+ jjo.put("operationId", requestId);
String bpmnRequest = jjo.toString();
// Capture audit event
- msoLogger
- .debug("MSO API Handler Posting call to BPEL engine for url: "
- + requestClient.getUrl());
+ logger.debug("MSO API Handler Posting call to BPEL engine for url: " + requestClient.getUrl());
String serviceId = instanceIdMap.get("serviceId");
String serviceInstanceType = e2eDelReq.getServiceType();
RequestClientParameter clientParam = new RequestClientParameter.Builder()
@@ -478,29 +435,14 @@ public class E2EServiceInstances {
.setRecipeParamXsd(recipeLookupResult.getRecipeParamXsd()).build();
response = requestClient.post(clientParam);
- msoLogger.recordMetricEvent(subStartTime,
- MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- "Successfully received response from BPMN engine", "BPMN",
- recipeLookupResult.getOrchestrationURI(), null);
} catch (Exception e) {
- msoLogger.recordMetricEvent(subStartTime,
- MsoLogger.StatusCode.ERROR,
- MsoLogger.ResponseCode.CommunicationError,
- "Exception while communicate with BPMN engine", "BPMN",
- recipeLookupResult.getOrchestrationURI(), null);
Response resp = msoRequest.buildServiceErrorResponse(
HttpStatus.SC_BAD_GATEWAY, MsoException.ServiceException,
"Failed calling bpmn " + e.getMessage(),
ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version);
- msoLogger.error(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR,
- MSO_PROP_APIHANDLER_INFRA, "", "",
- MsoLogger.ErrorCode.AvailabilityError,
- "Exception while communicate with BPMN engine");
- msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR,
- MsoLogger.ResponseCode.CommunicationError,
- "Exception while communicate with BPMN engine");
- msoLogger.debug("End of the transaction, the final response is: "
- + resp.getEntity());
+ logger.error("{} {} {} {}", MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA,
+ MsoLogger.ErrorCode.AvailabilityError.getValue(), "Exception while communicate with BPMN engine");
+ logger.debug("End of the transaction, the final response is: " + resp.getEntity());
return resp;
}
@@ -509,14 +451,9 @@ public class E2EServiceInstances {
HttpStatus.SC_BAD_GATEWAY, MsoException.ServiceException,
"bpelResponse is null",
ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version);
- msoLogger.error(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR,
- MSO_PROP_APIHANDLER_INFRA, "", "",
- MsoLogger.ErrorCode.BusinessProcesssError,
- "Null response from BPEL");
- msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR,
- MsoLogger.ResponseCode.InternalError,
- "Null response from BPMN");
- msoLogger.debug(END_OF_THE_TRANSACTION + resp.getEntity());
+ logger.error("{} {} {} {}", MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA,
+ MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Null response from BPEL");
+ logger.debug(END_OF_THE_TRANSACTION + resp.getEntity());
return resp;
}
@@ -531,9 +468,8 @@ public class E2EServiceInstances {
private Response updateE2EserviceInstances(String requestJSON, Action action,
HashMap<String, String> instanceIdMap, String version) throws ApiException {
- String requestId = UUIDChecker.generateUUID(msoLogger);
+ String requestId = UUID.randomUUID().toString();
long startTime = System.currentTimeMillis();
- msoLogger.debug("requestId is: " + requestId);
E2EServiceInstanceRequest e2eSir;
String serviceId = instanceIdMap.get("serviceId");
@@ -543,15 +479,13 @@ public class E2EServiceInstances {
} catch (Exception e) {
- msoLogger.debug("Mapping of request to JSON object failed : ", e);
+ logger.debug("Mapping of request to JSON object failed : ", e);
Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST,
MsoException.ServiceException, "Mapping of request to JSON object failed. " + e.getMessage(),
ErrorNumbers.SVC_BAD_PARAMETER, null, version);
- msoLogger.error(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "",
- MsoLogger.ErrorCode.SchemaError, requestJSON, e);
- msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError,
- "Mapping of request to JSON object failed");
- msoLogger.debug(END_OF_THE_TRANSACTION + response.getEntity());
+ logger.error("{} {} {} {}", MessageEnum.APIH_REQUEST_VALIDATION_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA,
+ MsoLogger.ErrorCode.SchemaError.getValue(), requestJSON, e);
+ logger.debug(END_OF_THE_TRANSACTION + response.getEntity());
return response;
}
@@ -560,18 +494,16 @@ public class E2EServiceInstances {
try {
parseRequest(sir, instanceIdMap, action, version, requestJSON, false, requestId);
} catch (Exception e) {
- msoLogger.debug("Validation failed: ", e);
+ logger.debug("Validation failed: ", e);
Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST,
MsoException.ServiceException, "Error parsing request. " + e.getMessage(),
ErrorNumbers.SVC_BAD_PARAMETER, null, version);
if (requestId != null) {
- msoLogger.debug("Logging failed message to the database");
+ logger.debug("Logging failed message to the database");
}
- msoLogger.error(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "",
- MsoLogger.ErrorCode.SchemaError, requestJSON, e);
- msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError,
- "Validation of the input request failed");
- msoLogger.debug(END_OF_THE_TRANSACTION + response.getEntity());
+ logger.error("{} {} {} {}", MessageEnum.APIH_REQUEST_VALIDATION_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA,
+ MsoLogger.ErrorCode.SchemaError.getValue(), requestJSON, e);
+ logger.debug(END_OF_THE_TRANSACTION + response.getEntity());
return response;
}
@@ -579,30 +511,24 @@ public class E2EServiceInstances {
try {
recipeLookupResult = getServiceInstanceOrchestrationURI(e2eSir.getService().getServiceUuid(), action);
} catch (Exception e) {
- msoLogger.error(MessageEnum.APIH_DB_ACCESS_EXC, MSO_PROP_APIHANDLER_INFRA, "", "",
- MsoLogger.ErrorCode.AvailabilityError, "Exception while communciate with Catalog DB", e);
+ logger.error("{} {} {} {}", MessageEnum.APIH_DB_ACCESS_EXC.toString(), MSO_PROP_APIHANDLER_INFRA,
+ MsoLogger.ErrorCode.AvailabilityError.getValue(), "Exception while communciate with Catalog DB", e);
Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND,
MsoException.ServiceException, "No communication to catalog DB " + e.getMessage(),
ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version);
-
-
- msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError,
- "Exception while communciate with DB");
- msoLogger.debug(END_OF_THE_TRANSACTION + response.getEntity());
+
+ logger.debug(END_OF_THE_TRANSACTION + response.getEntity());
return response;
}
if (recipeLookupResult == null) {
- msoLogger.error(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, MSO_PROP_APIHANDLER_INFRA, "", "",
- MsoLogger.ErrorCode.DataError, "No recipe found in DB");
+ logger.error("{} {} {} {}", MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND.toString(), MSO_PROP_APIHANDLER_INFRA,
+ MsoLogger.ErrorCode.DataError.getValue(), "No recipe found in DB");
Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND,
MsoException.ServiceException, "Recipe does not exist in catalog DB",
ErrorNumbers.SVC_GENERAL_SERVICE_ERROR, null, version);
-
- msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound,
- "No recipe found in DB");
- msoLogger.debug(END_OF_THE_TRANSACTION + response.getEntity());
+ logger.debug(END_OF_THE_TRANSACTION + response.getEntity());
return response;
}
@@ -619,7 +545,7 @@ public class E2EServiceInstances {
requestClient = requestClientFactory.getRequestClient(recipeLookupResult.getOrchestrationURI());
// Capture audit event
- msoLogger.debug("MSO API Handler Posting call to BPEL engine for url: " + requestClient.getUrl());
+ logger.debug("MSO API Handler Posting call to BPEL engine for url: " + requestClient.getUrl());
RequestClientParameter postParam = new RequestClientParameter.Builder()
.setRequestId(requestId)
.setBaseVfModule(false)
@@ -632,24 +558,15 @@ public class E2EServiceInstances {
.setALaCarte(false)
.setRecipeParamXsd(recipeLookupResult.getRecipeParamXsd()).build();
response = requestClient.post(postParam);
-
- msoLogger.recordMetricEvent(subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- "Successfully received response from BPMN engine", "BPMN", recipeLookupResult.getOrchestrationURI(),
- null);
} catch (Exception e) {
- msoLogger.debug("Exception while communicate with BPMN engine", e);
- msoLogger.recordMetricEvent(subStartTime, MsoLogger.StatusCode.ERROR,
- MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with BPMN engine", "BPMN",
- recipeLookupResult.getOrchestrationURI(), null);
+ logger.debug("Exception while communicate with BPMN engine", e);
Response getBPMNResp = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_GATEWAY,
MsoException.ServiceException, "Failed calling bpmn " + e.getMessage(),
ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version);
- msoLogger.error(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "",
- MsoLogger.ErrorCode.AvailabilityError, "Exception while communicate with BPMN engine");
- msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError,
- "Exception while communicate with BPMN engine");
- msoLogger.debug(END_OF_THE_TRANSACTION + getBPMNResp.getEntity());
+ logger.error("{} {} {} {}", MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA,
+ MsoLogger.ErrorCode.AvailabilityError.getValue(), "Exception while communicate with BPMN engine");
+ logger.debug(END_OF_THE_TRANSACTION + getBPMNResp.getEntity());
return getBPMNResp;
}
@@ -657,11 +574,9 @@ public class E2EServiceInstances {
if (response == null) {
Response getBPMNResp = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_GATEWAY,
MsoException.ServiceException, "bpelResponse is null", ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version);
- msoLogger.error(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "",
- MsoLogger.ErrorCode.BusinessProcesssError, "Null response from BPEL");
- msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError,
- "Null response from BPMN");
- msoLogger.debug(END_OF_THE_TRANSACTION + getBPMNResp.getEntity());
+ logger.error("{} {} {} {}", MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA,
+ MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Null response from BPEL");
+ logger.debug(END_OF_THE_TRANSACTION + getBPMNResp.getEntity());
return getBPMNResp;
}
@@ -675,9 +590,8 @@ public class E2EServiceInstances {
private Response processE2EserviceInstances(String requestJSON, Action action,
HashMap<String, String> instanceIdMap, String version) throws ApiException {
- String requestId = UUIDChecker.generateUUID(msoLogger);
+ String requestId = UUID.randomUUID().toString();
long startTime = System.currentTimeMillis();
- msoLogger.debug("requestId is: " + requestId);
E2EServiceInstanceRequest e2eSir;
MsoRequest msoRequest = new MsoRequest();
@@ -687,15 +601,13 @@ public class E2EServiceInstances {
} catch (Exception e) {
- msoLogger.debug("Mapping of request to JSON object failed : ", e);
+ logger.debug("Mapping of request to JSON object failed : ", e);
Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST,
MsoException.ServiceException, "Mapping of request to JSON object failed. " + e.getMessage(),
ErrorNumbers.SVC_BAD_PARAMETER, null, version);
- msoLogger.error(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "",
- MsoLogger.ErrorCode.SchemaError, requestJSON, e);
- msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError,
- "Mapping of request to JSON object failed");
- msoLogger.debug(END_OF_THE_TRANSACTION + response.getEntity());
+ logger.error("{} {} {} {}", MessageEnum.APIH_REQUEST_VALIDATION_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA,
+ MsoLogger.ErrorCode.SchemaError.getValue(), requestJSON, e);
+ logger.debug(END_OF_THE_TRANSACTION + response.getEntity());
return response;
}
@@ -704,18 +616,16 @@ public class E2EServiceInstances {
try {
parseRequest(sir, instanceIdMap, action, version, requestJSON, false, requestId);
} catch (Exception e) {
- msoLogger.debug("Validation failed: ", e);
+ logger.debug("Validation failed: ", e);
Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST,
MsoException.ServiceException, "Error parsing request. " + e.getMessage(),
ErrorNumbers.SVC_BAD_PARAMETER, null, version);
if (requestId != null) {
- msoLogger.debug("Logging failed message to the database");
+ logger.debug("Logging failed message to the database");
}
- msoLogger.error(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "",
- MsoLogger.ErrorCode.SchemaError, requestJSON, e);
- msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError,
- "Validation of the input request failed");
- msoLogger.debug(END_OF_THE_TRANSACTION + response.getEntity());
+ logger.error("{} {} {} {}", MessageEnum.APIH_REQUEST_VALIDATION_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA,
+ MsoLogger.ErrorCode.SchemaError.getValue(), requestJSON, e);
+ logger.debug(END_OF_THE_TRANSACTION + response.getEntity());
return response;
}
@@ -723,28 +633,22 @@ public class E2EServiceInstances {
try {
recipeLookupResult = getServiceInstanceOrchestrationURI(e2eSir.getService().getServiceUuid(), action);
} catch (Exception e) {
- msoLogger.error(MessageEnum.APIH_DB_ACCESS_EXC, MSO_PROP_APIHANDLER_INFRA, "", "",
- MsoLogger.ErrorCode.AvailabilityError, "Exception while communciate with Catalog DB", e);
+ logger.error("{} {} {} {}", MessageEnum.APIH_DB_ACCESS_EXC.toString(), MSO_PROP_APIHANDLER_INFRA,
+ MsoLogger.ErrorCode.AvailabilityError.getValue(), "Exception while communciate with Catalog DB", e);
Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND,
MsoException.ServiceException, "No communication to catalog DB " + e.getMessage(),
ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version);
-
- msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError,
- "Exception while communciate with DB");
- msoLogger.debug(END_OF_THE_TRANSACTION + response.getEntity());
+ logger.debug(END_OF_THE_TRANSACTION + response.getEntity());
return response;
}
if (recipeLookupResult == null) {
- msoLogger.error(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, MSO_PROP_APIHANDLER_INFRA, "", "",
- MsoLogger.ErrorCode.DataError, "No recipe found in DB");
+ logger.error("{} {} {} {}", MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND.toString(), MSO_PROP_APIHANDLER_INFRA,
+ MsoLogger.ErrorCode.DataError.getValue(), "No recipe found in DB");
Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND,
MsoException.ServiceException, "Recipe does not exist in catalog DB",
ErrorNumbers.SVC_GENERAL_SERVICE_ERROR, null, version);
-
- msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound,
- "No recipe found in DB");
- msoLogger.debug(END_OF_THE_TRANSACTION + response.getEntity());
+ logger.debug(END_OF_THE_TRANSACTION + response.getEntity());
return response;
}
@@ -761,7 +665,7 @@ public class E2EServiceInstances {
requestClient = requestClientFactory.getRequestClient(recipeLookupResult.getOrchestrationURI());
// Capture audit event
- msoLogger.debug("MSO API Handler Posting call to BPEL engine for url: " + requestClient.getUrl());
+ logger.debug("MSO API Handler Posting call to BPEL engine for url: " + requestClient.getUrl());
RequestClientParameter parameter = new RequestClientParameter.Builder()
.setRequestId(requestId)
.setBaseVfModule(false)
@@ -774,34 +678,23 @@ public class E2EServiceInstances {
.setALaCarte(false)
.setRecipeParamXsd(recipeLookupResult.getRecipeParamXsd()).build();
response = requestClient.post(parameter);
-
- msoLogger.recordMetricEvent(subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- "Successfully received response from BPMN engine", "BPMN", recipeLookupResult.getOrchestrationURI(),
- null);
} catch (Exception e) {
- msoLogger.recordMetricEvent(subStartTime, MsoLogger.StatusCode.ERROR,
- MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with BPMN engine", "BPMN",
- recipeLookupResult.getOrchestrationURI(), null);
Response resp = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_GATEWAY,
MsoException.ServiceException, "Failed calling bpmn " + e.getMessage(),
ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version);
-
- msoLogger.error(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "",
- MsoLogger.ErrorCode.AvailabilityError, "Exception while communicate with BPMN engine");
- msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError,
- "Exception while communicate with BPMN engine");
- msoLogger.debug(END_OF_THE_TRANSACTION + resp.getEntity());
+
+ logger.error("{} {} {} {}", MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA,
+ MsoLogger.ErrorCode.AvailabilityError.getValue(), "Exception while communicate with BPMN engine");
+ logger.debug(END_OF_THE_TRANSACTION + resp.getEntity());
return resp;
}
if (response == null) {
Response resp = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_GATEWAY,
MsoException.ServiceException, "bpelResponse is null", ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version);
- msoLogger.error(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "",
- MsoLogger.ErrorCode.BusinessProcesssError, "Null response from BPEL");
- msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError,
- "Null response from BPMN");
- msoLogger.debug(END_OF_THE_TRANSACTION + resp.getEntity());
+ logger.error("{} {} {} {}", MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA,
+ MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Null response from BPEL");
+ logger.debug(END_OF_THE_TRANSACTION + resp.getEntity());
return resp;
}
@@ -815,9 +708,8 @@ public class E2EServiceInstances {
private Response scaleE2EserviceInstances(String requestJSON,
Action action, HashMap<String, String> instanceIdMap, String version) throws ApiException {
- String requestId = UUIDChecker.generateUUID(msoLogger);
+ String requestId = UUID.randomUUID().toString();
long startTime = System.currentTimeMillis();
- msoLogger.debug("requestId is: " + requestId);
E2EServiceInstanceScaleRequest e2eScaleReq;
ObjectMapper mapper = new ObjectMapper();
@@ -827,22 +719,17 @@ public class E2EServiceInstances {
} catch (Exception e) {
- msoLogger.debug("Mapping of request to JSON object failed : ", e);
+ logger.debug("Mapping of request to JSON object failed : ", e);
Response response = msoRequest.buildServiceErrorResponse(
HttpStatus.SC_BAD_REQUEST,
MsoException.ServiceException,
"Mapping of request to JSON object failed. "
+ e.getMessage(), ErrorNumbers.SVC_BAD_PARAMETER,
null, version);
- msoLogger.error(MessageEnum.APIH_REQUEST_VALIDATION_ERROR,
- MSO_PROP_APIHANDLER_INFRA, "", "",
- MsoLogger.ErrorCode.SchemaError, requestJSON, e);
- msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR,
- MsoLogger.ResponseCode.SchemaError,
- "Mapping of request to JSON object failed");
- msoLogger.debug(END_OF_THE_TRANSACTION
- + response.getEntity());
- return response;
+ logger.error("{} {} {} {}", MessageEnum.APIH_REQUEST_VALIDATION_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA,
+ MsoLogger.ErrorCode.SchemaError.getValue(), requestJSON, e);
+ logger.debug(END_OF_THE_TRANSACTION + response.getEntity());
+ return response;
}
RecipeLookupResult recipeLookupResult;
@@ -850,40 +737,29 @@ public class E2EServiceInstances {
//TODO Get the service template model version uuid from AAI.
recipeLookupResult = getServiceInstanceOrchestrationURI(null, action);
} catch (Exception e) {
- msoLogger.error(MessageEnum.APIH_DB_ACCESS_EXC,
- MSO_PROP_APIHANDLER_INFRA, "", "",
- MsoLogger.ErrorCode.AvailabilityError,
- "Exception while communciate with Catalog DB", e);
-
- Response response = msoRequest.buildServiceErrorResponse(
+ logger.error("{} {} {} {}", MessageEnum.APIH_DB_ACCESS_EXC.toString(), MSO_PROP_APIHANDLER_INFRA,
+ MsoLogger.ErrorCode.AvailabilityError.getValue(), "Exception while communciate with Catalog DB", e);
+
+ Response response = msoRequest.buildServiceErrorResponse(
HttpStatus.SC_NOT_FOUND, MsoException.ServiceException,
"No communication to catalog DB " + e.getMessage(),
ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version);
msoRequest.createErrorRequestRecord(Status.FAILED, requestId, "No communication to catalog DB " + e.getMessage(), action, ModelType.service.name(), requestJSON);
- msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR,
- MsoLogger.ResponseCode.DBAccessError,
- "Exception while communciate with DB");
- msoLogger.debug(END_OF_THE_TRANSACTION
- + response.getEntity());
- return response;
+ logger.debug(END_OF_THE_TRANSACTION + response.getEntity());
+ return response;
}
if (recipeLookupResult == null) {
- msoLogger.error(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND,
- MSO_PROP_APIHANDLER_INFRA, "", "",
- MsoLogger.ErrorCode.DataError, "No recipe found in DB");
-
- Response response = msoRequest.buildServiceErrorResponse(
+ logger.error("{} {} {} {}", MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND.toString(), MSO_PROP_APIHANDLER_INFRA,
+ MsoLogger.ErrorCode.DataError.getValue(), "No recipe found in DB");
+
+ Response response = msoRequest.buildServiceErrorResponse(
HttpStatus.SC_NOT_FOUND, MsoException.ServiceException,
"Recipe does not exist in catalog DB",
ErrorNumbers.SVC_GENERAL_SERVICE_ERROR, null, version);
msoRequest.createErrorRequestRecord(Status.FAILED, requestId, "No recipe found in DB", action, ModelType.service.name(), requestJSON);
- msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR,
- MsoLogger.ResponseCode.DataNotFound,
- "No recipe found in DB");
- msoLogger.debug(END_OF_THE_TRANSACTION
- + response.getEntity());
- return response;
+ logger.debug(END_OF_THE_TRANSACTION + response.getEntity());
+ return response;
}
RequestClient requestClient;
@@ -894,15 +770,13 @@ public class E2EServiceInstances {
requestClient = requestClientFactory.getRequestClient(recipeLookupResult.getOrchestrationURI());
JSONObject jjo = new JSONObject(requestJSON);
- jjo.put("operationId", UUIDChecker.generateUUID(msoLogger));
+ jjo.put("operationId", requestId);
String bpmnRequest = jjo.toString();
// Capture audit event
- msoLogger
- .debug("MSO API Handler Posting call to BPEL engine for url: "
- + requestClient.getUrl());
- String serviceId = instanceIdMap.get("serviceId");
+ logger.debug("MSO API Handler Posting call to BPEL engine for url: " + requestClient.getUrl());
+ String serviceId = instanceIdMap.get("serviceId");
String serviceInstanceType = e2eScaleReq.getService().getServiceType();
RequestClientParameter postParam = new RequestClientParameter.Builder()
.setRequestId(requestId)
@@ -916,32 +790,16 @@ public class E2EServiceInstances {
.setALaCarte(false)
.setRecipeParamXsd(recipeLookupResult.getRecipeParamXsd()).build();
response = requestClient.post(postParam);
-
- msoLogger.recordMetricEvent(subStartTime,
- MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- "Successfully received response from BPMN engine", "BPMN",
- recipeLookupResult.getOrchestrationURI(), null);
- } catch (Exception e) {
- msoLogger.recordMetricEvent(subStartTime,
- MsoLogger.StatusCode.ERROR,
- MsoLogger.ResponseCode.CommunicationError,
- "Exception while communicate with BPMN engine", "BPMN",
- recipeLookupResult.getOrchestrationURI(), null);
+ } catch (Exception e) {
Response resp = msoRequest.buildServiceErrorResponse(
HttpStatus.SC_BAD_GATEWAY, MsoException.ServiceException,
"Failed calling bpmn " + e.getMessage(),
ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version);
-
- msoLogger.error(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR,
- MSO_PROP_APIHANDLER_INFRA, "", "",
- MsoLogger.ErrorCode.AvailabilityError,
- "Exception while communicate with BPMN engine",e);
- msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR,
- MsoLogger.ResponseCode.CommunicationError,
- "Exception while communicate with BPMN engine");
- msoLogger.debug(END_OF_THE_TRANSACTION
- + resp.getEntity());
- return resp;
+
+ logger.error("{} {} {} {}", MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA,
+ MsoLogger.ErrorCode.AvailabilityError.getValue(), "Exception while communicate with BPMN engine", e);
+ logger.debug(END_OF_THE_TRANSACTION + resp.getEntity());
+ return resp;
}
if (response == null) {
@@ -949,15 +807,10 @@ public class E2EServiceInstances {
HttpStatus.SC_BAD_GATEWAY, MsoException.ServiceException,
"bpelResponse is null",
ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version);
- msoLogger.error(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR,
- MSO_PROP_APIHANDLER_INFRA, "", "",
- MsoLogger.ErrorCode.BusinessProcesssError,
- "Null response from BPEL");
- msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR,
- MsoLogger.ResponseCode.InternalError,
- "Null response from BPMN");
- msoLogger.debug(END_OF_THE_TRANSACTION + resp.getEntity());
- return resp;
+ logger.error("{} {} {} {}", MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA,
+ MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Null response from BPEL");
+ logger.debug(END_OF_THE_TRANSACTION + resp.getEntity());
+ return resp;
}
ResponseHandler respHandler = new ResponseHandler(response,
@@ -978,11 +831,8 @@ public class E2EServiceInstances {
// BPMN accepted the request, the request is in progress
if (bpelStatus == HttpStatus.SC_ACCEPTED) {
String camundaJSONResponseBody = respHandler.getResponseBody();
- msoLogger.debug("Received from Camunda: " + camundaJSONResponseBody);
- msoLogger.recordAuditEvent(startTime,
- MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- "BPMN accepted the request, the request is in progress");
- msoLogger.debug(END_OF_THE_TRANSACTION + camundaJSONResponseBody);
+ logger.debug("Received from Camunda: " + camundaJSONResponseBody);
+ logger.debug(END_OF_THE_TRANSACTION + camundaJSONResponseBody);
return builder.buildResponse(HttpStatus.SC_ACCEPTED, null, camundaJSONResponseBody, apiVersion);
} else {
List<String> variables = new ArrayList<>();
@@ -995,17 +845,10 @@ public class E2EServiceInstances {
"Request Failed due to BPEL error with HTTP Status= %1 "
+ '\n' + camundaJSONResponseBody,
ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, variables, version);
- msoLogger.error(MessageEnum.APIH_BPEL_RESPONSE_ERROR,
- requestClient.getUrl(), "", "",
- MsoLogger.ErrorCode.BusinessProcesssError,
- "Response from BPEL engine is failed with HTTP Status="
- + bpelStatus);
- msoLogger.recordAuditEvent(startTime,
- MsoLogger.StatusCode.ERROR,
- MsoLogger.ResponseCode.InternalError,
- "Response from BPMN engine is failed");
- msoLogger.debug(END_OF_THE_TRANSACTION
- + resp.getEntity());
+ logger.error("{} {} {} {}", MessageEnum.APIH_BPEL_RESPONSE_ERROR.toString(), requestClient.getUrl(),
+ MsoLogger.ErrorCode.BusinessProcesssError.getValue(),
+ "Response from BPEL engine is failed with HTTP Status=" + bpelStatus);
+ logger.debug(END_OF_THE_TRANSACTION + resp.getEntity());
return resp;
} else {
Response resp = msoRequest
@@ -1015,16 +858,10 @@ public class E2EServiceInstances {
"Request Failed due to BPEL error with HTTP Status= %1",
ErrorNumbers.SVC_DETAILED_SERVICE_ERROR,
variables, version);
- msoLogger.error(MessageEnum.APIH_BPEL_RESPONSE_ERROR,
- requestClient.getUrl(), "", "",
- MsoLogger.ErrorCode.BusinessProcesssError,
- "Response from BPEL engine is empty");
- msoLogger.recordAuditEvent(startTime,
- MsoLogger.StatusCode.ERROR,
- MsoLogger.ResponseCode.InternalError,
+ logger.error("", MessageEnum.APIH_BPEL_RESPONSE_ERROR.toString(), requestClient.getUrl(),
+ MsoLogger.ErrorCode.BusinessProcesssError.getValue(),
"Response from BPEL engine is empty");
- msoLogger.debug(END_OF_THE_TRANSACTION
- + resp.getEntity());
+ logger.debug(END_OF_THE_TRANSACTION + resp.getEntity());
return resp;
}
}
@@ -1042,12 +879,11 @@ public class E2EServiceInstances {
RecipeLookupResult recipeLookupResult = getServiceURI(serviceModelUUID, action);
if (recipeLookupResult != null) {
- msoLogger.debug("Orchestration URI is: "
- + recipeLookupResult.getOrchestrationURI()
- + ", recipe Timeout is: "
- + Integer.toString(recipeLookupResult.getRecipeTimeout()));
+ logger.debug(
+ "Orchestration URI is: " + recipeLookupResult.getOrchestrationURI() + ", recipe Timeout is: " + Integer
+ .toString(recipeLookupResult.getRecipeTimeout()));
} else {
- msoLogger.debug("No matching recipe record found");
+ logger.debug("No matching recipe record found");
}
return recipeLookupResult;
}
@@ -1204,9 +1040,7 @@ public class E2EServiceInstances {
try {
returnString = mapper.writeValueAsString(sir);
} catch (IOException e) {
- msoLogger
- .debug("Exception while converting ServiceInstancesRequest object to string",
- e);
+ logger.debug("Exception while converting ServiceInstancesRequest object to string", e);
}
return returnString;
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 b002aa9f54..07c98c19b9 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
@@ -114,8 +114,6 @@ public class GlobalHealthcheckHandler {
HealthcheckResponse rsp = new HealthcheckResponse();
try{
- long startTime = System.currentTimeMillis ();
- MsoLogger.setServiceName ("GlobalHealthcheck");
// Generated RequestId
String requestId = requestContext.getProperty("requestId").toString();
MsoLogger.setLogContext(requestId, null);
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 cb458a7420..351a35826d 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
@@ -34,7 +34,6 @@ import javax.ws.rs.core.Response;
import org.apache.http.HttpStatus;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
@@ -60,8 +59,6 @@ public class NodeHealthcheckHandler {
@ApiOperation(value="Performing node health check",response=Response.class)
@Transactional
public Response nodeHealthcheck (@Context ContainerRequestContext requestContext) throws UnknownHostException {
- long startTime = System.currentTimeMillis ();
- MsoLogger.setServiceName ("NodeHealthcheck");
// Generated RequestId
String requestId = requestContext.getProperty("requestId").toString();
logger.info("{} {}", MessageEnum.APIH_GENERATED_REQUEST_ID.toString(), requestId);
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 0b2b1e73b4..ec1c4cb362 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
@@ -657,7 +657,7 @@ public class ServiceInstances {
public Response deleteInstanceGroups(@PathParam("version") String version, @PathParam("instanceGroupId") String instanceGroupId, @Context ContainerRequestContext requestContext) throws ApiException {
String requestId = getRequestId(requestContext);
HashMap<String, String> instanceIdMap = new HashMap<>();
- instanceIdMap.put(CommonConstants.INSTANCE_GROUP_ID, instanceGroupId);
+ instanceIdMap.put(CommonConstants.INSTANCE_GROUP_INSTANCE_ID, instanceGroupId);
return deleteInstanceGroups(Action.deleteInstance, instanceIdMap, version, requestId, getRequestUri(requestContext), requestContext);
}
@@ -670,7 +670,7 @@ public class ServiceInstances {
public Response addInstanceGroupMembers(String request, @PathParam("version") String version, @PathParam("instanceGroupId") String instanceGroupId, @Context ContainerRequestContext requestContext) throws ApiException {
String requestId = getRequestId(requestContext);
HashMap<String, String> instanceIdMap = new HashMap<>();
- instanceIdMap.put(CommonConstants.INSTANCE_GROUP_ID, instanceGroupId);
+ instanceIdMap.put(CommonConstants.INSTANCE_GROUP_INSTANCE_ID, instanceGroupId);
return serviceInstances(request, Action.addMembers, instanceIdMap, version, requestId, getRequestUri(requestContext));
}
@@ -683,7 +683,7 @@ public class ServiceInstances {
public Response removeInstanceGroupMembers(String request, @PathParam("version") String version, @PathParam("instanceGroupId") String instanceGroupId, @Context ContainerRequestContext requestContext) throws ApiException {
String requestId = getRequestId(requestContext);
HashMap<String, String> instanceIdMap = new HashMap<>();
- instanceIdMap.put(CommonConstants.INSTANCE_GROUP_ID, instanceGroupId);
+ instanceIdMap.put(CommonConstants.INSTANCE_GROUP_INSTANCE_ID, instanceGroupId);
return serviceInstances(request, Action.removeMembers, instanceIdMap, version, requestId, getRequestUri(requestContext));
}
@@ -808,16 +808,13 @@ public class ServiceInstances {
}
- serviceInstanceId = "";
+ serviceInstanceId = setServiceInstanceId(requestScope, sir);
String vnfId = "";
String vfModuleId = "";
String volumeGroupId = "";
String networkId = "";
String pnfCorrelationId = "";
String instanceGroupId = null;
- if(sir.getServiceInstanceId () != null){
- serviceInstanceId = sir.getServiceInstanceId ();
- }
if(sir.getVnfInstanceId () != null){
vnfId = sir.getVnfInstanceId ();
@@ -884,7 +881,7 @@ public class ServiceInstances {
return postBPELRequest(currentActiveReq, requestClientParameter, recipeLookupResult.getOrchestrationURI(), requestScope);
}
public Response deleteInstanceGroups(Actions action, HashMap<String, String> instanceIdMap, String version, String requestId, String requestUri, ContainerRequestContext requestContext) throws ApiException {
- String instanceGroupId = instanceIdMap.get(CommonConstants.INSTANCE_GROUP_ID);
+ String instanceGroupId = instanceIdMap.get(CommonConstants.INSTANCE_GROUP_INSTANCE_ID);
Boolean aLaCarte = true;
long startTime = System.currentTimeMillis ();
String apiVersion = version.substring(1);
@@ -1117,8 +1114,8 @@ public class ServiceInstances {
if(instanceIdMap.get("configurationInstanceId") != null){
currentActiveReq.setConfigurationId(instanceIdMap.get("configurationInstanceId"));
}
- if(instanceIdMap.get("InstanceGroupInstanceId") != null){
- currentActiveReq.setInstanceGroupId(instanceIdMap.get("InstanceGroupInstanceId"));
+ if(instanceIdMap.get(CommonConstants.INSTANCE_GROUP_INSTANCE_ID) != null){
+ currentActiveReq.setInstanceGroupId(instanceIdMap.get(CommonConstants.INSTANCE_GROUP_INSTANCE_ID));
}
}
}
@@ -1128,12 +1125,16 @@ public class ServiceInstances {
mapper.setSerializationInclusion(Include.NON_NULL);
if(msoRawRequest != null){
ServiceInstancesRequest sir = mapper.readValue(msoRawRequest, ServiceInstancesRequest.class);
- if( !isAlaCarte && Action.createInstance.equals(action) && serviceInstRequest != null &&
+ if( serviceInstRequest != null &&
serviceInstRequest.getRequestDetails() != null &&
serviceInstRequest.getRequestDetails().getRequestParameters() != null) {
- sir.getRequestDetails().setCloudConfiguration(serviceInstRequest.getRequestDetails().getCloudConfiguration());
- sir.getRequestDetails().getRequestParameters().setUserParams(serviceInstRequest.getRequestDetails().getRequestParameters().getUserParams());
+ if( !isAlaCarte && Action.createInstance.equals(action)) {
+ sir.getRequestDetails().setCloudConfiguration(serviceInstRequest.getRequestDetails().getCloudConfiguration());
+ sir.getRequestDetails().getRequestParameters().setUserParams(serviceInstRequest.getRequestDetails().getRequestParameters().getUserParams());
+ }
+ sir.getRequestDetails().getRequestParameters().setUsePreload(serviceInstRequest.getRequestDetails().getRequestParameters().getUsePreload());
}
+
logger.debug("Value as string: {}", mapper.writeValueAsString(sir));
return mapper.writeValueAsString(sir);
}
@@ -1970,4 +1971,20 @@ public class ServiceInstances {
}
return serviceType;
}
+ protected String setServiceInstanceId(String requestScope, ServiceInstancesRequest sir){
+ if(sir.getServiceInstanceId () != null){
+ return sir.getServiceInstanceId ();
+ }else if(requestScope.equalsIgnoreCase(ModelType.instanceGroup.toString())){
+ RelatedInstanceList[] relatedInstances = sir.getRequestDetails().getRelatedInstanceList();
+ if(relatedInstances != null){
+ for(RelatedInstanceList relatedInstanceList : relatedInstances){
+ RelatedInstance relatedInstance = relatedInstanceList.getRelatedInstance();
+ if(relatedInstance.getModelInfo().getModelType() == ModelType.service){
+ return relatedInstance.getInstanceId();
+ }
+ }
+ }
+ }
+ return null;
+ }
}
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 377b03c4ab..9305b80c13 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
@@ -158,7 +158,6 @@ public class CloudResourcesOrchestration {
@ApiOperation(value="Get status of an Operational Environment based on filter criteria",response=Response.class)
@Transactional
public Response getOperationEnvironmentStatusFilter(@Context UriInfo ui, @PathParam("version") String version ) throws ApiException{
- MsoLogger.setServiceName ("getOperationEnvironmentStatusFilter");
MultivaluedMap<String, String> queryParams = ui.getQueryParameters();
List<String> requestIdKey = queryParams.get("requestId");
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 31c65e1bd2..9303e12071 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
@@ -82,7 +82,6 @@ public class SDCClientHelper {
try {
String urlString = this.buildUriBuilder(serviceModelVersionId, operationalEnvironmentId);
- logger.debug("Url ASDC Activate request: {}", urlString);
String jsonPayload = this.buildJsonWorkloadContext(workloadContext);
String basicAuthCred = getBasicAuth();
@@ -158,7 +157,6 @@ public class SDCClientHelper {
enhancedAsdcResponseJsonObj.put("statusCode", Integer.toString(statusCode));
enhancedAsdcResponseJsonObj.put("messageId", "");
enhancedAsdcResponseJsonObj.put("message", "Success");
- logger.debug("Url ASDC Activate response: {} {}", "distributionId ", sdcResponseJsonObj.get("distributionId"));
} else { // error
if (sdcResponseJsonObj.has("requestError") ) {
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java
index 219a2efcac..352bf8fb0b 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java
@@ -86,26 +86,31 @@ public class ActivateVnfStatusOperationalEnvironment {
*/
public void execute(String requestId, CloudOrchestrationRequest request) throws ApiException {
-
- String operationalEnvironmentId = "";
+ try {
+
+ String operationalEnvironmentId = "";
String sdcDistributionId = request.getDistributionId();
Distribution sdcStatus = request.getDistribution();
- // Distribution, Query for operationalEnvironmentId, serviceModelVersionId
+ // Distribution, Query for operationalEnvironmentId, serviceModelVersionId, origRequestId
this.queryDistributionDbResponse = client.getDistributionStatusById(sdcDistributionId);
operationalEnvironmentId = this.queryDistributionDbResponse.getOperationalEnvId();
+ this.origRequestId = this.queryDistributionDbResponse.getRequestId();
- // ServiceModel, Query for dbRequestId, recoveryAction, retryCountString
- this.queryServiceModelResponse = client.findOneByOperationalEnvIdAndServiceModelVersionId(operationalEnvironmentId, queryDistributionDbResponse.getServiceModelVersionId());
- this.origRequestId = this.queryServiceModelResponse.getRequestId();
-
+ // ServiceModel, Query for recoveryAction, retryCountString
+ this.queryServiceModelResponse = client.findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestId(operationalEnvironmentId, queryDistributionDbResponse.getServiceModelVersionId(), this.origRequestId);
+
processActivateSDCStatus(sdcDistributionId, sdcStatus, this.queryDistributionDbResponse, this.queryServiceModelResponse);
// After EVERY status processed, need to query the status of all service modelId
// to determine the OVERALL status if "COMPLETE" or "FAILURE":
checkOrUpdateOverallStatus(operationalEnvironmentId, this.origRequestId);
-
+
+ } catch(Exception e) {
+ requestDb.updateInfraFailureCompletion(e.getMessage(), this.origRequestId, this.queryDistributionDbResponse.getOperationalEnvId());
+ }
+
}
/**
@@ -161,13 +166,11 @@ public class ActivateVnfStatusOperationalEnvironment {
}
sdcStatusValue = modifiedStatus;
- // should update 1 row, modified status & retryCount set 0
OperationalEnvServiceModelStatus updateRetryCountZeroAndStatus =
dbHelper.updateRetryCountAndStatusInOperationalEnvServiceModelStatus(queryServiceModelResponse,
modifiedStatus,
- RETRY_COUNT_ZERO);
+ RETRY_COUNT_ZERO);
client.save(updateRetryCountZeroAndStatus);
- // should update 1 row, modified status
OperationalEnvDistributionStatus updateDistStatus =
dbHelper.updateStatusInOperationalEnvDistributionStatus(queryDistributionDbResponse,
modifiedStatus,
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/RequestStatus.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/RequestStatus.java
index 7ef712e124..6fd765b76f 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/RequestStatus.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/RequestStatus.java
@@ -38,7 +38,7 @@ public class RequestStatus implements Serializable {
protected String statusMessage;
@JsonProperty("percentProgress")
protected String percentProgress;
- @JsonProperty("timeStamp")
+ @JsonProperty("timestamp")
protected String timeStamp;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/InstanceIdMapValidation.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/InstanceIdMapValidation.java
index f1985e9fcf..fad11a5cc6 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/InstanceIdMapValidation.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/InstanceIdMapValidation.java
@@ -77,11 +77,11 @@ public class InstanceIdMapValidation implements ValidationRule{
sir.setConfigurationId(instanceIdMap.get("configurationInstanceId"));
}
- if(instanceIdMap.get(CommonConstants.INSTANCE_GROUP_ID) != null){
- if (!UUIDChecker.isValidUUID (instanceIdMap.get (CommonConstants.INSTANCE_GROUP_ID))) {
- throw new ValidationException (CommonConstants.INSTANCE_GROUP_ID, true);
+ if(instanceIdMap.get(CommonConstants.INSTANCE_GROUP_INSTANCE_ID) != null){
+ if (!UUIDChecker.isValidUUID (instanceIdMap.get (CommonConstants.INSTANCE_GROUP_INSTANCE_ID))) {
+ throw new ValidationException (CommonConstants.INSTANCE_GROUP_INSTANCE_ID, true);
}
- sir.setInstanceGroupId(instanceIdMap.get(CommonConstants.INSTANCE_GROUP_ID));
+ sir.setInstanceGroupId(instanceIdMap.get(CommonConstants.INSTANCE_GROUP_INSTANCE_ID));
}
}
return info;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/RequestParametersValidation.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/RequestParametersValidation.java
index edb92ef68b..8e1a6f5d35 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/RequestParametersValidation.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/RequestParametersValidation.java
@@ -73,6 +73,23 @@ public class RequestParametersValidation implements ValidationRule{
if(action == Action.createInstance || action == Action.updateInstance){
if(requestParameters.isUsePreload() == null){
if(reqVersion >= 4){
+ if (requestParameters.getALaCarte() == null || requestParameters.getALaCarte() == true) {
+ requestParameters.setUsePreload(true);
+ }
+ else {
+ requestParameters.setUsePreload(false);
+ }
+ }
+ else {
+ requestParameters.setUsePreload(true);
+ }
+ }
+ }
+ }
+ if(requestScope.equalsIgnoreCase(ModelType.service.name())){
+ if(action == Action.createInstance){
+ if(requestParameters.isUsePreload() == null){
+ if(reqVersion >= 4){
if (requestParameters.getALaCarte() == null || requestParameters.getALaCarte() == false) {
requestParameters.setUsePreload(false);
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/MsoRequestTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/MsoRequestTest.java
index 145213fc6c..ee98accfdc 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/MsoRequestTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/MsoRequestTest.java
@@ -430,12 +430,12 @@ public class MsoRequestTest extends BaseTest {
@Test
public void instanceGroupIdHashMapFailureTest() throws JsonParseException, JsonMappingException, IOException, ValidationException{
this.sir = mapper.readValue(inputStream("/SuccessfulValidation/InstanceIdHashMap.json"), ServiceInstancesRequest.class);
- this.instanceIdMapTest.put("instanceGroupId", "test");
+ this.instanceIdMapTest.put("instanceGroupInstanceId", "test");
this.action = Action.createInstance;
thrown.expect(ValidationException.class);
this.reqVersion = 7;
this.version = "v" + reqVersion;
- thrown.expectMessage("No valid instanceGroupId is specified");
+ thrown.expectMessage("No valid instanceGroupInstanceId is specified");
this.msoRequest = new MsoRequest();
this.msoRequest.parse(sir, instanceIdMapTest, action, version, originalRequestJSON, reqVersion, false);
}
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 83b5a49e8c..d6c794ef2e 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
@@ -31,6 +31,7 @@ import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
@@ -79,8 +80,10 @@ import org.springframework.util.ResourceUtils;
import org.springframework.web.util.UriComponentsBuilder;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
+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.github.tomakehurst.wiremock.http.Fault;
@@ -114,9 +117,12 @@ public class ServiceInstancesTest extends BaseTest{
// set headers
headers = new HttpHeaders();
headers.set(ONAPLogConstants.Headers.PARTNER_NAME, "test_name");
- headers.set(ONAPLogConstants.Headers.REQUEST_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d");
- headers.set(MsoLogger.REQUESTOR_ID, "xxxxxx");
- try { // generate one-time port number to avoid RANDOM port number later.
+ headers.set(MsoLogger.TRANSACTION_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d");
+ headers.set(MsoLogger.ONAP_REQUEST_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d");
+ headers.set(ONAPLogConstants.MDCs.REQUEST_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d");
+ headers.set(MsoLogger.CLIENT_ID, "VID");
+ headers.set(MsoLogger.REQUESTOR_ID, "xxxxxx");
+ try { // generate one-time port number to avoid RANDOM port number later.
initialUrl = new URL(createURLWithPort(Constants.ORCHESTRATION_REQUESTS_PATH));
initialPort = initialUrl.getPort();
} catch (MalformedURLException e) {
@@ -188,6 +194,24 @@ public class ServiceInstancesTest extends BaseTest{
assertEquals("10",modelInfo.getModelUuid());
}
+
+
+ @Test
+ public void test_mapJSONtoMSOStyleUsePreload() throws IOException{
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.setSerializationInclusion(Include.NON_NULL);
+ String testRequest= inputStream("/ServiceInstanceDefault.json");
+ ServiceInstancesRequest sir = new ServiceInstancesRequest();
+ RequestDetails rd = new RequestDetails();
+ RequestParameters rp = new RequestParameters();
+ rp.setUsePreload(true);
+ rd.setRequestParameters(rp);
+ sir.setRequestDetails(rd);
+ String resultString = servInstances.mapJSONtoMSOStyle(testRequest, sir, false, null);
+ ServiceInstancesRequest sir1 = mapper.readValue(resultString, ServiceInstancesRequest.class);
+ assertTrue(sir1.getRequestDetails().getRequestParameters().getUsePreload());
+ }
+
@Test
public void createServiceInstanceVIDDefault() throws IOException{
TestAppender.events.clear();
@@ -391,9 +415,10 @@ public class ServiceInstancesTest extends BaseTest{
}
@Test
public void activateServiceInstanceNoRecipeALaCarte() throws IOException{
+ TestAppender.events.clear();
uri = servInstanceuri + "v5" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/activate";
HttpHeaders requestIDheaders = new HttpHeaders();
- requestIDheaders.set("X-ECOMP-RequestID", "32807a28-1a14-4b88-b7b3-2950918aa76d");
+ requestIDheaders.set(ONAPLogConstants.Headers.REQUEST_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d");
ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceALaCarteTrueNoRecipe.json"), uri, HttpMethod.POST, requestIDheaders);
Service defaultService = new Service();
@@ -2368,7 +2393,8 @@ public class ServiceInstancesTest extends BaseTest{
if(logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.JaxRsFilterLogging") &&
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("32807a28-1a14-4b88-b7b3-2950918aa76d", mdc.get(ONAPLogConstants.MDCs.REQUEST_ID));
+ assertEquals("VID",mdc.get(MsoLogger.PARTNERNAME));
}
}
}
@@ -2425,6 +2451,7 @@ public class ServiceInstancesTest extends BaseTest{
public void deleteInstanceGroupNoPartnerNameHeader() throws IOException{
HttpHeaders noPartnerHeaders = new HttpHeaders();
noPartnerHeaders.set(ONAPLogConstants.Headers.REQUEST_ID, "eca3a1b1-43ab-457e-ab1c-367263d148b4");
+ noPartnerHeaders.set(MsoLogger.REQUESTOR_ID, "xxxxxx");
uri = servInstanceuri + "/v7/instanceGroups/e05864f0-ab35-47d0-8be4-56fd9619ba3c";
ResponseEntity<String> response = sendRequest(null, uri, HttpMethod.DELETE, noPartnerHeaders);
//then
@@ -2621,6 +2648,61 @@ public class ServiceInstancesTest extends BaseTest{
assertEquals(serviceType, "networkModelName");
}
@Test
+ public void setServiceInstanceIdInstanceGroupTest() throws JsonParseException, JsonMappingException, IOException{
+ String requestScope = "instanceGroup";
+ ServiceInstancesRequest sir = mapper.readValue(inputStream("/CreateInstanceGroup.json"), ServiceInstancesRequest.class);
+ assertEquals("ddcbbf3d-f2c1-4ca0-8852-76a807285efc", servInstances.setServiceInstanceId(requestScope, sir));
+ }
+ @Test
+ public void setServiceInstanceIdTest(){
+ String requestScope = "vnf";
+ ServiceInstancesRequest sir = new ServiceInstancesRequest();
+ sir.setServiceInstanceId("f0a35706-efc4-4e27-80ea-a995d7a2a40f");
+ assertEquals("f0a35706-efc4-4e27-80ea-a995d7a2a40f", servInstances.setServiceInstanceId(requestScope, sir));
+ }
+ @Test
+ public void setServiceInstanceIdReturnNullTest(){
+ String requestScope = "vnf";
+ ServiceInstancesRequest sir = new ServiceInstancesRequest();
+ assertNull(servInstances.setServiceInstanceId(requestScope, sir));
+ }
+ @Test
+ public void camundaHistoryCheckTest() throws ContactCamundaException, RequestDbFailureException{
+ stubFor(get(("/sobpmnengine/history/process-instance?variables=mso-request-id_eq_f0a35706-efc4-4e27-80ea-a995d7a2a40f"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBodyFile("Camunda/HistoryCheckResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK)));
+
+ InfraActiveRequests duplicateRecord = new InfraActiveRequests();
+ duplicateRecord.setRequestId("f0a35706-efc4-4e27-80ea-a995d7a2a40f");
+ boolean inProgress = false;
+ inProgress = servInstances.camundaHistoryCheck(duplicateRecord, null);
+ assertTrue(inProgress);
+ }
+ @Test
+ public void camundaHistoryCheckNoneFoundTest() throws ContactCamundaException, RequestDbFailureException{
+ stubFor(get(("/sobpmnengine/history/process-instance?variables=mso-request-id_eq_f0a35706-efc4-4e27-80ea-a995d7a2a40f"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody("[]").withStatus(org.apache.http.HttpStatus.SC_OK)));
+
+ InfraActiveRequests duplicateRecord = new InfraActiveRequests();
+ duplicateRecord.setRequestId("f0a35706-efc4-4e27-80ea-a995d7a2a40f");
+ boolean inProgress = false;
+ inProgress = servInstances.camundaHistoryCheck(duplicateRecord, null);
+ assertFalse(inProgress);
+ }
+ @Test
+ public void camundaHistoryCheckNotInProgressTest()throws ContactCamundaException, RequestDbFailureException{
+ stubFor(get(("/sobpmnengine/history/process-instance?variables=mso-request-id_eq_f0a35706-efc4-4e27-80ea-a995d7a2a40f"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBodyFile("Camunda/HistoryCheckResponseCompleted.json").withStatus(org.apache.http.HttpStatus.SC_OK)));
+
+ InfraActiveRequests duplicateRecord = new InfraActiveRequests();
+ duplicateRecord.setRequestId("f0a35706-efc4-4e27-80ea-a995d7a2a40f");
+ boolean inProgress = false;
+ inProgress = servInstances.camundaHistoryCheck(duplicateRecord, null);
+ assertFalse(inProgress);
+ }
+ @Test
public void setCamundaHeadersTest()throws ContactCamundaException, RequestDbFailureException{
String encryptedAuth = "015E7ACF706C6BBF85F2079378BDD2896E226E09D13DC2784BA309E27D59AB9FAD3A5E039DF0BB8408"; // user:password
String key = "07a7159d3bf51a0e53be7a8f89699be7";
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironmentTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironmentTest.java
index 29fa1a34b3..a26848bf21 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironmentTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironmentTest.java
@@ -109,7 +109,7 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
iar.setRequestId(requestIdOrig);
iar.setRequestStatus("PENDING");
- stubFor(get(urlPathEqualTo("/operationalEnvServiceModelStatus/search/findOneByOperationalEnvIdAndServiceModelVersionId"))
+ stubFor(get(urlPathEqualTo("/operationalEnvServiceModelStatus/search/findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestId"))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBody(mapper.writeValueAsString(serviceModelDb))
.withStatus(HttpStatus.SC_OK)));
@@ -134,7 +134,7 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
serviceModelDb.setOperationalEnvId(operationalEnvironmentId);
serviceModelDb.setRetryCount(retryCountZero);
serviceModelDb.setServiceModelVersionDistrStatus(statusError);
- stubFor(get(urlPathEqualTo("/operationalEnvServiceModelStatus/search/findOneByOperationalEnvIdAndServiceModelVersionId"))
+ stubFor(get(urlPathEqualTo("/operationalEnvServiceModelStatus/search/findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestId"))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBody(mapper.writeValueAsString(serviceModelDb))
.withStatus(HttpStatus.SC_OK)));
@@ -169,7 +169,7 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
serviceModelDb.setOperationalEnvId(operationalEnvironmentId);
serviceModelDb.setRetryCount(retryCountTwo);
serviceModelDb.setServiceModelVersionDistrStatus(statusError);
- stubFor(get(urlPathEqualTo("/operationalEnvServiceModelStatus/search/findOneByOperationalEnvIdAndServiceModelVersionId"))
+ stubFor(get(urlPathEqualTo("/operationalEnvServiceModelStatus/search/findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestId"))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBody(mapper.writeValueAsString(serviceModelDb))
.withStatus(HttpStatus.SC_OK)));
@@ -208,7 +208,7 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
iar.setRequestId(requestIdOrig);
iar.setRequestStatus("PENDING");
- stubFor(get(urlPathEqualTo("/operationalEnvServiceModelStatus/search/findOneByOperationalEnvIdAndServiceModelVersionId"))
+ stubFor(get(urlPathEqualTo("/operationalEnvServiceModelStatus/search/findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestId"))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBody(mapper.writeValueAsString(serviceModelDb))
.withStatus(HttpStatus.SC_OK)));
@@ -244,7 +244,7 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
serviceModelDb.setOperationalEnvId(operationalEnvironmentId);
serviceModelDb.setRetryCount(retryCountThree);
serviceModelDb.setServiceModelVersionDistrStatus(statusError);
- stubFor(get(urlPathEqualTo("/operationalEnvServiceModelStatus/search/findOneByOperationalEnvIdAndServiceModelVersionId"))
+ stubFor(get(urlPathEqualTo("/operationalEnvServiceModelStatus/search/findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestId"))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBody(mapper.writeValueAsString(serviceModelDb))
.withStatus(HttpStatus.SC_OK)));
@@ -276,7 +276,7 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
stubFor(post(urlPathMatching("/sdc/v1/catalog/services/.*"))
.willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(jsonObject.toString()).withStatus(HttpStatus.SC_ACCEPTED)));
- stubFor(get(urlPathEqualTo("/operationalEnvServiceModelStatus/search/findOneByOperationalEnvIdAndServiceModelVersionId"))
+ stubFor(get(urlPathEqualTo("/operationalEnvServiceModelStatus/search/findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestId"))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBody(mapper.writeValueAsString(serviceModelDb))
.withStatus(HttpStatus.SC_OK)));
@@ -339,7 +339,7 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
iar.setRequestId(requestIdOrig);
iar.setRequestStatus("PENDING");
- stubFor(get(urlPathEqualTo("/operationalEnvServiceModelStatus/search/findOneByOperationalEnvIdAndServiceModelVersionId"))
+ stubFor(get(urlPathEqualTo("/operationalEnvServiceModelStatus/search/findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestId"))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBody(mapper.writeValueAsString(serviceModelDb))
.withStatus(HttpStatus.SC_OK)));
@@ -415,7 +415,7 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
InfraActiveRequests iar = new InfraActiveRequests();
iar.setRequestId(requestIdOrig);
iar.setRequestStatus("PENDING");
- stubFor(get(urlPathEqualTo("/operationalEnvServiceModelStatus/search/findOneByOperationalEnvIdAndServiceModelVersionId"))
+ stubFor(get(urlPathEqualTo("/operationalEnvServiceModelStatus/search/findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestId"))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBody(mapper.writeValueAsString(serviceModelDb))
.withStatus(HttpStatus.SC_OK)));
@@ -477,7 +477,7 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
iar.setRequestId(requestIdOrig);
iar.setRequestStatus("PENDING");
- stubFor(get(urlPathEqualTo("/operationalEnvServiceModelStatus/search/findOneByOperationalEnvIdAndServiceModelVersionId"))
+ stubFor(get(urlPathEqualTo("/operationalEnvServiceModelStatus/search/findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestId"))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBody(mapper.writeValueAsString(serviceModelDb))
.withStatus(HttpStatus.SC_OK)));
@@ -536,7 +536,7 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
iar.setRequestId(requestIdOrig);
iar.setRequestStatus("PENDING");
- stubFor(get(urlPathEqualTo("/operationalEnvServiceModelStatus/search/findOneByOperationalEnvIdAndServiceModelVersionId"))
+ stubFor(get(urlPathEqualTo("/operationalEnvServiceModelStatus/search/findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestId"))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBody(mapper.writeValueAsString(serviceModelDb))
.withStatus(HttpStatus.SC_OK)));
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/validation/RequestParametersValidationTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/validation/RequestParametersValidationTest.java
index 2813ef7b70..bd9b95dc12 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/validation/RequestParametersValidationTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/validation/RequestParametersValidationTest.java
@@ -50,7 +50,7 @@ public class RequestParametersValidationTest extends BaseTest{
sir.setServiceInstanceId("0fd90c0c-0e3a-46e2-abb5-4c4820d5985b");
RequestParametersValidation validation = new RequestParametersValidation();
validation.validate(info);
-
+ assertFalse(sir.getRequestDetails().getRequestParameters().getUsePreload());
assertFalse(info.getReqParameters().getUsePreload());
}
@@ -66,7 +66,8 @@ public class RequestParametersValidationTest extends BaseTest{
RequestParametersValidation validation = new RequestParametersValidation();
validation.validate(info);
- assertFalse(info.getReqParameters().getUsePreload());
+ assertTrue(sir.getRequestDetails().getRequestParameters().getUsePreload());
+ assertTrue(info.getReqParameters().getUsePreload());
}
@Test
@@ -82,6 +83,7 @@ public class RequestParametersValidationTest extends BaseTest{
RequestParametersValidation validation = new RequestParametersValidation();
validation.validate(info);
+ assertTrue(sir.getRequestDetails().getRequestParameters().getUsePreload());
assertTrue(info.getReqParameters().getUsePreload());
}
@@ -97,7 +99,71 @@ public class RequestParametersValidationTest extends BaseTest{
sir.setServiceInstanceId("0fd90c0c-0e3a-46e2-abb5-4c4820d5985b");
RequestParametersValidation validation = new RequestParametersValidation();
validation.validate(info);
-
+ assertTrue(sir.getRequestDetails().getRequestParameters().getUsePreload());
+ assertTrue(info.getReqParameters().getUsePreload());
+ }
+
+ @Test
+ public void testServiceWithFalseALaCarte() throws IOException, ValidationException {
+ String requestJson = new String(Files.readAllBytes(Paths.get("src/test/resources/MsoRequestTest/RequestParameters/VfModuleModelVersionId.json")));
+ ObjectMapper mapper = new ObjectMapper();
+ ServiceInstancesRequest sir = mapper.readValue(requestJson, ServiceInstancesRequest.class);
+ sir.getRequestDetails().getRequestParameters().setUsePreload(null);
+ ValidationInformation info = new ValidationInformation(sir, new HashMap<String, String>(), Action.createInstance,
+ 6, false, sir.getRequestDetails().getRequestParameters());
+ sir.setServiceInstanceId("0fd90c0c-0e3a-46e2-abb5-4c4820d5985b");
+ info.setRequestScope("service");
+ RequestParametersValidation validation = new RequestParametersValidation();
+ validation.validate(info);
+ assertFalse(sir.getRequestDetails().getRequestParameters().getUsePreload());
+ assertFalse(info.getReqParameters().getUsePreload());
+ }
+
+ @Test
+ public void testServiceWithNoALaCarte() throws IOException, ValidationException {
+ String requestJson = new String(Files.readAllBytes(Paths.get("src/test/resources/MsoRequestTest/RequestParameters/VfModuleRequestParametersNoALaCarte.json")));
+ ObjectMapper mapper = new ObjectMapper();
+ ServiceInstancesRequest sir = mapper.readValue(requestJson, ServiceInstancesRequest.class);
+ ValidationInformation info = new ValidationInformation(sir, new HashMap<String, String>(), Action.createInstance,
+ 6, false, sir.getRequestDetails().getRequestParameters());
+ sir.setServiceInstanceId("0fd90c0c-0e3a-46e2-abb5-4c4820d5985b");
+ sir.getRequestDetails().getRequestParameters().setSubscriptionServiceType("subscriptionServiceType");
+ info.setRequestScope("service");
+ RequestParametersValidation validation = new RequestParametersValidation();
+ validation.validate(info);
+ assertFalse(sir.getRequestDetails().getRequestParameters().getUsePreload());
+ assertFalse(info.getReqParameters().getUsePreload());
+ }
+
+ @Test
+ public void testServiceWithTrueALaCarte() throws IOException, ValidationException {
+ String requestJson = new String(Files.readAllBytes(Paths.get("src/test/resources/MsoRequestTest/RequestParameters/VfModuleRequestParametersIsALaCarte.json")));
+ ObjectMapper mapper = new ObjectMapper();
+ ServiceInstancesRequest sir = mapper.readValue(requestJson, ServiceInstancesRequest.class);
+ sir.getRequestDetails().getRequestParameters().setUsePreload(null);
+ ValidationInformation info = new ValidationInformation(sir, new HashMap<String, String>(), Action.createInstance,
+ 6, true, sir.getRequestDetails().getRequestParameters());
+ sir.setServiceInstanceId("0fd90c0c-0e3a-46e2-abb5-4c4820d5985b");
+ info.setRequestScope("service");
+ RequestParametersValidation validation = new RequestParametersValidation();
+ validation.validate(info);
+ assertTrue(sir.getRequestDetails().getRequestParameters().getUsePreload());
assertTrue(info.getReqParameters().getUsePreload());
}
+
+ @Test
+ public void testServiceWithReqVersionBelow4() throws IOException, ValidationException {
+ String requestJson = new String(Files.readAllBytes(Paths.get("src/test/resources/MsoRequestTest/RequestParameters/VfModuleModelVersionId.json")));
+ ObjectMapper mapper = new ObjectMapper();
+ ServiceInstancesRequest sir = mapper.readValue(requestJson, ServiceInstancesRequest.class);
+ sir.getRequestDetails().getRequestParameters().setUsePreload(null);
+ ValidationInformation info = new ValidationInformation(sir, new HashMap<String, String>(), Action.createInstance,
+ 3, false, sir.getRequestDetails().getRequestParameters());
+ sir.setServiceInstanceId("0fd90c0c-0e3a-46e2-abb5-4c4820d5985b");
+ info.setRequestScope("service");
+ RequestParametersValidation validation = new RequestParametersValidation();
+ validation.validate(info);
+ assertTrue(sir.getRequestDetails().getRequestParameters().getUsePreload());
+ assertTrue(info.getReqParameters().getUsePreload());
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/OrchestrationFilterResponse.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/OrchestrationFilterResponse.json
index dde4392c38..3b2eca7ce2 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/OrchestrationFilterResponse.json
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/OrchestrationFilterResponse.json
@@ -29,7 +29,7 @@
"requestState": "COMPLETE",
"statusMessage": "STATUS: COMPLETED",
"percentProgress": 100,
- "timeStamp": "Fri, 01 Jul 2016 04:41:42 GMT"
+ "timestamp": "Fri, 01 Jul 2016 04:41:42 GMT"
}
}
},
@@ -63,7 +63,7 @@
"requestState": "COMPLETE",
"statusMessage": "STATUS: Vf Module has been deleted successfully. FLOW STATUS: Building blocks 1 of 3 completed. ROLLBACK STATUS: Rollback has been completed successfully.",
"percentProgress": 100,
- "timeStamp": "Thu, 22 Dec 2016 08:30:28 GMT"
+ "timestamp": "Thu, 22 Dec 2016 08:30:28 GMT"
}
}
},
@@ -97,7 +97,7 @@
"requestState": "PENDING",
"statusMessage": "STATUS: Vf Module deletion pending.",
"percentProgress": 0,
- "timeStamp": "Thu, 22 Dec 2016 08:30:28 GMT"
+ "timestamp": "Thu, 22 Dec 2016 08:30:28 GMT"
}
}
},
@@ -181,7 +181,7 @@
"requestState": "UNLOCKED",
"statusMessage": "STATUS: Vf Module deletion pending.",
"percentProgress": 0,
- "timeStamp": "Mon, 30 Jul 2018 06:09:01 GMT"
+ "timestamp": "Mon, 30 Jul 2018 06:09:01 GMT"
}
}
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/OrchestrationList.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/OrchestrationList.json
index ecbf7a92a4..90089c0c7e 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/OrchestrationList.json
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/OrchestrationList.json
@@ -28,7 +28,7 @@
"requestState":"COMPLETE",
"statusMessage":"STATUS: Vf Module has been deleted successfully.",
"percentProgress":100,
- "timeStamp": "Thu, 22 Dec 2016 08:30:28 GMT"
+ "timestamp": "Thu, 22 Dec 2016 08:30:28 GMT"
}
}
},
@@ -60,7 +60,7 @@
"requestState":"PENDING",
"statusMessage":"FLOW STATUS: Building blocks 1 of 3 completed. RETRY STATUS: Retry 2/5 will be started in 8 min. ROLLBACK STATUS: Rollback has been completed successfully.",
"percentProgress":0,
- "timeStamp": "Thu, 22 Dec 2016 08:30:28 GMT"
+ "timestamp": "Thu, 22 Dec 2016 08:30:28 GMT"
}
}
},
@@ -323,7 +323,7 @@
"requestState":"PENDING",
"statusMessage":"STATUS: Adding members. FLOW STATUS: Building blocks 1 of 3 completed. RETRY STATUS: Retry 2/5 will be started in 8 min. ROLLBACK STATUS: Rollback has been completed successfully.",
"percentProgress":0,
- "timeStamp": "Thu, 22 Dec 2016 08:30:28 GMT"
+ "timestamp": "Thu, 22 Dec 2016 08:30:28 GMT"
}
}
}
diff --git a/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImpl.java b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImpl.java
index 761aaa1446..e3f15764d7 100644
--- a/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImpl.java
+++ b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImpl.java
@@ -551,6 +551,7 @@ public class InfraActiveRequestsRepositoryImpl implements InfraActiveRequestsRep
}
try {
final CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
+
final CriteriaQuery<InfraActiveRequests> criteriaQuery =
criteriaBuilder.createQuery(InfraActiveRequests.class);
final Root<InfraActiveRequests> tableRoot = criteriaQuery.from(InfraActiveRequests.class);
@@ -558,17 +559,12 @@ public class InfraActiveRequestsRepositoryImpl implements InfraActiveRequestsRep
final Timestamp minTime = new Timestamp(startTime);
final Timestamp maxTime = new Timestamp(endTime);
- predicates.add(criteriaBuilder.greaterThanOrEqualTo(tableRoot.get(START_TIME), minTime));
- predicates.add(criteriaBuilder.lessThanOrEqualTo(tableRoot.get(END_TIME), maxTime));
-
final Predicate basePredicate = criteriaBuilder.and(predicates.toArray(new Predicate[predicates.size()]));
-
- final Predicate additionalPredicate = criteriaBuilder.and(tableRoot.get(END_TIME).isNull(),
- criteriaBuilder.greaterThanOrEqualTo(tableRoot.get(START_TIME), minTime),
- criteriaBuilder.lessThanOrEqualTo(tableRoot.get(START_TIME), maxTime));
-
- criteriaQuery.where(criteriaBuilder.or(basePredicate, additionalPredicate));
+ final Predicate additionalPredicate = criteriaBuilder.and(
+ criteriaBuilder.greaterThanOrEqualTo(tableRoot.get(START_TIME), minTime),
+ criteriaBuilder.or(tableRoot.get(END_TIME).isNull(), criteriaBuilder.lessThanOrEqualTo(tableRoot.get(END_TIME), maxTime)));
+ criteriaQuery.where(criteriaBuilder.and(basePredicate, additionalPredicate));
if (maxResult != null) {
return entityManager.createQuery(criteriaQuery).setMaxResults(maxResult).getResultList();
}
@@ -579,7 +575,7 @@ public class InfraActiveRequestsRepositoryImpl implements InfraActiveRequestsRep
}
}
- private List<Predicate> getPredicates(final Map<String, String[]> filters, final CriteriaBuilder criteriaBuilder,
+ protected List<Predicate> getPredicates(final Map<String, String[]> filters, final CriteriaBuilder criteriaBuilder,
final Root<InfraActiveRequests> tableRoot) {
final List<Predicate> predicates = new LinkedList<>();
for (final Entry<String, String[]> entry : filters.entrySet()) {
diff --git a/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/OperationalEnvServiceModelStatusRepository.java b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/OperationalEnvServiceModelStatusRepository.java
index bcad9ce6d5..ecf1dcb183 100644
--- a/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/OperationalEnvServiceModelStatusRepository.java
+++ b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/OperationalEnvServiceModelStatusRepository.java
@@ -37,7 +37,8 @@ public interface OperationalEnvServiceModelStatusRepository extends JpaRepositor
public OperationalEnvServiceModelStatus findOneByOperationalEnvIdAndRequestId(String operationalEnvId, String requestId);
public List<OperationalEnvServiceModelStatus> findAllByOperationalEnvIdAndRequestId(@Param("OPERATIONAL_ENV_ID") String operationalEnvId,
@Param("REQUEST_ID") String requestId);
- public OperationalEnvServiceModelStatus findOneByOperationalEnvIdAndServiceModelVersionId(@Param("OPERATIONAL_ENV_ID") String operationalEnvId,
- @Param("SERVICE_MODEL_VERSION_ID") String serviceModelVersionId);
+ public OperationalEnvServiceModelStatus findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestId(@Param("OPERATIONAL_ENV_ID") String operationalEnvId,
+ @Param("SERVICE_MODEL_VERSION_ID") String serviceModelVersionId,
+ @Param("REQUEST_ID") String requestId);
}
diff --git a/mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/OperationalEnvServiceModelStatusTest.java b/mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/OperationalEnvServiceModelStatusTest.java
index ef3466278e..9eec860cc9 100644
--- a/mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/OperationalEnvServiceModelStatusTest.java
+++ b/mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/OperationalEnvServiceModelStatusTest.java
@@ -54,8 +54,9 @@ public class OperationalEnvServiceModelStatusTest {
status.setRetryCount(0);
repository.saveAndFlush(status);
- OperationalEnvServiceModelStatus status2 = repository.findOneByOperationalEnvIdAndServiceModelVersionId("oper-env-id-1", "service-model-ver-id-1");
+ OperationalEnvServiceModelStatus status2 = repository.findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestId("oper-env-id-1", "service-model-ver-id-1", "request-id-1");
status2.setRetryCount(1);
+ assertEquals("request-id-1", status2.getRequestId());
repository.saveAndFlush(status2);
diff --git a/mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/RequestDBConfig.java b/mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/RequestDBConfig.java
index 9026571720..9c270d619b 100644
--- a/mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/RequestDBConfig.java
+++ b/mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/RequestDBConfig.java
@@ -21,11 +21,15 @@
package org.onap.so.db.request;
+import java.util.TimeZone;
+
+import javax.annotation.PostConstruct;
import javax.persistence.EntityManagerFactory;
import javax.sql.DataSource;
+
import org.springframework.beans.factory.annotation.Qualifier;
-import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -73,5 +77,10 @@ public class RequestDBConfig {
) {
return new JpaTransactionManager(entityManagerFactory);
}
+
+ @PostConstruct
+ public void started() {
+ TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
+ }
}
diff --git a/mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImplTest.java b/mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImplTest.java
index def999b556..4dd500d86d 100644
--- a/mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImplTest.java
+++ b/mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImplTest.java
@@ -19,11 +19,15 @@
*/
package org.onap.so.db.request.data.repository;
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.hamcrest.CoreMatchers.not;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.mock;
import static org.onap.so.db.request.data.repository.InfraActiveRequestsRepositoryImpl.ACTION;
import static org.onap.so.db.request.data.repository.InfraActiveRequestsRepositoryImpl.REQUEST_ID;
import static org.onap.so.db.request.data.repository.InfraActiveRequestsRepositoryImpl.SERVICE_INSTANCE_ID;
@@ -33,6 +37,11 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
+import java.util.stream.Collectors;
+
+import javax.persistence.criteria.CriteriaBuilder;
+import javax.persistence.criteria.Predicate;
+import javax.persistence.criteria.Root;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -43,7 +52,6 @@ import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;
-
@RunWith(SpringRunner.class)
@SpringBootTest(classes = TestApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@ActiveProfiles("test")
@@ -73,7 +81,7 @@ public class InfraActiveRequestsRepositoryImplTest {
private static final String SERVICE_INSTANCE_ID_VALUE = "e3b5744d-2ad1-4cdd-8390-c999a38829bc";
@Autowired
- private InfraActiveRequestsRepository objUnderTest;
+ private InfraActiveRequestsRepositoryImpl objUnderTest;
@Test
public void test_GetInfraActiveRequests_emptyFiltersMap() {
@@ -86,11 +94,9 @@ public class InfraActiveRequestsRepositoryImplTest {
public void test_GetInfraActiveRequests_invalidFiltersMap() {
final Map<String, String[]> filters = new HashMap<>();
filters.put("OverTheMoon", new String[] {"Humpty Dumpty Sat On The Wall"});
- final long startTime = START_TIME_IN_MILISEC - TimeUnit.DAYS.toMillis(20);
- final long endTime = END_TIME_IN_MILISEC - TimeUnit.DAYS.toMillis(20);
- final List<InfraActiveRequests> actualRequests =
- objUnderTest.getInfraActiveRequests(filters, startTime, endTime, null);
- assertTrue(actualRequests.isEmpty());
+ final List<Predicate> predicates =
+ objUnderTest.getPredicates(filters, mock(CriteriaBuilder.class), (Root<InfraActiveRequests>)mock(Root.class));
+ assertTrue(predicates.isEmpty());
}
@Test
@@ -218,14 +224,8 @@ public class InfraActiveRequestsRepositoryImplTest {
assertFalse(actualRequests.isEmpty());
assertEquals(3, actualRequests.size());
- final Map<String, InfraActiveRequests> result = new HashMap<>();
- for (final InfraActiveRequests actualActiveRequests : actualRequests) {
- result.put(actualActiveRequests.getRequestId(), actualActiveRequests);
-
- }
- final InfraActiveRequests actualInfraActiveRequests = result.get("9383dc81-7a6c-4673-8082-650d50a82a1a");
- assertNull(actualInfraActiveRequests.getEndTime());
- assertEquals("IN_PROGRESS", actualInfraActiveRequests.getRequestStatus());
+ assertEquals("ShouldReturnInSearchQuery_1,ShouldReturnInSearchQuery_2,ShouldReturnInSearchQuery_3",
+ actualRequests.stream().map(item -> item.getServiceInstanceName()).collect(Collectors.joining(",")));
}
}
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 3358d770e2..4ff7025dee 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
@@ -112,7 +112,7 @@ INSERT INTO PUBLIC.INFRA_ACTIVE_REQUESTS(REQUEST_ID, CLIENT_REQUEST_ID, ACTION,
('a1abeab2-f8ef-43ab-b76c-9c3c2cb9980f', null, 'activateInstance', 'FAILED', '2019-01-01 13:00:00', '2019-01-01 14:00:00', 'f7712652-b516-4925-a243-64550d26fd84', 'ShouldReturnInSearchQuery_3'),
('81b8e152-ee89-49f4-b82b-08b0dcae27cd', null, 'createInstance', 'COMPLETE', '2019-01-01 14:10:00', '2019-01-01 15:00:00', 'f7712652-b516-4925-a243-64550d26fd84', 'SHOULD_NOT_RETURN_1'),
('0c28cad2-ff79-4dfa-a04a-9e44996fd7f7', null, 'createInstance', 'IN_PROGRESS', '2019-01-01 13:30:00', '2019-01-01 15:00:00', 'f7712652-b516-4925-a243-64550d26fd84', 'SHOULD_NOT_RETURN_2'),
-('d0d995a7-549b-4e7e-9101-2bab17ec24ea', null, 'createInstance', 'IN_PROGRESS', '2019-01-01 14:15:00', null, 'f7712652-b516-4925-a243-64550d26fd84', 'SHOULD_NOT_RETURN_3');
+('d0d995a7-549b-4e7e-9101-2bab17ec24ea', null, 'createInstance', 'IN_PROGRESS', '2019-01-01 11:15:00', null, 'f7712652-b516-4925-a243-64550d26fd84', 'SHOULD_NOT_RETURN_3');
CREATE CACHED TABLE PUBLIC.ARCHIVED_INFRA_REQUESTS(
REQUEST_ID VARCHAR NOT NULL SELECTIVITY 100,
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/WatchdogDistributionStatus.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/WatchdogDistributionStatus.java
index 69d84b7679..c8ad5f1843 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/WatchdogDistributionStatus.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/WatchdogDistributionStatus.java
@@ -56,7 +56,6 @@ public class WatchdogDistributionStatus implements Serializable {
@Column(name = "MODIFY_TIME")
@Temporal(TemporalType.TIMESTAMP)
private Date modifyTime;
- @Version
@Column(name = "LOCK_VERSION")
private int version;
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 b809691b31..5958397851 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
@@ -96,7 +96,7 @@ public class RequestsDbClient {
private String findOneByServiceIdAndOperationIdURI = "/findOneByServiceIdAndOperationId";
- private String findOneByOperationalEnvIdAndServiceModelVersionIdURI = "/findOneByOperationalEnvIdAndServiceModelVersionId";
+ private String findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestIdURI = "/findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestId";
private String findAllByOperationalEnvIdAndRequestIdURI = "/findAllByOperationalEnvIdAndRequestId";
@@ -123,7 +123,7 @@ public class RequestsDbClient {
findOneByServiceIdAndOperationIdURI = endpoint + OPERATION_STATUS_SEARCH + findOneByServiceIdAndOperationIdURI;
requestProcessingDataURI = endpoint + requestProcessingDataURI;
operationalEnvDistributionStatusURI = endpoint + operationalEnvDistributionStatusURI;
- findOneByOperationalEnvIdAndServiceModelVersionIdURI = endpoint + OPERATIONAL_ENV_SERVICE_MODEL_STATUS_SEARCH + findOneByOperationalEnvIdAndServiceModelVersionIdURI;
+ findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestIdURI = endpoint + OPERATIONAL_ENV_SERVICE_MODEL_STATUS_SEARCH + findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestIdURI;
findAllByOperationalEnvIdAndRequestIdURI = endpoint + OPERATIONAL_ENV_SERVICE_MODEL_STATUS_SEARCH + findAllByOperationalEnvIdAndRequestIdURI;
}
@@ -227,16 +227,18 @@ public class RequestsDbClient {
}
}
- public OperationalEnvServiceModelStatus findOneByOperationalEnvIdAndServiceModelVersionId(String operationalEnvironmentId, String serviceModelVersionId) {
+ public OperationalEnvServiceModelStatus findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestId(String operationalEnvironmentId, String serviceModelVersionId, String requestId) {
try {
HttpEntity<?> entity = getHttpEntity();
- OperationalEnvServiceModelStatus modelStatus = restTemplate.exchange(getUri(UriBuilder.fromUri(findOneByOperationalEnvIdAndServiceModelVersionIdURI)
+ OperationalEnvServiceModelStatus modelStatus = restTemplate.exchange(getUri(UriBuilder.fromUri(findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestIdURI)
.queryParam(OPERATIONAL_ENVIRONMENT_ID, operationalEnvironmentId)
.queryParam(SERVICE_MODEL_VERSION_ID, serviceModelVersionId)
+ .queryParam(REQUEST_ID, requestId)
.build().toString()), HttpMethod.GET, entity, OperationalEnvServiceModelStatus.class).getBody();
if (null != modelStatus) {
modelStatus.setOperationalEnvId(operationalEnvironmentId);
modelStatus.setServiceModelVersionId(serviceModelVersionId);
+ modelStatus.setRequestId(requestId);
}
return modelStatus;
}catch(HttpClientErrorException e){
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/OrchestrationAction.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/OrchestrationAction.java
index d831d1ebd2..1fd254f254 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/OrchestrationAction.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/OrchestrationAction.java
@@ -30,6 +30,8 @@ public enum OrchestrationAction {
CREATE("Create"),
DELETE("Delete"),
UPDATE("Update"),
+ ADD_MEMBERS("AddMembers"),
+ REMOVE_MEMBERS("RemoveMembers"),
CUSTOM("Custom");
private final String name;
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/PnfResource.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/PnfResource.java
new file mode 100644
index 0000000000..5e9a07443f
--- /dev/null
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/PnfResource.java
@@ -0,0 +1,215 @@
+/*
+ * ============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.so.db.catalog.beans;
+
+import com.openpojo.business.annotation.BusinessKey;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.Id;
+import javax.persistence.OneToMany;
+import javax.persistence.PrePersist;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import uk.co.blackpepper.bowman.annotation.LinkedResource;
+
+@Entity
+@Table(name = "pnf_resource")
+public class PnfResource implements Serializable {
+
+ private static final long serialVersionUID = 7680261093213053483L;
+
+ @BusinessKey
+ @Id
+ @Column(name = "MODEL_UUID")
+ private String modelUUID;
+
+ @Column(name = "MODEL_INVARIANT_UUID")
+ private String modelInvariantUUID;
+
+ @Column(name = "MODEL_NAME")
+ private String modelName;
+
+ @Column(name = "MODEL_VERSION")
+ private String modelVersion;
+
+ @Column(name = "TOSCA_NODE_TYPE")
+ private String toscaNodeType;
+
+ @Column(name = "DESCRIPTION")
+ private String description;
+
+ @Column(name = "ORCHESTRATION_MODE")
+ private String orchestrationMode;
+
+ @Column(name = "RESOURCE_CATEGORY")
+ private String category;
+
+ @Column(name = "RESOURCE_SUB_CATEGORY")
+ private String subCategory;
+
+ @Column(name = "CREATION_TIMESTAMP", updatable = false)
+ @Temporal(TemporalType.TIMESTAMP)
+ private Date created;
+
+ @OneToMany(fetch = FetchType.LAZY, mappedBy = "pnfResources")
+ private List<PnfResourceCustomization> pnfResourceCustomizations;
+
+ @PrePersist
+ protected void onCreate() {
+ this.created = new Date();
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("modelUUID", modelUUID).append("modelInvariantUUID", modelInvariantUUID)
+ .append("modelName", modelName).append("modelVersion", modelVersion)
+ .append("toscaNodeType", toscaNodeType).append("description", description)
+ .append("orchestrationMode", orchestrationMode).append("created", created)
+ .append("pnfResourceCustomizations", pnfResourceCustomizations)
+ .toString();
+ }
+
+ @Override
+ public boolean equals(final Object other) {
+ if (!(other instanceof PnfResource)) {
+ return false;
+ }
+ PnfResource castOther = (PnfResource) other;
+ return new EqualsBuilder().append(modelUUID, castOther.modelUUID).isEquals();
+ }
+
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder().append(modelUUID).toHashCode();
+ }
+
+ public String getOrchestrationMode() {
+ return orchestrationMode;
+ }
+
+ public void setOrchestrationMode(String orchestrationMode) {
+ this.orchestrationMode = orchestrationMode;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public Date getCreated() {
+ return created;
+ }
+
+ /**
+ * @return Returns the category.
+ */
+ public String getCategory() {
+ return category;
+ }
+
+ /**
+ * @param category The category to set.
+ */
+ public void setCategory(String category) {
+ this.category = category;
+ }
+
+ /**
+ * @return Returns the subCategory.
+ */
+ public String getSubCategory() {
+ return subCategory;
+ }
+
+ /**
+ * @param subCategory The subCategory to set.
+ */
+ public void setSubCategory(String subCategory) {
+ this.subCategory = subCategory;
+ }
+
+ public String getModelInvariantUUID() {
+ return this.modelInvariantUUID;
+ }
+
+ public void setModelInvariantUUID(String modelInvariantUUID) {
+ this.modelInvariantUUID = modelInvariantUUID;
+ }
+
+ public String getModelName() {
+ return modelName;
+ }
+
+ public void setModelName(String modelName) {
+ this.modelName = modelName;
+ }
+
+ public String getModelUUID() {
+ return modelUUID;
+ }
+
+ public void setModelUUID(String modelUUID) {
+ this.modelUUID = modelUUID;
+ }
+
+ public String getModelInvariantId() {
+ return this.modelInvariantUUID;
+ }
+
+ public String getToscaNodeType() {
+ return toscaNodeType;
+ }
+
+ public void setToscaNodeType(String toscaNodeType) {
+ this.toscaNodeType = toscaNodeType;
+ }
+
+ @LinkedResource
+ public List<PnfResourceCustomization> getPnfResourceCustomizations() {
+ if (pnfResourceCustomizations == null) {
+ pnfResourceCustomizations = new ArrayList<>();
+ }
+ return pnfResourceCustomizations;
+ }
+
+ public void setPnfResourceCustomizations(List<PnfResourceCustomization> pnfResourceCustomizations) {
+ this.pnfResourceCustomizations = pnfResourceCustomizations;
+ }
+
+ public String getModelVersion() {
+ return modelVersion;
+ }
+
+ public void setModelVersion(String modelVersion) {
+ this.modelVersion = modelVersion;
+ }
+}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/PnfResourceCustomization.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/PnfResourceCustomization.java
new file mode 100644
index 0000000000..b2d40b8409
--- /dev/null
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/PnfResourceCustomization.java
@@ -0,0 +1,220 @@
+/*
+ * ============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.so.db.catalog.beans;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.openpojo.business.annotation.BusinessKey;
+import java.io.Serializable;
+import java.util.Date;
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.PrePersist;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import uk.co.blackpepper.bowman.annotation.LinkedResource;
+
+@Entity
+@Table(name = "pnf_resource_customization")
+public class PnfResourceCustomization implements Serializable {
+
+ private static final long serialVersionUID = 768026109321305415L;
+
+ @BusinessKey
+ @Id
+ @Column(name = "MODEL_CUSTOMIZATION_UUID")
+ private String modelCustomizationUUID;
+
+ @Column(name = "MODEL_INSTANCE_NAME")
+ private String modelInstanceName;
+
+ @Column(name = "CREATION_TIMESTAMP", updatable = false)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS")
+ @Temporal(TemporalType.TIMESTAMP)
+ private Date created;
+
+ @Column(name = "NF_FUNCTION")
+ private String nfFunction;
+
+ @Column(name = "NF_TYPE")
+ private String nfType;
+
+ @Column(name = "NF_ROLE")
+ private String nfRole;
+
+ @Column(name = "NF_NAMING_CODE")
+ private String nfNamingCode;
+
+ @Column(name = "MULTI_STAGE_DESIGN")
+ private String multiStageDesign;
+
+ @Column(name = "RESOURCE_INPUT")
+ private String resourceInput;
+
+ @ManyToOne(cascade = CascadeType.ALL)
+ @JoinColumn(name = "PNF_RESOURCE_MODEL_UUID")
+ private PnfResource pnfResources;
+
+ @Column(name = "CDS_BLUEPRINT_NAME")
+ private String blueprintName;
+
+ @Column(name = "CDS_BLUEPRINT_VERSION")
+ private String blueprintVersion;
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("modelCustomizationUUID", modelCustomizationUUID)
+ .append("modelInstanceName", modelInstanceName).append("created", created)
+ .append("nfFunction", nfFunction)
+ .append("nfType", nfType).append("nfRole", nfRole).append("nfNamingCode", nfNamingCode)
+ .append("multiStageDesign", multiStageDesign).append("pnfResources", pnfResources)
+ .append("blueprintName", blueprintName).append("blueprintVersion", blueprintVersion)
+ .toString();
+ }
+
+ @Override
+ public boolean equals(final Object other) {
+ if (!(other instanceof PnfResourceCustomization)) {
+ return false;
+ }
+ PnfResourceCustomization castOther = (PnfResourceCustomization) other;
+ return new EqualsBuilder().append(modelCustomizationUUID, castOther.modelCustomizationUUID).isEquals();
+ }
+
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder().append(modelCustomizationUUID).toHashCode();
+ }
+
+ @PrePersist
+ protected void onCreate() {
+ this.created = new Date();
+ }
+
+ public Date getCreationTimestamp() {
+ return this.created;
+ }
+
+ public void setCreated(Date created) {
+ this.created = created;
+ }
+
+ public String getModelCustomizationUUID() {
+ return modelCustomizationUUID;
+ }
+
+ public void setModelCustomizationUUID(String modelCustomizationUUID) {
+ this.modelCustomizationUUID = modelCustomizationUUID;
+ }
+
+ public String getModelInstanceName() {
+ return this.modelInstanceName;
+ }
+
+ public void setModelInstanceName(String modelInstanceName) {
+ this.modelInstanceName = modelInstanceName;
+ }
+
+ public String getNfFunction() {
+ return nfFunction;
+ }
+
+ public void setNfFunction(String nfFunction) {
+ this.nfFunction = nfFunction;
+ }
+
+ public String getNfType() {
+ return nfType;
+ }
+
+ public void setNfType(String nfType) {
+ this.nfType = nfType;
+ }
+
+ public String getNfRole() {
+ return nfRole;
+ }
+
+ public void setNfRole(String nfRole) {
+ this.nfRole = nfRole;
+ }
+
+ public String getNfNamingCode() {
+ return nfNamingCode;
+ }
+
+ public void setNfNamingCode(String nfNamingCode) {
+ this.nfNamingCode = nfNamingCode;
+ }
+
+ public String getMultiStageDesign() {
+ return this.multiStageDesign;
+ }
+
+ public void setMultiStageDesign(String multiStageDesign) {
+ this.multiStageDesign = multiStageDesign;
+ }
+
+ @LinkedResource
+ public PnfResource getPnfResources() {
+ return pnfResources;
+ }
+
+ public void setPnfResources(PnfResource pnfResources) {
+ this.pnfResources = pnfResources;
+ }
+
+ public Date getCreated() {
+ return created;
+ }
+
+ public String getResourceInput() {
+ return resourceInput;
+ }
+
+ public void setResourceInput(String resourceInput) {
+ this.resourceInput = resourceInput;
+ }
+
+
+ public String getBlueprintName() {
+ return blueprintName;
+ }
+
+ public void setBlueprintName(String blueprintName) {
+ this.blueprintName = blueprintName;
+ }
+
+ public String getBlueprintVersion() {
+ return blueprintVersion;
+ }
+
+ public void setBlueprintVersion(String blueprintVersion) {
+ this.blueprintVersion = blueprintVersion;
+ }
+
+}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ResourceType.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ResourceType.java
index 64eff56f97..6d5c0fd9a8 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ResourceType.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ResourceType.java
@@ -28,6 +28,7 @@ public enum ResourceType {
NETWORK("Network"),
NETWORK_COLLECTION("NetworkCollection"),
CONFIGURATION("Configuration"),
+ INSTANCE_GROUP("InstanceGroup"),
NO_VALIDATE("NoValidate");
private final String name;
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/Service.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/Service.java
index 28ff778d44..428736eddc 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/Service.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/Service.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.
@@ -53,294 +53,315 @@ import uk.co.blackpepper.bowman.annotation.LinkedResource;
@Table(name = "service")
public class Service implements Serializable {
- private static final long serialVersionUID = 768026109321305392L;
-
- @Column(name = "MODEL_NAME")
- private String modelName;
-
- @Column(name = "DESCRIPTION", length = 1200)
- private String description;
-
- @BusinessKey
- @Id
- @Column(name = "MODEL_UUID")
- private String modelUUID;
-
- @Column(name = "MODEL_INVARIANT_UUID")
- private String modelInvariantUUID;
-
- @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS")
- @Column(name = "CREATION_TIMESTAMP", updatable = false)
- @Temporal(TemporalType.TIMESTAMP)
- private Date created;
-
- @Column(name = "MODEL_VERSION")
- private String modelVersion;
-
- @Column(name = "SERVICE_TYPE")
- private String serviceType;
-
- @Column(name = "SERVICE_ROLE")
- private String serviceRole;
-
- @Column(name = "ENVIRONMENT_CONTEXT")
- private String environmentContext;
-
- @Column(name = "WORKLOAD_CONTEXT")
- private String workloadContext;
-
- @Column(name = "SERVICE_CATEGORY")
- private String category;
-
- @Column(name = "RESOURCE_ORDER")
- private String resourceOrder;
-
- @OneToMany(cascade = CascadeType.ALL)
- @JoinTable(name = "network_resource_customization_to_service", joinColumns = @JoinColumn(name = "SERVICE_MODEL_UUID"), inverseJoinColumns = @JoinColumn(name = "RESOURCE_MODEL_CUSTOMIZATION_UUID"))
- private List<NetworkResourceCustomization> networkCustomizations;
-
- @OneToMany(cascade = CascadeType.ALL)
- @JoinTable(name = "vnf_resource_customization_to_service", joinColumns = @JoinColumn(name = "SERVICE_MODEL_UUID"), inverseJoinColumns = @JoinColumn(name = "RESOURCE_MODEL_CUSTOMIZATION_UUID"))
- private List<VnfResourceCustomization> vnfCustomizations;
-
- @OneToMany(cascade = CascadeType.ALL)
- @JoinTable(name = "allotted_resource_customization_to_service", joinColumns = @JoinColumn(name = "SERVICE_MODEL_UUID"), inverseJoinColumns = @JoinColumn(name = "RESOURCE_MODEL_CUSTOMIZATION_UUID"))
- private List<AllottedResourceCustomization> allottedCustomizations;
-
- @OneToMany(cascade = CascadeType.ALL)
- @JoinTable(name = "collection_resource_customization_to_service", joinColumns = @JoinColumn(name = "SERVICE_MODEL_UUID"), inverseJoinColumns = @JoinColumn(name = "RESOURCE_MODEL_CUSTOMIZATION_UUID"))
- private List<CollectionResourceCustomization> collectionResourceCustomizations;
-
- @OneToMany(cascade = CascadeType.ALL)
- @JoinTable(name = "service_proxy_customization_to_service", joinColumns = @JoinColumn(name = "SERVICE_MODEL_UUID"), inverseJoinColumns = @JoinColumn(name = "RESOURCE_MODEL_CUSTOMIZATION_UUID"))
- private List<ServiceProxyResourceCustomization> serviceProxyCustomizations;
-
- @OneToMany(cascade = CascadeType.ALL)
- @JoinTable(name = "configuration_customization_to_service", joinColumns = @JoinColumn(name = "SERVICE_MODEL_UUID"), inverseJoinColumns = @JoinColumn(name = "RESOURCE_MODEL_CUSTOMIZATION_UUID"))
- private List<ConfigurationResourceCustomization> configurationCustomizations;
-
- @OneToMany(cascade = CascadeType.ALL)
- @MapKey(name = "action")
- @JoinColumn(name = "SERVICE_MODEL_UUID")
- private Map<String, ServiceRecipe> recipes;
-
- @ManyToOne(cascade = CascadeType.ALL)
- @JoinColumn(name = "TOSCA_CSAR_ARTIFACT_UUID")
- private ToscaCsar csar;
-
- @Override
- public String toString() {
- return new ToStringBuilder(this).append("modelName", modelName).append("description", description)
- .append("modelUUID", modelUUID).append("modelInvariantUUID", modelInvariantUUID)
- .append("created", created).append("modelVersion", modelVersion).append("serviceType", serviceType)
- .append("serviceRole", serviceRole).append("environmentContext", environmentContext)
- .append("workloadContext", workloadContext).append("category", category)
- .append("networkCustomizations", networkCustomizations).append("vnfCustomizations", vnfCustomizations)
- .append("allottedCustomizations", allottedCustomizations)
- .append("collectionResourceCustomizations", collectionResourceCustomizations)
- .append("serviceProxyCustomizations", serviceProxyCustomizations)
- .append("configurationCustomizations", configurationCustomizations).append("recipes", recipes)
- .append("csar", csar).toString();
- }
-
- @PrePersist
- protected void onCreate() {
- this.created = new Date();
- }
-
- @Override
- public boolean equals(final Object other) {
- if (!(other instanceof Service)) {
- return false;
- }
- Service castOther = (Service) other;
- return new EqualsBuilder().append(modelUUID, castOther.modelUUID).isEquals();
- }
-
- @Override
- public int hashCode() {
- return new HashCodeBuilder().append(modelUUID).toHashCode();
- }
-
- @LinkedResource
- public List<ServiceProxyResourceCustomization> getServiceProxyCustomizations() {
- return serviceProxyCustomizations;
- }
-
- public void setServiceProxyCustomizations(List<ServiceProxyResourceCustomization> serviceProxyCustomizations) {
- this.serviceProxyCustomizations = serviceProxyCustomizations;
- }
-
- @LinkedResource
- public List<NetworkResourceCustomization> getNetworkCustomizations() {
- if (networkCustomizations == null)
- networkCustomizations = new ArrayList<>();
- return networkCustomizations;
- }
-
- public void setNetworkCustomizations(List<NetworkResourceCustomization> networkCustomizations) {
- this.networkCustomizations = networkCustomizations;
- }
-
- @LinkedResource
- public List<VnfResourceCustomization> getVnfCustomizations() {
- if (vnfCustomizations == null)
- vnfCustomizations = new ArrayList<>();
- return vnfCustomizations;
- }
-
- public void setVnfCustomizations(List<VnfResourceCustomization> vnfCustomizations) {
- this.vnfCustomizations = vnfCustomizations;
- }
-
- @LinkedResource
- public List<AllottedResourceCustomization> getAllottedCustomizations() {
- if (allottedCustomizations == null)
- allottedCustomizations = new ArrayList<>();
- return allottedCustomizations;
- }
-
- public void setAllottedCustomizations(List<AllottedResourceCustomization> allotedCustomizations) {
- this.allottedCustomizations = allotedCustomizations;
- }
-
- @LinkedResource
- public List<CollectionResourceCustomization> getCollectionResourceCustomizations() {
- if (collectionResourceCustomizations == null)
- collectionResourceCustomizations = new ArrayList<>();
- return collectionResourceCustomizations;
- }
-
- public void setCollectionResourceCustomizations(
- List<CollectionResourceCustomization> collectionResourceCustomizations) {
- this.collectionResourceCustomizations = collectionResourceCustomizations;
- }
-
- @LinkedResource
- public List<ConfigurationResourceCustomization> getConfigurationCustomizations() {
- if(configurationCustomizations == null)
- configurationCustomizations = new ArrayList<>();
- return configurationCustomizations;
- }
-
- public void setConfigurationCustomizations(List<ConfigurationResourceCustomization> configurationCustomizations) {
- this.configurationCustomizations = configurationCustomizations;
- }
-
- public String getModelName() {
- return modelName;
- }
-
- public void setModelName(String modelName) {
- this.modelName = modelName;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- @LinkedResource
- public Map<String, ServiceRecipe> getRecipes() {
- return recipes;
- }
-
- public void setRecipes(Map<String, ServiceRecipe> recipes) {
- this.recipes = recipes;
- }
-
- public Date getCreated() {
- return created;
- }
-
- public String getModelUUID() {
- return modelUUID;
- }
-
- public void setModelUUID(String modelUUID) {
- this.modelUUID = modelUUID;
- }
-
- public String getModelInvariantUUID() {
- return modelInvariantUUID;
- }
-
- public void setModelInvariantUUID(String modelInvariantUUID) {
- this.modelInvariantUUID = modelInvariantUUID;
- }
-
- public String getModelVersion() {
- return modelVersion;
- }
-
- public void setModelVersion(String modelVersion) {
- this.modelVersion = modelVersion;
- }
-
- /**
- * @return Returns the category.
- */
- public String getCategory() {
- return category;
- }
-
- /**
- * @param category
- * The category to set.
- */
- public void setCategory(String category) {
- this.category = category;
- }
-
- public String getServiceType() {
- return serviceType;
- }
-
- public void setServiceType(String serviceType) {
- this.serviceType = serviceType;
- }
-
- public String getServiceRole() {
- return serviceRole;
- }
-
- public void setServiceRole(String serviceRole) {
- this.serviceRole = serviceRole;
- }
-
- public String getEnvironmentContext() {
- return this.environmentContext;
- }
-
- public void setEnvironmentContext(String environmentContext) {
- this.environmentContext = environmentContext;
- }
-
- @LinkedResource
- public ToscaCsar getCsar() {
- return csar;
- }
-
- public void setCsar(ToscaCsar csar) {
- this.csar = csar;
- }
-
- public String getWorkloadContext() {
- return this.workloadContext;
- }
-
- public void setWorkloadContext(String workloadContext) {
- this.workloadContext = workloadContext;
- }
-
- public String getResourceOrder() {
- return resourceOrder;
- }
-
- public void setResourceOrder(String resourceOrder) {
- this.resourceOrder = resourceOrder;
- }
+ private static final long serialVersionUID = 768026109321305392L;
+
+ @Column(name = "MODEL_NAME")
+ private String modelName;
+
+ @Column(name = "DESCRIPTION", length = 1200)
+ private String description;
+
+ @BusinessKey
+ @Id
+ @Column(name = "MODEL_UUID")
+ private String modelUUID;
+
+ @Column(name = "MODEL_INVARIANT_UUID")
+ private String modelInvariantUUID;
+
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS")
+ @Column(name = "CREATION_TIMESTAMP", updatable = false)
+ @Temporal(TemporalType.TIMESTAMP)
+ private Date created;
+
+ @Column(name = "MODEL_VERSION")
+ private String modelVersion;
+
+ @Column(name = "SERVICE_TYPE")
+ private String serviceType;
+
+ @Column(name = "SERVICE_ROLE")
+ private String serviceRole;
+
+ @Column(name = "ENVIRONMENT_CONTEXT")
+ private String environmentContext;
+
+ @Column(name = "WORKLOAD_CONTEXT")
+ private String workloadContext;
+
+ @Column(name = "SERVICE_CATEGORY")
+ private String category;
+
+ @Column(name = "RESOURCE_ORDER")
+ private String resourceOrder;
+
+ @OneToMany(cascade = CascadeType.ALL)
+ @JoinTable(name = "network_resource_customization_to_service", joinColumns = @JoinColumn(name = "SERVICE_MODEL_UUID"), inverseJoinColumns = @JoinColumn(name = "RESOURCE_MODEL_CUSTOMIZATION_UUID"))
+ private List<NetworkResourceCustomization> networkCustomizations;
+
+ @OneToMany(cascade = CascadeType.ALL)
+ @JoinTable(name = "vnf_resource_customization_to_service", joinColumns = @JoinColumn(name = "SERVICE_MODEL_UUID"), inverseJoinColumns = @JoinColumn(name = "RESOURCE_MODEL_CUSTOMIZATION_UUID"))
+ private List<VnfResourceCustomization> vnfCustomizations;
+
+ @OneToMany(cascade = CascadeType.ALL)
+ @JoinTable(name = "allotted_resource_customization_to_service", joinColumns = @JoinColumn(name = "SERVICE_MODEL_UUID"), inverseJoinColumns = @JoinColumn(name = "RESOURCE_MODEL_CUSTOMIZATION_UUID"))
+ private List<AllottedResourceCustomization> allottedCustomizations;
+
+ @OneToMany(cascade = CascadeType.ALL)
+ @JoinTable(name = "collection_resource_customization_to_service", joinColumns = @JoinColumn(name = "SERVICE_MODEL_UUID"), inverseJoinColumns = @JoinColumn(name = "RESOURCE_MODEL_CUSTOMIZATION_UUID"))
+ private List<CollectionResourceCustomization> collectionResourceCustomizations;
+
+ @OneToMany(cascade = CascadeType.ALL)
+ @JoinTable(name = "service_proxy_customization_to_service", joinColumns = @JoinColumn(name = "SERVICE_MODEL_UUID"), inverseJoinColumns = @JoinColumn(name = "RESOURCE_MODEL_CUSTOMIZATION_UUID"))
+ private List<ServiceProxyResourceCustomization> serviceProxyCustomizations;
+
+ @OneToMany(cascade = CascadeType.ALL)
+ @JoinTable(name = "configuration_customization_to_service", joinColumns = @JoinColumn(name = "SERVICE_MODEL_UUID"), inverseJoinColumns = @JoinColumn(name = "RESOURCE_MODEL_CUSTOMIZATION_UUID"))
+ private List<ConfigurationResourceCustomization> configurationCustomizations;
+
+ @OneToMany(cascade = CascadeType.ALL)
+ @JoinTable(name = "pnf_resource_customization_to_service", joinColumns = @JoinColumn(name = "SERVICE_MODEL_UUID"), inverseJoinColumns = @JoinColumn(name = "RESOURCE_MODEL_CUSTOMIZATION_UUID"))
+ private List<PnfResourceCustomization> pnfCustomizations;
+
+ @OneToMany(cascade = CascadeType.ALL, mappedBy = "service")
+ @MapKey(name = "action")
+ private Map<String, ServiceRecipe> recipes;
+
+ @ManyToOne(cascade = CascadeType.ALL)
+ @JoinColumn(name = "TOSCA_CSAR_ARTIFACT_UUID")
+ private ToscaCsar csar;
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("modelName", modelName).append("description", description)
+ .append("modelUUID", modelUUID).append("modelInvariantUUID", modelInvariantUUID)
+ .append("created", created).append("modelVersion", modelVersion).append("serviceType", serviceType)
+ .append("serviceRole", serviceRole).append("environmentContext", environmentContext)
+ .append("workloadContext", workloadContext).append("category", category)
+ .append("networkCustomizations", networkCustomizations).append("vnfCustomizations", vnfCustomizations)
+ .append("allottedCustomizations", allottedCustomizations)
+ .append("collectionResourceCustomizations", collectionResourceCustomizations)
+ .append("serviceProxyCustomizations", serviceProxyCustomizations)
+ .append("configurationCustomizations", configurationCustomizations)
+ .append("pnfCustomizations", pnfCustomizations)
+ .append("recipes", recipes)
+ .append("csar", csar).toString();
+ }
+
+ @PrePersist
+ protected void onCreate() {
+ this.created = new Date();
+ }
+
+ @Override
+ public boolean equals(final Object other) {
+ if (!(other instanceof Service)) {
+ return false;
+ }
+ Service castOther = (Service) other;
+ return new EqualsBuilder().append(modelUUID, castOther.modelUUID).isEquals();
+ }
+
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder().append(modelUUID).toHashCode();
+ }
+
+ @LinkedResource
+ public List<ServiceProxyResourceCustomization> getServiceProxyCustomizations() {
+ return serviceProxyCustomizations;
+ }
+
+ public void setServiceProxyCustomizations(List<ServiceProxyResourceCustomization> serviceProxyCustomizations) {
+ this.serviceProxyCustomizations = serviceProxyCustomizations;
+ }
+
+ @LinkedResource
+ public List<NetworkResourceCustomization> getNetworkCustomizations() {
+ if (networkCustomizations == null) {
+ networkCustomizations = new ArrayList<>();
+ }
+ return networkCustomizations;
+ }
+
+ public void setNetworkCustomizations(List<NetworkResourceCustomization> networkCustomizations) {
+ this.networkCustomizations = networkCustomizations;
+ }
+
+ @LinkedResource
+ public List<VnfResourceCustomization> getVnfCustomizations() {
+ if (vnfCustomizations == null) {
+ vnfCustomizations = new ArrayList<>();
+ }
+ return vnfCustomizations;
+ }
+
+ public void setVnfCustomizations(List<VnfResourceCustomization> vnfCustomizations) {
+ this.vnfCustomizations = vnfCustomizations;
+ }
+
+ @LinkedResource
+ public List<AllottedResourceCustomization> getAllottedCustomizations() {
+ if (allottedCustomizations == null) {
+ allottedCustomizations = new ArrayList<>();
+ }
+ return allottedCustomizations;
+ }
+
+ public void setAllottedCustomizations(List<AllottedResourceCustomization> allotedCustomizations) {
+ this.allottedCustomizations = allotedCustomizations;
+ }
+
+ @LinkedResource
+ public List<CollectionResourceCustomization> getCollectionResourceCustomizations() {
+ if (collectionResourceCustomizations == null) {
+ collectionResourceCustomizations = new ArrayList<>();
+ }
+ return collectionResourceCustomizations;
+ }
+
+ public void setCollectionResourceCustomizations(
+ List<CollectionResourceCustomization> collectionResourceCustomizations) {
+ this.collectionResourceCustomizations = collectionResourceCustomizations;
+ }
+
+ @LinkedResource
+ public List<ConfigurationResourceCustomization> getConfigurationCustomizations() {
+ if (configurationCustomizations == null) {
+ configurationCustomizations = new ArrayList<>();
+ }
+ return configurationCustomizations;
+ }
+
+ public void setConfigurationCustomizations(List<ConfigurationResourceCustomization> configurationCustomizations) {
+ this.configurationCustomizations = configurationCustomizations;
+ }
+
+ @LinkedResource
+ public List<PnfResourceCustomization> getPnfCustomizations() {
+ if (pnfCustomizations == null) {
+ pnfCustomizations = new ArrayList<>();
+ }
+ return pnfCustomizations;
+ }
+
+ public void setPnfCustomizations(List<PnfResourceCustomization> pnfCustomizations) {
+ this.pnfCustomizations = pnfCustomizations;
+ }
+
+ public String getModelName() {
+ return modelName;
+ }
+
+ public void setModelName(String modelName) {
+ this.modelName = modelName;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ @LinkedResource
+ public Map<String, ServiceRecipe> getRecipes() {
+ return recipes;
+ }
+
+ public void setRecipes(Map<String, ServiceRecipe> recipes) {
+ this.recipes = recipes;
+ }
+
+ public Date getCreated() {
+ return created;
+ }
+
+ public String getModelUUID() {
+ return modelUUID;
+ }
+
+ public void setModelUUID(String modelUUID) {
+ this.modelUUID = modelUUID;
+ }
+
+ public String getModelInvariantUUID() {
+ return modelInvariantUUID;
+ }
+
+ public void setModelInvariantUUID(String modelInvariantUUID) {
+ this.modelInvariantUUID = modelInvariantUUID;
+ }
+
+ public String getModelVersion() {
+ return modelVersion;
+ }
+
+ public void setModelVersion(String modelVersion) {
+ this.modelVersion = modelVersion;
+ }
+
+ /**
+ * @return Returns the category.
+ */
+ public String getCategory() {
+ return category;
+ }
+
+ /**
+ * @param category The category to set.
+ */
+ public void setCategory(String category) {
+ this.category = category;
+ }
+
+ public String getServiceType() {
+ return serviceType;
+ }
+
+ public void setServiceType(String serviceType) {
+ this.serviceType = serviceType;
+ }
+
+ public String getServiceRole() {
+ return serviceRole;
+ }
+
+ public void setServiceRole(String serviceRole) {
+ this.serviceRole = serviceRole;
+ }
+
+ public String getEnvironmentContext() {
+ return this.environmentContext;
+ }
+
+ public void setEnvironmentContext(String environmentContext) {
+ this.environmentContext = environmentContext;
+ }
+
+ @LinkedResource
+ public ToscaCsar getCsar() {
+ return csar;
+ }
+
+ public void setCsar(ToscaCsar csar) {
+ this.csar = csar;
+ }
+
+ public String getWorkloadContext() {
+ return this.workloadContext;
+ }
+
+ public void setWorkloadContext(String workloadContext) {
+ this.workloadContext = workloadContext;
+ }
+
+ public String getResourceOrder() {
+ return resourceOrder;
+ }
+
+ public void setResourceOrder(String resourceOrder) {
+ this.resourceOrder = resourceOrder;
+ }
}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ServiceRecipe.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ServiceRecipe.java
index d063ea4809..79b27e7deb 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ServiceRecipe.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ServiceRecipe.java
@@ -23,9 +23,13 @@ package org.onap.so.db.catalog.beans;
import java.io.Serializable;
import java.util.Date;
+import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
+import javax.persistence.FetchType;
import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
import javax.persistence.PrePersist;
import javax.persistence.Table;
import javax.persistence.Temporal;
@@ -74,6 +78,11 @@ public class ServiceRecipe implements Serializable, Recipe {
@Column(name = "CREATION_TIMESTAMP", updatable = false)
@Temporal(TemporalType.TIMESTAMP)
private Date created;
+
+ @BusinessKey
+ @ManyToOne(cascade = CascadeType.ALL)
+ @JoinColumn(name = "SERVICE_MODEL_UUID", referencedColumnName = "MODEL_UUID",insertable = false, updatable = false)
+ private Service service;
@PrePersist
protected void onCreate() {
@@ -177,6 +186,14 @@ public class ServiceRecipe implements Serializable, Recipe {
public void setServiceTimeoutInterim(Integer serviceTimeoutInterim) {
this.serviceTimeoutInterim = serviceTimeoutInterim;
}
+
+ public Service getService() {
+ return service;
+ }
+
+ public void setService(Service service) {
+ this.service = service;
+ }
public Date getCreated() {
return created;
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResourceCustomization.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResourceCustomization.java
index 53e8c9613e..c75199ed41 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResourceCustomization.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResourceCustomization.java
@@ -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.
@@ -54,244 +54,270 @@ import uk.co.blackpepper.bowman.annotation.LinkedResource;
@Table(name = "vnf_resource_customization")
public class VnfResourceCustomization implements Serializable {
- private static final long serialVersionUID = 768026109321305392L;
-
- @BusinessKey
- @Id
- @Column(name = "MODEL_CUSTOMIZATION_UUID")
- private String modelCustomizationUUID;
-
- @Column(name = "MODEL_INSTANCE_NAME")
- private String modelInstanceName;
-
- @Column(name = "CREATION_TIMESTAMP", updatable = false)
- @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS")
- @Temporal(TemporalType.TIMESTAMP)
- private Date created;
-
- public void setCreated(Date created) {
- this.created = created;
- }
-
- @Column(name = "MIN_INSTANCES")
- private Integer minInstances;
-
- @Column(name = "MAX_INSTANCES")
- private Integer maxInstances;
-
- @Column(name = "AVAILABILITY_ZONE_MAX_COUNT")
- private Integer availabilityZoneMaxCount;
-
- @Column(name = "NF_FUNCTION")
- private String nfFunction;
-
- @Column(name = "NF_TYPE")
- private String nfType;
-
- @Column(name = "NF_ROLE")
- private String nfRole;
-
- @Column(name = "NF_NAMING_CODE")
- private String nfNamingCode;
-
- @Column(name = "MULTI_STAGE_DESIGN")
- private String multiStageDesign;
-
- @Column(name = "RESOURCE_INPUT")
- private String resourceInput;
-
- @ManyToOne(cascade = CascadeType.ALL)
- @JoinColumn(name = "VNF_RESOURCE_MODEL_UUID")
- private VnfResource vnfResources;
-
- @OneToMany(cascade = CascadeType.ALL)
- @JoinTable(name = "vnf_res_custom_to_vf_module_custom", joinColumns = @JoinColumn(name = "VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID", referencedColumnName = "MODEL_CUSTOMIZATION_UUID"), inverseJoinColumns = @JoinColumn(name = "VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID", referencedColumnName = "MODEL_CUSTOMIZATION_UUID"))
- private List<VfModuleCustomization> vfModuleCustomizations;
-
- @OneToMany(fetch = FetchType.LAZY, mappedBy = "vnfResourceCust")
- private List<VnfcInstanceGroupCustomization> vnfcInstanceGroupCustomizations;
-
- @OneToMany(cascade = CascadeType.ALL, mappedBy = "modelCustomizationUUID")
- private Set<VnfVfmoduleCvnfcConfigurationCustomization> vnfVfmoduleCvnfcConfigurationCustomization;
-
- @OneToMany(cascade = CascadeType.ALL, mappedBy = "modelCustomizationUUID")
- private List<CvnfcCustomization> cvnfcCustomization;
-
- @Override
- public String toString() {
- return new ToStringBuilder(this).append("modelCustomizationUUID", modelCustomizationUUID)
- .append("modelInstanceName", modelInstanceName).append("created", created)
- .append("minInstances", minInstances).append("maxInstances", maxInstances)
- .append("availabilityZoneMaxCount", availabilityZoneMaxCount).append("nfFunction", nfFunction)
- .append("nfType", nfType).append("nfRole", nfRole).append("nfNamingCode", nfNamingCode)
- .append("multiStageDesign", multiStageDesign).append("vnfResources", vnfResources)
- .append("vfModuleCustomizations", vfModuleCustomizations)
- .append("vnfcInstanceGroupCustomizations", vnfcInstanceGroupCustomizations).toString();
- }
-
- @Override
- public boolean equals(final Object other) {
- if (!(other instanceof VnfResourceCustomization)) {
- return false;
- }
- VnfResourceCustomization castOther = (VnfResourceCustomization) other;
- return new EqualsBuilder().append(modelCustomizationUUID, castOther.modelCustomizationUUID).isEquals();
- }
-
- @Override
- public int hashCode() {
- return new HashCodeBuilder().append(modelCustomizationUUID).toHashCode();
- }
-
- @PrePersist
- protected void onCreate() {
- this.created = new Date();
- }
-
- public String getModelCustomizationUUID() {
- return modelCustomizationUUID;
- }
-
- public void setModelCustomizationUUID(String modelCustomizationUUID) {
- this.modelCustomizationUUID = modelCustomizationUUID;
- }
-
- public String getModelInstanceName() {
- return this.modelInstanceName;
- }
-
- public void setModelInstanceName(String modelInstanceName) {
- this.modelInstanceName = modelInstanceName;
- }
-
- public Date getCreationTimestamp() {
- return this.created;
- }
-
- public Integer getMinInstances() {
- return this.minInstances;
- }
-
- public void setMinInstances(Integer minInstances) {
- this.minInstances = minInstances;
- }
-
- public Integer getMaxInstances() {
- return this.maxInstances;
- }
-
- public void setMaxInstances(Integer maxInstances) {
- this.maxInstances = maxInstances;
- }
-
- public Integer getAvailabilityZoneMaxCount() {
- return this.availabilityZoneMaxCount;
- }
-
- public void setAvailabilityZoneMaxCount(Integer availabilityZoneMaxCount) {
- this.availabilityZoneMaxCount = availabilityZoneMaxCount;
- }
-
- public String getNfFunction() {
- return nfFunction;
- }
-
- public void setNfFunction(String nfFunction) {
- this.nfFunction = nfFunction;
- }
-
- public String getNfType() {
- return nfType;
- }
-
- public void setNfType(String nfType) {
- this.nfType = nfType;
- }
-
- public String getNfRole() {
- return nfRole;
- }
-
- public void setNfRole(String nfRole) {
- this.nfRole = nfRole;
- }
-
- public String getNfNamingCode() {
- return nfNamingCode;
- }
-
- public void setNfNamingCode(String nfNamingCode) {
- this.nfNamingCode = nfNamingCode;
- }
-
- public String getMultiStageDesign() {
- return this.multiStageDesign;
- }
-
- public void setMultiStageDesign(String multiStageDesign) {
- this.multiStageDesign = multiStageDesign;
- }
-
- @LinkedResource
- public List<VfModuleCustomization> getVfModuleCustomizations() {
- if (vfModuleCustomizations == null)
- vfModuleCustomizations = new ArrayList<>();
- return vfModuleCustomizations;
- }
-
- public void setVfModuleCustomizations(List<VfModuleCustomization> vfModuleCustomizations) {
- this.vfModuleCustomizations = vfModuleCustomizations;
- }
-
- @LinkedResource
- public VnfResource getVnfResources() {
- return vnfResources;
- }
-
- public void setVnfResources(VnfResource vnfResources) {
- this.vnfResources = vnfResources;
- }
-
- public Date getCreated() {
- return created;
- }
-
- @LinkedResource
- public List<VnfcInstanceGroupCustomization> getVnfcInstanceGroupCustomizations() {
- return vnfcInstanceGroupCustomizations;
- }
-
- public void setVnfcInstanceGroupCustomizations(
- List<VnfcInstanceGroupCustomization> vnfcInstanceGroupCustomizations) {
- this.vnfcInstanceGroupCustomizations = vnfcInstanceGroupCustomizations;
- }
-
- @LinkedResource
- public Set<VnfVfmoduleCvnfcConfigurationCustomization> getVnfVfmoduleCvnfcConfigurationCustomization() {
- if (vnfVfmoduleCvnfcConfigurationCustomization == null)
- vnfVfmoduleCvnfcConfigurationCustomization = new HashSet<>();
- return vnfVfmoduleCvnfcConfigurationCustomization;
- }
-
- public void setVnfVfmoduleCvnfcConfigurationCustomization(
- Set<VnfVfmoduleCvnfcConfigurationCustomization> vnfVfmoduleCvnfcConfigurationCustomization) {
- this.vnfVfmoduleCvnfcConfigurationCustomization = vnfVfmoduleCvnfcConfigurationCustomization;
- }
-
- @LinkedResource
- public List<CvnfcCustomization> getCvnfcCustomization() {
- return cvnfcCustomization;
- }
-
- public void setCvnfcCustomization(List<CvnfcCustomization> cvnfcCustomization) {
- this.cvnfcCustomization = cvnfcCustomization;
- }
-
- public String getResourceInput() {
- return resourceInput;
- }
-
- public void setResourceInput(String resourceInput) {
- this.resourceInput = resourceInput;
- }
+ private static final long serialVersionUID = 768026109321305392L;
+
+ @BusinessKey
+ @Id
+ @Column(name = "MODEL_CUSTOMIZATION_UUID")
+ private String modelCustomizationUUID;
+
+ @Column(name = "MODEL_INSTANCE_NAME")
+ private String modelInstanceName;
+
+ @Column(name = "CREATION_TIMESTAMP", updatable = false)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS")
+ @Temporal(TemporalType.TIMESTAMP)
+ private Date created;
+
+ public void setCreated(Date created) {
+ this.created = created;
+ }
+
+ @Column(name = "MIN_INSTANCES")
+ private Integer minInstances;
+
+ @Column(name = "MAX_INSTANCES")
+ private Integer maxInstances;
+
+ @Column(name = "AVAILABILITY_ZONE_MAX_COUNT")
+ private Integer availabilityZoneMaxCount;
+
+ @Column(name = "NF_FUNCTION")
+ private String nfFunction;
+
+ @Column(name = "NF_TYPE")
+ private String nfType;
+
+ @Column(name = "NF_ROLE")
+ private String nfRole;
+
+ @Column(name = "NF_NAMING_CODE")
+ private String nfNamingCode;
+
+ @Column(name = "MULTI_STAGE_DESIGN")
+ private String multiStageDesign;
+
+ @Column(name = "RESOURCE_INPUT")
+ private String resourceInput;
+
+ @ManyToOne(cascade = CascadeType.ALL)
+ @JoinColumn(name = "VNF_RESOURCE_MODEL_UUID")
+ private VnfResource vnfResources;
+
+ @OneToMany(cascade = CascadeType.ALL)
+ @JoinTable(name = "vnf_res_custom_to_vf_module_custom", joinColumns = @JoinColumn(name = "VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID", referencedColumnName = "MODEL_CUSTOMIZATION_UUID"), inverseJoinColumns = @JoinColumn(name = "VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID", referencedColumnName = "MODEL_CUSTOMIZATION_UUID"))
+ private List<VfModuleCustomization> vfModuleCustomizations;
+
+ @OneToMany(fetch = FetchType.LAZY, mappedBy = "vnfResourceCust")
+ private List<VnfcInstanceGroupCustomization> vnfcInstanceGroupCustomizations;
+
+ @OneToMany(cascade = CascadeType.ALL, mappedBy = "modelCustomizationUUID")
+ private Set<VnfVfmoduleCvnfcConfigurationCustomization> vnfVfmoduleCvnfcConfigurationCustomization;
+
+ @OneToMany(cascade = CascadeType.ALL, mappedBy = "modelCustomizationUUID")
+ private List<CvnfcCustomization> cvnfcCustomization;
+
+ @Column(name = "CDS_BLUEPRINT_NAME")
+ private String blueprintName;
+
+ @Column(name = "CDS_BLUEPRINT_VERSION")
+ private String blueprintVersion;
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("modelCustomizationUUID", modelCustomizationUUID)
+ .append("modelInstanceName", modelInstanceName).append("created", created)
+ .append("minInstances", minInstances).append("maxInstances", maxInstances)
+ .append("availabilityZoneMaxCount", availabilityZoneMaxCount).append("nfFunction", nfFunction)
+ .append("nfType", nfType).append("nfRole", nfRole).append("nfNamingCode", nfNamingCode)
+ .append("multiStageDesign", multiStageDesign).append("vnfResources", vnfResources)
+ .append("vfModuleCustomizations", vfModuleCustomizations)
+ .append("vnfcInstanceGroupCustomizations", vnfcInstanceGroupCustomizations).toString();
+ }
+
+ @Override
+ public boolean equals(final Object other) {
+ if (!(other instanceof VnfResourceCustomization)) {
+ return false;
+ }
+ VnfResourceCustomization castOther = (VnfResourceCustomization) other;
+ return new EqualsBuilder().append(modelCustomizationUUID, castOther.modelCustomizationUUID).isEquals();
+ }
+
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder().append(modelCustomizationUUID).toHashCode();
+ }
+
+ @PrePersist
+ protected void onCreate() {
+ this.created = new Date();
+ }
+
+ public String getModelCustomizationUUID() {
+ return modelCustomizationUUID;
+ }
+
+ public void setModelCustomizationUUID(String modelCustomizationUUID) {
+ this.modelCustomizationUUID = modelCustomizationUUID;
+ }
+
+ public String getModelInstanceName() {
+ return this.modelInstanceName;
+ }
+
+ public void setModelInstanceName(String modelInstanceName) {
+ this.modelInstanceName = modelInstanceName;
+ }
+
+ public Date getCreationTimestamp() {
+ return this.created;
+ }
+
+ public Integer getMinInstances() {
+ return this.minInstances;
+ }
+
+ public void setMinInstances(Integer minInstances) {
+ this.minInstances = minInstances;
+ }
+
+ public Integer getMaxInstances() {
+ return this.maxInstances;
+ }
+
+ public void setMaxInstances(Integer maxInstances) {
+ this.maxInstances = maxInstances;
+ }
+
+ public Integer getAvailabilityZoneMaxCount() {
+ return this.availabilityZoneMaxCount;
+ }
+
+ public void setAvailabilityZoneMaxCount(Integer availabilityZoneMaxCount) {
+ this.availabilityZoneMaxCount = availabilityZoneMaxCount;
+ }
+
+ public String getNfFunction() {
+ return nfFunction;
+ }
+
+ public void setNfFunction(String nfFunction) {
+ this.nfFunction = nfFunction;
+ }
+
+ public String getNfType() {
+ return nfType;
+ }
+
+ public void setNfType(String nfType) {
+ this.nfType = nfType;
+ }
+
+ public String getNfRole() {
+ return nfRole;
+ }
+
+ public void setNfRole(String nfRole) {
+ this.nfRole = nfRole;
+ }
+
+ public String getNfNamingCode() {
+ return nfNamingCode;
+ }
+
+ public void setNfNamingCode(String nfNamingCode) {
+ this.nfNamingCode = nfNamingCode;
+ }
+
+ public String getMultiStageDesign() {
+ return this.multiStageDesign;
+ }
+
+ public void setMultiStageDesign(String multiStageDesign) {
+ this.multiStageDesign = multiStageDesign;
+ }
+
+ @LinkedResource
+ public List<VfModuleCustomization> getVfModuleCustomizations() {
+ if (vfModuleCustomizations == null) {
+ vfModuleCustomizations = new ArrayList<>();
+ }
+ return vfModuleCustomizations;
+ }
+
+ public void setVfModuleCustomizations(List<VfModuleCustomization> vfModuleCustomizations) {
+ this.vfModuleCustomizations = vfModuleCustomizations;
+ }
+
+ @LinkedResource
+ public VnfResource getVnfResources() {
+ return vnfResources;
+ }
+
+ public void setVnfResources(VnfResource vnfResources) {
+ this.vnfResources = vnfResources;
+ }
+
+ public Date getCreated() {
+ return created;
+ }
+
+ @LinkedResource
+ public List<VnfcInstanceGroupCustomization> getVnfcInstanceGroupCustomizations() {
+ return vnfcInstanceGroupCustomizations;
+ }
+
+ public void setVnfcInstanceGroupCustomizations(
+ List<VnfcInstanceGroupCustomization> vnfcInstanceGroupCustomizations) {
+ this.vnfcInstanceGroupCustomizations = vnfcInstanceGroupCustomizations;
+ }
+
+ @LinkedResource
+ public Set<VnfVfmoduleCvnfcConfigurationCustomization> getVnfVfmoduleCvnfcConfigurationCustomization() {
+ if (vnfVfmoduleCvnfcConfigurationCustomization == null) {
+ vnfVfmoduleCvnfcConfigurationCustomization = new HashSet<>();
+ }
+ return vnfVfmoduleCvnfcConfigurationCustomization;
+ }
+
+ public void setVnfVfmoduleCvnfcConfigurationCustomization(
+ Set<VnfVfmoduleCvnfcConfigurationCustomization> vnfVfmoduleCvnfcConfigurationCustomization) {
+ this.vnfVfmoduleCvnfcConfigurationCustomization = vnfVfmoduleCvnfcConfigurationCustomization;
+ }
+
+ @LinkedResource
+ public List<CvnfcCustomization> getCvnfcCustomization() {
+ return cvnfcCustomization;
+ }
+
+ public void setCvnfcCustomization(List<CvnfcCustomization> cvnfcCustomization) {
+ this.cvnfcCustomization = cvnfcCustomization;
+ }
+
+ public String getResourceInput() {
+ return resourceInput;
+ }
+
+ public void setResourceInput(String resourceInput) {
+ this.resourceInput = resourceInput;
+ }
+
+
+ public String getBlueprintName() {
+ return blueprintName;
+ }
+
+ public void setBlueprintName(String blueprintName) {
+ this.blueprintName = blueprintName;
+ }
+
+ public String getBlueprintVersion() {
+ return blueprintVersion;
+ }
+
+ public void setBlueprintVersion(String blueprintVersion) {
+ this.blueprintVersion = blueprintVersion;
+ }
+
}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfVfmoduleCvnfcConfigurationCustomization.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfVfmoduleCvnfcConfigurationCustomization.java
index f5e9b5f560..7ce657c5c7 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfVfmoduleCvnfcConfigurationCustomization.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfVfmoduleCvnfcConfigurationCustomization.java
@@ -213,6 +213,7 @@ public class VnfVfmoduleCvnfcConfigurationCustomization implements Serializable
this.configurationResource = configurationResource;
}
+ @LinkedResource
public CvnfcCustomization getCvnfcCustomization() {
return cvnfcCustomization;
}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java
index ac123b280d..9b888cb2ed 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
@@ -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.
@@ -24,10 +24,8 @@ import java.net.URI;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
-
import javax.annotation.PostConstruct;
import javax.ws.rs.core.UriBuilder;
-
import org.onap.so.db.catalog.beans.BuildingBlockDetail;
import org.onap.so.db.catalog.beans.CloudSite;
import org.onap.so.db.catalog.beans.CloudifyManager;
@@ -44,6 +42,8 @@ import org.onap.so.db.catalog.beans.NetworkResourceCustomization;
import org.onap.so.db.catalog.beans.OrchestrationAction;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
import org.onap.so.db.catalog.beans.OrchestrationStatusStateTransitionDirective;
+import org.onap.so.db.catalog.beans.PnfResource;
+import org.onap.so.db.catalog.beans.PnfResourceCustomization;
import org.onap.so.db.catalog.beans.ResourceType;
import org.onap.so.db.catalog.beans.Service;
import org.onap.so.db.catalog.beans.ServiceRecipe;
@@ -53,6 +53,7 @@ import org.onap.so.db.catalog.beans.VnfComponentsRecipe;
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.beans.VnfVfmoduleCvnfcConfigurationCustomization;
import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization;
import org.onap.so.db.catalog.beans.macro.NorthBoundRequest;
import org.onap.so.db.catalog.beans.macro.OrchestrationFlow;
@@ -65,7 +66,6 @@ import org.springframework.http.client.BufferingClientHttpRequestFactory;
import org.springframework.http.client.ClientHttpRequestFactory;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.stereotype.Component;
-
import uk.co.blackpepper.bowman.Client;
import uk.co.blackpepper.bowman.ClientFactory;
import uk.co.blackpepper.bowman.Configuration;
@@ -73,633 +73,728 @@ import uk.co.blackpepper.bowman.Configuration;
@Component("CatalogDbClient")
public class CatalogDbClient {
- private static final String CLOUD_SITE = "/cloudSite";
- private static final String CLOUDIFY_MANAGER = "/cloudifyManager";
- private static final String RAINY_DAY_HANDLER_MACRO = "/rainy_day_handler_macro";
- private static final String NORTHBOUND_REQUEST_REF_LOOKUP = "/northbound_request_ref_lookup";
- private static final String NETWORK_RESOURCE_CUSTOMIZATION = "/networkResourceCustomization";
- private static final String COLLECTION_RESOURCE_INSTANCE_GROUP_CUSTOMIZATION = "/collectionResourceInstanceGroupCustomization";
- private static final String VNFC_INSTANCE_GROUP_CUSTOMIZATION = "/vnfcInstanceGroupCustomization";
- private static final String ORCHESTRATION_FLOW = "/orchestrationFlow";
- private static final String ORCHESTRATION_STATUS_STATE_TRANSITION_DIRECTIVE = "/orchestrationStatusStateTransitionDirective";
- private static final String INSTANCE_GROUP = "/instanceGroup";
- private static final String COLLECTION_NETWORK_RESOURCE_CUSTOMIZATION = "/collectionNetworkResourceCustomization";
- private static final String BUILDING_BLOCK_DETAIL = "/buildingBlockDetail";
- private static final String NETWORK_COLLECTION_RESOURCE_CUSTOMIZATION = "/networkCollectionResourceCustomization";
- private static final String VNF_RESOURCE_CUSTOMIZATION = "/vnfResourceCustomization";
- private static final String SERVICE = "/service";
- private static final String EXTERNAL_SERVICE_TO_INTERNAL_MODEL_MAPPING = "/externalServiceToInternalService";
- private static final String VNF_RESOURCE = "/vnfResource";
- private static final String VNF_RECIPE = "/vnfRecipe";
- private static final String VFMODULE = "/vfModule";
- private static final String VFMODULE_CUSTOMIZATION = "/vfModuleCustomization";
- private static final String VNF_COMPONENTS_RECIPE = "/vnfComponentsRecipe";
- private static final String SERVICE_RECIPE = "/serviceRecipe";
- private static final String NETWORK_RECIPE = "/networkRecipe";
-
- private static final String SEARCH = "/search";
- private static final String URI_SEPARATOR = "/";
-
- private static final String SERVICE_MODEL_UUID = "serviceModelUUID";
- private static final String SERVICE_NAME = "serviceName";
- private static final String MODEL_UUID = "modelUUID";
- private static final String MODEL_CUSTOMIZATION_UUID = "modelCustomizationUUID";
- private static final String ACTION = "action";
- private static final String MODEL_NAME = "modelName";
- private static final String MODEL_VERSION = "modelVersion";
- private static final String MODEL_INVARIANT_UUID = "modelInvariantUUID";
- private static final String MODEL_INSTANCE_NAME = "modelInstanceName";
- private static final String VNF_RESOURCE_MODEL_UUID = "vnfResourceModelUUID";
- private static final String NF_ROLE = "nfRole";
- private static final String VF_MODULE_MODEL_UUID = "vfModuleModelUUID";
- private static final String VNF_COMPONENT_TYPE = "vnfComponentType";
- private static final String BUILDING_BLOCK_NAME = "buildingBlockName";
- private static final String RESOURCE_TYPE = "resourceType";
- private static final String ORCHESTRATION_STATUS = "orchestrationStatus";
- private static final String TARGET_ACTION = "targetAction";
- private static final String REQUEST_SCOPE = "requestScope";
- private static final String IS_ALACARTE = "isALaCarte";
- private static final String CLOUD_OWNER = "cloudOwner";
- private static final String FLOW_NAME = "flowName";
- private static final String SERVICE_TYPE = "serviceType";
- private static final String VNF_TYPE = "vnfType";
- private static final String ERROR_CODE = "errorCode";
- private static final String WORK_STEP = "workStep";
- private static final String CLLI = "clli";
- private static final String CLOUD_VERSION = "cloudVersion";
- private static final String HOMING_INSTANCE = "/homingInstance";
-
- private static final String TARGET_ENTITY = "SO:CatalogDB";
- private static final String ASTERISK = "*";
-
- private String findExternalToInternalServiceByServiceName = "/findByServiceName";
- private String findServiceByModelName = "/findOneByModelName";
- private String findServiceRecipeByActionAndServiceModelUUID = "/findByActionAndServiceModelUUID";
- private String findServiceByModelUUID = "/findOneByModelUUID";
- private String findFirstByModelNameURI = "/findFirstByModelNameOrderByModelVersionDesc";
- private String findFirstByServiceModelUUIDAndActionURI = "/findFirstByServiceModelUUIDAndAction";
- private String findFirstByModelVersionAndModelInvariantUUIDURI = "/findFirstByModelVersionAndModelInvariantUUID";
- private String findByModelInvariantUUIDURI = "/findByModelInvariantUUIDOrderByModelVersionDesc";
- private String findFirstByModelNameAndAction = "/findFirstByModelNameAndAction";
- private String findFirstResourceByModelInvariantUUIDAndModelVersion = "/findFirstResourceByModelInvariantUUIDAndModelVersion";
- private String findByModelInstanceNameAndVnfResources = "/findByModelInstanceNameAndVnfResources";
- private String findFirstVnfRecipeByNfRoleAndAction = "/findFirstVnfRecipeByNfRoleAndAction";
- private String findByModelCustomizationUUIDAndVfModuleModelUUID = "/findByModelCustomizationUUIDAndVfModuleModelUUID";
- private String findFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction = "/findFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction";
- private String findFirstVnfComponentsRecipeByVnfComponentTypeAndAction = "/findFirstVnfComponentsRecipeByVnfComponentTypeAndAction";
- private String findVfModuleByModelInvariantUUIDOrderByModelVersionDesc = "/findByModelInvariantUUIDOrderByModelVersionDesc";
- private String findFirstVfModuleByModelInvariantUUIDAndModelVersion = "/findFirstVfModuleByModelInvariantUUIDAndModelVersion";
- private String findOneByBuildingBlockName = "/findOneByBuildingBlockName";
- private String findOneByResourceTypeAndOrchestrationStatusAndTargetAction = "/findOneByResourceTypeAndOrchestrationStatusAndTargetAction";
- private String findByAction = "/findByAction";
- private String findVnfcInstanceGroupCustomizationByModelCustomizationUUID = "/findByModelCustomizationUUID";
- private String findCollectionResourceInstanceGroupCustomizationByModelCustomizationUUID = "/findByModelCustomizationUUID";
- private String findOneByActionAndRequestScopeAndIsAlacarte = "/findOneByActionAndRequestScopeAndIsAlacarte";
- private String findOneByActionAndRequestScopeAndIsAlacarteAndCloudOwner = "/findOneByActionAndRequestScopeAndIsAlacarteAndCloudOwner";
- private String findOneByActionAndRequestScopeAndIsAlacarteAndCloudOwnerAndServiceType = "/findOneByActionAndRequestScopeAndIsAlacarteAndCloudOwnerAndServiceType";
- private String findOneByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep = "/findOneByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep";
- private String findByClliAndCloudVersion = "/findByClliAndCloudVersion";
- private String findServiceByServiceInstanceId = "/findServiceByServiceInstanceId";
-
-
- private String serviceURI;
- private String vfModuleURI;
- private String vnfResourceURI;
- private String vfModuleCustomizationURI;
- private String networkCollectionResourceCustomizationURI;
- private String networkResourceCustomizationURI;
- private String vnfResourceCustomizationURI;
- private String collectionNetworkResourceCustomizationURI;
- private String instanceGroupURI;
- private String cloudifyManagerURI;
- private String cloudSiteURI;
- private String homingInstanceURI;
-
- private final Client<Service> serviceClient;
-
- private final Client<NetworkRecipe> networkRecipeClient;
-
- private final Client<NetworkResourceCustomization> networkResourceCustomizationClient;
-
- private final Client<VnfResource> vnfResourceClient;
-
- private final Client<VnfResourceCustomization> vnfResourceCustomizationClient;
-
- private final Client<VnfRecipe> vnfRecipeClient;
-
- private final Client<VfModuleCustomization> vfModuleCustomizationClient;
-
- private final Client<VfModule> vfModuleClient;
-
- private final Client<VnfComponentsRecipe> vnfComponentsRecipeClient;
-
- private final Client<OrchestrationFlow> orchestrationClient;
-
- private final Client<NorthBoundRequest> northBoundRequestClient;
-
- private final Client<RainyDayHandlerStatus> rainyDayHandlerStatusClient;
-
- private final Client<BuildingBlockDetail> buildingBlockDetailClient;
-
- private final Client<OrchestrationStatusStateTransitionDirective> orchestrationStatusStateTransitionDirectiveClient;
-
- private final Client<VnfcInstanceGroupCustomization> vnfcInstanceGroupCustomizationClient;
-
- private final Client<CollectionResourceInstanceGroupCustomization> collectionResourceInstanceGroupCustomizationClient;
-
- private final Client<InstanceGroup> instanceGroupClient;
-
- private final Client<NetworkCollectionResourceCustomization> networkCollectionResourceCustomizationClient;
-
- private final Client<CollectionNetworkResourceCustomization> collectionNetworkResourceCustomizationClient;
-
- private final Client<ServiceRecipe> serviceRecipeClient;
-
- private final Client<ExternalServiceToInternalService> externalServiceToInternalServiceClient;
-
- private final Client<CloudSite> cloudSiteClient;
-
- private final Client<HomingInstance> homingInstanceClient;
-
- private final Client<CloudifyManager> cloudifyManagerClient;
-
- private final Client<CvnfcCustomization> cvnfcCustomizationClient;
-
- private final Client<ControllerSelectionReference> controllerSelectionReferenceClient;
-
- @Value("${mso.catalog.db.spring.endpoint}")
- private String endpoint;
-
- @Value("${mso.db.auth}")
- private String msoAdaptersAuth;
-
-
- @PostConstruct
- public void init(){
- findExternalToInternalServiceByServiceName = endpoint + EXTERNAL_SERVICE_TO_INTERNAL_MODEL_MAPPING + SEARCH + findExternalToInternalServiceByServiceName;
- findServiceByModelName = endpoint + SERVICE + SEARCH + findServiceByModelName;
- findServiceRecipeByActionAndServiceModelUUID = endpoint + SERVICE_RECIPE + SEARCH + findServiceRecipeByActionAndServiceModelUUID;
- findServiceByModelUUID = endpoint + SERVICE + SEARCH + findServiceByModelUUID;
- findFirstByModelNameURI = endpoint + SERVICE + SEARCH + findFirstByModelNameURI;
- findFirstByModelVersionAndModelInvariantUUIDURI = endpoint + SERVICE + SEARCH + findFirstByModelVersionAndModelInvariantUUIDURI;
- findByModelInvariantUUIDURI = endpoint + SERVICE + SEARCH + findByModelInvariantUUIDURI;
- findFirstByServiceModelUUIDAndActionURI = endpoint + SERVICE_RECIPE + SEARCH + findFirstByServiceModelUUIDAndActionURI;
- findFirstByModelNameAndAction = endpoint + NETWORK_RECIPE + SEARCH + findFirstByModelNameAndAction;
- findFirstResourceByModelInvariantUUIDAndModelVersion = endpoint + VNF_RESOURCE + SEARCH + findFirstResourceByModelInvariantUUIDAndModelVersion;
- findByModelInstanceNameAndVnfResources = endpoint + VNF_RESOURCE_CUSTOMIZATION + SEARCH + findByModelInstanceNameAndVnfResources;
- findFirstVnfRecipeByNfRoleAndAction = endpoint + VNF_RECIPE + SEARCH + findFirstVnfRecipeByNfRoleAndAction;
- findByModelCustomizationUUIDAndVfModuleModelUUID = endpoint + VFMODULE_CUSTOMIZATION + SEARCH + findByModelCustomizationUUIDAndVfModuleModelUUID;
- findFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction = endpoint + VNF_COMPONENTS_RECIPE + SEARCH + findFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction;
- findFirstVnfComponentsRecipeByVnfComponentTypeAndAction = endpoint + VNF_COMPONENTS_RECIPE + SEARCH + findFirstVnfComponentsRecipeByVnfComponentTypeAndAction;
- findVfModuleByModelInvariantUUIDOrderByModelVersionDesc = endpoint + VFMODULE + SEARCH +findVfModuleByModelInvariantUUIDOrderByModelVersionDesc;
- findFirstVfModuleByModelInvariantUUIDAndModelVersion = endpoint + VFMODULE + SEARCH + findFirstVfModuleByModelInvariantUUIDAndModelVersion;
- findOneByBuildingBlockName = endpoint + BUILDING_BLOCK_DETAIL + SEARCH + findOneByBuildingBlockName;
- findOneByResourceTypeAndOrchestrationStatusAndTargetAction = endpoint + ORCHESTRATION_STATUS_STATE_TRANSITION_DIRECTIVE + SEARCH + findOneByResourceTypeAndOrchestrationStatusAndTargetAction;
- findByAction = endpoint + ORCHESTRATION_FLOW + SEARCH + findByAction;
- findVnfcInstanceGroupCustomizationByModelCustomizationUUID = endpoint + VNFC_INSTANCE_GROUP_CUSTOMIZATION + SEARCH + findVnfcInstanceGroupCustomizationByModelCustomizationUUID;
- findCollectionResourceInstanceGroupCustomizationByModelCustomizationUUID = endpoint + COLLECTION_RESOURCE_INSTANCE_GROUP_CUSTOMIZATION + SEARCH + findCollectionResourceInstanceGroupCustomizationByModelCustomizationUUID;
- findOneByActionAndRequestScopeAndIsAlacarte = endpoint + NORTHBOUND_REQUEST_REF_LOOKUP + SEARCH + findOneByActionAndRequestScopeAndIsAlacarte;
- findOneByActionAndRequestScopeAndIsAlacarteAndCloudOwner = endpoint + NORTHBOUND_REQUEST_REF_LOOKUP + SEARCH + findOneByActionAndRequestScopeAndIsAlacarteAndCloudOwner;
- findOneByActionAndRequestScopeAndIsAlacarteAndCloudOwnerAndServiceType = endpoint + NORTHBOUND_REQUEST_REF_LOOKUP + SEARCH + findOneByActionAndRequestScopeAndIsAlacarteAndCloudOwnerAndServiceType;
- findOneByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep = endpoint + RAINY_DAY_HANDLER_MACRO + SEARCH + findOneByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep;
- findByClliAndCloudVersion = endpoint + CLOUD_SITE + SEARCH + findByClliAndCloudVersion;
-
- serviceURI = endpoint + SERVICE + URI_SEPARATOR;
- vfModuleURI = endpoint + VFMODULE + URI_SEPARATOR;
- vnfResourceURI = endpoint + VNF_RESOURCE + URI_SEPARATOR;
- vfModuleCustomizationURI = endpoint + VFMODULE_CUSTOMIZATION + URI_SEPARATOR;
- networkCollectionResourceCustomizationURI = endpoint + NETWORK_COLLECTION_RESOURCE_CUSTOMIZATION + URI_SEPARATOR;
- networkResourceCustomizationURI = endpoint + NETWORK_RESOURCE_CUSTOMIZATION + URI_SEPARATOR;
- vnfResourceCustomizationURI = endpoint + VNF_RESOURCE_CUSTOMIZATION + URI_SEPARATOR;
- collectionNetworkResourceCustomizationURI = endpoint + COLLECTION_NETWORK_RESOURCE_CUSTOMIZATION + URI_SEPARATOR;
- instanceGroupURI = endpoint + INSTANCE_GROUP + URI_SEPARATOR;
- cloudifyManagerURI = endpoint + CLOUDIFY_MANAGER + URI_SEPARATOR;
- cloudSiteURI = endpoint + CLOUD_SITE + URI_SEPARATOR;
- homingInstanceURI = endpoint + HOMING_INSTANCE + URI_SEPARATOR;
-
- }
-
- public CatalogDbClient() {
- ClientHttpRequestFactory factory = new BufferingClientHttpRequestFactory(new HttpComponentsClientHttpRequestFactory());
-
- ClientFactory clientFactory = Configuration.builder().setClientHttpRequestFactory(factory).setRestTemplateConfigurer(restTemplate -> {
- restTemplate.getInterceptors().add((new SpringClientFilter()));
-
- restTemplate.getInterceptors().add((request, body, execution) -> {
-
- request.getHeaders().add(HttpHeaders.AUTHORIZATION, msoAdaptersAuth);
- request.getHeaders().add(LogConstants.TARGET_ENTITY_HEADER,TARGET_ENTITY);
- return execution.execute(request, body);
- });
- }).build().buildClientFactory();
- serviceClient = clientFactory.create(Service.class);
- networkRecipeClient = clientFactory.create(NetworkRecipe.class);
- networkResourceCustomizationClient = clientFactory.create(NetworkResourceCustomization.class);
- vnfResourceClient = clientFactory.create(VnfResource.class);
- vnfResourceCustomizationClient = clientFactory.create(VnfResourceCustomization.class);
- vnfRecipeClient = clientFactory.create(VnfRecipe.class);
- orchestrationClient = clientFactory.create(OrchestrationFlow.class);
- vfModuleCustomizationClient = clientFactory.create(VfModuleCustomization.class);
- vfModuleClient = clientFactory.create(VfModule.class);
- vnfComponentsRecipeClient = clientFactory.create(VnfComponentsRecipe.class);
- northBoundRequestClient = clientFactory.create(NorthBoundRequest.class);
- rainyDayHandlerStatusClient = clientFactory.create(RainyDayHandlerStatus.class);
- buildingBlockDetailClient = clientFactory.create(BuildingBlockDetail.class);
- orchestrationStatusStateTransitionDirectiveClient = clientFactory
- .create(OrchestrationStatusStateTransitionDirective.class);
- vnfcInstanceGroupCustomizationClient = clientFactory.create(VnfcInstanceGroupCustomization.class);
- collectionResourceInstanceGroupCustomizationClient = clientFactory
- .create(CollectionResourceInstanceGroupCustomization.class);
- instanceGroupClient = clientFactory.create(InstanceGroup.class);
- networkCollectionResourceCustomizationClient = clientFactory.create(NetworkCollectionResourceCustomization.class);
- collectionNetworkResourceCustomizationClient = clientFactory.create(CollectionNetworkResourceCustomization.class);
- cloudSiteClient = clientFactory.create(CloudSite.class);
- homingInstanceClient = clientFactory.create(HomingInstance.class);
- cloudifyManagerClient = clientFactory.create(CloudifyManager.class);
- serviceRecipeClient = clientFactory.create(ServiceRecipe.class);
- cvnfcCustomizationClient = clientFactory.create(CvnfcCustomization.class);
- controllerSelectionReferenceClient = clientFactory.create(ControllerSelectionReference.class);
- externalServiceToInternalServiceClient = clientFactory.create(ExternalServiceToInternalService.class);
- }
-
- public CatalogDbClient(String baseUri, String auth) {
- ClientHttpRequestFactory factory = new BufferingClientHttpRequestFactory(new HttpComponentsClientHttpRequestFactory());
-
- ClientFactory clientFactory = Configuration.builder().setBaseUri(baseUri).setClientHttpRequestFactory(factory).setRestTemplateConfigurer(restTemplate -> {
- restTemplate.getInterceptors().add((new SpringClientFilter()));
-
- restTemplate.getInterceptors().add((request, body, execution) -> {
-
- request.getHeaders().add(HttpHeaders.AUTHORIZATION, auth);
- request.getHeaders().add(LogConstants.TARGET_ENTITY_HEADER,TARGET_ENTITY);
- return execution.execute(request, body);
- });
- }).build().buildClientFactory();
- serviceClient = clientFactory.create(Service.class);
- networkRecipeClient = clientFactory.create(NetworkRecipe.class);
- networkResourceCustomizationClient = clientFactory.create(NetworkResourceCustomization.class);
- vnfResourceClient = clientFactory.create(VnfResource.class);
- vnfResourceCustomizationClient = clientFactory.create(VnfResourceCustomization.class);
- vnfRecipeClient = clientFactory.create(VnfRecipe.class);
- orchestrationClient = clientFactory.create(OrchestrationFlow.class);
- vfModuleCustomizationClient = clientFactory.create(VfModuleCustomization.class);
- vfModuleClient = clientFactory.create(VfModule.class);
- vnfComponentsRecipeClient = clientFactory.create(VnfComponentsRecipe.class);
- northBoundRequestClient = clientFactory.create(NorthBoundRequest.class);
- rainyDayHandlerStatusClient = clientFactory.create(RainyDayHandlerStatus.class);
- buildingBlockDetailClient = clientFactory.create(BuildingBlockDetail.class);
- orchestrationStatusStateTransitionDirectiveClient = clientFactory
- .create(OrchestrationStatusStateTransitionDirective.class);
- vnfcInstanceGroupCustomizationClient = clientFactory.create(VnfcInstanceGroupCustomization.class);
- collectionResourceInstanceGroupCustomizationClient = clientFactory
- .create(CollectionResourceInstanceGroupCustomization.class);
- instanceGroupClient = clientFactory.create(InstanceGroup.class);
- networkCollectionResourceCustomizationClient = clientFactory.create(NetworkCollectionResourceCustomization.class);
- collectionNetworkResourceCustomizationClient = clientFactory.create(CollectionNetworkResourceCustomization.class);
- cloudSiteClient = clientFactory.create(CloudSite.class);
- homingInstanceClient = clientFactory.create(HomingInstance.class);
- cloudifyManagerClient = clientFactory.create(CloudifyManager.class);
- serviceRecipeClient = clientFactory.create(ServiceRecipe.class);
- cvnfcCustomizationClient = clientFactory.create(CvnfcCustomization.class);
- controllerSelectionReferenceClient = clientFactory.create(ControllerSelectionReference.class);
- externalServiceToInternalServiceClient = clientFactory.create(ExternalServiceToInternalService.class);
- }
-
- public NetworkCollectionResourceCustomization getNetworkCollectionResourceCustomizationByID(String modelCustomizationUUID) {
- NetworkCollectionResourceCustomization networkCollectionResourceCustomization =
- this.getSingleResource(networkCollectionResourceCustomizationClient, getUri(networkCollectionResourceCustomizationURI + modelCustomizationUUID));
- if (networkCollectionResourceCustomization != null) {
- networkCollectionResourceCustomization.setModelCustomizationUUID(modelCustomizationUUID);
- }
- return networkCollectionResourceCustomization;
- }
-
- public Service getServiceByID(String modelUUID) {
- Service service = getSingleResource(serviceClient,getUri(serviceURI + modelUUID));
- if (service != null) {
- service.setModelUUID(modelUUID);
- }
- return service;
- }
-
- public VfModule getVfModuleByModelUUID(String modelUUID) {
- VfModule vfModule = getSingleResource(vfModuleClient,getUri(vfModuleURI + modelUUID));
- if (vfModule != null) {
- vfModule.setModelUUID(modelUUID);
- }
- return vfModule;
- }
-
- public VnfResource getVnfResourceByModelUUID(String modelUUID){
-
- VnfResource vnfResource = this.getSingleResource(vnfResourceClient, getUri(vnfResourceURI + modelUUID));
- if (vnfResource != null) {
- vnfResource.setModelUUID(modelUUID);
- }
- return vnfResource;
- }
-
- public VnfResourceCustomization getVnfResourceCustomizationByModelCustomizationUUID(String modelCustomizationUUID){
- VnfResourceCustomization vnfResourceCustomization = getSingleResource(vnfResourceCustomizationClient, getUri(vnfResourceCustomizationURI + modelCustomizationUUID));
- if (vnfResourceCustomization != null) {
- vnfResourceCustomization.setModelCustomizationUUID(modelCustomizationUUID);
- }
- return vnfResourceCustomization;
- }
-
- public CollectionNetworkResourceCustomization getCollectionNetworkResourceCustomizationByID(String modelCustomizationUUID) {
- CollectionNetworkResourceCustomization collectionNetworkResourceCustomization =
- this.getSingleResource(collectionNetworkResourceCustomizationClient,getUri(UriBuilder
- .fromUri(collectionNetworkResourceCustomizationURI + modelCustomizationUUID).build().toString()));
- if (collectionNetworkResourceCustomization != null) {
- collectionNetworkResourceCustomization.setModelCustomizationUUID(modelCustomizationUUID);
- }
- return collectionNetworkResourceCustomization;
- }
-
- public InstanceGroup getInstanceGroupByModelUUID(String modelUUID) {
- InstanceGroup instanceGroup = this.getSingleResource(instanceGroupClient, getUri(instanceGroupURI + modelUUID));
- if (instanceGroup != null) {
- instanceGroup.setModelUUID(modelUUID);
- }
- return instanceGroup;
- }
-
- public VfModuleCustomization getVfModuleCustomizationByModelCuztomizationUUID(String modelCustomizationUUID) {
- VfModuleCustomization vfModuleCust = this.getSingleResource(vfModuleCustomizationClient, getUri(vfModuleCustomizationURI + modelCustomizationUUID));
- if (vfModuleCust != null) {
- vfModuleCust.setModelCustomizationUUID(modelCustomizationUUID);
- }
- return vfModuleCust;
- }
-
- public NetworkResourceCustomization getNetworkResourceCustomizationByModelCustomizationUUID(String modelCustomizationUUID){
- NetworkResourceCustomization networkResourceCustomization =
- this.getSingleResource(networkResourceCustomizationClient, getUri(networkResourceCustomizationURI + modelCustomizationUUID));
- if (networkResourceCustomization != null) {
- networkResourceCustomization.setModelCustomizationUUID(modelCustomizationUUID);
- }
- return networkResourceCustomization;
- }
-
- public BuildingBlockDetail getBuildingBlockDetail(String buildingBlockName) {
- BuildingBlockDetail buildingBlockDetail = getSingleResource(buildingBlockDetailClient, getUri(UriBuilder
- .fromUri(findOneByBuildingBlockName).queryParam(BUILDING_BLOCK_NAME, buildingBlockName).build().toString()));
- if (buildingBlockDetail != null) {
- buildingBlockDetail.setBuildingBlockName(buildingBlockName);
- }
- return buildingBlockDetail;
- }
-
-
- public OrchestrationStatusStateTransitionDirective getOrchestrationStatusStateTransitionDirective(
- ResourceType resourceType, OrchestrationStatus orchestrationStatus, OrchestrationAction targetAction) {
- return getSingleResource(orchestrationStatusStateTransitionDirectiveClient, UriBuilder
- .fromUri(findOneByResourceTypeAndOrchestrationStatusAndTargetAction)
- .queryParam(RESOURCE_TYPE, resourceType.name())
- .queryParam(ORCHESTRATION_STATUS, orchestrationStatus.name())
- .queryParam(TARGET_ACTION, targetAction.name()).build());
- }
-
- public List<OrchestrationFlow> getOrchestrationFlowByAction(String action) {
- return this.getMultipleResources(orchestrationClient, UriBuilder
- .fromUri(findByAction).queryParam(ACTION, action).build());
- }
-
- public List<VnfcInstanceGroupCustomization> getVnfcInstanceGroupsByVnfResourceCust(String modelCustomizationUUID) {
- return this.getMultipleResources(vnfcInstanceGroupCustomizationClient, UriBuilder
- .fromUri(findVnfcInstanceGroupCustomizationByModelCustomizationUUID)
- .queryParam(MODEL_CUSTOMIZATION_UUID, modelCustomizationUUID).build());
- }
-
- public List<CollectionResourceInstanceGroupCustomization> getCollectionResourceInstanceGroupCustomizationByModelCustUUID(
- String modelCustomizationUUID) {
- return this.getMultipleResources(collectionResourceInstanceGroupCustomizationClient, UriBuilder
- .fromUri(findCollectionResourceInstanceGroupCustomizationByModelCustomizationUUID)
- .queryParam(MODEL_CUSTOMIZATION_UUID, modelCustomizationUUID).build());
- }
-
- public VfModuleCustomization getVfModuleCustomizationByModelCustomizationUUIDAndVfModuleModelUUID(String modelCustomizationUUID, String vfModuleModelUUID) {
- return this.getSingleResource(vfModuleCustomizationClient, getUri(UriBuilder
- .fromUri(findByModelCustomizationUUIDAndVfModuleModelUUID)
- .queryParam(MODEL_CUSTOMIZATION_UUID,modelCustomizationUUID)
- .queryParam(VF_MODULE_MODEL_UUID,vfModuleModelUUID).build().toString()));
- }
-
- public NorthBoundRequest getNorthBoundRequestByActionAndIsALaCarteAndRequestScope(String requestAction,
- String resourceName, boolean aLaCarte) {
- return this.getSingleResource(northBoundRequestClient, UriBuilder
- .fromUri(findOneByActionAndRequestScopeAndIsAlacarte)
- .queryParam(ACTION, requestAction).queryParam(REQUEST_SCOPE, resourceName)
- .queryParam(IS_ALACARTE, aLaCarte).build());
- }
-
- public NorthBoundRequest getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(String requestAction,
- String resourceName, boolean aLaCarte, String cloudOwner) {
- return this.getSingleResource(northBoundRequestClient, getUri(UriBuilder
- .fromUri(findOneByActionAndRequestScopeAndIsAlacarteAndCloudOwnerAndServiceType)
- .queryParam(ACTION, requestAction).queryParam(REQUEST_SCOPE, resourceName)
- .queryParam(IS_ALACARTE, aLaCarte)
- .queryParam(CLOUD_OWNER, cloudOwner)
- .queryParam(SERVICE_TYPE, ASTERISK).build().toString()));
- }
-
- public NorthBoundRequest getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwnerAndServiceType(String requestAction,
- String resourceName, boolean aLaCarte, String cloudOwner, String serviceType) {
- return this.getSingleResource(northBoundRequestClient, getUri(UriBuilder
- .fromUri(findOneByActionAndRequestScopeAndIsAlacarteAndCloudOwnerAndServiceType)
- .queryParam(ACTION, requestAction).queryParam(REQUEST_SCOPE, resourceName)
- .queryParam(IS_ALACARTE, aLaCarte)
- .queryParam(CLOUD_OWNER, cloudOwner)
- .queryParam(SERVICE_TYPE, serviceType).build().toString()));
- }
-
- public RainyDayHandlerStatus getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(
- String flowName, String serviceType, String vnfType, String errorCode, String workStep) {
- return this.getSingleResource(rainyDayHandlerStatusClient, getUri(UriBuilder
- .fromUri(findOneByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep)
- .queryParam(FLOW_NAME, flowName).queryParam(SERVICE_TYPE, serviceType)
- .queryParam(VNF_TYPE, vnfType).queryParam(ERROR_CODE, errorCode).queryParam(WORK_STEP, workStep)
- .build().toString()));
- }
-
- public ServiceRecipe getFirstByServiceModelUUIDAndAction(String modelUUID, String action){
- return this.getSingleResource(serviceRecipeClient, getUri(UriBuilder
- .fromUri(findFirstByServiceModelUUIDAndActionURI)
- .queryParam(SERVICE_MODEL_UUID,modelUUID)
- .queryParam(ACTION,action).build().toString()));
- }
-
- public NetworkRecipe getFirstNetworkRecipeByModelNameAndAction(String modelName, String action){
- return this.getSingleResource(networkRecipeClient, UriBuilder
- .fromUri(findFirstByModelNameAndAction)
- .queryParam(MODEL_NAME,modelName)
- .queryParam(ACTION,action).build());
- }
-
- public ControllerSelectionReference getControllerSelectionReferenceByVnfTypeAndActionCategory(String vnfType, String actionCategory) {
- return this.getSingleResource(controllerSelectionReferenceClient, UriBuilder
- .fromUri(endpoint + "/controllerSelectionReference/search/findControllerSelectionReferenceByVnfTypeAndActionCategory")
- .queryParam("VNF_TYPE", vnfType).queryParam("ACTION_CATEGORY", actionCategory).build());
- }
-
- public Service getFirstByModelNameOrderByModelVersionDesc(String modelName){
- return this.getSingleResource(serviceClient,UriBuilder
- .fromUri(findFirstByModelNameURI)
- .queryParam(MODEL_NAME,modelName).build());
- }
-
- public ExternalServiceToInternalService findExternalToInternalServiceByServiceName(String serviceName){
- return this.getSingleResource(externalServiceToInternalServiceClient, getUri(UriBuilder
- .fromUri(findExternalToInternalServiceByServiceName)
- .queryParam(SERVICE_NAME,serviceName).build().toString()));
- }
-
- public ServiceRecipe findServiceRecipeByActionAndServiceModelUUID(String action,String modelUUID){
- return this.getSingleResource(serviceRecipeClient, getUri(UriBuilder
- .fromUri(findServiceRecipeByActionAndServiceModelUUID)
- .queryParam(ACTION,action)
- .queryParam(SERVICE_MODEL_UUID,modelUUID).build().toString()));
- }
-
- public Service getServiceByModelName(String modelName){
- return this.getSingleResource(serviceClient,getUri(UriBuilder
- .fromUri(findServiceByModelName)
- .queryParam(MODEL_NAME,modelName).build().toString()));
- }
-
- public Service getServiceByModelUUID(String modelModelUUID){
- return this.getSingleResource(serviceClient,getUri(UriBuilder
- .fromUri(findServiceByModelUUID)
- .queryParam(MODEL_UUID,modelModelUUID).build().toString()));
- }
-
- public VnfResource getFirstVnfResourceByModelInvariantUUIDAndModelVersion(String modelInvariantUUID, String modelVersion){
- return this.getSingleResource(vnfResourceClient, getUri(UriBuilder
- .fromUri(findFirstResourceByModelInvariantUUIDAndModelVersion)
- .queryParam(MODEL_INVARIANT_UUID,modelInvariantUUID)
- .queryParam(MODEL_VERSION,modelVersion).build().toString()));
- }
-
-
- public VnfResourceCustomization getFirstVnfResourceCustomizationByModelInstanceNameAndVnfResources(String modelInstanceName, VnfResource vnfResource){
- return this.getSingleResource(vnfResourceCustomizationClient, getUri(UriBuilder
- .fromUri(findByModelInstanceNameAndVnfResources)
- .queryParam(MODEL_INSTANCE_NAME,modelInstanceName)
- .queryParam(VNF_RESOURCE_MODEL_UUID,vnfResource.getModelUUID()).build().toString()));
- }
-
- public VnfRecipe getFirstVnfRecipeByNfRoleAndAction(String nfRole, String action){
- return this.getSingleResource(vnfRecipeClient,getUri(UriBuilder
- .fromUri(findFirstVnfRecipeByNfRoleAndAction)
- .queryParam(NF_ROLE,nfRole)
- .queryParam(ACTION,action).build().toString()));
- }
-
- public VnfComponentsRecipe getFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction(String vfModuleModelUUID, String vnfComponentType, String action){
- return this.getSingleResource(vnfComponentsRecipeClient,getUri(UriBuilder
- .fromUri(findFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction)
- .queryParam(VF_MODULE_MODEL_UUID,vfModuleModelUUID)
- .queryParam(VNF_COMPONENT_TYPE,vnfComponentType)
- .queryParam(ACTION,action).build().toString()));
- }
-
- public VnfComponentsRecipe getFirstVnfComponentsRecipeByVnfComponentTypeAndAction(String vnfComponentType, String action) {
- return this.getSingleResource(vnfComponentsRecipeClient,getUri(UriBuilder
- .fromUri(findFirstVnfComponentsRecipeByVnfComponentTypeAndAction)
- .queryParam(VNF_COMPONENT_TYPE,vnfComponentType)
- .queryParam(ACTION,action).build().toString()));
- }
- protected URI getUri(String template){
- return URI.create(template);
- }
-
- public CloudifyManager getCloudifyManager(String id) {
- return this.getSingleResource(cloudifyManagerClient,getUri(cloudifyManagerURI + id));
- }
-
- public CloudSite getCloudSite(String id){
- return this.getSingleResource(cloudSiteClient,
- getUri(cloudSiteURI + id));
- }
-
- public CloudSite getCloudSite(String id, String uri){
- return this.getSingleResource(cloudSiteClient,
- getUri(uri + id));
- }
-
- public void postCloudSite(CloudSite cloudSite){
- this.postSingleResource(cloudSiteClient, cloudSite);
- }
-
- public CloudSite getCloudSiteByClliAndAicVersion (String clli, String cloudVersion){
- return this.getSingleResource(cloudSiteClient, getUri(UriBuilder
- .fromUri(findByClliAndCloudVersion)
- .queryParam(CLLI,clli).queryParam(CLOUD_VERSION,cloudVersion).build().toString()));
- }
-
- public HomingInstance getHomingInstance (String serviceInstanceId){
- return this.getSingleResource(homingInstanceClient,
- getUri(homingInstanceURI + serviceInstanceId));
- }
-
- public HomingInstance getHomingInstance (String serviceInstanceId, String uri){
- return this.getSingleResource(homingInstanceClient,
- getUri(uri + serviceInstanceId));
- }
-
- public void postHomingInstance(HomingInstance homingInstance){
- this.postSingleResource(homingInstanceClient, homingInstance);
- }
-
- public Service getServiceByModelVersionAndModelInvariantUUID(String modelVersion, String modelInvariantUUID) {
- return this.getSingleResource(serviceClient, getUri(UriBuilder
- .fromUri(findFirstByModelVersionAndModelInvariantUUIDURI)
- .queryParam(MODEL_VERSION, modelVersion)
- .queryParam(MODEL_INVARIANT_UUID, modelInvariantUUID).build().toString()));
- }
-
- public VfModule getVfModuleByModelInvariantUUIDAndModelVersion(String modelInvariantUUID, String modelVersion){
- return this.getSingleResource(vfModuleClient,getUri(UriBuilder
- .fromUri(findFirstVfModuleByModelInvariantUUIDAndModelVersion)
- .queryParam(MODEL_INVARIANT_UUID, modelInvariantUUID)
- .queryParam(MODEL_VERSION, modelVersion).build().toString()));
- }
-
- public List<Service> getServiceByModelInvariantUUIDOrderByModelVersionDesc(String modelInvariantUUID) {
- return this.getMultipleResources(serviceClient, getUri(UriBuilder
- .fromUri(findByModelInvariantUUIDURI)
- .queryParam(MODEL_INVARIANT_UUID, modelInvariantUUID).build().toString()));
- }
-
- public List<VfModule> getVfModuleByModelInvariantUUIDOrderByModelVersionDesc(String modelInvariantUUID) {
- return this.getMultipleResources(vfModuleClient, getUri(UriBuilder
- .fromUri(findVfModuleByModelInvariantUUIDOrderByModelVersionDesc)
- .queryParam(MODEL_INVARIANT_UUID, modelInvariantUUID).build().toString()));
- }
-
- private <T> T getSingleResource(Client<T> client, URI uri) {
- return client.get(uri);
- }
-
- private <T> List<T> getMultipleResources(Client<T> client, URI uri) {
- Iterable<T> iterator = client.getAll(uri);
- List<T> list = new ArrayList<>();
- Iterator<T> it = iterator.iterator();
- it.forEachRemaining(list::add);
- return list;
- }
-
- private <T> URI postSingleResource(Client<T> client, T type){
- return client.post(type);
- }
-
- public List<CvnfcCustomization> getCvnfcCustomizationByVnfCustomizationUUIDAndVfModuleCustomizationUUID(String vnfCustomizationUUID, String vfModuleCustomizationUUID){
-
- return this.getMultipleResources(cvnfcCustomizationClient,getUri(UriBuilder
- .fromUri(endpoint + "/cvnfcCustomization/search/findByVnfResourceCustomizationAndVfModuleCustomization")
- .queryParam("VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID", vnfCustomizationUUID)
- .queryParam("VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID", vfModuleCustomizationUUID).build().toString()));
- }
-
+ private static final String CLOUD_SITE = "/cloudSite";
+ private static final String CLOUDIFY_MANAGER = "/cloudifyManager";
+ private static final String RAINY_DAY_HANDLER_MACRO = "/rainy_day_handler_macro";
+ private static final String NORTHBOUND_REQUEST_REF_LOOKUP = "/northbound_request_ref_lookup";
+ private static final String NETWORK_RESOURCE_CUSTOMIZATION = "/networkResourceCustomization";
+ private static final String COLLECTION_RESOURCE_INSTANCE_GROUP_CUSTOMIZATION = "/collectionResourceInstanceGroupCustomization";
+ private static final String VNFC_INSTANCE_GROUP_CUSTOMIZATION = "/vnfcInstanceGroupCustomization";
+ private static final String ORCHESTRATION_FLOW = "/orchestrationFlow";
+ private static final String ORCHESTRATION_STATUS_STATE_TRANSITION_DIRECTIVE = "/orchestrationStatusStateTransitionDirective";
+ private static final String INSTANCE_GROUP = "/instanceGroup";
+ private static final String COLLECTION_NETWORK_RESOURCE_CUSTOMIZATION = "/collectionNetworkResourceCustomization";
+ private static final String BUILDING_BLOCK_DETAIL = "/buildingBlockDetail";
+ private static final String NETWORK_COLLECTION_RESOURCE_CUSTOMIZATION = "/networkCollectionResourceCustomization";
+ private static final String VNF_RESOURCE_CUSTOMIZATION = "/vnfResourceCustomization";
+ private static final String SERVICE = "/service";
+ private static final String EXTERNAL_SERVICE_TO_INTERNAL_MODEL_MAPPING = "/externalServiceToInternalService";
+ private static final String VNF_RESOURCE = "/vnfResource";
+ private static final String VNF_RECIPE = "/vnfRecipe";
+ private static final String VFMODULE = "/vfModule";
+ private static final String VFMODULE_CUSTOMIZATION = "/vfModuleCustomization";
+ private static final String VNF_COMPONENTS_RECIPE = "/vnfComponentsRecipe";
+ private static final String SERVICE_RECIPE = "/serviceRecipe";
+ private static final String NETWORK_RECIPE = "/networkRecipe";
+ private static final String PNF_RESOURCE = "/pnfResource";
+ private static final String PNF_RESOURCE_CUSTOMIZATION = "/pnfResourceCustomization";
+
+
+ private static final String SEARCH = "/search";
+ private static final String URI_SEPARATOR = "/";
+
+ private static final String SERVICE_MODEL_UUID = "serviceModelUUID";
+ private static final String SERVICE_NAME = "serviceName";
+ private static final String MODEL_UUID = "modelUUID";
+ private static final String MODEL_CUSTOMIZATION_UUID = "modelCustomizationUUID";
+ private static final String ACTION = "action";
+ private static final String MODEL_NAME = "modelName";
+ private static final String MODEL_VERSION = "modelVersion";
+ private static final String MODEL_INVARIANT_UUID = "modelInvariantUUID";
+ private static final String MODEL_INSTANCE_NAME = "modelInstanceName";
+ private static final String VNF_RESOURCE_MODEL_UUID = "vnfResourceModelUUID";
+ private static final String NF_ROLE = "nfRole";
+ private static final String VF_MODULE_MODEL_UUID = "vfModuleModelUUID";
+ private static final String VNF_COMPONENT_TYPE = "vnfComponentType";
+ private static final String BUILDING_BLOCK_NAME = "buildingBlockName";
+ private static final String RESOURCE_TYPE = "resourceType";
+ private static final String ORCHESTRATION_STATUS = "orchestrationStatus";
+ private static final String TARGET_ACTION = "targetAction";
+ private static final String REQUEST_SCOPE = "requestScope";
+ private static final String IS_ALACARTE = "isALaCarte";
+ private static final String CLOUD_OWNER = "cloudOwner";
+ private static final String FLOW_NAME = "flowName";
+ private static final String SERVICE_TYPE = "serviceType";
+ private static final String VNF_TYPE = "vnfType";
+ private static final String ERROR_CODE = "errorCode";
+ private static final String WORK_STEP = "workStep";
+ private static final String CLLI = "clli";
+ private static final String CLOUD_VERSION = "cloudVersion";
+ private static final String HOMING_INSTANCE = "/homingInstance";
+
+ private static final String TARGET_ENTITY = "SO:CatalogDB";
+ private static final String ASTERISK = "*";
+
+ private String findExternalToInternalServiceByServiceName = "/findByServiceName";
+ private String findServiceByModelName = "/findOneByModelName";
+ private String findServiceRecipeByActionAndServiceModelUUID = "/findByActionAndServiceModelUUID";
+ private String findServiceByModelUUID = "/findOneByModelUUID";
+ private String findFirstByModelNameURI = "/findFirstByModelNameOrderByModelVersionDesc";
+ private String findFirstByServiceModelUUIDAndActionURI = "/findFirstByServiceModelUUIDAndAction";
+ private String findFirstByModelVersionAndModelInvariantUUIDURI = "/findFirstByModelVersionAndModelInvariantUUID";
+ private String findByModelInvariantUUIDURI = "/findByModelInvariantUUIDOrderByModelVersionDesc";
+ private String findFirstByModelNameAndAction = "/findFirstByModelNameAndAction";
+ private String findFirstResourceByModelInvariantUUIDAndModelVersion = "/findFirstResourceByModelInvariantUUIDAndModelVersion";
+ private String findByModelInstanceNameAndVnfResources = "/findByModelInstanceNameAndVnfResources";
+ private String findFirstVnfRecipeByNfRoleAndAction = "/findFirstVnfRecipeByNfRoleAndAction";
+ private String findByModelCustomizationUUIDAndVfModuleModelUUID = "/findByModelCustomizationUUIDAndVfModuleModelUUID";
+ private String findFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction = "/findFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction";
+ private String findFirstVnfComponentsRecipeByVnfComponentTypeAndAction = "/findFirstVnfComponentsRecipeByVnfComponentTypeAndAction";
+ private String findVfModuleByModelInvariantUUIDOrderByModelVersionDesc = "/findByModelInvariantUUIDOrderByModelVersionDesc";
+ private String findFirstVfModuleByModelInvariantUUIDAndModelVersion = "/findFirstVfModuleByModelInvariantUUIDAndModelVersion";
+ private String findOneByBuildingBlockName = "/findOneByBuildingBlockName";
+ private String findOneByResourceTypeAndOrchestrationStatusAndTargetAction = "/findOneByResourceTypeAndOrchestrationStatusAndTargetAction";
+ private String findByAction = "/findByAction";
+ private String findVnfcInstanceGroupCustomizationByModelCustomizationUUID = "/findByModelCustomizationUUID";
+ private String findCollectionResourceInstanceGroupCustomizationByModelCustomizationUUID = "/findByModelCustomizationUUID";
+ private String findOneByActionAndRequestScopeAndIsAlacarte = "/findOneByActionAndRequestScopeAndIsAlacarte";
+ private String findOneByActionAndRequestScopeAndIsAlacarteAndCloudOwner = "/findOneByActionAndRequestScopeAndIsAlacarteAndCloudOwner";
+ private String findOneByActionAndRequestScopeAndIsAlacarteAndCloudOwnerAndServiceType = "/findOneByActionAndRequestScopeAndIsAlacarteAndCloudOwnerAndServiceType";
+ private String findOneByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep = "/findOneByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep";
+ private String findByClliAndCloudVersion = "/findByClliAndCloudVersion";
+ private String findServiceByServiceInstanceId = "/findServiceByServiceInstanceId";
+
+
+ private String serviceURI;
+ private String vfModuleURI;
+ private String vnfResourceURI;
+ private String vfModuleCustomizationURI;
+ private String networkCollectionResourceCustomizationURI;
+ private String networkResourceCustomizationURI;
+ private String vnfResourceCustomizationURI;
+ private String collectionNetworkResourceCustomizationURI;
+ private String instanceGroupURI;
+ private String cloudifyManagerURI;
+ private String cloudSiteURI;
+ private String homingInstanceURI;
+ private String pnfResourceURI;
+ private String pnfResourceCustomizationURI;
+
+ private final Client<Service> serviceClient;
+
+ private final Client<NetworkRecipe> networkRecipeClient;
+
+ private final Client<NetworkResourceCustomization> networkResourceCustomizationClient;
+
+ private final Client<VnfResource> vnfResourceClient;
+
+ private final Client<VnfResourceCustomization> vnfResourceCustomizationClient;
+
+ private final Client<VnfRecipe> vnfRecipeClient;
+
+ private final Client<VfModuleCustomization> vfModuleCustomizationClient;
+
+ private final Client<VfModule> vfModuleClient;
+
+ private final Client<VnfComponentsRecipe> vnfComponentsRecipeClient;
+
+ private final Client<OrchestrationFlow> orchestrationClient;
+
+ private final Client<NorthBoundRequest> northBoundRequestClient;
+
+ private final Client<RainyDayHandlerStatus> rainyDayHandlerStatusClient;
+
+ private final Client<BuildingBlockDetail> buildingBlockDetailClient;
+
+ private final Client<OrchestrationStatusStateTransitionDirective> orchestrationStatusStateTransitionDirectiveClient;
+
+ private final Client<VnfcInstanceGroupCustomization> vnfcInstanceGroupCustomizationClient;
+
+ private final Client<CollectionResourceInstanceGroupCustomization> collectionResourceInstanceGroupCustomizationClient;
+
+ private final Client<InstanceGroup> instanceGroupClient;
+
+ private final Client<NetworkCollectionResourceCustomization> networkCollectionResourceCustomizationClient;
+
+ private final Client<CollectionNetworkResourceCustomization> collectionNetworkResourceCustomizationClient;
+
+ private final Client<ServiceRecipe> serviceRecipeClient;
+
+ private final Client<ExternalServiceToInternalService> externalServiceToInternalServiceClient;
+
+ private final Client<CloudSite> cloudSiteClient;
+
+ private final Client<HomingInstance> homingInstanceClient;
+
+ private final Client<CloudifyManager> cloudifyManagerClient;
+
+ private final Client<CvnfcCustomization> cvnfcCustomizationClient;
+
+ private final Client<ControllerSelectionReference> controllerSelectionReferenceClient;
+
+ private final Client<VnfVfmoduleCvnfcConfigurationCustomization> vnfVfmoduleCvnfcConfigurationCustomizationClient;
+
+ private final Client<PnfResource> pnfResourceClient;
+
+ private final Client<PnfResourceCustomization> pnfResourceCustomizationClient;
+
+ @Value("${mso.catalog.db.spring.endpoint}")
+ private String endpoint;
+
+ @Value("${mso.db.auth}")
+ private String msoAdaptersAuth;
+
+
+ @PostConstruct
+ public void init() {
+ findExternalToInternalServiceByServiceName =
+ endpoint + EXTERNAL_SERVICE_TO_INTERNAL_MODEL_MAPPING + SEARCH + findExternalToInternalServiceByServiceName;
+ findServiceByModelName = endpoint + SERVICE + SEARCH + findServiceByModelName;
+ findServiceRecipeByActionAndServiceModelUUID =
+ endpoint + SERVICE_RECIPE + SEARCH + findServiceRecipeByActionAndServiceModelUUID;
+ findServiceByModelUUID = endpoint + SERVICE + SEARCH + findServiceByModelUUID;
+ findFirstByModelNameURI = endpoint + SERVICE + SEARCH + findFirstByModelNameURI;
+ findFirstByModelVersionAndModelInvariantUUIDURI =
+ endpoint + SERVICE + SEARCH + findFirstByModelVersionAndModelInvariantUUIDURI;
+ findByModelInvariantUUIDURI = endpoint + SERVICE + SEARCH + findByModelInvariantUUIDURI;
+ findFirstByServiceModelUUIDAndActionURI =
+ endpoint + SERVICE_RECIPE + SEARCH + findFirstByServiceModelUUIDAndActionURI;
+ findFirstByModelNameAndAction = endpoint + NETWORK_RECIPE + SEARCH + findFirstByModelNameAndAction;
+ findFirstResourceByModelInvariantUUIDAndModelVersion =
+ endpoint + VNF_RESOURCE + SEARCH + findFirstResourceByModelInvariantUUIDAndModelVersion;
+ findByModelInstanceNameAndVnfResources =
+ endpoint + VNF_RESOURCE_CUSTOMIZATION + SEARCH + findByModelInstanceNameAndVnfResources;
+ findFirstVnfRecipeByNfRoleAndAction = endpoint + VNF_RECIPE + SEARCH + findFirstVnfRecipeByNfRoleAndAction;
+ findByModelCustomizationUUIDAndVfModuleModelUUID =
+ endpoint + VFMODULE_CUSTOMIZATION + SEARCH + findByModelCustomizationUUIDAndVfModuleModelUUID;
+ findFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction =
+ endpoint + VNF_COMPONENTS_RECIPE + SEARCH
+ + findFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction;
+ findFirstVnfComponentsRecipeByVnfComponentTypeAndAction =
+ endpoint + VNF_COMPONENTS_RECIPE + SEARCH + findFirstVnfComponentsRecipeByVnfComponentTypeAndAction;
+ findVfModuleByModelInvariantUUIDOrderByModelVersionDesc =
+ endpoint + VFMODULE + SEARCH + findVfModuleByModelInvariantUUIDOrderByModelVersionDesc;
+ findFirstVfModuleByModelInvariantUUIDAndModelVersion =
+ endpoint + VFMODULE + SEARCH + findFirstVfModuleByModelInvariantUUIDAndModelVersion;
+ findOneByBuildingBlockName = endpoint + BUILDING_BLOCK_DETAIL + SEARCH + findOneByBuildingBlockName;
+ findOneByResourceTypeAndOrchestrationStatusAndTargetAction =
+ endpoint + ORCHESTRATION_STATUS_STATE_TRANSITION_DIRECTIVE + SEARCH
+ + findOneByResourceTypeAndOrchestrationStatusAndTargetAction;
+ findByAction = endpoint + ORCHESTRATION_FLOW + SEARCH + findByAction;
+ findVnfcInstanceGroupCustomizationByModelCustomizationUUID =
+ endpoint + VNFC_INSTANCE_GROUP_CUSTOMIZATION + SEARCH
+ + findVnfcInstanceGroupCustomizationByModelCustomizationUUID;
+ findCollectionResourceInstanceGroupCustomizationByModelCustomizationUUID =
+ endpoint + COLLECTION_RESOURCE_INSTANCE_GROUP_CUSTOMIZATION + SEARCH
+ + findCollectionResourceInstanceGroupCustomizationByModelCustomizationUUID;
+ findOneByActionAndRequestScopeAndIsAlacarte =
+ endpoint + NORTHBOUND_REQUEST_REF_LOOKUP + SEARCH + findOneByActionAndRequestScopeAndIsAlacarte;
+ findOneByActionAndRequestScopeAndIsAlacarteAndCloudOwner = endpoint + NORTHBOUND_REQUEST_REF_LOOKUP + SEARCH
+ + findOneByActionAndRequestScopeAndIsAlacarteAndCloudOwner;
+ findOneByActionAndRequestScopeAndIsAlacarteAndCloudOwnerAndServiceType =
+ endpoint + NORTHBOUND_REQUEST_REF_LOOKUP + SEARCH
+ + findOneByActionAndRequestScopeAndIsAlacarteAndCloudOwnerAndServiceType;
+ findOneByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep = endpoint + RAINY_DAY_HANDLER_MACRO + SEARCH
+ + findOneByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep;
+ findByClliAndCloudVersion = endpoint + CLOUD_SITE + SEARCH + findByClliAndCloudVersion;
+
+ serviceURI = endpoint + SERVICE + URI_SEPARATOR;
+ vfModuleURI = endpoint + VFMODULE + URI_SEPARATOR;
+ vnfResourceURI = endpoint + VNF_RESOURCE + URI_SEPARATOR;
+ vfModuleCustomizationURI = endpoint + VFMODULE_CUSTOMIZATION + URI_SEPARATOR;
+ networkCollectionResourceCustomizationURI =
+ endpoint + NETWORK_COLLECTION_RESOURCE_CUSTOMIZATION + URI_SEPARATOR;
+ networkResourceCustomizationURI = endpoint + NETWORK_RESOURCE_CUSTOMIZATION + URI_SEPARATOR;
+ vnfResourceCustomizationURI = endpoint + VNF_RESOURCE_CUSTOMIZATION + URI_SEPARATOR;
+ collectionNetworkResourceCustomizationURI =
+ endpoint + COLLECTION_NETWORK_RESOURCE_CUSTOMIZATION + URI_SEPARATOR;
+ instanceGroupURI = endpoint + INSTANCE_GROUP + URI_SEPARATOR;
+ cloudifyManagerURI = endpoint + CLOUDIFY_MANAGER + URI_SEPARATOR;
+ cloudSiteURI = endpoint + CLOUD_SITE + URI_SEPARATOR;
+ homingInstanceURI = endpoint + HOMING_INSTANCE + URI_SEPARATOR;
+ pnfResourceURI = endpoint + PNF_RESOURCE + URI_SEPARATOR;
+ pnfResourceCustomizationURI = endpoint + PNF_RESOURCE_CUSTOMIZATION + URI_SEPARATOR;
+
+ }
+
+ public CatalogDbClient() {
+ ClientHttpRequestFactory factory = new BufferingClientHttpRequestFactory(
+ new HttpComponentsClientHttpRequestFactory());
+
+ ClientFactory clientFactory = Configuration.builder().setClientHttpRequestFactory(factory)
+ .setRestTemplateConfigurer(restTemplate -> {
+ restTemplate.getInterceptors().add((new SpringClientFilter()));
+
+ restTemplate.getInterceptors().add((request, body, execution) -> {
+
+ request.getHeaders().add(HttpHeaders.AUTHORIZATION, msoAdaptersAuth);
+ request.getHeaders().add(LogConstants.TARGET_ENTITY_HEADER, TARGET_ENTITY);
+ return execution.execute(request, body);
+ });
+ }).build().buildClientFactory();
+ serviceClient = clientFactory.create(Service.class);
+ networkRecipeClient = clientFactory.create(NetworkRecipe.class);
+ networkResourceCustomizationClient = clientFactory.create(NetworkResourceCustomization.class);
+ vnfResourceClient = clientFactory.create(VnfResource.class);
+ vnfResourceCustomizationClient = clientFactory.create(VnfResourceCustomization.class);
+ vnfRecipeClient = clientFactory.create(VnfRecipe.class);
+ orchestrationClient = clientFactory.create(OrchestrationFlow.class);
+ vfModuleCustomizationClient = clientFactory.create(VfModuleCustomization.class);
+ vfModuleClient = clientFactory.create(VfModule.class);
+ vnfComponentsRecipeClient = clientFactory.create(VnfComponentsRecipe.class);
+ northBoundRequestClient = clientFactory.create(NorthBoundRequest.class);
+ rainyDayHandlerStatusClient = clientFactory.create(RainyDayHandlerStatus.class);
+ buildingBlockDetailClient = clientFactory.create(BuildingBlockDetail.class);
+ orchestrationStatusStateTransitionDirectiveClient = clientFactory
+ .create(OrchestrationStatusStateTransitionDirective.class);
+ vnfcInstanceGroupCustomizationClient = clientFactory.create(VnfcInstanceGroupCustomization.class);
+ collectionResourceInstanceGroupCustomizationClient = clientFactory
+ .create(CollectionResourceInstanceGroupCustomization.class);
+ instanceGroupClient = clientFactory.create(InstanceGroup.class);
+ networkCollectionResourceCustomizationClient = clientFactory
+ .create(NetworkCollectionResourceCustomization.class);
+ collectionNetworkResourceCustomizationClient = clientFactory
+ .create(CollectionNetworkResourceCustomization.class);
+ cloudSiteClient = clientFactory.create(CloudSite.class);
+ homingInstanceClient = clientFactory.create(HomingInstance.class);
+ cloudifyManagerClient = clientFactory.create(CloudifyManager.class);
+ serviceRecipeClient = clientFactory.create(ServiceRecipe.class);
+ cvnfcCustomizationClient = clientFactory.create(CvnfcCustomization.class);
+ controllerSelectionReferenceClient = clientFactory.create(ControllerSelectionReference.class);
+ externalServiceToInternalServiceClient = clientFactory.create(ExternalServiceToInternalService.class);
+ vnfVfmoduleCvnfcConfigurationCustomizationClient = clientFactory.create(VnfVfmoduleCvnfcConfigurationCustomization.class);
+ pnfResourceClient = clientFactory.create(PnfResource.class);
+ pnfResourceCustomizationClient = clientFactory.create(PnfResourceCustomization.class);
+ }
+
+ public CatalogDbClient(String baseUri, String auth) {
+ ClientHttpRequestFactory factory = new BufferingClientHttpRequestFactory(
+ new HttpComponentsClientHttpRequestFactory());
+
+ ClientFactory clientFactory = Configuration.builder().setBaseUri(baseUri).setClientHttpRequestFactory(factory)
+ .setRestTemplateConfigurer(restTemplate -> {
+ restTemplate.getInterceptors().add((new SpringClientFilter()));
+
+ restTemplate.getInterceptors().add((request, body, execution) -> {
+
+ request.getHeaders().add(HttpHeaders.AUTHORIZATION, auth);
+ request.getHeaders().add(LogConstants.TARGET_ENTITY_HEADER, TARGET_ENTITY);
+ return execution.execute(request, body);
+ });
+ }).build().buildClientFactory();
+ serviceClient = clientFactory.create(Service.class);
+ networkRecipeClient = clientFactory.create(NetworkRecipe.class);
+ networkResourceCustomizationClient = clientFactory.create(NetworkResourceCustomization.class);
+ vnfResourceClient = clientFactory.create(VnfResource.class);
+ vnfResourceCustomizationClient = clientFactory.create(VnfResourceCustomization.class);
+ vnfRecipeClient = clientFactory.create(VnfRecipe.class);
+ orchestrationClient = clientFactory.create(OrchestrationFlow.class);
+ vfModuleCustomizationClient = clientFactory.create(VfModuleCustomization.class);
+ vfModuleClient = clientFactory.create(VfModule.class);
+ vnfComponentsRecipeClient = clientFactory.create(VnfComponentsRecipe.class);
+ northBoundRequestClient = clientFactory.create(NorthBoundRequest.class);
+ rainyDayHandlerStatusClient = clientFactory.create(RainyDayHandlerStatus.class);
+ buildingBlockDetailClient = clientFactory.create(BuildingBlockDetail.class);
+ orchestrationStatusStateTransitionDirectiveClient = clientFactory
+ .create(OrchestrationStatusStateTransitionDirective.class);
+ vnfcInstanceGroupCustomizationClient = clientFactory.create(VnfcInstanceGroupCustomization.class);
+ collectionResourceInstanceGroupCustomizationClient = clientFactory
+ .create(CollectionResourceInstanceGroupCustomization.class);
+ instanceGroupClient = clientFactory.create(InstanceGroup.class);
+ networkCollectionResourceCustomizationClient = clientFactory
+ .create(NetworkCollectionResourceCustomization.class);
+ collectionNetworkResourceCustomizationClient = clientFactory
+ .create(CollectionNetworkResourceCustomization.class);
+ cloudSiteClient = clientFactory.create(CloudSite.class);
+ homingInstanceClient = clientFactory.create(HomingInstance.class);
+ cloudifyManagerClient = clientFactory.create(CloudifyManager.class);
+ serviceRecipeClient = clientFactory.create(ServiceRecipe.class);
+ cvnfcCustomizationClient = clientFactory.create(CvnfcCustomization.class);
+ controllerSelectionReferenceClient = clientFactory.create(ControllerSelectionReference.class);
+ externalServiceToInternalServiceClient = clientFactory.create(ExternalServiceToInternalService.class);
+ vnfVfmoduleCvnfcConfigurationCustomizationClient = clientFactory.create(VnfVfmoduleCvnfcConfigurationCustomization.class);
+ pnfResourceClient = clientFactory.create(PnfResource.class);
+ pnfResourceCustomizationClient = clientFactory.create(PnfResourceCustomization.class);
+ }
+
+ public NetworkCollectionResourceCustomization getNetworkCollectionResourceCustomizationByID(
+ String modelCustomizationUUID) {
+ NetworkCollectionResourceCustomization networkCollectionResourceCustomization =
+ this.getSingleResource(networkCollectionResourceCustomizationClient,
+ getUri(networkCollectionResourceCustomizationURI + modelCustomizationUUID));
+ if (networkCollectionResourceCustomization != null) {
+ networkCollectionResourceCustomization.setModelCustomizationUUID(modelCustomizationUUID);
+ }
+ return networkCollectionResourceCustomization;
+ }
+
+ public Service getServiceByID(String modelUUID) {
+ Service service = getSingleResource(serviceClient, getUri(serviceURI + modelUUID));
+ if (service != null) {
+ service.setModelUUID(modelUUID);
+ }
+ return service;
+ }
+
+ public VfModule getVfModuleByModelUUID(String modelUUID) {
+ VfModule vfModule = getSingleResource(vfModuleClient, getUri(vfModuleURI + modelUUID));
+ if (vfModule != null) {
+ vfModule.setModelUUID(modelUUID);
+ }
+ return vfModule;
+ }
+
+ public VnfResource getVnfResourceByModelUUID(String modelUUID) {
+
+ VnfResource vnfResource = this.getSingleResource(vnfResourceClient, getUri(vnfResourceURI + modelUUID));
+ if (vnfResource != null) {
+ vnfResource.setModelUUID(modelUUID);
+ }
+ return vnfResource;
+ }
+
+ public VnfResourceCustomization getVnfResourceCustomizationByModelCustomizationUUID(String modelCustomizationUUID) {
+ VnfResourceCustomization vnfResourceCustomization = getSingleResource(vnfResourceCustomizationClient,
+ getUri(vnfResourceCustomizationURI + modelCustomizationUUID));
+ if (vnfResourceCustomization != null) {
+ vnfResourceCustomization.setModelCustomizationUUID(modelCustomizationUUID);
+ }
+ return vnfResourceCustomization;
+ }
+
+ public PnfResource getPnfResourceByModelUUID(String modelUUID) {
+ PnfResource PnfResource = this.getSingleResource(pnfResourceClient, getUri(pnfResourceURI + modelUUID));
+ if (PnfResource != null) {
+ PnfResource.setModelUUID(modelUUID);
+ }
+ return PnfResource;
+ }
+
+ public PnfResourceCustomization getPnfResourceCustomizationByModelCustomizationUUID(String modelCustomizationUUID) {
+ PnfResourceCustomization pnfResourceCustomization = getSingleResource(pnfResourceCustomizationClient,
+ getUri(pnfResourceCustomizationURI + modelCustomizationUUID));
+ if (pnfResourceCustomization != null) {
+ pnfResourceCustomization.setModelCustomizationUUID(modelCustomizationUUID);
+ }
+ return pnfResourceCustomization;
+ }
+
+ public CollectionNetworkResourceCustomization getCollectionNetworkResourceCustomizationByID(
+ String modelCustomizationUUID) {
+ CollectionNetworkResourceCustomization collectionNetworkResourceCustomization =
+ this.getSingleResource(collectionNetworkResourceCustomizationClient, getUri(UriBuilder
+ .fromUri(collectionNetworkResourceCustomizationURI + modelCustomizationUUID).build().toString()));
+ if (collectionNetworkResourceCustomization != null) {
+ collectionNetworkResourceCustomization.setModelCustomizationUUID(modelCustomizationUUID);
+ }
+ return collectionNetworkResourceCustomization;
+ }
+
+ public InstanceGroup getInstanceGroupByModelUUID(String modelUUID) {
+ InstanceGroup instanceGroup = this.getSingleResource(instanceGroupClient, getUri(instanceGroupURI + modelUUID));
+ if (instanceGroup != null) {
+ instanceGroup.setModelUUID(modelUUID);
+ }
+ return instanceGroup;
+ }
+
+ public VfModuleCustomization getVfModuleCustomizationByModelCuztomizationUUID(String modelCustomizationUUID) {
+ VfModuleCustomization vfModuleCust = this
+ .getSingleResource(vfModuleCustomizationClient, getUri(vfModuleCustomizationURI + modelCustomizationUUID));
+ if (vfModuleCust != null) {
+ vfModuleCust.setModelCustomizationUUID(modelCustomizationUUID);
+ }
+ return vfModuleCust;
+ }
+
+ public NetworkResourceCustomization getNetworkResourceCustomizationByModelCustomizationUUID(
+ String modelCustomizationUUID) {
+ NetworkResourceCustomization networkResourceCustomization =
+ this.getSingleResource(networkResourceCustomizationClient,
+ getUri(networkResourceCustomizationURI + modelCustomizationUUID));
+ if (networkResourceCustomization != null) {
+ networkResourceCustomization.setModelCustomizationUUID(modelCustomizationUUID);
+ }
+ return networkResourceCustomization;
+ }
+
+ public BuildingBlockDetail getBuildingBlockDetail(String buildingBlockName) {
+ BuildingBlockDetail buildingBlockDetail = getSingleResource(buildingBlockDetailClient, getUri(UriBuilder
+ .fromUri(findOneByBuildingBlockName).queryParam(BUILDING_BLOCK_NAME, buildingBlockName).build()
+ .toString()));
+ if (buildingBlockDetail != null) {
+ buildingBlockDetail.setBuildingBlockName(buildingBlockName);
+ }
+ return buildingBlockDetail;
+ }
+
+
+ public OrchestrationStatusStateTransitionDirective getOrchestrationStatusStateTransitionDirective(
+ ResourceType resourceType, OrchestrationStatus orchestrationStatus, OrchestrationAction targetAction) {
+ return getSingleResource(orchestrationStatusStateTransitionDirectiveClient, UriBuilder
+ .fromUri(findOneByResourceTypeAndOrchestrationStatusAndTargetAction)
+ .queryParam(RESOURCE_TYPE, resourceType.name())
+ .queryParam(ORCHESTRATION_STATUS, orchestrationStatus.name())
+ .queryParam(TARGET_ACTION, targetAction.name()).build());
+ }
+
+ public List<OrchestrationFlow> getOrchestrationFlowByAction(String action) {
+ return this.getMultipleResources(orchestrationClient, UriBuilder
+ .fromUri(findByAction).queryParam(ACTION, action).build());
+ }
+
+ public List<VnfcInstanceGroupCustomization> getVnfcInstanceGroupsByVnfResourceCust(String modelCustomizationUUID) {
+ return this.getMultipleResources(vnfcInstanceGroupCustomizationClient, UriBuilder
+ .fromUri(findVnfcInstanceGroupCustomizationByModelCustomizationUUID)
+ .queryParam(MODEL_CUSTOMIZATION_UUID, modelCustomizationUUID).build());
+ }
+
+ public List<CollectionResourceInstanceGroupCustomization> getCollectionResourceInstanceGroupCustomizationByModelCustUUID(
+ String modelCustomizationUUID) {
+ return this.getMultipleResources(collectionResourceInstanceGroupCustomizationClient, UriBuilder
+ .fromUri(findCollectionResourceInstanceGroupCustomizationByModelCustomizationUUID)
+ .queryParam(MODEL_CUSTOMIZATION_UUID, modelCustomizationUUID).build());
+ }
+
+ public VfModuleCustomization getVfModuleCustomizationByModelCustomizationUUIDAndVfModuleModelUUID(
+ String modelCustomizationUUID, String vfModuleModelUUID) {
+ return this.getSingleResource(vfModuleCustomizationClient, getUri(UriBuilder
+ .fromUri(findByModelCustomizationUUIDAndVfModuleModelUUID)
+ .queryParam(MODEL_CUSTOMIZATION_UUID, modelCustomizationUUID)
+ .queryParam(VF_MODULE_MODEL_UUID, vfModuleModelUUID).build().toString()));
+ }
+
+ public NorthBoundRequest getNorthBoundRequestByActionAndIsALaCarteAndRequestScope(String requestAction,
+ String resourceName, boolean aLaCarte) {
+ return this.getSingleResource(northBoundRequestClient, UriBuilder
+ .fromUri(findOneByActionAndRequestScopeAndIsAlacarte)
+ .queryParam(ACTION, requestAction).queryParam(REQUEST_SCOPE, resourceName)
+ .queryParam(IS_ALACARTE, aLaCarte).build());
+ }
+
+ public NorthBoundRequest getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(String requestAction,
+ String resourceName, boolean aLaCarte, String cloudOwner) {
+ return this.getSingleResource(northBoundRequestClient, getUri(UriBuilder
+ .fromUri(findOneByActionAndRequestScopeAndIsAlacarteAndCloudOwnerAndServiceType)
+ .queryParam(ACTION, requestAction).queryParam(REQUEST_SCOPE, resourceName)
+ .queryParam(IS_ALACARTE, aLaCarte)
+ .queryParam(CLOUD_OWNER, cloudOwner)
+ .queryParam(SERVICE_TYPE, ASTERISK).build().toString()));
+ }
+
+ public NorthBoundRequest getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwnerAndServiceType(
+ String requestAction,
+ String resourceName, boolean aLaCarte, String cloudOwner, String serviceType) {
+ return this.getSingleResource(northBoundRequestClient, getUri(UriBuilder
+ .fromUri(findOneByActionAndRequestScopeAndIsAlacarteAndCloudOwnerAndServiceType)
+ .queryParam(ACTION, requestAction).queryParam(REQUEST_SCOPE, resourceName)
+ .queryParam(IS_ALACARTE, aLaCarte)
+ .queryParam(CLOUD_OWNER, cloudOwner)
+ .queryParam(SERVICE_TYPE, serviceType).build().toString()));
+ }
+
+ public RainyDayHandlerStatus getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(
+ String flowName, String serviceType, String vnfType, String errorCode, String workStep) {
+ return this.getSingleResource(rainyDayHandlerStatusClient, getUri(UriBuilder
+ .fromUri(findOneByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep)
+ .queryParam(FLOW_NAME, flowName).queryParam(SERVICE_TYPE, serviceType)
+ .queryParam(VNF_TYPE, vnfType).queryParam(ERROR_CODE, errorCode).queryParam(WORK_STEP, workStep)
+ .build().toString()));
+ }
+
+ public ServiceRecipe getFirstByServiceModelUUIDAndAction(String modelUUID, String action) {
+ return this.getSingleResource(serviceRecipeClient, getUri(UriBuilder
+ .fromUri(findFirstByServiceModelUUIDAndActionURI)
+ .queryParam(SERVICE_MODEL_UUID, modelUUID)
+ .queryParam(ACTION, action).build().toString()));
+ }
+
+ public NetworkRecipe getFirstNetworkRecipeByModelNameAndAction(String modelName, String action) {
+ return this.getSingleResource(networkRecipeClient, UriBuilder
+ .fromUri(findFirstByModelNameAndAction)
+ .queryParam(MODEL_NAME, modelName)
+ .queryParam(ACTION, action).build());
+ }
+
+ public ControllerSelectionReference getControllerSelectionReferenceByVnfTypeAndActionCategory(String vnfType,
+ String actionCategory) {
+ return this.getSingleResource(controllerSelectionReferenceClient, UriBuilder
+ .fromUri(endpoint
+ + "/controllerSelectionReference/search/findControllerSelectionReferenceByVnfTypeAndActionCategory")
+ .queryParam("VNF_TYPE", vnfType).queryParam("ACTION_CATEGORY", actionCategory).build());
+ }
+
+ public Service getFirstByModelNameOrderByModelVersionDesc(String modelName) {
+ return this.getSingleResource(serviceClient, UriBuilder
+ .fromUri(findFirstByModelNameURI)
+ .queryParam(MODEL_NAME, modelName).build());
+ }
+
+ public ExternalServiceToInternalService findExternalToInternalServiceByServiceName(String serviceName) {
+ return this.getSingleResource(externalServiceToInternalServiceClient, getUri(UriBuilder
+ .fromUri(findExternalToInternalServiceByServiceName)
+ .queryParam(SERVICE_NAME, serviceName).build().toString()));
+ }
+
+ public ServiceRecipe findServiceRecipeByActionAndServiceModelUUID(String action, String modelUUID) {
+ return this.getSingleResource(serviceRecipeClient, getUri(UriBuilder
+ .fromUri(findServiceRecipeByActionAndServiceModelUUID)
+ .queryParam(ACTION, action)
+ .queryParam(SERVICE_MODEL_UUID, modelUUID).build().toString()));
+ }
+
+ public Service getServiceByModelName(String modelName) {
+ return this.getSingleResource(serviceClient, getUri(UriBuilder
+ .fromUri(findServiceByModelName)
+ .queryParam(MODEL_NAME, modelName).build().toString()));
+ }
+
+ public Service getServiceByModelUUID(String modelModelUUID) {
+ return this.getSingleResource(serviceClient, getUri(UriBuilder
+ .fromUri(findServiceByModelUUID)
+ .queryParam(MODEL_UUID, modelModelUUID).build().toString()));
+ }
+
+ public VnfResource getFirstVnfResourceByModelInvariantUUIDAndModelVersion(String modelInvariantUUID,
+ String modelVersion) {
+ return this.getSingleResource(vnfResourceClient, getUri(UriBuilder
+ .fromUri(findFirstResourceByModelInvariantUUIDAndModelVersion)
+ .queryParam(MODEL_INVARIANT_UUID, modelInvariantUUID)
+ .queryParam(MODEL_VERSION, modelVersion).build().toString()));
+ }
+
+
+ public VnfResourceCustomization getFirstVnfResourceCustomizationByModelInstanceNameAndVnfResources(
+ String modelInstanceName, VnfResource vnfResource) {
+ return this.getSingleResource(vnfResourceCustomizationClient, getUri(UriBuilder
+ .fromUri(findByModelInstanceNameAndVnfResources)
+ .queryParam(MODEL_INSTANCE_NAME, modelInstanceName)
+ .queryParam(VNF_RESOURCE_MODEL_UUID, vnfResource.getModelUUID()).build().toString()));
+ }
+
+ public VnfRecipe getFirstVnfRecipeByNfRoleAndAction(String nfRole, String action) {
+ return this.getSingleResource(vnfRecipeClient, getUri(UriBuilder
+ .fromUri(findFirstVnfRecipeByNfRoleAndAction)
+ .queryParam(NF_ROLE, nfRole)
+ .queryParam(ACTION, action).build().toString()));
+ }
+
+ public VnfComponentsRecipe getFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction(
+ String vfModuleModelUUID, String vnfComponentType, String action) {
+ return this.getSingleResource(vnfComponentsRecipeClient, getUri(UriBuilder
+ .fromUri(findFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction)
+ .queryParam(VF_MODULE_MODEL_UUID, vfModuleModelUUID)
+ .queryParam(VNF_COMPONENT_TYPE, vnfComponentType)
+ .queryParam(ACTION, action).build().toString()));
+ }
+
+ public VnfComponentsRecipe getFirstVnfComponentsRecipeByVnfComponentTypeAndAction(String vnfComponentType,
+ String action) {
+ return this.getSingleResource(vnfComponentsRecipeClient, getUri(UriBuilder
+ .fromUri(findFirstVnfComponentsRecipeByVnfComponentTypeAndAction)
+ .queryParam(VNF_COMPONENT_TYPE, vnfComponentType)
+ .queryParam(ACTION, action).build().toString()));
+ }
+
+ protected URI getUri(String template) {
+ return URI.create(template);
+ }
+
+ public CloudifyManager getCloudifyManager(String id) {
+ return this.getSingleResource(cloudifyManagerClient, getUri(cloudifyManagerURI + id));
+ }
+
+ public CloudSite getCloudSite(String id) {
+ return this.getSingleResource(cloudSiteClient,
+ getUri(cloudSiteURI + id));
+ }
+
+ public CloudSite getCloudSite(String id, String uri) {
+ return this.getSingleResource(cloudSiteClient,
+ getUri(uri + id));
+ }
+
+ public void postCloudSite(CloudSite cloudSite) {
+ this.postSingleResource(cloudSiteClient, cloudSite);
+ }
+
+ public CloudSite getCloudSiteByClliAndAicVersion(String clli, String cloudVersion) {
+ return this.getSingleResource(cloudSiteClient, getUri(UriBuilder
+ .fromUri(findByClliAndCloudVersion)
+ .queryParam(CLLI, clli).queryParam(CLOUD_VERSION, cloudVersion).build().toString()));
+ }
+
+ public HomingInstance getHomingInstance(String serviceInstanceId) {
+ return this.getSingleResource(homingInstanceClient,
+ getUri(homingInstanceURI + serviceInstanceId));
+ }
+
+ public HomingInstance getHomingInstance(String serviceInstanceId, String uri) {
+ return this.getSingleResource(homingInstanceClient,
+ getUri(uri + serviceInstanceId));
+ }
+
+ public void postHomingInstance(HomingInstance homingInstance) {
+ this.postSingleResource(homingInstanceClient, homingInstance);
+ }
+
+ public Service getServiceByModelVersionAndModelInvariantUUID(String modelVersion, String modelInvariantUUID) {
+ return this.getSingleResource(serviceClient, getUri(UriBuilder
+ .fromUri(findFirstByModelVersionAndModelInvariantUUIDURI)
+ .queryParam(MODEL_VERSION, modelVersion)
+ .queryParam(MODEL_INVARIANT_UUID, modelInvariantUUID).build().toString()));
+ }
+
+ public VfModule getVfModuleByModelInvariantUUIDAndModelVersion(String modelInvariantUUID, String modelVersion) {
+ return this.getSingleResource(vfModuleClient, getUri(UriBuilder
+ .fromUri(findFirstVfModuleByModelInvariantUUIDAndModelVersion)
+ .queryParam(MODEL_INVARIANT_UUID, modelInvariantUUID)
+ .queryParam(MODEL_VERSION, modelVersion).build().toString()));
+ }
+
+ public List<Service> getServiceByModelInvariantUUIDOrderByModelVersionDesc(String modelInvariantUUID) {
+ return this.getMultipleResources(serviceClient, getUri(UriBuilder
+ .fromUri(findByModelInvariantUUIDURI)
+ .queryParam(MODEL_INVARIANT_UUID, modelInvariantUUID).build().toString()));
+ }
+
+ public List<VfModule> getVfModuleByModelInvariantUUIDOrderByModelVersionDesc(String modelInvariantUUID) {
+ return this.getMultipleResources(vfModuleClient, getUri(UriBuilder
+ .fromUri(findVfModuleByModelInvariantUUIDOrderByModelVersionDesc)
+ .queryParam(MODEL_INVARIANT_UUID, modelInvariantUUID).build().toString()));
+ }
+
+ private <T> T getSingleResource(Client<T> client, URI uri) {
+ return client.get(uri);
+ }
+
+ private <T> List<T> getMultipleResources(Client<T> client, URI uri) {
+ Iterable<T> iterator = client.getAll(uri);
+ List<T> list = new ArrayList<>();
+ Iterator<T> it = iterator.iterator();
+ it.forEachRemaining(list::add);
+ return list;
+ }
+
+ private <T> URI postSingleResource(Client<T> client, T type) {
+ return client.post(type);
+ }
+
+ public List<CvnfcCustomization> getCvnfcCustomizationByVnfCustomizationUUIDAndVfModuleCustomizationUUID(
+ String vnfCustomizationUUID, String vfModuleCustomizationUUID) {
+
+ return this.getMultipleResources(cvnfcCustomizationClient, getUri(UriBuilder
+ .fromUri(endpoint + "/cvnfcCustomization/search/findByVnfResourceCustomizationAndVfModuleCustomization")
+ .queryParam("VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID", vnfCustomizationUUID)
+ .queryParam("VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID", vfModuleCustomizationUUID).build().toString()));
+ }
+
+ public VnfVfmoduleCvnfcConfigurationCustomization getVnfVfmoduleCvnfcConfigurationCustomizationByVnfCustomizationUuidAndVfModuleCustomizationUuidAndCvnfcCustomizationUuid(String vnfCustomizationUuid,
+ String vfModuleCustomizationUuid, String cvnfcCustomizationUuid) {
+ return this.getSingleResource(vnfVfmoduleCvnfcConfigurationCustomizationClient, getUri(UriBuilder
+ .fromUri(endpoint + "/vnfVfmoduleCvnfcConfigurationCustomization/search/findOneByVnfResourceCustomizationAndVfModuleCustomizationAndCvnfcCustomization")
+ .queryParam("VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID", vnfCustomizationUuid)
+ .queryParam("VF_MODULE_MODEL_CUSTOMIZATION_UUID", vfModuleCustomizationUuid)
+ .queryParam("CVNFC_MODEL_CUSTOMIZATION_UUID", cvnfcCustomizationUuid).build().toString()));
+ }
}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/PnfCustomizationRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/PnfCustomizationRepository.java
new file mode 100644
index 0000000000..8252b2427e
--- /dev/null
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/PnfCustomizationRepository.java
@@ -0,0 +1,32 @@
+/*
+ * ============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.so.db.catalog.data.repository;
+
+import org.onap.so.db.catalog.beans.PnfResourceCustomization;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.data.rest.core.annotation.RepositoryRestResource;
+
+import java.util.List;
+
+@RepositoryRestResource(collectionResourceRel = "pnfResourceCustomization", path = "pnfResourceCustomization")
+public interface PnfCustomizationRepository extends JpaRepository<PnfResourceCustomization, String> {
+
+} \ No newline at end of file
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/PnfResourceRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/PnfResourceRepository.java
new file mode 100644
index 0000000000..bf8e83bbac
--- /dev/null
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/PnfResourceRepository.java
@@ -0,0 +1,29 @@
+/*
+ * ============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.so.db.catalog.data.repository;
+
+import org.onap.so.db.catalog.beans.PnfResource;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.rest.core.annotation.RepositoryRestResource;
+
+@RepositoryRestResource(collectionResourceRel = "pnfResource", path = "pnfResource")
+public interface PnfResourceRepository extends JpaRepository<PnfResource, String> {
+
+} \ No newline at end of file
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfVfmoduleCvnfcConfigurationCustomizationRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfVfmoduleCvnfcConfigurationCustomizationRepository.java
index f936933485..aad75a15be 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfVfmoduleCvnfcConfigurationCustomizationRepository.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfVfmoduleCvnfcConfigurationCustomizationRepository.java
@@ -24,9 +24,17 @@ import java.util.List;
import org.onap.so.db.catalog.beans.VnfVfmoduleCvnfcConfigurationCustomization;
import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.data.repository.query.Param;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
@RepositoryRestResource(collectionResourceRel = "vnfVfmoduleCvnfcConfigurationCustomization", path = "vnfVfmoduleCvnfcConfigurationCustomization")
public interface VnfVfmoduleCvnfcConfigurationCustomizationRepository extends JpaRepository<VnfVfmoduleCvnfcConfigurationCustomization, Integer> {
List<VnfVfmoduleCvnfcConfigurationCustomization> findByModelCustomizationUUID(String modelCustomizationUUID);
+
+ @Query(value = "SELECT * FROM vnf_vfmodule_cvnfc_configuration_customization WHERE VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID = ?1 AND VF_MODULE_MODEL_CUSTOMIZATION_UUID = ?2 AND CVNFC_MODEL_CUSTOMIZATION_UUID = ?3", nativeQuery = true)
+ VnfVfmoduleCvnfcConfigurationCustomization findOneByVnfResourceCustomizationAndVfModuleCustomizationAndCvnfcCustomization (
+ @Param("VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID") String vnfResourceCustomizationUuid,
+ @Param("VF_MODULE_MODEL_CUSTOMIZATION_UUID") String vfModuleCustomizationUuid,
+ @Param("CVNFC_MODEL_CUSTOMIZATION_UUID") String cvnfcCustomizationUuid);
} \ No newline at end of file
diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/ServiceTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/ServiceTest.java
index ffa56a9ce3..7028d9161c 100644
--- a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/ServiceTest.java
+++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/ServiceTest.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.
@@ -21,11 +21,14 @@
package org.onap.so.db.catalog;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
import java.util.List;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.onap.so.db.catalog.beans.PnfResource;
+import org.onap.so.db.catalog.beans.PnfResourceCustomization;
import org.onap.so.db.catalog.beans.Service;
import org.onap.so.db.catalog.data.repository.ServiceRepository;
import org.springframework.beans.factory.annotation.Autowired;
@@ -37,42 +40,62 @@ import org.springframework.test.context.junit4.SpringRunner;
@SpringBootTest(classes = TestApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@ActiveProfiles("test")
public class ServiceTest {
- @Autowired
- private ServiceRepository serviceRepo;
- @Test
- public void Find_LatestService_Test() {
- Service latestVersionService = serviceRepo.findFirstByModelNameOrderByModelVersionDesc("MSOTADevInfra_vSAMP10a_Service");
- assertEquals("5df8b6de-2083-11e7-93ae-92361f002675",latestVersionService.getModelUUID());
- }
+ @Autowired
+ private ServiceRepository serviceRepo;
+ @Test
+ public void Find_LatestService_Test() {
+ Service latestVersionService = serviceRepo
+ .findFirstByModelNameOrderByModelVersionDesc("MSOTADevInfra_vSAMP10a_Service");
+ assertEquals("5df8b6de-2083-11e7-93ae-92361f002675", latestVersionService.getModelUUID());
+ }
- @Test
- public void Find_LatestService_Test_2() {
- Service latestVersionService = serviceRepo.findByModelNameOrderByModelVersionDesc("MSOTADevInfra_vSAMP10a_Service");
- assertEquals("5df8b6de-2083-11e7-93ae-92361f002675",latestVersionService.getModelUUID());
- }
+ @Test
+ public void Find_LatestService_Test_2() {
+ Service latestVersionService = serviceRepo
+ .findByModelNameOrderByModelVersionDesc("MSOTADevInfra_vSAMP10a_Service");
+ assertEquals("5df8b6de-2083-11e7-93ae-92361f002675", latestVersionService.getModelUUID());
+ }
- @Test
- public void Find_LatestService_Test_Invariant_UUID() {
- List<Service> latestVersionService = serviceRepo.findByModelInvariantUUIDOrderByModelVersionDesc("9647dfc4-2083-11e7-93ae-92361f002671");
- assertEquals("5df8b6de-2083-11e7-93ae-92361f002675",latestVersionService.get(0).getModelUUID());
- assertEquals("5df8b6de-2083-11e7-93ae-92361f002674",latestVersionService.get(1).getModelUUID());
- assertEquals("5df8b6de-2083-11e7-93ae-92361f002673",latestVersionService.get(2).getModelUUID());
- assertEquals("5df8b6de-2083-11e7-93ae-92361f002672",latestVersionService.get(3).getModelUUID());
- assertEquals("5df8b6de-2083-11e7-93ae-92361f002671",latestVersionService.get(4).getModelUUID());
- }
+ @Test
+ public void Find_LatestService_Test_Invariant_UUID() {
+ List<Service> latestVersionService = serviceRepo
+ .findByModelInvariantUUIDOrderByModelVersionDesc("9647dfc4-2083-11e7-93ae-92361f002671");
+ assertEquals("5df8b6de-2083-11e7-93ae-92361f002675", latestVersionService.get(0).getModelUUID());
+ assertEquals("5df8b6de-2083-11e7-93ae-92361f002674", latestVersionService.get(1).getModelUUID());
+ assertEquals("5df8b6de-2083-11e7-93ae-92361f002673", latestVersionService.get(2).getModelUUID());
+ assertEquals("5df8b6de-2083-11e7-93ae-92361f002672", latestVersionService.get(3).getModelUUID());
+ assertEquals("5df8b6de-2083-11e7-93ae-92361f002671", latestVersionService.get(4).getModelUUID());
+ }
- @Test
- public void Find_LatestService_Test_4() {
- Service latestVersionService = serviceRepo.findOneByModelUUIDOrderByModelVersionDesc("5df8b6de-2083-11e7-93ae-92361f002671");
- assertEquals("5df8b6de-2083-11e7-93ae-92361f002671",latestVersionService.getModelUUID());
- }
+ @Test
+ public void Find_LatestService_Test_4() {
+ Service latestVersionService = serviceRepo
+ .findOneByModelUUIDOrderByModelVersionDesc("5df8b6de-2083-11e7-93ae-92361f002671");
+ assertEquals("5df8b6de-2083-11e7-93ae-92361f002671", latestVersionService.getModelUUID());
+ }
- @Test
- public void Find_LatestService_Test_5() {
- Service latestVersionService = serviceRepo.findFirstByModelInvariantUUIDOrderByModelVersionDesc("9647dfc4-2083-11e7-93ae-92361f002671");
- assertEquals("5df8b6de-2083-11e7-93ae-92361f002675",latestVersionService.getModelUUID());
- }
+ @Test
+ public void Find_LatestService_Test_5() {
+ Service latestVersionService = serviceRepo
+ .findFirstByModelInvariantUUIDOrderByModelVersionDesc("9647dfc4-2083-11e7-93ae-92361f002671");
+ assertEquals("5df8b6de-2083-11e7-93ae-92361f002675", latestVersionService.getModelUUID());
+ }
+
+
+ @Test
+ public void findByModelNameOrderByModelVersionDesc_ValidModelName_ExpectedOutput() {
+ Service latestVersionService = serviceRepo.findByModelNameOrderByModelVersionDesc("PNF_routing_service");
+ assertEquals("5df8b6de-2083-11e7-93ae-92361f002676", latestVersionService.getModelUUID());
+ }
+
+ @Test
+ public void findByModelInvariantUUIDOrderByModelVersionDesc_ValidInvariantUuid_ExpectedOutput() {
+ List<Service> services = serviceRepo
+ .findByModelInvariantUUIDOrderByModelVersionDesc("9647dfc4-2083-11e7-93ae-92361f002676");
+ assertEquals("One PNF service found", 1, services.size());
+ assertEquals("5df8b6de-2083-11e7-93ae-92361f002676", services.get(0).getModelUUID());
+ }
}
diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/PnfCustomizationRepositoryTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/PnfCustomizationRepositoryTest.java
new file mode 100644
index 0000000000..c5e95fcfbc
--- /dev/null
+++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/PnfCustomizationRepositoryTest.java
@@ -0,0 +1,62 @@
+/*
+ * ============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.so.db.catalog.data.repository;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+
+import org.junit.Test;
+import org.onap.so.db.catalog.BaseTest;
+import org.onap.so.db.catalog.beans.PnfResource;
+import org.onap.so.db.catalog.beans.PnfResourceCustomization;
+import org.onap.so.db.catalog.exceptions.NoEntityFoundException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.util.CollectionUtils;
+
+import java.util.List;
+
+public class PnfCustomizationRepositoryTest extends BaseTest {
+
+ @Autowired
+ private PnfCustomizationRepository pnfCustomizationRepository;
+
+ @Test
+ public void findById_ValidUuid_ExpectedOutput() throws Exception {
+ PnfResourceCustomization pnfResourceCustomization = pnfCustomizationRepository
+ .findById("68dc9a92-214c-11e7-93ae-92361f002680")
+ .orElseThrow(() -> new NoEntityFoundException("Cannot Find Operation"));
+ checkPnfResourceCustomization(pnfResourceCustomization);
+ }
+
+ private void checkPnfResourceCustomization(PnfResourceCustomization pnfResourceCustomization) {
+ assertEquals("modelInstanceName", "PNF routing", pnfResourceCustomization.getModelInstanceName());
+ assertEquals("blueprintName", "test_configuration_restconf", pnfResourceCustomization.getBlueprintName());
+ assertEquals("blueprintVersion", "1.0.0", pnfResourceCustomization.getBlueprintVersion());
+ PnfResource pnfResource = pnfResourceCustomization.getPnfResources();
+ assertNotNull(pnfResource);
+
+ assertEquals("PNFResource modelUUID", "ff2ae348-214a-11e7-93ae-92361f002680", pnfResource.getModelUUID());
+ assertEquals("PNFResource modelInvariantUUID", "2fff5b20-214b-11e7-93ae-92361f002680",
+ pnfResource.getModelInvariantUUID());
+ assertEquals("PNFResource modelVersion", "1.0", pnfResource.getModelVersion());
+ assertEquals("PNFResource orchestration mode", "", pnfResource.getOrchestrationMode());
+ }
+}
diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/PnfResourceRepositoryTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/PnfResourceRepositoryTest.java
new file mode 100644
index 0000000000..4dde3b25df
--- /dev/null
+++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/PnfResourceRepositoryTest.java
@@ -0,0 +1,50 @@
+/*
+ * ============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.so.db.catalog.data.repository;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+import org.onap.so.db.catalog.BaseTest;
+import org.onap.so.db.catalog.beans.PnfResource;
+import org.onap.so.db.catalog.exceptions.NoEntityFoundException;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public class PnfResourceRepositoryTest extends BaseTest {
+
+ @Autowired
+ private PnfResourceRepository pnfResourceRepository;
+
+ @Test
+ public void findResourceById_validUuid_expectedOutput() throws Exception {
+
+ PnfResource pnfResource = pnfResourceRepository.findById("ff2ae348-214a-11e7-93ae-92361f002680")
+ .orElseThrow(() -> new NoEntityFoundException("Cannot Find Entity"));
+ checkPnfResource(pnfResource);
+ }
+
+ private void checkPnfResource(PnfResource pnfResource) {
+ assertEquals("PNFResource modelUUID", "ff2ae348-214a-11e7-93ae-92361f002680", pnfResource.getModelUUID());
+ assertEquals("PNFResource modelInvariantUUID", "2fff5b20-214b-11e7-93ae-92361f002680",
+ pnfResource.getModelInvariantUUID());
+ assertEquals("PNFResource modelVersion", "1.0", pnfResource.getModelVersion());
+ assertEquals("PNFResource orchestration mode", "", pnfResource.getOrchestrationMode());
+ }
+} \ No newline at end of file
diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/VnfCustomizationRepositoryTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/VnfCustomizationRepositoryTest.java
new file mode 100644
index 0000000000..8e2e1e0446
--- /dev/null
+++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/VnfCustomizationRepositoryTest.java
@@ -0,0 +1,78 @@
+/*
+ * ============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.so.db.catalog.data.repository;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+
+import org.junit.Test;
+import org.onap.so.db.catalog.BaseTest;
+import org.onap.so.db.catalog.beans.VnfResource;
+import org.onap.so.db.catalog.beans.VnfResourceCustomization;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.util.CollectionUtils;
+
+import java.util.List;
+
+
+public class VnfCustomizationRepositoryTest extends BaseTest {
+
+ @Autowired
+ private VnfCustomizationRepository vnfCustomizationRepository;
+
+ @Test
+ public void findByModelCustomizationUUID_ValidUuid_ExpectedOutput() throws Exception {
+ List<VnfResourceCustomization> vnfCustomizationList = vnfCustomizationRepository
+ .findByModelCustomizationUUID("68dc9a92-214c-11e7-93ae-92361f002671");
+ assertFalse(CollectionUtils.isEmpty(vnfCustomizationList));
+ assertEquals("output contains one entity", 1, vnfCustomizationList.size());
+
+ checkVnfResourceCustomization(vnfCustomizationList.get(0));
+ }
+
+ @Test
+ public void findOneByModelCustomizationUUID_ValidUuid_ExpectedOutput() throws Exception {
+ VnfResourceCustomization vnfResourceCustomization = vnfCustomizationRepository
+ .findOneByModelCustomizationUUID("68dc9a92-214c-11e7-93ae-92361f002671");
+ checkVnfResourceCustomization(vnfResourceCustomization);
+ }
+
+ @Test
+ public void findByModelInstanceNameAndVnfResources_ValidNameAndUuid_ExpectedOutput() throws Exception {
+ VnfResourceCustomization vnfResourceCustomization = vnfCustomizationRepository
+ .findByModelInstanceNameAndVnfResources("vSAMP10a 1", "ff2ae348-214a-11e7-93ae-92361f002671");
+ checkVnfResourceCustomization(vnfResourceCustomization);
+ }
+
+ private void checkVnfResourceCustomization(VnfResourceCustomization vnfResourceCustomization) {
+ assertEquals("modelInstanceName", "vSAMP10a 1", vnfResourceCustomization.getModelInstanceName());
+ assertEquals("blueprintName", "test_configuration_restconf", vnfResourceCustomization.getBlueprintName());
+ assertEquals("blueprintVersion", "1.0.0", vnfResourceCustomization.getBlueprintVersion());
+ VnfResource vnfResource = vnfResourceCustomization.getVnfResources();
+ assertNotNull(vnfResource);
+
+ assertEquals("VNFResource modelUUID", "ff2ae348-214a-11e7-93ae-92361f002671", vnfResource.getModelUUID());
+ assertEquals("VNFResource modelInvariantUUID", "2fff5b20-214b-11e7-93ae-92361f002671",
+ vnfResource.getModelInvariantUUID());
+ assertEquals("VNFResource modelVersion", "1.0", vnfResource.getModelVersion());
+ assertEquals("VNFResource orchestration mode", "HEAT", vnfResource.getOrchestrationMode());
+ }
+}
diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/VnfVfmoduleCvnfcConfigurationCustomizationRepositoryTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/VnfVfmoduleCvnfcConfigurationCustomizationRepositoryTest.java
index 6f0e3020b1..a953fc8a3c 100644
--- a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/VnfVfmoduleCvnfcConfigurationCustomizationRepositoryTest.java
+++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/VnfVfmoduleCvnfcConfigurationCustomizationRepositoryTest.java
@@ -81,7 +81,7 @@ public class VnfVfmoduleCvnfcConfigurationCustomizationRepositoryTest extends Ba
vnfVfmoduleCvnfcConfigurationCustomization.setConfigurationResource(configurationResource);
CvnfcCustomization cvnfcCustomization = setUpCvnfcCustomization();
- cvnfcCustomization.setModelCustomizationUUID("cf9f6efc-9f14-11e8-98d0-529269fb1459");
+ cvnfcCustomization.setModelCustomizationUUID("0c3a8b76-3f5b-11e9-b210-d663bd873d93");
VfModuleCustomization vfModuleCustomization = new VfModuleCustomization();
vfModuleCustomization.setModelCustomizationUUID("cf9f6efc-9f14-11e8-98d0-529269fb1459");
@@ -122,5 +122,12 @@ public class VnfVfmoduleCvnfcConfigurationCustomizationRepositoryTest extends Ba
if(foundVnfVfmoduleCvnfcConfigurationCustomization == null)
fail("should not be null");
+
+ VnfVfmoduleCvnfcConfigurationCustomization foundOneVnfVfmoduleCvnfcConfigurationCustomization =
+ vnfVfmoduleCvnfcConfigurationCustomizationRepository.findOneByVnfResourceCustomizationAndVfModuleCustomizationAndCvnfcCustomization("cf9f6efc-9f14-11e8-98d0-529269fb1459", "cf9f6efc-9f14-11e8-98d0-529269fb1459", "0c3a8b76-3f5b-11e9-b210-d663bd873d93");
+
+ if(foundOneVnfVfmoduleCvnfcConfigurationCustomization == null)
+ fail("should not be null");
+ Assert.assertTrue(foundOneVnfVfmoduleCvnfcConfigurationCustomization.getConfigurationFunction().equalsIgnoreCase("testConfigurationFunction"));
}
-}
+} \ No newline at end of file
diff --git a/mso-catalog-db/src/test/resources/data.sql b/mso-catalog-db/src/test/resources/data.sql
index 14834ea963..a59137d023 100644
--- a/mso-catalog-db/src/test/resources/data.sql
+++ b/mso-catalog-db/src/test/resources/data.sql
@@ -44,9 +44,8 @@ insert into heat_environment(artifact_uuid, name, version, description, body, ar
insert into vnf_resource(orchestration_mode, description, creation_timestamp, model_uuid, aic_version_min, aic_version_max, model_invariant_uuid, model_version, model_name, tosca_node_type, heat_template_artifact_uuid) values
('HEAT', '1607 vSAMP10a - inherent network', '2017-04-14 21:46:28', 'ff2ae348-214a-11e7-93ae-92361f002671', '', '', '2fff5b20-214b-11e7-93ae-92361f002671', '1.0', 'vSAMP10a', 'VF', null);
-insert into vnf_resource_customization(model_customization_uuid, model_instance_name, min_instances, max_instances, availability_zone_max_count, nf_type, nf_role, nf_function, nf_naming_code, creation_timestamp, vnf_resource_model_uuid, multi_stage_design) values
-('68dc9a92-214c-11e7-93ae-92361f002671', 'vSAMP10a 1', '0', '0', '0', 'vSAMP', 'vSAMP', 'vSAMP', 'vSAMP', '2017-05-26 15:08:24', 'ff2ae348-214a-11e7-93ae-92361f002671', null);
-
+insert into vnf_resource_customization(model_customization_uuid, model_instance_name, min_instances, max_instances, availability_zone_max_count, nf_type, nf_role, nf_function, nf_naming_code, creation_timestamp, vnf_resource_model_uuid, multi_stage_design, cds_blueprint_name, cds_blueprint_version) values
+('68dc9a92-214c-11e7-93ae-92361f002671', 'vSAMP10a 1', '0', '0', '0', 'vSAMP', 'vSAMP', 'vSAMP', 'vSAMP', '2017-05-26 15:08:24', 'ff2ae348-214a-11e7-93ae-92361f002671', null, "test_configuration_restconf", "1.0.0");
insert into vf_module(model_uuid, model_invariant_uuid, model_version, model_name, description, is_base, heat_template_artifact_uuid, vol_heat_template_artifact_uuid, creation_timestamp, vnf_resource_model_uuid) values
@@ -759,3 +758,15 @@ VALUES ( '1',
'testPolicyName',
'2018-07-17 14:05:08',
'c59a41ca-9b3b-11e8-98d0-529269fb1459');
+
+insert into service(model_uuid, model_name, model_invariant_uuid, model_version, description, creation_timestamp, tosca_csar_artifact_uuid, service_type, service_role, environment_context, workload_context) values
+('5df8b6de-2083-11e7-93ae-92361f002676', 'PNF_routing_service', '9647dfc4-2083-11e7-93ae-92361f002676', '1.0', 'PNF service', '2019-03-08 12:00:29', null, 'NA', 'NA', 'Luna', 'Oxygen');
+
+insert into pnf_resource(orchestration_mode, description, creation_timestamp, model_uuid, model_invariant_uuid, model_version, model_name, tosca_node_type) values
+('', 'PNF routing', '2019-03-08 12:00:28', 'ff2ae348-214a-11e7-93ae-92361f002680', '2fff5b20-214b-11e7-93ae-92361f002680', '1.0', 'PNF resource', null);
+
+insert into pnf_resource_customization(model_customization_uuid, model_instance_name, nf_type, nf_role, nf_function, nf_naming_code, creation_timestamp, pnf_resource_model_uuid, multi_stage_design, cds_blueprint_name, cds_blueprint_version) values
+('68dc9a92-214c-11e7-93ae-92361f002680', 'PNF routing', 'routing', 'routing', 'routing', 'routing', '2019-03-08 12:00:29', 'ff2ae348-214a-11e7-93ae-92361f002680', null, "test_configuration_restconf", "1.0.0");
+
+insert into pnf_resource_customization_to_service(service_model_uuid, resource_model_customization_uuid) values
+('5df8b6de-2083-11e7-93ae-92361f002676', '68dc9a92-214c-11e7-93ae-92361f002680'); \ No newline at end of file
diff --git a/mso-catalog-db/src/test/resources/schema.sql b/mso-catalog-db/src/test/resources/schema.sql
index d20a9adb7e..6bd9baee80 100644
--- a/mso-catalog-db/src/test/resources/schema.sql
+++ b/mso-catalog-db/src/test/resources/schema.sql
@@ -437,6 +437,8 @@ create table `vnf_resource_customization` (
`vnf_resource_model_uuid` varchar(200) not null,
`multi_stage_design` varchar(20) default null,
`resource_input` varchar(20000) default null,
+ `cds_blueprint_name` varchar(200) default null,
+ `cds_blueprint_version` varchar(20) default null,
primary key (`model_customization_uuid`),
key `fk_vnf_resource_customization__vnf_resource1_idx` (`vnf_resource_model_uuid`),
constraint `fk_vnf_resource_customization__vnf_resource1` foreign key (`vnf_resource_model_uuid`) references `vnf_resource` (`model_uuid`) on delete cascade on update cascade
@@ -946,3 +948,41 @@ CREATE TABLE IF NOT EXISTS vnf_vfmodule_cvnfc_configuration_customization (
REFERENCES `vnf_resource_customization` (`MODEL_CUSTOMIZATION_UUID`)
ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=INNODB AUTO_INCREMENT=20654 DEFAULT CHARACTER SET=LATIN1;
+
+CREATE TABLE IF NOT EXISTS `pnf_resource` (
+ `ORCHESTRATION_MODE` varchar(20) NOT NULL DEFAULT 'HEAT',
+ `DESCRIPTION` varchar(1200) DEFAULT NULL,
+ `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ `MODEL_UUID` varchar(200) NOT NULL,
+ `MODEL_INVARIANT_UUID` varchar(200) DEFAULT NULL,
+ `MODEL_VERSION` varchar(20) NOT NULL,
+ `MODEL_NAME` varchar(200) DEFAULT NULL,
+ `TOSCA_NODE_TYPE` varchar(200) DEFAULT NULL,
+ `RESOURCE_CATEGORY` varchar(200) DEFAULT NULL,
+ `RESOURCE_SUB_CATEGORY` varchar(200) DEFAULT NULL,
+ PRIMARY KEY (`MODEL_UUID`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+CREATE TABLE IF NOT EXISTS `pnf_resource_customization` (
+ `MODEL_CUSTOMIZATION_UUID` varchar(200) NOT NULL,
+ `MODEL_INSTANCE_NAME` varchar(200) NOT NULL,
+ `NF_TYPE` varchar(200) DEFAULT NULL,
+ `NF_ROLE` varchar(200) DEFAULT NULL,
+ `NF_FUNCTION` varchar(200) DEFAULT NULL,
+ `NF_NAMING_CODE` varchar(200) DEFAULT NULL,
+ `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ `PNF_RESOURCE_MODEL_UUID` varchar(200) NOT NULL,
+ `MULTI_STAGE_DESIGN` varchar(20) DEFAULT NULL,
+ `RESOURCE_INPUT` varchar(2000) DEFAULT NULL,
+ `CDS_BLUEPRINT_NAME` varchar(200) DEFAULT NULL,
+ `CDS_BLUEPRINT_VERSION` varchar(20) DEFAULT NULL,
+ PRIMARY KEY (`MODEL_CUSTOMIZATION_UUID`),
+ KEY `fk_pnf_resource_customization__pnf_resource1_idx` (`PNF_RESOURCE_MODEL_UUID`),
+ CONSTRAINT `fk_pnf_resource_customization__pnf_resource1` FOREIGN KEY (`PNF_RESOURCE_MODEL_UUID`) REFERENCES `pnf_resource` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+CREATE TABLE IF NOT EXISTS `pnf_resource_customization_to_service` (
+ `SERVICE_MODEL_UUID` varchar(200) NOT NULL,
+ `RESOURCE_MODEL_CUSTOMIZATION_UUID` varchar(200) NOT NULL,
+ PRIMARY KEY (`SERVICE_MODEL_UUID`,`RESOURCE_MODEL_CUSTOMIZATION_UUID`)
+)ENGINE=InnoDB DEFAULT CHARSET=latin1; \ No newline at end of file
diff --git a/packages/docker/pom.xml b/packages/docker/pom.xml
index 11b7de62b7..49f6422f3f 100644
--- a/packages/docker/pom.xml
+++ b/packages/docker/pom.xml
@@ -80,6 +80,31 @@
</build>
</image>
<image>
+ <name>onap/so/vnfm-adapter</name>
+ <build>
+ <cleanup>try</cleanup>
+ <dockerFileDir>docker-files</dockerFileDir>
+ <dockerFile>Dockerfile.so-app</dockerFile>
+ <tags>
+ <tag>${project.version}</tag>
+ <tag>${project.version}-${maven.build.timestamp}</tag>
+ <tag>${project.docker.latesttag.version}</tag>
+ </tags>
+ <assembly>
+ <inline>
+ <dependencySets>
+ <dependencySet>
+ <includes>
+ <include>org.onap.so.adapters:mso-vnfm-etsi-adapter</include>
+ </includes>
+ <outputFileNameMapping>app.jar</outputFileNameMapping>
+ </dependencySet>
+ </dependencySets>
+ </inline>
+ </assembly>
+ </build>
+ </image>
+ <image>
<name>onap/so/catalog-db-adapter</name>
<build>
<cleanup>try</cleanup>
@@ -355,6 +380,11 @@
<dependencies>
<dependency>
<groupId>org.onap.so.adapters</groupId>
+ <artifactId>mso-vnfm-etsi-adapter</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.so.adapters</groupId>
<artifactId>mso-catalog-db-adapter</artifactId>
<version>${project.version}</version>
</dependency>
diff --git a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/configuration/rest/CorsConfigurer.java b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/configuration/rest/CorsConfigurer.java
index 0bcf24dbd8..4d0fd443e9 100644
--- a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/configuration/rest/CorsConfigurer.java
+++ b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/configuration/rest/CorsConfigurer.java
@@ -30,17 +30,12 @@ import org.springframework.web.filter.CorsFilter;
* @author waqas.ikram@ericsson, eoin.hanan@ericsson.com
*/
@Configuration
-public class CorsConfigurer {
+public class CorsConfigurer {
@Bean
public CorsFilter corsFilter() {
final UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
- final CorsConfiguration config = new CorsConfiguration();
- config.setAllowCredentials(true);
- config.addAllowedOrigin("*");
- config.addAllowedHeader("*");
- config.addAllowedMethod("*");
- source.registerCorsConfiguration("/**", config);
+ source.registerCorsConfiguration("/**", new CorsConfiguration().applyPermitDefaultValues());
return new CorsFilter(source);
}
}
diff --git a/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/montoring/configuration/CamundaConfigurationTest.java b/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/monitoring/configuration/CamundaConfigurationTest.java
index fb56d841e4..fb56d841e4 100644
--- a/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/montoring/configuration/CamundaConfigurationTest.java
+++ b/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/monitoring/configuration/CamundaConfigurationTest.java
diff --git a/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/montoring/configuration/CamundaRestUrlProviderTest.java b/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/monitoring/configuration/CamundaRestUrlProviderTest.java
index 3cd8a33d77..3cd8a33d77 100644
--- a/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/montoring/configuration/CamundaRestUrlProviderTest.java
+++ b/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/monitoring/configuration/CamundaRestUrlProviderTest.java
diff --git a/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/montoring/configuration/HttpServiceProviderConfigurationTest.java b/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/monitoring/configuration/HttpServiceProviderConfigurationTest.java
index 1b3e168c12..1b3e168c12 100644
--- a/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/montoring/configuration/HttpServiceProviderConfigurationTest.java
+++ b/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/monitoring/configuration/HttpServiceProviderConfigurationTest.java
diff --git a/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/montoring/configuration/PojoClassesTests.java b/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/monitoring/configuration/PojoClassesTests.java
index f51d4c64b1..f51d4c64b1 100644
--- a/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/montoring/configuration/PojoClassesTests.java
+++ b/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/monitoring/configuration/PojoClassesTests.java
diff --git a/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/montoring/configuration/database/DatabaseUrlProviderTest.java b/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/monitoring/configuration/database/DatabaseUrlProviderTest.java
index d820e9435d..d820e9435d 100644
--- a/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/montoring/configuration/database/DatabaseUrlProviderTest.java
+++ b/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/monitoring/configuration/database/DatabaseUrlProviderTest.java
diff --git a/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/montoring/db/api/DatabaseServiceProviderTest.java b/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/monitoring/db/api/DatabaseServiceProviderTest.java
index 58666671a7..58666671a7 100644
--- a/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/montoring/db/api/DatabaseServiceProviderTest.java
+++ b/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/monitoring/db/api/DatabaseServiceProviderTest.java
diff --git a/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/montoring/rest/service/CamundaProcessDataServiceProviderTest.java b/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/monitoring/rest/service/CamundaProcessDataServiceProviderTest.java
index c3930df196..c3930df196 100644
--- a/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/montoring/rest/service/CamundaProcessDataServiceProviderTest.java
+++ b/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/monitoring/rest/service/CamundaProcessDataServiceProviderTest.java
diff --git a/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/montoring/utils/ObjectEqualsUtilsTest.java b/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/monitoring/utils/ObjectEqualsUtilsTest.java
index dd363abe3a..dd363abe3a 100644
--- a/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/montoring/utils/ObjectEqualsUtilsTest.java
+++ b/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/monitoring/utils/ObjectEqualsUtilsTest.java