aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatEnvironmentEntry.java3
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java56
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java10
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/VfModuleRollback.java6
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceInfo.java9
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceMacroHolder.java2
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java5
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql23
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V7.5.1__AddServiceArtifact.sql17
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V8.5__AddCloudOwner.sql13
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V8.6__Update_Service_Function.sql4
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/NetworkCollectionCatalogDbQueryTest.java19
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql24
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditStackService.java91
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/cloudregion/CloudRegionRestV1.java6
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/cloudregion/CloudRestImpl.java70
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryService.java52
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java2
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/TaskServices.java132
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AbstractAudit.java (renamed from adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AbstractAudit.java)2
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AbstractAuditService.java (renamed from adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AbstractAuditService.java)3
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditCreateStackService.java (renamed from adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditCreateStackService.java)8
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditDataService.java (renamed from adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditDataService.java)2
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditDeleteStackService.java (renamed from adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditDeleteStackService.java)13
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditQueryStackService.java (renamed from adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditQueryStackService.java)10
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditVServer.java (renamed from adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditVServer.java)2
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/HeatStackAudit.java (renamed from adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/HeatStackAudit.java)2
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/CreateAAIInventory.java (renamed from adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateAAIInventory.java)2
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/CreateInventoryTask.java (renamed from adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryTask.java)9
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/InventoryException.java (renamed from adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/InventoryException.java)2
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/PollService.java191
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/RollbackService.java92
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/StackService.java207
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java66
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRest.java1
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestV2.java8
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2.java47
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/cloudregion/CloudRegionRestImplTest.java34
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AuditDataServiceTest.java (renamed from adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditDataServiceTest.java)3
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AuditStackServiceDataTest.java (renamed from adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceDataTest.java)8
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AuditVServerTest.java (renamed from adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditVServerTest.java)3
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/HeatStackAuditTest.java (renamed from adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/HeatStackAuditTest.java)4
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/inventory/CreateAAIInventoryTest.java (renamed from adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/inventory/create/CreateAAIInventoryTest.java)3
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/inventory/CreateInventoryTaskTest.java (renamed from adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/inventory/create/CreateInventoryTaskTest.java)17
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/PollServiceTest.java82
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/RollbackServiceTest.java82
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/StackServiceTest.java113
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/__files/vnfAdapterTaskRequestCreate.xml66
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/schema.sql1
-rw-r--r--adapters/mso-requests-db-adapter/src/main/resources/db/migration/V8.2__Fix_Invalid_Request_Status.sql4
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/MessageConverterConfiguration.java10
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/VnfmAdapterUrlProvider.java105
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/converters/etsicatalog/sol003/VnfPkgInfoConverter.java60
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogPackageManagementServiceProvider.java72
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogServiceProvider.java71
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogServiceProviderConfiguration.java132
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogServiceProviderImpl.java9
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogSubscriptionServiceProvider.java55
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmHelper.java49
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmHttpServiceProviderConfiguration.java49
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderConfiguration.java16
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/AbstractNotificationServiceProvider.java13
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/BasicAuthNotificationServiceProvider.java6
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/OAuthNotificationServiceProvider.java13
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/SubscriptionManager.java46
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementController.java2
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/EtsiSubscriptionNotificationControllerTest.java2
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementControllerTest.java58
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementSubscriptionControllerTest.java4
-rw-r--r--adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/client/beans/ConfigurationParameters.java21
-rw-r--r--adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTask.java2
-rw-r--r--adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImpl.java9
-rw-r--r--adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImplTest.java33
-rw-r--r--adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskTest.java2
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java26
-rw-r--r--asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java5
-rw-r--r--asdc-controller/src/test/resources/schema.sql13
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcess.groovy5
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy676
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoServiceInstance.java10
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java56
-rw-r--r--bpmn/MSOCommonBPMN/src/main/resources/subprocess/VnfAdapterTask.bpmn336
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java4
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFConfigModifyActivity.bpmn67
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/VnfAdapter.bpmn57
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFConfigModifyActivityTest.java54
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VnfAdapterTest.java8
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy19
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy25
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy851
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy11
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy978
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy854
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/HandleOrchestrationTask.groovy (renamed from bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/HandleOrchestrationTask.groovy)0
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/PNFSoftwareUpgrade.groovy124
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceServiceTest.groovy75
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteVfModuleVolumeInfraV1.bpmn9
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/PNFSWUPDownload.bpmn221
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/PNFSoftwareUpgrade.bpmn230
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/UpdateVfModuleVolumeInfraV1.bpmn9
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVfModule.bpmn6
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVfModuleRollback.bpmn15
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVfModuleVolumeRollback.bpmn7
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVfModuleVolumeV2.bpmn7
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn3
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteVfModule.bpmn15
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteVfModuleFromVnf.bpmn15
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteVfModuleVolumeV2.bpmn68
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoUpdateVfModule.bpmn15
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/PNFSoftwareUpgradeTest.java18
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java142
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java6
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessor.java21
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/sdnc/SdncControllerDE.java106
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasks.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java44
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java31
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImplTest.java42
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessorTest.java43
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasksTest.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java3
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapperTest.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/createNetworkRequest.json2
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleAddonRequest.json4
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestWithCloudResources.json4
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleWithVolumeGroupRequest.json4
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/appcTaskRequestConfigModify.json13
-rw-r--r--common/src/main/java/org/onap/so/appc/orchestrator/service/beans/ApplicationControllerTaskRequest.java11
-rw-r--r--common/src/main/java/org/onap/so/logging/tasks/AuditMDCSetup.java (renamed from common/src/main/java/org/onap/so/externaltasks/logging/AuditMDCSetup.java)3
-rw-r--r--common/src/main/java/org/onap/so/utils/ExternalTaskServiceUtils.java7
-rw-r--r--common/src/main/java/org/onap/so/utils/ExternalTaskUtils.java6
-rw-r--r--common/src/test/java/org/onap/so/logging/tasks/MDCSetupTest.java (renamed from common/src/test/java/org/onap/so/externaltasks/logging/AuditMDCSetupTest.java)27
-rw-r--r--common/src/test/java/org/onap/so/utils/ExternalTaskUtilsTest.java5
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java4
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/AAIDataRetrieval.java35
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/NetworkDeleteValidator.java34
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/RequestValidator.java3
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/RequestValidatorListenerRunner.java9
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/ServiceInstanceDeleteValidator.java38
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/VnfDeleteValidator.java34
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/VolumeGroupDeleteValidator.java33
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/validator/NetworkDeleteValidatorTest.java73
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/validator/ServiceInstanceDeleteValidatorTest.java88
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/validator/VnfDeleteValidatorTest.java67
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/validator/VolumeGroupDeleteValidatorTest.java69
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudSite.java15
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CvnfcConfigurationCustomization.java4
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CvnfcCustomization.java4
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/NetworkTechnologyReference.java101
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/Service.java26
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ServiceInfo.java5
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VfModuleCustomization.java12
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java9
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NetworkTechnologyReferenceRepository.java (renamed from mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceInfoRepository.java)17
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/rest/beans/ServiceMacroHolder.java15
-rw-r--r--mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepositoryTest.java11
-rw-r--r--mso-catalog-db/src/test/resources/data.sql2
-rw-r--r--mso-catalog-db/src/test/resources/schema.sql2
-rw-r--r--packages/docker/pom.xml24
-rw-r--r--releases/1.6.0.yaml33
-rw-r--r--so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryStackByIdDoubleFailure.java52
-rw-r--r--so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryStackByIdFailure.java16
-rw-r--r--so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryStackByIdMacro1.java32
-rw-r--r--so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryStackByIdMacro2.java15
-rw-r--r--so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryStackByIdMacro3.java16
-rw-r--r--version.properties2
167 files changed, 5929 insertions, 2873 deletions
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatEnvironmentEntry.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatEnvironmentEntry.java
index 47ba076e0e..1f6ff1408c 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatEnvironmentEntry.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatEnvironmentEntry.java
@@ -58,7 +58,8 @@ public class MsoHeatEnvironmentEntry {
return;
byte[] b = this.rawEntry.toString().getBytes();
MsoYamlEditorWithEnvt yaml = new MsoYamlEditorWithEnvt(b);
- StringBuilder sb = null;
+ this.parameters = yaml.getParameterListFromEnvt();
+ StringBuilder sb = this.getResourceRegistryRawEntry();
if (yaml != null) {
this.parameters = yaml.getParameterListFromEnvt();
// this.resources = yaml.getResourceListFromEnvt();
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 f5464645d6..62d9f068f9 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
@@ -33,6 +33,7 @@ import java.util.Map.Entry;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.adapters.vdu.CloudInfo;
import org.onap.so.adapters.vdu.PluginAction;
@@ -45,14 +46,11 @@ import org.onap.so.adapters.vdu.VduPlugin;
import org.onap.so.adapters.vdu.VduStateType;
import org.onap.so.adapters.vdu.VduStatus;
import org.onap.so.cloud.authentication.KeystoneAuthHolder;
-import org.onap.so.db.catalog.beans.CloudIdentity;
-import org.onap.so.db.catalog.beans.CloudSite;
import org.onap.so.db.catalog.beans.HeatTemplate;
import org.onap.so.db.catalog.beans.HeatTemplateParam;
import org.onap.so.db.request.beans.CloudApiRequests;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.client.RequestsDbClient;
-import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.onap.so.openstack.beans.CreateStackRequest;
import org.onap.so.openstack.beans.HeatStatus;
@@ -134,7 +132,6 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
private static final ObjectMapper JSON_MAPPER = new ObjectMapper();
-
/**
* Create a new Stack in the specified cloud location and tenant. The Heat template and parameter map are passed in
* as arguments, along with the cloud access credentials. It is expected that parameters have been validated and
@@ -192,7 +189,10 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
} else if (CREATE_FAILED.equals(currentStack.getStackStatus())
|| DELETE_FAILED.equals(currentStack.getStackStatus())) {
try {
- processCreateStack(cloudSiteId, tenantId, timeoutMinutes, backout, currentStack, createStack, true);
+ if (pollForCompletion) {
+ processCreateStack(cloudSiteId, tenantId, timeoutMinutes, backout, currentStack, createStack,
+ true);
+ }
} catch (MsoException e) {
if (e instanceof StackCreationException) {
logger.warn("Error during Stack will attempt to recreate stack");
@@ -201,9 +201,6 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
if (pollForCompletion) {
currentStack = processCreateStack(cloudSiteId, tenantId, timeoutMinutes, backout,
currentStack, createStack, true);
- } else {
- currentStack = queryHeatStack(currentStack.getStackName() + "/" + currentStack.getId(),
- cloudSiteId, tenantId);
}
} else {
throw e;
@@ -216,9 +213,6 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
if (pollForCompletion) {
currentStack = processCreateStack(cloudSiteId, tenantId, timeoutMinutes, backout, currentStack,
createStack, true);
- } else {
- currentStack =
- queryHeatStack(currentStack.getStackName() + "/" + currentStack.getId(), cloudSiteId, tenantId);
}
operationPerformed = true;
}
@@ -268,6 +262,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
Stack heatStack, CreateStackParam stackCreate, boolean keyPairCleanUp) throws MsoException {
Stack latestStack = null;
try {
+
latestStack =
pollStackForStatus(timeoutMinutes, heatStack, CREATE_IN_PROGRESS, cloudSiteId, tenantId, false);
} catch (MsoException me) {
@@ -277,7 +272,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
stackCreate);
}
- protected Stack postProcessStackCreate(Stack stack, boolean backout, int timeoutMinutes, boolean cleanUpKeyPair,
+ public Stack postProcessStackCreate(Stack stack, boolean backout, int timeoutMinutes, boolean cleanUpKeyPair,
String cloudSiteId, String tenantId, CreateStackParam stackCreate) throws MsoException {
boolean stackCreationFailed = false;
boolean stackRollbackFailed = false;
@@ -327,7 +322,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
}
}
- protected Stack pollStackForStatus(int timeoutMinutes, Stack stack, String stackStatus, String cloudSiteId,
+ public Stack pollStackForStatus(int timeoutMinutes, Stack stack, String stackStatus, String cloudSiteId,
String tenantId, boolean notFoundIsSuccess) throws MsoException {
int pollingFrequency =
Integer.parseInt(this.environment.getProperty(createPollIntervalProp, CREATE_POLL_INTERVAL_DEFAULT));
@@ -336,7 +331,11 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
int numberOfPollingAttempts = Math.floorDiv((timeoutMinutes * pollingMultiplier), pollingFrequency);
Heat heatClient = getHeatClient(cloudSiteId, tenantId);
while (true) {
- Stack latestStack = queryHeatStack(heatClient, stack.getStackName() + "/" + stack.getId());
+ String stackName = stack.getStackName() + "/" + stack.getId();
+ if (stack.getId() == null) {
+ stackName = stack.getStackName();
+ }
+ Stack latestStack = queryHeatStack(heatClient, stackName);
if (latestStack == null && notFoundIsSuccess) {
return null;
} else if (latestStack != null) {
@@ -387,27 +386,33 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
protected Stack handleUnknownCreateStackFailure(Stack stack, int timeoutMinutes, String cloudSiteId,
String tenantId) throws MsoException {
if (stack != null && !Strings.isNullOrEmpty(stack.getStackName()) && !Strings.isNullOrEmpty(stack.getId())) {
- return deleteStack(stack, timeoutMinutes, cloudSiteId, tenantId);
+ return deleteStack(stack, timeoutMinutes, cloudSiteId, tenantId, false);
} else {
throw new StackCreationException("Cannot Find Stack Name or Id");
}
}
- private Stack deleteStack(Stack stack, int timeoutMinutes, String cloudSiteId, String tenantId)
- throws MsoException {
+ private Stack deleteStack(Stack stack, int timeoutMinutes, String cloudSiteId, String tenantId,
+ boolean pollForCompletion) throws MsoException {
OpenStackRequest<Void> request = getHeatClient(cloudSiteId, tenantId).getStacks()
.deleteByName(stack.getStackName() + "/" + stack.getId());
executeAndRecordOpenstackRequest(request);
- Stack currentStack = pollStackForStatus(timeoutMinutes, stack, DELETE_IN_PROGRESS, cloudSiteId, tenantId, true);
- if (currentStack == null) {
+ logger.debug("Completed Executing executeAndRecordOpenstackRequest");
+ if (pollForCompletion == true) {
+ Stack currentStack =
+ pollStackForStatus(timeoutMinutes, stack, DELETE_IN_PROGRESS, cloudSiteId, tenantId, true);
+ if (currentStack == null) {
+ return currentStack;
+ }
+ postProcessStackDelete(currentStack);
return currentStack;
} else {
- postProcessStackDelete(currentStack);
+ logger.debug("Returning the stack");
+ return stack;
}
- return currentStack;
}
- protected void postProcessStackDelete(Stack stack) throws MsoException {
+ public void postProcessStackDelete(Stack stack) throws MsoException {
logger.info("Performing post processing on delete stack {}", stack);
if (stack != null && !Strings.isNullOrEmpty(stack.getStackStatus())) {
if (!DELETE_COMPLETE.equals(stack.getStackStatus()))
@@ -505,10 +510,13 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
stackInfo = new StackInfo(stackName, HeatStatus.NOTFOUND);
stackInfo.setOperationPerformed(false);
} else {
- currentStack = deleteStack(currentStack, timeoutMinutes, cloudSiteId, tenantId);
+ currentStack = deleteStack(currentStack, timeoutMinutes, cloudSiteId, tenantId, pollForCompletion);
stackInfo = new StackInfoMapper(currentStack).map();
stackInfo.setName(stackName);
stackInfo.setOperationPerformed(true);
+ if (currentStack != null) {
+ stackInfo.setCanonicalName(currentStack.getStackName() + "/" + currentStack.getId());
+ }
}
return stackInfo;
}
@@ -634,7 +642,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
return queryHeatStack(getHeatClient(cloudSiteId, tenantId), stackName);
}
-
+ // TODO enhancement - just have this return the stack then we dont have to query again in deleteStack
public Map<String, Object> queryStackForOutputs(String cloudSiteId, String cloudOwner, String tenantId,
String stackName) throws MsoException {
logger.debug("MsoHeatUtils.queryStackForOutputs)");
diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java
index 0f9f7a273e..4938bff748 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -264,9 +264,9 @@ public class MsoHeatUtilsTest extends MsoHeatUtils {
heatUtils.handleUnknownCreateStackFailure(stack, 120, cloudSiteId, tenantId);
Mockito.verify(heatUtils, times(1)).executeAndRecordOpenstackRequest(mockDeleteStack);
- Mockito.verify(heatUtils, times(1)).pollStackForStatus(120, stack, "DELETE_IN_PROGRESS", cloudSiteId, tenantId,
+ Mockito.verify(heatUtils, times(0)).pollStackForStatus(120, stack, "DELETE_IN_PROGRESS", cloudSiteId, tenantId,
true);
- Mockito.verify(heatUtils, times(1)).postProcessStackDelete(deletedStack);
+ Mockito.verify(heatUtils, times(0)).postProcessStackDelete(deletedStack);
}
@@ -324,8 +324,6 @@ public class MsoHeatUtilsTest extends MsoHeatUtils {
CreateStackParam createStackParam = new CreateStackParam();
createStackParam.setStackName("stackName");
- // doReturn(mockResources).when(heatUtils).queryStackResources(cloudSiteId, tenantId, "stackName", 2);
- // doNothing().when(novaClient).deleteKeyPair(cloudSiteId, tenantId, "KeypairName");
doReturn(null).when(heatUtils).handleUnknownCreateStackFailure(stack, 120, cloudSiteId, tenantId);
doReturn(createdStack).when(heatUtils).createStack(createStackParam, cloudSiteId, tenantId);
doReturn(createdStack).when(heatUtils).processCreateStack(cloudSiteId, tenantId, 120, true, createdStack,
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/VfModuleRollback.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/VfModuleRollback.java
index 5f93765688..5f4d9d3eab 100644
--- a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/VfModuleRollback.java
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/VfModuleRollback.java
@@ -44,15 +44,15 @@ public class VfModuleRollback {
public VfModuleRollback(VnfRollback vrb, String vfModuleId, String vfModuleStackId, String messageId) {
this.vnfId = vrb.getVnfId();
- this.vfModuleId = vfModuleId;
- this.vfModuleStackId = vfModuleStackId;
this.vfModuleCreated = vrb.getVnfCreated();
this.tenantId = vrb.getTenantId();
this.cloudOwner = vrb.getCloudOwner();
this.cloudSiteId = vrb.getCloudSiteId();
this.msoRequest = vrb.getMsoRequest();
- this.messageId = messageId;
this.mode = vrb.getMode();
+ this.vfModuleId = vfModuleId;
+ this.vfModuleStackId = vfModuleStackId;
+ this.messageId = messageId;
}
public VfModuleRollback(String vnfId, String vfModuleId, String vfModuleStackId, boolean vfModuleCreated,
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceInfo.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceInfo.java
index 6c1c81c6ef..195ada37f7 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceInfo.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceInfo.java
@@ -24,8 +24,11 @@ import org.onap.so.db.catalog.beans.Service;
import org.onap.so.db.catalog.beans.ServiceInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.springframework.util.CollectionUtils;
import javax.xml.bind.annotation.XmlRootElement;
+import java.util.Collections;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
@XmlRootElement(name = "serviceInfo")
@@ -45,8 +48,10 @@ public class QueryServiceInfo extends CatalogQuery {
this.serviceInfo = new ServiceInfo();
}
- public QueryServiceInfo(ServiceInfo serviceInfo) {
- this.serviceInfo = serviceInfo;
+ public QueryServiceInfo(List<ServiceInfo> serviceInfos) {
+ if (!CollectionUtils.isEmpty(serviceInfos)) {
+ this.serviceInfo = serviceInfos.get(0);
+ }
}
public ServiceInfo getServiceInfo() {
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceMacroHolder.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceMacroHolder.java
index d5aa472c8d..305d52a997 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceMacroHolder.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceMacroHolder.java
@@ -94,7 +94,7 @@ public class QueryServiceMacroHolder extends CatalogQuery {
subitem = new QueryAllottedResourceCustomization(service.getAllottedCustomizations()).JSON2(true, true);
valueMap.put("_SERVICEALLOTTEDRESOURCES_", subitem.replaceAll(LINE_BEGINNING, "\t"));
- subitem = new QueryServiceInfo(serviceMacroHolder.getServiceInfo()).JSON2(true, true);
+ subitem = new QueryServiceInfo(service.getServiceInfos()).JSON2(true, true);
valueMap.put("_SERVICEINFO_", subitem.replaceAll(LINE_BEGINNING, "\t"));
subitem = new QueryServiceProxyCustomization(service.getServiceProxyCustomizations()).JSON2(true, true);
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java
index fca1d3a45e..98abf15645 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java
@@ -102,9 +102,6 @@ public class CatalogDbAdapterRest {
@Autowired
private InstanceGroupRepository instanceGroupRepository;
- @Autowired
- private ServiceInfoRepository serviceInfoRepository;
-
private static final String NO_MATCHING_PARAMETERS = "no matching parameters";
public Response respond(String version, int respStatus, boolean isArray, CatalogQuery qryResp) {
@@ -307,8 +304,6 @@ public class CatalogDbAdapterRest {
respStatus = HttpStatus.SC_NOT_FOUND;
qryResp = new QueryServiceMacroHolder();
} else {
- ServiceInfo serviceInfo = serviceInfoRepository.findByService(ret.getService());
- ret.setServiceInfo(serviceInfo);
qryResp = new QueryServiceMacroHolder(ret);
logger.debug("serviceMacroHolder qryResp= {}", qryResp);
}
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql
index e5daf24d6c..b70d409cd8 100644
--- a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql
@@ -30,7 +30,8 @@ INSERT INTO northbound_request_ref_lookup(MACRO_ACTION, ACTION, REQUEST_SCOPE, I
('NetworkCollection-Macro-Create', 'createInstance', 'NetworkCollection', false,true, '7','7', 'DEFAULT', '*'),
('NetworkCollection-Macro-Delete', 'deleteInstance', 'NetworkCollection', false,true, '7','7', 'DEFAULT', '*'),
('VFModule-ScaleOut', 'scaleOut', 'VfModule', true, true, '7','7', 'DEFAULT', '*'),
-('VNF-InPlaceUpdate', 'inPlaceSoftwareUpdate', 'Vnf', true, true, '7','7', 'DEFAULT', '*');
+('VNF-InPlaceUpdate', 'inPlaceSoftwareUpdate', 'Vnf', true, true, '7','7', 'DEFAULT', '*'),
+('VNF-Config-Update', 'applyUpdatedConfig', 'Vnf', true, true, '7','7', 'DEFAULT', '*');
INSERT INTO orchestration_flow_reference(COMPOSITE_ACTION, SEQ_NO, FLOW_NAME, FLOW_VERSION, NB_REQ_REF_LOOKUP_ID) VALUES
@@ -198,9 +199,16 @@ INSERT INTO orchestration_flow_reference(COMPOSITE_ACTION, SEQ_NO, FLOW_NAME, FL
('VNF-InPlaceUpdate', '15', 'VNFResumeTrafficActivity', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-InPlaceUpdate' and CLOUD_OWNER = 'DEFAULT')),
('VNF-InPlaceUpdate', '16', 'VNFUnlockActivity', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-InPlaceUpdate' and CLOUD_OWNER = 'DEFAULT')),
('VNF-InPlaceUpdate', '17', 'VNFUnsetInMaintFlagActivity', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-InPlaceUpdate' and CLOUD_OWNER = 'DEFAULT')),
-('VNF-InPlaceUpdate', '18', 'VNFUnsetClosedLoopDisabledFlagActivity', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-InPlaceUpdate' and CLOUD_OWNER = 'DEFAULT'));
-
-
+('VNF-InPlaceUpdate', '18', 'VNFUnsetClosedLoopDisabledFlagActivity', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-InPlaceUpdate' and CLOUD_OWNER = 'DEFAULT')),
+('VNF-Config-Update', '1', 'VNFCheckPserversLockedFlagActivity', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Config-Update' and CLOUD_OWNER = 'DEFAULT')),
+('VNF-Config-Update', '2', 'VNFCheckInMaintFlagActivity', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Config-Update' and CLOUD_OWNER = 'DEFAULT')),
+('VNF-Config-Update', '3', 'VNFSetInMaintFlagActivity', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Config-Update' and CLOUD_OWNER = 'DEFAULT')),
+('VNF-Config-Update', '4', 'VNFSetClosedLoopDisabledFlagActivity', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Config-Update' and CLOUD_OWNER = 'DEFAULT')),
+('VNF-Config-Update', '5', 'VNFHealthCheckActivity', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Config-Update' and CLOUD_OWNER = 'DEFAULT')),
+('VNF-Config-Update', '6', 'VNFConfigModifyActivity', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Config-Update' and CLOUD_OWNER = 'DEFAULT')),
+('VNF-Config-Update', '7', 'VNFHealthCheckActivity', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Config-Update' and CLOUD_OWNER = 'DEFAULT')),
+('VNF-Config-Update', '8', 'VNFUnsetInMaintFlagActivity', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Config-Update' and CLOUD_OWNER = 'DEFAULT')),
+('VNF-Config-Update', '9', 'VNFUnsetClosedLoopDisabledFlagActivity', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Config-Update' and CLOUD_OWNER = 'DEFAULT'));
INSERT INTO rainy_day_handler_macro (FLOW_NAME, SERVICE_TYPE, VNF_TYPE, ERROR_CODE, WORK_STEP, POLICY)
VALUES
@@ -860,7 +868,8 @@ VALUES
('VNFUpgradePostCheckActivity', 'NO_VALIDATE', 'CUSTOM'),
('VNFUpgradePreCheckActivity', 'NO_VALIDATE', 'CUSTOM'),
('VNFUpgradeSoftwareActivity', 'NO_VALIDATE', 'CUSTOM'),
-('VnfInPlaceSoftwareUpdate', 'NO_VALIDATE', 'CUSTOM');
+('VnfInPlaceSoftwareUpdate', 'NO_VALIDATE', 'CUSTOM'),
+('VNFConfigModifyActivity', 'NO_VALIDATE', 'CUSTOM');
UPDATE northbound_request_ref_lookup SET SERVICE_TYPE = '*' WHERE SERVICE_TYPE IS NULL;
@@ -881,6 +890,10 @@ UPDATE vnf_recipe
SET ORCHESTRATION_URI = '/mso/async/services/WorkflowActionBB'
WHERE NF_ROLE = 'GR-API-DEFAULT' AND ACTION = 'inPlaceSoftwareUpdate';
+UPDATE vnf_recipe
+SET ORCHESTRATION_URI = '/mso/async/services/WorkflowActionBB'
+WHERE NF_ROLE = 'GR-API-DEFAULT' AND ACTION = 'applyUpdatedConfig';
+
INSERT INTO rainy_day_handler_macro (FLOW_NAME, SERVICE_TYPE, VNF_TYPE, ERROR_CODE, WORK_STEP, POLICY, SECONDARY_POLICY, REG_EX_ERROR_MESSAGE, SERVICE_ROLE)
VALUES
('VNFCheckPserversLockedFlagActivity','*','*','*','*','Manual','Abort','*', '*'),
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V7.5.1__AddServiceArtifact.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V7.5.1__AddServiceArtifact.sql
new file mode 100644
index 0000000000..60a9482707
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V7.5.1__AddServiceArtifact.sql
@@ -0,0 +1,17 @@
+use catalogdb;
+
+
+ALTER TABLE `service_info`
+ ADD COLUMN IF NOT EXISTS SERVICE_MODEL_UUID varchar (200)
+ NOT NULL;
+
+
+ALTER TABLE `service_artifact` DROP FOREIGN KEY `fk_service_artifact_service_info1`;
+
+ALTER TABLE `service_info`
+ ADD CONSTRAINT `fk_service_info_service1` FOREIGN KEY (`SERVICE_MODEL_UUID`) REFERENCES `service` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE;
+
+ALTER TABLE `service_artifact`
+ ADD CONSTRAINT `fk_service_artifact_service1` FOREIGN KEY (`SERVICE_MODEL_UUID`) REFERENCES `service` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE;
+
+DROP TABLE IF EXISTS `service_to_service_info`;
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V8.5__AddCloudOwner.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V8.5__AddCloudOwner.sql
new file mode 100644
index 0000000000..92502e2696
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V8.5__AddCloudOwner.sql
@@ -0,0 +1,13 @@
+use catalogdb;
+
+
+ALTER TABLE cloud_sites
+ ADD COLUMN IF NOT EXISTS CLOUD_OWNER varchar(255);
+
+
+CREATE TABLE IF NOT EXISTS `network_technology_reference` (
+ `ID` INT(11) NOT NULL AUTO_INCREMENT,
+ `NETWORK_TECHNOLOGY` varchar(200) NOT NULL ,
+ `CLOUD_OWNER` varchar(200) NOT NULL,
+ PRIMARY KEY (`ID`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1; \ No newline at end of file
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V8.6__Update_Service_Function.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V8.6__Update_Service_Function.sql
new file mode 100644
index 0000000000..51be8be664
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V8.6__Update_Service_Function.sql
@@ -0,0 +1,4 @@
+use catalogdb;
+
+ALTER TABLE service
+ ADD COLUMN IF NOT EXISTS service_function varchar(200) DEFAULT NULL; \ No newline at end of file
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/NetworkCollectionCatalogDbQueryTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/NetworkCollectionCatalogDbQueryTest.java
index 440270e047..0ffc213a4e 100644
--- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/NetworkCollectionCatalogDbQueryTest.java
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/NetworkCollectionCatalogDbQueryTest.java
@@ -30,13 +30,13 @@ import java.util.List;
import javax.transaction.Transactional;
import org.junit.Before;
import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.onap.so.adapters.catalogdb.CatalogDBApplication;
import org.onap.so.adapters.catalogdb.CatalogDbAdapterBaseTest;
import org.onap.so.db.catalog.beans.BuildingBlockDetail;
import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization;
import org.onap.so.db.catalog.beans.CollectionResourceCustomization;
import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization;
+import org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization;
+import org.onap.so.db.catalog.beans.CvnfcCustomization;
import org.onap.so.db.catalog.beans.InstanceGroup;
import org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization;
import org.onap.so.db.catalog.client.CatalogDbClientPortChanger;
@@ -44,9 +44,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.web.server.LocalServerPort;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.context.ActiveProfiles;
-import org.springframework.test.context.junit4.SpringRunner;
public class NetworkCollectionCatalogDbQueryTest extends CatalogDbAdapterBaseTest {
@@ -149,4 +146,16 @@ public class NetworkCollectionCatalogDbQueryTest extends CatalogDbAdapterBaseTes
assertNotNull(collectionNetworkCust);
logger.debug(collectionNetworkCust.getModelCustomizationUUID());
}
+
+ @Test
+ public void getCvnfcCustomization() {
+ client.getServiceByID(serviceUUID);
+ String vfId = "cb82ffd8-252a-11e7-93ae-92361f002671";
+ String vnfId = "68dc9a92-214c-11e7-93ae-92361f002671";
+
+ CvnfcConfigurationCustomization fabricConfig =
+ client.getCvnfcCustomization(serviceUUID, vnfId, vfId, "dadc2c8c-2bab-11e9-b210-d663bd873d95");
+ assertEquals("386c9aa7-9318-48ee-a6d1-1bf0f85de385", fabricConfig.getModelCustomizationUUID());
+ }
+
}
diff --git a/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql b/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql
index 32c51293c2..8fd171bf64 100644
--- a/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql
+++ b/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql
@@ -213,8 +213,30 @@ VALUES ( '1',
'testNfcFunction',
'testNfcNamingCode',
'2018-07-17 14:05:08',
+ '9bcce658-9b37-11e8-98d0-529269fb1459',1),
+ ( '2',
+ 'dadc2c8c-2bab-11e9-b210-d663bd873d95',
+ 'testModelInstanceName',
+ 'b25735fe-9b37-11e8-98d0-529269fb1459',
+ 'ba7e6ef0-9b37-11e8-98d0-529269fb1459',
+ 'testModelVersion',
+ 'testModelName',
+ 'testToscaNodeType',
+ 'testCvnfcCustomzationDescription',
+ 'testNfcFunction',
+ 'testNfcNamingCode',
+ '2018-07-17 14:05:08',
'9bcce658-9b37-11e8-98d0-529269fb1459',1);
+
+
+INSERT IGNORE INTO `configuration` (`MODEL_UUID`, `MODEL_INVARIANT_UUID`, `MODEL_VERSION`, `MODEL_NAME`, `TOSCA_NODE_TYPE`, `DESCRIPTION`, `CREATION_TIMESTAMP`) VALUES
+ ('d2195b0e-307a-4d30-b82f-9c82001d965e', '2f0a4b7a-dfdb-4f82-a2ab-b65d1ddd5e8e', '13.0', 'Fabric Configuration', 'org.openecomp.nodes.FabricConfiguration', 'A fabric Configuration object', '2019-06-04 20:12:20');
+
+INSERT IGNORE INTO `cvnfc_configuration_customization` (`MODEL_CUSTOMIZATION_UUID`, `MODEL_INSTANCE_NAME`, `CONFIGURATION_TYPE`, `CONFIGURATION_ROLE`, `CONFIGURATION_FUNCTION`, `POLICY_NAME`, `CREATION_TIMESTAMP`, `CONFIGURATION_MODEL_UUID`, `CVNFC_CUSTOMIZATION_ID`) VALUES
+ ('386c9aa7-9318-48ee-a6d1-1bf0f85de385', 'Fabric Configuration 0', '5G', 'Fabric Config', 'Network Cloud', 'Config_MS_fabric_configuration_FRWL.1.xml', '2019-06-04 20:12:20', 'd2195b0e-307a-4d30-b82f-9c82001d965e', '2');
+
+
insert into service(model_uuid, model_name, model_invariant_uuid, model_version, description, creation_timestamp, tosca_csar_artifact_uuid, service_type, service_role, environment_context, workload_context) values
('5df8b6de-2083-11e7-93ae-92361f002676', 'PNF_routing_service', '9647dfc4-2083-11e7-93ae-92361f002676', '1.0', 'PNF service', '2019-03-08 12:00:29', null, 'NA', 'NA', 'Luna', 'Oxygen');
@@ -231,4 +253,4 @@ insert into workflow(artifact_uuid, artifact_name, name, operation_name, version
('5b0c4322-643d-4c9f-b184-4516049e99b1', 'testingWorkflow.bpmn', 'testingWorkflow', 'create', 1, 'Test Workflow', null, 'vnf', 'sdc');
insert into vnf_resource_to_workflow(vnf_resource_model_uuid, workflow_id) values
-('ff2ae348-214a-11e7-93ae-92361f002671', '1');
+('ff2ae348-214a-11e7-93ae-92361f002671', '1'); \ No newline at end of file
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditStackService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditStackService.java
deleted file mode 100644
index 7cc7c02f23..0000000000
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditStackService.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*-
- * ============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.adapters.audit;
-
-import javax.annotation.PostConstruct;
-import org.camunda.bpm.client.ExternalTaskClient;
-import org.onap.so.utils.ExternalTaskServiceUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Profile;
-import org.springframework.core.env.Environment;
-import org.springframework.stereotype.Component;
-
-@Component
-@Profile("!test")
-public class AuditStackService {
-
- private static final String MSO_AUDIT_LOCK_TIME = "mso.audit.lock-time";
-
- private static final Logger logger = LoggerFactory.getLogger(AuditStackService.class);
-
- private static final String DEFAULT_AUDIT_LOCK_TIME = "60000";
-
- private static final String DEFAULT_MAX_CLIENTS_FOR_TOPIC = "10";
-
-
- @Autowired
- public Environment env;
-
- @Autowired
- private AuditCreateStackService auditCreateStack;
-
- @Autowired
- private AuditDeleteStackService auditDeleteStack;
-
- @Autowired
- private AuditQueryStackService auditQueryStack;
-
- @Autowired
- private ExternalTaskServiceUtils externalTaskServiceUtils;
-
- @PostConstruct
- public void auditAddAAIInventory() throws Exception {
- for (int i = 0; i < externalTaskServiceUtils.getMaxClients(); i++) {
- ExternalTaskClient client = externalTaskServiceUtils.createExternalTaskClient();
- client.subscribe("InventoryAddAudit")
- .lockDuration(Long.parseLong(env.getProperty(MSO_AUDIT_LOCK_TIME, DEFAULT_AUDIT_LOCK_TIME)))
- .handler(auditCreateStack::executeExternalTask).open();
- }
- }
-
- @PostConstruct
- public void auditDeleteAAIInventory() throws Exception {
- for (int i = 0; i < externalTaskServiceUtils.getMaxClients(); i++) {
- ExternalTaskClient client = externalTaskServiceUtils.createExternalTaskClient();
- client.subscribe("InventoryDeleteAudit")
- .lockDuration(Long.parseLong(env.getProperty(MSO_AUDIT_LOCK_TIME, DEFAULT_AUDIT_LOCK_TIME)))
- .handler(auditDeleteStack::executeExternalTask).open();
- }
- }
-
- @PostConstruct
- public void auditQueryInventory() throws Exception {
- for (int i = 0; i < externalTaskServiceUtils.getMaxClients(); i++) {
- ExternalTaskClient client = externalTaskServiceUtils.createExternalTaskClient();
- client.subscribe("InventoryQueryAudit")
- .lockDuration(Long.parseLong(env.getProperty(MSO_AUDIT_LOCK_TIME, DEFAULT_AUDIT_LOCK_TIME)))
- .handler(auditQueryStack::executeExternalTask).open();
- }
- }
-
-}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/cloudregion/CloudRegionRestV1.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/cloudregion/CloudRegionRestV1.java
index 780480507b..6cf42e1433 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/cloudregion/CloudRegionRestV1.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/cloudregion/CloudRegionRestV1.java
@@ -56,7 +56,6 @@ public class CloudRegionRestV1 {
private CloudRestImpl cloudRestImpl;
@POST
- @Path("{cloud-region-id}/{cloud-owner}")
@Consumes({MediaType.APPLICATION_JSON})
@Produces({MediaType.APPLICATION_JSON})
@ApiOperation(value = "CreateCloudRegion", response = Response.class,
@@ -65,9 +64,8 @@ public class CloudRegionRestV1 {
@ApiResponse(code = 500, message = "Create Cloud Region has failed")})
public Response createCloudRegion(
@ApiParam(value = "cloud-region-id", required = true) @PathParam("cloud-region-id") String cloudRegionId,
- @ApiParam(value = "cloud-owner", required = true) @PathParam("cloud-owner") String cloudOwner,
@ApiParam(value = "CloudSite", required = true) final CloudSite cloudSite) {
- cloudRestImpl.createCloudRegion(cloudSite, cloudOwner);
+ cloudRestImpl.createCloudRegion(cloudSite);
return Response.status(HttpStatus.SC_CREATED).build();
}
@@ -96,7 +94,7 @@ public class CloudRegionRestV1 {
@ApiParam(value = "cloud-region-id", required = true) @PathParam("cloud-region-id") String cloudRegionId,
@ApiParam(value = "cloud-owner", required = true) @PathParam("cloud-owner") String cloudOwner,
@ApiParam(value = "CloudSite", required = true) final CloudSite cloudSite) {
- cloudRestImpl.updateCloudRegion(cloudSite, cloudOwner);
+ cloudRestImpl.updateCloudRegion(cloudSite);
return Response.status(HttpStatus.SC_OK).build();
}
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/cloudregion/CloudRestImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/cloudregion/CloudRestImpl.java
index 4cde8655ae..380f42fa69 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/cloudregion/CloudRestImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/cloudregion/CloudRestImpl.java
@@ -1,13 +1,21 @@
package org.onap.so.adapters.cloudregion;
+import java.util.List;
import java.util.Optional;
import org.onap.aai.domain.yang.CloudRegion;
+import org.onap.aai.domain.yang.Complex;
+import org.onap.aai.domain.yang.NetworkTechnologies;
+import org.onap.so.client.aai.AAIObjectPlurals;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.AAIResourcesClient;
+import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.db.catalog.beans.CloudSite;
+import org.onap.so.db.catalog.beans.NetworkTechnologyReference;
import org.onap.so.db.catalog.client.CatalogDbClient;
+import org.onap.so.db.catalog.data.repository.NetworkTechnologyReferenceRepository;
+import org.onap.so.db.catalog.utils.MavenLikeVersioning;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -21,14 +29,17 @@ public class CloudRestImpl {
private AAIResourcesClient aaiClient;
@Autowired
+ private NetworkTechnologyReferenceRepository ctrRepo;
+
+ @Autowired
private CatalogDbClient catalogDBClient;
- public void createCloudRegion(CloudSite cloudSite, String cloudOwner) throws CloudException {
+ public void createCloudRegion(CloudSite cloudSite) throws CloudException {
createRegionInCatalogDb(cloudSite);
- createCloudRegionInAAI(cloudSite, cloudOwner);
+ createCloudRegionInAAI(cloudSite);
}
- public void updateCloudRegion(CloudSite cloudSite, String cloudOwner) throws CloudException {
+ public void updateCloudRegion(CloudSite cloudSite) throws CloudException {
updateRegionInCatalogDb(cloudSite);
}
@@ -50,18 +61,49 @@ public class CloudRestImpl {
}
}
- protected void createCloudRegionInAAI(CloudSite cloudSite, String cloudOwner) {
+ protected void createCloudRegionInAAI(CloudSite cloudSite) {
try {
- CloudRegion cloudRegion = mapCloudRegion(cloudSite, cloudOwner);
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION,
+ CloudRegion cloudRegion = mapCloudRegion(cloudSite);
+ Optional<Complex> complex = retrieveComplex(cloudSite);
+ if (complex.isPresent()) {
+ cloudRegion.setComplexName(complex.get().getComplexName());
+ }
+ AAIResourceUri cloudRegionURI = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION,
cloudRegion.getCloudOwner(), cloudRegion.getCloudRegionId());
- getAaiClient().createIfNotExists(uri, Optional.of(cloudRegion));
+ getAaiClient().createIfNotExists(cloudRegionURI, Optional.of(cloudRegion));
+ if (complex.isPresent()) {
+ AAIResourceUri complexURI = AAIUriFactory.createResourceUri(AAIObjectType.COMPLEX, cloudSite.getClli());
+ getAaiClient().connect(cloudRegionURI, complexURI);
+ }
+ createCloudRegionNetworkTechnologyRelationship(cloudSite, cloudRegionURI);
} catch (Exception e) {
logger.error("Error creating cloud region in AAI", e);
throw new CloudException("Error creating cloud region in AAI: " + e.getMessage(), e);
}
}
+ protected void createCloudRegionNetworkTechnologyRelationship(CloudSite cloudSite, AAIResourceUri cloudRegionURI) {
+ List<NetworkTechnologyReference> listOfNetworkTech = ctrRepo.findAllByCloudOwner(cloudSite.getCloudOwner());
+ listOfNetworkTech.stream().forEach(tech -> linkCloudAndTechnology(tech.getNetworkTechnology(), cloudRegionURI));
+ }
+
+ protected Optional<Complex> retrieveComplex(CloudSite cloudSite) {
+ AAIResourceUri complexURI = AAIUriFactory.createResourceUri(AAIObjectType.COMPLEX, cloudSite.getClli());
+ return getAaiClient().get(Complex.class, complexURI);
+ }
+
+ protected void linkCloudAndTechnology(String networkTechnologyName, AAIResourceUri cloudRegionURI) {
+ AAIPluralResourceUri technologyPluralUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_TECHNOLOGY)
+ .queryParam("network-technology-name", networkTechnologyName);
+ Optional<NetworkTechnologies> networkTechnology =
+ getAaiClient().get(NetworkTechnologies.class, technologyPluralUri);
+ if (networkTechnology.isPresent()) {
+ AAIResourceUri networkTechnologyURI = AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_TECHNOLOGY,
+ networkTechnology.get().getNetworkTechnology().get(0).getNetworkTechnologyId());
+ getAaiClient().connect(cloudRegionURI, networkTechnologyURI);
+ }
+ }
+
protected void createRegionInCatalogDb(CloudSite cloudSite) throws CloudException {
try {
CloudSite existingCloudSite = catalogDBClient.getCloudSite(cloudSite.getRegionId());
@@ -74,16 +116,22 @@ public class CloudRestImpl {
}
}
- protected CloudRegion mapCloudRegion(CloudSite cloudSite, String cloudOwner) {
+ protected CloudRegion mapCloudRegion(CloudSite cloudSite) {
CloudRegion region = new CloudRegion();
- region.setCloudOwner(cloudOwner);
+ region.setCloudOwner(cloudSite.getCloudOwner());
region.setCloudRegionId(cloudSite.getRegionId());
region.setCloudRegionVersion(cloudSite.getCloudVersion());
region.setOwnerDefinedType("cLCP");
+ region.setCloudType("openstack");
+ MavenLikeVersioning cloudVersion = new MavenLikeVersioning();
+ cloudVersion.setVersion(cloudSite.getCloudVersion());
+ if (cloudVersion.isMoreRecentThan("3.0")) {
+ region.setCloudZone(cloudSite.getRegionId().substring(0, cloudSite.getRegionId().length() - 1));
+ } else {
+ region.setCloudZone(cloudSite.getRegionId());
+ }
region.setOrchestrationDisabled(false);
- region.setComplexName("NA");
region.setInMaint(false);
- region.setCloudType("openstack");
return region;
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryService.java
deleted file mode 100644
index 4ab4d14dac..0000000000
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryService.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*-
- * ============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.adapters.inventory.create;
-
-import javax.annotation.PostConstruct;
-import org.camunda.bpm.client.ExternalTaskClient;
-import org.onap.so.utils.ExternalTaskServiceUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Profile;
-import org.springframework.core.env.Environment;
-import org.springframework.stereotype.Component;
-
-@Component
-@Profile("!test")
-public class CreateInventoryService {
-
- @Autowired
- public Environment env;
-
- @Autowired
- private CreateInventoryTask createInventory;
-
- @Autowired
- private ExternalTaskServiceUtils externalTaskServiceUtils;
-
- @PostConstruct
- public void auditAAIInventory() throws Exception {
- ExternalTaskClient client = externalTaskServiceUtils.createExternalTaskClient();
- client.subscribe("InventoryCreate")
- .lockDuration(Long.parseLong(env.getProperty("mso.audit.lock-time", "60000")))
- .handler(createInventory::executeExternalTask).open();
- }
-
-}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java
index 257374fdb2..4728effdca 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
@@ -97,7 +97,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
private static final String NETWORK_CREATED_STATUS_MESSAGE =
"The new network was successfully created in the cloud";
private static final String NETWORK_NOT_EXIST_STATUS_MESSAGE =
- "The network as not found, thus no network was deleted in the cloud via this request";
+ "The network was not found, thus no network was deleted in the cloud via this request";
private static final String NETWORK_DELETED_STATUS_MESSAGE = "The network was successfully deleted in the cloud";
private static final Logger logger = LoggerFactory.getLogger(MsoNetworkAdapterImpl.class);
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/TaskServices.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/TaskServices.java
new file mode 100644
index 0000000000..d282046b3f
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/TaskServices.java
@@ -0,0 +1,132 @@
+/*-
+ * ============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.adapters.tasks;
+
+import javax.annotation.PostConstruct;
+import org.camunda.bpm.client.ExternalTaskClient;
+import org.onap.so.utils.ExternalTaskServiceUtils;
+import org.onap.so.adapters.tasks.audit.AuditCreateStackService;
+import org.onap.so.adapters.tasks.audit.AuditDeleteStackService;
+import org.onap.so.adapters.tasks.audit.AuditQueryStackService;
+import org.onap.so.adapters.tasks.inventory.CreateInventoryTask;
+import org.onap.so.adapters.tasks.orchestration.PollService;
+import org.onap.so.adapters.tasks.orchestration.RollbackService;
+import org.onap.so.adapters.tasks.orchestration.StackService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Profile;
+import org.springframework.stereotype.Component;
+
+@Component
+@Profile("!test")
+public class TaskServices {
+
+ private static final Logger logger = LoggerFactory.getLogger(TaskServices.class);
+
+ @Autowired
+ private ExternalTaskServiceUtils externalTaskServiceUtils;
+
+ @Autowired
+ private AuditCreateStackService auditCreateStack;
+
+ @Autowired
+ private AuditDeleteStackService auditDeleteStack;
+
+ @Autowired
+ private AuditQueryStackService auditQueryStack;
+
+ @Autowired
+ private CreateInventoryTask createInventory;
+
+ @Autowired
+ private StackService stackService;
+
+ @Autowired
+ private PollService pollService;
+
+ @Autowired
+ private RollbackService rollbackService;
+
+ @PostConstruct
+ public void auditAddAAIInventory() throws Exception {
+ for (int i = 0; i < externalTaskServiceUtils.getMaxClients(); i++) {
+ ExternalTaskClient client = externalTaskServiceUtils.createExternalTaskClient();
+ client.subscribe("InventoryAddAudit").lockDuration(externalTaskServiceUtils.getLockDuration())
+ .handler(auditCreateStack::executeExternalTask).open();
+ }
+ }
+
+ @PostConstruct
+ public void auditDeleteAAIInventory() throws Exception {
+ for (int i = 0; i < externalTaskServiceUtils.getMaxClients(); i++) {
+ ExternalTaskClient client = externalTaskServiceUtils.createExternalTaskClient();
+ client.subscribe("InventoryDeleteAudit").lockDuration(externalTaskServiceUtils.getLockDuration())
+ .handler(auditDeleteStack::executeExternalTask).open();
+ }
+ }
+
+ @PostConstruct
+ public void auditQueryInventory() throws Exception {
+ for (int i = 0; i < externalTaskServiceUtils.getMaxClients(); i++) {
+ ExternalTaskClient client = externalTaskServiceUtils.createExternalTaskClient();
+ client.subscribe("InventoryQueryAudit").lockDuration(externalTaskServiceUtils.getLockDuration())
+ .handler(auditQueryStack::executeExternalTask).open();
+ }
+ }
+
+ @PostConstruct
+ public void auditAAIInventory() throws Exception {
+ for (int i = 0; i < externalTaskServiceUtils.getMaxClients(); i++) {
+ ExternalTaskClient client = externalTaskServiceUtils.createExternalTaskClient();
+ client.subscribe("InventoryCreate").lockDuration(externalTaskServiceUtils.getLockDuration())
+ .handler(createInventory::executeExternalTask).open();
+ }
+ }
+
+ @PostConstruct
+ public void openstackInvoker() throws Exception {
+ for (int i = 0; i < externalTaskServiceUtils.getMaxClients(); i++) {
+ ExternalTaskClient client = externalTaskServiceUtils.createExternalTaskClient();
+ client.subscribe("OpenstackAdapterInvoke").lockDuration(externalTaskServiceUtils.getLockDuration())
+ .handler(stackService::executeExternalTask).open();
+ }
+ }
+
+ @PostConstruct
+ public void openstackPoller() throws Exception {
+ for (int i = 0; i < externalTaskServiceUtils.getMaxClients(); i++) {
+ ExternalTaskClient client = externalTaskServiceUtils.createExternalTaskClient();
+ client.subscribe("OpenstackAdapterPolling").lockDuration(externalTaskServiceUtils.getLockDuration())
+ .handler(pollService::executeExternalTask).open();
+ }
+ }
+
+ @PostConstruct
+ public void openstackRollback() throws Exception {
+ for (int i = 0; i < externalTaskServiceUtils.getMaxClients(); i++) {
+ ExternalTaskClient client = externalTaskServiceUtils.createExternalTaskClient();
+ client.subscribe("OpenstackAdapterRollback").lockDuration(externalTaskServiceUtils.getLockDuration())
+ .handler(rollbackService::executeExternalTask).open();
+ }
+ }
+
+}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AbstractAudit.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AbstractAudit.java
index ad28f0daeb..7622c1ba28 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AbstractAudit.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AbstractAudit.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.audit;
+package org.onap.so.adapters.tasks.audit;
import org.onap.so.client.aai.AAIResourcesClient;
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AbstractAuditService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AbstractAuditService.java
index ddd9fb1b5e..2f7155bffc 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AbstractAuditService.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AbstractAuditService.java
@@ -19,14 +19,13 @@
*/
-package org.onap.so.adapters.audit;
+package org.onap.so.adapters.tasks.audit;
import java.util.Optional;
import org.onap.so.objects.audit.AAIObjectAudit;
import org.onap.so.objects.audit.AAIObjectAuditList;
import org.onap.so.utils.ExternalTaskUtils;
import org.onap.so.utils.RetrySequenceLevel;
-import org.onap.logging.filter.base.ONAPComponents;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditCreateStackService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditCreateStackService.java
index 8291fa9882..874823a7cd 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditCreateStackService.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditCreateStackService.java
@@ -20,7 +20,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.audit;
+package org.onap.so.adapters.tasks.audit;
import java.util.HashMap;
import java.util.Map;
@@ -30,7 +30,7 @@ import org.camunda.bpm.client.task.ExternalTaskService;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.audit.beans.AuditInventory;
import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
-import org.onap.so.externaltasks.logging.AuditMDCSetup;
+import org.onap.so.logging.tasks.AuditMDCSetup;
import org.onap.so.objects.audit.AAIObjectAuditList;
import org.onap.so.utils.RetrySequenceLevel;
import org.slf4j.Logger;
@@ -47,13 +47,13 @@ public class AuditCreateStackService extends AbstractAuditService {
public HeatStackAudit heatStackAudit;
@Autowired
- private AuditMDCSetup mdcSetup;
+ public AuditMDCSetup mdcSetup;
public AuditCreateStackService() {
super();
}
- protected void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) {
+ public void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) {
mdcSetup.setupMDC(externalTask);
AuditInventory auditInventory = externalTask.getVariable("auditInventory");
Map<String, Object> variables = new HashMap<>();
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditDataService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditDataService.java
index 1c707fe795..2c76acdb1b 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditDataService.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditDataService.java
@@ -1,4 +1,4 @@
-package org.onap.so.adapters.audit;
+package org.onap.so.adapters.tasks.audit;
import java.io.IOException;
import java.util.List;
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditDeleteStackService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditDeleteStackService.java
index cf077915c9..55cde4d174 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditDeleteStackService.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditDeleteStackService.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.audit;
+package org.onap.so.adapters.tasks.audit;
import java.util.HashMap;
import java.util.Map;
@@ -28,7 +28,7 @@ import org.camunda.bpm.client.task.ExternalTaskService;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.audit.beans.AuditInventory;
import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
-import org.onap.so.externaltasks.logging.AuditMDCSetup;
+import org.onap.so.logging.tasks.AuditMDCSetup;
import org.onap.so.objects.audit.AAIObjectAuditList;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -45,9 +45,6 @@ public class AuditDeleteStackService extends AbstractAuditService {
protected HeatStackAudit heatStackAudit;
@Autowired
- private AuditMDCSetup mdcSetup;
-
- @Autowired
protected AuditVServer auditVservers;
@Autowired
@@ -56,11 +53,15 @@ public class AuditDeleteStackService extends AbstractAuditService {
@Autowired
protected Environment env;
+ @Autowired
+ public AuditMDCSetup mdcSetup;
+
public AuditDeleteStackService() {
super();
}
- protected void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) {
+ public void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) {
+
mdcSetup.setupMDC(externalTask);
AuditInventory auditInventory = externalTask.getVariable("auditInventory");
Map<String, Object> variables = new HashMap<>();
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditQueryStackService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditQueryStackService.java
index 1c69a3e5e7..ebef4425eb 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditQueryStackService.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditQueryStackService.java
@@ -1,4 +1,4 @@
-package org.onap.so.adapters.audit;
+package org.onap.so.adapters.tasks.audit;
import java.util.HashMap;
import java.util.Map;
@@ -7,7 +7,7 @@ import org.camunda.bpm.client.task.ExternalTask;
import org.camunda.bpm.client.task.ExternalTaskService;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.audit.beans.AuditInventory;
-import org.onap.so.externaltasks.logging.AuditMDCSetup;
+import org.onap.so.logging.tasks.AuditMDCSetup;
import org.onap.so.objects.audit.AAIObjectAuditList;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -23,16 +23,16 @@ public class AuditQueryStackService extends AbstractAuditService {
protected HeatStackAudit heatStackAudit;
@Autowired
- private AuditMDCSetup mdcSetup;
+ protected AuditDataService auditDataService;
@Autowired
- protected AuditDataService auditDataService;
+ public AuditMDCSetup mdcSetup;
public AuditQueryStackService() {
super();
}
- protected void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) {
+ public void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) {
mdcSetup.setupMDC(externalTask);
AuditInventory auditInventory = externalTask.getVariable("auditInventory");
boolean success = false;
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditVServer.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditVServer.java
index 585e001f1a..63853c34fa 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditVServer.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditVServer.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.audit;
+package org.onap.so.adapters.tasks.audit;
import java.util.List;
import java.util.Optional;
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/HeatStackAudit.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/HeatStackAudit.java
index ffa76cf8ee..1554881193 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/HeatStackAudit.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/HeatStackAudit.java
@@ -20,7 +20,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.audit;
+package org.onap.so.adapters.tasks.audit;
import java.net.URI;
import java.util.Arrays;
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateAAIInventory.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/CreateAAIInventory.java
index 69e16986da..a3cb99e3af 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateAAIInventory.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/CreateAAIInventory.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.inventory.create;
+package org.onap.so.adapters.tasks.inventory;
import java.util.Optional;
import java.util.stream.Stream;
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryTask.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/CreateInventoryTask.java
index e02258c619..04dcd9ff61 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryTask.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/CreateInventoryTask.java
@@ -20,13 +20,13 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.inventory.create;
+package org.onap.so.adapters.tasks.inventory;
import org.camunda.bpm.client.task.ExternalTask;
import org.camunda.bpm.client.task.ExternalTaskService;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
-import org.onap.so.externaltasks.logging.AuditMDCSetup;
+import org.onap.so.logging.tasks.AuditMDCSetup;
import org.onap.so.objects.audit.AAIObjectAuditList;
import org.onap.so.utils.ExternalTaskUtils;
import org.onap.so.utils.RetrySequenceLevel;
@@ -48,13 +48,14 @@ public class CreateInventoryTask extends ExternalTaskUtils {
CreateAAIInventory createInventory;
@Autowired
- private AuditMDCSetup mdcSetup;
+ public AuditMDCSetup mdcSetup;
public CreateInventoryTask() {
super(RetrySequenceLevel.SHORT);
}
- protected void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) {
+
+ public void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) {
mdcSetup.setupMDC(externalTask);
boolean success = true;
boolean inventoryException = false;
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/InventoryException.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/InventoryException.java
index ed31c1c67e..7df3822961 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/InventoryException.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/InventoryException.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.inventory.create;
+package org.onap.so.adapters.tasks.inventory;
public class InventoryException extends Exception {
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/PollService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/PollService.java
new file mode 100644
index 0000000000..6e181c4696
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/PollService.java
@@ -0,0 +1,191 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.tasks.orchestration;
+
+import java.io.ByteArrayInputStream;
+import java.io.StringReader;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Optional;
+import javax.xml.bind.JAXB;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import org.apache.commons.lang3.mutable.MutableBoolean;
+import org.camunda.bpm.client.task.ExternalTask;
+import org.camunda.bpm.client.task.ExternalTaskService;
+import org.onap.so.adapters.vnfrest.CreateVfModuleRequest;
+import org.onap.so.adapters.vnfrest.CreateVolumeGroupRequest;
+import org.onap.so.adapters.vnfrest.DeleteVfModuleRequest;
+import org.onap.so.adapters.vnfrest.DeleteVolumeGroupRequest;
+import org.onap.so.logging.tasks.AuditMDCSetup;
+import org.onap.so.openstack.exceptions.MsoException;
+import org.onap.so.openstack.utils.MsoHeatUtils;
+import org.onap.so.utils.ExternalTaskUtils;
+import org.onap.so.utils.RetrySequenceLevel;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import com.woorea.openstack.heat.model.Stack;
+
+@Component
+public class PollService extends ExternalTaskUtils {
+
+ private static final Logger logger = LoggerFactory.getLogger(PollService.class);
+
+ @Autowired
+ private MsoHeatUtils msoHeatUtils;
+
+ @Autowired
+ private AuditMDCSetup mdcSetup;
+
+ public PollService() {
+ super(RetrySequenceLevel.SHORT);
+ }
+
+ public void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) {
+ mdcSetup.setupMDC(externalTask);
+ logger.trace("Executing External Task Poll Service");
+ Map<String, Object> variables = new HashMap<>();
+ MutableBoolean success = new MutableBoolean();
+ String errorMessage = null;
+ try {
+ String xmlRequest = externalTask.getVariable("vnfAdapterTaskRequest");
+ if (xmlRequest != null) {
+ Optional<String> requestType = findRequestType(xmlRequest);
+ if ("createVolumeGroupRequest".equals(requestType.get())) {
+ determineCreateVolumeGroupStatus(xmlRequest, externalTask, success);
+ } else if ("createVfModuleRequest".equals(requestType.get())) {
+ determineCreateVfModuleStatus(xmlRequest, externalTask, success);
+ } else if ("deleteVfModuleRequest".equals(requestType.get())) {
+ logger.debug("Executing External Task Poll Service for Delete Vf Module");
+ DeleteVfModuleRequest req =
+ JAXB.unmarshal(new StringReader(xmlRequest), DeleteVfModuleRequest.class);
+ pollDeleteResource(req.getCloudSiteId(), req.getTenantId(), externalTask, success);
+ } else if ("deleteVolumeGroupRequest".equals(requestType.get())) {
+ logger.debug("Executing External Task Poll Service for Delete Volume Group");
+ DeleteVolumeGroupRequest req =
+ JAXB.unmarshal(new StringReader(xmlRequest), DeleteVolumeGroupRequest.class);
+ pollDeleteResource(req.getCloudSiteId(), req.getTenantId(), externalTask, success);
+ }
+ }
+ } catch (Exception e) {
+ logger.error("Error during External Task Poll Service", e);
+ errorMessage = e.getMessage();
+ }
+
+ variables.put("OpenstackPollSuccess", success.booleanValue());
+ variables.put("openstackAdapterErrorMessage", errorMessage);
+ if (success.isTrue()) {
+ externalTaskService.complete(externalTask, variables);
+ logger.debug("The External Task Id: {} Successful", externalTask.getId());
+ } else {
+ if (externalTask.getRetries() == null) {
+ logger.debug("The External Task Id: {} Failed, Setting Retries to Default Start Value: {}",
+ externalTask.getId(), getRetrySequence().length);
+ externalTaskService.handleFailure(externalTask, "errorMessage", "errorDetails",
+ getRetrySequence().length, 10000);
+ } else if (externalTask.getRetries() != null && externalTask.getRetries() - 1 == 0) {
+ logger.debug("The External Task Id: {} Failed, All Retries Exhausted", externalTask.getId());
+ externalTaskService.complete(externalTask, variables);
+ } else {
+ logger.debug("The External Task Id: {} Failed, Decrementing Retries: {} , Retry Delay: {}",
+ externalTask.getId(), externalTask.getRetries() - 1,
+ calculateRetryDelay(externalTask.getRetries()));
+ externalTaskService.handleFailure(externalTask, "errorMessage", "errorDetails",
+ externalTask.getRetries() - 1, calculateRetryDelay(externalTask.getRetries()));
+ }
+ }
+ }
+
+ private void determineCreateVolumeGroupStatus(String xmlRequest, ExternalTask externalTask, MutableBoolean success)
+ throws MsoException {
+ CreateVolumeGroupRequest req = JAXB.unmarshal(new StringReader(xmlRequest), CreateVolumeGroupRequest.class);
+ boolean pollRollbackStatus = externalTask.getVariable("PollRollbackStatus");
+ if (pollRollbackStatus) {
+ logger.debug("Executing External Task Poll Service for Rollback Create Volume Group");
+ pollDeleteResource(req.getCloudSiteId(), req.getTenantId(), externalTask, success);
+ } else {
+ pollCreateResource(req.getCloudSiteId(), req.getTenantId(), externalTask, success);
+ }
+ }
+
+ private void determineCreateVfModuleStatus(String xmlRequest, ExternalTask externalTask, MutableBoolean success)
+ throws MsoException {
+ CreateVfModuleRequest req = JAXB.unmarshal(new StringReader(xmlRequest), CreateVfModuleRequest.class);
+ boolean pollRollbackStatus = externalTask.getVariable("PollRollbackStatus");
+ if (pollRollbackStatus) {
+ logger.debug("Executing External Task Poll Service for Rollback Create Vf Module");
+ pollDeleteResource(req.getCloudSiteId(), req.getTenantId(), externalTask, success);
+ } else {
+ logger.debug("Executing External Task Poll Service for Create Vf Module");
+ pollCreateResource(req.getCloudSiteId(), req.getTenantId(), externalTask, success);
+ }
+ }
+
+ private void pollCreateResource(String cloudSiteId, String tenantId, ExternalTask externalTask,
+ MutableBoolean success) throws MsoException {
+ Stack currentStack = createCurrentStack(externalTask.getVariable("stackId"));
+ Stack stack =
+ msoHeatUtils.pollStackForStatus(1, currentStack, "CREATE_IN_PROGRESS", cloudSiteId, tenantId, false);
+ msoHeatUtils.postProcessStackCreate(stack, false, 0, false, cloudSiteId, tenantId, null);
+ success.setTrue();
+ }
+
+ private void pollDeleteResource(String cloudSiteId, String tenantId, ExternalTask externalTask,
+ MutableBoolean success) throws MsoException {
+ Stack currentStack = createCurrentStack(externalTask.getVariable("stackId"));
+ Stack stack =
+ msoHeatUtils.pollStackForStatus(1, currentStack, "DELETE_IN_PROGRESS", cloudSiteId, tenantId, true);
+ if (stack != null) { // if stack is null it was not found and no need to do post process
+ msoHeatUtils.postProcessStackDelete(stack);
+ }
+ success.setTrue();
+ }
+
+ protected Optional<String> findRequestType(String xmlString) {
+ try {
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ org.w3c.dom.Document doc;
+ doc = builder.parse(new ByteArrayInputStream(xmlString.getBytes("UTF-8")));
+ return Optional.of(doc.getDocumentElement().getNodeName());
+ } catch (Exception e) {
+ logger.error("Error Finding Request Type", e);
+ return Optional.empty();
+ }
+ }
+
+ private Stack createCurrentStack(String canonicalStackId) {
+ Stack currentStack = new Stack();
+ String stackName = canonicalStackId;
+ if (canonicalStackId.contains("/")) {
+ String[] stacks = canonicalStackId.split("/");
+ stackName = stacks[0];
+ currentStack.setId(stacks[1]);
+ }
+ currentStack.setStackName(stackName);
+ return currentStack;
+ }
+
+}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/RollbackService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/RollbackService.java
new file mode 100644
index 0000000000..c302293169
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/RollbackService.java
@@ -0,0 +1,92 @@
+package org.onap.so.adapters.tasks.orchestration;
+
+import java.io.ByteArrayInputStream;
+import java.io.StringReader;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Optional;
+import javax.xml.bind.JAXB;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.ws.Holder;
+import org.camunda.bpm.client.task.ExternalTask;
+import org.camunda.bpm.client.task.ExternalTaskService;
+import org.onap.so.adapters.vnf.MsoVnfAdapterImpl;
+import org.onap.so.adapters.vnfrest.CreateVfModuleRequest;
+import org.onap.so.adapters.vnfrest.CreateVolumeGroupRequest;
+import org.onap.so.logging.tasks.AuditMDCSetup;
+import org.onap.so.utils.ExternalTaskUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class RollbackService extends ExternalTaskUtils {
+
+ private static final Logger logger = LoggerFactory.getLogger(RollbackService.class);
+
+ @Autowired
+ private MsoVnfAdapterImpl vnfAdapterImpl;
+
+ @Autowired
+ private AuditMDCSetup mdcSetup;
+
+ public void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) {
+ mdcSetup.setupMDC(externalTask);
+ logger.trace("Executing External Task Rollback Service");
+ Map<String, Object> variables = new HashMap<>();
+ boolean success = false;
+ boolean pollRollbackStatus = false;
+ try {
+ String xmlRequest = externalTask.getVariable("vnfAdapterTaskRequest");
+ if (xmlRequest != null) {
+ Optional<String> requestType = findRequestType(xmlRequest);
+ if ("createVolumeGroupRequest".equals(requestType.get())) {
+ logger.debug("Executing External Task Rollback Service for Create Volume Group");
+ CreateVolumeGroupRequest req =
+ JAXB.unmarshal(new StringReader(xmlRequest), CreateVolumeGroupRequest.class);
+ vnfAdapterImpl.deleteVnf(req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(),
+ req.getVolumeGroupName(), req.getMsoRequest(), false);
+ pollRollbackStatus = true;
+ success = true;
+ } else if ("createVfModuleRequest".equals(requestType.get())) {
+ logger.debug("Executing External Task Rollback Service for Create Vf Module");
+ CreateVfModuleRequest req =
+ JAXB.unmarshal(new StringReader(xmlRequest), CreateVfModuleRequest.class);
+ vnfAdapterImpl.deleteVfModule(req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(),
+ req.getVfModuleName(), req.getVnfId(), req.getVfModuleId(), req.getModelCustomizationUuid(),
+ req.getMsoRequest(), new Holder<>());
+ pollRollbackStatus = true;
+ success = true;
+ }
+ }
+ } catch (Exception e) {
+ logger.error("Error during External Task Rollback Service", e);
+ }
+ variables.put("OpenstackRollbackSuccess", success);
+ variables.put("rollbackPerformed", true);
+ variables.put("PollRollbackStatus", pollRollbackStatus);
+ if (success) {
+ externalTaskService.complete(externalTask, variables);
+ logger.debug("The External Task Id: {} Successful", externalTask.getId());
+ } else {
+ logger.debug("The External Task Id: {} Failed. Not Retrying", externalTask.getId());
+ externalTaskService.complete(externalTask, variables);
+ }
+ }
+
+ protected Optional<String> findRequestType(String xmlString) {
+ try {
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ org.w3c.dom.Document doc;
+ doc = builder.parse(new ByteArrayInputStream(xmlString.getBytes("UTF-8")));
+ return Optional.of(doc.getDocumentElement().getNodeName());
+ } catch (Exception e) {
+ logger.error("Error Finding Request Type", e);
+ return Optional.empty();
+ }
+ }
+
+}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/StackService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/StackService.java
new file mode 100644
index 0000000000..34952a056b
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/StackService.java
@@ -0,0 +1,207 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.tasks.orchestration;
+
+import java.io.ByteArrayInputStream;
+import java.io.StringReader;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Optional;
+import javax.xml.bind.JAXB;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.ws.Holder;
+import org.apache.commons.lang3.mutable.MutableBoolean;
+import org.camunda.bpm.client.task.ExternalTask;
+import org.camunda.bpm.client.task.ExternalTaskService;
+import org.onap.so.adapters.vnf.MsoVnfAdapterImpl;
+import org.onap.so.adapters.vnf.exceptions.VnfException;
+import org.onap.so.adapters.vnfrest.CreateVfModuleRequest;
+import org.onap.so.adapters.vnfrest.CreateVfModuleResponse;
+import org.onap.so.adapters.vnfrest.CreateVolumeGroupRequest;
+import org.onap.so.adapters.vnfrest.CreateVolumeGroupResponse;
+import org.onap.so.adapters.vnfrest.DeleteVfModuleRequest;
+import org.onap.so.adapters.vnfrest.DeleteVfModuleResponse;
+import org.onap.so.adapters.vnfrest.DeleteVolumeGroupRequest;
+import org.onap.so.adapters.vnfrest.DeleteVolumeGroupResponse;
+import org.onap.so.adapters.vnfrest.VfModuleRollback;
+import org.onap.so.adapters.vnfrest.VolumeGroupRollback;
+import org.onap.so.logging.tasks.AuditMDCSetup;
+import org.onap.so.openstack.beans.VnfRollback;
+import org.onap.so.utils.ExternalTaskUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class StackService extends ExternalTaskUtils {
+
+ private static final Logger logger = LoggerFactory.getLogger(StackService.class);
+
+ @Autowired
+ private MsoVnfAdapterImpl vnfAdapterImpl;
+
+ @Autowired
+ private AuditMDCSetup mdcSetup;
+
+ public void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) {
+ Map<String, Object> variables = new HashMap<>();
+ mdcSetup.setupMDC(externalTask);
+ String xmlRequest = externalTask.getVariable("vnfAdapterTaskRequest");
+ logger.debug("Executing External Task Stack Service. {}", xmlRequest);
+ MutableBoolean success = new MutableBoolean();
+ MutableBoolean backout = new MutableBoolean();
+ String response = "";
+ Holder<String> canonicalStackId = new Holder<>();
+ String errorMessage = "";
+ try {
+ if (xmlRequest != null) {
+ Holder<Map<String, String>> outputs = new Holder<>();
+ Holder<VnfRollback> vnfRollback = new Holder<>();
+ Optional<String> requestType = findRequestType(xmlRequest);
+ if ("createVolumeGroupRequest".equals(requestType.get())) {
+ logger.debug("Executing External Task Stack Service For Create Volume Group");
+ response = createVolumeGroup(xmlRequest, outputs, vnfRollback, canonicalStackId, backout, success);
+ } else if ("createVfModuleRequest".equals(requestType.get())) {
+ logger.debug("Executing External Task Stack Service For Create Vf Module");
+ response = createVfModule(xmlRequest, outputs, vnfRollback, canonicalStackId, backout, success);
+ } else if ("deleteVfModuleRequest".equals(requestType.get())) {
+ logger.debug("Executing External Task Stack Service For Delete Vf Module");
+ response = deleteVfModule(xmlRequest, outputs, vnfRollback, canonicalStackId, backout, success);
+ } else if ("deleteVolumeGroupRequest".equals(requestType.get())) {
+ logger.debug("Executing External Task Stack Service For Delete Volume Group");
+ response = deleteVolumeGroup(xmlRequest, outputs, vnfRollback, canonicalStackId, backout, success);
+ }
+ }
+ } catch (Exception e) {
+ logger.error("Error during External Task Stack Service", e);
+ errorMessage = e.getMessage();
+ }
+ variables.put("backout", backout.booleanValue());
+ variables.put("WorkflowResponse", response);
+ variables.put("OpenstackInvokeSuccess", success.booleanValue());
+ variables.put("stackId", canonicalStackId.value);
+ variables.put("openstackAdapterErrorMessage", errorMessage);
+ variables.put("PollRollbackStatus", false);
+ variables.put("rollbackPerformed", false);
+ variables.put("OpenstackRollbackSuccess", false);
+ variables.put("OpenstackPollSuccess", false);
+
+ if (success.isTrue()) {
+ externalTaskService.complete(externalTask, variables);
+ logger.debug("The External Task Id: {} Successful", externalTask.getId());
+ } else {
+ logger.debug("The External Task Id: {} Failed. Not Retrying", externalTask.getId());
+ externalTaskService.complete(externalTask, variables);
+ }
+ }
+
+ private String createVolumeGroup(String xmlRequest, Holder<Map<String, String>> outputs,
+ Holder<VnfRollback> vnfRollback, Holder<String> canonicalStackId, MutableBoolean backout,
+ MutableBoolean success) throws VnfException {
+ Holder<String> stackId = new Holder<>();
+ CreateVolumeGroupRequest req = JAXB.unmarshal(new StringReader(xmlRequest), CreateVolumeGroupRequest.class);
+ String completeVnfVfModuleType = req.getVnfType() + "::" + req.getVfModuleType();
+ vnfAdapterImpl.createVfModule(req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(),
+ completeVnfVfModuleType, req.getVnfVersion(), "", req.getVolumeGroupName(), "", "VOLUME", null, null,
+ req.getModelCustomizationUuid(), req.getVolumeGroupParams(), false, true, req.getEnableBridge(),
+ req.getMsoRequest(), stackId, outputs, vnfRollback);
+ success.setTrue();
+ backout.setValue(!req.getSuppressBackout());
+ VolumeGroupRollback rb = new VolumeGroupRollback(req.getVolumeGroupId(), stackId.value,
+ vnfRollback.value.getVnfCreated(), req.getTenantId(), req.getCloudOwner(), req.getCloudSiteId(),
+ req.getMsoRequest(), req.getMessageId());
+ canonicalStackId.value = stackId.value;
+ CreateVolumeGroupResponse createResponse = new CreateVolumeGroupResponse(req.getVolumeGroupId(), stackId.value,
+ vnfRollback.value.getVnfCreated(), outputs.value, rb, req.getMessageId());
+ return createResponse.toXmlString();
+ }
+
+ private String createVfModule(String xmlRequest, Holder<Map<String, String>> outputs,
+ Holder<VnfRollback> vnfRollback, Holder<String> canonicalStackId, MutableBoolean backout,
+ MutableBoolean success) throws VnfException {
+ Holder<String> stackId = new Holder<>();
+ CreateVfModuleRequest req = JAXB.unmarshal(new StringReader(xmlRequest), CreateVfModuleRequest.class);
+ String completeVnfVfModuleType = req.getVnfType() + "::" + req.getVfModuleType();
+ vnfAdapterImpl.createVfModule(req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(),
+ completeVnfVfModuleType, req.getVnfVersion(), req.getVnfId(), req.getVfModuleName(),
+ req.getVfModuleId(), req.getRequestType(), req.getVolumeGroupStackId(), req.getBaseVfModuleStackId(),
+ req.getModelCustomizationUuid(), req.getVfModuleParams(), false, false, req.getEnableBridge(),
+ req.getMsoRequest(), stackId, outputs, vnfRollback);
+ success.setTrue();
+ backout.setValue(req.getBackout());
+ canonicalStackId.value = stackId.value;
+ VfModuleRollback modRollback =
+ new VfModuleRollback(vnfRollback.value, req.getVfModuleId(), stackId.value, req.getMessageId());
+ CreateVfModuleResponse createResponse = new CreateVfModuleResponse(req.getVnfId(), req.getVfModuleId(),
+ stackId.value, Boolean.TRUE, outputs.value, modRollback, req.getMessageId());
+ return createResponse.toXmlString();
+ }
+
+ private String deleteVfModule(String xmlRequest, Holder<Map<String, String>> outputs,
+ Holder<VnfRollback> vnfRollback, Holder<String> canonicalStackId, MutableBoolean backout,
+ MutableBoolean success) throws VnfException {
+ backout.setFalse();
+ DeleteVfModuleRequest req = JAXB.unmarshal(new StringReader(xmlRequest), DeleteVfModuleRequest.class);
+ vnfAdapterImpl.deleteVfModule(req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(),
+ req.getVfModuleStackId(), req.getVnfId(), req.getVfModuleId(), req.getModelCustomizationUuid(),
+ req.getMsoRequest(), outputs);
+ success.setTrue();
+ if (outputs != null && outputs.value != null) {
+ canonicalStackId.value = outputs.value.get("canonicalStackId");
+ } else {
+ canonicalStackId.value = req.getVfModuleStackId();
+ }
+ DeleteVfModuleResponse deleteResponse = new DeleteVfModuleResponse(req.getVnfId(), req.getVfModuleId(),
+ Boolean.TRUE, req.getMessageId(), outputs.value);
+ return deleteResponse.toXmlString();
+ }
+
+ private String deleteVolumeGroup(String xmlRequest, Holder<Map<String, String>> outputs,
+ Holder<VnfRollback> vnfRollback, Holder<String> canonicalStackId, MutableBoolean backout,
+ MutableBoolean success) throws VnfException {
+ backout.setFalse();
+ DeleteVolumeGroupRequest req = JAXB.unmarshal(new StringReader(xmlRequest), DeleteVolumeGroupRequest.class);
+
+ vnfAdapterImpl.deleteVnf(req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(),
+ req.getVolumeGroupStackId(), req.getMsoRequest(), false);
+ success.setTrue();
+ canonicalStackId.value = req.getVolumeGroupStackId();
+ DeleteVolumeGroupResponse deleteResponse = new DeleteVolumeGroupResponse(true, req.getMessageId());
+ return deleteResponse.toXmlString();
+ }
+
+ protected Optional<String> findRequestType(String xmlString) {
+ try {
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ org.w3c.dom.Document doc;
+ doc = builder.parse(new ByteArrayInputStream(xmlString.getBytes("UTF-8")));
+ return Optional.of(doc.getDocumentElement().getNodeName());
+ } catch (Exception e) {
+ logger.error("Error Finding Request Type", e);
+ return Optional.empty();
+ }
+ }
+}
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 32e88d8cad..5951fda16e 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
@@ -33,6 +33,7 @@ import java.util.Optional;
import javax.jws.WebService;
import javax.xml.ws.Holder;
import org.apache.commons.collections.CollectionUtils;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.adapters.vnf.exceptions.VnfException;
import org.onap.so.adapters.vnf.exceptions.VnfNotFound;
import org.onap.so.client.aai.AAIResourcesClient;
@@ -53,7 +54,6 @@ import org.onap.so.entity.MsoRequest;
import org.onap.so.heatbridge.HeatBridgeApi;
import org.onap.so.heatbridge.HeatBridgeException;
import org.onap.so.heatbridge.HeatBridgeImpl;
-import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.LoggingAnchor;
import org.onap.so.logger.MessageEnum;
import org.onap.so.openstack.beans.HeatStatus;
@@ -104,8 +104,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
private static final String DELETE_VNF = "DeleteVNF";
private static final String QUERY_STACK = "QueryStack";
private static final String CREATE_VFM_MODULE = "CreateVFModule";
- private static final String CREATE_VF_STACK = "Create VF: Stack";
- private static final String STACK = "Stack";
private static final String USER_ERROR = "USER ERROR";
private static final String VERSION_MIN = "VersionMin";
private static final String VERSION_MAX = "VersionMax";
@@ -113,7 +111,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
"The vf module was found to already exist, thus no new vf module was created in the cloud via this request";
private static final String VF_CREATED_STATUS_MESSAGE = "The new vf module was successfully created in the cloud";
private static final String VF_NOT_EXIST_STATUS_MESSAGE =
- "The vf module was not, thus no vf module was deleted in the cloud via this request";
+ "The vf module was not found, thus no vf module was deleted in the cloud via this request";
private static final String VF_DELETED_STATUS_MESSAGE = "The vf module was successfully deleted in the cloud";
@Autowired
@@ -323,6 +321,42 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
}
/**
+ * This is the "Delete VNF" web service implementation. It will delete a VNF by name or ID in the specified cloud
+ * and tenant.
+ *
+ * The method has no outputs.
+ *
+ * @param cloudSiteId CLLI code of the cloud site in which to delete
+ * @param cloudOwner cloud owner of the cloud region in which to delete
+ * @param tenantId Openstack tenant identifier
+ * @param vnfName VNF Name or Openstack ID
+ * @param msoRequest Request tracking information for logs
+ */
+ public void deleteVnf(String cloudSiteId, String cloudOwner, String tenantId, String vnfName, MsoRequest msoRequest,
+ boolean pollStackStatus) throws VnfException {
+
+ logger.debug("Deleting VNF {} in {}", vnfName, cloudSiteId + "/" + tenantId);
+
+ try {
+ msoHeatUtils.deleteStack(tenantId, cloudOwner, cloudSiteId, vnfName, pollStackStatus, 118);
+ } catch (MsoException me) {
+ me.addContext(DELETE_VNF);
+ // Failed to query the Stack due to an openstack exception.
+ // Convert to a generic VnfException
+ String error =
+ "Delete VNF: " + vnfName + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me;
+ logger.error(LoggingAnchor.NINE, MessageEnum.RA_DELETE_VNF_ERR.toString(), vnfName, cloudOwner, cloudSiteId,
+ tenantId, OPENSTACK, DELETE_VNF, ErrorCode.DataError.getValue(), "Exception - " + DELETE_VNF, me);
+ logger.debug(error);
+ throw new VnfException(me);
+ }
+
+ // On success, nothing is returned.
+ return;
+ }
+
+
+ /**
* This web service endpoint will rollback a previous Create VNF operation. A rollback object is returned to the
* client in a successful creation response. The client can pass that object as-is back to the rollbackVnf operation
* to undo the creation.
@@ -536,6 +570,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
Map<String, Object> inputs, Boolean failIfExists, Boolean backout, Boolean enableBridge,
MsoRequest msoRequest, Holder<String> vnfId, Holder<Map<String, String>> outputs,
Holder<VnfRollback> rollback) throws VnfException {
+ boolean pollForCompletion = false;
String vfModuleName = vnfName;
String vfModuleType = vnfType;
String vfVersion = vnfVersion;
@@ -1050,11 +1085,13 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
}
if (msoHeatUtils != null) {
heatStack = msoHeatUtils.createStack(cloudSiteId, cloudOwner, tenantId, vfModuleName, null,
- template, goldenInputs, true, heatTemplate.getTimeoutMinutes(), newEnvironmentString,
- nestedTemplatesChecked, heatFilesObjects, backout.booleanValue(), failIfExists);
-
- msoHeatUtils.updateResourceStatus(msoRequest.getRequestId(),
- heatStack.isOperationPerformed() ? VF_EXIST_STATUS_MESSAGE : VF_CREATED_STATUS_MESSAGE);
+ template, goldenInputs, pollForCompletion, heatTemplate.getTimeoutMinutes(),
+ newEnvironmentString, nestedTemplatesChecked, heatFilesObjects, backout.booleanValue(),
+ failIfExists);
+ if (msoRequest.getRequestId() != null) {
+ msoHeatUtils.updateResourceStatus(msoRequest.getRequestId(),
+ heatStack.isOperationPerformed() ? VF_CREATED_STATUS_MESSAGE : VF_EXIST_STATUS_MESSAGE);
+ }
} else {
throw new MsoHeatNotFoundException();
}
@@ -1134,10 +1171,15 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
}
try {
- StackInfo stackInfo =
- msoHeatUtils.deleteStack(tenantId, cloudOwner, cloudSiteId, vnfName, true, timeoutMinutes);
+ StackInfo currentStack =
+ msoHeatUtils.deleteStack(tenantId, cloudOwner, cloudSiteId, vnfName, false, timeoutMinutes);
+ if (currentStack != null && outputs != null && outputs.value != null) {
+ logger.debug("Adding canonical stack id to outputs " + currentStack.getCanonicalName());
+ outputs.value.put("canonicalStackId", currentStack.getCanonicalName());
+ }
msoHeatUtils.updateResourceStatus(msoRequest.getRequestId(),
- stackInfo.isOperationPerformed() ? VF_DELETED_STATUS_MESSAGE : VF_NOT_EXIST_STATUS_MESSAGE);
+ currentStack.isOperationPerformed() ? VF_DELETED_STATUS_MESSAGE : VF_NOT_EXIST_STATUS_MESSAGE);
+
} catch (MsoException me) {
me.addContext(DELETE_VNF);
// Failed to query the Stack due to an openstack exception.
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRest.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRest.java
index 0836f69ba7..5b78d2f066 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRest.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRest.java
@@ -78,6 +78,7 @@ import io.swagger.annotations.ApiResponses;
* can be produced/consumed. Set Accept: and Content-Type: headers appropriately. XML is the default. For testing, call
* with cloudSiteId = ___TESTING___ To test exceptions, also set tenantId = ___TESTING___
*/
+@Deprecated
@Path("/v1/vnfs")
@Api(value = "/v1/vnfs", description = "root of vnf adapters restful web service")
@Transactional
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestV2.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestV2.java
index 18ed9872a0..63b4c5d0f3 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestV2.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestV2.java
@@ -39,7 +39,6 @@ import javax.ws.rs.core.GenericEntity;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.xml.ws.Holder;
-import org.onap.so.logger.LoggingAnchor;
import org.apache.http.HttpStatus;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.adapters.vnf.exceptions.VnfException;
@@ -56,6 +55,7 @@ import org.onap.so.adapters.vnfrest.VfModuleExceptionResponse;
import org.onap.so.adapters.vnfrest.VfModuleRollback;
import org.onap.so.entity.MsoRequest;
import org.onap.logging.filter.base.ErrorCode;
+import org.onap.so.logger.LoggingAnchor;
import org.onap.so.logger.MessageEnum;
import org.onap.so.openstack.beans.VnfRollback;
import org.onap.so.openstack.beans.VnfStatus;
@@ -78,6 +78,7 @@ import io.swagger.annotations.ApiResponses;
*
* V2 incorporates run-time selection of sub-orchestrator implementation (Heat or Cloudify) based on the target cloud.
*/
+@Deprecated
@Path("/v2/vnfs")
@Api(value = "/v2/vnfs", description = "root of vnf adapters restful web service v2")
@Component
@@ -189,10 +190,7 @@ public class VnfAdapterRestV2 {
}
String cloudsite = req.getCloudSiteId();
Holder<Map<String, String>> outputs = new Holder<>();
- if (cloudsite != null && !cloudsite.equals(TESTING_KEYWORD)) {
- // vnfAdapter.deleteVnf (req.getCloudSiteId(), req.getTenantId(), req.getVfModuleStackId(),
- // req.getMsoRequest());
- // Support different Adapter Implementations
+ if (cloudsite != null) {
MsoVnfAdapter adapter = vnfAdapterRestUtils.getVnfAdapterImpl(mode, cloudsite);
adapter.deleteVfModule(req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(),
req.getVfModuleStackId(), req.getVnfId(), req.getVfModuleId(),
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2.java
index cfddbba34e..a424fa92fd 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2.java
@@ -174,33 +174,26 @@ public class VolumeAdapterRestV2 {
logger.debug("in createVfModuleVolumes - completeVnfVfModuleType={}", completeVnfVfModuleType);
String cloudsiteId = req.getCloudSiteId();
- if (cloudsiteId != null && cloudsiteId.equals(TESTING_KEYWORD)) {
- String tenant = req.getTenantId();
- if (tenant != null && tenant.equals(TESTING_KEYWORD)) {
- throw new VnfException("testing.");
- }
- stackId.value = "479D3D8B-6360-47BC-AB75-21CC91981484";
- outputs.value = testMap();
- } else {
- // Support different Adapter Implementations
- MsoVnfAdapter vnfAdapter = vnfAdapterRestUtils.getVnfAdapterImpl(mode, cloudsiteId);
- vnfAdapter.createVfModule(req.getCloudSiteId(), // cloudSiteId,
- req.getCloudOwner(), // cloudOwner,
- req.getTenantId(), // tenantId,
- completeVnfVfModuleType, // vnfType,
- req.getVnfVersion(), // vnfVersion,
- "", // genericVnfId
- req.getVolumeGroupName(), // vnfName,
- "", // vfModuleId
- "VOLUME", // requestType,
- null, // volumeGroupHeatStackId,
- null, // baseVfHeatStackId,
- req.getModelCustomizationUuid(), req.getVolumeGroupParams(), // inputs,
- req.getFailIfExists(), // failIfExists,
- req.getSuppressBackout(), // backout,
- req.getEnableBridge(), req.getMsoRequest(), // msoRequest,
- stackId, outputs, vnfRollback);
- }
+
+ // Support different Adapter Implementations
+ MsoVnfAdapter vnfAdapter = vnfAdapterRestUtils.getVnfAdapterImpl(mode, cloudsiteId);
+ vnfAdapter.createVfModule(req.getCloudSiteId(), // cloudSiteId,
+ req.getCloudOwner(), // cloudOwner,
+ req.getTenantId(), // tenantId,
+ completeVnfVfModuleType, // vnfType,
+ req.getVnfVersion(), // vnfVersion,
+ "", // genericVnfId
+ req.getVolumeGroupName(), // vnfName,
+ "", // vfModuleId
+ "VOLUME", // requestType,
+ null, // volumeGroupHeatStackId,
+ null, // baseVfHeatStackId,
+ req.getModelCustomizationUuid(), req.getVolumeGroupParams(), // inputs,
+ req.getFailIfExists(), // failIfExists,
+ req.getSuppressBackout(), // backout,
+ req.getEnableBridge(), req.getMsoRequest(), // msoRequest,
+ stackId, outputs, vnfRollback);
+
VolumeGroupRollback rb = new VolumeGroupRollback(req.getVolumeGroupId(), stackId.value,
vnfRollback.value.getVnfCreated(), req.getTenantId(), req.getCloudOwner(), req.getCloudSiteId(),
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/cloudregion/CloudRegionRestImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/cloudregion/CloudRegionRestImplTest.java
index 9c62c286ac..2df56ede10 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/cloudregion/CloudRegionRestImplTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/cloudregion/CloudRegionRestImplTest.java
@@ -23,6 +23,7 @@ import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.db.catalog.beans.CloudSite;
import org.onap.so.db.catalog.client.CatalogDbClient;
+import org.onap.so.db.catalog.data.repository.NetworkTechnologyReferenceRepository;
@RunWith(MockitoJUnitRunner.class)
@@ -38,6 +39,9 @@ public class CloudRegionRestImplTest {
@Mock
private AAIResourcesClient aaiResClientMock;
+ @Mock
+ private NetworkTechnologyReferenceRepository ntRepoMock;
+
private CloudSite cloudSite = new CloudSite();
private CloudRegion testCloudRegion = new CloudRegion();
@@ -46,30 +50,52 @@ public class CloudRegionRestImplTest {
public void setup() {
cloudSite.setCloudVersion("1.0");
cloudSite.setRegionId("region1");
+ cloudSite.setCloudOwner("bob");
Mockito.doReturn(aaiResClientMock).when(cloudRestImpl).getAaiClient();
testCloudRegion.setCloudOwner("bob");
testCloudRegion.setCloudRegionId("region1");
testCloudRegion.setCloudRegionVersion("1.0");
testCloudRegion.setInMaint(false);
testCloudRegion.setOrchestrationDisabled(false);
- testCloudRegion.setComplexName("NA");
testCloudRegion.setCloudRegionVersion("1.0");
testCloudRegion.setOwnerDefinedType("cLCP");
testCloudRegion.setCloudType("openstack");
+ testCloudRegion.setCloudZone("region1");
}
@Test
public void mapCloudRegionTest() {
- CloudRegion mappedRegion = cloudRestImpl.mapCloudRegion(cloudSite, "bob");
+ CloudRegion mappedRegion = cloudRestImpl.mapCloudRegion(cloudSite);
assertThat(mappedRegion, sameBeanAs(testCloudRegion));
}
+
+ @Test
+ public void mapCloudRegionVersionGreaterThan3Test() {
+ CloudSite cloudSite2 = new CloudSite();
+ cloudSite2.setCloudVersion("3.0.1");
+ cloudSite2.setRegionId("region1");
+ cloudSite2.setCloudOwner("bob");
+
+ CloudRegion mappedRegion = cloudRestImpl.mapCloudRegion(cloudSite2);
+ CloudRegion testRegion2 = new CloudRegion();
+ testRegion2.setCloudOwner("bob");
+ testRegion2.setCloudRegionId("region1");
+ testRegion2.setCloudRegionVersion("3.0.1");
+ testRegion2.setInMaint(false);
+ testRegion2.setOrchestrationDisabled(false);
+ testRegion2.setOwnerDefinedType("cLCP");
+ testRegion2.setCloudType("openstack");
+ testRegion2.setCloudZone("region");
+ assertThat(mappedRegion, sameBeanAs(testRegion2));
+ }
+
@Test
public void createCloudRegionTest() {
when(catalogDbClientMock.getCloudSite("region1")).thenReturn(null);
when(catalogDbClientMock.postCloudSite(cloudSite)).thenReturn(cloudSite);
AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, "bob", "region1");
- cloudRestImpl.createCloudRegion(cloudSite, "bob");
+ cloudRestImpl.createCloudRegion(cloudSite);
ArgumentCaptor<AAIResourceUri> actualURI = ArgumentCaptor.forClass(AAIResourceUri.class);
ArgumentCaptor<Optional<Object>> actualCloudRegion = ArgumentCaptor.forClass(Optional.class);
verify(catalogDbClientMock, times(1)).getCloudSite("region1");
@@ -82,7 +108,7 @@ public class CloudRegionRestImplTest {
@Test
public void updateCloudRegionTest() {
when(catalogDbClientMock.updateCloudSite(cloudSite)).thenReturn(cloudSite);
- cloudRestImpl.updateCloudRegion(cloudSite, "bob");
+ cloudRestImpl.updateCloudRegion(cloudSite);
verify(catalogDbClientMock, times(1)).updateCloudSite(cloudSite);
}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditDataServiceTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AuditDataServiceTest.java
index d3380a6a33..d5f8f865a8 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditDataServiceTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AuditDataServiceTest.java
@@ -1,4 +1,4 @@
-package org.onap.so.adapters.audit;
+package org.onap.so.adapters.tasks.audit;
import static org.junit.Assert.assertEquals;
import static org.mockito.ArgumentMatchers.any;
@@ -13,6 +13,7 @@ import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.aai.domain.yang.Vserver;
+import org.onap.so.adapters.tasks.audit.AuditDataService;
import org.onap.so.audit.beans.AuditInventory;
import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
import org.onap.so.db.request.beans.RequestProcessingData;
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceDataTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AuditStackServiceDataTest.java
index cff4d5f994..a10ab4b7df 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceDataTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AuditStackServiceDataTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.audit;
+package org.onap.so.adapters.tasks.audit;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
@@ -36,8 +36,12 @@ import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
+import org.onap.so.adapters.tasks.audit.AuditCreateStackService;
+import org.onap.so.adapters.tasks.audit.AuditDataService;
+import org.onap.so.adapters.tasks.audit.AuditQueryStackService;
+import org.onap.so.adapters.tasks.audit.HeatStackAudit;
import org.onap.so.audit.beans.AuditInventory;
-import org.onap.so.externaltasks.logging.AuditMDCSetup;
+import org.onap.so.logging.tasks.AuditMDCSetup;
import org.onap.so.objects.audit.AAIObjectAuditList;
import org.springframework.core.env.Environment;
import com.fasterxml.jackson.core.JsonParseException;
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditVServerTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AuditVServerTest.java
index 8e71ec46b0..af4afd41a1 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditVServerTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AuditVServerTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.audit;
+package org.onap.so.adapters.tasks.audit;
import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.doReturn;
@@ -41,6 +41,7 @@ import org.onap.aai.domain.yang.LInterfaces;
import org.onap.aai.domain.yang.VfModule;
import org.onap.aai.domain.yang.VfModules;
import org.onap.aai.domain.yang.Vserver;
+import org.onap.so.adapters.tasks.audit.AuditVServer;
import org.onap.so.client.aai.AAIObjectPlurals;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.AAIResourcesClient;
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/HeatStackAuditTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/HeatStackAuditTest.java
index c995064ab2..d1d0d96042 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/HeatStackAuditTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/HeatStackAuditTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.audit;
+package org.onap.so.adapters.tasks.audit;
import static com.shazam.shazamcrest.MatcherAssert.assertThat;
import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
@@ -43,6 +43,8 @@ import org.mockito.junit.MockitoJUnitRunner;
import org.onap.aai.domain.yang.LInterface;
import org.onap.aai.domain.yang.LInterfaces;
import org.onap.aai.domain.yang.Vserver;
+import org.onap.so.adapters.tasks.audit.AuditVServer;
+import org.onap.so.adapters.tasks.audit.HeatStackAudit;
import org.onap.so.objects.audit.AAIObjectAuditList;
import org.onap.so.openstack.utils.MsoHeatUtils;
import org.onap.so.openstack.utils.MsoNeutronUtils;
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/inventory/create/CreateAAIInventoryTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/inventory/CreateAAIInventoryTest.java
index 8226f4fed8..e822f65072 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/inventory/create/CreateAAIInventoryTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/inventory/CreateAAIInventoryTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.inventory.create;
+package org.onap.so.adapters.tasks.inventory;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
@@ -38,6 +38,7 @@ import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
+import org.onap.so.adapters.tasks.inventory.CreateAAIInventory;
import org.onap.so.audit.beans.AuditInventory;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.AAIResourcesClient;
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/inventory/create/CreateInventoryTaskTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/inventory/CreateInventoryTaskTest.java
index c4fa9ee2c5..fc2baefcd5 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/inventory/create/CreateInventoryTaskTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/inventory/CreateInventoryTaskTest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.inventory.create;
+package org.onap.so.adapters.tasks.inventory;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.times;
@@ -30,8 +30,11 @@ import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
+import org.onap.so.adapters.tasks.inventory.CreateAAIInventory;
+import org.onap.so.adapters.tasks.inventory.CreateInventoryTask;
+import org.onap.so.adapters.tasks.inventory.InventoryException;
import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
-import org.onap.so.externaltasks.logging.AuditMDCSetup;
+import org.onap.so.logging.tasks.AuditMDCSetup;
import org.onap.so.objects.audit.AAIObjectAudit;
import org.onap.so.objects.audit.AAIObjectAuditList;
import com.fasterxml.jackson.core.JsonProcessingException;
@@ -47,12 +50,12 @@ public class CreateInventoryTaskTest {
@Mock
ExternalTaskService externalTaskService;
- @Mock
- private AuditMDCSetup mdcSetup;
-
@InjectMocks
CreateInventoryTask inventoryTask;
+ @Mock
+ private AuditMDCSetup mdcSetup;
+
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/PollServiceTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/PollServiceTest.java
new file mode 100644
index 0000000000..b5b0f5a8ef
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/PollServiceTest.java
@@ -0,0 +1,82 @@
+package org.onap.so.adapters.tasks.orchestration;
+
+import org.camunda.bpm.client.task.ExternalTask;
+import org.camunda.bpm.client.task.ExternalTaskService;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import static org.mockito.Mockito.any;
+import static org.mockito.Mockito.eq;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.so.adapters.tasks.orchestration.PollService;
+import org.onap.so.logging.tasks.AuditMDCSetup;
+import org.onap.so.openstack.exceptions.MsoException;
+import org.onap.so.openstack.utils.MsoHeatUtils;
+import com.woorea.openstack.heat.model.Stack;
+
+@RunWith(MockitoJUnitRunner.class)
+public class PollServiceTest {
+
+ private String RESOURCE_PATH = "src/test/resources/__files/";
+
+ @Mock
+ private ExternalTask mockExternalTask;
+
+ @Mock
+ private ExternalTaskService mockExternalTaskService;
+
+ @Mock
+ private MsoHeatUtils msoHeatUtils;
+
+ @Mock
+ private AuditMDCSetup mdcSetup;
+
+ @InjectMocks
+ private PollService pollService;
+
+ @Test
+ public void testExecuteExternalTask() throws MsoException, IOException {
+ String xmlString =
+ new String(Files.readAllBytes(Paths.get(RESOURCE_PATH + "/vnfAdapterTaskRequestCreate.xml")));
+
+ Mockito.when(mockExternalTask.getVariable("vnfAdapterTaskRequest")).thenReturn(xmlString);
+ Mockito.when(mockExternalTask.getVariable("PollRollbackStatus")).thenReturn(false);
+ Mockito.when(mockExternalTask.getVariable("stackId")).thenReturn("stackId/stack123");
+ Mockito.when(msoHeatUtils.pollStackForStatus(eq(1), any(Stack.class), eq("CREATE_IN_PROGRESS"), eq("regionOne"),
+ eq("0422ffb57ba042c0800a29dc85ca70f8"), eq(false))).thenReturn(new Stack());
+ // Mockito.doNothing().when(msoHeatUtils).postProcessStackCreate(Mockito.any(), Mockito.any(), Mockito.any(),
+ // Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any());
+
+ pollService.executeExternalTask(mockExternalTask, mockExternalTaskService);
+
+ Mockito.verify(msoHeatUtils).pollStackForStatus(eq(1), any(Stack.class), eq("CREATE_IN_PROGRESS"),
+ eq("regionOne"), eq("0422ffb57ba042c0800a29dc85ca70f8"), eq(false));
+
+ }
+
+ @Test
+ public void testExecuteExternalTask_rollback() throws MsoException, IOException {
+ String xmlString =
+ new String(Files.readAllBytes(Paths.get(RESOURCE_PATH + "/vnfAdapterTaskRequestCreate.xml")));
+
+ Mockito.when(mockExternalTask.getVariable("vnfAdapterTaskRequest")).thenReturn(xmlString);
+ Mockito.when(mockExternalTask.getVariable("PollRollbackStatus")).thenReturn(true);
+ Mockito.when(mockExternalTask.getVariable("stackId")).thenReturn("stackId/stack123");
+ Mockito.when(msoHeatUtils.pollStackForStatus(eq(1), any(), eq("DELETE_IN_PROGRESS"), eq("regionOne"),
+ eq("0422ffb57ba042c0800a29dc85ca70f8"), eq(true))).thenReturn(new Stack());
+ Mockito.doNothing().when(msoHeatUtils).postProcessStackDelete(Mockito.any());
+
+
+ pollService.executeExternalTask(mockExternalTask, mockExternalTaskService);
+
+ Mockito.verify(msoHeatUtils).pollStackForStatus(eq(1), any(), eq("DELETE_IN_PROGRESS"), eq("regionOne"),
+ eq("0422ffb57ba042c0800a29dc85ca70f8"), eq(true));
+
+ }
+
+}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/RollbackServiceTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/RollbackServiceTest.java
new file mode 100644
index 0000000000..f7613909ec
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/RollbackServiceTest.java
@@ -0,0 +1,82 @@
+package org.onap.so.adapters.tasks.orchestration;
+
+import static org.junit.Assert.assertEquals;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Optional;
+import javax.xml.ws.Holder;
+import org.camunda.bpm.client.task.ExternalTask;
+import org.camunda.bpm.client.task.ExternalTaskService;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.so.adapters.tasks.orchestration.RollbackService;
+import org.onap.so.adapters.vnf.MsoVnfAdapterImpl;
+import org.onap.so.adapters.vnf.exceptions.VnfException;
+import org.onap.so.entity.MsoRequest;
+import org.onap.so.logging.tasks.AuditMDCSetup;
+import org.onap.so.openstack.beans.VnfRollback;
+import org.onap.so.openstack.exceptions.MsoException;
+import org.onap.so.openstack.utils.MsoHeatUtils;
+import com.woorea.openstack.heat.model.Stack;
+
+@RunWith(MockitoJUnitRunner.class)
+public class RollbackServiceTest {
+
+ private String RESOURCE_PATH = "src/test/resources/__files/";
+
+ @Mock
+ private ExternalTask mockExternalTask;
+
+ @Mock
+ private ExternalTaskService mockExternalTaskService;
+
+ @Mock
+ private MsoVnfAdapterImpl vnfAdapterImpl;
+
+ @Mock
+ private MsoHeatUtils msoHeatUtils;
+
+ @Mock
+ private AuditMDCSetup mdcSetup;
+
+ @InjectMocks
+ private RollbackService rollbackService;
+
+
+ @Test
+ public void findRequestTypeTest() throws IOException {
+ String payload = new String(Files.readAllBytes(Paths.get(RESOURCE_PATH + "/vnfAdapterTaskRequestCreate.xml")));
+
+ Optional<String> actual = rollbackService.findRequestType(payload);
+
+ assertEquals("createVfModuleRequest", actual.get());
+ }
+
+ @Test
+ public void testExecuteExternalTask() throws VnfException, MsoException, IOException {
+ String payload = new String(Files.readAllBytes(Paths.get(RESOURCE_PATH + "/vnfAdapterTaskRequestCreate.xml")));
+
+ Stack stack = new Stack();
+ stack.setId("heatId");
+ Mockito.when(mockExternalTask.getVariable("vnfAdapterTaskRequest")).thenReturn(payload);
+ Mockito.doNothing().when(vnfAdapterImpl).deleteVfModule(Mockito.any(), Mockito.any(), Mockito.any(),
+ Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any());
+ Mockito.doNothing().when(mockExternalTaskService).complete(Mockito.any(), Mockito.any());
+
+ rollbackService.executeExternalTask(mockExternalTask, mockExternalTaskService);
+
+ Mockito.verify(vnfAdapterImpl, Mockito.times(1)).deleteVfModule(Mockito.eq("regionOne"),
+ Mockito.eq("CloudOwner"), Mockito.eq("0422ffb57ba042c0800a29dc85ca70f8"), Mockito.eq("dummy_id"),
+ Mockito.any(String.class), Mockito.any(String.class), Mockito.any(), Mockito.any(), Mockito.any());
+ Mockito.verify(mockExternalTaskService).complete(Mockito.eq(mockExternalTask), Mockito.any());
+
+ }
+
+}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/StackServiceTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/StackServiceTest.java
new file mode 100644
index 0000000000..2f583b30a2
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/StackServiceTest.java
@@ -0,0 +1,113 @@
+package org.onap.so.adapters.tasks.orchestration;
+
+import static org.junit.Assert.assertEquals;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Optional;
+import javax.xml.ws.Holder;
+import org.camunda.bpm.client.task.ExternalTask;
+import org.camunda.bpm.client.task.ExternalTaskService;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.so.adapters.tasks.orchestration.StackService;
+import org.onap.so.adapters.vnf.MsoVnfAdapterImpl;
+import org.onap.so.entity.MsoRequest;
+import org.onap.so.logging.tasks.AuditMDCSetup;
+import org.onap.so.openstack.beans.VnfRollback;
+import org.onap.so.openstack.exceptions.MsoException;
+import org.onap.so.openstack.utils.MsoHeatUtils;
+import com.woorea.openstack.heat.model.Stack;
+import org.onap.so.adapters.vnf.exceptions.VnfException;
+
+@RunWith(MockitoJUnitRunner.class)
+public class StackServiceTest {
+
+ private String RESOURCE_PATH = "src/test/resources/__files/";
+
+ @Mock
+ private ExternalTask mockExternalTask;
+
+ @Mock
+ private ExternalTaskService mockExternalTaskService;
+
+ @Mock
+ private MsoVnfAdapterImpl vnfAdapterImpl;
+
+ @Mock
+ private MsoHeatUtils msoHeatUtils;
+
+ @Mock
+ private AuditMDCSetup mdcSetup;
+
+ @InjectMocks
+ private StackService stackService;
+
+ @Test
+ public void findRequestTypeTest() throws IOException {
+ String payload = new String(Files.readAllBytes(Paths.get(RESOURCE_PATH + "/vnfAdapterTaskRequestCreate.xml")));
+
+ Optional<String> actual = stackService.findRequestType(payload);
+
+ assertEquals("createVfModuleRequest", actual.get());
+ }
+
+ @Test
+ public void testExecuteExternalTask() throws VnfException, MsoException, IOException {
+ String payload = new String(Files.readAllBytes(Paths.get(RESOURCE_PATH + "/vnfAdapterTaskRequestCreate.xml")));
+
+ Stack stack = new Stack();
+ stack.setId("heatId");
+ Mockito.when(mockExternalTask.getVariable("vnfAdapterTaskRequest")).thenReturn(payload);
+ Mockito.doNothing().when(vnfAdapterImpl).createVfModule(Mockito.any(), Mockito.any(), Mockito.any(),
+ Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(),
+ Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(),
+ Mockito.any(), Mockito.any(), Mockito.any());
+ Mockito.doNothing().when(mockExternalTaskService).complete(Mockito.any(), Mockito.any());
+
+ stackService.executeExternalTask(mockExternalTask, mockExternalTaskService);
+
+ Map<String, Object> paramsMap = new HashMap<String, Object>();
+ paramsMap.put("vf_module_id", "985a468b-328b-4c2b-ad0e-b8f1e19501c4");
+ paramsMap.put("vnf_id", "6640feba-55f6-4946-9694-4d9558c8870a");
+ paramsMap.put("vnf_name", "Robot_VNF_For_Volume_Group");
+ paramsMap.put("availability_zone_0", "AZ-MN02");
+ paramsMap.put("environment_context", "General_Revenue-Bearing");
+ paramsMap.put("user_directives", "{}");
+ paramsMap.put("workload_context", "");
+ paramsMap.put("vf_module_name", "dummy_id");
+ paramsMap.put("vf_module_index", "0");
+ paramsMap.put("sdnc_directives",
+ "{ \"attributes\": [ {\"attribute_name\": \"availability_zone_0\", \"attribute_value\": \"AZ-MN02\"}] }");
+
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("backout", true);
+ variables.put("WorkflowResponse", "");
+ variables.put("OpenstackInvokeSuccess", true);
+ variables.put("stackId", null);
+ variables.put("openstackAdapterErrorMessage", null);
+ variables.put("PollRollbackStatus", false);
+ variables.put("rollbackPerformed", false);
+ variables.put("OpenstackRollbackSuccess", false);
+ variables.put("OpenstackPollSuccess", false);
+
+ Mockito.verify(vnfAdapterImpl, Mockito.times(1)).createVfModule(Mockito.eq("regionOne"),
+ Mockito.eq("CloudOwner"), Mockito.eq("0422ffb57ba042c0800a29dc85ca70f8"),
+ Mockito.eq(
+ "Vf zrdm5bpxmc02092017-Service/Vf zrdm5bpxmc02092017-VF 0::VfZrdm5bpxmc02092017Vf..pxmc_base..module-0"),
+ Mockito.eq("1.0"), Mockito.eq("6640feba-55f6-4946-9694-4d9558c8870a"), Mockito.eq("dummy_id"),
+ Mockito.eq("985a468b-328b-4c2b-ad0e-b8f1e19501c4"), Mockito.eq(null), Mockito.eq(null),
+ Mockito.eq(null), Mockito.eq("074c64d0-7e13-4bcc-8bdb-ea922331102d"), Mockito.eq(paramsMap),
+ Mockito.eq(false), Mockito.eq(false), Mockito.eq(null), Mockito.any(), Mockito.any(), Mockito.any(),
+ Mockito.any());
+ Mockito.verify(mockExternalTaskService).complete(Mockito.eq(mockExternalTask), Mockito.eq(variables));
+
+ }
+
+}
diff --git a/adapters/mso-openstack-adapters/src/test/resources/__files/vnfAdapterTaskRequestCreate.xml b/adapters/mso-openstack-adapters/src/test/resources/__files/vnfAdapterTaskRequestCreate.xml
new file mode 100644
index 0000000000..c7c880ed92
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/__files/vnfAdapterTaskRequestCreate.xml
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<createVfModuleRequest>
+ <messageId>7f4557c8-c3b9-4743-8b88-9539f9ed7bea</messageId>
+ <notificationUrl>http://mso-bpmn-infra-svc:9200/mso/WorkflowMessage/VNFAResponse/7f4557c8-c3b9-4743-8b88-9539f9ed7bea
+ </notificationUrl>
+ <skipAAI>true</skipAAI>
+ <cloudSiteId>regionOne</cloudSiteId>
+ <cloudOwner>CloudOwner</cloudOwner>
+ <tenantId>0422ffb57ba042c0800a29dc85ca70f8</tenantId>
+ <vnfId>6640feba-55f6-4946-9694-4d9558c8870a</vnfId>
+ <vnfType>Vf zrdm5bpxmc02092017-Service/Vf zrdm5bpxmc02092017-VF 0</vnfType>
+ <vnfVersion>1.0</vnfVersion>
+ <vfModuleId>985a468b-328b-4c2b-ad0e-b8f1e19501c4</vfModuleId>
+ <vfModuleName>dummy_id</vfModuleName>
+ <vfModuleType>VfZrdm5bpxmc02092017Vf..pxmc_base..module-0</vfModuleType>
+ <baseVfModuleId>985a468b-328b-4c2b-ad0e-b8f1e19501c4</baseVfModuleId>
+ <modelCustomizationUuid>074c64d0-7e13-4bcc-8bdb-ea922331102d</modelCustomizationUuid>
+ <failIfExists>false</failIfExists>
+ <backout>true</backout>
+ <vfModuleParams>
+ <entry>
+ <key>vf_module_id</key>
+ <value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string">985a468b-328b-4c2b-ad0e-b8f1e19501c4</value>
+ </entry>
+ <entry>
+ <key>vnf_id</key>
+ <value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string">6640feba-55f6-4946-9694-4d9558c8870a</value>
+ </entry>
+ <entry>
+ <key>vnf_name</key>
+ <value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string">Robot_VNF_For_Volume_Group</value>
+ </entry>
+ <entry>
+ <key>availability_zone_0</key>
+ <value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string">AZ-MN02</value>
+ </entry>
+ <entry>
+ <key>environment_context</key>
+ <value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string">General_Revenue-Bearing</value>
+ </entry>
+ <entry>
+ <key>user_directives</key>
+ <value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string">{}</value>
+ </entry>
+ <entry>
+ <key>workload_context</key>
+ <value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string"/>
+ </entry>
+ <entry>
+ <key>vf_module_name</key>
+ <value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string">dummy_id</value>
+ </entry>
+ <entry>
+ <key>vf_module_index</key>
+ <value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string">0</value>
+ </entry>
+ <entry>
+ <key>sdnc_directives</key>
+ <value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string">{ "attributes": [ {"attribute_name": "availability_zone_0", "attribute_value": "AZ-MN02"}] }</value>
+ </entry>
+ </vfModuleParams>
+ <msoRequest>
+ <requestId>049abdd8-0e19-48b8-bd87-b18f8d49048c</requestId>
+ <serviceInstanceId>7dc4c4eb-b1d7-4aef-94d1-24e925d1210c</serviceInstanceId>
+ </msoRequest>
+</createVfModuleRequest>
diff --git a/adapters/mso-openstack-adapters/src/test/resources/schema.sql b/adapters/mso-openstack-adapters/src/test/resources/schema.sql
index 6b791e789c..3357fec109 100644
--- a/adapters/mso-openstack-adapters/src/test/resources/schema.sql
+++ b/adapters/mso-openstack-adapters/src/test/resources/schema.sql
@@ -801,6 +801,7 @@ CREATE TABLE `service` (
`TOSCA_CSAR_ARTIFACT_UUID` varchar(200) DEFAULT NULL,
`SERVICE_TYPE` varchar(200) DEFAULT NULL,
`SERVICE_ROLE` varchar(200) DEFAULT NULL,
+ `SERVICE_FUNCTION` varchar(200) DEFAULT NULL,
`ENVIRONMENT_CONTEXT` varchar(200) DEFAULT NULL,
`WORKLOAD_CONTEXT` varchar(200) DEFAULT NULL,
`SERVICE_CATEGORY` varchar(200) DEFAULT NULL,
diff --git a/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V8.2__Fix_Invalid_Request_Status.sql b/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V8.2__Fix_Invalid_Request_Status.sql
new file mode 100644
index 0000000000..9fee716326
--- /dev/null
+++ b/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V8.2__Fix_Invalid_Request_Status.sql
@@ -0,0 +1,4 @@
+USE `requestdb`;
+
+UPDATE infra_active_requests SET request_status='COMPLETE' where request_status = 'COMPLETED';
+UPDATE archived_infra_requests SET request_status='COMPLETE' where request_status = 'COMPLETED'; \ No newline at end of file
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/MessageConverterConfiguration.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/MessageConverterConfiguration.java
index 87e8bb4d57..bb2730bd2b 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/MessageConverterConfiguration.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/MessageConverterConfiguration.java
@@ -28,6 +28,7 @@ import org.onap.so.adapters.vnfmadapter.converters.etsicatalog.sol003.PkgOnboard
import org.onap.so.adapters.vnfmadapter.converters.etsicatalog.sol003.VnfPkgInfoConverter;
import org.onap.so.adapters.vnfmadapter.converters.sol003.etsicatalog.PkgmSubscriptionRequestConverter;
import org.onap.so.adapters.vnfmadapter.oauth.OAuth2AccessTokenAdapter;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -43,10 +44,17 @@ import org.springframework.security.oauth2.common.OAuth2AccessToken;
@Configuration
public class MessageConverterConfiguration {
+ private final VnfmAdapterUrlProvider vnfmAdapterUrlProvider;
+
+ @Autowired
+ public MessageConverterConfiguration(final VnfmAdapterUrlProvider vnfmAdapterUrlProvider) {
+ this.vnfmAdapterUrlProvider = vnfmAdapterUrlProvider;
+ }
+
@Bean
public ConversionService conversionService() {
final DefaultConversionService service = new DefaultConversionService();
- service.addConverter(new VnfPkgInfoConverter());
+ service.addConverter(new VnfPkgInfoConverter(vnfmAdapterUrlProvider));
service.addConverter(new PkgmSubscriptionRequestConverter());
service.addConverter(new PkgChangeNotificationConverter());
service.addConverter(new PkgOnboardingNotificationConverter());
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/VnfmAdapterUrlProvider.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/VnfmAdapterUrlProvider.java
new file mode 100644
index 0000000000..411a57069f
--- /dev/null
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/VnfmAdapterUrlProvider.java
@@ -0,0 +1,105 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Ericsson. 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.adapters.vnfmadapter;
+
+import static org.onap.so.adapters.vnfmadapter.Constants.BASE_URL;
+import static org.onap.so.adapters.vnfmadapter.Constants.ETSI_SUBSCRIPTION_NOTIFICATION_BASE_URL;
+import static org.onap.so.adapters.vnfmadapter.Constants.OPERATION_NOTIFICATION_ENDPOINT;
+import static org.onap.so.adapters.vnfmadapter.Constants.PACKAGE_MANAGEMENT_BASE_URL;
+import static org.slf4j.LoggerFactory.getLogger;
+import java.net.URI;
+import java.security.GeneralSecurityException;
+import org.apache.commons.lang3.tuple.ImmutablePair;
+import org.onap.so.utils.CryptoUtils;
+import org.slf4j.Logger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Configuration;
+
+
+/**
+ * Provides VNFM Adapter endpoint URLs
+ *
+ * @author Waqas Ikram (waqas.ikram@est.tech)
+ *
+ */
+@Configuration
+public class VnfmAdapterUrlProvider {
+
+ private static final Logger logger = getLogger(VnfmAdapterUrlProvider.class);
+ private static final String COLON = ":";
+ private static final int LIMIT = 2;
+
+ private final String vnfmAdapterEndpoint;
+ private final String msoKeyString;
+ private final String vnfmAdapterAuth;
+
+ @Autowired
+ public VnfmAdapterUrlProvider(@Value("${vnfmadapter.endpoint}") final String vnfmAdapterEndpoint,
+ @Value("${mso.key}") final String msoKeyString,
+ @Value("${vnfmadapter.auth:BF29BA36F0CFE1C05507781F6B97EFBCA7EFAC9F595954D465FC43F646883EF585C20A58CBB02528A6FAAC}") final String vnfmAdapterAuth) {
+ this.vnfmAdapterEndpoint = vnfmAdapterEndpoint;
+ this.msoKeyString = msoKeyString;
+ this.vnfmAdapterAuth = vnfmAdapterAuth;
+ }
+
+ public String getEtsiSubscriptionNotificationBaseUrl() {
+ return vnfmAdapterEndpoint + ETSI_SUBSCRIPTION_NOTIFICATION_BASE_URL;
+ }
+
+ public URI getSubscriptionUri(final String subscriptionId) {
+ return URI.create(getSubscriptionUriString(subscriptionId));
+ }
+
+ public ImmutablePair<String, String> getDecryptAuth() throws GeneralSecurityException {
+ final String decryptedAuth = CryptoUtils.decrypt(vnfmAdapterAuth, msoKeyString);
+ final String[] auth = decryptedAuth.split(COLON, LIMIT);
+ if (auth.length > 1) {
+ return ImmutablePair.of(auth[0], auth[1]);
+ }
+ logger.error("Unexpected auth value: {}", vnfmAdapterAuth);
+ return ImmutablePair.nullPair();
+ }
+
+ public String getSubscriptionUriString(final String subscriptionId) {
+ return vnfmAdapterEndpoint + PACKAGE_MANAGEMENT_BASE_URL + "/subscriptions/" + subscriptionId;
+ }
+
+ public String getVnfLcmOperationOccurrenceNotificationUrl() {
+ return vnfmAdapterEndpoint + BASE_URL + OPERATION_NOTIFICATION_ENDPOINT;
+ }
+
+ public String getVnfPackageUrl(final String vnfPkgId) {
+ return vnfmAdapterEndpoint + PACKAGE_MANAGEMENT_BASE_URL + "/vnf_packages/" + vnfPkgId;
+ }
+
+ public String getVnfPackageVnfdUrl(final String vnfPkgId) {
+ return getVnfPackageUrl(vnfPkgId) + "/vnfd";
+ }
+
+ public String getVnfPackageContentUrl(final String vnfPkgId) {
+ return getVnfPackageUrl(vnfPkgId) + "/package_content";
+ }
+
+ public String getOauthTokenUrl() {
+ return vnfmAdapterEndpoint + "/oauth/token";
+ }
+
+}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/converters/etsicatalog/sol003/VnfPkgInfoConverter.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/converters/etsicatalog/sol003/VnfPkgInfoConverter.java
index 160b875374..ee941f6951 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/converters/etsicatalog/sol003/VnfPkgInfoConverter.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/converters/etsicatalog/sol003/VnfPkgInfoConverter.java
@@ -22,22 +22,22 @@ package org.onap.so.adapters.vnfmadapter.converters.etsicatalog.sol003;
import java.util.ArrayList;
import java.util.List;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.core.convert.converter.Converter;
-import org.springframework.stereotype.Service;
+import org.onap.so.adapters.vnfmadapter.VnfmAdapterUrlProvider;
+import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.Checksum;
+import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.VNFPKGMLinkSerializer;
+import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.VnfPackageArtifactInfo;
+import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.VnfPackageSoftwareImageInfo;
import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.VnfPkgInfo;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.InlineResponse2001;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.VnfPackagesChecksum;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.VnfPackagesSoftwareImages;
-import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.VnfPackageSoftwareImageInfo;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.VnfPackagesAdditionalArtifacts;
-import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.VnfPackageArtifactInfo;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.VnfPackagesChecksum;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.VnfPackagesLinks;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.VnfPackagesLinksSelf;
-import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.VNFPKGMLinkSerializer;
-import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.Checksum;
-import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.UriLink;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.VnfPackagesSoftwareImages;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.core.convert.converter.Converter;
+import org.springframework.stereotype.Service;
/**
* Converter to convert from an Etsi Catalog Manager {@link VnfPkgInfo} Object to its equivalent SOL003 Object
@@ -48,6 +48,11 @@ import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.UriLink;
@Service
public class VnfPkgInfoConverter implements Converter<VnfPkgInfo, InlineResponse2001> {
private static final Logger logger = LoggerFactory.getLogger(VnfPkgInfoConverter.class);
+ private final VnfmAdapterUrlProvider vnfmAdapterUrlProvider;
+
+ public VnfPkgInfoConverter(final VnfmAdapterUrlProvider vnfmAdapterUrlProvider) {
+ this.vnfmAdapterUrlProvider = vnfmAdapterUrlProvider;
+ }
/**
* Convert a {@link VnfPkgInfo} Object to an {@link InlineResponse2001} Object
@@ -58,7 +63,7 @@ public class VnfPkgInfoConverter implements Converter<VnfPkgInfo, InlineResponse
@Override
public InlineResponse2001 convert(final VnfPkgInfo vnfPkgInfo) {
if (vnfPkgInfo == null) {
- logger.info("No VnfPkgInfo Object Provided for Conversion. (Null object received, returning Null)");
+ logger.error("No VnfPkgInfo Object Provided for Conversion. (Null object received, returning Null)");
return null;
}
final InlineResponse2001 response = new InlineResponse2001();
@@ -87,7 +92,7 @@ public class VnfPkgInfoConverter implements Converter<VnfPkgInfo, InlineResponse
response.setUserDefinedData((vnfPkgInfo.getUserDefinedData()));
if (vnfPkgInfo.getLinks() != null) {
- response.setLinks(convertVNFPKGMLinkSerializerToVnfPackagesLinks(vnfPkgInfo.getLinks()));
+ response.setLinks(getVnfPackagesLinks(vnfPkgInfo.getLinks(), vnfPkgInfo.getId()));
}
return response;
@@ -167,22 +172,27 @@ public class VnfPkgInfoConverter implements Converter<VnfPkgInfo, InlineResponse
return vnfPackagesAdditionalArtifacts;
}
- private VnfPackagesLinks convertVNFPKGMLinkSerializerToVnfPackagesLinks(
- final VNFPKGMLinkSerializer vnfpkgmLinkSerializer) {
+ private VnfPackagesLinks getVnfPackagesLinks(final VNFPKGMLinkSerializer links, final String vnfPkgId) {
final VnfPackagesLinks vnfPackagesLinks = new VnfPackagesLinks();
- vnfPackagesLinks.setSelf(convertUriLinkToVnfPackagesLinksSelf(vnfpkgmLinkSerializer.getSelf()));
- vnfPackagesLinks.setVnfd(convertUriLinkToVnfPackagesLinksSelf(vnfpkgmLinkSerializer.getVnfd()));
- vnfPackagesLinks
- .setPackageContent(convertUriLinkToVnfPackagesLinksSelf(vnfpkgmLinkSerializer.getPackageContent()));
+
+ if (links.getSelf() != null) {
+ vnfPackagesLinks.setSelf(getVnfPackagesLinksSelf(vnfmAdapterUrlProvider.getVnfPackageUrl(vnfPkgId)));
+ }
+
+ if (links.getVnfd() != null) {
+ vnfPackagesLinks.setVnfd(getVnfPackagesLinksSelf(vnfmAdapterUrlProvider.getVnfPackageVnfdUrl(vnfPkgId)));
+ }
+
+ if (links.getPackageContent() != null) {
+ vnfPackagesLinks.setPackageContent(
+ getVnfPackagesLinksSelf(vnfmAdapterUrlProvider.getVnfPackageContentUrl(vnfPkgId)));
+ }
+
return vnfPackagesLinks;
}
- private VnfPackagesLinksSelf convertUriLinkToVnfPackagesLinksSelf(final UriLink uriLink) {
- final VnfPackagesLinksSelf vnfPackagesLinksSelf = new VnfPackagesLinksSelf();
- if (uriLink != null) {
- vnfPackagesLinksSelf.setHref(uriLink.getHref());
- }
- return vnfPackagesLinksSelf;
+ private VnfPackagesLinksSelf getVnfPackagesLinksSelf(final String href) {
+ return new VnfPackagesLinksSelf().href(href);
}
}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogPackageManagementServiceProvider.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogPackageManagementServiceProvider.java
new file mode 100644
index 0000000000..95252218c8
--- /dev/null
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogPackageManagementServiceProvider.java
@@ -0,0 +1,72 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Ericsson. 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.adapters.vnfmadapter.extclients.etsicatalog;
+
+import java.util.Optional;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.InlineResponse2001;
+
+/**
+ * @author Waqas Ikram (waqas.ikram@est.tech)
+ *
+ */
+public interface EtsiCatalogPackageManagementServiceProvider {
+
+ /**
+ * GET Package Content, from VNF Package.
+ *
+ * @param vnfPkgId The ID of the VNF Package from which the "package_content" will be retrieved.
+ * @return The Package Content of a VNF Package ("vnfPkgId").
+ */
+ Optional<byte[]> getVnfPackageContent(final String vnfPkgId);
+
+ /**
+ * GET VNF packages information from ETSI Catalog. Will return zero or more VNF package representations.
+ *
+ * @return An Array of all VNF packages retrieved from the ETSI Catalog.
+ */
+ Optional<InlineResponse2001[]> getVnfPackages();
+
+ /**
+ * GET specific VNF package information from ETSI Catalog.
+ *
+ * @param vnfPkgId The ID of the VNF Package that you want to query.
+ * @return The VNF package retrieved from the ETSI Catalog
+ */
+ Optional<InlineResponse2001> getVnfPackage(final String vnfPkgId);
+
+ /**
+ * GET specific VNF package VNFD from ETSI Catalog.
+ *
+ * @param vnfPkgId The ID of the VNF Package that you want to query.
+ * @return The VNF package retrieved from the ETSI Catalog
+ */
+ Optional<byte[]> getVnfPackageVnfd(final String vnfPkgId);
+
+ /**
+ * GET Package Artifact, from VNF Package.
+ *
+ * @param vnfPkgId The ID of the VNF Package from which the artifact will be retrieved.
+ * @param artifactPath Sequence of one or more path segments representing the path of the artifact within the VNF
+ * Package, e.g., foo/bar/run.sh
+ * @return The Package Artifact of a VNF Package ("vnfPkgId", "artifactPath").
+ */
+ Optional<byte[]> getVnfPackageArtifact(final String vnfPkgId, final String artifactPath);
+
+}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogServiceProvider.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogServiceProvider.java
index 0dcc49eeac..61db82f38c 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogServiceProvider.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogServiceProvider.java
@@ -20,80 +20,13 @@
package org.onap.so.adapters.vnfmadapter.extclients.etsicatalog;
-import java.util.Optional;
-import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.NsdmSubscription;
-import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.PkgmSubscription;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.InlineResponse2001;
-
/**
* Provides methods for invoking REST calls to the ETSI Catalog Manager.
*
* @author gareth.roper@est.tech
*/
-public interface EtsiCatalogServiceProvider {
-
- /**
- * GET Package Content, from VNF Package.
- *
- * @param vnfPkgId The ID of the VNF Package from which the "package_content" will be retrieved.
- * @return The Package Content of a VNF Package ("vnfPkgId").
- */
- Optional<byte[]> getVnfPackageContent(final String vnfPkgId);
-
- /**
- * GET VNF packages information from ETSI Catalog. Will return zero or more VNF package representations.
- *
- * @return An Array of all VNF packages retrieved from the ETSI Catalog.
- */
- Optional<InlineResponse2001[]> getVnfPackages();
-
- /**
- * GET specific VNF package information from ETSI Catalog.
- *
- * @param vnfPkgId The ID of the VNF Package that you want to query.
- * @return The VNF package retrieved from the ETSI Catalog
- */
- Optional<InlineResponse2001> getVnfPackage(final String vnfPkgId);
-
- /**
- * GET specific VNF package VNFD from ETSI Catalog.
- *
- * @param vnfPkgId The ID of the VNF Package that you want to query.
- * @return The VNF package retrieved from the ETSI Catalog
- */
- Optional<byte[]> getVnfPackageVnfd(final String vnfPkgId);
-
- /**
- * GET Package Artifact, from VNF Package.
- *
- * @param vnfPkgId The ID of the VNF Package from which the artifact will be retrieved.
- * @param artifactPath Sequence of one or more path segments representing the path of the artifact within the VNF
- * Package, e.g., foo/bar/run.sh
- * @return The Package Artifact of a VNF Package ("vnfPkgId", "artifactPath").
- */
- Optional<byte[]> getVnfPackageArtifact(final String vnfPkgId, final String artifactPath);
-
- /**
- * POST the SubscriptionRequest Object.
- *
- * @return The ETSI Catalog Manager's PkgmSubscription object.
- */
- Optional<PkgmSubscription> postSubscription(
- final org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.PkgmSubscriptionRequest etsiCatalogManagerSubscriptionRequest);
-
- /**
- * Get the Subscription from ETSI Catalog.
- *
- * @param subscriptionId Subscription ID
- * @return The Subscription {@link NsdmSubscription} from ETSI Catalog
- */
- Optional<NsdmSubscription> getSubscription(final String subscriptionId);
+public interface EtsiCatalogServiceProvider
+ extends EtsiCatalogSubscriptionServiceProvider, EtsiCatalogPackageManagementServiceProvider {
- /**
- * DELETE the SubscriptionRequest Object.
- *
- * @return A Boolean representing if the delete was successful or not.
- */
- boolean deleteSubscription(final String subscriptionId);
}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogServiceProviderConfiguration.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogServiceProviderConfiguration.java
index 6840dd388b..860dfbbe9c 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogServiceProviderConfiguration.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogServiceProviderConfiguration.java
@@ -20,16 +20,41 @@
package org.onap.so.adapters.vnfmadapter.extclients.etsicatalog;
-import static org.onap.so.client.RestTemplateConfig.CONFIGURABLE_REST_TEMPLATE;
+import java.io.IOException;
+import java.security.KeyManagementException;
+import java.security.KeyStoreException;
+import java.security.NoSuchAlgorithmException;
+import java.security.cert.CertificateException;
+import java.util.concurrent.TimeUnit;
+import javax.net.ssl.HostnameVerifier;
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLSession;
+import org.apache.http.client.config.RequestConfig;
+import org.apache.http.config.Registry;
+import org.apache.http.config.RegistryBuilder;
+import org.apache.http.conn.socket.ConnectionSocketFactory;
+import org.apache.http.conn.socket.PlainConnectionSocketFactory;
+import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
+import org.apache.http.impl.client.HttpClientBuilder;
+import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
+import org.apache.http.ssl.SSLContextBuilder;
+import org.onap.logging.filter.spring.SpringClientPayloadFilter;
import org.onap.so.adapters.vnfmadapter.extclients.AbstractServiceProviderConfiguration;
import org.onap.so.configuration.rest.BasicHttpHeadersProvider;
-import org.onap.so.configuration.rest.HttpHeadersProvider;
+import org.onap.so.configuration.rest.HttpClientConnectionConfiguration;
+import org.onap.so.logging.jaxrs.filter.SOSpringClientFilter;
import org.onap.so.rest.service.HttpRestServiceProvider;
import org.onap.so.rest.service.HttpRestServiceProviderImpl;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
+import org.springframework.core.io.Resource;
+import org.springframework.http.client.BufferingClientHttpRequestFactory;
+import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.web.client.RestTemplate;
/**
@@ -41,16 +66,105 @@ import org.springframework.web.client.RestTemplate;
@Configuration
public class EtsiCatalogServiceProviderConfiguration extends AbstractServiceProviderConfiguration {
- @Bean(name = "etsiCatalogServiceProvider")
- public HttpRestServiceProvider httpRestServiceProvider(
- @Qualifier(CONFIGURABLE_REST_TEMPLATE) @Autowired final RestTemplate restTemplate) {
- return getHttpRestServiceProvider(restTemplate, new BasicHttpHeadersProvider());
+ public static final String ETSI_CATALOG_REST_TEMPLATE_BEAN = "etsiCatalogRestTemplate";
+
+ public static final String ETSI_CATALOG_SERVICE_PROVIDER_BEAN = "etsiCatalogServiceProvider";
+
+ private final static Logger LOGGER = LoggerFactory.getLogger(EtsiCatalogServiceProviderConfiguration.class);
+
+ private final HttpClientConnectionConfiguration clientConnectionConfiguration;
+
+ @Value("${etsi-catalog-manager.http.client.ssl.trust-store:#{null}}")
+ private Resource trustStore;
+ @Value("${etsi-catalog-manager.http.client.ssl.trust-store-password:#{null}}")
+ private String trustStorePassword;
+
+ @Autowired
+ public EtsiCatalogServiceProviderConfiguration(
+ final HttpClientConnectionConfiguration clientConnectionConfiguration) {
+ this.clientConnectionConfiguration = clientConnectionConfiguration;
+ }
+
+ @Bean
+ @Qualifier(ETSI_CATALOG_REST_TEMPLATE_BEAN)
+ public RestTemplate etsiCatalogRestTemplate() {
+ final RestTemplate restTemplate = new RestTemplate();
+ restTemplate.getInterceptors().add(new SOSpringClientFilter());
+ restTemplate.getInterceptors().add((new SpringClientPayloadFilter()));
+ return restTemplate;
}
- private HttpRestServiceProvider getHttpRestServiceProvider(final RestTemplate restTemplate,
- final HttpHeadersProvider httpHeadersProvider) {
+ @Bean
+ @Qualifier(ETSI_CATALOG_SERVICE_PROVIDER_BEAN)
+ public HttpRestServiceProvider etsiCatalogHttpRestServiceProvider(
+ @Qualifier(ETSI_CATALOG_REST_TEMPLATE_BEAN) final RestTemplate restTemplate) {
setGsonMessageConverter(restTemplate);
- return new HttpRestServiceProviderImpl(restTemplate, httpHeadersProvider);
+
+ final HttpClientBuilder httpClientBuilder = getHttpClientBuilder();
+ if (trustStore != null) {
+ try {
+ LOGGER.debug("Setting up HttpComponentsClientHttpRequestFactory with SSL Context");
+ LOGGER.debug("Setting client trust-store: {}", trustStore.getURL());
+ LOGGER.debug("Creating SSLConnectionSocketFactory with AllowAllHostsVerifier ... ");
+ final SSLContext sslContext = new SSLContextBuilder()
+ .loadTrustMaterial(trustStore.getURL(), trustStorePassword.toCharArray()).build();
+ final SSLConnectionSocketFactory sslConnectionSocketFactory =
+ new SSLConnectionSocketFactory(sslContext, AllowAllHostsVerifier.INSTANCE);
+ httpClientBuilder.setSSLSocketFactory(sslConnectionSocketFactory);
+ final Registry<ConnectionSocketFactory> socketFactoryRegistry = RegistryBuilder
+ .<ConnectionSocketFactory>create().register("http", PlainConnectionSocketFactory.INSTANCE)
+ .register("https", sslConnectionSocketFactory).build();
+
+ httpClientBuilder.setConnectionManager(getConnectionManager(socketFactoryRegistry));
+ } catch (final KeyManagementException | NoSuchAlgorithmException | KeyStoreException | CertificateException
+ | IOException exception) {
+ LOGGER.error("Error reading truststore, TLS connection will fail.", exception);
+ }
+
+ } else {
+ LOGGER.debug("Setting connection manager without SSL ConnectionSocketFactory ...");
+ httpClientBuilder.setConnectionManager(getConnectionManager());
+ }
+
+ final HttpComponentsClientHttpRequestFactory factory =
+ new HttpComponentsClientHttpRequestFactory(httpClientBuilder.build());
+ restTemplate.setRequestFactory(new BufferingClientHttpRequestFactory(factory));
+
+ return new HttpRestServiceProviderImpl(restTemplate, new BasicHttpHeadersProvider().getHttpHeaders());
+ }
+
+ private PoolingHttpClientConnectionManager getConnectionManager(
+ final Registry<ConnectionSocketFactory> socketFactoryRegistry) {
+ return new PoolingHttpClientConnectionManager(socketFactoryRegistry, null, null, null,
+ clientConnectionConfiguration.getTimeToLiveInMins(), TimeUnit.MINUTES);
+ }
+
+ private PoolingHttpClientConnectionManager getConnectionManager() {
+ return new PoolingHttpClientConnectionManager(clientConnectionConfiguration.getTimeToLiveInMins(),
+ TimeUnit.MINUTES);
+ }
+
+ private HttpClientBuilder getHttpClientBuilder() {
+ return HttpClientBuilder.create().setMaxConnPerRoute(clientConnectionConfiguration.getMaxConnectionsPerRoute())
+ .setMaxConnTotal(clientConnectionConfiguration.getMaxConnections())
+ .setDefaultRequestConfig(getRequestConfig());
+ }
+
+ private RequestConfig getRequestConfig() {
+ return RequestConfig.custom().setSocketTimeout(clientConnectionConfiguration.getSocketTimeOutInMiliSeconds())
+ .setConnectTimeout(clientConnectionConfiguration.getConnectionTimeOutInMilliSeconds()).build();
+ }
+
+ private static final class AllowAllHostsVerifier implements HostnameVerifier {
+
+ private static final AllowAllHostsVerifier INSTANCE = new AllowAllHostsVerifier();
+
+ @Override
+ public boolean verify(final String hostname, final SSLSession session) {
+ LOGGER.debug("Skipping hostname verification ...");
+ return true;
+ }
+
}
}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogServiceProviderImpl.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogServiceProviderImpl.java
index 30d084629c..cae413ce10 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogServiceProviderImpl.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogServiceProviderImpl.java
@@ -20,6 +20,7 @@
package org.onap.so.adapters.vnfmadapter.extclients.etsicatalog;
+import static org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.EtsiCatalogServiceProviderConfiguration.ETSI_CATALOG_SERVICE_PROVIDER_BEAN;
import java.util.Optional;
import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.NsdmSubscription;
import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.PkgmSubscription;
@@ -53,14 +54,14 @@ import org.springframework.stereotype.Service;
public class EtsiCatalogServiceProviderImpl implements EtsiCatalogServiceProvider {
private static final Logger logger = LoggerFactory.getLogger(EtsiCatalogServiceProviderImpl.class);
- @Qualifier("etsiCatalogServiceProvider")
private final HttpRestServiceProvider httpServiceProvider;
private final EtsiCatalogUrlProvider etsiCatalogUrlProvider;
private final ConversionService conversionService;
@Autowired
public EtsiCatalogServiceProviderImpl(final EtsiCatalogUrlProvider etsiCatalogUrlProvider,
- final HttpRestServiceProvider httpServiceProvider, final ConversionService conversionService) {
+ @Qualifier(ETSI_CATALOG_SERVICE_PROVIDER_BEAN) final HttpRestServiceProvider httpServiceProvider,
+ final ConversionService conversionService) {
this.etsiCatalogUrlProvider = etsiCatalogUrlProvider;
this.httpServiceProvider = httpServiceProvider;
this.conversionService = conversionService;
@@ -118,8 +119,10 @@ public class EtsiCatalogServiceProviderImpl implements EtsiCatalogServiceProvide
if (inlineResponse2001 != null) {
responses[index] = inlineResponse2001;
}
+ } else {
+ logger.error("Unable to find Converter for response class: {}",
+ vnfPackages[index].getClass());
}
- logger.error("Unable to find Converter for response class: {}", vnfPackages[index].getClass());
}
return Optional.of(responses);
}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogSubscriptionServiceProvider.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogSubscriptionServiceProvider.java
new file mode 100644
index 0000000000..ed04ad7746
--- /dev/null
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogSubscriptionServiceProvider.java
@@ -0,0 +1,55 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Ericsson. 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.adapters.vnfmadapter.extclients.etsicatalog;
+
+import java.util.Optional;
+import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.NsdmSubscription;
+import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.PkgmSubscription;
+
+/**
+ * @author Waqas Ikram (waqas.ikram@est.tech)
+ *
+ */
+public interface EtsiCatalogSubscriptionServiceProvider {
+
+ /**
+ * POST the SubscriptionRequest Object.
+ *
+ * @return The ETSI Catalog Manager's PkgmSubscription object.
+ */
+ Optional<PkgmSubscription> postSubscription(
+ final org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.PkgmSubscriptionRequest etsiCatalogManagerSubscriptionRequest);
+
+ /**
+ * Get the Subscription from ETSI Catalog.
+ *
+ * @param subscriptionId Subscription ID
+ * @return The Subscription {@link NsdmSubscription} from ETSI Catalog
+ */
+ Optional<NsdmSubscription> getSubscription(final String subscriptionId);
+
+ /**
+ * DELETE the SubscriptionRequest Object.
+ *
+ * @return A Boolean representing if the delete was successful or not.
+ */
+ boolean deleteSubscription(final String subscriptionId);
+
+}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmHelper.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmHelper.java
index 7c22020287..fabf8839a6 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmHelper.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmHelper.java
@@ -20,17 +20,13 @@
package org.onap.so.adapters.vnfmadapter.extclients.vnfm;
-import static org.onap.so.adapters.vnfmadapter.Constants.BASE_URL;
-import static org.onap.so.adapters.vnfmadapter.Constants.OPERATION_NOTIFICATION_ENDPOINT;
-import com.google.common.reflect.TypeToken;
-import com.google.gson.Gson;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonObject;
import java.security.GeneralSecurityException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
+import org.apache.commons.lang3.tuple.ImmutablePair;
import org.onap.aai.domain.yang.EsrSystemInfo;
+import org.onap.so.adapters.vnfmadapter.VnfmAdapterUrlProvider;
import org.onap.so.adapters.vnfmadapter.extclients.aai.AaiServiceProvider;
import org.onap.so.adapters.vnfmadapter.extclients.vim.model.AccessInfo;
import org.onap.so.adapters.vnfmadapter.extclients.vim.model.InterfaceInfo;
@@ -47,15 +43,17 @@ import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.SubscriptionsFilte
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.SubscriptionsFilterVnfInstanceSubscriptionFilter;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.VnfInstancesvnfInstanceIdinstantiateExtVirtualLinks;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.VnfInstancesvnfInstanceIdinstantiateVimConnectionInfo;
-import org.onap.so.utils.CryptoUtils;
import org.onap.vnfmadapter.v1.model.CreateVnfRequest;
import org.onap.vnfmadapter.v1.model.ExternalVirtualLink;
import org.onap.vnfmadapter.v1.model.Tenant;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
+import com.google.common.reflect.TypeToken;
+import com.google.gson.Gson;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
/**
* Provides helper methods for interactions with VNFM.
@@ -66,19 +64,13 @@ public class VnfmHelper {
private static final Logger logger = LoggerFactory.getLogger(VnfmHelper.class);
private static final String SEPARATOR = "_";
private final AaiServiceProvider aaiServiceProvider;
-
- @Value("${vnfmadapter.endpoint}")
- private String vnfmAdapterEndoint;
-
- @Value("${vnfmadapter.auth:E39823AAB2739CC654C4E92B52C05BC34149342D0A46451B00CA508C8EDC62242CE4E9DA9445D3C01A3F13}")
- private String vnfmAdapterAuth;
-
- @Value("${mso.key}")
- private String msoEncryptionKey;
+ private final VnfmAdapterUrlProvider vnfmAdapterUrlProvider;
@Autowired
- public VnfmHelper(final AaiServiceProvider aaiServiceProvider) {
+ public VnfmHelper(final AaiServiceProvider aaiServiceProvider,
+ final VnfmAdapterUrlProvider vnfmAdapterUrlProvider) {
this.aaiServiceProvider = aaiServiceProvider;
+ this.vnfmAdapterUrlProvider = vnfmAdapterUrlProvider;
}
/**
@@ -99,11 +91,6 @@ public class VnfmHelper {
return instantiateVnfRequest;
}
- private String getFlavourId() {
- // TODO read from csar
- return "default";
- }
-
private List<VnfInstancesvnfInstanceIdinstantiateVimConnectionInfo> getVimConnectionInfos(final Tenant tenant) {
final List<VnfInstancesvnfInstanceIdinstantiateVimConnectionInfo> connectionInfos = new ArrayList<>();
connectionInfos.add(getVimConnectionInfo(tenant));
@@ -183,7 +170,7 @@ public class VnfmHelper {
throws GeneralSecurityException {
final LccnSubscriptionRequest lccnSubscriptionRequest = new LccnSubscriptionRequest();
lccnSubscriptionRequest.setAuthentication(getSubscriptionsAuthentication());
- lccnSubscriptionRequest.setCallbackUri(vnfmAdapterEndoint + BASE_URL + OPERATION_NOTIFICATION_ENDPOINT);
+ lccnSubscriptionRequest.setCallbackUri(vnfmAdapterUrlProvider.getVnfLcmOperationOccurrenceNotificationUrl());
final SubscriptionsFilter filter = new SubscriptionsFilter();
filter.addNotificationTypesItem(NotificationTypesEnum.VNFLCMOPERATIONOCCURRENCENOTIFICATION);
final SubscriptionsFilterVnfInstanceSubscriptionFilter vnfInstanceSubscriptionFilter =
@@ -197,19 +184,19 @@ public class VnfmHelper {
private SubscriptionsAuthentication getSubscriptionsAuthentication() throws GeneralSecurityException {
final SubscriptionsAuthentication authentication = new SubscriptionsAuthentication();
- final String[] decrypedAuth = CryptoUtils.decrypt(vnfmAdapterAuth, msoEncryptionKey).split(":");
+ final ImmutablePair<String, String> decrypedAuth = vnfmAdapterUrlProvider.getDecryptAuth();
- SubscriptionsAuthenticationParamsOauth2ClientCredentials oauthParams =
+ final SubscriptionsAuthenticationParamsOauth2ClientCredentials oauthParams =
new SubscriptionsAuthenticationParamsOauth2ClientCredentials();
- oauthParams.setTokenEndpoint(vnfmAdapterEndoint + "/oauth/token");
- oauthParams.clientId(decrypedAuth[0]);
- oauthParams.setClientPassword(decrypedAuth[1]);
+ oauthParams.setTokenEndpoint(vnfmAdapterUrlProvider.getOauthTokenUrl());
+ oauthParams.clientId(decrypedAuth.getLeft());
+ oauthParams.setClientPassword(decrypedAuth.getRight());
authentication.addAuthTypeItem(AuthTypeEnum.OAUTH2_CLIENT_CREDENTIALS);
authentication.paramsOauth2ClientCredentials(oauthParams);
final SubscriptionsAuthenticationParamsBasic basicAuthParams = new SubscriptionsAuthenticationParamsBasic();
- basicAuthParams.setUserName(decrypedAuth[0]);
- basicAuthParams.setPassword(decrypedAuth[1]);
+ basicAuthParams.setUserName(decrypedAuth.getLeft());
+ basicAuthParams.setPassword(decrypedAuth.getRight());
authentication.addAuthTypeItem(AuthTypeEnum.BASIC);
authentication.paramsBasic(basicAuthParams);
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmHttpServiceProviderConfiguration.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmHttpServiceProviderConfiguration.java
new file mode 100644
index 0000000000..9ed17e4379
--- /dev/null
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmHttpServiceProviderConfiguration.java
@@ -0,0 +1,49 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Ericsson. 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.adapters.vnfmadapter.extclients.vnfm;
+
+import static org.onap.so.client.RestTemplateConfig.CONFIGURABLE_REST_TEMPLATE;
+import org.onap.so.adapters.vnfmadapter.extclients.AbstractServiceProviderConfiguration;
+import org.onap.so.configuration.rest.BasicHttpHeadersProvider;
+import org.onap.so.rest.service.HttpRestServiceProvider;
+import org.onap.so.rest.service.HttpRestServiceProviderImpl;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.client.RestTemplate;
+
+/**
+ * @author Waqas Ikram (waqas.ikram@est.tech)
+ *
+ */
+@Configuration
+public class VnfmHttpServiceProviderConfiguration extends AbstractServiceProviderConfiguration {
+ public static final String VNFM_ADAPTER_HTTP_SERVICE_PROVIDER_BEAN = "vnfmAdapterHttpServiceProvider";
+
+ @Bean
+ @Qualifier(VNFM_ADAPTER_HTTP_SERVICE_PROVIDER_BEAN)
+ public HttpRestServiceProvider vnfmAdapterHttpRestServiceProvider(
+ @Autowired @Qualifier(CONFIGURABLE_REST_TEMPLATE) RestTemplate restTemplate) {
+ setGsonMessageConverter(restTemplate);
+ return new HttpRestServiceProviderImpl(restTemplate, new BasicHttpHeadersProvider().getHttpHeaders());
+ }
+
+}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderConfiguration.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderConfiguration.java
index 073fc93107..eaaa8d8544 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderConfiguration.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderConfiguration.java
@@ -28,7 +28,6 @@ import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.UnrecoverableKeyException;
import java.security.cert.CertificateException;
-import java.util.ListIterator;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
@@ -40,10 +39,8 @@ import org.apache.http.impl.client.HttpClients;
import org.apache.http.ssl.SSLContextBuilder;
import org.onap.aai.domain.yang.EsrSystemInfo;
import org.onap.aai.domain.yang.EsrVnfm;
-import org.onap.logging.filter.spring.SpringClientPayloadFilter;
import org.onap.so.adapters.vnfmadapter.extclients.AbstractServiceProviderConfiguration;
import org.onap.so.configuration.rest.BasicHttpHeadersProvider;
-import org.onap.so.logging.jaxrs.filter.SOSpringClientFilter;
import org.onap.so.rest.service.HttpRestServiceProvider;
import org.onap.so.rest.service.HttpRestServiceProviderImpl;
import org.slf4j.Logger;
@@ -54,7 +51,6 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.Resource;
import org.springframework.http.client.BufferingClientHttpRequestFactory;
-import org.springframework.http.client.ClientHttpRequestInterceptor;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.security.oauth2.client.OAuth2RestTemplate;
import org.springframework.security.oauth2.client.token.grant.client.ClientCredentialsResourceDetails;
@@ -102,7 +98,7 @@ public class VnfmServiceProviderConfiguration extends AbstractServiceProviderCon
if (trustStore != null) {
setTrustStore(restTemplate);
}
- return new HttpRestServiceProviderImpl(restTemplate, new BasicHttpHeadersProvider());
+ return new HttpRestServiceProviderImpl(restTemplate, new BasicHttpHeadersProvider().getHttpHeaders());
}
private RestTemplate createRestTemplate(final EsrVnfm vnfm) {
@@ -155,14 +151,4 @@ public class VnfmServiceProviderConfiguration extends AbstractServiceProviderCon
}
}
- private void removeSpringClientFilter(final RestTemplate restTemplate) {
- ListIterator<ClientHttpRequestInterceptor> interceptorIterator = restTemplate.getInterceptors().listIterator();
- while (interceptorIterator.hasNext()) {
- ClientHttpRequestInterceptor interceptor = interceptorIterator.next();
- if (interceptor instanceof SOSpringClientFilter || interceptor instanceof SpringClientPayloadFilter) {
- interceptorIterator.remove();
- }
- }
- }
-
}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/AbstractNotificationServiceProvider.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/AbstractNotificationServiceProvider.java
index 86ca59cffe..d6b7ae7201 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/AbstractNotificationServiceProvider.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/AbstractNotificationServiceProvider.java
@@ -19,16 +19,13 @@
*/
package org.onap.so.adapters.vnfmadapter.packagemanagement.subscriptionmanagement;
-import static org.onap.so.client.RestTemplateConfig.CONFIGURABLE_REST_TEMPLATE;
+import static org.onap.so.adapters.vnfmadapter.extclients.vnfm.VnfmHttpServiceProviderConfiguration.VNFM_ADAPTER_HTTP_SERVICE_PROVIDER_BEAN;
import java.nio.charset.StandardCharsets;
import org.apache.commons.codec.binary.Base64;
import org.onap.so.configuration.rest.BasicHttpHeadersProvider;
-import org.onap.so.configuration.rest.HttpHeadersProvider;
import org.onap.so.rest.service.HttpRestServiceProvider;
-import org.onap.so.rest.service.HttpRestServiceProviderImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
-import org.springframework.web.client.RestTemplate;
/**
* A base class that can be extended by classes for providing notification services. Provides common methods that will
@@ -40,12 +37,10 @@ import org.springframework.web.client.RestTemplate;
public abstract class AbstractNotificationServiceProvider {
@Autowired
- @Qualifier(CONFIGURABLE_REST_TEMPLATE)
- private RestTemplate restTemplate;
+ @Qualifier(VNFM_ADAPTER_HTTP_SERVICE_PROVIDER_BEAN)
+ private HttpRestServiceProvider httpRestServiceProvider;
- protected HttpRestServiceProvider getHttpRestServiceProvider(final HttpHeadersProvider httpHeadersProvider) {
- final HttpRestServiceProvider httpRestServiceProvider =
- new HttpRestServiceProviderImpl(restTemplate, httpHeadersProvider);
+ protected HttpRestServiceProvider getHttpRestServiceProvider() {
return httpRestServiceProvider;
}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/BasicAuthNotificationServiceProvider.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/BasicAuthNotificationServiceProvider.java
index 6f9d94e9de..cf0cdb085a 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/BasicAuthNotificationServiceProvider.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/BasicAuthNotificationServiceProvider.java
@@ -47,10 +47,10 @@ public class BasicAuthNotificationServiceProvider extends AbstractNotificationSe
final HttpHeadersProvider httpHeadersProvider =
getBasicHttpHeadersProviderWithBasicAuth(subscriptionsAuthentication.getParamsBasic().getUserName(),
subscriptionsAuthentication.getParamsBasic().getPassword());
- final HttpRestServiceProvider httpRestServiceProvider = getHttpRestServiceProvider(httpHeadersProvider);
+ final HttpRestServiceProvider httpRestServiceProvider = getHttpRestServiceProvider();
- final ResponseEntity<Void> responseEntity =
- httpRestServiceProvider.postHttpRequest(notification, callbackUri, Void.class);
+ final ResponseEntity<Void> responseEntity = httpRestServiceProvider.postHttpRequest(notification, callbackUri,
+ httpHeadersProvider.getHttpHeaders(), Void.class);
if (responseEntity.getStatusCode().is2xxSuccessful()) {
logger.info("Notification sent successfully.");
return true;
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/OAuthNotificationServiceProvider.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/OAuthNotificationServiceProvider.java
index 496fb083cf..c065203cd8 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/OAuthNotificationServiceProvider.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/OAuthNotificationServiceProvider.java
@@ -48,13 +48,14 @@ public class OAuthNotificationServiceProvider extends AbstractNotificationServic
final String token = getAccessToken(subscriptionsAuthentication);
if (token == null) {
+ logger.error("Failed to get access token");
return false;
}
final HttpHeadersProvider httpHeadersProvider = getHttpHeadersProvider(token);
- final HttpRestServiceProvider httpRestServiceProvider = getHttpRestServiceProvider(httpHeadersProvider);
- final ResponseEntity<Void> responseEntity =
- httpRestServiceProvider.postHttpRequest(notification, callbackUri, Void.class);
+ final HttpRestServiceProvider httpRestServiceProvider = getHttpRestServiceProvider();
+ final ResponseEntity<Void> responseEntity = httpRestServiceProvider.postHttpRequest(notification, callbackUri,
+ httpHeadersProvider.getHttpHeaders(), Void.class);
if (responseEntity.getStatusCode().is2xxSuccessful()) {
logger.info("Notification sent successfully.");
return true;
@@ -83,9 +84,9 @@ public class OAuthNotificationServiceProvider extends AbstractNotificationServic
subscriptionsAuthentication.getParamsOauth2ClientCredentials().getClientId(),
subscriptionsAuthentication.getParamsOauth2ClientCredentials().getClientPassword());
- final HttpRestServiceProvider httpRestServiceProvider = getHttpRestServiceProvider(httpHeadersProvider);
- final ResponseEntity<OAuthTokenResponse> responseEntity =
- httpRestServiceProvider.postHttpRequest(null, tokenEndpoint, OAuthTokenResponse.class);
+ final HttpRestServiceProvider httpRestServiceProvider = getHttpRestServiceProvider();
+ final ResponseEntity<OAuthTokenResponse> responseEntity = httpRestServiceProvider.postHttpRequest(null,
+ tokenEndpoint, httpHeadersProvider.getHttpHeaders(), OAuthTokenResponse.class);
if (responseEntity.getStatusCode().is2xxSuccessful()) {
if (responseEntity.getBody() != null) {
logger.info("Returning Access Token.");
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/SubscriptionManager.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/SubscriptionManager.java
index a23eb6c3e3..a63e14c899 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/SubscriptionManager.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/SubscriptionManager.java
@@ -29,7 +29,8 @@ import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
-import org.onap.so.adapters.vnfmadapter.Constants;
+import org.apache.commons.lang3.tuple.ImmutablePair;
+import org.onap.so.adapters.vnfmadapter.VnfmAdapterUrlProvider;
import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.EtsiCatalogServiceProvider;
import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.BasicAuth;
import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.NsdmSubscription;
@@ -42,10 +43,8 @@ import org.onap.so.adapters.vnfmadapter.packagemanagement.subscriptionmanagement
import org.onap.so.adapters.vnfmadapter.rest.exceptions.ConversionFailedException;
import org.onap.so.adapters.vnfmadapter.rest.exceptions.InternalServerErrorException;
import org.onap.so.adapters.vnfmadapter.rest.exceptions.SubscriptionNotFoundException;
-import org.onap.so.utils.CryptoUtils;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.convert.ConversionService;
import org.springframework.stereotype.Service;
@@ -62,22 +61,16 @@ public class SubscriptionManager {
private final PackageManagementCacheServiceProvider packageManagementCacheServiceProvider;
private final ConversionService conversionService;
private final EtsiCatalogServiceProvider etsiCatalogServiceProvider;
- private final String vnfmAdapterEndpoint;
- private final String msoKeyString;
- private final String vnfmAdapterAuth;
+ private final VnfmAdapterUrlProvider vnfmAdapterUrlProvider;
@Autowired
public SubscriptionManager(final PackageManagementCacheServiceProvider packageManagementCacheServiceProvider,
final ConversionService conversionService, final EtsiCatalogServiceProvider etsiCatalogServiceProvider,
- @Value("${vnfmadapter.endpoint}") final String vnfmAdapterEndpoint,
- @Value("${mso.key}") final String msoKeyString,
- @Value("${vnfmadapter.auth:BF29BA36F0CFE1C05507781F6B97EFBCA7EFAC9F595954D465FC43F646883EF585C20A58CBB02528A6FAAC}") final String vnfmAdapterAuth) {
+ final VnfmAdapterUrlProvider vnfmAdapterUrlProvider) {
this.packageManagementCacheServiceProvider = packageManagementCacheServiceProvider;
this.conversionService = conversionService;
this.etsiCatalogServiceProvider = etsiCatalogServiceProvider;
- this.vnfmAdapterEndpoint = vnfmAdapterEndpoint;
- this.vnfmAdapterAuth = vnfmAdapterAuth;
- this.msoKeyString = msoKeyString;
+ this.vnfmAdapterUrlProvider = vnfmAdapterUrlProvider;
}
public Optional<InlineResponse201> createSubscription(final PkgmSubscriptionRequest pkgmSubscriptionRequest)
@@ -100,7 +93,7 @@ public class SubscriptionManager {
final InlineResponse201 response = new InlineResponse201();
response.setId(subscriptionId);
response.setFilter(pkgmSubscriptionRequest.getFilter());
- response.setCallbackUri(getSubscriptionUri(subscriptionId).toString());
+ response.setCallbackUri(vnfmAdapterUrlProvider.getSubscriptionUriString(subscriptionId));
response.setLinks(new SubscriptionsLinks()
.self(new VnfPackagesLinksSelf().href(getSubscriptionUri(subscriptionId).toString())));
@@ -167,8 +160,7 @@ public class SubscriptionManager {
}
public URI getSubscriptionUri(final String subscriptionId) {
- return URI.create(
- vnfmAdapterEndpoint + Constants.PACKAGE_MANAGEMENT_BASE_URL + "/subscriptions/" + subscriptionId);
+ return vnfmAdapterUrlProvider.getSubscriptionUri(subscriptionId);
}
public Optional<PkgmSubscriptionRequest> getSubscriptionRequest(final String subscriptionId) {
@@ -199,25 +191,19 @@ public class SubscriptionManager {
if (etsiCatalogManagerSubscriptionRequest != null) {
etsiCatalogManagerSubscriptionRequest
- .setCallbackUri(vnfmAdapterEndpoint + Constants.ETSI_SUBSCRIPTION_NOTIFICATION_BASE_URL);
-
- final String[] auth = decryptAuth();
- final String username = auth[0];
- final String password = auth[1];
-
- etsiCatalogManagerSubscriptionRequest.setAuthentication(
- new org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.SubscriptionAuthentication()
- .addAuthTypeItem(BASIC).paramsBasic(new BasicAuth().userName(username).password(password)));
+ .setCallbackUri(vnfmAdapterUrlProvider.getEtsiSubscriptionNotificationBaseUrl());
+
+ final ImmutablePair<String, String> immutablePair = vnfmAdapterUrlProvider.getDecryptAuth();
+ if (!immutablePair.equals(ImmutablePair.nullPair())) {
+ etsiCatalogManagerSubscriptionRequest.setAuthentication(
+ new org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.SubscriptionAuthentication()
+ .addAuthTypeItem(BASIC).paramsBasic(new BasicAuth().userName(immutablePair.getLeft())
+ .password(immutablePair.getRight())));
+ }
return etsiCatalogManagerSubscriptionRequest;
}
throw new ConversionFailedException(
"Failed to convert Sol003 PkgmSubscriptionRequest to ETSI-Catalog Manager PkgmSubscriptionRequest");
}
- private String[] decryptAuth() throws GeneralSecurityException {
- final String decryptedAuth = CryptoUtils.decrypt(vnfmAdapterAuth, msoKeyString);
- final String[] auth = decryptedAuth.split(":");
- return auth;
- }
-
}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementController.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementController.java
index f1d20c65ef..6d067902c5 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementController.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementController.java
@@ -170,8 +170,6 @@ public class Sol003PackageManagementController {
+ " Sol003PackageManagementController from the EtsiCatalogManager using the\n GET \"vnf_packages\" by vnfPkgId: \""
+ vnfPkgId + "\" for artifactPath: \"" + artifactPath + "\"\n" + "endpoint.";
logger.error(errorMessage);
- // return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(new
- // ProblemDetails().detail(errorMessage));
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(new ProblemDetails().detail(errorMessage));
}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/EtsiSubscriptionNotificationControllerTest.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/EtsiSubscriptionNotificationControllerTest.java
index 322251e753..29afa8c549 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/EtsiSubscriptionNotificationControllerTest.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/EtsiSubscriptionNotificationControllerTest.java
@@ -278,7 +278,7 @@ public class EtsiSubscriptionNotificationControllerTest {
mockRestServer.expect(requestTo(CALLBACK_URI)).andExpect(method(HttpMethod.POST))
.andExpect(jsonPath("$.id").value(NOTIFICATION_ID))
.andExpect(jsonPath("$.notificationType").value(
- VnfPackageChangeNotification.NotificationTypeEnum.VNFPACKAGECHANGENOTIFICATION.toString()))
+ VnfPackageChangeNotification.NotificationTypeEnum.VNFPACKAGECHANGENOTIFICATION.getValue()))
.andExpect(jsonPath("$.subscriptionId").value(SUBSCRIPTION_ID))
.andExpect(jsonPath("$.timeStamp").value(TIMESTAMP.toString()))
.andExpect(jsonPath("$.vnfPkgId").value(VNFPKG_ID.toString()))
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementControllerTest.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementControllerTest.java
index c5194cf27e..be8b0c2e0b 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementControllerTest.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementControllerTest.java
@@ -25,7 +25,7 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.onap.so.adapters.vnfmadapter.Constants.PACKAGE_MANAGEMENT_BASE_URL;
-import static org.onap.so.client.RestTemplateConfig.CONFIGURABLE_REST_TEMPLATE;
+import static org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.EtsiCatalogServiceProviderConfiguration.ETSI_CATALOG_REST_TEMPLATE_BEAN;
import static org.springframework.test.web.client.match.MockRestRequestMatchers.method;
import static org.springframework.test.web.client.match.MockRestRequestMatchers.requestTo;
import static org.springframework.test.web.client.response.MockRestResponseCreators.withStatus;
@@ -45,6 +45,7 @@ import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.VnfPackageA
import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.VnfPackageSoftwareImageInfo;
import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.VnfPkgInfo;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.InlineResponse2001;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.VnfPackagesLinks;
import org.onap.so.configuration.rest.BasicHttpHeadersProvider;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
@@ -74,11 +75,11 @@ public class Sol003PackageManagementControllerTest {
private int port;
@Autowired
- @Qualifier(CONFIGURABLE_REST_TEMPLATE)
- private RestTemplate testRestTemplate;
+ @Qualifier(ETSI_CATALOG_REST_TEMPLATE_BEAN)
+ private RestTemplate restTemplate;
@Autowired
- private TestRestTemplate restTemplate;
+ private TestRestTemplate testRestTemplate;
private static final String VNF_PACKAGE_ID = "myVnfPackageId";
private static final String ARTIFACT_PATH = "myArtifactPath";
@@ -94,7 +95,11 @@ public class Sol003PackageManagementControllerTest {
private static final String VNFD_VERSION = "vnfdVersion";
private static final String ALGORITHM = "algorithm";
private static final String HASH = "hash";
- private static final String URI_HREF = "uriHref";
+ private static final String EXPECTED_BASE_URL =
+ "https://so-vnfm-adapter.onap:30406/so/vnfm-adapter/v1/vnfpkgm/v1/vnf_packages/";
+ private static final String EXPECTED_SELF_HREF = EXPECTED_BASE_URL + VNF_PACKAGE_ID;
+ private static final String EXPECTED_VNFD_HREF = EXPECTED_BASE_URL + VNF_PACKAGE_ID + "/vnfd";
+ private static final String EXPECTED_PACKAGE_CONTENT_HREF = EXPECTED_BASE_URL + VNF_PACKAGE_ID + "/package_content";
private MockRestServiceServer mockRestServer;
private BasicHttpHeadersProvider basicHttpHeadersProvider;
@@ -104,8 +109,7 @@ public class Sol003PackageManagementControllerTest {
@Before
public void setUp() {
- final MockRestServiceServer.MockRestServiceServerBuilder builder =
- MockRestServiceServer.bindTo(testRestTemplate);
+ final MockRestServiceServer.MockRestServiceServerBuilder builder = MockRestServiceServer.bindTo(restTemplate);
builder.ignoreExpectOrder(true);
mockRestServer = builder.build();
basicHttpHeadersProvider = new BasicHttpHeadersProvider();
@@ -123,7 +127,7 @@ public class Sol003PackageManagementControllerTest {
+ VNF_PACKAGE_ID + "/package_content";
final HttpEntity<?> request = new HttpEntity<>(basicHttpHeadersProvider.getHttpHeaders());
final ResponseEntity<byte[]> responseEntity =
- restTemplate.withBasicAuth("test", "test").exchange(testURL, HttpMethod.GET, request, byte[].class);
+ testRestTemplate.withBasicAuth("test", "test").exchange(testURL, HttpMethod.GET, request, byte[].class);
assertEquals(byte[].class, responseEntity.getBody().getClass());
assertArrayEquals(responseEntity.getBody(), responseArray);
@@ -164,7 +168,7 @@ public class Sol003PackageManagementControllerTest {
final ResponseEntity<ProblemDetails> responseEntity =
- restTemplate.exchange(testURL, HttpMethod.GET, request, ProblemDetails.class);
+ testRestTemplate.exchange(testURL, HttpMethod.GET, request, ProblemDetails.class);
assertTrue(responseEntity.getBody() instanceof ProblemDetails);
assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, responseEntity.getStatusCode());
@@ -226,7 +230,7 @@ public class Sol003PackageManagementControllerTest {
+ VNF_PACKAGE_ID + "/artifacts/" + ARTIFACT_PATH;
final HttpEntity<?> request = new HttpEntity<>(basicHttpHeadersProvider.getHttpHeaders());
final ResponseEntity<byte[]> responseEntity =
- restTemplate.withBasicAuth("test", "test").exchange(testURL, HttpMethod.GET, request, byte[].class);
+ testRestTemplate.withBasicAuth("test", "test").exchange(testURL, HttpMethod.GET, request, byte[].class);
assertEquals(byte[].class, responseEntity.getBody().getClass());
assertArrayEquals(responseEntity.getBody(), responseArray);
@@ -267,7 +271,7 @@ public class Sol003PackageManagementControllerTest {
final HttpEntity<?> request = new HttpEntity<>(basicHttpHeadersProvider.getHttpHeaders());
final ResponseEntity<ProblemDetails> responseEntity =
- restTemplate.exchange(testURL, HttpMethod.GET, request, ProblemDetails.class);
+ testRestTemplate.exchange(testURL, HttpMethod.GET, request, ProblemDetails.class);
assertNotNull(responseEntity.getBody());
assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, responseEntity.getStatusCode());
@@ -331,7 +335,7 @@ public class Sol003PackageManagementControllerTest {
final String testURL = localhostUrl + port + VNFPKGM_BASE_URL;
final HttpEntity<?> request = new HttpEntity<>(basicHttpHeadersProvider.getHttpHeaders());
- final ResponseEntity<InlineResponse2001[]> responseEntity = restTemplate.withBasicAuth("test", "test")
+ final ResponseEntity<InlineResponse2001[]> responseEntity = testRestTemplate.withBasicAuth("test", "test")
.exchange(testURL, HttpMethod.GET, request, InlineResponse2001[].class);
assertEquals(HttpStatus.OK, responseEntity.getStatusCode());
@@ -347,7 +351,11 @@ public class Sol003PackageManagementControllerTest {
assertEquals(ARTIFACT_PATH, inlineResponse2001.getAdditionalArtifacts().get(0).getArtifactPath());
assertEquals(ALGORITHM, inlineResponse2001.getAdditionalArtifacts().get(0).getChecksum().getAlgorithm());
assertEquals(HASH, inlineResponse2001.getAdditionalArtifacts().get(0).getChecksum().getHash());
- assertEquals(URI_HREF, inlineResponse2001.getLinks().getSelf().getHref());
+ final VnfPackagesLinks links = inlineResponse2001.getLinks();
+ assertNotNull(links);
+ assertEquals(EXPECTED_SELF_HREF, links.getSelf().getHref());
+ assertEquals(EXPECTED_VNFD_HREF, links.getVnfd().getHref());
+ assertEquals(EXPECTED_PACKAGE_CONTENT_HREF, links.getPackageContent().getHref());
}
@Test
@@ -412,7 +420,7 @@ public class Sol003PackageManagementControllerTest {
final String testURL = localhostUrl + port + VNFPKGM_BASE_URL + "/" + VNF_PACKAGE_ID;
final HttpEntity<?> request = new HttpEntity<>(basicHttpHeadersProvider.getHttpHeaders());
- final ResponseEntity<InlineResponse2001> responseEntity = restTemplate.withBasicAuth("test", "test")
+ final ResponseEntity<InlineResponse2001> responseEntity = testRestTemplate.withBasicAuth("test", "test")
.exchange(testURL, HttpMethod.GET, request, InlineResponse2001.class);
assertEquals(HttpStatus.OK, responseEntity.getStatusCode());
@@ -427,7 +435,12 @@ public class Sol003PackageManagementControllerTest {
assertEquals(ARTIFACT_PATH, inlineResponse2001.getAdditionalArtifacts().get(0).getArtifactPath());
assertEquals(ALGORITHM, inlineResponse2001.getAdditionalArtifacts().get(0).getChecksum().getAlgorithm());
assertEquals(HASH, inlineResponse2001.getAdditionalArtifacts().get(0).getChecksum().getHash());
- assertEquals(URI_HREF, inlineResponse2001.getLinks().getSelf().getHref());
+ final VnfPackagesLinks links = inlineResponse2001.getLinks();
+ assertNotNull(links);
+ assertEquals(EXPECTED_SELF_HREF, links.getSelf().getHref());
+ assertEquals(EXPECTED_VNFD_HREF, links.getVnfd().getHref());
+ assertEquals(EXPECTED_PACKAGE_CONTENT_HREF, links.getPackageContent().getHref());
+
}
@Test
@@ -484,7 +497,8 @@ public class Sol003PackageManagementControllerTest {
+ VNF_PACKAGE_ID + "\" \n" + "endpoint.", problemDetails.getDetail());
}
- // The below test method is here to improve code coverage and provide a foundation for writing future tests
+ // The below test method is here to improve code coverage and provide a foundation for writing
+ // future tests
@Test
public void testGetPackageVnfd_ValidArray_Success() {
final byte[] responseArray = buildByteArrayWithRandomData(10);
@@ -497,7 +511,7 @@ public class Sol003PackageManagementControllerTest {
"http://localhost:" + port + PACKAGE_MANAGEMENT_BASE_URL + "/vnf_packages/" + VNF_PACKAGE_ID + "/vnfd";
final HttpEntity<?> request = new HttpEntity<>(basicHttpHeadersProvider.getHttpHeaders());
final ResponseEntity<byte[]> responseEntity =
- restTemplate.withBasicAuth("test", "test").exchange(testURL, HttpMethod.GET, request, byte[].class);
+ testRestTemplate.withBasicAuth("test", "test").exchange(testURL, HttpMethod.GET, request, byte[].class);
assertEquals(byte[].class, responseEntity.getBody().getClass());
assertArrayEquals(responseEntity.getBody(), responseArray);
@@ -592,7 +606,7 @@ public class Sol003PackageManagementControllerTest {
private ResponseEntity<ProblemDetails> sendHttpRequest(final String url) {
final String testURL = localhostUrl + port + VNFPKGM_BASE_URL + "/" + url;
final HttpEntity<?> request = new HttpEntity<>(basicHttpHeadersProvider.getHttpHeaders());
- return restTemplate.withBasicAuth("test", "test").exchange(testURL, HttpMethod.GET, request,
+ return testRestTemplate.withBasicAuth("test", "test").exchange(testURL, HttpMethod.GET, request,
ProblemDetails.class);
}
@@ -648,8 +662,10 @@ public class Sol003PackageManagementControllerTest {
}
private VNFPKGMLinkSerializer createVNFPKGMLinkSerializerLinks() {
- final UriLink uriLink = new UriLink().href(URI_HREF);
- final VNFPKGMLinkSerializer vnfpkgmLinkSerializer = new VNFPKGMLinkSerializer().self(uriLink);
- return vnfpkgmLinkSerializer;
+ final String baseUrl = "http://msb-iag:443/api/vnfpkgm/v1/vnf_packages";
+ return new VNFPKGMLinkSerializer().self(new UriLink().href(baseUrl + "/myVnfPackageId"))
+ .vnfd(new UriLink().href(baseUrl + "/myVnfPackageId/vnfd"))
+ .packageContent(new UriLink().href(baseUrl + "/myVnfPackageId/package_content"));
}
+
}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementSubscriptionControllerTest.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementSubscriptionControllerTest.java
index a2828b1f9f..c269af8e68 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementSubscriptionControllerTest.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementSubscriptionControllerTest.java
@@ -28,7 +28,7 @@ import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.onap.so.adapters.vnfmadapter.Constants.PACKAGE_MANAGEMENT_BASE_URL;
-import static org.onap.so.client.RestTemplateConfig.CONFIGURABLE_REST_TEMPLATE;
+import static org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.EtsiCatalogServiceProviderConfiguration.ETSI_CATALOG_REST_TEMPLATE_BEAN;
import static org.springframework.test.web.client.match.MockRestRequestMatchers.method;
import static org.springframework.test.web.client.match.MockRestRequestMatchers.requestTo;
import static org.springframework.test.web.client.response.MockRestResponseCreators.withStatus;
@@ -102,7 +102,7 @@ public class Sol003PackageManagementSubscriptionControllerTest {
private static final String LOCALHOST_URL = "http://localhost:";
@Autowired
- @Qualifier(CONFIGURABLE_REST_TEMPLATE)
+ @Qualifier(ETSI_CATALOG_REST_TEMPLATE_BEAN)
private RestTemplate restTemplate;
private MockRestServiceServer mockRestServiceServer;
@Autowired
diff --git a/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/client/beans/ConfigurationParameters.java b/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/client/beans/ConfigurationParameters.java
index b065e9a0c3..e5321067ac 100644
--- a/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/client/beans/ConfigurationParameters.java
+++ b/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/client/beans/ConfigurationParameters.java
@@ -1,5 +1,10 @@
package org.onap.so.adapters.appc.orchestrator.client.beans;
+import java.util.HashMap;
+import java.util.Map;
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -14,6 +19,8 @@ public class ConfigurationParameters {
private String nodeList;
@JsonProperty("file_parameter_content")
private String fileParameterContent;
+ @JsonIgnore
+ private Map<String, String> additionalProperties = new HashMap<>();
@JsonProperty("vnf_name")
@@ -50,4 +57,18 @@ public class ConfigurationParameters {
this.fileParameterContent = fileParameterContent;
}
+ @JsonAnyGetter
+ public Map<String, String> getAdditionalProperties() {
+ return this.additionalProperties;
+ }
+
+ @JsonAnySetter
+ public void setAdditionalProperty(String name, String value) {
+ this.additionalProperties.put(name, value);
+ }
+
+ public void setAdditionalProperties(Map<String, String> map) {
+ this.additionalProperties = map;
+ }
+
}
diff --git a/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTask.java b/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTask.java
index db70a6b5cb..2b5e4b2553 100644
--- a/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTask.java
+++ b/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTask.java
@@ -6,7 +6,7 @@ import org.onap.so.adapters.appc.orchestrator.client.ApplicationControllerCallba
import org.onap.so.adapters.appc.orchestrator.client.ApplicationControllerSupport;
import org.onap.so.adapters.appc.orchestrator.client.StatusCategory;
import org.onap.so.appc.orchestrator.service.beans.ApplicationControllerTaskRequest;
-import org.onap.so.externaltasks.logging.AuditMDCSetup;
+import org.onap.so.logging.tasks.AuditMDCSetup;
import org.onap.so.utils.ExternalTaskUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImpl.java b/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImpl.java
index a174ccb05a..99d6b4dc12 100644
--- a/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImpl.java
+++ b/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImpl.java
@@ -32,10 +32,10 @@ public class ApplicationControllerTaskImpl {
Optional<String> vserverId = Optional.empty();
Parameters parameters = new Parameters();
ConfigurationParameters configParams = new ConfigurationParameters();
+ RequestParameters requestParams = new RequestParameters();
switch (request.getAction()) {
case HealthCheck:
- RequestParameters requestParams = new RequestParameters();
requestParams.setHostIpAddress(request.getApplicationControllerVnf().getVnfHostIpAddress());
parameters.setRequestParameters(requestParams);
payload = Optional.of((mapper.getMapper().writeValueAsString(parameters)));
@@ -75,6 +75,12 @@ public class ApplicationControllerTaskImpl {
payload = Optional.of((mapper.getMapper().writeValueAsString(parameters)));
break;
case ConfigModify:
+ requestParams.setHostIpAddress(request.getApplicationControllerVnf().getVnfHostIpAddress());
+ configParams.setAdditionalProperties(request.getConfigParams());
+ parameters.setRequestParameters(requestParams);
+ parameters.setConfigurationParameters(configParams);
+ payload = Optional.of((mapper.getMapper().writeValueAsString(parameters)));
+ break;
case ConfigScaleOut:
break;
case UpgradePreCheck:
@@ -97,6 +103,7 @@ public class ApplicationControllerTaskImpl {
vserverId = Optional
.of(request.getApplicationControllerVnf().getApplicationControllerVm().getVserverId());
}
+ break;
default:
// errorMessage = "Unable to idenify Action request for AppCClient";
break;
diff --git a/adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImplTest.java b/adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImplTest.java
index 640e2dbd6e..973430c37e 100644
--- a/adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImplTest.java
+++ b/adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImplTest.java
@@ -1,5 +1,7 @@
package org.onap.so.adapters.appc.orchestrator.service;
+import java.util.HashMap;
+import java.util.Map;
import java.util.Optional;
import org.junit.Before;
import org.junit.Test;
@@ -50,6 +52,10 @@ public class ApplicationControllerTaskImplTest {
request.setNewSoftwareVersion("2.0");
request.setExistingSoftwareVersion("1.0");
request.setOperationsTimeout("30");
+ Map<String, String> reqConfigParams = new HashMap<>();
+ reqConfigParams.put("name1", "value1");
+ reqConfigParams.put("name2", "value2");
+ request.setConfigParams(reqConfigParams);
ApplicationControllerVnf applicationControllerVnf = new ApplicationControllerVnf();
applicationControllerVnf.setVnfHostIpAddress("100.100");
applicationControllerVnf.setVnfId("testVnfId");
@@ -228,6 +234,33 @@ public class ApplicationControllerTaskImplTest {
}
@Test
+ public void testExcute_configModify() throws JsonProcessingException, ApplicationControllerOrchestratorException {
+ request.setAction(Action.ConfigModify);
+
+ Parameters parameters = new Parameters();
+ RequestParameters requestParams = new RequestParameters();
+ requestParams.setHostIpAddress(request.getApplicationControllerVnf().getVnfHostIpAddress());
+ parameters.setRequestParameters(requestParams);
+ ConfigurationParameters configParams = new ConfigurationParameters();
+ Map<String, String> configParamMap = new HashMap<>();
+ configParamMap.put("name1", "value1");
+ configParamMap.put("name2", "value2");
+ configParams.setAdditionalProperties(configParamMap);
+ parameters.setConfigurationParameters(configParams);
+ Optional<String> payload = Optional.of((mapper.getMapper().writeValueAsString(parameters)));
+
+ Mockito.when(applicationControllerClient.vnfCommand(request.getAction(), "testRequestId",
+ request.getApplicationControllerVnf().getVnfId(), Optional.empty(), payload, "testControllerType",
+ listener)).thenReturn(new Status());
+
+ Status status = applicationControllerTaskImpl.execute("testRequestId", request, listener);
+
+ Mockito.verify(applicationControllerClient).vnfCommand(request.getAction(), "testRequestId",
+ request.getApplicationControllerVnf().getVnfId(), Optional.empty(), payload, "testControllerType",
+ listener);
+ }
+
+ @Test
public void testListener() throws Exception {
request.setAction(Action.QuiesceTraffic);
Status status = applicationControllerTaskImpl.execute("testRequestId", request, listener);
diff --git a/adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskTest.java b/adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskTest.java
index 228ee90107..179bdabc6b 100644
--- a/adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskTest.java
+++ b/adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskTest.java
@@ -31,9 +31,9 @@ import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
-import org.onap.so.externaltasks.logging.AuditMDCSetup;
import org.onap.so.adapters.appc.orchestrator.client.ApplicationControllerCallback;
import org.onap.so.appc.orchestrator.service.beans.ApplicationControllerTaskRequest;
+import org.onap.so.logging.tasks.AuditMDCSetup;
import org.onap.appc.client.lcm.model.Status;
public class ApplicationControllerTaskTest extends ApplicationControllerTask {
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 423c1a7ed6..d023df3b79 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
@@ -216,9 +216,6 @@ public class ToscaResourceInstaller {
protected PnfCustomizationRepository pnfCustomizationRepository;
@Autowired
- protected ServiceInfoRepository serviceInfoRepository;
-
- @Autowired
protected WorkflowResource workflowResource;
@Autowired
@@ -393,7 +390,7 @@ public class ToscaResourceInstaller {
createToscaCsar(toscaResourceStruct);
createService(toscaResourceStruct, vfResourceStruct);
Service service = toscaResourceStruct.getCatalogService();
- ServiceInfo serviceInfo = createServiceInfo(toscaResourceStruct, service);
+ createServiceInfo(toscaResourceStruct, service);
List<IEntityDetails> vfEntityList = getEntityDetails(toscaResourceStruct,
EntityQuery.newBuilder(SdcTypes.VF), TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE), false);
@@ -423,9 +420,8 @@ public class ToscaResourceInstaller {
processServiceProxyAndConfiguration(toscaResourceStruct, service);
logger.info("Saving Service: {} ", service.getModelName());
- ServiceInfo serviceResult = serviceInfoRepository.save(serviceInfo);
- Service resultService = serviceResult.getService();
- correlateConfigCustomResources(resultService);
+ service = serviceRepo.save(service);
+ correlateConfigCustomResources(service);
workflowResource.processWorkflows(vfResourceStructure);
@@ -1381,6 +1377,7 @@ public class ToscaResourceInstaller {
service.setServiceType(serviceMetadata.getValue("serviceType"));
service.setServiceRole(serviceMetadata.getValue("serviceRole"));
+ service.setServiceFunction(serviceMetadata.getValue("serviceFunction"));
service.setCategory(serviceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_CATEGORY));
service.setDescription(serviceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
@@ -2039,7 +2036,7 @@ public class ToscaResourceInstaller {
// ******************************************************************************************************************
List<CvnfcConfigurationCustomization> cvnfcConfigurationCustomizations = new ArrayList<>();
- Set<CvnfcCustomization> cvnfcCustomizations = new HashSet<>();
+ List<CvnfcCustomization> cvnfcCustomizations = new ArrayList<>();
Set<VnfcCustomization> vnfcCustomizations = new HashSet<>();
// Only set the CVNFC if this vfModule group is a member of it.
@@ -2902,9 +2899,9 @@ public class ToscaResourceInstaller {
createToscaCsar(toscaResourceStruct);
createService(toscaResourceStruct, vfResourceStruct);
Service service = toscaResourceStruct.getCatalogService();
- ServiceInfo serviceInfo = createServiceInfo(toscaResourceStruct, service);
+ createServiceInfo(toscaResourceStruct, service);
createServiceArtifact(service, vfResourceStruct, artifactContent);
- serviceInfoRepository.save(serviceInfo);
+ serviceRepo.save(service);
}
private void createServiceArtifact(Service service, VfResourceStructure vfResourceStruct, String artifactContent) {
@@ -2927,16 +2924,19 @@ public class ToscaResourceInstaller {
service.setServiceArtifactList(serviceArtifactList);
}
- private ServiceInfo createServiceInfo(ToscaResourceStructure toscaResourceStruct, Service service) {
+ private void createServiceInfo(ToscaResourceStructure toscaResourceStruct, Service service) {
+ List<ServiceInfo> serviceInfos = new ArrayList<>();
+
ServiceInfo serviceInfo = new ServiceInfo();
String serviceInput = getServiceInput(toscaResourceStruct);
serviceInfo.setServiceInput(serviceInput);
String serviceProperties = getServiceProperties(toscaResourceStruct);
serviceInfo.setServiceProperties(serviceProperties);
-
serviceInfo.setService(service);
- return serviceInfo;
+ serviceInfos.add(serviceInfo);
+
+ service.setServiceInfos(serviceInfos);
}
private String getServiceProperties(ToscaResourceStructure toscaResourceStruct) {
diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java
index b8a2d01b49..e4882119ab 100644
--- a/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java
@@ -343,7 +343,6 @@ public class ToscaResourceInstallerTest extends BaseTest {
doReturn(resourceCustomizationUUID).when(metadata).getValue("vfModuleModelCustomizationUUID");
ServiceRepository serviceRepo = spy(ServiceRepository.class);
- ServiceInfoRepository serviceInfoRepo = spy(ServiceInfoRepository.class);
VnfResourceRepository vnfRepo = spy(VnfResourceRepository.class);
doReturn(null).when(vnfRepo).findResourceByModelUUID(uuid);
@@ -354,7 +353,6 @@ public class ToscaResourceInstallerTest extends BaseTest {
WorkflowResource workflowResource = spy(WorkflowResource.class);
ReflectionTestUtils.setField(toscaInstaller, "serviceRepo", serviceRepo);
- ReflectionTestUtils.setField(toscaInstaller, "serviceInfoRepository", serviceInfoRepo);
ReflectionTestUtils.setField(toscaInstaller, "vnfRepo", vnfRepo);
ReflectionTestUtils.setField(toscaInstaller, "vfModuleRepo", vfModuleRepo);
ReflectionTestUtils.setField(toscaInstaller, "instanceGroupRepo", instanceGroupRepo);
@@ -425,10 +423,7 @@ public class ToscaResourceInstallerTest extends BaseTest {
assertNotNull(service);
service.setModelVersion("1.0");
- ServiceInfo serviceInfo = new ServiceInfo();
- serviceInfo.setService(service);
doReturn(service).when(serviceRepo).save(service);
- doReturn(serviceInfo).when(serviceInfoRepo).save(any(ServiceInfo.class));
WatchdogComponentDistributionStatusRepository watchdogCDStatusRepository =
spy(WatchdogComponentDistributionStatusRepository.class);
diff --git a/asdc-controller/src/test/resources/schema.sql b/asdc-controller/src/test/resources/schema.sql
index d051d1a56c..f94f74da97 100644
--- a/asdc-controller/src/test/resources/schema.sql
+++ b/asdc-controller/src/test/resources/schema.sql
@@ -804,6 +804,7 @@ CREATE TABLE `service` (
`TOSCA_CSAR_ARTIFACT_UUID` varchar(200) DEFAULT NULL,
`SERVICE_TYPE` varchar(200) DEFAULT NULL,
`SERVICE_ROLE` varchar(200) DEFAULT NULL,
+ `SERVICE_FUNCTION` varchar(200) DEFAULT NULL,
`ENVIRONMENT_CONTEXT` varchar(200) DEFAULT NULL,
`WORKLOAD_CONTEXT` varchar(200) DEFAULT NULL,
`SERVICE_CATEGORY` varchar(200) DEFAULT NULL,
@@ -1382,7 +1383,9 @@ CREATE TABLE IF NOT EXISTS `service_info` (
`ID` int (11) AUTO_INCREMENT,
`SERVICE_INPUT` varchar (5000),
`SERVICE_PROPERTIES` varchar (5000),
- PRIMARY KEY (`ID`)
+ `SERVICE_MODEL_UUID` varchar (200) NOT NULL,
+ PRIMARY KEY (`ID`),
+ CONSTRAINT `fk_service_info_service1` FOREIGN KEY (`SERVICE_MODEL_UUID`) REFERENCES `service` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE
)ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE IF NOT EXISTS `service_artifact`(
@@ -1399,14 +1402,6 @@ CREATE TABLE IF NOT EXISTS `service_artifact`(
CONSTRAINT `fk_service_artifact_service_info1` FOREIGN KEY (`SERVICE_MODEL_UUID`) REFERENCES `service` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE
)ENGINE=InnoDB DEFAULT CHARSET=latin1;
-CREATE TABLE IF NOT EXISTS `service_to_service_info` (
- `SERVICE_MODEL_UUID` varchar (200) NOT NULL,
- `SERVICE_INFO_ID` INT (11) NOT NULL,
- PRIMARY KEY (`SERVICE_MODEL_UUID`,`SERVICE_INFO_ID`),
- CONSTRAINT `fk_service_to_service_info__service1` FOREIGN KEY (`SERVICE_MODEL_UUID`) REFERENCES `service` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE,
- CONSTRAINT `fk_service_to_service_info__service_info1` FOREIGN KEY (`SERVICE_INFO_ID`) REFERENCES `service_info` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE
-)ENGINE=InnoDB DEFAULT CHARSET=latin1;
-
--------START Request DB SCHEMA --------
CREATE DATABASE requestdb;
USE requestdb;
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 48a8e60095..a86e1de772 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
@@ -89,7 +89,7 @@ public class CompleteMsoProcess extends AbstractServiceTaskProcessor {
}
infraRequest.setLastModifiedBy("BPMN")
infraRequest.setStatusMessage(statusMessage)
- infraRequest.setRequestStatus("COMPLETED")
+ infraRequest.setRequestStatus("COMPLETE")
infraRequest.setProgress(100)
if(utils.nodeExists(xml, "vnfId")){
@@ -104,7 +104,8 @@ public class CompleteMsoProcess extends AbstractServiceTaskProcessor {
infraRequest.setVfModuleId(utils.getNodeText(xml, "vfModuleId"))
}else if(utils.nodeExists(xml, "volumeGroupId")){
infraRequest.setVolumeGroupId(utils.getNodeText(xml, "volumeGroupId"))
-
+ }else if(utils.nodeExists(xml, "pnfName")){
+ infraRequest.setPnfName(utils.getNodeText(xml, "pnfName"))
}
dbClient.updateInfraActiveRequests(infraRequest, UrnPropertiesReader.getVariable("mso.adapters.requestDb.auth"), UrnPropertiesReader.getVariable("mso.adapters.requestDb.endpoint"))
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 a6aacc7ea5..e8f842471c 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
@@ -40,419 +40,419 @@ import java.util.UUID
import org.onap.so.utils.Components
-
+@Deprecated //Use vnfAdapterRestV2
class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
private static final Logger logger = LoggerFactory.getLogger( VnfAdapterRestV1.class);
- ExceptionUtil exceptionUtil = new ExceptionUtil()
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
- // VNF Response Processing
- public void preProcessRequest (DelegateExecution execution) {
- def method = getClass().getSimpleName() + '.preProcessRequest(' +
- 'execution=' + execution.getId() +
- ')'
- logger.trace('Entered ' + method)
+ // VNF Response Processing
+ public void preProcessRequest (DelegateExecution execution) {
+ def method = getClass().getSimpleName() + '.preProcessRequest(' +
+ 'execution=' + execution.getId() +
+ ')'
+ logger.trace('Entered ' + method)
- def prefix="VNFREST_"
- execution.setVariable("prefix", prefix)
- setSuccessIndicator(execution, false)
+ def prefix="VNFREST_"
+ execution.setVariable("prefix", prefix)
+ setSuccessIndicator(execution, false)
- try {
- String request = validateRequest(execution, "mso-request-id")
+ try {
+ String request = validateRequest(execution, "mso-request-id")
- // Get the request type (the name of the root element) from the request
+ // Get the request type (the name of the root element) from the request
- Node root = new XmlParser().parseText(request)
- String requestType = root.name()
- execution.setVariable(prefix + 'requestType', requestType)
- logger.debug(getProcessKey(execution) + ': ' + prefix + 'requestType = ' + requestType)
+ Node root = new XmlParser().parseText(request)
+ String requestType = root.name()
+ execution.setVariable(prefix + 'requestType', requestType)
+ logger.debug(getProcessKey(execution) + ': ' + prefix + 'requestType = ' + requestType)
- logger.debug('VnfAdapterRestV1, request: ' + request)
- // Get the messageId from the request
+ logger.debug('VnfAdapterRestV1, request: ' + request)
+ // Get the messageId from the request
- String messageId = getChildText(root, 'messageId')
+ String messageId = getChildText(root, 'messageId')
- if ('rollbackVolumeGroupRequest'.equals(requestType)) {
- messageId = getMessageIdForVolumeGroupRollback(root)
- }
+ if ('rollbackVolumeGroupRequest'.equals(requestType)) {
+ messageId = getMessageIdForVolumeGroupRollback(root)
+ }
- if (messageId == null || messageId.isEmpty()) {
- String msg = getProcessKey(execution) + ': no messageId in ' + requestType
- logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- ErrorCode.UnknownError.getValue());
+ if (messageId == null || messageId.isEmpty()) {
+ String msg = getProcessKey(execution) + ': no messageId in ' + requestType
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
- }
+ }
- execution.setVariable('VNFAResponse_CORRELATOR', messageId)
- logger.debug(getProcessKey(execution) + ': VNFAResponse_CORRELATOR = ' + messageId)
+ execution.setVariable('VNFAResponse_CORRELATOR', messageId)
+ logger.debug(getProcessKey(execution) + ': VNFAResponse_CORRELATOR = ' + messageId)
- // Get the notificationUrl from the request
+ // Get the notificationUrl from the request
- String notificationUrl = getChildText(root, 'notificationUrl')
+ String notificationUrl = getChildText(root, 'notificationUrl')
- if (notificationUrl == null || notificationUrl.isEmpty()) {
- String msg = getProcessKey(execution) + ': no notificationUrl in ' + requestType
- logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- ErrorCode.UnknownError.getValue());
+ if (notificationUrl == null || notificationUrl.isEmpty()) {
+ String msg = getProcessKey(execution) + ': no notificationUrl in ' + requestType
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
- }
+ }
- execution.setVariable(prefix + 'notificationUrl', notificationUrl)
- logger.debug(getProcessKey(execution) + ': ' + prefix + 'notificationUrl = ' + notificationUrl)
+ execution.setVariable(prefix + 'notificationUrl', notificationUrl)
+ logger.debug(getProcessKey(execution) + ': ' + prefix + 'notificationUrl = ' + notificationUrl)
- // Determine the VnfAdapter endpoint
+ // Determine the VnfAdapter endpoint
- String vnfAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.vnf.rest.endpoint", execution)
+ String vnfAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.vnf.rest.endpoint", execution)
- if (vnfAdapterEndpoint == null || vnfAdapterEndpoint.isEmpty()) {
- String msg = getProcessKey(execution) + ': mso:adapters:vnf:rest:endpoint URN mapping is not defined'
- logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- ErrorCode.UnknownError.getValue());
+ if (vnfAdapterEndpoint == null || vnfAdapterEndpoint.isEmpty()) {
+ String msg = getProcessKey(execution) + ': mso:adapters:vnf:rest:endpoint URN mapping is not defined'
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
- }
+ }
- while (vnfAdapterEndpoint.endsWith('/')) {
- vnfAdapterEndpoint = vnfAdapterEndpoint.substring(0, vnfAdapterEndpoint.length()-1)
- }
+ while (vnfAdapterEndpoint.endsWith('/')) {
+ vnfAdapterEndpoint = vnfAdapterEndpoint.substring(0, vnfAdapterEndpoint.length()-1)
+ }
- String vnfAdapterMethod = null
- String vnfAdapterUrl = null
- String vnfAdapterRequest = request
+ String vnfAdapterMethod = null
+ String vnfAdapterUrl = null
+ String vnfAdapterRequest = request
- if ('createVfModuleRequest'.equals(requestType)) {
- String vnfId = getChildText(root, 'vnfId')
+ if ('createVfModuleRequest'.equals(requestType)) {
+ String vnfId = getChildText(root, 'vnfId')
- if (vnfId == null || vnfId.isEmpty()) {
- String msg = getProcessKey(execution) + ': no vnfId in ' + requestType
- logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- ErrorCode.UnknownError.getValue());
+ if (vnfId == null || vnfId.isEmpty()) {
+ String msg = getProcessKey(execution) + ': no vnfId in ' + requestType
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
- }
+ }
- vnfAdapterMethod = 'POST'
- vnfAdapterUrl = vnfAdapterEndpoint + '/' + URLEncoder.encode(vnfId, 'UTF-8') + '/vf-modules'
+ vnfAdapterMethod = 'POST'
+ vnfAdapterUrl = vnfAdapterEndpoint + '/' + URLEncoder.encode(vnfId, 'UTF-8') + '/vf-modules'
- } else if ('updateVfModuleRequest'.equals(requestType)) {
- String vnfId = getChildText(root, 'vnfId')
+ } else if ('updateVfModuleRequest'.equals(requestType)) {
+ String vnfId = getChildText(root, 'vnfId')
- if (vnfId == null || vnfId.isEmpty()) {
- String msg = getProcessKey(execution) + ': no vnfId in ' + requestType
- logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- ErrorCode.UnknownError.getValue());
+ if (vnfId == null || vnfId.isEmpty()) {
+ String msg = getProcessKey(execution) + ': no vnfId in ' + requestType
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
- }
+ }
- String vfModuleId = getChildText(root, 'vfModuleId')
+ String vfModuleId = getChildText(root, 'vfModuleId')
- if (vfModuleId == null || vfModuleId.isEmpty()) {
- String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType
- logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- ErrorCode.UnknownError.getValue());
+ if (vfModuleId == null || vfModuleId.isEmpty()) {
+ String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
- }
+ }
- vnfAdapterMethod = 'PUT'
- vnfAdapterUrl = vnfAdapterEndpoint + '/' + URLEncoder.encode(vnfId, 'UTF-8') +
- '/vf-modules/' + URLEncoder.encode(vfModuleId, 'UTF-8')
+ vnfAdapterMethod = 'PUT'
+ vnfAdapterUrl = vnfAdapterEndpoint + '/' + URLEncoder.encode(vnfId, 'UTF-8') +
+ '/vf-modules/' + URLEncoder.encode(vfModuleId, 'UTF-8')
- } else if ('deleteVfModuleRequest'.equals(requestType)) {
- String vnfId = getChildText(root, 'vnfId')
+ } else if ('deleteVfModuleRequest'.equals(requestType)) {
+ String vnfId = getChildText(root, 'vnfId')
- if (vnfId == null || vnfId.isEmpty()) {
- String msg = getProcessKey(execution) + ': no vnfId in ' + requestType
- logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- ErrorCode.UnknownError.getValue());
+ if (vnfId == null || vnfId.isEmpty()) {
+ String msg = getProcessKey(execution) + ': no vnfId in ' + requestType
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
- }
+ }
- String vfModuleId = getChildText(root, 'vfModuleId')
+ String vfModuleId = getChildText(root, 'vfModuleId')
- if (vfModuleId == null || vfModuleId.isEmpty()) {
- String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType
- logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- ErrorCode.UnknownError.getValue());
+ if (vfModuleId == null || vfModuleId.isEmpty()) {
+ String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
- }
+ }
- vnfAdapterMethod = 'DELETE'
- vnfAdapterUrl = vnfAdapterEndpoint + '/' + URLEncoder.encode(vnfId, 'UTF-8') +
- '/vf-modules/' + URLEncoder.encode(vfModuleId, 'UTF-8')
+ vnfAdapterMethod = 'DELETE'
+ vnfAdapterUrl = vnfAdapterEndpoint + '/' + URLEncoder.encode(vnfId, 'UTF-8') +
+ '/vf-modules/' + URLEncoder.encode(vfModuleId, 'UTF-8')
- } else if ('rollbackVfModuleRequest'.equals(requestType)) {
- Node vfModuleRollbackNode = getChild(root, 'vfModuleRollback')
+ } else if ('rollbackVfModuleRequest'.equals(requestType)) {
+ Node vfModuleRollbackNode = getChild(root, 'vfModuleRollback')
- if (vfModuleRollbackNode == null) {
- String msg = getProcessKey(execution) + ': no vfModuleRollback in ' + requestType
- logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- ErrorCode.UnknownError.getValue());
+ if (vfModuleRollbackNode == null) {
+ String msg = getProcessKey(execution) + ': no vfModuleRollback in ' + requestType
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
- }
+ }
- String vnfId = getChildText(vfModuleRollbackNode, 'vnfId')
+ String vnfId = getChildText(vfModuleRollbackNode, 'vnfId')
- if (vnfId == null || vnfId.isEmpty()) {
- String msg = getProcessKey(execution) + ': no vnfId in ' + requestType
- logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- ErrorCode.UnknownError.getValue());
+ if (vnfId == null || vnfId.isEmpty()) {
+ String msg = getProcessKey(execution) + ': no vnfId in ' + requestType
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
- }
+ }
- String vfModuleId = getChildText(vfModuleRollbackNode, 'vfModuleId')
+ String vfModuleId = getChildText(vfModuleRollbackNode, 'vfModuleId')
- if (vfModuleId == null || vfModuleId.isEmpty()) {
- String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType
- logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- ErrorCode.UnknownError.getValue());
+ if (vfModuleId == null || vfModuleId.isEmpty()) {
+ String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
- }
-
- vnfAdapterMethod = 'DELETE'
- vnfAdapterUrl = vnfAdapterEndpoint + '/' + URLEncoder.encode(vnfId, 'UTF-8') +
- '/vf-modules/' + URLEncoder.encode(vfModuleId, 'UTF-8') + '/rollback'
-
- } else if ('createVolumeGroupRequest'.equals(requestType)) {
- vnfAdapterMethod = 'POST'
- if (vnfAdapterEndpoint.endsWith('v1/vnfs')) {
- vnfAdapterEndpoint = vnfAdapterEndpoint.substring(0, (vnfAdapterEndpoint.length()-'/vnfs'.length()))
- }
- vnfAdapterUrl = vnfAdapterEndpoint + '/volume-groups'
-
- } else if ('updateVolumeGroupRequest'.equals(requestType)) {
- String volumeGroupId = getChildText(root, 'volumeGroupId')
-
- if (volumeGroupId == null || volumeGroupId.isEmpty()) {
- String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType
- logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- ErrorCode.UnknownError.getValue());
+ }
+
+ vnfAdapterMethod = 'DELETE'
+ vnfAdapterUrl = vnfAdapterEndpoint + '/' + URLEncoder.encode(vnfId, 'UTF-8') +
+ '/vf-modules/' + URLEncoder.encode(vfModuleId, 'UTF-8') + '/rollback'
+
+ } else if ('createVolumeGroupRequest'.equals(requestType)) {
+ vnfAdapterMethod = 'POST'
+ if (vnfAdapterEndpoint.endsWith('v1/vnfs')) {
+ vnfAdapterEndpoint = vnfAdapterEndpoint.substring(0, (vnfAdapterEndpoint.length()-'/vnfs'.length()))
+ }
+ vnfAdapterUrl = vnfAdapterEndpoint + '/volume-groups'
+
+ } else if ('updateVolumeGroupRequest'.equals(requestType)) {
+ String volumeGroupId = getChildText(root, 'volumeGroupId')
+
+ if (volumeGroupId == null || volumeGroupId.isEmpty()) {
+ String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
- }
+ }
- vnfAdapterMethod = 'PUT'
- if (vnfAdapterEndpoint.endsWith('v1/vnfs')) {
- vnfAdapterEndpoint = vnfAdapterEndpoint.substring(0, (vnfAdapterEndpoint.length()-'/vnfs'.length()))
- }
- vnfAdapterUrl = vnfAdapterEndpoint + '/volume-groups/' + URLEncoder.encode(volumeGroupId, 'UTF-8')
+ vnfAdapterMethod = 'PUT'
+ if (vnfAdapterEndpoint.endsWith('v1/vnfs')) {
+ vnfAdapterEndpoint = vnfAdapterEndpoint.substring(0, (vnfAdapterEndpoint.length()-'/vnfs'.length()))
+ }
+ vnfAdapterUrl = vnfAdapterEndpoint + '/volume-groups/' + URLEncoder.encode(volumeGroupId, 'UTF-8')
- } else if ('deleteVolumeGroupRequest'.equals(requestType)) {
- String volumeGroupId = getChildText(root, 'volumeGroupId')
+ } else if ('deleteVolumeGroupRequest'.equals(requestType)) {
+ String volumeGroupId = getChildText(root, 'volumeGroupId')
- if (volumeGroupId == null || volumeGroupId.isEmpty()) {
- String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType
- logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- ErrorCode.UnknownError.getValue());
+ if (volumeGroupId == null || volumeGroupId.isEmpty()) {
+ String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
- }
+ }
- vnfAdapterMethod = 'DELETE'
- if (vnfAdapterEndpoint.endsWith('v1/vnfs')) {
- vnfAdapterEndpoint = vnfAdapterEndpoint.substring(0, (vnfAdapterEndpoint.length()-'/vnfs'.length()))
- }
- vnfAdapterUrl = vnfAdapterEndpoint + '/volume-groups/' + URLEncoder.encode(volumeGroupId, 'UTF-8')
+ vnfAdapterMethod = 'DELETE'
+ if (vnfAdapterEndpoint.endsWith('v1/vnfs')) {
+ vnfAdapterEndpoint = vnfAdapterEndpoint.substring(0, (vnfAdapterEndpoint.length()-'/vnfs'.length()))
+ }
+ vnfAdapterUrl = vnfAdapterEndpoint + '/volume-groups/' + URLEncoder.encode(volumeGroupId, 'UTF-8')
- } else if ('rollbackVolumeGroupRequest'.equals(requestType)) {
- String volumeGroupId = getVolumeGroupIdFromRollbackRequest(root)
+ } else if ('rollbackVolumeGroupRequest'.equals(requestType)) {
+ String volumeGroupId = getVolumeGroupIdFromRollbackRequest(root)
- if (volumeGroupId == null || volumeGroupId.isEmpty()) {
- String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType
- logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- ErrorCode.UnknownError.getValue());
+ if (volumeGroupId == null || volumeGroupId.isEmpty()) {
+ String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
- }
-
- vnfAdapterMethod = 'DELETE'
- if (vnfAdapterEndpoint.endsWith('v1/vnfs')) {
- vnfAdapterEndpoint = vnfAdapterEndpoint.substring(0, (vnfAdapterEndpoint.length()-'/vnfs'.length()))
- }
- vnfAdapterUrl = vnfAdapterEndpoint + '/volume-groups/' + URLEncoder.encode(volumeGroupId, 'UTF-8') + '/rollback'
-
- } else {
- String msg = getProcessKey(execution) + ': Unsupported request type: ' + requestType
- logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- ErrorCode.UnknownError.getValue());
+ }
+
+ vnfAdapterMethod = 'DELETE'
+ if (vnfAdapterEndpoint.endsWith('v1/vnfs')) {
+ vnfAdapterEndpoint = vnfAdapterEndpoint.substring(0, (vnfAdapterEndpoint.length()-'/vnfs'.length()))
+ }
+ vnfAdapterUrl = vnfAdapterEndpoint + '/volume-groups/' + URLEncoder.encode(volumeGroupId, 'UTF-8') + '/rollback'
+
+ } else {
+ String msg = getProcessKey(execution) + ': Unsupported request type: ' + requestType
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
- }
-
- execution.setVariable(prefix + 'vnfAdapterMethod', vnfAdapterMethod)
- logger.debug(getProcessKey(execution) + ': ' + prefix + 'vnfAdapterMethod = ' + vnfAdapterMethod)
- execution.setVariable(prefix + 'vnfAdapterUrl', vnfAdapterUrl)
- logger.debug(getProcessKey(execution) + ': ' + prefix + 'vnfAdapterUrl = ' + vnfAdapterUrl)
- execution.setVariable(prefix + 'vnfAdapterRequest', 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()) {
- logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined", "BPMN",
- ErrorCode.UnknownError.getValue());
- } else {
- try {
- def encodedString = utils.getBasicAuth(basicAuthValue, UrnPropertiesReader.getVariable("mso.msoKey", execution))
- execution.setVariable(prefix + 'basicAuthHeaderValue', encodedString)
- } catch (IOException ex) {
- logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- getProcessKey(execution) + ": Unable to encode BasicAuth credentials for VnfAdapter",
- "BPMN", ErrorCode.UnknownError.getValue(), ex);
- }
- }
-
- } catch (BpmnError e) {
- logger.debug(" Rethrowing MSOWorkflowException")
- throw e
- } catch (Exception e) {
- String msg = 'Caught exception in ' + method + ": " + e
- logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- ErrorCode.UnknownError.getValue());
- logger.debug(msg)
+ }
+
+ execution.setVariable(prefix + 'vnfAdapterMethod', vnfAdapterMethod)
+ logger.debug(getProcessKey(execution) + ': ' + prefix + 'vnfAdapterMethod = ' + vnfAdapterMethod)
+ execution.setVariable(prefix + 'vnfAdapterUrl', vnfAdapterUrl)
+ logger.debug(getProcessKey(execution) + ': ' + prefix + 'vnfAdapterUrl = ' + vnfAdapterUrl)
+ execution.setVariable(prefix + 'vnfAdapterRequest', 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()) {
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined", "BPMN",
+ ErrorCode.UnknownError.getValue());
+ } else {
+ try {
+ def encodedString = utils.getBasicAuth(basicAuthValue, UrnPropertiesReader.getVariable("mso.msoKey", execution))
+ execution.setVariable(prefix + 'basicAuthHeaderValue', encodedString)
+ } catch (IOException ex) {
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ getProcessKey(execution) + ": Unable to encode BasicAuth credentials for VnfAdapter",
+ "BPMN", ErrorCode.UnknownError.getValue(), ex);
+ }
+ }
+
+ } catch (BpmnError e) {
+ logger.debug(" Rethrowing MSOWorkflowException")
+ throw e
+ } catch (Exception e) {
+ String msg = 'Caught exception in ' + method + ": " + e
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ ErrorCode.UnknownError.getValue());
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
- }
- }
+ }
+ }
- public String getVolumeGroupIdFromRollbackRequest(Node root) {
- return root.'volumeGroupRollback'.'volumeGroupId'.text()
- }
+ public String getVolumeGroupIdFromRollbackRequest(Node root) {
+ return root.'volumeGroupRollback'.'volumeGroupId'.text()
+ }
- public String getMessageIdForVolumeGroupRollback(Node root) {
- return root.'volumeGroupRollback'.'messageId'.text()
- }
+ public String getMessageIdForVolumeGroupRollback(Node root) {
+ return root.'volumeGroupRollback'.'messageId'.text()
+ }
- /**
- * This method is used instead of an HTTP Connector task because the
- * connector does not allow DELETE with a body.
- */
- public void sendRequestToVnfAdapter(DelegateExecution execution) {
- def method = getClass().getSimpleName() + '.sendRequestToVnfAdapter(' +
- 'execution=' + execution.getId() +
- ')'
- logger.trace('Entered ' + method)
+ /**
+ * This method is used instead of an HTTP Connector task because the
+ * connector does not allow DELETE with a body.
+ */
+ public void sendRequestToVnfAdapter(DelegateExecution execution) {
+ def method = getClass().getSimpleName() + '.sendRequestToVnfAdapter(' +
+ 'execution=' + execution.getId() +
+ ')'
+ logger.trace('Entered ' + method)
- String prefix = execution.getVariable('prefix')
+ String prefix = execution.getVariable('prefix')
- try {
- String vnfAdapterMethod = execution.getVariable(prefix + 'vnfAdapterMethod')
- String vnfAdapterUrl = execution.getVariable(prefix + 'vnfAdapterUrl')
- String vnfAdapterRequest = execution.getVariable(prefix + 'vnfAdapterRequest')
+ try {
+ String vnfAdapterMethod = execution.getVariable(prefix + 'vnfAdapterMethod')
+ String vnfAdapterUrl = execution.getVariable(prefix + 'vnfAdapterUrl')
+ String vnfAdapterRequest = execution.getVariable(prefix + 'vnfAdapterRequest')
- URL url = new URL(vnfAdapterUrl);
+ URL url = new URL(vnfAdapterUrl);
HttpClient httpClient = new HttpClientFactory().newXmlClient(url, ONAPComponents.VNF_ADAPTER)
- httpClient.addAdditionalHeader("Authorization", execution.getVariable(prefix + "basicAuthHeaderValue"))
-
- httpClient.addAdditionalHeader("X-ONAP-RequestID", execution.getVariable("mso-request-id"))
- httpClient.addAdditionalHeader("X-ONAP-InvocationID", UUID.randomUUID().toString())
- httpClient.addAdditionalHeader("X-ONAP-PartnerName", "SO-VNFAdapter")
- Response response;
-
- if ("GET".equals(vnfAdapterMethod)) {
- response = httpClient.get()
- } else if ("PUT".equals(vnfAdapterMethod)) {
- response = httpClient.put(vnfAdapterRequest)
- } else if ("POST".equals(vnfAdapterMethod)) {
- response = httpClient.post(vnfAdapterRequest)
- } else if ("DELETE".equals(vnfAdapterMethod)) {
- response = httpClient.delete(vnfAdapterRequest)
- } else {
- String msg = 'Unsupported HTTP method "' + vnfAdapterMethod + '" in ' + method + ": " + e
- logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- ErrorCode.UnknownError.getValue());
+ httpClient.addAdditionalHeader("Authorization", execution.getVariable(prefix + "basicAuthHeaderValue"))
+
+ httpClient.addAdditionalHeader("X-ONAP-RequestID", execution.getVariable("mso-request-id"))
+ httpClient.addAdditionalHeader("X-ONAP-InvocationID", UUID.randomUUID().toString())
+ httpClient.addAdditionalHeader("X-ONAP-PartnerName", "SO-VNFAdapter")
+ Response response;
+
+ if ("GET".equals(vnfAdapterMethod)) {
+ response = httpClient.get()
+ } else if ("PUT".equals(vnfAdapterMethod)) {
+ response = httpClient.put(vnfAdapterRequest)
+ } else if ("POST".equals(vnfAdapterMethod)) {
+ response = httpClient.post(vnfAdapterRequest)
+ } else if ("DELETE".equals(vnfAdapterMethod)) {
+ response = httpClient.delete(vnfAdapterRequest)
+ } else {
+ String msg = 'Unsupported HTTP method "' + vnfAdapterMethod + '" in ' + method + ": " + e
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
- }
-
- execution.setVariable(prefix + "vnfAdapterStatusCode", response.getStatus())
- if(response.hasEntity()){
- execution.setVariable(prefix + "vnfAdapterResponse", response.readEntity(String.class))
- }
- } catch (BpmnError e) {
- throw e
- } catch (Exception e) {
- String msg = 'Caught exception in ' + method + ": " + e
- logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- ErrorCode.UnknownError.getValue());
+ }
+
+ execution.setVariable(prefix + "vnfAdapterStatusCode", response.getStatus())
+ if(response.hasEntity()){
+ execution.setVariable(prefix + "vnfAdapterResponse", response.readEntity(String.class))
+ }
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception e) {
+ String msg = 'Caught exception in ' + method + ": " + e
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
- }
- }
-
- public void processCallback(DelegateExecution execution){
- def method = getClass().getSimpleName() + '.processCallback(' +
- 'execution=' + execution.getId() +
- ')'
- logger.trace('Entered ' + method)
-
- String callback = execution.getVariable('VNFAResponse_MESSAGE')
-
- try {
- 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.
- execution.setVariable(getProcessKey(execution) + 'Response', callback)
- // TODO: Should deprecate use of processKey+Response variable for the response. Will use "WorkflowResponse" instead.
- execution.setVariable("WorkflowResponse", callback)
-
- callback = utils.removeXmlPreamble(callback)
-
- Node root = new XmlParser().parseText(callback)
- if (root.name().endsWith('Exception')) {
- vnfAdapterWorkflowException(execution, callback)
- }
- } catch (Exception e) {
- logger.debug("Error encountered within VnfAdapterRest ProcessCallback method: {}", e.getMessage(), e)
+ }
+ }
+
+ public void processCallback(DelegateExecution execution){
+ def method = getClass().getSimpleName() + '.processCallback(' +
+ 'execution=' + execution.getId() +
+ ')'
+ logger.trace('Entered ' + method)
+
+ String callback = execution.getVariable('VNFAResponse_MESSAGE')
+
+ try {
+ 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.
+ execution.setVariable(getProcessKey(execution) + 'Response', callback)
+ // TODO: Should deprecate use of processKey+Response variable for the response. Will use "WorkflowResponse" instead.
+ execution.setVariable("WorkflowResponse", callback)
+
+ callback = utils.removeXmlPreamble(callback)
+
+ Node root = new XmlParser().parseText(callback)
+ if (root.name().endsWith('Exception')) {
+ vnfAdapterWorkflowException(execution, callback)
+ }
+ } catch (Exception e) {
+ logger.debug("Error encountered within VnfAdapterRest ProcessCallback method: {}", e.getMessage(), e)
exceptionUtil.buildAndThrowWorkflowException(execution, 7020, "Error encountered within VnfAdapterRest ProcessCallback method", ONAPComponents.SO)
- }
- }
-
- /**
- * Tries to parse the response as XML to extract the information to create
- * a WorkflowException. If the response cannot be parsed, a more generic
- * WorkflowException is created.
- */
- public void vnfAdapterWorkflowException(DelegateExecution execution, Object response) {
- try {
- Node root = new XmlParser().parseText(response)
- String category = getChildText(root, "category")
- category = category == null || category.isEmpty() ? "" : " category='" + category + "'"
- String message = getChildText(root, "message")
- message = message == null || message.isEmpty() ? "" : " message='" + message + "'"
- String rolledBack = getChildText(root, "rolledBack")
- rolledBack = rolledBack == null || rolledBack.isEmpty() ? "" : " rolledBack='" + rolledBack + "'"
- exceptionUtil.buildWorkflowException(execution, 7020, "Received " + root.name() +
+ }
+ }
+
+ /**
+ * Tries to parse the response as XML to extract the information to create
+ * a WorkflowException. If the response cannot be parsed, a more generic
+ * WorkflowException is created.
+ */
+ public void vnfAdapterWorkflowException(DelegateExecution execution, Object response) {
+ try {
+ Node root = new XmlParser().parseText(response)
+ String category = getChildText(root, "category")
+ category = category == null || category.isEmpty() ? "" : " category='" + category + "'"
+ String message = getChildText(root, "message")
+ message = message == null || message.isEmpty() ? "" : " message='" + message + "'"
+ String rolledBack = getChildText(root, "rolledBack")
+ rolledBack = rolledBack == null || rolledBack.isEmpty() ? "" : " rolledBack='" + rolledBack + "'"
+ exceptionUtil.buildWorkflowException(execution, 7020, "Received " + root.name() +
" from VnfAdapter:" + category + message + rolledBack, Components.OPENSTACK);
- } catch (Exception e) {
- response = response == null || String.valueOf(response).isEmpty() ? "NONE" : response
+ } catch (Exception e) {
+ response = response == null || String.valueOf(response).isEmpty() ? "NONE" : response
exceptionUtil.buildWorkflowException(execution, 7020, "Received error from VnfAdapter: " + response, Components.OPENSTACK)
- }
- }
-
- /**
- * Gets the named child of the specified node.
- * @param node the node
- * @param name the child name
- * @return the child node, or null if no such child exists
- */
- private Node getChild(Node node, String name) {
- for (Node child : node.children()) {
- if (child.name() == name) {
- return child
- }
- }
- return null
- }
-
- /**
- * Gets the text of the named child of the specified node.
- * @param node the node
- * @param name the child name
- * @return the child node text, or null if no such child exists
- */
- private String getChildText(Node node, String name) {
- Node child = getChild(node, name)
- return child == null ? null : child.text()
- }
-
- public Logger getLogger() {
- return logger;
- }
+ }
+ }
+
+ /**
+ * Gets the named child of the specified node.
+ * @param node the node
+ * @param name the child name
+ * @return the child node, or null if no such child exists
+ */
+ private Node getChild(Node node, String name) {
+ for (Node child : node.children()) {
+ if (child.name() == name) {
+ return child
+ }
+ }
+ return null
+ }
+
+ /**
+ * Gets the text of the named child of the specified node.
+ * @param node the node
+ * @param name the child name
+ * @return the child node text, or null if no such child exists
+ */
+ private String getChildText(Node node, String name) {
+ Node child = getChild(node, name)
+ return child == null ? null : child.text()
+ }
+
+ public Logger getLogger() {
+ return logger;
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoServiceInstance.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoServiceInstance.java
index bc330eeafd..b554d7a9ba 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoServiceInstance.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoServiceInstance.java
@@ -35,6 +35,8 @@ public class ModelInfoServiceInstance extends ModelInfoMetadata implements Seria
private String serviceType;
@JsonProperty("service-role")
private String serviceRole;
+ @JsonProperty("service-function")
+ private String serviceFunction;
@JsonProperty("environment-context")
private String environmentContext;
@JsonProperty("workload-context")
@@ -77,6 +79,14 @@ public class ModelInfoServiceInstance extends ModelInfoMetadata implements Seria
this.serviceRole = serviceRole;
}
+ public String getServiceFunction() {
+ return serviceFunction;
+ }
+
+ public void setServiceFunction(String serviceFunction) {
+ this.serviceFunction = serviceFunction;
+ }
+
public String getEnvironmentContext() {
return environmentContext;
}
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 2e9d4b0117..30fd2c8770 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
@@ -45,6 +45,7 @@ import org.onap.so.logger.LoggingAnchor;
import org.onap.so.logger.MessageEnum;
import org.onap.so.objects.audit.AAIObjectAudit;
import org.onap.so.objects.audit.AAIObjectAuditList;
+import org.onap.so.utils.Components;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
@@ -207,26 +208,26 @@ public class ExceptionBuilder {
}
public void buildAndThrowWorkflowException(DelegateExecution execution, int errorCode, String errorMessage) {
+
+ buildWorkflowException(execution, errorCode, errorMessage);
+ logger.info("Throwing MSOWorkflowException");
+ throw new BpmnError("MSOWorkflowException");
+ }
+
+ public void buildWorkflowException(DelegateExecution execution, int errorCode, String errorMessage) {
String processKey = getProcessKey(execution);
- logger.info("Building a WorkflowException for Subflow");
+ logger.info("Building a WorkflowException");
WorkflowException exception = new WorkflowException(processKey, errorCode, errorMessage);
execution.setVariable("WorkflowException", exception);
execution.setVariable("WorkflowExceptionErrorMessage", errorMessage);
logger.info("Outgoing WorkflowException is {}", exception);
- logger.info("Throwing MSOWorkflowException");
- throw new BpmnError("MSOWorkflowException");
}
public void buildAndThrowWorkflowException(DelegateExecution execution, int errorCode, String errorMessage,
ONAPComponentsList extSystemErrorSource) {
- String processKey = getProcessKey(execution);
- logger.info("Building a WorkflowException for Subflow");
- WorkflowException exception = new WorkflowException(processKey, errorCode, errorMessage, extSystemErrorSource);
- execution.setVariable("WorkflowException", exception);
- execution.setVariable("WorkflowExceptionErrorMessage", errorMessage);
- logger.info("Outgoing WorkflowException is {}", exception);
+ buildWorkflowException(execution, errorCode, errorMessage, extSystemErrorSource);
logger.info("Throwing MSOWorkflowException");
throw new BpmnError("MSOWorkflowException");
}
@@ -313,7 +314,7 @@ public class ExceptionBuilder {
execution.setVariable("WorkflowException", exception);
execution.setVariable("WorkflowExceptionErrorMessage", errorMessage.toString());
logger.info("Outgoing WorkflowException is {}", exception);
- logger.info("Throwing MSOWorkflowException");
+ logger.info("Throwing AAIInventoryFailure");
throw new BpmnError("AAIInventoryFailure");
}
@@ -323,9 +324,42 @@ public class ExceptionBuilder {
execution.setVariable("WorkflowException", exception);
execution.setVariable("WorkflowExceptionErrorMessage", errorMessage);
logger.info("Outgoing WorkflowException is {}", exception);
- logger.info("Throwing MSOWorkflowException");
+ logger.info("Throwing AAIInventoryFailure");
throw new BpmnError("AAIInventoryFailure");
}
}
+ public void processVnfAdapterException(DelegateExecution execution) {
+ StringBuilder workflowExceptionMessage = new StringBuilder();
+ logger.debug("Processing Vnf Adapter Exception");
+ try {
+ String errorMessage = (String) execution.getVariable("openstackAdapterErrorMessage");
+ boolean openstackRollbackPollSuccess = (boolean) execution.getVariable("OpenstackPollSuccess");
+ boolean rollbackPerformed = (boolean) execution.getVariable("rollbackPerformed");
+ boolean openstackRollbackSuccess = (boolean) execution.getVariable("OpenstackRollbackSuccess");
+ boolean pollRollbackStatus = (boolean) execution.getVariable("PollRollbackStatus");
+
+ workflowExceptionMessage.append("Exception occured during vnf adapter: " + errorMessage + ".");
+
+ boolean rollbackCompleted = false;
+ if (rollbackPerformed) {
+ if (openstackRollbackSuccess && !pollRollbackStatus) {
+ rollbackCompleted = true;
+ } else if (openstackRollbackSuccess && pollRollbackStatus) {
+ if (openstackRollbackPollSuccess) {
+ rollbackCompleted = true;
+ }
+ }
+ workflowExceptionMessage
+ .append(" The resource was rollbacked in openstack: " + rollbackCompleted + ".");
+ }
+ } catch (Exception e) {
+ logger.debug("Error while Processing Vnf Adapter Exception", e);
+ }
+ buildWorkflowException(execution, 500, workflowExceptionMessage.toString(), Components.OPENSTACK);
+ throw new BpmnError("MSOWorkflowException");
+
+
+ }
+
}
diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/VnfAdapterTask.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/VnfAdapterTask.bpmn
new file mode 100644
index 0000000000..69b68e534e
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/VnfAdapterTask.bpmn
@@ -0,0 +1,336 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_GraPIIyxEeWmdMDkx6Uftw" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
+ <bpmn2:process id="vnfAdapterTask" name="vnfAdapterTask" isExecutable="true">
+ <bpmn2:endEvent id="EndEvent_6">
+ <bpmn2:incoming>SequenceFlow_13uy51h</bpmn2:incoming>
+ </bpmn2:endEvent>
+ <bpmn2:startEvent id="StartEvent_1">
+ <bpmn2:outgoing>SequenceFlow_9</bpmn2:outgoing>
+ </bpmn2:startEvent>
+ <bpmn2:sequenceFlow id="SequenceFlow_9" name="" sourceRef="StartEvent_1" targetRef="executeOpenstackAction" />
+ <bpmn2:serviceTask id="executeOpenstackAction" name="&#10;Openstack&#10;Action&#10;(resource)&#10;" camunda:asyncAfter="true" camunda:type="external" camunda:topic="OpenstackAdapterInvoke">
+ <bpmn2:incoming>SequenceFlow_9</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_1ff2y8j</bpmn2:outgoing>
+ </bpmn2:serviceTask>
+ <bpmn2:sequenceFlow id="SequenceFlow_1ff2y8j" sourceRef="executeOpenstackAction" targetRef="ExclusiveGateway_08a6you" />
+ <bpmn2:serviceTask id="ServiceTask_11iuzx9" name="&#10;Openstack&#10;Query&#10;(resource)&#10;" camunda:asyncAfter="true" camunda:type="external" camunda:topic="OpenstackAdapterPolling">
+ <bpmn2:incoming>SequenceFlow_1p39f4r</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_0ecut35</bpmn2:outgoing>
+ </bpmn2:serviceTask>
+ <bpmn2:sequenceFlow id="SequenceFlow_0ecut35" sourceRef="ServiceTask_11iuzx9" targetRef="ExclusiveGateway_1fn953y" />
+ <bpmn2:exclusiveGateway id="ExclusiveGateway_1fn953y" name="Success?">
+ <bpmn2:incoming>SequenceFlow_0ecut35</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_13uy51h</bpmn2:outgoing>
+ <bpmn2:outgoing>SequenceFlow_0o8wnkx</bpmn2:outgoing>
+ </bpmn2:exclusiveGateway>
+ <bpmn2:sequenceFlow id="SequenceFlow_13uy51h" name="Yes" sourceRef="ExclusiveGateway_1fn953y" targetRef="EndEvent_6">
+ <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("OpenstackPollSuccess") == true }]]></bpmn2:conditionExpression>
+ </bpmn2:sequenceFlow>
+ <bpmn2:sequenceFlow id="SequenceFlow_0o8wnkx" name="No" sourceRef="ExclusiveGateway_1fn953y" targetRef="EndEvent_1dt01ez">
+ <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("OpenstackPollSuccess") == false }]]></bpmn2:conditionExpression>
+ </bpmn2:sequenceFlow>
+ <bpmn2:exclusiveGateway id="ExclusiveGateway_08a6you" name="Success?">
+ <bpmn2:incoming>SequenceFlow_1ff2y8j</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_1p39f4r</bpmn2:outgoing>
+ <bpmn2:outgoing>SequenceFlow_007m32h</bpmn2:outgoing>
+ </bpmn2:exclusiveGateway>
+ <bpmn2:sequenceFlow id="SequenceFlow_1p39f4r" name="Yes" sourceRef="ExclusiveGateway_08a6you" targetRef="ServiceTask_11iuzx9">
+ <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("OpenstackInvokeSuccess") == true }]]></bpmn2:conditionExpression>
+ </bpmn2:sequenceFlow>
+ <bpmn2:sequenceFlow id="SequenceFlow_007m32h" name="No" sourceRef="ExclusiveGateway_08a6you" targetRef="EndEvent_0rxprkw">
+ <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("OpenstackInvokeSuccess") == false }]]></bpmn2:conditionExpression>
+ </bpmn2:sequenceFlow>
+ <bpmn2:subProcess id="SubProcess_0y17e8j" name="Error Handling" triggeredByEvent="true">
+ <bpmn2:startEvent id="StartEvent_17oglfe">
+ <bpmn2:outgoing>SequenceFlow_02rhau9</bpmn2:outgoing>
+ <bpmn2:errorEventDefinition />
+ </bpmn2:startEvent>
+ <bpmn2:intermediateThrowEvent id="IntermediateThrowEvent_040yoan">
+ <bpmn2:incoming>SequenceFlow_0y1by9x</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_006myq9</bpmn2:outgoing>
+ <bpmn2:compensateEventDefinition waitForCompletion="true" activityRef="executeOpenstackAction" />
+ </bpmn2:intermediateThrowEvent>
+ <bpmn2:exclusiveGateway id="ExclusiveGateway_0qlnby0" name="Poll Rollback Status?" default="SequenceFlow_1piwh1c">
+ <bpmn2:incoming>SequenceFlow_006myq9</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_1ubla93</bpmn2:outgoing>
+ <bpmn2:outgoing>SequenceFlow_1piwh1c</bpmn2:outgoing>
+ </bpmn2:exclusiveGateway>
+ <bpmn2:sequenceFlow id="SequenceFlow_02rhau9" sourceRef="StartEvent_17oglfe" targetRef="ExclusiveGateway_18ndby1" />
+ <bpmn2:sequenceFlow id="SequenceFlow_006myq9" sourceRef="IntermediateThrowEvent_040yoan" targetRef="ExclusiveGateway_0qlnby0" />
+ <bpmn2:serviceTask id="ServiceTask_120p27h" name="&#10;Openstack&#10;Query&#10;(resource)&#10;" camunda:asyncAfter="true" camunda:type="external" camunda:topic="OpenstackAdapterPolling">
+ <bpmn2:incoming>SequenceFlow_1ubla93</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_1nku4uk</bpmn2:outgoing>
+ </bpmn2:serviceTask>
+ <bpmn2:exclusiveGateway id="ExclusiveGateway_0tuxj9l">
+ <bpmn2:incoming>SequenceFlow_1piwh1c</bpmn2:incoming>
+ <bpmn2:incoming>SequenceFlow_1nku4uk</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_1yx80cq</bpmn2:outgoing>
+ </bpmn2:exclusiveGateway>
+ <bpmn2:serviceTask id="buildError" name="&#10;Process&#10;Exception&#10;" camunda:expression="${ExceptionBuilder.processVnfAdapterException(execution)}">
+ <bpmn2:incoming>SequenceFlow_1yx80cq</bpmn2:incoming>
+ <bpmn2:incoming>SequenceFlow_1az3a2q</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_0bnzfqb</bpmn2:outgoing>
+ </bpmn2:serviceTask>
+ <bpmn2:sequenceFlow id="SequenceFlow_1ubla93" name="Yes" sourceRef="ExclusiveGateway_0qlnby0" targetRef="ServiceTask_120p27h">
+ <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("PollRollbackStatus") == true}]]></bpmn2:conditionExpression>
+ </bpmn2:sequenceFlow>
+ <bpmn2:sequenceFlow id="SequenceFlow_1piwh1c" name="No" sourceRef="ExclusiveGateway_0qlnby0" targetRef="ExclusiveGateway_0tuxj9l" />
+ <bpmn2:sequenceFlow id="SequenceFlow_1nku4uk" sourceRef="ServiceTask_120p27h" targetRef="ExclusiveGateway_0tuxj9l" />
+ <bpmn2:sequenceFlow id="SequenceFlow_1yx80cq" sourceRef="ExclusiveGateway_0tuxj9l" targetRef="buildError" />
+ <bpmn2:sequenceFlow id="SequenceFlow_0bnzfqb" sourceRef="buildError" targetRef="EndEvent_1yiy2fi" />
+ <bpmn2:endEvent id="EndEvent_1yiy2fi">
+ <bpmn2:incoming>SequenceFlow_0bnzfqb</bpmn2:incoming>
+ <bpmn2:terminateEventDefinition />
+ </bpmn2:endEvent>
+ <bpmn2:exclusiveGateway id="ExclusiveGateway_18ndby1" name="Rollback Resource?" default="SequenceFlow_1az3a2q">
+ <bpmn2:incoming>SequenceFlow_02rhau9</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_0y1by9x</bpmn2:outgoing>
+ <bpmn2:outgoing>SequenceFlow_1az3a2q</bpmn2:outgoing>
+ </bpmn2:exclusiveGateway>
+ <bpmn2:sequenceFlow id="SequenceFlow_0y1by9x" name="Yes" sourceRef="ExclusiveGateway_18ndby1" targetRef="IntermediateThrowEvent_040yoan">
+ <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("backout") == true }]]></bpmn2:conditionExpression>
+ </bpmn2:sequenceFlow>
+ <bpmn2:sequenceFlow id="SequenceFlow_1az3a2q" name="No" sourceRef="ExclusiveGateway_18ndby1" targetRef="buildError" />
+ </bpmn2:subProcess>
+ <bpmn2:boundaryEvent id="BoundaryEvent_1ysr7mk" attachedToRef="executeOpenstackAction">
+ <bpmn2:compensateEventDefinition />
+ </bpmn2:boundaryEvent>
+ <bpmn2:serviceTask id="Task_0zbd85n" name="&#10;Openstack&#10;Rollback&#10;(resource)&#10;" isForCompensation="true" camunda:asyncAfter="true" camunda:type="external" camunda:topic="OpenstackAdapterRollback" />
+ <bpmn2:endEvent id="EndEvent_0rxprkw">
+ <bpmn2:incoming>SequenceFlow_007m32h</bpmn2:incoming>
+ <bpmn2:errorEventDefinition errorRef="Error_1" />
+ </bpmn2:endEvent>
+ <bpmn2:endEvent id="EndEvent_1dt01ez">
+ <bpmn2:incoming>SequenceFlow_0o8wnkx</bpmn2:incoming>
+ <bpmn2:errorEventDefinition errorRef="Error_1" />
+ </bpmn2:endEvent>
+ <bpmn2:association id="Association_1cnlu6p" associationDirection="One" sourceRef="BoundaryEvent_1ysr7mk" targetRef="Task_0zbd85n" />
+ </bpmn2:process>
+ <bpmn2:error id="Error_1" name="MSO Workflow Exception" errorCode="MSOWorkflowException" />
+ <bpmn2:message id="Message_1" name="WorkflowMessage" />
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="vnfAdapterTask">
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_54" bpmnElement="StartEvent_1">
+ <dc:Bounds x="110" y="146" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="116" y="187" width="24" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_2" bpmnElement="SequenceFlow_9" sourceElement="_BPMNShape_StartEvent_54" targetElement="ServiceTask_0rcy900_di">
+ <di:waypoint xsi:type="dc:Point" x="146" y="164" />
+ <di:waypoint xsi:type="dc:Point" x="253" y="163" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="154.5" y="145.5" width="90" height="6" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_EndEvent_158" bpmnElement="EndEvent_6">
+ <dc:Bounds x="929" y="146" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="924" y="187" width="46" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_0rcy900_di" bpmnElement="executeOpenstackAction">
+ <dc:Bounds x="253" y="124" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1ff2y8j_di" bpmnElement="SequenceFlow_1ff2y8j">
+ <di:waypoint xsi:type="dc:Point" x="353" y="164" />
+ <di:waypoint xsi:type="dc:Point" x="404" y="164" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="333.5" y="139" width="90" height="20" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_11iuzx9_di" bpmnElement="ServiceTask_11iuzx9">
+ <dc:Bounds x="541" y="124" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0ecut35_di" bpmnElement="SequenceFlow_0ecut35">
+ <di:waypoint xsi:type="dc:Point" x="641" y="164" />
+ <di:waypoint xsi:type="dc:Point" x="676" y="164" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="613.5" y="139" width="90" height="20" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ExclusiveGateway_1fn953y_di" bpmnElement="ExclusiveGateway_1fn953y" isMarkerVisible="true">
+ <dc:Bounds x="676" y="139" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="676" y="119" width="49" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_13uy51h_di" bpmnElement="SequenceFlow_13uy51h">
+ <di:waypoint xsi:type="dc:Point" x="726" y="164" />
+ <di:waypoint xsi:type="dc:Point" x="929" y="164" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="746.6875" y="166" width="19" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0o8wnkx_di" bpmnElement="SequenceFlow_0o8wnkx">
+ <di:waypoint xsi:type="dc:Point" x="701" y="189" />
+ <di:waypoint xsi:type="dc:Point" x="701" y="249" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="706" y="198" width="14" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_120p27h_di" bpmnElement="ServiceTask_120p27h">
+ <dc:Bounds x="496" y="443" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ExclusiveGateway_08a6you_di" bpmnElement="ExclusiveGateway_08a6you" isMarkerVisible="true">
+ <dc:Bounds x="404" y="139" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="409" y="117" width="49" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1p39f4r_di" bpmnElement="SequenceFlow_1p39f4r">
+ <di:waypoint xsi:type="dc:Point" x="454" y="164" />
+ <di:waypoint xsi:type="dc:Point" x="541" y="164" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="472" y="168" width="19" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_007m32h_di" bpmnElement="SequenceFlow_007m32h">
+ <di:waypoint xsi:type="dc:Point" x="429" y="189" />
+ <di:waypoint xsi:type="dc:Point" x="429" y="249" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="435" y="198" width="14" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="SubProcess_09bkjg0_di" bpmnElement="SubProcess_0y17e8j" isExpanded="true">
+ <dc:Bounds x="151" y="404" width="787" height="344" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="BoundaryEvent_04c5efr_di" bpmnElement="BoundaryEvent_1ysr7mk">
+ <dc:Bounds x="335" y="186" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="353" y="226" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="Association_1cnlu6p_di" bpmnElement="Association_1cnlu6p">
+ <di:waypoint xsi:type="dc:Point" x="353" y="222" />
+ <di:waypoint xsi:type="dc:Point" x="353" y="267" />
+ <di:waypoint xsi:type="dc:Point" x="321" y="267" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_0vacscp_di" bpmnElement="Task_0zbd85n">
+ <dc:Bounds x="221" y="227" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_0lzcn0v_di" bpmnElement="EndEvent_0rxprkw">
+ <dc:Bounds x="411" y="249" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="429" y="288.658" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_14424k5_di" bpmnElement="EndEvent_1dt01ez">
+ <dc:Bounds x="683" y="249" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="701" y="288.658" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="StartEvent_1wrpebh_di" bpmnElement="StartEvent_17oglfe">
+ <dc:Bounds x="181" y="599" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="198.35199999999998" y="638.658" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="IntermediateThrowEvent_0gltuh4_di" bpmnElement="IntermediateThrowEvent_040yoan">
+ <dc:Bounds x="365" y="529" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="382.352" y="569" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ExclusiveGateway_0qlnby0_di" bpmnElement="ExclusiveGateway_0qlnby0" isMarkerVisible="true">
+ <dc:Bounds x="429.352" y="522" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="484" y="535" width="62" height="24" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_02rhau9_di" bpmnElement="SequenceFlow_02rhau9">
+ <di:waypoint xsi:type="dc:Point" x="217" y="617" />
+ <di:waypoint xsi:type="dc:Point" x="284" y="617" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="250.5" y="596" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_006myq9_di" bpmnElement="SequenceFlow_006myq9">
+ <di:waypoint xsi:type="dc:Point" x="401" y="547" />
+ <di:waypoint xsi:type="dc:Point" x="429" y="547" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="415" y="526" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ExclusiveGateway_0tuxj9l_di" bpmnElement="ExclusiveGateway_0tuxj9l" isMarkerVisible="true">
+ <dc:Bounds x="608.352" y="522" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="633.352" y="576" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_108cgfw_di" bpmnElement="buildError">
+ <dc:Bounds x="695" y="577" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1ubla93_di" bpmnElement="SequenceFlow_1ubla93">
+ <di:waypoint xsi:type="dc:Point" x="454" y="522" />
+ <di:waypoint xsi:type="dc:Point" x="454" y="483" />
+ <di:waypoint xsi:type="dc:Point" x="496" y="483" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="461" y="489" width="19" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1piwh1c_di" bpmnElement="SequenceFlow_1piwh1c">
+ <di:waypoint xsi:type="dc:Point" x="454" y="572" />
+ <di:waypoint xsi:type="dc:Point" x="454" y="603" />
+ <di:waypoint xsi:type="dc:Point" x="633" y="603" />
+ <di:waypoint xsi:type="dc:Point" x="633" y="572" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="460" y="576.85" width="14" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1nku4uk_di" bpmnElement="SequenceFlow_1nku4uk">
+ <di:waypoint xsi:type="dc:Point" x="596" y="483" />
+ <di:waypoint xsi:type="dc:Point" x="633" y="483" />
+ <di:waypoint xsi:type="dc:Point" x="633" y="522" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="614.5" y="462" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1yx80cq_di" bpmnElement="SequenceFlow_1yx80cq">
+ <di:waypoint xsi:type="dc:Point" x="658" y="547" />
+ <di:waypoint xsi:type="dc:Point" x="745" y="547" />
+ <di:waypoint xsi:type="dc:Point" x="745" y="577" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="656.5" y="526" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0bnzfqb_di" bpmnElement="SequenceFlow_0bnzfqb">
+ <di:waypoint xsi:type="dc:Point" x="795" y="617" />
+ <di:waypoint xsi:type="dc:Point" x="870" y="617" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="787.5" y="596" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="EndEvent_1l1f6zj_di" bpmnElement="EndEvent_1yiy2fi">
+ <dc:Bounds x="870" y="599" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="887.352" y="639" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ExclusiveGateway_18ndby1_di" bpmnElement="ExclusiveGateway_18ndby1" isMarkerVisible="true">
+ <dc:Bounds x="284.352" y="592" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="338" y="605" width="54" height="24" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0y1by9x_di" bpmnElement="SequenceFlow_0y1by9x">
+ <di:waypoint xsi:type="dc:Point" x="309" y="592" />
+ <di:waypoint xsi:type="dc:Point" x="309" y="547" />
+ <di:waypoint xsi:type="dc:Point" x="365" y="547" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="315" y="558" width="19" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1az3a2q_di" bpmnElement="SequenceFlow_1az3a2q">
+ <di:waypoint xsi:type="dc:Point" x="309" y="642" />
+ <di:waypoint xsi:type="dc:Point" x="309" y="686" />
+ <di:waypoint xsi:type="dc:Point" x="745" y="686" />
+ <di:waypoint xsi:type="dc:Point" x="745" y="657" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="318" y="657" width="14" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn2:definitions>
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java
index 506088eb15..477dce1072 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java
@@ -9,9 +9,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFConfigModifyActivity.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFConfigModifyActivity.bpmn
new file mode 100644
index 0000000000..d77b1cebb1
--- /dev/null
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFConfigModifyActivity.bpmn
@@ -0,0 +1,67 @@
+<?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.9.0">
+ <bpmn:process id="VNFConfigModifyActivity" name="VNFConfigModifyActivity" isExecutable="true">
+ <bpmn:startEvent id="Start_VNFConfigModifyActivity" name="Start">
+ <bpmn:outgoing>SequenceFlow_0d87xrn</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:serviceTask id="ConfigModify" name="VNF Config Modify&#10;" camunda:type="external" camunda:topic="AppcService">
+ <bpmn:incoming>SequenceFlow_05oatn2</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1pg83wr</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="SequenceFlow_0d87xrn" sourceRef="Start_VNFConfigModifyActivity" targetRef="PreProcessActivity" />
+ <bpmn:endEvent id="End_VNFConfigModifyActivity" name="End">
+ <bpmn:incoming>SequenceFlow_1pg83wr</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_1pg83wr" sourceRef="ConfigModify" targetRef="End_VNFConfigModifyActivity" />
+ <bpmn:serviceTask id="PreProcessActivity" name="PreProcess Activity" camunda:expression="${AppcOrchestratorPreProcessor.buildAppcTaskRequest(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)),&#34;ConfigModify&#34;)}">
+ <bpmn:incoming>SequenceFlow_0d87xrn</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_05oatn2</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="SequenceFlow_05oatn2" sourceRef="PreProcessActivity" targetRef="ConfigModify" />
+ </bpmn:process>
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="VNFConfigModifyActivity">
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="Start_VNFConfigModifyActivity">
+ <dc:Bounds x="173" y="102" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="179" y="138" width="25" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_1q3bjtz_di" bpmnElement="ConfigModify">
+ <dc:Bounds x="532" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0d87xrn_di" bpmnElement="SequenceFlow_0d87xrn">
+ <di:waypoint xsi:type="dc:Point" x="209" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="257" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="257" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="304" y="120" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="272" y="114" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="EndEvent_15t8iwk_di" bpmnElement="End_VNFConfigModifyActivity">
+ <dc:Bounds x="756" y="102" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="764" y="142" width="20" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1pg83wr_di" bpmnElement="SequenceFlow_1pg83wr">
+ <di:waypoint xsi:type="dc:Point" x="632" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="756" y="120" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="694" y="99" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_0h60lbz_di" bpmnElement="PreProcessActivity">
+ <dc:Bounds x="308" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_05oatn2_di" bpmnElement="SequenceFlow_05oatn2">
+ <di:waypoint xsi:type="dc:Point" x="408" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="532" y="120" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="470" y="99" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/VnfAdapter.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/VnfAdapter.bpmn
index 30a95eb81f..e139e94660 100644
--- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/VnfAdapter.bpmn
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/VnfAdapter.bpmn
@@ -27,92 +27,91 @@
<bpmn:outgoing>SequenceFlow_1ivhukd</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:sequenceFlow id="SequenceFlow_1ivhukd" sourceRef="PostProcessResponse" targetRef="VnfAdapter_End" />
- <bpmn:callActivity id="Call_vnfAdapterRestV1" name="Call vnfAdapterRestV1" calledElement="vnfAdapterRestV1">
+ <bpmn:callActivity id="Call_vnfAdapterTask" name="&#10;Cloud&#10;Create&#10;(vnf)&#10;" calledElement="vnfAdapterTask">
<bpmn:extensionElements>
<camunda:out source="WorkflowException" target="WorkflowException" />
- <camunda:in source="VNFREST_Request" target="vnfAdapterRestV1Request" />
- <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" />
- <camunda:out source="vnfAdapterRestV1Response" target="vnfAdapterRestV1Response" />
+ <camunda:in source="VNFREST_Request" target="vnfAdapterTaskRequest" />
+ <camunda:out source="WorkflowResponse" target="WorkflowResponse" />
<camunda:in source="mso-request-id" target="mso-request-id" />
<camunda:in source="mso-service-instance-id" target="mso-service-instance-id" />
</bpmn:extensionElements>
<bpmn:incoming>SequenceFlow_0qaaf5k</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_0j1zvis</bpmn:outgoing>
</bpmn:callActivity>
- <bpmn:sequenceFlow id="SequenceFlow_0qaaf5k" sourceRef="PreProcessRequest" targetRef="Call_vnfAdapterRestV1" />
- <bpmn:sequenceFlow id="SequenceFlow_0j1zvis" sourceRef="Call_vnfAdapterRestV1" targetRef="PostProcessResponse" />
+ <bpmn:sequenceFlow id="SequenceFlow_0qaaf5k" sourceRef="PreProcessRequest" targetRef="Call_vnfAdapterTask" />
+ <bpmn:sequenceFlow id="SequenceFlow_0j1zvis" sourceRef="Call_vnfAdapterTask" targetRef="PostProcessResponse" />
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="VnfAdapter">
<bpmndi:BPMNShape id="StartEvent_0kxwniy_di" bpmnElement="VnfAdapter_Start">
- <dc:Bounds x="213" y="357" width="36" height="36" />
+ <dc:Bounds x="156" y="103" width="36" height="36" />
<bpmndi:BPMNLabel>
<dc:Bounds x="219" y="393" width="24" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="SubProcess_17szae7_di" bpmnElement="VnfAdapter_Error" isExpanded="true">
- <dc:Bounds x="453" y="529" width="233" height="135" />
+ <dc:Bounds x="396" y="275" width="233" height="135" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1xr6chl_di" bpmnElement="SequenceFlow_1xr6chl">
- <di:waypoint xsi:type="dc:Point" x="249" y="375" />
- <di:waypoint xsi:type="dc:Point" x="329" y="375" />
+ <di:waypoint xsi:type="dc:Point" x="192" y="121" />
+ <di:waypoint xsi:type="dc:Point" x="272" y="121" />
<bpmndi:BPMNLabel>
<dc:Bounds x="244" y="360" width="90" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="EndEvent_16vfqpk_di" bpmnElement="Error_End">
- <dc:Bounds x="606" y="573" width="36" height="36" />
+ <dc:Bounds x="549" y="319" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="615" y="613" width="19" height="12" />
+ <dc:Bounds x="558" y="359" width="20" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="StartEvent_1t3ep1m_di" bpmnElement="Error_Start">
- <dc:Bounds x="491" y="573" width="36" height="36" />
+ <dc:Bounds x="434" y="319" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="498" y="613" width="24" height="12" />
+ <dc:Bounds x="441" y="359" width="24" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1abat8l_di" bpmnElement="SequenceFlow_1abat8l">
- <di:waypoint xsi:type="dc:Point" x="527" y="591" />
- <di:waypoint xsi:type="dc:Point" x="566" y="591" />
- <di:waypoint xsi:type="dc:Point" x="566" y="591" />
- <di:waypoint xsi:type="dc:Point" x="606" y="591" />
+ <di:waypoint xsi:type="dc:Point" x="470" y="337" />
+ <di:waypoint xsi:type="dc:Point" x="509" y="337" />
+ <di:waypoint xsi:type="dc:Point" x="509" y="337" />
+ <di:waypoint xsi:type="dc:Point" x="549" y="337" />
<bpmndi:BPMNLabel>
<dc:Bounds x="536" y="591" width="90" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="EndEvent_0qdq7wj_di" bpmnElement="VnfAdapter_End">
- <dc:Bounds x="894" y="357" width="36" height="36" />
+ <dc:Bounds x="837" y="103" width="36" height="36" />
<bpmndi:BPMNLabel>
<dc:Bounds x="902" y="397" width="19" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ServiceTask_1frb5h2_di" bpmnElement="PreProcessRequest">
- <dc:Bounds x="329" y="335" width="100" height="80" />
+ <dc:Bounds x="272" y="81" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ServiceTask_1yomr79_di" bpmnElement="PostProcessResponse">
- <dc:Bounds x="714" y="335" width="100" height="80" />
+ <dc:Bounds x="657" y="81" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1ivhukd_di" bpmnElement="SequenceFlow_1ivhukd">
- <di:waypoint xsi:type="dc:Point" x="814" y="375" />
- <di:waypoint xsi:type="dc:Point" x="894" y="375" />
+ <di:waypoint xsi:type="dc:Point" x="757" y="121" />
+ <di:waypoint xsi:type="dc:Point" x="837" y="121" />
<bpmndi:BPMNLabel>
<dc:Bounds x="809" y="354" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="CallActivity_0n6wnin_di" bpmnElement="Call_vnfAdapterRestV1">
- <dc:Bounds x="520" y="335" width="100" height="80" />
+ <bpmndi:BPMNShape id="CallActivity_0n6wnin_di" bpmnElement="Call_vnfAdapterTask">
+ <dc:Bounds x="463" y="81" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0qaaf5k_di" bpmnElement="SequenceFlow_0qaaf5k">
- <di:waypoint xsi:type="dc:Point" x="429" y="375" />
- <di:waypoint xsi:type="dc:Point" x="520" y="375" />
+ <di:waypoint xsi:type="dc:Point" x="372" y="121" />
+ <di:waypoint xsi:type="dc:Point" x="463" y="121" />
<bpmndi:BPMNLabel>
<dc:Bounds x="429.5" y="354" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0j1zvis_di" bpmnElement="SequenceFlow_0j1zvis">
- <di:waypoint xsi:type="dc:Point" x="620" y="375" />
- <di:waypoint xsi:type="dc:Point" x="714" y="375" />
+ <di:waypoint xsi:type="dc:Point" x="563" y="121" />
+ <di:waypoint xsi:type="dc:Point" x="657" y="121" />
<bpmndi:BPMNLabel>
<dc:Bounds x="622" y="354" width="90" height="12" />
</bpmndi:BPMNLabel>
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFConfigModifyActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFConfigModifyActivityTest.java
new file mode 100644
index 0000000000..99ee8d9fcb
--- /dev/null
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFConfigModifyActivityTest.java
@@ -0,0 +1,54 @@
+/*-
+ * ============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 java.util.List;
+import org.camunda.bpm.engine.delegate.BpmnError;
+import org.camunda.bpm.engine.externaltask.LockedExternalTask;
+import org.camunda.bpm.engine.runtime.ProcessInstance;
+import org.junit.Test;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.BaseBPMNTest;
+
+public class VNFConfigModifyActivityTest extends BaseBPMNTest {
+ @Test
+ public void sunnyDayVNFConfigModifyActivity_Test() throws InterruptedException {
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFConfigModifyActivity", variables);
+ assertThat(pi).isNotNull();
+ processExternalTasks(pi, "ConfigModify");
+ assertThat(pi).isStarted().hasPassedInOrder("Start_VNFConfigModifyActivity", "PreProcessActivity",
+ "ConfigModify", "End_VNFConfigModifyActivity");
+ assertThat(pi).isEnded();
+ }
+
+ @Test
+ public void rainyDayVNFConfigModifyActivity_Test() throws Exception {
+ doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcOrchestratorPreProcessor)
+ .buildAppcTaskRequest(any(BuildingBlockExecution.class), any(String.class));
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFConfigModifyActivity", variables);
+ assertThat(pi).isNotNull().isStarted().hasPassedInOrder("Start_VNFConfigModifyActivity", "PreProcessActivity")
+ .hasNotPassed("ConfigModify", "End_VNFConfigModifyActivity");
+ }
+
+}
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VnfAdapterTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VnfAdapterTest.java
index 8ad4e0f07f..4dbf4d46ff 100644
--- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VnfAdapterTest.java
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VnfAdapterTest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -32,11 +32,11 @@ import org.onap.so.bpmn.common.BuildingBlockExecution;
public class VnfAdapterTest extends BaseBPMNTest {
@Test
public void vnfAdapterCreatedTest() {
- mockSubprocess("vnfAdapterRestV1", "Mocked vnfAdapterRestV1", "GenericStub");
+ mockSubprocess("vnfAdapterTask", "Mocked vnfAdapterTask", "GenericStub");
ProcessInstance pi = runtimeService.startProcessInstanceByKey("VnfAdapter", variables);
assertThat(pi).isNotNull();
- assertThat(pi).isStarted().hasPassedInOrder("VnfAdapter_Start", "PreProcessRequest", "Call_vnfAdapterRestV1",
+ assertThat(pi).isStarted().hasPassedInOrder("VnfAdapter_Start", "PreProcessRequest", "Call_vnfAdapterTask",
"PostProcessResponse", "VnfAdapter_End");
assertThat(pi).isEnded();
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy
index 8b9726c2b7..7d1bc4c779 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy
@@ -127,11 +127,7 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
String key = iterator.next()
HashMap<String, String> hashMap = new HashMap()
hashMap.put("name", key)
- if(jsonObject.get(key)==null){
- hashMap.put("value", "")
- }else{
- hashMap.put("value", jsonObject.get(key))
- }
+ hashMap.put("value", jsonObject.get(key))
paramList.add(hashMap)
}
Map<String, List<Map<String, Object>>> paramMap = new HashMap()
@@ -260,6 +256,17 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
break
+ case ~/[\w\s\W]*UNI[\w\s\W]*/ :
+ def resourceInput = resourceInputObj.getResourceParameters()
+ String incomingRequest = resourceInputObj.getRequestsInputs()
+ String serviceParameters = JsonUtils.getJsonValue(incomingRequest, "service.parameters")
+ String requestInputs = JsonUtils.getJsonValue(serviceParameters, "requestInputs")
+ JSONObject inputParameters = new JSONObject(requestInputs)
+ String uResourceInput = jsonUtil.addJsonValue(resourceInput, "requestInputs.service-name", inputParameters.get("name"))
+ resourceInputObj.setResourceParameters(uResourceInput)
+ execution.setVariable(Prefix + "resourceInput", resourceInputObj.toString())
+ break
+
case ~/[\w\s\W]*sdwanvpnattachment[\w\s\W]*/ :
case ~/[\w\s\W]*sotnvpnattachment[\w\s\W]*/ :
case ~/[\w\s\W]*SOTN-Attachment[\w\s\W]*/ :
@@ -363,7 +370,7 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
<sdncadapter:MsoAction>opticalservice</sdncadapter:MsoAction>
</sdncadapter:RequestHeader>
<sdncadapterworkflow:SDNCRequestData>
- <request-id>${msoUtils.xmlEscape(hdrRequestId)}</request-id>
+ <request-id>${msoUtils.xmlEscape(serviceInstanceId)}</request-id>
<global-customer-id>${msoUtils.xmlEscape(globalCustomerId)}</global-customer-id>
<service-type>${msoUtils.xmlEscape(serviceType)}</service-type>
<notification-url>sdncCallback</notification-url>
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy
index 61b1250522..cdc242dbd8 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy
@@ -221,6 +221,30 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor {
switch (modelType) {
case "VNF":
+ if(modelName.contains("UNI") && "MDONS_OTN".equals(serviceType)){
+ String serviceInstanceName = resourceInputObj.getResourceInstanceName()
+ sdncTopologyDeleteRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
+ xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1"
+ xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1">
+ <sdncadapter:RequestHeader>
+ <sdncadapter:RequestId>${MsoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId>
+ <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId>
+ <sdncadapter:SvcAction>${MsoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction>
+ <sdncadapter:SvcOperation>optical-service-delete</sdncadapter:SvcOperation>
+ <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl>
+ <sdncadapter:MsoAction>opticalservice</sdncadapter:MsoAction>
+ </sdncadapter:RequestHeader>
+ <sdncadapterworkflow:SDNCRequestData>
+ <request-id>${msoUtils.xmlEscape(serviceInstanceId)}</request-id>
+ <payload>
+ <param>
+ <name>service-name</name>
+ <value>${msoUtils.xmlEscape(serviceInstanceName)}</value>
+ </param>
+ </payload>
+ </sdncadapterworkflow:SDNCRequestData>
+ </aetgt:SDNCAdapterWorkflowRequest>""".trim()
+ } else{
sdncTopologyDeleteRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1"
xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1">
@@ -275,6 +299,7 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor {
</vnf-request-input>
</sdncadapterworkflow:SDNCRequestData>
</aetgt:SDNCAdapterWorkflowRequest>""".trim()
+ }
break
case "GROUP" :
//When a new resource creation request reaches SO, the parent resources information needs to be provided
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 a77f6f0628..a505aa1a34 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
@@ -50,164 +50,164 @@ import javax.ws.rs.NotFoundException
public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{
private static final Logger logger = LoggerFactory.getLogger( DoCreateVfModuleRollback.class);
- def Prefix="DCVFMR_"
- ExceptionUtil exceptionUtil = new ExceptionUtil()
-
- public void initProcessVariables(DelegateExecution execution) {
- execution.setVariable("prefix",Prefix)
- }
-
- // parse the incoming DELETE_VF_MODULE request for the Generic Vnf and Vf Module Ids
- // and formulate the outgoing request for PrepareUpdateAAIVfModuleRequest
- public void preProcessRequest(DelegateExecution execution) {
-
-
- initProcessVariables(execution)
-
- try {
-
- execution.setVariable("rolledBack", null)
- execution.setVariable("rollbackError", null)
-
- def rollbackData = execution.getVariable("rollbackData")
- logger.debug("RollbackData:" + rollbackData)
-
- if (rollbackData != null) {
- String vnfId = rollbackData.get("VFMODULE", "vnfid")
- execution.setVariable("DCVFMR_vnfId", vnfId)
- String vfModuleId = rollbackData.get("VFMODULE", "vfmoduleid")
- execution.setVariable("DCVFMR_vfModuleId", vfModuleId)
- String source = rollbackData.get("VFMODULE", "source")
- execution.setVariable("DCVFMR_source", source)
- String serviceInstanceId = rollbackData.get("VFMODULE", "serviceInstanceId")
- execution.setVariable("DCVFMR_serviceInstanceId", serviceInstanceId)
- String serviceId = rollbackData.get("VFMODULE", "service-id")
- execution.setVariable("DCVFMR_serviceId", serviceId)
- String vnfType = rollbackData.get("VFMODULE", "vnftype")
- execution.setVariable("DCVFMR_vnfType", vnfType)
- String vnfName = rollbackData.get("VFMODULE", "vnfname")
- execution.setVariable("DCVFMR_vnfName", vnfName)
- String tenantId = rollbackData.get("VFMODULE", "tenantid")
- execution.setVariable("DCVFMR_tenantId", tenantId)
- String vfModuleName = rollbackData.get("VFMODULE", "vfmodulename")
- execution.setVariable("DCVFMR_vfModuleName", vfModuleName)
- String vfModuleModelName = rollbackData.get("VFMODULE", "vfmodulemodelname")
- execution.setVariable("DCVFMR_vfModuleModelName", vfModuleModelName)
- String cloudSiteId = rollbackData.get("VFMODULE", "aiccloudregion")
- execution.setVariable("DCVFMR_cloudSiteId", cloudSiteId)
- String cloudOwner = rollbackData.get("VFMODULE", "cloudowner")
- execution.setVariable("DCVFMR_cloudOwner", cloudOwner)
- String heatStackId = rollbackData.get("VFMODULE", "heatstackid")
- execution.setVariable("DCVFMR_heatStackId", heatStackId)
- String requestId = rollbackData.get("VFMODULE", "msorequestid")
- execution.setVariable("DCVFMR_requestId", requestId)
- // Set mso-request-id to request-id for VNF Adapter interface
- execution.setVariable("mso-request-id", requestId)
- List createdNetworkPolicyFqdnList = []
- int i = 0
- while (i < 100) {
- String fqdn = rollbackData.get("VFMODULE", "contrailNetworkPolicyFqdn" + i)
- if (fqdn == null) {
- break
- }
- createdNetworkPolicyFqdnList.add(fqdn)
- logger.debug("got fqdn # " + i + ": " + fqdn)
- i = i + 1
-
- }
-
- execution.setVariable("DCVFMR_createdNetworkPolicyFqdnList", createdNetworkPolicyFqdnList)
- String oamManagementV4Address = rollbackData.get("VFMODULE", "oamManagementV4Address")
- execution.setVariable("DCVFMR_oamManagementV4Address", oamManagementV4Address)
- String oamManagementV6Address = rollbackData.get("VFMODULE", "oamManagementV6Address")
- execution.setVariable("DCVFMR_oamManagementV6Address", oamManagementV6Address)
- //String serviceInstanceId = rollbackData.get("VFMODULE", "msoserviceinstanceid")
- //execution.setVariable("DCVFMR_serviceInstanceId", serviceInstanceId)
- execution.setVariable("DCVFMR_rollbackPrepareUpdateVfModule", rollbackData.get("VFMODULE", "rollbackPrepareUpdateVfModule"))
- execution.setVariable("DCVFMR_rollbackUpdateAAIVfModule", rollbackData.get("VFMODULE", "rollbackUpdateAAIVfModule"))
- execution.setVariable("DCVFMR_rollbackVnfAdapterCreate", rollbackData.get("VFMODULE", "rollbackVnfAdapterCreate"))
- execution.setVariable("DCVFMR_rollbackSDNCRequestAssign", rollbackData.get("VFMODULE", "rollbackSDNCRequestAssign"))
- execution.setVariable("DCVFMR_rollbackSDNCRequestActivate", rollbackData.get("VFMODULE", "rollbackSDNCRequestActivate"))
- execution.setVariable("DCVFMR_rollbackCreateAAIVfModule", rollbackData.get("VFMODULE", "rollbackCreateAAIVfModule"))
- execution.setVariable("DCVFMR_rollbackCreateNetworkPoliciesAAI", rollbackData.get("VFMODULE", "rollbackCreateNetworkPoliciesAAI"))
- execution.setVariable("DCVFMR_rollbackUpdateVnfAAI", rollbackData.get("VFMODULE", "rollbackUpdateVnfAAI"))
-
- // formulate the request for PrepareUpdateAAIVfModule
- String request = """<PrepareUpdateAAIVfModuleRequest>
+ def Prefix="DCVFMR_"
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+
+ public void initProcessVariables(DelegateExecution execution) {
+ execution.setVariable("prefix",Prefix)
+ }
+
+ // parse the incoming DELETE_VF_MODULE request for the Generic Vnf and Vf Module Ids
+ // and formulate the outgoing request for PrepareUpdateAAIVfModuleRequest
+ public void preProcessRequest(DelegateExecution execution) {
+
+
+ initProcessVariables(execution)
+
+ try {
+
+ execution.setVariable("rolledBack", null)
+ execution.setVariable("rollbackError", null)
+
+ def rollbackData = execution.getVariable("rollbackData")
+ logger.debug("RollbackData:" + rollbackData)
+
+ if (rollbackData != null) {
+ String vnfId = rollbackData.get("VFMODULE", "vnfid")
+ execution.setVariable("DCVFMR_vnfId", vnfId)
+ String vfModuleId = rollbackData.get("VFMODULE", "vfmoduleid")
+ execution.setVariable("DCVFMR_vfModuleId", vfModuleId)
+ String source = rollbackData.get("VFMODULE", "source")
+ execution.setVariable("DCVFMR_source", source)
+ String serviceInstanceId = rollbackData.get("VFMODULE", "serviceInstanceId")
+ execution.setVariable("DCVFMR_serviceInstanceId", serviceInstanceId)
+ String serviceId = rollbackData.get("VFMODULE", "service-id")
+ execution.setVariable("DCVFMR_serviceId", serviceId)
+ String vnfType = rollbackData.get("VFMODULE", "vnftype")
+ execution.setVariable("DCVFMR_vnfType", vnfType)
+ String vnfName = rollbackData.get("VFMODULE", "vnfname")
+ execution.setVariable("DCVFMR_vnfName", vnfName)
+ String tenantId = rollbackData.get("VFMODULE", "tenantid")
+ execution.setVariable("DCVFMR_tenantId", tenantId)
+ String vfModuleName = rollbackData.get("VFMODULE", "vfmodulename")
+ execution.setVariable("DCVFMR_vfModuleName", vfModuleName)
+ String vfModuleModelName = rollbackData.get("VFMODULE", "vfmodulemodelname")
+ execution.setVariable("DCVFMR_vfModuleModelName", vfModuleModelName)
+ String cloudSiteId = rollbackData.get("VFMODULE", "aiccloudregion")
+ execution.setVariable("DCVFMR_cloudSiteId", cloudSiteId)
+ String cloudOwner = rollbackData.get("VFMODULE", "cloudowner")
+ execution.setVariable("DCVFMR_cloudOwner", cloudOwner)
+ String heatStackId = rollbackData.get("VFMODULE", "heatstackid")
+ execution.setVariable("DCVFMR_heatStackId", heatStackId)
+ String requestId = rollbackData.get("VFMODULE", "msorequestid")
+ execution.setVariable("DCVFMR_requestId", requestId)
+ // Set mso-request-id to request-id for VNF Adapter interface
+ execution.setVariable("mso-request-id", requestId)
+ List createdNetworkPolicyFqdnList = []
+ int i = 0
+ while (i < 100) {
+ String fqdn = rollbackData.get("VFMODULE", "contrailNetworkPolicyFqdn" + i)
+ if (fqdn == null) {
+ break
+ }
+ createdNetworkPolicyFqdnList.add(fqdn)
+ logger.debug("got fqdn # " + i + ": " + fqdn)
+ i = i + 1
+
+ }
+
+ execution.setVariable("DCVFMR_createdNetworkPolicyFqdnList", createdNetworkPolicyFqdnList)
+ String oamManagementV4Address = rollbackData.get("VFMODULE", "oamManagementV4Address")
+ execution.setVariable("DCVFMR_oamManagementV4Address", oamManagementV4Address)
+ String oamManagementV6Address = rollbackData.get("VFMODULE", "oamManagementV6Address")
+ execution.setVariable("DCVFMR_oamManagementV6Address", oamManagementV6Address)
+ //String serviceInstanceId = rollbackData.get("VFMODULE", "msoserviceinstanceid")
+ //execution.setVariable("DCVFMR_serviceInstanceId", serviceInstanceId)
+ execution.setVariable("DCVFMR_rollbackPrepareUpdateVfModule", rollbackData.get("VFMODULE", "rollbackPrepareUpdateVfModule"))
+ execution.setVariable("DCVFMR_rollbackUpdateAAIVfModule", rollbackData.get("VFMODULE", "rollbackUpdateAAIVfModule"))
+ execution.setVariable("DCVFMR_rollbackVnfAdapterCreate", rollbackData.get("VFMODULE", "rollbackVnfAdapterCreate"))
+ execution.setVariable("DCVFMR_rollbackSDNCRequestAssign", rollbackData.get("VFMODULE", "rollbackSDNCRequestAssign"))
+ execution.setVariable("DCVFMR_rollbackSDNCRequestActivate", rollbackData.get("VFMODULE", "rollbackSDNCRequestActivate"))
+ execution.setVariable("DCVFMR_rollbackCreateAAIVfModule", rollbackData.get("VFMODULE", "rollbackCreateAAIVfModule"))
+ execution.setVariable("DCVFMR_rollbackCreateNetworkPoliciesAAI", rollbackData.get("VFMODULE", "rollbackCreateNetworkPoliciesAAI"))
+ execution.setVariable("DCVFMR_rollbackUpdateVnfAAI", rollbackData.get("VFMODULE", "rollbackUpdateVnfAAI"))
+
+ // formulate the request for PrepareUpdateAAIVfModule
+ String request = """<PrepareUpdateAAIVfModuleRequest>
<vnf-id>${MsoUtils.xmlEscape(vnfId)}</vnf-id>
<vf-module-id>${MsoUtils.xmlEscape(vfModuleId)}</vf-module-id>
<orchestration-status>pending-delete</orchestration-status>
</PrepareUpdateAAIVfModuleRequest>""" as String
- logger.debug("PrepareUpdateAAIVfModuleRequest :" + request)
- execution.setVariable("PrepareUpdateAAIVfModuleRequest", request)
- } else {
- execution.setVariable("skipRollback", true)
- }
-
- if (execution.getVariable("disableRollback").equals("true" )) {
- execution.setVariable("skipRollback", true)
- }
-
- } catch (BpmnError e) {
- throw e;
- } catch (Exception ex){
- def msg = "Exception in DoCreateVfModuleRollback preProcessRequest " + ex.getMessage()
- logger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
- }
- }
-
- // build a SDNC vnf-topology-operation request for the specified action
- // (note: the action passed is expected to be 'changedelete' or 'delete')
- public void prepSDNCAdapterRequest(DelegateExecution execution) {
-
- String srvInstId = execution.getVariable("DCVFMR_serviceInstanceId")
-
- String uuid = execution.getVariable('testReqId') // for junits
- if(uuid==null){
- uuid = execution.getVariable("DCVFMR_requestId") + "-" + System.currentTimeMillis()
- }
-
- def callbackUrl = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution)
-
- String source = execution.getVariable("DCVFMR_source")
- String serviceId = execution.getVariable("DCVFMR_serviceId")
- String vnfId = execution.getVariable("DCVFMR_vnfId")
- String vnfType = execution.getVariable("DCVFMR_vnfType")
- String vnfName = execution.getVariable("DCVFMR_vnfName")
- String tenantId = execution.getVariable("DCVFMR_tenantId")
- String vfModuleId = execution.getVariable("DCVFMR_vfModuleId")
- String vfModuleName = execution.getVariable("DCVFMR_vfModuleName")
- String vfModuleModelName = execution.getVariable("DCVFMR_vfModuleModelName")
- String cloudSiteId = execution.getVariable("DCVFMR_cloudSiteId")
- String requestId = execution.getVariable("DCVFMR_requestId")
-
- String serviceInstanceIdToSdnc = ""
- if (srvInstId != null && !srvInstId.isEmpty()) {
- serviceInstanceIdToSdnc = srvInstId
- } else {
- serviceInstanceIdToSdnc = vfModuleId
- }
-
- def doSDNCActivateRollback = execution.getVariable("DCVFMR_rollbackSDNCRequestActivate")
- def doSDNCAssignRollback = execution.getVariable("DCVFMR_rollbackSDNCRequestAssign")
-
- def action = ""
- def requestAction = ""
-
- if (doSDNCActivateRollback.equals("true")) {
- action = "delete"
- requestAction = "DisconnectVNFRequest"
- }
- else if (doSDNCAssignRollback.equals("true")) {
- action = "rollback"
- requestAction = "VNFActivateRequest"
- }
- else
- return
-
-
- String request = """<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.onap/so/request/types/v1"
+ logger.debug("PrepareUpdateAAIVfModuleRequest :" + request)
+ execution.setVariable("PrepareUpdateAAIVfModuleRequest", request)
+ } else {
+ execution.setVariable("skipRollback", true)
+ }
+
+ if (execution.getVariable("disableRollback").equals("true" )) {
+ execution.setVariable("skipRollback", true)
+ }
+
+ } catch (BpmnError e) {
+ throw e;
+ } catch (Exception ex){
+ def msg = "Exception in DoCreateVfModuleRollback preProcessRequest " + ex.getMessage()
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ }
+
+ // build a SDNC vnf-topology-operation request for the specified action
+ // (note: the action passed is expected to be 'changedelete' or 'delete')
+ public void prepSDNCAdapterRequest(DelegateExecution execution) {
+
+ String srvInstId = execution.getVariable("DCVFMR_serviceInstanceId")
+
+ String uuid = execution.getVariable('testReqId') // for junits
+ if(uuid==null){
+ uuid = execution.getVariable("DCVFMR_requestId") + "-" + System.currentTimeMillis()
+ }
+
+ def callbackUrl = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution)
+
+ String source = execution.getVariable("DCVFMR_source")
+ String serviceId = execution.getVariable("DCVFMR_serviceId")
+ String vnfId = execution.getVariable("DCVFMR_vnfId")
+ String vnfType = execution.getVariable("DCVFMR_vnfType")
+ String vnfName = execution.getVariable("DCVFMR_vnfName")
+ String tenantId = execution.getVariable("DCVFMR_tenantId")
+ String vfModuleId = execution.getVariable("DCVFMR_vfModuleId")
+ String vfModuleName = execution.getVariable("DCVFMR_vfModuleName")
+ String vfModuleModelName = execution.getVariable("DCVFMR_vfModuleModelName")
+ String cloudSiteId = execution.getVariable("DCVFMR_cloudSiteId")
+ String requestId = execution.getVariable("DCVFMR_requestId")
+
+ String serviceInstanceIdToSdnc = ""
+ if (srvInstId != null && !srvInstId.isEmpty()) {
+ serviceInstanceIdToSdnc = srvInstId
+ } else {
+ serviceInstanceIdToSdnc = vfModuleId
+ }
+
+ def doSDNCActivateRollback = execution.getVariable("DCVFMR_rollbackSDNCRequestActivate")
+ def doSDNCAssignRollback = execution.getVariable("DCVFMR_rollbackSDNCRequestAssign")
+
+ def action = ""
+ def requestAction = ""
+
+ if (doSDNCActivateRollback.equals("true")) {
+ action = "delete"
+ requestAction = "DisconnectVNFRequest"
+ }
+ else if (doSDNCAssignRollback.equals("true")) {
+ action = "rollback"
+ requestAction = "VNFActivateRequest"
+ }
+ else
+ return
+
+
+ String request = """<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.onap/so/request/types/v1"
xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"
xmlns:sdncadapter="http://org.onap/workflow/sdnc/adapter/schema/v1">
<sdncadapter:RequestHeader>
@@ -245,76 +245,76 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{
</sdncadapterworkflow:SDNCRequestData>
</sdncadapterworkflow:SDNCAdapterWorkflowRequest>"""
- logger.debug("sdncAdapterWorkflowRequest: " + request)
- execution.setVariable("sdncAdapterWorkflowRequest", request)
- }
-
- public void preProcessSDNCDeactivateRequest(DelegateExecution execution){
-
- execution.setVariable("prefix", Prefix)
- logger.trace("STARTED preProcessSDNCDeactivateRequest")
-
- def serviceInstanceId = execution.getVariable("DCVFMR_serviceInstanceId")
-
- try{
- //Build SDNC Request
-
- String deactivateSDNCRequest = buildSDNCRequest(execution, serviceInstanceId, "deactivate")
-
- deactivateSDNCRequest = utils.formatXml(deactivateSDNCRequest)
- execution.setVariable("DCVFMR_deactivateSDNCRequest", deactivateSDNCRequest)
- logger.debug("Outgoing DeactivateSDNCRequest is: \n" + deactivateSDNCRequest)
-
- }catch(Exception e){
- logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- "Exception Occured Processing preProcessSDNCDeactivateRequest.", "BPMN",
- ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
- exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessSDNCDeactivateRequest Method:\n" + e.getMessage())
- }
- logger.trace("COMPLETED preProcessSDNCDeactivateRequest")
- }
-
- public void preProcessSDNCUnassignRequest(DelegateExecution execution) {
- def method = getClass().getSimpleName() + '.preProcessSDNCUnassignRequest(' +
- 'execution=' + execution.getId() +
- ')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logger.trace('Entered ' + method)
- execution.setVariable("prefix", Prefix)
- logger.trace("STARTED preProcessSDNCUnassignRequest Process")
- try{
- String serviceInstanceId = execution.getVariable("DCVFMR_serviceInstanceId")
-
- String unassignSDNCRequest = buildSDNCRequest(execution, serviceInstanceId, "unassign")
-
- execution.setVariable("DCVFMR_unassignSDNCRequest", unassignSDNCRequest)
- logger.debug("Outgoing UnassignSDNCRequest is: \n" + unassignSDNCRequest)
-
- }catch(Exception e){
- logger.debug("Exception Occured Processing preProcessSDNCUnassignRequest. Exception is:\n" + e)
- exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessSDNCUnassignRequest Method:\n" + e.getMessage())
- }
- logger.trace("COMPLETED preProcessSDNCUnassignRequest Process")
- }
-
- public String buildSDNCRequest(DelegateExecution execution, String svcInstId, String action){
-
- String uuid = execution.getVariable('testReqId') // for junits
- if(uuid==null){
- uuid = execution.getVariable("DCVFMR_requestId") + "-" + System.currentTimeMillis()
- }
- def callbackURL = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution)
- def requestId = execution.getVariable("DCVFMR_requestId")
- def serviceId = execution.getVariable("DCVFMR_serviceId")
- def serviceInstanceId = execution.getVariable("DCVFMR_serviceInstanceId")
- def vfModuleId = execution.getVariable("DCVFMR_vfModuleId")
- def source = execution.getVariable("DCVFMR_source")
- def vnfId = execution.getVariable("DCVFMR_vnfId")
-
- def sdncVersion = execution.getVariable("sdncVersion")
-
- String sdncRequest =
- """<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.onap/so/request/types/v1"
+ logger.debug("sdncAdapterWorkflowRequest: " + request)
+ execution.setVariable("sdncAdapterWorkflowRequest", request)
+ }
+
+ public void preProcessSDNCDeactivateRequest(DelegateExecution execution){
+
+ execution.setVariable("prefix", Prefix)
+ logger.trace("STARTED preProcessSDNCDeactivateRequest")
+
+ def serviceInstanceId = execution.getVariable("DCVFMR_serviceInstanceId")
+
+ try{
+ //Build SDNC Request
+
+ String deactivateSDNCRequest = buildSDNCRequest(execution, serviceInstanceId, "deactivate")
+
+ deactivateSDNCRequest = utils.formatXml(deactivateSDNCRequest)
+ execution.setVariable("DCVFMR_deactivateSDNCRequest", deactivateSDNCRequest)
+ logger.debug("Outgoing DeactivateSDNCRequest is: \n" + deactivateSDNCRequest)
+
+ }catch(Exception e){
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Occured Processing preProcessSDNCDeactivateRequest.", "BPMN",
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessSDNCDeactivateRequest Method:\n" + e.getMessage())
+ }
+ logger.trace("COMPLETED preProcessSDNCDeactivateRequest")
+ }
+
+ public void preProcessSDNCUnassignRequest(DelegateExecution execution) {
+ def method = getClass().getSimpleName() + '.preProcessSDNCUnassignRequest(' +
+ 'execution=' + execution.getId() +
+ ')'
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ logger.trace('Entered ' + method)
+ execution.setVariable("prefix", Prefix)
+ logger.trace("STARTED preProcessSDNCUnassignRequest Process")
+ try{
+ String serviceInstanceId = execution.getVariable("DCVFMR_serviceInstanceId")
+
+ String unassignSDNCRequest = buildSDNCRequest(execution, serviceInstanceId, "unassign")
+
+ execution.setVariable("DCVFMR_unassignSDNCRequest", unassignSDNCRequest)
+ logger.debug("Outgoing UnassignSDNCRequest is: \n" + unassignSDNCRequest)
+
+ }catch(Exception e){
+ logger.debug("Exception Occured Processing preProcessSDNCUnassignRequest. Exception is:\n" + e)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessSDNCUnassignRequest Method:\n" + e.getMessage())
+ }
+ logger.trace("COMPLETED preProcessSDNCUnassignRequest Process")
+ }
+
+ public String buildSDNCRequest(DelegateExecution execution, String svcInstId, String action){
+
+ String uuid = execution.getVariable('testReqId') // for junits
+ if(uuid==null){
+ uuid = execution.getVariable("DCVFMR_requestId") + "-" + System.currentTimeMillis()
+ }
+ def callbackURL = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution)
+ def requestId = execution.getVariable("DCVFMR_requestId")
+ def serviceId = execution.getVariable("DCVFMR_serviceId")
+ def serviceInstanceId = execution.getVariable("DCVFMR_serviceInstanceId")
+ def vfModuleId = execution.getVariable("DCVFMR_vfModuleId")
+ def source = execution.getVariable("DCVFMR_source")
+ def vnfId = execution.getVariable("DCVFMR_vnfId")
+
+ def sdncVersion = execution.getVariable("sdncVersion")
+
+ String sdncRequest =
+ """<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.onap/so/request/types/v1"
xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"
xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1">
<sdncadapter:RequestHeader>
@@ -351,32 +351,32 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{
</sdncadapterworkflow:SDNCRequestData>
</sdncadapterworkflow:SDNCAdapterWorkflowRequest>"""
- logger.debug("sdncRequest: " + sdncRequest)
- return sdncRequest
- }
-
- // parse the incoming DELETE_VF_MODULE request
- // and formulate the outgoing VnfAdapterDeleteV1 request
- public void prepVNFAdapterRequest(DelegateExecution execution) {
-
- String requestId = UUID.randomUUID().toString()
- String origRequestId = execution.getVariable("DCVFMR_requestId")
- String srvInstId = execution.getVariable("DCVFMR_serviceInstanceId")
- String aicCloudRegion = execution.getVariable("DCVFMR_cloudSiteId")
- String cloudOwner = execution.getVariable("DCVFMR_cloudOwner")
- String vnfId = execution.getVariable("DCVFMR_vnfId")
- String vfModuleId = execution.getVariable("DCVFMR_vfModuleId")
- String vfModuleStackId = execution.getVariable("DCVFMR_heatStackId")
- String tenantId = execution.getVariable("DCVFMR_tenantId")
- def messageId = execution.getVariable('mso-request-id') + '-' +
- System.currentTimeMillis()
- def notificationUrl = createCallbackURL(execution, "VNFAResponse", messageId)
- def useQualifiedHostName = UrnPropertiesReader.getVariable("mso.use.qualified.host",execution)
- if ('true'.equals(useQualifiedHostName)) {
- notificationUrl = utils.getQualifiedHostNameForCallback(notificationUrl)
- }
-
- String request = """
+ logger.debug("sdncRequest: " + sdncRequest)
+ return sdncRequest
+ }
+
+ // parse the incoming DELETE_VF_MODULE request
+ // and formulate the outgoing VnfAdapterDeleteV1 request
+ public void prepVNFAdapterRequest(DelegateExecution execution) {
+
+ String requestId = UUID.randomUUID().toString()
+ String origRequestId = execution.getVariable("DCVFMR_requestId")
+ String srvInstId = execution.getVariable("DCVFMR_serviceInstanceId")
+ String aicCloudRegion = execution.getVariable("DCVFMR_cloudSiteId")
+ String cloudOwner = execution.getVariable("DCVFMR_cloudOwner")
+ String vnfId = execution.getVariable("DCVFMR_vnfId")
+ String vfModuleId = execution.getVariable("DCVFMR_vfModuleId")
+ String vfModuleStackId = execution.getVariable("DCVFMR_heatStackId")
+ String tenantId = execution.getVariable("DCVFMR_tenantId")
+ def messageId = execution.getVariable('mso-request-id') + '-' +
+ System.currentTimeMillis()
+ def notificationUrl = createCallbackURL(execution, "VNFAResponse", messageId)
+ def useQualifiedHostName = UrnPropertiesReader.getVariable("mso.use.qualified.host",execution)
+ if ('true'.equals(useQualifiedHostName)) {
+ notificationUrl = utils.getQualifiedHostNameForCallback(notificationUrl)
+ }
+
+ String request = """
<deleteVfModuleRequest>
<cloudSiteId>${MsoUtils.xmlEscape(aicCloudRegion)}</cloudSiteId>
<cloudOwner>${MsoUtils.xmlEscape(cloudOwner)}</cloudOwner>
@@ -394,117 +394,116 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{
</deleteVfModuleRequest>
""" as String
- logger.debug("vnfAdapterRestV1Request: " + request)
- execution.setVariable("vnfAdapterRestV1Request", request)
- }
+ execution.setVariable("vnfAdapterTaskRequest", request)
+ }
- // parse the incoming DELETE_VF_MODULE request
- // and formulate the outgoing UpdateAAIVfModuleRequest request
- public void prepUpdateAAIVfModule(DelegateExecution execution) {
+ // parse the incoming DELETE_VF_MODULE request
+ // and formulate the outgoing UpdateAAIVfModuleRequest request
+ public void prepUpdateAAIVfModule(DelegateExecution execution) {
- String vnfId = execution.getVariable("DCVFMR_vnfId")
- String vfModuleId = execution.getVariable("DCVFMR_vfModuleId")
- // formulate the request for UpdateAAIVfModule
- String request = """<UpdateAAIVfModuleRequest>
+ String vnfId = execution.getVariable("DCVFMR_vnfId")
+ String vfModuleId = execution.getVariable("DCVFMR_vfModuleId")
+ // formulate the request for UpdateAAIVfModule
+ String request = """<UpdateAAIVfModuleRequest>
<vnf-id>${MsoUtils.xmlEscape(vnfId)}</vnf-id>
<vf-module-id>${MsoUtils.xmlEscape(vfModuleId)}</vf-module-id>
<heat-stack-id>DELETE</heat-stack-id>
<orchestration-status>deleted</orchestration-status>
</UpdateAAIVfModuleRequest>""" as String
- logger.debug("UpdateAAIVfModuleRequest :" + request)
- execution.setVariable("UpdateAAIVfModuleRequest", request)
- }
-
- // parse the incoming DELETE_VF_MODULE request
- // and formulate the outgoing UpdateAAIVfModuleRequest request
- public void prepUpdateAAIVfModuleToAssigned(DelegateExecution execution) {
-
- String vnfId = execution.getVariable("DCVFMR_vnfId")
- String vfModuleId = execution.getVariable("DCVFMR_vfModuleId")
- // formulate the request for UpdateAAIVfModule
- String request = """<UpdateAAIVfModuleRequest>
+ logger.debug("UpdateAAIVfModuleRequest :" + request)
+ execution.setVariable("UpdateAAIVfModuleRequest", request)
+ }
+
+ // parse the incoming DELETE_VF_MODULE request
+ // and formulate the outgoing UpdateAAIVfModuleRequest request
+ public void prepUpdateAAIVfModuleToAssigned(DelegateExecution execution) {
+
+ String vnfId = execution.getVariable("DCVFMR_vnfId")
+ String vfModuleId = execution.getVariable("DCVFMR_vfModuleId")
+ // formulate the request for UpdateAAIVfModule
+ String request = """<UpdateAAIVfModuleRequest>
<vnf-id>${MsoUtils.xmlEscape(vnfId)}</vnf-id>
<vf-module-id>${MsoUtils.xmlEscape(vfModuleId)}</vf-module-id>
<heat-stack-id></heat-stack-id>
<orchestration-status>Assigned</orchestration-status>
</UpdateAAIVfModuleRequest>""" as String
- logger.debug("UpdateAAIVfModuleRequest :" + request)
- execution.setVariable("UpdateAAIVfModuleRequest", request)
- }
-
- // parse the incoming DELETE_VF_MODULE request
- // and formulate the outgoing DeleteAAIVfModuleRequest request
- public void prepDeleteAAIVfModule(DelegateExecution execution) {
-
- String vnfId = execution.getVariable("DCVFMR_vnfId")
- String vfModuleId = execution.getVariable("DCVFMR_vfModuleId")
- // formulate the request for UpdateAAIVfModule
- String request = """<DeleteAAIVfModuleRequest>
+ logger.debug("UpdateAAIVfModuleRequest :" + request)
+ execution.setVariable("UpdateAAIVfModuleRequest", request)
+ }
+
+ // parse the incoming DELETE_VF_MODULE request
+ // and formulate the outgoing DeleteAAIVfModuleRequest request
+ public void prepDeleteAAIVfModule(DelegateExecution execution) {
+
+ String vnfId = execution.getVariable("DCVFMR_vnfId")
+ String vfModuleId = execution.getVariable("DCVFMR_vfModuleId")
+ // formulate the request for UpdateAAIVfModule
+ String request = """<DeleteAAIVfModuleRequest>
<vnf-id>${MsoUtils.xmlEscape(vnfId)}</vnf-id>
<vf-module-id>${MsoUtils.xmlEscape(vfModuleId)}</vf-module-id>
</DeleteAAIVfModuleRequest>""" as String
- logger.debug("DeleteAAIVfModuleRequest :" + request)
- execution.setVariable("DeleteAAIVfModuleRequest", request)
- }
+ logger.debug("DeleteAAIVfModuleRequest :" + request)
+ execution.setVariable("DeleteAAIVfModuleRequest", request)
+ }
- // generates a WorkflowException if
- // -
- public void handleDoDeleteVfModuleFailure(DelegateExecution execution) {
+ // generates a WorkflowException if
+ // -
+ public void handleDoDeleteVfModuleFailure(DelegateExecution execution) {
- logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- "AAI error occurred deleting the Generic Vnf" + execution.getVariable("DoDVfMod_deleteGenericVnfResponse"),
- "BPMN", ErrorCode.UnknownError.getValue());
- String processKey = getProcessKey(execution);
- exceptionUtil.buildWorkflowException(execution, 5000, "Failure in DoDeleteVfModule")
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "AAI error occurred deleting the Generic Vnf" + execution.getVariable("DoDVfMod_deleteGenericVnfResponse"),
+ "BPMN", ErrorCode.UnknownError.getValue());
+ String processKey = getProcessKey(execution);
+ exceptionUtil.buildWorkflowException(execution, 5000, "Failure in DoDeleteVfModule")
- }
+ }
- public void sdncValidateResponse(DelegateExecution execution, String response){
+ public void sdncValidateResponse(DelegateExecution execution, String response){
- execution.setVariable("prefix",Prefix)
+ execution.setVariable("prefix",Prefix)
- WorkflowException workflowException = execution.getVariable("WorkflowException")
- boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator")
+ WorkflowException workflowException = execution.getVariable("WorkflowException")
+ boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator")
- SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils()
- sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator)
+ SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils()
+ sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator)
- if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){
- logger.debug("Successfully Validated SDNC Response")
- }else{
- throw new BpmnError("MSOWorkflowException")
- }
- }
+ if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){
+ logger.debug("Successfully Validated SDNC Response")
+ }else{
+ throw new BpmnError("MSOWorkflowException")
+ }
+ }
- public void deleteNetworkPoliciesFromAAI(DelegateExecution execution) {
- def method = getClass().getSimpleName() + '.deleteNetworkPoliciesFromAAI(' +
- 'execution=' + execution.getId() +
- ')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logger.trace('Entered ' + method)
- execution.setVariable("prefix", Prefix)
- logger.trace("STARTED deleteNetworkPoliciesFromAAI")
+ public void deleteNetworkPoliciesFromAAI(DelegateExecution execution) {
+ def method = getClass().getSimpleName() + '.deleteNetworkPoliciesFromAAI(' +
+ 'execution=' + execution.getId() +
+ ')'
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ logger.trace('Entered ' + method)
+ execution.setVariable("prefix", Prefix)
+ logger.trace("STARTED deleteNetworkPoliciesFromAAI")
- try {
- // get variables
- List fqdnList = execution.getVariable(Prefix + "createdNetworkPolicyFqdnList")
- if (fqdnList == null) {
- logger.debug("No network policies to delete")
- return
- }
- int fqdnCount = fqdnList.size()
+ try {
+ // get variables
+ List fqdnList = execution.getVariable(Prefix + "createdNetworkPolicyFqdnList")
+ if (fqdnList == null) {
+ logger.debug("No network policies to delete")
+ return
+ }
+ int fqdnCount = fqdnList.size()
- execution.setVariable(Prefix + "networkPolicyFqdnCount", fqdnCount)
- logger.debug("networkPolicyFqdnCount - " + fqdnCount)
+ execution.setVariable(Prefix + "networkPolicyFqdnCount", fqdnCount)
+ logger.debug("networkPolicyFqdnCount - " + fqdnCount)
- AaiUtil aaiUriUtil = new AaiUtil(this)
+ AaiUtil aaiUriUtil = new AaiUtil(this)
- if (fqdnCount > 0) {
- // AII loop call over contrail network policy fqdn list
- for (i in 0..fqdnCount-1) {
+ if (fqdnCount > 0) {
+ // AII loop call over contrail network policy fqdn list
+ for (i in 0..fqdnCount-1) {
- int counting = i+1
- String fqdn = fqdnList[i]
+ int counting = i+1
+ String fqdn = fqdnList[i]
try {
// Query AAI for this network policy FQDN
@@ -517,10 +516,10 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{
NetworkPolicy networkPolicy = networkPolicies.get().getNetworkPolicy().get(0)
try{
- AAIResourceUri delUri = AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, networkPolicy.getNetworkPolicyId())
- getAAIClient().delete(delUri)
- execution.setVariable(Prefix + "aaiDeleteNetworkPolicyReturnCode", 200)
- logger.debug("AAI delete network policy Response Code, NetworkPolicy #" + counting + " : " + 200)
+ AAIResourceUri delUri = AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, networkPolicy.getNetworkPolicyId())
+ getAAIClient().delete(delUri)
+ execution.setVariable(Prefix + "aaiDeleteNetworkPolicyReturnCode", 200)
+ logger.debug("AAI delete network policy Response Code, NetworkPolicy #" + counting + " : " + 200)
logger.debug("The return code from deleting network policy is: " + 200)
// This network policy was deleted from AAI successfully
logger.debug(" DelAAINetworkPolicy Success REST Response, , NetworkPolicy #" + counting + " : ")
@@ -548,113 +547,113 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{
logger.debug(dataErrorMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage)
}
- } // end loop
+ } // end loop
- } else {
- logger.debug("No contrail network policies to query/create")
+ } else {
+ logger.debug("No contrail network policies to query/create")
- }
+ }
- } catch (BpmnError e) {
- throw e;
+ } catch (BpmnError e) {
+ throw e;
- } catch (Exception ex) {
- String exceptionMessage = "Bpmn error encountered in DoCreateVfModuleRollback flow. deleteNetworkPoliciesFromAAI() - " + ex.getMessage()
- logger.debug(exceptionMessage)
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
- }
+ } catch (Exception ex) {
+ String exceptionMessage = "Bpmn error encountered in DoCreateVfModuleRollback flow. deleteNetworkPoliciesFromAAI() - " + ex.getMessage()
+ logger.debug(exceptionMessage)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
+ }
- }
+ }
- /**
- * Prepare a Request for invoking the UpdateAAIGenericVnf subflow.
- *
- * @param execution The flow's execution instance.
- */
- public void preProcessUpdateAAIGenericVnf(DelegateExecution execution) {
- def method = getClass().getSimpleName() + '.preProcessUpdateAAIGenericVnf((' +
- 'execution=' + execution.getId() +
- ')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logger.trace('Entered ' + method)
+ /**
+ * Prepare a Request for invoking the UpdateAAIGenericVnf subflow.
+ *
+ * @param execution The flow's execution instance.
+ */
+ public void preProcessUpdateAAIGenericVnf(DelegateExecution execution) {
+ def method = getClass().getSimpleName() + '.preProcessUpdateAAIGenericVnf((' +
+ 'execution=' + execution.getId() +
+ ')'
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ logger.trace('Entered ' + method)
- try {
- def vnfId = execution.getVariable('DCVFMR_vnfId')
- def oamManagementV4Address = execution.getVariable(Prefix + 'oamManagementV4Address')
- def oamManagementV6Address = execution.getVariable(Prefix + 'oamManagementV6Address')
- def ipv4OamAddressElement = ''
- def managementV6AddressElement = ''
+ try {
+ def vnfId = execution.getVariable('DCVFMR_vnfId')
+ def oamManagementV4Address = execution.getVariable(Prefix + 'oamManagementV4Address')
+ def oamManagementV6Address = execution.getVariable(Prefix + 'oamManagementV6Address')
+ def ipv4OamAddressElement = ''
+ def managementV6AddressElement = ''
- if (oamManagementV4Address != null) {
- ipv4OamAddressElement = '<ipv4-oam-address>' + 'DELETE' + '</ipv4-oam-address>'
- }
+ if (oamManagementV4Address != null) {
+ ipv4OamAddressElement = '<ipv4-oam-address>' + 'DELETE' + '</ipv4-oam-address>'
+ }
- if (oamManagementV6Address != null) {
- managementV6AddressElement = '<management-v6-address>' + 'DELETE' + '</management-v6-address>'
- }
+ if (oamManagementV6Address != null) {
+ managementV6AddressElement = '<management-v6-address>' + 'DELETE' + '</management-v6-address>'
+ }
- String updateAAIGenericVnfRequest = """
+ String updateAAIGenericVnfRequest = """
<UpdateAAIGenericVnfRequest>
<vnf-id>${MsoUtils.xmlEscape(vnfId)}</vnf-id>
${ipv4OamAddressElement}
${managementV6AddressElement}
</UpdateAAIGenericVnfRequest>
"""
- updateAAIGenericVnfRequest = utils.formatXml(updateAAIGenericVnfRequest)
- execution.setVariable(Prefix + 'updateAAIGenericVnfRequest', updateAAIGenericVnfRequest)
- logger.debug('Request for UpdateAAIGenericVnf:\n' + updateAAIGenericVnfRequest)
-
-
- logger.trace('Exited ' + method)
- } catch (BpmnError e) {
- throw e;
- } catch (Exception e) {
- logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- 'Caught exception in ' + method, "BPMN",
- ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
- exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preProcessUpdateAAIGenericVnf((): ' + e.getMessage())
- }
- }
-
- public void setSuccessfulRollbackStatus (DelegateExecution execution){
-
- execution.setVariable("prefix", Prefix)
- logger.trace("STARTED setSuccessfulRollbackStatus")
-
- try{
- // Set rolledBack to true, rollbackError to null
- execution.setVariable("rolledBack", true)
- execution.setVariable("rollbackError", null)
-
- }catch(Exception e){
- logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- "Exception Occured Processing setSuccessfulRollbackStatus.", "BPMN",
- ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
- exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during setSuccessfulRollbackStatus Method:\n" + e.getMessage())
- }
- logger.trace("COMPLETED setSuccessfulRollbackStatus")
- }
-
- public void setFailedRollbackStatus (DelegateExecution execution){
-
- execution.setVariable("prefix", Prefix)
- logger.trace("STARTED setFailedRollbackStatus")
-
- try{
- // Set rolledBack to false, rollbackError to actual value, rollbackData to null
- execution.setVariable("rolledBack", false)
- execution.setVariable("rollbackError", 'Caught exception in DoCreateVfModuleRollback')
- execution.setVariable("rollbackData", null)
-
- }catch(Exception e){
- logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- "Exception Occured Processing setFailedRollbackStatus.", "BPMN",
- ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
- exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during setFailedRollbackStatus Method:\n" + e.getMessage())
- }
- logger.trace("COMPLETED setFailedRollbackStatus")
- }
+ updateAAIGenericVnfRequest = utils.formatXml(updateAAIGenericVnfRequest)
+ execution.setVariable(Prefix + 'updateAAIGenericVnfRequest', updateAAIGenericVnfRequest)
+ logger.debug('Request for UpdateAAIGenericVnf:\n' + updateAAIGenericVnfRequest)
+
+
+ logger.trace('Exited ' + method)
+ } catch (BpmnError e) {
+ throw e;
+ } catch (Exception e) {
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN",
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preProcessUpdateAAIGenericVnf((): ' + e.getMessage())
+ }
+ }
+
+ public void setSuccessfulRollbackStatus (DelegateExecution execution){
+
+ execution.setVariable("prefix", Prefix)
+ logger.trace("STARTED setSuccessfulRollbackStatus")
+
+ try{
+ // Set rolledBack to true, rollbackError to null
+ execution.setVariable("rolledBack", true)
+ execution.setVariable("rollbackError", null)
+
+ }catch(Exception e){
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Occured Processing setSuccessfulRollbackStatus.", "BPMN",
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during setSuccessfulRollbackStatus Method:\n" + e.getMessage())
+ }
+ logger.trace("COMPLETED setSuccessfulRollbackStatus")
+ }
+
+ public void setFailedRollbackStatus (DelegateExecution execution){
+
+ execution.setVariable("prefix", Prefix)
+ logger.trace("STARTED setFailedRollbackStatus")
+
+ try{
+ // Set rolledBack to false, rollbackError to actual value, rollbackData to null
+ execution.setVariable("rolledBack", false)
+ execution.setVariable("rollbackError", 'Caught exception in DoCreateVfModuleRollback')
+ execution.setVariable("rollbackData", null)
+
+ }catch(Exception e){
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Occured Processing setFailedRollbackStatus.", "BPMN",
+ 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/DoDeleteE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy
index a24bc4411e..35af3d34d6 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy
@@ -450,6 +450,16 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
execution.setVariable("serviceModelInfo", serviceDecomposition.getModelInfo())
List<Resource> deleteResourceList = serviceDecomposition.getServiceResources()
+ if (serviceDecomposition.getServiceType().equals("MDONS_OTN")){
+ for (Resource resource : deleteResourceList) {
+ String serviceName = execution.getVariable("serviceInstanceName")
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
+ resource.setResourceId(serviceInstanceId)
+ resource.setResourceInstanceName(serviceName)
+ def delMap = new ImmutablePair(resource, null)
+ deleteRealResourceList.add(delMap)
+ }
+ } else{
String serviceRelationShip = execution.getVariable("serviceRelationShip")
def jsonSlurper = new JsonSlurper()
def jsonOutput = new JsonOutput()
@@ -492,6 +502,7 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
}
}
}
+ }
// only delete real existing resources
execution.setVariable("deleteResourceList", deleteRealResourceList)
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 002e283790..e776eaf422 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
@@ -55,187 +55,185 @@ import org.xml.sax.InputSource
/* Subflow for Delete VF Module. When no DoDeleteVfModuleRequest is specified on input,
* functions as a building block subflow
-
-* Inputs for building block interface:
-* @param - requestId
-* @param - isDebugLogEnabled
-* @param - vnfId
-* @param - vfModuleId
-* @param - serviceInstanceId
-* @param - vfModuleName O
-* @param - vfModuleModelInfo
-* @param - cloudConfiguration*
-* @param - sdncVersion ("1610")
-* @param - retainResources
-* @param - aLaCarte
-*
-* Outputs:
-* @param - WorkflowException
-*
-*/
+ * Inputs for building block interface:
+ * @param - requestId
+ * @param - isDebugLogEnabled
+ * @param - vnfId
+ * @param - vfModuleId
+ * @param - serviceInstanceId
+ * @param - vfModuleName O
+ * @param - vfModuleModelInfo
+ * @param - cloudConfiguration*
+ * @param - sdncVersion ("1610")
+ * @param - retainResources
+ * @param - aLaCarte
+ *
+ * Outputs:
+ * @param - WorkflowException
+ *
+ */
public class DoDeleteVfModule extends AbstractServiceTaskProcessor{
private static final Logger logger = LoggerFactory.getLogger( DoDeleteVfModule.class);
- def Prefix="DoDVfMod_"
-
- ExceptionUtil exceptionUtil = new ExceptionUtil()
- JsonUtils jsonUtil = new JsonUtils()
-
- public void initProcessVariables(DelegateExecution execution) {
- execution.setVariable("prefix",Prefix)
- execution.setVariable("DoDVfMod_contrailNetworkPolicyFqdnList", null)
- execution.setVariable("DoDVfMod_oamManagementV4Address", null)
- execution.setVariable("DoDVfMod_oamManagementV6Address", null)
-
- }
-
- // parse the incoming DELETE_VF_MODULE request for the Generic Vnf and Vf Module Ids
- // and formulate the outgoing request for PrepareUpdateAAIVfModuleRequest
- public void preProcessRequest(DelegateExecution execution) {
-
- initProcessVariables(execution)
-
- try {
- def xml = execution.getVariable("DoDeleteVfModuleRequest")
- String vnfId = ""
- String vfModuleId = ""
-
- if (xml == null || xml.isEmpty()) {
- // Building Block-type request
-
- // Set mso-request-id to request-id for VNF Adapter interface
- String requestId = execution.getVariable("requestId")
- execution.setVariable("mso-request-id", requestId)
-
- String cloudConfiguration = execution.getVariable("cloudConfiguration")
- String vfModuleModelInfo = execution.getVariable("vfModuleModelInfo")
- String tenantId = jsonUtil.getJsonValue(cloudConfiguration, "tenantId")
- execution.setVariable("tenantId", tenantId)
- String cloudSiteId = jsonUtil.getJsonValue(cloudConfiguration, "lcpCloudRegionId")
- execution.setVariable("cloudSiteId", cloudSiteId)
- String cloudOwner = jsonUtil.getJsonValue(cloudConfiguration, "cloudOwner")
- execution.setVariable("cloudOwner", cloudOwner)
- // Source is HARDCODED
- String source = "VID"
- execution.setVariable("source", source)
- // SrvInstId is hardcoded to empty
- execution.setVariable("srvInstId", "")
- // ServiceId is hardcoded to empty
- execution.setVariable("serviceId", "")
- String serviceInstanceId = execution.getVariable("serviceInstanceId")
- vnfId = execution.getVariable("vnfId")
- vfModuleId = execution.getVariable("vfModuleId")
- if (serviceInstanceId == null || serviceInstanceId.isEmpty()) {
- execution.setVariable(Prefix + "serviceInstanceIdToSdnc", vfModuleId)
- }
- else {
- execution.setVariable(Prefix + "serviceInstanceIdToSdnc", serviceInstanceId)
- }
- //vfModuleModelName
- def vfModuleModelName = jsonUtil.getJsonValue(vfModuleModelInfo, "modelName")
- execution.setVariable("vfModuleModelName", vfModuleModelName)
- // retainResources
- def retainResources = execution.getVariable("retainResources")
- if (retainResources == null) {
- retainResources = false
- }
- execution.setVariable("retainResources", retainResources)
- }
- else {
-
- logger.debug("DoDeleteVfModule Request: " + xml)
-
- logger.debug("input request xml: " + xml)
-
- vnfId = utils.getNodeText(xml,"vnf-id")
- execution.setVariable("vnfId", vnfId)
- vfModuleId = utils.getNodeText(xml,"vf-module-id")
- execution.setVariable("vfModuleId", vfModuleId)
- def srvInstId = execution.getVariable("mso-service-instance-id")
- execution.setVariable("srvInstId", srvInstId)
- String requestId = ""
- try {
- requestId = execution.getVariable("mso-request-id")
- } catch (Exception ex) {
- requestId = utils.getNodeText(xml, "request-id")
- }
- execution.setVariable("requestId", requestId)
- String source = utils.getNodeText(xml, "source")
- execution.setVariable("source", source)
- String serviceId = utils.getNodeText(xml, "service-id")
- execution.setVariable("serviceId", serviceId)
- String tenantId = utils.getNodeText(xml, "tenant-id")
- execution.setVariable("tenantId", tenantId)
-
- String serviceInstanceIdToSdnc = ""
- if (xml.contains("service-instance-id")) {
- serviceInstanceIdToSdnc = utils.getNodeText(xml, "service-instance-id")
- } else {
- serviceInstanceIdToSdnc = vfModuleId
- }
- execution.setVariable(Prefix + "serviceInstanceIdToSdnc", serviceInstanceIdToSdnc)
- String vfModuleName = utils.getNodeText(xml, "vf-module-name")
- execution.setVariable("vfModuleName", vfModuleName)
- String vfModuleModelName = utils.getNodeText(xml, "vf-module-model-name")
- execution.setVariable("vfModuleModelName", vfModuleModelName)
- String cloudSiteId = utils.getNodeText(xml, "aic-cloud-region")
- execution.setVariable("cloudSiteId", cloudSiteId)
- String cloudOwner = utils.getNodeText(xml, "cloud-owner")
- execution.setVariable("cloudOwner", cloudOwner)
- }
-
- // formulate the request for PrepareUpdateAAIVfModule
- String request = """<PrepareUpdateAAIVfModuleRequest>
+ def Prefix="DoDVfMod_"
+
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+ JsonUtils jsonUtil = new JsonUtils()
+
+ public void initProcessVariables(DelegateExecution execution) {
+ execution.setVariable("prefix",Prefix)
+ execution.setVariable("DoDVfMod_contrailNetworkPolicyFqdnList", null)
+ execution.setVariable("DoDVfMod_oamManagementV4Address", null)
+ execution.setVariable("DoDVfMod_oamManagementV6Address", null)
+ }
+
+ // parse the incoming DELETE_VF_MODULE request for the Generic Vnf and Vf Module Ids
+ // and formulate the outgoing request for PrepareUpdateAAIVfModuleRequest
+ public void preProcessRequest(DelegateExecution execution) {
+
+ initProcessVariables(execution)
+
+ try {
+ def xml = execution.getVariable("DoDeleteVfModuleRequest")
+ String vnfId = ""
+ String vfModuleId = ""
+
+ if (xml == null || xml.isEmpty()) {
+ // Building Block-type request
+
+ // Set mso-request-id to request-id for VNF Adapter interface
+ String requestId = execution.getVariable("requestId")
+ execution.setVariable("mso-request-id", requestId)
+
+ String cloudConfiguration = execution.getVariable("cloudConfiguration")
+ String vfModuleModelInfo = execution.getVariable("vfModuleModelInfo")
+ String tenantId = jsonUtil.getJsonValue(cloudConfiguration, "tenantId")
+ execution.setVariable("tenantId", tenantId)
+ String cloudSiteId = jsonUtil.getJsonValue(cloudConfiguration, "lcpCloudRegionId")
+ execution.setVariable("cloudSiteId", cloudSiteId)
+ String cloudOwner = jsonUtil.getJsonValue(cloudConfiguration, "cloudOwner")
+ execution.setVariable("cloudOwner", cloudOwner)
+ // Source is HARDCODED
+ String source = "VID"
+ execution.setVariable("source", source)
+ // SrvInstId is hardcoded to empty
+ execution.setVariable("srvInstId", "")
+ // ServiceId is hardcoded to empty
+ execution.setVariable("serviceId", "")
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
+ vnfId = execution.getVariable("vnfId")
+ vfModuleId = execution.getVariable("vfModuleId")
+ if (serviceInstanceId == null || serviceInstanceId.isEmpty()) {
+ execution.setVariable(Prefix + "serviceInstanceIdToSdnc", vfModuleId)
+ }
+ else {
+ execution.setVariable(Prefix + "serviceInstanceIdToSdnc", serviceInstanceId)
+ }
+ //vfModuleModelName
+ def vfModuleModelName = jsonUtil.getJsonValue(vfModuleModelInfo, "modelName")
+ execution.setVariable("vfModuleModelName", vfModuleModelName)
+ // retainResources
+ def retainResources = execution.getVariable("retainResources")
+ if (retainResources == null) {
+ retainResources = false
+ }
+ execution.setVariable("retainResources", retainResources)
+ }
+ else {
+
+ logger.debug("DoDeleteVfModule Request: " + xml)
+
+ logger.debug("input request xml: " + xml)
+
+ vnfId = utils.getNodeText(xml,"vnf-id")
+ execution.setVariable("vnfId", vnfId)
+ vfModuleId = utils.getNodeText(xml,"vf-module-id")
+ execution.setVariable("vfModuleId", vfModuleId)
+ def srvInstId = execution.getVariable("mso-service-instance-id")
+ execution.setVariable("srvInstId", srvInstId)
+ String requestId = ""
+ try {
+ requestId = execution.getVariable("mso-request-id")
+ } catch (Exception ex) {
+ requestId = utils.getNodeText(xml, "request-id")
+ }
+ execution.setVariable("requestId", requestId)
+ String source = utils.getNodeText(xml, "source")
+ execution.setVariable("source", source)
+ String serviceId = utils.getNodeText(xml, "service-id")
+ execution.setVariable("serviceId", serviceId)
+ String tenantId = utils.getNodeText(xml, "tenant-id")
+ execution.setVariable("tenantId", tenantId)
+
+ String serviceInstanceIdToSdnc = ""
+ if (xml.contains("service-instance-id")) {
+ serviceInstanceIdToSdnc = utils.getNodeText(xml, "service-instance-id")
+ } else {
+ serviceInstanceIdToSdnc = vfModuleId
+ }
+ execution.setVariable(Prefix + "serviceInstanceIdToSdnc", serviceInstanceIdToSdnc)
+ String vfModuleName = utils.getNodeText(xml, "vf-module-name")
+ execution.setVariable("vfModuleName", vfModuleName)
+ String vfModuleModelName = utils.getNodeText(xml, "vf-module-model-name")
+ execution.setVariable("vfModuleModelName", vfModuleModelName)
+ String cloudSiteId = utils.getNodeText(xml, "aic-cloud-region")
+ execution.setVariable("cloudSiteId", cloudSiteId)
+ String cloudOwner = utils.getNodeText(xml, "cloud-owner")
+ execution.setVariable("cloudOwner", cloudOwner)
+ }
+
+ // formulate the request for PrepareUpdateAAIVfModule
+ String request = """<PrepareUpdateAAIVfModuleRequest>
<vnf-id>${MsoUtils.xmlEscape(vnfId)}</vnf-id>
<vf-module-id>${MsoUtils.xmlEscape(vfModuleId)}</vf-module-id>
<orchestration-status>pending-delete</orchestration-status>
</PrepareUpdateAAIVfModuleRequest>""" as String
- logger.debug("PrepareUpdateAAIVfModuleRequest :" + request)
- logger.debug("UpdateAAIVfModule Request: " + request)
- execution.setVariable("PrepareUpdateAAIVfModuleRequest", request)
- execution.setVariable("vfModuleFromAAI", null)
- }catch(BpmnError b){
- throw b
- }catch(Exception e){
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error encountered in PreProcess method!")
- }
- }
-
- // build a SDNC vnf-topology-operation request for the specified action
- // (note: the action passed is expected to be 'changedelete' or 'delete')
- public void prepSDNCAdapterRequest(DelegateExecution execution, String action) {
-
-
- String uuid = execution.getVariable('testReqId') // for junits
- if(uuid==null){
- uuid = execution.getVariable("requestId") + "-" + System.currentTimeMillis()
- }
-
- def srvInstId = execution.getVariable("srvInstId")
- def callbackUrl = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution)
- String requestId = execution.getVariable("requestId")
- String source = execution.getVariable("source")
- String serviceId = execution.getVariable("serviceId")
- String vnfId = execution.getVariable("vnfId")
- String tenantId = execution.getVariable("tenantId")
- String vfModuleId = execution.getVariable("vfModuleId")
- String serviceInstanceIdToSdnc = execution.getVariable(Prefix + "serviceInstanceIdToSdnc")
- String vfModuleName = execution.getVariable("vfModuleName")
- // Get vfModuleName from AAI response if it was not specified on the request
- if (vfModuleName == null || vfModuleName.isEmpty()) {
- if (execution.getVariable("vfModuleFromAAI") != null) {
- org.onap.aai.domain.yang.VfModule vfModuleFromAAI = execution.getVariable("vfModuleFromAAI")
- vfModuleName = vfModuleFromAAI.getVfModuleName()
- }
- }
- String vfModuleModelName = execution.getVariable("vfModuleModelName")
- String cloudSiteId = execution.getVariable("cloudSiteId")
- boolean retainResources = execution.getVariable("retainResources")
- String requestSubActionString = ""
- if (retainResources) {
- requestSubActionString = "<request-sub-action>RetainResource</request-sub-action>"
- }
- String request = """<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.onap/so/request/types/v1"
+ logger.debug("PrepareUpdateAAIVfModuleRequest :" + request)
+ logger.debug("UpdateAAIVfModule Request: " + request)
+ execution.setVariable("PrepareUpdateAAIVfModuleRequest", request)
+ execution.setVariable("vfModuleFromAAI", null)
+ }catch(BpmnError b){
+ throw b
+ }catch(Exception e){
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error encountered in PreProcess method!")
+ }
+ }
+
+ // build a SDNC vnf-topology-operation request for the specified action
+ // (note: the action passed is expected to be 'changedelete' or 'delete')
+ public void prepSDNCAdapterRequest(DelegateExecution execution, String action) {
+
+
+ String uuid = execution.getVariable('testReqId') // for junits
+ if(uuid==null){
+ uuid = execution.getVariable("requestId") + "-" + System.currentTimeMillis()
+ }
+
+ def srvInstId = execution.getVariable("srvInstId")
+ def callbackUrl = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution)
+ String requestId = execution.getVariable("requestId")
+ String source = execution.getVariable("source")
+ String serviceId = execution.getVariable("serviceId")
+ String vnfId = execution.getVariable("vnfId")
+ String tenantId = execution.getVariable("tenantId")
+ String vfModuleId = execution.getVariable("vfModuleId")
+ String serviceInstanceIdToSdnc = execution.getVariable(Prefix + "serviceInstanceIdToSdnc")
+ String vfModuleName = execution.getVariable("vfModuleName")
+ // Get vfModuleName from AAI response if it was not specified on the request
+ if (vfModuleName == null || vfModuleName.isEmpty()) {
+ if (execution.getVariable("vfModuleFromAAI") != null) {
+ org.onap.aai.domain.yang.VfModule vfModuleFromAAI = execution.getVariable("vfModuleFromAAI")
+ vfModuleName = vfModuleFromAAI.getVfModuleName()
+ }
+ }
+ String vfModuleModelName = execution.getVariable("vfModuleModelName")
+ String cloudSiteId = execution.getVariable("cloudSiteId")
+ boolean retainResources = execution.getVariable("retainResources")
+ String requestSubActionString = ""
+ if (retainResources) {
+ requestSubActionString = "<request-sub-action>RetainResource</request-sub-action>"
+ }
+ String request = """<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.onap/so/request/types/v1"
xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"
xmlns:sdncadapter="http://org.onap/workflow/sdnc/adapter/schema/v1">
<sdncadapter:RequestHeader>
@@ -274,33 +272,33 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{
</sdncadapterworkflow:SDNCRequestData>
</sdncadapterworkflow:SDNCAdapterWorkflowRequest>"""
- logger.debug("sdncAdapterWorkflowRequest: " + request)
- logger.debug("DoDeleteVfModule - SDNCAdapterWorkflowRequest: " + request)
- execution.setVariable("sdncAdapterWorkflowRequest", request)
- }
-
- // parse the incoming DELETE_VF_MODULE request
- // and formulate the outgoing VnfAdapterDeleteV1 request
- public void prepVNFAdapterRequest(DelegateExecution execution) {
-
- def requestId = UUID.randomUUID().toString()
- def origRequestId = execution.getVariable('requestId')
- def srvInstId = execution.getVariable("serviceInstanceId")
- def aicCloudRegion = execution.getVariable("cloudSiteId")
- def cloudOwner = execution.getVariable("cloudOwner")
- def vnfId = execution.getVariable("vnfId")
- def vfModuleId = execution.getVariable("vfModuleId")
- def vfModuleStackId = execution.getVariable('DoDVfMod_heatStackId')
- def tenantId = execution.getVariable("tenantId")
- def messageId = execution.getVariable('requestId') + '-' +
- System.currentTimeMillis()
- def notificationUrl = createCallbackURL(execution, "VNFAResponse", messageId)
- def useQualifiedHostName = UrnPropertiesReader.getVariable("mso.use.qualified.host",execution)
- if ('true'.equals(useQualifiedHostName)) {
- notificationUrl = utils.getQualifiedHostNameForCallback(notificationUrl)
- }
-
- String request = """
+ logger.debug("sdncAdapterWorkflowRequest: " + request)
+ logger.debug("DoDeleteVfModule - SDNCAdapterWorkflowRequest: " + request)
+ execution.setVariable("sdncAdapterWorkflowRequest", request)
+ }
+
+ // parse the incoming DELETE_VF_MODULE request
+ // and formulate the outgoing VnfAdapterDeleteV1 request
+ public void prepVNFAdapterRequest(DelegateExecution execution) {
+
+ def requestId = UUID.randomUUID().toString()
+ def origRequestId = execution.getVariable('requestId')
+ def srvInstId = execution.getVariable("serviceInstanceId")
+ def aicCloudRegion = execution.getVariable("cloudSiteId")
+ def cloudOwner = execution.getVariable("cloudOwner")
+ def vnfId = execution.getVariable("vnfId")
+ def vfModuleId = execution.getVariable("vfModuleId")
+ def vfModuleStackId = execution.getVariable('DoDVfMod_heatStackId')
+ def tenantId = execution.getVariable("tenantId")
+ def messageId = execution.getVariable('requestId') + '-' +
+ System.currentTimeMillis()
+ def notificationUrl = createCallbackURL(execution, "VNFAResponse", messageId)
+ def useQualifiedHostName = UrnPropertiesReader.getVariable("mso.use.qualified.host",execution)
+ if ('true'.equals(useQualifiedHostName)) {
+ notificationUrl = utils.getQualifiedHostNameForCallback(notificationUrl)
+ }
+
+ String request = """
<deleteVfModuleRequest>
<cloudSiteId>${MsoUtils.xmlEscape(aicCloudRegion)}</cloudSiteId>
<cloudOwner>${MsoUtils.xmlEscape(cloudOwner)}</cloudOwner>
@@ -318,303 +316,301 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{
</deleteVfModuleRequest>
""" as String
- logger.debug("vnfAdapterRestV1Request: " + request)
- logger.debug("deleteVfModuleRequest: " + request)
- execution.setVariable("vnfAdapterRestV1Request", request)
- }
+ logger.debug("deleteVfModuleRequest: " + request)
+ execution.setVariable("vnfAdapterTaskRequest", request)
+ }
- // parse the incoming DELETE_VF_MODULE request
- // and formulate the outgoing UpdateAAIVfModuleRequest request
- public void prepUpdateAAIVfModule(DelegateExecution execution) {
+ // parse the incoming DELETE_VF_MODULE request
+ // and formulate the outgoing UpdateAAIVfModuleRequest request
+ public void prepUpdateAAIVfModule(DelegateExecution execution) {
- def vnfId = execution.getVariable("vnfId")
- def vfModuleId = execution.getVariable("vfModuleId")
- // formulate the request for UpdateAAIVfModule
- String request = """<UpdateAAIVfModuleRequest>
+ def vnfId = execution.getVariable("vnfId")
+ def vfModuleId = execution.getVariable("vfModuleId")
+ // formulate the request for UpdateAAIVfModule
+ String request = """<UpdateAAIVfModuleRequest>
<vnf-id>${MsoUtils.xmlEscape(vnfId)}</vnf-id>
<vf-module-id>${MsoUtils.xmlEscape(vfModuleId)}</vf-module-id>
<heat-stack-id>DELETE</heat-stack-id>
<orchestration-status>deleted</orchestration-status>
</UpdateAAIVfModuleRequest>""" as String
- logger.debug("UpdateAAIVfModuleRequest :" + request)
- logger.debug("UpdateAAIVfModuleRequest: " + request)
- execution.setVariable("UpdateAAIVfModuleRequest", request)
- }
+ logger.debug("UpdateAAIVfModuleRequest: " + request)
+ execution.setVariable("UpdateAAIVfModuleRequest", request)
+ }
- // parse the incoming DELETE_VF_MODULE request
- // and formulate the outgoing DeleteAAIVfModuleRequest request
- public void prepDeleteAAIVfModule(DelegateExecution execution) {
+ // parse the incoming DELETE_VF_MODULE request
+ // and formulate the outgoing DeleteAAIVfModuleRequest request
+ public void prepDeleteAAIVfModule(DelegateExecution execution) {
- def vnfId = execution.getVariable("vnfId")
- def vfModuleId = execution.getVariable("vfModuleId")
- // formulate the request for UpdateAAIVfModule
- String request = """<DeleteAAIVfModuleRequest>
+ def vnfId = execution.getVariable("vnfId")
+ def vfModuleId = execution.getVariable("vfModuleId")
+ // formulate the request for UpdateAAIVfModule
+ String request = """<DeleteAAIVfModuleRequest>
<vnf-id>${MsoUtils.xmlEscape(vnfId)}</vnf-id>
<vf-module-id>${MsoUtils.xmlEscape(vfModuleId)}</vf-module-id>
</DeleteAAIVfModuleRequest>""" as String
- logger.debug("DeleteAAIVfModuleRequest :" + request)
- logger.debug("DeleteAAIVfModuleRequest: " + request)
- execution.setVariable("DeleteAAIVfModuleRequest", request)
- }
-
- // generates a WorkflowException if
- // -
- public void handleDoDeleteVfModuleFailure(DelegateExecution execution) {
- logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- "AAI error occurred deleting the Generic Vnf: " + execution.getVariable("DoDVfMod_deleteGenericVnfResponse"),
- "BPMN", ErrorCode.UnknownError.getValue(), "Exception");
- String processKey = getProcessKey(execution);
- WorkflowException exception = new WorkflowException(processKey, 5000,
- execution.getVariable("DoDVfMod_deleteGenericVnfResponse"))
- execution.setVariable("WorkflowException", exception)
- }
-
- public void sdncValidateResponse(DelegateExecution execution, String response){
-
- execution.setVariable("prefix",Prefix)
-
- WorkflowException workflowException = execution.getVariable("WorkflowException")
- boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator")
-
- SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils()
- sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator)
-
- if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){
- logger.debug("Successfully Validated SDNC Response")
- }else{
- throw new BpmnError("MSOWorkflowException")
- }
- }
-
- public void postProcessVNFAdapterRequest(DelegateExecution execution) {
- def method = getClass().getSimpleName() + '.postProcessVNFAdapterRequest(' +
- 'execution=' + execution.getId() +
- ')'
-
- logger.trace('Entered ' + method)
- execution.setVariable("prefix",Prefix)
- try{
- logger.trace("STARTED postProcessVNFAdapterRequest Process")
-
- String vnfResponse = execution.getVariable("DoDVfMod_doDeleteVfModuleResponse")
- logger.debug("VNF Adapter Response is: " + vnfResponse)
- logger.debug("deleteVnfAResponse is: \n" + vnfResponse)
-
- if(vnfResponse != null){
-
- if(vnfResponse.contains("deleteVfModuleResponse")){
- logger.debug("Received a Good Response from VNF Adapter for DELETE_VF_MODULE Call.")
- execution.setVariable("DoDVfMod_vnfVfModuleDeleteCompleted", true)
-
- // Parse vnfOutputs for contrail network polcy FQDNs
- if (vnfResponse.contains("vfModuleOutputs")) {
- def vfModuleOutputsXml = utils.getNodeXml(vnfResponse, "vfModuleOutputs")
- InputSource source = new InputSource(new StringReader(vfModuleOutputsXml));
- DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
- docFactory.setNamespaceAware(true)
- DocumentBuilder docBuilder = docFactory.newDocumentBuilder()
- Document outputsXml = docBuilder.parse(source)
-
- NodeList entries = outputsXml.getElementsByTagNameNS("*", "entry")
- List contrailNetworkPolicyFqdnList = []
- for (int i = 0; i< entries.getLength(); i++) {
- Node node = entries.item(i)
- if (node.getNodeType() == Node.ELEMENT_NODE) {
- Element element = (Element) node
- String key = element.getElementsByTagNameNS("*", "key").item(0).getTextContent()
- if (key.endsWith("contrail_network_policy_fqdn")) {
- String contrailNetworkPolicyFqdn = element.getElementsByTagNameNS("*", "value").item(0).getTextContent()
- logger.debug("Obtained contrailNetworkPolicyFqdn: " + contrailNetworkPolicyFqdn)
- contrailNetworkPolicyFqdnList.add(contrailNetworkPolicyFqdn)
- }
- else if (key.equals("oam_management_v4_address")) {
- String oamManagementV4Address = element.getElementsByTagNameNS("*", "value").item(0).getTextContent()
- logger.debug("Obtained oamManagementV4Address: " + oamManagementV4Address)
- execution.setVariable(Prefix + "oamManagementV4Address", oamManagementV4Address)
- }
- else if (key.equals("oam_management_v6_address")) {
- String oamManagementV6Address = element.getElementsByTagNameNS("*", "value").item(0).getTextContent()
- logger.debug("Obtained oamManagementV6Address: " + oamManagementV6Address)
- execution.setVariable(Prefix + "oamManagementV6Address", oamManagementV6Address)
- }
-
- }
- }
- if (!contrailNetworkPolicyFqdnList.isEmpty()) {
- logger.debug("Setting the fqdn list")
- execution.setVariable("DoDVfMod_contrailNetworkPolicyFqdnList", contrailNetworkPolicyFqdnList)
- }
- }
- }else{
- logger.debug("Received a BAD Response from VNF Adapter for DELETE_VF_MODULE Call.")
- exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "VNF Adapter Error")
- }
- }else{
- logger.debug("Response from VNF Adapter is Null for DELETE_VF_MODULE Call.")
- exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Empty response from VNF Adapter")
- }
-
- }catch(BpmnError b){
- throw b
- }catch(Exception e){
- logger.debug("Internal Error Occured in PostProcess Method")
- exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Internal Error Occured in PostProcess Method")
- }
- logger.trace("COMPLETED postProcessVnfAdapterResponse Process")
- }
-
- public void deleteNetworkPoliciesFromAAI(DelegateExecution execution) {
- def method = getClass().getSimpleName() + '.deleteNetworkPoliciesFromAAI(' +
- 'execution=' + execution.getId() +
- ')'
-
- logger.trace('Entered ' + method)
- execution.setVariable("prefix", Prefix)
- logger.trace("STARTED deleteNetworkPoliciesFromAAI ")
-
- try {
- // get variables
- List fqdnList = execution.getVariable("DoDVfMod_contrailNetworkPolicyFqdnList")
- if (fqdnList == null) {
- logger.debug("No network policies to delete")
- return
- }
- int fqdnCount = fqdnList.size()
-
- execution.setVariable("DoDVfMod_networkPolicyFqdnCount", fqdnCount)
- logger.debug("DoDVfMod_networkPolicyFqdnCount - " + fqdnCount)
-
- if (fqdnCount > 0) {
- // AII loop call over contrail network policy fqdn list
- for (i in 0..fqdnCount-1) {
- String fqdn = fqdnList[i]
- // Query AAI for this network policy FQDN
+ logger.debug("DeleteAAIVfModuleRequest :" + request)
+ logger.debug("DeleteAAIVfModuleRequest: " + request)
+ execution.setVariable("DeleteAAIVfModuleRequest", request)
+ }
+
+ // generates a WorkflowException if
+ // -
+ public void handleDoDeleteVfModuleFailure(DelegateExecution execution) {
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "AAI error occurred deleting the Generic Vnf: " + execution.getVariable("DoDVfMod_deleteGenericVnfResponse"),
+ "BPMN", ErrorCode.UnknownError.getValue(), "Exception");
+ String processKey = getProcessKey(execution);
+ WorkflowException exception = new WorkflowException(processKey, 5000,
+ execution.getVariable("DoDVfMod_deleteGenericVnfResponse"))
+ execution.setVariable("WorkflowException", exception)
+ }
+
+ public void sdncValidateResponse(DelegateExecution execution, String response){
+
+ execution.setVariable("prefix",Prefix)
+
+ WorkflowException workflowException = execution.getVariable("WorkflowException")
+ boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator")
+
+ SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils()
+ sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator)
+
+ if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){
+ logger.debug("Successfully Validated SDNC Response")
+ }else{
+ throw new BpmnError("MSOWorkflowException")
+ }
+ }
+
+ public void postProcessVNFAdapterRequest(DelegateExecution execution) {
+ def method = getClass().getSimpleName() + '.postProcessVNFAdapterRequest(' +
+ 'execution=' + execution.getId() +
+ ')'
+
+ logger.trace('Entered ' + method)
+ execution.setVariable("prefix",Prefix)
+ try{
+ logger.trace("STARTED postProcessVNFAdapterRequest Process")
+
+ String vnfResponse = execution.getVariable("DoDVfMod_doDeleteVfModuleResponse")
+ logger.debug("VNF Adapter Response is: " + vnfResponse)
+ logger.debug("deleteVnfAResponse is: \n" + vnfResponse)
+
+ if(vnfResponse != null){
+
+ if(vnfResponse.contains("deleteVfModuleResponse")){
+ logger.debug("Received a Good Response from VNF Adapter for DELETE_VF_MODULE Call.")
+ execution.setVariable("DoDVfMod_vnfVfModuleDeleteCompleted", true)
+
+ // Parse vnfOutputs for contrail network polcy FQDNs
+ if (vnfResponse.contains("vfModuleOutputs")) {
+ def vfModuleOutputsXml = utils.getNodeXml(vnfResponse, "vfModuleOutputs")
+ InputSource source = new InputSource(new StringReader(vfModuleOutputsXml));
+ DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
+ docFactory.setNamespaceAware(true)
+ DocumentBuilder docBuilder = docFactory.newDocumentBuilder()
+ Document outputsXml = docBuilder.parse(source)
+
+ NodeList entries = outputsXml.getElementsByTagNameNS("*", "entry")
+ List contrailNetworkPolicyFqdnList = []
+ for (int i = 0; i< entries.getLength(); i++) {
+ Node node = entries.item(i)
+ if (node.getNodeType() == Node.ELEMENT_NODE) {
+ Element element = (Element) node
+ String key = element.getElementsByTagNameNS("*", "key").item(0).getTextContent()
+ if (key.endsWith("contrail_network_policy_fqdn")) {
+ String contrailNetworkPolicyFqdn = element.getElementsByTagNameNS("*", "value").item(0).getTextContent()
+ logger.debug("Obtained contrailNetworkPolicyFqdn: " + contrailNetworkPolicyFqdn)
+ contrailNetworkPolicyFqdnList.add(contrailNetworkPolicyFqdn)
+ }
+ else if (key.equals("oam_management_v4_address")) {
+ String oamManagementV4Address = element.getElementsByTagNameNS("*", "value").item(0).getTextContent()
+ logger.debug("Obtained oamManagementV4Address: " + oamManagementV4Address)
+ execution.setVariable(Prefix + "oamManagementV4Address", oamManagementV4Address)
+ }
+ else if (key.equals("oam_management_v6_address")) {
+ String oamManagementV6Address = element.getElementsByTagNameNS("*", "value").item(0).getTextContent()
+ logger.debug("Obtained oamManagementV6Address: " + oamManagementV6Address)
+ execution.setVariable(Prefix + "oamManagementV6Address", oamManagementV6Address)
+ }
+
+ }
+ }
+ if (!contrailNetworkPolicyFqdnList.isEmpty()) {
+ logger.debug("Setting the fqdn list")
+ execution.setVariable("DoDVfMod_contrailNetworkPolicyFqdnList", contrailNetworkPolicyFqdnList)
+ }
+ }
+ }else{
+ logger.debug("Received a BAD Response from VNF Adapter for DELETE_VF_MODULE Call.")
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "VNF Adapter Error")
+ }
+ }else{
+ logger.debug("Response from VNF Adapter is Null for DELETE_VF_MODULE Call.")
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Empty response from VNF Adapter")
+ }
+
+ }catch(BpmnError b){
+ throw b
+ }catch(Exception e){
+ logger.debug("Internal Error Occured in PostProcess Method")
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Internal Error Occured in PostProcess Method")
+ }
+ logger.trace("COMPLETED postProcessVnfAdapterResponse Process")
+ }
+
+ public void deleteNetworkPoliciesFromAAI(DelegateExecution execution) {
+ def method = getClass().getSimpleName() + '.deleteNetworkPoliciesFromAAI(' +
+ 'execution=' + execution.getId() +
+ ')'
+
+ logger.trace('Entered ' + method)
+ execution.setVariable("prefix", Prefix)
+ logger.trace("STARTED deleteNetworkPoliciesFromAAI ")
+
+ try {
+ // get variables
+ List fqdnList = execution.getVariable("DoDVfMod_contrailNetworkPolicyFqdnList")
+ if (fqdnList == null) {
+ logger.debug("No network policies to delete")
+ return
+ }
+ int fqdnCount = fqdnList.size()
+
+ execution.setVariable("DoDVfMod_networkPolicyFqdnCount", fqdnCount)
+ logger.debug("DoDVfMod_networkPolicyFqdnCount - " + fqdnCount)
+
+ if (fqdnCount > 0) {
+ // AII loop call over contrail network policy fqdn list
+ for (i in 0..fqdnCount-1) {
+ String fqdn = fqdnList[i]
+ // Query AAI for this network policy FQDN
AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY)
- uri.queryParam("network-policy-fqdn", fqdn)
- try {
- Optional<NetworkPolicies> networkPolicies = getAAIClient().get(NetworkPolicies.class, uri)
- if (networkPolicies.isPresent() && !networkPolicies.get().getNetworkPolicy().isEmpty()) {
- // This network policy FQDN exists in AAI - need to delete it now
- NetworkPolicy networkPolicy = networkPolicies.get().getNetworkPolicy().get(0)
- execution.setVariable("DCVFM_aaiQueryNetworkPolicyByFqdnReturnCode", 200)
- // Retrieve the network policy id for this FQDN
- def networkPolicyId = networkPolicy.getNetworkPolicyId()
- logger.debug("Deleting network-policy with network-policy-id " + networkPolicyId)
- try {
- AAIResourceUri delUri = AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, networkPolicyId)
- getAAIClient().delete(delUri)
- execution.setVariable("DoDVfMod_aaiDeleteNetworkPolicyReturnCode", 200)
- } catch (Exception e) {
- execution.setVariable("DoDVfMod_aaiDeleteNetworkPolicyReturnCode", 500)
- String delErrorMessage = "Unable to delete network-policy to AAI deleteNetworkPoliciesFromAAI - " + e.getMessage()
- logger.debug(delErrorMessage)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2500, delErrorMessage)
- }
- } else {
- execution.setVariable("DCVFM_aaiQueryNetworkPolicyByFqdnReturnCode", 404)
- // This network policy FQDN is not in AAI. No need to delete.
- logger.debug("The return code is: " + 404)
- logger.debug("This network policy FQDN is not in AAI: " + fqdn)
- logger.debug("Network policy FQDN is not in AAI")
- }
- }catch(Exception e ) {
- // aai all errors
- String dataErrorMessage = "Unexpected Response from deleteNetworkPoliciesFromAAI - " + e.getMessage()
- logger.debug(dataErrorMessage)
- }
- } // end loop
- } else {
- logger.debug("No contrail network policies to query/create")
- }
- } catch (BpmnError e) {
- throw e;
- } catch (Exception ex) {
- String exceptionMessage = "Bpmn error encountered in DoDeletVfModule flow. deleteNetworkPoliciesFromAAI() - " + ex.getMessage()
- logger.debug(exceptionMessage)
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
- }
-
- }
-
- /**
- * Prepare a Request for invoking the UpdateAAIGenericVnf subflow.
- *
- * @param execution The flow's execution instance.
- */
- public void prepUpdateAAIGenericVnf(DelegateExecution execution) {
- def method = getClass().getSimpleName() + '.prepUpdateAAIGenericVnf(' +
- 'execution=' + execution.getId() +
- ')'
-
- logger.trace('Entered ' + method)
-
- try {
- def vnfId = execution.getVariable('vnfId')
- def oamManagementV4Address = execution.getVariable(Prefix + 'oamManagementV4Address')
- def oamManagementV6Address = execution.getVariable(Prefix + 'oamManagementV6Address')
- def ipv4OamAddressElement = ''
- def managementV6AddressElement = ''
-
- if (oamManagementV4Address != null) {
- ipv4OamAddressElement = '<ipv4-oam-address>' + 'DELETE' + '</ipv4-oam-address>'
- }
-
- if (oamManagementV6Address != null) {
- managementV6AddressElement = '<management-v6-address>' + 'DELETE' + '</management-v6-address>'
- }
-
-
- String updateAAIGenericVnfRequest = """
+ uri.queryParam("network-policy-fqdn", fqdn)
+ try {
+ Optional<NetworkPolicies> networkPolicies = getAAIClient().get(NetworkPolicies.class, uri)
+ if (networkPolicies.isPresent() && !networkPolicies.get().getNetworkPolicy().isEmpty()) {
+ // This network policy FQDN exists in AAI - need to delete it now
+ NetworkPolicy networkPolicy = networkPolicies.get().getNetworkPolicy().get(0)
+ execution.setVariable("DCVFM_aaiQueryNetworkPolicyByFqdnReturnCode", 200)
+ // Retrieve the network policy id for this FQDN
+ def networkPolicyId = networkPolicy.getNetworkPolicyId()
+ logger.debug("Deleting network-policy with network-policy-id " + networkPolicyId)
+ try {
+ AAIResourceUri delUri = AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, networkPolicyId)
+ getAAIClient().delete(delUri)
+ execution.setVariable("DoDVfMod_aaiDeleteNetworkPolicyReturnCode", 200)
+ } catch (Exception e) {
+ execution.setVariable("DoDVfMod_aaiDeleteNetworkPolicyReturnCode", 500)
+ String delErrorMessage = "Unable to delete network-policy to AAI deleteNetworkPoliciesFromAAI - " + e.getMessage()
+ logger.debug(delErrorMessage)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, delErrorMessage)
+ }
+ } else {
+ execution.setVariable("DCVFM_aaiQueryNetworkPolicyByFqdnReturnCode", 404)
+ // This network policy FQDN is not in AAI. No need to delete.
+ logger.debug("The return code is: " + 404)
+ logger.debug("This network policy FQDN is not in AAI: " + fqdn)
+ logger.debug("Network policy FQDN is not in AAI")
+ }
+ }catch(Exception e ) {
+ // aai all errors
+ String dataErrorMessage = "Unexpected Response from deleteNetworkPoliciesFromAAI - " + e.getMessage()
+ logger.debug(dataErrorMessage)
+ }
+ } // end loop
+ } else {
+ logger.debug("No contrail network policies to query/create")
+ }
+ } catch (BpmnError e) {
+ throw e;
+ } catch (Exception ex) {
+ String exceptionMessage = "Bpmn error encountered in DoDeletVfModule flow. deleteNetworkPoliciesFromAAI() - " + ex.getMessage()
+ logger.debug(exceptionMessage)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
+ }
+
+ }
+
+ /**
+ * Prepare a Request for invoking the UpdateAAIGenericVnf subflow.
+ *
+ * @param execution The flow's execution instance.
+ */
+ public void prepUpdateAAIGenericVnf(DelegateExecution execution) {
+ def method = getClass().getSimpleName() + '.prepUpdateAAIGenericVnf(' +
+ 'execution=' + execution.getId() +
+ ')'
+
+ logger.trace('Entered ' + method)
+
+ try {
+ def vnfId = execution.getVariable('vnfId')
+ def oamManagementV4Address = execution.getVariable(Prefix + 'oamManagementV4Address')
+ def oamManagementV6Address = execution.getVariable(Prefix + 'oamManagementV6Address')
+ def ipv4OamAddressElement = ''
+ def managementV6AddressElement = ''
+
+ if (oamManagementV4Address != null) {
+ ipv4OamAddressElement = '<ipv4-oam-address>' + 'DELETE' + '</ipv4-oam-address>'
+ }
+
+ if (oamManagementV6Address != null) {
+ managementV6AddressElement = '<management-v6-address>' + 'DELETE' + '</management-v6-address>'
+ }
+
+
+ String updateAAIGenericVnfRequest = """
<UpdateAAIGenericVnfRequest>
<vnf-id>${MsoUtils.xmlEscape(vnfId)}</vnf-id>
${ipv4OamAddressElement}
${managementV6AddressElement}
</UpdateAAIGenericVnfRequest>
"""
- updateAAIGenericVnfRequest = utils.formatXml(updateAAIGenericVnfRequest)
- execution.setVariable(Prefix + 'updateAAIGenericVnfRequest', updateAAIGenericVnfRequest)
- logger.debug("updateAAIGenericVnfRequest : " + updateAAIGenericVnfRequest)
- logger.debug('Request for UpdateAAIGenericVnf:\n' + updateAAIGenericVnfRequest)
-
-
- logger.trace('Exited ' + method)
- } catch (BpmnError e) {
- throw e;
- } catch (Exception e) {
- logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- 'Caught exception in ' + method, "BPMN",
- ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
- exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepUpdateAAIGenericVnf(): ' + e.getMessage())
- }
- }
-
- /**
- * Using the vnfId and vfModuleId provided in the inputs,
- * query AAI to get the corresponding VF Module info.
- * A 200 response is expected with the VF Module info in the response body,
- * Will determine VF Module's orchestration status if one exists
- *
- * @param execution The flow's execution instance.
- */
- public void queryAAIVfModuleForStatus(DelegateExecution execution) {
-
- def method = getClass().getSimpleName() + '.queryAAIVfModuleForStatus(' +
- 'execution=' + execution.getId() +
- ')'
- logger.trace('Entered ' + method)
-
- execution.setVariable(Prefix + 'orchestrationStatus', '')
-
- try {
- def vnfId = execution.getVariable('vnfId')
- def vfModuleId = execution.getVariable('vfModuleId')
-
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId)
-
- try {
+ updateAAIGenericVnfRequest = utils.formatXml(updateAAIGenericVnfRequest)
+ execution.setVariable(Prefix + 'updateAAIGenericVnfRequest', updateAAIGenericVnfRequest)
+ logger.debug("updateAAIGenericVnfRequest : " + updateAAIGenericVnfRequest)
+ logger.debug('Request for UpdateAAIGenericVnf:\n' + updateAAIGenericVnfRequest)
+
+
+ logger.trace('Exited ' + method)
+ } catch (BpmnError e) {
+ throw e;
+ } catch (Exception e) {
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN",
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepUpdateAAIGenericVnf(): ' + e.getMessage())
+ }
+ }
+
+ /**
+ * Using the vnfId and vfModuleId provided in the inputs,
+ * query AAI to get the corresponding VF Module info.
+ * A 200 response is expected with the VF Module info in the response body,
+ * Will determine VF Module's orchestration status if one exists
+ *
+ * @param execution The flow's execution instance.
+ */
+ public void queryAAIVfModuleForStatus(DelegateExecution execution) {
+
+ def method = getClass().getSimpleName() + '.queryAAIVfModuleForStatus(' +
+ 'execution=' + execution.getId() +
+ ')'
+ logger.trace('Entered ' + method)
+
+ execution.setVariable(Prefix + 'orchestrationStatus', '')
+
+ try {
+ def vnfId = execution.getVariable('vnfId')
+ def vfModuleId = execution.getVariable('vfModuleId')
+
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId)
+
+ try {
Optional<org.onap.aai.domain.yang.VfModule> vfModule = getAAIClient().get(org.onap.aai.domain.yang.VfModule.class, uri);
- // Retrieve VF Module info and its orchestration status; if not found, do nothing
+ // Retrieve VF Module info and its orchestration status; if not found, do nothing
if (vfModule.isPresent()) {
execution.setVariable(Prefix + 'queryAAIVfModuleForStatusResponseCode', 200)
execution.setVariable(Prefix + 'queryAAIVfModuleForStatusResponse', vfModule.get())
@@ -622,20 +618,20 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{
execution.setVariable(Prefix + "orchestrationStatus", orchestrationStatus)
logger.debug("Received orchestration status from A&AI: " + orchestrationStatus)
}
- } catch (Exception ex) {
- logger.debug('Exception occurred while executing AAI GET: {}', ex.getMessage(), ex)
- exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'AAI GET Failed:' + ex.getMessage())
- }
- logger.trace('Exited ' + method)
- } catch (BpmnError e) {
- throw e;
- } catch (Exception e) {
- logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- 'Caught exception in ' + method, "BPMN",
- ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
- exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIVfModuleForStatus(): ' + e.getMessage())
- }
- }
+ } catch (Exception ex) {
+ logger.debug('Exception occurred while executing AAI GET: {}', ex.getMessage(), ex)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'AAI GET Failed:' + ex.getMessage())
+ }
+ logger.trace('Exited ' + method)
+ } catch (BpmnError e) {
+ throw e;
+ } catch (Exception e) {
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN",
+ 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 34a210364a..350de4a03d 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
@@ -9,9 +9,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -53,244 +53,244 @@ import org.slf4j.LoggerFactory
public class DoDeleteVfModuleFromVnf extends VfModuleBase {
private static final Logger logger = LoggerFactory.getLogger( DoDeleteVfModuleFromVnf.class);
- def Prefix="DDVFMV_"
- ExceptionUtil exceptionUtil = new ExceptionUtil()
- JsonUtils jsonUtil = new JsonUtils()
-
- public void initProcessVariables(DelegateExecution execution) {
- execution.setVariable("prefix",Prefix)
- execution.setVariable("DDVFMV_contrailNetworkPolicyFqdnList", null)
- }
-
- // parse the incoming request
- public void preProcessRequest(DelegateExecution execution) {
-
- initProcessVariables(execution)
-
- try {
-
- // Building Block-type request
-
- // Set mso-request-id to request-id for VNF Adapter interface
- String requestId = execution.getVariable("msoRequestId")
- execution.setVariable("mso-request-id", requestId)
- execution.setVariable("requestId", requestId)
- logger.debug("msoRequestId: " + requestId)
- String tenantId = execution.getVariable("tenantId")
- logger.debug("tenantId: " + tenantId)
- String cloudSiteId = execution.getVariable("lcpCloudRegionId")
- execution.setVariable("cloudSiteId", cloudSiteId)
- logger.debug("cloudSiteId: " + cloudSiteId)
- String cloudOwner = execution.getVariable("cloudOwner")
- execution.setVariable("cloudOwner", cloudOwner)
- logger.debug("cloudOwner: " + cloudOwner)
- // Source is HARDCODED
- String source = "VID"
- execution.setVariable("source", source)
- // isVidRequest is hardcoded to "true"
- execution.setVariable("isVidRequest", "true")
- // SrvInstId is hardcoded to empty
- execution.setVariable("srvInstId", "")
- // ServiceId is hardcoded to empty
- execution.setVariable("serviceId", "")
- String serviceInstanceId = execution.getVariable("serviceInstanceId")
- logger.debug("serviceInstanceId: " + serviceInstanceId)
- String vnfId = execution.getVariable("vnfId")
- logger.debug("vnfId: " + vnfId)
- String vfModuleId = execution.getVariable("vfModuleId")
- logger.debug("vfModuleId: " + vfModuleId)
- if (serviceInstanceId == null || serviceInstanceId.isEmpty()) {
- execution.setVariable(Prefix + "serviceInstanceIdToSdnc", vfModuleId)
- }
- else {
- execution.setVariable(Prefix + "serviceInstanceIdToSdnc", serviceInstanceId)
- }
-
- String sdncVersion = execution.getVariable("sdncVersion")
- if (sdncVersion == null) {
- sdncVersion = "1707"
- }
- execution.setVariable(Prefix + "sdncVersion", sdncVersion)
- logger.debug("Incoming Sdnc Version is: " + sdncVersion)
-
- String sdncCallbackUrl = (String) UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution)
- if (sdncCallbackUrl == null || sdncCallbackUrl.trim().isEmpty()) {
- def msg = 'Required variable \'mso.workflow.sdncadapter.callback\' is missing'
- logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- ErrorCode.UnknownError.getValue(), "Exception");
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
- }
- execution.setVariable("sdncCallbackUrl", sdncCallbackUrl)
- logger.debug("SDNC Callback URL: " + sdncCallbackUrl)
- logger.debug("SDNC Callback URL is: " + sdncCallbackUrl)
-
- }catch(BpmnError b){
- throw b
- }catch(Exception e){
- logger.debug("Exception is: " + e.getMessage())
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error encountered in PreProcess method!")
- }
- }
-
- public void queryAAIForVfModule(DelegateExecution execution) {
- def method = getClass().getSimpleName() + '.queryAAIForVfModule(' +
- 'execution=' + execution.getId() +
- ')'
-
- logger.trace('Entered ' + method)
-
- try {
- def vnfId = execution.getVariable('vnfId')
-
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId).depth(Depth.ONE)
- try {
- Optional<GenericVnf> genericVnf = getAAIClient().get(GenericVnf.class,uri)
-
- if(genericVnf.isPresent()){
- execution.setVariable('DDVMFV_getVnfResponseCode', 200)
- execution.setVariable('DDVMFV_getVnfResponse', genericVnf.get())
- }else{
- execution.setVariable('DDVMFV_getVnfResponseCode', 404)
- execution.setVariable('DDVMFV_getVnfResponse', "Generic Vnf not found!")
- }
- } catch (Exception ex) {
- logger.debug('Exception occurred while executing AAI GET: {}', ex.getMessage(), ex)
- execution.setVariable('DDVMFV_getVnfResponseCode', 500)
- execution.setVariable('DDVFMV_getVnfResponse', 'AAI GET Failed:' + ex.getMessage())
- }
- logger.trace('Exited ' + method)
- } catch (BpmnError e) {
- throw e;
- } catch (Exception e) {
- logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- 'Caught exception in ' + method, "BPMN",
- ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
- exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIForVfModule(): ' + e.getMessage())
- }
- }
-
- /**
- * Validate the VF Module. That is, confirm that a VF Module with the input VF Module ID
- * exists in the retrieved Generic VNF. Then, check to make sure that if that VF Module
- * is the base VF Module and it's not the only VF Module for this Generic VNF, that we're not
- * attempting to delete it.
- *
- * @param execution The flow's execution instance.
- */
- public void validateVfModule(DelegateExecution execution) {
- def method = getClass().getSimpleName() + '.validateVfModule(' +
- 'execution=' + execution.getId() +
- ')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logger.trace('Entered ' + method)
-
- try {
- GenericVnf genericVnf = execution.getVariable('DDVMFV_getVnfResponse')
- def vnfId = execution.getVariable('_vnfId')
- def vfModuleId = execution.getVariable('vfModuleId')
+ def Prefix="DDVFMV_"
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+ JsonUtils jsonUtil = new JsonUtils()
+
+ public void initProcessVariables(DelegateExecution execution) {
+ execution.setVariable("prefix",Prefix)
+ execution.setVariable("DDVFMV_contrailNetworkPolicyFqdnList", null)
+ }
+
+ // parse the incoming request
+ public void preProcessRequest(DelegateExecution execution) {
+
+ initProcessVariables(execution)
+
+ try {
+
+ // Building Block-type request
+
+ // Set mso-request-id to request-id for VNF Adapter interface
+ String requestId = execution.getVariable("msoRequestId")
+ execution.setVariable("mso-request-id", requestId)
+ execution.setVariable("requestId", requestId)
+ logger.debug("msoRequestId: " + requestId)
+ String tenantId = execution.getVariable("tenantId")
+ logger.debug("tenantId: " + tenantId)
+ String cloudSiteId = execution.getVariable("lcpCloudRegionId")
+ execution.setVariable("cloudSiteId", cloudSiteId)
+ logger.debug("cloudSiteId: " + cloudSiteId)
+ String cloudOwner = execution.getVariable("cloudOwner")
+ execution.setVariable("cloudOwner", cloudOwner)
+ logger.debug("cloudOwner: " + cloudOwner)
+ // Source is HARDCODED
+ String source = "VID"
+ execution.setVariable("source", source)
+ // isVidRequest is hardcoded to "true"
+ execution.setVariable("isVidRequest", "true")
+ // SrvInstId is hardcoded to empty
+ execution.setVariable("srvInstId", "")
+ // ServiceId is hardcoded to empty
+ execution.setVariable("serviceId", "")
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
+ logger.debug("serviceInstanceId: " + serviceInstanceId)
+ String vnfId = execution.getVariable("vnfId")
+ logger.debug("vnfId: " + vnfId)
+ String vfModuleId = execution.getVariable("vfModuleId")
+ logger.debug("vfModuleId: " + vfModuleId)
+ if (serviceInstanceId == null || serviceInstanceId.isEmpty()) {
+ execution.setVariable(Prefix + "serviceInstanceIdToSdnc", vfModuleId)
+ }
+ else {
+ execution.setVariable(Prefix + "serviceInstanceIdToSdnc", serviceInstanceId)
+ }
+
+ String sdncVersion = execution.getVariable("sdncVersion")
+ if (sdncVersion == null) {
+ sdncVersion = "1707"
+ }
+ execution.setVariable(Prefix + "sdncVersion", sdncVersion)
+ logger.debug("Incoming Sdnc Version is: " + sdncVersion)
+
+ String sdncCallbackUrl = (String) UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution)
+ if (sdncCallbackUrl == null || sdncCallbackUrl.trim().isEmpty()) {
+ def msg = 'Required variable \'mso.workflow.sdncadapter.callback\' is missing'
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ ErrorCode.UnknownError.getValue(), "Exception");
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ }
+ execution.setVariable("sdncCallbackUrl", sdncCallbackUrl)
+ logger.debug("SDNC Callback URL: " + sdncCallbackUrl)
+ logger.debug("SDNC Callback URL is: " + sdncCallbackUrl)
+
+ }catch(BpmnError b){
+ throw b
+ }catch(Exception e){
+ logger.debug("Exception is: " + e.getMessage())
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error encountered in PreProcess method!")
+ }
+ }
+
+ public void queryAAIForVfModule(DelegateExecution execution) {
+ def method = getClass().getSimpleName() + '.queryAAIForVfModule(' +
+ 'execution=' + execution.getId() +
+ ')'
+
+ logger.trace('Entered ' + method)
+
+ try {
+ def vnfId = execution.getVariable('vnfId')
+
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId).depth(Depth.ONE)
+ try {
+ Optional<GenericVnf> genericVnf = getAAIClient().get(GenericVnf.class,uri)
+
+ if(genericVnf.isPresent()){
+ execution.setVariable('DDVMFV_getVnfResponseCode', 200)
+ execution.setVariable('DDVMFV_getVnfResponse', genericVnf.get())
+ }else{
+ execution.setVariable('DDVMFV_getVnfResponseCode', 404)
+ execution.setVariable('DDVMFV_getVnfResponse', "Generic Vnf not found!")
+ }
+ } catch (Exception ex) {
+ logger.debug('Exception occurred while executing AAI GET: {}', ex.getMessage(), ex)
+ execution.setVariable('DDVMFV_getVnfResponseCode', 500)
+ execution.setVariable('DDVFMV_getVnfResponse', 'AAI GET Failed:' + ex.getMessage())
+ }
+ logger.trace('Exited ' + method)
+ } catch (BpmnError e) {
+ throw e;
+ } catch (Exception e) {
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN",
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIForVfModule(): ' + e.getMessage())
+ }
+ }
+
+ /**
+ * Validate the VF Module. That is, confirm that a VF Module with the input VF Module ID
+ * exists in the retrieved Generic VNF. Then, check to make sure that if that VF Module
+ * is the base VF Module and it's not the only VF Module for this Generic VNF, that we're not
+ * attempting to delete it.
+ *
+ * @param execution The flow's execution instance.
+ */
+ public void validateVfModule(DelegateExecution execution) {
+ def method = getClass().getSimpleName() + '.validateVfModule(' +
+ 'execution=' + execution.getId() +
+ ')'
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ logger.trace('Entered ' + method)
+
+ try {
+ GenericVnf genericVnf = execution.getVariable('DDVMFV_getVnfResponse')
+ def vnfId = execution.getVariable('_vnfId')
+ def vfModuleId = execution.getVariable('vfModuleId')
Optional<VfModule> vfModule = Optional.empty()
if(genericVnf.getVfModules()!=null && ! genericVnf.getVfModules().getVfModule().isEmpty()) {
vfModule = genericVnf.getVfModules().getVfModule().stream().filter { v -> v.getVfModuleId().equals(vfModuleId) }.findFirst()
}
- if (!vfModule.isPresent()) {
- String msg = 'VF Module \'' + vfModuleId + '\' does not exist in Generic VNF \'' + vnfId + '\''
- logger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 1002, msg)
- } else {
+ if (!vfModule.isPresent()) {
+ String msg = 'VF Module \'' + vfModuleId + '\' does not exist in Generic VNF \'' + vnfId + '\''
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1002, msg)
+ } else {
Boolean isOnlyVfModule = (genericVnf.getVfModules().getVfModule().size() == 1)
- if (isDebugLogEnabled) {
- logger.debug('VF Module \'' + vfModuleId + '\': isBaseVfModule=' + vfModule.get().isIsBaseVfModule() + ', isOnlyVfModule=' + isOnlyVfModule)
- }
- if (vfModule.get().isIsBaseVfModule() && !isOnlyVfModule) {
+ if (isDebugLogEnabled) {
+ logger.debug('VF Module \'' + vfModuleId + '\': isBaseVfModule=' + vfModule.get().isIsBaseVfModule() + ', isOnlyVfModule=' + isOnlyVfModule)
+ }
+ if (vfModule.get().isIsBaseVfModule() && !isOnlyVfModule) {
String msg = 'Cannot delete VF Module \'' + vfModuleId +
'\'since it is the base VF Module and it\'s not the only VF Module in Generic VNF \'' + vnfId + '\''
logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002,msg)
- }
- def heatStackId = vfModule.get().getHeatStackId()
- execution.setVariable('DDVMFV_heatStackId', heatStackId)
- logger.debug('VF Module heatStackId retrieved from AAI: ' + heatStackId)
- }
- logger.trace('Exited ' + method)
- } catch (BpmnError e) {
- throw e;
- } catch (Exception e) {
- logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- 'Caught exception in ' + method, "BPMN",
- ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
- exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in validateVfModule(): ' + e.getMessage())
- }
- }
-
-
- public void preProcessSDNCDeactivateRequest(DelegateExecution execution){
-
- execution.setVariable("prefix", Prefix)
- logger.trace("STARTED preProcessSDNCDeactivateRequest ")
-
- def serviceInstanceId = execution.getVariable("serviceInstanceId")
-
- try{
- //Build SDNC Request
-
- String deactivateSDNCRequest = buildSDNCRequest(execution, serviceInstanceId, "deactivate")
-
- deactivateSDNCRequest = utils.formatXml(deactivateSDNCRequest)
- execution.setVariable("DDVMFV_deactivateSDNCRequest", deactivateSDNCRequest)
- logger.debug("Outgoing DeactivateSDNCRequest is: \n" + deactivateSDNCRequest)
-
-
- }catch(Exception e){
- logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- "Exception Occured Processing preProcessSDNCDeactivateRequest. Exception is:\n" + e, "BPMN",
- ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
- exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessSDNCDeactivateRequest Method:\n" + e.getMessage())
- }
- logger.trace("COMPLETED preProcessSDNCDeactivateRequest ")
- }
-
- public void preProcessSDNCUnassignRequest(DelegateExecution execution) {
- def method = getClass().getSimpleName() + '.preProcessSDNCUnassignRequest(' +
- 'execution=' + execution.getId() +
- ')'
-
- logger.trace('Entered ' + method)
- execution.setVariable("prefix", Prefix)
- logger.trace("STARTED preProcessSDNCUnassignRequest Process ")
- try{
- String serviceInstanceId = execution.getVariable("serviceInstanceId")
-
- String unassignSDNCRequest = buildSDNCRequest(execution, serviceInstanceId, "unassign")
-
- execution.setVariable("DDVMFV_unassignSDNCRequest", unassignSDNCRequest)
- logger.debug("Outgoing UnassignSDNCRequest is: \n" + unassignSDNCRequest)
-
-
- }catch(Exception e){
- logger.debug("Exception Occured Processing preProcessSDNCUnassignRequest. Exception is:\n" + e)
- exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessSDNCUnassignRequest Method:\n" + e.getMessage())
- }
- logger.trace("COMPLETED preProcessSDNCUnassignRequest Process ")
- }
-
- public String buildSDNCRequest(DelegateExecution execution, String svcInstId, String action){
-
- String uuid = execution.getVariable('testReqId') // for junits
- if(uuid==null){
- uuid = execution.getVariable("msoRequestId") + "-" + System.currentTimeMillis()
- }
- def callbackURL = execution.getVariable("sdncCallbackUrl")
- def requestId = execution.getVariable("msoRequestId")
- def serviceId = execution.getVariable("serviceId")
- def serviceInstanceId = execution.getVariable("serviceInstanceId")
- def vfModuleId = execution.getVariable("vfModuleId")
- def source = execution.getVariable("source")
- def vnfId = execution.getVariable("vnfId")
-
- def sdncVersion = execution.getVariable(Prefix + "sdncVersion")
-
- String sdncRequest =
- """<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.onap/so/request/types/v1"
+ }
+ def heatStackId = vfModule.get().getHeatStackId()
+ execution.setVariable('DDVMFV_heatStackId', heatStackId)
+ logger.debug('VF Module heatStackId retrieved from AAI: ' + heatStackId)
+ }
+ logger.trace('Exited ' + method)
+ } catch (BpmnError e) {
+ throw e;
+ } catch (Exception e) {
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'Caught exception in ' + method, "BPMN",
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in validateVfModule(): ' + e.getMessage())
+ }
+ }
+
+
+ public void preProcessSDNCDeactivateRequest(DelegateExecution execution){
+
+ execution.setVariable("prefix", Prefix)
+ logger.trace("STARTED preProcessSDNCDeactivateRequest ")
+
+ def serviceInstanceId = execution.getVariable("serviceInstanceId")
+
+ try{
+ //Build SDNC Request
+
+ String deactivateSDNCRequest = buildSDNCRequest(execution, serviceInstanceId, "deactivate")
+
+ deactivateSDNCRequest = utils.formatXml(deactivateSDNCRequest)
+ execution.setVariable("DDVMFV_deactivateSDNCRequest", deactivateSDNCRequest)
+ logger.debug("Outgoing DeactivateSDNCRequest is: \n" + deactivateSDNCRequest)
+
+
+ }catch(Exception e){
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Occured Processing preProcessSDNCDeactivateRequest. Exception is:\n" + e, "BPMN",
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessSDNCDeactivateRequest Method:\n" + e.getMessage())
+ }
+ logger.trace("COMPLETED preProcessSDNCDeactivateRequest ")
+ }
+
+ public void preProcessSDNCUnassignRequest(DelegateExecution execution) {
+ def method = getClass().getSimpleName() + '.preProcessSDNCUnassignRequest(' +
+ 'execution=' + execution.getId() +
+ ')'
+
+ logger.trace('Entered ' + method)
+ execution.setVariable("prefix", Prefix)
+ logger.trace("STARTED preProcessSDNCUnassignRequest Process ")
+ try{
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
+
+ String unassignSDNCRequest = buildSDNCRequest(execution, serviceInstanceId, "unassign")
+
+ execution.setVariable("DDVMFV_unassignSDNCRequest", unassignSDNCRequest)
+ logger.debug("Outgoing UnassignSDNCRequest is: \n" + unassignSDNCRequest)
+
+
+ }catch(Exception e){
+ logger.debug("Exception Occured Processing preProcessSDNCUnassignRequest. Exception is:\n" + e)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessSDNCUnassignRequest Method:\n" + e.getMessage())
+ }
+ logger.trace("COMPLETED preProcessSDNCUnassignRequest Process ")
+ }
+
+ public String buildSDNCRequest(DelegateExecution execution, String svcInstId, String action){
+
+ String uuid = execution.getVariable('testReqId') // for junits
+ if(uuid==null){
+ uuid = execution.getVariable("msoRequestId") + "-" + System.currentTimeMillis()
+ }
+ def callbackURL = execution.getVariable("sdncCallbackUrl")
+ def requestId = execution.getVariable("msoRequestId")
+ def serviceId = execution.getVariable("serviceId")
+ def serviceInstanceId = execution.getVariable("serviceInstanceId")
+ def vfModuleId = execution.getVariable("vfModuleId")
+ def source = execution.getVariable("source")
+ def vnfId = execution.getVariable("vnfId")
+
+ def sdncVersion = execution.getVariable(Prefix + "sdncVersion")
+
+ String sdncRequest =
+ """<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.onap/so/request/types/v1"
xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"
xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1">
<sdncadapter:RequestHeader>
@@ -312,73 +312,73 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase {
</request-information>
<service-information>
<service-id/>
- <subscription-service-type/>
+ <subscription-service-type/>
<service-instance-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-instance-id>
<global-customer-id/>
</service-information>
<vnf-information>
<vnf-id>${MsoUtils.xmlEscape(vnfId)}</vnf-id>
- <vnf-type/>
+ <vnf-type/>
</vnf-information>
<vf-module-information>
<vf-module-id>${MsoUtils.xmlEscape(vfModuleId)}</vf-module-id>
</vf-module-information>
- <vf-module-request-input/>
+ <vf-module-request-input/>
</sdncadapterworkflow:SDNCRequestData>
</sdncadapterworkflow:SDNCAdapterWorkflowRequest>"""
-
- logger.debug("sdncRequest: " + sdncRequest)
- return sdncRequest
- }
-
- public void validateSDNCResponse(DelegateExecution execution, String response, String method){
-
- execution.setVariable("prefix",Prefix)
- logger.trace("STARTED ValidateSDNCResponse Process")
-
- WorkflowException workflowException = execution.getVariable("WorkflowException")
- boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator")
-
- logger.debug("workflowException: " + workflowException)
-
- SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils()
- sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator)
-
- logger.debug("SDNCResponse: " + response)
-
- String sdncResponse = response
- if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){
- logger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + sdncResponse)
- }else{
- logger.debug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.")
- throw new BpmnError("MSOWorkflowException")
- }
- logger.trace("COMPLETED ValidateSDNCResponse Process")
- }
-
-
- // parse the incoming DELETE_VF_MODULE request
- // and formulate the outgoing VnfAdapterDeleteV1 request
- public void prepVNFAdapterRequest(DelegateExecution execution) {
-
- def requestId = UUID.randomUUID().toString()
- def origRequestId = execution.getVariable('requestId')
- def srvInstId = execution.getVariable("serviceInstanceId")
- def aicCloudRegion = execution.getVariable("cloudSiteId")
- def cloudOwner = execution.getVariable("cloudOwner")
- def vnfId = execution.getVariable("vnfId")
- def vfModuleId = execution.getVariable("vfModuleId")
- def vfModuleStackId = execution.getVariable('DDVMFV_heatStackId')
- def tenantId = execution.getVariable("tenantId")
- def messageId = execution.getVariable('requestId') + '-' +
- System.currentTimeMillis()
- def notificationUrl = createCallbackURL(execution, "VNFAResponse", messageId)
- def useQualifiedHostName = UrnPropertiesReader.getVariable("mso.use.qualified.host",execution)
- if ('true'.equals(useQualifiedHostName)) {
- notificationUrl = utils.getQualifiedHostNameForCallback(notificationUrl)
- }
-
- String request = """
+
+ logger.debug("sdncRequest: " + sdncRequest)
+ return sdncRequest
+ }
+
+ public void validateSDNCResponse(DelegateExecution execution, String response, String method){
+
+ execution.setVariable("prefix",Prefix)
+ logger.trace("STARTED ValidateSDNCResponse Process")
+
+ WorkflowException workflowException = execution.getVariable("WorkflowException")
+ boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator")
+
+ logger.debug("workflowException: " + workflowException)
+
+ SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils()
+ sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator)
+
+ logger.debug("SDNCResponse: " + response)
+
+ String sdncResponse = response
+ if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){
+ logger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + sdncResponse)
+ }else{
+ logger.debug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.")
+ throw new BpmnError("MSOWorkflowException")
+ }
+ logger.trace("COMPLETED ValidateSDNCResponse Process")
+ }
+
+
+ // parse the incoming DELETE_VF_MODULE request
+ // and formulate the outgoing VnfAdapterDeleteV1 request
+ public void prepVNFAdapterRequest(DelegateExecution execution) {
+
+ def requestId = UUID.randomUUID().toString()
+ def origRequestId = execution.getVariable('requestId')
+ def srvInstId = execution.getVariable("serviceInstanceId")
+ def aicCloudRegion = execution.getVariable("cloudSiteId")
+ def cloudOwner = execution.getVariable("cloudOwner")
+ def vnfId = execution.getVariable("vnfId")
+ def vfModuleId = execution.getVariable("vfModuleId")
+ def vfModuleStackId = execution.getVariable('DDVMFV_heatStackId')
+ def tenantId = execution.getVariable("tenantId")
+ def messageId = execution.getVariable('requestId') + '-' +
+ System.currentTimeMillis()
+ def notificationUrl = createCallbackURL(execution, "VNFAResponse", messageId)
+ def useQualifiedHostName = UrnPropertiesReader.getVariable("mso.use.qualified.host",execution)
+ if ('true'.equals(useQualifiedHostName)) {
+ notificationUrl = utils.getQualifiedHostNameForCallback(notificationUrl)
+ }
+
+ String request = """
<deleteVfModuleRequest>
<cloudSiteId>${MsoUtils.xmlEscape(aicCloudRegion)}</cloudSiteId>
<cloudOwner>${MsoUtils.xmlEscape(cloudOwner)}</cloudOwner>
@@ -396,126 +396,126 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase {
</deleteVfModuleRequest>
""" as String
- logger.debug("vnfAdapterRestV1Request: " + request)
- logger.debug("deleteVfModuleRequest: " + request)
- execution.setVariable("vnfAdapterRestV1Request", request)
- }
-
-
- // generates a WorkflowException if
- // -
- public void handleDoDeleteVfModuleFailure(DelegateExecution execution) {
- logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- "AAI error occurred deleting the Generic Vnf: " + execution.getVariable("DDVFMV_deleteGenericVnfResponse"),
- "BPMN", ErrorCode.UnknownError.getValue(), "Exception");
- String processKey = getProcessKey(execution);
- WorkflowException exception = new WorkflowException(processKey, 5000,
- execution.getVariable("DDVFMV_deleteGenericVnfResponse"))
- execution.setVariable("WorkflowException", exception)
- }
-
- public void postProcessVNFAdapterRequest(DelegateExecution execution) {
- def method = getClass().getSimpleName() + '.postProcessVNFAdapterRequest(' +
- 'execution=' + execution.getId() +
- ')'
-
- logger.trace('Entered ' + method)
- execution.setVariable("prefix",Prefix)
- try{
- logger.trace("STARTED postProcessVNFAdapterRequest Process")
-
- String vnfResponse = execution.getVariable("DDVMFV_doDeleteVfModuleResponse")
- logger.debug("VNF Adapter Response is: " + vnfResponse)
- logger.debug("deleteVnfAResponse is: \n" + vnfResponse)
-
- if(vnfResponse != null){
-
- if(vnfResponse.contains("deleteVfModuleResponse")){
- logger.debug("Received a Good Response from VNF Adapter for DELETE_VF_MODULE Call.")
- execution.setVariable("DDVFMV_vnfVfModuleDeleteCompleted", true)
-
- // Parse vnfOutputs for contrail network polcy FQDNs
- def vfModuleOutputsXml = utils.getNodeXml(vnfResponse, "vfModuleOutputs")
- if(!isBlank(vfModuleOutputsXml)) {
- vfModuleOutputsXml = utils.removeXmlNamespaces(vfModuleOutputsXml)
- List contrailNetworkPolicyFqdnList = []
- for(Node node: utils.getMultNodeObjects(vfModuleOutputsXml, "entry")) {
- String key = utils.getChildNodeText(node, "key")
- if(key == null) {
-
- } else if (key.endsWith("contrail_network_policy_fqdn")) {
- String contrailNetworkPolicyFqdn = utils.getChildNodeText(node, "value")
- logger.debug("Obtained contrailNetworkPolicyFqdn: " + contrailNetworkPolicyFqdn)
- contrailNetworkPolicyFqdnList.add(contrailNetworkPolicyFqdn)
- }
- else if (key.equals("oam_management_v4_address")) {
- String oamManagementV4Address = utils.getChildNodeText(node, "value")
- logger.debug("Obtained oamManagementV4Address: " + oamManagementV4Address)
- execution.setVariable(Prefix + "oamManagementV4Address", oamManagementV4Address)
- }
- else if (key.equals("oam_management_v6_address")) {
- String oamManagementV6Address = utils.getChildNodeText(node, "value")
- logger.debug("Obtained oamManagementV6Address: " + oamManagementV6Address)
- execution.setVariable(Prefix + "oamManagementV6Address", oamManagementV6Address)
- }
- }
- if (!contrailNetworkPolicyFqdnList.isEmpty()) {
- logger.debug("Setting the fqdn list")
- execution.setVariable("DDVFMV_contrailNetworkPolicyFqdnList", contrailNetworkPolicyFqdnList)
- }
- }
- }else{
- logger.debug("Received a BAD Response from VNF Adapter for DELETE_VF_MODULE Call.")
- exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "VNF Adapter Error")
- }
- }else{
- logger.debug("Response from VNF Adapter is Null for DELETE_VF_MODULE Call.")
- exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Empty response from VNF Adapter")
- }
-
- }catch(BpmnError b){
- throw b
- }catch(Exception e){
- logger.debug("Internal Error Occured in PostProcess Method")
- exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Internal Error Occured in PostProcess Method")
- }
- logger.trace("COMPLETED postProcessVnfAdapterResponse Process")
- }
-
- public void deleteNetworkPoliciesFromAAI(DelegateExecution execution) {
- def method = getClass().getSimpleName() + '.deleteNetworkPoliciesFromAAI(' +
- 'execution=' + execution.getId() +
- ')'
-
- logger.trace('Entered ' + method)
- execution.setVariable("prefix", Prefix)
- logger.trace("STARTED deleteNetworkPoliciesFromAAI ")
-
- try {
- // get variables
- List fqdnList = execution.getVariable("DDVFMV_contrailNetworkPolicyFqdnList")
- if (fqdnList == null) {
- logger.debug("No network policies to delete")
- return
- }
- int fqdnCount = fqdnList.size()
-
- execution.setVariable("DDVFMV_networkPolicyFqdnCount", fqdnCount)
- logger.debug("DDVFMV_networkPolicyFqdnCount - " + fqdnCount)
-
- AaiUtil aaiUriUtil = new AaiUtil(this)
-
- if (fqdnCount > 0) {
- // AII loop call over contrail network policy fqdn list
- for (i in 0..fqdnCount-1) {
-
- int counting = i+1
- String fqdn = fqdnList[i]
-
- // Query AAI for this network policy FQDN
+
+ logger.debug("deleteVfModuleRequest: " + request)
+ execution.setVariable("vnfAdapterTaskRequest", request)
+ }
+
+
+ // generates a WorkflowException if
+ // -
+ public void handleDoDeleteVfModuleFailure(DelegateExecution execution) {
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "AAI error occurred deleting the Generic Vnf: " + execution.getVariable("DDVFMV_deleteGenericVnfResponse"),
+ "BPMN", ErrorCode.UnknownError.getValue(), "Exception");
+ String processKey = getProcessKey(execution);
+ WorkflowException exception = new WorkflowException(processKey, 5000,
+ execution.getVariable("DDVFMV_deleteGenericVnfResponse"))
+ execution.setVariable("WorkflowException", exception)
+ }
+
+ public void postProcessVNFAdapterRequest(DelegateExecution execution) {
+ def method = getClass().getSimpleName() + '.postProcessVNFAdapterRequest(' +
+ 'execution=' + execution.getId() +
+ ')'
+
+ logger.trace('Entered ' + method)
+ execution.setVariable("prefix",Prefix)
+ try{
+ logger.trace("STARTED postProcessVNFAdapterRequest Process")
+
+ String vnfResponse = execution.getVariable("DDVMFV_doDeleteVfModuleResponse")
+ logger.debug("VNF Adapter Response is: " + vnfResponse)
+ logger.debug("deleteVnfAResponse is: \n" + vnfResponse)
+
+ if(vnfResponse != null){
+
+ if(vnfResponse.contains("deleteVfModuleResponse")){
+ logger.debug("Received a Good Response from VNF Adapter for DELETE_VF_MODULE Call.")
+ execution.setVariable("DDVFMV_vnfVfModuleDeleteCompleted", true)
+
+ // Parse vnfOutputs for contrail network polcy FQDNs
+ def vfModuleOutputsXml = utils.getNodeXml(vnfResponse, "vfModuleOutputs")
+ if(!isBlank(vfModuleOutputsXml)) {
+ vfModuleOutputsXml = utils.removeXmlNamespaces(vfModuleOutputsXml)
+ List contrailNetworkPolicyFqdnList = []
+ for(Node node: utils.getMultNodeObjects(vfModuleOutputsXml, "entry")) {
+ String key = utils.getChildNodeText(node, "key")
+ if(key == null) {
+
+ } else if (key.endsWith("contrail_network_policy_fqdn")) {
+ String contrailNetworkPolicyFqdn = utils.getChildNodeText(node, "value")
+ logger.debug("Obtained contrailNetworkPolicyFqdn: " + contrailNetworkPolicyFqdn)
+ contrailNetworkPolicyFqdnList.add(contrailNetworkPolicyFqdn)
+ }
+ else if (key.equals("oam_management_v4_address")) {
+ String oamManagementV4Address = utils.getChildNodeText(node, "value")
+ logger.debug("Obtained oamManagementV4Address: " + oamManagementV4Address)
+ execution.setVariable(Prefix + "oamManagementV4Address", oamManagementV4Address)
+ }
+ else if (key.equals("oam_management_v6_address")) {
+ String oamManagementV6Address = utils.getChildNodeText(node, "value")
+ logger.debug("Obtained oamManagementV6Address: " + oamManagementV6Address)
+ execution.setVariable(Prefix + "oamManagementV6Address", oamManagementV6Address)
+ }
+ }
+ if (!contrailNetworkPolicyFqdnList.isEmpty()) {
+ logger.debug("Setting the fqdn list")
+ execution.setVariable("DDVFMV_contrailNetworkPolicyFqdnList", contrailNetworkPolicyFqdnList)
+ }
+ }
+ }else{
+ logger.debug("Received a BAD Response from VNF Adapter for DELETE_VF_MODULE Call.")
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "VNF Adapter Error")
+ }
+ }else{
+ logger.debug("Response from VNF Adapter is Null for DELETE_VF_MODULE Call.")
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Empty response from VNF Adapter")
+ }
+
+ }catch(BpmnError b){
+ throw b
+ }catch(Exception e){
+ logger.debug("Internal Error Occured in PostProcess Method")
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Internal Error Occured in PostProcess Method")
+ }
+ logger.trace("COMPLETED postProcessVnfAdapterResponse Process")
+ }
+
+ public void deleteNetworkPoliciesFromAAI(DelegateExecution execution) {
+ def method = getClass().getSimpleName() + '.deleteNetworkPoliciesFromAAI(' +
+ 'execution=' + execution.getId() +
+ ')'
+
+ logger.trace('Entered ' + method)
+ execution.setVariable("prefix", Prefix)
+ logger.trace("STARTED deleteNetworkPoliciesFromAAI ")
+
+ try {
+ // get variables
+ List fqdnList = execution.getVariable("DDVFMV_contrailNetworkPolicyFqdnList")
+ if (fqdnList == null) {
+ logger.debug("No network policies to delete")
+ return
+ }
+ int fqdnCount = fqdnList.size()
+
+ execution.setVariable("DDVFMV_networkPolicyFqdnCount", fqdnCount)
+ logger.debug("DDVFMV_networkPolicyFqdnCount - " + fqdnCount)
+
+ AaiUtil aaiUriUtil = new AaiUtil(this)
+
+ if (fqdnCount > 0) {
+ // AII loop call over contrail network policy fqdn list
+ for (i in 0..fqdnCount-1) {
+
+ int counting = i+1
+ String fqdn = fqdnList[i]
+
+ // Query AAI for this network policy FQDN
AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY)
- uri.queryParam("network-policy-fqdn", fqdn)
+ uri.queryParam("network-policy-fqdn", fqdn)
try {
Optional<NetworkPolicies> networkPolicies = getAAIClient().get(NetworkPolicies.class, uri)
@@ -555,35 +555,35 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase {
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage)
}
} // end loop
- } else {
- logger.debug("No contrail network policies to query/create")
+ } else {
+ logger.debug("No contrail network policies to query/create")
- }
+ }
+
+ } catch (BpmnError e) {
+ throw e;
- } catch (BpmnError e) {
- throw e;
+ } catch (Exception ex) {
+ String exceptionMessage = "Bpmn error encountered in DoDeletVfModule flow. deleteNetworkPoliciesFromAAI() - " + ex.getMessage()
+ logger.debug(exceptionMessage)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
+ }
- } catch (Exception ex) {
- String exceptionMessage = "Bpmn error encountered in DoDeletVfModule flow. deleteNetworkPoliciesFromAAI() - " + ex.getMessage()
- logger.debug(exceptionMessage)
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
- }
+ }
- }
-
- // and formulate the outgoing DeleteAAIVfModuleRequest request
- public void prepDeleteAAIVfModule(DelegateExecution execution) {
+ // and formulate the outgoing DeleteAAIVfModuleRequest request
+ public void prepDeleteAAIVfModule(DelegateExecution execution) {
- def vnfId = execution.getVariable("vnfId")
- def vfModuleId = execution.getVariable("vfModuleId")
- // formulate the request for UpdateAAIVfModule
- String request = """<DeleteAAIVfModuleRequest>
+ def vnfId = execution.getVariable("vnfId")
+ def vfModuleId = execution.getVariable("vfModuleId")
+ // formulate the request for UpdateAAIVfModule
+ String request = """<DeleteAAIVfModuleRequest>
<vnf-id>${MsoUtils.xmlEscape(vnfId)}</vnf-id>
<vf-module-id>${MsoUtils.xmlEscape(vfModuleId)}</vf-module-id>
</DeleteAAIVfModuleRequest>""" as String
- logger.debug("DeleteAAIVfModuleRequest :" + request)
-
- execution.setVariable("DeleteAAIVfModuleRequest", request)
- }
+ logger.debug("DeleteAAIVfModuleRequest :" + request)
+
+ execution.setVariable("DeleteAAIVfModuleRequest", request)
+ }
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/HandleOrchestrationTask.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/HandleOrchestrationTask.groovy
index 89490ff620..89490ff620 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/HandleOrchestrationTask.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/HandleOrchestrationTask.groovy
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/PNFSoftwareUpgrade.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/PNFSoftwareUpgrade.groovy
new file mode 100644
index 0000000000..8e7a4f727d
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/PNFSoftwareUpgrade.groovy
@@ -0,0 +1,124 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.scripts
+
+import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+import org.onap.so.bpmn.common.scripts.ExceptionUtil
+import org.onap.so.bpmn.common.scripts.MsoUtils
+import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
+import org.onap.so.bpmn.common.workflow.context.WorkflowContext
+import org.onap.so.bpmn.common.workflow.context.WorkflowContextHolder
+import org.onap.so.bpmn.core.WorkflowException
+import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.*
+
+class PNFSoftwareUpgrade extends AbstractServiceTaskProcessor {
+ private static final Logger logger = LoggerFactory.getLogger(PNFSoftwareUpgrade.class)
+
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+ String prefix = "PnfSwUpgrade_"
+
+ @Override
+ void preProcessRequest(DelegateExecution execution) {
+ }
+
+ void sendResponse(DelegateExecution execution) {
+ def requestId = execution.getVariable(REQUEST_ID)
+ def instanceId = execution.getVariable(PNF_CORRELATION_ID)
+ logger.debug("Send response for requestId: {}, instanceId: {}", requestId, instanceId)
+
+ String response = """{"requestReferences":{"requestId":"${requestId}", "instanceId":"${instanceId}"}}""".trim()
+ sendWorkflowResponse(execution, 200, response)
+ }
+
+ static WorkflowContext getWorkflowContext(DelegateExecution execution) {
+ String requestId = execution.getVariable(REQUEST_ID)
+ return WorkflowContextHolder.getInstance().getWorkflowContext(requestId)
+ }
+
+ void prepareCompletion(DelegateExecution execution) {
+ try {
+ String requestId = execution.getVariable(REQUEST_ID)
+ logger.debug("Prepare Completion of PNF Software Upgrade for requestId: {}", requestId)
+
+ String msoCompletionRequest =
+ """<aetgt:MsoCompletionRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
+ xmlns:ns="http://org.onap/so/request/types/v1">
+ <request-info xmlns="http://org.onap/so/infra/vnf-request/v1">
+ <request-id>${MsoUtils.xmlEscape(requestId)}</request-id>
+ <action>UPDATE</action>
+ <source>VID</source>
+ </request-info>
+ <aetgt:status-message>PNF has been upgraded successfully.</aetgt:status-message>
+ <aetgt:mso-bpel-name>PNF_SOFTWARE_UPGRADE</aetgt:mso-bpel-name>
+ </aetgt:MsoCompletionRequest>"""
+ String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest)
+
+ execution.setVariable(prefix + "CompleteMsoProcessRequest", xmlMsoCompletionRequest)
+
+ logger.debug("CompleteMsoProcessRequest of PNF Software Upgrade - " + "\n" + xmlMsoCompletionRequest)
+ } catch (Exception e) {
+ String msg = "Prepare Completion error for PNF software upgrade - " + e.getMessage()
+ logger.error(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ }
+ }
+
+ void prepareFalloutHandler(DelegateExecution execution) {
+ WorkflowContext workflowContext = getWorkflowContext(execution)
+ if (workflowContext == null) {
+ logger.debug("Error occurred before sending response to API handler, and send it now")
+ sendResponse(execution)
+ }
+
+ try {
+ String requestId = execution.getVariable(REQUEST_ID)
+ logger.debug("Prepare FalloutHandler of PNF Software Upgrade for requestId: {}", requestId)
+
+ WorkflowException workflowException = execution.getVariable("WorkflowException")
+ String errorCode = String.valueOf(workflowException.getErrorCode())
+ String errorMessage = workflowException.getErrorMessage()
+ String falloutHandlerRequest =
+ """<aetgt:FalloutHandlerRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
+ xmlns:ns="http://org.onap/so/request/types/v1">
+ <request-info xmlns="http://org.onap/so/infra/vnf-request/v1">
+ <request-id>${MsoUtils.xmlEscape(requestId)}</request-id>
+ <action>UPDATE</action>
+ <source>VID</source>
+ </request-info>
+ <aetgt:WorkflowException xmlns:aetgt="http://org.onap/so/workflow/schema/v1">
+ <aetgt:ErrorMessage>${MsoUtils.xmlEscape(errorMessage)}</aetgt:ErrorMessage>
+ <aetgt:ErrorCode>${MsoUtils.xmlEscape(errorCode)}</aetgt:ErrorCode>
+ </aetgt:WorkflowException>
+ </aetgt:FalloutHandlerRequest>"""
+ String xmlFalloutHandlerRequest = utils.formatXml(falloutHandlerRequest)
+
+ execution.setVariable(prefix + "FalloutHandlerRequest", xmlFalloutHandlerRequest)
+
+ logger.debug("FalloutHandlerRequest of PNF Software Upgrade - " + "\n" + xmlFalloutHandlerRequest)
+ } catch (Exception e) {
+ String msg = "Prepare FalloutHandler error for PNF software upgrade - " + e.getMessage()
+ logger.error(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ }
+ }
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceServiceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceServiceTest.groovy
index 6b7944cc6e..46f061d89c 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceServiceTest.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceServiceTest.groovy
@@ -159,4 +159,79 @@ class CreateSliceServiceTest extends MsoGroovyTest {
assertNotNull(values)
}
+ @Test
+ void testPrepareDecomposeService() {
+ when(mockExecution.getVariable("uuiRequest")).thenReturn(uuiRequest)
+ when(mockExecution.getVariable("serviceProfile")).thenReturn(serviceProfile)
+ CreateSliceService sliceService = new CreateSliceService()
+ sliceService.prepareDecomposeService(mockExecution)
+
+ String serviceModelInfoExcept = """{
+ "modelInvariantUuid":"123456",
+ "modelUuid":"123456",
+ "modelVersion":""
+ }"""
+ Mockito.verify(mockExecution, times(1)).setVariable(eq("ssServiceModelInfo"), captor.capture())
+ String serviceModelInfo = captor.getValue()
+ assertEquals(serviceModelInfoExcept.replaceAll("\\s+", ""),
+ serviceModelInfo.replaceAll("\\s+", ""))
+ }
+
+ @Test
+ void testProcessDecomposition() {
+ when(mockExecution.getVariable("uuiRequest")).thenReturn(uuiRequest)
+ when(mockExecution.getVariable("serviceProfile")).thenReturn(serviceProfile)
+ when(mockExecution.getVariable("nstSolution")).thenReturn(nstSolution)
+
+ CreateSliceService sliceService = new CreateSliceService()
+ sliceService.processDecomposition(mockExecution)
+
+ Mockito.verify(mockExecution, times(1)).setVariable(eq("subscriptionServiceType"), captor.capture())
+ assertEquals(captor.getValue(), "5G")
+ Mockito.verify(mockExecution, times(1)).setVariable(eq("serviceType"), captor.capture())
+ assertEquals(captor.getValue(), "embb")
+ Mockito.verify(mockExecution, times(1)).setVariable(eq("resourceSharingLevel"), captor.capture())
+ assertEquals(captor.getValue(), "shared")
+ Mockito.verify(mockExecution, times(1)).setVariable(eq("nstModelUuid"), captor.capture())
+ assertEquals(captor.getValue(), "aaaaaa")
+ Mockito.verify(mockExecution, times(1)).setVariable(eq("nstModelInvariantUuid"), captor.capture())
+ assertEquals(captor.getValue(), "bbbbbb")
+ }
+
+ @Test
+ void testPrepareCreateOrchestrationTask() {
+ when(mockExecution.getVariable("serviceInstanceId")).thenReturn("123456")
+ when(mockExecution.getVariable("serviceInstanceName")).thenReturn("test")
+ when(mockExecution.getVariable("serviceProfile")).thenReturn(serviceProfile)
+
+ CreateSliceService sliceService = new CreateSliceService()
+ sliceService.prepareCreateOrchestrationTask(mockExecution)
+
+ SliceTaskParams sliceTaskParamsExpect = new SliceTaskParams()
+ sliceTaskParamsExpect.setServiceId("123456")
+ sliceTaskParamsExpect.setServiceName("test")
+ sliceTaskParamsExpect.setServiceProfile(serviceProfile)
+ String paramJsonExpect = sliceTaskParamsExpect.convertToJson()
+
+ Mockito.verify(mockExecution, times(2)).setVariable(eq("subscriptionServiceType"), captor.capture())
+ List allValues = captor.getAllValues()
+ SliceTaskParams sliceTaskParams = allValues.get(0)
+ String paramJson = allValues.get(1)
+ assertEquals(sliceTaskParams.getServiceId(), sliceTaskParams.getServiceId())
+ assertEquals(sliceTaskParams.getServiceName(), sliceTaskParams.getServiceName())
+ assertEquals(sliceTaskParams.getServiceProfile(), sliceTaskParams.getServiceProfile())
+ assertEquals(paramJsonExpect, paramJson)
+ }
+
+ @Test
+ void testSendSyncResponse() {
+ when(mockExecution.getVariable("operationId")).thenReturn("123456")
+ when(mockExecution.getVariable("serviceInstanceId")).thenReturn("12345")
+ CreateSliceService sliceService = new CreateSliceService()
+ sliceService.sendSyncResponse(mockExecution)
+ Mockito.verify(mockExecution, times(1)).setVariable(eq("sentSyncResponse"), captor.capture())
+ def catchSyncResponse = captor.getValue()
+ assertEquals(catchSyncResponse, true)
+ }
+
}
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteVfModuleVolumeInfraV1.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteVfModuleVolumeInfraV1.bpmn
index b7ce608090..2e5d2e30b1 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteVfModuleVolumeInfraV1.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteVfModuleVolumeInfraV1.bpmn
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
+<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
<bpmn2:process id="DeleteVfModuleVolumeInfraV1" name="DeleteVfModuleVolumeInfraV1" isExecutable="true">
<bpmn2:scriptTask id="preProcessRequest_ScriptTask" name="PreProcess Incoming Request" scriptFormat="groovy">
<bpmn2:incoming>SequenceFlow_1</bpmn2:incoming>
@@ -51,13 +51,12 @@ deleteVfMod.executeMethod('prepareVnfAdapterDeleteRequest', execution, isDebugLo
<bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("DELVfModVol_tenantId") == execution.getVariable("DELVfModVol_volumeGroupTenantId")}]]></bpmn2:conditionExpression>
</bpmn2:sequenceFlow>
<bpmn2:sequenceFlow id="SequenceFlow_21" name="" sourceRef="ExclusiveGateway_3" targetRef="ScriptTask_2" />
- <bpmn2:callActivity id="callVnfAdapterDeleteSubflow_CallActivity" name="Call Vnf Adapter Delete subflow" calledElement="vnfAdapterRestV1">
+ <bpmn2:callActivity id="callVnfAdapterDeleteSubflow_CallActivity" name="Call Vnf Adapter Delete subflow" calledElement="vnfAdapterTask">
<bpmn2:extensionElements>
- <camunda:in source="DELVfModVol_deleteVnfARequest" target="vnfAdapterRestV1Request" />
- <camunda:out source="vnfAdapterRestV1Response" target="DELVfModVol_deleteVnfAResponse" />
+ <camunda:in source="DELVfModVol_deleteVnfARequest" target="vnfAdapterTaskRequest" />
+ <camunda:out source="WorkflowResponse" target="DELVfModVol_deleteVnfAResponse" />
<camunda:in source="mso-request-id" target="mso-request-id" />
<camunda:in source="mso-service-instance-id" target="mso-service-instance-id" />
- <camunda:in variables="all" />
<camunda:out source="WorkflowException" target="WorkflowException" />
<camunda:out source="VNFREST_SuccessIndicator" target="VNFREST_SuccessIndicator" />
</bpmn2:extensionElements>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/PNFSWUPDownload.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/PNFSWUPDownload.bpmn
index 24ca7104a7..5d523194bb 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/PNFSWUPDownload.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/PNFSWUPDownload.bpmn
@@ -1,15 +1,15 @@
<?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: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" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_0474hns" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.3.4">
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/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" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_0474hns" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.1.0">
<bpmn:process id="PNFSWUPDownload" name="PNFSWUPDownload" isExecutable="true">
<bpmn:startEvent id="download_StartEvent" name="Start Flow">
<bpmn:outgoing>SequenceFlow_1fdclh0</bpmn:outgoing>
</bpmn:startEvent>
<bpmn:serviceTask id="ServiceTask_1mpt2eq" name="NF Download Dispatcher" camunda:delegateExpression="${NfSoftwareUpgradeDispatcher}">
<bpmn:incoming>SequenceFlow_1fdclh0</bpmn:incoming>
- <bpmn:outgoing>SequenceFlow_12155q6</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_0kusy70</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:endEvent id="download_EndEvent" name="End">
- <bpmn:incoming>SequenceFlow_1d2rfyx</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_0mjjdia</bpmn:incoming>
<bpmn:terminateEventDefinition id="TerminateEventDefinition_1kiurmf" />
</bpmn:endEvent>
<bpmn:exclusiveGateway id="ExclusiveGateway_1ja7grm" default="SequenceFlow_078xmlz">
@@ -32,8 +32,8 @@
</bpmn:endEvent>
<bpmn:exclusiveGateway id="ExclusiveGateway_08lusga" default="SequenceFlow_1gawssm">
<bpmn:incoming>SequenceFlow_1kaikh5</bpmn:incoming>
- <bpmn:outgoing>SequenceFlow_1d2rfyx</bpmn:outgoing>
<bpmn:outgoing>SequenceFlow_1gawssm</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_1d2rfyx</bpmn:outgoing>
</bpmn:exclusiveGateway>
<bpmn:endEvent id="EndEvent_11hee4g">
<bpmn:incoming>SequenceFlow_1gawssm</bpmn:incoming>
@@ -73,10 +73,7 @@
<bpmn:outgoing>SequenceFlow_1ccldpp</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:sequenceFlow id="SequenceFlow_1fdclh0" sourceRef="download_StartEvent" targetRef="ServiceTask_1mpt2eq" />
- <bpmn:sequenceFlow id="SequenceFlow_12155q6" sourceRef="ServiceTask_1mpt2eq" targetRef="ServiceTask_1nl90ao" />
- <bpmn:sequenceFlow id="SequenceFlow_1d2rfyx" name="Success" sourceRef="ExclusiveGateway_08lusga" targetRef="download_EndEvent">
- <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("ControllerStatus").equals("Success")}</bpmn:conditionExpression>
- </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="SequenceFlow_12155q6" sourceRef="ScriptTask_1ankfw8" targetRef="ServiceTask_1nl90ao" />
<bpmn:sequenceFlow id="SequenceFlow_0o6b6a8" sourceRef="ServiceTask_0yavde3" targetRef="ExclusiveGateway_1ja7grm" />
<bpmn:sequenceFlow id="SequenceFlow_078xmlz" name="Failure" sourceRef="ExclusiveGateway_1ja7grm" targetRef="EndEvent_1j64ij1" />
<bpmn:sequenceFlow id="SequenceFlow_1ccldpp" sourceRef="ServiceTask_1nl90ao" targetRef="ExclusiveGateway_1rj84ne" />
@@ -89,113 +86,229 @@
<bpmn:sequenceFlow id="SequenceFlow_0qznt4u" name="Success" sourceRef="ExclusiveGateway_1ja7grm" targetRef="ServiceTask_1wxo7xz">
<bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("ControllerStatus").equals("Success")}</bpmn:conditionExpression>
</bpmn:sequenceFlow>
+ <bpmn:subProcess id="SubProcess_02e59i3" name="Subprocess for FalloutHandler" triggeredByEvent="true">
+ <bpmn:startEvent id="StartEvent_0uftj43" name="Catch All Errors">
+ <bpmn:outgoing>SequenceFlow_0swi04u</bpmn:outgoing>
+ <bpmn:errorEventDefinition id="ErrorEventDefinition_061iekb" />
+ </bpmn:startEvent>
+ <bpmn:scriptTask id="ScriptTask_1yzq4u7" name="Prepare FalloutHandler" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0swi04u</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1ppn4a8</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def pnfSwUpgrade = new PNFSoftwareUpgrade()
+pnfSwUpgrade.prepareFalloutHandler(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:callActivity id="CallActivity_0ikcgtm" name="Call FalloutHandler" calledElement="FalloutHandler">
+ <bpmn:extensionElements>
+ <camunda:in source="PnfSwUpgrade_FalloutHandlerRequest" target="FalloutHandlerRequest" />
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_1ppn4a8</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1ahmdun</bpmn:outgoing>
+ </bpmn:callActivity>
+ <bpmn:endEvent id="EndEvent_1xtb63b" name="End">
+ <bpmn:incoming>SequenceFlow_1ahmdun</bpmn:incoming>
+ <bpmn:terminateEventDefinition id="TerminateEventDefinition_1vngo0e" />
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_1ahmdun" sourceRef="CallActivity_0ikcgtm" targetRef="EndEvent_1xtb63b" />
+ <bpmn:sequenceFlow id="SequenceFlow_1ppn4a8" sourceRef="ScriptTask_1yzq4u7" targetRef="CallActivity_0ikcgtm" />
+ <bpmn:sequenceFlow id="SequenceFlow_0swi04u" sourceRef="StartEvent_0uftj43" targetRef="ScriptTask_1yzq4u7" />
+ </bpmn:subProcess>
+ <bpmn:scriptTask id="ScriptTask_1ankfw8" name="Send Response" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0kusy70</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_12155q6</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def pnfSwUpgrade = new PNFSoftwareUpgrade()
+pnfSwUpgrade.sendResponse(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_0kusy70" sourceRef="ServiceTask_1mpt2eq" targetRef="ScriptTask_1ankfw8" />
+ <bpmn:scriptTask id="ScriptTask_17f7m2t" name="Prepare Completion" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1d2rfyx</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_183s0wo</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def pnfSwUpgrade = new PNFSoftwareUpgrade()
+pnfSwUpgrade.prepareCompletion(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:callActivity id="CallActivity_0tq2dug" name="Complete Process" calledElement="CompleteMsoProcess">
+ <bpmn:extensionElements>
+ <camunda:in source="PnfSwUpgrade_CompleteMsoProcessRequest" target="CompleteMsoProcessRequest" />
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_183s0wo</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0mjjdia</bpmn:outgoing>
+ </bpmn:callActivity>
+ <bpmn:sequenceFlow id="SequenceFlow_183s0wo" sourceRef="ScriptTask_17f7m2t" targetRef="CallActivity_0tq2dug" />
+ <bpmn:sequenceFlow id="SequenceFlow_1d2rfyx" name="Success" sourceRef="ExclusiveGateway_08lusga" targetRef="ScriptTask_17f7m2t">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("ControllerStatus").equals("Success")}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="SequenceFlow_0mjjdia" sourceRef="CallActivity_0tq2dug" targetRef="download_EndEvent" />
</bpmn:process>
<bpmn:error id="Error_1q14dnd" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="PNFSWUPDownload">
<bpmndi:BPMNShape id="StartEvent_1k8gssq_di" bpmnElement="download_StartEvent">
- <dc:Bounds x="162" y="102" width="36" height="36" />
+ <dc:Bounds x="172" y="103" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="157" y="145" width="50" height="14" />
+ <dc:Bounds x="167" y="146" width="50" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ServiceTask_1mpt2eq_di" bpmnElement="ServiceTask_1mpt2eq">
- <dc:Bounds x="280" y="80" width="100" height="80" />
+ <dc:Bounds x="270" y="81" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="EndEvent_1e4dq7w_di" bpmnElement="download_EndEvent">
- <dc:Bounds x="1312" y="102" width="36" height="36" />
+ <dc:Bounds x="512" y="463" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1321" y="145" width="20" height="14" />
+ <dc:Bounds x="522" y="506" width="18" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ExclusiveGateway_1ja7grm_di" bpmnElement="ExclusiveGateway_1ja7grm" isMarkerVisible="true">
- <dc:Bounds x="895" y="95" width="50" height="50" />
+ <dc:Bounds x="615" y="235" width="50" height="50" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="EndEvent_1j64ij1_di" bpmnElement="EndEvent_1j64ij1">
- <dc:Bounds x="902" y="252" width="36" height="36" />
+ <dc:Bounds x="622" y="344" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ExclusiveGateway_1rj84ne_di" bpmnElement="ExclusiveGateway_1rj84ne" isMarkerVisible="true">
- <dc:Bounds x="635" y="95" width="50" height="50" />
+ <dc:Bounds x="355" y="235" width="50" height="50" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="EndEvent_1ubpef4_di" bpmnElement="EndEvent_1ubpef4">
- <dc:Bounds x="642" y="252" width="36" height="36" />
+ <dc:Bounds x="362" y="344" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ExclusiveGateway_08lusga_di" bpmnElement="ExclusiveGateway_08lusga" isMarkerVisible="true">
- <dc:Bounds x="1155" y="95" width="50" height="50" />
+ <dc:Bounds x="875" y="235" width="50" height="50" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="EndEvent_11hee4g_di" bpmnElement="EndEvent_11hee4g">
- <dc:Bounds x="1162" y="252" width="36" height="36" />
+ <dc:Bounds x="882" y="344" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ServiceTask_0yavde3_di" bpmnElement="ServiceTask_0yavde3">
- <dc:Bounds x="760" y="80" width="100" height="80" />
+ <dc:Bounds x="480" y="220" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ServiceTask_1wxo7xz_di" bpmnElement="ServiceTask_1wxo7xz">
- <dc:Bounds x="1000" y="80" width="100" height="80" />
+ <dc:Bounds x="720" y="220" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ServiceTask_1nl90ao_di" bpmnElement="ServiceTask_1nl90ao">
- <dc:Bounds x="480" y="80" width="100" height="80" />
+ <dc:Bounds x="200" y="220" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1fdclh0_di" bpmnElement="SequenceFlow_1fdclh0">
- <di:waypoint x="198" y="120" />
- <di:waypoint x="280" y="120" />
+ <di:waypoint x="208" y="121" />
+ <di:waypoint x="270" y="121" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_12155q6_di" bpmnElement="SequenceFlow_12155q6">
- <di:waypoint x="380" y="120" />
- <di:waypoint x="480" y="120" />
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_1d2rfyx_di" bpmnElement="SequenceFlow_1d2rfyx">
- <di:waypoint x="1205" y="120" />
- <di:waypoint x="1312" y="120" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="1214" y="102" width="43" height="14" />
- </bpmndi:BPMNLabel>
+ <di:waypoint x="540" y="121" />
+ <di:waypoint x="570" y="121" />
+ <di:waypoint x="570" y="190" />
+ <di:waypoint x="160" y="190" />
+ <di:waypoint x="160" y="260" />
+ <di:waypoint x="200" y="260" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0o6b6a8_di" bpmnElement="SequenceFlow_0o6b6a8">
- <di:waypoint x="860" y="120" />
- <di:waypoint x="895" y="120" />
+ <di:waypoint x="580" y="260" />
+ <di:waypoint x="615" y="260" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_078xmlz_di" bpmnElement="SequenceFlow_078xmlz">
- <di:waypoint x="920" y="145" />
- <di:waypoint x="920" y="252" />
+ <di:waypoint x="640" y="285" />
+ <di:waypoint x="640" y="344" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="918" y="217" width="34" height="14" />
+ <dc:Bounds x="650" y="291" width="32" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1ccldpp_di" bpmnElement="SequenceFlow_1ccldpp">
- <di:waypoint x="580" y="120" />
- <di:waypoint x="635" y="120" />
+ <di:waypoint x="300" y="260" />
+ <di:waypoint x="355" y="260" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0s6i4o9_di" bpmnElement="SequenceFlow_0s6i4o9">
- <di:waypoint x="685" y="120" />
- <di:waypoint x="760" y="120" />
+ <di:waypoint x="405" y="260" />
+ <di:waypoint x="480" y="260" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="678" y="102" width="43" height="14" />
+ <dc:Bounds x="398" y="242" width="43" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1tfbzn1_di" bpmnElement="SequenceFlow_1tfbzn1">
- <di:waypoint x="660" y="145" />
- <di:waypoint x="660" y="252" />
+ <di:waypoint x="380" y="285" />
+ <di:waypoint x="380" y="344" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="658" y="217" width="34" height="14" />
+ <dc:Bounds x="384" y="292" width="32" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1kaikh5_di" bpmnElement="SequenceFlow_1kaikh5">
- <di:waypoint x="1100" y="120" />
- <di:waypoint x="1155" y="120" />
+ <di:waypoint x="820" y="260" />
+ <di:waypoint x="875" y="260" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1gawssm_di" bpmnElement="SequenceFlow_1gawssm">
- <di:waypoint x="1180" y="145" />
- <di:waypoint x="1180" y="252" />
+ <di:waypoint x="900" y="285" />
+ <di:waypoint x="900" y="344" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1178" y="172" width="34" height="14" />
+ <dc:Bounds x="912" y="290" width="32" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0qznt4u_di" bpmnElement="SequenceFlow_0qznt4u">
- <di:waypoint x="945" y="120" />
- <di:waypoint x="1000" y="120" />
+ <di:waypoint x="665" y="260" />
+ <di:waypoint x="720" y="260" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="671" y="242" width="43" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="SubProcess_02e59i3_di" bpmnElement="SubProcess_02e59i3" isExpanded="true">
+ <dc:Bounds x="190" y="580" width="650" height="190" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="StartEvent_0uftj43_di" bpmnElement="StartEvent_0uftj43">
+ <dc:Bounds x="262" y="662" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="242" y="703" width="76" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_1yzq4u7_di" bpmnElement="ScriptTask_1yzq4u7">
+ <dc:Bounds x="360" y="640" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="CallActivity_0ikcgtm_di" bpmnElement="CallActivity_0ikcgtm">
+ <dc:Bounds x="530" y="640" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_1xtb63b_di" bpmnElement="EndEvent_1xtb63b">
+ <dc:Bounds x="702" y="662" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="951" y="102" width="43" height="14" />
+ <dc:Bounds x="712" y="705" width="18" height="14" />
</bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1ahmdun_di" bpmnElement="SequenceFlow_1ahmdun">
+ <di:waypoint x="630" y="680" />
+ <di:waypoint x="702" y="680" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1ppn4a8_di" bpmnElement="SequenceFlow_1ppn4a8">
+ <di:waypoint x="460" y="680" />
+ <di:waypoint x="530" y="680" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0swi04u_di" bpmnElement="SequenceFlow_0swi04u">
+ <di:waypoint x="298" y="680" />
+ <di:waypoint x="360" y="680" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_1ankfw8_di" bpmnElement="ScriptTask_1ankfw8">
+ <dc:Bounds x="440" y="81" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0kusy70_di" bpmnElement="SequenceFlow_0kusy70">
+ <di:waypoint x="370" y="121" />
+ <di:waypoint x="440" y="121" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_17f7m2t_di" bpmnElement="ScriptTask_17f7m2t">
+ <dc:Bounds x="202" y="441" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="CallActivity_0tq2dug_di" bpmnElement="CallActivity_0tq2dug">
+ <dc:Bounds x="355" y="441" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_183s0wo_di" bpmnElement="SequenceFlow_183s0wo">
+ <di:waypoint x="302" y="481" />
+ <di:waypoint x="355" y="481" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1d2rfyx_di" bpmnElement="SequenceFlow_1d2rfyx">
+ <di:waypoint x="925" y="260" />
+ <di:waypoint x="970" y="260" />
+ <di:waypoint x="970" y="410" />
+ <di:waypoint x="160" y="410" />
+ <di:waypoint x="160" y="481" />
+ <di:waypoint x="202" y="481" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="938" y="242" width="43" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0mjjdia_di" bpmnElement="SequenceFlow_0mjjdia">
+ <di:waypoint x="455" y="481" />
+ <di:waypoint x="512" y="481" />
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/PNFSoftwareUpgrade.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/PNFSoftwareUpgrade.bpmn
index 8d59dac8ac..4ff0af4549 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/PNFSoftwareUpgrade.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/PNFSoftwareUpgrade.bpmn
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1yd8m0g" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.3.4">
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1yd8m0g" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.1.0">
<bpmn:process id="PNFSoftwareUpgrade" name="PNFSoftwareUpgrade" isExecutable="true">
<bpmn:startEvent id="softwareUpgrade_startEvent" name="Start Flow">
<bpmn:outgoing>SequenceFlow_1ng4b6l</bpmn:outgoing>
@@ -8,9 +8,9 @@
<bpmn:incoming>SequenceFlow_1ng4b6l</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_12ejx4m</bpmn:outgoing>
</bpmn:serviceTask>
- <bpmn:sequenceFlow id="SequenceFlow_12ejx4m" sourceRef="ServiceTask_042uz7n" targetRef="ServiceTask_0slpahe" />
+ <bpmn:sequenceFlow id="SequenceFlow_12ejx4m" sourceRef="ServiceTask_042uz7n" targetRef="ScriptTask_10klpg8" />
<bpmn:endEvent id="softwareUpgrade_endEvent" name="End">
- <bpmn:incoming>SequenceFlow_1atiydu</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_0tle5zb</bpmn:incoming>
<bpmn:terminateEventDefinition />
</bpmn:endEvent>
<bpmn:sequenceFlow id="SequenceFlow_1ng4b6l" sourceRef="softwareUpgrade_startEvent" targetRef="ServiceTask_042uz7n" />
@@ -60,7 +60,7 @@
<bpmn:sequenceFlow id="SequenceFlow_1eljvek" name="Success" sourceRef="ExclusiveGateway_0v3l3wv" targetRef="ServiceTask_02lxf48">
<bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("ControllerStatus").equals("Success")}</bpmn:conditionExpression>
</bpmn:sequenceFlow>
- <bpmn:sequenceFlow id="SequenceFlow_1atiydu" name="Success" sourceRef="ExclusiveGateway_1ny9b1z" targetRef="softwareUpgrade_endEvent">
+ <bpmn:sequenceFlow id="SequenceFlow_1atiydu" name="Success" sourceRef="ExclusiveGateway_1ny9b1z" targetRef="ScriptTask_1igtc83">
<bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("ControllerStatus").equals("Success")}</bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:sequenceFlow id="SequenceFlow_0eiif6e" name="Success" sourceRef="ExclusiveGateway_0ch3fef" targetRef="ServiceTask_1jo8vn7">
@@ -110,7 +110,7 @@
<camunda:inputParameter name="mode">async</camunda:inputParameter>
</camunda:inputOutput>
</bpmn:extensionElements>
- <bpmn:incoming>SequenceFlow_12ejx4m</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_0ks3p41</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_0j26xlx</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:sequenceFlow id="SequenceFlow_0j26xlx" sourceRef="ServiceTask_0slpahe" targetRef="ExclusiveGateway_0x6h0ni" />
@@ -119,9 +119,59 @@
<bpmn:outgoing>SequenceFlow_084orr1</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:sequenceFlow id="SequenceFlow_084orr1" sourceRef="ServiceTask_1jo8vn7" targetRef="ServiceTask_0y2uysu" />
+ <bpmn:scriptTask id="ScriptTask_10klpg8" name="Send Response" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_12ejx4m</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0ks3p41</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def pnfSwUpgrade = new PNFSoftwareUpgrade()
+pnfSwUpgrade.sendResponse(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_0ks3p41" sourceRef="ScriptTask_10klpg8" targetRef="ServiceTask_0slpahe" />
+ <bpmn:scriptTask id="ScriptTask_1igtc83" name="Prepare Completion" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1atiydu</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0ipc3nt</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def pnfSwUpgrade = new PNFSoftwareUpgrade()
+pnfSwUpgrade.prepareCompletion(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_0ipc3nt" sourceRef="ScriptTask_1igtc83" targetRef="CallActivity_0o1mi8u" />
+ <bpmn:callActivity id="CallActivity_0o1mi8u" name="Complete Process" calledElement="CompleteMsoProcess">
+ <bpmn:extensionElements>
+ <camunda:in source="PnfSwUpgrade_CompleteMsoProcessRequest" target="CompleteMsoProcessRequest" />
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_0ipc3nt</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0tle5zb</bpmn:outgoing>
+ </bpmn:callActivity>
+ <bpmn:sequenceFlow id="SequenceFlow_0tle5zb" sourceRef="CallActivity_0o1mi8u" targetRef="softwareUpgrade_endEvent" />
+ <bpmn:subProcess id="SubProcess_02p6q4s" name="Subprocess for FalloutHandler" triggeredByEvent="true">
+ <bpmn:startEvent id="StartEvent_149ecdm" name="Catch All Errors">
+ <bpmn:outgoing>SequenceFlow_05haut5</bpmn:outgoing>
+ <bpmn:errorEventDefinition id="ErrorEventDefinition_1" />
+ </bpmn:startEvent>
+ <bpmn:scriptTask id="ScriptTask_0gov132" name="Prepare FalloutHandler" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_05haut5</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_09y0mpc</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def pnfSwUpgrade = new PNFSoftwareUpgrade()
+pnfSwUpgrade.prepareFalloutHandler(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:callActivity id="CallActivity_00psvtk" name="Call FalloutHandler" calledElement="FalloutHandler">
+ <bpmn:extensionElements>
+ <camunda:in source="PnfSwUpgrade_FalloutHandlerRequest" target="FalloutHandlerRequest" />
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_09y0mpc</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1tcjlty</bpmn:outgoing>
+ </bpmn:callActivity>
+ <bpmn:endEvent id="EndEvent_1vq2glg" name="End">
+ <bpmn:incoming>SequenceFlow_1tcjlty</bpmn:incoming>
+ <bpmn:terminateEventDefinition id="TerminateEventDefinition_0994ojb" />
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_05haut5" sourceRef="StartEvent_149ecdm" targetRef="ScriptTask_0gov132" />
+ <bpmn:sequenceFlow id="SequenceFlow_09y0mpc" sourceRef="ScriptTask_0gov132" targetRef="CallActivity_00psvtk" />
+ <bpmn:sequenceFlow id="SequenceFlow_1tcjlty" sourceRef="CallActivity_00psvtk" targetRef="EndEvent_1vq2glg" />
+ </bpmn:subProcess>
</bpmn:process>
<bpmn:error id="Error_12cpov5" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
- <bpmn:error id="Error_0nmskzh" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="PNFSoftwareUpgrade">
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="softwareUpgrade_startEvent">
@@ -131,142 +181,204 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ServiceTask_042uz7n_di" bpmnElement="ServiceTask_042uz7n">
- <dc:Bounds x="280" y="80" width="100" height="80" />
+ <dc:Bounds x="270" y="80" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_12ejx4m_di" bpmnElement="SequenceFlow_12ejx4m">
- <di:waypoint x="380" y="120" />
- <di:waypoint x="480" y="120" />
+ <di:waypoint x="370" y="120" />
+ <di:waypoint x="440" y="120" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="EndEvent_1w3jv30_di" bpmnElement="softwareUpgrade_endEvent">
- <dc:Bounds x="1662" y="102" width="36" height="36" />
+ <dc:Bounds x="532" y="462" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1671" y="145" width="20" height="14" />
+ <dc:Bounds x="542" y="505" width="18" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1ng4b6l_di" bpmnElement="SequenceFlow_1ng4b6l">
<di:waypoint x="198" y="120" />
- <di:waypoint x="280" y="120" />
+ <di:waypoint x="270" y="120" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ExclusiveGateway_0v3l3wv_di" bpmnElement="ExclusiveGateway_0v3l3wv" isMarkerVisible="true">
- <dc:Bounds x="895" y="95" width="50" height="50" />
+ <dc:Bounds x="615" y="235" width="50" height="50" />
<bpmndi:BPMNLabel>
<dc:Bounds x="1040" y="65" width="43" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="EndEvent_0bnbfds_di" bpmnElement="EndEvent_0bnbfds">
- <dc:Bounds x="902" y="252" width="36" height="36" />
+ <dc:Bounds x="622" y="342" width="36" height="36" />
<bpmndi:BPMNLabel>
<dc:Bounds x="1044" y="295" width="34" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ExclusiveGateway_0x6h0ni_di" bpmnElement="ExclusiveGateway_0x6h0ni" isMarkerVisible="true">
- <dc:Bounds x="635" y="95" width="50" height="50" />
+ <dc:Bounds x="355" y="235" width="50" height="50" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1nsmyr5_di" bpmnElement="SequenceFlow_1nsmyr5">
- <di:waypoint x="685" y="120" />
- <di:waypoint x="760" y="120" />
+ <di:waypoint x="405" y="260" />
+ <di:waypoint x="460" y="260" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="678" y="102" width="43" height="14" />
+ <dc:Bounds x="408" y="242" width="43" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="EndEvent_180lm4y_di" bpmnElement="EndEvent_180lm4y">
- <dc:Bounds x="642" y="252" width="36" height="36" />
+ <dc:Bounds x="362" y="342" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0piri91_di" bpmnElement="SequenceFlow_0piri91">
- <di:waypoint x="660" y="145" />
- <di:waypoint x="660" y="252" />
+ <di:waypoint x="380" y="285" />
+ <di:waypoint x="380" y="342" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="658" y="217" width="34" height="14" />
+ <dc:Bounds x="384" y="293" width="32" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1lr7vgu_di" bpmnElement="SequenceFlow_1lr7vgu">
- <di:waypoint x="920" y="145" />
- <di:waypoint x="920" y="252" />
+ <di:waypoint x="640" y="285" />
+ <di:waypoint x="640" y="342" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="918" y="217" width="34" height="14" />
+ <dc:Bounds x="644" y="293" width="32" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ExclusiveGateway_0ch3fef_di" bpmnElement="ExclusiveGateway_0ch3fef" isMarkerVisible="true">
- <dc:Bounds x="1125" y="95" width="50" height="50" />
+ <dc:Bounds x="845" y="235" width="50" height="50" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="EndEvent_1ms4wdz_di" bpmnElement="EndEvent_1ms4wdz">
- <dc:Bounds x="1132" y="252" width="36" height="36" />
+ <dc:Bounds x="852" y="342" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0dqnb6c_di" bpmnElement="SequenceFlow_0dqnb6c">
- <di:waypoint x="1150" y="145" />
- <di:waypoint x="1150" y="252" />
+ <di:waypoint x="870" y="285" />
+ <di:waypoint x="870" y="342" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1148" y="230" width="34" height="14" />
+ <dc:Bounds x="874" y="293" width="32" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ExclusiveGateway_1ny9b1z_di" bpmnElement="ExclusiveGateway_1ny9b1z" isMarkerVisible="true">
- <dc:Bounds x="1505" y="95" width="50" height="50" />
+ <dc:Bounds x="1225" y="235" width="50" height="50" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="EndEvent_0l6n6x5_di" bpmnElement="EndEvent_0l6n6x5">
- <dc:Bounds x="1512" y="252" width="36" height="36" />
+ <dc:Bounds x="1232" y="342" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1p0axph_di" bpmnElement="SequenceFlow_1p0axph">
- <di:waypoint x="1530" y="145" />
- <di:waypoint x="1530" y="252" />
+ <di:waypoint x="1250" y="285" />
+ <di:waypoint x="1250" y="342" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1528" y="172" width="34" height="14" />
+ <dc:Bounds x="1254" y="293" width="32" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1eljvek_di" bpmnElement="SequenceFlow_1eljvek">
- <di:waypoint x="945" y="120" />
- <di:waypoint x="1010" y="120" />
+ <di:waypoint x="665" y="260" />
+ <di:waypoint x="720" y="260" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="938" y="102" width="43" height="14" />
+ <dc:Bounds x="668" y="242" width="43" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1atiydu_di" bpmnElement="SequenceFlow_1atiydu">
- <di:waypoint x="1555" y="120" />
- <di:waypoint x="1662" y="120" />
+ <di:waypoint x="1275" y="260" />
+ <di:waypoint x="1320" y="260" />
+ <di:waypoint x="1320" y="410" />
+ <di:waypoint x="180" y="410" />
+ <di:waypoint x="180" y="480" />
+ <di:waypoint x="220" y="480" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1564" y="102" width="43" height="14" />
+ <dc:Bounds x="1277" y="242" width="43" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0eiif6e_di" bpmnElement="SequenceFlow_0eiif6e">
- <di:waypoint x="1175" y="120" />
- <di:waypoint x="1210" y="120" />
+ <di:waypoint x="895" y="260" />
+ <di:waypoint x="950" y="260" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1169" y="102" width="43" height="14" />
+ <dc:Bounds x="898" y="242" width="43" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ServiceTask_0x5cje8_di" bpmnElement="ServiceTask_0x5cje8">
- <dc:Bounds x="760" y="80" width="100" height="80" />
+ <dc:Bounds x="460" y="220" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0cchgih_di" bpmnElement="SequenceFlow_0cchgih">
- <di:waypoint x="860" y="120" />
- <di:waypoint x="895" y="120" />
+ <di:waypoint x="560" y="260" />
+ <di:waypoint x="615" y="260" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ServiceTask_02lxf48_di" bpmnElement="ServiceTask_02lxf48">
- <dc:Bounds x="1010" y="80" width="100" height="80" />
+ <dc:Bounds x="720" y="220" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_015y785_di" bpmnElement="SequenceFlow_015y785">
- <di:waypoint x="1110" y="120" />
- <di:waypoint x="1125" y="120" />
+ <di:waypoint x="820" y="260" />
+ <di:waypoint x="845" y="260" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ServiceTask_0y2uysu_di" bpmnElement="ServiceTask_0y2uysu">
- <dc:Bounds x="1370" y="80" width="100" height="80" />
+ <dc:Bounds x="1090" y="220" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0g3qcd0_di" bpmnElement="SequenceFlow_0g3qcd0">
- <di:waypoint x="1470" y="120" />
- <di:waypoint x="1505" y="120" />
+ <di:waypoint x="1190" y="260" />
+ <di:waypoint x="1225" y="260" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ServiceTask_0slpahe_di" bpmnElement="ServiceTask_0slpahe">
- <dc:Bounds x="480" y="80" width="100" height="80" />
+ <dc:Bounds x="220" y="220" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0j26xlx_di" bpmnElement="SequenceFlow_0j26xlx">
- <di:waypoint x="580" y="120" />
- <di:waypoint x="635" y="120" />
+ <di:waypoint x="320" y="260" />
+ <di:waypoint x="355" y="260" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ServiceTask_1jo8vn7_di" bpmnElement="ServiceTask_1jo8vn7">
- <dc:Bounds x="1210" y="80" width="100" height="80" />
+ <dc:Bounds x="950" y="220" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_084orr1_di" bpmnElement="SequenceFlow_084orr1">
- <di:waypoint x="1310" y="120" />
- <di:waypoint x="1370" y="120" />
+ <di:waypoint x="1050" y="260" />
+ <di:waypoint x="1090" y="260" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_10klpg8_di" bpmnElement="ScriptTask_10klpg8">
+ <dc:Bounds x="440" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0ks3p41_di" bpmnElement="SequenceFlow_0ks3p41">
+ <di:waypoint x="540" y="120" />
+ <di:waypoint x="570" y="120" />
+ <di:waypoint x="570" y="190" />
+ <di:waypoint x="180" y="190" />
+ <di:waypoint x="180" y="260" />
+ <di:waypoint x="220" y="260" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_1igtc83_di" bpmnElement="ScriptTask_1igtc83">
+ <dc:Bounds x="220" y="440" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0ipc3nt_di" bpmnElement="SequenceFlow_0ipc3nt">
+ <di:waypoint x="320" y="480" />
+ <di:waypoint x="380" y="480" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="CallActivity_0o1mi8u_di" bpmnElement="CallActivity_0o1mi8u">
+ <dc:Bounds x="380" y="440" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0tle5zb_di" bpmnElement="SequenceFlow_0tle5zb">
+ <di:waypoint x="480" y="480" />
+ <di:waypoint x="532" y="480" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_0gov132_di" bpmnElement="ScriptTask_0gov132">
+ <dc:Bounds x="540" y="630" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="CallActivity_00psvtk_di" bpmnElement="CallActivity_00psvtk">
+ <dc:Bounds x="710" y="630" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_1vq2glg_di" bpmnElement="EndEvent_1vq2glg">
+ <dc:Bounds x="882" y="652" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="892" y="695" width="18" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_09y0mpc_di" bpmnElement="SequenceFlow_09y0mpc">
+ <di:waypoint x="640" y="670" />
+ <di:waypoint x="710" y="670" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1tcjlty_di" bpmnElement="SequenceFlow_1tcjlty">
+ <di:waypoint x="810" y="670" />
+ <di:waypoint x="882" y="670" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="StartEvent_1r4h504_di" bpmnElement="StartEvent_149ecdm">
+ <dc:Bounds x="442" y="652" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="422" y="693" width="76" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="SubProcess_02p6q4s_di" bpmnElement="SubProcess_02p6q4s" isExpanded="true">
+ <dc:Bounds x="370" y="570" width="650" height="190" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_05haut5_di" bpmnElement="SequenceFlow_05haut5">
+ <di:waypoint x="478" y="670" />
+ <di:waypoint x="540" y="670" />
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/UpdateVfModuleVolumeInfraV1.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/UpdateVfModuleVolumeInfraV1.bpmn
index 078d72a1d8..ce346e13b3 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/UpdateVfModuleVolumeInfraV1.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/UpdateVfModuleVolumeInfraV1.bpmn
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_ZBLUcCkQEeaY6ZhIaNLwzg" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
+<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_ZBLUcCkQEeaY6ZhIaNLwzg" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
<bpmn2:process id="UpdateVfModuleVolumeInfraV1" name="UpdateVfModuleVolumeInfraV1" isExecutable="true">
<bpmn2:endEvent id="EndEvent_4" name="TheEnd">
<bpmn2:incoming>SequenceFlow_1</bpmn2:incoming>
@@ -56,14 +56,13 @@ def uvmv = new UpdateVfModuleVolumeInfraV1()
uvmv.executeMethod('prepCompletionHandlerRequest', execution, UPDVfModVol_requestId, 'UPDATE', UPDVfModVol_source, isDebugLogEnabled)]]></bpmn2:script>
</bpmn2:scriptTask>
<bpmn2:sequenceFlow id="SequenceFlow_13" name="" sourceRef="ScriptTask_prepCompletionHandlerRequest" targetRef="CallActivity_completionHandler" />
- <bpmn2:callActivity id="CallActivity_callVNFAdapterRest" name="VNFAdapterRest" calledElement="vnfAdapterRestV1">
+ <bpmn2:callActivity id="CallActivity_callVNFAdapterRest" name="VNFAdapterRest" calledElement="vnfAdapterTask">
<bpmn2:extensionElements>
- <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" />
<camunda:in source="mso-request-id" target="mso-request-id" />
- <camunda:out source="vnfAdapterRestV1Response" target="UPDVfModVol_vnfAdapterRestResponse" />
+ <camunda:out source="WorkflowResponse" target="UPDVfModVol_vnfAdapterRestResponse" />
<camunda:out source="WorkflowException" target="WorkflowException" />
<camunda:in source="mso-service-instance-id" target="mso-service-instance-id" />
- <camunda:in source="UPDVfModVol_vnfAdapterRestRequest" target="vnfAdapterRestV1Request" />
+ <camunda:in source="UPDVfModVol_vnfAdapterRestRequest" target="vnfAdapterTaskRequest" />
</bpmn2:extensionElements>
<bpmn2:incoming>SequenceFlow_21</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_19</bpmn2:outgoing>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVfModule.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVfModule.bpmn
index c16061edb2..0d1b970c62 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVfModule.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVfModule.bpmn
@@ -224,10 +224,10 @@ doCreateVfModule.prepareCreateAAIVfModuleVolumeGroupRequest(execution)]]></bpmn2
def doCreateVfModule = new DoCreateVfModule()
doCreateVfModule.preProcessVNFAdapterRequest(execution)]]></bpmn2:script>
</bpmn2:scriptTask>
- <bpmn2:callActivity id="CallVNFAdapterVFModuleCreate" name="Call VNF Adapter to create VF Module" calledElement="vnfAdapterRestV1">
+ <bpmn2:callActivity id="CallVNFAdapterVFModuleCreate" name="Call VNF Adapter to create VF Module" calledElement="vnfAdapterTask">
<bpmn2:extensionElements>
- <camunda:in source="DCVFM_createVnfARequest" target="vnfAdapterRestV1Request" />
- <camunda:out source="vnfAdapterRestV1Response" target="DCVFM_createVnfAResponse" />
+ <camunda:in source="DCVFM_createVnfARequest" target="vnfAdapterTaskRequest" />
+ <camunda:out source="WorkflowResponse" target="DCVFM_createVnfAResponse" />
<camunda:in source="mso-request-id" target="mso-request-id" />
<camunda:in source="mso-service-instance-id" target="mso-service-instance-id" />
<camunda:in variables="all" />
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVfModuleRollback.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVfModuleRollback.bpmn
index 2508b31f01..e9675b89f8 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVfModuleRollback.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVfModuleRollback.bpmn
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_Wblj8GyfEeWUWLTvug7ZOg" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
+<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_Wblj8GyfEeWUWLTvug7ZOg" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
<bpmn2:process id="DoCreateVfModuleRollback" name="DoCreateVfModuleRollback" isExecutable="true">
<bpmn2:startEvent id="StartEvent_1">
<bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing>
@@ -38,13 +38,12 @@
def dcvfmr = new DoCreateVfModuleRollback()
dcvfmr.prepVNFAdapterRequest(execution)]]></bpmn2:script>
</bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_16" name="" sourceRef="VNFAdapterPrep" targetRef="InvokeVNFAdapterRestV1" />
- <bpmn2:callActivity id="InvokeVNFAdapterRestV1" name="Invoke&#10;VNFAdapterRestV1" calledElement="vnfAdapterRestV1">
+ <bpmn2:sequenceFlow id="SequenceFlow_16" name="" sourceRef="VNFAdapterPrep" targetRef="InvokeVNFAdapter" />
+ <bpmn2:callActivity id="InvokeVNFAdapter" name="Invoke&#10;VNFAdapterTask" calledElement="vnfAdapterTask">
<bpmn2:extensionElements>
<camunda:out source="WorkflowException" target="WorkflowException" />
- <camunda:in source="vnfAdapterRestV1Request" target="vnfAdapterRestV1Request" />
- <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" />
- <camunda:out source="vnfAdapterRestV1Response" target="DoDVfMod_DoCreateVfModuleRollbackResponse" />
+ <camunda:in source="vnfAdapterTaskRequest" target="vnfAdapterTaskRequest" />
+ <camunda:out source="WorkflowResponse" target="DoDVfMod_DoCreateVfModuleRollbackResponse" />
<camunda:in source="mso-request-id" target="mso-request-id" />
<camunda:in source="mso-service-instance-id" target="mso-service-instance-id" />
</bpmn2:extensionElements>
@@ -375,7 +374,7 @@ dcvfmr.setSuccessfulRollbackStatus(execution)]]></bpmn2:script>
def dcvfmr = new DoCreateVfModuleRollback()
dcvfmr.prepUpdateAAIVfModuleToAssigned(execution)]]></bpmn2:script>
</bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_08aruzz" sourceRef="InvokeVNFAdapterRestV1" targetRef="ExclusiveGateway_0ahc44p" />
+ <bpmn2:sequenceFlow id="SequenceFlow_08aruzz" sourceRef="InvokeVNFAdapter" targetRef="ExclusiveGateway_0ahc44p" />
</bpmn2:process>
<bpmn2:error id="Error_1" name="MSO Workflow Exception" errorCode="MSOWorkflowException" />
<bpmn2:message id="Message_1" name="DoCreateVfModuleRollbackRequest" />
@@ -403,7 +402,7 @@ dcvfmr.prepUpdateAAIVfModuleToAssigned(execution)]]></bpmn2:script>
<bpmndi:BPMNShape id="_BPMNShape_ScriptTask_170" bpmnElement="VNFAdapterPrep">
<dc:Bounds x="104" y="763" width="100" height="80" />
</bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_CallActivity_13" bpmnElement="InvokeVNFAdapterRestV1">
+ <bpmndi:BPMNShape id="_BPMNShape_CallActivity_13" bpmnElement="InvokeVNFAdapter">
<dc:Bounds x="262" y="763" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_16" bpmnElement="SequenceFlow_16" sourceElement="_BPMNShape_ScriptTask_170" targetElement="_BPMNShape_CallActivity_13">
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVfModuleVolumeRollback.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVfModuleVolumeRollback.bpmn
index a762b7ecd7..6f3dceda84 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVfModuleVolumeRollback.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVfModuleVolumeRollback.bpmn
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0">
+<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:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0">
<bpmn:process id="DoCreateVfModuleVolumeRollback" name="DoCreateVfModuleVolumeRollback" isExecutable="true">
<bpmn:subProcess id="SubProcess_1p4663w" name="Sub-process for UnexpectedErrors" triggeredByEvent="true">
<bpmn:scriptTask id="ScriptTask_0by1uwk" name="Log / Print Unexpected Error" scriptFormat="groovy">
@@ -33,10 +33,9 @@ doCreateVfModuleVolumeRollback.processJavaException(execution)]]></bpmn:script>
<bpmn:outgoing>SequenceFlow_0h7k68j</bpmn:outgoing>
<bpmn:outgoing>SequenceFlow_10dawse</bpmn:outgoing>
</bpmn:exclusiveGateway>
- <bpmn:callActivity id="CallActivity_03pmk7v" name="Call VNF Adapter Rollback" calledElement="vnfAdapterRestV1">
+ <bpmn:callActivity id="CallActivity_03pmk7v" name="Call VNF Adapter Rollback" calledElement="vnfAdapterTask">
<bpmn:extensionElements>
- <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" />
- <camunda:in source="DCVFMODVOLRBK_rollbackVnfARequest" target="vnfAdapterRestV1Request" />
+ <camunda:in source="DCVFMODVOLRBK_rollbackVnfARequest" target="vnfAdapterTaskRequest" />
<camunda:out source="workflowException" target="workflowException" />
<camunda:in source="mso-request-id" target="mso-request-id" />
<camunda:in source="mso-service-instance-id" target="mso-service-instance-id" />
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVfModuleVolumeV2.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVfModuleVolumeV2.bpmn
index 26a4112d59..58ea0c4951 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVfModuleVolumeV2.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVfModuleVolumeV2.bpmn
@@ -63,15 +63,14 @@ def doCreateVfModuleVolumeV2 = new DoCreateVfModuleVolumeV2()
doCreateVfModuleVolumeV2.executeMethod('callRESTCreateAAIVolGrpName', execution, isDebugLogEnabled)]]></bpmn2:script>
</bpmn2:scriptTask>
<bpmn2:sequenceFlow id="SequenceFlow_9" name="" sourceRef="ScriptTask_callRestAaiCreateVolumeGrp" targetRef="ScriptTask_prepareVnfAdapterCreate" />
- <bpmn2:callActivity id="CallActivity_callVnfAdapterCreate" name="Call VNF Adapter Create" calledElement="vnfAdapterRestV1">
+ <bpmn2:callActivity id="CallActivity_callVnfAdapterCreate" name="Call VNF Adapter Create" calledElement="vnfAdapterTask">
<bpmn2:extensionElements>
- <camunda:in source="DCVFMODVOLV2_createVnfARequest" target="vnfAdapterRestV1Request" />
+ <camunda:in source="DCVFMODVOLV2_createVnfARequest" target="vnfAdapterTaskRequest" />
<camunda:in source="msoRequestId" target="mso-request-id" />
<camunda:in source="serviceInstanceId" target="mso-service-instance-id" />
- <camunda:out source="vnfAdapterRestV1Response" target="DCVFMODVOLV2_createVnfAResponse" />
+ <camunda:out source="WorkflowResponse" target="DCVFMODVOLV2_createVnfAResponse" />
<camunda:out source="WorkflowException" target="WorkflowException" />
<camunda:out source="VNFREST_vnfAdapterStatusCode" target="DCVFMODVOLV2_createVnfAReturnCode" />
- <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" />
<camunda:out source="VNFREST_SuccessIndicator" target="VNFREST_SuccessIndicator" />
</bpmn2:extensionElements>
<bpmn2:incoming>SequenceFlow_10</bpmn2:incoming>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn
index 1149cc9ea9..85fe3b4b29 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.1.0">
+<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="3.4.1">
<bpmn:process id="DoDeleteE2EServiceInstance" name="All Resources Deleted" isExecutable="true">
<bpmn:startEvent id="StartEvent_0212h2r" name="Start Flow">
<bpmn:outgoing>SequenceFlow_0vz7cd9</bpmn:outgoing>
@@ -131,6 +131,7 @@ dcsi.postDecomposeService(execution)</bpmn:script>
<camunda:in source="operationType" target="operationType" />
<camunda:in source="operationId" target="operationId" />
<camunda:in source="serviceDecomposition" target="serviceDecomposition" />
+ <camunda:in source="serviceInstanceName" target="serviceInstanceName" />
</bpmn:extensionElements>
<bpmn:incoming>SequenceFlow_1j08ko3</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_1cevtpy</bpmn:outgoing>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteVfModule.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteVfModule.bpmn
index 848796c0b6..6026fc84b3 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteVfModule.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteVfModule.bpmn
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_Wblj8GyfEeWUWLTvug7ZOg" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
+<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_Wblj8GyfEeWUWLTvug7ZOg" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
<bpmn2:process id="DoDeleteVfModule" name="DoDeleteVfModule" isExecutable="true">
<bpmn2:scriptTask id="UpdateAAIVfModulePrep" name="UpdateAAIVfModule &#10;Prep" scriptFormat="groovy">
<bpmn2:incoming>SequenceFlow_0fp1wqz</bpmn2:incoming>
@@ -30,7 +30,7 @@ dvm.prepUpdateAAIVfModule(execution)]]></bpmn2:script>
<bpmn2:incoming>SequenceFlow_029ioyr</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_14xn858</bpmn2:outgoing>
</bpmn2:callActivity>
- <bpmn2:sequenceFlow id="SequenceFlow_4" name="" sourceRef="VNFAdapterPrep" targetRef="InvokeVNFAdapterRestV1" />
+ <bpmn2:sequenceFlow id="SequenceFlow_4" name="" sourceRef="VNFAdapterPrep" targetRef="InvokeVNFAdapterTask" />
<bpmn2:callActivity id="InvokeSDNCAdapterV1_2" name="Invoke &#10;SDNCAdapterV1" calledElement="sdncAdapter">
<bpmn2:extensionElements>
<camunda:out source="WorkflowException" target="WorkflowException" />
@@ -60,12 +60,11 @@ def dvm = new DoDeleteVfModule()
dvm.prepSDNCAdapterRequest(execution, "delete")]]></bpmn2:script>
</bpmn2:scriptTask>
<bpmn2:sequenceFlow id="SequenceFlow_32" name="" sourceRef="SDNCAdapterPrep2" targetRef="InvokeSDNCAdapterV1_2" />
- <bpmn2:callActivity id="InvokeVNFAdapterRestV1" name="Invoke &#10;VNFAdapterRestV1" calledElement="vnfAdapterRestV1">
+ <bpmn2:callActivity id="InvokeVNFAdapterTask" name="Invoke&#10;VNFAdapterTask" calledElement="vnfAdapterTask">
<bpmn2:extensionElements>
<camunda:out source="WorkflowException" target="WorkflowException" />
- <camunda:in source="vnfAdapterRestV1Request" target="vnfAdapterRestV1Request" />
- <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" />
- <camunda:out source="vnfAdapterRestV1Response" target="DoDVfMod_doDeleteVfModuleResponse" />
+ <camunda:in source="vnfAdapterTaskRequest" target="vnfAdapterTaskRequest" />
+ <camunda:out source="WorkflowResponse" target="DoDVfMod_doDeleteVfModuleResponse" />
<camunda:in source="mso-request-id" target="mso-request-id" />
<camunda:in source="mso-service-instance-id" target="mso-service-instance-id" />
</bpmn2:extensionElements>
@@ -182,7 +181,7 @@ doDeleteVfModule.prepUpdateAAIGenericVnf(execution)]]></bpmn2:script>
def dvm = new DoDeleteVfModule()
dvm.queryAAIVfModuleForStatus(execution)]]></bpmn2:script>
</bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_1xruki1" sourceRef="InvokeVNFAdapterRestV1" targetRef="PostProcessVNFAdapterRequest" />
+ <bpmn2:sequenceFlow id="SequenceFlow_1xruki1" sourceRef="InvokeVNFAdapterTask" targetRef="PostProcessVNFAdapterRequest" />
<bpmn2:sequenceFlow id="SequenceFlow_14xn858" sourceRef="InvokePrepareUpdateAAIVfModule" targetRef="VNFAdapterPrep" />
</bpmn2:process>
<bpmn2:error id="Error_1" name="MSO Workflow Exception" errorCode="MSOWorkflowException" />
@@ -221,7 +220,7 @@ dvm.queryAAIVfModuleForStatus(execution)]]></bpmn2:script>
<bpmndi:BPMNShape id="_BPMNShape_ScriptTask_170" bpmnElement="VNFAdapterPrep">
<dc:Bounds x="193" y="206" width="100" height="80" />
</bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_CallActivity_13" bpmnElement="InvokeVNFAdapterRestV1">
+ <bpmndi:BPMNShape id="_BPMNShape_CallActivity_13" bpmnElement="InvokeVNFAdapterTask">
<dc:Bounds x="404" y="206" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_ScriptTask_171" bpmnElement="UpdateAAIVfModulePrep">
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteVfModuleFromVnf.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteVfModuleFromVnf.bpmn
index b7a1373fe9..918964f8f8 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteVfModuleFromVnf.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteVfModuleFromVnf.bpmn
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
-<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_Wblj8GyfEeWUWLTvug7ZOg" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
+<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_Wblj8GyfEeWUWLTvug7ZOg" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
<bpmn2:process id="DoDeleteVfModuleFromVnf" name="DoDeleteVfModuleFromVnf" isExecutable="true">
- <bpmn2:sequenceFlow id="SequenceFlow_4" name="" sourceRef="VNFAdapterPrep" targetRef="InvokeVNFAdapterRestV1" />
+ <bpmn2:sequenceFlow id="SequenceFlow_4" name="" sourceRef="VNFAdapterPrep" targetRef="InvokeVNFAdapter" />
<bpmn2:callActivity id="callSDNCAdapterTopologyUnassign" name="Call SDNC Adapter Topology Unassign" calledElement="sdncAdapter">
<bpmn2:extensionElements>
<camunda:out source="WorkflowException" target="WorkflowException" />
@@ -31,12 +31,11 @@ def ddvmfv = new DoDeleteVfModuleFromVnf()
ddvmfv.preProcessSDNCUnassignRequest(execution)]]></bpmn2:script>
</bpmn2:scriptTask>
<bpmn2:sequenceFlow id="SequenceFlow_32" name="" sourceRef="SDNCAdapterPrep2" targetRef="callSDNCAdapterTopologyUnassign" />
- <bpmn2:callActivity id="InvokeVNFAdapterRestV1" name="Invoke &#10;&#10;VNFAdapterRestV1" calledElement="vnfAdapterRestV1">
+ <bpmn2:callActivity id="InvokeVNFAdapter" name="Invoke&#10;&#10;VNFAdapter" calledElement="vnfAdapterTask">
<bpmn2:extensionElements>
<camunda:out source="WorkflowException" target="WorkflowException" />
- <camunda:in source="vnfAdapterRestV1Request" target="vnfAdapterRestV1Request" />
- <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" />
- <camunda:out source="vnfAdapterRestV1Response" target="DDVMFV_doDeleteVfModuleResponse" />
+ <camunda:in source="vnfAdapterTaskRequest" target="vnfAdapterTaskRequest" />
+ <camunda:out source="WorkflowResponse" target="DDVMFV_doDeleteVfModuleResponse" />
<camunda:in source="mso-request-id" target="mso-request-id" />
<camunda:in source="mso-service-instance-id" target="mso-service-instance-id" />
</bpmn2:extensionElements>
@@ -83,7 +82,7 @@ ddvmfv.postProcessVNFAdapterRequest(execution)]]></bpmn2:script>
</bpmn2:startEvent>
<bpmn2:sequenceFlow id="SequenceFlow_0y4td40" sourceRef="preProcessSDNCDeactivateRequest" targetRef="callSDNCAdapterTopologyDeactivate" />
<bpmn2:sequenceFlow id="SequenceFlow_12q2r4i" sourceRef="callSDNCAdapterTopologyDeactivate" targetRef="postProcessSDNCDeactivateRequest" />
- <bpmn2:sequenceFlow id="SequenceFlow_0hia88a" sourceRef="InvokeVNFAdapterRestV1" targetRef="PostProcessVNFAdapterRequest" />
+ <bpmn2:sequenceFlow id="SequenceFlow_0hia88a" sourceRef="InvokeVNFAdapter" targetRef="PostProcessVNFAdapterRequest" />
<bpmn2:sequenceFlow id="SequenceFlow_0kx9e3s" sourceRef="postProcessSDNCDeactivateRequest" targetRef="VNFAdapterPrep" />
<bpmn2:sequenceFlow id="SequenceFlow_0ltm4jt" sourceRef="DeleteNetworkPoliciesFromAAI" targetRef="SDNCAdapterPrep2" />
<bpmn2:scriptTask id="preProcessSDNCDeactivateRequest" name="PreProcess SDNC Deactivate Request" scriptFormat="groovy">
@@ -187,7 +186,7 @@ ddvmfv.prepDeleteAAIVfModule(execution)]]></bpmn2:script>
<bpmndi:BPMNShape id="_BPMNShape_ScriptTask_170" bpmnElement="VNFAdapterPrep">
<dc:Bounds x="125" y="330" width="100" height="80" />
</bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_CallActivity_13" bpmnElement="InvokeVNFAdapterRestV1">
+ <bpmndi:BPMNShape id="_BPMNShape_CallActivity_13" bpmnElement="InvokeVNFAdapter">
<dc:Bounds x="281" y="330" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_ScriptTask_172" bpmnElement="SDNCAdapterPrep2">
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteVfModuleVolumeV2.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteVfModuleVolumeV2.bpmn
index 4409f2a0dc..e7706c20e6 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteVfModuleVolumeV2.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteVfModuleVolumeV2.bpmn
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0">
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0">
<bpmn:process id="DoDeleteVfModuleVolumeV2" name="DoDeleteVfModuleVolumeV2" isExecutable="true">
<bpmn:startEvent id="StartEvent_1" name="Start">
<bpmn:outgoing>SequenceFlow_1gvfdp4</bpmn:outgoing>
@@ -25,21 +25,20 @@ deleteVfMod.executeMethod('callRESTQueryAAIForVolumeGroup', execution, isDebugLo
def deleteVfMod = new DoDeleteVfModuleVolumeV2()
deleteVfMod.executeMethod('prepareVnfAdapterDeleteRequest', execution, isDebugLogEnabled)]]></bpmn:script>
</bpmn:scriptTask>
- <bpmn:callActivity id="Task_14fsstq" name="Call REST VNF Adapter Delete" calledElement="vnfAdapterRestV1">
+ <bpmn:callActivity id="Task_14fsstq" name="Call REST VNF Adapter Delete" calledElement="vnfAdapterTask">
<bpmn:extensionElements>
- <camunda:in source="DDVMV_deleteVnfARequest" target="vnfAdapterRestV1Request" />
+ <camunda:in source="DDVMV_deleteVnfARequest" target="vnfAdapterTaskRequest" />
<camunda:in source="mso-request-id" target="mso-request-id" />
<camunda:in source="mso-service-instance-id" target="mso-service-instance-id" />
- <camunda:in variables="all" />
- <camunda:out source="vnfAdapterRestV1Response" target="DDVMV_deleteVnfAResponse" />
+ <camunda:out source="WorkflowResponse" target="DDVMV_deleteVnfAResponse" />
<camunda:out source="WorkflowException" target="WorkflowException" />
<camunda:out source="VNFREST_SuccessIndicator" target="VNFREST_SuccessIndicator" />
</bpmn:extensionElements>
<bpmn:incoming>SequenceFlow_1tgngf7</bpmn:incoming>
- <bpmn:outgoing>SequenceFlow_1x3luyj</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_04zsr0f</bpmn:outgoing>
</bpmn:callActivity>
<bpmn:scriptTask id="Task_17q1roq" name="Call REST AAI Delete Volume Group" scriptFormat="groovy">
- <bpmn:incoming>SequenceFlow_0cy0y9t</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_04zsr0f</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_13c3cv2</bpmn:outgoing>
<bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.*
def deleteVfMod = new DoDeleteVfModuleVolumeV2()
@@ -61,20 +60,6 @@ deleteVfMod.executeMethod('preProcessRequest', execution, isDebugLogEnabled)
</bpmn:scriptTask>
<bpmn:sequenceFlow id="SequenceFlow_1gvfdp4" sourceRef="StartEvent_1" targetRef="Task_1i432ud" />
<bpmn:sequenceFlow id="SequenceFlow_1vy2ojp" sourceRef="Task_1i432ud" targetRef="Task_06u1lr0" />
- <bpmn:exclusiveGateway id="ExclusiveGateway_0o3lxtf" name="VNF Adapter REST call success?">
- <bpmn:incoming>SequenceFlow_1x3luyj</bpmn:incoming>
- <bpmn:outgoing>SequenceFlow_0cy0y9t</bpmn:outgoing>
- <bpmn:outgoing>SequenceFlow_1rgd8dg</bpmn:outgoing>
- </bpmn:exclusiveGateway>
- <bpmn:sequenceFlow id="SequenceFlow_1x3luyj" sourceRef="Task_14fsstq" targetRef="ExclusiveGateway_0o3lxtf" />
- <bpmn:sequenceFlow id="SequenceFlow_0cy0y9t" name="Yes" sourceRef="ExclusiveGateway_0o3lxtf" targetRef="Task_17q1roq">
- <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{VNFREST_SuccessIndicator == true}</bpmn:conditionExpression>
- </bpmn:sequenceFlow>
- <bpmn:endEvent id="EndEvent_00cohim" name="throw MSOException">
- <bpmn:incoming>SequenceFlow_1rgd8dg</bpmn:incoming>
- <bpmn:errorEventDefinition errorRef="Error_0fa7ks7" />
- </bpmn:endEvent>
- <bpmn:sequenceFlow id="SequenceFlow_1rgd8dg" sourceRef="ExclusiveGateway_0o3lxtf" targetRef="EndEvent_00cohim" />
<bpmn:scriptTask id="Task_018w43g" name="Post Process" scriptFormat="groovy">
<bpmn:incoming>SequenceFlow_13c3cv2</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_1sgtwr2</bpmn:outgoing>
@@ -84,6 +69,7 @@ deleteVfMod.executeMethod('postProcess', execution, isDebugLogEnabled)]]></bpmn:
</bpmn:scriptTask>
<bpmn:sequenceFlow id="SequenceFlow_13c3cv2" sourceRef="Task_17q1roq" targetRef="Task_018w43g" />
<bpmn:sequenceFlow id="SequenceFlow_1sgtwr2" sourceRef="Task_018w43g" targetRef="EndEvent_0fw1gkf" />
+ <bpmn:sequenceFlow id="SequenceFlow_04zsr0f" sourceRef="Task_14fsstq" targetRef="Task_17q1roq" />
</bpmn:process>
<bpmn:error id="Error_0fa7ks7" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
@@ -153,39 +139,6 @@ deleteVfMod.executeMethod('postProcess', execution, isDebugLogEnabled)]]></bpmn:
<dc:Bounds x="377" y="95" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="ExclusiveGateway_0o3lxtf_di" bpmnElement="ExclusiveGateway_0o3lxtf" isMarkerVisible="true">
- <dc:Bounds x="1028" y="95" width="50" height="50" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="1020" y="145" width="66" height="36" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_1x3luyj_di" bpmnElement="SequenceFlow_1x3luyj">
- <di:waypoint xsi:type="dc:Point" x="965" y="120" />
- <di:waypoint xsi:type="dc:Point" x="1028" y="120" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="997" y="95" width="0" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_0cy0y9t_di" bpmnElement="SequenceFlow_0cy0y9t">
- <di:waypoint xsi:type="dc:Point" x="1078" y="120" />
- <di:waypoint xsi:type="dc:Point" x="1151" y="120" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="1106" y="95" width="18" height="12" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="EndEvent_0zln0ww_di" bpmnElement="EndEvent_00cohim">
- <dc:Bounds x="1035" y="274" width="36" height="36" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="1016" y="310" width="73" height="24" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_1rgd8dg_di" bpmnElement="SequenceFlow_1rgd8dg">
- <di:waypoint xsi:type="dc:Point" x="1053" y="145" />
- <di:waypoint xsi:type="dc:Point" x="1053" y="274" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="1068" y="199.5" width="0" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ScriptTask_1ilduoy_di" bpmnElement="Task_018w43g">
<dc:Bounds x="1298" y="80" width="100" height="80" />
</bpmndi:BPMNShape>
@@ -203,6 +156,13 @@ deleteVfMod.executeMethod('postProcess', execution, isDebugLogEnabled)]]></bpmn:
<dc:Bounds x="1431" y="95" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_04zsr0f_di" bpmnElement="SequenceFlow_04zsr0f">
+ <di:waypoint xsi:type="dc:Point" x="965" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="1151" y="120" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1058" y="99" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoUpdateVfModule.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoUpdateVfModule.bpmn
index 46e7ddcbe6..cfda2ad73c 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoUpdateVfModule.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoUpdateVfModule.bpmn
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_Wblj8GyfEeWUWLTvug7ZOg" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
+<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_Wblj8GyfEeWUWLTvug7ZOg" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
<bpmn2:process id="DoUpdateVfModule" name="DoUpdateVfModule" isExecutable="true">
<bpmn2:documentation><![CDATA[This flow expects its incoming request to be in the variable 'DoUpdateVfModuleRequest'. This flow produces no output.]]></bpmn2:documentation>
<bpmn2:scriptTask id="PrepareUpdateAAIVfModule_prep" name="Prepare Update AAI Vf Module (prep)" scriptFormat="groovy">
@@ -121,8 +121,7 @@ duvm.prepUpdateAAIGenericVnf(execution)]]></bpmn2:script>
<bpmn2:outgoing>SequenceFlow_9</bpmn2:outgoing>
</bpmn2:callActivity>
<bpmn2:sequenceFlow id="SequenceFlow_9" name="" sourceRef="CallActivity_1" targetRef="ScriptTask_10" />
- <bpmn2:exclusiveGateway id="ExclusiveGateway_1" name="Skip Update
-&#10;Generic Vnf?" default="SequenceFlow_14">
+ <bpmn2:exclusiveGateway id="ExclusiveGateway_1" name="Skip Update &#10;&#10;Generic Vnf?" default="SequenceFlow_14">
<bpmn2:incoming>SequenceFlow_13</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_14</bpmn2:outgoing>
<bpmn2:outgoing>SequenceFlow_18</bpmn2:outgoing>
@@ -157,14 +156,13 @@ duvm.prepSDNCTopologyChg(execution)]]></bpmn2:script>
<bpmn2:incoming>SequenceFlow_12</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_3</bpmn2:outgoing>
</bpmn2:callActivity>
- <bpmn2:callActivity id="ScriptTask_9" name="VnfAdapterRest" calledElement="vnfAdapterRestV1">
+ <bpmn2:callActivity id="ScriptTask_9" name="VnfAdapterRest" calledElement="vnfAdapterTask">
<bpmn2:extensionElements>
- <camunda:in source="DOUPVfMod_vnfAdapterRestRequest" target="vnfAdapterRestV1Request" />
+ <camunda:in source="DOUPVfMod_vnfAdapterRestRequest" target="vnfAdapterTaskRequest" />
<camunda:in source="mso-request-id" target="mso-request-id" />
<camunda:in source="mso-service-instance-id" target="mso-service-instance-id" />
- <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" />
<camunda:out source="WorkflowException" target="WorkflowException" />
- <camunda:out source="vnfAdapterRestV1Response" target="DOUPVfMod_vnfAdapterRestResponse" />
+ <camunda:out source="WorkflowResponse" target="DOUPVfMod_vnfAdapterRestResponse" />
</bpmn2:extensionElements>
<bpmn2:incoming>SequenceFlow_21</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_24</bpmn2:outgoing>
@@ -248,8 +246,7 @@ def duvm = new DoUpdateVfModule()
duvm.prepConfirmVolumeGroupTenant(execution)]]></bpmn2:script>
</bpmn2:scriptTask>
<bpmn2:sequenceFlow id="SequenceFlow_11" name="" sourceRef="ScriptTask_2" targetRef="ScriptTask_3" />
- <bpmn2:exclusiveGateway id="ExclusiveGateway_2" name="VolumeGroupId
-&#10;present?" default="SequenceFlow_16">
+ <bpmn2:exclusiveGateway id="ExclusiveGateway_2" name="VolumeGroupId &#10;&#10;present?" default="SequenceFlow_16">
<bpmn2:incoming>SequenceFlow_29</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_10</bpmn2:outgoing>
<bpmn2:outgoing>SequenceFlow_16</bpmn2:outgoing>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/PNFSoftwareUpgradeTest.java b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/PNFSoftwareUpgradeTest.java
index a9bf4352bf..2993ed6724 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/PNFSoftwareUpgradeTest.java
+++ b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/PNFSoftwareUpgradeTest.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2020 Nordix Foundation.
+ * Modifications Copyright (C) 2020 Huawei Technologies Co., Ltd.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -60,6 +61,7 @@ public class PNFSoftwareUpgradeTest extends BaseBPMNTest {
private static final String TEST_PROCESSINSTANCE_KEY = "PNFSoftwareUpgrade";
private static final AAIVersion VERSION = AAIVersion.LATEST;
private static final Map<String, Object> executionVariables = new HashMap();
+ private static final String REQUEST_ID = "50ae41ad-049c-4fe2-9950-539f111120f5";
private final String[] actionNames = new String[4];
private String requestObject;
private String responseObject;
@@ -80,6 +82,7 @@ public class PNFSoftwareUpgradeTest extends BaseBPMNTest {
responseObject = FileUtil.readResourceFile("response/" + getClass().getSimpleName() + ".json");
executionVariables.put("bpmnRequest", requestObject);
+ executionVariables.put("requestId", REQUEST_ID);
/**
* This variable indicates that the flow was invoked asynchronously. It's injected by {@link WorkflowProcessor}.
@@ -99,6 +102,7 @@ public class PNFSoftwareUpgradeTest extends BaseBPMNTest {
public void workflow_validInput_expectedOutput() throws InterruptedException {
mockCatalogDb();
+ mockRequestDb();
mockAai();
final String msoRequestId = UUID.randomUUID().toString();
@@ -118,9 +122,9 @@ public class PNFSoftwareUpgradeTest extends BaseBPMNTest {
// Layout is to reflect the bpmn visual layout
assertThat(pi).isEnded().hasPassedInOrder("softwareUpgrade_startEvent", "ServiceTask_042uz7n",
- "ServiceTask_0slpahe", "ExclusiveGateway_0x6h0ni", "ServiceTask_0x5cje8", "ExclusiveGateway_0v3l3wv",
- "ServiceTask_02lxf48", "ExclusiveGateway_0ch3fef", "ServiceTask_0y2uysu", "ExclusiveGateway_1ny9b1z",
- "softwareUpgrade_endEvent");
+ "ScriptTask_10klpg8", "ServiceTask_0slpahe", "ExclusiveGateway_0x6h0ni", "ServiceTask_0x5cje8",
+ "ExclusiveGateway_0v3l3wv", "ServiceTask_02lxf48", "ExclusiveGateway_0ch3fef", "ServiceTask_0y2uysu",
+ "ExclusiveGateway_1ny9b1z", "ScriptTask_1igtc83", "CallActivity_0o1mi8u", "softwareUpgrade_endEvent");
List<ExecutionServiceInput> detailedMessages = grpcNettyServer.getDetailedMessages();
assertThat(detailedMessages.size() == 4);
@@ -202,6 +206,14 @@ public class PNFSoftwareUpgradeTest extends BaseBPMNTest {
wireMockServer.stubFor(post(urlEqualTo("/aai/" + VERSION + "/network/pnfs/pnf/PNFDemo")));
}
+ private void mockRequestDb() {
+ /**
+ * Update Request DB
+ */
+ wireMockServer.stubFor(put(urlEqualTo("/infraActiveRequests/" + REQUEST_ID)));
+
+ }
+
/**
* Mock the catalobdb rest interface.
*/
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java
index 7e5cf19b21..b6ab9d0ce6 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java
@@ -188,6 +188,15 @@ public class AAIUpdateTasks {
}
/**
+ * BPMN access method to update status of VfModule to Active in AAI
+ */
+ public void updateOrchestrationStatusActivateVfModule(BuildingBlockExecution execution) {
+ execution.setVariable("aaiActivateVfModuleRollback", false);
+ updateOrchestrationStatusForVfModule(execution, OrchestrationStatus.ACTIVE);
+ execution.setVariable("aaiActivateVfModuleRollback", true);
+ }
+
+ /**
* BPMN access method to update aaiDeactivateVfModuleRollback to true for deactivating the VfModule
*/
public void updateOrchestrationStatusDeactivateVfModule(BuildingBlockExecution execution) {
@@ -205,9 +214,6 @@ public class AAIUpdateTasks {
/**
* BPMN access method to update status of L3Network to Assigned in AAI
- *
- * @param execution
- * @throws BBObjectNotFoundException
*/
public void updateOrchestrationStatusAssignedNetwork(BuildingBlockExecution execution) {
updateNetwork(execution, OrchestrationStatus.ASSIGNED);
@@ -215,9 +221,6 @@ public class AAIUpdateTasks {
/**
* BPMN access method to update status of L3Network to Active in AAI
- *
- * @param execution
- * @throws BBObjectNotFoundException
*/
public void updateOrchestrationStatusActiveNetwork(BuildingBlockExecution execution) {
updateNetwork(execution, OrchestrationStatus.ACTIVE);
@@ -225,9 +228,6 @@ public class AAIUpdateTasks {
/**
* BPMN access method to update status of L3Network to Created in AAI
- *
- * @param execution
- * @throws BBObjectNotFoundException
*/
public void updateOrchestrationStatusCreatedNetwork(BuildingBlockExecution execution) {
updateNetwork(execution, OrchestrationStatus.CREATED);
@@ -262,9 +262,6 @@ public class AAIUpdateTasks {
/**
* BPMN access method to update status of L3Network Collection to Active in AAI
- *
- * @param execution
- * @throws BBObjectNotFoundException
*/
public void updateOrchestrationStatusActiveNetworkCollection(BuildingBlockExecution execution) {
execution.setVariable("aaiNetworkCollectionActivateRollback", false);
@@ -285,27 +282,7 @@ public class AAIUpdateTasks {
}
/**
- * BPMN access method to update status of VfModule to Active in AAI
- *
- * @param execution
- */
- public void updateOrchestrationStatusActivateVfModule(BuildingBlockExecution execution) {
- execution.setVariable("aaiActivateVfModuleRollback", false);
- try {
- VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf, OrchestrationStatus.ACTIVE);
- execution.setVariable("aaiActivateVfModuleRollback", true);
- } catch (Exception ex) {
- logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusActivateVfModule", ex);
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
-
- /**
* BPMN access method to update HeatStackId of VfModule in AAI
- *
- * @param execution
*/
public void updateHeatStackIdVfModule(BuildingBlockExecution execution) {
try {
@@ -325,9 +302,6 @@ public class AAIUpdateTasks {
/**
* BPMN access method to update L3Network after it was created in cloud
- *
- * @param execution
- * @throws Exception
*/
public void updateNetworkCreated(BuildingBlockExecution execution) throws Exception {
execution.setVariable("aaiNetworkActivateRollback", false);
@@ -369,9 +343,6 @@ public class AAIUpdateTasks {
/**
* BPMN access method to update L3Network after it was updated in cloud
- *
- * @param execution
- * @throws Exception
*/
public void updateNetworkUpdated(BuildingBlockExecution execution) throws Exception {
L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
@@ -399,8 +370,6 @@ public class AAIUpdateTasks {
/**
* BPMN access method to update L3Network Object
- *
- * @param execution
*/
public void updateObjectNetwork(BuildingBlockExecution execution) {
try {
@@ -414,8 +383,6 @@ public class AAIUpdateTasks {
/**
* BPMN access method to update ServiceInstance
- *
- * @param execution
*/
public void updateServiceInstance(BuildingBlockExecution execution) {
try {
@@ -430,8 +397,6 @@ public class AAIUpdateTasks {
/**
* BPMN access method to update Vnf Object
- *
- * @param execution
*/
public void updateObjectVnf(BuildingBlockExecution execution) {
try {
@@ -445,8 +410,6 @@ public class AAIUpdateTasks {
/**
* BPMN access method to update status of VfModuleRollback as true
- *
- * @param execution
*/
public void updateOrchestrationStatusDeleteVfModule(BuildingBlockExecution execution) {
execution.setVariable("aaiDeleteVfModuleRollback", false);
@@ -454,9 +417,6 @@ public class AAIUpdateTasks {
VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
vfModule.setHeatStackId("");
GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
-
- VfModule copiedVfModule = vfModule.shallowCopyId();
- copiedVfModule.setHeatStackId("");
aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf, OrchestrationStatus.ASSIGNED);
execution.setVariable("aaiDeleteVfModuleRollback", true);
} catch (Exception ex) {
@@ -467,8 +427,6 @@ public class AAIUpdateTasks {
/**
* BPMN access method to update Model of VfModule
- *
- * @param execution
*/
public void updateModelVfModule(BuildingBlockExecution execution) {
try {
@@ -483,8 +441,6 @@ public class AAIUpdateTasks {
/**
* BPMN access method to update status of FabricConfiguration to Assigned in AAI
- *
- * @param execution
*/
public void updateOrchestrationStatusAssignFabricConfiguration(BuildingBlockExecution execution) {
try {
@@ -499,8 +455,6 @@ public class AAIUpdateTasks {
/**
* BPMN access method to update status of FabricConfiguration to Active in AAI
- *
- * @param execution
*/
public void updateOrchestrationStatusActivateFabricConfiguration(BuildingBlockExecution execution) {
try {
@@ -515,8 +469,6 @@ public class AAIUpdateTasks {
/**
* BPMN access method to update status of FabricConfiguration to deactive in AAI
- *
- * @param execution
*/
public void updateOrchestrationStatusDeactivateFabricConfiguration(BuildingBlockExecution execution) {
try {
@@ -532,8 +484,6 @@ public class AAIUpdateTasks {
/**
* BPMN access method to update Ipv4OamAddress of Vnf
- *
- * @param execution
*/
public void updateIpv4OamAddressVnf(BuildingBlockExecution execution) {
try {
@@ -555,8 +505,6 @@ public class AAIUpdateTasks {
/**
* BPMN access method to update ManagementV6Address of Vnf
- *
- * @param execution
*/
public void updateManagementV6AddressVnf(BuildingBlockExecution execution) {
try {
@@ -578,8 +526,6 @@ public class AAIUpdateTasks {
/**
* BPMN access method to update ContrailServiceInstanceFqdn of VfModule
- *
- * @param execution
*/
public void updateContrailServiceInstanceFqdnVfModule(BuildingBlockExecution execution) {
try {
@@ -598,8 +544,6 @@ public class AAIUpdateTasks {
/**
* BPMN access method to update status of Vnf to ConfigAssigned in AAI
- *
- * @param execution
*/
public void updateOrchestrationStatusConfigAssignedVnf(BuildingBlockExecution execution) {
try {
@@ -613,79 +557,16 @@ public class AAIUpdateTasks {
/**
* BPMN access method to update status of Vnf to Configure in AAI
- *
- * @param execution
*/
public void updateOrchestrationStatusConfigDeployConfigureVnf(BuildingBlockExecution execution) {
- try {
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- aaiVnfResources.updateOrchestrationStatusVnf(vnf, OrchestrationStatus.CONFIGURE);
-
- } catch (Exception ex) {
- logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusConfigDeployConfigureVnf", ex);
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
+ updateOrchestrationStatusForVnf(execution, OrchestrationStatus.CONFIGURE);
}
/**
* BPMN access method to update status of Vnf to configured in AAI
- *
- * @param execution
*/
public void updateOrchestrationStatusConfigDeployConfiguredVnf(BuildingBlockExecution execution) {
- try {
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- aaiVnfResources.updateOrchestrationStatusVnf(vnf, OrchestrationStatus.CONFIGURED);
- } catch (Exception ex) {
- logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusConfigDeployConfiguredVnf", ex);
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
-
- /**
- * BPMN access method to update status of VNF/VF-Module based on SO scope and action.
- *
- * @param execution - BuildingBlockExecution
- * @param scope - SO scope (vnf/vfModule)
- * @param action - action (configAssign/configDeploy/configUndeploy etc..)
- */
- public void updateOrchestrationStatusForCds(BuildingBlockExecution execution, String scope, String action) {
- try {
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- OrchestrationStatus status = getOrchestrationStatus(action);
- switch (scope) {
- case "vnf":
- aaiVnfResources.updateOrchestrationStatusVnf(vnf, status);
- break;
- case "vfModule":
- VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
- aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf, status);
- break;
- default:
- throw new IllegalArgumentException(
- "Invalid scope to update orchestration status for CDS : " + action);
- }
- } catch (Exception ex) {
- logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusForCds", ex);
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
-
- private OrchestrationStatus getOrchestrationStatus(String action) {
- /**
- * At this state, OrcherstationStatus enum associated with configAssign and configDeploy. I am not sure which is
- * the correct approach. 1. Are we going to map each specific action to OrchestrationStauts ? 2. We will have
- * only one generic status for all actions ?
- */
-
- switch (action) {
- case "configAssign":
- return OrchestrationStatus.ASSIGNED;
- case "configDeploy":
- return OrchestrationStatus.CONFIGURED;
- default:
- throw new IllegalArgumentException("Invalid action to set Orchestration status: " + action);
- }
+ updateOrchestrationStatusForVnf(execution, OrchestrationStatus.CONFIGURED);
}
private void updateOrchestrationStatusForService(BuildingBlockExecution execution, OrchestrationStatus status) {
@@ -751,5 +632,4 @@ public class AAIUpdateTasks {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
-
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java
index 8b78560521..97d78b5ee8 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java
@@ -9,9 +9,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -91,7 +91,7 @@ public class VnfAdapterImpl {
public void postProcessVnfAdapter(BuildingBlockExecution execution) {
try {
- String vnfAdapterResponse = execution.getVariable("vnfAdapterRestV1Response");
+ String vnfAdapterResponse = execution.getVariable("WorkflowResponse");
if (!StringUtils.isEmpty(vnfAdapterResponse)) {
Object vnfRestResponse = unMarshal(vnfAdapterResponse);
if (vnfRestResponse instanceof CreateVfModuleResponse) {
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessor.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessor.java
index 9697246b03..9c55d0a922 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessor.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessor.java
@@ -1,7 +1,9 @@
package org.onap.so.bpmn.infrastructure.appc.tasks;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import java.util.Optional;
import org.onap.aai.domain.yang.Vserver;
import org.onap.appc.client.lcm.model.Action;
@@ -29,6 +31,8 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
@Component
public class AppcOrchestratorPreProcessor {
@@ -84,8 +88,16 @@ public class AppcOrchestratorPreProcessor {
appcTaskRequest.setNewSoftwareVersion(newSoftwareVersion);
String operationsTimeout = JsonUtils.getJsonValue(payload, "operations_timeout");
appcTaskRequest.setOperationsTimeout(operationsTimeout);
- }
+ Map<String, String> configMap = new HashMap<>();
+ ObjectMapper objectMapper = new ObjectMapper();
+ String configParamsStr = JsonUtils.getJsonValue(payload, "configuration_parameters");
+ if (configParamsStr != null) {
+ configMap =
+ objectMapper.readValue(configParamsStr, new TypeReference<HashMap<String, String>>() {});
+ }
+ appcTaskRequest.setConfigParams(configMap);
+ }
ControllerSelectionReference controllerSelectionReference = catalogDbClient
.getControllerSelectionReferenceByVnfTypeAndActionCategory(vnfType, action.toString());
String controllerType = null;
@@ -229,8 +241,13 @@ public class AppcOrchestratorPreProcessor {
.isEmpty()) {
errorMessage = "APPC action Snapshot is missing vserverId parameter. ";
}
- break;
}
+ break;
+ case ConfigModify:
+ if (appcTaskRequest.getConfigParams().isEmpty() || appcTaskRequest.getConfigParams() == null) {
+ errorMessage = "APPC action ConfigModify is missing Configuration parameters. ";
+ }
+ break;
default:
break;
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/sdnc/SdncControllerDE.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/sdnc/SdncControllerDE.java
index 8499b6f7d1..ea3405d423 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/sdnc/SdncControllerDE.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/sdnc/SdncControllerDE.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Nordix
- * Modifications Copyright (C) 2020 Huawei
+ * Modifications Copyright (C) 2020 Huawei Technologies Co., Ltd.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -29,6 +29,8 @@ import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.onap.so.bpmn.infrastructure.decisionpoint.api.ControllerContext;
import org.onap.so.bpmn.infrastructure.decisionpoint.impl.camunda.controller.common.SoPropertyConstants;
import org.onap.so.bpmn.infrastructure.decisionpoint.impl.camunda.controller.LcmControllerDE;
+import org.onap.so.client.exception.BadResponseException;
+import org.onap.so.client.exception.PayloadGenerationException;
import org.onap.so.client.sdnc.common.SDNCConstants;
import org.onap.so.client.sdnc.lcm.*;
import org.onap.so.client.sdnc.lcm.beans.*;
@@ -59,26 +61,20 @@ public class SdncControllerDE extends LcmControllerDE {
logger.debug("Running activity for id: {}, name: {}", execution.getCurrentActivityId(),
execution.getCurrentActivityName());
- boolean result;
try {
LcmInput lcmInput = buildLcmInput(execution);
- if (lcmInput != null) {
- result = sendLcmRequest(execution, lcmInput);
- } else {
- logger.error("Build LCM Input error");
- result = false;
- }
- } catch (Exception e) {
- logger.error("Call SDNC LCM Client failure: ", e);
- result = false;
- }
+ sendLcmRequest(execution, lcmInput);
- if (result) {
execution.setVariable(SoPropertyConstants.CONTROLLER_STATUS, "Success");
- } else {
+ } catch (Exception e) {
execution.setVariable(SoPropertyConstants.CONTROLLER_STATUS, "Failure");
+
+ exceptionUtil.buildAndThrowWorkflowException(execution, SDNC_DELEGATE_EXECUTION_ERROR_CODE, e);
}
+ logger.debug("Finish activity for id: {}, name: {}", execution.getCurrentActivityId(),
+ execution.getCurrentActivityName());
+
return 0;
}
@@ -87,17 +83,24 @@ public class SdncControllerDE extends LcmControllerDE {
return SDNC_DELEGATE_EXECUTION_ERROR_CODE;
}
- private LcmOutput sendSyncRequest(String operation, LcmInput lcmInput) {
+ private LcmOutput sendSyncRequest(String operation, LcmInput lcmInput) throws BadResponseException {
SDNCLcmClientBuilder sdncLcmClientBuilder = new SDNCLcmClientBuilder();
SDNCLcmRestClient sdncLcmRestClient;
try {
sdncLcmRestClient = sdncLcmClientBuilder.newSDNCLcmRestClient(operation);
} catch (SDNCLcmClientBuilderException e) {
logger.error("Create SDNCLcmRestClient error: ", e);
- return null;
+ throw new BadResponseException("Can not send request to SDNC.");
}
- return sdncLcmRestClient.sendRequest(lcmInput);
+ LcmOutput lcmOutput;
+ try {
+ lcmOutput = sdncLcmRestClient.sendRequest(lcmInput);
+ } catch (Exception e) {
+ logger.error("SDNCLcmRestClient sends request failure: ", e);
+ throw new BadResponseException("Send request to SDNC failure.");
+ }
+ return lcmOutput;
}
private LcmOutput selectLcmOutputFromDmaapResponses(List<LcmDmaapResponse> lcmDmaapResponses, LcmInput lcmInput) {
@@ -115,22 +118,22 @@ public class SdncControllerDE extends LcmControllerDE {
return null;
}
- private LcmOutput sendAsyncRequest(String operation, LcmInput lcmInput) {
+ private LcmOutput sendAsyncRequest(String operation, LcmInput lcmInput) throws BadResponseException {
SDNCLcmClientBuilder sdncLcmClientBuilder = new SDNCLcmClientBuilder();
SDNCLcmDmaapClient sdncLcmDmaapClient;
try {
sdncLcmDmaapClient = sdncLcmClientBuilder.newSDNCLcmDmaapClient();
} catch (SDNCLcmClientBuilderException e) {
logger.error("Create SDNCLcmDmaapClient error: ", e);
- return null;
+ throw new BadResponseException("Can not send request to SDNC.");
}
LcmDmaapRequest lcmDmaapRequest = SDNCLcmMessageBuilder.buildLcmDmaapRequest(operation, lcmInput);
try {
sdncLcmDmaapClient.sendRequest(lcmDmaapRequest);
} catch (Exception e) {
- logger.error("SDNCLcmDmaapClient sends request error: ", e);
- return null;
+ logger.error("SDNCLcmDmaapClient sends request failure: ", e);
+ throw new BadResponseException("Send request to SDNC failure.");
}
long timeout = sdncLcmClientBuilder.getSDNCLcmProperties().getActionTimeout();
@@ -146,8 +149,9 @@ public class SdncControllerDE extends LcmControllerDE {
long stopTime = System.currentTimeMillis();
if ((stopTime - startTime) > timeout) {
- logger.error("Timeout for SDNC LCM action {}", lcmInput.getAction());
- return null;
+ String msg = "Timeout for SDNC LCM action " + lcmInput.getAction();
+ logger.error(msg);
+ throw new BadResponseException(msg);
}
}
}
@@ -158,7 +162,15 @@ public class SdncControllerDE extends LcmControllerDE {
return lcmAction.replaceAll(regex, replacement).toLowerCase();
}
- private LcmInput buildLcmInput(DelegateExecution execution) throws JsonProcessingException {
+ private String convertToSting(Object msgObject) throws PayloadGenerationException {
+ try {
+ return SDNCLcmPayloadBuilder.convertToSting(msgObject);
+ } catch (JsonProcessingException e) {
+ throw new PayloadGenerationException(e.getMessage());
+ }
+ }
+
+ private LcmInput buildLcmInput(DelegateExecution execution) throws PayloadGenerationException {
String requestId = String.valueOf(execution.getVariable(REQUEST_ID));
String requestAction = String.valueOf(execution.getVariable(SoPropertyConstants.SO_ACTION));
String pnfName = String.valueOf(execution.getVariable(PNF_CORRELATION_ID));
@@ -176,32 +188,33 @@ public class SdncControllerDE extends LcmControllerDE {
UpgradePreCheckPayload upgradePreCheckPayload;
upgradePreCheckPayload = SDNCLcmPayloadBuilder.buildUpgradePreCheckPayload(execution);
- lcmPayload = SDNCLcmPayloadBuilder.convertToSting(upgradePreCheckPayload);
+ lcmPayload = convertToSting(upgradePreCheckPayload);
break;
case SoPropertyConstants.ACTION_DOWNLOAD_N_E_SW:
lcmAction = SDNCLcmActionConstants.DOWNLOAD_N_E_SW;
DownloadNESwPayload downloadNESwPayload;
downloadNESwPayload = SDNCLcmPayloadBuilder.buildDownloadNESwPayload(execution);
- lcmPayload = SDNCLcmPayloadBuilder.convertToSting(downloadNESwPayload);
+ lcmPayload = convertToSting(downloadNESwPayload);
break;
case SoPropertyConstants.ACTION_ACTIVATE_N_E_SW:
lcmAction = SDNCLcmActionConstants.ACTIVATE_N_E_SW;
ActivateNESwPayload activateNESwPayload;
activateNESwPayload = SDNCLcmPayloadBuilder.buildActivateNESwPayload(execution);
- lcmPayload = SDNCLcmPayloadBuilder.convertToSting(activateNESwPayload);
+ lcmPayload = convertToSting(activateNESwPayload);
break;
case SoPropertyConstants.ACTION_POST_CHECK:
lcmAction = SDNCLcmActionConstants.UPGRADE_POST_CHECK;
UpgradePostCheckPayload upgradePostCheckPayload;
upgradePostCheckPayload = SDNCLcmPayloadBuilder.buildUpgradePostCheckPayload(execution);
- lcmPayload = SDNCLcmPayloadBuilder.convertToSting(upgradePostCheckPayload);
+ lcmPayload = convertToSting(upgradePostCheckPayload);
break;
default:
- logger.error("Unsupported SO Action: " + requestAction);
- return null;
+ String msg = "Unsupported SO Action: " + requestAction;
+ logger.error(msg);
+ throw new PayloadGenerationException(msg);
}
String subRequestId = UUID.randomUUID().toString();
@@ -209,32 +222,33 @@ public class SdncControllerDE extends LcmControllerDE {
SDNCLcmMessageBuilder.buildLcmInputForPnf(requestId, subRequestId, pnfName, lcmAction, lcmPayload);
ObjectMapper mapper = new ObjectMapper();
- String lcmInputMsg = mapper.writeValueAsString(lcmInput);
- logger.debug("SDNC input message for {}: {}", lcmAction, lcmInputMsg);
+ try {
+ String lcmInputMsg = mapper.writeValueAsString(lcmInput);
+ logger.debug("SDNC input message for {}: {}", lcmAction, lcmInputMsg);
+ } catch (JsonProcessingException e) {
+ throw new PayloadGenerationException(e.getMessage());
+ }
return lcmInput;
}
- private boolean parseLcmOutput(LcmOutput lcmOutput, String lcmAction) {
- if (lcmOutput == null) {
- logger.error("Call SDNC LCM API failure");
- return false;
- }
-
+ private void parseLcmOutput(LcmOutput lcmOutput, String lcmAction) throws BadResponseException {
LcmStatus lcmStatus = lcmOutput.getStatus();
+ int lcmStatusCode = lcmStatus.getCode();
String outputPayload = lcmOutput.getPayload();
- logger.debug("SDNC LCM output payload of action {}: {}", lcmAction, outputPayload);
- if (lcmStatus.getCode() == SDNCConstants.LCM_OUTPUT_SUCCESS_CODE) {
- logger.debug("Call SDNC LCM API for {} success, message: {}", lcmAction, lcmStatus.getMessage());
- return true;
+ if (lcmStatusCode == SDNCConstants.LCM_OUTPUT_SUCCESS_CODE) {
+ logger.debug("Call SDNC LCM API for {} success, code: {}, message: {}, payload: {}", lcmAction,
+ lcmStatusCode, lcmStatus.getMessage(), outputPayload);
} else {
- logger.error("Call SDNC LCM API for {} failure, message: {}", lcmAction, lcmStatus.getMessage());
- return false;
+ String msg = String.format("Call SDNC LCM API for %s failure, code: %d, message: %s, payload: %s",
+ lcmAction, lcmStatusCode, lcmStatus.getMessage(), outputPayload);
+ logger.error(msg);
+ throw new BadResponseException(msg);
}
}
- private boolean sendLcmRequest(DelegateExecution execution, LcmInput lcmInput) {
+ private void sendLcmRequest(DelegateExecution execution, LcmInput lcmInput) throws BadResponseException {
String actionMode = String.valueOf(execution.getVariable(SoPropertyConstants.SO_ACTION_MODE));
String lcmOperation = toLowerHyphen(lcmInput.getAction());
@@ -245,6 +259,6 @@ public class SdncControllerDE extends LcmControllerDE {
lcmOutput = sendSyncRequest(lcmOperation, lcmInput);
}
- return parseLcmOutput(lcmOutput, lcmInput.getAction());
+ parseLcmOutput(lcmOutput, lcmInput.getAction());
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasks.java
index d9f5e65ba3..cdba6e0e2f 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasks.java
@@ -173,7 +173,7 @@ public class ManualHandlingTasks {
taskVariables.put(TASK_VARIABLE_DESCRIPTION, description);
TaskService taskService = execution.getProcessEngineServices().getTaskService();
- taskService.setVariables(taskId, taskVariables);
+ taskService.setVariablesLocal(taskId, taskVariables);
logger.debug("successfully created fallout task: " + taskId);
} catch (BpmnError e) {
logger.debug(BPMN_EXCEPTION + e.getMessage());
@@ -223,7 +223,7 @@ public class ManualHandlingTasks {
taskVariables.put(TASK_VARIABLE_VALID_RESPONSES, validResponses);
TaskService taskService = execution.getProcessEngineServices().getTaskService();
- taskService.setVariables(taskId, taskVariables);
+ taskService.setVariablesLocal(taskId, taskVariables);
logger.debug("successfully created pause task: " + taskId);
} catch (BpmnError e) {
logger.debug(BPMN_EXCEPTION + e.getMessage());
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 eead1761ea..e01149f981 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
@@ -83,7 +83,6 @@ import org.onap.so.serviceinstancebeans.Networks;
import org.onap.so.serviceinstancebeans.Pnfs;
import org.onap.so.serviceinstancebeans.RelatedInstance;
import org.onap.so.serviceinstancebeans.RequestDetails;
-import org.onap.so.serviceinstancebeans.RequestInfo;
import org.onap.so.serviceinstancebeans.Service;
import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
import org.onap.so.serviceinstancebeans.VfModules;
@@ -169,18 +168,6 @@ public class WorkflowAction {
}
public void selectExecutionList(DelegateExecution execution) throws Exception {
- final String apiVersion = (String) execution.getVariable(BBConstants.G_APIVERSION);
- final String vnfType = (String) execution.getVariable(VNF_TYPE);
- String serviceInstanceId = (String) execution.getVariable("serviceInstanceId");
- final String createInstanceAction = "createInstance";
- final String serviceType =
- Optional.ofNullable((String) execution.getVariable(BBConstants.G_SERVICE_TYPE)).orElse("");
-
- List<OrchestrationFlow> orchFlows =
- (List<OrchestrationFlow>) execution.getVariable(BBConstants.G_ORCHESTRATION_FLOW);
- WorkflowResourceIds workflowResourceIds = populateResourceIdsFromApiHandler(execution);
- List<Pair<WorkflowType, String>> aaiResourceIds = new ArrayList<>();
- List<Resource> resourceList = new ArrayList<>();
execution.setVariable("sentSyncResponse", false);
execution.setVariable("homing", false);
execution.setVariable("calledHoming", false);
@@ -205,8 +192,9 @@ public class WorkflowAction {
WorkflowType resourceType = resource.getResourceType();
execution.setVariable("resourceName", resourceType.toString());
String resourceId = "";
- final String requestAction = (String) execution.getVariable(BBConstants.G_ACTION);
- if (resource.isGenerated() && requestAction.equalsIgnoreCase(createInstanceAction)
+ String requestAction = (String) execution.getVariable(BBConstants.G_ACTION);
+ WorkflowResourceIds workflowResourceIds = populateResourceIdsFromApiHandler(execution);
+ if (resource.isGenerated() && requestAction.equalsIgnoreCase("createInstance")
&& sIRequest.getRequestDetails().getRequestInfo().getInstanceName() != null) {
resourceId = validateResourceIdInAAI(resource.getResourceId(), resourceType,
sIRequest.getRequestDetails().getRequestInfo().getInstanceName(), sIRequest.getRequestDetails(),
@@ -214,6 +202,7 @@ public class WorkflowAction {
} else {
resourceId = resource.getResourceId();
}
+ String serviceInstanceId = (String) execution.getVariable("serviceInstanceId");
if ((serviceInstanceId == null || serviceInstanceId.isEmpty()) && resourceType == WorkflowType.SERVICE) {
serviceInstanceId = resourceId;
}
@@ -232,10 +221,16 @@ public class WorkflowAction {
"Could not resume request with request Id: " + requestId + ". No flowsToExecute was found");
}
} else {
+ String vnfType = (String) execution.getVariable(VNF_TYPE);
String cloudOwner = getCloudOwner(requestDetails.getCloudConfiguration());
+ List<OrchestrationFlow> orchFlows =
+ (List<OrchestrationFlow>) execution.getVariable(BBConstants.G_ORCHESTRATION_FLOW);
+ final String apiVersion = (String) execution.getVariable(BBConstants.G_APIVERSION);
+ final String serviceType =
+ Optional.ofNullable((String) execution.getVariable(BBConstants.G_SERVICE_TYPE)).orElse("");
if (aLaCarte) {
if (orchFlows == null || orchFlows.isEmpty()) {
- orchFlows = queryNorthBoundRequestCatalogDb(execution, requestAction, resourceType, aLaCarte,
+ orchFlows = queryNorthBoundRequestCatalogDb(execution, requestAction, resourceType, true,
cloudOwner, serviceType);
}
String key = "";
@@ -248,12 +243,12 @@ public class WorkflowAction {
}
}
boolean isConfiguration = isConfiguration(orchFlows);
- Resource resourceKey = new Resource(resourceType, key, aLaCarte);
+ Resource resourceKey = new Resource(resourceType, key, true);
if (isConfiguration && !requestAction.equalsIgnoreCase(CREATEINSTANCE)) {
List<ExecuteBuildingBlock> configBuildingBlocks = getConfigBuildingBlocks(
new ConfigBuildingBlocksDataObject().setsIRequest(sIRequest).setOrchFlows(orchFlows)
.setRequestId(requestId).setResourceKey(resourceKey).setApiVersion(apiVersion)
- .setResourceId(resourceId).setRequestAction(requestAction).setaLaCarte(aLaCarte)
+ .setResourceId(resourceId).setRequestAction(requestAction).setaLaCarte(true)
.setVnfType(vnfType).setWorkflowResourceIds(workflowResourceIds)
.setRequestDetails(requestDetails).setExecution(execution));
@@ -269,19 +264,21 @@ public class WorkflowAction {
orchFlows = getVfModuleReplaceBuildingBlocks(
new ConfigBuildingBlocksDataObject().setsIRequest(sIRequest).setOrchFlows(orchFlows)
.setRequestId(requestId).setResourceKey(resourceKey).setApiVersion(apiVersion)
- .setResourceId(resourceId).setRequestAction(requestAction).setaLaCarte(aLaCarte)
+ .setResourceId(resourceId).setRequestAction(requestAction).setaLaCarte(true)
.setVnfType(vnfType).setWorkflowResourceIds(workflowResourceIds)
.setRequestDetails(requestDetails).setExecution(execution));
}
for (OrchestrationFlow orchFlow : orchFlows) {
ExecuteBuildingBlock ebb = buildExecuteBuildingBlock(orchFlow, requestId, resourceKey,
- apiVersion, resourceId, requestAction, aLaCarte, vnfType, workflowResourceIds,
+ apiVersion, resourceId, requestAction, true, vnfType, workflowResourceIds,
requestDetails, false, null, null, false);
flowsToExecute.add(ebb);
}
} else {
boolean foundRelated = false;
boolean containsService = false;
+ List<Resource> resourceList = new ArrayList<>();
+ List<Pair<WorkflowType, String>> aaiResourceIds = new ArrayList<>();
if (resourceType == WorkflowType.SERVICE && requestAction.equalsIgnoreCase(ASSIGNINSTANCE)) {
// SERVICE-MACRO-ASSIGN will always get user params with a
// service.
@@ -440,13 +437,6 @@ public class WorkflowAction {
return environment.getProperty(defaultCloudOwner);
}
- private boolean isSuppressRollback(RequestInfo requestInfo) {
- if (requestInfo != null) {
- return requestInfo.getSuppressRollback();
- }
- return false;
- }
-
protected <T> List<T> getRelatedResourcesInVfModule(String vnfId, String vfModuleId, Class<T> resultClass,
AAIObjectType type) {
List<T> vnfcs = new ArrayList<>();
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java
index 9de8e184f2..614401d32a 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java
@@ -22,18 +22,33 @@
package org.onap.so.client.aai.mapper;
-import org.modelmapper.ModelMapper;
-import org.modelmapper.PropertyMap;
-import org.onap.aai.domain.yang.RouteTargets;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.*;
-import org.springframework.stereotype.Component;
import java.util.List;
import org.modelmapper.Converter;
+import org.modelmapper.ModelMapper;
+import org.modelmapper.PropertyMap;
import org.modelmapper.spi.MappingContext;
+import org.onap.aai.domain.yang.RouteTargets;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CtagAssignment;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.HostRoute;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.NetworkPolicy;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.OwningEntity;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Project;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTarget;
import org.onap.so.bpmn.servicedecomposition.bbobjects.SegmentationAssignment;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.CtagAssignment;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding;
+import org.springframework.stereotype.Component;
@Component
public class AAIObjectMapper {
@@ -46,6 +61,7 @@ public class AAIObjectMapper {
protected void configure() {
map().setServiceType(source.getModelInfoServiceInstance().getServiceType());
map().setServiceRole(source.getModelInfoServiceInstance().getServiceRole());
+ map().setServiceFunction(source.getModelInfoServiceInstance().getServiceFunction());
map().setModelInvariantId(source.getModelInfoServiceInstance().getModelInvariantUuid());
map().setModelVersionId(source.getModelInfoServiceInstance().getModelUuid());
map().setEnvironmentContext(source.getModelInfoServiceInstance().getEnvironmentContext());
@@ -178,6 +194,7 @@ public class AAIObjectMapper {
private Converter<List<Subnet>, org.onap.aai.domain.yang.Subnets> convertSubnets =
new Converter<List<Subnet>, org.onap.aai.domain.yang.Subnets>() {
+ @Override
public org.onap.aai.domain.yang.Subnets convert(
MappingContext<List<Subnet>, org.onap.aai.domain.yang.Subnets> context) {
return mapToAAISubNets(context.getSource());
@@ -186,6 +203,7 @@ public class AAIObjectMapper {
private Converter<List<CtagAssignment>, org.onap.aai.domain.yang.CtagAssignments> convertCtagAssignments =
new Converter<List<CtagAssignment>, org.onap.aai.domain.yang.CtagAssignments>() {
+ @Override
public org.onap.aai.domain.yang.CtagAssignments convert(
MappingContext<List<CtagAssignment>, org.onap.aai.domain.yang.CtagAssignments> context) {
return mapToAAICtagAssignmentList(context.getSource());
@@ -194,6 +212,7 @@ public class AAIObjectMapper {
private Converter<List<SegmentationAssignment>, org.onap.aai.domain.yang.SegmentationAssignments> convertSegmentationAssignments =
new Converter<List<SegmentationAssignment>, org.onap.aai.domain.yang.SegmentationAssignments>() {
+ @Override
public org.onap.aai.domain.yang.SegmentationAssignments convert(
MappingContext<List<SegmentationAssignment>, org.onap.aai.domain.yang.SegmentationAssignments> context) {
return mapToAAISegmentationAssignmentList(context.getSource());
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImplTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImplTest.java
index 97a9388f8d..16e8c2de7d 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImplTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImplTest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -103,7 +103,7 @@ public class VnfAdapterImplTest extends BaseTaskTest {
@Test
public void postProcessVnfAdapter_CreateResponseTest() {
- execution.setVariable("vnfAdapterRestV1Response", VNF_ADAPTER_REST_CREATE_RESPONSE);
+ execution.setVariable("WorkflowResponse", VNF_ADAPTER_REST_CREATE_RESPONSE);
vnfAdapterImpl.postProcessVnfAdapter(execution);
assertEquals(TEST_VFMODULE_HEATSTACK_ID, vfModule.getHeatStackId());
assertEquals(TEST_CONTRAIL_SERVICE_INSTANCE_FQDN, vfModule.getContrailServiceInstanceFqdn());
@@ -119,20 +119,20 @@ public class VnfAdapterImplTest extends BaseTaskTest {
@Test
public void postProcessVnfAdapter_CreateResponseTest_EmptyCreateVfModuleResponseTag() {
expectedException.expect(BpmnError.class);
- execution.setVariable("vnfAdapterRestV1Response", "<vfModuleStackId></vfModuleStackId>");
+ execution.setVariable("WorkflowResponse", "<vfModuleStackId></vfModuleStackId>");
vnfAdapterImpl.postProcessVnfAdapter(execution);
}
@Test
public void postProcessVnfAdapter_CreateResponseTest_EmptyVfModuleStackIdTag() {
- execution.setVariable("vnfAdapterRestV1Response", "<createVfModuleResponse></createVfModuleResponse>");
+ execution.setVariable("WorkflowResponse", "<createVfModuleResponse></createVfModuleResponse>");
vnfAdapterImpl.postProcessVnfAdapter(execution);
assertNull(vfModule.getHeatStackId());
}
@Test
public void postProcessVnfAdapter_CreateResponseTest_EmptyHeatStackId() {
- execution.setVariable("vnfAdapterRestV1Response",
+ execution.setVariable("WorkflowResponse",
"<createVfModuleResponse><vfModuleStackId></vfModuleStackId></createVfModuleResponse>");
vnfAdapterImpl.postProcessVnfAdapter(execution);
assertNull(vfModule.getHeatStackId());
@@ -140,7 +140,7 @@ public class VnfAdapterImplTest extends BaseTaskTest {
@Test
public void postProcessVnfAdapter_CreateResponseTest_EmptyVfModuleOutputs() {
- execution.setVariable("vnfAdapterRestV1Response",
+ execution.setVariable("WorkflowResponse",
"<createVfModuleResponse><vfModuleOutputs></vfModuleOutputs></createVfModuleResponse>");
vnfAdapterImpl.postProcessVnfAdapter(execution);
assertNull(vfModule.getHeatStackId());
@@ -156,7 +156,7 @@ public class VnfAdapterImplTest extends BaseTaskTest {
@Test
public void postProcessVnfAdapter_DeleteResponseTest() {
vfModule.setHeatStackId(TEST_VFMODULE_HEATSTACK_ID);
- execution.setVariable("vnfAdapterRestV1Response", VNF_ADAPTER_REST_DELETE_RESPONSE);
+ execution.setVariable("WorkflowResponse", VNF_ADAPTER_REST_DELETE_RESPONSE);
vnfAdapterImpl.postProcessVnfAdapter(execution);
assertNull(vfModule.getHeatStackId());
assertEquals(vfModule.getContrailServiceInstanceFqdn(), "");
@@ -170,7 +170,7 @@ public class VnfAdapterImplTest extends BaseTaskTest {
@Test
public void postProcessVnfAdapter_DeleteResponseTest_EmptyVfModuleOutputs() {
- execution.setVariable("vnfAdapterRestV1Response",
+ execution.setVariable("WorkflowResponse",
"<createVfModuleResponse><vfModuleOutputs></vfModuleOutputs></createVfModuleResponse>");
vnfAdapterImpl.postProcessVnfAdapter(execution);
assertNull(vfModule.getHeatStackId());
@@ -183,14 +183,14 @@ public class VnfAdapterImplTest extends BaseTaskTest {
@Test
public void postProcessVnfAdapter_ResponseNullTest() {
- execution.setVariable("vnfAdapterRestV1Response", null);
+ execution.setVariable("WorkflowResponse", null);
vnfAdapterImpl.postProcessVnfAdapter(execution);
assertNull(vfModule.getHeatStackId());
}
@Test
public void postProcessVnfAdapter_ResponseEmptyTest() {
- execution.setVariable("vnfAdapterRestV1Response", "");
+ execution.setVariable("WorkflowResponse", "");
vnfAdapterImpl.postProcessVnfAdapter(execution);
assertNull(vfModule.getHeatStackId());
}
@@ -198,7 +198,7 @@ public class VnfAdapterImplTest extends BaseTaskTest {
@Test
public void postProcessVnfAdapter_DeleteResponseTest_VfModuleDeletedFalse() {
vfModule.setHeatStackId(TEST_VFMODULE_HEATSTACK_ID);
- execution.setVariable("vnfAdapterRestV1Response",
+ execution.setVariable("WorkflowResponse",
"<deleteVfModuleResponse><vfModuleDeleted>false</vfModuleDeleted></deleteVfModuleResponse>");
vnfAdapterImpl.postProcessVnfAdapter(execution);
assertEquals(TEST_VFMODULE_HEATSTACK_ID, vfModule.getHeatStackId());
@@ -207,14 +207,14 @@ public class VnfAdapterImplTest extends BaseTaskTest {
@Test
public void postProcessVnfAdapter_DeleteResponseTest_EmptyDeleteVfModuleResponseTag() {
expectedException.expect(BpmnError.class);
- execution.setVariable("vnfAdapterRestV1Response", "<vfModuleDeleted></vfModuleDeleted>");
+ execution.setVariable("WorkflowResponse", "<vfModuleDeleted></vfModuleDeleted>");
vnfAdapterImpl.postProcessVnfAdapter(execution);
}
@Test
public void postProcessVnfAdapter_DeleteResponseTest_EmptyVfModuleDeletedTag() {
vfModule.setHeatStackId(TEST_VFMODULE_HEATSTACK_ID);
- execution.setVariable("vnfAdapterRestV1Response", "<deleteVfModuleResponse></deleteVfModuleResponse>");
+ execution.setVariable("WorkflowResponse", "<deleteVfModuleResponse></deleteVfModuleResponse>");
vnfAdapterImpl.postProcessVnfAdapter(execution);
assertEquals(TEST_VFMODULE_HEATSTACK_ID, vfModule.getHeatStackId());
}
@@ -230,7 +230,7 @@ public class VnfAdapterImplTest extends BaseTaskTest {
@Test
public void postProcessVnfAdapter_CreateVolumeResponseTest() {
- execution.setVariable("vnfAdapterRestV1Response", VNF_ADAPTER_VOLUME_CREATE_RESPONSE);
+ execution.setVariable("WorkflowResponse", VNF_ADAPTER_VOLUME_CREATE_RESPONSE);
vnfAdapterImpl.postProcessVnfAdapter(execution);
assertEquals(TEST_VOLUME_HEATSTACK_ID, volumeGroup.getHeatStackId());
}
@@ -238,7 +238,7 @@ public class VnfAdapterImplTest extends BaseTaskTest {
@Test
public void postProcessVnfAdapter_CreateVolumeEmptyResponseTest() {
expectedException.expect(BpmnError.class);
- execution.setVariable("vnfAdapterRestV1Response", "<createVolumeGroupResponse></createVolumeGroupResponse>");
+ execution.setVariable("WorkflowResponse", "<createVolumeGroupResponse></createVolumeGroupResponse>");
vnfAdapterImpl.postProcessVnfAdapter(execution);
assertNull(volumeGroup.getHeatStackId());
}
@@ -246,7 +246,7 @@ public class VnfAdapterImplTest extends BaseTaskTest {
@Test
public void postProcessVnfAdapter_DeleteResponseTest_DeleteVolumeGroup() {
volumeGroup.setHeatStackId(TEST_VOLUME_HEATSTACK_ID);
- execution.setVariable("vnfAdapterRestV1Response", VNF_ADAPTER_VOLUME_DELETE_RESPONSE);
+ execution.setVariable("WorkflowResponse", VNF_ADAPTER_VOLUME_DELETE_RESPONSE);
vnfAdapterImpl.postProcessVnfAdapter(execution);
assertNull(volumeGroup.getHeatStackId());
}
@@ -255,7 +255,7 @@ public class VnfAdapterImplTest extends BaseTaskTest {
@Test
public void postProcessVnfAdapter_DeleteResponseTest_VolumeGroupDeletedFalse() {
volumeGroup.setHeatStackId(TEST_VOLUME_HEATSTACK_ID);
- execution.setVariable("vnfAdapterRestV1Response",
+ execution.setVariable("WorkflowResponse",
"<deleteVolumeGroupResponse><volumeGroupDeleted>false</volumeGroupDeleted></deleteVolumeGroupResponse>");
vnfAdapterImpl.postProcessVnfAdapter(execution);
assertEquals(TEST_VOLUME_HEATSTACK_ID, volumeGroup.getHeatStackId());
@@ -264,14 +264,14 @@ public class VnfAdapterImplTest extends BaseTaskTest {
@Test
public void postProcessVnfAdapter_DeleteResponseTest_EmptyDeleteVolumeGroupResponseTag() {
expectedException.expect(BpmnError.class);
- execution.setVariable("vnfAdapterRestV1Response", "<volumeGroupDeleted></volumeGroupDeleted>");
+ execution.setVariable("WorkflowResponse", "<volumeGroupDeleted></volumeGroupDeleted>");
vnfAdapterImpl.postProcessVnfAdapter(execution);
}
@Test
public void postProcessVnfAdapter_DeleteResponseTest_EmptyVolumeGroupDeletedTag() {
volumeGroup.setHeatStackId(TEST_VOLUME_HEATSTACK_ID);
- execution.setVariable("vnfAdapterRestV1Response", "<deleteVolumeGroupResponse></deleteVolumeGroupResponse>");
+ execution.setVariable("WorkflowResponse", "<deleteVolumeGroupResponse></deleteVolumeGroupResponse>");
vnfAdapterImpl.postProcessVnfAdapter(execution);
assertEquals(TEST_VOLUME_HEATSTACK_ID, volumeGroup.getHeatStackId());
}
@@ -281,7 +281,7 @@ public class VnfAdapterImplTest extends BaseTaskTest {
doThrow(RuntimeException.class).when(extractPojosForBB).extractByKey(any(),
ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID));
- execution.setVariable("vnfAdapterRestV1Response", VNF_ADAPTER_REST_CREATE_RESPONSE);
+ execution.setVariable("WorkflowResponse", VNF_ADAPTER_REST_CREATE_RESPONSE);
expectedException.expect(BpmnError.class);
vnfAdapterImpl.postProcessVnfAdapter(execution);
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessorTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessorTest.java
index c78b652bd0..ea1f7b47ad 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessorTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessorTest.java
@@ -45,6 +45,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestParameters;
import org.onap.so.client.aai.entities.AAIResultWrapper;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.policy.JettisonStyleMapperProvider;
@@ -163,4 +164,46 @@ public class AppcOrchestratorPreProcessorTest extends BaseTaskTest {
genericVnf.setIpv4OamAddress("127.0.0.1");
return genericVnf;
}
+
+ @Test
+ public void buildAppcTaskRequestConfigModifyTest() throws Exception {
+ final String expectedRequestJson =
+ new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "appcTaskRequestConfigModify.json")));
+ ApplicationControllerTaskRequest expectedTaskRequest =
+ mapper.readValue(expectedRequestJson, ApplicationControllerTaskRequest.class);
+ execution.getLookupMap().put(ResourceKey.GENERIC_VNF_ID, "-TEST");
+ fillRequiredAppcExecutionFieldsConfigModify();
+ GenericVnf genericVnf = getTestGenericVnf();
+ when(extractPojosForBB.extractByKey(eq(execution), eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(genericVnf);
+ mockReferenceResponseForConfigModify();
+ execution.getLookupMap().put(ResourceKey.VF_MODULE_ID, "VF-MODULE-ID-TEST");
+ VfModule vfModule = new VfModule();
+ vfModule.setVfModuleId("VF-MODULE-ID");
+ when(extractPojosForBB.extractByKey(eq(execution), eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
+ appcOrchestratorPreProcessor.buildAppcTaskRequest(execution, "ConfigModify");
+ ApplicationControllerTaskRequest actualTaskRequest = execution.getVariable("appcOrchestratorRequest");
+ assertThat(actualTaskRequest, sameBeanAs(expectedTaskRequest));
+ }
+
+ private void fillRequiredAppcExecutionFieldsConfigModify() {
+ RequestContext context = new RequestContext();
+ RequestParameters requestParameters = new RequestParameters();
+ requestParameters.setPayload(
+ "{\"request_parameters\":{\"host_ip_address\":\"10.10.10.10\"},\"configuration_parameters\":{\"name1\":\"value1\",\"name2\":\"value2\"}}");
+ context.setRequestParameters(requestParameters);
+ context.setMsoRequestId("TEST-MSO-ID");
+ execution.setVariable("aicIdentity", "AIC-TEST");
+ execution.setVariable("vmIdList", "VM-ID-LIST-TEST");
+ execution.setVariable("vserverIdList", "VSERVER-ID-LIST");
+ execution.setVariable("identityUrl", "IDENTITY-URL-TEST");
+ execution.getGeneralBuildingBlock().setRequestContext(context);
+ }
+
+ private void mockReferenceResponseForConfigModify() {
+ ControllerSelectionReference reference = new ControllerSelectionReference();
+ reference.setControllerName("APPC");
+ when(catalogDbClient.getControllerSelectionReferenceByVnfTypeAndActionCategory(eq("TEST-VNF-TYPE"),
+ eq(Action.ConfigModify.toString()))).thenReturn(reference);
+ }
+
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasksTest.java
index b6dcd96534..e3bbd11cc4 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasksTest.java
@@ -100,7 +100,7 @@ public class ManualHandlingTasksTest extends BaseTaskTest {
when(mockExecution.getProcessEngineServices()).thenReturn(processEngineServices);
when(processEngineServices.getTaskService()).thenReturn(taskService);
manualHandlingTasks.setFalloutTaskVariables(task);
- verify(taskService, times(1)).setVariables(any(String.class), any(Map.class));
+ verify(taskService, times(1)).setVariablesLocal(any(String.class), any(Map.class));
}
@Test
@@ -110,7 +110,7 @@ public class ManualHandlingTasksTest extends BaseTaskTest {
when(mockExecution.getProcessEngineServices()).thenReturn(processEngineServices);
when(processEngineServices.getTaskService()).thenReturn(taskService);
manualHandlingTasks.setPauseTaskVariables(task);
- verify(taskService, times(1)).setVariables(any(String.class), any(Map.class));
+ verify(taskService, times(1)).setVariablesLocal(any(String.class), any(Map.class));
}
@Test
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java
index dc64e4ee48..1e58a83f0a 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java
@@ -138,6 +138,7 @@ public class AAIObjectMapperTest {
ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance();
modelInfoServiceInstance.setServiceType("SITYPE");
modelInfoServiceInstance.setServiceRole("SIROLE");
+ modelInfoServiceInstance.setServiceFunction("SIFUNCTION");
modelInfoServiceInstance.setModelInvariantUuid("MIUUID");
modelInfoServiceInstance.setModelUuid("MUUID");
modelInfoServiceInstance.setEnvironmentContext("EC");
@@ -163,6 +164,8 @@ public class AAIObjectMapperTest {
serviceInstance.getModelInfoServiceInstance().getEnvironmentContext());
assertEquals(AAIServiceInstance.getWorkloadContext(),
serviceInstance.getModelInfoServiceInstance().getWorkloadContext());
+ assertEquals(AAIServiceInstance.getServiceFunction(),
+ serviceInstance.getModelInfoServiceInstance().getServiceFunction());
}
@Test
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java
index 109dc55294..ccd4376a10 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapperTest.java
index a482da5158..9dfc245f68 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapperTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapperTest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/createNetworkRequest.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/createNetworkRequest.json
index 19d42dddb9..4c97dbc53c 100644
--- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/createNetworkRequest.json
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/createNetworkRequest.json
@@ -19,7 +19,7 @@
"allocationPools": [{
"start": "107.244.64.2",
"end": "107.244.64.16"
- }]
+ }]
}
],
"providerVlanNetwork": {
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleAddonRequest.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleAddonRequest.json
index b57c8341f1..3ba5627b38 100644
--- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleAddonRequest.json
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleAddonRequest.json
@@ -14,13 +14,13 @@
"backout": false,
"failIfExists": false,
"enableBridge": true,
- "msoRequest":
+ "msoRequest":
{
"requestId": "requestId",
"serviceInstanceId": "serviceInstanceId"
},
- "vfModuleParams":
+ "vfModuleParams":
{
"vnf_id": "vnfId",
"vnf_name": "vnfName",
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestWithCloudResources.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestWithCloudResources.json
index da826b8a89..3fbf026176 100644
--- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestWithCloudResources.json
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestWithCloudResources.json
@@ -12,13 +12,13 @@
"backout": false,
"failIfExists": false,
"enableBridge": true,
- "msoRequest":
+ "msoRequest":
{
"requestId": "requestId",
"serviceInstanceId": "serviceInstanceId"
},
- "vfModuleParams":
+ "vfModuleParams":
{
"environment_context": "environmentContext",
"key1": "value1",
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleWithVolumeGroupRequest.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleWithVolumeGroupRequest.json
index 54f6e403ed..9f554490bd 100644
--- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleWithVolumeGroupRequest.json
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleWithVolumeGroupRequest.json
@@ -14,13 +14,13 @@
"backout": false,
"failIfExists": false,
"enableBridge": true,
- "msoRequest":
+ "msoRequest":
{
"requestId": "requestId",
"serviceInstanceId": "serviceInstanceId"
},
- "vfModuleParams":
+ "vfModuleParams":
{
"vnf_id": "vnfId",
"vnf_name": "vnfName",
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/appcTaskRequestConfigModify.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/appcTaskRequestConfigModify.json
new file mode 100644
index 0000000000..040c680d1c
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/appcTaskRequestConfigModify.json
@@ -0,0 +1,13 @@
+{
+ "ApplicationControllerTaskRequest": {
+ "controllerType": "APPC",
+ "action": "ConfigModify",
+ "identityUrl": "IDENTITY-URL-TEST",
+ "applicationControllerVnf": {
+ "vnfId": "TEST-VNF-ID",
+ "vnfName": "TEST-VNF-NAME",
+ "vnfHostIpAddress": "127.0.0.1"
+ },
+ "configParams": {"name1":"value1", "name2":"value2"}
+}
+}
diff --git a/common/src/main/java/org/onap/so/appc/orchestrator/service/beans/ApplicationControllerTaskRequest.java b/common/src/main/java/org/onap/so/appc/orchestrator/service/beans/ApplicationControllerTaskRequest.java
index 3811b52551..c240957ae9 100644
--- a/common/src/main/java/org/onap/so/appc/orchestrator/service/beans/ApplicationControllerTaskRequest.java
+++ b/common/src/main/java/org/onap/so/appc/orchestrator/service/beans/ApplicationControllerTaskRequest.java
@@ -1,6 +1,8 @@
package org.onap.so.appc.orchestrator.service.beans;
import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
import org.onap.appc.client.lcm.model.Action;
import org.onap.so.appc.orchestrator.service.beans.ApplicationControllerVnf;
@@ -18,6 +20,15 @@ public class ApplicationControllerTaskRequest implements Serializable {
private String existingSoftwareVersion;
private String newSoftwareVersion;
private ApplicationControllerVnf applicationControllerVnf;
+ private Map<String, String> configParams = new HashMap<String, String>();
+
+ public Map<String, String> getConfigParams() {
+ return configParams;
+ }
+
+ public void setConfigParams(Map<String, String> configParams) {
+ this.configParams = configParams;
+ }
public Action getAction() {
return action;
diff --git a/common/src/main/java/org/onap/so/externaltasks/logging/AuditMDCSetup.java b/common/src/main/java/org/onap/so/logging/tasks/AuditMDCSetup.java
index 9f71e61e1f..8d98307a43 100644
--- a/common/src/main/java/org/onap/so/externaltasks/logging/AuditMDCSetup.java
+++ b/common/src/main/java/org/onap/so/logging/tasks/AuditMDCSetup.java
@@ -1,4 +1,4 @@
-package org.onap.so.externaltasks.logging;
+package org.onap.so.logging.tasks;
import java.time.ZoneOffset;
import java.time.ZonedDateTime;
@@ -53,4 +53,5 @@ public class AuditMDCSetup {
MDC.remove(ONAPLogConstants.MDCs.ELAPSED_TIME);
MDC.remove(ONAPLogConstants.MDCs.PARTNER_NAME);
}
+
}
diff --git a/common/src/main/java/org/onap/so/utils/ExternalTaskServiceUtils.java b/common/src/main/java/org/onap/so/utils/ExternalTaskServiceUtils.java
index 035ad1dc81..840a978a61 100644
--- a/common/src/main/java/org/onap/so/utils/ExternalTaskServiceUtils.java
+++ b/common/src/main/java/org/onap/so/utils/ExternalTaskServiceUtils.java
@@ -51,7 +51,12 @@ public class ExternalTaskServiceUtils {
}
public int getMaxClients() {
- return Integer.parseInt(env.getProperty("workflow.topics.maxClients", "3"));
+ return Integer.parseInt(env.getProperty("workflow.topics.maxClients", "10"));
+ }
+
+ public Long getLockDuration() {
+ Long lockDuration = Long.parseLong(env.getProperty("mso.audit.lock-time", "60000"));
+ return lockDuration;
}
@ScheduledLogging
diff --git a/common/src/main/java/org/onap/so/utils/ExternalTaskUtils.java b/common/src/main/java/org/onap/so/utils/ExternalTaskUtils.java
index 9488187003..d414135570 100644
--- a/common/src/main/java/org/onap/so/utils/ExternalTaskUtils.java
+++ b/common/src/main/java/org/onap/so/utils/ExternalTaskUtils.java
@@ -9,11 +9,11 @@ import org.springframework.stereotype.Component;
@Component
public abstract class ExternalTaskUtils {
+ private static final Logger logger = LoggerFactory.getLogger(ExternalTaskUtils.class);
+
@Autowired
Environment env;
- private static final Logger logger = LoggerFactory.getLogger(ExternalTaskUtils.class);
-
private final RetrySequenceLevel retrySequenceLevel;
public ExternalTaskUtils() {
@@ -49,7 +49,7 @@ public abstract class ExternalTaskUtils {
return seqInter;
case LONG:
String[] seqLong = {"1", "1", "2", "3", "5", "8", "13", "20"};
- if (env.getProperty("mso.workflow.topics.retrySequence") != null) {
+ if (env.getProperty("mso.workflow.topics.retrySequence.long") != null) {
seqLong = env.getProperty("mso.workflow.topics.retrySequence", String[].class);
}
return seqLong;
diff --git a/common/src/test/java/org/onap/so/externaltasks/logging/AuditMDCSetupTest.java b/common/src/test/java/org/onap/so/logging/tasks/MDCSetupTest.java
index c4609f0336..929db79910 100644
--- a/common/src/test/java/org/onap/so/externaltasks/logging/AuditMDCSetupTest.java
+++ b/common/src/test/java/org/onap/so/logging/tasks/MDCSetupTest.java
@@ -1,4 +1,4 @@
-package org.onap.so.externaltasks.logging;
+package org.onap.so.logging.tasks;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
@@ -11,28 +11,27 @@ import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Spy;
-import org.mockito.junit.MockitoJUnitRunner;
-import org.onap.logging.filter.base.MDCSetup;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.logger.MdcConstants;
import org.slf4j.MDC;
+import org.mockito.junit.MockitoJUnitRunner;
@RunWith(MockitoJUnitRunner.class)
-public class AuditMDCSetupTest {
+public class MDCSetupTest {
@Mock
- private ExternalTask externalTask;
+ private org.onap.logging.filter.base.MDCSetup mdcSet;
@Mock
- private MDCSetup mdcSet;
-
- @Spy
- @InjectMocks
- private AuditMDCSetup mdcSetup;
+ private ExternalTask externalTask;
private String requestId = "9bb86b8d-a02f-4a0b-81a9-2eb963850009";
private String serviceName = "testServiceName";
+ @Spy
+ @InjectMocks
+ AuditMDCSetup setup = new AuditMDCSetup();
+
@After
public void tearDown() {
MDC.clear();
@@ -43,7 +42,7 @@ public class AuditMDCSetupTest {
doReturn(requestId).when(externalTask).getVariable("mso-request-id");
doReturn(serviceName).when(externalTask).getTopicName();
- mdcSetup.setupMDC(externalTask);
+ setup.setupMDC(externalTask);
assertNotNull(MDC.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP));
assertEquals(requestId, MDC.get(ONAPLogConstants.MDCs.REQUEST_ID));
@@ -57,14 +56,14 @@ public class AuditMDCSetupTest {
public void setElapsedTimeTest() {
MDC.put(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP, "2019-06-18T02:09:06.024Z");
- mdcSetup.setElapsedTime();
+ setup.setElapsedTime();
assertNotNull(MDC.get(ONAPLogConstants.MDCs.ELAPSED_TIME));
}
@Test
public void setResponseCodeTest() {
- mdcSetup.setResponseCode(ONAPLogConstants.ResponseStatus.INPROGRESS.toString());
+ setup.setResponseCode(ONAPLogConstants.ResponseStatus.INPROGRESS.toString());
assertEquals(ONAPLogConstants.ResponseStatus.INPROGRESS.toString(),
MDC.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE));
@@ -80,7 +79,7 @@ public class AuditMDCSetupTest {
MDC.put(ONAPLogConstants.MDCs.ELAPSED_TIME, "318");
MDC.put(ONAPLogConstants.MDCs.PARTNER_NAME, "SO.OPENSTACK_ADAPTER");
- mdcSetup.clearClientMDCs();
+ setup.clearClientMDCs();
assertNull(MDC.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE));
assertNull(MDC.get(MdcConstants.OPENSTACK_STATUS_CODE));
diff --git a/common/src/test/java/org/onap/so/utils/ExternalTaskUtilsTest.java b/common/src/test/java/org/onap/so/utils/ExternalTaskUtilsTest.java
index e27caa6458..6c2dbb666c 100644
--- a/common/src/test/java/org/onap/so/utils/ExternalTaskUtilsTest.java
+++ b/common/src/test/java/org/onap/so/utils/ExternalTaskUtilsTest.java
@@ -1,11 +1,13 @@
package org.onap.so.utils;
import static org.junit.Assert.assertEquals;
+import org.camunda.bpm.client.task.ExternalTask;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
+import org.mockito.Spy;
import org.mockito.junit.MockitoJUnitRunner;
import org.springframework.core.env.Environment;
@@ -13,6 +15,9 @@ import org.springframework.core.env.Environment;
public class ExternalTaskUtilsTest {
@Mock
+ private ExternalTask externalTask;
+
+ @Mock
private Environment mockenv;
@InjectMocks
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 f1e8e711c4..418ba05abf 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
@@ -40,6 +40,7 @@ import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.apache.commons.lang.StringUtils;
import org.apache.http.HttpStatus;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.apihandler.common.CommonConstants;
import org.onap.so.apihandler.common.ErrorNumbers;
import org.onap.so.apihandler.common.RequestClientParameter;
@@ -56,7 +57,6 @@ import org.onap.so.db.catalog.client.CatalogDbClient;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.client.RequestsDbClient;
import org.onap.so.exceptions.ValidationException;
-import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.onap.so.serviceinstancebeans.CloudConfiguration;
import org.onap.so.serviceinstancebeans.ModelInfo;
@@ -823,7 +823,7 @@ public class ServiceInstances extends AbstractRestHandler {
sir = requestHandlerUtils.convertJsonToServiceInstanceRequest(requestJSON, action, requestId, requestUri);
action = handleReplaceInstance(action, sir);
- requestValidatorListenerRunner.runValidations(requestUri, instanceIdMap, sir, queryParams);
+ requestValidatorListenerRunner.runValidations(requestUri, instanceIdMap, sir, queryParams, action);
String requestScope = requestHandlerUtils.deriveRequestScope(action, sir, requestUri);
InfraActiveRequests currentActiveReq =
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/AAIDataRetrieval.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/AAIDataRetrieval.java
index fee7a3a8f4..4e3d8736c2 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/AAIDataRetrieval.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/AAIDataRetrieval.java
@@ -9,6 +9,7 @@ import org.onap.aai.domain.yang.Tenant;
import org.onap.aai.domain.yang.VfModule;
import org.onap.aai.domain.yang.VolumeGroup;
import org.onap.so.apihandlerinfra.infra.rest.exception.AAIEntityNotFound;
+import org.onap.so.client.aai.AAIObjectPlurals;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.AAIResourcesClient;
import org.onap.so.client.aai.entities.AAIResultWrapper;
@@ -76,6 +77,40 @@ public class AAIDataRetrieval {
});
}
+
+ public boolean isVolumeGroupRelatedToVFModule(String volumeGroupId) {
+ return this.getAaiResourcesClient().exists(AAIUriFactory
+ .createResourceUri(AAIObjectType.VOLUME_GROUP, volumeGroupId).relatedTo(AAIObjectPlurals.VF_MODULE));
+ }
+
+ public boolean isVnfRelatedToVolumes(String vnfId) {
+ return this.getAaiResourcesClient().exists(AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
+ .relatedTo(AAIObjectPlurals.VOLUME_GROUP));
+ }
+
+ public boolean isNetworkRelatedToModules(String networkId) {
+ return this.getAaiResourcesClient().exists(AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, networkId)
+ .relatedTo(AAIObjectPlurals.VF_MODULE));
+ }
+
+ public boolean isServiceRelatedToNetworks(String serviceInstanceId) {
+ return this.getAaiResourcesClient()
+ .exists(AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId)
+ .relatedTo(AAIObjectPlurals.L3_NETWORK));
+ }
+
+ public boolean isServiceRelatedToGenericVnf(String serviceInstanceId) {
+ return this.getAaiResourcesClient()
+ .exists(AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId)
+ .relatedTo(AAIObjectPlurals.GENERIC_VNF));
+ }
+
+ public boolean isServiceRelatedToConfiguration(String serviceInstanceId) {
+ return this.getAaiResourcesClient()
+ .exists(AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId)
+ .relatedTo(AAIObjectPlurals.CONFIGURATION));
+ }
+
public Service getService(String serviceId) {
return this.getAaiResourcesClient()
.get(Service.class, AAIUriFactory.createResourceUri(AAIObjectType.SERVICE, serviceId)).orElseGet(() -> {
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/NetworkDeleteValidator.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/NetworkDeleteValidator.java
new file mode 100644
index 0000000000..f75897dda1
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/NetworkDeleteValidator.java
@@ -0,0 +1,34 @@
+package org.onap.so.apihandlerinfra.infra.rest.validators;
+
+import java.util.Map;
+import java.util.Optional;
+import java.util.regex.Pattern;
+import org.onap.so.apihandlerinfra.Action;
+import org.onap.so.apihandlerinfra.Actions;
+import org.onap.so.apihandlerinfra.infra.rest.AAIDataRetrieval;
+import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
+import org.springframework.beans.factory.annotation.Autowired;
+
+
+public class NetworkDeleteValidator implements RequestValidator {
+
+ @Autowired
+ AAIDataRetrieval aaiDataRetrieval;
+
+ @Override
+ public boolean shouldRunFor(String requestUri, ServiceInstancesRequest request, Actions action) {
+ return Pattern.compile("[Vv][5-8]/serviceInstances/[^/]+/networks/[^/]+").matcher(requestUri).matches()
+ && action.equals(Action.deleteInstance);
+
+ }
+
+ @Override
+ public Optional<String> validate(Map<String, String> instanceIdMap, ServiceInstancesRequest request,
+ Map<String, String> queryParams) {
+ if (aaiDataRetrieval.isNetworkRelatedToModules(instanceIdMap.get("networkInstanceId"))) {
+ return Optional.of("Cannot delete network it is still related to existing vf-modules");
+ } else {
+ return Optional.empty();
+ }
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/RequestValidator.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/RequestValidator.java
index 4aa60152dd..1dea57ad9c 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/RequestValidator.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/RequestValidator.java
@@ -22,6 +22,7 @@ package org.onap.so.apihandlerinfra.infra.rest.validators;
import java.util.Map;
import java.util.Optional;
+import org.onap.so.apihandlerinfra.Actions;
import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
public interface RequestValidator {
@@ -32,7 +33,7 @@ public interface RequestValidator {
*
* @return
*/
- public boolean shouldRunFor(String uri, ServiceInstancesRequest request);
+ public boolean shouldRunFor(String uri, ServiceInstancesRequest request, Actions action);
public Optional<String> validate(Map<String, String> instanceIdMap, ServiceInstancesRequest request,
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/RequestValidatorListenerRunner.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/RequestValidatorListenerRunner.java
index d689c6b7a5..3aba39b501 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/RequestValidatorListenerRunner.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/RequestValidatorListenerRunner.java
@@ -28,6 +28,7 @@ import java.util.Optional;
import java.util.stream.Collectors;
import javax.annotation.PostConstruct;
import org.javatuples.Pair;
+import org.onap.so.apihandlerinfra.Actions;
import org.onap.so.apihandlerinfra.exceptions.ApiException;
import org.onap.so.apihandlerinfra.exceptions.ValidateException;
import org.onap.so.listener.ListenerRunner;
@@ -50,10 +51,10 @@ public class RequestValidatorListenerRunner extends ListenerRunner {
}
public boolean runValidations(String requestURI, Map<String, String> instanceIdMap, ServiceInstancesRequest request,
- Map<String, String> queryParams) throws ApiException {
+ Map<String, String> queryParams, Actions action) throws ApiException {
logger.info("Running local validations");
List<Pair<String, Optional<String>>> results =
- runValidations(requestValidators, instanceIdMap, request, queryParams, requestURI);
+ runValidations(requestValidators, instanceIdMap, request, queryParams, requestURI, action);
if (!results.isEmpty()) {
throw new ValidateException("Failed Validations:\n"
+ results.stream().map(item -> String.format("%s: %s", item.getValue0(), item.getValue1().get()))
@@ -66,10 +67,10 @@ public class RequestValidatorListenerRunner extends ListenerRunner {
protected List<Pair<String, Optional<String>>> runValidations(List<? extends RequestValidator> validators,
Map<String, String> instanceIdMap, ServiceInstancesRequest request, Map<String, String> queryParams,
- String requestURI) {
+ String requestURI, Actions action) {
List<? extends RequestValidator> filtered =
- filterListeners(validators, (item -> item.shouldRunFor(requestURI, request)));
+ filterListeners(validators, (item -> item.shouldRunFor(requestURI, request, action)));
List<Pair<String, Optional<String>>> results = new ArrayList<>();
filtered.forEach(item -> results
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/ServiceInstanceDeleteValidator.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/ServiceInstanceDeleteValidator.java
new file mode 100644
index 0000000000..0c7ba65cf4
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/ServiceInstanceDeleteValidator.java
@@ -0,0 +1,38 @@
+package org.onap.so.apihandlerinfra.infra.rest.validators;
+
+import java.util.Map;
+import java.util.Optional;
+import java.util.regex.Pattern;
+import org.onap.so.apihandlerinfra.Action;
+import org.onap.so.apihandlerinfra.Actions;
+import org.onap.so.apihandlerinfra.infra.rest.AAIDataRetrieval;
+import org.onap.so.listener.Skip;
+import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
+import org.springframework.beans.factory.annotation.Autowired;
+
+@Skip
+public class ServiceInstanceDeleteValidator implements RequestValidator {
+
+ @Autowired
+ AAIDataRetrieval aaiDataRetrieval;
+
+ @Override
+ public boolean shouldRunFor(String requestUri, ServiceInstancesRequest request, Actions action) {
+ return Pattern.compile("[Vv][5-8]/serviceInstances/[^/]+").matcher(requestUri).matches()
+ && action.equals(Action.deleteInstance);
+ }
+
+ @Override
+ public Optional<String> validate(Map<String, String> instanceIdMap, ServiceInstancesRequest request,
+ Map<String, String> queryParams) {
+ if (aaiDataRetrieval.isServiceRelatedToGenericVnf(instanceIdMap.get("serviceInstanceId"))) {
+ return Optional.of("Cannot delete service it is still related to existing vf-modules");
+ } else if (aaiDataRetrieval.isServiceRelatedToNetworks(instanceIdMap.get("serviceInstanceId"))) {
+ return Optional.of("Cannot delete service it is still related to existing networks");
+ } else if (aaiDataRetrieval.isServiceRelatedToConfiguration(instanceIdMap.get("serviceInstanceId"))) {
+ return Optional.of("Cannot delete service it is still related to existing configurations");
+ } else {
+ return Optional.empty();
+ }
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/VnfDeleteValidator.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/VnfDeleteValidator.java
new file mode 100644
index 0000000000..d54e60d153
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/VnfDeleteValidator.java
@@ -0,0 +1,34 @@
+package org.onap.so.apihandlerinfra.infra.rest.validators;
+
+import java.util.Map;
+import java.util.Optional;
+import java.util.regex.Pattern;
+import org.onap.so.apihandlerinfra.Action;
+import org.onap.so.apihandlerinfra.Actions;
+import org.onap.so.apihandlerinfra.infra.rest.AAIDataRetrieval;
+import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
+import org.springframework.beans.factory.annotation.Autowired;
+
+
+public class VnfDeleteValidator implements RequestValidator {
+
+ @Autowired
+ AAIDataRetrieval aaiDataRetrieval;
+
+ @Override
+ public boolean shouldRunFor(String requestUri, ServiceInstancesRequest request, Actions action) {
+ return Pattern.compile("[Vv][5-8]/serviceInstances/[^/]+/vnfs/[^/]+").matcher(requestUri).matches()
+ && action.equals(Action.deleteInstance);
+ }
+
+ @Override
+ public Optional<String> validate(Map<String, String> instanceIdMap, ServiceInstancesRequest request,
+ Map<String, String> queryParams) {
+ if (aaiDataRetrieval.isVnfRelatedToVolumes(instanceIdMap.get("vnfInstanceId"))) {
+ return Optional.of("Cannot delete vnf it is still related to existing volume groups");
+ } else {
+ return Optional.empty();
+ }
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/VolumeGroupDeleteValidator.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/VolumeGroupDeleteValidator.java
new file mode 100644
index 0000000000..f010d47f70
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/VolumeGroupDeleteValidator.java
@@ -0,0 +1,33 @@
+package org.onap.so.apihandlerinfra.infra.rest.validators;
+
+import java.util.Map;
+import java.util.Optional;
+import java.util.regex.Pattern;
+import org.onap.so.apihandlerinfra.Action;
+import org.onap.so.apihandlerinfra.Actions;
+import org.onap.so.apihandlerinfra.infra.rest.AAIDataRetrieval;
+import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public class VolumeGroupDeleteValidator implements RequestValidator {
+
+ @Autowired
+ AAIDataRetrieval aaiDataRetrieval;
+
+ @Override
+ public boolean shouldRunFor(String requestUri, ServiceInstancesRequest request, Actions action) {
+ return Pattern.compile("[Vv][5-8]/serviceInstances/[^/]+/volumeGroups/[^/]+").matcher(requestUri).matches()
+ && action.equals(Action.deleteInstance);
+ }
+
+ @Override
+ public Optional<String> validate(Map<String, String> instanceIdMap, ServiceInstancesRequest request,
+ Map<String, String> queryParams) {
+ if (aaiDataRetrieval.isVolumeGroupRelatedToVFModule(instanceIdMap.get("volumeGroupInstanceId"))) {
+ return Optional.of("Cannot delete volume group it is related to existing vf-modules");
+ } else {
+ return Optional.empty();
+ }
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/validator/NetworkDeleteValidatorTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/validator/NetworkDeleteValidatorTest.java
new file mode 100644
index 0000000000..7780f0ee2b
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/validator/NetworkDeleteValidatorTest.java
@@ -0,0 +1,73 @@
+package org.onap.so.apihandlerinfra.infra.rest.validator;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.when;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Optional;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Spy;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.so.apihandlerinfra.Action;
+import org.onap.so.apihandlerinfra.infra.rest.AAIDataRetrieval;
+import org.onap.so.apihandlerinfra.infra.rest.validators.NetworkDeleteValidator;
+import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
+
+
+@RunWith(MockitoJUnitRunner.class)
+public class NetworkDeleteValidatorTest {
+
+
+ @InjectMocks
+ @Spy
+ private NetworkDeleteValidator networkValidator;
+
+ @Mock
+ private AAIDataRetrieval aaiDataRetrieval;
+
+ private Map<String, String> instanceIdMap = new HashMap<>();
+
+ @Test
+ public void validateURIMatchTest() {
+ assertEquals(true, networkValidator.shouldRunFor("v8/serviceInstances/uasdfasdf/networks/asdfasdf",
+ new ServiceInstancesRequest(), Action.deleteInstance));
+ }
+
+ @Test
+ public void validateURINotMatchTest() {
+ assertEquals(false, networkValidator.shouldRunFor("v8/serviceInstances/uasdfasdf/vnfs/asdfasdf",
+ new ServiceInstancesRequest(), Action.deleteInstance));
+ }
+
+ @Test
+ public void validateURINotMatch2Test() {
+ assertEquals(false, networkValidator.shouldRunFor("v8/serviceInstances/uasdfasdf/networks/asdfasdf/update",
+ new ServiceInstancesRequest(), Action.deleteInstance));
+ }
+
+ @Test
+ public void validateURINotMatchActionTest() {
+ assertEquals(false, networkValidator.shouldRunFor("v8/serviceInstances/uasdfasdf/networks/asdfasdf",
+ new ServiceInstancesRequest(), Action.createInstance));
+ }
+
+ @Test
+ public void validateSuccessTest() {
+ instanceIdMap.put("networkInstanceId", "1");
+ when(aaiDataRetrieval.isNetworkRelatedToModules("1")).thenReturn(false);
+ Optional<String> result = networkValidator.validate(instanceIdMap, null, null);
+ assertEquals(false, result.isPresent());
+ }
+
+ @Test
+ public void validateFailureTest() {
+ instanceIdMap.put("networkInstanceId", "1");
+ when(aaiDataRetrieval.isNetworkRelatedToModules("1")).thenReturn(true);
+ Optional<String> result = networkValidator.validate(instanceIdMap, null, null);
+ assertEquals(true, result.isPresent());
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/validator/ServiceInstanceDeleteValidatorTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/validator/ServiceInstanceDeleteValidatorTest.java
new file mode 100644
index 0000000000..c334d522b6
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/validator/ServiceInstanceDeleteValidatorTest.java
@@ -0,0 +1,88 @@
+package org.onap.so.apihandlerinfra.infra.rest.validator;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.when;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Optional;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Spy;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.so.apihandlerinfra.Action;
+import org.onap.so.apihandlerinfra.infra.rest.AAIDataRetrieval;
+import org.onap.so.apihandlerinfra.infra.rest.validators.ServiceInstanceDeleteValidator;
+import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
+
+
+@RunWith(MockitoJUnitRunner.class)
+public class ServiceInstanceDeleteValidatorTest {
+
+
+ @InjectMocks
+ @Spy
+ private ServiceInstanceDeleteValidator serviceValidator;
+
+ @Mock
+ private AAIDataRetrieval aaiDataRetrieval;
+
+ private Map<String, String> instanceIdMap = new HashMap<>();
+
+ @Test
+ public void validateURIMatchTest() {
+ assertEquals(true, serviceValidator.shouldRunFor("v8/serviceInstances/uasdfasdf", new ServiceInstancesRequest(),
+ Action.deleteInstance));
+ }
+
+ @Test
+ public void validateURINotMatchTest() {
+ assertEquals(false, serviceValidator.shouldRunFor("v8/serviceInstances/uasdfasdf/vnfs/asdfasdf",
+ new ServiceInstancesRequest(), Action.deleteInstance));
+ }
+
+ @Test
+ public void validateURINotMatch2Test() {
+ assertEquals(false, serviceValidator.shouldRunFor("v8/serviceInstances/uasdfasdf/update",
+ new ServiceInstancesRequest(), Action.deleteInstance));
+ }
+
+ @Test
+ public void validateSuccessTest() {
+ instanceIdMap.put("serviceInstanceId", "1");
+ when(aaiDataRetrieval.isServiceRelatedToGenericVnf("1")).thenReturn(false);
+ when(aaiDataRetrieval.isServiceRelatedToNetworks("1")).thenReturn(false);
+ when(aaiDataRetrieval.isServiceRelatedToConfiguration("1")).thenReturn(false);
+ Optional<String> result = serviceValidator.validate(instanceIdMap, null, null);
+ assertEquals(false, result.isPresent());
+ }
+
+ @Test
+ public void validateFailureVnfTest() {
+ instanceIdMap.put("serviceInstanceId", "1");
+ when(aaiDataRetrieval.isServiceRelatedToGenericVnf("1")).thenReturn(true);
+ Optional<String> result = serviceValidator.validate(instanceIdMap, null, null);
+ assertEquals(true, result.isPresent());
+ }
+
+ @Test
+ public void validateFailureNetworksTest() {
+ instanceIdMap.put("serviceInstanceId", "1");
+ when(aaiDataRetrieval.isServiceRelatedToGenericVnf("1")).thenReturn(false);
+ when(aaiDataRetrieval.isServiceRelatedToNetworks("1")).thenReturn(true);
+ Optional<String> result = serviceValidator.validate(instanceIdMap, null, null);
+ assertEquals(true, result.isPresent());
+ }
+
+ @Test
+ public void validateFailureConfigurationTest() {
+ instanceIdMap.put("serviceInstanceId", "1");
+ when(aaiDataRetrieval.isServiceRelatedToGenericVnf("1")).thenReturn(false);
+ when(aaiDataRetrieval.isServiceRelatedToNetworks("1")).thenReturn(false);
+ when(aaiDataRetrieval.isServiceRelatedToConfiguration("1")).thenReturn(true);
+ Optional<String> result = serviceValidator.validate(instanceIdMap, null, null);
+ assertEquals(true, result.isPresent());
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/validator/VnfDeleteValidatorTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/validator/VnfDeleteValidatorTest.java
new file mode 100644
index 0000000000..d4f57d3146
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/validator/VnfDeleteValidatorTest.java
@@ -0,0 +1,67 @@
+package org.onap.so.apihandlerinfra.infra.rest.validator;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.when;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Optional;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Spy;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.so.apihandlerinfra.Action;
+import org.onap.so.apihandlerinfra.infra.rest.AAIDataRetrieval;
+import org.onap.so.apihandlerinfra.infra.rest.validators.VnfDeleteValidator;
+import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
+
+
+@RunWith(MockitoJUnitRunner.class)
+public class VnfDeleteValidatorTest {
+
+
+ @InjectMocks
+ @Spy
+ private VnfDeleteValidator vnfValidator;
+
+ @Mock
+ private AAIDataRetrieval aaiDataRetrieval;
+
+ private Map<String, String> instanceIdMap = new HashMap<>();
+
+ @Test
+ public void validateURIMatchTest() {
+ assertEquals(true, vnfValidator.shouldRunFor("v8/serviceInstances/uasdfasdf/vnfs/asdfasdf",
+ new ServiceInstancesRequest(), Action.deleteInstance));
+ }
+
+ @Test
+ public void validateURINotMatchTest() {
+ assertEquals(false, vnfValidator.shouldRunFor("v8/serviceInstances/uasdfasdf/vnfs/asdfasdf/replace",
+ new ServiceInstancesRequest(), Action.deleteInstance));
+ }
+
+ @Test
+ public void validateURINotMatch2Test() {
+ assertEquals(false, vnfValidator.shouldRunFor("v8/serviceInstances/uasdfasdf", new ServiceInstancesRequest(),
+ Action.deleteInstance));
+ }
+
+ @Test
+ public void validateSuccessTest() {
+ instanceIdMap.put("vnfInstanceId", "1");
+ when(aaiDataRetrieval.isVnfRelatedToVolumes("1")).thenReturn(false);
+ Optional<String> result = vnfValidator.validate(instanceIdMap, null, null);
+ assertEquals(false, result.isPresent());
+ }
+
+ @Test
+ public void validateFailureVnfTest() {
+ instanceIdMap.put("vnfInstanceId", "1");
+ when(aaiDataRetrieval.isVnfRelatedToVolumes("1")).thenReturn(true);
+ Optional<String> result = vnfValidator.validate(instanceIdMap, null, null);
+ assertEquals(true, result.isPresent());
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/validator/VolumeGroupDeleteValidatorTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/validator/VolumeGroupDeleteValidatorTest.java
new file mode 100644
index 0000000000..3d81ee66c9
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/validator/VolumeGroupDeleteValidatorTest.java
@@ -0,0 +1,69 @@
+package org.onap.so.apihandlerinfra.infra.rest.validator;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.when;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Optional;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Spy;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.so.apihandlerinfra.Action;
+import org.onap.so.apihandlerinfra.infra.rest.AAIDataRetrieval;
+import org.onap.so.apihandlerinfra.infra.rest.validators.VolumeGroupDeleteValidator;
+import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
+
+
+@RunWith(MockitoJUnitRunner.class)
+public class VolumeGroupDeleteValidatorTest {
+
+
+ @InjectMocks
+ @Spy
+ private VolumeGroupDeleteValidator volumeGroupDeleteValidator;
+
+ @Mock
+ private AAIDataRetrieval aaiDataRetrieval;
+
+ private Map<String, String> instanceIdMap = new HashMap<>();
+
+ @Test
+ public void validateURIMatchTest() {
+ assertEquals(true, volumeGroupDeleteValidator.shouldRunFor("v8/serviceInstances/uasdfasdf/volumeGroups/uuid",
+ new ServiceInstancesRequest(), Action.deleteInstance));
+ }
+
+ @Test
+ public void validateURINotMatchTest() {
+ assertEquals(false,
+ volumeGroupDeleteValidator.shouldRunFor(
+ "v8/serviceInstances/uasdfasdf/vnfs/asdfasdf/volumeGroups/uuid/replace",
+ new ServiceInstancesRequest(), Action.deleteInstance));
+ }
+
+ @Test
+ public void validateURINotMatch2Test() {
+ assertEquals(false, volumeGroupDeleteValidator.shouldRunFor("v8/serviceInstances/uasdfasdf/vnfs/uuid",
+ new ServiceInstancesRequest(), Action.deleteInstance));
+ }
+
+ @Test
+ public void validateSuccessTest() {
+ instanceIdMap.put("volumeGroupInstanceId", "1");
+ when(aaiDataRetrieval.isVolumeGroupRelatedToVFModule("1")).thenReturn(false);
+ Optional<String> result = volumeGroupDeleteValidator.validate(instanceIdMap, null, null);
+ assertEquals(false, result.isPresent());
+ }
+
+ @Test
+ public void validateFailureVnfTest() {
+ instanceIdMap.put("volumeGroupInstanceId", "1");
+ when(aaiDataRetrieval.isVolumeGroupRelatedToVFModule("1")).thenReturn(true);
+ Optional<String> result = volumeGroupDeleteValidator.validate(instanceIdMap, null, null);
+ assertEquals(true, result.isPresent());
+ }
+
+}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudSite.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudSite.java
index deaa2a3221..0d7fe7d38f 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudSite.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudSite.java
@@ -93,6 +93,11 @@ public class CloudSite {
@Column(name = "CLOUDIFY_ID")
private String cloudifyId;
+ @JsonProperty("cloud_owner")
+ @BusinessKey
+ @Column(name = "CLOUD_OWNER")
+ private String cloudOwner;
+
// Derived property (set by CloudConfig loader based on identityServiceId)
@BusinessKey
@OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
@@ -266,12 +271,20 @@ public class CloudSite {
this.identityServiceId = identityServiceId;
}
+ public String getCloudOwner() {
+ return cloudOwner;
+ }
+
+ public void setCloudOwner(String cloudOwner) {
+ this.cloudOwner = cloudOwner;
+ }
+
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).append("regionId", getRegionId())
.append("identityServiceId", getIdentityServiceId()).append("cloudVersion", getCloudVersion())
.append("clli", getClli()).append("cloudifyId", getCloudifyId()).append("platform", getPlatform())
- .append("orchestrator", getOrchestrator()).toString();
+ .append("orchestrator", getOrchestrator()).append("cloud-owner", getCloudOwner()).toString();
}
@Override
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CvnfcConfigurationCustomization.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CvnfcConfigurationCustomization.java
index 05d43d093c..33994bae8b 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CvnfcConfigurationCustomization.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CvnfcConfigurationCustomization.java
@@ -78,11 +78,11 @@ public class CvnfcConfigurationCustomization implements Serializable {
@Temporal(TemporalType.TIMESTAMP)
private Date created;
- @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
+ @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
@JoinColumn(name = "CONFIGURATION_MODEL_UUID")
private ConfigurationResource configurationResource;
- @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
+ @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
@JoinColumn(name = "CVNFC_CUSTOMIZATION_ID")
private CvnfcCustomization cvnfcCustomization;
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CvnfcCustomization.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CvnfcCustomization.java
index 7fb328fdb5..9bf0cdd6a7 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CvnfcCustomization.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CvnfcCustomization.java
@@ -92,11 +92,11 @@ public class CvnfcCustomization implements Serializable {
@Temporal(TemporalType.TIMESTAMP)
private Date created;
- @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
+ @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
@JoinColumn(name = "VF_MODULE_CUSTOMIZATION_ID")
private VfModuleCustomization vfModuleCustomization;
- @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
+ @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
@JoinColumn(name = "VNFC_CUST_MODEL_CUSTOMIZATION_UUID")
private VnfcCustomization vnfcCustomization;
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/NetworkTechnologyReference.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/NetworkTechnologyReference.java
new file mode 100644
index 0000000000..1f19dcc1dd
--- /dev/null
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/NetworkTechnologyReference.java
@@ -0,0 +1,101 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 Tech Mahindra
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.db.catalog.beans;
+
+import java.io.Serializable;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import com.openpojo.business.annotation.BusinessKey;
+
+@Entity
+@Table(name = "network_technology_reference")
+public class NetworkTechnologyReference implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ @Id
+ @Column(name = "ID", nullable = false, updatable = false)
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ private Integer id;
+
+ @BusinessKey
+ @Column(name = "cloud_owner")
+ private String cloudOwner;
+
+ @BusinessKey
+ @Column(name = "network_technology")
+ private String networkTechnology;
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("id", id).append("cloudOwner", cloudOwner)
+ .append("networkTechnology", networkTechnology).toString();
+ }
+
+ @Override
+ public boolean equals(final Object other) {
+ if (!(other instanceof NetworkTechnologyReference)) {
+ return false;
+ }
+ NetworkTechnologyReference castOther = (NetworkTechnologyReference) other;
+ return new EqualsBuilder().append(cloudOwner, castOther.cloudOwner)
+ .append(networkTechnology, castOther.networkTechnology).isEquals();
+ }
+
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder().append(cloudOwner).append(networkTechnology).toHashCode();
+ }
+
+ public static long getSerialversionuid() {
+ return serialVersionUID;
+ }
+
+ public Integer getId() {
+ return id;
+ }
+
+ public String getCloudOwner() {
+ return cloudOwner;
+ }
+
+ public void setCloudOwner(String cloudOwner) {
+ this.cloudOwner = cloudOwner;
+ }
+
+ public String getNetworkTechnology() {
+ return networkTechnology;
+ }
+
+ public void setNetworkTechnology(String networkTechnology) {
+ this.networkTechnology = networkTechnology;
+ }
+
+
+
+}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/Service.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/Service.java
index 0d7a6dbd1f..8222b72d8f 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/Service.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/Service.java
@@ -79,6 +79,9 @@ public class Service implements Serializable {
@Column(name = "SERVICE_ROLE")
private String serviceRole;
+ @Column(name = "SERVICE_FUNCTION")
+ private String serviceFunction;
+
@Column(name = "ENVIRONMENT_CONTEXT")
private String environmentContext;
@@ -139,6 +142,9 @@ public class Service implements Serializable {
@OneToMany(cascade = CascadeType.ALL, mappedBy = "service")
private List<ServiceArtifact> serviceArtifactList;
+ @OneToMany(cascade = CascadeType.ALL, mappedBy = "service")
+ private List<ServiceInfo> serviceInfos;
+
@Column(name = "NAMING_POLICY")
private String namingPolicy;
@@ -385,6 +391,17 @@ public class Service implements Serializable {
this.serviceArtifactList = serviceArtifactList;
}
+ public List<ServiceInfo> getServiceInfos() {
+ if (serviceInfos == null) {
+ serviceInfos = new ArrayList<>();
+ }
+ return serviceInfos;
+ }
+
+ public void setServiceInfos(List<ServiceInfo> serviceInfos) {
+ this.serviceInfos = serviceInfos;
+ }
+
public String getWorkloadContext() {
return this.workloadContext;
}
@@ -456,4 +473,13 @@ public class Service implements Serializable {
public void setControllerActor(String controllerActor) {
this.controllerActor = controllerActor;
}
+
+ public String getServiceFunction() {
+ return serviceFunction;
+ }
+
+ public void setServiceFunction(String serviceFunction) {
+ this.serviceFunction = serviceFunction;
+ }
+
}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ServiceInfo.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ServiceInfo.java
index f9c95767f6..d11a112c80 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ServiceInfo.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ServiceInfo.java
@@ -45,9 +45,8 @@ public class ServiceInfo implements Serializable {
@Column(name = "SERVICE_PROPERTIES")
private String serviceProperties;
- @OneToOne(cascade = CascadeType.ALL)
- @JoinTable(name = "service_to_service_info", joinColumns = @JoinColumn(name = "SERVICE_INFO_ID"),
- inverseJoinColumns = @JoinColumn(name = "SERVICE_MODEL_UUID"))
+ @ManyToOne(cascade = CascadeType.ALL)
+ @JoinColumn(name = "SERVICE_MODEL_UUID")
private Service service;
public Integer getId() {
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VfModuleCustomization.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VfModuleCustomization.java
index 3420682900..83de95874c 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VfModuleCustomization.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VfModuleCustomization.java
@@ -21,10 +21,9 @@
package org.onap.so.db.catalog.beans;
import java.io.Serializable;
+import java.util.ArrayList;
import java.util.Date;
-import java.util.HashSet;
import java.util.List;
-import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
@@ -41,7 +40,6 @@ import javax.persistence.TemporalType;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.onap.so.db.catalog.beans.macro.OrchestrationFlow;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.openpojo.business.annotation.BusinessKey;
import uk.co.blackpepper.bowman.annotation.LinkedResource;
@@ -98,7 +96,7 @@ public class VfModuleCustomization implements Serializable {
private VnfResourceCustomization vnfCustomization;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "vfModuleCustomization")
- private Set<CvnfcCustomization> cvnfcCustomization;
+ private List<CvnfcCustomization> cvnfcCustomization;
@Column(name = "SKIP_POST_INSTANTIATION_CONFIGURATION")
private Boolean skipPostInstConf;
@@ -233,13 +231,13 @@ public class VfModuleCustomization implements Serializable {
}
@LinkedResource
- public Set<CvnfcCustomization> getCvnfcCustomization() {
+ public List<CvnfcCustomization> getCvnfcCustomization() {
if (cvnfcCustomization == null)
- cvnfcCustomization = new HashSet<>();
+ cvnfcCustomization = new ArrayList<>();
return cvnfcCustomization;
}
- public void setCvnfcCustomization(Set<CvnfcCustomization> cvnfcCustomization) {
+ public void setCvnfcCustomization(List<CvnfcCustomization> cvnfcCustomization) {
this.cvnfcCustomization = cvnfcCustomization;
}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java
index cd7edb007d..4c5bbaf7ec 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
@@ -915,7 +915,7 @@ public class CatalogDbClient {
findVnfResourceCustomizationInList(vnfCustomizationUUID, service.getVnfCustomizations());
VfModuleCustomization vfModuleCust =
findVfModuleCustomizationInList(vfModuleCustomizationUUID, vnfResourceCust.getVfModuleCustomizations());
- return vfModuleCust.getCvnfcCustomization().stream().collect(Collectors.toList());
+ return vfModuleCust.getCvnfcCustomization();
}
public VnfResourceCustomization findVnfResourceCustomizationInList(String vnfCustomizationUUID,
@@ -971,10 +971,9 @@ public class CatalogDbClient {
List<CvnfcCustomization> cvnfcCustomization =
getCvnfcCustomization(serviceModelUUID, vnfCustomizationUuid, vfModuleCustomizationUuid);
CvnfcCustomization cvnfc = findCvnfcCustomizationInAList(cvnfcCustomizationUuid, cvnfcCustomization);
- List<CvnfcConfigurationCustomization> fabricConfigs = cvnfc
- .getCvnfcConfigurationCustomization().stream().filter(cvnfcCustom -> cvnfcCustom
- .getConfigurationResource().getToscaNodeType().contains("FabricConfiguration"))
- .collect(Collectors.toList());
+ List<CvnfcConfigurationCustomization> fabricConfigs = cvnfc.getCvnfcConfigurationCustomization();
+ fabricConfigs.stream().filter(cvnfcCustom -> cvnfcCustom.getConfigurationResource().getToscaNodeType()
+ .contains("FabricConfiguration")).collect(Collectors.toList());
if (fabricConfigs != null && !fabricConfigs.isEmpty() && fabricConfigs.size() == 1) {
logger.debug("Found Fabric Configuration: {}", fabricConfigs.get(0));
return fabricConfigs.get(0);
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceInfoRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NetworkTechnologyReferenceRepository.java
index e3a4ca264e..0b7065490b 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceInfoRepository.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NetworkTechnologyReferenceRepository.java
@@ -2,14 +2,14 @@
* ============LICENSE_START=======================================================
* ONAP - SO
* ================================================================================
- * Copyright (c) 2019, CMCC Technologies Co., Ltd.
+ * Copyright (C) 2019 Tech Mahindra
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,14 +20,13 @@
package org.onap.so.db.catalog.data.repository;
-import org.onap.so.db.catalog.beans.Service;
-import org.onap.so.db.catalog.beans.ServiceInfo;
+
+import java.util.List;
+import org.onap.so.db.catalog.beans.NetworkTechnologyReference;
import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.data.rest.core.annotation.RepositoryRestResource;
-@RepositoryRestResource(collectionResourceRel = "serviceInfo", path = "serviceInfo")
-public interface ServiceInfoRepository extends JpaRepository<ServiceInfo, Integer> {
- ServiceInfo findByService(Service service);
+public interface NetworkTechnologyReferenceRepository extends JpaRepository<NetworkTechnologyReference, Integer> {
+ List<NetworkTechnologyReference> findAllByCloudOwner(String cloudOwner);
}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/rest/beans/ServiceMacroHolder.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/rest/beans/ServiceMacroHolder.java
index ec4e922c8f..65cbb5253e 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/rest/beans/ServiceMacroHolder.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/rest/beans/ServiceMacroHolder.java
@@ -39,7 +39,6 @@ public class ServiceMacroHolder implements Serializable {
private ArrayList<AllottedResourceCustomization> allottedResourceCustomizations;
private ArrayList<VnfResourceCustomization> vnfResourceCustomizations;
private ArrayList<ServiceProxyResourceCustomization> serviceProxyResourceCustomizations;
- private ServiceInfo serviceInfo;
public ServiceMacroHolder() {
@@ -50,7 +49,6 @@ public class ServiceMacroHolder implements Serializable {
this.allottedResourceCustomizations = new ArrayList<>();
this.vnfResourceCustomizations = new ArrayList<>();
this.serviceProxyResourceCustomizations = new ArrayList<>();
- this.serviceInfo = null;
}
public ServiceMacroHolder(Service service) {
@@ -66,14 +64,6 @@ public class ServiceMacroHolder implements Serializable {
this.service = service;
}
- public ServiceInfo getServiceInfo() {
- return serviceInfo;
- }
-
- public void setServiceInfo(ServiceInfo serviceInfo) {
- this.serviceInfo = serviceInfo;
- }
-
public void setVnfResources(ArrayList<VnfResource> vnfResources) {
this.vnfResources = vnfResources;
}
@@ -165,11 +155,6 @@ public class ServiceMacroHolder implements Serializable {
} else {
sb.append("service: null");
}
- if (this.serviceInfo != null) {
- sb.append("serviceInfo: " + this.serviceInfo.toString());
- } else {
- sb.append("serviceInfo: null");
- }
if (this.vnfResourceCustomizations != null && this.vnfResourceCustomizations.size() > 0) {
int i = 0;
sb.append("VnfResources: ");
diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepositoryTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepositoryTest.java
index e8addc4aa8..a13deae159 100644
--- a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepositoryTest.java
+++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepositoryTest.java
@@ -23,14 +23,10 @@ package org.onap.so.db.catalog.data.repository;
import static com.shazam.shazamcrest.MatcherAssert.assertThat;
import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
import java.util.ArrayList;
-import java.util.HashSet;
import java.util.List;
-import java.util.Set;
import org.junit.Assert;
import org.junit.Test;
import org.onap.so.db.catalog.BaseTest;
-import org.onap.so.db.catalog.beans.ConfigurationResource;
-import org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization;
import org.onap.so.db.catalog.beans.CvnfcCustomization;
import org.onap.so.db.catalog.beans.VfModule;
import org.onap.so.db.catalog.beans.VfModuleCustomization;
@@ -45,6 +41,7 @@ public class CvnfcCustomizationRepositoryTest extends BaseTest {
@Autowired
private CvnfcCustomizationRepository cvnfcCustomizationRepository;
+
@Test
public void findAllTest() throws Exception {
List<CvnfcCustomization> cvnfcCustomizationList = cvnfcCustomizationRepository.findAll();
@@ -125,14 +122,12 @@ public class CvnfcCustomizationRepositoryTest extends BaseTest {
vnfResourceCustomization.setVnfResources(vnfResource);
-
VnfcCustomization vnfcCustomization = setUpVnfcCustomization();
vnfcCustomization.setModelCustomizationUUID("d95d704a-9ff2-11e8-98d0-529269fb1459");
-
-
cvnfcCustomizationRepository.save(cvnfcCustomization);
+
List<CvnfcCustomization> cvnfcCustomizationList =
cvnfcCustomizationRepository.findByModelCustomizationUUID("cf9f6efc-9f14-11e8-98d0-529269fb1459");
boolean matchFound = false;
@@ -173,7 +168,7 @@ public class CvnfcCustomizationRepositoryTest extends BaseTest {
vnfResourceCustomization.setModelCustomizationUUID("cf9f6efc-9f14-11e8-98d0-529269fb1459");
vnfResourceCustomization.setModelInstanceName("testModelInstanceName");
- List<VnfResourceCustomization> vnfResourceCustomizations = new ArrayList();
+ List<VnfResourceCustomization> vnfResourceCustomizations = new ArrayList<>();
vnfResourceCustomizations.add(vnfResourceCustomization);
vnfResourceCustomization.setVnfResources(vnfResource);
diff --git a/mso-catalog-db/src/test/resources/data.sql b/mso-catalog-db/src/test/resources/data.sql
index 0852aa026d..b38d4d9376 100644
--- a/mso-catalog-db/src/test/resources/data.sql
+++ b/mso-catalog-db/src/test/resources/data.sql
@@ -683,7 +683,7 @@ INSERT INTO `cloudify_managers` (`ID`, `CLOUDIFY_URL`, `USERNAME`, `PASSWORD`, `
INSERT INTO `identity_services` (`ID`, `IDENTITY_URL`, `MSO_ID`, `MSO_PASS`, `PROJECT_DOMAIN_NAME`, `USER_DOMAIN_NAME`, `ADMIN_TENANT`, `MEMBER_ROLE`, `TENANT_METADATA`, `IDENTITY_SERVER_TYPE`, `IDENTITY_AUTHENTICATION_TYPE`, `LAST_UPDATED_BY`, `CREATION_TIMESTAMP`, `UPDATE_TIMESTAMP`) VALUES ('MTN13', 'http://localhost:28090/v2.0', 'm93945', '93937EA01B94A10A49279D4572B48369', NULL, NULL, 'admin', 'admin', 1, 'KEYSTONE', 'USERNAME_PASSWORD', 'MSO_USER', '2018-07-17 14:02:33', '2018-07-17 14:02:33');
-INSERT INTO `cloud_sites` (`ID`, `REGION_ID`, `IDENTITY_SERVICE_ID`, `CLOUD_VERSION`, `CLLI`, `CLOUDIFY_ID`, `PLATFORM`, `ORCHESTRATOR`, `LAST_UPDATED_BY`, `CREATION_TIMESTAMP`, `UPDATE_TIMESTAMP`, `SUPPORT_FABRIC`) VALUES ('mtn13', 'mtn13', 'MTN13', '2.5', 'MDT13', 'mtn13', NULL, 'orchestrator', 'MSO_USER', '2018-07-17 14:06:28', '2018-07-17 14:06:28', 1);
+INSERT INTO `cloud_sites` (`ID`, `REGION_ID`, `IDENTITY_SERVICE_ID`, `CLOUD_VERSION`, `CLLI`, `CLOUDIFY_ID`, `PLATFORM`, `ORCHESTRATOR`, `LAST_UPDATED_BY`, `CREATION_TIMESTAMP`, `UPDATE_TIMESTAMP`, `SUPPORT_FABRIC`,`CLOUD_OWNER`) VALUES ('mtn13', 'mtn13', 'MTN13', '2.5', 'MDT13', 'mtn13', NULL, 'orchestrator', 'MSO_USER', '2018-07-17 14:06:28', '2018-07-17 14:06:28', 1,'cloudOwner');
INSERT INTO `controller_selection_reference` (`VNF_TYPE`, `CONTROLLER_NAME`, `ACTION_CATEGORY`) VALUES
('vLoadBalancerMS/vLoadBalancerMS 0', 'APPC', 'ConfigScaleOut'),
diff --git a/mso-catalog-db/src/test/resources/schema.sql b/mso-catalog-db/src/test/resources/schema.sql
index 6573def570..0d49903e51 100644
--- a/mso-catalog-db/src/test/resources/schema.sql
+++ b/mso-catalog-db/src/test/resources/schema.sql
@@ -121,6 +121,7 @@ CREATE TABLE `cloud_sites` (
`CREATION_TIMESTAMP` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
`UPDATE_TIMESTAMP` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
`SUPPORT_FABRIC` bit(1) NOT NULL DEFAULT 1,
+ `CLOUD_OWNER` varchar(225) NOT NULL,
PRIMARY KEY (`ID`),
KEY `FK_cloud_sites_identity_services` (`IDENTITY_SERVICE_ID`),
CONSTRAINT `FK_cloud_sites_identity_services` FOREIGN KEY (`IDENTITY_SERVICE_ID`) REFERENCES `identity_services` (`ID`)
@@ -802,6 +803,7 @@ CREATE TABLE `service` (
`TOSCA_CSAR_ARTIFACT_UUID` varchar(200) DEFAULT NULL,
`SERVICE_TYPE` varchar(200) DEFAULT NULL,
`SERVICE_ROLE` varchar(200) DEFAULT NULL,
+ `SERVICE_FUNCTION` varchar(200) DEFAULT NULL,
`ENVIRONMENT_CONTEXT` varchar(200) DEFAULT NULL,
`WORKLOAD_CONTEXT` varchar(200) DEFAULT NULL,
`SERVICE_CATEGORY` varchar(200) DEFAULT NULL,
diff --git a/packages/docker/pom.xml b/packages/docker/pom.xml
index b231dedf91..3a9ec375da 100644
--- a/packages/docker/pom.xml
+++ b/packages/docker/pom.xml
@@ -42,20 +42,20 @@
</goals>
<configuration>
<source>
- println 'Project version: ' + project.properties['so.project.version'];
- def versionArray;
- if ( project.properties['so.project.version'] != null ) {
- versionArray = project.properties['so.project.version'].split('-');
- }
+ println 'Project version: ' + project.properties['so.project.version'];
+ def versionArray;
+ if ( project.properties['so.project.version'] != null ) {
+ versionArray = project.properties['so.project.version'].split('-');
+ }
- if ( project.properties['so.project.version'].endsWith("-SNAPSHOT") ) {
- project.properties['project.docker.latesttag.version']=versionArray[0] + "-SNAPSHOT-latest";
- } else {
- project.properties['project.docker.latesttag.version']=versionArray[0] + "-STAGING-latest";
- }
+ if ( project.properties['so.project.version'].endsWith("-SNAPSHOT") ) {
+ project.properties['project.docker.latesttag.version']=versionArray[0] + "-SNAPSHOT-latest";
+ } else {
+ project.properties['project.docker.latesttag.version']=versionArray[0] + "-STAGING-latest";
+ }
- println 'New tag for docker: ' + project.properties['project.docker.latesttag.version'];
- </source>
+ println 'New tag for docker: ' + project.properties['project.docker.latesttag.version'];
+ </source>
</configuration>
</execution>
</executions>
diff --git a/releases/1.6.0.yaml b/releases/1.6.0.yaml
new file mode 100644
index 0000000000..8e1e371e5b
--- /dev/null
+++ b/releases/1.6.0.yaml
@@ -0,0 +1,33 @@
+---
+distribution_type: 'container'
+container_release_tag: '1.6.0'
+project: 'so'
+log_dir: 'so-maven-docker-stage-elalto/2/'
+ref: '3c1f70e434b23e8bda331837c1e4ed8506f0166d'
+containers:
+ - name: 'so/vnfm-adapter'
+ version: '1.6.0-20200326T0421'
+ - name: 'so/catalog-db-adapter'
+ version: '1.6.0-20200326T0421'
+ - name: 'so/request-db-adapter'
+ version: '1.6.0-20200326T0421'
+ - name: 'so/openstack-adapter'
+ version: '1.6.0-20200326T0421'
+ - name: 'so/sdnc-adapter'
+ version: '1.6.0-20200326T0421'
+ - name: 'so/vfc-adapter'
+ version: '1.6.0-20200326T0421'
+ - name: 'so/sdc-controller'
+ version: '1.6.0-20200326T0421'
+ - name: 'so/bpmn-infra'
+ version: '1.6.0-20200326T0421'
+ - name: 'so/so-monitoring'
+ version: '1.6.0-20200326T0421'
+ - name: 'so/api-handler-infra'
+ version: '1.6.0-20200326T0421'
+ - name: 'so/so-appc-orchestrator'
+ version: '1.6.0-20200326T0421'
+ - name: 'so/nssmf-adapter'
+ version: '1.6.0-20200326T0421'
+ - name: 'so/ve-vnfm-adapter'
+ version: '1.6.0-20200326T0421' \ No newline at end of file
diff --git a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryStackByIdDoubleFailure.java b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryStackByIdDoubleFailure.java
index 2311c4c44e..2fa8725d56 100644
--- a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryStackByIdDoubleFailure.java
+++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryStackByIdDoubleFailure.java
@@ -17,10 +17,11 @@ public class QueryStackByIdDoubleFailure extends AbstractSimulatorScenario {
@Override
public void run(ScenarioDesigner scenario) {
- // Get to see if stack exists
+ // Create Poll Service
+ scenario.scenarioEndpoint().getEndpointConfiguration().setTimeout(300000L);
scenario.http().receive().get().extractFromHeader(DynamicEndpointUriResolver.REQUEST_PATH_HEADER_NAME,
"correlationId");
- scenario.echo("${correlationId}");
+ scenario.echo("${correlationId}"); // step 2
scenario.correlation().start().onHeader(DynamicEndpointUriResolver.REQUEST_PATH_HEADER_NAME,
"${correlationId}");
@@ -30,20 +31,63 @@ public class QueryStackByIdDoubleFailure extends AbstractSimulatorScenario {
scenario.variable("tenantId", "872f331350c54e59991a8de2cbffb40c");
scenario.variable("vServerId", "d29f3151-592d-4011-9356-ad047794e236");
scenario.variable("stack_failure_message", "The Flavor ID (nd.c6r16d20) could not be found.");
+ scenario.http().send().response(HttpStatus.OK) // step 4
+ .payload(new ClassPathResource("openstack/gr_api/Stack_Failure.json"));
+
+ // Create Poll Retry
+ scenario.http().receive().get(); // step 5
+ scenario.http().send().response(HttpStatus.OK)
+ .payload(new ClassPathResource("openstack/gr_api/Stack_Failure.json"));
+
+ // Rollback Delete of the stack
+ scenario.http().receive().delete(); // step 7
+ scenario.action(new DeleteVServers());
+ scenario.http().send().response(HttpStatus.NO_CONTENT);
+
+ // Rollback Poll
+ scenario.http().receive().get(); // step 10
scenario.http().send().response(HttpStatus.OK)
.payload(new ClassPathResource("openstack/gr_api/Stack_Failure.json"));
+ // Rollback Poll Retry
+ scenario.http().receive().get();
+ scenario.http().send().response(HttpStatus.OK)
+ .payload(new ClassPathResource("openstack/gr_api/Stack_Failure.json"));
+
+ // Create Poll
+ scenario.http().receive().get(); // step 14
+ scenario.http().send().response(HttpStatus.OK)
+ .payload(new ClassPathResource("openstack/gr_api/Stack_Failure.json"));
- // Delete of the stack
+ // Create Poll Retry
+ scenario.http().receive().get();
+ scenario.http().send().response(HttpStatus.OK)
+ .payload(new ClassPathResource("openstack/gr_api/Stack_Failure.json"));
+
+ // Rollback Delete
scenario.http().receive().delete();
scenario.action(new DeleteVServers());
scenario.http().send().response(HttpStatus.NO_CONTENT);
- // Poll Deletion of stack for status
+ // Rollback Poll
+ scenario.http().receive().get(); // step 18
+ scenario.http().send().response(HttpStatus.OK)
+ .payload(new ClassPathResource("openstack/gr_api/Stack_Failure.json"));
+
+ // Rollback Poll Retry
scenario.http().receive().get();
scenario.http().send().response(HttpStatus.OK)
.payload(new ClassPathResource("openstack/gr_api/Stack_Failure.json"));
+ // Delete
+ scenario.http().receive().delete();
+ scenario.http().send().response(HttpStatus.NO_CONTENT);
+
+ // Delete Poll
+ scenario.http().receive().get();
+ scenario.http().send().response(HttpStatus.OK)
+ .payload(new ClassPathResource("openstack/gr_api/Stack_Deleted.json"));
+
}
}
diff --git a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryStackByIdFailure.java b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryStackByIdFailure.java
index 4d0d578831..7f995f2930 100644
--- a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryStackByIdFailure.java
+++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryStackByIdFailure.java
@@ -3,8 +3,6 @@ package org.onap.so.simulator.scenarios.openstack;
import org.springframework.core.io.ClassPathResource;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.onap.so.simulator.actions.aai.DeleteVServers;
import com.consol.citrus.endpoint.resolver.DynamicEndpointUriResolver;
import com.consol.citrus.simulator.scenario.AbstractSimulatorScenario;
import com.consol.citrus.simulator.scenario.Scenario;
@@ -17,7 +15,9 @@ public class QueryStackByIdFailure extends AbstractSimulatorScenario {
@Override
public void run(ScenarioDesigner scenario) {
- // Get to see if stack exists
+ scenario.scenarioEndpoint().getEndpointConfiguration().setTimeout(300000L);
+
+ // Create Poll
scenario.http().receive().get().extractFromHeader(DynamicEndpointUriResolver.REQUEST_PATH_HEADER_NAME,
"correlationId");
scenario.echo("${correlationId}");
@@ -33,13 +33,13 @@ public class QueryStackByIdFailure extends AbstractSimulatorScenario {
scenario.http().send().response(HttpStatus.OK)
.payload(new ClassPathResource("openstack/gr_api/Stack_Failure.json"));
+ // Create Poll Retry
+ scenario.http().receive().get();
+ scenario.http().send().response(HttpStatus.OK)
+ .payload(new ClassPathResource("openstack/gr_api/Stack_Failure.json"));
- // Delete of the stack
- scenario.http().receive().delete();
- scenario.action(new DeleteVServers());
- scenario.http().send().response(HttpStatus.NO_CONTENT);
- // Poll Deletion of stack for status
+ // Rollback Poll
scenario.http().receive().get();
scenario.http().send().response(HttpStatus.OK)
.payload(new ClassPathResource("openstack/gr_api/Stack_Deleted.json"));
diff --git a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryStackByIdMacro1.java b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryStackByIdMacro1.java
index ba6a1a1185..c8c81ebecf 100644
--- a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryStackByIdMacro1.java
+++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryStackByIdMacro1.java
@@ -9,6 +9,10 @@ import com.consol.citrus.simulator.scenario.AbstractSimulatorScenario;
import com.consol.citrus.simulator.scenario.Scenario;
import com.consol.citrus.simulator.scenario.ScenarioDesigner;
+/**
+ * This scenario is used by the following test cases: Resume Service Instance Macro 3 Modules 1 To Complete
+ *
+ */
@Scenario("Openstack-QueryStackByID-Macro1")
@RequestMapping(value = "/sim/mockPublicUrl/stacks/macro_module_1/*", method = RequestMethod.GET)
public class QueryStackByIdMacro1 extends AbstractSimulatorScenario {
@@ -16,6 +20,9 @@ public class QueryStackByIdMacro1 extends AbstractSimulatorScenario {
@Override
public void run(ScenarioDesigner scenario) {
+ scenario.scenarioEndpoint().getEndpointConfiguration().setTimeout(300000L);
+
+ // Poll
scenario.http().receive().get().extractFromHeader(DynamicEndpointUriResolver.REQUEST_PATH_HEADER_NAME,
"correlationId");
scenario.echo("${correlationId}");
@@ -27,8 +34,33 @@ public class QueryStackByIdMacro1 extends AbstractSimulatorScenario {
scenario.http().send().response(HttpStatus.OK)
.payload(new ClassPathResource("openstack/gr_api/Stack_Created.json"));
+ // Create (module_2)
+ scenario.http().receive().get();
+ scenario.http().send().response(HttpStatus.OK)
+ .payload(new ClassPathResource("openstack/gr_api/Stack_Created.json"));
+
+ // Create (module_3)
+ scenario.http().receive().get();
+ scenario.http().send().response(HttpStatus.OK)
+ .payload(new ClassPathResource("openstack/gr_api/Stack_Created.json"));
+
+ // Create (module_2 recreate)
+ scenario.http().receive().get();
+ scenario.http().send().response(HttpStatus.OK)
+ .payload(new ClassPathResource("openstack/gr_api/Stack_Created.json"));
+
+ // Delete
+ scenario.http().receive().get();
+ scenario.http().send().response(HttpStatus.OK)
+ .payload(new ClassPathResource("openstack/gr_api/Stack_Deleted.json"));
+
+ // Delete
scenario.http().receive().get();
+ scenario.http().send().response(HttpStatus.OK)
+ .payload(new ClassPathResource("openstack/gr_api/Stack_Deleted.json"));
+ // Poll
+ scenario.http().receive().get();
scenario.http().send().response(HttpStatus.OK)
.payload(new ClassPathResource("openstack/gr_api/Stack_Deleted.json"));
}
diff --git a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryStackByIdMacro2.java b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryStackByIdMacro2.java
index efd420486d..aca5fe8194 100644
--- a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryStackByIdMacro2.java
+++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryStackByIdMacro2.java
@@ -9,6 +9,10 @@ import com.consol.citrus.simulator.scenario.AbstractSimulatorScenario;
import com.consol.citrus.simulator.scenario.Scenario;
import com.consol.citrus.simulator.scenario.ScenarioDesigner;
+/**
+ * This scenario is used by the following test cases: Resume Service Instance Macro 3 Modules 1 To Complete
+ *
+ */
@Scenario("Openstack-QueryStackByID-Macro2")
@RequestMapping(value = "/sim/mockPublicUrl/stacks/macro_module_2/*", method = RequestMethod.GET)
public class QueryStackByIdMacro2 extends AbstractSimulatorScenario {
@@ -16,6 +20,9 @@ public class QueryStackByIdMacro2 extends AbstractSimulatorScenario {
@Override
public void run(ScenarioDesigner scenario) {
+ scenario.scenarioEndpoint().getEndpointConfiguration().setTimeout(300000L);
+
+ // Poll
scenario.http().receive().get().extractFromHeader(DynamicEndpointUriResolver.REQUEST_PATH_HEADER_NAME,
"correlationId");
scenario.echo("${correlationId}");
@@ -27,11 +34,19 @@ public class QueryStackByIdMacro2 extends AbstractSimulatorScenario {
scenario.http().send().response(HttpStatus.OK)
.payload(new ClassPathResource("openstack/gr_api/Stack_Created.json"));
+ // Delete
scenario.http().receive().get();
+ scenario.http().send().response(HttpStatus.OK)
+ .payload(new ClassPathResource("openstack/gr_api/Stack_Created.json"));
+ scenario.http().receive().get();
scenario.http().send().response(HttpStatus.OK)
.payload(new ClassPathResource("openstack/gr_api/Stack_Deleted.json"));
+ // Poll
+ scenario.http().receive().get();
+ scenario.http().send().response(HttpStatus.OK)
+ .payload(new ClassPathResource("openstack/gr_api/Stack_Deleted.json"));
}
}
diff --git a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryStackByIdMacro3.java b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryStackByIdMacro3.java
index 4d3ba8697a..9fc6fafdb3 100644
--- a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryStackByIdMacro3.java
+++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryStackByIdMacro3.java
@@ -9,6 +9,10 @@ import com.consol.citrus.simulator.scenario.AbstractSimulatorScenario;
import com.consol.citrus.simulator.scenario.Scenario;
import com.consol.citrus.simulator.scenario.ScenarioDesigner;
+/**
+ * This scenario is used by the following test cases: Resume Service Instance Macro 3 Modules 1 To Complete
+ *
+ */
@Scenario("Openstack-QueryStackByID-Macro3")
@RequestMapping(value = "/sim/mockPublicUrl/stacks/macro_module_3/*", method = RequestMethod.GET)
public class QueryStackByIdMacro3 extends AbstractSimulatorScenario {
@@ -16,6 +20,8 @@ public class QueryStackByIdMacro3 extends AbstractSimulatorScenario {
@Override
public void run(ScenarioDesigner scenario) {
+ scenario.scenarioEndpoint().getEndpointConfiguration().setTimeout(300000L);
+
scenario.http().receive().get().extractFromHeader(DynamicEndpointUriResolver.REQUEST_PATH_HEADER_NAME,
"correlationId");
scenario.echo("${correlationId}");
@@ -24,11 +30,21 @@ public class QueryStackByIdMacro3 extends AbstractSimulatorScenario {
scenario.variable("stackName", "macro_module_3");
+ // Poll
+ scenario.http().send().response(HttpStatus.OK)
+ .payload(new ClassPathResource("openstack/gr_api/Stack_Created.json"));
+
+ // Delete
+ scenario.http().receive().get();
scenario.http().send().response(HttpStatus.OK)
.payload(new ClassPathResource("openstack/gr_api/Stack_Created.json"));
scenario.http().receive().get();
+ scenario.http().send().response(HttpStatus.OK)
+ .payload(new ClassPathResource("openstack/gr_api/Stack_Deleted.json"));
+ // Poll
+ scenario.http().receive().get();
scenario.http().send().response(HttpStatus.OK)
.payload(new ClassPathResource("openstack/gr_api/Stack_Deleted.json"));
diff --git a/version.properties b/version.properties
index a0756adf2b..922c4fa961 100644
--- a/version.properties
+++ b/version.properties
@@ -4,7 +4,7 @@
major=1
minor=6
-patch=0
+patch=1
base_version=${major}.${minor}.${patch}