summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java8
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/authentication/KeystoneAuthHolderTest.java20
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsUnitTest.java117
-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-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java9
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java9
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/MsoTenantAdapterImpl.java5
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java11
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java9
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java11
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java10
-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-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/test/emulators/NotificationDataImpl.java15
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java66
-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.groovy63
-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.groovy77
-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.groovy98
-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/Configuration.java14
-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/bbobjects/VfModule.java9
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Vnfc.java131
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ConfigurationResourceKeys.java7
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java24
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java5
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java5
-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/tasks/BBInputSetupTest.java18
-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/WorkflowMessageResource.java4
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFLockActivity.bpmn62
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFSnapShotActivity.bpmn62
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFStartActivity.bpmn62
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFStopActivity.bpmn62
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFUnlockActivity.bpmn62
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFUpgradeBackupActivity.bpmn62
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn195
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFHealthCheckActivityTest.java3
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFLockActivityTest.java57
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFQuiesceTrafficActivityTest.java3
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFResumeTrafficActivityTest.java3
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFSnapShotActivityTest.java57
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFStartActivityTest.java57
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFStopActivityTest.java57
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnlockActivityTest.java57
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradeBackupActivityTest.java60
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradePostCheckActivityTest.java4
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradePreCheckActivityTest.java3
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradeSoftwareActivityTest.java3
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleInfra.groovy24
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1.groovy3
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVnfInfra.groovy22
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteNetworkInstance.groovy8
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleInfra.groovy27
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy8
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy68
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy20
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy16
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy16
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModulesRollback.groovy22
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy16
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy12
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy20
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy20
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleE2EServiceInstance.groovy4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy7
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy56
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy12
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ReplaceVnfInfra.groovy36
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/RollbackVnf.groovy4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstance.groovy6
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModule.groovy24
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleInfra.groovy28
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolume.groovy32
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy6
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVnfInfra.groovy24
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfCmBase.groovy54
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfConfigUpdate.groovy28
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfInPlaceUpdate.groovy34
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy8
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy5
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollback.groovy4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollback.groovy4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRG.groovy4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXC.groovy4
-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.java12
-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.java5
-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/WorkflowAction.java124
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java113
-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/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/infrastructure/validations/CloudRegionOrchestrationValidatorTest.java20
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionUnitTest.java75
-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/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.java38
-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-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java10
-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/RequestParametersValidation.java17
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java18
-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/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/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/client/CatalogDbClient.java16
-rw-r--r--packages/docker/pom.xml30
215 files changed, 10841 insertions, 8273 deletions
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 012c560689..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
@@ -1330,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);
@@ -1375,7 +1375,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
else
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)
@@ -1390,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 70617fda4a..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,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=========================================================
+ */
+
/*
* ============LICENSE_START==========================================
* ONAP - SO
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 66d6f59e79..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,12 +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;
@@ -71,6 +95,99 @@ public class MsoHeatUtilsUnitTest {
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-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 25d8e564da..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,9 +126,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
String messageId,
MsoRequest msoRequest,
String notificationUrl) {
- String error;
- MsoLogger.setLogContext (msoRequest);
logger.debug("Async Create Network: {} of type {} in {}/{}", networkName, networkType, cloudSiteId, tenantId);
// Use the synchronous method to perform the actual Create
@@ -252,7 +250,6 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
MsoRequest msoRequest,
String notificationUrl) {
- MsoLogger.setLogContext (msoRequest);
logger.debug("Async Update Network: {} of type {} in {}/{}", networkId, networkType, cloudSiteId, tenantId);
// Use the synchronous method to perform the actual Create
@@ -342,9 +339,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
String messageId,
MsoRequest msoRequest,
String notificationUrl) {
- String error;
- MsoLogger.setLogContext (msoRequest);
logger.debug("Async Query Network {} in {}/{}", networkNameOrId, cloudSiteId, tenantId);
String errorCreateNetworkMessage = "{} {} Error sending createNetwork notification {} ";
@@ -440,8 +435,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
String messageId,
MsoRequest msoRequest,
String notificationUrl) {
- String error;
- MsoLogger.setLogContext (msoRequest);
+
String serviceName = "DeleteNetworkA";
logger.debug("Async Delete Network {} in {}/{}", networkId, cloudSiteId, tenantId);
@@ -507,7 +501,6 @@ 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
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 bcb6b1be42..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,7 +266,6 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
Holder <String> networkFqdn,
Holder <Map <String, String>> subnetIdMap,
Holder <NetworkRollback> rollback) throws NetworkException {
- MsoLogger.setLogContext (msoRequest);
logger.debug("*** CREATE Network: {} of type {} in {}/{}", networkName, networkType, cloudSiteId, tenantId);
// Will capture execution time for metrics
@@ -712,7 +711,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
MsoRequest msoRequest,
Holder <Map <String, String>> subnetIdMap,
Holder <NetworkRollback> rollback) throws NetworkException {
- MsoLogger.setLogContext (msoRequest);
+
logger.debug("***UPDATE Network adapter with Network: {} of type {} in {}/{}", networkName, networkType,
cloudSiteId, tenantId);
@@ -1147,7 +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);
+
logger.debug("*** QUERY Network with Network: {} in {}/{}", networkNameOrId, cloudSiteId, tenantId);
// Will capture execution time for metrics
@@ -1285,7 +1284,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
String networkId,
MsoRequest msoRequest,
Holder <Boolean> networkDeleted) throws NetworkException {
- MsoLogger.setLogContext (msoRequest);
+
logger.debug("*** DELETE Network adapter with Network: {} in {}/{}", networkId, cloudSiteId, tenantId);
// Will capture execution time for metrics
@@ -1386,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 a937bd9499..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,7 +88,6 @@ public class MsoTenantAdapterImpl implements MsoTenantAdapter {
MsoRequest msoRequest,
Holder <String> tenantId,
Holder <TenantRollback> rollback) throws TenantException {
- MsoLogger.setLogContext (msoRequest);
logger.debug("Call to MSO createTenant adapter. Creating Tenant: {} in {}", tenantName, cloudSiteId);
@@ -152,7 +151,7 @@ public class MsoTenantAdapterImpl implements MsoTenantAdapter {
Holder <String> tenantId,
Holder <String> tenantName,
Holder <Map <String, String>> metadata) throws TenantException {
- MsoLogger.setLogContext (msoRequest);
+
logger.debug ("Querying Tenant {} in {}", tenantNameOrId, cloudSiteId);
MsoTenantUtils tUtils;
@@ -196,7 +195,6 @@ public class MsoTenantAdapterImpl implements MsoTenantAdapter {
String tenantId,
MsoRequest msoRequest,
Holder <Boolean> tenantDeleted) throws TenantException {
- MsoLogger.setLogContext (msoRequest);
logger.debug ("Deleting Tenant {} in {}", tenantId, cloudSiteId);
@@ -238,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 b445dc8a26..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,7 +132,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
String messageId,
MsoRequest msoRequest,
String notificationUrl) {
- MsoLogger.setLogContext (msoRequest);
+
logger.info("{} createVnfA", MessageEnum.RA_ASYNC_CREATE_VNF);
// Use the synchronous method to perform the actual Create
MsoVnfAdapter vnfAdapter = vnfImpl;
@@ -213,7 +213,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
String messageId,
MsoRequest msoRequest,
String notificationUrl) {
- MsoLogger.setLogContext (msoRequest);
+
logger.info("{} UpdateVnfA", MessageEnum.RA_ASYNC_UPDATE_VNF);
// Use the synchronous method to perform the actual Create
@@ -289,9 +289,8 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
String messageId,
MsoRequest msoRequest,
String notificationUrl) {
- String error;
+
String serviceName = "QueryVnfA";
- MsoLogger.setLogContext (msoRequest);
logger.info("{}", MessageEnum.RA_ASYNC_QUERY_VNF);
// Use the synchronous method to perform the actual query
@@ -376,9 +375,8 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
String messageId,
MsoRequest msoRequest,
String notificationUrl) {
- String error;
+
String serviceName = "DeleteVnfA";
- MsoLogger.setLogContext (msoRequest);
logger.info("{}", MessageEnum.RA_ASYNC_DELETE_VNF);
// Use the synchronous method to perform the actual delete
@@ -441,7 +439,6 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
return;
}
- MsoLogger.setLogContext (rollback.getMsoRequest ());
logger.info("{} rollbackVnfA", MessageEnum.RA_ASYNC_ROLLBACK_VNF);
// Use the synchronous method to perform the actual rollback
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 a1d7698ad1..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
@@ -302,7 +302,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
Holder <String> vnfId,
Holder <VnfStatus> status,
Holder <Map <String, String>> outputs) throws VnfException {
- MsoLogger.setLogContext (msoRequest);
+
logger.debug("Querying VNF {} in {}", vnfName, cloudSiteId + "/" + tenantId);
// Will capture execution time for metrics
@@ -361,7 +361,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
String tenantId,
String vnfName,
MsoRequest msoRequest) throws VnfException {
- MsoLogger.setLogContext (msoRequest);
+
logger.debug("Deleting VNF {} in {}", vnfName, cloudSiteId + "/" + tenantId);
// Will capture execution time for metrics
long startTime = System.currentTimeMillis ();
@@ -409,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) {
@@ -600,7 +597,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
useMCUuid = true;
}
}
- MsoLogger.setLogContext (msoRequest);
+
String requestTypeString = "";
if (requestType != null && !"".equals(requestType)) {
requestTypeString = requestType;
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 bba960cddf..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,7 +206,6 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
Holder <Map <String, String>> outputs)
throws VnfException
{
- MsoLogger.setLogContext (msoRequest);
logger.debug ("Querying VNF {} in {}", vnfName, cloudSiteId + "/" + tenantId);
// Will capture execution time for metrics
@@ -264,7 +263,6 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
String tenantId,
String vnfName,
MsoRequest msoRequest) throws VnfException {
- MsoLogger.setLogContext (msoRequest);
// 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,8 +283,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
long startTime = System.currentTimeMillis ();
// 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;
}
@@ -300,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;
@@ -576,8 +571,6 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
// Will capture execution time for metrics
long startTime = System.currentTimeMillis ();
- MsoLogger.setLogContext (msoRequest);
-
// Require a model customization ID. Every VF Module definition must have one.
if (modelCustomizationUuid == null || modelCustomizationUuid.isEmpty()) {
logger.debug("Missing required input: modelCustomizationUuid");
@@ -1179,7 +1172,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
String vnfName,
MsoRequest msoRequest,
Holder <Map <String, String>> outputs) throws VnfException {
- MsoLogger.setLogContext (msoRequest);
+
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 704d54c918..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,7 +225,6 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
Holder <Map <String, String>> outputs)
throws VnfException
{
- MsoLogger.setLogContext (msoRequest);
logger.debug("Querying VNF " + vnfNameOrId + " in " + cloudSiteId + "/" + tenantId);
// Will capture execution time for metrics
@@ -281,7 +280,6 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
String tenantId,
String vnfName,
MsoRequest msoRequest) throws VnfException {
- MsoLogger.setLogContext (msoRequest);
// 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,8 +300,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
long startTime = System.currentTimeMillis ();
// 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;
}
@@ -319,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;
@@ -618,8 +613,6 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
// Will capture execution time for metrics
long startTime = System.currentTimeMillis ();
- MsoLogger.setLogContext (msoRequest);
-
// Require a model customization ID. Every VF Module definition must have one.
if (modelCustomizationUuid == null || modelCustomizationUuid.isEmpty()) {
logger.debug("Missing required input: modelCustomizationUuid");
@@ -1165,7 +1158,6 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
MsoRequest msoRequest,
Holder <Map <String, String>> outputs) throws VnfException
{
- MsoLogger.setLogContext (msoRequest);
logger.debug("Deleting VF Module " + vfModuleId + " in " + cloudSiteId + "/" + tenantId);
// Will capture execution time for metrics
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-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/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 892a96eb4e..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
@@ -1483,7 +1483,6 @@ public class ToscaResourceInstaller {
vfModuleMemberName = node.getName();
}
-
// Extract CVFC lists
List<NodeTemplate> cvfcList = toscaResourceStructure.getSdcCsarHelper().getNodeTemplateBySdcType(vfTemplate, SdcTypes.CVFC);
@@ -1491,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);
@@ -1502,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")){
@@ -1524,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
@@ -1595,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/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..4e7c549323 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.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.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..dec69dfb71 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,46 @@ 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.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 +233,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..3545361811 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.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..11c2bb265d 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.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.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.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.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.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.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.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.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.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..1c2862e00d 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,8 @@ 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.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method)
}
@@ -80,16 +85,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 +147,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 +167,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 +179,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 +212,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 +230,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.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 +259,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.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method)
}
@@ -271,8 +280,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 +295,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.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..dfe0772cab 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.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.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..f2d5a61542 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.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.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.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..8bc97f7f40 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.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.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..e6beac6742 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.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.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.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..b062974c98 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.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.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..d4c5d2f7bb 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.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.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.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.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.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.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.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.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..0d39ea15f8 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.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..8c67a42b6d 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.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.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.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..10d02686cc 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");
} 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.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.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..3a93d48da3 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.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.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.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.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..cf0e35a59f 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.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..fd5dbaea90 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.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.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.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.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.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.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.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.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.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.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.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..cd86120860 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.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.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.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.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.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.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.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..085e82ca24 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.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.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.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,31 @@ 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.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.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.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 +1040,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..c489778d36 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.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.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..fd45cb5a03 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.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..536d9062c0 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.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.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.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..d8b2c4f5c0 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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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..4d74ac374e 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.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/Configuration.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Configuration.java
index bcff93c5af..748d37d6e4 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Configuration.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Configuration.java
@@ -62,9 +62,11 @@ public class Configuration implements Serializable, ShallowCopy<Configuration> {
@JsonProperty("metadata")
private Metadata metadata;
@JsonProperty("forwarder-evcs")
- private List<ForwarderEvc> forwarderEvcs = new ArrayList<ForwarderEvc>();
+ private List<ForwarderEvc> forwarderEvcs = new ArrayList<>();
@JsonProperty("evcs")
- private List<Evc> evcs = new ArrayList<Evc>();
+ private List<Evc> evcs = new ArrayList<>();
+ @JsonProperty("vnfc")
+ private Vnfc vnfc = new Vnfc();
@JsonProperty("model-info-configuration")
private ModelInfoConfiguration modelInfoConfiguration;
@@ -88,6 +90,14 @@ public class Configuration implements Serializable, ShallowCopy<Configuration> {
public List<ForwarderEvc> getForwarderEvcs() {
return forwarderEvcs;
}
+
+ public Vnfc getVnfc() {
+ return vnfc;
+ }
+
+ public void setVnfc(Vnfc vnfc) {
+ this.vnfc = vnfc;
+ }
public List<Evc> getEvcs() {
return evcs;
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/bbobjects/VfModule.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VfModule.java
index 469bc991b4..ceca929806 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VfModule.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VfModule.java
@@ -21,19 +21,21 @@
package org.onap.so.bpmn.servicedecomposition.bbobjects;
import java.io.Serializable;
+import java.util.ArrayList;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import javax.persistence.Id;
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.ModelInfoVfModule;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;
-import org.onap.so.bpmn.servicedecomposition.ShallowCopy;
@JsonRootName("vf-module")
public class VfModule implements Serializable, ShallowCopy<VfModule> {
@@ -59,6 +61,8 @@ public class VfModule implements Serializable, ShallowCopy<VfModule> {
private Integer moduleIndex;
@JsonProperty("selflink")
private String selflink;
+ @JsonProperty("vnfcs")
+ private List<Vnfc> vnfcs = new ArrayList<>();
@JsonProperty("model-info-vf-module")
private ModelInfoVfModule modelInfoVfModule;
@@ -122,6 +126,9 @@ public class VfModule implements Serializable, ShallowCopy<VfModule> {
public void setCascaded(boolean cascaded) {
this.cascaded = cascaded;
}
+ public List<Vnfc> getVnfcs() {
+ return vnfcs;
+ }
@Override
public boolean equals(final Object other) {
if (!(other instanceof VfModule)) {
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Vnfc.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Vnfc.java
new file mode 100644
index 0000000000..68caeb244f
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Vnfc.java
@@ -0,0 +1,131 @@
+package org.onap.so.bpmn.servicedecomposition.bbobjects;
+
+import java.io.Serializable;
+
+import javax.persistence.Id;
+
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonRootName;
+
+@JsonRootName("vnfc")
+public class Vnfc implements Serializable {
+
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+ @Id
+ @JsonProperty("vnfc-name")
+ private String vnfcName;
+ @JsonProperty("nfc-naming-code")
+ private String nfcNamingCode;
+ @JsonProperty("nfc-function")
+ private String nfcFunction;
+ @JsonProperty("prov-status")
+ private String provStatus;
+ @JsonProperty("orchestration-status")
+ private String orchestrationStatus;
+ @JsonProperty("ipaddress-v4-oam-vip")
+ private String ipaddressV4OamVip;
+ @JsonProperty("in-maint")
+ private String inMaint;
+ @JsonProperty("is-closed-loop-disabled")
+ private String isClosedLoopDisabled;
+ @JsonProperty("group-notation")
+ private String groupNotation;
+ @JsonProperty("model-invariant-id")
+ private String modelInvariantId;
+ @JsonProperty("model-version-id")
+ private String modelVersionId;
+ @JsonProperty("model-customization-id")
+ private String modelCustomizationId;
+
+ @Override
+ public boolean equals(final Object other) {
+ if (!(other instanceof Vnfc)) {
+ return false;
+ }
+ Vnfc castOther = (Vnfc) other;
+ return new EqualsBuilder().append(vnfcName, castOther.vnfcName).isEquals();
+ }
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder().append(vnfcName).toHashCode();
+ }
+ public String getVnfcName() {
+ return vnfcName;
+ }
+ public void setVnfcName(String vnfcName) {
+ this.vnfcName = vnfcName;
+ }
+ public String getNfcNamingCode() {
+ return nfcNamingCode;
+ }
+ public void setNfcNamingCode(String nfcNamingCode) {
+ this.nfcNamingCode = nfcNamingCode;
+ }
+ public String getNfcFunction() {
+ return nfcFunction;
+ }
+ public void setNfcFunction(String nfcFunction) {
+ this.nfcFunction = nfcFunction;
+ }
+ public String getProvStatus() {
+ return provStatus;
+ }
+ public void setProvStatus(String provStatus) {
+ this.provStatus = provStatus;
+ }
+ public String getOrchestrationStatus() {
+ return orchestrationStatus;
+ }
+ public void setOrchestrationStatus(String orchestrationStatus) {
+ this.orchestrationStatus = orchestrationStatus;
+ }
+ public String getIpaddressV4OamVip() {
+ return ipaddressV4OamVip;
+ }
+ public void setIpaddressV4OamVip(String ipaddressV4OamVip) {
+ this.ipaddressV4OamVip = ipaddressV4OamVip;
+ }
+ public String getInMaint() {
+ return inMaint;
+ }
+ public void setInMaint(String inMaint) {
+ this.inMaint = inMaint;
+ }
+ public String getIsClosedLoopDisabled() {
+ return isClosedLoopDisabled;
+ }
+ public void setIsClosedLoopDisabled(String isClosedLoopDisabled) {
+ this.isClosedLoopDisabled = isClosedLoopDisabled;
+ }
+ public String getGroupNotation() {
+ return groupNotation;
+ }
+ public void setGroupNotation(String groupNotation) {
+ this.groupNotation = groupNotation;
+ }
+ public String getModelInvariantId() {
+ return modelInvariantId;
+ }
+ public void setModelInvariantId(String modelInvariantId) {
+ this.modelInvariantId = modelInvariantId;
+ }
+ public String getModelVersionId() {
+ return modelVersionId;
+ }
+ public void setModelVersionId(String modelVersionId) {
+ this.modelVersionId = modelVersionId;
+ }
+ public String getModelCustomizationId() {
+ return modelCustomizationId;
+ }
+ public void setModelCustomizationId(String modelCustomizationId) {
+ this.modelCustomizationId = modelCustomizationId;
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ConfigurationResourceKeys.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ConfigurationResourceKeys.java
index 8f0ced955c..00903ab782 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ConfigurationResourceKeys.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ConfigurationResourceKeys.java
@@ -31,6 +31,7 @@ public class ConfigurationResourceKeys implements Serializable{
private String vfModuleCustomizationUUID;
private String vnfResourceCustomizationUUID;
private String cvnfcCustomizationUUID;
+ private String vnfcName;
public String getVfModuleCustomizationUUID() {
return vfModuleCustomizationUUID;
@@ -50,6 +51,12 @@ public class ConfigurationResourceKeys implements Serializable{
public void setCvnfcCustomizationUUID(String cvnfcCustomizationUUID) {
this.cvnfcCustomizationUUID = cvnfcCustomizationUUID;
}
+ public String getVnfcName() {
+ return vnfcName;
+ }
+ public void setVnfcName(String vnfcName) {
+ this.vnfcName = vnfcName;
+ }
}
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 c80cd3d2a0..76b24caf09 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
@@ -51,6 +51,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Tenant;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Vnfc;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
import org.onap.so.bpmn.servicedecomposition.entities.ConfigurationResourceKeys;
import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
@@ -65,6 +66,7 @@ import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.entities.AAIResultWrapper;
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.client.exception.ExceptionBuilder;
import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization;
import org.onap.so.db.catalog.beans.CollectionResource;
@@ -333,10 +335,11 @@ public class BBInputSetup implements JavaDelegate {
relatedInstanceList, instanceName, vnfType, null);
} else if (modelType.equals(ModelType.vfModule)) {
if(bbName.contains("Configuration")) {
+ String configurationId = lookupKeyMap.get(ResourceKey.CONFIGURATION_ID);
ModelInfo configurationModelInfo = new ModelInfo();
configurationModelInfo.setModelCustomizationUuid(configurationKey);
populateConfiguration(configurationModelInfo, service, bbName, serviceInstance,
- lookupKeyMap, resourceId, instanceName, configurationResourceKeys);
+ lookupKeyMap, configurationId, instanceName, configurationResourceKeys);
} else {
lookupKeyMap.put(ResourceKey.VF_MODULE_ID, resourceId);
this.populateVfModule(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId,
@@ -381,10 +384,23 @@ public class BBInputSetup implements JavaDelegate {
serviceInstance.getConfigurations().add(configuration);
}
if(configuration != null) {
+ Vnfc vnfc = getVnfcToConfiguration(configurationResourceKeys.getVnfcName());
+ configuration.setVnfc(vnfc);
this.mapCatalogConfiguration(configuration, modelInfo, service, configurationResourceKeys);
}
}
+ protected Vnfc getVnfcToConfiguration(String vnfcName) {
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VNFC, vnfcName);
+ Optional<org.onap.aai.domain.yang.Vnfc> vnfcOp = bbInputSetupUtils.getAAIResourceDepthOne(uri).asBean(org.onap.aai.domain.yang.Vnfc.class);
+ if(vnfcOp.isPresent()) {
+ org.onap.aai.domain.yang.Vnfc vnfcAAI = vnfcOp.get();
+ return this.mapperLayer.mapAAIVnfc(vnfcAAI);
+ } else {
+ return null;
+ }
+ }
+
protected Configuration createConfiguration(Map<ResourceKey, String> lookupKeyMap,
String instanceName, String resourceId) {
lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, resourceId);
@@ -405,8 +421,8 @@ public class BBInputSetup implements JavaDelegate {
, vnfVfmoduleCvnfcConfigurationCustomization));
} else {
logger.debug("for Fabric configuration mapping by VF MODULE CUST UUID: " + configurationResourceKeys.getVfModuleCustomizationUUID());
- vnfVfmoduleCvnfcConfigurationCustomization = findVnfVfmoduleCvnfcConfigurationCustomization(configurationResourceKeys.getVfModuleCustomizationUUID(),
- configurationResourceKeys.getVnfResourceCustomizationUUID(), configurationResourceKeys.getCvnfcCustomizationUUID());
+ vnfVfmoduleCvnfcConfigurationCustomization = findVnfVfmoduleCvnfcConfigurationCustomization(configurationResourceKeys.getVnfResourceCustomizationUUID(),
+ configurationResourceKeys.getVfModuleCustomizationUUID(), configurationResourceKeys.getCvnfcCustomizationUUID());
if (vnfVfmoduleCvnfcConfigurationCustomization != null){
configuration.setModelInfoConfiguration(this.mapperLayer.mapCatalogConfigurationToConfiguration(vnfVfmoduleCvnfcConfigurationCustomization));
}
@@ -438,7 +454,7 @@ public class BBInputSetup implements JavaDelegate {
protected VnfVfmoduleCvnfcConfigurationCustomization findVnfVfmoduleCvnfcConfigurationCustomization(String vnfResourceCustomizationUUID,
String vfModuleCustomizationUUID, String cvnfcCustomizationUUID) {
- return bbInputSetupUtils.getVnfVfmoduleCvnfcConfigurationCustomizationByActionAndIsALaCarteAndRequestScopeAndCloudOwner(vnfResourceCustomizationUUID,
+ return bbInputSetupUtils.getVnfVfmoduleCvnfcConfigurationCustomizationByVnfCustomizationIdnAndVfModuleCustomizationIdAndCvnfcCustomizationId(vnfResourceCustomizationUUID,
vfModuleCustomizationUUID, cvnfcCustomizationUUID);
}
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 fac2e9b8c3..0a334cde6f 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
@@ -55,6 +55,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Tenant;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Vnfc;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.bpmn.servicedecomposition.generalobjects.License;
@@ -511,4 +512,8 @@ public class BBInputSetupMapperLayer {
CollectionNetworkResourceCustomization collectionNetworkResourceCust) {
return modelMapper.map(collectionNetworkResourceCust, NetworkResourceCustomization.class);
}
+
+ public Vnfc mapAAIVnfc(org.onap.aai.domain.yang.Vnfc vnfcAAI) {
+ return modelMapper.map(vnfcAAI, Vnfc.class);
+ }
}
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 a71c38f127..36a6bf37d9 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
@@ -451,4 +451,9 @@ public class BBInputSetupUtils {
return Optional.of(volumeGroup);
}
}
+
+ public VnfVfmoduleCvnfcConfigurationCustomization getVnfVfmoduleCvnfcConfigurationCustomizationByVnfCustomizationIdnAndVfModuleCustomizationIdAndCvnfcCustomizationId(
+ String vnfResourceCustomizationUUID, String vfModuleCustomizationUUID, String cvnfcCustomizationUUID) {
+ return catalogDbClient.getVnfVfmoduleCvnfcConfigurationCustomizationByVnfCustomizationUuidAndVfModuleCustomizationUuidAndCvnfcCustomizationUuid(vnfResourceCustomizationUUID, vfModuleCustomizationUUID, cvnfcCustomizationUUID);
+ }
}
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/tasks/BBInputSetupTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java
index 4b10d513d6..df9f2259a1 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
@@ -47,7 +47,6 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentMatchers;
-import org.mockito.ArgumentMatchers;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.Spy;
@@ -67,6 +66,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTableReference;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Vnfc;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.ConfigurationResourceKeys;
@@ -85,10 +85,8 @@ import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule;
import org.onap.so.client.aai.AAICommonObjectMapperProvider;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.entities.AAIResultWrapper;
-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.db.catalog.beans.CollectionNetworkResourceCustomization;
import org.onap.so.db.catalog.beans.CollectionResource;
import org.onap.so.db.catalog.beans.CollectionResourceCustomization;
@@ -1194,6 +1192,7 @@ public class BBInputSetupTest {
configuration.setConfigurationName("configurationName");
serviceInstance.getConfigurations().add(configuration);
String resourceId = "configurationId";
+ String vnfcName = "vnfcName";
// Mock service
Service service = mapper.readValue(
new File(RESOURCE_PATH + "CatalogDBService_getServiceInstanceNOAAIInput.json"), Service.class);
@@ -1207,9 +1206,12 @@ public class BBInputSetupTest {
configResourceKeys.setCvnfcCustomizationUUID("cvnfcCustomizationUUID");
configResourceKeys.setVfModuleCustomizationUUID("vfModuleCustomizationUUID");
configResourceKeys.setVnfResourceCustomizationUUID("vnfResourceCustomizationUUID");
+ configResourceKeys.setVnfcName(vnfcName);
+ Vnfc vnfc = new Vnfc();
+ vnfc.setVnfcName(vnfcName);
doNothing().when(SPY_bbInputSetup).mapCatalogConfiguration(configuration, modelInfo, service, configResourceKeys);
-
+ doReturn(vnfc).when(SPY_bbInputSetup).getVnfcToConfiguration(vnfcName);
SPY_bbInputSetup.populateConfiguration(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId,
instanceName, configResourceKeys);
verify(SPY_bbInputSetup, times(1)).mapCatalogConfiguration(configuration, modelInfo, service, configResourceKeys);
@@ -1264,6 +1266,7 @@ public class BBInputSetupTest {
configuration.setConfigurationName("configurationName");
serviceInstance.getConfigurations().add(configuration);
String resourceId = "configurationId";
+ String vnfcName = "vnfcName";
// Mock service
Service service = mapper.readValue(
new File(RESOURCE_PATH + "CatalogDBService_getServiceInstanceNOAAIInput.json"), Service.class);
@@ -1274,6 +1277,9 @@ public class BBInputSetupTest {
configResourceKeys.setCvnfcCustomizationUUID("cvnfcCustomizationUUID");
configResourceKeys.setVfModuleCustomizationUUID("vfModuleCustomizationUUID");
configResourceKeys.setVnfResourceCustomizationUUID("vnfResourceCustomizationUUID");
+ configResourceKeys.setVnfcName(vnfcName);
+ Vnfc vnfc = new Vnfc();
+ vnfc.setVnfcName(vnfcName);
VnfVfmoduleCvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization = new VnfVfmoduleCvnfcConfigurationCustomization();
ConfigurationResource configurationResource = new ConfigurationResource();
@@ -1282,7 +1288,7 @@ public class BBInputSetupTest {
vnfVfmoduleCvnfcConfigurationCustomization.setConfigurationResource(configurationResource);
doReturn(null).when(SPY_bbInputSetup).findConfigurationResourceCustomization(modelInfo, service);
- doReturn(vnfVfmoduleCvnfcConfigurationCustomization).when(SPY_bbInputSetup).findVnfVfmoduleCvnfcConfigurationCustomization("vfModuleCustomizationUUID","vnfResourceCustomizationUUID","cvnfcCustomizationUUID");
+ doReturn(vnfc).when(SPY_bbInputSetup).getVnfcToConfiguration(vnfcName);
SPY_bbInputSetup.populateConfiguration(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId,
instanceName, configResourceKeys);
@@ -2707,4 +2713,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/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/WorkflowMessageResource.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowMessageResource.java
index 072dec28c6..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
@@ -90,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();
}
@@ -98,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/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFLockActivity.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFLockActivity.bpmn
new file mode 100644
index 0000000000..1aaa920ef8
--- /dev/null
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFLockActivity.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="VNFLockActivity" name="VNFLockActivity" isExecutable="true">
+ <bpmn:startEvent id="VNFLockActivity_Start">
+ <bpmn:outgoing>SequenceFlow_06vhbci</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:endEvent id="VNFLockActivity_End">
+ <bpmn:incoming>SequenceFlow_01312aj</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_06vhbci" sourceRef="VNFLockActivity_Start" targetRef="TaskPreProcessActivity" />
+ <bpmn:sequenceFlow id="SequenceFlow_01312aj" sourceRef="TaskLock" targetRef="VNFLockActivity_End" />
+ <bpmn:serviceTask id="TaskLock" name="VNF Lock" camunda:expression="${AppcRunTasks.runAppcCommand(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)),execution.getVariable(&#34;actionLock&#34;))}">
+ <bpmn:incoming>SequenceFlow_0cf0riu</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_01312aj</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="SequenceFlow_0cf0riu" sourceRef="TaskPreProcessActivity" targetRef="TaskLock" />
+ <bpmn:serviceTask id="TaskPreProcessActivity" name="PreProcess Activity" camunda:expression="${AppcRunTasks.preProcessActivity(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:incoming>SequenceFlow_06vhbci</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0cf0riu</bpmn:outgoing>
+ </bpmn:serviceTask>
+ </bpmn:process>
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="VNFLockActivity">
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="VNFLockActivity_Start">
+ <dc:Bounds x="173" y="102" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_102xlzi_di" bpmnElement="VNFLockActivity_End">
+ <dc:Bounds x="561" y="102" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="579" y="138" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_06vhbci_di" bpmnElement="SequenceFlow_06vhbci">
+ <di:waypoint xsi:type="dc:Point" x="209" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="255" y="120" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="232" y="105" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_01312aj_di" bpmnElement="SequenceFlow_01312aj">
+ <di:waypoint xsi:type="dc:Point" x="497" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="561" y="120" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="529" y="105" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_066idx4_di" bpmnElement="TaskLock">
+ <dc:Bounds x="397" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0cf0riu_di" bpmnElement="SequenceFlow_0cf0riu">
+ <di:waypoint xsi:type="dc:Point" x="355" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="397" y="120" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="376" y="105" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_0fti66x_di" bpmnElement="TaskPreProcessActivity">
+ <dc:Bounds x="255" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFSnapShotActivity.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFSnapShotActivity.bpmn
new file mode 100644
index 0000000000..8115f694c2
--- /dev/null
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFSnapShotActivity.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="VNFSnapShotActivity" name="VNFSnapShotActivity" isExecutable="true">
+ <bpmn:startEvent id="VNFSnapShotActivity_Start">
+ <bpmn:outgoing>SequenceFlow_06vhbci</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:endEvent id="VNFSnapShotActivity_End">
+ <bpmn:incoming>SequenceFlow_01312aj</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_06vhbci" sourceRef="VNFSnapShotActivity_Start" targetRef="TaskPreProcessActivity" />
+ <bpmn:sequenceFlow id="SequenceFlow_01312aj" sourceRef="TaskSnapShot" targetRef="VNFSnapShotActivity_End" />
+ <bpmn:serviceTask id="TaskSnapShot" name="VNF SnapShot" camunda:expression="${AppcRunTasks.runAppcCommand(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)),execution.getVariable(&#34;actionSnapshot&#34;))}">
+ <bpmn:incoming>SequenceFlow_0cf0riu</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_01312aj</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:serviceTask id="TaskPreProcessActivity" name="PreProcess Activity" camunda:expression="${AppcRunTasks.preProcessActivity(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:incoming>SequenceFlow_06vhbci</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0cf0riu</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="SequenceFlow_0cf0riu" sourceRef="TaskPreProcessActivity" targetRef="TaskSnapShot" />
+ </bpmn:process>
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="VNFSnapShotActivity">
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="VNFSnapShotActivity_Start">
+ <dc:Bounds x="173" y="102" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_102xlzi_di" bpmnElement="VNFSnapShotActivity_End">
+ <dc:Bounds x="561" y="102" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="579" y="138" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_06vhbci_di" bpmnElement="SequenceFlow_06vhbci">
+ <di:waypoint xsi:type="dc:Point" x="209" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="255" y="120" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="232" y="105" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_01312aj_di" bpmnElement="SequenceFlow_01312aj">
+ <di:waypoint xsi:type="dc:Point" x="497" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="561" y="120" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="529" y="105" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_066idx4_di" bpmnElement="TaskSnapShot">
+ <dc:Bounds x="397" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_0fti66x_di" bpmnElement="TaskPreProcessActivity">
+ <dc:Bounds x="255" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0cf0riu_di" bpmnElement="SequenceFlow_0cf0riu">
+ <di:waypoint xsi:type="dc:Point" x="355" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="397" y="120" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="376" y="105" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFStartActivity.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFStartActivity.bpmn
new file mode 100644
index 0000000000..f0490a9b61
--- /dev/null
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFStartActivity.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="VNFStartActivity" name="VNFStartActivity" isExecutable="true">
+ <bpmn:startEvent id="VNFStartActivity_Start">
+ <bpmn:outgoing>SequenceFlow_06vhbci</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:endEvent id="VNFStartActivity_End">
+ <bpmn:incoming>SequenceFlow_01312aj</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_06vhbci" sourceRef="VNFStartActivity_Start" targetRef="TaskPreProcessActivity" />
+ <bpmn:sequenceFlow id="SequenceFlow_01312aj" sourceRef="TaskStart" targetRef="VNFStartActivity_End" />
+ <bpmn:serviceTask id="TaskStart" name="VNF Start" camunda:expression="${AppcRunTasks.runAppcCommand(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)),execution.getVariable(&#34;actionStart&#34;))}">
+ <bpmn:incoming>SequenceFlow_0cf0riu</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_01312aj</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="SequenceFlow_0cf0riu" sourceRef="TaskPreProcessActivity" targetRef="TaskStart" />
+ <bpmn:serviceTask id="TaskPreProcessActivity" name="PreProcess Activity" camunda:expression="${AppcRunTasks.preProcessActivity(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:incoming>SequenceFlow_06vhbci</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0cf0riu</bpmn:outgoing>
+ </bpmn:serviceTask>
+ </bpmn:process>
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="VNFStartActivity">
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="VNFStartActivity_Start">
+ <dc:Bounds x="173" y="102" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_102xlzi_di" bpmnElement="VNFStartActivity_End">
+ <dc:Bounds x="561" y="102" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="579" y="138" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_06vhbci_di" bpmnElement="SequenceFlow_06vhbci">
+ <di:waypoint xsi:type="dc:Point" x="209" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="255" y="120" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="232" y="105" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_01312aj_di" bpmnElement="SequenceFlow_01312aj">
+ <di:waypoint xsi:type="dc:Point" x="497" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="561" y="120" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="529" y="105" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_066idx4_di" bpmnElement="TaskStart">
+ <dc:Bounds x="397" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0cf0riu_di" bpmnElement="SequenceFlow_0cf0riu">
+ <di:waypoint xsi:type="dc:Point" x="355" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="397" y="120" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="376" y="105" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_0fti66x_di" bpmnElement="TaskPreProcessActivity">
+ <dc:Bounds x="255" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFStopActivity.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFStopActivity.bpmn
new file mode 100644
index 0000000000..0e02295631
--- /dev/null
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFStopActivity.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="VNFStopActivity" name="VNFStopActivity" isExecutable="true">
+ <bpmn:startEvent id="VNFStopActivity_Start">
+ <bpmn:outgoing>SequenceFlow_06vhbci</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:endEvent id="VNFStopActivity_End">
+ <bpmn:incoming>SequenceFlow_01312aj</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_06vhbci" sourceRef="VNFStopActivity_Start" targetRef="TaskPreProcessActivity" />
+ <bpmn:sequenceFlow id="SequenceFlow_01312aj" sourceRef="TaskStop" targetRef="VNFStopActivity_End" />
+ <bpmn:serviceTask id="TaskStop" name="VNF Stop" camunda:expression="${AppcRunTasks.runAppcCommand(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)),execution.getVariable(&#34;actionStop&#34;))}">
+ <bpmn:incoming>SequenceFlow_0cf0riu</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_01312aj</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="SequenceFlow_0cf0riu" sourceRef="TaskPreProcessActivity" targetRef="TaskStop" />
+ <bpmn:serviceTask id="TaskPreProcessActivity" name="PreProcess Activity" camunda:expression="${AppcRunTasks.preProcessActivity(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:incoming>SequenceFlow_06vhbci</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0cf0riu</bpmn:outgoing>
+ </bpmn:serviceTask>
+ </bpmn:process>
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="VNFStopActivity">
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="VNFStopActivity_Start">
+ <dc:Bounds x="173" y="102" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_102xlzi_di" bpmnElement="VNFStopActivity_End">
+ <dc:Bounds x="561" y="102" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="579" y="138" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_06vhbci_di" bpmnElement="SequenceFlow_06vhbci">
+ <di:waypoint xsi:type="dc:Point" x="209" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="255" y="120" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="232" y="105" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_01312aj_di" bpmnElement="SequenceFlow_01312aj">
+ <di:waypoint xsi:type="dc:Point" x="497" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="561" y="120" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="529" y="105" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_066idx4_di" bpmnElement="TaskStop">
+ <dc:Bounds x="397" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0cf0riu_di" bpmnElement="SequenceFlow_0cf0riu">
+ <di:waypoint xsi:type="dc:Point" x="355" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="397" y="120" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="376" y="105" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_0fti66x_di" bpmnElement="TaskPreProcessActivity">
+ <dc:Bounds x="255" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFUnlockActivity.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFUnlockActivity.bpmn
new file mode 100644
index 0000000000..6d1b68cb7b
--- /dev/null
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFUnlockActivity.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="VNFUnlockActivity" name="VNFUnlockActivity" isExecutable="true">
+ <bpmn:startEvent id="VNFUnlockActivity_Start">
+ <bpmn:outgoing>SequenceFlow_06vhbci</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:endEvent id="VNFUnlockActivity_End">
+ <bpmn:incoming>SequenceFlow_01312aj</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_06vhbci" sourceRef="VNFUnlockActivity_Start" targetRef="TaskPreProcessActivity" />
+ <bpmn:sequenceFlow id="SequenceFlow_01312aj" sourceRef="TaskUnlock" targetRef="VNFUnlockActivity_End" />
+ <bpmn:serviceTask id="TaskUnlock" name="VNF Unlock" camunda:expression="${AppcRunTasks.runAppcCommand(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)),execution.getVariable(&#34;actionUnlock&#34;))}">
+ <bpmn:incoming>SequenceFlow_0cf0riu</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_01312aj</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="SequenceFlow_0cf0riu" sourceRef="TaskPreProcessActivity" targetRef="TaskUnlock" />
+ <bpmn:serviceTask id="TaskPreProcessActivity" name="PreProcess Activity" camunda:expression="${AppcRunTasks.preProcessActivity(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:incoming>SequenceFlow_06vhbci</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0cf0riu</bpmn:outgoing>
+ </bpmn:serviceTask>
+ </bpmn:process>
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="VNFUnlockActivity">
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="VNFUnlockActivity_Start">
+ <dc:Bounds x="173" y="102" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_102xlzi_di" bpmnElement="VNFUnlockActivity_End">
+ <dc:Bounds x="561" y="102" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="579" y="138" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_06vhbci_di" bpmnElement="SequenceFlow_06vhbci">
+ <di:waypoint xsi:type="dc:Point" x="209" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="255" y="120" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="232" y="105" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_01312aj_di" bpmnElement="SequenceFlow_01312aj">
+ <di:waypoint xsi:type="dc:Point" x="497" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="561" y="120" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="529" y="105" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_066idx4_di" bpmnElement="TaskUnlock">
+ <dc:Bounds x="397" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0cf0riu_di" bpmnElement="SequenceFlow_0cf0riu">
+ <di:waypoint xsi:type="dc:Point" x="355" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="397" y="120" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="376" y="105" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_0fti66x_di" bpmnElement="TaskPreProcessActivity">
+ <dc:Bounds x="255" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFUpgradeBackupActivity.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFUpgradeBackupActivity.bpmn
new file mode 100644
index 0000000000..dfcf9974ee
--- /dev/null
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFUpgradeBackupActivity.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="VNFUpgradeBackupActivity" name="VNFUpgradeBackupActivity" isExecutable="true">
+ <bpmn:startEvent id="VNFUpgradeBackupActivity_Start">
+ <bpmn:outgoing>SequenceFlow_06vhbci</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:endEvent id="VNFUpgradeBackupActivity_End">
+ <bpmn:incoming>SequenceFlow_01312aj</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_06vhbci" sourceRef="VNFUpgradeBackupActivity_Start" targetRef="TaskPreProcessActivity" />
+ <bpmn:sequenceFlow id="SequenceFlow_01312aj" sourceRef="TaskUpgradeBackup" targetRef="VNFUpgradeBackupActivity_End" />
+ <bpmn:serviceTask id="TaskUpgradeBackup" name="VNF UpgradeBackup" camunda:expression="${AppcRunTasks.runAppcCommand(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)),execution.getVariable(&#34;actionUpgradeBackup&#34;))}">
+ <bpmn:incoming>SequenceFlow_0cf0riu</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_01312aj</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="SequenceFlow_0cf0riu" sourceRef="TaskPreProcessActivity" targetRef="TaskUpgradeBackup" />
+ <bpmn:serviceTask id="TaskPreProcessActivity" name="PreProcess Activity" camunda:expression="${AppcRunTasks.preProcessActivity(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:incoming>SequenceFlow_06vhbci</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0cf0riu</bpmn:outgoing>
+ </bpmn:serviceTask>
+ </bpmn:process>
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="VNFUpgradeBackupActivity">
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="VNFUpgradeBackupActivity_Start">
+ <dc:Bounds x="173" y="102" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_102xlzi_di" bpmnElement="VNFUpgradeBackupActivity_End">
+ <dc:Bounds x="561" y="102" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="579" y="138" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_06vhbci_di" bpmnElement="SequenceFlow_06vhbci">
+ <di:waypoint xsi:type="dc:Point" x="209" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="255" y="120" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="232" y="105" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_01312aj_di" bpmnElement="SequenceFlow_01312aj">
+ <di:waypoint xsi:type="dc:Point" x="497" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="561" y="120" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="529" y="105" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_066idx4_di" bpmnElement="TaskUpgradeBackup">
+ <dc:Bounds x="397" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0cf0riu_di" bpmnElement="SequenceFlow_0cf0riu">
+ <di:waypoint xsi:type="dc:Point" x="355" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="397" y="120" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="376" y="105" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_0fti66x_di" bpmnElement="TaskPreProcessActivity">
+ <dc:Bounds x="255" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn
index 81d3226037..2437476b59 100644
--- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn
@@ -24,24 +24,23 @@
<camunda:in source="suppressRollback" target="suppressRollback" />
</bpmn:extensionElements>
<bpmn:incoming>SequenceFlow_0mew9im</bpmn:incoming>
- <bpmn:outgoing>SequenceFlow_07h9d4y</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_1hsqed1</bpmn:outgoing>
</bpmn:callActivity>
<bpmn:sequenceFlow id="SequenceFlow_0mqrkxv" sourceRef="Task_SelectBB" targetRef="ServiceTask_0e2p0xs" />
<bpmn:serviceTask id="Task_SelectBB" name="Select BB" camunda:expression="${WorkflowActionBBTasks.selectBB(execution)}">
<bpmn:incoming>SequenceFlow_1atzsgn</bpmn:incoming>
- <bpmn:incoming>SequenceFlow_005hi8o</bpmn:incoming>
<bpmn:incoming>SequenceFlow_1tfizxf</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_1pnkpim</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_0mqrkxv</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:exclusiveGateway id="ExclusiveGateway_Finished" default="SequenceFlow_01j184u">
- <bpmn:incoming>SequenceFlow_07h9d4y</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_1fftixk</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_1m2eezj</bpmn:outgoing>
<bpmn:outgoing>SequenceFlow_0v588sm</bpmn:outgoing>
<bpmn:outgoing>SequenceFlow_11530ei</bpmn:outgoing>
<bpmn:outgoing>SequenceFlow_01j184u</bpmn:outgoing>
<bpmn:outgoing>SequenceFlow_0l7kaba</bpmn:outgoing>
</bpmn:exclusiveGateway>
- <bpmn:sequenceFlow id="SequenceFlow_07h9d4y" sourceRef="Call_ExecuteBB" targetRef="ExclusiveGateway_Finished" />
<bpmn:sequenceFlow id="SequenceFlow_1m2eezj" name="Completed = true" sourceRef="ExclusiveGateway_Finished" targetRef="ExclusiveGateway_isTopLevelFlowC">
<bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("completed")==true&&execution.getVariable("isRollback")==false&&execution.getVariable("handlingCode")=="Success"}]]></bpmn:conditionExpression>
</bpmn:sequenceFlow>
@@ -114,10 +113,9 @@
<bpmn:sequenceFlow id="SequenceFlow_1p8yxu6" sourceRef="Task_AbortAndCallErrorHandling" targetRef="EndEvent_0lzz1ya" />
<bpmn:sequenceFlow id="SequenceFlow_1wb59ic" sourceRef="Task_SendSync" targetRef="Task_PreValidateWorkflow" />
<bpmn:sequenceFlow id="SequenceFlow_01j184u" sourceRef="ExclusiveGateway_Finished" targetRef="Task_0a31dkf" />
- <bpmn:sequenceFlow id="SequenceFlow_005hi8o" sourceRef="Task_0a31dkf" targetRef="Task_SelectBB" />
<bpmn:serviceTask id="Task_0a31dkf" name="Check Retry Status" camunda:expression="${WorkflowActionBBTasks.checkRetryStatus(execution)}">
<bpmn:incoming>SequenceFlow_01j184u</bpmn:incoming>
- <bpmn:outgoing>SequenceFlow_005hi8o</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_1pnkpim</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:exclusiveGateway id="ExclusiveGateway_isTopLevelFlow" name="Is Top-Level Flow?" default="SequenceFlow_0sckerv">
<bpmn:incoming>SequenceFlow_0vc9go9</bpmn:incoming>
@@ -187,6 +185,13 @@
<bpmn:incoming>SequenceFlow_1wb59ic</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_1tfizxf</bpmn:outgoing>
</bpmn:serviceTask>
+ <bpmn:serviceTask id="ServiceTask_0lbkcyp" name="Post Processing Execute BB" camunda:expression="${WorkflowActionBBTasks.postProcessingExecuteBB(execution)}">
+ <bpmn:incoming>SequenceFlow_1hsqed1</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1fftixk</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="SequenceFlow_1hsqed1" sourceRef="Call_ExecuteBB" targetRef="ServiceTask_0lbkcyp" />
+ <bpmn:sequenceFlow id="SequenceFlow_1fftixk" sourceRef="ServiceTask_0lbkcyp" targetRef="ExclusiveGateway_Finished" />
+ <bpmn:sequenceFlow id="SequenceFlow_1pnkpim" sourceRef="Task_0a31dkf" targetRef="Task_SelectBB" />
</bpmn:process>
<bpmn:error id="Error_0kd2o2a" name="java.lang.Exception" errorCode="java.lang.Exception" />
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
@@ -198,9 +203,9 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="EndEvent_1uv6erv_di" bpmnElement="End_WorkflowActionBB">
- <dc:Bounds x="1085" y="147" width="36" height="36" />
+ <dc:Bounds x="1304" y="147" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1094" y="127" width="18" height="12" />
+ <dc:Bounds x="1313" y="127" width="18" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_15s0okp_di" bpmnElement="SequenceFlow_15s0okp">
@@ -224,24 +229,17 @@
<dc:Bounds x="239" y="80" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ExclusiveGateway_0m1zt0q_di" bpmnElement="ExclusiveGateway_Finished" isMarkerVisible="true">
- <dc:Bounds x="692" y="95" width="50" height="50" />
+ <dc:Bounds x="911" y="95" width="50" height="50" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="676" y="42" width="0" height="0" />
+ <dc:Bounds x="850" y="42" width="90" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_07h9d4y_di" bpmnElement="SequenceFlow_07h9d4y">
- <di:waypoint xsi:type="dc:Point" x="660" y="120" />
- <di:waypoint xsi:type="dc:Point" x="692" y="120" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="676" y="99" width="0" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1m2eezj_di" bpmnElement="SequenceFlow_1m2eezj">
- <di:waypoint xsi:type="dc:Point" x="730" y="132" />
- <di:waypoint xsi:type="dc:Point" x="761" y="165" />
- <di:waypoint xsi:type="dc:Point" x="841" y="165" />
+ <di:waypoint xsi:type="dc:Point" x="949" y="132" />
+ <di:waypoint xsi:type="dc:Point" x="980" y="165" />
+ <di:waypoint xsi:type="dc:Point" x="1060" y="165" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="749" y="168" width="83" height="12" />
+ <dc:Bounds x="968" y="168" width="83" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ServiceTask_0kn8jt8_di" bpmnElement="Task_RetrieveBBExectuionList">
@@ -251,14 +249,14 @@
<dc:Bounds x="-132" y="-6" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ServiceTask_0wzh11j_di" bpmnElement="Task_UpdateRequestComplete">
- <dc:Bounds x="942" y="206" width="100" height="80" />
+ <dc:Bounds x="1161" y="206" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1pz6edz_di" bpmnElement="SequenceFlow_1pz6edz">
- <di:waypoint xsi:type="dc:Point" x="1042" y="246" />
- <di:waypoint xsi:type="dc:Point" x="1103" y="246" />
- <di:waypoint xsi:type="dc:Point" x="1103" y="183" />
+ <di:waypoint xsi:type="dc:Point" x="1261" y="246" />
+ <di:waypoint xsi:type="dc:Point" x="1322" y="246" />
+ <di:waypoint xsi:type="dc:Point" x="1322" y="183" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1027.5" y="231" width="90" height="0" />
+ <dc:Bounds x="1247" y="231" width="90" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="SubProcess_18226x4_di" bpmnElement="SubProcess_18226x4" isExpanded="true">
@@ -277,11 +275,11 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0v588sm_di" bpmnElement="SequenceFlow_0v588sm">
- <di:waypoint xsi:type="dc:Point" x="717" y="145" />
- <di:waypoint xsi:type="dc:Point" x="717" y="262" />
+ <di:waypoint xsi:type="dc:Point" x="936" y="145" />
+ <di:waypoint xsi:type="dc:Point" x="936" y="262" />
<di:waypoint xsi:type="dc:Point" x="339" y="262" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="597.5" y="272" width="73" height="12" />
+ <dc:Bounds x="769.202380952381" y="272" width="73" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1atzsgn_di" bpmnElement="SequenceFlow_1atzsgn">
@@ -302,29 +300,29 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_11530ei_di" bpmnElement="SequenceFlow_11530ei">
- <di:waypoint xsi:type="dc:Point" x="727" y="105" />
- <di:waypoint xsi:type="dc:Point" x="764" y="44" />
- <di:waypoint xsi:type="dc:Point" x="841" y="45" />
+ <di:waypoint xsi:type="dc:Point" x="946" y="105" />
+ <di:waypoint xsi:type="dc:Point" x="983" y="44" />
+ <di:waypoint xsi:type="dc:Point" x="1060" y="45" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="756" y="17.269982652857244" width="57" height="12" />
+ <dc:Bounds x="975" y="17" width="58" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ServiceTask_0jo36ez_di" bpmnElement="Task_AbortAndCallErrorHandling">
- <dc:Bounds x="957" y="-76" width="100" height="80" />
+ <dc:Bounds x="1176" y="-76" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="EndEvent_0lzz1ya_di" bpmnElement="EndEvent_0lzz1ya">
- <dc:Bounds x="1167" y="27" width="36" height="36" />
+ <dc:Bounds x="1386" y="27" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1176" y="67" width="18" height="12" />
+ <dc:Bounds x="1395" y="67" width="18" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1p8yxu6_di" bpmnElement="SequenceFlow_1p8yxu6">
- <di:waypoint xsi:type="dc:Point" x="1057" y="-36" />
- <di:waypoint xsi:type="dc:Point" x="1140" y="-36" />
- <di:waypoint xsi:type="dc:Point" x="1140" y="45" />
- <di:waypoint xsi:type="dc:Point" x="1167" y="45" />
+ <di:waypoint xsi:type="dc:Point" x="1276" y="-36" />
+ <di:waypoint xsi:type="dc:Point" x="1359" y="-36" />
+ <di:waypoint xsi:type="dc:Point" x="1359" y="45" />
+ <di:waypoint xsi:type="dc:Point" x="1386" y="45" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1155" y="4.5" width="0" height="0" />
+ <dc:Bounds x="1329" y="5" width="90" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1wb59ic_di" bpmnElement="SequenceFlow_1wb59ic">
@@ -337,24 +335,16 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_01j184u_di" bpmnElement="SequenceFlow_01j184u">
- <di:waypoint xsi:type="dc:Point" x="717" y="95" />
- <di:waypoint xsi:type="dc:Point" x="717" y="55" />
- <di:waypoint xsi:type="dc:Point" x="717" y="55" />
- <di:waypoint xsi:type="dc:Point" x="717" y="4" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="732" y="49" width="0" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_005hi8o_di" bpmnElement="SequenceFlow_005hi8o">
- <di:waypoint xsi:type="dc:Point" x="667" y="-36" />
- <di:waypoint xsi:type="dc:Point" x="289" y="-36" />
- <di:waypoint xsi:type="dc:Point" x="289" y="80" />
+ <di:waypoint xsi:type="dc:Point" x="936" y="95" />
+ <di:waypoint xsi:type="dc:Point" x="936" y="55" />
+ <di:waypoint xsi:type="dc:Point" x="936" y="55" />
+ <di:waypoint xsi:type="dc:Point" x="936" y="4" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="433" y="-51" width="90" height="0" />
+ <dc:Bounds x="906" y="49" width="90" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ServiceTask_1c1v3p1_di" bpmnElement="Task_0a31dkf">
- <dc:Bounds x="667" y="-76" width="100" height="80" />
+ <dc:Bounds x="886" y="-76" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ExclusiveGateway_0ptb1yi_di" bpmnElement="ExclusiveGateway_isTopLevelFlow" isMarkerVisible="true">
<dc:Bounds x="-228" y="95" width="50" height="50" />
@@ -378,68 +368,68 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ExclusiveGateway_001g41v_di" bpmnElement="ExclusiveGateway_isTopLevelFlowAbort" isMarkerVisible="true">
- <dc:Bounds x="841" y="20" width="50" height="50" />
+ <dc:Bounds x="1060" y="20" width="50" height="50" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="836" y="70" width="60" height="24" />
+ <dc:Bounds x="1055" y="70" width="61" height="24" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_02ksbt0_di" bpmnElement="SequenceFlow_02ksbt0">
- <di:waypoint xsi:type="dc:Point" x="866" y="20" />
- <di:waypoint xsi:type="dc:Point" x="866" y="-37" />
- <di:waypoint xsi:type="dc:Point" x="957" y="-37" />
+ <di:waypoint xsi:type="dc:Point" x="1085" y="20" />
+ <di:waypoint xsi:type="dc:Point" x="1085" y="-37" />
+ <di:waypoint xsi:type="dc:Point" x="1176" y="-37" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="872" y="-8.5" width="18" height="12" />
+ <dc:Bounds x="1091" y="-8" width="19" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1r570x3_di" bpmnElement="SequenceFlow_1r570x3">
- <di:waypoint xsi:type="dc:Point" x="891" y="45" />
- <di:waypoint xsi:type="dc:Point" x="1167" y="45" />
+ <di:waypoint xsi:type="dc:Point" x="1110" y="45" />
+ <di:waypoint xsi:type="dc:Point" x="1386" y="45" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1023" y="20" width="12" height="12" />
+ <dc:Bounds x="1242" y="20" width="12" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ExclusiveGateway_1er1kam_di" bpmnElement="ExclusiveGateway_isTopLevelFlowC" isMarkerVisible="true">
- <dc:Bounds x="841" y="140" width="50" height="50" />
+ <dc:Bounds x="1060" y="140" width="50" height="50" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="836" y="108" width="60" height="24" />
+ <dc:Bounds x="1055" y="108" width="61" height="24" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0x4urgp_di" bpmnElement="SequenceFlow_0x4urgp">
- <di:waypoint xsi:type="dc:Point" x="891" y="165" />
- <di:waypoint xsi:type="dc:Point" x="1001" y="165" />
- <di:waypoint xsi:type="dc:Point" x="1001" y="165" />
- <di:waypoint xsi:type="dc:Point" x="1085" y="165" />
+ <di:waypoint xsi:type="dc:Point" x="1110" y="165" />
+ <di:waypoint xsi:type="dc:Point" x="1220" y="165" />
+ <di:waypoint xsi:type="dc:Point" x="1220" y="165" />
+ <di:waypoint xsi:type="dc:Point" x="1304" y="165" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1037.2153846153847" y="140" width="12" height="12" />
+ <dc:Bounds x="1256" y="140" width="12" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="EndEvent_1q8eh5e_di" bpmnElement="End_RollbackFailed">
- <dc:Bounds x="940" y="347" width="36" height="36" />
+ <dc:Bounds x="1159" y="347" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="958" y="399" width="18" height="12" />
+ <dc:Bounds x="1177" y="399" width="18" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_11dlyzt_di" bpmnElement="SequenceFlow_11dlyzt">
<di:waypoint xsi:type="dc:Point" x="289" y="302" />
<di:waypoint xsi:type="dc:Point" x="289" y="368" />
- <di:waypoint xsi:type="dc:Point" x="741" y="368" />
+ <di:waypoint xsi:type="dc:Point" x="960" y="368" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="340.85361216730035" y="325" width="63" height="24" />
+ <dc:Bounds x="381.45685840707966" y="325" width="63" height="24" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ServiceTask_1h154rn_di" bpmnElement="Task_UpdateDb">
<dc:Bounds x="713" y="617" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ServiceTask_1t8n9gd_di" bpmnElement="Task_UpdateRequestToFailed">
- <dc:Bounds x="741" y="325" width="100" height="80" />
+ <dc:Bounds x="960" y="325" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0l7kaba_di" bpmnElement="SequenceFlow_0l7kaba">
- <di:waypoint xsi:type="dc:Point" x="723" y="139" />
- <di:waypoint xsi:type="dc:Point" x="757" y="252" />
- <di:waypoint xsi:type="dc:Point" x="797" y="252" />
- <di:waypoint xsi:type="dc:Point" x="797" y="325" />
+ <di:waypoint xsi:type="dc:Point" x="942" y="139" />
+ <di:waypoint xsi:type="dc:Point" x="976" y="252" />
+ <di:waypoint xsi:type="dc:Point" x="1016" y="252" />
+ <di:waypoint xsi:type="dc:Point" x="1016" y="325" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="739.7268586738111" y="255.4388401674105" width="52" height="24" />
+ <dc:Bounds x="959" y="255" width="52" height="24" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1edjl5x_di" bpmnElement="SequenceFlow_1edjl5x">
@@ -457,12 +447,12 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1ui67mc_di" bpmnElement="SequenceFlow_1ui67mc">
- <di:waypoint xsi:type="dc:Point" x="841" y="365" />
- <di:waypoint xsi:type="dc:Point" x="915" y="365" />
- <di:waypoint xsi:type="dc:Point" x="915" y="365" />
- <di:waypoint xsi:type="dc:Point" x="940" y="365" />
+ <di:waypoint xsi:type="dc:Point" x="1060" y="365" />
+ <di:waypoint xsi:type="dc:Point" x="1134" y="365" />
+ <di:waypoint xsi:type="dc:Point" x="1134" y="365" />
+ <di:waypoint xsi:type="dc:Point" x="1159" y="365" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="885" y="359" width="90" height="13" />
+ <dc:Bounds x="1104" y="359" width="90" height="13" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ExclusiveGateway_10q79b6_di" bpmnElement="ExclusiveGateway_10q79b6" isMarkerVisible="true">
@@ -541,11 +531,11 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0kf5sen_di" bpmnElement="SequenceFlow_0kf5sen">
- <di:waypoint xsi:type="dc:Point" x="866" y="190" />
- <di:waypoint xsi:type="dc:Point" x="866" y="246" />
- <di:waypoint xsi:type="dc:Point" x="942" y="246" />
+ <di:waypoint xsi:type="dc:Point" x="1085" y="190" />
+ <di:waypoint xsi:type="dc:Point" x="1085" y="246" />
+ <di:waypoint xsi:type="dc:Point" x="1161" y="246" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="872" y="217.6" width="18" height="12" />
+ <dc:Bounds x="1091" y="218" width="19" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1tfizxf_di" bpmnElement="SequenceFlow_1tfizxf">
@@ -560,6 +550,31 @@
<bpmndi:BPMNShape id="ServiceTask_0m5xr0e_di" bpmnElement="Task_PreValidateWorkflow">
<dc:Bounds x="80" y="80" width="100" height="80" />
</bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_0lbkcyp_di" bpmnElement="ServiceTask_0lbkcyp">
+ <dc:Bounds x="735" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1hsqed1_di" bpmnElement="SequenceFlow_1hsqed1">
+ <di:waypoint xsi:type="dc:Point" x="660" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="735" y="120" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="697.5" y="99" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1fftixk_di" bpmnElement="SequenceFlow_1fftixk">
+ <di:waypoint xsi:type="dc:Point" x="835" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="911" y="120" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="873" y="99" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1pnkpim_di" bpmnElement="SequenceFlow_1pnkpim">
+ <di:waypoint xsi:type="dc:Point" x="886" y="-36" />
+ <di:waypoint xsi:type="dc:Point" x="289" y="-36" />
+ <di:waypoint xsi:type="dc:Point" x="289" y="80" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="587.5" y="-57" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFHealthCheckActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFHealthCheckActivityTest.java
index 9c745fd512..8e76f8f4d1 100644
--- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFHealthCheckActivityTest.java
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFHealthCheckActivityTest.java
@@ -25,7 +25,6 @@ import static org.mockito.Mockito.doThrow;
import org.camunda.bpm.engine.delegate.BpmnError;
import org.camunda.bpm.engine.runtime.ProcessInstance;
-import org.junit.Ignore;
import org.junit.Test;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.BaseBPMNTest;
@@ -44,8 +43,8 @@ public class VNFHealthCheckActivityTest extends BaseBPMNTest{
}
@Test
- @Ignore
public void rainyDayVNFHealthCheckActivity_Test() throws Exception {
+ variables.put("actionHealthCheck", Action.HealthCheck);
doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks)
.runAppcCommand(any(BuildingBlockExecution.class), any(Action.class));
ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFHealthCheckActivity", variables);
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFLockActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFLockActivityTest.java
new file mode 100644
index 0000000000..f36a72fc01
--- /dev/null
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFLockActivityTest.java
@@ -0,0 +1,57 @@
+/*-
+ * ============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 org.camunda.bpm.engine.delegate.BpmnError;
+import org.camunda.bpm.engine.runtime.ProcessInstance;
+import org.junit.Test;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.BaseBPMNTest;
+import org.onap.appc.client.lcm.model.Action;
+
+public class VNFLockActivityTest extends BaseBPMNTest{
+ @Test
+ public void sunnyDayVNFLockActivity_Test() throws InterruptedException {
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFLockActivity", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassedInOrder("VNFLockActivity_Start",
+ "TaskPreProcessActivity",
+ "TaskLock",
+ "VNFLockActivity_End");
+ assertThat(pi).isEnded();
+ }
+
+ @Test
+ public void rainyDayVNFLockActivity_Test() throws Exception {
+ variables.put("actionLock", Action.Lock);
+ doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks)
+ .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class));
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFLockActivity", variables);
+ assertThat(pi).isNotNull().isStarted().hasPassedInOrder("VNFLockActivity_Start",
+ "TaskPreProcessActivity",
+ "TaskLock").hasNotPassed(
+ "VNFLockActivity_End");
+ }
+
+}
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFQuiesceTrafficActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFQuiesceTrafficActivityTest.java
index e8d603ea9a..2d9b952509 100644
--- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFQuiesceTrafficActivityTest.java
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFQuiesceTrafficActivityTest.java
@@ -25,7 +25,6 @@ import static org.mockito.Mockito.doThrow;
import org.camunda.bpm.engine.delegate.BpmnError;
import org.camunda.bpm.engine.runtime.ProcessInstance;
-import org.junit.Ignore;
import org.junit.Test;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.BaseBPMNTest;
@@ -44,8 +43,8 @@ public class VNFQuiesceTrafficActivityTest extends BaseBPMNTest{
}
@Test
- @Ignore
public void rainyDayVNFQuiesceTrafficActivity_Test() throws Exception {
+ variables.put("actionQuiesceTraffic", Action.QuiesceTraffic);
doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks)
.runAppcCommand(any(BuildingBlockExecution.class), any(Action.class));
ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFQuiesceTrafficActivity", variables);
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFResumeTrafficActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFResumeTrafficActivityTest.java
index 75ff1eb32d..d541cdf834 100644
--- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFResumeTrafficActivityTest.java
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFResumeTrafficActivityTest.java
@@ -25,7 +25,6 @@ import static org.mockito.Mockito.doThrow;
import org.camunda.bpm.engine.delegate.BpmnError;
import org.camunda.bpm.engine.runtime.ProcessInstance;
-import org.junit.Ignore;
import org.junit.Test;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.BaseBPMNTest;
@@ -44,8 +43,8 @@ public class VNFResumeTrafficActivityTest extends BaseBPMNTest{
}
@Test
- @Ignore
public void rainyDayVNFResumeTrafficActivity_Test() throws Exception {
+ variables.put("actionResumeTraffic", Action.ResumeTraffic);
doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks)
.runAppcCommand(any(BuildingBlockExecution.class), any(Action.class));
ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFResumeTrafficActivity", variables);
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFSnapShotActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFSnapShotActivityTest.java
new file mode 100644
index 0000000000..f6bfd04d03
--- /dev/null
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFSnapShotActivityTest.java
@@ -0,0 +1,57 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.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 org.camunda.bpm.engine.delegate.BpmnError;
+import org.camunda.bpm.engine.runtime.ProcessInstance;
+import org.junit.Test;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.BaseBPMNTest;
+import org.onap.appc.client.lcm.model.Action;
+
+public class VNFSnapShotActivityTest extends BaseBPMNTest{
+ @Test
+ public void sunnyDayVNFSnapShotActivity_Test() throws InterruptedException {
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFSnapShotActivity", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassedInOrder("VNFSnapShotActivity_Start",
+ "TaskPreProcessActivity",
+ "TaskSnapShot",
+ "VNFSnapShotActivity_End");
+ assertThat(pi).isEnded();
+ }
+
+ @Test
+ public void rainyDayVNFSnapShotActivity_Test() throws Exception {
+ variables.put("actionSnapshot", Action.Snapshot);
+ doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks)
+ .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class));
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFSnapShotActivity", variables);
+ assertThat(pi).isNotNull().isStarted().hasPassedInOrder("VNFSnapShotActivity_Start",
+ "TaskPreProcessActivity",
+ "TaskSnapShot").hasNotPassed(
+ "VNFSnapShotActivity_End");
+ }
+
+}
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFStartActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFStartActivityTest.java
new file mode 100644
index 0000000000..6e4be69a91
--- /dev/null
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFStartActivityTest.java
@@ -0,0 +1,57 @@
+/*-
+ * ============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 org.camunda.bpm.engine.delegate.BpmnError;
+import org.camunda.bpm.engine.runtime.ProcessInstance;
+import org.junit.Test;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.BaseBPMNTest;
+import org.onap.appc.client.lcm.model.Action;
+
+public class VNFStartActivityTest extends BaseBPMNTest{
+ @Test
+ public void sunnyDayVNFStartActivity_Test() throws InterruptedException {
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFStartActivity", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassedInOrder("VNFStartActivity_Start",
+ "TaskPreProcessActivity",
+ "TaskStart",
+ "VNFStartActivity_End");
+ assertThat(pi).isEnded();
+ }
+
+ @Test
+ public void rainyDayVNFStartActivity_Test() throws Exception {
+ variables.put("actionStart", Action.Start);
+ doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks)
+ .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class));
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFStartActivity", variables);
+ assertThat(pi).isNotNull().isStarted().hasPassedInOrder("VNFStartActivity_Start",
+ "TaskPreProcessActivity",
+ "TaskStart").hasNotPassed(
+ "VNFStartActivity_End");
+ }
+
+}
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFStopActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFStopActivityTest.java
new file mode 100644
index 0000000000..3bc5940493
--- /dev/null
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFStopActivityTest.java
@@ -0,0 +1,57 @@
+/*-
+ * ============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 org.camunda.bpm.engine.delegate.BpmnError;
+import org.camunda.bpm.engine.runtime.ProcessInstance;
+import org.junit.Test;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.BaseBPMNTest;
+import org.onap.appc.client.lcm.model.Action;
+
+public class VNFStopActivityTest extends BaseBPMNTest{
+ @Test
+ public void sunnyDayVNFStopActivity_Test() throws InterruptedException {
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFStopActivity", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassedInOrder("VNFStopActivity_Start",
+ "TaskPreProcessActivity",
+ "TaskStop",
+ "VNFStopActivity_End");
+ assertThat(pi).isEnded();
+ }
+
+ @Test
+ public void rainyDayVNFStopActivity_Test() throws Exception {
+ variables.put("actionStop", Action.Stop);
+ doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks)
+ .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class));
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFStopActivity", variables);
+ assertThat(pi).isNotNull().isStarted().hasPassedInOrder("VNFStopActivity_Start",
+ "TaskPreProcessActivity",
+ "TaskStop").hasNotPassed(
+ "VNFStopActivity_End");
+ }
+
+}
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnlockActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnlockActivityTest.java
new file mode 100644
index 0000000000..d0db70b2aa
--- /dev/null
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnlockActivityTest.java
@@ -0,0 +1,57 @@
+/*-
+ * ============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 org.camunda.bpm.engine.delegate.BpmnError;
+import org.camunda.bpm.engine.runtime.ProcessInstance;
+import org.junit.Test;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.BaseBPMNTest;
+import org.onap.appc.client.lcm.model.Action;
+
+public class VNFUnlockActivityTest extends BaseBPMNTest{
+ @Test
+ public void sunnyDayVNFUnlockActivity_Test() throws InterruptedException {
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUnlockActivity", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassedInOrder("VNFUnlockActivity_Start",
+ "TaskPreProcessActivity",
+ "TaskUnlock",
+ "VNFUnlockActivity_End");
+ assertThat(pi).isEnded();
+ }
+
+ @Test
+ public void rainyDayVNFUnlockActivity_Test() throws Exception {
+ variables.put("actionUnlock", Action.Unlock);
+ doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks)
+ .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class));
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUnlockActivity", variables);
+ assertThat(pi).isNotNull().isStarted().hasPassedInOrder("VNFUnlockActivity_Start",
+ "TaskPreProcessActivity",
+ "TaskUnlock").hasNotPassed(
+ "VNFUnlockActivity_End");
+ }
+
+}
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradeBackupActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradeBackupActivityTest.java
new file mode 100644
index 0000000000..c68196c3bf
--- /dev/null
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradeBackupActivityTest.java
@@ -0,0 +1,60 @@
+/*-
+ * ============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.bpmn.BpmnAwareAssertions.assertThat;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.doThrow;
+
+import org.camunda.bpm.engine.delegate.BpmnError;
+import org.camunda.bpm.engine.runtime.ProcessInstance;
+import org.junit.Test;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.BaseBPMNTest;
+import org.onap.appc.client.lcm.model.Action;
+
+public class VNFUpgradeBackupActivityTest extends BaseBPMNTest{
+ @Test
+ public void sunnyDayVNFUpgradeBackupActivity_Test() throws InterruptedException {
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUpgradeBackupActivity", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassedInOrder("VNFUpgradeBackupActivity_Start",
+ "TaskPreProcessActivity",
+ "TaskUpgradeBackup",
+ "VNFUpgradeBackupActivity_End");
+ assertThat(pi).isEnded();
+ }
+
+ @Test
+ public void rainyDayVNFUpgradeBackupActivity_Test() throws Exception {
+ variables.put("actionUpgradeBackup", Action.UpgradeBackup);
+ doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks)
+ .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class));
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUpgradeBackupActivity", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassedInOrder("VNFUpgradeBackupActivity_Start",
+ "TaskPreProcessActivity",
+ "TaskUpgradeBackup").hasNotPassed(
+ "VNFUpgradeBackupActivity_End");
+ assertThat(pi).isEnded();
+ }
+
+}
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradePostCheckActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradePostCheckActivityTest.java
index b3976ade1f..5fa930712d 100644
--- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradePostCheckActivityTest.java
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradePostCheckActivityTest.java
@@ -25,7 +25,6 @@ import static org.mockito.Mockito.doThrow;
import org.camunda.bpm.engine.delegate.BpmnError;
import org.camunda.bpm.engine.runtime.ProcessInstance;
-import org.junit.Ignore;
import org.junit.Test;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.BaseBPMNTest;
@@ -43,8 +42,9 @@ public class VNFUpgradePostCheckActivityTest extends BaseBPMNTest{
}
@Test
- @Ignore
public void rainyDayVNFUpgradePostCheckActivity_Test() throws Exception {
+ variables.put("actionUpgradePostCheck", Action.UpgradePostCheck);
+
doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks)
.runAppcCommand(any(BuildingBlockExecution.class), any(Action.class));
ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUpgradePostCheckActivity", variables);
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradePreCheckActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradePreCheckActivityTest.java
index 15f314bd20..40f5df8dae 100644
--- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradePreCheckActivityTest.java
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradePreCheckActivityTest.java
@@ -25,7 +25,6 @@ import static org.mockito.Mockito.doThrow;
import org.camunda.bpm.engine.delegate.BpmnError;
import org.camunda.bpm.engine.runtime.ProcessInstance;
-import org.junit.Ignore;
import org.junit.Test;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.BaseBPMNTest;
@@ -44,8 +43,8 @@ public class VNFUpgradePreCheckActivityTest extends BaseBPMNTest{
}
@Test
- @Ignore
public void rainyDayVNFUpgradePreCheckActivity_Test() throws Exception {
+ variables.put("actionUpgradePreCheck", Action.UpgradePreCheck);
doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks)
.runAppcCommand(any(BuildingBlockExecution.class), any(Action.class));
ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUpgradePreCheckActivity", variables);
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradeSoftwareActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradeSoftwareActivityTest.java
index 11f88d29f7..91e6bf40be 100644
--- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradeSoftwareActivityTest.java
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradeSoftwareActivityTest.java
@@ -25,7 +25,6 @@ import static org.mockito.Mockito.doThrow;
import org.camunda.bpm.engine.delegate.BpmnError;
import org.camunda.bpm.engine.runtime.ProcessInstance;
-import org.junit.Ignore;
import org.junit.Test;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.BaseBPMNTest;
@@ -44,8 +43,8 @@ public class VNFUpgradeSoftwareActivityTest extends BaseBPMNTest{
}
@Test
- @Ignore
public void rainyDayVNFUpgradeSoftwareActivity_Test() throws Exception {
+ variables.put("actionUpgradeSoftware", Action.UpgradeSoftware);
doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks)
.runAppcCommand(any(BuildingBlockExecution.class), any(Action.class));
ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUpgradeSoftwareActivity", variables);
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 0c8477ca20..21426c1d51 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
@@ -325,9 +325,9 @@ public class CreateCustomE2EServiceInstance extends AbstractServiceTaskProcessor
logger.debug("CreateVfModuleInfra Outgoing updateServiceOperStatusRequest Request: " + payload)
}catch(Exception e){
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occured Processing prepareInitServiceOperationStatus.", "BPMN",
- MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during prepareInitServiceOperationStatus Method:\n" + e.getMessage())
}
logger.trace("finished prepareInitServiceOperationStatus")
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 e3ac04e9e3..116328b05d 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
@@ -252,8 +252,8 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor {
String restFaultMessage = e.getMessage()
//execution.setVariable("CVFMODVOL2_RESTFault", restFaultMessage)
//execution.setVariable("CVFMODVOL2_isDataOk", false)
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- " Exception Encountered - " + "\n" + restFaultMessage, "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ " Exception Encountered - " + "\n" + restFaultMessage, "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 400, "Internal Error - During PreProcessRequest")
}
@@ -302,8 +302,8 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- "Exception Encountered ", "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Encountered ", "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage())
}
@@ -403,9 +403,9 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor {
logger.debug("Outgoing MsoCompletionRequest: \n" + payload)
}catch(Exception e){
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occured Processing PostProcessResponse - " + "\n", "BPMN",
- MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
execution.setVariable("CVFMI_ErrorResponse", "Error Occured during PostProcessResponse Method:\n" + e.getMessage())
}
logger.trace("COMPLETED PostProcessResponse Process")
@@ -480,8 +480,8 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- "Caught exception in " + method , "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Caught exception in " + method , "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Invalid Message")
}
@@ -529,8 +529,8 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor {
logger.debug("CreateVfModuleInfra Outgoing UpdateInfra Request: " + payload)
}catch(Exception e){
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- "Exception Occured Processing prepareUpdateInfraRequest.", "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Occured Processing prepareUpdateInfraRequest.", "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during prepareUpdateInfraRequest Method:\n" + e.getMessage())
}
@@ -585,8 +585,8 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- "Caught exception in " + method , "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Caught exception in " + method , "BPMN",
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/CreateVfModuleVolumeInfraV1.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1.groovy
index d85ea481d5..26690ece48 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
@@ -310,7 +310,8 @@ class CreateVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor {
String xmlHandlerRequest = utils.formatXml(falloutHandlerRequest)
execution.setVariable(prefix+'FalloutHandlerRequest', xmlHandlerRequest)
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Overall Error Response going to FalloutHandler", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "\n" + xmlHandlerRequest);
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Overall Error Response " +
+ "going to FalloutHandler", "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), "\n" + xmlHandlerRequest);
}
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 29eb47c1e7..1c2975b06c 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
@@ -168,7 +168,8 @@ 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'
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError.getValue());
+ logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -193,7 +194,8 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor {
logger.debug("Rethrowing MSOWorkflowException")
throw b
}catch(Exception 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)
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), " Error Occurred in " +
+ "CreateVnfInfra PreProcessRequest method", "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e)
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occurred in CreateVnfInfra PreProcessRequest")
}
@@ -218,7 +220,7 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor {
execution.setVariable("CREVI_sentSyncResponse", true)
} catch (Exception ex) {
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), " Error Occurred in CreateVnfInfra SendSyncResponse Process", "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), " Error Occurred in CreateVnfInfra SendSyncResponse Process", "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e)
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in CreateVnfInfra SendSyncResponse Process")
@@ -244,7 +246,7 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor {
logger.debug("Outgoing AssignSDNCRequest is: \n" + assignSDNCRequest)
}catch(Exception e){
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occurred Processing preProcessSDNCAssignRequest", "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occurred Processing preProcessSDNCAssignRequest", "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during prepareProvision Method:\n" + e.getMessage())
}
@@ -268,7 +270,8 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor {
logger.debug("Outgoing CommitSDNCRequest is: \n" + activateSDNCRequest)
}catch(Exception e){
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing preProcessSDNCActivateRequest", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e)
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured " +
+ "Processing preProcessSDNCActivateRequest", "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessSDNCActivateRequest Method:\n" + e.getMessage())
}
logger.trace("COMPLETED preProcessSDNCActivateRequest Process")
@@ -458,7 +461,8 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor {
logger.debug("obtained VNF list: " + vnfs)
if (vnfs == null) {
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "No matching VNFs in Catalog DB for vnfModelCustomizationUuid=" + vnfModelCustomizationUuid, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "");
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "No matching " +
+ "VNFs in Catalog DB for vnfModelCustomizationUuid=" + vnfModelCustomizationUuid, "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), "");
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "No matching VNFs in Catalog DB for vnfModelCustomizationUuid=" + vnfModelCustomizationUuid)
}
@@ -466,7 +470,8 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor {
JSONObject vnf = vnfs.get(0)
if (vnf == null) {
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "No matching VNF in Catalog DB for vnfModelCustomizationUuid=" + vnfModelCustomizationUuid, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "");
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "No matching VNF" +
+ " in Catalog DB for vnfModelCustomizationUuid=" + vnfModelCustomizationUuid, "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), "");
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "No matching VNF in Catalog DB for vnfModelCustomizationUuid=" + vnfModelCustomizationUuid)
}
@@ -538,7 +543,8 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor {
aaiCR.createAAILineOfBusiness(lineOfBusiness, vnfId)
}catch(Exception ex){
String msg = "Exception in LineOfBusiness. " + ex.getMessage();
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + ex)
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + ex)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
}
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 0008f6fd65..a19b7b7870 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
@@ -357,9 +357,9 @@ public class DeleteNetworkInstance extends AbstractServiceTaskProcessor {
logger.debug(falloutHandlerRequest)
execution.setVariable(Prefix + "FalloutHandlerRequest", falloutHandlerRequest)
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Overall Error Response going to FalloutHandler: " + "\n" + falloutHandlerRequest, "BPMN",
- MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue())
+ MsoLogger.ErrorCode.UnknownError.getValue())
} catch (Exception ex) {
// caught exception
@@ -380,9 +380,9 @@ public class DeleteNetworkInstance extends AbstractServiceTaskProcessor {
</aetgt:WorkflowException>
</aetgt:FalloutHandlerRequest>"""
execution.setVariable(Prefix + "FalloutHandlerRequest", falloutHandlerRequest)
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 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)
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + ex)
}
}
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 357ce69d50..234482f83c 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
@@ -126,8 +126,8 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor {
}
catch(Exception e) {
String restFaultMessage = e.getMessage()
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Caught exception",
- "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Caught exception",
+ "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(),
"Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Internal Error - During PreProcess Request")
}
@@ -159,8 +159,8 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- "Caught exception in " + method, "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Caught exception in " + method, "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preProcessRequest(): ' + e.getMessage())
}
@@ -202,8 +202,8 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- "Caught exception in " + method, "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Caught exception in " + method, "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage())
}
@@ -229,7 +229,8 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in '
+ + method, "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepDoDeleteVfModule(): ' + e.getMessage())
}
}
@@ -276,8 +277,8 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepInfraRequest(): ' + e.getMessage())
}
@@ -321,8 +322,8 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, 'Internal Error')
}
@@ -374,8 +375,8 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN",
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 9675e89249..c48527a64f 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
@@ -464,8 +464,8 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor {
logger.debug(xmlHandlerRequest)
execution.setVariable("DELVfModVol_FalloutHandlerRequest", xmlHandlerRequest)
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- "Overall Error Response going to FalloutHandler", "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Overall Error Response going to FalloutHandler", "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), "\n" + xmlHandlerRequest);
}
@@ -485,9 +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
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Error in DeleteVfModuleVolume: " + "\n" + errorMessage, "BPMN",
- MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
+ 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/DoCreateE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy
index aac4b72b06..e35268c45a 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
@@ -442,8 +442,8 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
logger.debug("CreateVfModuleInfra Outgoing initResourceOperationStatus Request: " + payload)
}catch(Exception e){
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- "Exception Occured Processing preInitResourcesOperStatus.", "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Occured Processing preInitResourcesOperStatus.", "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), e);
execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preInitResourcesOperStatus Method:\n" + e.getMessage())
}
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 b17b0a37b7..418a1bdd9b 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
@@ -234,8 +234,8 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces
getAAIClient().connect(nsUri,relatedServiceUri)
logger.info("NS relationship to Service added successfully")
}catch(Exception e){
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- "Exception occured while executing AAI Put Call", "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception occured while executing AAI Put Call", "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
throw new BpmnError("MSOWorkflowException")
}
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 9ee8ff8b67..80bc201ecd 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
@@ -568,8 +568,8 @@ 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'
- 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, 2000, msg)
}
@@ -620,8 +620,8 @@ public class DoCreateVfModule extends VfModuleBase {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Internal Error')
@@ -749,8 +749,8 @@ public class DoCreateVfModule extends VfModuleBase {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIVfModule(): ' + e.getMessage())
}
@@ -830,8 +830,8 @@ public class DoCreateVfModule extends VfModuleBase {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIVfModuleForStatus(): ' + e.getMessage())
}
@@ -866,8 +866,8 @@ public class DoCreateVfModule extends VfModuleBase {
logger.debug("Outgoing AssignSDNCRequest is: \n" + assignSDNCRequest)
}catch(Exception e){
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- "Exception Occurred Processing preProcessSDNCAssignRequest", "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Occurred Processing preProcessSDNCAssignRequest", "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during prepareProvision Method:\n" + e.getMessage())
}
@@ -960,8 +960,8 @@ public class DoCreateVfModule extends VfModuleBase {
logger.debug("Outgoing GetSDNCRequest is: \n" + SDNCGetRequest)
}catch(Exception e){
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- "Exception Occurred Processing preProcessSDNCGetRequest", "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Occurred Processing preProcessSDNCGetRequest", "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during prepareProvision Method:\n" + e.getMessage())
}
@@ -1165,8 +1165,8 @@ public class DoCreateVfModule extends VfModuleBase {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Invalid Message")
}
@@ -1555,9 +1555,9 @@ public class DoCreateVfModule extends VfModuleBase {
logger.debug("Outgoing UpdateAAIVfModuleRequest is: \n" + updateAAIVfModuleRequest)
}catch(Exception e){
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occured Processing preProcessUpdateAAIVfModuleRequestOrch", "BPMN",
- MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessUpdateAAIVfModuleRequestOrch Method:\n" + e.getMessage())
}
logger.trace("COMPLETED preProcessUpdateAAIVfModuleRequestOrch")
@@ -1585,9 +1585,9 @@ public class DoCreateVfModule extends VfModuleBase {
logger.debug("Outgoing UpdateAAIVfModuleRequest is: \n" + updateAAIVfModuleRequest)
}catch(Exception e){
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occured Processing preProcessUpdateAAIVfModuleStatus", "BPMN",
- MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessUpdateAAIVfModuleStatus Method:\n" + e.getMessage())
}
logger.trace("COMPLETED preProcessUpdateAAIVfModuleStatus")
@@ -1615,9 +1615,9 @@ public class DoCreateVfModule extends VfModuleBase {
logger.debug("Outgoing UpdateAAIVfModuleRequest is: \n" + updateAAIVfModuleRequest)
}catch(Exception e){
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occured Processing preProcessUpdateAAIVfModuleRequestGroup", "BPMN",
- MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessUpdateAAIVfModuleRequestGroup Method:\n" + e.getMessage())
}
logger.trace("COMPLETED preProcessUpdateAAIVfModuleRequestGroup")
@@ -1695,8 +1695,8 @@ public class DoCreateVfModule extends VfModuleBase {
logger.debug("Outgoing GetSDNCRequest is: \n" + SDNCGetRequest)
}catch(Exception e){
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- "Exception Occured Processing preProcessSDNCGetRequest", "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Occured Processing preProcessSDNCGetRequest", "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during prepareProvision Method:\n" + e.getMessage())
}
@@ -1817,15 +1817,15 @@ public class DoCreateVfModule extends VfModuleBase {
logger.debug(" is Cloud Region Good: " + execution.getVariable("DCVFM_isCloudRegionGood"))
} catch(BpmnError b){
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- "Rethrowing MSOWorkflowException", "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Rethrowing MSOWorkflowException", "BPMN",
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()
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- "AAI Query Cloud Region Failed " + errorMessage, "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "AAI Query Cloud Region Failed " + errorMessage, "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Exception occured during queryCloudRegion method")
}
@@ -1887,9 +1887,9 @@ public class DoCreateVfModule extends VfModuleBase {
logger.debug("Outgoing CreateAAIVfModuleVolumeGroupRequest is: \n" + createAAIVfModuleVolumeGroupRequest)
}catch(Exception e){
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Exception Occured Processing prepareCreateAAIVfModuleVolumeGroupRequest', "BPMN",
- MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during prepareCreateAAIVfModuleVolumeGroupRequest Method:\n" + e.getMessage())
}
logger.trace("COMPLETED prepareCreateAAIVfModuleVolumeGroupRequest")
@@ -2020,8 +2020,8 @@ public class DoCreateVfModule extends VfModuleBase {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- "Exception Encountered in " + method, "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Encountered in " + method, "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepUpdateAAIGenericVnf(): ' + e.getMessage())
@@ -2065,8 +2065,8 @@ public class DoCreateVfModule extends VfModuleBase {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in postProcessUpdateAAIGenericVnf(): ' + e.getMessage())
}
@@ -2118,8 +2118,8 @@ public class DoCreateVfModule extends VfModuleBase {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- 'Caught exception in queryCatalogDB', "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in queryCatalogDB', "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryCatalogDB(): ' + e.getMessage())
}
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 d9989606e0..6f6ed671fe 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
@@ -263,9 +263,9 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{
logger.debug("Outgoing DeactivateSDNCRequest is: \n" + deactivateSDNCRequest)
}catch(Exception e){
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occured Processing preProcessSDNCDeactivateRequest.", "BPMN",
- MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessSDNCDeactivateRequest Method:\n" + e.getMessage())
}
logger.trace("COMPLETED preProcessSDNCDeactivateRequest")
@@ -446,9 +446,9 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{
// -
public void handleDoDeleteVfModuleFailure(DelegateExecution execution) {
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 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());
+ "BPMN", MsoLogger.ErrorCode.UnknownError.getValue());
String processKey = getProcessKey(execution);
exceptionUtil.buildWorkflowException(execution, 5000, "Failure in DoDeleteVfModule")
@@ -607,8 +607,8 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preProcessUpdateAAIGenericVnf((): ' + e.getMessage())
}
@@ -625,9 +625,9 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{
execution.setVariable("rollbackError", null)
}catch(Exception e){
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occured Processing setSuccessfulRollbackStatus.", "BPMN",
- MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during setSuccessfulRollbackStatus Method:\n" + e.getMessage())
}
logger.trace("COMPLETED setSuccessfulRollbackStatus")
@@ -645,9 +645,9 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{
execution.setVariable("rollbackData", null)
}catch(Exception e){
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occured Processing setFailedRollbackStatus.", "BPMN",
- MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during setFailedRollbackStatus Method:\n" + e.getMessage())
}
logger.trace("COMPLETED setFailedRollbackStatus")
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 2c433863aa..24528db473 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
@@ -221,8 +221,8 @@ 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'
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
+ logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
execution.setVariable("DoCVNF_sdncCallbackUrl", sdncCallbackUrl)
@@ -412,8 +412,8 @@ class DoCreateVnf extends AbstractServiceTaskProcessor {
logger.debug("Outgoing AssignSDNCRequest is: \n" + assignSDNCRequest)
}catch(Exception e){
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- "Exception Occured Processing preProcessSDNCAssignRequest", "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Occured Processing preProcessSDNCAssignRequest", "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessSDNCAssignRequest Method:\n" + e.getMessage())
}
@@ -630,8 +630,8 @@ class DoCreateVnf extends AbstractServiceTaskProcessor {
logger.debug("Outgoing GetSDNCRequest is: \n" + SDNCGetRequest)
}catch(Exception e){
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- "Exception Occurred Processing preProcessSDNCGetRequest. ", "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Occurred Processing preProcessSDNCGetRequest. ", "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during prepareProvision Method:\n" + e.getMessage())
}
@@ -669,8 +669,8 @@ class DoCreateVnf extends AbstractServiceTaskProcessor {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- "Caught exception in " + method, "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Caught exception in " + method, "BPMN",
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 4730462ac6..f0680e227c 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
@@ -308,8 +308,8 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor {
}catch(Exception e){
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- "Exception Occured Processing preProcessAddOnModule ", "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Occured Processing preProcessAddOnModule ", "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessAddOnModule Method:\n" + e.getMessage())
}
@@ -326,8 +326,8 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor {
execution.setVariable("addOnModulesDeployed", addOnModulesDeployed + 1)
}catch(Exception e){
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- "Exception Occured Processing postProcessAddOnModule ", "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Occured Processing postProcessAddOnModule ", "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during postProcessAddOnModule Method:\n" + e.getMessage())
}
@@ -356,8 +356,8 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor {
}
}catch(Exception e){
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- "Exception Occured Processing validateBaseModule ", "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Occured Processing validateBaseModule ", "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during validateBaseModule Method:\n" + e.getMessage())
}
@@ -387,8 +387,8 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor {
rollbackData.put("VNFANDMODULES", "numOfCreatedAddOnModules", "${numOfCreatedAddOnModules}")
execution.setVariable("rollbackData", rollbackData)
}catch(Exception e){
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- "Exception Occured Processing preProcessAddOnModule ", "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Occured Processing preProcessAddOnModule ", "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessAddOnModule Method:\n" + e.getMessage())
}
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 2de7314a98..6f4c030683 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
@@ -165,9 +165,9 @@ class DoCreateVnfAndModulesRollback extends AbstractServiceTaskProcessor {
execution.setVariable("DCVAMR_RollbackData", vfModuleRollbackData)
}catch(Exception e){
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occured Processing preProcessCreateVfModuleRollback ", "BPMN",
- MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessCreateVfModuleRollback Method:\n" + e.getMessage())
}
logger.trace("COMPLETED preProcessCreateVfModuleRollback")
@@ -185,15 +185,15 @@ class DoCreateVnfAndModulesRollback extends AbstractServiceTaskProcessor {
def numOfModulesToDelete = execution.getVariable("DCVAMR_numOfModulesToDelete")
execution.setVariable("DCVAMR_numOfModulesToDelete", numOfModulesToDelete - 1)
}catch(Exception e){
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occured Processing postProcessCreateVfModuleRollback ", "BPMN",
- MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during postProcessCreateVfModuleRollback Method:\n" + e.getMessage())
}
if (rolledBack == false) {
logger.debug("Failure on DoCreateVfModuleRollback")
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- "Unsuccessful rollback of DoCreateVfModule ", "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Unsuccessful rollback of DoCreateVfModule ", "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during rollback of DoCreateVfModule")
}
@@ -218,9 +218,9 @@ class DoCreateVnfAndModulesRollback extends AbstractServiceTaskProcessor {
logger.debug("Outgoing DeactivateSDNCRequest is: \n" + deactivateSDNCRequest)
}catch(Exception e){
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occured Processing preProcessSDNCDeactivateRequest ", "BPMN",
- MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessSDNCDeactivateRequest Method:\n" + e.getMessage())
}
logger.trace("COMPLETED preProcessSDNCDeactivateRequest")
@@ -341,7 +341,8 @@ class DoCreateVnfAndModulesRollback extends AbstractServiceTaskProcessor {
execution.setVariable("rollbackError", null)
}catch(Exception e){
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing setSuccessfulRollbackStatus ", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured " +
+ "Processing setSuccessfulRollbackStatus ", "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during setSuccessfulRollbackStatus Method:\n" + e.getMessage())
}
logger.trace("COMPLETED setSuccessfulRollbackStatus")
@@ -362,7 +363,8 @@ class DoCreateVnfAndModulesRollback extends AbstractServiceTaskProcessor {
execution.setVariable("rollbackData", null)
}catch(Exception e){
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing setFailedRollbackStatus. ", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured " +
+ "Processing setFailedRollbackStatus. ", "BPMN",MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during setFailedRollbackStatus Method:\n" + e.getMessage())
}
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 5b83ca6641..0c14827f22 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
@@ -531,8 +531,8 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess
logger.debug("CreateVfModuleInfra Outgoing initResourceOperationStatus Request: " + payload)
}catch(Exception e){
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- "Exception Occured Processing preInitResourcesOperStatus.", "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Occured Processing preInitResourcesOperStatus.", "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), e);
execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preInitResourcesOperStatus Method:\n" + e.getMessage())
}
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 b16ccaa8fd..f476b080b7 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
@@ -945,8 +945,8 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce
}catch(Exception e){
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- "Exception Occured Processing preUpdateServiceOperationStatus.", "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Occured Processing preUpdateServiceOperationStatus.", "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), e);
execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preUpdateServiceOperationStatus Method:\n" + e.getMessage())
}
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 002e20e6d7..9c04328d0d 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
@@ -465,8 +465,8 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
} catch (Exception ex) {
// caught exception
String exceptionMessage = "Bpmn error encountered in DoDeleteNetworkInstance, sendRequestToVnfAdapter() - " + ex.getMessage()
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), exceptionMessage,
- "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), exceptionMessage,
+ "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(),
"Exception is:\n" + ex);
logger.debug(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
@@ -517,8 +517,8 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
} catch (Exception ex) {
// caught exception
String exceptionMessage = "Bpmn error encountered in DoDeleteNetworkInstance, prepareSDNCRequest() - " + ex.getMessage()
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), exceptionMessage,
- "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), exceptionMessage,
+ "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(),
"Exception is:\n" + ex);
logger.debug(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
@@ -558,8 +558,8 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
} catch (Exception ex) {
// caught exception
String exceptionMessage = "Bpmn error encountered in DoDeleteNetworkInstance, prepareSDNCRequest() - " + ex.getMessage()
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), exceptionMessage,
- "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), exceptionMessage,
+ "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(),
"Exception is:\n" + ex);
logger.debug(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
@@ -998,8 +998,8 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
} catch (Exception ex) {
// caught exception
String exceptionMessage = "Bpmn error encountered in DoDeleteNetworkInstance, prepareSDNCRollback() - " + ex.getMessage()
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), exceptionMessage,
- "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), exceptionMessage,
+ "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(),
"Exception is:\n" + ex);
logger.debug(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
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 2e0b69066e..e3e3990527 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
@@ -356,9 +356,9 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{
// generates a WorkflowException if
// -
public void handleDoDeleteVfModuleFailure(DelegateExecution execution) {
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 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");
+ "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), "Exception");
String processKey = getProcessKey(execution);
WorkflowException exception = new WorkflowException(processKey, 5000,
execution.getVariable("DoDVfMod_deleteGenericVnfResponse"))
@@ -577,8 +577,8 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepUpdateAAIGenericVnf(): ' + e.getMessage())
}
@@ -626,8 +626,8 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN",
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 655d6ec958..0c244e8e67 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
@@ -111,8 +111,8 @@ public class DoDeleteVfModuleFromVnf 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'
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception");
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception");
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
execution.setVariable("sdncCallbackUrl", sdncCallbackUrl)
@@ -160,8 +160,8 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIForVfModule(): ' + e.getMessage())
}
@@ -213,8 +213,8 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in validateVfModule(): ' + e.getMessage())
}
@@ -239,9 +239,9 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase {
}catch(Exception e){
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 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);
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessSDNCDeactivateRequest Method:\n" + e.getMessage())
}
logger.trace("COMPLETED preProcessSDNCDeactivateRequest ")
@@ -401,9 +401,9 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase {
// generates a WorkflowException if
// -
public void handleDoDeleteVfModuleFailure(DelegateExecution execution) {
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 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");
+ "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), "Exception");
String processKey = getProcessKey(execution);
WorkflowException exception = new WorkflowException(processKey, 5000,
execution.getVariable("DDVFMV_deleteGenericVnfResponse"))
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 3b23a03589..a2c6a82a93 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
@@ -110,8 +110,8 @@ 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'
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception");
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception");
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
execution.setVariable("sdncCallbackUrl", sdncCallbackUrl)
@@ -238,8 +238,8 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor {
}catch(Exception e){
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- "Exception Occured Processing preProcessAddOnModule." + e, "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Occured Processing preProcessAddOnModule." + e, "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessAddOnModule Method:\n" + e.getMessage())
}
@@ -339,8 +339,8 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIVfModule(): ' + e.getMessage())
}
@@ -367,8 +367,8 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor {
execution.setVariable("DDVAM_vfModuleModelInfo", vfModuleModelInfo)
}catch(Exception e){
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- "Exception Occured Processing preProcessAddOnModule." + e, "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Occured Processing preProcessAddOnModule." + e, "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during prepareNextModuleToDelete Method:\n" + e.getMessage())
}
@@ -393,9 +393,9 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor {
logger.debug("Outgoing DeactivateSDNCRequest is: \n" + deactivateSDNCRequest)
}catch(Exception e){
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occured Processing preProcessSDNCDeactivateRequest." + e, "BPMN",
- MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessSDNCDeactivateRequest Method:\n" + e.getMessage())
}
logger.trace("COMPLETED preProcessSDNCDeactivateRequest ")
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 e04cf35c54..7f168d99ad 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
@@ -137,8 +137,8 @@ public class DoScaleE2EServiceInstance extends AbstractServiceTaskProcessor {
logger.debug("CreateVfModuleInfra Outgoing initResourceOperationStatus Request: " + payload)
}catch(Exception e){
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- "Exception Occured Processing preInitResourcesOperStatus.", "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Occured Processing preInitResourcesOperStatus.", "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), e);
execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preInitResourcesOperStatus Method:\n" + e.getMessage())
}
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 671eb5cdc0..905afb53d5 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
@@ -182,8 +182,8 @@ public class DoScaleVFCNetworkServiceInstance extends AbstractServiceTaskProcess
try {
Thread.sleep(5000)
} catch (InterruptedException e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- "Time Delay exception" + e, "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Time Delay exception" + e, "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue());
}
}
@@ -216,7 +216,8 @@ public class DoScaleVFCNetworkServiceInstance extends AbstractServiceTaskProcess
logger.info("response code:"+ apiResponse.getStatus() +"\nresponse body:"+ apiResponse.readEntity(String.class))
logger.trace("Completed Execute VF-C adapter Post Process ")
}catch(Exception e){
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception occured while executing VFC Post Call.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), e);
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception occured " +
+ "while executing VFC Post Call.", "BPMN", 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/DoUpdateVfModule.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy
index 641878be8e..47647bd9a6 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
@@ -326,8 +326,8 @@ 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'
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
+ logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -335,8 +335,8 @@ public class DoUpdateVfModule extends VfModuleBase {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preProcessRequest(): ' + e.getMessage())
}
@@ -376,8 +376,8 @@ public class DoUpdateVfModule extends VfModuleBase {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preparePrepareUpdateAAIVfModule(): ' + e.getMessage())
}
@@ -427,16 +427,16 @@ public class DoUpdateVfModule extends VfModuleBase {
logger.debug(" is Cloud Region Good: " + execution.getVariable(prefix + "isCloudRegionGood"))
} catch(BpmnError b){
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- "Rethrowing MSOWorkflowException", "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Rethrowing MSOWorkflowException", "BPMN",
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()
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 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);
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Exception occured during prepConfirmVolumeGroupTenant(): " + e.getMessage())
}
logger.trace('Exited ' + method)
@@ -541,8 +541,8 @@ public class DoUpdateVfModule extends VfModuleBase {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepSDNCTopologyChg(): ' + e.getMessage())
}
@@ -605,8 +605,8 @@ public class DoUpdateVfModule extends VfModuleBase {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepSDNCTopologyQuery(): ' + e.getMessage())
}
@@ -707,8 +707,8 @@ public class DoUpdateVfModule extends VfModuleBase {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepVnfAdapterRest(): ' + e.getMessage())
}
@@ -755,8 +755,8 @@ public class DoUpdateVfModule extends VfModuleBase {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepUpdateAAIGenericVnf(): ' + e.getMessage())
}
@@ -829,8 +829,8 @@ public class DoUpdateVfModule extends VfModuleBase {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepUpdateAAIVfModule(): ' + e.getMessage())
}
@@ -932,8 +932,8 @@ public class DoUpdateVfModule extends VfModuleBase {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepSDNCTopologyAct(): ' + e.getMessage())
}
@@ -953,16 +953,16 @@ public class DoUpdateVfModule extends VfModuleBase {
try {
def WorkflowException workflowException = (WorkflowException) execution.getVariable('WorkflowException')
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
method + ' caught WorkflowException: ' + workflowException.getErrorMessage(), "BPMN",
- MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
+ MsoLogger.ErrorCode.UnknownError.getValue());
logger.trace('Exited ' + method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildWorkflowException(execution, 1002, 'Error in handleWorkflowException(): ' + e.getMessage())
}
@@ -1040,8 +1040,8 @@ public class DoUpdateVfModule extends VfModuleBase {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN",
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 0781553879..3d8205fd2a 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
@@ -273,8 +273,8 @@ class DoUpdateVnfAndModules extends AbstractServiceTaskProcessor {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIVfModule(): ' + e.getMessage())
}
@@ -329,9 +329,9 @@ class DoUpdateVnfAndModules extends AbstractServiceTaskProcessor {
}
}catch(Exception e){
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 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);
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during prepareNextModuleToUpdate Method:\n" + e.getMessage())
}
logger.trace("COMPLETED prepareNextModuleToUpdate ")
@@ -405,8 +405,8 @@ class DoUpdateVnfAndModules extends AbstractServiceTaskProcessor {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN",
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/ReplaceVnfInfra.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ReplaceVnfInfra.groovy
index 0454bb4876..534e5b513a 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
@@ -233,8 +233,8 @@ public class ReplaceVnfInfra extends VnfCmBase {
}
catch(Exception e) {
String restFaultMessage = e.getMessage()
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- "Exception Encountered - " + "\n" + restFaultMessage, "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Encountered - " + "\n" + restFaultMessage, "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 5000, restFaultMessage)
}
@@ -276,8 +276,8 @@ public class ReplaceVnfInfra extends VnfCmBase {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage())
}
@@ -327,8 +327,8 @@ public class ReplaceVnfInfra extends VnfCmBase {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in getVnfResourceDecomposition(): ' + e.getMessage())
}
@@ -369,8 +369,8 @@ public class ReplaceVnfInfra extends VnfCmBase {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
@@ -413,8 +413,8 @@ public class ReplaceVnfInfra extends VnfCmBase {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
@@ -461,8 +461,8 @@ public class ReplaceVnfInfra extends VnfCmBase {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
@@ -531,20 +531,20 @@ public class ReplaceVnfInfra extends VnfCmBase {
logger.trace('Exited ' + method)
} catch (BpmnError e) {
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
} catch (java.lang.NoSuchMethodError e) {
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
} catch (Exception e) {
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
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 5b0b92415d..5f215479e9 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
@@ -114,8 +114,8 @@ public class RollbackVnf extends VnfCmBase {
}
catch(Exception e) {
String restFaultMessage = e.getMessage()
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- "Exception Encountered - " + "\n" + restFaultMessage, "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Encountered - " + "\n" + restFaultMessage, "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
execution.setVariable("rollbackErrorCode", "1")
exceptionUtil.buildAndThrowWorkflowException(execution, 5000, restFaultMessage)
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 010f3d77f3..010ac7cda8 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
@@ -94,7 +94,7 @@ public class ScaleCustomE2EServiceInstance extends AbstractServiceTaskProcessor
execution.setVariable("resources", resources)
// node template UUID
- String nodeTemplateUUID = UUIDChecker.generateUUID(msoLogger)
+ String nodeTemplateUUID = UUIDChecker.getUUID();
execution.setVariable("nodeTemplateUUID", nodeTemplateUUID)
//subscriberInfo
@@ -293,9 +293,9 @@ public class ScaleCustomE2EServiceInstance extends AbstractServiceTaskProcessor
logger.debug("Scale network service updateServiceOperStatusRequest Request: " + payload)
}catch(Exception e){
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occured Processing prepareInitServiceOperationStatus.", "BPMN",
- MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), e);
+ MsoLogger.ErrorCode.UnknownError.getValue(), e);
execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during prepareInitServiceOperationStatus Method:\n" + e.getMessage())
}
logger.trace("COMPLETED prepareInitServiceOperationStatus Process ")
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 35947ee4da..175bbbdbc9 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
@@ -96,8 +96,8 @@ public class UpdateVfModule extends AbstractServiceTaskProcessor {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preProcessRequest(): ' + e.getMessage())
}
@@ -151,8 +151,8 @@ public class UpdateVfModule extends AbstractServiceTaskProcessor {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendSynchResponse(): ' + e.getMessage())
}
@@ -181,8 +181,8 @@ public class UpdateVfModule extends AbstractServiceTaskProcessor {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepDoUpdateVfModule(): ' + e.getMessage())
}
@@ -237,8 +237,8 @@ public class UpdateVfModule extends AbstractServiceTaskProcessor {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepUpdateInfraRequest(): ' + e.getMessage())
}
@@ -278,8 +278,8 @@ public class UpdateVfModule extends AbstractServiceTaskProcessor {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, 'Internal Error')
}
@@ -333,8 +333,8 @@ public class UpdateVfModule extends AbstractServiceTaskProcessor {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN",
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 b4914c8cd5..cad1c6f204 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
@@ -222,8 +222,8 @@ public class UpdateVfModuleInfra extends AbstractServiceTaskProcessor {
}
catch(Exception e) {
String restFaultMessage = e.getMessage()
- logger.error("{} {} {} Exception Encountered - \n{}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), restFaultMessage, e)
+ logger.error("{} {} Exception Encountered - \n{}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), restFaultMessage, e)
exceptionUtil.buildAndThrowWorkflowException(execution, 5000, restFaultMessage)
}
}
@@ -263,8 +263,8 @@ public class UpdateVfModuleInfra extends AbstractServiceTaskProcessor {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+ logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage())
}
}
@@ -292,8 +292,8 @@ public class UpdateVfModuleInfra extends AbstractServiceTaskProcessor {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+ logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepDoUpdateVfModule(): ' + e.getMessage())
}
}
@@ -346,8 +346,8 @@ public class UpdateVfModuleInfra extends AbstractServiceTaskProcessor {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+ logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepUpdateInfraRequest(): ' + e.getMessage())
}
}
@@ -385,8 +385,8 @@ public class UpdateVfModuleInfra extends AbstractServiceTaskProcessor {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+ logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, 'Internal Error')
}
}
@@ -438,8 +438,8 @@ public class UpdateVfModuleInfra extends AbstractServiceTaskProcessor {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+ logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
exceptionUtil.buildWorkflowException(execution, 2000, 'Internal Error')
}
}
@@ -508,8 +508,8 @@ public class UpdateVfModuleInfra extends AbstractServiceTaskProcessor {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+ logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 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/UpdateVfModuleVolume.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolume.groovy
index 69bb4fd0c4..367a63fede 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
@@ -110,8 +110,8 @@ class UpdateVfModuleVolume extends VfModuleBase {
} catch (BpmnError bpmnError) {
throw bpmnError
} catch (Exception e) {
- logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+ logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preProcessRequest(): ' + e.getMessage())
}
}
@@ -162,8 +162,8 @@ class UpdateVfModuleVolume extends VfModuleBase {
} catch (BpmnError e) {
throw e
} catch (Exception e) {
- logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+ logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendSynchResponse(): ' + e.getMessage())
}
}
@@ -213,8 +213,8 @@ class UpdateVfModuleVolume extends VfModuleBase {
} catch (BpmnError e) {
throw e
} catch (Exception e) {
- logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+ logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIForVolumeGroup(): ' + e.getMessage())
}
}
@@ -282,8 +282,8 @@ class UpdateVfModuleVolume extends VfModuleBase {
} catch (BpmnError e) {
throw e
} catch (Exception e) {
- logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+ logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepVnfAdapterRest(): ' + e.getMessage())
}
}
@@ -327,8 +327,8 @@ class UpdateVfModuleVolume extends VfModuleBase {
} catch (BpmnError e) {
throw e
} catch (Exception e) {
- logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+ logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
exceptionUtil.buildWorkflowException(execution, 1002, 'Error in prepDbInfraDbRequest(): ' + e.getMessage())
}
}
@@ -365,8 +365,8 @@ class UpdateVfModuleVolume extends VfModuleBase {
} catch (BpmnError e) {
throw e
} catch (Exception e) {
- logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+ logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepCompletionHandlerRequest(): ' + e.getMessage())
}
}
@@ -415,8 +415,8 @@ class UpdateVfModuleVolume extends VfModuleBase {
} catch (BpmnError e) {
throw e
} catch (Exception e) {
- logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+ logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
exceptionUtil.buildWorkflowException(execution, 1002, 'Error in prepFalloutHandler(): ' + e.getMessage())
}
}
@@ -443,8 +443,8 @@ 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 + '\''
- logger.error("{} {} {} Error in UpdateVfModuleVol: {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), errorMessage)
+ logger.error("{} {} Error in UpdateVfModuleVol: {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), errorMessage)
WorkflowException exception = new WorkflowException(processKey, 5000, errorMessage)
execution.setVariable("WorkflowException", exception)
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 e9121aa420..9e1694089e 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
@@ -479,7 +479,8 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase {
" retrieved from AAI for Volume Group Id " + volumeGroupId + ", AIC Cloud Region " + aicCloudRegion
ExceptionUtil exceptionUtil = new ExceptionUtil()
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Error in UpdateVfModuleVol: ' + errorMessage, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception")
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Error in ' +
+ 'UpdateVfModuleVol: ' + errorMessage, "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), "Exception")
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, errorMessage)
}
@@ -497,7 +498,8 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase {
" retrieved from AAI for Volume Group Id "
ExceptionUtil exceptionUtil = new ExceptionUtil()
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Error in UpdateVfModuleVol: ' + errorMessage, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception")
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Error in ' +
+ 'UpdateVfModuleVol: ' + errorMessage, "BPMN", 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 1a62ad60f9..60af2a0fe2 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
@@ -213,8 +213,8 @@ public class UpdateVnfInfra extends VnfCmBase {
}
catch(Exception e) {
String restFaultMessage = e.getMessage()
- logger.error("{} {} {} Exception Encountered - \n{}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), restFaultMessage, e)
+ logger.error("{} {} Exception Encountered - \n{}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), restFaultMessage, e)
exceptionUtil.buildAndThrowWorkflowException(execution, 5000, restFaultMessage)
}
}
@@ -254,8 +254,8 @@ public class UpdateVnfInfra extends VnfCmBase {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+ logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage())
}
}
@@ -304,8 +304,8 @@ public class UpdateVnfInfra extends VnfCmBase {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+ logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in getVnfResourceDecomposition(): ' + e.getMessage())
}
}
@@ -345,8 +345,8 @@ public class UpdateVnfInfra extends VnfCmBase {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+ logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
//exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfVnfInMaintInAAI(): ' + e.getMessage())
@@ -388,8 +388,8 @@ public class UpdateVnfInfra extends VnfCmBase {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+ logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
//exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfPserversInMaintInAAI(): ' + e.getMessage())
@@ -435,8 +435,8 @@ public class UpdateVnfInfra extends VnfCmBase {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+ logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
}
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 01f0e246af..a83b36fd6e 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
@@ -99,8 +99,8 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+ logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage())
}
}
@@ -148,8 +148,8 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+ logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in getVnfResourceDecomposition(): ' + e.getMessage())
}
}
@@ -189,8 +189,8 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+ logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
//exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfVnfInMaintInAAI(): ' + e.getMessage())
@@ -319,8 +319,8 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+ logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIForVnf(): ' + e.getMessage())
}
}
@@ -361,8 +361,8 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+ logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
//exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfPserversInMaintInAAI(): ' + e.getMessage())
@@ -408,8 +408,8 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+ logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
}
@@ -453,8 +453,8 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+ logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
}
@@ -499,8 +499,8 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+ logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
}
@@ -578,20 +578,20 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor {
logger.trace('Exited ' + method)
} catch (BpmnError e) {
- logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+ logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
} catch (java.lang.NoSuchMethodError e) {
- logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+ logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
} catch (Exception e) {
- logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+ logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
@@ -657,8 +657,8 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+ logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, 'Internal Error')
}
}
@@ -728,8 +728,8 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+ logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
exceptionUtil.buildWorkflowException(execution, 2000, 'Internal Error')
}
}
@@ -821,4 +821,4 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor {
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 6075f0df96..0a748db561 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
@@ -158,8 +158,8 @@ public class VnfConfigUpdate extends VnfCmBase {
}
catch(Exception e) {
String restFaultMessage = e.getMessage()
- logger.error("{} {} {} Exception Encountered - \n {} \n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), restFaultMessage, e)
+ logger.error("{} {} Exception Encountered - \n {} \n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), restFaultMessage, e)
exceptionUtil.buildAndThrowWorkflowException(execution, 5000, restFaultMessage)
}
}
@@ -200,8 +200,8 @@ public class VnfConfigUpdate extends VnfCmBase {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+ logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage())
}
}
@@ -241,8 +241,8 @@ public class VnfConfigUpdate extends VnfCmBase {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+ logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
//exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfVnfInMaintInAAI(): ' + e.getMessage())
@@ -284,8 +284,8 @@ public class VnfConfigUpdate extends VnfCmBase {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+ logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
//exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfPserversInMaintInAAI(): ' + e.getMessage())
@@ -332,8 +332,8 @@ public class VnfConfigUpdate extends VnfCmBase {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+ logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
}
@@ -377,8 +377,8 @@ public class VnfConfigUpdate extends VnfCmBase {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+ logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
//exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfVnfInMaintInAAI(): ' + e.getMessage())
@@ -423,8 +423,8 @@ public class VnfConfigUpdate extends VnfCmBase {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+ logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
//exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfVnfInMaintInAAI(): ' + e.getMessage())
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 cd89d2a2ef..fe6045dc3b 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
@@ -178,8 +178,8 @@ public class VnfInPlaceUpdate extends VnfCmBase {
}
catch(Exception e) {
String restFaultMessage = e.getMessage()
- logger.error("{} {} {} Exception Encountered - {} \n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), restFaultMessage, e)
+ logger.error("{} {} Exception Encountered - {} \n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), restFaultMessage, e)
exceptionUtil.buildAndThrowWorkflowException(execution, 5000, restFaultMessage)
}
}
@@ -219,8 +219,8 @@ public class VnfInPlaceUpdate extends VnfCmBase {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} Caught exception in {} \n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+ logger.error("{} {} Caught exception in {} \n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage())
}
}
@@ -261,8 +261,8 @@ public class VnfInPlaceUpdate extends VnfCmBase {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} Caught exception in {} \n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+ logger.error("{} {} Caught exception in {} \n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
//exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfVnfInMaintInAAI(): ' + e.getMessage())
@@ -304,8 +304,8 @@ public class VnfInPlaceUpdate extends VnfCmBase {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} Caught exception in {} \n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+ logger.error("{} {} Caught exception in {} \n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
//exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfPserversInMaintInAAI(): ' + e.getMessage())
@@ -351,7 +351,8 @@ public class VnfInPlaceUpdate extends VnfCmBase {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in' +
+ ' ' + method, "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
}
@@ -395,7 +396,8 @@ public class VnfInPlaceUpdate extends VnfCmBase {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in' +
+ ' ' + method, "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
}
@@ -439,7 +441,8 @@ public class VnfInPlaceUpdate extends VnfCmBase {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in' +
+ ' ' + method, "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
}
@@ -517,15 +520,18 @@ public class VnfInPlaceUpdate extends VnfCmBase {
logger.trace('Exited ' + method)
} catch (BpmnError e) {
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in' +
+ ' ' + method, "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
} catch (java.lang.NoSuchMethodError e) {
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in' +
+ ' ' + method, "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
} catch (Exception e) {
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in' +
+ ' ' + method, "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
}
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 0af1bcb00e..628088c380 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
@@ -419,8 +419,8 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method)
}
@@ -846,8 +846,8 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
// Adding this line temporarily until this flows error handling gets updated
exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Caught a Java Lang Exception")
} catch (BpmnError b) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- "Rethrowing MSOWorkflowException", "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Rethrowing MSOWorkflowException", "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue());
throw b
} catch (Exception e) {
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 75f5ec9161..312f3ca102 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
@@ -25,6 +25,7 @@ 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
@@ -418,8 +419,8 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor {
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){
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- "Rethrowing MSOWorkflowException", "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Rethrowing MSOWorkflowException", "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue());
throw b
}catch(Exception e){
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 db8c993533..8bf16a0dc4 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
@@ -585,8 +585,8 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{
execution.setVariable("sdncGetRequest", SDNCGetRequest)
}catch(Exception e){
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- "Exception Occurred Processing preProcessSDNCGetRequest.", "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Occurred Processing preProcessSDNCGetRequest.", "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during SDNC GET Method:\n" + e.getMessage())
}
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 03f795cadf..255b1f32eb 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
@@ -205,8 +205,8 @@ public class DoCreateAllottedResourceBRGRollback extends AbstractServiceTaskProc
} catch (BpmnError e) {
throw e;
}catch(Exception ex){
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- "Exception Occurred Processing preProcessSDNCGetRequest.", "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Occurred Processing preProcessSDNCGetRequest.", "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during SDNC GET Method:\n" + ex.getMessage())
}
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 a5f0d7dc30..d74510a25e 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
@@ -520,8 +520,8 @@ public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{
execution.setVariable("sdncGetRequest", SDNCGetRequest)
}catch(Exception e){
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- "Exception Occurred Processing preProcessSDNCGetRequest.", "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Occurred Processing preProcessSDNCGetRequest.", "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during SDNC GET Method:\n" + e.getMessage())
}
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 3d34e2de94..def3cca2f7 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
@@ -212,8 +212,8 @@ public class DoCreateAllottedResourceTXCRollback extends AbstractServiceTaskProc
} catch (BpmnError e) {
throw e;
}catch(Exception ex){
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- "Exception Occurred Processing preProcessSDNCGetRequest.", "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Occurred Processing preProcessSDNCGetRequest.", "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during SDNC GET Method:\n" + ex.getMessage())
}
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 3b80f3c468..8929f67cfc 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
@@ -351,9 +351,9 @@ public class DoDeleteAllottedResourceBRG extends AbstractServiceTaskProcessor{
} catch (BpmnError e) {
throw e;
}catch(Exception ex){
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occurred Processing preProcessSDNCGetRequest." + ex, "BPMN",
- MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:" + ex);
+ MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:" + ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during SDNC GET Method:\n" + ex.getMessage())
}
logger.trace("end deleteAaiAR")
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 9b9f9f0388..84e77afda7 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
@@ -355,8 +355,8 @@ public class DoDeleteAllottedResourceTXC extends AbstractServiceTaskProcessor{
} catch (BpmnError e) {
throw e;
}catch(Exception ex){
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- "Exception Occurred Processing preProcessSDNCGetRequest.", "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Occurred Processing preProcessSDNCGetRequest.", "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during SDNC GET Method:\n" + ex.getMessage())
}
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 5534a39685..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
@@ -120,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);
@@ -165,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);
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 e0516ce9af..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
@@ -68,6 +68,7 @@ public class AppcRunTasks {
execution.setVariable("actionResumeTraffic", Action.ResumeTraffic);
execution.setVariable("actionStop", Action.Stop);
execution.setVariable("actionStart", Action.Start);
+ execution.setVariable("actionHealthCheck", Action.HealthCheck);
execution.setVariable("rollbackVnfStop", false);
execution.setVariable("rollbackVnfLock", false);
execution.setVariable("rollbackQuiesceTraffic", false);
@@ -134,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/WorkflowAction.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
index d87b11a1a6..aeffb0ecab 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
@@ -41,6 +41,7 @@ import org.onap.aai.domain.yang.GenericVnf;
import org.onap.aai.domain.yang.L3Network;
import org.onap.aai.domain.yang.Relationship;
import org.onap.aai.domain.yang.ServiceInstance;
+import org.onap.aai.domain.yang.Vnfc;
import org.onap.aai.domain.yang.VolumeGroup;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
@@ -51,8 +52,11 @@ import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds;
import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetup;
import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils;
import org.onap.so.client.aai.AAICommonObjectMapperProvider;
+import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.entities.AAIResultWrapper;
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.client.exception.ExceptionBuilder;
import org.onap.so.client.orchestration.AAIConfigurationResources;
import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization;
@@ -199,7 +203,6 @@ public class WorkflowAction {
if (orchFlows == null || orchFlows.isEmpty()) {
orchFlows = queryNorthBoundRequestCatalogDb(execution, requestAction, resourceType, aLaCarte, cloudOwner, serviceType);
}
- orchFlows = filterOrchFlows(sIRequest, orchFlows, resourceType, execution);
String key = "";
ModelInfo modelInfo = sIRequest.getRequestDetails().getModelInfo();
if(modelInfo != null) {
@@ -211,16 +214,17 @@ public class WorkflowAction {
}
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);
+ if(isConfiguration && !requestAction.equalsIgnoreCase(CREATEINSTANCE)) {
+ List<ExecuteBuildingBlock> configBuildingBlocks = getConfigBuildingBlocks(sIRequest, orchFlows, requestId, resourceKey, apiVersion, resourceId, requestAction, aLaCarte, vnfType,
+ workflowResourceIds, requestDetails, execution);
+ flowsToExecute.addAll(configBuildingBlocks);
+ }
+ orchFlows = orchFlows.stream().filter(item -> !item.getFlowName().contains(FABRIC_CONFIGURATION)).collect(Collectors.toList());
for (OrchestrationFlow orchFlow : orchFlows) {
- if(!orchFlow.getFlowName().contains("Configuration")) {
- ExecuteBuildingBlock ebb = buildExecuteBuildingBlock(orchFlow, requestId, resourceKey, apiVersion, resourceId,
- requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null, false);
- flowsToExecute.add(ebb);
- }
+ 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;
@@ -348,6 +352,26 @@ public class WorkflowAction {
}
}
+ protected <T> List<T> getRelatedResourcesInVfModule(String vnfId, String vfModuleId, Class<T> resultClass, AAIObjectType type) {
+ List<T> vnfcs = new ArrayList<>();
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId);
+ AAIResultWrapper vfModuleResultsWrapper = bbInputSetupUtils.getAAIResourceDepthOne(uri);
+ Optional<Relationships> relationshipsOp = vfModuleResultsWrapper.getRelationships();
+ if (!relationshipsOp.isPresent()) {
+ logger.debug("No relationships were found for vfModule in AAI");
+ } else {
+ Relationships relationships = relationshipsOp.get();
+ List<AAIResultWrapper> vnfcResultWrappers = relationships.getByType(type);
+ for(AAIResultWrapper vnfcResultWrapper : vnfcResultWrappers) {
+ Optional<T> vnfcOp = vnfcResultWrapper.asBean(resultClass);
+ if(vnfcOp.isPresent()) {
+ vnfcs.add(vnfcOp.get());
+ }
+ }
+ }
+ return vnfcs;
+ }
+
protected boolean isConfiguration(List<OrchestrationFlow> orchFlows) {
for(OrchestrationFlow flow : orchFlows) {
if(flow.getFlowName().contains("Configuration")) {
@@ -359,41 +383,56 @@ public class WorkflowAction {
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) {
+ WorkflowResourceIds workflowResourceIds, RequestDetails requestDetails, DelegateExecution execution) {
+ List<ExecuteBuildingBlock> flowsToExecuteConfigs = new ArrayList<>();
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();
- }
- }
- }
+ String vnfId = workflowResourceIds.getVnfId();
+ String vfModuleId = workflowResourceIds.getVfModuleId();
- 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
- }
+ String vnfCustomizationUUID = bbInputSetupUtils.getAAIGenericVnf(vnfId).getModelCustomizationId();
+ String vfModuleCustomizationUUID = bbInputSetupUtils.getAAIVfModule(vnfId, vfModuleId).getModelCustomizationId();
+ List<org.onap.aai.domain.yang.Configuration> configurations = getRelatedResourcesInVfModule(vnfId, vfModuleId, org.onap.aai.domain.yang.Configuration.class, AAIObjectType.CONFIGURATION);
+
+ for(org.onap.aai.domain.yang.Configuration configuration : configurations) {
+ workflowResourceIds.setConfigurationId(configuration.getConfigurationId());
for(OrchestrationFlow orchFlow : result) {
resourceKey.setVfModuleCustomizationId(vfModuleCustomizationUUID);
- resourceKey.setCvnfModuleCustomizationId(fabricConfig.getCvnfcCustomization().getModelCustomizationUUID());
+ resourceKey.setCvnfModuleCustomizationId(configuration.getModelCustomizationId());
resourceKey.setVnfCustomizationId(vnfCustomizationUUID);
ExecuteBuildingBlock ebb = buildExecuteBuildingBlock(orchFlow, requestId, resourceKey, apiVersion, resourceId,
requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null, true);
+ String vnfcName = getVnfcNameForConfiguration(configuration);
+ if(vnfcName == null || vnfcName.isEmpty()) {
+ buildAndThrowException(execution, "Exception in create execution list " + ": VnfcName does not exist or is null while there is a configuration for the vfModule", new Exception("Vnfc and Configuration do not match"));
+ }
+ ebb.getConfigurationResourceKeys().setVnfcName(vnfcName);
flowsToExecuteConfigs.add(ebb);
}
}
return flowsToExecuteConfigs;
}
+
+ protected String getVnfcNameForConfiguration(org.onap.aai.domain.yang.Configuration configuration) {
+ AAIResultWrapper wrapper = new AAIResultWrapper(configuration);
+ Optional<Relationships> relationshipsOp = wrapper.getRelationships();
+ if (!relationshipsOp.isPresent()) {
+ logger.debug("No relationships were found for Configuration in AAI");
+ return null;
+ } else {
+ Relationships relationships = relationshipsOp.get();
+ List<AAIResultWrapper> vnfcResultWrappers = relationships.getByType(AAIObjectType.VNFC);
+ if(vnfcResultWrappers.size() > 1 || vnfcResultWrappers.isEmpty()) {
+ logger.debug("Too many vnfcs or no vnfc found that are related to configuration");
+ }
+ Optional<Vnfc> vnfcOp = vnfcResultWrappers.get(0).asBean(Vnfc.class);
+ if(vnfcOp.isPresent()) {
+ return vnfcOp.get().getVnfcName();
+ } else {
+ return null;
+ }
+ }
+ }
protected List<Resource> sortVfModulesByBaseFirst(List<Resource> vfModuleResources) {
int count = 0;
@@ -1159,29 +1198,6 @@ public class WorkflowAction {
}
return listToExecute;
}
-
- protected List<OrchestrationFlow> filterOrchFlows(ServiceInstancesRequest sIRequest, List<OrchestrationFlow> orchFlows, WorkflowType resourceType, DelegateExecution execution) {
- List<OrchestrationFlow> result = new ArrayList<>(orchFlows);
- 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();
- }
- }
- }
-
- if (resourceType.equals(WorkflowType.VFMODULE)) {
- List<VnfVfmoduleCvnfcConfigurationCustomization> fabricCustomizations = traverseCatalogDbForConfiguration(vnfCustomizationUUID, vfModuleCustomizationUUID);
- if (fabricCustomizations.isEmpty()) {
- result = orchFlows.stream().filter(item -> !item.getFlowName().contains(FABRIC_CONFIGURATION)).collect(Collectors.toList());
- }
- }
- return result;
- }
protected void buildAndThrowException(DelegateExecution execution, String msg, Exception ex) {
logger.error(msg, ex);
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 33a89e0b82..877a0dded7 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
@@ -22,18 +22,28 @@ package org.onap.so.bpmn.infrastructure.workflow.tasks;
import java.sql.Timestamp;
import java.util.ArrayList;
-import java.util.Date;
import java.util.List;
import java.util.Optional;
+import java.util.UUID;
-import org.camunda.bpm.engine.delegate.BpmnError;
import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.onap.aai.domain.yang.Vnfc;
import org.onap.so.bpmn.common.workflow.context.WorkflowCallbackResponse;
import org.onap.so.bpmn.common.workflow.context.WorkflowContextHolder;
-import org.onap.so.bpmn.core.WorkflowException;
import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.ConfigurationResourceKeys;
import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds;
+import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils;
+import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.aai.entities.AAIResultWrapper;
+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.client.exception.ExceptionBuilder;
+import org.onap.so.db.catalog.beans.CvnfcCustomization;
+import org.onap.so.db.catalog.beans.VnfVfmoduleCvnfcConfigurationCustomization;
+import org.onap.so.db.catalog.client.CatalogDbClient;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.client.RequestsDbClient;
import org.onap.so.serviceinstancebeans.RequestReferences;
@@ -55,6 +65,9 @@ public class WorkflowActionBBTasks {
private static final String G_ALACARTE = "aLaCarte";
private static final String G_ACTION = "requestAction";
private static final String RETRY_COUNT = "retryCount";
+ private static final String FABRIC_CONFIGURATION = "FabricConfiguration";
+ private static final String ASSIGN_FABRIC_CONFIGURATION_BB = "AssignFabricConfigurationBB";
+ private static final String ACTIVATE_FABRIC_CONFIGURATION_BB = "ActivateFabricConfigurationBB";
protected String maxRetries = "mso.rainyDay.maxRetries";
private static final Logger logger = LoggerFactory.getLogger(WorkflowActionBBTasks.class);
@@ -66,6 +79,10 @@ public class WorkflowActionBBTasks {
private WorkflowActionBBFailure workflowActionBBFailure;
@Autowired
private Environment environment;
+ @Autowired
+ private BBInputSetupUtils bbInputSetupUtils;
+ @Autowired
+ private CatalogDbClient catalogDbClient;
public void selectBB(DelegateExecution execution) {
List<ExecuteBuildingBlock> flowsToExecute = (List<ExecuteBuildingBlock>) execution
@@ -281,10 +298,12 @@ public class WorkflowActionBBTasks {
int flowSize = rollbackFlows.size();
String handlingCode = (String) execution.getVariable("handlingCode");
- if(handlingCode.equals("RollbackToAssigned")){
+ if(handlingCode.equals("RollbackToAssigned") || handlingCode.equals("RollbackToCreated")){
for(int i = 0; i<flowSize; i++){
if(rollbackFlows.get(i).getBuildingBlock().getBpmnFlowName().contains("Unassign")){
rollbackFlows.remove(i);
+ } else if(rollbackFlows.get(i).getBuildingBlock().getBpmnFlowName().contains("Delete") && handlingCode.equals("RollbackToCreated")) {
+ rollbackFlows.remove(i);
}
}
}
@@ -331,4 +350,90 @@ public class WorkflowActionBBTasks {
workflowAction.buildAndThrowException(execution, "Failed to update Request db with instanceId");
}
}
+
+ public void postProcessingExecuteBB(DelegateExecution execution) {
+ List<ExecuteBuildingBlock> flowsToExecute = (List<ExecuteBuildingBlock>) execution
+ .getVariable("flowsToExecute");
+ String handlingCode = (String) execution.getVariable("handlingCode");
+ final boolean aLaCarte = (boolean) execution.getVariable(G_ALACARTE);
+ int currentSequence = (int) execution.getVariable(G_CURRENT_SEQUENCE);
+ ExecuteBuildingBlock ebb = flowsToExecute.get(currentSequence - 1);
+ String bbFlowName = ebb.getBuildingBlock().getBpmnFlowName();
+ if(bbFlowName.equalsIgnoreCase("ActivateVfModuleBB") && aLaCarte && handlingCode.equalsIgnoreCase("Success")) {
+ postProcessingExecuteBBActivateVfModule(execution, ebb, flowsToExecute);
+ }
+ }
+
+ protected void postProcessingExecuteBBActivateVfModule(DelegateExecution execution,
+ ExecuteBuildingBlock ebb, List<ExecuteBuildingBlock> flowsToExecute) {
+ try {
+ String vnfId = ebb.getWorkflowResourceIds().getVnfId();
+ String vfModuleId = ebb.getWorkflowResourceIds().getVfModuleId();
+ String vnfCustomizationUUID = bbInputSetupUtils.getAAIGenericVnf(vnfId).getModelCustomizationId();
+ String vfModuleCustomizationUUID = bbInputSetupUtils.getAAIVfModule(vnfId, vfModuleId).getModelCustomizationId();
+ List<Vnfc> vnfcs = workflowAction.getRelatedResourcesInVfModule(vnfId, vfModuleId, Vnfc.class, AAIObjectType.VNFC);
+ for(Vnfc vnfc : vnfcs) {
+ String modelCustomizationId = vnfc.getModelCustomizationId();
+ List<CvnfcCustomization> cvnfcCustomizations = catalogDbClient.getCvnfcCustomizationByVnfCustomizationUUIDAndVfModuleCustomizationUUID(vnfCustomizationUUID, vfModuleCustomizationUUID);
+ CvnfcCustomization cvnfcCustomization = null;
+ for(CvnfcCustomization cvnfc : cvnfcCustomizations) {
+ if(cvnfc.getModelCustomizationUUID().equalsIgnoreCase(modelCustomizationId)) {
+ cvnfcCustomization = cvnfc;
+ }
+ }
+ if(cvnfcCustomization != null) {
+ VnfVfmoduleCvnfcConfigurationCustomization fabricConfig = null;
+ for(VnfVfmoduleCvnfcConfigurationCustomization customization : cvnfcCustomization.getVnfVfmoduleCvnfcConfigurationCustomization()){
+ if(customization.getConfigurationResource().getToscaNodeType().contains(FABRIC_CONFIGURATION)){
+ if(fabricConfig == null) {
+ fabricConfig = customization;
+ } else {
+ throw new Exception("Multiple Fabric configs found for this vnfc");
+ }
+ }
+ }
+ if(fabricConfig != null) {
+ String configurationId = UUID.randomUUID().toString();
+ ConfigurationResourceKeys configurationResourceKeys = new ConfigurationResourceKeys();
+ configurationResourceKeys.setCvnfcCustomizationUUID(modelCustomizationId);
+ configurationResourceKeys.setVfModuleCustomizationUUID(vfModuleCustomizationUUID);
+ configurationResourceKeys.setVnfResourceCustomizationUUID(vnfCustomizationUUID);
+ configurationResourceKeys.setVnfcName(vnfc.getVnfcName());
+ ExecuteBuildingBlock assignConfigBB = getExecuteBBForConfig(ASSIGN_FABRIC_CONFIGURATION_BB, ebb, configurationId, configurationResourceKeys);
+ ExecuteBuildingBlock activateConfigBB = getExecuteBBForConfig(ACTIVATE_FABRIC_CONFIGURATION_BB, ebb, configurationId, configurationResourceKeys);
+ flowsToExecute.add(assignConfigBB);
+ flowsToExecute.add(activateConfigBB);
+ execution.setVariable("flowsToExecute", flowsToExecute);
+ execution.setVariable("completed", false);
+ }
+ } else {
+ logger.debug("No cvnfcCustomization found for customizationId: " + modelCustomizationId);
+ }
+ }
+ } catch (Exception e) {
+ String errorMessage = "Error occurred in post processing of Vf Module create";
+ execution.setVariable("handlingCode", "RollbackToCreated");
+ execution.setVariable("WorkflowActionErrorMessage", errorMessage);
+ logger.error(errorMessage, e);
+ }
+ }
+
+ protected ExecuteBuildingBlock getExecuteBBForConfig(String bbName, ExecuteBuildingBlock ebb, String configurationId, ConfigurationResourceKeys configurationResourceKeys) {
+ ExecuteBuildingBlock configBB = new ExecuteBuildingBlock();
+ BuildingBlock buildingBlock = new BuildingBlock();
+ buildingBlock.setBpmnFlowName(bbName);
+ buildingBlock.setMsoId(UUID.randomUUID().toString());
+ configBB.setaLaCarte(ebb.isaLaCarte());
+ configBB.setApiVersion(ebb.getApiVersion());
+ configBB.setRequestAction(ebb.getRequestAction());
+ configBB.setVnfType(ebb.getVnfType());
+ configBB.setRequestId(ebb.getRequestId());
+ configBB.setRequestDetails(ebb.getRequestDetails());
+ configBB.setBuildingBlock(buildingBlock);
+ WorkflowResourceIds workflowResourceIds = ebb.getWorkflowResourceIds();
+ workflowResourceIds.setConfigurationId(configurationId);
+ configBB.setWorkflowResourceIds(workflowResourceIds);
+ configBB.setConfigurationResourceKeys(configurationResourceKeys);
+ return configBB;
+ }
}
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/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/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/WorkflowActionUnitTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionUnitTest.java
index 8195cd58c0..5c083779be 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
@@ -83,54 +83,6 @@ public class WorkflowActionUnitTest {
private WorkflowAction workflowAction;
@Test
- public void filterOrchFlowsHasFabricTest() {
-
- List<OrchestrationFlow> flows = createFlowList(
- "DeactivateFabricConfigurationBB",
- "flow x",
- "flow y",
- "ActivateFabricConfigurationBB",
- "flow z");
- doReturn(Arrays.asList("yes", "yes")).when(workflowAction).traverseCatalogDbForConfiguration(ArgumentMatchers.any(String.class), ArgumentMatchers.isNull());
-
- ServiceInstancesRequest sIRequest = new ServiceInstancesRequest();
- RequestDetails requestDetails = new RequestDetails();
- ModelInfo modelInfo = new ModelInfo();
- requestDetails.setModelInfo(modelInfo);
- RelatedInstance relatedInstance = new RelatedInstance();
- sIRequest.setRequestDetails(requestDetails);
-
- List<OrchestrationFlow> result = workflowAction.filterOrchFlows(sIRequest, flows, WorkflowType.VFMODULE, mock(DelegateExecution.class));
-
- assertThat(result, is(flows));
- }
-
- @Test
- public void filterOrchFlowNoFabricTest() {
- List<OrchestrationFlow> flows = createFlowList(
- "DeactivateFabricConfigurationBB",
- "flow x",
- "flow y",
- "ActivateFabricConfigurationBB",
- "flow z");
-
- ServiceInstancesRequest sIRequest = new ServiceInstancesRequest();
- RequestDetails requestDetails = new RequestDetails();
- ModelInfo modelInfo = new ModelInfo();
- modelInfo.setModelCustomizationUuid("");
- requestDetails.setModelInfo(modelInfo);
- sIRequest.setRequestDetails(requestDetails);
-
- List<OrchestrationFlow> result = workflowAction.filterOrchFlows(sIRequest, flows, WorkflowType.VFMODULE, mock(DelegateExecution.class));
- List<OrchestrationFlow> expected = createFlowList(
- "flow x",
- "flow y",
- "flow z");
-
- assertThat(result, is(expected));
- }
-
- @Test
public void traverseCatalogDbForConfigurationTest() {
CvnfcCustomization cvnfcCustomization = new CvnfcCustomization();
@@ -150,33 +102,6 @@ public class WorkflowActionUnitTest {
}
- @Test
- public void verifyFilterOrchInvocation() throws Exception {
- DelegateExecution execution = mock(DelegateExecution.class);
-
- when(execution.getVariable(eq("aLaCarte"))).thenReturn(true);
- when(execution.getVariable(eq("bpmnRequest"))).thenReturn(getJson("ServiceMacroAssign.json"));
- when(execution.getVariable(eq("requestUri"))).thenReturn("/v6/serviceInstances/123/vnfs/1234");
-
- OrchestrationFlow flow = new OrchestrationFlow();
- flow.setFlowName("flow x");
-
- List<OrchestrationFlow> flows = Arrays.asList(flow);
- doReturn(Arrays.asList(flow)).when(workflowAction).queryNorthBoundRequestCatalogDb(any(), any(), any(), anyBoolean(), any(), any());
- workflowAction.selectExecutionList(execution);
-
- verify(workflowAction, times(1)).filterOrchFlows(any(), eq(flows), any(), any());
-
- flow = new OrchestrationFlow();
- flow.setFlowName("flow y");
- flows = Arrays.asList(flow);
- when(execution.getVariable(eq("aLaCarte"))).thenReturn(false);
- workflowAction.selectExecutionList(execution);
-
- verify(workflowAction, never()).filterOrchFlows(any(), eq(flows), any(), any());
-
- }
-
private String getJson(String filename) throws IOException {
return new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + filename)));
}
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/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 341d7996a9..9715695d7c 100644
--- a/common/src/main/java/org/onap/so/logger/MsoLogger.java
+++ b/common/src/main/java/org/onap/so/logger/MsoLogger.java
@@ -888,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);
@@ -959,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,
@@ -1042,7 +1031,7 @@ public class MsoLogger {
/**
* Set the requestId and serviceInstanceId
- *
+ *
* @param reqId
* The requestId
* @param svcId
@@ -1058,31 +1047,6 @@ public class MsoLogger {
}
}
- /**
- * Get the serviceName
- *
- * @return The service name
- */
- public static String getServiceName() {
- return MDC.get(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;
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-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 2dab494b07..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
@@ -1125,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);
}
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/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/ServiceInstancesTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java
index 23974ef1fa..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
@@ -194,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();
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/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/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/client/CatalogDbClient.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java
index 9b888cb2ed..f73044747c 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
@@ -75,6 +75,7 @@ public class CatalogDbClient {
private static final String CLOUD_SITE = "/cloudSite";
private static final String CLOUDIFY_MANAGER = "/cloudifyManager";
+ private static final String CVNFC_CUSTOMZIATION = "/cvnfcCustomization";
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";
@@ -177,6 +178,7 @@ public class CatalogDbClient {
private String cloudifyManagerURI;
private String cloudSiteURI;
private String homingInstanceURI;
+ private String cvnfcResourceCustomizationURI;
private String pnfResourceURI;
private String pnfResourceCustomizationURI;
@@ -238,10 +240,10 @@ public class CatalogDbClient {
private final Client<PnfResourceCustomization> pnfResourceCustomizationClient;
- @Value("${mso.catalog.db.spring.endpoint}")
+ @Value("${mso.catalog.db.spring.endpoint:#{null}}")
private String endpoint;
- @Value("${mso.db.auth}")
+ @Value("${mso.db.auth:#{null}}")
private String msoAdaptersAuth;
@@ -305,6 +307,7 @@ public class CatalogDbClient {
networkCollectionResourceCustomizationURI =
endpoint + NETWORK_COLLECTION_RESOURCE_CUSTOMIZATION + URI_SEPARATOR;
networkResourceCustomizationURI = endpoint + NETWORK_RESOURCE_CUSTOMIZATION + URI_SEPARATOR;
+ cvnfcResourceCustomizationURI = endpoint + CVNFC_CUSTOMZIATION + URI_SEPARATOR;
vnfResourceCustomizationURI = endpoint + VNF_RESOURCE_CUSTOMIZATION + URI_SEPARATOR;
collectionNetworkResourceCustomizationURI =
endpoint + COLLECTION_NETWORK_RESOURCE_CUSTOMIZATION + URI_SEPARATOR;
@@ -518,6 +521,15 @@ public class CatalogDbClient {
return networkResourceCustomization;
}
+ public CvnfcCustomization getCvnfcCustomizationByModelCustomizationUUID(String modelCustomizationUUID){
+ CvnfcCustomization cvnfcResourceCustomization =
+ this.getSingleResource(cvnfcCustomizationClient, getUri(cvnfcResourceCustomizationURI + modelCustomizationUUID));
+ if (cvnfcResourceCustomization != null) {
+ cvnfcResourceCustomization.setModelCustomizationUUID(modelCustomizationUUID);
+ }
+ return cvnfcResourceCustomization;
+ }
+
public BuildingBlockDetail getBuildingBlockDetail(String buildingBlockName) {
BuildingBlockDetail buildingBlockDetail = getSingleResource(buildingBlockDetailClient, getUri(UriBuilder
.fromUri(findOneByBuildingBlockName).queryParam(BUILDING_BLOCK_NAME, buildingBlockName).build()
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>