summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore2
-rw-r--r--adapters/etsi-sol002-adapter/src/main/resources/certs/org.onap.so.trust.jksbin1413 -> 3202 bytes
-rw-r--r--adapters/etsi-sol002-adapter/src/main/resources/certs/ve-vnfm-adapter.p12bin4079 -> 5852 bytes
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-adapter-application/src/main/resources/org.onap.so.trust.jksbin1413 -> 3202 bytes
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-adapter-application/src/main/resources/so-vnfm-adapter.p12bin4079 -> 5834 bytes
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/extclients/aai/AaiPropertiesImpl.java9
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/lifecycle/LifecycleManager.java6
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-api/pom.xml5
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-ext-clients/pom.xml5
-rw-r--r--adapters/mso-adapter-utils/pom.xml3
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java16
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java25
-rw-r--r--adapters/mso-cnf-adapter/pom.xml2
-rw-r--r--adapters/mso-nssmf-adapter/pom.xml3
-rw-r--r--adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/extclients/aai/AaiServiceProviderImpl.java4
-rw-r--r--adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/BaseNssmfManager.java4
-rw-r--r--adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/ExternalNssmfManager.java4
-rw-r--r--adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/external/ExternalAnNssmfManager.java23
-rw-r--r--adapters/mso-oof-adapter/pom.xml2
-rw-r--r--adapters/mso-openstack-adapters/pom.xml73
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java132
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/constants/HeatBridgeConstants.java1
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/utils/HeatBridgeUtils.java4
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java100
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/utils/HeatBridgeUtilsTest.java2
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/__files/pathed-sriov-pf.json8
-rw-r--r--adapters/mso-requests-db-adapter/pom.xml5
-rw-r--r--adapters/mso-sdnc-adapter/pom.xml3
-rw-r--r--adapters/mso-vfc-adapter/pom.xml3
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy704
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java3
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java14
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDayTest.java29
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderUnitTest.java15
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/resources/org.onap.so.p12bin4095 -> 5834 bytes
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/resources/org.onap.so.trust.jksbin1413 -> 3202 bytes
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/pom.xml3
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSliceSubnet.groovy290
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/AllocateSliceSubnet.groovy308
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeAllocateSliceSubnet.groovy113
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateTnNssi.groovy2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSSI.groovy33
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCommonCoreNSSI.groovy410
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOption.groovy26
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateTnNssiInstance.groovy90
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateCoreNSSI.groovy118
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateNSSI.groovy60
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateTnNssi.groovy2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyCoreNSSI.groovy266
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyTnNssi.groovy2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ModifySliceSubnet.groovy274
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnAllocateNssi.groovy19
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnNssmfUtils.groovy41
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCommonCoreNSSITest.groovy296
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateCoreNSSITest.groovy111
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyCoreNSSITest.groovy116
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/pom.xml3
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/AllocateSliceSubnet.bpmn42
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateTransportNSSI.bpmn4
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateSliceServiceOption.bpmn207
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateCoreNSSI.bpmn418
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateNSSI.bpmn9
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoModifyCoreNSSI.bpmn417
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java12
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListener.java14
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java34
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListenerTest.java49
-rw-r--r--common/pom.xml1
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/AllocateAnNssi.java4
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/AnPerfReq.java5
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/AnSliceProfile.java5
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/DeAllocateNssi.java4
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/JobStatusResponse.java5
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/NsiInfo.java5
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/NssiResponse.java5
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/PerfReqEmbb.java5
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/PerfReqUrllc.java5
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/ResponseDescriptor.java5
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/ServiceInfo.java3
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/SliceTaskParamsAdapter.java4
-rw-r--r--cxf-logging/pom.xml3
-rw-r--r--graph-inventory/fluent-builder-maven-plugin/pom.xml30
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java14
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java14
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java3
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java48
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/PnfResourceCustomization.java6
-rw-r--r--mso-catalog-db/src/test/java/org/onap/so/db/catalog/beans/BeansTest.java8
-rw-r--r--packages/docker/src/main/docker/docker-files/Dockerfile.so-base-image7
-rw-r--r--pom.xml68
-rw-r--r--so-etsi-nfvo/pom.xml1
-rw-r--r--so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-api/pom.xml6
-rw-r--r--so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/pom.xml6
-rw-r--r--so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/CamundaVariableNameConstants.java3
-rw-r--r--so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/Constants.java1
-rw-r--r--so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/exceptions/NsRequestProcessingException.java3
-rw-r--r--so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/aai/AaiServiceProvider.java1
-rw-r--r--so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/aai/AaiServiceProviderImpl.java12
-rw-r--r--so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/etsicatalog/EtsiCatalogPackageManagementServiceProviderImpl.java17
-rw-r--r--so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/etsicatalog/EtsiCatalogServiceProviderConfiguration.java4
-rw-r--r--so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/etsicatalog/EtsiCatalogUrlProvider.java2
-rw-r--r--so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/vnfm/Sol003AdapterConfiguration.java12
-rw-r--r--so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/vnfm/Sol003AdapterServiceProviderImpl.java5
-rw-r--r--so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/nsd/FileEntry.java5
-rw-r--r--so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/nsd/parser/FileParser.java (renamed from so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/nsd/FileParser.java)3
-rw-r--r--so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/nsd/parser/NetworkServiceDescriptorParser.java (renamed from so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/nsd/NetworkServiceDescriptorParser.java)16
-rw-r--r--so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/nsd/parser/ToscaMetadataParser.java (renamed from so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/nsd/ToscaMetadataParser.java)7
-rw-r--r--so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/nsd/parser/YamlFileParser.java (renamed from so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/nsd/YamlFileParser.java)3
-rw-r--r--so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/service/JobExecutorService.java53
-rw-r--r--so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/service/WorkflowQueryService.java6
-rw-r--r--so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/tasks/AbstractNetworkServiceTask.java29
-rw-r--r--so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/tasks/CreateInstantiateVnfTask.java42
-rw-r--r--so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/tasks/CreateNsTask.java8
-rw-r--r--so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/tasks/DeleteNsTask.java140
-rw-r--r--so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/tasks/InstantiateNsTask.java137
-rw-r--r--so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/tasks/MonitorSol003AdapterNodeTask.java4
-rw-r--r--so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/tasks/TerminateNsTask.java19
-rw-r--r--so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/tasks/TerminateVnfTask.java34
-rw-r--r--so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/utils/LocalDateTimeTypeAdapter.java15
-rw-r--r--so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/resources/CreateNs.bpmn4
-rw-r--r--so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/resources/DeleteNs.bpmn260
-rw-r--r--so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/resources/InstantiateNs.bpmn4
-rw-r--r--so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/resources/TerminateNs.bpmn2
-rw-r--r--so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/BaseTest.java5
-rw-r--r--so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/PojoClassesTests.java63
-rw-r--r--so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/nsd/parser/NetworkServiceDescriptorParserTest.java (renamed from so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/nsd/NetworkServiceDescriptorParserTest.java)4
-rw-r--r--so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/java/org/onap/so/etsi/nfvo/ns/workflow/engine/tasks/CreateNsTaskTest.java12
-rw-r--r--so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/java/org/onap/so/etsi/nfvo/ns/workflow/engine/tasks/DeleteNsTaskTest.java185
-rw-r--r--so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/java/org/onap/so/etsi/nfvo/ns/workflow/engine/tasks/InstantiateNsTaskTest.java2
-rw-r--r--so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/java/org/onap/so/etsi/nfvo/ns/workflow/engine/tasks/MonitorSol003AdapterCreateJobTaskTest.java2
-rw-r--r--so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/java/org/onap/so/etsi/nfvo/ns/workflow/engine/tasks/TerminateNsTaskTest.java13
-rw-r--r--so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/pom.xml12
-rw-r--r--so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/beans/CancelModeType.java (renamed from adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/config/WebSecurityConfig.java)29
-rw-r--r--so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/beans/NfvoJob.java17
-rw-r--r--so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/beans/NfvoJobStatus.java16
-rw-r--r--so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/beans/NfvoNfInst.java14
-rw-r--r--so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/beans/NfvoNsInst.java16
-rw-r--r--so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/beans/NsLcmOpOcc.java68
-rw-r--r--so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/beans/utils/Utils.java3
-rw-r--r--so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/service/DatabaseServiceProvider.java10
-rw-r--r--so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/resources/db/migration/V1_1__create_nfvo_tables.sql3
-rw-r--r--so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/test/java/org/onap/so/etsi/nfvo/ns/lcm/database/DatabaseServiceProviderTest.java4
-rw-r--r--so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/test/java/org/onap/so/etsi/nfvo/ns/lcm/database/PojoClassesTests.java93
-rw-r--r--so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/lifecycle/NsLcmOperationOccurrenceManager.java122
-rw-r--r--so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/lifecycle/NsLifeCycleManager.java5
-rw-r--r--so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/rest/NsLcmOperationOccurrencesController.java24
-rw-r--r--so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/rest/NsLifecycleManagementController.java13
-rw-r--r--so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-service/src/test/java/org/onap/so/etsi/nfvo/ns/lcm/rest/NsLcmOperationOccurrencesControllerTest.java72
-rw-r--r--so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-service/src/test/java/org/onap/so/etsi/nfvo/ns/lcm/rest/NsLifecycleManagementControllerTest.java32
-rw-r--r--so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-service/src/test/resources/application.yaml6
-rw-r--r--version.properties2
153 files changed, 4706 insertions, 2264 deletions
diff --git a/.gitignore b/.gitignore
index 79d2c94622..c57b142a05 100644
--- a/.gitignore
+++ b/.gitignore
@@ -23,3 +23,5 @@ packages/root-pack-extras/config-resources/mariadb/db-sql-scripts/main-schemas/M
**/bin/
/tattletale/
/.metadata/
+**/.sts4-cache
+**/.java-version
diff --git a/adapters/etsi-sol002-adapter/src/main/resources/certs/org.onap.so.trust.jks b/adapters/etsi-sol002-adapter/src/main/resources/certs/org.onap.so.trust.jks
index 1f0d8a550a..4605a24f4c 100644
--- a/adapters/etsi-sol002-adapter/src/main/resources/certs/org.onap.so.trust.jks
+++ b/adapters/etsi-sol002-adapter/src/main/resources/certs/org.onap.so.trust.jks
Binary files differ
diff --git a/adapters/etsi-sol002-adapter/src/main/resources/certs/ve-vnfm-adapter.p12 b/adapters/etsi-sol002-adapter/src/main/resources/certs/ve-vnfm-adapter.p12
index ae4fddc684..d333e57eed 100644
--- a/adapters/etsi-sol002-adapter/src/main/resources/certs/ve-vnfm-adapter.p12
+++ b/adapters/etsi-sol002-adapter/src/main/resources/certs/ve-vnfm-adapter.p12
Binary files differ
diff --git a/adapters/etsi-sol003-adapter/etsi-sol003-adapter-application/src/main/resources/org.onap.so.trust.jks b/adapters/etsi-sol003-adapter/etsi-sol003-adapter-application/src/main/resources/org.onap.so.trust.jks
index 1f0d8a550a..4605a24f4c 100644
--- a/adapters/etsi-sol003-adapter/etsi-sol003-adapter-application/src/main/resources/org.onap.so.trust.jks
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-adapter-application/src/main/resources/org.onap.so.trust.jks
Binary files differ
diff --git a/adapters/etsi-sol003-adapter/etsi-sol003-adapter-application/src/main/resources/so-vnfm-adapter.p12 b/adapters/etsi-sol003-adapter/etsi-sol003-adapter-application/src/main/resources/so-vnfm-adapter.p12
index ae4fddc684..6bd786d596 100644
--- a/adapters/etsi-sol003-adapter/etsi-sol003-adapter-application/src/main/resources/so-vnfm-adapter.p12
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-adapter-application/src/main/resources/so-vnfm-adapter.p12
Binary files differ
diff --git a/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/extclients/aai/AaiPropertiesImpl.java b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/extclients/aai/AaiPropertiesImpl.java
index b3b22e239d..9e08cda354 100644
--- a/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/extclients/aai/AaiPropertiesImpl.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/extclients/aai/AaiPropertiesImpl.java
@@ -32,13 +32,15 @@ public class AaiPropertiesImpl implements AAIProperties {
private final String endpoint;
private final String encryptedBasicAuth;
private final String encrytptionKey;
+ private final String aaiVersion;
public AaiPropertiesImpl() {
-
final ApplicationContext context = SpringContextHelper.getAppContext();
this.endpoint = context.getEnvironment().getProperty("aai.endpoint");
this.encryptedBasicAuth = context.getEnvironment().getProperty("aai.auth");
this.encrytptionKey = context.getEnvironment().getProperty("mso.key");
+ this.aaiVersion = context.getEnvironment().getProperty("aai.version");
+
}
@Override
@@ -53,6 +55,11 @@ public class AaiPropertiesImpl implements AAIProperties {
@Override
public AAIVersion getDefaultVersion() {
+ for (final AAIVersion version : AAIVersion.values()) {
+ if (version.toString().equalsIgnoreCase(this.aaiVersion)) {
+ return version;
+ }
+ }
return AAIVersion.LATEST;
}
diff --git a/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/lifecycle/LifecycleManager.java b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/lifecycle/LifecycleManager.java
index a2af1a4580..4a8e95ff07 100644
--- a/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/lifecycle/LifecycleManager.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/lifecycle/LifecycleManager.java
@@ -199,9 +199,9 @@ public class LifecycleManager {
private String sendInstantiateRequestToVnfm(final EsrVnfm vnfm, final GenericVnf genericVnf,
final CreateVnfRequest createVnfRequest) {
- final InstantiateVnfRequest instantiateVnfRequest =
- vnfmHelper.createInstantiateRequest(createVnfRequest.getTenant(), createVnfRequest,
- packageProvider.getFlavourId(genericVnf.getModelVersionId()));
+ final String pkgId = getPackageId(createVnfRequest, genericVnf);
+ final InstantiateVnfRequest instantiateVnfRequest = vnfmHelper.createInstantiateRequest(
+ createVnfRequest.getTenant(), createVnfRequest, packageProvider.getFlavourId(pkgId));
final String jobId = vnfmServiceProvider.instantiateVnf(vnfm, genericVnf.getSelflink(), instantiateVnfRequest);
logger.info("Instantiate VNF request successfully sent to " + genericVnf.getSelflink());
diff --git a/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-api/pom.xml b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-api/pom.xml
index 8d79aff29d..aaf4949144 100644
--- a/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-api/pom.xml
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-api/pom.xml
@@ -187,10 +187,5 @@
<artifactId>okhttp</artifactId>
<version>${okhttp-version}</version>
</dependency>
- <dependency>
- <groupId>com.squareup.okhttp</groupId>
- <artifactId>logging-interceptor</artifactId>
- <version>${okhttp-version}</version>
- </dependency>
</dependencies>
</project>
diff --git a/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-ext-clients/pom.xml b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-ext-clients/pom.xml
index f34fb61802..6554da3409 100644
--- a/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-ext-clients/pom.xml
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-ext-clients/pom.xml
@@ -187,11 +187,6 @@
<artifactId>okhttp</artifactId>
<version>${okhttp-version}</version>
</dependency>
- <dependency>
- <groupId>com.squareup.okhttp</groupId>
- <artifactId>logging-interceptor</artifactId>
- <version>${okhttp-version}</version>
- </dependency>
</dependencies>
</project>
diff --git a/adapters/mso-adapter-utils/pom.xml b/adapters/mso-adapter-utils/pom.xml
index 2453c18f1a..6c9c23a59b 100644
--- a/adapters/mso-adapter-utils/pom.xml
+++ b/adapters/mso-adapter-utils/pom.xml
@@ -124,17 +124,14 @@
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-rs-client</artifactId>
- <version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-bindings-soap</artifactId>
- <version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
- <version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.onap.so</groupId>
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 c33160d255..a7c47f8f53 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
@@ -24,6 +24,7 @@
package org.onap.so.openstack.utils;
import java.io.IOException;
+import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
@@ -124,10 +125,8 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
// Properties names and variables (with default values)
protected String createPollIntervalProp = "org.onap.so.adapters.po.pollInterval";
- private String pollingMultiplierProp = "org.onap.so.adapters.po.pollMultiplier";
protected static final String CREATE_POLL_INTERVAL_DEFAULT = "15";
- private static final String POLLING_MULTIPLIER_DEFAULT = "60";
private static final ObjectMapper JSON_MAPPER = new ObjectMapper();
@@ -348,9 +347,12 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
String tenantId, boolean notFoundIsSuccess) throws MsoException {
int pollingFrequency =
Integer.parseInt(this.environment.getProperty(createPollIntervalProp, CREATE_POLL_INTERVAL_DEFAULT));
- int pollingMultiplier =
- Integer.parseInt(this.environment.getProperty(pollingMultiplierProp, POLLING_MULTIPLIER_DEFAULT));
- int numberOfPollingAttempts = Math.floorDiv((timeoutMinutes * pollingMultiplier), pollingFrequency);
+ LocalDateTime stopPolling = LocalDateTime.now().plusMinutes(timeoutMinutes);
+ if (pollingFrequency > timeoutMinutes * 60) {
+ logger.debug("Will not poll. Poll interval {} sec is greater then timeout {} sec", pollingFrequency,
+ timeoutMinutes * 60);
+ stopPolling = LocalDateTime.now().minusMinutes(1);
+ }
Heat heatClient = getHeatClient(cloudSiteId, tenantId);
while (true) {
String stackName = stack.getStackName() + "/" + stack.getId();
@@ -363,12 +365,12 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
} else if (latestStack != null) {
statusHandler.updateStackStatus(latestStack);
if (stackStatus.equals(latestStack.getStackStatus())) {
- if (numberOfPollingAttempts <= 0) {
+ if (LocalDateTime.now().isAfter(stopPolling)) {
logger.error("Polling of stack timed out with Status: {}", latestStack.getStackStatus());
return latestStack;
}
+ logger.debug("Will poll again until {}", stopPolling);
sleep(pollingFrequency * 1000L);
- numberOfPollingAttempts -= 1;
} else {
return latestStack;
}
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 4938bff748..4f7fed7df4 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
@@ -36,6 +36,7 @@ import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
@@ -106,7 +107,6 @@ public class MsoHeatUtilsTest extends MsoHeatUtils {
@Before
public void setup() {
doReturn("15").when(env).getProperty("org.onap.so.adapters.po.pollInterval", "15");
- doReturn("1").when(env).getProperty("org.onap.so.adapters.po.pollMultiplier", "60");
}
@Test
@@ -130,9 +130,8 @@ public class MsoHeatUtilsTest extends MsoHeatUtils {
assertEquals(true, actual != null);
}
-
@Test
- public final void pollStackForStatus_Polling_Exhausted_Test() throws MsoException, IOException {
+ public final void pollStackForStatus_No_Polling_Test() throws MsoException, IOException {
Stack stack = new Stack();
stack.setId("id");
stack.setStackName("stackName");
@@ -141,6 +140,7 @@ public class MsoHeatUtilsTest extends MsoHeatUtils {
doNothing().when(stackStatusHandler).updateStackStatus(stack);
doReturn(stack).when(heatUtils).queryHeatStack(isA(Heat.class), eq("stackName/id"));
doReturn(heatClient).when(heatUtils).getHeatClient(cloudSiteId, tenantId);
+ doReturn("61").when(env).getProperty("org.onap.so.adapters.po.pollInterval", "15");
Stack actual = heatUtils.pollStackForStatus(1, stack, "CREATE_IN_PROGRESS", cloudSiteId, tenantId, false);
Mockito.verify(stackStatusHandler, times(1)).updateStackStatus(stack);
Mockito.verify(heatUtils, times(1)).queryHeatStack(isA(Heat.class), eq("stackName/id"));
@@ -148,6 +148,22 @@ public class MsoHeatUtilsTest extends MsoHeatUtils {
}
@Test
+ public final void pollStackForStatus_Polling_Exhausted_Test() throws MsoException, IOException {
+ Stack stack = new Stack();
+ stack.setId("id");
+ stack.setStackName("stackName");
+ stack.setStackStatus("CREATE_IN_PROGRESS");
+ stack.setStackStatusReason("Stack Finished");
+ doNothing().when(stackStatusHandler).updateStackStatus(stack);
+ doReturn(stack).when(heatUtils).queryHeatStack(isA(Heat.class), eq("stackName/id"));
+ doReturn(heatClient).when(heatUtils).getHeatClient(cloudSiteId, tenantId);
+ Stack actual = heatUtils.pollStackForStatus(1, stack, "CREATE_IN_PROGRESS", cloudSiteId, tenantId, false);
+ Mockito.verify(stackStatusHandler, times(5)).updateStackStatus(stack);
+ Mockito.verify(heatUtils, times(5)).queryHeatStack(isA(Heat.class), eq("stackName/id"));
+ assertEquals(true, actual != null);
+ }
+
+ @Test
public final void postProcessStackCreate_CREATE_IN_PROGRESS_Test() throws MsoException, IOException {
Stack stack = new Stack();
stack.setId("id");
@@ -255,12 +271,9 @@ public class MsoHeatUtilsTest extends MsoHeatUtils {
CreateStackParam createStackParam = new CreateStackParam();
createStackParam.setStackName("stackName");
doReturn(heatClient).when(heatUtils).getHeatClient(cloudSiteId, tenantId);
- doNothing().when(heatUtils).postProcessStackDelete(deletedStack);
doReturn(null).when(heatUtils).executeAndRecordOpenstackRequest(mockDeleteStack);
doReturn(stackResource).when(heatClient).getStacks();
doReturn(mockDeleteStack).when(stackResource).deleteByName("stackName/id");
- doReturn(deletedStack).when(heatUtils).pollStackForStatus(120, stack, "DELETE_IN_PROGRESS", cloudSiteId,
- tenantId, true);
heatUtils.handleUnknownCreateStackFailure(stack, 120, cloudSiteId, tenantId);
Mockito.verify(heatUtils, times(1)).executeAndRecordOpenstackRequest(mockDeleteStack);
diff --git a/adapters/mso-cnf-adapter/pom.xml b/adapters/mso-cnf-adapter/pom.xml
index 0928da084e..8cfb2dc581 100644
--- a/adapters/mso-cnf-adapter/pom.xml
+++ b/adapters/mso-cnf-adapter/pom.xml
@@ -89,12 +89,10 @@
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-spring-boot-starter-jaxws</artifactId>
- <version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-spring-boot-starter-jaxrs</artifactId>
- <version>${cxf.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpmime -->
<dependency>
diff --git a/adapters/mso-nssmf-adapter/pom.xml b/adapters/mso-nssmf-adapter/pom.xml
index 45fe77eecc..0099bb3091 100644
--- a/adapters/mso-nssmf-adapter/pom.xml
+++ b/adapters/mso-nssmf-adapter/pom.xml
@@ -107,17 +107,14 @@
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-spring-boot-starter-jaxws</artifactId>
- <version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-spring-boot-starter-jaxrs</artifactId>
- <version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-rs-service-description-swagger</artifactId>
- <version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
diff --git a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/extclients/aai/AaiServiceProviderImpl.java b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/extclients/aai/AaiServiceProviderImpl.java
index 442339d9fe..b972517338 100644
--- a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/extclients/aai/AaiServiceProviderImpl.java
+++ b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/extclients/aai/AaiServiceProviderImpl.java
@@ -59,8 +59,8 @@ public class AaiServiceProviderImpl implements AaiServiceProvider {
public EsrSystemInfoList invokeGetThirdPartySdncEsrSystemInfo(String sdncId) {
return aaiClientProvider.getAaiClient()
.get(EsrSystemInfoList.class,
- AAIUriFactory
- .createResourceUri(AAIFluentTypeBuilder.externalSystem().esrThirdpartySdnc((sdncId))))
+ AAIUriFactory.createResourceUri(
+ AAIFluentTypeBuilder.externalSystem().esrThirdpartySdnc((sdncId)).esrSystemInfoList()))
.orElseGet(() -> {
logger.debug("VNFM not found in AAI");
return null;
diff --git a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/BaseNssmfManager.java b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/BaseNssmfManager.java
index 97a4c5e889..2ccd88a358 100644
--- a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/BaseNssmfManager.java
+++ b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/BaseNssmfManager.java
@@ -141,7 +141,9 @@ public abstract class BaseNssmfManager implements NssmfManager {
public RestResponse queryJobStatus(NssmfAdapterNBIRequest jobReq, String jobId) throws ApplicationException {
this.params.clear();
this.params.put("jobId", jobId);
- this.params.put("responseId", jobReq.getResponseId());
+ if (jobReq.getResponseId() != null) {
+ this.params.put("responseId", jobReq.getResponseId());
+ }
this.urlHandler();
/**
diff --git a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/ExternalNssmfManager.java b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/ExternalNssmfManager.java
index d8a9088a42..0d0d896370 100644
--- a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/ExternalNssmfManager.java
+++ b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/ExternalNssmfManager.java
@@ -127,8 +127,8 @@ public abstract class ExternalNssmfManager extends BaseNssmfManager {
return restUtil.send(nssmfUrl, this.httpMethod, content, header);
}
- private void updateRequestDbJobStatus(ResponseDescriptor rspDesc, ResourceOperationStatus status, RestResponse rsp)
- throws ApplicationException {
+ protected void updateRequestDbJobStatus(ResponseDescriptor rspDesc, ResourceOperationStatus status,
+ RestResponse rsp) throws ApplicationException {
switch (fromString(rspDesc.getStatus())) {
case STARTED:
diff --git a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/external/ExternalAnNssmfManager.java b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/external/ExternalAnNssmfManager.java
index bc7a3d0bb7..491da0aab4 100644
--- a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/external/ExternalAnNssmfManager.java
+++ b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/external/ExternalAnNssmfManager.java
@@ -30,6 +30,8 @@ import org.onap.so.adapters.nssmf.util.NssmfAdapterUtil;
import org.onap.so.beans.nsmf.DeAllocateNssi;
import org.onap.so.beans.nsmf.NssiResponse;
import org.onap.so.beans.nsmf.NssmfAdapterNBIRequest;
+import org.onap.so.beans.nsmf.ResponseDescriptor;
+import org.onap.so.beans.nsmf.JobStatusResponse;
import org.onap.so.db.request.beans.ResourceOperationStatus;
import java.util.HashMap;
import java.util.Map;
@@ -72,7 +74,7 @@ public class ExternalAnNssmfManager extends ExternalNssmfManager {
restResponse = returnRsp;
ResourceOperationStatus status =
- new ResourceOperationStatus(serviceInfo.getNsiId(), nssiId, serviceInfo.getServiceUuid());
+ new ResourceOperationStatus(serviceInfo.getNsiId(), resp.getJobId(), serviceInfo.getServiceUuid());
status.setResourceInstanceID(nssiId);
updateDbStatus(status, restResponse.getStatus(), JobStatus.FINISHED,
@@ -111,6 +113,25 @@ public class ExternalAnNssmfManager extends ExternalNssmfManager {
}
@Override
+ protected RestResponse doQueryJobStatus(ResourceOperationStatus status) throws ApplicationException {
+ ResponseDescriptor responseDescriptor = new ResponseDescriptor();
+ responseDescriptor.setStatus(JobStatus.FINISHED.toString());
+ responseDescriptor.setProgress(100);
+ responseDescriptor.setStatusDescription("Finished");
+
+ JobStatusResponse jobStatusResponse = new JobStatusResponse();
+ jobStatusResponse.setResponseDescriptor(responseDescriptor);
+
+ RestResponse restResponse = new RestResponse();
+ restResponse.setStatus(200);
+ restResponse.setResponseContent(marshal(jobStatusResponse));
+
+ updateRequestDbJobStatus(responseDescriptor, status, restResponse);
+
+ return restResponse;
+ }
+
+ @Override
protected SelectionType doQueryNSSISelectionCapability() {
return SelectionType.NSSMF;
}
diff --git a/adapters/mso-oof-adapter/pom.xml b/adapters/mso-oof-adapter/pom.xml
index 98150d39e0..a986052551 100644
--- a/adapters/mso-oof-adapter/pom.xml
+++ b/adapters/mso-oof-adapter/pom.xml
@@ -36,12 +36,10 @@
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-spring-boot-starter-jaxrs</artifactId>
- <version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-rs-service-description-swagger</artifactId>
- <version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
diff --git a/adapters/mso-openstack-adapters/pom.xml b/adapters/mso-openstack-adapters/pom.xml
index eb6cba5510..7d5e8cc6fd 100644
--- a/adapters/mso-openstack-adapters/pom.xml
+++ b/adapters/mso-openstack-adapters/pom.xml
@@ -51,76 +51,6 @@
</execution>
</executions>
</plugin>
-
- <!-- run the following plugin only when there's a wsdl change and you need to recompile the java classes
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>jaxws-maven-plugin</artifactId>
- <version>2.4.1</version>
- <executions>
- <execution>
- <id>generate-network-async-stubs</id>
- <phase>process-classes</phase>
- <goals>
- <goal>wsimport</goal>
- </goals>
- <configuration>
- <vmArgs>
- <vmArg>-Djavax.xml.accessExternalSchema=all</vmArg>
- </vmArgs>
- <wsdlDirectory>src/main/resources/wsdl</wsdlDirectory>
- <wsdlFiles>
- <wsdlFile>NetworkAdapterNotify.wsdl</wsdlFile>
- </wsdlFiles>
- <wsdlLocation>/NetworkAdapterNotify.wsdl</wsdlLocation>
- <packageName>org.onap.so.adapters.network.async.client</packageName>
- <xnocompile>false</xnocompile>
- <keep>true</keep>
- </configuration>
- </execution>
-
- <execution>
- <id>generate-vnf-async-stubs</id>
- <phase>process-classes</phase>
- <goals>
- <goal>wsimport</goal>
- </goals>
- <configuration>
- <vmArgs>
- <vmArg>-Djavax.xml.accessExternalSchema=all</vmArg>
- </vmArgs>
- <wsdlDirectory>src/main/resources/wsdl</wsdlDirectory>
- <wsdlFiles>
- <wsdlFile>VnfAdapterNotify.wsdl</wsdlFile>
- </wsdlFiles>
- <wsdlLocation>/VnfAdapterNotify.wsdl</wsdlLocation>
- <packageName>org.onap.so.adapters.vnf.async.client</packageName>
- <xnocompile>false</xnocompile>
- <keep>true</keep>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>build-helper-maven-plugin</artifactId>
- <version>3.0.0</version>
- <executions>
- <execution>
- <id>add-source</id>
- <phase>generate-sources</phase>
- <goals>
- <goal>add-source</goal>
- </goals>
- <configuration>
- <sources>
- <source>${project.build.directory}/generated-sources/wsimport/</source>
- </sources>
- </configuration>
- </execution>
- </executions>
- </plugin>
- -->
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
@@ -228,17 +158,14 @@
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-spring-boot-starter-jaxws</artifactId>
- <version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-spring-boot-starter-jaxrs</artifactId>
- <version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-rs-service-description-swagger</artifactId>
- <version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java
index 90a578d3b4..5cb870e0d7 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java
@@ -46,6 +46,7 @@ import java.util.stream.Collectors;
import javax.annotation.Nonnull;
import javax.ws.rs.NotFoundException;
import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.UriBuilder;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.validator.routines.InetAddressValidator;
import org.onap.aai.domain.yang.Flavor;
@@ -59,7 +60,6 @@ import org.onap.aai.domain.yang.Pserver;
import org.onap.aai.domain.yang.Relationship;
import org.onap.aai.domain.yang.RelationshipList;
import org.onap.aai.domain.yang.SriovPf;
-import org.onap.aai.domain.yang.SriovPfs;
import org.onap.aai.domain.yang.Subnets;
import org.onap.aai.domain.yang.SriovVf;
import org.onap.aai.domain.yang.VfModule;
@@ -80,12 +80,12 @@ import org.onap.aaiclient.client.graphinventory.entities.DSLQuery;
import org.onap.aaiclient.client.graphinventory.entities.DSLQueryBuilder;
import org.onap.aaiclient.client.graphinventory.entities.DSLStartNode;
import org.onap.aaiclient.client.graphinventory.entities.Node;
+import org.onap.aaiclient.client.graphinventory.entities.Pathed;
import org.onap.aaiclient.client.graphinventory.entities.Start;
import org.onap.aaiclient.client.graphinventory.entities.TraversalBuilder;
import org.onap.aaiclient.client.graphinventory.entities.__;
import org.onap.aaiclient.client.graphinventory.entities.uri.Depth;
import org.onap.aaiclient.client.graphinventory.exceptions.BulkProcessFailed;
-import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.cloud.resource.beans.NodeType;
import org.onap.so.db.catalog.beans.CloudIdentity;
import org.onap.so.db.catalog.beans.ServerType;
@@ -95,8 +95,6 @@ import org.onap.so.heatbridge.helpers.AaiHelper;
import org.onap.so.heatbridge.openstack.api.OpenstackClient;
import org.onap.so.heatbridge.openstack.factory.OpenstackClientFactoryImpl;
import org.onap.so.heatbridge.utils.HeatBridgeUtils;
-import org.onap.so.logger.LoggingAnchor;
-import org.onap.so.logger.MessageEnum;
import org.onap.so.spring.SpringContextHelper;
import org.openstack4j.model.compute.Server;
import org.openstack4j.model.heat.Resource;
@@ -466,7 +464,7 @@ public class HeatBridgeImpl implements HeatBridgeApi {
resourcesClient.createIfNotExists(uri, Optional.of(pInterface));
}
- private void updateLInterfaceVlan(final Port port, final LInterface lIf, final String hostName)
+ protected void updateLInterfaceVlan(final Port port, final LInterface lIf, final String hostName)
throws HeatBridgeException {
// add back all vlan logic
Vlan vlan = new Vlan();
@@ -486,11 +484,13 @@ public class HeatBridgeImpl implements HeatBridgeApi {
Optional.of(vlan));
}
- if (nodeType == NodeType.GREENFIELD) {
- validatePhysicalNetwork(port, network);
- processOVS(lIf, hostName, NodeType.GREENFIELD.getInterfaceName());
- } else {
- processOVS(lIf, hostName, NodeType.BROWNFIELD.getInterfaceName());
+ if (!lIf.getInterfaceType().equals(SRIOV)) {
+ if (nodeType == NodeType.GREENFIELD) {
+ validatePhysicalNetwork(port, network);
+ processOVS(lIf, hostName, NodeType.GREENFIELD.getInterfaceName());
+ } else {
+ processOVS(lIf, hostName, NodeType.BROWNFIELD.getInterfaceName());
+ }
}
List<String> privateVlans = (ArrayList<String>) port.getProfile().get(PRIVATE_VLANS);
@@ -580,69 +580,67 @@ public class HeatBridgeImpl implements HeatBridgeApi {
*
* @param port Openstack port object
* @param lIf AAI l-interface object
+ * @throws HeatBridgeException
*/
- private void updateSriovPfToPserver(final Port port, final LInterface lIf) {
+ protected void updateSriovPfToPserver(final Port port, final LInterface lIf) throws HeatBridgeException {
if (port.getvNicType().equalsIgnoreCase(HeatBridgeConstants.OS_SRIOV_PORT_TYPE)) {
- if (port.getProfile() == null || Strings
- .isNullOrEmpty(port.getProfile().get(HeatBridgeConstants.OS_PHYSICAL_NETWORK_KEY).toString())) {
- logger.debug("The SRIOV port:" + port.getName() + " is missing physical-network-id, cannot update "
- + "sriov-pf object for host pserver: " + port.getHostId());
- return;
- }
- Optional<String> matchingPifName = HeatBridgeUtils.getMatchingPserverPifName(
- port.getProfile().get(HeatBridgeConstants.OS_PHYSICAL_NETWORK_KEY).toString());
- if (matchingPifName.isPresent()) {
- // Update l-interface description
- String pserverHostName = port.getHostId();
- lIf.setInterfaceDescription(
- "Attached to SR-IOV port: " + pserverHostName + "::" + matchingPifName.get());
- try {
- Optional<PInterface> matchingPIf = resourcesClient.get(PInterface.class,
- AAIUriFactory
- .createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
- .pserver(pserverHostName).pInterface(matchingPifName.get()))
- .depth(Depth.ONE));
- if (matchingPIf.isPresent()) {
- SriovPfs pIfSriovPfs = matchingPIf.get().getSriovPfs();
- if (pIfSriovPfs == null) {
- pIfSriovPfs = new SriovPfs();
- }
- // Extract PCI-ID from OS port object
- String pfPciId = port.getProfile().get(HeatBridgeConstants.OS_PCI_SLOT_KEY).toString();
-
- List<SriovPf> existingSriovPfs = pIfSriovPfs.getSriovPf();
- if (CollectionUtils.isEmpty(existingSriovPfs) || existingSriovPfs.stream()
- .noneMatch(existingSriovPf -> existingSriovPf.getPfPciId().equals(pfPciId))) {
- // Add sriov-pf object with PCI-ID to AAI
- SriovPf sriovPf = new SriovPf();
- sriovPf.setPfPciId(pfPciId);
- logger.debug("Queuing AAI command to update sriov-pf object to pserver: " + pserverHostName
- + "/" + matchingPifName.get());
-
- AAIResourceUri sriovPfUri = AAIUriFactory.createResourceUri(
- AAIFluentTypeBuilder.cloudInfrastructure().pserver(pserverHostName)
- .pInterface(matchingPifName.get()).sriovPf(sriovPf.getPfPciId()));
-
-
- if (!resourcesClient.exists(sriovPfUri)) {
- transaction.create(sriovPfUri, sriovPf);
-
- AAIResourceUri sriovVfUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder
- .cloudInfrastructure().cloudRegion(cloudOwner, cloudRegionId).tenant(tenantId)
- .vserver(port.getDeviceId()).lInterface(lIf.getInterfaceName()).sriovVf(
- port.getProfile().get(HeatBridgeConstants.OS_PCI_SLOT_KEY).toString()));
- transaction.connect(sriovPfUri, sriovVfUri);
- }
- }
+
+ AAIResourceUri sriovVfUri = AAIUriFactory
+ .createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(cloudOwner, cloudRegionId)
+ .tenant(tenantId).vserver(port.getDeviceId()).lInterface(lIf.getInterfaceName())
+ .sriovVf(port.getProfile().get(HeatBridgeConstants.OS_PCI_SLOT_KEY).toString()));
+
+ boolean relationshipExist = sriovVfHasSriovPfRelationship(sriovVfUri);
+
+ String pserverHostName = port.getHostId();
+ lIf.setInterfaceDescription("Attached to SR-IOV port: " + pserverHostName);
+
+ if (!relationshipExist) {
+ AAIResourceUri pserverUri = AAIUriFactory
+ .createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().pserver(pserverHostName));
+ if (resourcesClient.exists(pserverUri)) {
+ String pfPciId = port.getProfile().get(HeatBridgeConstants.OS_PF_PCI_SLOT_KEY).toString();
+
+ DSLQueryBuilder<Start, Node> builder = TraversalBuilder
+ .fragment(new DSLStartNode(Types.PSERVER, __.key("hostname", pserverHostName)))
+ .to(__.node(Types.P_INTERFACE)
+ .to(__.node(Types.SRIOV_PF, __.key("pf-pci-id", pfPciId)).output()));
+
+ List<Pathed> results = getAAIDSLClient().queryPathed(new DSLQuery(builder.build()));
+
+ if (results.size() == 1) {
+
+ AAIResourceUri sriovPfUri = AAIUriFactory.createResourceFromExistingURI(Types.SRIOV_PF,
+ UriBuilder.fromUri(results.get(0).getResourceLink()).build());
+
+ transaction.connect(sriovPfUri, sriovVfUri);
+
+ } else {
+ throw new HeatBridgeException("Unable to find sriov-pf related link " + pfPciId
+ + ". Unexpected results size" + results.size());
}
- } catch (WebApplicationException e) {
- // Silently log that we failed to update the Pserver p-interface with PCI-ID
- logger.error(LoggingAnchor.NINE, MessageEnum.GENERAL_EXCEPTION, pserverHostName,
- matchingPifName.get(), cloudOwner, tenantId, "OpenStack", "Heatbridge",
- ErrorCode.DataError.getValue(), "Exception - Failed to add sriov-pf object to pserver", e);
+ } else {
+ logger.error("Pserver {} does not exist in AAI. Unable to build sriov-vf to sriov-pf relationship.",
+ pserverHostName);
+ throw new HeatBridgeException("Pserver " + pserverHostName + " does not exist in AAI");
+ }
+ }
+ }
+ }
+
+ protected boolean sriovVfHasSriovPfRelationship(AAIResourceUri sriovVfUri) {
+ boolean pfRelationshipsExist = false;
+ if (resourcesClient.exists(sriovVfUri)) {
+ Optional<Relationships> sriovVfRelationships = resourcesClient.get(sriovVfUri).getRelationships();
+
+ if (sriovVfRelationships.isPresent()) {
+ List<AAIResourceUri> sriovPfUris = sriovVfRelationships.get().getRelatedUris(Types.SRIOV_PF);
+ if (sriovPfUris.size() != 0) {
+ pfRelationshipsExist = true;
}
}
}
+ return pfRelationshipsExist;
}
protected void updateLInterfaceIps(final Port port, final LInterface lIf) {
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/constants/HeatBridgeConstants.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/constants/HeatBridgeConstants.java
index 71c6a96cd6..c8a39a5795 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/constants/HeatBridgeConstants.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/constants/HeatBridgeConstants.java
@@ -43,6 +43,7 @@ public class HeatBridgeConstants {
public static final String OS_NEUTRON_PROVIDERNET = "OS::Neutron::ProviderNet";
public static final String OS_SRIOV_PORT_TYPE = "direct";
public static final String OS_PCI_SLOT_KEY = "pci_slot";
+ public static final String OS_PF_PCI_SLOT_KEY = "pf_pci_slot";
public static final String OS_PHYSICAL_NETWORK_KEY = "physical_network";
public static final String OS_PHYSICAL_INTERFACE_KEY = "physical-interface";
public static final String OS_VLAN_NETWORK_KEY = "vlan";
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/utils/HeatBridgeUtils.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/utils/HeatBridgeUtils.java
index 1667f980e1..c281dbd9e5 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/utils/HeatBridgeUtils.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/utils/HeatBridgeUtils.java
@@ -59,7 +59,7 @@ public final class HeatBridgeUtils {
public static Optional<String> getMatchingPserverPifName(@Nonnull final String physicalNetworkName) {
Preconditions.checkState(!Strings.isNullOrEmpty(physicalNetworkName),
- "Physical network name is null or " + "empty!");
+ "Physical network name is null or empty!");
if (physicalNetworkName.contains(OS_SIDE_DEDICATED_SRIOV_PREFIX)) {
return Optional.of(
physicalNetworkName.replace(OS_SIDE_DEDICATED_SRIOV_PREFIX, COMPUTE_SIDE_DEDICATED_SRIOV_PREFIX));
@@ -67,7 +67,7 @@ public final class HeatBridgeUtils {
return Optional
.of(physicalNetworkName.replace(OS_SIDE_SHARED_SRIOV_PREFIX, COMPUTE_SIDE_SHARED_SRIOV_PREFIX));
}
- return Optional.empty();
+ return Optional.of(physicalNetworkName);
}
public static List<String> extractPciIdsFromVServer(Vserver vserver) {
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java
index 110faaf8ab..531496cc8f 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java
@@ -41,6 +41,8 @@ import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
@@ -48,9 +50,10 @@ import static org.mockito.Mockito.when;
import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;
+import java.nio.file.Files;
+import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Objects;
@@ -59,12 +62,12 @@ import java.util.Set;
import org.apache.commons.io.FileUtils;
import org.junit.Assert;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
import org.mockito.InjectMocks;
import org.mockito.Mock;
+import org.mockito.Spy;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.aai.domain.yang.L3InterfaceIpv6AddressList;
import org.onap.aai.domain.yang.LInterface;
@@ -73,9 +76,12 @@ import org.onap.aai.domain.yang.SriovPf;
import org.onap.aaiclient.client.aai.AAIDSLQueryClient;
import org.onap.aaiclient.client.aai.AAIResourcesClient;
import org.onap.aaiclient.client.aai.AAISingleTransactionClient;
+import org.onap.aaiclient.client.aai.entities.Results;
import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
+import org.onap.aaiclient.client.graphinventory.entities.DSLQuery;
+import org.onap.aaiclient.client.graphinventory.entities.Pathed;
import org.onap.aaiclient.client.graphinventory.exceptions.BulkProcessFailed;
import org.onap.so.cloud.resource.beans.NodeType;
import org.onap.so.db.catalog.beans.CloudIdentity;
@@ -98,6 +104,7 @@ import org.openstack4j.openstack.heat.domain.HeatResource;
import org.openstack4j.openstack.heat.domain.HeatResource.Resources;
import org.springframework.core.env.Environment;
import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.collect.ImmutableMap;
@@ -131,6 +138,10 @@ public class HeatBridgeImplTest {
@Mock
private Server server;
+ @Mock
+ private AAIDSLQueryClient dSLQueryClient;
+
+ @Spy
@InjectMocks
private HeatBridgeImpl heatbridge = new HeatBridgeImpl(resourcesClient, cloudIdentity, CLOUD_OWNER, REGION_ID,
REGION_ID, TENANT_ID, NodeType.GREENFIELD);
@@ -339,11 +350,13 @@ public class HeatBridgeImplTest {
}
@Test
- public void testUpdateVserverLInterfacesToAai() throws HeatBridgeException {
+ public void testUpdateVserverLInterfacesToAai()
+ throws HeatBridgeException, JsonParseException, JsonMappingException, IOException {
// Arrange
List<Resource> stackResources = (List<Resource>) extractTestStackResources();
Port port = mock(Port.class);
when(port.getId()).thenReturn("test-port-id");
+ when(port.getHostId()).thenReturn("pserverId");
when(port.getName()).thenReturn("test-port-name");
when(port.getvNicType()).thenReturn(HeatBridgeConstants.OS_SRIOV_PORT_TYPE);
when(port.getMacAddress()).thenReturn("78:4f:43:68:e2:78");
@@ -354,7 +367,7 @@ public class HeatBridgeImplTest {
when(server.getHypervisorHostname()).thenReturn("test.server.name");
String pfPciId = "0000:08:00.0";
when(port.getProfile()).thenReturn(ImmutableMap.of(HeatBridgeConstants.OS_PCI_SLOT_KEY, pfPciId,
- HeatBridgeConstants.OS_PHYSICAL_NETWORK_KEY, "physical_network_id"));
+ HeatBridgeConstants.OS_PF_PCI_SLOT_KEY, "testPfPciId"));
IP ip = mock(IP.class);
@@ -383,10 +396,14 @@ public class HeatBridgeImplTest {
SriovPf sriovPf = new SriovPf();
sriovPf.setPfPciId(pfPciId);
- PInterface pIf = mock(PInterface.class);
- when(pIf.getInterfaceName()).thenReturn("test-port-id");
- when(resourcesClient.get(eq(PInterface.class), any(AAIResourceUri.class))).thenReturn(Optional.of(pIf));
+
+ when(resourcesClient.exists(any(AAIResourceUri.class))).thenReturn(true);
when(env.getProperty("mso.cloudOwner.included", "")).thenReturn("CloudOwner");
+ doReturn(dSLQueryClient).when(heatbridge).getAAIDSLClient();
+ List<Pathed> pathed = ((Results<Pathed>) MAPPER.readValue(getJson("pathed-sriov-pf.json"),
+ new TypeReference<Results<Pathed>>() {})).getResult();
+ when(dSLQueryClient.queryPathed(any(DSLQuery.class))).thenReturn(pathed);
+ doReturn(false).when(heatbridge).sriovVfHasSriovPfRelationship(any());
// Act
heatbridge.buildAddVserverLInterfacesToAaiAction(stackResources, Arrays.asList("1", "2"), "CloudOwner");
@@ -396,6 +413,7 @@ public class HeatBridgeImplTest {
verify(osClient, times(5)).getPortById(anyString());
verify(osClient, times(5)).getSubnetById("testSubnetId");
verify(osClient, times(10)).getNetworkById(anyString());
+ verify(transaction, times(5)).connect(any(AAIResourceUri.class), any(AAIResourceUri.class));
}
@Test
@@ -463,6 +481,63 @@ public class HeatBridgeImplTest {
}
@Test
+ public void testUpdateLInterfaceVlan() throws HeatBridgeException {
+ // Arrange
+ List<Resource> stackResources = (List<Resource>) extractTestStackResources();
+ Port port = mock(Port.class);
+ when(port.getId()).thenReturn("test-port-id");
+ when(port.getName()).thenReturn("test-port-name");
+ when(port.getvNicType()).thenReturn(HeatBridgeConstants.OS_SRIOV_PORT_TYPE);
+ when(port.getMacAddress()).thenReturn("78:4f:43:68:e2:78");
+ when(port.getNetworkId()).thenReturn("890a203a-23gg-56jh-df67-731656a8f13a");
+ when(port.getDeviceId()).thenReturn("test-device-id");
+
+ LInterface lIf = new LInterface();
+ lIf.setInterfaceId("test-port-id");
+ lIf.setInterfaceType("SRIOV");
+ lIf.setInterfaceName("name");
+
+ String pfPciId = "0000:08:00.0";
+ when(port.getProfile()).thenReturn(ImmutableMap.of(HeatBridgeConstants.OS_PCI_SLOT_KEY, pfPciId,
+ HeatBridgeConstants.OS_PHYSICAL_NETWORK_KEY, "physical_network_id"));
+
+ IP ip = mock(IP.class);
+
+ Set<IP> ipSet = new HashSet<>();
+ ipSet.add(ip);
+ when(ip.getIpAddress()).thenReturn("2606:ae00:2e60:100::226");
+ when(ip.getSubnetId()).thenReturn("testSubnetId");
+ when(port.getFixedIps()).thenAnswer(x -> ipSet);
+
+ Subnet subnet = mock(Subnet.class);
+ when(subnet.getCidr()).thenReturn("169.254.100.0/24");
+ when(osClient.getSubnetById("testSubnetId")).thenReturn(subnet);
+
+ Network network = mock(Network.class);
+ when(network.getId()).thenReturn("test-network-id");
+ when(network.getNetworkType()).thenReturn(NetworkType.VLAN);
+ when(network.getProviderSegID()).thenReturn("2345");
+ when(network.getProviderPhyNet()).thenReturn("ovsnet");
+ doNothing().when(heatbridge).processOVS(any(), any(), any());
+
+ when(osClient.getNetworkById(anyString())).thenReturn(network);
+
+ SriovPf sriovPf = new SriovPf();
+ sriovPf.setPfPciId(pfPciId);
+ PInterface pIf = mock(PInterface.class);
+ when(pIf.getInterfaceName()).thenReturn("test-port-id");
+ when(resourcesClient.get(eq(PInterface.class), any(AAIResourceUri.class))).thenReturn(Optional.of(pIf));
+
+ // Act
+ heatbridge.updateLInterfaceVlan(port, lIf, "hostname");
+
+ // Assert
+ verify(transaction, times(2)).createIfNotExists(any(AAIResourceUri.class), any(Optional.class));
+ verify(osClient, times(1)).getNetworkById(anyString());
+ verify(heatbridge, times(0)).processOVS(any(), any(), any());
+ }
+
+ @Test
public void testUpdateLInterfaceIps()
throws HeatBridgeException, JsonParseException, JsonMappingException, IOException {
@@ -511,7 +586,8 @@ public class HeatBridgeImplTest {
}
@Test
- public void testUpdateVserverLInterfacesToAai_skipVlans() throws HeatBridgeException {
+ public void testUpdateVserverLInterfacesToAai_skipVlans()
+ throws HeatBridgeException, JsonParseException, JsonMappingException, IOException {
// Arrange
List<Resource> stackResources = (List<Resource>) extractTestStackResources();
Port port = mock(Port.class);
@@ -537,11 +613,9 @@ public class HeatBridgeImplTest {
when(osClient.getPortById("c54b9f45-b413-4937-bbe4-3c8a5689cfc9")).thenReturn(port);
when(osClient.getNetworkById(anyString())).thenReturn(network);
- SriovPf sriovPf = new SriovPf();
- sriovPf.setPfPciId(pfPciId);
PInterface pIf = mock(PInterface.class);
when(pIf.getInterfaceName()).thenReturn("test-port-id");
- when(resourcesClient.get(eq(PInterface.class), any(AAIResourceUri.class))).thenReturn(Optional.of(pIf));
+ doNothing().when(heatbridge).updateSriovPfToPserver(any(), any());
// Act
heatbridge.buildAddVserverLInterfacesToAaiAction(stackResources, Arrays.asList("1", "2"), "CloudOwner");
@@ -576,5 +650,9 @@ public class HeatBridgeImplTest {
return content;
}
+ private String getJson(String filename) throws IOException {
+ return new String(Files.readAllBytes(Paths.get("src/test/resources/__files/" + filename)));
+ }
+
}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/utils/HeatBridgeUtilsTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/utils/HeatBridgeUtilsTest.java
index bbc99bd258..13a8cb21e7 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/utils/HeatBridgeUtilsTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/utils/HeatBridgeUtilsTest.java
@@ -26,6 +26,6 @@ public class HeatBridgeUtilsTest {
@Test
public void matchServerName_unknown() {
Optional<String> serverName = HeatBridgeUtils.getMatchingPserverPifName("differentServerName");
- assertThat(serverName).isEmpty();
+ assertThat(serverName).isNotEmpty().hasValue("differentServerName");
}
}
diff --git a/adapters/mso-openstack-adapters/src/test/resources/__files/pathed-sriov-pf.json b/adapters/mso-openstack-adapters/src/test/resources/__files/pathed-sriov-pf.json
new file mode 100644
index 0000000000..cccad4c6d3
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/__files/pathed-sriov-pf.json
@@ -0,0 +1,8 @@
+{
+ "results" : [
+ {
+ "resource-type" : "sriov-pf",
+ "resource-link" : "/cloud-infrastructure/pservers/pserver/id1/p-interfaces/p-interface/id2/sriov-pfs/sriov-pf/id3"
+ }
+ ]
+} \ No newline at end of file
diff --git a/adapters/mso-requests-db-adapter/pom.xml b/adapters/mso-requests-db-adapter/pom.xml
index ca13895848..66b9a6b993 100644
--- a/adapters/mso-requests-db-adapter/pom.xml
+++ b/adapters/mso-requests-db-adapter/pom.xml
@@ -25,17 +25,14 @@
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-spring-boot-starter-jaxws</artifactId>
- <version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-spring-boot-starter-jaxrs</artifactId>
- <version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-rs-service-description-swagger</artifactId>
- <version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
@@ -159,7 +156,7 @@
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
- <version>2.4.0-b180725.0644</version>
+ <version>2.4.0-b180830.0438</version>
</dependency>
</dependencies>
<executions>
diff --git a/adapters/mso-sdnc-adapter/pom.xml b/adapters/mso-sdnc-adapter/pom.xml
index 808210389a..590121966e 100644
--- a/adapters/mso-sdnc-adapter/pom.xml
+++ b/adapters/mso-sdnc-adapter/pom.xml
@@ -179,17 +179,14 @@
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-spring-boot-starter-jaxws</artifactId>
- <version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-spring-boot-starter-jaxrs</artifactId>
- <version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-rs-service-description-swagger</artifactId>
- <version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
diff --git a/adapters/mso-vfc-adapter/pom.xml b/adapters/mso-vfc-adapter/pom.xml
index a86dc94cf2..eae6745866 100644
--- a/adapters/mso-vfc-adapter/pom.xml
+++ b/adapters/mso-vfc-adapter/pom.xml
@@ -66,17 +66,14 @@
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-spring-boot-starter-jaxws</artifactId>
- <version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-spring-boot-starter-jaxrs</artifactId>
- <version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-rs-service-description-swagger</artifactId>
- <version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy
index 55f1187d69..6377d77d19 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy
@@ -56,349 +56,363 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
private static final Logger logger = LoggerFactory.getLogger( SDNCAdapterRestV1.class)
- ExceptionUtil exceptionUtil = new ExceptionUtil()
- JsonUtils jsonUtil = new JsonUtils()
-
- /**
- * Processes the incoming request.
- */
- public void preProcessRequest (DelegateExecution execution) {
- def method = getClass().getSimpleName() + '.preProcessRequest(' +
- 'execution=' + execution.getId() +
- ')'
- logger.trace('Entered ' + method)
-
- def prefix="SDNCREST_"
- execution.setVariable("prefix", prefix)
- setSuccessIndicator(execution, false)
-
- try {
- // Determine the request type and log the request
-
- String request = validateRequest(execution, "mso-request-id")
- String requestType = jsonUtil.getJsonRootProperty(request)
- execution.setVariable(prefix + 'requestType', requestType)
- logger.debug(getProcessKey(execution) + ': ' + prefix + 'requestType = ' + requestType)
-
- // Determine the SDNCAdapter endpoint
-
- String sdncAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.sdnc.rest.endpoint", execution)
-
- if (sdncAdapterEndpoint == null || sdncAdapterEndpoint.isEmpty()) {
- String msg = getProcessKey(execution) + ': mso:adapters:sdnc:rest:endpoint URN mapping is not defined'
- logger.debug(msg)
- logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- ErrorCode.UnknownError.getValue())
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
- }
-
- while (sdncAdapterEndpoint.endsWith('/')) {
- sdncAdapterEndpoint = sdncAdapterEndpoint.substring(0, sdncAdapterEndpoint.length()-1)
- }
-
- String sdncAdapterMethod = null
- String sdncAdapterUrl = null
- String sdncAdapterRequest = request
-
- if ('SDNCServiceRequest'.equals(requestType)) {
- // Get the sdncRequestId from the request
-
- String sdncRequestId = jsonUtil.getJsonValue(request, requestType + ".sdncRequestId")
-
- if (sdncRequestId == null || sdncRequestId.isEmpty()) {
- String msg = getProcessKey(execution) + ': no sdncRequestId in ' + requestType
- logger.debug(msg)
- logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- ErrorCode.UnknownError.getValue())
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
- }
-
- execution.setVariable('SDNCAResponse_CORRELATOR', sdncRequestId)
- logger.debug(getProcessKey(execution) + ': SDNCAResponse_CORRELATOR = ' + sdncRequestId)
-
- // Get the bpNotificationUrl from the request (just to make sure it's there)
-
- String bpNotificationUrl = jsonUtil.getJsonValue(request, requestType + ".bpNotificationUrl")
-
- if (bpNotificationUrl == null || bpNotificationUrl.isEmpty()) {
- String msg = getProcessKey(execution) + ': no bpNotificationUrl in ' + requestType
- logger.debug(msg)
- logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- ErrorCode.UnknownError.getValue())
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
- }
-
- sdncAdapterMethod = 'POST'
- sdncAdapterUrl = sdncAdapterEndpoint
-
- RollbackData rollbackData = new RollbackData()
- rollbackData.setRequestId(sdncRequestId)
- rollbackData.getAdditionalData().put("service", jsonUtil.getJsonValue(request, requestType + ".sdncService"))
- rollbackData.getAdditionalData().put("operation", jsonUtil.getJsonValue(request, requestType + ".sdncOperation"))
- execution.setVariable("RollbackData", rollbackData)
-
- } else {
- String msg = getProcessKey(execution) + ': Unsupported request type: ' + requestType
- logger.debug(msg)
- logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- ErrorCode.UnknownError.getValue())
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
- }
-
- execution.setVariable(prefix + 'sdncAdapterMethod', sdncAdapterMethod)
- execution.setVariable(prefix + 'sdncAdapterUrl', sdncAdapterUrl)
- execution.setVariable(prefix + 'sdncAdapterRequest', sdncAdapterRequest)
-
- // Get the Basic Auth credentials for the SDNCAdapter (yes... we ARE using the PO adapters credentials)
-
- String basicAuthValue = UrnPropertiesReader.getVariable("mso.adapters.po.auth", execution)
-
- if (basicAuthValue == null || basicAuthValue.isEmpty()) {
- logger.debug(getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined")
- 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.debug(getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter")
- logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter",
- "BPMN", ErrorCode.UnknownError.getValue(), ex)
- }
- }
-
- // Set the timeout value, e.g. PT5M. It may be specified in the request as the
- // bpTimeout value. If it's not in the request, use the URN mapping value.
-
- String timeout = jsonUtil.getJsonValue(request, requestType + ".bpTimeout")
-
- // in addition to null/empty, also need to verify that the timer value is a valid duration "P[n]T[n]H|M|S"
- String timerRegex = "PT[0-9]+[HMS]"
- if (timeout == null || timeout.isEmpty() || !timeout.matches(timerRegex)) {
- logger.debug(getProcessKey(execution) + ': preProcessRequest(): null/empty/invalid bpTimeout value. Using "mso.adapters.sdnc.timeout"')
- timeout = UrnPropertiesReader.getVariable("mso.adapters.sdnc.timeout", execution)
- }
-
- // the timeout could still be null at this point if the config parm is missing/undefined
- // forced to log (so OPs can fix the config) and temporarily use a hard coded value of 10 seconds
- if (timeout == null) {
- msoLogger.warnSimple('preProcessRequest()', 'property "mso.adapters.sdnc.timeout" is missing/undefined. Using "PT10S"')
- timeout = "PT10S"
- }
-
- execution.setVariable(prefix + 'timeout', timeout)
- logger.debug(getProcessKey(execution) + ': ' + prefix + 'timeout = ' + timeout)
- } catch (BpmnError e) {
- throw e
- } catch (Exception e) {
- String msg = 'Caught exception in ' + method + ": " + e
- logger.debug(msg)
- logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- ErrorCode.UnknownError.getValue())
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
- }
- }
-
- /**
- * Sends the request to the SDNC adapter.
- */
- public void sendRequestToSDNCAdapter(DelegateExecution execution) {
- def method = getClass().getSimpleName() + '.sendRequestToSDNCAdapter(' +
- 'execution=' + execution.getId() +
- ')'
- logger.trace('Entered ' + method)
-
- String prefix = execution.getVariable('prefix')
-
- try {
- String sdncAdapterMethod = execution.getVariable(prefix + 'sdncAdapterMethod')
- logger.debug("SDNC Method is: " + sdncAdapterMethod)
- String sdncAdapterUrl = execution.getVariable(prefix + 'sdncAdapterUrl')
- logger.debug("SDNC Url is: " + sdncAdapterUrl)
- String sdncAdapterRequest = execution.getVariable(prefix + 'sdncAdapterRequest')
- logger.debug("SDNC Rest Request is: " + sdncAdapterRequest)
-
- URL url = new URL(sdncAdapterUrl)
-
- HttpClient httpClient = new HttpClientFactory().newJsonClient(url, ONAPComponents.SDNC_ADAPTER)
- httpClient.addAdditionalHeader("mso-request-id", execution.getVariable("mso-request-id"))
- httpClient.addAdditionalHeader("mso-service-instance-id", execution.getVariable("mso-service-instance-id"))
- httpClient.addAdditionalHeader("Authorization", execution.getVariable(prefix + "basicAuthHeaderValue"))
-
- Response response
-
- if ("GET".equals(sdncAdapterMethod)) {
- response = httpClient.get()
- } else if ("PUT".equals(sdncAdapterMethod)) {
- response = httpClient.put(sdncAdapterRequest)
- } else if ("POST".equals(sdncAdapterMethod)) {
- response = httpClient.post(sdncAdapterRequest)
- } else if ("DELETE".equals(sdncAdapterMethod)) {
- response = httpClient.delete(sdncAdapterRequest)
- } else {
- String msg = 'Unsupported HTTP method "' + sdncAdapterMethod + '" in ' + method + ": " + e
- logger.debug(msg)
- logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- ErrorCode.UnknownError.getValue())
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
- }
-
- execution.setVariable(prefix + "sdncAdapterStatusCode", response.getStatus())
- if(response.hasEntity()){
- execution.setVariable(prefix + "sdncAdapterResponse", response.readEntity(String.class))
- }
- } catch (BpmnError e) {
- throw e
- } catch (Exception e) {
- String msg = 'Caught exception in ' + method + ": " + e
- logger.debug(msg, e)
- logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- ErrorCode.UnknownError.getValue())
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
- }
- }
-
- /**
- * Processes a callback.
- */
- public void processCallback(DelegateExecution execution){
- def method = getClass().getSimpleName() + '.processCallback(' +
- 'execution=' + execution.getId() +
- ')'
- logger.trace('Entered ' + method)
-
- String prefix = execution.getVariable('prefix')
- String callback = execution.getVariable('SDNCAResponse_MESSAGE')
- logger.debug("Incoming SDNC Rest Callback is: " + callback)
-
- try {
- int callbackNumber = 1
- while (execution.getVariable(prefix + 'callback' + callbackNumber) != null) {
- ++callbackNumber
- }
-
- execution.setVariable(prefix + 'callback' + callbackNumber, callback)
- execution.removeVariable('SDNCAResponse_MESSAGE')
-
- String responseType = jsonUtil.getJsonRootProperty(callback)
-
- // Get the ackFinalIndicator and make sure it's either Y or N. Default to Y.
- String ackFinalIndicator = jsonUtil.getJsonValue(callback, responseType + ".ackFinalIndicator")
-
- if (!'N'.equals(ackFinalIndicator)) {
- ackFinalIndicator = 'Y'
- }
-
- execution.setVariable(prefix + "ackFinalIndicator", ackFinalIndicator)
-
- if (responseType.endsWith('Error')) {
- sdncAdapterBuildWorkflowException(execution, callback)
- }
- } catch (Exception e) {
- callback = callback == null || String.valueOf(callback).isEmpty() ? "NONE" : callback
- String msg = "Received error from SDNCAdapter: " + callback
- logger.debug(getProcessKey(execution) + ': ' + msg)
- exceptionUtil.buildWorkflowException(execution, 5300, msg)
- }
- }
-
- /**
- * 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 sdncAdapterBuildWorkflowException(DelegateExecution execution, String response) {
- try {
- String responseType = jsonUtil.getJsonRootProperty(response)
- String responseCode = jsonUtil.getJsonValue(response, responseType + ".responseCode")
- String responseMessage = jsonUtil.getJsonValue(response, responseType + ".responseMessage")
-
- String info = ""
-
- if (responseCode != null && !responseCode.isEmpty()) {
- info += " responseCode='" + responseCode + "'"
- }
-
- if (responseMessage != null && !responseMessage.isEmpty()) {
- info += " responseMessage='" + responseMessage + "'"
- }
-
- // Note: the mapping function handles a null or empty responseCode
- int mappedResponseCode = Integer.parseInt(exceptionUtil.MapSDNCResponseCodeToErrorCode(responseCode))
- exceptionUtil.buildWorkflowException(execution, mappedResponseCode, "Received " + responseType +
- " from SDNCAdapter:" + info)
- } catch (Exception e) {
- response = response == null || String.valueOf(response).isEmpty() ? "NONE" : response
- exceptionUtil.buildWorkflowException(execution, 5300, "Received error from SDNCAdapter: " + response)
- }
- }
-
- /**
- * Gets the last callback request from the execution, or null if there was no callback.
- */
- public String getLastCallback(DelegateExecution execution) {
- def method = getClass().getSimpleName() + '.getLastCallback(' +
- 'execution=' + execution.getId() +
- ')'
- logger.trace('Entered ' + method)
-
- String prefix = execution.getVariable('prefix')
-
- try {
- int callbackNumber = 1
- String callback = null
-
- while (true) {
- String thisCallback = (String) execution.getVariable(prefix + 'callback' + callbackNumber)
-
- if (thisCallback == null) {
- break
- }
-
- callback = thisCallback
- ++callbackNumber
- }
-
- return callback
- } catch (Exception e) {
- String msg = 'Caught exception in ' + method + ": " + e
- logger.debug(msg)
- logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- ErrorCode.UnknownError.getValue())
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
- }
- }
-
- /**
- * Sets the timeout value to wait for the next notification.
- */
- public void setTimeoutValue(DelegateExecution execution) {
- def method = getClass().getSimpleName() + '.setTimeoutValue(' +
- 'execution=' + execution.getId() +
- ')'
- logger.trace('Entered ' + method)
-
- String prefix = execution.getVariable('prefix')
-
- try {
- def timeoutValue = UrnPropertiesReader.getVariable("mso.adapters.sdnc.timeout", execution)
-
- if (execution.getVariable(prefix + 'callback1') != null) {
- // Waiting for subsequent notifications
- }
- } catch (Exception e) {
- String msg = 'Caught exception in ' + method + ": " + e
- logger.debug(msg)
- logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- ErrorCode.UnknownError.getValue())
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
- }
- }
-
- public Logger getLogger() {
- return logger
- }
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+ JsonUtils jsonUtil = new JsonUtils()
+
+ /**
+ * Processes the incoming request.
+ */
+ public void preProcessRequest (DelegateExecution execution) {
+ def method = getClass().getSimpleName() + '.preProcessRequest(' +
+ 'execution=' + execution.getId() +
+ ')'
+ logger.trace('Entered ' + method)
+
+ def prefix="SDNCREST_"
+ execution.setVariable("prefix", prefix)
+ setSuccessIndicator(execution, false)
+
+ try {
+ // Determine the request type and log the request
+
+ String request = validateRequest(execution, "mso-request-id")
+ String requestType = jsonUtil.getJsonRootProperty(request)
+ execution.setVariable(prefix + 'requestType', requestType)
+ logger.debug(getProcessKey(execution) + ': ' + prefix + 'requestType = ' + requestType)
+
+ // Determine the SDNCAdapter endpoint
+
+ String sdncAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.sdnc.rest.endpoint", execution)
+
+ if (sdncAdapterEndpoint == null || sdncAdapterEndpoint.isEmpty()) {
+ String msg = getProcessKey(execution) + ': mso:adapters:sdnc:rest:endpoint URN mapping is not defined'
+ logger.debug(msg)
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ ErrorCode.UnknownError.getValue())
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ }
+
+ while (sdncAdapterEndpoint.endsWith('/')) {
+ sdncAdapterEndpoint = sdncAdapterEndpoint.substring(0, sdncAdapterEndpoint.length()-1)
+ }
+
+ String sdncAdapterMethod = null
+ String sdncAdapterUrl = null
+ String sdncAdapterRequest = request
+
+ if ('SDNCServiceRequest'.equals(requestType)) {
+ // Get the sdncRequestId from the request
+
+ String sdncRequestId = jsonUtil.getJsonValue(request, requestType + ".sdncRequestId")
+
+ if (sdncRequestId == null || sdncRequestId.isEmpty()) {
+ String msg = getProcessKey(execution) + ': no sdncRequestId in ' + requestType
+ logger.debug(msg)
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ ErrorCode.UnknownError.getValue())
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ }
+
+ execution.setVariable('SDNCAResponse_CORRELATOR', sdncRequestId)
+ logger.debug(getProcessKey(execution) + ': SDNCAResponse_CORRELATOR = ' + sdncRequestId)
+
+ // Get the bpNotificationUrl from the request (just to make sure it's there)
+
+ String bpNotificationUrl = jsonUtil.getJsonValue(request, requestType + ".bpNotificationUrl")
+
+ if (bpNotificationUrl == null || bpNotificationUrl.isEmpty()) {
+ String msg = getProcessKey(execution) + ': no bpNotificationUrl in ' + requestType
+ logger.debug(msg)
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ ErrorCode.UnknownError.getValue())
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ }
+
+ sdncAdapterMethod = 'POST'
+ sdncAdapterUrl = sdncAdapterEndpoint
+
+ RollbackData rollbackData = new RollbackData()
+ rollbackData.setRequestId(sdncRequestId)
+ rollbackData.getAdditionalData().put("service", jsonUtil.getJsonValue(request, requestType + ".sdncService"))
+ rollbackData.getAdditionalData().put("operation", jsonUtil.getJsonValue(request, requestType + ".sdncOperation"))
+ execution.setVariable("RollbackData", rollbackData)
+
+ } else {
+ String msg = getProcessKey(execution) + ': Unsupported request type: ' + requestType
+ logger.debug(msg)
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ ErrorCode.UnknownError.getValue())
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ }
+
+ execution.setVariable(prefix + 'sdncAdapterMethod', sdncAdapterMethod)
+ execution.setVariable(prefix + 'sdncAdapterUrl', sdncAdapterUrl)
+ execution.setVariable(prefix + 'sdncAdapterRequest', sdncAdapterRequest)
+
+ // Get the Basic Auth credentials for the SDNCAdapter (yes... we ARE using the PO adapters credentials)
+
+ String basicAuthValue = UrnPropertiesReader.getVariable("mso.adapters.po.auth", execution)
+
+ if (basicAuthValue == null || basicAuthValue.isEmpty()) {
+ logger.debug(getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined")
+ 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.debug(getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter")
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter",
+ "BPMN", ErrorCode.UnknownError.getValue(), ex)
+ }
+ }
+
+ // Set the timeout value, e.g. PT5M. It may be specified in the request as the
+ // bpTimeout value. If it's not in the request, use the URN mapping value.
+
+ String timeout = jsonUtil.getJsonValue(request, requestType + ".bpTimeout")
+
+ // in addition to null/empty, also need to verify that the timer value is a valid duration "P[n]T[n]H|M|S"
+ String timerRegex = "PT[0-9]+[HMS]"
+ if (timeout == null || timeout.isEmpty() || !timeout.matches(timerRegex)) {
+ logger.debug(getProcessKey(execution) + ': preProcessRequest(): null/empty/invalid bpTimeout value. Using "mso.adapters.sdnc.timeout"')
+ timeout = UrnPropertiesReader.getVariable("mso.adapters.sdnc.timeout", execution)
+ }
+
+ // the timeout could still be null at this point if the config parm is missing/undefined
+ // forced to log (so OPs can fix the config) and temporarily use a hard coded value of 10 seconds
+ if (timeout == null) {
+ msoLogger.warnSimple('preProcessRequest()', 'property "mso.adapters.sdnc.timeout" is missing/undefined. Using "PT10S"')
+ timeout = "PT10S"
+ }
+
+ execution.setVariable(prefix + 'timeout', timeout)
+
+ Boolean failOnCallbackError = execution.getVariable("failOnCallbackError")
+ if(failOnCallbackError == null) {
+ execution.setVariable("failOnCallbackError", true)
+ }
+
+ logger.debug(getProcessKey(execution) + ': ' + prefix + 'timeout = ' + timeout)
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception e) {
+ String msg = 'Caught exception in ' + method + ": " + e
+ logger.debug(msg)
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ ErrorCode.UnknownError.getValue())
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ }
+ }
+
+ /**
+ * Sends the request to the SDNC adapter.
+ */
+ public void sendRequestToSDNCAdapter(DelegateExecution execution) {
+ def method = getClass().getSimpleName() + '.sendRequestToSDNCAdapter(' +
+ 'execution=' + execution.getId() +
+ ')'
+ logger.trace('Entered ' + method)
+
+ String prefix = execution.getVariable('prefix')
+
+ try {
+ String sdncAdapterMethod = execution.getVariable(prefix + 'sdncAdapterMethod')
+ logger.debug("SDNC Method is: " + sdncAdapterMethod)
+ String sdncAdapterUrl = execution.getVariable(prefix + 'sdncAdapterUrl')
+ logger.debug("SDNC Url is: " + sdncAdapterUrl)
+ String sdncAdapterRequest = execution.getVariable(prefix + 'sdncAdapterRequest')
+ logger.debug("SDNC Rest Request is: " + sdncAdapterRequest)
+
+ URL url = new URL(sdncAdapterUrl)
+
+ HttpClient httpClient = new HttpClientFactory().newJsonClient(url, ONAPComponents.SDNC_ADAPTER)
+ httpClient.addAdditionalHeader("mso-request-id", execution.getVariable("mso-request-id"))
+ httpClient.addAdditionalHeader("mso-service-instance-id", execution.getVariable("mso-service-instance-id"))
+ httpClient.addAdditionalHeader("Authorization", execution.getVariable(prefix + "basicAuthHeaderValue"))
+
+ Response response
+
+ if ("GET".equals(sdncAdapterMethod)) {
+ response = httpClient.get()
+ } else if ("PUT".equals(sdncAdapterMethod)) {
+ response = httpClient.put(sdncAdapterRequest)
+ } else if ("POST".equals(sdncAdapterMethod)) {
+ response = httpClient.post(sdncAdapterRequest)
+ } else if ("DELETE".equals(sdncAdapterMethod)) {
+ response = httpClient.delete(sdncAdapterRequest)
+ } else {
+ String msg = 'Unsupported HTTP method "' + sdncAdapterMethod + '" in ' + method + ": " + e
+ logger.debug(msg)
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ ErrorCode.UnknownError.getValue())
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ }
+
+ execution.setVariable(prefix + "sdncAdapterStatusCode", response.getStatus())
+ if(response.hasEntity()){
+ execution.setVariable(prefix + "sdncAdapterResponse", response.readEntity(String.class))
+ }
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception e) {
+ String msg = 'Caught exception in ' + method + ": " + e
+ logger.debug(msg, e)
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ ErrorCode.UnknownError.getValue())
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ }
+ }
+
+ /**
+ * Processes a callback.
+ */
+ public void processCallback(DelegateExecution execution){
+ def method = getClass().getSimpleName() + '.processCallback(' +
+ 'execution=' + execution.getId() +
+ ')'
+ logger.trace('Entered ' + method)
+
+ String prefix = execution.getVariable('prefix')
+ String callback = execution.getVariable('SDNCAResponse_MESSAGE')
+ logger.debug("Incoming SDNC Rest Callback is: " + callback)
+
+ try {
+ int callbackNumber = 1
+ while (execution.getVariable(prefix + 'callback' + callbackNumber) != null) {
+ ++callbackNumber
+ }
+
+ execution.setVariable(prefix + 'callback' + callbackNumber, callback)
+ execution.removeVariable('SDNCAResponse_MESSAGE')
+
+ String responseType = jsonUtil.getJsonRootProperty(callback)
+
+ // Get the ackFinalIndicator and make sure it's either Y or N. Default to Y.
+ String ackFinalIndicator = jsonUtil.getJsonValue(callback, responseType + ".ackFinalIndicator")
+
+ if (!'N'.equals(ackFinalIndicator)) {
+ ackFinalIndicator = 'Y'
+ }
+
+ execution.setVariable(prefix + "ackFinalIndicator", ackFinalIndicator)
+
+ if (responseType.endsWith('Error')) {
+ Boolean failOnCallbackError = execution.getVariable("failOnCallbackError")
+ if(failOnCallbackError) {
+ sdncAdapterBuildWorkflowException(execution, callback)
+ }else {
+ if(ackFinalIndicator.equals('Y')) {
+ sdncAdapterBuildWorkflowException(execution, callback)
+ }
+ }
+ }
+
+ } catch (Exception e) {
+ callback = callback == null || String.valueOf(callback).isEmpty() ? "NONE" : callback
+ String msg = "Received error from SDNCAdapter: " + callback
+ logger.debug(getProcessKey(execution) + ': ' + msg)
+ exceptionUtil.buildWorkflowException(execution, 5300, msg)
+ }
+ }
+
+ /**
+ * 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 sdncAdapterBuildWorkflowException(DelegateExecution execution, String response) {
+ try {
+ String responseType = jsonUtil.getJsonRootProperty(response)
+ String responseCode = jsonUtil.getJsonValue(response, responseType + ".responseCode")
+ String responseMessage = jsonUtil.getJsonValue(response, responseType + ".responseMessage")
+
+ String info = ""
+
+ if (responseCode != null && !responseCode.isEmpty()) {
+ info += " responseCode='" + responseCode + "'"
+ }
+
+ if (responseMessage != null && !responseMessage.isEmpty()) {
+ info += " responseMessage='" + responseMessage + "'"
+ }
+
+ // Note: the mapping function handles a null or empty responseCode
+ int mappedResponseCode = Integer.parseInt(exceptionUtil.MapSDNCResponseCodeToErrorCode(responseCode))
+ exceptionUtil.buildWorkflowException(execution, mappedResponseCode, "Received " + responseType +
+ " from SDNCAdapter:" + info)
+ } catch (Exception e) {
+ response = response == null || String.valueOf(response).isEmpty() ? "NONE" : response
+ exceptionUtil.buildWorkflowException(execution, 5300, "Received error from SDNCAdapter: " + response)
+ }
+ }
+
+ /**
+ * Gets the last callback request from the execution, or null if there was no callback.
+ */
+ public String getLastCallback(DelegateExecution execution) {
+ def method = getClass().getSimpleName() + '.getLastCallback(' +
+ 'execution=' + execution.getId() +
+ ')'
+ logger.trace('Entered ' + method)
+
+ String prefix = execution.getVariable('prefix')
+
+ try {
+ int callbackNumber = 1
+ String callback = null
+
+ while (true) {
+ String thisCallback = (String) execution.getVariable(prefix + 'callback' + callbackNumber)
+
+ if (thisCallback == null) {
+ break
+ }
+
+ callback = thisCallback
+ ++callbackNumber
+ }
+
+ return callback
+ } catch (Exception e) {
+ String msg = 'Caught exception in ' + method + ": " + e
+ logger.debug(msg)
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ ErrorCode.UnknownError.getValue())
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ }
+ }
+
+ /**
+ * Sets the timeout value to wait for the next notification.
+ */
+ public void setTimeoutValue(DelegateExecution execution) {
+ def method = getClass().getSimpleName() + '.setTimeoutValue(' +
+ 'execution=' + execution.getId() +
+ ')'
+ logger.trace('Entered ' + method)
+
+ String prefix = execution.getVariable('prefix')
+
+ try {
+ def timeoutValue = UrnPropertiesReader.getVariable("mso.adapters.sdnc.timeout", execution)
+
+ if (execution.getVariable(prefix + 'callback1') != null) {
+ // Waiting for subsequent notifications
+ }
+ } catch (Exception e) {
+ String msg = 'Caught exception in ' + method + ": " + e
+ logger.debug(msg)
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ ErrorCode.UnknownError.getValue())
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ }
+ }
+
+ public Logger getLogger() {
+ return logger
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java
index 4206596c94..3b84b150e0 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java
@@ -213,7 +213,8 @@ public class ExecuteBuildingBlockRainyDay {
String targetState = "";
if ("RollbackToAssigned".equalsIgnoreCase(handlingCode)) {
targetState = Status.ROLLED_BACK_TO_ASSIGNED.toString();
- } else if ("RollbackToCreated".equalsIgnoreCase(handlingCode)) {
+ } else if ("RollbackToCreated".equalsIgnoreCase(handlingCode)
+ || "RollbackToCreatedNoConfiguration".equalsIgnoreCase(handlingCode)) {
targetState = Status.ROLLED_BACK_TO_CREATED.toString();
} else {
targetState = Status.ROLLED_BACK.toString();
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 843cca0848..43db27917e 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
@@ -232,6 +232,20 @@ public class ExceptionBuilder {
throw new BpmnError("MSOWorkflowException");
}
+ public void buildAndThrowWorkflowException(DelegateExecution execution, int errorCode, String errorMessage,
+ ONAPComponentsList extSystemErrorSource, String workStep) {
+ String processKey = getProcessKey(execution);
+ logger.info("Building a WorkflowException for Subflow");
+
+ WorkflowException exception =
+ new WorkflowException(processKey, errorCode, errorMessage, workStep, extSystemErrorSource);
+ execution.setVariable("WorkflowException", exception);
+ execution.setVariable("WorkflowExceptionErrorMessage", errorMessage);
+ logger.info("Outgoing WorkflowException is {}", exception);
+ logger.info("Throwing MSOWorkflowException");
+ throw new BpmnError("MSOWorkflowException");
+ }
+
public WorkflowException buildWorkflowException(DelegateExecution execution, int errorCode, String errorMessage,
ONAPComponentsList extSystemErrorSource) {
String processKey = getProcessKey(execution);
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDayTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDayTest.java
index ee47b514d1..b34d9dce9c 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDayTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDayTest.java
@@ -259,6 +259,35 @@ public class ExecuteBuildingBlockRainyDayTest extends BaseTest {
assertEquals(Status.ROLLED_BACK_TO_CREATED.toString(), delegateExecution.getVariable("rollbackTargetState"));
}
+ @Test
+ public void queryRainyDayTableRollbackToCreatedNoConfiguration() throws Exception {
+ customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
+ serviceInstance.getModelInfoServiceInstance().setServiceType("st1");
+ vnf.setVnfType("vnft1");
+ BuildingBlock buildingBlock = new BuildingBlock().setBpmnFlowName("AddFabricConfigurationBB");
+ ExecuteBuildingBlock executeBuildingBlock = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock);
+ delegateExecution.setVariable("buildingBlock", executeBuildingBlock);
+ delegateExecution.setVariable("aLaCarte", true);
+ delegateExecution.setVariable("suppressRollback", false);
+ delegateExecution.setVariable("WorkflowExceptionCode", "7000");
+ RainyDayHandlerStatus rainyDayHandlerStatus = new RainyDayHandlerStatus();
+ rainyDayHandlerStatus.setErrorCode("7000");
+ rainyDayHandlerStatus.setFlowName("AddFabricConfigurationBB");
+ rainyDayHandlerStatus.setServiceType("st1");
+ rainyDayHandlerStatus.setVnfType("vnft1");
+ rainyDayHandlerStatus.setPolicy("RollbackToCreatedNoConfiguration");
+ rainyDayHandlerStatus.setWorkStep(ASTERISK);
+ rainyDayHandlerStatus.setSecondaryPolicy("Abort");
+
+ doReturn(rainyDayHandlerStatus).when(MOCK_catalogDbClient).getRainyDayHandlerStatus("AddFabricConfigurationBB",
+ "st1", "vnft1", "7000", "*", "errorMessage", "*");
+
+ executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution, true);
+
+ assertEquals("RollbackToCreatedNoConfiguration", delegateExecution.getVariable("handlingCode"));
+ assertEquals(Status.ROLLED_BACK_TO_CREATED.toString(), delegateExecution.getVariable("rollbackTargetState"));
+ }
+
@Test
public void suppressRollbackTest() throws Exception {
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderUnitTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderUnitTest.java
index 5baafbba67..b7e4dd98d8 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderUnitTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderUnitTest.java
@@ -22,6 +22,7 @@
package org.onap.so.client.exception;
+import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.times;
@@ -39,6 +40,7 @@ import org.mockito.Mock;
import org.mockito.Spy;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.core.WorkflowException;
import org.onap.logging.filter.base.ONAPComponents;
@RunWith(MockitoJUnitRunner.class)
@@ -95,4 +97,17 @@ public class ExceptionBuilderUnitTest {
thrown.expect(BpmnError.class);
exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getMessage(), ONAPComponents.SDNC);
}
+
+ @Test
+ public void buildAndThrowWorkflowExceptionWithWorkStepTest() {
+ doReturn("Process key").when(exceptionBuilder).getProcessKey(execution);
+
+ try {
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getMessage(), ONAPComponents.SDNC,
+ "WORKSTEP");
+ } catch (BpmnError e) {
+ }
+ WorkflowException workflowException = (WorkflowException) execution.getVariable("WorkflowException");
+ assertEquals("WORKSTEP", workflowException.getWorkStep());
+ }
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/resources/org.onap.so.p12 b/bpmn/mso-infrastructure-bpmn/src/main/resources/org.onap.so.p12
index 79631bf344..50602dde95 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/resources/org.onap.so.p12
+++ b/bpmn/mso-infrastructure-bpmn/src/main/resources/org.onap.so.p12
Binary files differ
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/resources/org.onap.so.trust.jks b/bpmn/mso-infrastructure-bpmn/src/main/resources/org.onap.so.trust.jks
index 6f8168d896..7b67a40bb9 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/resources/org.onap.so.trust.jks
+++ b/bpmn/mso-infrastructure-bpmn/src/main/resources/org.onap.so.trust.jks
Binary files differ
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn
index f2e0ce29ff..5fd9701880 100644
--- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn
@@ -95,7 +95,7 @@
</bpmn:serviceTask>
</bpmn:subProcess>
<bpmn:sequenceFlow id="SequenceFlow_0v588sm" name="Rollback = true" sourceRef="ExclusiveGateway_Finished" targetRef="Task_RollbackExecutionPath">
- <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("handlingCode")=="Rollback"||execution.getVariable("handlingCode")=="RollbackToAssigned"||execution.getVariable("handlingCode")=="RollbackToCreated"}</bpmn:conditionExpression>
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("handlingCode")=="Rollback"||execution.getVariable("handlingCode")=="RollbackToAssigned"||execution.getVariable("handlingCode")=="RollbackToCreated"||execution.getVariable("handlingCode")=="RollbackToCreatedNoConfiguration"}</bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:sequenceFlow id="SequenceFlow_1atzsgn" sourceRef="Task_RollbackExecutionPath" targetRef="Task_SelectBB">
<bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("isRollbackNeeded")==true}</bpmn:conditionExpression>
diff --git a/bpmn/so-bpmn-infrastructure-common/pom.xml b/bpmn/so-bpmn-infrastructure-common/pom.xml
index 5dad9b8687..ebc0264c7e 100644
--- a/bpmn/so-bpmn-infrastructure-common/pom.xml
+++ b/bpmn/so-bpmn-infrastructure-common/pom.xml
@@ -143,17 +143,14 @@
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-spring-boot-starter-jaxws</artifactId>
- <version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-spring-boot-starter-jaxrs</artifactId>
- <version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-rs-service-description-swagger</artifactId>
- <version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSliceSubnet.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSliceSubnet.groovy
index c7fe7e36a6..eabe58488e 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSliceSubnet.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSliceSubnet.groovy
@@ -32,150 +32,148 @@ import org.slf4j.LoggerFactory
import static org.apache.commons.lang3.StringUtils.isBlank
class ActivateSliceSubnet extends AbstractServiceTaskProcessor {
- String Prefix="ActSS"
- ExceptionUtil exceptionUtil = new ExceptionUtil()
- JsonUtils jsonUtil = new JsonUtils()
- RequestDBUtil requestDBUtil = new RequestDBUtil()
-
- private static final Logger logger = LoggerFactory.getLogger(ActivateSliceSubnet.class)
-
- @Override
- void preProcessRequest(DelegateExecution execution) {
- logger.debug(Prefix + "preProcessRequest Start")
- execution.setVariable("prefix", Prefix)
- execution.setVariable("startTime", System.currentTimeMillis())
- def msg
- try {
- // get request input
- String subnetInstanceReq = execution.getVariable("bpmnRequest")
- logger.debug(subnetInstanceReq)
-
- String requestId = execution.getVariable("mso-request-id")
- execution.setVariable("msoRequestId", requestId)
- logger.debug("Input Request:" + subnetInstanceReq + " reqId:" + requestId)
-
- //subscriberInfo
- String globalSubscriberId = jsonUtil.getJsonValue(subnetInstanceReq, "globalSubscriberId")
- if (isBlank(globalSubscriberId)) {
- msg = "Input globalSubscriberId' is null"
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
- } else {
- execution.setVariable("globalSubscriberId", globalSubscriberId)
- }
-
- //NSSI ID
- String serviceInstanceID = jsonUtil.getJsonValue(subnetInstanceReq, "serviceInstanceID")
- if (isBlank(serviceInstanceID)) {
- msg = "Input serviceInstanceID is null"
- logger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
- } else
- {
- execution.setVariable("serviceInstanceID", serviceInstanceID)
- }
-
- String nsiId = jsonUtil.getJsonValue(subnetInstanceReq, "additionalProperties.nsiId")
- if (isBlank(nsiId)) {
- msg = "Input nsiId is null"
- logger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
- } else
- {
- execution.setVariable("nsiId", nsiId)
- }
- String networkType = jsonUtil.getJsonValue(subnetInstanceReq, "networkType")
- if (isBlank(networkType)) {
- msg = "Input networkType is null"
- logger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
- } else
- {
- execution.setVariable("networkType", networkType.toUpperCase())
- }
-
- //requestParameters, subscriptionServiceType is 5G
- String subscriptionServiceType = jsonUtil.getJsonValue(subnetInstanceReq, "subscriptionServiceType")
- if (isBlank(subscriptionServiceType)) {
- msg = "Input subscriptionServiceType is null"
- logger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
- } else {
- execution.setVariable("subscriptionServiceType", subscriptionServiceType)
- }
-
- //operationType = deactivateInstance/activateInstance
- String operationType = execution.getVariable("requestAction")
- if (isBlank(operationType)) {
- msg = "Input operationType is null"
- logger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
- } else {
- execution.setVariable("operationType", operationType)
- }
-
- String jobId = UUID.randomUUID().toString()
- execution.setVariable("jobId", jobId)
-
- String sliceParams = jsonUtil.getJsonValue(subnetInstanceReq, "additionalProperties")
- execution.setVariable("sliceParams", sliceParams)
-
- } catch(BpmnError e) {
- throw e
- } catch(Exception ex) {
- msg = "Exception in ActivateSliceSubnet.preProcessRequest " + ex.getMessage()
- logger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
- }
- logger.debug(Prefix + "preProcessRequest Exit")
- }
-
-
- /**
- * create operation status in request db
- *
- * Init the Operation Status
- */
- def prepareInitOperationStatus = { DelegateExecution execution ->
- logger.debug(Prefix + "prepareInitOperationStatus Start")
-
- String serviceId = execution.getVariable("serviceInstanceID")
- String jobId = execution.getVariable("jobId")
- String nsiId = execution.getVariable("nsiId")
- String operationType = execution.getVariable("operationType")
- logger.debug("Generated new job for Service Instance serviceId:" + serviceId + " jobId:" + jobId)
-
- ResourceOperationStatus initStatus = new ResourceOperationStatus()
- initStatus.setServiceId(serviceId)
- initStatus.setOperationId(jobId)
- initStatus.setResourceTemplateUUID(nsiId)
- initStatus.setOperType(operationType)
- requestDBUtil.prepareInitResourceOperationStatus(execution, initStatus)
-
- logger.debug(Prefix + "prepareInitOperationStatus Exit")
- }
-
-
-
- /**
- * return sync response
- */
- def sendSyncResponse = { DelegateExecution execution ->
- logger.debug(Prefix + "sendSyncResponse Start")
- try {
- String jobId = execution.getVariable("jobId")
- String activateSyncResponse = """{"jobId": "${jobId}","status": "processing"}"""
- .trim().replaceAll(" ", "")
-
- logger.debug("sendSyncResponse to APIH:" + "\n" + activateSyncResponse)
- sendWorkflowResponse(execution, 202, activateSyncResponse)
-
- execution.setVariable("sentSyncResponse", true)
- } catch (Exception ex) {
- String msg = "Exception in sendSyncResponse:" + ex.getMessage()
- logger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
- }
- logger.debug(Prefix + "sendSyncResponse Exit")
- }
-
+ String Prefix="ActivateSliceSubnet_"
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+ JsonUtils jsonUtil = new JsonUtils()
+ RequestDBUtil requestDBUtil = new RequestDBUtil()
+
+ private static final Logger logger = LoggerFactory.getLogger(ActivateSliceSubnet.class)
+
+ @Override
+ void preProcessRequest(DelegateExecution execution) {
+ logger.debug(Prefix + "preProcessRequest Start")
+ execution.setVariable("prefix", Prefix)
+ execution.setVariable("startTime", System.currentTimeMillis())
+ def msg
+ try {
+ // get request input
+ String subnetInstanceReq = execution.getVariable("bpmnRequest")
+ logger.debug(subnetInstanceReq)
+
+ String requestId = execution.getVariable("mso-request-id")
+ execution.setVariable("msoRequestId", requestId)
+ logger.debug("Input Request:" + subnetInstanceReq + " reqId:" + requestId)
+
+ //subscriberInfo
+ String globalSubscriberId = jsonUtil.getJsonValue(subnetInstanceReq, "globalSubscriberId")
+ if (isBlank(globalSubscriberId)) {
+ msg = "Input globalSubscriberId' is null"
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else {
+ execution.setVariable("globalSubscriberId", globalSubscriberId)
+ }
+
+ //NSSI ID
+ String serviceInstanceID = jsonUtil.getJsonValue(subnetInstanceReq, "serviceInstanceID")
+ if (isBlank(serviceInstanceID)) {
+ msg = "Input serviceInstanceID is null"
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else
+ {
+ execution.setVariable("serviceInstanceID", serviceInstanceID)
+ }
+ String nsiId = jsonUtil.getJsonValue(subnetInstanceReq, "additionalProperties.nsiId")
+ if (isBlank(nsiId)) {
+ msg = "Input nsiId is null"
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else
+ {
+ execution.setVariable("nsiId", nsiId)
+ }
+ String networkType = jsonUtil.getJsonValue(subnetInstanceReq, "networkType")
+ if (isBlank(networkType)) {
+ msg = "Input networkType is null"
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else
+ {
+ execution.setVariable("networkType", networkType.toUpperCase())
+ }
+ //requestParameters, subscriptionServiceType is 5G
+ String subscriptionServiceType = jsonUtil.getJsonValue(subnetInstanceReq, "subscriptionServiceType")
+ if (isBlank(subscriptionServiceType)) {
+ msg = "Input subscriptionServiceType is null"
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else {
+ execution.setVariable("subscriptionServiceType", subscriptionServiceType)
+ }
+
+ //operationType = deactivateInstance/activateInstance
+ String operationType = execution.getVariable("requestAction")
+ if (isBlank(operationType)) {
+ msg = "Input operationType is null"
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else {
+ execution.setVariable("operationType", operationType)
+ }
+
+ String jobId = UUID.randomUUID().toString()
+ execution.setVariable("jobId", jobId)
+
+ String sliceParams = jsonUtil.getJsonValue(subnetInstanceReq, "additionalProperties")
+ execution.setVariable("sliceParams", sliceParams)
+
+ } catch(BpmnError e) {
+ throw e
+ } catch(Exception ex) {
+ msg = "Exception in ActivateSliceSubnet.preProcessRequest " + ex.getMessage()
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ logger.debug(Prefix + "preProcessRequest Exit")
+ }
+
+
+ /**
+ * create operation status in request db
+ *
+ * Init the Operation Status
+ */
+ def prepareInitOperationStatus = { DelegateExecution execution ->
+ logger.debug(Prefix + "prepareInitOperationStatus Start")
+
+ String serviceId = execution.getVariable("serviceInstanceID")
+ String jobId = execution.getVariable("jobId")
+ String nsiId = execution.getVariable("nsiId")
+ String operationType = execution.getVariable("operationType")
+ logger.debug("Generated new job for Service Instance serviceId:" + serviceId + " jobId:" + jobId)
+
+ ResourceOperationStatus initStatus = new ResourceOperationStatus()
+ initStatus.setServiceId(serviceId)
+ initStatus.setOperationId(jobId)
+ initStatus.setResourceTemplateUUID(nsiId)
+ initStatus.setOperType(operationType)
+ requestDBUtil.prepareInitResourceOperationStatus(execution, initStatus)
+
+ logger.debug(Prefix + "prepareInitOperationStatus Exit")
+ }
+
+
+
+ /**
+ * return sync response
+ */
+ def sendSyncResponse = { DelegateExecution execution ->
+ logger.debug(Prefix + "sendSyncResponse Start")
+ try {
+ String jobId = execution.getVariable("jobId")
+ String activateSyncResponse = """{"jobId": "${jobId}","status": "processing"}"""
+ .trim().replaceAll(" ", "")
+
+ logger.debug("sendSyncResponse to APIH:" + "\n" + activateSyncResponse)
+ sendWorkflowResponse(execution, 202, activateSyncResponse)
+
+ execution.setVariable("sentSyncResponse", true)
+ } catch (Exception ex) {
+ String msg = "Exception in sendSyncResponse:" + ex.getMessage()
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ logger.debug(Prefix + "sendSyncResponse Exit")
+ }
+
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/AllocateSliceSubnet.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/AllocateSliceSubnet.groovy
index 5a7722d679..9100f2773b 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/AllocateSliceSubnet.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/AllocateSliceSubnet.groovy
@@ -33,158 +33,158 @@ import static org.apache.commons.lang3.StringUtils.isBlank
class AllocateSliceSubnet extends AbstractServiceTaskProcessor {
- String Prefix="ASS_"
- ExceptionUtil exceptionUtil = new ExceptionUtil()
- RequestDBUtil requestDBUtil = new RequestDBUtil()
- JsonUtils jsonUtil = new JsonUtils()
- private static final Logger logger = LoggerFactory.getLogger(AllocateSliceSubnet.class)
-
- @Override
- void preProcessRequest(DelegateExecution execution) {
- logger.debug(Prefix + "preProcessRequest Start")
- execution.setVariable("prefix", Prefix)
- execution.setVariable("startTime", System.currentTimeMillis())
- def msg
- try {
- // get request input
- String subnetInstanceReq = execution.getVariable("bpmnRequest")
- logger.debug(subnetInstanceReq)
-
- String requestId = execution.getVariable("mso-request-id")
- execution.setVariable("msoRequestId", requestId)
- logger.debug("Input Request:" + subnetInstanceReq + " reqId:" + requestId)
-
- //modelInfo
- String modelInvariantUuid = jsonUtil.getJsonValue(subnetInstanceReq, "modelInvariantUuid")
- if (isBlank(modelInvariantUuid)) {
- msg = "Input modelInvariantUuid is null"
- logger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
- } else
- {
- execution.setVariable("modelInvariantUuid", modelInvariantUuid)
- }
-
- logger.debug("modelInvariantUuid: " + modelInvariantUuid)
-
- String modelUuid = jsonUtil.getJsonValue(subnetInstanceReq, "modelUuid")
- if (isBlank(modelUuid)) {
- msg = "Input modelUuid is null"
- logger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
- } else
- {
- execution.setVariable("modelUuid", modelUuid)
- }
-
- logger.debug("modelUuid: " + modelUuid)
-
-
- //subscriberInfo
- String globalSubscriberId = jsonUtil.getJsonValue(subnetInstanceReq, "globalSubscriberId")
- if (isBlank(globalSubscriberId)) {
- msg = "Input globalSubscriberId' is null"
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
- } else {
- execution.setVariable("globalSubscriberId", globalSubscriberId)
- }
- String dummyServiceId = new UUID(0,0).toString();
- execution.setVariable("dummyServiceId", dummyServiceId)
- logger.debug("dummyServiceId: " + dummyServiceId)
- String servicename = jsonUtil.getJsonValue(subnetInstanceReq, "name")
- execution.setVariable("servicename", servicename)
-
- String nsiId = jsonUtil.getJsonValue(subnetInstanceReq, "additionalProperties.nsiInfo.nsiId")
- if (isBlank(nsiId)) {
- msg = "Input nsiId is null"
- logger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
- } else
- {
- execution.setVariable("nsiId", nsiId)
- }
-
- String networkType = jsonUtil.getJsonValue(subnetInstanceReq, "networkType")
- if (isBlank(networkType)) {
- msg = "Input networkType is null"
- logger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
- } else
- {
- execution.setVariable("networkType", networkType.toUpperCase())
- }
-
- //requestParameters, subscriptionServiceType is 5G
- String subscriptionServiceType = jsonUtil.getJsonValue(subnetInstanceReq, "subscriptionServiceType")
- if (isBlank(subscriptionServiceType)) {
- msg = "Input subscriptionServiceType is null"
- logger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
- } else {
- execution.setVariable("subscriptionServiceType", subscriptionServiceType)
- }
-
- String jobId = UUID.randomUUID().toString()
- execution.setVariable("jobId", jobId)
-
- String sliceParams = jsonUtil.getJsonValue(subnetInstanceReq, "additionalProperties")
- execution.setVariable("sliceParams", sliceParams)
-
- } catch(BpmnError e) {
- throw e
- } catch(Exception ex) {
- msg = "Exception in AllocateSliceSubnet.preProcessRequest " + ex.getMessage()
- logger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
- }
- logger.debug(Prefix + "preProcessRequest Exit")
- }
-
-
- /**
- * create operation status in request db
- *
- * Init the Operation Status
- */
- def prepareInitOperationStatus = { DelegateExecution execution ->
- logger.debug(Prefix + "prepareInitOperationStatus Start")
-
- String serviceId = execution.getVariable("dummyServiceId")
- String jobId = execution.getVariable("jobId")
- String nsiId = execution.getVariable("nsiId")
- logger.debug("Generated new job for Service Instance serviceId:" + serviceId + " jobId:" + jobId)
-
- ResourceOperationStatus initStatus = new ResourceOperationStatus()
- initStatus.setServiceId(serviceId)
- initStatus.setOperationId(jobId)
- initStatus.setResourceTemplateUUID(nsiId)
- initStatus.setOperType("Allocate")
- requestDBUtil.prepareInitResourceOperationStatus(execution, initStatus)
-
- logger.debug(Prefix + "prepareInitOperationStatus Exit")
- }
-
-
- /**
- * return sync response
- */
- def sendSyncResponse = { DelegateExecution execution ->
- logger.debug(Prefix + "sendSyncResponse Start")
- try {
- String jobId = execution.getVariable("jobId")
- String allocateSyncResponse = """{"jobId": "${jobId}","status": "processing"}"""
- .trim().replaceAll(" ", "").trim().replaceAll(" ", "")
-
- logger.debug("sendSyncResponse to APIH:" + "\n" + allocateSyncResponse)
- sendWorkflowResponse(execution, 202, allocateSyncResponse)
-
- execution.setVariable("sentSyncResponse", true)
- } catch (Exception ex) {
- String msg = "Exception in sendSyncResponse:" + ex.getMessage()
- logger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
- }
- logger.debug(Prefix + "sendSyncResponse Exit")
- }
-
+ String Prefix="AllocateSliceSubnet_"
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+ RequestDBUtil requestDBUtil = new RequestDBUtil()
+ JsonUtils jsonUtil = new JsonUtils()
+ private static final Logger logger = LoggerFactory.getLogger(AllocateSliceSubnet.class)
+
+ @Override
+ void preProcessRequest(DelegateExecution execution) {
+ logger.debug(Prefix + "preProcessRequest Start")
+ execution.setVariable("prefix", Prefix)
+ execution.setVariable("startTime", System.currentTimeMillis())
+ def msg
+ try {
+ // get request input
+ String subnetInstanceReq = execution.getVariable("bpmnRequest")
+ logger.debug(subnetInstanceReq)
+
+ String requestId = execution.getVariable("mso-request-id")
+ execution.setVariable("msoRequestId", requestId)
+ logger.debug("Input Request:" + subnetInstanceReq + " reqId:" + requestId)
+
+ //modelInfo
+ String modelInvariantUuid = jsonUtil.getJsonValue(subnetInstanceReq, "modelInvariantUuid")
+ if (isBlank(modelInvariantUuid)) {
+ msg = "Input modelInvariantUuid is null"
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else
+ {
+ execution.setVariable("modelInvariantUuid", modelInvariantUuid)
+ }
+
+ logger.debug("modelInvariantUuid: " + modelInvariantUuid)
+
+ String modelUuid = jsonUtil.getJsonValue(subnetInstanceReq, "modelUuid")
+ if (isBlank(modelUuid)) {
+ msg = "Input modelUuid is null"
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else
+ {
+ execution.setVariable("modelUuid", modelUuid)
+ }
+
+ logger.debug("modelUuid: " + modelUuid)
+
+
+ //subscriberInfo
+ String globalSubscriberId = jsonUtil.getJsonValue(subnetInstanceReq, "globalSubscriberId")
+ if (isBlank(globalSubscriberId)) {
+ msg = "Input globalSubscriberId' is null"
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else {
+ execution.setVariable("globalSubscriberId", globalSubscriberId)
+ }
+ String dummyServiceId = new UUID(0,0).toString();
+ execution.setVariable("dummyServiceId", dummyServiceId)
+ logger.debug("dummyServiceId: " + dummyServiceId)
+ String servicename = jsonUtil.getJsonValue(subnetInstanceReq, "name")
+ execution.setVariable("servicename", servicename)
+
+ String nsiId = jsonUtil.getJsonValue(subnetInstanceReq, "additionalProperties.nsiInfo.nsiId")
+ if (isBlank(nsiId)) {
+ msg = "Input nsiId is null"
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else
+ {
+ execution.setVariable("nsiId", nsiId)
+ }
+
+ String networkType = jsonUtil.getJsonValue(subnetInstanceReq, "networkType")
+ if (isBlank(networkType)) {
+ msg = "Input networkType is null"
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else
+ {
+ execution.setVariable("networkType", networkType.toUpperCase())
+ }
+
+ //requestParameters, subscriptionServiceType is 5G
+ String subscriptionServiceType = jsonUtil.getJsonValue(subnetInstanceReq, "subscriptionServiceType")
+ if (isBlank(subscriptionServiceType)) {
+ msg = "Input subscriptionServiceType is null"
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else {
+ execution.setVariable("subscriptionServiceType", subscriptionServiceType)
+ }
+
+ String jobId = UUID.randomUUID().toString()
+ execution.setVariable("jobId", jobId)
+
+ String sliceParams = jsonUtil.getJsonValue(subnetInstanceReq, "additionalProperties")
+ execution.setVariable("sliceParams", sliceParams)
+
+ } catch(BpmnError e) {
+ throw e
+ } catch(Exception ex) {
+ msg = "Exception in AllocateSliceSubnet.preProcessRequest " + ex.getMessage()
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ logger.debug(Prefix + "preProcessRequest Exit")
+ }
+
+
+ /**
+ * create operation status in request db
+ *
+ * Init the Operation Status
+ */
+ def prepareInitOperationStatus = { DelegateExecution execution ->
+ logger.debug(Prefix + "prepareInitOperationStatus Start")
+
+ String serviceId = execution.getVariable("dummyServiceId")
+ String jobId = execution.getVariable("jobId")
+ String nsiId = execution.getVariable("nsiId")
+ logger.debug("Generated new job for Service Instance serviceId:" + serviceId + " jobId:" + jobId)
+
+ ResourceOperationStatus initStatus = new ResourceOperationStatus()
+ initStatus.setServiceId(serviceId)
+ initStatus.setOperationId(jobId)
+ initStatus.setResourceTemplateUUID(nsiId)
+ initStatus.setOperType("Allocate")
+ requestDBUtil.prepareInitResourceOperationStatus(execution, initStatus)
+
+ logger.debug(Prefix + "prepareInitOperationStatus Exit")
+ }
+
+
+ /**
+ * return sync response
+ */
+ def sendSyncResponse = { DelegateExecution execution ->
+ logger.debug(Prefix + "sendSyncResponse Start")
+ try {
+ String jobId = execution.getVariable("jobId")
+ String allocateSyncResponse = """{"jobId": "${jobId}","status": "processing"}"""
+ .trim().replaceAll(" ", "").trim().replaceAll(" ", "")
+
+ logger.debug("sendSyncResponse to APIH:" + "\n" + allocateSyncResponse)
+ sendWorkflowResponse(execution, 202, allocateSyncResponse)
+
+ execution.setVariable("sentSyncResponse", true)
+ } catch (Exception ex) {
+ String msg = "Exception in sendSyncResponse:" + ex.getMessage()
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ logger.debug(Prefix + "sendSyncResponse Exit")
+ }
+
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeAllocateSliceSubnet.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeAllocateSliceSubnet.groovy
index 964baa7a9d..65885f3516 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeAllocateSliceSubnet.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeAllocateSliceSubnet.groovy
@@ -32,14 +32,13 @@ import org.slf4j.LoggerFactory
import static org.apache.commons.lang3.StringUtils.isBlank
class DeAllocateSliceSubnet extends AbstractServiceTaskProcessor {
- String Prefix="DeASS_"
- ExceptionUtil exceptionUtil = new ExceptionUtil()
- JsonUtils jsonUtil = new JsonUtils()
- RequestDBUtil requestDBUtil = new RequestDBUtil()
-
- private static final Logger logger = LoggerFactory.getLogger(DeAllocateSliceSubnet.class)
-
- @Override
+ String Prefix="DeAllocateSliceSubnet_"
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+ JsonUtils jsonUtil = new JsonUtils()
+ RequestDBUtil requestDBUtil = new RequestDBUtil()
+ private static final Logger logger = LoggerFactory.getLogger(DeAllocateSliceSubnet.class)
+
+ @Override
void preProcessRequest(DelegateExecution execution) {
logger.debug(Prefix + "preProcessRequest Start")
execution.setVariable("prefix", Prefix)
@@ -62,8 +61,8 @@ class DeAllocateSliceSubnet extends AbstractServiceTaskProcessor {
} else {
execution.setVariable("globalSubscriberId", globalSubscriberId)
}
-
- //NSSI ID
+
+ //NSSI ID
String serviceInstanceID = jsonUtil.getJsonValue(subnetInstanceReq, "serviceInstanceID")
if (isBlank(serviceInstanceID)) {
msg = "Input serviceInstanceID is null"
@@ -73,27 +72,27 @@ class DeAllocateSliceSubnet extends AbstractServiceTaskProcessor {
{
execution.setVariable("serviceInstanceID", serviceInstanceID)
}
-
- String nsiId = jsonUtil.getJsonValue(subnetInstanceReq, "additionalProperties.nsiId")
- if (isBlank(nsiId)) {
- msg = "Input nsiId is null"
- logger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
- } else
- {
- execution.setVariable("nsiId", nsiId)
- }
-
- String networkType = jsonUtil.getJsonValue(subnetInstanceReq, "networkType")
- if (isBlank(networkType)) {
- msg = "Input networkType is null"
- logger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
- } else
- {
- execution.setVariable("networkType", networkType.toUpperCase())
- }
-
+
+ String nsiId = jsonUtil.getJsonValue(subnetInstanceReq, "additionalProperties.nsiId")
+ if (isBlank(nsiId)) {
+ msg = "Input nsiId is null"
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else
+ {
+ execution.setVariable("nsiId", nsiId)
+ }
+
+ String networkType = jsonUtil.getJsonValue(subnetInstanceReq, "networkType")
+ if (isBlank(networkType)) {
+ msg = "Input networkType is null"
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else
+ {
+ execution.setVariable("networkType", networkType.toUpperCase())
+ }
+
//requestParameters, subscriptionServiceType is 5G
String subscriptionServiceType = jsonUtil.getJsonValue(subnetInstanceReq, "subscriptionServiceType")
if (isBlank(subscriptionServiceType)) {
@@ -106,9 +105,9 @@ class DeAllocateSliceSubnet extends AbstractServiceTaskProcessor {
String jobId = UUID.randomUUID().toString()
execution.setVariable("jobId", jobId)
-
- String sliceParams = jsonUtil.getJsonValue(subnetInstanceReq, "additionalProperties")
- execution.setVariable("sliceParams", sliceParams)
+
+ String sliceParams = jsonUtil.getJsonValue(subnetInstanceReq, "additionalProperties")
+ execution.setVariable("sliceParams", sliceParams)
} catch(BpmnError e) {
throw e
@@ -131,13 +130,13 @@ class DeAllocateSliceSubnet extends AbstractServiceTaskProcessor {
String serviceId = execution.getVariable("serviceInstanceID")
String jobId = execution.getVariable("jobId")
- String nsiId = execution.getVariable("nsiId")
+ String nsiId = execution.getVariable("nsiId")
logger.debug("Generated new job for Service Instance serviceId:" + serviceId + " jobId:" + jobId)
ResourceOperationStatus initStatus = new ResourceOperationStatus()
initStatus.setServiceId(serviceId)
initStatus.setOperationId(jobId)
- initStatus.setResourceTemplateUUID(nsiId)
+ initStatus.setResourceTemplateUUID(nsiId)
initStatus.setOperType("Deallocate")
requestDBUtil.prepareInitResourceOperationStatus(execution, initStatus)
@@ -145,26 +144,26 @@ class DeAllocateSliceSubnet extends AbstractServiceTaskProcessor {
}
-
- /**
- * return sync response
- */
- def sendSyncResponse = { DelegateExecution execution ->
- logger.debug(Prefix + "sendSyncResponse Start")
- try {
- String jobId = execution.getVariable("jobId")
- String deAllocateSyncResponse = """{"jobId": "${jobId}","status": "processing"}""".trim().replaceAll(" ", "")
-
- logger.debug("sendSyncResponse to APIH:" + "\n" + deAllocateSyncResponse)
- sendWorkflowResponse(execution, 202, deAllocateSyncResponse)
-
- execution.setVariable("sentSyncResponse", true)
- } catch (Exception ex) {
- String msg = "Exception in sendSyncResponse:" + ex.getMessage()
- logger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
- }
- logger.debug(Prefix + "sendSyncResponse Exit")
- }
+
+ /**
+ * return sync response
+ */
+ def sendSyncResponse = { DelegateExecution execution ->
+ logger.debug(Prefix + "sendSyncResponse Start")
+ try {
+ String jobId = execution.getVariable("jobId")
+ String deAllocateSyncResponse = """{"jobId": "${jobId}","status": "processing"}""".trim().replaceAll(" ", "")
+
+ logger.debug("sendSyncResponse to APIH:" + "\n" + deAllocateSyncResponse)
+ sendWorkflowResponse(execution, 202, deAllocateSyncResponse)
+
+ execution.setVariable("sentSyncResponse", true)
+ } catch (Exception ex) {
+ String msg = "Exception in sendSyncResponse:" + ex.getMessage()
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ logger.debug(Prefix + "sendSyncResponse Exit")
+ }
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateTnNssi.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateTnNssi.groovy
index 0900863a62..e5c9514fa5 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateTnNssi.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateTnNssi.groovy
@@ -158,7 +158,7 @@ public class DoActivateTnNssi extends AbstractServiceTaskProcessor {
roStatus.setProgress(progress)
roStatus.setStatus(status)
roStatus.setStatusDescription(statusDescription)
- requestDBUtil.prepareUpdateResourceOperationStatus(execution, status)
+ requestDBUtil.prepareUpdateResourceOperationStatus(execution, roStatus)
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSSI.groovy
index 88014e7b54..3e834fa7bb 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSSI.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSSI.groovy
@@ -4,6 +4,7 @@ import com.fasterxml.jackson.databind.ObjectMapper
import org.apache.commons.lang3.StringUtils
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.so.beans.nsmf.EsrInfo
+import org.onap.so.beans.nsmf.JobStatusResponse
import org.onap.so.beans.nsmf.NssiResponse
import org.onap.so.beans.nsmf.NssmfAdapterNBIRequest
import org.onap.so.beans.nsmf.ResponseDescriptor
@@ -17,7 +18,6 @@ import org.onap.so.bpmn.common.scripts.NssmfAdapterUtils
import org.onap.so.bpmn.core.json.JsonUtils
import org.slf4j.Logger
import org.slf4j.LoggerFactory
-import org.springframework.http.ResponseEntity
class DoAllocateNSSI extends AbstractServiceTaskProcessor {
@@ -34,7 +34,7 @@ class DoAllocateNSSI extends AbstractServiceTaskProcessor {
private static final NSSMF_ALLOCATE_URL = "/api/rest/provMns/v1/NSS/SliceProfiles"
- private static final NSSMF_QUERY_JOB_STATUS_URL = "/NSS/jobs/%s"
+ private static final NSSMF_QUERY_JOB_STATUS_URL = "/api/rest/provMns/v1/NSS/jobs/%s"
@Override
void preProcessRequest(DelegateExecution execution) {
@@ -64,11 +64,12 @@ class DoAllocateNSSI extends AbstractServiceTaskProcessor {
NssmfAdapterNBIRequest nbiRequest = execution.getVariable("nbiRequest") as NssmfAdapterNBIRequest
String response = nssmfAdapterUtils.sendPostRequestNSSMF(execution, NSSMF_ALLOCATE_URL,
objectMapper.writeValueAsString(nbiRequest))
- ResponseEntity responseEntity = objectMapper.readValue(response, ResponseEntity.class)
- String respBody = responseEntity.getBody()
- NssiResponse result = objectMapper.readValue(respBody, NssiResponse.class)
- //todo: if success
- //todo:
+
+ if (response != null) {
+ NssiResponse nssiResponse = objectMapper.readValue(response, NssiResponse.class)
+ execution.setVariable("nssiAllocateResult", nssiResponse)
+ }
+
execution.setVariable("serviceInfo", nbiRequest.getServiceInfo())
execution.setVariable("esrInfo", nbiRequest.getEsrInfo())
}
@@ -96,13 +97,14 @@ class DoAllocateNSSI extends AbstractServiceTaskProcessor {
String response =
nssmfAdapterUtils.sendPostRequestNSSMF(execution, endpoint, objectMapper.writeValueAsString(nbiRequest))
- ResponseEntity responseEntity = objectMapper.readValue(response, ResponseEntity.class)
- String result = responseEntity.getBody()
- //todoï¼›if success
- ResponseDescriptor responseDescriptor = objectMapper.readValue(result, ResponseDescriptor.class)
+ if (response != null) {
+ JobStatusResponse jobStatusResponse = objectMapper.readValue(response, JobStatusResponse.class)
+ execution.setVariable("nssiAllocateStatus", jobStatusResponse)
- //todo: handle status
- execution.setVariable("nssiAllocateResult", responseDescriptor)
+ if (jobStatusResponse.getResponseDescriptor().getProgress() == 100) {
+ execution.setVariable("jobFinished", true)
+ }
+ }
}
void prepareUpdateOrchestrationTask(DelegateExecution execution) {
@@ -111,10 +113,10 @@ class DoAllocateNSSI extends AbstractServiceTaskProcessor {
SliceTaskParamsAdapter sliceParams =
execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter
- ResponseDescriptor response = execution.getVariable("nssiAllocateResult") as ResponseDescriptor
+ JobStatusResponse jobStatusResponse = execution.getVariable("nssiAllocateStatus") as JobStatusResponse
+ ResponseDescriptor response = jobStatusResponse.getResponseDescriptor()
SubnetType subnetType = execution.getVariable("subnetType") as SubnetType
-
SliceTaskInfo sliceTaskInfo = execution.getVariable("sliceTaskInfo") as SliceTaskInfo
sliceTaskInfo.progress = response.getProgress()
sliceTaskInfo.status = response.getStatus()
@@ -127,6 +129,7 @@ class DoAllocateNSSI extends AbstractServiceTaskProcessor {
execution.setVariable("sliceTaskParams", sliceParams)
execution.setVariable("sliceTaskInfo", sliceTaskInfo)
+
logger.debug("Finish prepareUpdateOrchestrationTask progress")
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCommonCoreNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCommonCoreNSSI.groovy
index e225c360ed..646861a6a0 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCommonCoreNSSI.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCommonCoreNSSI.groovy
@@ -22,15 +22,9 @@ package org.onap.so.bpmn.infrastructure.scripts
import com.fasterxml.jackson.databind.ObjectMapper
import org.camunda.bpm.engine.delegate.DelegateExecution
-import org.onap.aai.domain.yang.CloudRegion
-import org.onap.aai.domain.yang.GenericVnf
-import org.onap.aai.domain.yang.ModelVer
-import org.onap.aai.domain.yang.ServiceInstance
-import org.onap.aai.domain.yang.ServiceSubscription
-import org.onap.aai.domain.yang.SliceProfile
-import org.onap.aai.domain.yang.Tenant
-import org.onap.aai.domain.yang.VfModule
-import org.onap.aaiclient.client.aai.AAIObjectType
+import org.json.JSONArray
+import org.json.JSONObject
+import org.onap.aai.domain.yang.v19.*
import org.onap.aaiclient.client.aai.AAIResourcesClient
import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
import org.onap.aaiclient.client.aai.entities.Relationships
@@ -39,35 +33,20 @@ import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder
import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types
import org.onap.logging.filter.base.ONAPComponents
-import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
-import org.onap.so.bpmn.common.scripts.ExceptionUtil
-import org.onap.so.bpmn.common.scripts.RequestDBUtil
+import org.onap.so.bpmn.common.scripts.*
import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.client.HttpClient
-import org.onap.so.db.request.beans.OperationStatus
-import org.onap.so.requestsdb.RequestsDbConstant
-import org.onap.so.serviceinstancebeans.CloudConfiguration
-import org.onap.so.serviceinstancebeans.LineOfBusiness
-import org.onap.so.serviceinstancebeans.ModelInfo
-import org.onap.so.serviceinstancebeans.ModelType
-import org.onap.so.serviceinstancebeans.OwningEntity
-import org.onap.so.serviceinstancebeans.Project
-import org.onap.so.serviceinstancebeans.RequestDetails
-import org.onap.so.serviceinstancebeans.RequestInfo
-import org.onap.so.serviceinstancebeans.RequestParameters
-import org.onap.so.serviceinstancebeans.Resources
-import org.onap.so.serviceinstancebeans.Service
-import org.onap.so.serviceinstancebeans.SubscriberInfo
-import org.onap.so.serviceinstancebeans.VfModules
-import org.onap.so.serviceinstancebeans.Vnfs
+import org.onap.so.db.request.beans.ResourceOperationStatus
+import org.onap.so.serviceinstancebeans.*
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import javax.ws.rs.core.Response
+import static org.apache.commons.lang3.StringUtils.isBlank
- class DoCommonCoreNSSI extends AbstractServiceTaskProcessor {
+class DoCommonCoreNSSI extends AbstractServiceTaskProcessor {
private final String PREFIX ="DoCommonCoreNSSI"
@@ -83,10 +62,54 @@ import javax.ws.rs.core.Response
def currentNSSI = execution.getVariable("currentNSSI")
if (!currentNSSI) {
- String msg = "currentNSSI is null"
+ currentNSSI = [:]
+ }
+
+ // NSSI ID
+ String nssiId = execution.getVariable("serviceInstanceID")
+ if (isBlank(nssiId)) {
+ String msg = "NSSI service instance id is null"
+ LOGGER.error(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ }
+ else {
+ currentNSSI['nssiId'] = nssiId
+ }
+
+ // NSI ID
+ String nsiId = execution.getVariable("nsiId")
+ if (isBlank(nsiId)) {
+ String msg = "nsiId is null"
LOGGER.error(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
}
+ else {
+ currentNSSI['nsiId'] = nsiId
+ }
+
+
+ // Slice Profile
+ String sliceProfile = jsonUtil.getJsonValue(execution.getVariable("sliceParams"), "sliceProfile")
+ if (isBlank(sliceProfile)) {
+ String msg = "Slice Profile is null"
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else {
+ currentNSSI['sliceProfile'] = sliceProfile
+ }
+
+ // S-NSSAI
+ def snssaiList = jsonUtil.StringArrayToList(jsonUtil.getJsonValue(sliceProfile, "snssaiList"))
+
+ String sNssai = snssaiList.get(0)
+ currentNSSI['S-NSSAI'] = sNssai
+
+
+ // Slice Profile id
+ String sliceProfileId = jsonUtil.getJsonValue(sliceProfile, "sliceProfileId")
+ currentNSSI['sliceProfileId'] = sliceProfileId
+
+ execution.setVariable("currentNSSI", currentNSSI)
+
LOGGER.trace("***** ${getPrefix()} Exit preProcessRequest")
}
@@ -223,11 +246,61 @@ import javax.ws.rs.core.Response
void getNSSIAssociatedProfiles(DelegateExecution execution) {
LOGGER.trace("${getPrefix()} Start getNSSIAssociatedProfiles")
+ List<SliceProfile> associatedProfiles = new ArrayList<>()
+
+ AAIResourcesClient client = getAAIClient()
+
def currentNSSI = execution.getVariable("currentNSSI")
ServiceInstance nssi = (ServiceInstance)currentNSSI['nssi']
- List<SliceProfile> associatedProfiles = nssi.getSliceProfiles().getSliceProfile()
+ String nssiId = currentNSSI['nssiId']
+
+ // NSSI
+ AAIResourceUri nssiUri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(nssiId))
+ AAIResultWrapper nssiWrapper = client.get(nssiUri)
+ Optional<Relationships> nssiRelationships = nssiWrapper.getRelationships()
+
+ if (nssiRelationships.isPresent()) {
+ // Allotted Resource
+ for (AAIResourceUri allottedResourceUri : nssiRelationships.get().getRelatedUris(Types.ALLOTTED_RESOURCE)) {
+ AAIResultWrapper arWrapper = client.get(allottedResourceUri)
+ Optional<Relationships> arRelationships = arWrapper.getRelationships()
+
+ boolean isFound = false
+ if(arRelationships.isPresent()) {
+ // Slice Profile Instance
+ for (AAIResourceUri sliceProfileInstanceUri : arRelationships.get().getRelatedUris(Types.SERVICE_INSTANCE)) {
+ Optional<ServiceInstance> sliceProfileInstanceOpt = client.get(ServiceInstance.class, sliceProfileInstanceUri)
+
+ if (sliceProfileInstanceOpt.isPresent()) {
+ ServiceInstance sliceProfileInstance = sliceProfileInstanceOpt.get()
+ if(sliceProfileInstance.getServiceRole().equals("slice-profile-instance")) { // Service instance as a Slice Profile Instance
+ associatedProfiles = sliceProfileInstance.getSliceProfiles()?.getSliceProfile()
+
+ currentNSSI['sliceProfileInstanceUri'] = sliceProfileInstanceUri
+
+ isFound = true
+ break // Should be only one
+ }
+ }
+ else {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, "No Slice Profile Instance found")
+ }
+ }
+ }
+ else {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, "No relationships found for Allotted Resource")
+ }
+
+ if(isFound) {
+ break
+ }
+ }
+ }
+ else {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, "No relationships found for nssi id = " + nssiId)
+ }
if(associatedProfiles.isEmpty()) {
String msg = String.format("No associated profiles found for NSSI %s in AAI", nssi.getServiceInstanceId())
@@ -257,7 +330,7 @@ import javax.ws.rs.core.Response
List<String> snssais = new ArrayList<>()
- String isCreateSliceProfileInstanceVar = execution.getVariable("isCreateSliceProfileInstance" )
+ String isCreateSliceProfileInstanceVar = execution.getVariable("isCreateSliceProfileInstance" ) // Not exist in case of Deallocate
boolean isCreateSliceProfileInstance = Boolean.parseBoolean(isCreateSliceProfileInstanceVar)
@@ -294,14 +367,14 @@ import javax.ws.rs.core.Response
def currentNSSI = execution.getVariable("currentNSSI")
try {
- //url:/onap/so/infra/serviceInstantiation/v7/serviceInstances/{serviceInstanceId}/vnfs/{vnfId}"
- def nsmfЕndpoint = UrnPropertiesReader.getVariable("mso.infra.endpoint.url", execution) // ???
+ //url:/onap/so/infra/serviceInstantiation/v7/serviceInstances/{serviceInstanceId}"
+ def nsmfЕndPoint = UrnPropertiesReader.getVariable("mso.infra.endpoint.url", execution) // ???
ServiceInstance networkServiceInstance = (ServiceInstance)currentNSSI['networkServiceInstance']
- GenericVnf constituteVnf = (GenericVnf)currentNSSI['constituteVnf']
+ String url = String.format("${nsmfЕndPoint}/serviceInstantiation/v7/serviceInstances/%s", networkServiceInstance.getServiceInstanceId())
- String url = String.format("${nsmfЕndpoint}/serviceInstantiation/v7/serviceInstances/%s/vnfs/%s", networkServiceInstance.getServiceInstanceId(), constituteVnf.getVnfId())
+ currentNSSI['putServiceInstanceURL'] = url
String msoKey = UrnPropertiesReader.getVariable("mso.msoKey", execution)
String basicAuth = UrnPropertiesReader.getVariable("mso.infra.endpoint.auth", execution)
@@ -332,7 +405,7 @@ import javax.ws.rs.core.Response
String putServiceInstanceResponse = ""
if(errorCode == null || errorCode.isEmpty()) { // No error
- putServiceInstanceResponse = callPUTServiceInstanceResponse // check the response ???
+ putServiceInstanceResponse = callPUTServiceInstanceResponse
}
else {
LOGGER.error(jsonUtil.getJsonValue(callPUTServiceInstanceResponse, "errorMessage"))
@@ -430,9 +503,9 @@ import javax.ws.rs.core.Response
SubscriberInfo prepareSubscriberInfo(DelegateExecution execution) {
def currentNSSI = execution.getVariable("currentNSSI")
- String globalSubscriberId = currentNSSI['globalSubscriberId']
+ String globalSubscriberId = execution.getVariable("globalSubscriberId")
- String subscriberName = currentNSSI['subscriberName']
+ String subscriberName = execution.getVariable("subscriberName")
SubscriberInfo subscriberInfo = new SubscriberInfo()
subscriberInfo.setGlobalSubscriberId(globalSubscriberId)
@@ -484,13 +557,13 @@ import javax.ws.rs.core.Response
RequestInfo prepareRequestInfo(DelegateExecution execution, ServiceInstance networkServiceInstance) {
def currentNSSI = execution.getVariable("currentNSSI")
- String serviceId = currentNSSI['serviceId']
+ String productFamilyId = execution.getVariable("productFamilyId")
RequestInfo requestInfo = new RequestInfo()
requestInfo.setInstanceName(networkServiceInstance.getServiceInstanceName())
requestInfo.setSource("VID")
- requestInfo.setProductFamilyId(serviceId)
+ requestInfo.setProductFamilyId(productFamilyId)
requestInfo.setRequestorId("NBI")
return requestInfo
@@ -564,13 +637,13 @@ import javax.ws.rs.core.Response
* @param constituteVnf
* @return List<VfModules>
*/
- List<VfModules> prepareVfModules(DelegateExecution execution, GenericVnf constituteVnf) {
+ List<org.onap.so.serviceinstancebeans.VfModules> prepareVfModules(DelegateExecution execution, GenericVnf constituteVnf) {
AAIResourcesClient client = getAAIClient()
- List<VfModules> vfModuless = new ArrayList<>()
+ List<org.onap.so.serviceinstancebeans.VfModules> vfModuless = new ArrayList<>()
for (VfModule vfModule : constituteVnf.getVfModules().getVfModule()) {
- VfModules vfmodules = new VfModules()
+ org.onap.so.serviceinstancebeans.VfModules vfmodules = new org.onap.so.serviceinstancebeans.VfModules()
ModelInfo vfModuleModelInfo = new ModelInfo()
vfModuleModelInfo.setModelInvariantUuid(vfModule.getModelInvariantId())
@@ -680,7 +753,7 @@ import javax.ws.rs.core.Response
Vnfs vnf = new Vnfs()
// Line of Business
- LineOfBusiness lob = new LineOfBusiness()
+ org.onap.so.serviceinstancebeans.LineOfBusiness lob = new org.onap.so.serviceinstancebeans.LineOfBusiness()
lob.setLineOfBusinessName("VNF")
vnf.setLineOfBusiness(lob)
@@ -716,8 +789,8 @@ import javax.ws.rs.core.Response
* Prepare Service
* @return Service
*/
- Service prepareService(DelegateExecution execution, ServiceInstance networkServiceInstance, ModelInfo modelInfo) {
- Service service = new Service()
+ org.onap.so.serviceinstancebeans.Service prepareService(DelegateExecution execution, ServiceInstance networkServiceInstance, ModelInfo modelInfo) {
+ org.onap.so.serviceinstancebeans.Service service = new org.onap.so.serviceinstancebeans.Service()
// Model Info
service.setModelInfo(prepareServiceModelInfo(networkServiceInstance, modelInfo))
@@ -770,21 +843,21 @@ import javax.ws.rs.core.Response
* @param execution
* @return OwningEntity
*/
- OwningEntity prepareOwningEntity(DelegateExecution execution) {
+ org.onap.so.serviceinstancebeans.OwningEntity prepareOwningEntity(DelegateExecution execution) {
def currentNSSI = execution.getVariable("currentNSSI")
AAIResourcesClient client = getAAIClient()
AAIResourceUri networkServiceInstanceUri = (AAIResourceUri)currentNSSI['networkServiceInstanceUri']
- OwningEntity owningEntity = new OwningEntity()
+ org.onap.so.serviceinstancebeans.OwningEntity owningEntity = new org.onap.so.serviceinstancebeans.OwningEntity()
AAIResultWrapper wrapper = client.get(networkServiceInstanceUri)
Optional<Relationships> owningEntityRelationshipsOps = wrapper.getRelationships()
if (owningEntityRelationshipsOps.isPresent()) {
List<AAIResourceUri> owningEntityRelatedAAIUris = owningEntityRelationshipsOps.get().getRelatedUris(Types.OWNING_ENTITY)
if (!(owningEntityRelatedAAIUris == null || owningEntityRelatedAAIUris.isEmpty())) {
- Optional<org.onap.aai.domain.yang.OwningEntity> owningEntityOpt = client.get(org.onap.aai.domain.yang.OwningEntity.class, owningEntityRelatedAAIUris.get(0)) // Many-To-One relation
+ Optional<org.onap.aai.domain.yang.OwningEntity> owningEntityOpt = client.get(org.onap.aai.domain.yang.v19.OwningEntity.class, owningEntityRelatedAAIUris.get(0)) // Many-To-One relation
if (owningEntityOpt.isPresent()) {
owningEntity.setOwningEntityId(owningEntityOpt.get().getOwningEntityId())
owningEntity.setOwningEntityName(owningEntityOpt.get().getOwningEntityName())
@@ -802,12 +875,12 @@ import javax.ws.rs.core.Response
* @param execution
* @return Project
*/
- Project prepareProject(DelegateExecution execution) {
+ org.onap.so.serviceinstancebeans.Project prepareProject(DelegateExecution execution) {
def currentNSSI = execution.getVariable("currentNSSI")
AAIResourcesClient client = getAAIClient()
- Project project = new Project()
+ org.onap.so.serviceinstancebeans.Project project = new org.onap.so.serviceinstancebeans.Project()
AAIResourceUri cloudRegionRelatedAAIUri = (AAIResourceUri)currentNSSI['cloudRegionRelatedAAIUri']
@@ -817,7 +890,7 @@ import javax.ws.rs.core.Response
if (cloudRegionOps.isPresent()) {
List<AAIResourceUri> projectAAIUris = cloudRegionOps.get().getRelatedUris(Types.PROJECT)
if (!(projectAAIUris == null || projectAAIUris.isEmpty())) {
- Optional<org.onap.aai.domain.yang.Project> projectOpt = client.get(org.onap.aai.domain.yang.Project.class, projectAAIUris.get(0))
+ Optional<org.onap.aai.domain.yang.Project> projectOpt = client.get(org.onap.aai.domain.yang.v19.Project.class, projectAAIUris.get(0))
if (projectOpt.isPresent()) {
project.setProjectName(projectOpt.get().getProjectName())
}
@@ -927,22 +1000,48 @@ import javax.ws.rs.core.Response
def currentNSSI = execution.getVariable("currentNSSI")
- ServiceInstance nssi = (ServiceInstance)currentNSSI['nssi']
-
String nssiId = currentNSSI['nssiId']
AAIResourceUri nssiUri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(nssiId))
- List<SliceProfile> associatedProfiles = nssi.getSliceProfiles().getSliceProfile()
+ AAIResourceUri sliceProfileInstanceUri = (AAIResourceUri)currentNSSI['sliceProfileInstanceUri']
- String currentSNSSAI = currentNSSI['S-NSSAI']
+ Optional<ServiceInstance> sliceProfileInstanceOpt = client.get(ServiceInstance.class, sliceProfileInstanceUri)
+ if (sliceProfileInstanceOpt.isPresent()) {
+ ServiceInstance sliceProfileInstance = sliceProfileInstanceOpt.get()
+
+ List<SliceProfile> associatedProfiles = sliceProfileInstance.getSliceProfiles()?.getSliceProfile()
+
+ String currentSNSSAI = currentNSSI['S-NSSAI']
+
+ if(!(associatedProfiles == null || associatedProfiles.isEmpty())) {
+ // Removes slice profile which contains given S-NSSAI and updates Slice Profile Instance
+ associatedProfiles.removeIf({ associatedProfile -> (associatedProfile.getSNssai().equals(currentSNSSAI)) })
+
+ try {
+ client.update(sliceProfileInstanceUri, sliceProfileInstance)
+
+ currentNSSI['sliceProfileInstance'] = sliceProfileInstance
+ } catch (Exception e) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 25000, "Exception occured while Slice Profile association with NSSI update call: " + e.getMessage())
+ }
+ }
+ else {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, "No slice profiles found")
+ }
- associatedProfiles.removeIf({ associatedProfile -> (associatedProfile.getSNssai().equals(currentSNSSAI)) })
+ }
+ else {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, "No slice profile instance found")
+ }
+ // Removes SLice Profile Instance association with NSSI
try {
- getAAIClient().update(nssiUri, nssi)
- }catch(Exception e){
- exceptionUtil.buildAndThrowWorkflowException(execution, 25000, "Exception occured while Slice Profile association with NSSI update call: " + e.getMessage())
+ client.disconnect(nssiUri, sliceProfileInstanceUri)
}
+ catch (Exception e) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 25000, "Exception occured while Slice Profile Instance association with NSSI dosconnect call: " + e.getMessage())
+ }
+
LOGGER.trace("${getPrefix()} Exit removeSPAssociationWithNSSI")
}
@@ -959,17 +1058,10 @@ import javax.ws.rs.core.Response
def currentNSSI = execution.getVariable("currentNSSI")
- SliceProfile sliceProfileContainsSNSSAI = (SliceProfile)currentNSSI['sliceProfileS-NSSAI']
-
- String globalSubscriberId = currentNSSI['globalSubscriberId']
- String serviceType = currentNSSI['serviceType']
- String nssiId = currentNSSI['nssiId']
-
- // global-customer-id, service-type, service-instance-id, profile-id
- AAIResourceUri sliceProfileUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(serviceType).serviceInstance(nssiId).sliceProfile(sliceProfileContainsSNSSAI.getProfileId()))
+ AAIResourceUri sliceProfileInstanceURI = (AAIResourceUri)currentNSSI['sliceProfileInstanceUri']
try {
- getAAIClient().delete(sliceProfileUri)
+ client.delete(sliceProfileInstanceURI)
}catch(Exception e){
exceptionUtil.buildAndThrowWorkflowException(execution, 25000, "Exception occured while Slice Profile Instance delete call: " + e.getMessage())
}
@@ -979,27 +1071,180 @@ import javax.ws.rs.core.Response
/**
- * Updates operation status
+ * Prepares update resource operation status
* @param execution
*/
- void updateServiceOperationStatus(DelegateExecution execution) {
+ void prepareUpdateResourceOperationStatus(DelegateExecution execution) {
LOGGER.trace("${getPrefix()} Start updateServiceOperationStatus")
def currentNSSI = execution.getVariable("currentNSSI")
- OperationStatus operationStatus = new OperationStatus()
- operationStatus.setServiceId(currentNSSI['e2eServiceInstanceId'] as String)
- operationStatus.setOperationId(currentNSSI['operationId'] as String)
- operationStatus.setOperation(currentNSSI['operationType'] as String)
- operationStatus.setResult(RequestsDbConstant.Status.FINISHED)
+ //Prepare Update Status for PUT failure and success
+ String isTimeOutVar = execution.getVariable("isTimeOut")
+ if(!isBlank(isTimeOutVar) && isTimeOutVar.equals("YES")) {
+ LOGGER.error("TIMEOUT - SO PUT Failure")
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "SO PUT Failure")
+ } else {
+ execution.setVariable("progress", "100")
+ execution.setVariable("status", "finished")
+ execution.setVariable("operationContent", "${getAction()} Core NSSI successful.")
+ }
- requestDBUtil.prepareUpdateOperationStatus(execution, operationStatus)
+ setResourceOperationStatus(execution, "finished", "100", "Core NSSI ${getAction()} successful")
LOGGER.trace("${getPrefix()} Exit updateServiceOperationStatus")
}
/**
+ * Prepares ResourceOperation status
+ * @param execution
+ * @param operationType
+ */
+ void setResourceOperationStatus(DelegateExecution execution, String status, String progress, String statusDesc) {
+ LOGGER.trace("${getPrefix()} Start setResourceOperationStatus")
+
+ def currentNSSI = execution.getVariable("currentNSSI")
+
+ String serviceId = currentNSSI['nssiId']
+ String jobId = execution.getVariable("jobId")
+ String nsiId = currentNSSI['nsiId']
+ String operationType = execution.getVariable("operationType")
+
+ ResourceOperationStatus resourceOperationStatus = new ResourceOperationStatus()
+ resourceOperationStatus.setServiceId(serviceId)
+ resourceOperationStatus.setOperationId(jobId)
+ resourceOperationStatus.setResourceTemplateUUID(nsiId)
+ resourceOperationStatus.setOperType(operationType)
+ resourceOperationStatus.setStatus(status)
+ resourceOperationStatus.setProgress(progress)
+ resourceOperationStatus.setStatusDescription(statusDesc)
+ requestDBUtil.prepareUpdateResourceOperationStatus(execution, resourceOperationStatus)
+
+ LOGGER.trace("${getPrefix()} Exit setResourceOperationStatus")
+ }
+
+
+ /**
+ * Prepares failed operation status update
+ * @param execution
+ */
+ void prepareFailedOperationStatusUpdate(DelegateExecution execution) {
+ LOGGER.trace("${getPrefix()} Start prepareFailedOperationStatusUpdate")
+
+ setResourceOperationStatus(execution, "failed", "0", "Core NSSI ${getAction()} Failed")
+
+ LOGGER.trace("${getPrefix()} Exit prepareFailedOperationStatusUpdate")
+ }
+
+
+ /**
+ * Gets progress status of ServiceInstance PUT operation
+ * @param execution
+ */
+ public void getPUTServiceInstanceProgress(DelegateExecution execution) {
+ LOGGER.trace("${getPrefix()} Start getPUTServiceInstanceProgress")
+
+ def currentNSSI = execution.getVariable("currentNSSI")
+
+ String url = currentNSSI['putServiceInstanceURL']
+
+ getProgress(execution, url, "putStatus")
+
+ LOGGER.trace("${getPrefix()} Exit getPUTServiceInstanceProgress")
+ }
+
+
+ void getProgress(DelegateExecution execution, String url, String statusVariableName) {
+ String msg=""
+ try {
+
+ ExternalAPIUtil externalAPIUtil = getExternalAPIUtilFactory().create()
+ Response response = externalAPIUtil.executeExternalAPIGetCall(execution, url)
+ int responseCode = response.getStatus()
+ execution.setVariable("GetServiceOrderResponseCode", responseCode)
+ LOGGER.debug("Get ServiceOrder response code is: " + responseCode)
+
+ String extApiResponse = response.readEntity(String.class)
+ JSONObject responseObj = new JSONObject(extApiResponse)
+ execution.setVariable("GetServiceOrderResponse", extApiResponse)
+ LOGGER.debug("Create response body is: " + extApiResponse)
+ //Process Response //200 OK 201 CREATED 202 ACCEPTED
+ if(responseCode == 200 || responseCode == 201 || responseCode == 202 )
+ {
+ LOGGER.debug("Get Create ServiceOrder Received a Good Response")
+ String orderState = responseObj.get("state")
+ if("REJECTED".equalsIgnoreCase(orderState)) {
+ prepareFailedOperationStatusUpdate(execution)
+ return
+ }
+
+ JSONArray items = responseObj.getJSONArray("orderItem")
+ JSONObject item = items.get(0)
+ JSONObject service = item.get("service")
+ String networkServiceId = service.get("id")
+ if (networkServiceId == null || networkServiceId.equals("null")) {
+ prepareFailedOperationStatusUpdate(execution)
+ return
+ }
+
+ execution.setVariable("networkServiceId", networkServiceId)
+ String serviceOrderState = item.get("state")
+ execution.setVariable("ServiceOrderState", serviceOrderState)
+ // Get serviceOrder State and process progress
+ if("ACKNOWLEDGED".equalsIgnoreCase(serviceOrderState)) {
+ execution.setVariable(statusVariableName, "processing")
+ }
+ else if("INPROGRESS".equalsIgnoreCase(serviceOrderState)) {
+ execution.setVariable(statusVariableName, "processing")
+ }
+ else if("COMPLETED".equalsIgnoreCase(serviceOrderState)) {
+ execution.setVariable(statusVariableName, "completed")
+ }
+ else if("FAILED".equalsIgnoreCase(serviceOrderState)) {
+ msg = "ServiceOrder failed"
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ else {
+ msg = "ServiceOrder failed"
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ }
+ else{
+ msg = "Get ServiceOrder Received a Bad Response Code. Response Code is: " + responseCode
+ prepareFailedOperationStatusUpdate(execution)
+ }
+
+ }catch(Exception e){
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, e.getMessage())
+ }
+
+ }
+
+
+
+ /**
+ * Delays 5 sec
+ * @param execution
+ */
+ void timeDelay(DelegateExecution execution) {
+ LOGGER.trace("${getPrefix()} Start timeDelay")
+
+ try {
+ LOGGER.debug("${getPrefix()} timeDelay going to sleep for 5 sec")
+
+ Thread.sleep(5000)
+
+ LOGGER.debug("${getPrefix()} ::: timeDelay wakeup after 5 sec")
+ } catch(InterruptedException e) {
+ LOGGER.error("${getPrefix()} ::: timeDelay exception" + e)
+ }
+
+ LOGGER.trace("${getPrefix()} Exit timeDelay")
+ }
+
+
+ /**
* Returns AAI client
* @return AAI client
*/
@@ -1008,7 +1253,16 @@ import javax.ws.rs.core.Response
}
+ ExternalAPIUtilFactory getExternalAPIUtilFactory() {
+ return new ExternalAPIUtilFactory()
+ }
+
+
String getPrefix() {
return PREFIX
}
+
+ String getAction() {
+ return ""
+ }
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOption.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOption.groovy
index 8993127dbc..1d5232f3c5 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOption.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOption.groovy
@@ -95,7 +95,7 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
List<TemplateInfo> nsstInfos = new ArrayList<>()
ServiceDecomposition nstServiceDecomposition =
execution.getVariable("nstServiceDecomposition") as ServiceDecomposition
- //todo:
+
List<AllottedResource> allottedResources = nstServiceDecomposition.getAllottedResources()
for (AllottedResource allottedResource : allottedResources) {
TemplateInfo nsstInfo = new TemplateInfo()
@@ -150,9 +150,6 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
execution.setVariable("nsstServiceDecompositions", nsstServiceDecompositions)
-
-
-
int num = execution.getVariable("maxNsstIndex") as Integer
int index = execution.getVariable("currentNsstIndex") as Integer
@@ -180,8 +177,6 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
List<SubnetCapability> subnetCapabilities = new ArrayList<>()
-
-
for (ServiceDecomposition serviceDecomposition : nsstServiceDecompositions) {
SubnetCapability subnetCapability = new SubnetCapability()
handleByType(execution, serviceDecomposition, sliceParams, subnetCapability)
@@ -206,7 +201,6 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
sliceParams.tnBHSliceTaskInfo.NSSTInfo.UUID = modelInfo.getModelUuid()
sliceParams.tnBHSliceTaskInfo.NSSTInfo.invariantUUID = modelInfo.getModelInvariantUuid()
sliceParams.tnBHSliceTaskInfo.NSSTInfo.name = modelInfo.getModelName()
-
break
case SubnetType.TN_MH:
sliceParams.tnMHSliceTaskInfo.vendor = vendor
@@ -215,7 +209,6 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
sliceParams.tnMHSliceTaskInfo.NSSTInfo.UUID = modelInfo.getModelUuid()
sliceParams.tnMHSliceTaskInfo.NSSTInfo.invariantUUID = modelInfo.getModelInvariantUuid()
sliceParams.tnMHSliceTaskInfo.NSSTInfo.name = modelInfo.getModelName()
-
break
case SubnetType.AN_NF:
sliceParams.anSliceTaskInfo.vendor = vendor
@@ -236,9 +229,6 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
default:
subnetType = null
break
-
- //todo
-
}
if (null == subnetType) {
def msg = "Get subnetType failed, modelUUId=" + modelInfo.getModelUuid()
@@ -297,17 +287,16 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
private static String buildQuerySubnetCapRequest(String vendor, SubnetType subnetType) {
NssmfAdapterNBIRequest request = new NssmfAdapterNBIRequest()
- List<String> subnetTypes = new ArrayList<>()
- subnetTypes.add(subnetType.subnetType)
+// List<String> subnetTypes = new ArrayList<>()
+// subnetTypes.add(subnetType.subnetType)
Map<String, Object> paramMap = new HashMap()
- paramMap.put("subnetTypes", subnetTypes)
+ paramMap.put("subnetType", subnetType.subnetType)
request.setSubnetCapabilityQuery(objectMapper.writeValueAsString(paramMap))
EsrInfo esrInfo = new EsrInfo()
esrInfo.setVendor(vendor)
esrInfo.setNetworkType(subnetType.networkType)
-
request.setEsrInfo(esrInfo)
String strRequest = objectMapper.writeValueAsString(request)
@@ -320,7 +309,8 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
* prepare select nsi request
* @param execution
*/
- public void preNSIRequest(DelegateExecution execution, boolean preferReuse) {
+ public void preNSIRequest(DelegateExecution execution) {
+ boolean preferReuse = execution.getVariable("needQuerySliceProfile") ? false : true
String urlString = UrnPropertiesReader.getVariable("mso.oof.endpoint", execution)
logger.debug( "get NSI option OOF Url: " + urlString)
@@ -378,8 +368,9 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
if (isSharable && solution.get("existingNSI")) {
//sharedNSISolution
processSharedNSI(solution, sliceTaskParams)
+ execution.setVariable("needQuerySliceProfile", true)
}
- else if(solution.containsKey("newNSISolution")) {
+ else {
processNewNSI(solution, sliceTaskParams)
}
}
@@ -395,6 +386,7 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
String nsiName = sharedNSISolution.get("NSIName")
sliceParams.setSuggestNsiId(nsiId)
sliceParams.setSuggestNsiName(nsiName)
+
}
private void processNewNSI(Map<String, Object> solution, SliceTaskParamsAdapter sliceParams) {
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateTnNssiInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateTnNssiInstance.groovy
index 0f1bf0d8b4..7beafefc28 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateTnNssiInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateTnNssiInstance.groovy
@@ -23,12 +23,10 @@ package org.onap.so.bpmn.infrastructure.scripts
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.aai.domain.yang.SliceProfile
-import org.onap.aaiclient.client.aai.AAIObjectType
import org.onap.aaiclient.client.aai.AAIResourcesClient
import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder
-import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types
import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.onap.so.bpmn.common.scripts.ExceptionUtil
import org.onap.so.bpmn.core.json.JsonUtils
@@ -38,6 +36,7 @@ import org.slf4j.LoggerFactory
class DoCreateTnNssiInstance extends AbstractServiceTaskProcessor {
private static final Logger logger = LoggerFactory.getLogger(DoCreateTnNssiInstance.class);
+ final String AAI_VERSION = "v21"
JsonUtils jsonUtil = new JsonUtils()
TnNssmfUtils tnNssmfUtils = new TnNssmfUtils()
ExceptionUtil exceptionUtil = new ExceptionUtil()
@@ -67,23 +66,26 @@ class DoCreateTnNssiInstance extends AbstractServiceTaskProcessor {
void createSliceProfile(DelegateExecution execution) {
- String sliceserviceInstanceId = execution.getVariable("sliceServiceInstanceId")
+ String ssInstanceId = execution.getVariable("sliceServiceInstanceId")
String sliceProfileStr = execution.getVariable("sliceProfile")
String sliceProfileId = UUID.randomUUID().toString()
SliceProfile sliceProfile = new SliceProfile();
sliceProfile.setProfileId(sliceProfileId)
sliceProfile.setLatency(Integer.parseInt(jsonUtil.getJsonValue(sliceProfileStr, "latency")))
sliceProfile.setResourceSharingLevel(jsonUtil.getJsonValue(sliceProfileStr, "resourceSharingLevel"))
- sliceProfile.setSNssai(tnNssmfUtils.getFirstSnssaiFromSliceProfile(sliceProfileStr)) //TODO: should be list
+ //sliceProfile.setSNssai(tnNssmfUtils.getFirstSnssaiFromSliceProfile(sliceProfileStr))
- sliceProfile.setE2ELatency(Integer.parseInt(jsonUtil.getJsonValue(sliceProfileStr, "latency")))
sliceProfile.setMaxBandwidth(Integer.parseInt(jsonUtil.getJsonValue(sliceProfileStr, "maxBandwidth")))
- //TODO: new API
- sliceProfile.setReliability(new Object())
+ //sliceProfile.setReliability(new Object())
try {
AAIResourcesClient client = getAAIClient()
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(sliceserviceInstanceId).sliceProfile(sliceProfileId))
+ AAIResourceUri uri =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business()
+ .customer(execution.getVariable("globalSubscriberId"))
+ .serviceSubscription(execution.getVariable("subscriptionServiceType"))
+ .serviceInstance(ssInstanceId)
+ .sliceProfile(sliceProfileId))
client.create(uri, sliceProfile)
} catch (BpmnError e) {
@@ -112,20 +114,25 @@ class DoCreateTnNssiInstance extends AbstractServiceTaskProcessor {
ss.setOrchestrationStatus(serviceStatus)
String modelInvariantUuid = execution.getVariable("modelInvariantUuid")
String modelUuid = execution.getVariable("modelUuid")
- ss.setModelInvariantId(modelInvariantUuid)
- ss.setModelVersionId(modelUuid)
+ //TODO: need valid model ID from the caller, as AAI does not accept invalid IDs
+ //ss.setModelInvariantId(modelInvariantUuid)
+ //ss.setModelVersionId(modelUuid)
String serviceInstanceLocationid = tnNssmfUtils.getFirstPlmnIdFromSliceProfile(sliceProfileStr)
ss.setServiceInstanceLocationId(serviceInstanceLocationid)
String snssai = tnNssmfUtils.getFirstSnssaiFromSliceProfile(sliceProfileStr)
ss.setEnvironmentContext(snssai)
ss.setServiceRole(serviceRole)
AAIResourcesClient client = getAAIClient()
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(ssInstanceId))
+ AAIResourceUri uri =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business()
+ .customer(execution.getVariable("globalSubscriberId"))
+ .serviceSubscription(execution.getVariable("subscriptionServiceType"))
+ .serviceInstance(ssInstanceId))
client.create(uri, ss)
} catch (BpmnError e) {
throw e
} catch (Exception ex) {
- String msg = "Exception in DoCreateTnNssiInstance.createServiceInstance. " + ex.getMessage()
+ String msg = "Exception in DoCreateTnNssiInstance.createServiceInstance: " + ex.getMessage()
logger.info(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
@@ -133,17 +140,19 @@ class DoCreateTnNssiInstance extends AbstractServiceTaskProcessor {
void createAllottedResource(DelegateExecution execution) {
- String serviceInstanceId = execution.getVariable('sliceServiceInstanceId')
-
- AAIResourcesClient resourceClient = getAAIClient()
- AAIResourceUri ssServiceuri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId))
+ String ssInstanceId = execution.getVariable('sliceServiceInstanceId')
try {
List<String> networkStrList = jsonUtil.StringArrayToList(execution.getVariable("transportSliceNetworks"))
for (String networkStr : networkStrList) {
String allottedResourceId = UUID.randomUUID().toString()
- AAIResourceUri allottedResourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(execution.getVariable("sliceserviceInstanceId")).allottedResource(allottedResourceId))
+ AAIResourceUri allottedResourceUri =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business()
+ .customer(execution.getVariable("globalSubscriberId"))
+ .serviceSubscription(execution.getVariable("subscriptionServiceType"))
+ .serviceInstance(execution.getVariable("sliceServiceInstanceId"))
+ .allottedResource(allottedResourceId))
execution.setVariable("allottedResourceUri", allottedResourceUri)
String modelInvariantId = execution.getVariable("modelInvariantUuid")
String modelVersionId = execution.getVariable("modelUuid")
@@ -152,27 +161,37 @@ class DoCreateTnNssiInstance extends AbstractServiceTaskProcessor {
resource.setId(allottedResourceId)
resource.setType("TsciNetwork")
resource.setAllottedResourceName("network_" + execution.getVariable("sliceServiceInstanceName"))
- resource.setModelInvariantId(modelInvariantId)
- resource.setModelVersionId(modelVersionId)
getAAIClient().create(allottedResourceUri, resource)
- //AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceFromExistingURI(Types.SERVICE_INSTANCE, UriBuilder.fromPath(ssServiceuri).build())
- //getAAIClient().connect(allottedResourceUri,ssServiceuri)
- //execution.setVariable("aaiARPath", allottedResourceUri.build().toString());
String linkArrayStr = jsonUtil.getJsonValue(networkStr, "connectionLinks")
- createLogicalLinksForAllocatedResource(execution, linkArrayStr, serviceInstanceId, allottedResourceId)
+ createLogicalLinksForAllocatedResource(execution, linkArrayStr, ssInstanceId, allottedResourceId)
}
-
+ } catch (BpmnError e) {
+ throw e
} catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Exception in createAaiAR " + ex.getMessage())
+ String msg = "Exception in DoCreateTnNssiInstance.createAllottedResource: " + ex.getMessage()
+ logger.info(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
}
void createLogicalLinksForAllocatedResource(DelegateExecution execution,
- String linkArrayStr, String serviceInstanceId,
+ String linkArrayStr, String ssInstanceId,
String allottedResourceId) {
-
try {
+ AAIResourceUri allottedResourceUri =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business()
+ .customer(execution.getVariable("globalSubscriberId"))
+ .serviceSubscription(execution.getVariable("subscriptionServiceType"))
+ .serviceInstance(ssInstanceId)
+ .allottedResource(allottedResourceId))
+
+ if (!getAAIClient().exists(allottedResourceUri)) {
+ logger.info("ERROR: createLogicalLinksForAllocatedResource: allottedResource not exist: uri={}",
+ allottedResourceUri)
+ return
+ }
+
List<String> linkStrList = jsonUtil.StringArrayToList(linkArrayStr)
for (String linkStr : linkStrList) {
@@ -186,15 +205,22 @@ class DoCreateTnNssiInstance extends AbstractServiceTaskProcessor {
resource.setLinkId(logicalLinkId)
resource.setLinkName(epA)
resource.setLinkName2(epB)
- resource.setModelInvariantId(modelInvariantId)
- resource.setModelVersionId(modelVersionId)
+ resource.setLinkType("TsciConnectionLink")
+ resource.setInMaint(false)
- AAIResourceUri logicalLinkUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().logicalLink(logicalLinkId))
+ //epA is link-name
+ AAIResourceUri logicalLinkUri =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().logicalLink(epA))
getAAIClient().create(logicalLinkUri, resource)
+
+ tnNssmfUtils.attachLogicalLinkToAllottedResource(execution, AAI_VERSION, allottedResourceUri, epA);
}
+ } catch (BpmnError e) {
+ throw e
} catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000,
- "Exception in createLogicalLinksForAllocatedResource" + ex.getMessage())
+ String msg = "Exception in DoCreateTnNssiInstance.createLogicalLinksForAllocatedResource: " + ex.getMessage()
+ logger.info(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateCoreNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateCoreNSSI.groovy
index c94e2dd67d..fe881eb888 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateCoreNSSI.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateCoreNSSI.groovy
@@ -20,19 +20,10 @@
package org.onap.so.bpmn.infrastructure.scripts
-import com.fasterxml.jackson.databind.ObjectMapper
+
import org.camunda.bpm.engine.delegate.DelegateExecution
-import org.onap.aai.domain.yang.CloudRegion
-import org.onap.aai.domain.yang.Customer
-import org.onap.aai.domain.yang.ModelVer
-import org.onap.aai.domain.yang.OwningEntities
-import org.onap.aai.domain.yang.ServiceSubscription
-import org.onap.aai.domain.yang.SliceProfile
-import org.onap.aai.domain.yang.GenericVnf
-import org.onap.aai.domain.yang.ServiceInstance
-import org.onap.aai.domain.yang.Tenant
-import org.onap.aai.domain.yang.VfModule
-import org.onap.aaiclient.client.aai.AAIClient
+import org.onap.aai.domain.yang.v19.AllottedResource
+import org.onap.aai.domain.yang.v19.ServiceInstance
import org.onap.aaiclient.client.aai.AAIResourcesClient
import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
import org.onap.aaiclient.client.aai.entities.Relationships
@@ -41,7 +32,6 @@ import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder
import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types
import org.onap.logging.filter.base.ONAPComponents
-import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.onap.so.bpmn.common.scripts.ExceptionUtil
import org.onap.so.bpmn.common.scripts.MsoUtils
import org.onap.so.bpmn.common.scripts.RequestDBUtil
@@ -49,22 +39,6 @@ import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.client.HttpClient
import org.onap.so.client.HttpClientFactory
-import org.onap.so.db.request.beans.OperationStatus
-import org.onap.so.requestsdb.RequestsDbConstant
-import org.onap.so.serviceinstancebeans.CloudConfiguration
-import org.onap.so.serviceinstancebeans.LineOfBusiness
-import org.onap.so.serviceinstancebeans.ModelInfo
-import org.onap.so.serviceinstancebeans.ModelType
-import org.onap.so.serviceinstancebeans.OwningEntity
-import org.onap.so.serviceinstancebeans.Project
-import org.onap.so.serviceinstancebeans.RequestDetails
-import org.onap.so.serviceinstancebeans.RequestInfo
-import org.onap.so.serviceinstancebeans.RequestParameters
-import org.onap.so.serviceinstancebeans.Resources
-import org.onap.so.serviceinstancebeans.Service
-import org.onap.so.serviceinstancebeans.SubscriberInfo
-import org.onap.so.serviceinstancebeans.VfModules
-import org.onap.so.serviceinstancebeans.Vnfs
import org.slf4j.Logger
import org.slf4j.LoggerFactory
@@ -72,6 +46,7 @@ import javax.ws.rs.core.Response
class DoDeallocateCoreNSSI extends DoCommonCoreNSSI {
private final String PREFIX ="DoDeallocateCoreNSSI"
+ private final String ACTION = "Deallocate"
private ExceptionUtil exceptionUtil = new ExceptionUtil()
private RequestDBUtil requestDBUtil = new RequestDBUtil()
@@ -80,7 +55,7 @@ class DoDeallocateCoreNSSI extends DoCommonCoreNSSI {
private static final Logger LOGGER = LoggerFactory.getLogger( DoDeallocateCoreNSSI.class)
-/**
+ /**
* Queries OOF for NSSI termination
* @param execution
*/
@@ -191,36 +166,6 @@ class DoDeallocateCoreNSSI extends DoCommonCoreNSSI {
}
- String encryptBasicAuth(String basicAuth, String msoKey) {
- return utils.encrypt(basicAuth, msoKey)
- }
-
-
- String getAuthHeader(DelegateExecution execution, String basicAuthValue, String msokey) {
- String response = ""
- String errorCode = ""
- String errorMessage = ""
-
- LOGGER.debug("Obtained BasicAuth username and password for OOF: " + basicAuthValue)
- try {
- response = utils.getBasicAuth(basicAuthValue, msokey)
- } catch (Exception ex) {
- LOGGER.error("Unable to encode username and password string: ", ex)
-
- errorCode = "401"
- errorMessage = "Internal Error - Unable to encode username and password string"
-
- response = "{\n" +
- " \"errorCode\": \"${errorCode}\",\n" +
- " \"errorMessage\": \"${errorMessage}\"\n" +
- "}"
- }
-
- return response
- }
-
-
-
/**
* Builds OOF request
* @param execution
@@ -263,7 +208,9 @@ class DoDeallocateCoreNSSI extends DoCommonCoreNSSI {
ServiceInstance networkServiceInstance = (ServiceInstance)currentNSSI['networkServiceInstance']
- String url = String.format("${nbiEndpointUrl}/api/v4/serviceOrder/%s", networkServiceInstance.getServiceInstanceId()) // Service Order ID = Network Service Instance ID
+ String url = String.format("${nbiEndpointUrl}/api/v4/serviceOrder/%s", networkServiceInstance.getServiceInstanceId())
+
+ currentNSSI['deleteServiceOrderURL'] = url
String msoKey = UrnPropertiesReader.getVariable("mso.msoKey", execution)
String basicAuth = UrnPropertiesReader.getVariable("mso.infra.endpoint.auth", execution)
@@ -356,12 +303,38 @@ class DoDeallocateCoreNSSI extends DoCommonCoreNSSI {
String nssiId = currentNSSI['nssiId']
String nsiId = currentNSSI['nsiId']
+ String globalSubscriberId = execution.getVariable("globalSubscriberId")
+ String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
+ // NSSI
AAIResourceUri nssiUri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(nssiId))
+ ServiceInstance nssi = currentNSSI['nssi']
+
+ String allottedResourceId = null
+
+ // Removes Allotted resource
+ List<AllottedResource> allottedResources = nssi.getAllottedResources()?.getAllottedResource()
+ if(allottedResources != null && allottedResources.size() == 1) { // Shouldn contain one allotted resource
+ allottedResourceId = allottedResources.get(0).getId()
+ allottedResources.remove(0)
+ }
+ else {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, "No allotted resource found for NSSI id = " + nssiId)
+ }
+
+ try {
+ client.update(nssiUri, nssi)
+ }catch(Exception e){
+ exceptionUtil.buildAndThrowWorkflowException(execution, 25000, "Exception occured while NSSI association with NSI disconnect call: " + e.getMessage())
+ }
+
+
+ // Remove association between NSI and Allotted Resource
AAIResourceUri nsiUri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(nsiId))
+ AAIResourceUri allottedResourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(nssiId).allottedResource(allottedResourceId))
try {
- client.disconnect(nssiUri, nsiUri)
+ client.disconnect(nsiUri, allottedResourceUri)
}catch(Exception e){
exceptionUtil.buildAndThrowWorkflowException(execution, 25000, "Exception occured while NSSI association with NSI disconnect call: " + e.getMessage())
}
@@ -387,17 +360,36 @@ class DoDeallocateCoreNSSI extends DoCommonCoreNSSI {
try {
getAAIClient().delete(nssiUri)
}catch(Exception e){
- exceptionUtil.buildAndThrowWorkflowException(execution, 25000, "Exception occured while NSSI Service Instance delete call: " + e.getMessage())
+ exceptionUtil.buildAndThrowWorkflowException(execution, 25000, "Exception occurred while NSSI Service Instance delete call: " + e.getMessage())
}
LOGGER.trace("${PREFIX} Exit deleteNSSIServiceInstance")
}
+ /**
+ * Gets Delete Service Order progress
+ * @param execution
+ */
+ void getDeleteServiceOrderProgress(DelegateExecution execution) {
+ LOGGER.trace("${getPrefix()} Start getDeleteServiceOrderProgress")
+
+ def currentNSSI = execution.getVariable("currentNSSI")
+
+ String url = currentNSSI['deleteServiceOrderURL']
+
+ getProgress(execution, url, "deleteStatus")
+
+ }
+
@Override
String getPrefix() {
return PREFIX
}
+ @Override
+ String getAction() {
+ return ACTION
+ }
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateNSSI.groovy
index 9d6c4a1b2a..75ef7d347c 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateNSSI.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateNSSI.groovy
@@ -19,8 +19,8 @@
*/
package org.onap.so.bpmn.infrastructure.scripts
+import com.fasterxml.jackson.databind.ObjectMapper
import org.camunda.bpm.engine.delegate.DelegateExecution
-import org.json.JSONObject
import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder
@@ -47,6 +47,7 @@ class DoDeallocateNSSI extends AbstractServiceTaskProcessor
private ExceptionUtil exceptionUtil = new ExceptionUtil()
private JsonUtils jsonUtil = new JsonUtils()
+ ObjectMapper objectMapper = new ObjectMapper()
private RequestDBUtil requestDBUtil = new RequestDBUtil()
private NssmfAdapterUtils nssmfAdapterUtils = new NssmfAdapterUtils(httpClientFactory, jsonUtil)
@@ -133,10 +134,9 @@ class DoDeallocateNSSI extends AbstractServiceTaskProcessor
String nssiId = currentNSSI['nssiServiceInstanceId']
String nsiId = currentNSSI['nsiServiceInstanceId']
String scriptName = execution.getVariable("scriptName")
- boolean modifyAction = execution.getVariable("terminateNSI")
String serviceInvariantUuid = currentNSSI['modelInvariantId']
- String serviceUuid = currentNSSI['modelVersionId']
+ String serviceUuid = currentNSSI['modelId']
String globalSubscriberId = currentNSSI['globalSubscriberId']
String subscriptionServiceType = execution.getVariable("serviceType")
@@ -146,37 +146,37 @@ class DoDeallocateNSSI extends AbstractServiceTaskProcessor
deAllocateNssi.setTerminateNssiOption(0)
deAllocateNssi.setSnssaiList(Arrays.asList(snssai))
deAllocateNssi.setScriptName(scriptName)
- deAllocateNssi.setSliceProfileId(profileId)
- deAllocateNssi.setModifyAction(modifyAction)
ServiceInfo serviceInfo = new ServiceInfo()
serviceInfo.setServiceInvariantUuid(serviceInvariantUuid)
serviceInfo.setServiceUuid(serviceUuid)
+ serviceInfo.setNsiId(nsiId)
serviceInfo.setGlobalSubscriberId(globalSubscriberId)
serviceInfo.setSubscriptionServiceType(subscriptionServiceType)
+ String serviceInfoString = objectMapper.writeValueAsString(serviceInfo)
EsrInfo esrInfo = getEsrInfo(currentNSSI)
+ String esrInfoString = objectMapper.writeValueAsString(esrInfo)
execution.setVariable("deAllocateNssi",deAllocateNssi)
- execution.setVariable("esrInfo",esrInfo)
- execution.setVariable("serviceInfo",serviceInfo)
+ execution.setVariable("esrInfo", esrInfoString)
+ execution.setVariable("serviceInfo", serviceInfoString)
String nssmfRequest = """
{
- "deAllocateNssi": "${execution.getVariable("deAllocateNssi") as JSONObject}",
- "esrInfo": ${execution.getVariable("esrInfo") as JSONObject},
- "serviceInfo": ${execution.getVariable("serviceInfo") as JSONObject}
+ "deAllocateNssi": ${objectMapper.writeValueAsString(deAllocateNssi)},
+ "esrInfo": ${esrInfoString},
+ "serviceInfo": ${serviceInfoString}
}
"""
- String urlStr = String.format("/api/rest/provMns/v1/NSS/nssi/%s",nssiId)
+ String urlStr = String.format("/api/rest/provMns/v1/NSS/SliceProfiles/%s", profileId)
NssiResponse nssmfResponse = nssmfAdapterUtils.sendPostRequestNSSMF(execution, urlStr, nssmfRequest, NssiResponse.class)
if (nssmfResponse != null) {
currentNSSI['jobId']= nssmfResponse.getJobId() ?: ""
currentNSSI['jobProgress'] = 0
execution.setVariable("currentNSSI", currentNSSI)
- }
- else {
+ } else {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Received a Bad Response from NSSMF.")
}
LOGGER.debug("*****${PREFIX} Exit sendRequestToNSSMF *****")
@@ -190,32 +190,9 @@ class DoDeallocateNSSI extends AbstractServiceTaskProcessor
{
def currentNSSI = execution.getVariable("currentNSSI")
String jobId = currentNSSI['jobId']
- String nssiId = currentNSSI['nssiServiceInstanceId']
- String nsiId = currentNSSI['nsiServiceInstanceId']
- String serviceInvariantUuid = currentNSSI['modelInvariantId']
- String serviceUuid = currentNSSI['modelVersionId']
- String globalSubscriberId = currentNSSI['globalSubscriberId']
- String subscriptionServiceType = execution.getVariable("serviceType")
- String sST = currentNSSI['sST']
- String PLMNIdList = currentNSSI['PLMNIdList']
- String nssiName = currentNSSI['nssiName']
-
+
execution.setVariable("responseId", "3")
- execution.setVariable("esrInfo", getEsrInfo(currentNSSI))
execution.setVariable("jobId", jobId)
-
- Map<String, ?> serviceInfoMap = new HashMap<>()
- serviceInfoMap.put("nssiId", nssiId)
- serviceInfoMap.put("nsiId", nsiId)
- serviceInfoMap.put("nssiName", nssiName)
- serviceInfoMap.put("sST", sST)
- serviceInfoMap.put("PLMNIdList", PLMNIdList)
- serviceInfoMap.put("globalSubscriberId", globalSubscriberId)
- serviceInfoMap.put("subscriptionServiceType", subscriptionServiceType)
- serviceInfoMap.put("serviceInvariantUuid", serviceInvariantUuid)
- serviceInfoMap.put("serviceUuid", serviceUuid)
-
- execution.setVariable("serviceInfo", serviceInfoMap)
}
@@ -238,8 +215,9 @@ class DoDeallocateNSSI extends AbstractServiceTaskProcessor
LOGGER.error("job progress is null or empty!")
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Received a Bad Job progress from NSSMF.")
}
+ def currentNSSI = execution.getVariable("currentNSSI")
int oldProgress = currentNSSI['jobProgress']
- int currentProgress = progress
+ int currentProgress = Integer.parseInt(progress)
execution.setVariable("isNSSIDeAllocated", (currentProgress == 100))
execution.setVariable("isNeedUpdateDB", (oldProgress != currentProgress))
@@ -247,6 +225,8 @@ class DoDeallocateNSSI extends AbstractServiceTaskProcessor
currentNSSI['status'] = status
currentNSSI['statusDescription'] = statusDescription
+ String nssiId = currentNSSI['nssiServiceInstanceId']
+ String nsiId = currentNSSI['nsiServiceInstanceId']
LOGGER.debug("job status result: nsiId = ${nsiId}, nssiId=${nssiId}, oldProgress=${oldProgress}, progress = ${currentProgress}" )
}
else {
@@ -256,7 +236,7 @@ class DoDeallocateNSSI extends AbstractServiceTaskProcessor
}
catch (any)
{
- String msg = "Received a Bad Response from NSSMF." cause-"+any.getCause()"
+ String msg = "Received a Bad Response from NSSMF. cause-"+any.getCause()
LOGGER.error(any.printStackTrace())
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
@@ -309,7 +289,7 @@ class DoDeallocateNSSI extends AbstractServiceTaskProcessor
String nssiServiceInstanceId = currentNSSI['nssiServiceInstanceId']
String profileId = currentNSSI['profileId']
String globalSubscriberId = currentNSSI["globalSubscriberId"]
- String serviceType = currentNSSI["serviceType"]
+ String serviceType = execution.getVariable("serviceType")
try
{
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateTnNssi.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateTnNssi.groovy
index a410b93d16..baf0333a19 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateTnNssi.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateTnNssi.groovy
@@ -162,7 +162,7 @@ class DoDeallocateTnNssi extends AbstractServiceTaskProcessor {
roStatus.setProgress(progress)
roStatus.setStatus(status)
roStatus.setStatusDescription(statusDescription)
- requestDBUtil.prepareUpdateResourceOperationStatus(execution, status)
+ requestDBUtil.prepareUpdateResourceOperationStatus(execution, roStatus)
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyCoreNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyCoreNSSI.groovy
index ebeab3eb7d..ff16184f02 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyCoreNSSI.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyCoreNSSI.groovy
@@ -21,57 +21,32 @@
package org.onap.so.bpmn.infrastructure.scripts
import com.fasterxml.jackson.databind.ObjectMapper
-import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
-import org.onap.aai.domain.yang.CloudRegion
-import org.onap.aai.domain.yang.Customer
-import org.onap.aai.domain.yang.GenericVnf
-import org.onap.aai.domain.yang.ModelVer
-import org.onap.aai.domain.yang.ServiceInstance
-import org.onap.aai.domain.yang.ServiceSubscription
-import org.onap.aai.domain.yang.SliceProfile
-import org.onap.aai.domain.yang.Tenant
-import org.onap.aai.domain.yang.VfModule
-import org.onap.aaiclient.client.aai.AAIObjectType
+import org.onap.aai.domain.yang.v19.AllottedResource
+import org.onap.aai.domain.yang.v19.AllottedResources
+import org.onap.aai.domain.yang.v19.ServiceInstance
+import org.onap.aai.domain.yang.v19.SliceProfile
+import org.onap.aai.domain.yang.v19.SliceProfiles
import org.onap.aaiclient.client.aai.AAIResourcesClient
import org.onap.aaiclient.client.aai.entities.AAIEdgeLabel
-import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
-import org.onap.aaiclient.client.aai.entities.Relationships
import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder
import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types
-import org.onap.logging.filter.base.ONAPComponents
-import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.onap.so.bpmn.common.scripts.ExceptionUtil
import org.onap.so.bpmn.common.scripts.MsoUtils
import org.onap.so.bpmn.common.scripts.RequestDBUtil
-import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.bpmn.core.json.JsonUtils
-import org.onap.so.client.HttpClient
-import org.onap.so.db.request.beans.OperationStatus
-import org.onap.so.requestsdb.RequestsDbConstant
-import org.onap.so.serviceinstancebeans.CloudConfiguration
-import org.onap.so.serviceinstancebeans.ModelInfo
-import org.onap.so.serviceinstancebeans.ModelType
-import org.onap.so.serviceinstancebeans.OwningEntity
-import org.onap.so.serviceinstancebeans.Project
-import org.onap.so.serviceinstancebeans.RequestDetails
-import org.onap.so.serviceinstancebeans.RequestInfo
-import org.onap.so.serviceinstancebeans.RequestParameters
-import org.onap.so.serviceinstancebeans.Resources
-import org.onap.so.serviceinstancebeans.Service
-import org.onap.so.serviceinstancebeans.SubscriberInfo
-import org.onap.so.serviceinstancebeans.VfModules
-import org.onap.so.serviceinstancebeans.Vnfs
import org.slf4j.Logger
import org.slf4j.LoggerFactory
-import javax.ws.rs.core.Response
+import static org.apache.commons.lang3.StringUtils.isAllLowerCase
+import static org.apache.commons.lang3.StringUtils.isBlank
class DoModifyCoreNSSI extends DoCommonCoreNSSI {
private final String PREFIX ="DoModifyCoreNSSI"
+ private final String ACTION = "Modify"
private ExceptionUtil exceptionUtil = new ExceptionUtil()
private RequestDBUtil requestDBUtil = new RequestDBUtil()
@@ -80,22 +55,17 @@ class DoModifyCoreNSSI extends DoCommonCoreNSSI {
private static final Logger LOGGER = LoggerFactory.getLogger( DoModifyCoreNSSI.class)
+
/**
- * Creates Slice Profile Instance
+ * Prepares Slice Profile
* @param execution
+ * @return SLice Profile
*/
- void createSliceProfileInstance(DelegateExecution execution) {
- LOGGER.trace("${PREFIX} Start createSliceProfileInstance")
-
+ SliceProfile prepareSliceProfile(DelegateExecution execution) {
def currentNSSI = execution.getVariable("currentNSSI")
- String sliceProfileID = execution.getVariable("sliceProfileID")
- Map<String, Object> sliceProfileMap = execution.getVariable("sliceProfileCn")
- Map<String, Object> serviceProfileMap = execution.getVariable("serviceProfile")
-
- String globalSubscriberId = currentNSSI['globalSubscriberId']
- String serviceType = currentNSSI['serviceType']
- String nssiId = currentNSSI['nssiId']
+ String sliceProfileID = currentNSSI['sliceProfileId']
+ Map<String,Object> sliceProfileMap = new ObjectMapper().readValue(currentNSSI['sliceProfile'], Map.class)
SliceProfile sliceProfile = new SliceProfile()
sliceProfile.setServiceAreaDimension("")
@@ -105,26 +75,117 @@ class DoModifyCoreNSSI extends DoCommonCoreNSSI {
sliceProfile.setExpDataRate(0)
sliceProfile.setTrafficDensity(0)
sliceProfile.setConnDensity(0)
- sliceProfile.setSNssai(sliceProfileMap.get("sNSSAI").toString())
- sliceProfile.setExpDataRateUL(Integer.parseInt(sliceProfileMap.get("expDataRateUL").toString()))
- sliceProfile.setExpDataRateDL(Integer.parseInt(sliceProfileMap.get("expDataRateDL").toString()))
- sliceProfile.setActivityFactor(Integer.parseInt(sliceProfileMap.get("activityFactor").toString()))
- sliceProfile.setResourceSharingLevel(sliceProfileMap.get("activityFactor").toString())
- sliceProfile.setUeMobilityLevel(serviceProfileMap.get("uEMobilityLevel").toString())
- sliceProfile.setCoverageAreaTAList(serviceProfileMap.get("coverageAreaTAList").toString())
- sliceProfile.setMaxNumberOfUEs(Integer.parseInt(sliceProfileMap.get("activityFactor").toString()))
- sliceProfile.setLatency(Integer.parseInt(sliceProfileMap.get("latency").toString()))
+ sliceProfile.setSNssai(currentNSSI['S-NSSAI'])
+
+ if(!isBlank(sliceProfileMap.get("expDataRateUL"))) {
+ sliceProfile.setExpDataRateUL(Integer.parseInt(sliceProfileMap.get("expDataRateUL").toString()))
+ }
+
+ if(!isBlank(sliceProfileMap.get("expDataRateDL"))) {
+ sliceProfile.setExpDataRateDL(Integer.parseInt(sliceProfileMap.get("expDataRateDL").toString()))
+ }
+
+ if(!isBlank(sliceProfileMap.get("activityFactor"))) {
+ sliceProfile.setActivityFactor(Integer.parseInt(sliceProfileMap.get("activityFactor").toString()))
+ }
+
+ if(!isBlank(sliceProfileMap.get("resourceSharingLevel"))) {
+ sliceProfile.setResourceSharingLevel(sliceProfileMap.get("resourceSharingLevel").toString())
+ }
+
+ if(!isBlank(sliceProfileMap.get("uEMobilityLevel"))) {
+ sliceProfile.setUeMobilityLevel(sliceProfileMap.get("uEMobilityLevel").toString())
+ }
+
+ if(!isBlank(sliceProfileMap.get("coverageAreaTAList"))) {
+ sliceProfile.setCoverageAreaTAList(sliceProfileMap.get("coverageAreaTAList").toString())
+ }
+
+ if(!isBlank(sliceProfileMap.get("maxNumberofUEs"))) {
+ sliceProfile.setMaxNumberOfUEs(Integer.parseInt(sliceProfileMap.get("maxNumberofUEs").toString()))
+ }
+
+ if(!isBlank(sliceProfileMap.get("latency"))) {
+ sliceProfile.setLatency(Integer.parseInt(sliceProfileMap.get("latency").toString()))
+ }
+
sliceProfile.setProfileId(sliceProfileID)
sliceProfile.setE2ELatency(0)
+ return sliceProfile
+ }
+
+
+ /**
+ * Prepares Slice Profile Instance
+ * @param execution
+ * @return Slice Profile Instance
+ */
+ ServiceInstance prepareSliceProfileInstance(DelegateExecution execution) {
+
+ def currentNSSI = execution.getVariable("currentNSSI")
+
+ ServiceInstance sliceProfileInstance = new ServiceInstance()
+ String sliceProfileInstanceId = UUID.randomUUID().toString()
+ sliceProfileInstance.setServiceInstanceId(sliceProfileInstanceId)
+
+
+ String sliceInstanceName = "sliceprofile_" + sliceProfileInstanceId
+ sliceProfileInstance.setServiceInstanceName(sliceInstanceName)
+
+ String serviceType = jsonUtil.getJsonValue(currentNSSI['sliceProfile'], "sST")
+ sliceProfileInstance.setServiceType(serviceType)
+
+ String serviceStatus = "deactivated"
+ sliceProfileInstance.setOrchestrationStatus(serviceStatus)
+
+ String serviceInstanceLocationid = jsonUtil.getJsonValue(currentNSSI['sliceProfile'], "plmnIdList")
+ sliceProfileInstance.setServiceInstanceLocationId(serviceInstanceLocationid)
+
+ String serviceRole = "slice-profile-instance"
+ sliceProfileInstance.setServiceRole(serviceRole)
+ List<String> snssaiList = (List<String>)currentNSSI['S-NSSAIs']
+ String snssai = snssaiList.get(0)
+
+ sliceProfileInstance.setEnvironmentContext(snssai)
+ sliceProfileInstance.setWorkloadContext("CN-NF")
+
+ // TO DO: Model info
+
+ return sliceProfileInstance
+ }
+
+
+
+ /**
+ * Creates Slice Profile Instance
+ * @param execution
+ */
+ void createSliceProfileInstance(DelegateExecution execution) {
+ LOGGER.trace("${PREFIX} Start createSliceProfileInstance")
+
+ def currentNSSI = execution.getVariable("currentNSSI")
+
+ String globalSubscriberId = execution.getVariable("globalSubscriberId")
+ String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
+
+ SliceProfile sliceProfile = prepareSliceProfile(execution)
+
+ ServiceInstance sliceProfileInstance = prepareSliceProfileInstance(execution)
+
+ SliceProfiles sliceProfiles = new SliceProfiles()
+ sliceProfiles.getSliceProfile().add(sliceProfile)
+ sliceProfileInstance.setSliceProfiles(sliceProfiles)
+
try {
AAIResourcesClient client = getAAIClient()
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(serviceType).serviceInstance(nssiId).sliceProfile(sliceProfileID))
- client.create(uri, sliceProfile)
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).
+ serviceInstance(sliceProfileInstance.getServiceInstanceId()))
+ client.create(uri, sliceProfileInstance)
- currentNSSI['createdSliceProfile'] = sliceProfile
+ currentNSSI['createdSliceProfileInstanceId'] = sliceProfileInstance.getServiceInstanceId()
} catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 25000, "Exception occured while Slice Profile create call:" + ex.getMessage())
+ exceptionUtil.buildAndThrowWorkflowException(execution, 25000, "Exception occurred while Slice Profile create call:" + ex.getMessage())
}
LOGGER.trace("${PREFIX} Exit createSliceProfileInstance")
@@ -132,34 +193,92 @@ class DoModifyCoreNSSI extends DoCommonCoreNSSI {
/**
+ * Creates Allotted Resource
+ * @param execution
+ * @return AllottedResource
+ */
+ AllottedResource createAllottedResource(DelegateExecution execution) {
+ def currentNSSI = execution.getVariable("currentNSSI")
+
+ String globalSubscriberId = execution.getVariable("globalSubscriberId")
+ String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
+ String sliceProfileInstanceId = currentNSSI['createdSliceProfileInstanceId']
+
+ AllottedResource allottedResource = new AllottedResource()
+
+ String allottedResourceId = UUID.randomUUID().toString()
+
+ allottedResource.setId(allottedResourceId)
+
+ // TO DO: No other info
+
+ try {
+ AAIResourcesClient client = getAAIClient()
+ AAIResourceUri allottedResourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(sliceProfileInstanceId).allottedResource(allottedResourceId))
+
+ client.create(allottedResourceUri, allottedResource)
+
+ currentNSSI['allottedResourceUri'] = allottedResourceUri
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 25000, "Exception occurred while Allotted Resource create call:" + ex.getMessage())
+ }
+
+ return allottedResource
+ }
+
+
+
+ /**
* Creates Slice Profile association with NSSI
* @param execution
*/
void associateSliceProfileInstanceWithNSSI(DelegateExecution execution) {
LOGGER.trace("${PREFIX} Start associateSliceProfileInstanceWithNSSI")
- String sliceProfileID = execution.getVariable("sliceProfileID")
-
def currentNSSI = execution.getVariable("currentNSSI")
- String globalSubscriberId = currentNSSI['globalSubscriberId']
- String serviceType = currentNSSI['serviceType']
String nssiId = currentNSSI['nssiId']
- AAIResourceUri nssiUri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(nssiId))
- AAIResourceUri sliceProfileUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(serviceType).serviceInstance(nssiId).sliceProfile(sliceProfileID))
+ String sliceProfileInstanceId = currentNSSI['createdSliceProfileInstanceId']
+ AAIResourcesClient client = getAAIClient()
+
+ // Creates Allotted Resource
+ AllottedResource allottedResource = createAllottedResource(execution)
+ AAIResourceUri allottedResourceUri = (AAIResourceUri)currentNSSI['allottedResourceUri']
+
+ // Updates Slice Profile Instance with Allotted Resource
try {
- SliceProfile createdSliceProfile = (SliceProfile)currentNSSI['createdSliceProfile']
- ServiceInstance nssi = (ServiceInstance)currentNSSI['nssi']
- List<SliceProfile> associatedProfiles = nssi.getSliceProfiles().getSliceProfile()
- associatedProfiles.add(createdSliceProfile)
+ AAIResourceUri sliceProfileInstanceUri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(sliceProfileInstanceId))
+ Optional<ServiceInstance> sliceProfileInstanceOpt = client.get(ServiceInstance.class, sliceProfileInstanceUri)
+ if (sliceProfileInstanceOpt.isPresent()) {
+ ServiceInstance sliceProfileInstance = sliceProfileInstanceOpt.get()
+
+ AllottedResources allottedResources = sliceProfileInstance.getAllottedResources()
+ if(allottedResources == null) {
+ allottedResources = new AllottedResources()
+ }
- getAAIClient().update(nssiUri, nssi)
+ allottedResources.getAllottedResource().add(allottedResource)
+ sliceProfileInstance.setAllottedResources(allottedResources)
- getAAIClient().connect(sliceProfileUri, nssiUri, AAIEdgeLabel.BELONGS_TO)
- }catch(Exception e){
- exceptionUtil.buildAndThrowWorkflowException(execution, 25000, "Exception occured while Slice Profile association with NSSI disconnect call: " + e.getMessage())
+ client.update(sliceProfileInstanceUri, sliceProfileInstance)
+ }
+ else {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, "No slice profile instance found with id = " + sliceProfileInstanceId)
+ }
+
+ } catch(Exception e){
+ exceptionUtil.buildAndThrowWorkflowException(execution, 25000, "Exception occured while Slice Profile Instance update call: " + e.getMessage())
+ }
+
+
+ // Associates NSSI with Allotted Resource
+ try {
+ AAIResourceUri nssiUri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(nssiId))
+ client.connect(nssiUri, allottedResourceUri, AAIEdgeLabel.USES)
+ } catch(Exception e){
+ exceptionUtil.buildAndThrowWorkflowException(execution, 25000, "Exception occured while NSSI with Allotted Resource connect call: " + e.getMessage())
}
LOGGER.trace("${PREFIX} Exit associateSliceProfileInstanceWithNSSI")
@@ -171,4 +290,9 @@ class DoModifyCoreNSSI extends DoCommonCoreNSSI {
return PREFIX
}
+
+ @Override
+ String getAction() {
+ return ACTION
+ }
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyTnNssi.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyTnNssi.groovy
index 03a726c52c..4ff15a58c5 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyTnNssi.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyTnNssi.groovy
@@ -387,7 +387,7 @@ public class DoModifyTnNssi extends AbstractServiceTaskProcessor {
roStatus.setProgress(progress)
roStatus.setStatus(status)
roStatus.setStatusDescription(statusDescription)
- requestDBUtil.prepareUpdateResourceOperationStatus(execution, status)
+ requestDBUtil.prepareUpdateResourceOperationStatus(execution, roStatus)
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ModifySliceSubnet.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ModifySliceSubnet.groovy
index 47489b7b84..0465a433eb 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ModifySliceSubnet.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ModifySliceSubnet.groovy
@@ -32,142 +32,142 @@ import org.slf4j.LoggerFactory
import static org.apache.commons.lang3.StringUtils.isBlank
class ModifySliceSubnet extends AbstractServiceTaskProcessor {
- String Prefix="MSS_"
- ExceptionUtil exceptionUtil = new ExceptionUtil()
- JsonUtils jsonUtil = new JsonUtils()
- RequestDBUtil requestDBUtil = new RequestDBUtil()
-
- private static final Logger logger = LoggerFactory.getLogger(ModifySliceSubnet.class)
-
- @Override
- void preProcessRequest(DelegateExecution execution) {
- logger.debug(Prefix + "preProcessRequest Start")
- execution.setVariable("prefix", Prefix)
- execution.setVariable("startTime", System.currentTimeMillis())
- def msg
- try {
- // get request input
- String subnetInstanceReq = execution.getVariable("bpmnRequest")
- logger.debug(subnetInstanceReq)
-
- String requestId = execution.getVariable("mso-request-id")
- execution.setVariable("msoRequestId", requestId)
- logger.debug("Input Request:" + subnetInstanceReq + " reqId:" + requestId)
-
- //subscriberInfo
- String globalSubscriberId = jsonUtil.getJsonValue(subnetInstanceReq, "globalSubscriberId")
- if (isBlank(globalSubscriberId)) {
- msg = "Input globalSubscriberId' is null"
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
- } else {
- execution.setVariable("globalSubscriberId", globalSubscriberId)
- }
-
- //NSSI Info
- String serviceInstanceID = jsonUtil.getJsonValue(subnetInstanceReq, "serviceInstanceID")
- if (isBlank(serviceInstanceID)) {
- msg = "Input serviceInstanceID is null"
- logger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
- } else
- {
- execution.setVariable("serviceInstanceID", serviceInstanceID)
- }
-
- String servicename = jsonUtil.getJsonValue(subnetInstanceReq, "name")
- execution.setVariable("servicename", servicename)
-
- String nsiId = jsonUtil.getJsonValue(subnetInstanceReq, "additionalProperties.nsiInfo.nsiId")
- if (isBlank(nsiId)) {
- msg = "Input nsiId is null"
- logger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
- } else
- {
- execution.setVariable("nsiId", nsiId)
- }
-
- String networkType = jsonUtil.getJsonValue(subnetInstanceReq, "networkType")
- if (isBlank(networkType)) {
- msg = "Input networkType is null"
- logger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
- } else
- {
- execution.setVariable("networkType", networkType.toUpperCase())
- }
-
- //requestParameters, subscriptionServiceType is 5G
- String subscriptionServiceType = jsonUtil.getJsonValue(subnetInstanceReq, "subscriptionServiceType")
- if (isBlank(subscriptionServiceType)) {
- msg = "Input subscriptionServiceType is null"
- logger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
- } else {
- execution.setVariable("subscriptionServiceType", subscriptionServiceType)
- }
-
- String jobId = UUID.randomUUID().toString()
- execution.setVariable("jobId", jobId)
-
- String sliceParams = jsonUtil.getJsonValue(subnetInstanceReq, "additionalProperties")
- execution.setVariable("sliceParams", sliceParams)
-
- } catch(BpmnError e) {
- throw e
- } catch(Exception ex) {
- msg = "Exception in ModifySliceSubnet.preProcessRequest " + ex.getMessage()
- logger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
- }
- logger.debug(Prefix + "preProcessRequest Exit")
- }
-
-
- /**
- * create operation status in request db
- *
- * Init the Operation Status
- */
- def prepareInitOperationStatus = { DelegateExecution execution ->
- logger.debug(Prefix + "prepareInitOperationStatus Start")
-
- String serviceId = execution.getVariable("serviceInstanceID")
- String jobId = execution.getVariable("jobId")
- String nsiId = execution.getVariable("nsiId")
- logger.debug("Generated new job for Service Instance serviceId:" + serviceId + "jobId:" + jobId)
-
- ResourceOperationStatus initStatus = new ResourceOperationStatus()
- initStatus.setServiceId(serviceId)
- initStatus.setOperationId(jobId)
- initStatus.setResourceTemplateUUID(nsiId)
- initStatus.setOperType("Modify")
- requestDBUtil.prepareInitResourceOperationStatus(execution, initStatus)
-
- logger.debug(Prefix + "prepareInitOperationStatus Exit")
- }
-
-
-
- /**
- * return sync response
- */
- def sendSyncResponse = { DelegateExecution execution ->
- logger.debug(Prefix + "sendSyncResponse Start")
- try {
- String jobId = execution.getVariable("jobId")
- String modifySyncResponse = """{"jobId": "${jobId}","status": "processing"}"""
- .trim().replaceAll(" ", "")
- logger.debug("sendSyncResponse to APIH:" + "\n" + modifySyncResponse)
- sendWorkflowResponse(execution, 202, modifySyncResponse)
-
- execution.setVariable("sentSyncResponse", true)
- } catch (Exception ex) {
- String msg = "Exception in sendSyncResponse:" + ex.getMessage()
- logger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
- }
- logger.debug(Prefix + "sendSyncResponse Exit")
- }
+ String Prefix="ModifySliceSubnet_"
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+ JsonUtils jsonUtil = new JsonUtils()
+ RequestDBUtil requestDBUtil = new RequestDBUtil()
+
+ private static final Logger logger = LoggerFactory.getLogger(ModifySliceSubnet.class)
+
+ @Override
+ void preProcessRequest(DelegateExecution execution) {
+ logger.debug(Prefix + "preProcessRequest Start")
+ execution.setVariable("prefix", Prefix)
+ execution.setVariable("startTime", System.currentTimeMillis())
+ def msg
+ try {
+ // get request input
+ String subnetInstanceReq = execution.getVariable("bpmnRequest")
+ logger.debug(subnetInstanceReq)
+
+ String requestId = execution.getVariable("mso-request-id")
+ execution.setVariable("msoRequestId", requestId)
+ logger.debug("Input Request:" + subnetInstanceReq + " reqId:" + requestId)
+
+ //subscriberInfo
+ String globalSubscriberId = jsonUtil.getJsonValue(subnetInstanceReq, "globalSubscriberId")
+ if (isBlank(globalSubscriberId)) {
+ msg = "Input globalSubscriberId' is null"
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else {
+ execution.setVariable("globalSubscriberId", globalSubscriberId)
+ }
+
+ //NSSI Info
+ String serviceInstanceID = jsonUtil.getJsonValue(subnetInstanceReq, "serviceInstanceID")
+ if (isBlank(serviceInstanceID)) {
+ msg = "Input serviceInstanceID is null"
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else
+ {
+ execution.setVariable("serviceInstanceID", serviceInstanceID)
+ }
+
+ String servicename = jsonUtil.getJsonValue(subnetInstanceReq, "name")
+ execution.setVariable("servicename", servicename)
+
+ String nsiId = jsonUtil.getJsonValue(subnetInstanceReq, "additionalProperties.nsiInfo.nsiId")
+ if (isBlank(nsiId)) {
+ msg = "Input nsiId is null"
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else
+ {
+ execution.setVariable("nsiId", nsiId)
+ }
+
+ String networkType = jsonUtil.getJsonValue(subnetInstanceReq, "networkType")
+ if (isBlank(networkType)) {
+ msg = "Input networkType is null"
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else
+ {
+ execution.setVariable("networkType", networkType.toUpperCase())
+ }
+
+ //requestParameters, subscriptionServiceType is 5G
+ String subscriptionServiceType = jsonUtil.getJsonValue(subnetInstanceReq, "subscriptionServiceType")
+ if (isBlank(subscriptionServiceType)) {
+ msg = "Input subscriptionServiceType is null"
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else {
+ execution.setVariable("subscriptionServiceType", subscriptionServiceType)
+ }
+
+ String jobId = UUID.randomUUID().toString()
+ execution.setVariable("jobId", jobId)
+
+ String sliceParams = jsonUtil.getJsonValue(subnetInstanceReq, "additionalProperties")
+ execution.setVariable("sliceParams", sliceParams)
+
+ } catch(BpmnError e) {
+ throw e
+ } catch(Exception ex) {
+ msg = "Exception in ModifySliceSubnet.preProcessRequest " + ex.getMessage()
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ logger.debug(Prefix + "preProcessRequest Exit")
+ }
+
+
+ /**
+ * create operation status in request db
+ *
+ * Init the Operation Status
+ */
+ def prepareInitOperationStatus = { DelegateExecution execution ->
+ logger.debug(Prefix + "prepareInitOperationStatus Start")
+
+ String serviceId = execution.getVariable("serviceInstanceID")
+ String jobId = execution.getVariable("jobId")
+ String nsiId = execution.getVariable("nsiId")
+ logger.debug("Generated new job for Service Instance serviceId:" + serviceId + "jobId:" + jobId)
+
+ ResourceOperationStatus initStatus = new ResourceOperationStatus()
+ initStatus.setServiceId(serviceId)
+ initStatus.setOperationId(jobId)
+ initStatus.setResourceTemplateUUID(nsiId)
+ initStatus.setOperType("Modify")
+ requestDBUtil.prepareInitResourceOperationStatus(execution, initStatus)
+
+ logger.debug(Prefix + "prepareInitOperationStatus Exit")
+ }
+
+
+
+ /**
+ * return sync response
+ */
+ def sendSyncResponse = { DelegateExecution execution ->
+ logger.debug(Prefix + "sendSyncResponse Start")
+ try {
+ String jobId = execution.getVariable("jobId")
+ String modifySyncResponse = """{"jobId": "${jobId}","status": "processing"}"""
+ .trim().replaceAll(" ", "")
+ logger.debug("sendSyncResponse to APIH:" + "\n" + modifySyncResponse)
+ sendWorkflowResponse(execution, 202, modifySyncResponse)
+
+ execution.setVariable("sentSyncResponse", true)
+ } catch (Exception ex) {
+ String msg = "Exception in sendSyncResponse:" + ex.getMessage()
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ logger.debug(Prefix + "sendSyncResponse Exit")
+ }
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnAllocateNssi.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnAllocateNssi.groovy
index 7d2e536af9..e856522fca 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnAllocateNssi.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnAllocateNssi.groovy
@@ -27,11 +27,9 @@ import groovy.json.JsonSlurper
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.aai.domain.yang.ServiceInstance
-import org.onap.aaiclient.client.aai.AAIObjectType
import org.onap.aaiclient.client.aai.AAIResourcesClient
import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
-import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder
import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types
import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.onap.so.bpmn.common.scripts.ExceptionUtil
@@ -155,7 +153,7 @@ class TnAllocateNssi extends AbstractServiceTaskProcessor {
"modelUuid":"${modelUuid}",
"modelVersion":""
}"""
- execution.setVariable("ssServiceModelInfo", serviceModelInfo)
+ execution.setVariable("serviceModelInfo", serviceModelInfo)
logger.debug("Finish prepareDecomposeService")
}
@@ -186,13 +184,14 @@ class TnAllocateNssi extends AbstractServiceTaskProcessor {
if (maxIndex < 1) {
String msg = "Exception in TN NSST processDecomposition. There is no NSST associated with TN NSST "
logger.info(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ //exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ } else {
+ execution.setVariable("tnNsstInfoList", nsstInfoList)
+ execution.setVariable("tnModelVersion", tnModelVersion)
+ execution.setVariable("tnModelName", tnModelName)
+ execution.setVariable("currentIndex", currentIndex)
+ execution.setVariable("maxIndex", maxIndex)
}
- execution.setVariable("tnNsstInfoList", nsstInfoList)
- execution.setVariable("tnModelVersion", tnModelVersion)
- execution.setVariable("tnModelName", tnModelName)
- execution.setVariable("currentIndex", currentIndex)
- execution.setVariable("maxIndex", maxIndex)
logger.debug("End processDecomposition")
}
@@ -334,7 +333,7 @@ class TnAllocateNssi extends AbstractServiceTaskProcessor {
roStatus.setProgress(progress)
roStatus.setStatus(status)
roStatus.setStatusDescription(statusDescription)
- requestDBUtil.prepareUpdateResourceOperationStatus(execution, status)
+ requestDBUtil.prepareUpdateResourceOperationStatus(execution, roStatus)
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnNssmfUtils.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnNssmfUtils.groovy
index a1b883c34e..1bb0e8aca7 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnNssmfUtils.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnNssmfUtils.groovy
@@ -20,8 +20,11 @@
package org.onap.so.bpmn.infrastructure.scripts
-
+import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.onap.aai.domain.yang.Relationship
+import org.onap.aaiclient.client.aai.AAIResourcesClient
+import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
import org.onap.so.bpmn.common.scripts.ExceptionUtil
import org.onap.so.bpmn.common.scripts.MsoUtils
import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils
@@ -241,4 +244,40 @@ class TnNssmfUtils {
return res
}
+
+ void createRelationShipInAAI(DelegateExecution execution, AAIResourceUri uri, Relationship relationship) {
+ logger.debug("createRelationShipInAAI Start")
+ String msg
+ AAIResourcesClient client = new AAIResourcesClient()
+ try {
+ if (!client.exists(uri)) {
+ logger.info("ERROR: createRelationShipInAAI: not exist: uri={}", uri)
+ return
+ }
+ AAIResourceUri from = ((AAIResourceUri) (uri.clone())).relationshipAPI()
+ client.create(from, relationship)
+
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+ msg = "Exception in createRelationShipInAAI. " + ex.getMessage()
+ logger.info(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ logger.debug("createRelationShipInAAI Exit")
+ }
+
+ void attachLogicalLinkToAllottedResource(DelegateExecution execution, String aaiVersion, AAIResourceUri arUri,
+ String logicalLinkId) {
+
+
+ String toLink = "aai/${aaiVersion}/network/logical-links/logical-link/${logicalLinkId}"
+
+ Relationship relationship = new Relationship()
+ relationship.setRelatedLink(toLink)
+ relationship.setRelatedTo("logical-link")
+ relationship.setRelationshipLabel("org.onap.relationships.inventory.ComposedOf")
+
+ createRelationShipInAAI(execution, arUri, relationship)
+ }
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCommonCoreNSSITest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCommonCoreNSSITest.groovy
index 2c943ffc7c..9707dd2242 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCommonCoreNSSITest.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCommonCoreNSSITest.groovy
@@ -24,19 +24,24 @@ import com.fasterxml.jackson.databind.ObjectMapper
import org.junit.Before
import org.junit.Test
import org.mockito.Mockito
-import org.onap.aai.domain.yang.*
-import org.onap.aaiclient.client.aai.AAIObjectType
+import org.onap.aai.domain.yang.v19.*
import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
import org.onap.aaiclient.client.aai.entities.Relationships
import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
import org.onap.aaiclient.client.aai.entities.uri.AAISimpleUri
import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
+import org.onap.aaiclient.client.aai.entities.uri.ServiceInstanceUri
import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder
import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types
-import org.onap.aaiclient.client.aai.entities.uri.ServiceInstanceUri
+import org.onap.so.bpmn.common.scripts.ExternalAPIUtil
+import org.onap.so.bpmn.common.scripts.ExternalAPIUtilFactory
import org.onap.so.bpmn.common.scripts.MsoGroovyTest
+import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.serviceinstancebeans.RequestDetails
+import javax.ws.rs.core.Response
+import java.time.Instant
+
import static org.junit.Assert.assertNotNull
import static org.junit.Assert.assertTrue
import static org.mockito.Mockito.*
@@ -50,13 +55,32 @@ class DoCommonCoreNSSITest extends MsoGroovyTest {
@Test
void testPreProcessRequest() {
- def currentNSSI = [:]
- currentNSSI.put("nssiId","5G-999")
- when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI)
+
+ String nssiId = "5G-999"
+ when(mockExecution.getVariable("serviceInstanceID")).thenReturn(nssiId)
+
+ String nsiId = "5G-777"
+ when(mockExecution.getVariable("nsiId")).thenReturn(nsiId)
+
+ String snssai = "S-NSSAI"
+ String snssaiList = "[ \"${snssai}\" ]"
+ String sliceProfileId = "slice-profile-id"
+ String sliceParams = "{\n" +
+ "\"sliceProfile\":{\"sliceProfileId\":\"${sliceProfileId}\",\"snssaiList\":${snssaiList}}\n" +
+ "}"
+ when(mockExecution.getVariable("sliceParams")).thenReturn(sliceParams)
DoCommonCoreNSSI dcnssi = new DoCommonCoreNSSI()
dcnssi.preProcessRequest(mockExecution)
- Mockito.verify(mockExecution,times(1)).getVariable("currentNSSI")
+
+ def currentNSSI = [:]
+ currentNSSI.put("nssiId", nssiId)
+ currentNSSI.put("nsiId", nsiId)
+ currentNSSI.put("sliceProfile", "{\"sliceProfileId\":\"slice-profile-id\",\"snssaiList\":[\"S-NSSAI\"]}")
+ currentNSSI.put("S-NSSAI", snssai)
+ currentNSSI.put("sliceProfileId", sliceProfileId)
+ Mockito.verify(mockExecution,times(1)).setVariable("currentNSSI", currentNSSI)
+
}
@@ -90,13 +114,13 @@ class DoCommonCoreNSSITest extends MsoGroovyTest {
Relationships rsMock = mock(Relationships.class)
Optional<Relationships> orsMock = Optional.of(rsMock)
List<AAIResourceUri> arus = new ArrayList<>()
- AAIResourceUri aru = new ServiceInstanceUri(networkServiceInstanceUri)
+ AAIResourceUri aru = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(networkServiceInstance.getServiceInstanceId()))
arus.add(aru)
when(client.get(nssiUri)).thenReturn(wrapperMock)
when(wrapperMock.getRelationships()).thenReturn(orsMock)
- when(rsMockgetRelatedUris(Types.SERVICE_INSTANCE)).thenReturn(arus)
+ when(rsMock.getRelatedUris(Types.SERVICE_INSTANCE)).thenReturn(arus)
when(client.get(ServiceInstance.class, aru)).thenReturn(networkServiceInstaneOpt)
spy.getNetworkServiceInstance(mockExecution)
@@ -145,7 +169,7 @@ class DoCommonCoreNSSITest extends MsoGroovyTest {
when(client.get(networkServiceInstanceUri)).thenReturn(wrapperMock)
when(wrapperMock.getRelationships()).thenReturn(orsMock)
- when(rsMockgetRelatedUris(Types.GENERIC_VNF)).thenReturn(arus)
+ when(rsMock.getRelatedUris(Types.GENERIC_VNF)).thenReturn(arus)
when(client.get(GenericVnf.class, genericVNFUri)).thenReturn(genericVnfOpt)
spy.getConstituteVNFFromNetworkServiceInst(mockExecution)
@@ -162,8 +186,10 @@ class DoCommonCoreNSSITest extends MsoGroovyTest {
def currentNSSI = [:]
when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI)
+ String nssiId = "5G-999"
ServiceInstance nssi = new ServiceInstance()
- nssi.setServiceInstanceId("5G-999")
+ nssi.setServiceInstanceId(nssiId)
+ currentNSSI.put("nssiId", nssiId)
SliceProfiles sliceProfiles = new SliceProfiles()
@@ -171,13 +197,49 @@ class DoCommonCoreNSSITest extends MsoGroovyTest {
slProfiles.add(new SliceProfile())
slProfiles.add(new SliceProfile())
- nssi.setSliceProfiles(sliceProfiles)
+ //nssi.setSliceProfiles(sliceProfiles)
currentNSSI.put("nssi", nssi)
- DoCommonCoreNSSI obj = new DoCommonCoreNSSI()
- obj.getNSSIAssociatedProfiles(mockExecution)
+ DoCommonCoreNSSI spy = spy(DoCommonCoreNSSI.class)
+ when(spy.getAAIClient()).thenReturn(client)
+
+ AAIResourceUri nssiUri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(nssiId))
+
+ AAIResultWrapper wrapperMock = mock(AAIResultWrapper.class) //new AAIResultWrapper(json)
+ Relationships rsMock = mock(Relationships.class)
+ Optional<Relationships> orsMock = Optional.of(rsMock)
+ List<AAIResourceUri> allottedUris = new ArrayList<>()
+ AAIResourceUri allottedUri = AAIUriFactory.createResourceUri(Types.ALLOTTED_RESOURCE.getFragment("allotted-id"))
+ allottedUris.add(allottedUri)
+
+ when(client.get(nssiUri)).thenReturn(wrapperMock)
+ when(wrapperMock.getRelationships()).thenReturn(orsMock)
+ when(rsMock.getRelatedUris(Types.ALLOTTED_RESOURCE)).thenReturn(allottedUris)
+
+ String sliceProfileInstanceId = "slice-profile-instance-id"
+ ServiceInstance sliceProfileInstance = new ServiceInstance()
+ sliceProfileInstance.setServiceInstanceId(sliceProfileInstanceId)
+ sliceProfileInstance.setServiceRole("slice-profile-instance")
+
+ List<AAIResourceUri> sliceProfileInstanceUris = new ArrayList<>()
+ AAIResourceUri sliceProfileInstanceUri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(sliceProfileInstance.getServiceInstanceId()))
+ sliceProfileInstanceUris.add(sliceProfileInstanceUri)
+
+ Optional<ServiceInstance> sliceProfileInstanceOpt = Optional.of(sliceProfileInstance)
+
+ when(client.get(allottedUri)).thenReturn(wrapperMock)
+ when(rsMock.getRelatedUris(Types.SERVICE_INSTANCE)).thenReturn(sliceProfileInstanceUris)
+ when(client.get(ServiceInstance.class, sliceProfileInstanceUri)).thenReturn(sliceProfileInstanceOpt)
+
+
+ SliceProfiles sps = new SliceProfiles()
+ sps.getSliceProfile().addAll(slProfiles)
+ sliceProfileInstance.setSliceProfiles(sps)
+
+ spy.getNSSIAssociatedProfiles(mockExecution)
List<SliceProfile> associatedProfiles = (List<SliceProfile>)currentNSSI.get("associatedProfiles")
+ assertTrue("sliceProfileInstanceUri not found in contect Map", currentNSSI.get("sliceProfileInstanceUri") != null)
assertTrue("Either associatedProfiles doesn't exist or size is incorrect", (associatedProfiles != null && associatedProfiles.size() == 2))
}
@@ -190,13 +252,9 @@ class DoCommonCoreNSSITest extends MsoGroovyTest {
networkServiceInstance.setServiceInstanceId("NS-777")
networkServiceInstance.setServiceRole("Network Service")
- GenericVnf constituteVnf = new GenericVnf()
- constituteVnf.setVnfId("VNF-1")
-
when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI)
currentNSSI.put("networkServiceInstance", networkServiceInstance)
- currentNSSI.put("constituteVnf", constituteVnf)
when(mockExecution.getVariable("mso.infra.endpoint.url")).thenReturn("http://mso.onap:8088")
when(mockExecution.getVariable("mso.msoKey")).thenReturn("mso.msoKey")
@@ -211,7 +269,7 @@ class DoCommonCoreNSSITest extends MsoGroovyTest {
when(spy.getAuthHeader(mockExecution, "auth-value", "mso.msoKey")).thenReturn(authHeaderResponse)
- String urlString = String.format("http://mso.onap:8088/serviceInstantiation/v7/serviceInstances/%s/vnfs/%s", networkServiceInstance.getServiceInstanceId(), constituteVnf.getVnfId())
+ String urlString = String.format("http://mso.onap:8088/serviceInstantiation/v7/serviceInstances/%s", networkServiceInstance.getServiceInstanceId())
String callPUTServiceInstanceResponse = "put"
@@ -243,6 +301,20 @@ class DoCommonCoreNSSITest extends MsoGroovyTest {
AAIResourceUri nssiUri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(nssiId))
+ AAIResourceUri sliceProfileInstanceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer("global-subscriber-id").serviceSubscription("subscription-service-type").
+ serviceInstance("slice-profile-instance-id"))
+
+ String sliceProfileInstanceId = "slice-profile-instance-id"
+ ServiceInstance sliceProfileInstance = new ServiceInstance()
+ sliceProfileInstance.setServiceInstanceId(sliceProfileInstanceId)
+ sliceProfileInstance.setServiceRole("slice-profile-instance")
+
+ Optional<ServiceInstance> sliceProfileInstanceOpt = Optional.of(sliceProfileInstance)
+
+ when(client.get(ServiceInstance.class, sliceProfileInstanceUri)).thenReturn(sliceProfileInstanceOpt)
+
+ currentNSSI.put("sliceProfileInstanceUri", sliceProfileInstanceUri)
+
DoCommonCoreNSSI spy = spy(DoCommonCoreNSSI.class)
when(spy.getAAIClient()).thenReturn(client)
@@ -265,13 +337,19 @@ class DoCommonCoreNSSITest extends MsoGroovyTest {
associatedProfiles.add(sliceProfile2)
associatedProfiles.add(sliceProfile3)
+ SliceProfiles sps = new SliceProfiles()
+ sps.getSliceProfile().addAll(associatedProfiles)
+ sliceProfileInstance.setSliceProfiles(sps)
+
int sizeBefore = associatedProfiles.size()
- doNothing().when(client).update(nssiUri, nssi)
+ doNothing().when(client).update(sliceProfileInstanceUri, sliceProfileInstance)
+
+ doNothing().when(client). disconnect(nssiUri, sliceProfileInstanceUri)
spy.removeSPAssociationWithNSSI(mockExecution)
- assertTrue("Association between slice profile and NSSI wasn't removed", ((ServiceInstance)currentNSSI.get("nssi")).getSliceProfiles().getSliceProfile().size() == (sizeBefore - 1))
+ assertTrue("Association between slice profile and NSSI wasn't removed", ((ServiceInstance)currentNSSI.get("sliceProfileInstance")).getSliceProfiles().getSliceProfile().size() == (sizeBefore - 1))
}
@@ -281,29 +359,16 @@ class DoCommonCoreNSSITest extends MsoGroovyTest {
when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI)
- String globalSubscriberId = "global-id"
- String serviceType = "service"
- String nssiId = "5G-999"
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer("global-subscriber-id").serviceSubscription("subscription-service-type").
+ serviceInstance("slice-profile-instance-id"))
- currentNSSI.put("globalSubscriberId", globalSubscriberId)
- currentNSSI.put("serviceType", serviceType)
- currentNSSI.put("nssiId", nssiId)
-
- String theSNSSAI = "theS-NSSAI"
-
- SliceProfile sliceProfile = new SliceProfile()
- sliceProfile.setSNssai(theSNSSAI)
- sliceProfile.setProfileId("prof-id")
-
- AAIResourceUri nssiUri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(nssiId))
-
- currentNSSI.put("sliceProfileS-NSSAI", sliceProfile)
+ currentNSSI.put("sliceProfileInstanceUri", uri)
DoCommonCoreNSSI spy = spy(DoCommonCoreNSSI.class)
when(spy.getAAIClient()).thenReturn(client)
- doNothing().when(client).delete(nssiUri)
+ doNothing().when(client).delete(uri)
spy.deleteSliceProfileInstance(mockExecution)
@@ -311,26 +376,6 @@ class DoCommonCoreNSSITest extends MsoGroovyTest {
@Test
- void testUpdateServiceOperationStatus() {
- def currentNSSI = [:]
-
- when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI)
-
- String nssiId = "5G-999"
-
- currentNSSI.put("nssiId", nssiId)
- currentNSSI.put("e2eServiceInstanceId", "e2eServiceInstanceId")
- currentNSSI.put("operationId", "operationId")
- currentNSSI.put("operationType", "operationType")
-
- DoCommonCoreNSSI spy = spy(DoCommonCoreNSSI.class)
-
- spy.updateServiceOperationStatus(mockExecution)
-
- }
-
-
- @Test
void testPrepareRequestDetails() {
def currentNSSI = [:]
@@ -426,7 +471,130 @@ class DoCommonCoreNSSITest extends MsoGroovyTest {
prepareProject(cloudRegionAAIUri)
- String requestDetails = spy.prepareRequestDetails(mockExecution)
+ String prepareRequestDetailsResponse = spy.prepareRequestDetails(mockExecution)
+
+ JsonUtils jsonUtil = new JsonUtils()
+ String errorCode = jsonUtil.getJsonValue(prepareRequestDetailsResponse, "errorCode")
+ String errMsg = jsonUtil.getJsonValue(prepareRequestDetailsResponse, "errorMessage")
+
+ assertTrue(errMsg, errorCode == null || errorCode.isEmpty())
+ }
+
+
+ @Test
+ void testPrepareFailedOperationStatusUpdate() {
+ def currentNSSI = [:]
+
+ when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI)
+ when(mockExecution.getVariable("jobId")).thenReturn("job-id")
+ when(mockExecution.getVariable("operationType")).thenReturn("operation-type")
+
+ String nssiId = "5G-999"
+ String nsiId = "5G-777"
+
+ currentNSSI.put("nssiId", nssiId)
+ currentNSSI.put("nsiId", nsiId)
+ currentNSSI.put("e2eServiceInstanceId", "e2eServiceInstanceId")
+ currentNSSI.put("operationId", "operationId")
+ currentNSSI.put("operationType", "operationType")
+
+ DoCommonCoreNSSI spy = spy(DoCommonCoreNSSI.class)
+
+ spy.prepareFailedOperationStatusUpdate(mockExecution)
+ }
+
+
+ @Test
+ void testPrepareUpdateResourceOperationStatus() {
+ def currentNSSI = [:]
+
+ when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI)
+ when(mockExecution.getVariable("jobId")).thenReturn("job-id")
+ when(mockExecution.getVariable("operationType")).thenReturn("operation-type")
+
+ String nssiId = "5G-999"
+ String nsiId = "5G-777"
+
+ currentNSSI.put("nssiId", nssiId)
+ currentNSSI.put("nsiId", nsiId)
+ currentNSSI.put("e2eServiceInstanceId", "e2eServiceInstanceId")
+ currentNSSI.put("operationId", "operationId")
+ currentNSSI.put("operationType", "operationType")
+
+ DoCommonCoreNSSI spy = spy(DoCommonCoreNSSI.class)
+
+ spy.prepareUpdateResourceOperationStatus(mockExecution)
+
+ }
+
+
+ @Test
+ void testGetPUTServiceInstanceProgressAcknowledged() {
+
+ executePUTServiceInstanceProgress("ACKNOWLEDGED")
+ Mockito.verify(mockExecution,times(1)).setVariable("putStatus", "processing")
+ }
+
+
+ @Test
+ void testGetPUTServiceInstanceProgressInProgress() {
+
+ executePUTServiceInstanceProgress("INPROGRESS")
+ Mockito.verify(mockExecution,times(1)).setVariable("putStatus", "processing")
+ }
+
+
+ @Test
+ void testGetPUTServiceInstanceProgressCompleted() {
+
+ executePUTServiceInstanceProgress("COMPLETED")
+ Mockito.verify(mockExecution,times(1)).setVariable("putStatus", "completed")
+ }
+
+
+ @Test
+ void testTimeDelay() {
+ DoCommonCoreNSSI obj = spy(DoCommonCoreNSSI.class)
+
+ long before = Instant.now().toEpochMilli()
+ obj.timeDelay(mockExecution)
+
+ long after = Instant.now().toEpochMilli()
+
+ long delay = 5L
+
+ assertTrue(String.format("Didn't wait %d sec", delay), ((after - before) >= delay))
+ }
+
+
+ void executePUTServiceInstanceProgress(String state) {
+
+ def currentNSSI = [:]
+
+ when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI)
+
+ String url = "http://mso.onap:8088/serviceInstantiation/v7/serviceInstances/5G-777"
+
+ currentNSSI.put("putServiceInstanceURL", url)
+
+ DoCommonCoreNSSI spy = spy(DoCommonCoreNSSI.class)
+
+ ExternalAPIUtilFactory externalAPIUtilFactoryMock = mock(ExternalAPIUtilFactory.class)
+ when(spy.getExternalAPIUtilFactory()).thenReturn(externalAPIUtilFactoryMock)
+
+ ExternalAPIUtil externalAPIUtilMock = mock(ExternalAPIUtil.class)
+
+ when(externalAPIUtilFactoryMock.create()).thenReturn(externalAPIUtilMock)
+
+ Response responseMock = mock(Response.class)
+ when(externalAPIUtilMock.executeExternalAPIGetCall(mockExecution, url)).thenReturn(responseMock)
+
+ when(responseMock.getStatus()).thenReturn(200)
+
+ String entity = "{\"state\":\"ACCEPTED\",\"orderItem\":[{\"service\":{\"id\":\"5G-999\"},\"state\":\"${state}\"}]}"
+ when(responseMock.readEntity(String.class)).thenReturn(entity)
+
+ spy.getPUTServiceInstanceProgress(mockExecution)
}
@@ -446,7 +614,7 @@ class DoCommonCoreNSSITest extends MsoGroovyTest {
AAIResourceUri aru = new AAISimpleUri(cloudRegionAAIUri)
arus.add(aru)
- when(rsMockgetRelatedUris(Types.PROJECT)).thenReturn(arus)
+ when(rsMock.getRelatedUris(Types.PROJECT)).thenReturn(arus)
Optional<Project> projectOpt = Optional.of(project)
@@ -472,7 +640,7 @@ class DoCommonCoreNSSITest extends MsoGroovyTest {
AAIResourceUri aru = new AAISimpleUri(networkServiceInstanceUri)
arus.add(aru)
- when(rsMockgetRelatedUris(Types.OWNING_ENTITY)).thenReturn(arus)
+ when(rsMock.getRelatedUris(Types.OWNING_ENTITY)).thenReturn(arus)
Optional<OwningEntity> owningEntityOpt = Optional.of(owningEntity)
@@ -494,7 +662,7 @@ class DoCommonCoreNSSITest extends MsoGroovyTest {
AAIResourceUri aru = new AAISimpleUri(cloudRegionAAIUri)
arus.add(aru)
- when(rsMockgetRelatedUris(Types.CLOUD_REGION)).thenReturn(arus)
+ when(rsMock.getRelatedUris(Types.CLOUD_REGION)).thenReturn(arus)
CloudRegion cloudRegion = new CloudRegion()
cloudRegion.setCloudRegionId("cloud-region-id")
@@ -527,7 +695,7 @@ class DoCommonCoreNSSITest extends MsoGroovyTest {
arus.add(serviceSubscriptionUri)
- when(rsMockgetRelatedUris(Types.SERVICE_SUBSCRIPTION)).thenReturn(arus)
+ when(rsMock.getRelatedUris(Types.SERVICE_SUBSCRIPTION)).thenReturn(arus)
ServiceSubscription serviceSubscription = new ServiceSubscription()
serviceSubscription.setServiceType("service-type")
@@ -537,7 +705,7 @@ class DoCommonCoreNSSITest extends MsoGroovyTest {
when(client.get(networkServiceInstanceUri)).thenReturn(wrapperMock)
- when(rsMockgetRelatedUris(Types.CUSTOMER)).thenReturn(arus)
+ when(rsMock.getRelatedUris(Types.CUSTOMER)).thenReturn(arus)
Customer customer = new Customer()
customer.setSubscriberName("subscriber-name")
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateCoreNSSITest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateCoreNSSITest.groovy
index eae788666d..26b96a0a4a 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateCoreNSSITest.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateCoreNSSITest.groovy
@@ -20,19 +20,20 @@
package org.onap.so.bpmn.infrastructure.scripts
-
import org.junit.Before
import org.junit.Test
-import org.onap.aai.domain.yang.ServiceInstance
-import org.onap.aai.domain.yang.SliceProfile
-import org.onap.aai.domain.yang.SliceProfiles
-import org.onap.aaiclient.client.aai.AAIObjectType
+import org.mockito.Mockito
+import org.onap.aai.domain.yang.v19.*
import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder
import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types
+import org.onap.so.bpmn.common.scripts.ExternalAPIUtil
+import org.onap.so.bpmn.common.scripts.ExternalAPIUtilFactory
import org.onap.so.bpmn.common.scripts.MsoGroovyTest
+import javax.ws.rs.core.Response
+
import static org.junit.Assert.assertNotNull
import static org.junit.Assert.assertTrue
import static org.mockito.Mockito.*
@@ -153,31 +154,6 @@ class DoDeallocateCoreNSSITest extends MsoGroovyTest {
@Test
- void testGetNSSIAssociatedProfiles() {
- def currentNSSI = [:]
- when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI)
-
- ServiceInstance nssi = new ServiceInstance()
- nssi.setServiceInstanceId("5G-999")
-
- SliceProfiles sliceProfiles = new SliceProfiles()
-
- List<SliceProfile> slProfiles = sliceProfiles.getSliceProfile()
- slProfiles.add(new SliceProfile())
- slProfiles.add(new SliceProfile())
-
- nssi.setSliceProfiles(sliceProfiles)
- currentNSSI.put("nssi", nssi)
-
- DoDeallocateCoreNSSI obj = new DoDeallocateCoreNSSI()
- obj.getNSSIAssociatedProfiles(mockExecution)
-
- List<SliceProfile> associatedProfiles = (List<SliceProfile>)currentNSSI.get("associatedProfiles")
- assertTrue("Either associatedProfiles doesn't exist or size is incorrect", (associatedProfiles != null && associatedProfiles.size() == 2))
- }
-
-
- @Test
void testCalculateSNSSAI() {
def currentNSSI = [:]
when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI)
@@ -232,9 +208,30 @@ class DoDeallocateCoreNSSITest extends MsoGroovyTest {
currentNSSI.put("nsiId", nsiId)
AAIResourceUri nssiUri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(nssiId))
+
+ ServiceInstance nssi = new ServiceInstance()
+ nssi.setServiceInstanceId(nssiId)
+
+ AllottedResources allottedResources = new AllottedResources()
+ AllottedResource allottedResource = new AllottedResource()
+ allottedResource.setId(UUID.randomUUID().toString())
+ allottedResources.getAllottedResource().add(allottedResource)
+ nssi.setAllottedResources(allottedResources)
+
+ currentNSSI.put("nssi", nssi)
+
AAIResourceUri nsiUri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(nsiId))
- doNothing().when(client).disconnect(nssiUri, nsiUri)
+ doNothing().when(client).update(nssiUri, nssi)
+
+ String globalSubscriberId = "globalSubscriberId"
+ String subscriptionServiceType = "subscription-service-type"
+ when(mockExecution.getVariable("globalSubscriberId")).thenReturn(globalSubscriberId)
+ when(mockExecution.getVariable("subscriptionServiceType")).thenReturn(subscriptionServiceType)
+
+ AAIResourceUri allottedResourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(nssiId).allottedResource(allottedResource.getId()))
+
+ doNothing().when(client).disconnect(nsiUri, allottedResourceUri)
spy.removeNSSIAssociationWithNSI(mockExecution)
@@ -263,4 +260,56 @@ class DoDeallocateCoreNSSITest extends MsoGroovyTest {
}
+ @Test
+ void testDeleteServiceOrderProgressAcknowledged() {
+
+ executeDeleteServiceOrderProgress("ACKNOWLEDGED")
+ Mockito.verify(mockExecution,times(1)).setVariable("deleteStatus", "processing")
+ }
+
+ @Test
+ void testDeleteServiceOrderProgressInProgress() {
+
+ executeDeleteServiceOrderProgress("INPROGRESS")
+ Mockito.verify(mockExecution,times(1)).setVariable("deleteStatus", "processing")
+ }
+
+
+ @Test
+ void testDeleteServiceOrderProgressCompleted() {
+
+ executeDeleteServiceOrderProgress("COMPLETED")
+ Mockito.verify(mockExecution,times(1)).setVariable("deleteStatus", "completed")
+ }
+
+
+ void executeDeleteServiceOrderProgress(String state) {
+ def currentNSSI = [:]
+
+ when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI)
+
+ String url = "http://nbi.onap:8088/api/v4/serviceOrder/NS-777"
+
+ currentNSSI.put("deleteServiceOrderURL", url)
+
+ DoDeallocateCoreNSSI spy = spy(DoDeallocateCoreNSSI.class)
+
+ ExternalAPIUtilFactory externalAPIUtilFactoryMock = mock(ExternalAPIUtilFactory.class)
+ when(spy.getExternalAPIUtilFactory()).thenReturn(externalAPIUtilFactoryMock)
+
+ ExternalAPIUtil externalAPIUtilMock = mock(ExternalAPIUtil.class)
+
+ when(externalAPIUtilFactoryMock.create()).thenReturn(externalAPIUtilMock)
+
+ Response responseMock = mock(Response.class)
+ when(externalAPIUtilMock.executeExternalAPIGetCall(mockExecution, url)).thenReturn(responseMock)
+
+ when(responseMock.getStatus()).thenReturn(200)
+
+ String entity = "{\"state\":\"ACCEPTED\",\"orderItem\":[{\"service\":{\"id\":\"5G-999\"},\"state\":\"${state}\"}]}"
+ when(responseMock.readEntity(String.class)).thenReturn(entity)
+
+ spy.getDeleteServiceOrderProgress(mockExecution)
+ }
+
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyCoreNSSITest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyCoreNSSITest.groovy
index bbc237f1f9..ac6f897dfa 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyCoreNSSITest.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyCoreNSSITest.groovy
@@ -20,13 +20,14 @@
package org.onap.so.bpmn.infrastructure.scripts
-
+import com.fasterxml.jackson.databind.ObjectMapper
import org.junit.Before
import org.junit.Test
-import org.onap.aai.domain.yang.ServiceInstance
-import org.onap.aai.domain.yang.SliceProfile
-import org.onap.aai.domain.yang.SliceProfiles
-import org.onap.aaiclient.client.aai.AAIObjectType
+import org.mockito.Mockito
+import org.onap.aai.domain.yang.v19.AllottedResource
+import org.onap.aai.domain.yang.v19.ServiceInstance
+import org.onap.aai.domain.yang.v19.SliceProfile
+import org.onap.aai.domain.yang.v19.SliceProfiles
import org.onap.aaiclient.client.aai.entities.AAIEdgeLabel
import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
@@ -47,31 +48,6 @@ class DoModifyCoreNSSITest extends MsoGroovyTest {
@Test
- void testGetNSSIAssociatedProfiles() {
- def currentNSSI = [:]
- when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI)
-
- ServiceInstance nssi = new ServiceInstance()
- nssi.setServiceInstanceId("5G-999")
-
- SliceProfiles sliceProfiles = new SliceProfiles()
-
- List<SliceProfile> slProfiles = sliceProfiles.getSliceProfile()
- slProfiles.add(new SliceProfile())
- slProfiles.add(new SliceProfile())
-
- nssi.setSliceProfiles(sliceProfiles)
- currentNSSI.put("nssi", nssi)
-
- DoModifyCoreNSSI obj = new DoModifyCoreNSSI()
- obj.getNSSIAssociatedProfiles(mockExecution)
-
- List<SliceProfile> associatedProfiles = (List<SliceProfile>)currentNSSI.get("associatedProfiles")
- assertTrue("Either associatedProfiles doesn't exist or size is incorrect", (associatedProfiles != null && associatedProfiles.size() == 2))
- }
-
-
- @Test
void testCalculateSNSSAISliceProfileInstanceHasToBeDeleted() {
def currentNSSI = [:]
when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI)
@@ -155,44 +131,42 @@ class DoModifyCoreNSSITest extends MsoGroovyTest {
String sliceProfileId = "sliceProfileId"
- when(mockExecution.getVariable("sliceProfileID")).thenReturn(sliceProfileId)
-
- Map<String, Object> sliceProfileMap = new HashMap<>()
- sliceProfileMap.put("expDataRateUL", "12")
- sliceProfileMap.put("expDataRateDL", 5)
- sliceProfileMap.put("activityFactor", 2)
- sliceProfileMap.put("latency", 10)
-
- when(mockExecution.getVariable("sliceProfileCn")).thenReturn(sliceProfileMap)
-
-
- Map<String, Object> serviceProfileMap = new HashMap<>()
- when(mockExecution.getVariable("serviceProfile")).thenReturn(serviceProfileMap)
+ currentNSSI.put("sliceProfile", "{\"sliceProfileId\":\"slice-profile-id\",\"snssaiList\":[\"S-NSSAI\"],\"expDataRateUL\":\"12\",\"expDataRateDL\":\"5\"," +
+ "\"activityFactor\":\"2\",\"resourceSharingLevel\":\"resource-sharing-level\",\"uEMobilityLevel\":\"ue-mobility-level\",\"coverageAreaTAList\":\"coverage-area-ta-list\"," +
+ "\"maxNumberofUEs\":\"10000\",\"latency\":\"7\"}")
+ currentNSSI.put("sliceProfileId", sliceProfileId)
+ List<String> snssais = new ArrayList<>()
+ snssais.add("s-nssai")
+ currentNSSI.put("S-NSSAIs", snssais)
DoModifyCoreNSSI spy = spy(DoModifyCoreNSSI.class)
when(spy.getAAIClient()).thenReturn(client)
String globalSubscriberId = "globalSubscriberId"
- String serviceType = "serviceType"
+ String subscriptionServiceType = "subscription-service-type"
String nssiId = "nssiId"
- currentNSSI.put("globalSubscriberId", globalSubscriberId)
- currentNSSI.put("serviceType", serviceType)
+ when(mockExecution.getVariable("globalSubscriberId")).thenReturn(globalSubscriberId)
+ when(mockExecution.getVariable("subscriptionServiceType")).thenReturn(subscriptionServiceType)
+
currentNSSI.put("nssiId", nssiId)
- currentNSSI.put("sliceProfileId", sliceProfileId)
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(serviceType).serviceInstance(nssiId).sliceProfile(sliceProfileId))
+ ServiceInstance sliceProfileInstance = new ServiceInstance()
+ sliceProfileInstance.setServiceInstanceId(UUID.randomUUID().toString())
+
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).
+ serviceInstance(sliceProfileInstance.getServiceInstanceId()))
SliceProfile sliceProfile = new SliceProfile()
sliceProfile.setProfileId(sliceProfileId)
- doNothing().when(client).create(uri, sliceProfile)
+ doNothing().when(client).create(uri, sliceProfileInstance)
spy.createSliceProfileInstance(mockExecution)
- assertNotNull("Slice Profile doesn't exist", currentNSSI.get("createdSliceProfile"))
- assertTrue("Unexpected Slice Profile Id", ((SliceProfile)currentNSSI.get("createdSliceProfile")).getProfileId().equals(sliceProfile.getProfileId()))
+ assertTrue("Slice Profile Instance Id doesn't exist", (currentNSSI.get("createdSliceProfileInstanceId")) != null)
+
}
@@ -213,32 +187,50 @@ class DoModifyCoreNSSITest extends MsoGroovyTest {
currentNSSI.put("nssiId", nssiId)
String globalSubscriberId = "globalSubscriberId"
- String serviceType = "serviceType"
+ String subscriptionServiceType = "subscriptionServiceType"
- AAIResourceUri nssiUri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(nssiId))
- AAIResourceUri sliceProfileUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(serviceType).serviceInstance(nssiId).sliceProfile(sliceProfileId))
+ String sliceProfileInstanceId = "slice-rpofile-instance-id"
+ currentNSSI.put("createdSliceProfileInstanceId", sliceProfileInstanceId)
+
+ AllottedResource allottedResource = new AllottedResource()
+
+ String allottedResourceId = UUID.randomUUID().toString()
+
+ allottedResource.setId(allottedResourceId)
+
+ AAIResourceUri allottedResourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(sliceProfileInstanceId).allottedResource(allottedResourceId))
+ doNothing().when(client).create(allottedResourceUri, allottedResource)
+
+ currentNSSI.put("allottedResourceUri", allottedResourceUri)
+
+ when(mockExecution.getVariable("globalSubscriberId")).thenReturn(globalSubscriberId)
+ when(mockExecution.getVariable("subscriptionServiceType")).thenReturn(subscriptionServiceType)
- currentNSSI.put("globalSubscriberId", globalSubscriberId)
- currentNSSI.put("serviceType", serviceType)
currentNSSI.put("sliceProfileId", sliceProfileId)
SliceProfile sliceProfile = new SliceProfile()
currentNSSI.put("createdSliceProfile", sliceProfile)
+ AAIResourceUri sliceProfileInstanceUri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(sliceProfileInstanceId))
+
+ AAIResourceUri nssiUri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(nssiId))
+
+ ServiceInstance sliceProfileInstance = new ServiceInstance()
+ sliceProfileInstance.setServiceInstanceId(sliceProfileInstanceId)
+ Optional<ServiceInstance> sliceProfileInstanceOpt = Optional.of(sliceProfileInstance)
+
+ when(client.get(ServiceInstance.class, sliceProfileInstanceUri)).thenReturn(sliceProfileInstanceOpt)
+ doNothing().when(client).update(sliceProfileInstanceUri, sliceProfileInstance)
+
ServiceInstance nssi = new ServiceInstance()
nssi.setServiceInstanceId(nssiId)
nssi.setSliceProfiles(new SliceProfiles())
currentNSSI.put("nssi", nssi)
- int sizeBelore = nssi.getSliceProfiles().getSliceProfile().size()
-
- doNothing().when(client).update(nssiUri, nssi)
- doNothing().when(client).connect(sliceProfileUri, nssiUri, AAIEdgeLabel.BELONGS_TO)
+ doNothing().when(client).connect(nssiUri, sliceProfileInstanceUri, AAIEdgeLabel.USES)
spy.associateSliceProfileInstanceWithNSSI(mockExecution)
- assertTrue("Wrong number of associated slice profiles", ((ServiceInstance)currentNSSI.get("nssi")).getSliceProfiles().getSliceProfile().size() == (sizeBelore + 1))
}
-
}
diff --git a/bpmn/so-bpmn-infrastructure-flows/pom.xml b/bpmn/so-bpmn-infrastructure-flows/pom.xml
index e6eb284199..a8f35986e7 100644
--- a/bpmn/so-bpmn-infrastructure-flows/pom.xml
+++ b/bpmn/so-bpmn-infrastructure-flows/pom.xml
@@ -195,17 +195,14 @@
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-spring-boot-starter-jaxws</artifactId>
- <version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-spring-boot-starter-jaxrs</artifactId>
- <version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-rs-service-description-swagger</artifactId>
- <version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/AllocateSliceSubnet.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/AllocateSliceSubnet.bpmn
index 450faaebca..29f024991d 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/AllocateSliceSubnet.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/AllocateSliceSubnet.bpmn
@@ -91,13 +91,6 @@ nss.prepareInitOperationStatus(execution)</bpmn:script>
</bpmn:scriptTask>
<bpmn:sequenceFlow id="Flow_0ou7wr9" sourceRef="Activity_1hyt0pb" targetRef="Activity_1ydx2rx" />
<bpmn:sequenceFlow id="Flow_18cgkru" sourceRef="Activity_1ydx2rx" targetRef="Activity_0qlstj2" />
- <bpmn:callActivity id="CallDoAllocateTransportNSSI" name="Call TNAllocateNSSI" calledElement="DoAllocateTransportNSSI">
- <bpmn:extensionElements>
- <camunda:in source="servicename" target="servicename" />
- </bpmn:extensionElements>
- <bpmn:incoming>Flow_0g7721r</bpmn:incoming>
- <bpmn:outgoing>Flow_189zwjw</bpmn:outgoing>
- </bpmn:callActivity>
<bpmn:sequenceFlow id="Flow_189zwjw" sourceRef="CallDoAllocateTransportNSSI" targetRef="Event_18u424w" />
<bpmn:callActivity id="CallDoAllocateCoreNSSI" name="Call CNAllocateNSSI" calledElement="DoAllocateCoreNSSI">
<bpmn:extensionElements>
@@ -118,6 +111,24 @@ nss.prepareInitOperationStatus(execution)</bpmn:script>
<bpmn:outgoing>Flow_1coedjo</bpmn:outgoing>
</bpmn:callActivity>
<bpmn:sequenceFlow id="Flow_1coedjo" sourceRef="CallDoAllocateCoreNSSI" targetRef="Event_18u424w" />
+ <bpmn:callActivity id="CallDoAllocateTransportNSSI" name="Call TNAllocateNSSI" calledElement="DoAllocateTransportNSSI">
+ <bpmn:extensionElements>
+ <camunda:in source="msoRequestId" target="msoRequestId" />
+ <camunda:in source="modelInvariantUuid" target="modelInvariantUuid" />
+ <camunda:in source="modelUuid" target="modelUuid" />
+ <camunda:in source="globalSubscriberId" target="globalSubscriberId" />
+ <camunda:in source="dummyServiceId" target="dummyServiceId" />
+ <camunda:in source="nsiId" target="nsiId" />
+ <camunda:in source="networkType" target="networkType" />
+ <camunda:in source="subscriptionServiceType" target="subscriptionServiceType" />
+ <camunda:in source="jobId" target="jobId" />
+ <camunda:in source="sliceParams" target="sliceParams" />
+ <camunda:out source="WorkflowException" target="WorkflowException" />
+ <camunda:in source="servicename" target="servicename" />
+ </bpmn:extensionElements>
+ <bpmn:incoming>Flow_0g7721r</bpmn:incoming>
+ <bpmn:outgoing>Flow_189zwjw</bpmn:outgoing>
+ </bpmn:callActivity>
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="AllocateSliceSubnet">
@@ -126,8 +137,8 @@ nss.prepareInitOperationStatus(execution)</bpmn:script>
<di:waypoint x="1152" y="190" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_189zwjw_di" bpmnElement="Flow_189zwjw">
- <di:waypoint x="1080" y="300" />
- <di:waypoint x="1170" y="300" />
+ <di:waypoint x="1080" y="290" />
+ <di:waypoint x="1170" y="290" />
<di:waypoint x="1170" y="208" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_18cgkru_di" bpmnElement="Flow_18cgkru">
@@ -153,10 +164,10 @@ nss.prepareInitOperationStatus(execution)</bpmn:script>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_0g7721r_di" bpmnElement="Flow_0g7721r">
<di:waypoint x="890" y="215" />
- <di:waypoint x="890" y="300" />
- <di:waypoint x="980" y="300" />
+ <di:waypoint x="890" y="290" />
+ <di:waypoint x="980" y="290" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="912" y="273" width="36" height="14" />
+ <dc:Bounds x="912" y="263" width="36" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_1fij4ds_di" bpmnElement="Flow_1fij4ds">
@@ -208,12 +219,13 @@ nss.prepareInitOperationStatus(execution)</bpmn:script>
<bpmndi:BPMNShape id="Activity_1ydx2rx_di" bpmnElement="Activity_1ydx2rx">
<dc:Bounds x="380" y="150" width="100" height="80" />
</bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="Activity_008nbm9_di" bpmnElement="CallDoAllocateTransportNSSI">
- <dc:Bounds x="980" y="260" width="100" height="80" />
- </bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_01669p4_di" bpmnElement="CallDoAllocateCoreNSSI">
<dc:Bounds x="980" y="150" width="100" height="80" />
</bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_00awuik_di" bpmnElement="CallDoAllocateTransportNSSI">
+ <dc:Bounds x="980" y="250" width="100" height="80" />
+ </bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>
+
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateTransportNSSI.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateTransportNSSI.bpmn
index f4886322c2..12632dec72 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateTransportNSSI.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateTransportNSSI.bpmn
@@ -68,12 +68,12 @@ ex.processJavaException(execution)</bpmn:script>
<bpmn:incoming>SequenceFlow_07e12rt</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_0t094g7</bpmn:outgoing>
<bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
-def rupScript = new TnAllocateNssi()
+def runScript = new TnAllocateNssi()
runScript.prepareUpdateJobStatus(execution,"progress","10","Allocate TN NSSI started")</bpmn:script>
</bpmn:scriptTask>
<bpmn:intermediateThrowEvent id="IntermediateThrowEvent_1ex8ke9" name="Goto OOF TN NSSI Selection">
<bpmn:incoming>SequenceFlow_0jrclmc</bpmn:incoming>
- <bpmn:linkEventDefinition id="LinkEventDefinition_0de65en" name="OofTnNssiSelect" />
+ <bpmn:linkEventDefinition id="LinkEventDefinition_0de65en" name="TnAllocateNssi" />
</bpmn:intermediateThrowEvent>
<bpmn:scriptTask id="ScriptTask_1ssh2l9" name="Prepare Update Resource Oper Status((finish)" scriptFormat="groovy">
<bpmn:incoming>SequenceFlow_0kixzdj</bpmn:incoming>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateSliceServiceOption.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateSliceServiceOption.bpmn
index 1bda596c6a..7699e804b4 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateSliceServiceOption.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateSliceServiceOption.bpmn
@@ -160,10 +160,11 @@ dcso.processNSIResp(execution)</bpmn:script>
</bpmn:scriptTask>
<bpmn:scriptTask id="ScriptTask_0bgvphs" name="Prepare OOF Select NSI options request" scriptFormat="groovy">
<bpmn:incoming>SequenceFlow_1iawj3m</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_1e7iqkm</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_14o0fxe</bpmn:outgoing>
<bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
def dcso = new DoCreateSliceServiceOption()
-dcso.preNSIRequest(execution,true)</bpmn:script>
+dcso.preNSIRequest(execution)</bpmn:script>
</bpmn:scriptTask>
<bpmn:intermediateCatchEvent id="IntermediateCatchEvent_00uke3g" name=" Select NSSI ">
<bpmn:outgoing>SequenceFlow_1iawj3m</bpmn:outgoing>
@@ -190,7 +191,7 @@ dcso.handleNssiSelect(execution)</bpmn:script>
<bpmn:sequenceFlow id="SequenceFlow_103oxyw" sourceRef="CallActivity_0melx8d" targetRef="ParallelGateway_06a2n9u" />
<bpmn:sequenceFlow id="SequenceFlow_14rhmx9" sourceRef="CallActivity_1vzxvna" targetRef="ParallelGateway_06a2n9u" />
<bpmn:parallelGateway id="ParallelGateway_05zg916">
- <bpmn:incoming>SequenceFlow_1h3kdce</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_0vfe8hp</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_0il5j01</bpmn:outgoing>
<bpmn:outgoing>SequenceFlow_0euwvgf</bpmn:outgoing>
<bpmn:outgoing>SequenceFlow_05250mp</bpmn:outgoing>
@@ -198,7 +199,7 @@ dcso.handleNssiSelect(execution)</bpmn:script>
<bpmn:sequenceFlow id="SequenceFlow_0il5j01" sourceRef="ParallelGateway_05zg916" targetRef="CallActivity_0otry7e" />
<bpmn:sequenceFlow id="SequenceFlow_0euwvgf" sourceRef="ParallelGateway_05zg916" targetRef="CallActivity_0melx8d" />
<bpmn:sequenceFlow id="SequenceFlow_05250mp" sourceRef="ParallelGateway_05zg916" targetRef="CallActivity_1vzxvna" />
- <bpmn:sequenceFlow id="SequenceFlow_1h3kdce" sourceRef="ScriptTask_12t6v71" targetRef="ParallelGateway_05zg916" />
+ <bpmn:sequenceFlow id="SequenceFlow_1h3kdce" sourceRef="ScriptTask_12t6v71" targetRef="ExclusiveGateway_015qbbq" />
<bpmn:sequenceFlow id="SequenceFlow_1tqg26p" sourceRef="CallActivity_0tzazs0" targetRef="Task_00nfg5x" />
<bpmn:sequenceFlow id="SequenceFlow_1tey3hz" sourceRef="Task_1jyj2vs" targetRef="ExclusiveGateway_0b52m39" />
<bpmn:sequenceFlow id="SequenceFlow_0abqxa1" sourceRef="Task_1m9qoo3" targetRef="CallActivity_0tzazs0" />
@@ -216,212 +217,234 @@ dcso.handleNssiSelect(execution)</bpmn:script>
</bpmn:endEvent>
<bpmn:sequenceFlow id="SequenceFlow_1nrfy6i" sourceRef="ExclusiveGateway_0b52m39" targetRef="EndEvent_0p0cjhl" />
<bpmn:sequenceFlow id="SequenceFlow_1ezi1oi" sourceRef="Task_00nfg5x" targetRef="ExclusiveGateway_0b52m39" />
+ <bpmn:exclusiveGateway id="ExclusiveGateway_015qbbq" default="SequenceFlow_0vfe8hp">
+ <bpmn:incoming>SequenceFlow_1h3kdce</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0vfe8hp</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_1e7iqkm</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:sequenceFlow id="SequenceFlow_0vfe8hp" sourceRef="ExclusiveGateway_015qbbq" targetRef="ParallelGateway_05zg916" />
+ <bpmn:sequenceFlow id="SequenceFlow_1e7iqkm" sourceRef="ExclusiveGateway_015qbbq" targetRef="ScriptTask_0bgvphs">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("needQuerySliceProfile") == true}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoCreateSliceServiceOption">
<bpmndi:BPMNShape id="ScriptTask_11rb2ju_di" bpmnElement="ScriptTask_11rb2ju">
- <dc:Bounds x="400" y="140" width="100" height="80" />
+ <dc:Bounds x="470" y="140" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="CallActivity_0c567r4_di" bpmnElement="CallActivity_0c567r4">
- <dc:Bounds x="560" y="140" width="100" height="80" />
+ <dc:Bounds x="630" y="140" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ScriptTask_0z0dwk2_di" bpmnElement="ScriptTask_0z0dwk2">
- <dc:Bounds x="710" y="140" width="100" height="80" />
+ <dc:Bounds x="780" y="140" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1kzy63m_di" bpmnElement="SequenceFlow_1kzy63m">
- <di:waypoint x="500" y="180" />
- <di:waypoint x="560" y="180" />
+ <di:waypoint x="570" y="180" />
+ <di:waypoint x="630" y="180" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1t317y2_di" bpmnElement="SequenceFlow_1t317y2">
- <di:waypoint x="660" y="180" />
- <di:waypoint x="710" y="180" />
+ <di:waypoint x="730" y="180" />
+ <di:waypoint x="780" y="180" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="CallActivity_0tzazs0_di" bpmnElement="CallActivity_0tzazs0">
- <dc:Bounds x="1410" y="320" width="100" height="80" />
+ <dc:Bounds x="1560" y="320" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="StartEvent_0mwlirs_di" bpmnElement="StartEvent_0mwlirs">
- <dc:Bounds x="162" y="162" width="36" height="36" />
+ <dc:Bounds x="232" y="162" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="169" y="198" width="25" height="14" />
+ <dc:Bounds x="239" y="198" width="25" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ScriptTask_0w34e57_di" bpmnElement="ScriptTask_0w34e57">
- <dc:Bounds x="230" y="140" width="100" height="80" />
+ <dc:Bounds x="300" y="140" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1fuwy35_di" bpmnElement="SequenceFlow_1fuwy35">
- <di:waypoint x="198" y="180" />
- <di:waypoint x="230" y="180" />
+ <di:waypoint x="268" y="180" />
+ <di:waypoint x="300" y="180" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ScriptTask_1anc3ln_di" bpmnElement="CallActivity_1vzxvna">
- <dc:Bounds x="740" y="320" width="100" height="80" />
+ <dc:Bounds x="950" y="330" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ScriptTask_1xgkaqi_di" bpmnElement="CallActivity_0melx8d">
- <dc:Bounds x="740" y="460" width="100" height="80" />
+ <dc:Bounds x="950" y="460" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ScriptTask_11y7ba5_di" bpmnElement="CallActivity_0otry7e">
- <dc:Bounds x="740" y="580" width="100" height="80" />
+ <dc:Bounds x="950" y="580" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ScriptTask_1icyh1a_di" bpmnElement="Task_1m9qoo3">
- <dc:Bounds x="1410" y="460" width="100" height="80" />
+ <dc:Bounds x="1560" y="460" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ScriptTask_0aqbm7t_di" bpmnElement="Task_00nfg5x">
- <dc:Bounds x="1210" y="320" width="100" height="80" />
+ <dc:Bounds x="1360" y="320" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ScriptTask_12sydez_di" bpmnElement="ScriptTask_12sydez">
- <dc:Bounds x="860" y="140" width="100" height="80" />
+ <dc:Bounds x="930" y="140" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="CallActivity_0hfiogq_di" bpmnElement="CallActivity_0hfiogq">
- <dc:Bounds x="1010" y="140" width="100" height="80" />
+ <dc:Bounds x="1080" y="140" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ScriptTask_14j28c2_di" bpmnElement="ScriptTask_14j28c2">
- <dc:Bounds x="1170" y="140" width="100" height="80" />
+ <dc:Bounds x="1240" y="140" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_12pvazb_di" bpmnElement="SequenceFlow_12pvazb">
- <di:waypoint x="960" y="180" />
- <di:waypoint x="1010" y="180" />
+ <di:waypoint x="1030" y="180" />
+ <di:waypoint x="1080" y="180" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1inonqp_di" bpmnElement="SequenceFlow_1inonqp">
- <di:waypoint x="1110" y="180" />
- <di:waypoint x="1170" y="180" />
+ <di:waypoint x="1180" y="180" />
+ <di:waypoint x="1240" y="180" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="IntermediateThrowEvent_1bxdugq_di" bpmnElement="IntermediateThrowEvent_1bxdugq">
- <dc:Bounds x="1482" y="162" width="36" height="36" />
+ <dc:Bounds x="1552" y="162" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1459" y="205" width="87" height="14" />
+ <dc:Bounds x="1529" y="205" width="87" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_067xdx1_di" bpmnElement="SequenceFlow_067xdx1">
- <di:waypoint x="330" y="180" />
<di:waypoint x="400" y="180" />
+ <di:waypoint x="470" y="180" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_049glzl_di" bpmnElement="SequenceFlow_049glzl">
- <di:waypoint x="1270" y="180" />
- <di:waypoint x="1320" y="180" />
+ <di:waypoint x="1340" y="180" />
+ <di:waypoint x="1390" y="180" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0zglfyw_di" bpmnElement="SequenceFlow_0zglfyw">
- <di:waypoint x="1230" y="140" />
- <di:waypoint x="1230" y="80" />
- <di:waypoint x="910" y="80" />
- <di:waypoint x="910" y="140" />
+ <di:waypoint x="1300" y="140" />
+ <di:waypoint x="1300" y="80" />
+ <di:waypoint x="980" y="80" />
+ <di:waypoint x="980" y="140" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0t4gmix_di" bpmnElement="SequenceFlow_0t4gmix">
- <di:waypoint x="810" y="180" />
- <di:waypoint x="860" y="180" />
+ <di:waypoint x="880" y="180" />
+ <di:waypoint x="930" y="180" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ScriptTask_1tx9eou_di" bpmnElement="Task_1xqjkqx">
- <dc:Bounds x="1320" y="140" width="100" height="80" />
+ <dc:Bounds x="1390" y="140" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_16akt81_di" bpmnElement="SequenceFlow_16akt81">
- <di:waypoint x="1420" y="180" />
- <di:waypoint x="1482" y="180" />
+ <di:waypoint x="1490" y="180" />
+ <di:waypoint x="1552" y="180" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="CallActivity_0vs5jgq_di" bpmnElement="CallActivity_0vs5jgq">
- <dc:Bounds x="360" y="460" width="100" height="80" />
+ <dc:Bounds x="410" y="460" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ScriptTask_12t6v71_di" bpmnElement="ScriptTask_12t6v71">
- <dc:Bounds x="490" y="460" width="100" height="80" />
+ <dc:Bounds x="580" y="460" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ScriptTask_0bgvphs_di" bpmnElement="ScriptTask_0bgvphs">
- <dc:Bounds x="210" y="460" width="100" height="80" />
+ <dc:Bounds x="250" y="460" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="IntermediateCatchEvent_00uke3g_di" bpmnElement="IntermediateCatchEvent_00uke3g">
- <dc:Bounds x="142" y="482" width="36" height="36" />
+ <dc:Bounds x="162" y="482" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="135" y="525" width="60" height="14" />
+ <dc:Bounds x="155" y="525" width="60" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_14o0fxe_di" bpmnElement="SequenceFlow_14o0fxe">
- <di:waypoint x="310" y="500" />
- <di:waypoint x="360" y="500" />
+ <di:waypoint x="350" y="500" />
+ <di:waypoint x="410" y="500" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0nwt0ci_di" bpmnElement="SequenceFlow_0nwt0ci">
- <di:waypoint x="460" y="500" />
- <di:waypoint x="490" y="500" />
+ <di:waypoint x="510" y="500" />
+ <di:waypoint x="580" y="500" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1iawj3m_di" bpmnElement="SequenceFlow_1iawj3m">
- <di:waypoint x="178" y="500" />
- <di:waypoint x="210" y="500" />
+ <di:waypoint x="198" y="500" />
+ <di:waypoint x="250" y="500" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ScriptTask_0h3fsja_di" bpmnElement="Task_1jyj2vs">
- <dc:Bounds x="1010" y="460" width="100" height="80" />
+ <dc:Bounds x="1220" y="460" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ParallelGateway_06a2n9u_di" bpmnElement="ParallelGateway_06a2n9u">
- <dc:Bounds x="905" y="475" width="50" height="50" />
+ <dc:Bounds x="1105" y="475" width="50" height="50" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1tr3i9d_di" bpmnElement="SequenceFlow_1tr3i9d">
- <di:waypoint x="955" y="500" />
- <di:waypoint x="1010" y="500" />
+ <di:waypoint x="1155" y="500" />
+ <di:waypoint x="1220" y="500" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0aasemn_di" bpmnElement="SequenceFlow_0aasemn">
- <di:waypoint x="840" y="620" />
- <di:waypoint x="930" y="620" />
- <di:waypoint x="930" y="525" />
+ <di:waypoint x="1050" y="620" />
+ <di:waypoint x="1130" y="620" />
+ <di:waypoint x="1130" y="525" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_103oxyw_di" bpmnElement="SequenceFlow_103oxyw">
- <di:waypoint x="840" y="500" />
- <di:waypoint x="905" y="500" />
+ <di:waypoint x="1050" y="500" />
+ <di:waypoint x="1105" y="500" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_14rhmx9_di" bpmnElement="SequenceFlow_14rhmx9">
- <di:waypoint x="840" y="360" />
- <di:waypoint x="930" y="360" />
- <di:waypoint x="930" y="475" />
+ <di:waypoint x="1050" y="370" />
+ <di:waypoint x="1130" y="370" />
+ <di:waypoint x="1130" y="475" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ParallelGateway_05zg916_di" bpmnElement="ParallelGateway_05zg916">
- <dc:Bounds x="635" y="475" width="50" height="50" />
+ <dc:Bounds x="825" y="475" width="50" height="50" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0il5j01_di" bpmnElement="SequenceFlow_0il5j01">
- <di:waypoint x="660" y="525" />
- <di:waypoint x="660" y="620" />
- <di:waypoint x="740" y="620" />
+ <di:waypoint x="850" y="525" />
+ <di:waypoint x="850" y="620" />
+ <di:waypoint x="950" y="620" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0euwvgf_di" bpmnElement="SequenceFlow_0euwvgf">
- <di:waypoint x="685" y="500" />
- <di:waypoint x="740" y="500" />
+ <di:waypoint x="875" y="500" />
+ <di:waypoint x="950" y="500" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_05250mp_di" bpmnElement="SequenceFlow_05250mp">
- <di:waypoint x="660" y="475" />
- <di:waypoint x="660" y="360" />
- <di:waypoint x="740" y="360" />
+ <di:waypoint x="850" y="475" />
+ <di:waypoint x="850" y="370" />
+ <di:waypoint x="950" y="370" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1h3kdce_di" bpmnElement="SequenceFlow_1h3kdce">
- <di:waypoint x="590" y="500" />
- <di:waypoint x="635" y="500" />
+ <di:waypoint x="680" y="500" />
+ <di:waypoint x="725" y="500" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1tqg26p_di" bpmnElement="SequenceFlow_1tqg26p">
- <di:waypoint x="1410" y="360" />
- <di:waypoint x="1310" y="360" />
+ <di:waypoint x="1560" y="360" />
+ <di:waypoint x="1460" y="360" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1tey3hz_di" bpmnElement="SequenceFlow_1tey3hz">
- <di:waypoint x="1110" y="500" />
- <di:waypoint x="1235" y="500" />
+ <di:waypoint x="1320" y="500" />
+ <di:waypoint x="1385" y="500" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0abqxa1_di" bpmnElement="SequenceFlow_0abqxa1">
- <di:waypoint x="1460" y="460" />
- <di:waypoint x="1460" y="400" />
+ <di:waypoint x="1610" y="460" />
+ <di:waypoint x="1610" y="400" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ExclusiveGateway_0b52m39_di" bpmnElement="ExclusiveGateway_0b52m39" isMarkerVisible="true">
- <dc:Bounds x="1235" y="475" width="50" height="50" />
+ <dc:Bounds x="1385" y="475" width="50" height="50" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1218" y="463" width="85" height="14" />
+ <dc:Bounds x="1367" y="535" width="86" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_126j77n_di" bpmnElement="SequenceFlow_126j77n">
- <di:waypoint x="1285" y="500" />
- <di:waypoint x="1410" y="500" />
+ <di:waypoint x="1435" y="500" />
+ <di:waypoint x="1560" y="500" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1339" y="482" width="17" height="14" />
+ <dc:Bounds x="1489" y="482" width="17" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="EndEvent_0p0cjhl_di" bpmnElement="EndEvent_0p0cjhl">
- <dc:Bounds x="1242" y="632" width="36" height="36" />
+ <dc:Bounds x="1392" y="632" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1nrfy6i_di" bpmnElement="SequenceFlow_1nrfy6i">
- <di:waypoint x="1260" y="525" />
- <di:waypoint x="1260" y="632" />
+ <di:waypoint x="1410" y="525" />
+ <di:waypoint x="1410" y="632" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1ezi1oi_di" bpmnElement="SequenceFlow_1ezi1oi">
- <di:waypoint x="1260" y="400" />
- <di:waypoint x="1260" y="475" />
+ <di:waypoint x="1410" y="400" />
+ <di:waypoint x="1410" y="475" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ExclusiveGateway_015qbbq_di" bpmnElement="ExclusiveGateway_015qbbq" isMarkerVisible="true">
+ <dc:Bounds x="725" y="475" width="50" height="50" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0vfe8hp_di" bpmnElement="SequenceFlow_0vfe8hp">
+ <di:waypoint x="775" y="500" />
+ <di:waypoint x="825" y="500" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1e7iqkm_di" bpmnElement="SequenceFlow_1e7iqkm">
+ <di:waypoint x="750" y="525" />
+ <di:waypoint x="750" y="620" />
+ <di:waypoint x="300" y="620" />
+ <di:waypoint x="300" y="540" />
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateCoreNSSI.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateCoreNSSI.bpmn
index 81ed921a5f..b55b7c41f0 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateCoreNSSI.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateCoreNSSI.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:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1v4vnwb" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.1.1">
+<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:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1v4vnwb" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.1.1">
<bpmn:process id="Process_02hqnsq" isExecutable="true">
<bpmn:startEvent id="StartEvent_1" name="Deallocate Core NSSI Flow">
<bpmn:outgoing>Flow_0xxq2h8</bpmn:outgoing>
@@ -83,11 +83,11 @@ def dcnssi= new DoDeallocateCoreNSSI()
</bpmn:scriptTask>
<bpmn:exclusiveGateway id="Gateway_07ygtxz" name="Is terminateNSSI=true?" default="Flow_12nxpx6">
<bpmn:incoming>Flow_009x8vn</bpmn:incoming>
- <bpmn:outgoing>Flow_1r39237</bpmn:outgoing>
<bpmn:outgoing>Flow_12nxpx6</bpmn:outgoing>
+ <bpmn:outgoing>Flow_1r39237</bpmn:outgoing>
</bpmn:exclusiveGateway>
<bpmn:endEvent id="Event_1vgebg2" name="End">
- <bpmn:incoming>Flow_15rk73d</bpmn:incoming>
+ <bpmn:incoming>Flow_095vvrk</bpmn:incoming>
</bpmn:endEvent>
<bpmn:scriptTask id="Activity_1gcmlps" name=" Delete the NSSI service instance " scriptFormat="groovy">
<bpmn:incoming>Flow_1r39237</bpmn:incoming>
@@ -96,18 +96,15 @@ def dcnssi= new DoDeallocateCoreNSSI()
def dcnssi= new DoDeallocateCoreNSSI()
dcnssi.deleteNSSIServiceInstance(execution)</bpmn:script>
</bpmn:scriptTask>
- <bpmn:sequenceFlow id="Flow_1r39237" name="yes" sourceRef="Gateway_07ygtxz" targetRef="Activity_1gcmlps">
- <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isTerminateNSSI" ) == true)}</bpmn:conditionExpression>
- </bpmn:sequenceFlow>
- <bpmn:scriptTask id="Activity_0gs71qq" name="Update Service Operation Status" scriptFormat="groovy">
- <bpmn:incoming>Flow_12nxpx6</bpmn:incoming>
+ <bpmn:scriptTask id="Activity_0gs71qq" name="Prepare Update Operation Status" scriptFormat="groovy">
<bpmn:incoming>Flow_04hswb4</bpmn:incoming>
+ <bpmn:incoming>Flow_12nxpx6</bpmn:incoming>
<bpmn:outgoing>Flow_15rk73d</bpmn:outgoing>
<bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
def dcnssi= new DoDeallocateCoreNSSI()
- dcnssi.updateServiceOperationStatus(execution)</bpmn:script>
+ dcnssi.prepareUpdateResourceOperationStatus(execution)</bpmn:script>
</bpmn:scriptTask>
- <bpmn:intermediateThrowEvent id="Event_016dxue" name="Goto no terminate NSSI Subflow">
+ <bpmn:intermediateThrowEvent id="Event_016dxue" name="Goto No terminate NSSI Subflow">
<bpmn:incoming>Flow_0e3yvck</bpmn:incoming>
<bpmn:linkEventDefinition id="LinkEventDefinition_0l191e1" name="NoTerminateNSSISubflow" />
</bpmn:intermediateThrowEvent>
@@ -125,12 +122,12 @@ def dcnssi= new DoDeallocateCoreNSSI()
<bpmn:sequenceFlow id="Flow_1qwi2ka" sourceRef="Activity_0es9or8" targetRef="Activity_0mnkgd6" />
<bpmn:sequenceFlow id="Flow_0e3yvck" name="no" sourceRef="Gateway_1dqw1bg" targetRef="Event_016dxue" />
<bpmn:intermediateThrowEvent id="Event_062ulql" name="Goto Common Subflow">
- <bpmn:incoming>Flow_178myd8</bpmn:incoming>
- <bpmn:incoming>Flow_1b14can</bpmn:incoming>
+ <bpmn:incoming>Flow_1mrr969</bpmn:incoming>
+ <bpmn:incoming>Flow_1gxcve5</bpmn:incoming>
<bpmn:linkEventDefinition id="LinkEventDefinition_017h179" name="CommonSubflow" />
</bpmn:intermediateThrowEvent>
- <bpmn:sequenceFlow id="Flow_178myd8" sourceRef="Activity_0mnkgd6" targetRef="Event_062ulql" />
- <bpmn:sequenceFlow id="Flow_1b14can" sourceRef="Activity_1kne6ot" targetRef="Event_062ulql" />
+ <bpmn:sequenceFlow id="Flow_178myd8" sourceRef="Activity_0mnkgd6" targetRef="Activity_07qrjro" />
+ <bpmn:sequenceFlow id="Flow_1b14can" sourceRef="Activity_1kne6ot" targetRef="Activity_1a5fd5v" />
<bpmn:intermediateCatchEvent id="Event_027jirg" name="Common Subflow">
<bpmn:outgoing>Flow_16j7pjk</bpmn:outgoing>
<bpmn:linkEventDefinition id="LinkEventDefinition_1fn4t8h" name="CommonSubflow" />
@@ -139,8 +136,7 @@ def dcnssi= new DoDeallocateCoreNSSI()
<bpmn:sequenceFlow id="Flow_0j8gu83" sourceRef="Activity_1mbtpe6" targetRef="Activity_0tanqh5" />
<bpmn:sequenceFlow id="Flow_009x8vn" sourceRef="Activity_0tanqh5" targetRef="Gateway_07ygtxz" />
<bpmn:sequenceFlow id="Flow_12nxpx6" name="no" sourceRef="Gateway_07ygtxz" targetRef="Activity_0gs71qq" />
- <bpmn:sequenceFlow id="Flow_04hswb4" sourceRef="Activity_1gcmlps" targetRef="Activity_0gs71qq" />
- <bpmn:sequenceFlow id="Flow_15rk73d" sourceRef="Activity_0gs71qq" targetRef="Event_1vgebg2" />
+ <bpmn:sequenceFlow id="Flow_15rk73d" sourceRef="Activity_0gs71qq" targetRef="Activity_1npwfvi" />
<bpmn:scriptTask id="Activity_13qnpcn" name="Execute terminate NSSI query" scriptFormat="groovy">
<bpmn:incoming>Flow_0g84uy5</bpmn:incoming>
<bpmn:outgoing>Flow_189j30m</bpmn:outgoing>
@@ -150,46 +146,180 @@ def dcnssi= new DoDeallocateCoreNSSI()
</bpmn:scriptTask>
<bpmn:sequenceFlow id="Flow_0g84uy5" sourceRef="Activity_0u06qij" targetRef="Activity_13qnpcn" />
<bpmn:sequenceFlow id="Flow_189j30m" sourceRef="Activity_13qnpcn" targetRef="Activity_0wswwhj" />
+ <bpmn:subProcess id="Activity_14l5j2f" name="Sub-process for FalloutHandler and Rollback" triggeredByEvent="true">
+ <bpmn:startEvent id="Event_1blx2tk">
+ <bpmn:outgoing>Flow_0z51qfz</bpmn:outgoing>
+ <bpmn:errorEventDefinition id="ErrorEventDefinition_06njwcg" />
+ </bpmn:startEvent>
+ <bpmn:endEvent id="Event_1umlj38">
+ <bpmn:incoming>Flow_139pcs3</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:scriptTask id="Activity_1hh3qh1" name="Handle Unexpected Error" scriptFormat="groovy">
+ <bpmn:incoming>Flow_1vq4jz8</bpmn:incoming>
+ <bpmn:outgoing>Flow_139pcs3</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.common.scripts.*
+ExceptionUtil ex = new ExceptionUtil()
+ex.processJavaException(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:scriptTask id="Activity_009mpgu" name="Prepare Resource Operation Status Update" scriptFormat="groovy">
+ <bpmn:incoming>Flow_0z51qfz</bpmn:incoming>
+ <bpmn:outgoing>Flow_1cl22g1</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcnssi = new DoDeallocateCoreNSSI()
+dcnssi.prepareFailedOperationStatusUpdate(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:serviceTask id="Activity_0ckr2ke" name="Update Resource Operation Status">
+ <bpmn:extensionElements>
+ <camunda:connector>
+ <camunda:inputOutput>
+ <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter>
+ <camunda:inputParameter name="headers">
+ <camunda:map>
+ <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+ <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry>
+ </camunda:map>
+ </camunda:inputParameter>
+ <camunda:inputParameter name="payload">${updateResourceOperationStatus}</camunda:inputParameter>
+ <camunda:inputParameter name="method">POST</camunda:inputParameter>
+ <camunda:outputParameter name="NSSMF_dbResponseCode">${statusCode}</camunda:outputParameter>
+ <camunda:outputParameter name="NSSMF_dbResponse">${response}</camunda:outputParameter>
+ </camunda:inputOutput>
+ <camunda:connectorId>http-connector</camunda:connectorId>
+ </camunda:connector>
+ </bpmn:extensionElements>
+ <bpmn:incoming>Flow_1cl22g1</bpmn:incoming>
+ <bpmn:outgoing>Flow_1vq4jz8</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="Flow_1vq4jz8" sourceRef="Activity_0ckr2ke" targetRef="Activity_1hh3qh1" />
+ <bpmn:sequenceFlow id="Flow_1cl22g1" sourceRef="Activity_009mpgu" targetRef="Activity_0ckr2ke" />
+ <bpmn:sequenceFlow id="Flow_0z51qfz" sourceRef="Event_1blx2tk" targetRef="Activity_009mpgu" />
+ <bpmn:sequenceFlow id="Flow_139pcs3" sourceRef="Activity_1hh3qh1" targetRef="Event_1umlj38" />
+ </bpmn:subProcess>
+ <bpmn:serviceTask id="Activity_1npwfvi" name="Update Resource Operation Status">
+ <bpmn:extensionElements>
+ <camunda:connector>
+ <camunda:inputOutput>
+ <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter>
+ <camunda:inputParameter name="headers">
+ <camunda:map>
+ <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+ <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry>
+ </camunda:map>
+ </camunda:inputParameter>
+ <camunda:inputParameter name="payload">${updateResourceOperationStatus}</camunda:inputParameter>
+ <camunda:inputParameter name="method">POST</camunda:inputParameter>
+ <camunda:outputParameter name="NSSMF_dbResponseCode">${statusCode}</camunda:outputParameter>
+ <camunda:outputParameter name="NSSMF_dbResponse">${response}</camunda:outputParameter>
+ </camunda:inputOutput>
+ <camunda:connectorId>http-connector</camunda:connectorId>
+ </camunda:connector>
+ </bpmn:extensionElements>
+ <bpmn:incoming>Flow_15rk73d</bpmn:incoming>
+ <bpmn:outgoing>Flow_095vvrk</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="Flow_095vvrk" sourceRef="Activity_1npwfvi" targetRef="Event_1vgebg2" />
+ <bpmn:scriptTask id="Activity_1a5fd5v" name="Call Get Delete ServiceOrder Progress" scriptFormat="groovy">
+ <bpmn:incoming>Flow_1b14can</bpmn:incoming>
+ <bpmn:incoming>Flow_1qej57v</bpmn:incoming>
+ <bpmn:outgoing>Flow_1h8q1h1</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcnssi= new DoDeallocateCoreNSSI()
+dcnssi.getDeleteServiceOrderProgress(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="Flow_1h8q1h1" sourceRef="Activity_1a5fd5v" targetRef="Gateway_13cwisg" />
+ <bpmn:exclusiveGateway id="Gateway_13cwisg" name="Status = processing" default="Flow_1mrr969">
+ <bpmn:incoming>Flow_1h8q1h1</bpmn:incoming>
+ <bpmn:outgoing>Flow_1mrr969</bpmn:outgoing>
+ <bpmn:outgoing>Flow_1j1en2h</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:sequenceFlow id="Flow_1mrr969" name="No" sourceRef="Gateway_13cwisg" targetRef="Event_062ulql" />
+ <bpmn:scriptTask id="Activity_1ym1op6" name="Time Delay" scriptFormat="groovy">
+ <bpmn:incoming>Flow_1j1en2h</bpmn:incoming>
+ <bpmn:outgoing>Flow_1qej57v</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcnssi= new DoDeallocateCoreNSSI()
+dcnssi.timeDelay(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="Flow_1j1en2h" name="Yes" sourceRef="Gateway_13cwisg" targetRef="Activity_1ym1op6">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("deleteStatus" ) == "processing" )}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="Flow_1qej57v" sourceRef="Activity_1ym1op6" targetRef="Activity_1a5fd5v" />
+ <bpmn:scriptTask id="Activity_07qrjro" name="Call Get PUT Service Instance Progress" scriptFormat="groovy">
+ <bpmn:incoming>Flow_178myd8</bpmn:incoming>
+ <bpmn:incoming>Flow_0att74c</bpmn:incoming>
+ <bpmn:outgoing>Flow_0pvh1x9</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcnssi= new DoDeallocateCoreNSSI()
+dcnssi.getPUTServiceInstanceProgress(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="Flow_0pvh1x9" sourceRef="Activity_07qrjro" targetRef="Gateway_1yftwt8" />
+ <bpmn:sequenceFlow id="Flow_04hswb4" sourceRef="Activity_1gcmlps" targetRef="Activity_0gs71qq" />
+ <bpmn:sequenceFlow id="Flow_1r39237" name="yes" sourceRef="Gateway_07ygtxz" targetRef="Activity_1gcmlps">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isTerminateNSSI" ) == true)}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:exclusiveGateway id="Gateway_1yftwt8" name="Status = processing" default="Flow_1gxcve5">
+ <bpmn:incoming>Flow_0pvh1x9</bpmn:incoming>
+ <bpmn:outgoing>Flow_1gxcve5</bpmn:outgoing>
+ <bpmn:outgoing>Flow_0afgah7</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:sequenceFlow id="Flow_1gxcve5" name="No" sourceRef="Gateway_1yftwt8" targetRef="Event_062ulql" />
+ <bpmn:scriptTask id="Activity_1lafl76" name="Time Delay" scriptFormat="groovy">
+ <bpmn:incoming>Flow_0afgah7</bpmn:incoming>
+ <bpmn:outgoing>Flow_0att74c</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcnssi= new DoDeallocateCoreNSSI()
+dcnssi.timeDelay(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="Flow_0afgah7" name="Yes" sourceRef="Gateway_1yftwt8" targetRef="Activity_1lafl76">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("putStatus" ) == "processing" )}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="Flow_0att74c" sourceRef="Activity_1lafl76" targetRef="Activity_07qrjro" />
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_02hqnsq">
+ <bpmndi:BPMNEdge id="Flow_189j30m_di" bpmnElement="Flow_189j30m">
+ <di:waypoint x="510" y="117" />
+ <di:waypoint x="580" y="117" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_0g84uy5_di" bpmnElement="Flow_0g84uy5">
+ <di:waypoint x="360" y="117" />
+ <di:waypoint x="410" y="117" />
+ </bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_15rk73d_di" bpmnElement="Flow_15rk73d">
- <di:waypoint x="1220" y="600" />
- <di:waypoint x="1282" y="600" />
+ <di:waypoint x="1220" y="670" />
+ <di:waypoint x="1270" y="670" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_04hswb4_di" bpmnElement="Flow_04hswb4">
- <di:waypoint x="980" y="600" />
- <di:waypoint x="1120" y="600" />
+ <di:waypoint x="980" y="750" />
+ <di:waypoint x="1170" y="750" />
+ <di:waypoint x="1170" y="710" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_12nxpx6_di" bpmnElement="Flow_12nxpx6">
- <di:waypoint x="790" y="625" />
- <di:waypoint x="790" y="680" />
- <di:waypoint x="1170" y="680" />
- <di:waypoint x="1170" y="640" />
+ <di:waypoint x="795" y="670" />
+ <di:waypoint x="1120" y="670" />
<bpmndi:BPMNLabel>
<dc:Bounds x="814" y="663" width="13" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_009x8vn_di" bpmnElement="Flow_009x8vn">
- <di:waypoint x="680" y="600" />
- <di:waypoint x="765" y="600" />
+ <di:waypoint x="670" y="670" />
+ <di:waypoint x="745" y="670" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_0j8gu83_di" bpmnElement="Flow_0j8gu83">
- <di:waypoint x="510" y="600" />
- <di:waypoint x="580" y="600" />
+ <di:waypoint x="510" y="670" />
+ <di:waypoint x="570" y="670" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_16j7pjk_di" bpmnElement="Flow_16j7pjk">
- <di:waypoint x="208" y="600" />
- <di:waypoint x="260" y="600" />
+ <di:waypoint x="215" y="670" />
+ <di:waypoint x="260" y="670" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_1b14can_di" bpmnElement="Flow_1b14can">
<di:waypoint x="800" y="240" />
- <di:waypoint x="975" y="240" />
- <di:waypoint x="975" y="382" />
+ <di:waypoint x="910" y="240" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_178myd8_di" bpmnElement="Flow_178myd8">
- <di:waypoint x="840" y="400" />
- <di:waypoint x="957" y="400" />
+ <di:waypoint x="820" y="450" />
+ <di:waypoint x="880" y="450" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_0e3yvck_di" bpmnElement="Flow_0e3yvck">
<di:waypoint x="775" y="117" />
@@ -199,20 +329,20 @@ def dcnssi= new DoDeallocateCoreNSSI()
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_1qwi2ka_di" bpmnElement="Flow_1qwi2ka">
- <di:waypoint x="680" y="400" />
- <di:waypoint x="740" y="400" />
+ <di:waypoint x="680" y="450" />
+ <di:waypoint x="720" y="450" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_0xrq94a_di" bpmnElement="Flow_0xrq94a">
- <di:waypoint x="510" y="400" />
- <di:waypoint x="580" y="400" />
+ <di:waypoint x="510" y="450" />
+ <di:waypoint x="580" y="450" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_1eev81t_di" bpmnElement="Flow_1eev81t">
- <di:waypoint x="360" y="400" />
- <di:waypoint x="410" y="400" />
+ <di:waypoint x="360" y="450" />
+ <di:waypoint x="410" y="450" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_1v68jns_di" bpmnElement="Flow_1v68jns">
- <di:waypoint x="208" y="400" />
- <di:waypoint x="260" y="400" />
+ <di:waypoint x="215" y="450" />
+ <di:waypoint x="260" y="450" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_15ew9rs_di" bpmnElement="Flow_15ew9rs">
<di:waypoint x="750" y="142" />
@@ -222,14 +352,15 @@ def dcnssi= new DoDeallocateCoreNSSI()
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_0nvtepd_di" bpmnElement="Flow_0nvtepd">
- <di:waypoint x="360" y="600" />
- <di:waypoint x="410" y="600" />
+ <di:waypoint x="360" y="670" />
+ <di:waypoint x="410" y="670" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_1r39237_di" bpmnElement="Flow_1r39237">
- <di:waypoint x="815" y="600" />
- <di:waypoint x="880" y="600" />
+ <di:waypoint x="770" y="695" />
+ <di:waypoint x="770" y="750" />
+ <di:waypoint x="880" y="750" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="823" y="582" width="17" height="14" />
+ <dc:Bounds x="772" y="701" width="17" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_16192dm_di" bpmnElement="Flow_16192dm">
@@ -240,13 +371,55 @@ def dcnssi= new DoDeallocateCoreNSSI()
<di:waypoint x="215" y="117" />
<di:waypoint x="260" y="117" />
</bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="Flow_0g84uy5_di" bpmnElement="Flow_0g84uy5">
- <di:waypoint x="360" y="117" />
- <di:waypoint x="410" y="117" />
+ <bpmndi:BPMNEdge id="Flow_095vvrk_di" bpmnElement="Flow_095vvrk">
+ <di:waypoint x="1370" y="670" />
+ <di:waypoint x="1432" y="670" />
</bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="Flow_189j30m_di" bpmnElement="Flow_189j30m">
- <di:waypoint x="510" y="117" />
- <di:waypoint x="580" y="117" />
+ <bpmndi:BPMNEdge id="Flow_1h8q1h1_di" bpmnElement="Flow_1h8q1h1">
+ <di:waypoint x="1010" y="240" />
+ <di:waypoint x="1130" y="240" />
+ <di:waypoint x="1130" y="325" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_1mrr969_di" bpmnElement="Flow_1mrr969">
+ <di:waypoint x="1130" y="375" />
+ <di:waypoint x="1130" y="432" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1138" y="393" width="15" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_1j1en2h_di" bpmnElement="Flow_1j1en2h">
+ <di:waypoint x="1105" y="350" />
+ <di:waypoint x="1010" y="350" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1026" y="352" width="18" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_1qej57v_di" bpmnElement="Flow_1qej57v">
+ <di:waypoint x="960" y="310" />
+ <di:waypoint x="960" y="280" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_0pvh1x9_di" bpmnElement="Flow_0pvh1x9">
+ <di:waypoint x="980" y="450" />
+ <di:waypoint x="1015" y="450" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_1gxcve5_di" bpmnElement="Flow_1gxcve5">
+ <di:waypoint x="1065" y="450" />
+ <di:waypoint x="1112" y="450" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1083" y="432" width="15" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_0afgah7_di" bpmnElement="Flow_0afgah7">
+ <di:waypoint x="1040" y="475" />
+ <di:waypoint x="1040" y="520" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1046" y="482" width="18" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_0att74c_di" bpmnElement="Flow_0att74c">
+ <di:waypoint x="990" y="560" />
+ <di:waypoint x="930" y="560" />
+ <di:waypoint x="930" y="490" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
<dc:Bounds x="179" y="99" width="36" height="36" />
@@ -257,83 +430,144 @@ def dcnssi= new DoDeallocateCoreNSSI()
<bpmndi:BPMNShape id="Activity_0u06qij_di" bpmnElement="Activity_0u06qij">
<dc:Bounds x="260" y="77" width="100" height="80" />
</bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_0wswwhj_di" bpmnElement="Activity_0wswwhj">
+ <dc:Bounds x="580" y="77" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Gateway_1dqw1bg_di" bpmnElement="Gateway_1dqw1bg" isMarkerVisible="true">
+ <dc:Bounds x="725" y="92" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="708" y="53" width="85" height="40" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_1kne6ot_di" bpmnElement="Activity_1kne6ot">
<dc:Bounds x="700" y="200" width="100" height="80" />
</bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Event_016dxue_di" bpmnElement="Event_016dxue">
+ <dc:Bounds x="832" y="99" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="821" y="140" width="74" height="40" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_13qnpcn_di" bpmnElement="Activity_13qnpcn">
+ <dc:Bounds x="410" y="77" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Event_1mk9pgp_di" bpmnElement="Event_1mk9pgp">
+ <dc:Bounds x="179" y="432" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="169" y="475" width="69" height="27" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_1anr9ry_di" bpmnElement="Activity_1anr9ry">
- <dc:Bounds x="260" y="360" width="100" height="80" />
+ <dc:Bounds x="260" y="410" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_16wfqhu_di" bpmnElement="Activity_16wfqhu">
- <dc:Bounds x="410" y="360" width="100" height="80" />
+ <dc:Bounds x="410" y="410" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_0es9or8_di" bpmnElement="Activity_0es9or8">
- <dc:Bounds x="580" y="360" width="100" height="80" />
+ <dc:Bounds x="580" y="410" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_0mnkgd6_di" bpmnElement="Activity_0mnkgd6">
- <dc:Bounds x="740" y="360" width="100" height="80" />
+ <dc:Bounds x="720" y="410" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_1a5fd5v_di" bpmnElement="Activity_1a5fd5v">
+ <dc:Bounds x="910" y="200" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_1ym1op6_di" bpmnElement="Activity_1ym1op6">
+ <dc:Bounds x="910" y="310" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_07qrjro_di" bpmnElement="Activity_07qrjro">
+ <dc:Bounds x="880" y="410" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Event_027jirg_di" bpmnElement="Event_027jirg">
+ <dc:Bounds x="179" y="652" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="160" y="695" width="88" height="14" />
+ </bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_19z90sm_di" bpmnElement="Activity_19z90sm">
- <dc:Bounds x="260" y="560" width="100" height="80" />
+ <dc:Bounds x="260" y="630" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_1mbtpe6_di" bpmnElement="Activity_1mbtpe6">
- <dc:Bounds x="410" y="560" width="100" height="80" />
+ <dc:Bounds x="410" y="630" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_0tanqh5_di" bpmnElement="Activity_0tanqh5">
- <dc:Bounds x="580" y="560" width="100" height="80" />
+ <dc:Bounds x="570" y="630" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Gateway_07ygtxz_di" bpmnElement="Gateway_07ygtxz" isMarkerVisible="true">
- <dc:Bounds x="765" y="575" width="50" height="50" />
+ <dc:Bounds x="745" y="645" width="50" height="50" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="737" y="529" width="86" height="40" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="Event_1vgebg2_di" bpmnElement="Event_1vgebg2">
- <dc:Bounds x="1282" y="582" width="36" height="36" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="1290" y="558" width="20" height="14" />
+ <dc:Bounds x="717" y="599" width="86" height="40" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_1gcmlps_di" bpmnElement="Activity_1gcmlps">
- <dc:Bounds x="880" y="560" width="100" height="80" />
+ <dc:Bounds x="880" y="710" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_0gs71qq_di" bpmnElement="Activity_0gs71qq">
- <dc:Bounds x="1120" y="560" width="100" height="80" />
+ <dc:Bounds x="1120" y="630" width="100" height="80" />
</bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="Event_1mk9pgp_di" bpmnElement="Event_1mk9pgp">
- <dc:Bounds x="172" y="382" width="36" height="36" />
+ <bpmndi:BPMNShape id="Activity_1npwfvi_di" bpmnElement="Activity_1npwfvi">
+ <dc:Bounds x="1270" y="630" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Event_1vgebg2_di" bpmnElement="Event_1vgebg2">
+ <dc:Bounds x="1432" y="652" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="162" y="425" width="69" height="27" />
+ <dc:Bounds x="1440" y="698" width="20" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_062ulql_di" bpmnElement="Event_062ulql">
- <dc:Bounds x="957" y="382" width="36" height="36" />
+ <dc:Bounds x="1112" y="432" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="947" y="423" width="72" height="27" />
+ <dc:Bounds x="1102" y="473" width="72" height="27" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="Event_027jirg_di" bpmnElement="Event_027jirg">
- <dc:Bounds x="172" y="582" width="36" height="36" />
+ <bpmndi:BPMNShape id="Gateway_13cwisg_di" bpmnElement="Gateway_13cwisg" isMarkerVisible="true">
+ <dc:Bounds x="1105" y="325" width="50" height="50" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="153" y="625" width="88" height="14" />
+ <dc:Bounds x="1165" y="336" width="54" height="27" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="Activity_13qnpcn_di" bpmnElement="Activity_13qnpcn">
- <dc:Bounds x="410" y="77" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="Activity_0wswwhj_di" bpmnElement="Activity_0wswwhj">
- <dc:Bounds x="580" y="77" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="Gateway_1dqw1bg_di" bpmnElement="Gateway_1dqw1bg" isMarkerVisible="true">
- <dc:Bounds x="725" y="92" width="50" height="50" />
+ <bpmndi:BPMNShape id="Gateway_1yftwt8_di" bpmnElement="Gateway_1yftwt8" isMarkerVisible="true">
+ <dc:Bounds x="1015" y="425" width="50" height="50" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="708" y="53" width="85" height="40" />
+ <dc:Bounds x="1028" y="396" width="54" height="27" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="Event_016dxue_di" bpmnElement="Event_016dxue">
- <dc:Bounds x="832" y="99" width="36" height="36" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="820" y="140" width="74" height="40" />
- </bpmndi:BPMNLabel>
+ <bpmndi:BPMNShape id="Activity_1lafl76_di" bpmnElement="Activity_1lafl76">
+ <dc:Bounds x="990" y="520" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_14l5j2f_di" bpmnElement="Activity_14l5j2f" isExpanded="true">
+ <dc:Bounds x="250" y="910" width="781" height="196" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="Flow_1vq4jz8_di" bpmnElement="Flow_1vq4jz8">
+ <di:waypoint x="640" y="1014" />
+ <di:waypoint x="710" y="1014" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_1cl22g1_di" bpmnElement="Flow_1cl22g1">
+ <di:waypoint x="480" y="1014" />
+ <di:waypoint x="540" y="1014" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_0z51qfz_di" bpmnElement="Flow_0z51qfz">
+ <di:waypoint x="316" y="1014" />
+ <di:waypoint x="380" y="1014" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_139pcs3_di" bpmnElement="Flow_139pcs3">
+ <di:waypoint x="810" y="1014" />
+ <di:waypoint x="918" y="1014" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="Event_1blx2tk_di" bpmnElement="Event_1blx2tk">
+ <dc:Bounds x="280" y="996" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Event_1umlj38_di" bpmnElement="Event_1umlj38">
+ <dc:Bounds x="918" y="996" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_1hh3qh1_di" bpmnElement="Activity_1hh3qh1">
+ <dc:Bounds x="710" y="974" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_009mpgu_di" bpmnElement="Activity_009mpgu">
+ <dc:Bounds x="380" y="974" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_0ckr2ke_di" bpmnElement="Activity_0ckr2ke">
+ <dc:Bounds x="540" y="974" width="100" height="80" />
</bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateNSSI.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateNSSI.bpmn
index c107cfb53a..a745f7c50d 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateNSSI.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateNSSI.bpmn
@@ -99,10 +99,11 @@ dnssi.prepareUpdateOperationStatus(execution)</bpmn:script>
<bpmn:callActivity id="Task_1x3et9h" name="Query Job Status" calledElement="QueryJobStatus">
<bpmn:extensionElements>
<camunda:in source="msoRequestId" target="msoRequestId" />
- <camunda:in source="serviceInstanceId" target="serviceInstanceId" />
- <camunda:in source="serviceModelInfo" target="serviceModelInfo" />
- <camunda:out source="serviceDecomposition" target="serviceDecomposition" />
- <camunda:out source="serviceDecompositionString" target="serviceDecompositionString" />
+ <camunda:in source="esrInfo" target="esrInfo" />
+ <camunda:in source="serviceInfo" target="serviceInfo" />
+ <camunda:in source="jobId" target="jobId" />
+ <camunda:in source="responseId" target="responseId" />
+ <camunda:out source="responseDescriptor" target="responseDescriptor" />
</bpmn:extensionElements>
<bpmn:incoming>SequenceFlow_0w01l14</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_10nogqz</bpmn:outgoing>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoModifyCoreNSSI.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoModifyCoreNSSI.bpmn
index 1f1fe4e735..e0c0b9a994 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoModifyCoreNSSI.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoModifyCoreNSSI.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:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_1ejx57e" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.1.1">
+<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:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1ejx57e" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.1.1">
<bpmn:process id="Process_1nmtzzp" isExecutable="true">
<bpmn:startEvent id="Event_0fbqt56" name="Modify Core NSSI Flow">
<bpmn:outgoing>Flow_0e007rx</bpmn:outgoing>
@@ -28,11 +28,11 @@ def mcnssi= new DoModifyCoreNSSI()
</bpmn:scriptTask>
<bpmn:sequenceFlow id="Flow_184tfp7" sourceRef="Activity_1ce41n6" targetRef="Activity_02skgkj" />
<bpmn:exclusiveGateway id="Gateway_1hadnun" name="Is Slice Profile Instance has to be created" default="Flow_03gf14v">
- <bpmn:incoming>Flow_0s31teg</bpmn:incoming>
+ <bpmn:incoming>Flow_1hm2xps</bpmn:incoming>
<bpmn:outgoing>Flow_1pls2hu</bpmn:outgoing>
<bpmn:outgoing>Flow_03gf14v</bpmn:outgoing>
</bpmn:exclusiveGateway>
- <bpmn:sequenceFlow id="Flow_0s31teg" sourceRef="Activity_02skgkj" targetRef="Gateway_1hadnun" />
+ <bpmn:sequenceFlow id="Flow_0s31teg" sourceRef="Activity_02skgkj" targetRef="Activity_0wdaul0" />
<bpmn:intermediateThrowEvent id="Event_1243wg1" name="Goto Slice Profile Instance has to be created">
<bpmn:incoming>Flow_1pls2hu</bpmn:incoming>
<bpmn:linkEventDefinition id="LinkEventDefinition_14qnw6y" name="SliceProfileInstanceHasToBeCreated" />
@@ -45,87 +45,54 @@ def mcnssi= new DoModifyCoreNSSI()
<bpmn:linkEventDefinition id="LinkEventDefinition_0ecwvhj" name="SliceProfileInstanceHasToBeDeleted" />
</bpmn:intermediateThrowEvent>
<bpmn:sequenceFlow id="Flow_03gf14v" name="no" sourceRef="Gateway_1hadnun" targetRef="Event_1gjhrcq" />
- <bpmn:scriptTask id="Activity_0oph5am" name="Update Service Operation Status" scriptFormat="groovy">
+ <bpmn:scriptTask id="Activity_0oph5am" name="Prepare Update Operation Status" scriptFormat="groovy">
<bpmn:incoming>Flow_0l7hcnf</bpmn:incoming>
<bpmn:incoming>Flow_0lrenyo</bpmn:incoming>
<bpmn:outgoing>Flow_0yq24um</bpmn:outgoing>
<bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
-def mcnssi= new DoDeallocateCoreNSSI()
- mcnssi.updateServiceOperationStatus(execution)</bpmn:script>
+def mcnssi= new DoModifyCoreNSSI()
+ mcnssi.prepareUpdateResourceOperationStatus(execution)</bpmn:script>
</bpmn:scriptTask>
<bpmn:endEvent id="Event_1p0mogo" name="End">
- <bpmn:incoming>Flow_0yq24um</bpmn:incoming>
+ <bpmn:incoming>Flow_1yphs5r</bpmn:incoming>
</bpmn:endEvent>
- <bpmn:sequenceFlow id="Flow_0yq24um" sourceRef="Activity_0oph5am" targetRef="Event_1p0mogo" />
+ <bpmn:sequenceFlow id="Flow_0yq24um" sourceRef="Activity_0oph5am" targetRef="Activity_0d1kk7f" />
<bpmn:intermediateCatchEvent id="Event_0z9mer1" name="Slice Profile Instance has to be created">
- <bpmn:outgoing>Flow_1xysykm</bpmn:outgoing>
+ <bpmn:outgoing>Flow_1twqfsc</bpmn:outgoing>
<bpmn:linkEventDefinition id="LinkEventDefinition_0fbskyk" name="SliceProfileInstanceHasToBeCreated" />
</bpmn:intermediateCatchEvent>
<bpmn:intermediateCatchEvent id="Event_0m2jn7c" name="Slice profile instance has to be deleted">
<bpmn:outgoing>Flow_11vf6ik</bpmn:outgoing>
<bpmn:linkEventDefinition id="LinkEventDefinition_1lptuqv" name="SliceProfileInstanceHasToBeDeleted" />
</bpmn:intermediateCatchEvent>
- <bpmn:scriptTask id="Activity_0ouov98" name="Calculate S-NSSAI" scriptFormat="groovy">
- <bpmn:incoming>Flow_1xysykm</bpmn:incoming>
- <bpmn:outgoing>Flow_1nxaeez</bpmn:outgoing>
- <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
-def mcnssi= new DoModifyCoreNSSI()
- mcnssi.calculateSNSSAI(execution)</bpmn:script>
- </bpmn:scriptTask>
- <bpmn:sequenceFlow id="Flow_1xysykm" sourceRef="Event_0z9mer1" targetRef="Activity_0ouov98" />
- <bpmn:scriptTask id="Activity_00t4mmi" name="Invoke PUT Service Instance API" scriptFormat="groovy">
- <bpmn:incoming>Flow_1nxaeez</bpmn:incoming>
- <bpmn:outgoing>Flow_0ccqmju</bpmn:outgoing>
- <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
-def mcnssi= new ModifyCoreNSSI()
- mcnssi.invokePUTServiceInstance(execution)</bpmn:script>
- </bpmn:scriptTask>
- <bpmn:sequenceFlow id="Flow_1nxaeez" sourceRef="Activity_0ouov98" targetRef="Activity_00t4mmi" />
<bpmn:scriptTask id="Activity_1q02wiz" name="Create a slice profile instance " scriptFormat="groovy">
- <bpmn:incoming>Flow_0ccqmju</bpmn:incoming>
+ <bpmn:incoming>Flow_1twqfsc</bpmn:incoming>
<bpmn:outgoing>Flow_1fdpbsx</bpmn:outgoing>
<bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
-def mcnssi= new ModifyCoreNSSI()
+def mcnssi= new DoModifyCoreNSSI()
mcnssi.createSliceProfileInstance(execution)</bpmn:script>
</bpmn:scriptTask>
- <bpmn:sequenceFlow id="Flow_0ccqmju" sourceRef="Activity_00t4mmi" targetRef="Activity_1q02wiz" />
<bpmn:scriptTask id="Activity_1josmor" name="Associate slice profile instance the same with the NSSI " scriptFormat="groovy">
<bpmn:incoming>Flow_1fdpbsx</bpmn:incoming>
<bpmn:outgoing>Flow_0l7hcnf</bpmn:outgoing>
<bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
-def mcnssi= new ModifyCoreNSSI()
+def mcnssi= new DoModifyCoreNSSI()
mcnssi.associateSliceProfileInstanceWithNSSI(execution)</bpmn:script>
</bpmn:scriptTask>
<bpmn:sequenceFlow id="Flow_1fdpbsx" sourceRef="Activity_1q02wiz" targetRef="Activity_1josmor" />
- <bpmn:scriptTask id="Activity_0j4c22q" name="Calculate S-NSSAI" scriptFormat="groovy">
- <bpmn:incoming>Flow_11vf6ik</bpmn:incoming>
- <bpmn:outgoing>Flow_1oeokwy</bpmn:outgoing>
- <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
-def mcnssi= new DoModifyCoreNSSI()
- mcnssi.calculateSNSSAI(execution)</bpmn:script>
- </bpmn:scriptTask>
- <bpmn:sequenceFlow id="Flow_11vf6ik" sourceRef="Event_0m2jn7c" targetRef="Activity_0j4c22q" />
- <bpmn:scriptTask id="Activity_0c4wmiz" name="Invoke PUT Service Instance API" scriptFormat="groovy">
- <bpmn:incoming>Flow_1oeokwy</bpmn:incoming>
- <bpmn:outgoing>Flow_15fi92t</bpmn:outgoing>
- <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
-def mcnssi= new ModifyCoreNSSI()
- mcnssi.invokePUTServiceInstance(execution)</bpmn:script>
- </bpmn:scriptTask>
- <bpmn:sequenceFlow id="Flow_1oeokwy" sourceRef="Activity_0j4c22q" targetRef="Activity_0c4wmiz" />
+ <bpmn:sequenceFlow id="Flow_11vf6ik" sourceRef="Event_0m2jn7c" targetRef="Activity_1iegufd" />
<bpmn:scriptTask id="Activity_1iegufd" name="Remove the NSSI to slice instance association " scriptFormat="groovy">
- <bpmn:incoming>Flow_15fi92t</bpmn:incoming>
+ <bpmn:incoming>Flow_11vf6ik</bpmn:incoming>
<bpmn:outgoing>Flow_1wtv1zj</bpmn:outgoing>
<bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
-def mcnssi= new ModifyCoreNSSI()
+def mcnssi= new DoModifyCoreNSSI()
mcnssi.removeSPAssociationWithNSSI(execution)</bpmn:script>
</bpmn:scriptTask>
- <bpmn:sequenceFlow id="Flow_15fi92t" sourceRef="Activity_0c4wmiz" targetRef="Activity_1iegufd" />
<bpmn:scriptTask id="Activity_010nkjp" name="Delete the slice profile instance " scriptFormat="groovy">
<bpmn:incoming>Flow_1wtv1zj</bpmn:incoming>
<bpmn:outgoing>Flow_0lrenyo</bpmn:outgoing>
<bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
-def mcnssi= new ModifyCoreNSSI()
+def mcnssi= new DoModifyCoreNSSI()
mcnssi.deleteSliceProfileInstance(execution)</bpmn:script>
</bpmn:scriptTask>
<bpmn:sequenceFlow id="Flow_1wtv1zj" sourceRef="Activity_1iegufd" targetRef="Activity_010nkjp" />
@@ -140,90 +107,223 @@ def mcnssi= new ModifyCoreNSSI()
</bpmn:scriptTask>
<bpmn:sequenceFlow id="Flow_0e007rx" sourceRef="Event_0fbqt56" targetRef="Activity_0klj7y1" />
<bpmn:sequenceFlow id="Flow_06j2avj" sourceRef="Activity_0klj7y1" targetRef="Activity_0tf735w" />
+ <bpmn:subProcess id="Activity_1u4xfuz" name="Sub-process for FalloutHandler and Rollback" triggeredByEvent="true">
+ <bpmn:startEvent id="Event_0xhp6c7">
+ <bpmn:outgoing>Flow_1i9kph3</bpmn:outgoing>
+ <bpmn:errorEventDefinition id="ErrorEventDefinition_0auvylm" />
+ </bpmn:startEvent>
+ <bpmn:endEvent id="Event_05xctbx">
+ <bpmn:incoming>Flow_00tfsrn</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:scriptTask id="Activity_0opij79" name="Handle Unexpected Error" scriptFormat="groovy">
+ <bpmn:incoming>Flow_07ftouz</bpmn:incoming>
+ <bpmn:outgoing>Flow_00tfsrn</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.common.scripts.*
+ExceptionUtil ex = new ExceptionUtil()
+ex.processJavaException(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:scriptTask id="Activity_099prfj" name="Prepare Resource Operation Status Update" scriptFormat="groovy">
+ <bpmn:incoming>Flow_1i9kph3</bpmn:incoming>
+ <bpmn:outgoing>Flow_14kgrjc</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def mcnssi = new DoModifyCoreNSSI()
+mcnssi.prepareFailedOperationStatusUpdate(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:serviceTask id="Activity_1feavwd" name="Update Resource Operation Status">
+ <bpmn:extensionElements>
+ <camunda:connector>
+ <camunda:inputOutput>
+ <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter>
+ <camunda:inputParameter name="headers">
+ <camunda:map>
+ <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+ <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry>
+ </camunda:map>
+ </camunda:inputParameter>
+ <camunda:inputParameter name="payload">${updateResourceOperationStatus}</camunda:inputParameter>
+ <camunda:inputParameter name="method">POST</camunda:inputParameter>
+ <camunda:outputParameter name="NSSMF_dbResponseCode">${statusCode}</camunda:outputParameter>
+ <camunda:outputParameter name="NSSMF_dbResponse">${response}</camunda:outputParameter>
+ </camunda:inputOutput>
+ <camunda:connectorId>http-connector</camunda:connectorId>
+ </camunda:connector>
+ </bpmn:extensionElements>
+ <bpmn:incoming>Flow_14kgrjc</bpmn:incoming>
+ <bpmn:outgoing>Flow_07ftouz</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="Flow_07ftouz" sourceRef="Activity_1feavwd" targetRef="Activity_0opij79" />
+ <bpmn:sequenceFlow id="Flow_14kgrjc" sourceRef="Activity_099prfj" targetRef="Activity_1feavwd" />
+ <bpmn:sequenceFlow id="Flow_1i9kph3" sourceRef="Event_0xhp6c7" targetRef="Activity_099prfj" />
+ <bpmn:sequenceFlow id="Flow_00tfsrn" sourceRef="Activity_0opij79" targetRef="Event_05xctbx" />
+ </bpmn:subProcess>
+ <bpmn:serviceTask id="Activity_0d1kk7f" name="Update Resource Operation Status">
+ <bpmn:extensionElements>
+ <camunda:connector>
+ <camunda:inputOutput>
+ <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter>
+ <camunda:inputParameter name="headers">
+ <camunda:map>
+ <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+ <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry>
+ </camunda:map>
+ </camunda:inputParameter>
+ <camunda:inputParameter name="payload">${updateResourceOperationStatus}</camunda:inputParameter>
+ <camunda:inputParameter name="method">POST</camunda:inputParameter>
+ <camunda:outputParameter name="NSSMF_dbResponseCode">${statusCode}</camunda:outputParameter>
+ <camunda:outputParameter name="NSSMF_dbResponse">${response}</camunda:outputParameter>
+ </camunda:inputOutput>
+ <camunda:connectorId>http-connector</camunda:connectorId>
+ </camunda:connector>
+ </bpmn:extensionElements>
+ <bpmn:incoming>Flow_0yq24um</bpmn:incoming>
+ <bpmn:outgoing>Flow_1yphs5r</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="Flow_1yphs5r" sourceRef="Activity_0d1kk7f" targetRef="Event_1p0mogo" />
+ <bpmn:scriptTask id="Activity_0wdaul0" name="Calculate S-NSSAI" scriptFormat="groovy">
+ <bpmn:incoming>Flow_0s31teg</bpmn:incoming>
+ <bpmn:outgoing>Flow_0fj4doc</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def mcnssi= new DoModifyCoreNSSI()
+ mcnssi.calculateSNSSAI(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="Flow_0fj4doc" sourceRef="Activity_0wdaul0" targetRef="Activity_0rvt126" />
+ <bpmn:scriptTask id="Activity_0rvt126" name="Invoke PUT Service Instance API" scriptFormat="groovy">
+ <bpmn:incoming>Flow_0fj4doc</bpmn:incoming>
+ <bpmn:outgoing>Flow_1y0m22h</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def mcnssi= new DoModifyCoreNSSI()
+ mcnssi.invokePUTServiceInstance(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="Flow_1y0m22h" sourceRef="Activity_0rvt126" targetRef="Activity_1gojm1c" />
+ <bpmn:scriptTask id="Activity_1gojm1c" name="Call Get PUT Service Instance Progress" scriptFormat="groovy">
+ <bpmn:incoming>Flow_1y0m22h</bpmn:incoming>
+ <bpmn:incoming>Flow_1jm7045</bpmn:incoming>
+ <bpmn:outgoing>Flow_0nxwq7b</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def mcnssi= new DoModifyCoreNSSI()
+mcnssi.getPUTServiceInstanceProgress(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:exclusiveGateway id="Gateway_13w96z9" name="Status = processing" default="Flow_1hm2xps">
+ <bpmn:incoming>Flow_0nxwq7b</bpmn:incoming>
+ <bpmn:outgoing>Flow_1hm2xps</bpmn:outgoing>
+ <bpmn:outgoing>Flow_06or8oz</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:sequenceFlow id="Flow_0nxwq7b" sourceRef="Activity_1gojm1c" targetRef="Gateway_13w96z9" />
+ <bpmn:sequenceFlow id="Flow_1hm2xps" name="No" sourceRef="Gateway_13w96z9" targetRef="Gateway_1hadnun" />
+ <bpmn:scriptTask id="Activity_15kjs2a" name="Time Delay" scriptFormat="groovy">
+ <bpmn:incoming>Flow_06or8oz</bpmn:incoming>
+ <bpmn:outgoing>Flow_1jm7045</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def mcnssi= new DoModifyCoreNSSI()
+mcnssi.timeDelay(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="Flow_1jm7045" sourceRef="Activity_15kjs2a" targetRef="Activity_1gojm1c" />
+ <bpmn:sequenceFlow id="Flow_06or8oz" name="Yes" sourceRef="Gateway_13w96z9" targetRef="Activity_15kjs2a">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("putStatus" ) == "processing" )}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="Flow_1twqfsc" sourceRef="Event_0z9mer1" targetRef="Activity_1q02wiz" />
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1nmtzzp">
<bpmndi:BPMNEdge id="Flow_06j2avj_di" bpmnElement="Flow_06j2avj">
- <di:waypoint x="380" y="150" />
- <di:waypoint x="440" y="150" />
+ <di:waypoint x="360" y="150" />
+ <di:waypoint x="400" y="150" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_0e007rx_di" bpmnElement="Flow_0e007rx">
<di:waypoint x="218" y="150" />
- <di:waypoint x="280" y="150" />
+ <di:waypoint x="260" y="150" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_0lrenyo_di" bpmnElement="Flow_0lrenyo">
- <di:waypoint x="890" y="600" />
- <di:waypoint x="930" y="600" />
- <di:waypoint x="930" y="540" />
- <di:waypoint x="970" y="540" />
+ <di:waypoint x="540" y="570" />
+ <di:waypoint x="540" y="530" />
+ <di:waypoint x="660" y="530" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_0l7hcnf_di" bpmnElement="Flow_0l7hcnf">
- <di:waypoint x="890" y="430" />
- <di:waypoint x="930" y="430" />
- <di:waypoint x="930" y="500" />
- <di:waypoint x="970" y="500" />
+ <di:waypoint x="530" y="470" />
+ <di:waypoint x="530" y="490" />
+ <di:waypoint x="660" y="490" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_1wtv1zj_di" bpmnElement="Flow_1wtv1zj">
- <di:waypoint x="730" y="600" />
- <di:waypoint x="790" y="600" />
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="Flow_15fi92t_di" bpmnElement="Flow_15fi92t">
- <di:waypoint x="560" y="600" />
- <di:waypoint x="630" y="600" />
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="Flow_1oeokwy_di" bpmnElement="Flow_1oeokwy">
- <di:waypoint x="380" y="600" />
- <di:waypoint x="460" y="600" />
+ <di:waypoint x="430" y="610" />
+ <di:waypoint x="490" y="610" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_11vf6ik_di" bpmnElement="Flow_11vf6ik">
- <di:waypoint x="218" y="600" />
- <di:waypoint x="280" y="600" />
+ <di:waypoint x="248" y="610" />
+ <di:waypoint x="330" y="610" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_1fdpbsx_di" bpmnElement="Flow_1fdpbsx">
- <di:waypoint x="730" y="430" />
- <di:waypoint x="790" y="430" />
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="Flow_0ccqmju_di" bpmnElement="Flow_0ccqmju">
- <di:waypoint x="560" y="430" />
- <di:waypoint x="630" y="430" />
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="Flow_1nxaeez_di" bpmnElement="Flow_1nxaeez">
- <di:waypoint x="390" y="430" />
- <di:waypoint x="460" y="430" />
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="Flow_1xysykm_di" bpmnElement="Flow_1xysykm">
- <di:waypoint x="218" y="430" />
- <di:waypoint x="290" y="430" />
+ <di:waypoint x="430" y="430" />
+ <di:waypoint x="480" y="430" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_0yq24um_di" bpmnElement="Flow_0yq24um">
- <di:waypoint x="1070" y="520" />
- <di:waypoint x="1132" y="520" />
+ <di:waypoint x="760" y="510" />
+ <di:waypoint x="820" y="510" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_03gf14v_di" bpmnElement="Flow_03gf14v">
- <di:waypoint x="1010" y="175" />
- <di:waypoint x="1010" y="252" />
+ <di:waypoint x="1430" y="235" />
+ <di:waypoint x="1430" y="282" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1019" y="190" width="13" height="14" />
+ <dc:Bounds x="1439" y="254" width="13" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_1pls2hu_di" bpmnElement="Flow_1pls2hu">
- <di:waypoint x="1035" y="150" />
- <di:waypoint x="1132" y="150" />
+ <di:waypoint x="1455" y="210" />
+ <di:waypoint x="1622" y="210" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1049" y="132" width="17" height="14" />
+ <dc:Bounds x="1458" y="182" width="17" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_0s31teg_di" bpmnElement="Flow_0s31teg">
- <di:waypoint x="910" y="150" />
- <di:waypoint x="985" y="150" />
+ <di:waypoint x="780" y="150" />
+ <di:waypoint x="810" y="150" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_184tfp7_di" bpmnElement="Flow_184tfp7">
- <di:waypoint x="720" y="150" />
- <di:waypoint x="810" y="150" />
+ <di:waypoint x="640" y="150" />
+ <di:waypoint x="680" y="150" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_1mqjtfk_di" bpmnElement="Flow_1mqjtfk">
+ <di:waypoint x="500" y="150" />
<di:waypoint x="540" y="150" />
- <di:waypoint x="620" y="150" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_1yphs5r_di" bpmnElement="Flow_1yphs5r">
+ <di:waypoint x="920" y="510" />
+ <di:waypoint x="962" y="510" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_0fj4doc_di" bpmnElement="Flow_0fj4doc">
+ <di:waypoint x="910" y="150" />
+ <di:waypoint x="940" y="150" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_1y0m22h_di" bpmnElement="Flow_1y0m22h">
+ <di:waypoint x="1040" y="150" />
+ <di:waypoint x="1070" y="150" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_0nxwq7b_di" bpmnElement="Flow_0nxwq7b">
+ <di:waypoint x="1170" y="150" />
+ <di:waypoint x="1215" y="150" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_1hm2xps_di" bpmnElement="Flow_1hm2xps">
+ <di:waypoint x="1265" y="150" />
+ <di:waypoint x="1430" y="150" />
+ <di:waypoint x="1430" y="185" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1273" y="130" width="15" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_1jm7045_di" bpmnElement="Flow_1jm7045">
+ <di:waypoint x="1120" y="240" />
+ <di:waypoint x="1120" y="190" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_06or8oz_di" bpmnElement="Flow_06or8oz">
+ <di:waypoint x="1240" y="175" />
+ <di:waypoint x="1240" y="280" />
+ <di:waypoint x="1170" y="280" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1246" y="225" width="18" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_1twqfsc_di" bpmnElement="Flow_1twqfsc">
+ <di:waypoint x="248" y="430" />
+ <di:waypoint x="330" y="430" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="Event_0fbqt56_di" bpmnElement="Event_0fbqt56">
<dc:Bounds x="182" y="132" width="36" height="36" />
@@ -231,80 +331,123 @@ def mcnssi= new ModifyCoreNSSI()
<dc:Bounds x="158" y="175" width="89" height="27" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_0klj7y1_di" bpmnElement="Activity_0klj7y1">
+ <dc:Bounds x="260" y="110" width="100" height="80" />
+ </bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_0tf735w_di" bpmnElement="Activity_0tf735w">
- <dc:Bounds x="440" y="110" width="100" height="80" />
+ <dc:Bounds x="400" y="110" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_1ce41n6_di" bpmnElement="Activity_1ce41n6">
- <dc:Bounds x="620" y="110" width="100" height="80" />
+ <dc:Bounds x="540" y="110" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_02skgkj_di" bpmnElement="Activity_02skgkj">
+ <dc:Bounds x="680" y="110" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_0wdaul0_di" bpmnElement="Activity_0wdaul0">
<dc:Bounds x="810" y="110" width="100" height="80" />
</bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="Gateway_1hadnun_di" bpmnElement="Gateway_1hadnun" isMarkerVisible="true">
- <dc:Bounds x="985" y="125" width="50" height="50" />
+ <bpmndi:BPMNShape id="Activity_0rvt126_di" bpmnElement="Activity_0rvt126">
+ <dc:Bounds x="940" y="110" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_1gojm1c_di" bpmnElement="Activity_1gojm1c">
+ <dc:Bounds x="1070" y="110" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Gateway_13w96z9_di" bpmnElement="Gateway_13w96z9" isMarkerVisible="true">
+ <dc:Bounds x="1215" y="125" width="50" height="50" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="974" y="86" width="75" height="40" />
+ <dc:Bounds x="1213" y="87" width="54" height="27" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_1243wg1_di" bpmnElement="Event_1243wg1">
- <dc:Bounds x="1132" y="132" width="36" height="36" />
+ <dc:Bounds x="1622" y="192" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1113" y="173" width="90" height="40" />
+ <dc:Bounds x="1603" y="233" width="90" height="40" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="Event_1gjhrcq_di" bpmnElement="Event_1gjhrcq">
- <dc:Bounds x="992" y="252" width="36" height="36" />
+ <bpmndi:BPMNShape id="Gateway_1hadnun_di" bpmnElement="Gateway_1hadnun" isMarkerVisible="true">
+ <dc:Bounds x="1405" y="185" width="50" height="50" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="973" y="293" width="90" height="40" />
+ <dc:Bounds x="1305" y="190" width="90" height="40" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="Activity_0oph5am_di" bpmnElement="Activity_0oph5am">
- <dc:Bounds x="970" y="480" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="Event_1p0mogo_di" bpmnElement="Event_1p0mogo">
- <dc:Bounds x="1132" y="502" width="36" height="36" />
+ <bpmndi:BPMNShape id="Event_1gjhrcq_di" bpmnElement="Event_1gjhrcq">
+ <dc:Bounds x="1412" y="282" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1140" y="478" width="20" height="14" />
+ <dc:Bounds x="1393" y="323" width="90" height="40" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_15kjs2a_di" bpmnElement="Activity_15kjs2a">
+ <dc:Bounds x="1070" y="240" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_1q02wiz_di" bpmnElement="Activity_1q02wiz">
+ <dc:Bounds x="330" y="390" width="100" height="80" />
+ </bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_0z9mer1_di" bpmnElement="Event_0z9mer1">
- <dc:Bounds x="182" y="412" width="36" height="36" />
+ <dc:Bounds x="212" y="412" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="162" y="455" width="90" height="40" />
+ <dc:Bounds x="192" y="455" width="90" height="40" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_0oph5am_di" bpmnElement="Activity_0oph5am">
+ <dc:Bounds x="660" y="470" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_1iegufd_di" bpmnElement="Activity_1iegufd">
+ <dc:Bounds x="330" y="570" width="100" height="80" />
+ </bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_0m2jn7c_di" bpmnElement="Event_0m2jn7c">
- <dc:Bounds x="182" y="582" width="36" height="36" />
+ <dc:Bounds x="212" y="592" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="155" y="625" width="90" height="40" />
+ <dc:Bounds x="185" y="635" width="90" height="40" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="Activity_0ouov98_di" bpmnElement="Activity_0ouov98">
- <dc:Bounds x="290" y="390" width="100" height="80" />
+ <bpmndi:BPMNShape id="Activity_010nkjp_di" bpmnElement="Activity_010nkjp">
+ <dc:Bounds x="490" y="570" width="100" height="80" />
</bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="Activity_00t4mmi_di" bpmnElement="Activity_00t4mmi">
- <dc:Bounds x="460" y="390" width="100" height="80" />
+ <bpmndi:BPMNShape id="Activity_1josmor_di" bpmnElement="Activity_1josmor">
+ <dc:Bounds x="480" y="390" width="100" height="80" />
</bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="Activity_1q02wiz_di" bpmnElement="Activity_1q02wiz">
- <dc:Bounds x="630" y="390" width="100" height="80" />
+ <bpmndi:BPMNShape id="Activity_0d1kk7f_di" bpmnElement="Activity_0d1kk7f">
+ <dc:Bounds x="820" y="470" width="100" height="80" />
</bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="Activity_1josmor_di" bpmnElement="Activity_1josmor">
- <dc:Bounds x="790" y="390" width="100" height="80" />
+ <bpmndi:BPMNShape id="Event_1p0mogo_di" bpmnElement="Event_1p0mogo">
+ <dc:Bounds x="962" y="492" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="970" y="538" width="20" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_1u4xfuz_di" bpmnElement="Activity_1u4xfuz" isExpanded="true">
+ <dc:Bounds x="190" y="790" width="781" height="196" />
</bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="Activity_0j4c22q_di" bpmnElement="Activity_0j4c22q">
- <dc:Bounds x="280" y="560" width="100" height="80" />
+ <bpmndi:BPMNEdge id="Flow_07ftouz_di" bpmnElement="Flow_07ftouz">
+ <di:waypoint x="580" y="894" />
+ <di:waypoint x="650" y="894" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_14kgrjc_di" bpmnElement="Flow_14kgrjc">
+ <di:waypoint x="420" y="894" />
+ <di:waypoint x="480" y="894" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_1i9kph3_di" bpmnElement="Flow_1i9kph3">
+ <di:waypoint x="256" y="894" />
+ <di:waypoint x="320" y="894" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_00tfsrn_di" bpmnElement="Flow_00tfsrn">
+ <di:waypoint x="750" y="894" />
+ <di:waypoint x="858" y="894" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="Event_0xhp6c7_di" bpmnElement="Event_0xhp6c7">
+ <dc:Bounds x="220" y="876" width="36" height="36" />
</bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="Activity_0c4wmiz_di" bpmnElement="Activity_0c4wmiz">
- <dc:Bounds x="460" y="560" width="100" height="80" />
+ <bpmndi:BPMNShape id="Event_05xctbx_di" bpmnElement="Event_05xctbx">
+ <dc:Bounds x="858" y="876" width="36" height="36" />
</bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="Activity_1iegufd_di" bpmnElement="Activity_1iegufd">
- <dc:Bounds x="630" y="560" width="100" height="80" />
+ <bpmndi:BPMNShape id="Activity_0opij79_di" bpmnElement="Activity_0opij79">
+ <dc:Bounds x="650" y="854" width="100" height="80" />
</bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="Activity_010nkjp_di" bpmnElement="Activity_010nkjp">
- <dc:Bounds x="790" y="560" width="100" height="80" />
+ <bpmndi:BPMNShape id="Activity_099prfj_di" bpmnElement="Activity_099prfj">
+ <dc:Bounds x="320" y="854" width="100" height="80" />
</bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="Activity_0klj7y1_di" bpmnElement="Activity_0klj7y1">
- <dc:Bounds x="280" y="110" width="100" height="80" />
+ <bpmndi:BPMNShape id="Activity_1feavwd_di" bpmnElement="Activity_1feavwd">
+ <dc:Bounds x="480" y="854" width="100" height="80" />
</bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
index 5425b2a725..f0898ace81 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
@@ -75,6 +75,7 @@ public class WorkflowActionBBTasks {
private static final String COMPLETED = "completed";
private static final String HANDLINGCODE = "handlingCode";
private static final String ROLLBACKTOCREATED = "RollbackToCreated";
+ private static final String ROLLBACKTOCREATEDNOCONFIGURATION = "RollbackToCreatedNoConfiguration";
private static final String REPLACEINSTANCE = "replaceInstance";
private static final String VFMODULE = "VfModule";
protected String maxRetries = "mso.rainyDay.maxRetries";
@@ -334,14 +335,19 @@ public class WorkflowActionBBTasks {
String handlingCode = (String) execution.getVariable(HANDLINGCODE);
List<ExecuteBuildingBlock> rollbackFlowsFiltered = new ArrayList<>(rollbackFlows);
- if ("RollbackToAssigned".equals(handlingCode) || ROLLBACKTOCREATED.equals(handlingCode)) {
+ if ("RollbackToAssigned".equals(handlingCode) || ROLLBACKTOCREATED.equals(handlingCode)
+ || ROLLBACKTOCREATEDNOCONFIGURATION.equals(handlingCode)) {
for (ExecuteBuildingBlock rollbackFlow : rollbackFlows) {
if (rollbackFlow.getBuildingBlock().getBpmnFlowName().contains("Unassign")
&& !rollbackFlow.getBuildingBlock().getBpmnFlowName().contains("FabricConfiguration")) {
rollbackFlowsFiltered.remove(rollbackFlow);
} else if (rollbackFlow.getBuildingBlock().getBpmnFlowName().contains("Delete")
- && !rollbackFlow.getBuildingBlock().getBpmnFlowName().contains("FabricConfiguration")
- && ROLLBACKTOCREATED.equals(handlingCode)) {
+ && ((!rollbackFlow.getBuildingBlock().getBpmnFlowName().contains("FabricConfiguration")
+ && (ROLLBACKTOCREATED.equals(handlingCode)
+ || ROLLBACKTOCREATEDNOCONFIGURATION.equals(handlingCode)))
+ || (rollbackFlow.getBuildingBlock().getBpmnFlowName()
+ .contains("FabricConfiguration")
+ && ROLLBACKTOCREATEDNOCONFIGURATION.equals(handlingCode)))) {
rollbackFlowsFiltered.remove(rollbackFlow);
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListener.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListener.java
index 682a0471ee..2119ced951 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListener.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListener.java
@@ -29,6 +29,7 @@ import org.onap.so.bpmn.common.BBConstants;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.common.listener.flowmanipulator.FlowManipulator;
import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
+import org.onap.so.db.catalog.beans.PnfResourceCustomization;
import org.onap.so.db.catalog.beans.VfModuleCustomization;
import org.onap.so.db.catalog.beans.VnfResourceCustomization;
import org.onap.so.db.catalog.client.CatalogDbClient;
@@ -48,6 +49,9 @@ public class SkipCDSBuildingBlockListener implements FlowManipulator {
private Set<String> vFModuleAction =
new HashSet<String>(Arrays.asList("VfModuleConfigAssign", "VfModuleConfigDeploy"));
+ private Set<String> pnfActions =
+ new HashSet<>(Arrays.asList("config-assign", "config-deploy", "PnfConfigAssign", "PnfConfigDeploy"));
+
@Override
public boolean shouldRunFor(String currentBBName, boolean isFirst, BuildingBlockExecution execution) {
@@ -95,9 +99,17 @@ public class SkipCDSBuildingBlockListener implements FlowManipulator {
boolean skipVfModule = vfc.isSkipPostInstConf();
currentSequenceSkipCheck(execution, skipVfModule);
}
- }
+ } else if (currentBB.getBuildingBlock().getBpmnScope().equalsIgnoreCase("PNF")
+ && containsIgnoreCaseAction(currentBB, pnfActions)) {
+ PnfResourceCustomization pnfResourceCustomization =
+ catalogDbClient.getPnfResourceCustomizationByModelCustomizationUUID(customizationUUID);
+ if (null != pnfResourceCustomization) {
+ boolean skipConfigPNF = pnfResourceCustomization.isSkipPostInstConf();
+ currentSequenceSkipCheck(execution, skipConfigPNF);
+ }
+ }
}
private boolean containsIgnoreCaseAction(ExecuteBuildingBlock currentBB, Set<String> actions) {
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java
index a7ee89f073..3290bb3dce 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java
@@ -436,6 +436,40 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest {
}
@Test
+ public void rollbackExecutionRollbackToCreatedNoConfigurationWithFabricTest() {
+ execution.setVariable("isRollback", false);
+ execution.setVariable("handlingCode", "RollbackToCreatedNoConfiguration");
+ execution.setVariable("requestAction", EMPTY_STRING);
+ execution.setVariable("resourceName", EMPTY_STRING);
+ List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>();
+
+ BuildingBlock buildingBlock1 = new BuildingBlock().setBpmnFlowName("AssignVfModuleBB");
+ ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock1);
+ flowsToExecute.add(ebb1);
+
+ BuildingBlock buildingBlock2 = new BuildingBlock().setBpmnFlowName("CreateVfModuleBB");
+ ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock2);
+ flowsToExecute.add(ebb2);
+
+ BuildingBlock buildingBlock3 = new BuildingBlock().setBpmnFlowName("ActivateVfModuleBB");
+ ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock3);
+ flowsToExecute.add(ebb3);
+
+ BuildingBlock buildingBlock4 = new BuildingBlock().setBpmnFlowName("AddFabricConfigurationBB");
+ ExecuteBuildingBlock ebb4 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock4);
+ flowsToExecute.add(ebb4);
+
+ execution.setVariable("flowsToExecute", flowsToExecute);
+ execution.setVariable("gCurrentSequence", 4);
+
+ workflowActionBBTasks.rollbackExecutionPath(execution);
+ List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
+ assertEquals(0, execution.getVariable("gCurrentSequence"));
+ assertEquals(1, ebbs.size());
+ assertEquals("DeactivateVfModuleBB", ebbs.get(0).getBuildingBlock().getBpmnFlowName());
+ }
+
+ @Test
public void rollbackExecutionRollbackToCreatedTest() {
execution.setVariable("isRollback", false);
execution.setVariable("handlingCode", "RollbackToCreated");
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListenerTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListenerTest.java
index fb162f857b..fdf4d36c89 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListenerTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListenerTest.java
@@ -36,6 +36,7 @@ import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.common.DelegateExecutionImpl;
import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
+import org.onap.so.db.catalog.beans.PnfResourceCustomization;
import org.onap.so.db.catalog.beans.VfModuleCustomization;
import org.onap.so.db.catalog.beans.VnfResourceCustomization;
import org.onap.so.db.catalog.client.CatalogDbClient;
@@ -47,9 +48,11 @@ public class SkipCDSBuildingBlockListenerTest {
private static final String VNF_SCOPE = "VNF";
private static final String VF_SCOPE = "VFModule";
+ private static final String PNF_SCOPE = "pnf";
private static final String TEST_MODELUUID = "123456789";
private static final String VNF_TEST_ACTION = "VnfConfigAssign";
private static final String VFModule_TEST_ACTION = "VfModuleConfigAssign";
+ private static final String PNFModule_TEST_ACTION = "config-assign";
private static final String MODELCUSTOMIZATIONUUID = "123456789";
private static final String BBNAME = "ControllerExecutionBB";
private static final boolean ISFIRST = true;
@@ -63,6 +66,7 @@ public class SkipCDSBuildingBlockListenerTest {
private BuildingBlockExecution buildingBlockExecution = new DelegateExecutionImpl(new DelegateExecutionFake());
private VnfResourceCustomization vnfCust = new VnfResourceCustomization();
private VfModuleCustomization vfCust = new VfModuleCustomization();
+ private PnfResourceCustomization pnfResourceCustomization = new PnfResourceCustomization();
private BuildingBlock buildingBlock = new BuildingBlock();
@InjectMocks
@@ -166,6 +170,44 @@ public class SkipCDSBuildingBlockListenerTest {
}
+ @Test
+ public void testProcessForPNFToSkipCDSBB() {
+ // given
+ setBuildingBlockAndCurrentSequence(PNF_SCOPE, PNFModule_TEST_ACTION, 0);
+ pnfResourceCustomization = getPnfResourceCustomization(true);
+
+ when(catalogDbClient
+ .getPnfResourceCustomizationByModelCustomizationUUID(executeBuildingBlock.getBuildingBlock().getKey()))
+ .thenReturn(pnfResourceCustomization);
+
+ // when
+ skipCDSBuildingBlockListener.run(flowsToExecute, executeBuildingBlock, buildingBlockExecution);
+
+ // then
+ actual = buildingBlockExecution.getVariable(BBConstants.G_CURRENT_SEQUENCE);
+ assertEquals(1, actual);
+
+ }
+
+ @Test
+ public void testProcessForPNFNotToSkipCDSBB() {
+ // given
+ setBuildingBlockAndCurrentSequence(PNF_SCOPE, PNFModule_TEST_ACTION, 0);
+ pnfResourceCustomization = getPnfResourceCustomization(false);
+
+ when(catalogDbClient
+ .getPnfResourceCustomizationByModelCustomizationUUID(executeBuildingBlock.getBuildingBlock().getKey()))
+ .thenReturn(pnfResourceCustomization);
+
+ // when
+ skipCDSBuildingBlockListener.run(flowsToExecute, executeBuildingBlock, buildingBlockExecution);
+
+ // then
+ actual = buildingBlockExecution.getVariable(BBConstants.G_CURRENT_SEQUENCE);
+ assertEquals(0, actual);
+
+ }
+
/**
* setting scope action in buildingBlock and BB current sequence in BuildingBlockExecution
*
@@ -199,4 +241,11 @@ public class SkipCDSBuildingBlockListenerTest {
return vfModuleCustomizations;
}
+ private PnfResourceCustomization getPnfResourceCustomization(boolean setSkippost) {
+ PnfResourceCustomization pnfResourceCustomization = new PnfResourceCustomization();
+ pnfResourceCustomization.setModelCustomizationUUID(MODELCUSTOMIZATIONUUID);
+ pnfResourceCustomization.setSkipPostInstConf(setSkippost);
+ return pnfResourceCustomization;
+ }
+
}
diff --git a/common/pom.xml b/common/pom.xml
index ff13da4ee6..74e51805ad 100644
--- a/common/pom.xml
+++ b/common/pom.xml
@@ -71,7 +71,6 @@
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-rs-client</artifactId>
- <version>${cxf.version}</version>
<scope>test</scope>
</dependency>
<dependency>
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/AllocateAnNssi.java b/common/src/main/java/org/onap/so/beans/nsmf/AllocateAnNssi.java
index 27c5cf8e26..dc8e69121e 100644
--- a/common/src/main/java/org/onap/so/beans/nsmf/AllocateAnNssi.java
+++ b/common/src/main/java/org/onap/so/beans/nsmf/AllocateAnNssi.java
@@ -22,14 +22,16 @@ package org.onap.so.beans.nsmf;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
+import java.io.Serializable;
import java.util.Map;
@JsonInclude(JsonInclude.Include.NON_NULL)
@Data
-public class AllocateAnNssi {
+public class AllocateAnNssi implements Serializable {
@Deprecated
public final static String URL = "/api/rest/provMns/v1/an/NSS" + "/SliceProfiles";
+ private static final long serialVersionUID = 4925129853421138442L;
private String nsstId;
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/AnPerfReq.java b/common/src/main/java/org/onap/so/beans/nsmf/AnPerfReq.java
index 418f8a5065..e2c2e999ec 100644
--- a/common/src/main/java/org/onap/so/beans/nsmf/AnPerfReq.java
+++ b/common/src/main/java/org/onap/so/beans/nsmf/AnPerfReq.java
@@ -21,9 +21,12 @@
package org.onap.so.beans.nsmf;
import com.fasterxml.jackson.annotation.JsonInclude;
+import java.io.Serializable;
@JsonInclude(JsonInclude.Include.NON_NULL)
-public class AnPerfReq {
+public class AnPerfReq implements Serializable {
+
+ private static final long serialVersionUID = -7415880702887244040L;
private PerfReqEmbb perfReqEmbb;
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/AnSliceProfile.java b/common/src/main/java/org/onap/so/beans/nsmf/AnSliceProfile.java
index e5eb3e0d21..eef0396205 100644
--- a/common/src/main/java/org/onap/so/beans/nsmf/AnSliceProfile.java
+++ b/common/src/main/java/org/onap/so/beans/nsmf/AnSliceProfile.java
@@ -24,12 +24,15 @@ import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import lombok.ToString;
+import java.io.Serializable;
import java.util.List;
@JsonInclude(JsonInclude.Include.NON_NULL)
@Data
@ToString
-public class AnSliceProfile {
+public class AnSliceProfile implements Serializable {
+
+ private static final long serialVersionUID = -3057342171549542794L;
@JsonProperty(value = "sliceProfileId", required = true)
private String sliceProfileId;
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/DeAllocateNssi.java b/common/src/main/java/org/onap/so/beans/nsmf/DeAllocateNssi.java
index 399d51e894..10aaf26413 100644
--- a/common/src/main/java/org/onap/so/beans/nsmf/DeAllocateNssi.java
+++ b/common/src/main/java/org/onap/so/beans/nsmf/DeAllocateNssi.java
@@ -21,12 +21,14 @@
package org.onap.so.beans.nsmf;
import com.fasterxml.jackson.annotation.JsonInclude;
+import java.io.Serializable;
import java.util.List;
@JsonInclude(JsonInclude.Include.NON_NULL)
-public class DeAllocateNssi {
+public class DeAllocateNssi implements Serializable {
@Deprecated
public final static String URL = "/api/rest/provMns/v1/NSS" + "/SliceProfiles/%s";
+ private static final long serialVersionUID = 8198187346132154044L;
private String nsiId;
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/JobStatusResponse.java b/common/src/main/java/org/onap/so/beans/nsmf/JobStatusResponse.java
index 9259d51591..a0a9531c89 100644
--- a/common/src/main/java/org/onap/so/beans/nsmf/JobStatusResponse.java
+++ b/common/src/main/java/org/onap/so/beans/nsmf/JobStatusResponse.java
@@ -21,9 +21,12 @@
package org.onap.so.beans.nsmf;
import com.fasterxml.jackson.annotation.JsonInclude;
+import java.io.Serializable;
@JsonInclude(JsonInclude.Include.NON_NULL)
-public class JobStatusResponse {
+public class JobStatusResponse implements Serializable {
+
+ private static final long serialVersionUID = -2039407266985403172L;
private ResponseDescriptor responseDescriptor;
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/NsiInfo.java b/common/src/main/java/org/onap/so/beans/nsmf/NsiInfo.java
index d1679c6dfa..3219846ec7 100644
--- a/common/src/main/java/org/onap/so/beans/nsmf/NsiInfo.java
+++ b/common/src/main/java/org/onap/so/beans/nsmf/NsiInfo.java
@@ -21,9 +21,12 @@
package org.onap.so.beans.nsmf;
import com.fasterxml.jackson.annotation.JsonInclude;
+import java.io.Serializable;
@JsonInclude(JsonInclude.Include.NON_NULL)
-public class NsiInfo {
+public class NsiInfo implements Serializable {
+
+ private static final long serialVersionUID = -8432406430744875618L;
private String nsiName;
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/NssiResponse.java b/common/src/main/java/org/onap/so/beans/nsmf/NssiResponse.java
index 66368be6b8..92acdaa90d 100644
--- a/common/src/main/java/org/onap/so/beans/nsmf/NssiResponse.java
+++ b/common/src/main/java/org/onap/so/beans/nsmf/NssiResponse.java
@@ -21,9 +21,12 @@
package org.onap.so.beans.nsmf;
import com.fasterxml.jackson.annotation.JsonInclude;
+import java.io.Serializable;
@JsonInclude(JsonInclude.Include.NON_NULL)
-public class NssiResponse {
+public class NssiResponse implements Serializable {
+
+ private static final long serialVersionUID = 2723440188640857903L;
private String nssiId;
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/PerfReqEmbb.java b/common/src/main/java/org/onap/so/beans/nsmf/PerfReqEmbb.java
index bce0d56f9a..f6e945e368 100644
--- a/common/src/main/java/org/onap/so/beans/nsmf/PerfReqEmbb.java
+++ b/common/src/main/java/org/onap/so/beans/nsmf/PerfReqEmbb.java
@@ -21,9 +21,12 @@
package org.onap.so.beans.nsmf;
import com.fasterxml.jackson.annotation.JsonInclude;
+import java.io.Serializable;
@JsonInclude(JsonInclude.Include.NON_NULL)
-public class PerfReqEmbb {
+public class PerfReqEmbb implements Serializable {
+
+ private static final long serialVersionUID = 8886635511695277599L;
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
private int expDataRateDL;
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/PerfReqUrllc.java b/common/src/main/java/org/onap/so/beans/nsmf/PerfReqUrllc.java
index 0b05d39bab..9e4b4edce3 100644
--- a/common/src/main/java/org/onap/so/beans/nsmf/PerfReqUrllc.java
+++ b/common/src/main/java/org/onap/so/beans/nsmf/PerfReqUrllc.java
@@ -21,9 +21,12 @@
package org.onap.so.beans.nsmf;
import com.fasterxml.jackson.annotation.JsonInclude;
+import java.io.Serializable;
@JsonInclude(JsonInclude.Include.NON_NULL)
-public class PerfReqUrllc {
+public class PerfReqUrllc implements Serializable {
+
+ private static final long serialVersionUID = 3133479142915485943L;
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
private int e2eLatency;
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/ResponseDescriptor.java b/common/src/main/java/org/onap/so/beans/nsmf/ResponseDescriptor.java
index 146032c6fd..2456d540ce 100644
--- a/common/src/main/java/org/onap/so/beans/nsmf/ResponseDescriptor.java
+++ b/common/src/main/java/org/onap/so/beans/nsmf/ResponseDescriptor.java
@@ -22,11 +22,14 @@ package org.onap.so.beans.nsmf;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
+import java.io.Serializable;
import java.util.List;
@JsonInclude(JsonInclude.Include.NON_NULL)
@Data
-public class ResponseDescriptor {
+public class ResponseDescriptor implements Serializable {
+
+ private static final long serialVersionUID = 6330527958947215910L;
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
private int progress;
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/ServiceInfo.java b/common/src/main/java/org/onap/so/beans/nsmf/ServiceInfo.java
index 19e8b46314..f9848fca31 100644
--- a/common/src/main/java/org/onap/so/beans/nsmf/ServiceInfo.java
+++ b/common/src/main/java/org/onap/so/beans/nsmf/ServiceInfo.java
@@ -19,10 +19,11 @@
*/
package org.onap.so.beans.nsmf;
+import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
import java.io.Serializable;
-import java.util.List;
+@JsonInclude(JsonInclude.Include.NON_NULL)
@Data
public class ServiceInfo implements Serializable {
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/SliceTaskParamsAdapter.java b/common/src/main/java/org/onap/so/beans/nsmf/SliceTaskParamsAdapter.java
index dd73fdb76b..8ea0eb6587 100644
--- a/common/src/main/java/org/onap/so/beans/nsmf/SliceTaskParamsAdapter.java
+++ b/common/src/main/java/org/onap/so/beans/nsmf/SliceTaskParamsAdapter.java
@@ -27,6 +27,7 @@ import java.io.IOException;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.HashMap;
+import java.io.Serializable;
import java.util.Map;
@@ -35,7 +36,8 @@ import java.util.Map;
@AllArgsConstructor
@ToString
@Builder
-public class SliceTaskParamsAdapter {
+public class SliceTaskParamsAdapter implements Serializable {
+
private static final long serialVersionUID = -7785578865170503301L;
private String serviceId;
diff --git a/cxf-logging/pom.xml b/cxf-logging/pom.xml
index cb0d126283..64cea6c8b3 100644
--- a/cxf-logging/pom.xml
+++ b/cxf-logging/pom.xml
@@ -13,17 +13,14 @@
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-rs-client</artifactId>
- <version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-bindings-soap</artifactId>
- <version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
- <version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
diff --git a/graph-inventory/fluent-builder-maven-plugin/pom.xml b/graph-inventory/fluent-builder-maven-plugin/pom.xml
index 87f5138b4b..6e59d0d893 100644
--- a/graph-inventory/fluent-builder-maven-plugin/pom.xml
+++ b/graph-inventory/fluent-builder-maven-plugin/pom.xml
@@ -9,6 +9,36 @@
<artifactId>fluent-builder-maven-plugin</artifactId>
<packaging>maven-plugin</packaging>
<build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.m2e</groupId>
+ <artifactId>lifecycle-mapping</artifactId>
+ <version>1.0.0</version>
+ <configuration>
+ <lifecycleMappingMetadata>
+ <pluginExecutions>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-plugin-plugin</artifactId>
+ <goals>
+ <goal>descriptor</goal>
+ </goals>
+ <versionRange>[3.6.0,)</versionRange>
+ </pluginExecutionFilter>
+ <action>
+ <execute>
+ <runOnIncremental>false</runOnIncremental>
+ </execute>
+ </action>
+ </pluginExecution>
+ </pluginExecutions>
+ </lifecycleMappingMetadata>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java
index b09d676b57..7ed60384a5 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java
@@ -403,7 +403,7 @@ public class E2EServiceInstances {
msoRequest.createErrorRequestRecord(Status.FAILED, requestId,
"Exception while communciate with " + "Catalog DB", action, ModelType.service.name(), requestJSON,
- null);
+ null, null);
logger.debug(END_OF_THE_TRANSACTION + response.getEntity());
return response;
}
@@ -415,7 +415,7 @@ public class E2EServiceInstances {
ErrorNumbers.SVC_GENERAL_SERVICE_ERROR, null, version);
msoRequest.createErrorRequestRecord(Status.FAILED, requestId, "Recipe does not exist in catalog DB", action,
- ModelType.service.name(), requestJSON, null);
+ ModelType.service.name(), requestJSON, null, null);
logger.debug(END_OF_THE_TRANSACTION + response.getEntity());
return response;
}
@@ -493,7 +493,7 @@ public class E2EServiceInstances {
msoRequest.createErrorRequestRecord(Status.FAILED, requestId,
"Exception while communciate with " + "Catalog DB", action, ModelType.service.name(), requestJSON,
- null);
+ null, null);
logger.debug(END_OF_THE_TRANSACTION + response.getEntity());
return response;
}
@@ -505,7 +505,7 @@ public class E2EServiceInstances {
ErrorNumbers.SVC_GENERAL_SERVICE_ERROR, null, version);
msoRequest.createErrorRequestRecord(Status.FAILED, requestId, "Recipe does not exist in catalog DB", action,
- ModelType.service.name(), requestJSON, null);
+ ModelType.service.name(), requestJSON, null, null);
logger.debug(END_OF_THE_TRANSACTION + response.getEntity());
return response;
}
@@ -725,7 +725,7 @@ public class E2EServiceInstances {
msoRequest.createErrorRequestRecord(Status.FAILED, requestId,
"No communication to catalog DB " + e.getMessage(), action, ModelType.service.name(), requestJSON,
- null);
+ null, null);
logger.debug(END_OF_THE_TRANSACTION + response.getEntity());
return response;
}
@@ -737,7 +737,7 @@ public class E2EServiceInstances {
MsoException.ServiceException, "Recipe does not exist in catalog DB",
ErrorNumbers.SVC_GENERAL_SERVICE_ERROR, null, version);
msoRequest.createErrorRequestRecord(Status.FAILED, requestId, "No recipe found in DB", action,
- ModelType.service.name(), requestJSON, null);
+ ModelType.service.name(), requestJSON, null, null);
logger.debug(END_OF_THE_TRANSACTION + response.getEntity());
return response;
}
@@ -958,7 +958,7 @@ public class E2EServiceInstances {
ErrorNumbers.SVC_BAD_PARAMETER).cause(e).errorInfo(errorLoggerInfo).build();
msoRequest.createErrorRequestRecord(Status.FAILED, requestId, validateException.getMessage(), action,
- ModelType.service.name(), requestJSON, null);
+ ModelType.service.name(), requestJSON, null, null);
throw validateException;
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java
index bf76cd3174..64c42a0498 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java
@@ -451,7 +451,7 @@ public class MsoRequest {
}
public void createErrorRequestRecord(Status status, String requestId, String errorMessage, Actions action,
- String requestScope, String requestJSON, String serviceInstanceId) {
+ String requestScope, String requestJSON, String serviceInstanceId, ServiceInstancesRequest sir) {
try {
InfraActiveRequests request = new InfraActiveRequests(requestId);
Timestamp startTimeStamp = new Timestamp(System.currentTimeMillis());
@@ -469,6 +469,17 @@ public class MsoRequest {
Timestamp endTimeStamp = new Timestamp(System.currentTimeMillis());
request.setEndTime(endTimeStamp);
request.setRequestUrl(MDC.get(LogConstants.HTTP_URL));
+ if (sir != null) {
+ if (sir.getRequestDetails() != null && sir.getRequestDetails().getRequestInfo() != null) {
+ request.setRequestorId(sir.getRequestDetails().getRequestInfo().getRequestorId());
+ request.setSource(sir.getRequestDetails().getRequestInfo().getSource());
+ if (ModelType.service.name().equalsIgnoreCase(requestScope)) {
+ if (sir.getRequestDetails().getRequestInfo().getInstanceName() != null) {
+ request.setServiceInstanceName(sir.getRequestDetails().getRequestInfo().getInstanceName());
+ }
+ }
+ }
+ }
requestsDbClient.save(request);
} catch (Exception e) {
logger.error("Exception when updating record in DB", e);
@@ -476,7 +487,6 @@ public class MsoRequest {
}
}
-
public Response buildResponse(int httpResponseCode, String errorCode, InfraActiveRequests inProgress) {
return buildResponseWithError(httpResponseCode, errorCode, inProgress, null);
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java
index 60e9c3b30a..cddb1ada31 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java
@@ -326,7 +326,7 @@ public class RequestHandlerUtils extends AbstractRestHandler {
String requestScope = requestScopeFromUri(requestUri);
msoRequest.createErrorRequestRecord(Status.FAILED, requestId, validateException.getMessage(), action,
- requestScope, requestJSON, null);
+ requestScope, requestJSON, null, null);
throw validateException;
}
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 2c8e92633c..7924ca304a 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
@@ -830,7 +830,8 @@ public class ServiceInstances extends AbstractRestHandler {
} catch (ApiException e) {
msoRequest.createErrorRequestRecord(Status.FAILED, requestId, e.getMessage(), action, requestScope,
requestJSON, requestHandlerUtils
- .getServiceInstanceIdForValidationError(sir, instanceIdMap, requestScope).orElse(null));
+ .getServiceInstanceIdForValidationError(sir, instanceIdMap, requestScope).orElse(null),
+ sir);
throw e;
}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java
index 17b22ec216..9b42eacfc2 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java
@@ -29,6 +29,7 @@ import javax.annotation.PostConstruct;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriBuilder;
import org.apache.http.HttpStatus;
+import org.onap.logging.filter.spring.SpringClientPayloadFilter;
import org.onap.so.db.request.beans.ArchivedInfraRequests;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.beans.OperationStatus;
@@ -42,6 +43,7 @@ import org.onap.so.db.request.beans.WatchdogComponentDistributionStatus;
import org.onap.so.db.request.beans.WatchdogDistributionStatus;
import org.onap.so.db.request.beans.WatchdogServiceModVerIdLookup;
import org.onap.so.db.request.data.controller.InstanceNameDuplicateCheckRequest;
+import org.onap.so.logging.jaxrs.filter.SOSpringClientFilter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Primary;
@@ -297,17 +299,55 @@ public class RequestsDbClient {
restTemplate.exchange(uri, HttpMethod.PATCH, entity, String.class);
}
+ /**
+ * Required for groovy usage. Cannot use Spring Autowired variables
+ *
+ * @param requestId
+ * @param basicAuth
+ * @param host
+ * @return
+ */
public InfraActiveRequests getInfraActiveRequests(String requestId, String basicAuth, String host) {
+ RestTemplate template = new RestTemplate();
+ HttpHeaders headers = new HttpHeaders();
+ headers.set(HttpHeaders.AUTHORIZATION, basicAuth);
+ headers.set(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON);
+ headers.set(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON);
URI uri = getUri(host + "/infraActiveRequests/" + requestId);
-
- return getSingleResponse(uri, InfraActiveRequests.class);
+ try {
+ InfraActiveRequests infraActiveRequests = template
+ .exchange(uri, HttpMethod.GET, new HttpEntity<>(headers), InfraActiveRequests.class).getBody();
+ if (infraActiveRequests != null) {
+ infraActiveRequests.setRequestId(requestId);
+ }
+ return infraActiveRequests;
+ } catch (HttpClientErrorException e) {
+ if (HttpStatus.SC_NOT_FOUND == e.getStatusCode().value()) {
+ return null;
+ }
+ throw e;
+ }
}
+ /**
+ * Required for groovy usage. Cannot use Spring Autowired variables
+ *
+ * @param request
+ * @param basicAuth
+ * @param host
+ */
public void updateInfraActiveRequests(InfraActiveRequests request, String basicAuth, String host) {
+ RestTemplate template = new RestTemplate();
+ template.getInterceptors().add(new SOSpringClientFilter());
+ template.getInterceptors().add(new SpringClientPayloadFilter());
+ HttpHeaders headers = new HttpHeaders();
+ headers.set(HttpHeaders.AUTHORIZATION, basicAuth);
+ headers.set(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON);
+ headers.set(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON);
URI uri = getUri(host + "/infraActiveRequests/" + request.getRequestId());
- HttpEntity<InfraActiveRequests> entity = new HttpEntity<>(request, getHttpHeaders());
- restTemplate.put(uri, entity);
+ HttpEntity<InfraActiveRequests> entity = new HttpEntity<>(request, headers);
+ template.put(uri, entity);
}
protected URI getUri(String uri) {
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/PnfResourceCustomization.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/PnfResourceCustomization.java
index d26ce84505..2e4623d25d 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/PnfResourceCustomization.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/PnfResourceCustomization.java
@@ -83,7 +83,7 @@ public class PnfResourceCustomization implements Serializable {
private String blueprintVersion;
@Column(name = "SKIP_POST_INSTANTIATION_CONFIGURATION")
- private Boolean skipPostInstConf;
+ private boolean skipPostInstConf;
@Column(name = "CONTROLLER_ACTOR")
private String controllerActor;
@@ -219,11 +219,11 @@ public class PnfResourceCustomization implements Serializable {
this.blueprintVersion = blueprintVersion;
}
- public Boolean isSkipPostInstConf() {
+ public boolean isSkipPostInstConf() {
return skipPostInstConf;
}
- public void setSkipPostInstConf(Boolean skipPostInstConf) {
+ public void setSkipPostInstConf(boolean skipPostInstConf) {
this.skipPostInstConf = skipPostInstConf;
}
diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/beans/BeansTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/beans/BeansTest.java
index f710890883..b39a85fb92 100644
--- a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/beans/BeansTest.java
+++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/beans/BeansTest.java
@@ -67,10 +67,10 @@ public class BeansTest {
}
private void test(String pojoPackage) {
- Validator validator = ValidatorBuilder.create().with(new GetterMustExistRule()).with(new NoPrimitivesRule())
- .with(new NoNestedClassRule()).with(new NoStaticExceptFinalRule())
- .with(new SerializableMustHaveSerialVersionUIDRule()).with(new HasToStringRule())
- .with(new EqualsAndHashCodeTester()).with(new NoPublicFieldsExceptStaticFinalRule())
+ Validator validator = ValidatorBuilder.create().with(new GetterMustExistRule()).with(new NoNestedClassRule())
+ .with(new NoStaticExceptFinalRule()).with(new SerializableMustHaveSerialVersionUIDRule())
+ .with(new HasToStringRule()).with(new EqualsAndHashCodeTester())
+ .with(new NoPublicFieldsExceptStaticFinalRule())
.with(new CustomSetterMustExistRule()
.exclude(allOf(hasAnnotationPropertyWithValue(Column.class, "updatable", equalTo(false)),
hasAnnotation(GeneratedValue.class)), hasAnnotation(Temporal.class)))
diff --git a/packages/docker/src/main/docker/docker-files/Dockerfile.so-base-image b/packages/docker/src/main/docker/docker-files/Dockerfile.so-base-image
index db57688dc1..a1f4fc15ae 100644
--- a/packages/docker/src/main/docker/docker-files/Dockerfile.so-base-image
+++ b/packages/docker/src/main/docker/docker-files/Dockerfile.so-base-image
@@ -8,7 +8,12 @@ ENV http_proxy=$HTTP_PROXY
ENV https_proxy=$HTTPS_PROXY
# Install commonly needed tools
-RUN apk --no-cache add curl netcat-openbsd nss apache2-utils
+RUN apk --no-cache add curl netcat-openbsd nss apache2-utils java-cacerts
+
+# Create symlink for default Java truststore
+RUN set -eux; \
+ rm -rf "$JAVA_HOME/lib/security/cacerts"; \
+ ln -sT /etc/ssl/certs/java/cacerts "$JAVA_HOME/lib/security/cacerts"
# Create 'so' user
RUN addgroup -g 1000 so && adduser -S -u 1000 -G so -s /bin/sh so
diff --git a/pom.xml b/pom.xml
index 7151bb7246..f59702f05b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -962,8 +962,74 @@
<dependency>
<groupId>org.onap.aai.schema-service</groupId>
<artifactId>aai-schema</artifactId>
- <version>1.7.10-SNAPSHOT</version>
+ <version>1.7.10</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-rs-client</artifactId>
+ <version>${cxf.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.jboss.spec.javax.rmi</groupId>
+ <artifactId>jboss-rmi-api_1.0_spec</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-bindings-soap</artifactId>
+ <version>${cxf.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.jboss.spec.javax.rmi</groupId>
+ <artifactId>jboss-rmi-api_1.0_spec</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-transports-http</artifactId>
+ <version>${cxf.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.jboss.spec.javax.rmi</groupId>
+ <artifactId>jboss-rmi-api_1.0_spec</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-spring-boot-starter-jaxws</artifactId>
+ <version>${cxf.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.jboss.spec.javax.rmi</groupId>
+ <artifactId>jboss-rmi-api_1.0_spec</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-spring-boot-starter-jaxrs</artifactId>
+ <version>${cxf.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.jboss.spec.javax.rmi</groupId>
+ <artifactId>jboss-rmi-api_1.0_spec</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-rs-service-description-swagger</artifactId>
+ <version>${cxf.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.jboss.spec.javax.rmi</groupId>
+ <artifactId>jboss-rmi-api_1.0_spec</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
</dependencies>
</dependencyManagement>
<profiles>
diff --git a/so-etsi-nfvo/pom.xml b/so-etsi-nfvo/pom.xml
index fa85460086..6845896fc0 100644
--- a/so-etsi-nfvo/pom.xml
+++ b/so-etsi-nfvo/pom.xml
@@ -28,6 +28,7 @@
<jaxb-api>2.3.0</jaxb-api>
<snakeyaml-version>0.11</snakeyaml-version>
<hamcrest-version>2.2</hamcrest-version>
+ <equalsverifier-version>3.4.1</equalsverifier-version>
</properties>
<build>
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-api/pom.xml b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-api/pom.xml
index a541117c93..272ac0c11a 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-api/pom.xml
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-api/pom.xml
@@ -166,14 +166,8 @@
<version>${okhttp-version}</version>
</dependency>
<dependency>
- <groupId>com.squareup.okhttp</groupId>
- <artifactId>logging-interceptor</artifactId>
- <version>${okhttp-version}</version>
- </dependency>
- <dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
- <version>${jaxb-api}</version>
</dependency>
</dependencies>
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/pom.xml b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/pom.xml
index 1c13ecac25..3178b28502 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/pom.xml
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/pom.xml
@@ -102,5 +102,11 @@
<version>${hamcrest-version}</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>nl.jqno.equalsverifier</groupId>
+ <artifactId>equalsverifier</artifactId>
+ <version>${equalsverifier-version}</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
</project> \ No newline at end of file
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/CamundaVariableNameConstants.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/CamundaVariableNameConstants.java
index fd51b1a873..a7acc3ec25 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/CamundaVariableNameConstants.java
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/CamundaVariableNameConstants.java
@@ -32,8 +32,7 @@ public class CamundaVariableNameConstants {
public static final String SERVICE_TYPE_PARAM_NAME = "serviceType";
public static final String NS_PACKAGE_MODEL_PARAM_NAME = "NSPackageModel";
- public static final String CREATE_NS_WORKFLOW_PROCESSING_EXCEPTION_PARAM_NAME =
- "CreateNsWorkflowProcessingException";
+ public static final String NS_WORKFLOW_PROCESSING_EXCEPTION_PARAM_NAME = "NsWorkflowProcessingException";
public static final String CREATE_NS_RESPONSE_PARAM_NAME = "createNsResponse";
public static final String INSTANTIATE_NS_REQUEST_PARAM_NAME = "instantiateNsRequest";
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/Constants.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/Constants.java
index 14a4f4340b..c6c56c9eb3 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/Constants.java
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/Constants.java
@@ -30,6 +30,7 @@ public class Constants {
public static final String CREATE_NS_WORKFLOW_NAME = "CreateNs";
public static final String INSTANTIATE_NS_WORKFLOW_NAME = "InstantiateNs";
public static final String TERMINATE_NS_WORKFLOW_NAME = "TerminateNs";
+ public static final String DELETE_NS_WORKFLOW_NAME = "DeleteNs";
public static final String GET_NS_OCCURRENCE_OPERATION_STATUS_NAME = "GetNsOccurrenceOperationStatus";
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/exceptions/NsRequestProcessingException.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/exceptions/NsRequestProcessingException.java
index 0dcadfd4d8..0901f077d2 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/exceptions/NsRequestProcessingException.java
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/exceptions/NsRequestProcessingException.java
@@ -31,10 +31,11 @@ import org.springframework.web.bind.annotation.ResponseStatus;
public class NsRequestProcessingException extends RuntimeException {
private static final long serialVersionUID = 66862444537194516L;
- private InlineResponse400 problemDetails;
+ private final InlineResponse400 problemDetails;
public NsRequestProcessingException(final String message) {
super(message);
+ problemDetails = null;
}
public NsRequestProcessingException(final String message, final InlineResponse400 problemDetails) {
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/aai/AaiServiceProvider.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/aai/AaiServiceProvider.java
index 29ed85cbd8..a54a6f41f9 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/aai/AaiServiceProvider.java
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/aai/AaiServiceProvider.java
@@ -43,4 +43,5 @@ public interface AaiServiceProvider {
void deleteGenericVnf(final String vnfId);
+ void deleteServiceInstance(final String globalCustomerId, final String serviceType, final String serviceInstanceId);
}
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/aai/AaiServiceProviderImpl.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/aai/AaiServiceProviderImpl.java
index 0da53a09c2..a3b3fa9d66 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/aai/AaiServiceProviderImpl.java
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/aai/AaiServiceProviderImpl.java
@@ -22,7 +22,6 @@ package org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.extclients.aai;
import java.util.Optional;
import org.onap.aai.domain.yang.GenericVnf;
import org.onap.aai.domain.yang.ServiceInstance;
-import org.onap.aaiclient.client.aai.AAIObjectType;
import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
@@ -93,4 +92,15 @@ public class AaiServiceProviderImpl implements AaiServiceProvider {
AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId));
aaiClientProvider.getAaiClient().delete(aaiResourceUri);
}
+
+ @Override
+ public void deleteServiceInstance(final String globalCustomerId, final String serviceType,
+ final String serviceInstanceId) {
+ logger.info(
+ "Deleting Service Instance with \nGlobal Customer Id: {}, \nService Type: {}, and \nService Instance Id: {} \nfrom AAI.",
+ globalCustomerId, serviceType, serviceInstanceId);
+ final AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business()
+ .customer(globalCustomerId).serviceSubscription(serviceType).serviceInstance(serviceInstanceId));
+ aaiClientProvider.getAaiClient().delete(serviceInstanceUri);
+ }
}
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/etsicatalog/EtsiCatalogPackageManagementServiceProviderImpl.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/etsicatalog/EtsiCatalogPackageManagementServiceProviderImpl.java
index 75dd7107a7..749e85e3db 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/etsicatalog/EtsiCatalogPackageManagementServiceProviderImpl.java
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/etsicatalog/EtsiCatalogPackageManagementServiceProviderImpl.java
@@ -25,7 +25,7 @@ import org.onap.so.adapters.etsisol003adapter.pkgm.extclients.etsicatalog.model.
import org.onap.so.adapters.etsisol003adapter.pkgm.extclients.etsicatalog.model.VnfPkgInfo;
import org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.exceptions.EtsiCatalogManagerRequestFailureException;
import org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.nsd.NetworkServiceDescriptor;
-import org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.nsd.NetworkServiceDescriptorParser;
+import org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.nsd.parser.NetworkServiceDescriptorParser;
import org.onap.so.rest.service.HttpRestServiceProvider;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -66,9 +66,8 @@ public class EtsiCatalogPackageManagementServiceProviderImpl implements EtsiCata
}
return Optional.empty();
} catch (final Exception restProcessingException) {
- logger.error("Caught exception while getting NS package model for: {}", nsdId, restProcessingException);
- throw new EtsiCatalogManagerRequestFailureException("Internal Server Error Occurred.",
- restProcessingException);
+ final String message = "Caught exception while getting NS package model for: " + nsdId;
+ throw new EtsiCatalogManagerRequestFailureException(message, restProcessingException);
}
}
@@ -82,9 +81,8 @@ public class EtsiCatalogPackageManagementServiceProviderImpl implements EtsiCata
}
return Optional.empty();
} catch (final Exception restProcessingException) {
- logger.error("Caught exception while getting VNF package model for: {}", vnfPkgId, restProcessingException);
- throw new EtsiCatalogManagerRequestFailureException("Internal Server Error Occurred.",
- restProcessingException);
+ final String message = "Caught exception while getting VNF package model for: " + vnfPkgId;
+ throw new EtsiCatalogManagerRequestFailureException(message, restProcessingException);
}
}
@@ -101,9 +99,8 @@ public class EtsiCatalogPackageManagementServiceProviderImpl implements EtsiCata
}
return Optional.empty();
} catch (final Exception restProcessingException) {
- logger.error("Caught exception while getting NS package content for: {}", nsdId, restProcessingException);
- throw new EtsiCatalogManagerRequestFailureException("Internal Server Error Occurred.",
- restProcessingException);
+ final String message = "Caught exception while getting NS package content for: " + nsdId;
+ throw new EtsiCatalogManagerRequestFailureException(message, restProcessingException);
}
}
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/etsicatalog/EtsiCatalogServiceProviderConfiguration.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/etsicatalog/EtsiCatalogServiceProviderConfiguration.java
index 8c6ea92428..7adf87adf4 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/etsicatalog/EtsiCatalogServiceProviderConfiguration.java
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/etsicatalog/EtsiCatalogServiceProviderConfiguration.java
@@ -69,11 +69,11 @@ import org.springframework.web.client.RestTemplate;
@Configuration
public class EtsiCatalogServiceProviderConfiguration {
- public static final String ETSI_CATALOG_REST_TEMPLATE_BEAN = "etsiCatalogRestTemplate";
+ private static final Logger LOGGER = LoggerFactory.getLogger(EtsiCatalogServiceProviderConfiguration.class);
public static final String ETSI_CATALOG_SERVICE_PROVIDER_BEAN = "etsiCatalogServiceProvider";
- private final static Logger LOGGER = LoggerFactory.getLogger(EtsiCatalogServiceProviderConfiguration.class);
+ public static final String ETSI_CATALOG_REST_TEMPLATE_BEAN = "etsiCatalogRestTemplate";
private final HttpClientConnectionConfiguration clientConnectionConfiguration;
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/etsicatalog/EtsiCatalogUrlProvider.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/etsicatalog/EtsiCatalogUrlProvider.java
index e3c159c7b0..54f6ad6543 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/etsicatalog/EtsiCatalogUrlProvider.java
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/etsicatalog/EtsiCatalogUrlProvider.java
@@ -33,8 +33,6 @@ public class EtsiCatalogUrlProvider {
@Value("${etsi-catalog-manager.base.endpoint}")
private String etsiCatalogManagerEndpoint;
- public EtsiCatalogUrlProvider() {}
-
public String getNsPackageUrl(final String nsdId) {
return etsiCatalogManagerEndpoint + "/nsd/v1/ns_descriptors/" + nsdId;
}
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/vnfm/Sol003AdapterConfiguration.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/vnfm/Sol003AdapterConfiguration.java
index fe710ec00b..6776d8ba0b 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/vnfm/Sol003AdapterConfiguration.java
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/vnfm/Sol003AdapterConfiguration.java
@@ -73,20 +73,20 @@ public class Sol003AdapterConfiguration {
@Value("${rest.http.client.configuration.ssl.trustStorePassword:#{null}}")
private String trustStorePassword;
- @Value("so.adapters.sol003-adapter.auth:Basic dm5mbTpwYXNzd29yZDEk")
+ @Value("${so.adapters.sol003-adapter.auth:Basic dm5mbTpwYXNzd29yZDEk}")
private String sol003AdapterBasicAuth;
@Autowired
private GsonProvider gsonProvider;
- @Autowired
- private HttpComponentsClientConfiguration httpComponentsClientConfiguration;
-
@Bean
@Qualifier(SOL003_ADAPTER_REST_TEMPLATE_BEAN)
- public RestTemplate sol003AdapterRestTemplate() {
+ public RestTemplate sol003AdapterRestTemplate(
+ @Autowired final HttpComponentsClientConfiguration httpComponentsClientConfiguration) {
+
final HttpComponentsClientHttpRequestFactory clientHttpRequestFactory =
httpComponentsClientConfiguration.httpComponentsClientHttpRequestFactory();
+
final RestTemplate restTemplate =
new RestTemplate(new BufferingClientHttpRequestFactory(clientHttpRequestFactory));
restTemplate.getInterceptors().add(new SOSpringClientFilter());
@@ -114,7 +114,7 @@ public class Sol003AdapterConfiguration {
final HttpComponentsClientHttpRequestFactory factory =
new HttpComponentsClientHttpRequestFactory(httpClient);
restTemplate.setRequestFactory(new BufferingClientHttpRequestFactory(factory));
- } catch (Exception exception) {
+ } catch (final Exception exception) {
logger.error("Error reading truststore, TLS connection to VNFM will fail.", exception);
}
}
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/vnfm/Sol003AdapterServiceProviderImpl.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/vnfm/Sol003AdapterServiceProviderImpl.java
index a0798f6e55..df3a0c2e31 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/vnfm/Sol003AdapterServiceProviderImpl.java
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/vnfm/Sol003AdapterServiceProviderImpl.java
@@ -22,6 +22,7 @@ package org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.extclients.vnfm;
import static org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.extclients.vnfm.Sol003AdapterConfiguration.SOL003_ADAPTER_HTTP_REST_SERVICE_PROVIDER_BEAN;
import java.util.Optional;
+import org.apache.commons.lang3.StringUtils;
import org.onap.so.adapters.etsisol003adapter.lcm.v1.model.CreateVnfRequest;
import org.onap.so.adapters.etsisol003adapter.lcm.v1.model.CreateVnfResponse;
import org.onap.so.adapters.etsisol003adapter.lcm.v1.model.DeleteVnfResponse;
@@ -76,7 +77,7 @@ public class Sol003AdapterServiceProviderImpl implements Sol003AdapterServicePro
final CreateVnfResponse createVnfResponse = response.getBody();
- if (createVnfResponse.getJobId() == null || createVnfResponse.getJobId().isEmpty()) {
+ if (StringUtils.isBlank(createVnfResponse.getJobId())) {
LOGGER.error("Received invalid instantiation response: {}", response);
return Optional.empty();
}
@@ -134,7 +135,7 @@ public class Sol003AdapterServiceProviderImpl implements Sol003AdapterServicePro
}
final DeleteVnfResponse deleteVnfResponse = response.getBody();
- if (deleteVnfResponse.getJobId() == null || deleteVnfResponse.getJobId().isEmpty()) {
+ if (StringUtils.isBlank(deleteVnfResponse.getJobId())) {
LOGGER.error("Received invalid terminate response: {}", response);
return Optional.empty();
}
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/nsd/FileEntry.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/nsd/FileEntry.java
index 58ca2507bd..cfe5b94859 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/nsd/FileEntry.java
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/nsd/FileEntry.java
@@ -22,6 +22,7 @@ package org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.nsd;
import static org.onap.so.etsi.nfvo.ns.lcm.database.beans.utils.Utils.toIndentedString;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
+import java.util.Arrays;
import java.util.Objects;
/**
@@ -82,7 +83,7 @@ public class FileEntry {
@Override
public int hashCode() {
- return Objects.hash(isDirectory, filePath, fileContent);
+ return Objects.hash(isDirectory, filePath) + Arrays.hashCode(fileContent);
}
@Override
@@ -90,7 +91,7 @@ public class FileEntry {
if (obj instanceof FileEntry) {
final FileEntry other = (FileEntry) obj;
return Objects.equals(isDirectory, other.isDirectory) && Objects.equals(filePath, other.filePath)
- && Objects.equals(fileContent, other.fileContent);
+ && Arrays.equals(fileContent, other.fileContent);
}
return false;
}
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/nsd/FileParser.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/nsd/parser/FileParser.java
index 9df5262302..2a37922e9b 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/nsd/FileParser.java
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/nsd/parser/FileParser.java
@@ -17,9 +17,10 @@
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-package org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.nsd;
+package org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.nsd.parser;
import java.util.Map;
+import org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.nsd.FileEntry;
/**
* @author Waqas Ikram (waqas.ikram@est.tech)
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/nsd/NetworkServiceDescriptorParser.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/nsd/parser/NetworkServiceDescriptorParser.java
index 33737f4c17..cc92234750 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/nsd/NetworkServiceDescriptorParser.java
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/nsd/parser/NetworkServiceDescriptorParser.java
@@ -17,7 +17,7 @@
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-package org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.nsd;
+package org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.nsd.parser;
import java.io.ByteArrayInputStream;
import java.io.IOException;
@@ -31,6 +31,10 @@ import java.util.Optional;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import org.apache.commons.io.IOUtils;
+import org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.nsd.FileEntry;
+import org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.nsd.NetworkServiceDescriptor;
+import org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.nsd.ToscaMetadata;
+import org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.nsd.VirtualNetworkFunction;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -79,7 +83,7 @@ public class NetworkServiceDescriptorParser {
final Map<String, Object> nodeTemplates = getNodeTemplates(topologyTemplates);
final Optional<NetworkServiceDescriptor> nsdOptional =
- getNetworkServiceDescriptor(topologyTemplates);;
+ getNetworkServiceDescriptor(topologyTemplates);
if (nsdOptional.isPresent()) {
final NetworkServiceDescriptor networkServiceDescriptor = nsdOptional.get();
networkServiceDescriptor.setVnfs(getVirtualNetworkFunctions(nodeTemplates));
@@ -91,10 +95,10 @@ public class NetworkServiceDescriptorParser {
}
+ logger.error("Unable to find {} file in {}", TOSCA_META_PATH_FILE_NAME, files);
} catch (final Exception exception) {
- logger.error("Unable to parser nsd zip content", exception);
+ logger.error("Unable to parse nsd zip content", exception);
}
- logger.error("Unable to parser nsd zip content");
return Optional.empty();
}
@@ -104,7 +108,7 @@ public class NetworkServiceDescriptorParser {
final Map<String, Object> substitutionMappings =
(Map<String, Object>) topologyTemplates.get(SUBSTITUTION_MAPPINGS);
final Object nodeType = substitutionMappings.get(NODE_TYPE);
- if (substitutionMappings != null && nodeType != null && NS_NODE_TYPE.equals(nodeType)) {
+ if (substitutionMappings != null && NS_NODE_TYPE.equals(nodeType)) {
final NetworkServiceDescriptor networkServiceDescriptor = new NetworkServiceDescriptor();
networkServiceDescriptor.setType(nodeType.toString());
networkServiceDescriptor.setProperties((Map<String, Object>) substitutionMappings.get(PROPERTIES));
@@ -191,7 +195,7 @@ public class NetworkServiceDescriptorParser {
}
return files;
} catch (final Exception exception) {
- logger.error("Unable to parser nsd zip content", exception);
+ logger.error("Unable to parse nsd zip content", exception);
return Collections.emptyMap();
}
}
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/nsd/ToscaMetadataParser.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/nsd/parser/ToscaMetadataParser.java
index fe23f5ef8d..746416c8e4 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/nsd/ToscaMetadataParser.java
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/nsd/parser/ToscaMetadataParser.java
@@ -17,12 +17,15 @@
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-package org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.nsd;
+package org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.nsd.parser;
+import static java.nio.charset.StandardCharsets.UTF_8;
import static org.apache.commons.lang3.StringUtils.isNotBlank;
import java.util.List;
import java.util.Optional;
import org.apache.commons.io.IOUtils;
+import org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.nsd.FileEntry;
+import org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.nsd.ToscaMetadata;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
@@ -39,7 +42,7 @@ public class ToscaMetadataParser {
public Optional<ToscaMetadata> parse(final FileEntry toscaMetaFile) {
try {
final ToscaMetadata toscaMetadata = new ToscaMetadata();
- final List<String> lines = IOUtils.readLines(toscaMetaFile.getFileContentAsStream(), "utf-8");
+ final List<String> lines = IOUtils.readLines(toscaMetaFile.getFileContentAsStream(), UTF_8);
for (final String line : lines) {
final String trimmedLine = line.trim();
if (!trimmedLine.isEmpty() && trimmedLine.contains(ATTRIBUTE_VALUE_SEPARATOR)) {
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/nsd/YamlFileParser.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/nsd/parser/YamlFileParser.java
index ac8f782a99..eab6974252 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/nsd/YamlFileParser.java
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/nsd/parser/YamlFileParser.java
@@ -17,9 +17,10 @@
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-package org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.nsd;
+package org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.nsd.parser;
import java.util.Map;
+import org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.nsd.FileEntry;
import org.springframework.stereotype.Service;
import org.yaml.snakeyaml.Yaml;
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/service/JobExecutorService.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/service/JobExecutorService.java
index 31e3011c0e..49118494cf 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/service/JobExecutorService.java
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/service/JobExecutorService.java
@@ -28,8 +28,10 @@ import static org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.CamundaVariableNameConstan
import static org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.CamundaVariableNameConstants.SERVICE_TYPE_PARAM_NAME;
import static org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.CamundaVariableNameConstants.TERMINATE_NS_REQUEST_PARAM_NAME;
import static org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.Constants.CREATE_NS_WORKFLOW_NAME;
+import static org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.Constants.DELETE_NS_WORKFLOW_NAME;
import static org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.Constants.INSTANTIATE_NS_WORKFLOW_NAME;
import static org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.Constants.TERMINATE_NS_WORKFLOW_NAME;
+import static org.onap.so.etsi.nfvo.ns.lcm.database.beans.JobAction.DELETE;
import static org.onap.so.etsi.nfvo.ns.lcm.database.beans.JobAction.INSTANTIATE;
import static org.onap.so.etsi.nfvo.ns.lcm.database.beans.JobAction.TERMINATE;
import static org.onap.so.etsi.nfvo.ns.lcm.database.beans.JobStatusEnum.ERROR;
@@ -162,7 +164,7 @@ public class JobExecutorService {
final LocalDateTime currentDateTime = LocalDateTime.now();
final NsLcmOpOcc newNsLcmOpOcc = new NsLcmOpOcc().id(nsInstanceId).operation(NsLcmOpType.INSTANTIATE)
.operationState(OperationStateEnum.PROCESSING).stateEnteredTime(currentDateTime)
- .startTime(currentDateTime).nfvoNsInst(getNfvoNsInst(nsInstanceId)).isAutoInnovation(false)
+ .startTime(currentDateTime).nfvoNsInst(getNfvoNsInst(nsInstanceId)).isAutoInvocation(false)
.isCancelPending(false).operationParams(gson.toJson(instantiateNsRequest));
databaseServiceProvider.addNSLcmOpOcc(newNsLcmOpOcc);
logger.info("New NSLcmOpOcc created in database :\n{}", newNsLcmOpOcc);
@@ -207,7 +209,7 @@ public class JobExecutorService {
final LocalDateTime currentDateTime = LocalDateTime.now();
final NsLcmOpOcc nsLcmOpOcc = new NsLcmOpOcc().id(nsInstanceId).operation(NsLcmOpType.TERMINATE)
.operationState(OperationStateEnum.PROCESSING).stateEnteredTime(currentDateTime)
- .startTime(currentDateTime).nfvoNsInst(getNfvoNsInst(nsInstanceId)).isAutoInnovation(false)
+ .startTime(currentDateTime).nfvoNsInst(getNfvoNsInst(nsInstanceId)).isAutoInvocation(false)
.isCancelPending(false).operationParams(gson.toJson(terminateNsRequest));
databaseServiceProvider.addNSLcmOpOcc(nsLcmOpOcc);
logger.info("New NSLcmOpOcc created in database :\n{}", nsLcmOpOcc);
@@ -240,6 +242,46 @@ public class JobExecutorService {
throw new NsRequestProcessingException(message);
}
+ public void runDeleteNsJob(final String nsInstanceId) {
+ final NfvoJob nfvoJob = new NfvoJob().startTime(LocalDateTime.now()).jobType("NS").jobAction(DELETE)
+ .resourceId(nsInstanceId).status(STARTING).progress(0);
+ databaseServiceProvider.addJob(nfvoJob);
+ logger.info("New job created in database :\n{}", nfvoJob);
+
+ workflowExecutorService.executeWorkflow(nfvoJob.getJobId(), DELETE_NS_WORKFLOW_NAME,
+ getVariables(nsInstanceId, nfvoJob.getJobId()));
+
+ final ImmutablePair<String, JobStatusEnum> immutablePair =
+ waitForJobToFinish(nfvoJob.getJobId(), JOB_FINISHED_STATES);
+
+ if (immutablePair.getRight() == null) {
+ final String message = "Failed to Delete NS with id: " + nsInstanceId;
+ logger.error(message);
+ throw new NsRequestProcessingException(message);
+ }
+
+ final JobStatusEnum finalJobStatus = immutablePair.getRight();
+ final String processInstanceId = immutablePair.getLeft();
+
+ if (FINISHED.equals(finalJobStatus)) {
+ logger.info("Delete Job status: {}", finalJobStatus);
+ return;
+ }
+
+ final Optional<InlineResponse400> optional = workflowQueryService.getProblemDetails(processInstanceId);
+ if (optional.isPresent()) {
+ final InlineResponse400 problemDetails = optional.get();
+ final String message = "Failed to Delete NS with id: " + nsInstanceId + " due to:\n" + problemDetails;
+ logger.error(message);
+ throw new NsRequestProcessingException(message, problemDetails);
+ }
+
+ final String message =
+ "Received unexpected Job Status: " + finalJobStatus + " Failed to Delete NS with id: " + nsInstanceId;
+ logger.error(message);
+ throw new NsRequestProcessingException(message);
+ }
+
private void doInitialTerminateChecks(final String nsInstanceId, final TerminateNsRequest terminateNsRequest) {
if (isNotImmediateTerminateRequest(terminateNsRequest)) {
final String message = "TerminateNsRequest received with terminateTime: "
@@ -347,4 +389,11 @@ public class JobExecutorService {
variables.put(TERMINATE_NS_REQUEST_PARAM_NAME, terminateNsRequest);
return variables;
}
+
+ private Map<String, Object> getVariables(final String nsInstanceId, final String jobId) {
+ final Map<String, Object> variables = new HashMap<>();
+ variables.put(NS_INSTANCE_ID_PARAM_NAME, nsInstanceId);
+ variables.put(JOB_ID_PARAM_NAME, jobId);
+ return variables;
+ }
}
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/service/WorkflowQueryService.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/service/WorkflowQueryService.java
index 297e9c34af..a6180b0e52 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/service/WorkflowQueryService.java
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/service/WorkflowQueryService.java
@@ -20,7 +20,7 @@
package org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.service;
import static org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.CamundaVariableNameConstants.CREATE_NS_RESPONSE_PARAM_NAME;
-import static org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.CamundaVariableNameConstants.CREATE_NS_WORKFLOW_PROCESSING_EXCEPTION_PARAM_NAME;
+import static org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.CamundaVariableNameConstants.NS_WORKFLOW_PROCESSING_EXCEPTION_PARAM_NAME;
import static org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.Constants.TENANT_ID;
import static org.slf4j.LoggerFactory.getLogger;
import java.util.Optional;
@@ -83,7 +83,7 @@ public class WorkflowQueryService {
public Optional<InlineResponse400> getProblemDetails(final String processInstanceId) {
try {
final HistoricVariableInstance historicVariableInstance =
- getVariable(processInstanceId, CREATE_NS_WORKFLOW_PROCESSING_EXCEPTION_PARAM_NAME);
+ getVariable(processInstanceId, NS_WORKFLOW_PROCESSING_EXCEPTION_PARAM_NAME);
logger.info("Found HistoricVariableInstance : {}", historicVariableInstance);
final Object variableValue = historicVariableInstance.getValue();
@@ -94,7 +94,7 @@ public class WorkflowQueryService {
historicVariableInstance.getValue() != null ? variableValue.getClass() : null, variableValue);
} catch (final ProcessEngineException processEngineException) {
logger.error("Unable to find {} variable using processInstanceId: {}",
- CREATE_NS_WORKFLOW_PROCESSING_EXCEPTION_PARAM_NAME, processInstanceId, processEngineException);
+ NS_WORKFLOW_PROCESSING_EXCEPTION_PARAM_NAME, processInstanceId, processEngineException);
}
return Optional.empty();
}
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/tasks/AbstractNetworkServiceTask.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/tasks/AbstractNetworkServiceTask.java
index e6905b86fc..e94b3de81e 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/tasks/AbstractNetworkServiceTask.java
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/tasks/AbstractNetworkServiceTask.java
@@ -19,7 +19,7 @@
*/
package org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.tasks;
-import static org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.CamundaVariableNameConstants.CREATE_NS_WORKFLOW_PROCESSING_EXCEPTION_PARAM_NAME;
+import static org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.CamundaVariableNameConstants.NS_WORKFLOW_PROCESSING_EXCEPTION_PARAM_NAME;
import static org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.CamundaVariableNameConstants.JOB_ID_PARAM_NAME;
import static org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.CamundaVariableNameConstants.NS_INSTANCE_ID_PARAM_NAME;
import static org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.CamundaVariableNameConstants.OCC_ID_PARAM_NAME;
@@ -33,6 +33,7 @@ import org.onap.so.etsi.nfvo.ns.lcm.database.beans.NfvoJobStatus;
import org.onap.so.etsi.nfvo.ns.lcm.database.beans.NfvoNsInst;
import org.onap.so.etsi.nfvo.ns.lcm.database.beans.NsLcmOpOcc;
import org.onap.so.etsi.nfvo.ns.lcm.database.beans.OperationStateEnum;
+import org.onap.so.etsi.nfvo.ns.lcm.database.beans.State;
import org.onap.so.etsi.nfvo.ns.lcm.database.service.DatabaseServiceProvider;
import org.onap.so.etsi.nfvo.ns.lcm.model.InlineResponse400;
import org.slf4j.Logger;
@@ -47,10 +48,20 @@ public abstract class AbstractNetworkServiceTask {
private final Logger logger = LoggerFactory.getLogger(getClass());
protected final DatabaseServiceProvider databaseServiceProvider;
- public AbstractNetworkServiceTask(final DatabaseServiceProvider jobServiceProvider) {
+ protected AbstractNetworkServiceTask(final DatabaseServiceProvider jobServiceProvider) {
this.databaseServiceProvider = jobServiceProvider;
}
+ public void addJobStatus(final DelegateExecution execution, final JobStatusEnum jobStatus,
+ final String description) {
+ final NfvoJobStatus nfvoJobStatus =
+ new NfvoJobStatus().status(jobStatus).description(description).updatedTime(LocalDateTime.now());
+ logger.info("Adding NfvoJobStatus {}", nfvoJobStatus);
+ final NfvoJob nfvoJob = getNfvoJob(execution);
+ nfvoJob.nfvoJobStatus(nfvoJobStatus);
+ databaseServiceProvider.addJob(nfvoJob);
+ }
+
public void setJobStatus(final DelegateExecution execution, final JobStatusEnum jobStatus,
final String description) {
logger.info("Setting Job Status to {}", jobStatus);
@@ -77,7 +88,7 @@ public abstract class AbstractNetworkServiceTask {
final Optional<NfvoJob> optional = databaseServiceProvider.getJob(jobId);
if (optional.isPresent()) {
final InlineResponse400 problemDetails =
- (InlineResponse400) execution.getVariable(CREATE_NS_WORKFLOW_PROCESSING_EXCEPTION_PARAM_NAME);
+ (InlineResponse400) execution.getVariable(NS_WORKFLOW_PROCESSING_EXCEPTION_PARAM_NAME);
final NfvoJob nfvoJob = optional.get();
nfvoJob.status(JobStatusEnum.ERROR).endTime(LocalDateTime.now());
@@ -146,7 +157,7 @@ public abstract class AbstractNetworkServiceTask {
protected void abortOperation(final DelegateExecution execution, final String message,
final InlineResponse400 problemDetails) {
logger.error(message);
- execution.setVariable(CREATE_NS_WORKFLOW_PROCESSING_EXCEPTION_PARAM_NAME, problemDetails);
+ execution.setVariable(NS_WORKFLOW_PROCESSING_EXCEPTION_PARAM_NAME, problemDetails);
throw new BpmnError("WORKFLOW_FAILED");
}
@@ -156,14 +167,20 @@ public abstract class AbstractNetworkServiceTask {
if (optional.isEmpty()) {
final String message = "Unable to find job using job id: " + jobId;
logger.error(message);
- execution.setVariable(CREATE_NS_WORKFLOW_PROCESSING_EXCEPTION_PARAM_NAME,
- new InlineResponse400().detail(message));
+ execution.setVariable(NS_WORKFLOW_PROCESSING_EXCEPTION_PARAM_NAME, new InlineResponse400().detail(message));
throw new BpmnError("WORKFLOW_FAILED");
}
return optional.get();
}
+ protected void updateNsInstanceStatus(final DelegateExecution execution, final State nsStatus) {
+ final NfvoNsInst nfvoNsInst = getNfvoNsInst(execution);
+ logger.info("Updating NfvoNsInst Status to {} and saving to DB", nsStatus);
+ nfvoNsInst.setStatus(nsStatus);
+ databaseServiceProvider.saveNfvoNsInst(nfvoNsInst);
+ }
+
protected NfvoNsInst getNfvoNsInst(final DelegateExecution execution) {
final String nsInstId = (String) execution.getVariable(NS_INSTANCE_ID_PARAM_NAME);
return getNfvoNsInst(execution, nsInstId);
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/tasks/CreateInstantiateVnfTask.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/tasks/CreateInstantiateVnfTask.java
index 251e694219..600792acc0 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/tasks/CreateInstantiateVnfTask.java
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/tasks/CreateInstantiateVnfTask.java
@@ -47,6 +47,7 @@ import org.springframework.stereotype.Component;
*/
@Component
public class CreateInstantiateVnfTask extends AbstractNetworkServiceTask {
+ private static final String CREATE_INSTANTIATE_REQUEST_PARAM_NAME = "request";
private static final Logger logger = LoggerFactory.getLogger(CreateInstantiateVnfTask.class);
private static final String NF_INST_ID_PARAM_NAME = "NF_INST_ID";
public static final String CREATE_VNF_RESPONSE_PARAM_NAME = "createVnfResponse";
@@ -64,10 +65,11 @@ public class CreateInstantiateVnfTask extends AbstractNetworkServiceTask {
public void checkIfNfInstanceExistsInDb(final DelegateExecution execution) {
logger.info("Executing checkIfNfInstanceInDb");
- final CreateInstantiateRequest request = (CreateInstantiateRequest) execution.getVariable("request");
+ final CreateInstantiateRequest request =
+ (CreateInstantiateRequest) execution.getVariable(CREATE_INSTANTIATE_REQUEST_PARAM_NAME);
logger.info("request: {}", request);
- setJobStatus(execution, JobStatusEnum.IN_PROGRESS, "Checking if NF Instance record exists in database for "
+ addJobStatus(execution, JobStatusEnum.IN_PROGRESS, "Checking if NF Instance record exists in database for "
+ request.getNsInstId() + " and " + request.getVnfName());
if (!databaseServiceProvider.isNsInstExists(request.getNsInstId(), request.getVnfName())) {
abortOperation(execution,
@@ -79,10 +81,11 @@ public class CreateInstantiateVnfTask extends AbstractNetworkServiceTask {
public void createNfInstanceInDb(final DelegateExecution execution) {
logger.info("Executing createNfInstanceInDb");
- final CreateInstantiateRequest request = (CreateInstantiateRequest) execution.getVariable("request");
+ final CreateInstantiateRequest request =
+ (CreateInstantiateRequest) execution.getVariable(CREATE_INSTANTIATE_REQUEST_PARAM_NAME);
logger.info("request: {}", request);
- setJobStatus(execution, IN_PROGRESS, "Creating NF Instance record in database for " + request.getVnfName());
+ addJobStatus(execution, IN_PROGRESS, "Creating NF Instance record in database for " + request.getVnfName());
final Optional<NfvoNsInst> optional = databaseServiceProvider.getNfvoNsInst(request.getNsInstId());
@@ -104,9 +107,10 @@ public class CreateInstantiateVnfTask extends AbstractNetworkServiceTask {
public void createGenericVnfInAai(final DelegateExecution execution) {
logger.info("Executing createGenericVnfInAai");
try {
- final CreateInstantiateRequest request = (CreateInstantiateRequest) execution.getVariable("request");
+ final CreateInstantiateRequest request =
+ (CreateInstantiateRequest) execution.getVariable(CREATE_INSTANTIATE_REQUEST_PARAM_NAME);
- setJobStatus(execution, IN_PROGRESS, "Creating GenericVnf record in AAI for " + request.getVnfName());
+ addJobStatus(execution, IN_PROGRESS, "Creating GenericVnf record in AAI for " + request.getVnfName());
final String nfInstId = (String) execution.getVariable(NF_INST_ID_PARAM_NAME);
final String nsInstId = (String) execution.getVariable(NS_INSTANCE_ID_PARAM_NAME);
@@ -140,17 +144,16 @@ public class CreateInstantiateVnfTask extends AbstractNetworkServiceTask {
logger.info("Executing invokeCreateInstantiationRequest");
try {
- final CreateInstantiateRequest request = (CreateInstantiateRequest) execution.getVariable("request");
+ final CreateInstantiateRequest request =
+ (CreateInstantiateRequest) execution.getVariable(CREATE_INSTANTIATE_REQUEST_PARAM_NAME);
logger.info("request: {}", request);
- setJobStatus(execution, IN_PROGRESS,
+ addJobStatus(execution, IN_PROGRESS,
"Invoking SOL003 adapter for creating and instantiating VNF: " + request.getVnfName());
- final String nsInstId = (String) execution.getVariable(NS_INSTANCE_ID_PARAM_NAME);
- final NfvoNsInst nfvoNsInst = getNfvoNsInst(execution, nsInstId);
final CreateVnfRequest vnfRequest = new CreateVnfRequest();
vnfRequest.setTenant(request.getTenant());
- vnfRequest.setName(nfvoNsInst.getName() + "." + request.getVnfName());
+ vnfRequest.setName(request.getVnfName());
vnfRequest.setPkgId(request.getVnfPkgId());
vnfRequest.setAdditionalParams(request.getAdditionalParams());
final String vnfId = (String) execution.getVariable(NF_INST_ID_PARAM_NAME);
@@ -167,7 +170,7 @@ public class CreateInstantiateVnfTask extends AbstractNetworkServiceTask {
logger.info("Vnf instantiation response: {}", vnfResponse);
execution.setVariable(CREATE_VNF_RESPONSE_PARAM_NAME, vnfResponse);
- setJobStatus(execution, IN_PROGRESS, "Successfully invoked SOL003 adapater creating and instantiating VNF: "
+ addJobStatus(execution, IN_PROGRESS, "Successfully invoked SOL003 adapater creating and instantiating VNF: "
+ request.getVnfName() + " CreaetVnfResponse Job Id: " + vnfResponse.getJobId());
logger.debug("Finished executing invokeCreateInstantiationRequest ...");
} catch (final Exception exception) {
@@ -182,8 +185,9 @@ public class CreateInstantiateVnfTask extends AbstractNetworkServiceTask {
logger.info("Executing updateNfInstanceStatusToInstantiated");
updateNfInstanceStatus(execution, State.INSTANTIATED);
- final CreateInstantiateRequest request = (CreateInstantiateRequest) execution.getVariable("request");
- setJobStatus(execution, FINISHED, "Successfully created and Instantiated VNF: " + request.getVnfName()
+ final CreateInstantiateRequest request =
+ (CreateInstantiateRequest) execution.getVariable(CREATE_INSTANTIATE_REQUEST_PARAM_NAME);
+ addJobStatus(execution, FINISHED, "Successfully created and Instantiated VNF: " + request.getVnfName()
+ " will set status to " + State.INSTANTIATED);
logger.info("Finished executing updateNfInstanceStatusToInstantiated ...");
@@ -194,8 +198,9 @@ public class CreateInstantiateVnfTask extends AbstractNetworkServiceTask {
logger.info("Executing updateNfInstanceStatusToActive");
updateNfInstanceStatus(execution, State.FAILED);
- final CreateInstantiateRequest request = (CreateInstantiateRequest) execution.getVariable("request");
- setJobStatus(execution, ERROR, "Failed to create and instantiate VNF: " + request.getVnfName()
+ final CreateInstantiateRequest request =
+ (CreateInstantiateRequest) execution.getVariable(CREATE_INSTANTIATE_REQUEST_PARAM_NAME);
+ addJobStatus(execution, ERROR, "Failed to create and instantiate VNF: " + request.getVnfName()
+ " will set status to " + State.FAILED);
logger.info("Finished executing updateNfInstanceStatusToInstantiated ...");
@@ -204,14 +209,11 @@ public class CreateInstantiateVnfTask extends AbstractNetworkServiceTask {
private void updateNfInstanceStatus(final DelegateExecution execution, final State vnfStatus) {
final String nfInstId = (String) execution.getVariable(NF_INST_ID_PARAM_NAME);
-
final Optional<NfvoNfInst> optional = databaseServiceProvider.getNfvoNfInst(nfInstId);
- if (!optional.isPresent()) {
+ if (optional.isEmpty()) {
final String message = "Unable to find NfvoNfInst record in database using nfInstId: " + nfInstId;
logger.error(message);
-
abortOperation(execution, message);
-
}
final NfvoNfInst nfvoNfInst = optional.get();
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/tasks/CreateNsTask.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/tasks/CreateNsTask.java
index fa7187b388..2cf68bee14 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/tasks/CreateNsTask.java
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/tasks/CreateNsTask.java
@@ -21,7 +21,7 @@ package org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.tasks;
import static org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.CamundaVariableNameConstants.CREATE_NS_REQUEST_PARAM_NAME;
import static org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.CamundaVariableNameConstants.CREATE_NS_RESPONSE_PARAM_NAME;
-import static org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.CamundaVariableNameConstants.CREATE_NS_WORKFLOW_PROCESSING_EXCEPTION_PARAM_NAME;
+import static org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.CamundaVariableNameConstants.NS_WORKFLOW_PROCESSING_EXCEPTION_PARAM_NAME;
import static org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.CamundaVariableNameConstants.GLOBAL_CUSTOMER_ID_PARAM_NAME;
import static org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.CamundaVariableNameConstants.NS_INSTANCE_ID_PARAM_NAME;
import static org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.CamundaVariableNameConstants.NS_PACKAGE_MODEL_PARAM_NAME;
@@ -102,7 +102,7 @@ public class CreateNsTask extends AbstractNetworkServiceTask {
final String message = "Unable to find NS package using NsdId: " + createNsRequest.getNsdId();
logger.error(message);
execution.setVariable(DOES_NS_PACKAGE_EXISTS_PARAM_NAME, false);
- execution.setVariable(CREATE_NS_WORKFLOW_PROCESSING_EXCEPTION_PARAM_NAME,
+ execution.setVariable(NS_WORKFLOW_PROCESSING_EXCEPTION_PARAM_NAME,
new InlineResponse400().detail(message));
}
@@ -113,7 +113,7 @@ public class CreateNsTask extends AbstractNetworkServiceTask {
execution.setVariable(DOES_NS_PACKAGE_EXISTS_PARAM_NAME, false);
- execution.setVariable(CREATE_NS_WORKFLOW_PROCESSING_EXCEPTION_PARAM_NAME,
+ execution.setVariable(NS_WORKFLOW_PROCESSING_EXCEPTION_PARAM_NAME,
new InlineResponse400().title(message).detail(message));
}
@@ -135,7 +135,7 @@ public class CreateNsTask extends AbstractNetworkServiceTask {
final Optional<NfvoNsInst> optional =
databaseServiceProvider.getNfvoNsInstByName(createNsRequest.getNsName());
final NfvoNsInst nfvoNsInst = optional.get();
- execution.setVariable(CREATE_NS_WORKFLOW_PROCESSING_EXCEPTION_PARAM_NAME, new InlineResponse400()
+ execution.setVariable(NS_WORKFLOW_PROCESSING_EXCEPTION_PARAM_NAME, new InlineResponse400()
.detail("Ns Instance already exists in database : " + nfvoNsInst.toString()));
}
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/tasks/DeleteNsTask.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/tasks/DeleteNsTask.java
new file mode 100644
index 0000000000..cd711fb3e8
--- /dev/null
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/tasks/DeleteNsTask.java
@@ -0,0 +1,140 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.tasks;
+
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.extclients.aai.AaiServiceProvider;
+import org.onap.so.etsi.nfvo.ns.lcm.database.beans.NfvoNsInst;
+import org.onap.so.etsi.nfvo.ns.lcm.database.beans.State;
+import org.onap.so.etsi.nfvo.ns.lcm.database.service.DatabaseServiceProvider;
+import org.onap.so.etsi.nfvo.ns.lcm.model.InlineResponse400;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import java.util.Optional;
+import static org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.CamundaVariableNameConstants.NS_INSTANCE_ID_PARAM_NAME;
+import static org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.CamundaVariableNameConstants.NS_WORKFLOW_PROCESSING_EXCEPTION_PARAM_NAME;
+import static org.onap.so.etsi.nfvo.ns.lcm.database.beans.JobStatusEnum.FINISHED;
+import static org.onap.so.etsi.nfvo.ns.lcm.database.beans.JobStatusEnum.IN_PROGRESS;
+import static org.onap.so.etsi.nfvo.ns.lcm.database.beans.JobStatusEnum.STARTED;
+import static org.onap.so.etsi.nfvo.ns.lcm.database.beans.State.NOT_INSTANTIATED;
+
+/**
+ * @author Andrew Lamb (andrew.a.lamb@est.tech)
+ *
+ */
+@Component
+public class DeleteNsTask extends AbstractNetworkServiceTask {
+
+ private static final String NS_INSTANCE_EXISTS_PARAM_NAME = "nsInstanceExists";
+ private static final String NS_INSTANCE_IS_IN_NOT_INSTANTIATED_STATE_PARAM_NAME = "isInNotInstantiatedState";
+ private static final Logger logger = LoggerFactory.getLogger(DeleteNsTask.class);
+ private final AaiServiceProvider aaiServiceProvider;
+
+ @Autowired
+ public DeleteNsTask(final DatabaseServiceProvider databaseServiceProvider,
+ final AaiServiceProvider aaiServiceProvider) {
+ super(databaseServiceProvider);
+ this.aaiServiceProvider = aaiServiceProvider;
+ }
+
+ public void setJobStatusToStarted(final DelegateExecution execution) {
+ setJobStatus(execution, STARTED, "Delete NS workflow process started");
+ }
+
+ public void setJobStatusToFinished(final DelegateExecution execution) {
+ setJobStatus(execution, FINISHED, "Delete NS workflow process finished");
+ }
+
+ public void setJobStatusInProgress(final DelegateExecution execution, final String message) {
+ setJobStatus(execution, IN_PROGRESS, message);
+ }
+
+ public void setJobStatusToError(final DelegateExecution execution) {
+ setJobStatusToError(execution, "Delete NS workflow process failed");
+ }
+
+ public void checkIfNsInstanceExistsInDb(final DelegateExecution execution) {
+ logger.info("Executing checkIfNsInstanceExistsInDb ...");
+ setJobStatusInProgress(execution, "Checking that NS Instance Exists in DB");
+
+ final String nsInstId = (String) execution.getVariable(NS_INSTANCE_ID_PARAM_NAME);
+ final Optional<NfvoNsInst> optionalNfvoNsInst = databaseServiceProvider.getNfvoNsInst(nsInstId);
+ final boolean nsInstanceExists = optionalNfvoNsInst.isPresent();
+ logger.info("NS Instance entry with id: {} {} exist in database", nsInstId,
+ nsInstanceExists ? "does" : "doesn't");
+ execution.setVariable(NS_INSTANCE_EXISTS_PARAM_NAME, nsInstanceExists);
+
+ if (!nsInstanceExists) {
+ final String message =
+ "NS Instance with id: " + nsInstId + " does not exist in database, so will not be deleted.";
+ logger.info(message);
+ execution.setVariable(NS_WORKFLOW_PROCESSING_EXCEPTION_PARAM_NAME, new InlineResponse400().detail(message));
+ }
+
+ logger.info("Finished executing checkIfNsInstanceExistsInDb ...");
+ }
+
+ public void checkthatNsInstanceInDbIsInNotInstantiatedState(final DelegateExecution execution) {
+ logger.info("Executing checkthatNsInstanceInDbIsInNotInstantiatedState ...");
+ setJobStatusInProgress(execution, "Checking that NS Instance is in NOT_INSTANTIATED state in Db");
+
+ final String nsInstId = (String) execution.getVariable(NS_INSTANCE_ID_PARAM_NAME);
+ final NfvoNsInst nfvoNsInst = getNfvoNsInst(execution, nsInstId);
+ final State nfvoNsInstState = nfvoNsInst.getStatus();
+ final boolean nsInstanceIsNotInstantiated = NOT_INSTANTIATED.equals(nfvoNsInstState);
+ logger.info("Ns Instance entry with nsInstId: {} is in state: {}", nsInstId, nfvoNsInstState);
+ execution.setVariable(NS_INSTANCE_IS_IN_NOT_INSTANTIATED_STATE_PARAM_NAME, nsInstanceIsNotInstantiated);
+
+ if (!nsInstanceIsNotInstantiated) {
+ final String message =
+ "Cannot Delete NS Instance with id: " + nsInstId + " in the state: " + nfvoNsInstState;
+ logger.info(message);
+ execution.setVariable(NS_WORKFLOW_PROCESSING_EXCEPTION_PARAM_NAME, new InlineResponse400().detail(message));
+ }
+
+ logger.info("Finished executing checkthatNsInstanceInDbIsInNotInstantiatedState ...");
+ }
+
+ public void deleteNsInstanceFromAai(final DelegateExecution execution) {
+ logger.info("Executing deleteNsInstanceFromAAI ...");
+ setJobStatusInProgress(execution, "Deleting NS Instance from AAI");
+
+ final String nsInstId = (String) execution.getVariable(NS_INSTANCE_ID_PARAM_NAME);
+ final NfvoNsInst nfvoNsInst = getNfvoNsInst(execution, nsInstId);
+ final String globalCustomerId = nfvoNsInst.getGlobalCustomerId();
+ final String serviceType = nfvoNsInst.getServiceType();
+
+ aaiServiceProvider.deleteServiceInstance(globalCustomerId, serviceType, nsInstId);
+
+ logger.info("Finished executing deleteNsInstanceFromAAI ...");
+ }
+
+ public void deleteNsInstanceFromDb(final DelegateExecution execution) {
+ logger.info("Executing deleteNsInstanceFromDb ...");
+ setJobStatusInProgress(execution, "Deleting NS Instance from Db");
+
+ final String nsInstId = (String) execution.getVariable(NS_INSTANCE_ID_PARAM_NAME);
+ databaseServiceProvider.deleteNfvoNsInst(nsInstId);
+
+ logger.info("Finished executing deleteNsInstanceFromDb ...");
+ }
+}
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/tasks/InstantiateNsTask.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/tasks/InstantiateNsTask.java
index 6774fad543..a6d35e301e 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/tasks/InstantiateNsTask.java
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/tasks/InstantiateNsTask.java
@@ -22,17 +22,16 @@ package org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.tasks;
import static org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.CamundaVariableNameConstants.INSTANTIATE_NS_REQUEST_PARAM_NAME;
import static org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.CamundaVariableNameConstants.NETWORK_SERVICE_DESCRIPTOR_PARAM_NAME;
import static org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.CamundaVariableNameConstants.NS_INSTANCE_ID_PARAM_NAME;
-import static org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.CamundaVariableNameConstants.OCC_ID_PARAM_NAME;
import static org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.CamundaVariableNameConstants.VNF_CREATE_INSTANTIATE_REQUESTS;
import static org.onap.so.etsi.nfvo.ns.lcm.database.beans.JobStatusEnum.FINISHED;
import static org.onap.so.etsi.nfvo.ns.lcm.database.beans.JobStatusEnum.IN_PROGRESS;
import static org.onap.so.etsi.nfvo.ns.lcm.database.beans.JobStatusEnum.STARTED;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
+import org.apache.commons.lang.StringUtils;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.onap.so.adapters.etsisol003adapter.lcm.v1.model.Tenant;
import org.onap.so.adapters.etsisol003adapter.pkgm.extclients.etsicatalog.model.NsdInfo;
@@ -43,8 +42,6 @@ import org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.nsd.NetworkServiceDescriptor;
import org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.nsd.VirtualNetworkFunction;
import org.onap.so.etsi.nfvo.ns.lcm.database.beans.NfvoNfInst;
import org.onap.so.etsi.nfvo.ns.lcm.database.beans.NfvoNsInst;
-import org.onap.so.etsi.nfvo.ns.lcm.database.beans.NsLcmOpOcc;
-import org.onap.so.etsi.nfvo.ns.lcm.database.beans.OperationStateEnum;
import org.onap.so.etsi.nfvo.ns.lcm.database.beans.State;
import org.onap.so.etsi.nfvo.ns.lcm.database.service.DatabaseServiceProvider;
import org.onap.so.etsi.nfvo.ns.lcm.model.InstantiateNsRequest;
@@ -144,7 +141,7 @@ public class InstantiateNsTask extends AbstractNetworkServiceTask {
final Optional<NetworkServiceDescriptor> optional =
etsiCatalogPackageManagementServiceProvider.getNetworkServiceDescriptor(nsPackageId);
- if (!optional.isPresent()) {
+ if (optional.isEmpty()) {
final String message = "Unable to parse NSD " + nsPackageId;
logger.error(message);
abortOperation(execution, message);
@@ -172,6 +169,7 @@ public class InstantiateNsTask extends AbstractNetworkServiceTask {
final NetworkServiceDescriptor networkServiceDescriptor =
(NetworkServiceDescriptor) execution.getVariable(NETWORK_SERVICE_DESCRIPTOR_PARAM_NAME);
final String nsInstId = (String) execution.getVariable(NS_INSTANCE_ID_PARAM_NAME);
+ final NfvoNsInst nfvoNsInst = getNfvoNsInst(execution, nsInstId);
final InstantiateNsRequest instantiateNsRequest =
(InstantiateNsRequest) execution.getVariable(INSTANTIATE_NS_REQUEST_PARAM_NAME);
@@ -195,17 +193,36 @@ public class InstantiateNsTask extends AbstractNetworkServiceTask {
abortOperation(execution, message);
}
- final Optional<Tenant> optional = getTenant(vnfPkgId, additionalParamsForVnfList);
- if (!optional.isPresent()) {
+ final Optional<NsInstancesnsInstanceIdinstantiateAdditionalParamsForVnf> additionalParamsForVnfOptional =
+ getAdditionalParamsForVnf(vnfdId, additionalParamsForVnfList);
+
+ if (additionalParamsForVnfOptional.isEmpty()) {
+ final String message = "Unable to find AdditionalParamsForVnf for " + vnfdId
+ + " in instantiateNsRequest : " + instantiateNsRequest;
+ abortOperation(execution, message);
+ }
+
+ final NsInstancesnsInstanceIdinstantiateAdditionalParamsForVnf additionalParamsForVnf =
+ additionalParamsForVnfOptional.get();
+
+ @SuppressWarnings("unchecked")
+ final Map<String, String> additionalParams =
+ (Map<String, String>) additionalParamsForVnf.getAdditionalParams();
+
+ final Optional<Tenant> optional = getTenant(additionalParams);
+ if (optional.isEmpty()) {
final String message = "Unable to find Tenant information for " + vnfdId + " in instantiateNsRequest : "
+ instantiateNsRequest;
abortOperation(execution, message);
}
- final Tenant tenant = optional.get();
- final CreateInstantiateRequest createInstantiateRequest = new CreateInstantiateRequest().nsInstId(nsInstId)
- .vnfdId(vnfdId).vnfName(vnf.getVnfName()).vnfPkgId(vnfPkgId).nfType(vnfmInfoList.get(0))
- .tenant(tenant).additionalParams(getAdditionalParams(vnfPkgId, additionalParamsForVnfList));
+ final String vnfInstanceName = additionalParamsForVnf.getVnfInstanceName();
+ final String vnfName = StringUtils.isNotBlank(vnfInstanceName) ? vnfInstanceName
+ : nfvoNsInst.getName() + "." + vnf.getVnfName();
+
+ final CreateInstantiateRequest createInstantiateRequest =
+ new CreateInstantiateRequest().nsInstId(nsInstId).vnfdId(vnfdId).vnfName(vnfName).vnfPkgId(vnfPkgId)
+ .nfType(vnfmInfoList.get(0)).tenant(optional.get()).additionalParams(additionalParams);
logger.info("Adding request to list: {}", createInstantiateRequest);
requests.add(createInstantiateRequest);
@@ -223,17 +240,25 @@ public class InstantiateNsTask extends AbstractNetworkServiceTask {
final String nsInstId = (String) execution.getVariable(NS_INSTANCE_ID_PARAM_NAME);
final NfvoNsInst nfvoNsInst = getNfvoNsInst(execution, nsInstId);
-
final String nsPackageId = nfvoNsInst.getNsPackageId();
- final NsdInfo nsdInfo = getNsdInfo(execution, nsPackageId);
final Map<String, String> vnfdIdToVnfPkgIdMapping = new HashMap<>();
try {
+ final Optional<NsdInfo> nsdInfoOptional =
+ etsiCatalogPackageManagementServiceProvider.getNSPackageModel(nsPackageId);
+
+ if (nsdInfoOptional.isEmpty()) {
+ final String message = "Unable to find NS package using NS package id: " + nsPackageId;
+ logger.error(message);
+ abortOperation(execution, message);
+ }
+
+ final NsdInfo nsdInfo = nsdInfoOptional.get();
for (final String vnfPkgId : nsdInfo.getVnfPkgIds()) {
final Optional<VnfPkgInfo> optional =
etsiCatalogPackageManagementServiceProvider.getVnfPkgInfo(vnfPkgId);
- if (!optional.isPresent()) {
+ if (optional.isEmpty()) {
final String message = "Unable to find VNF package using NS vnfPkgId: " + vnfPkgId;
logger.error(message);
abortOperation(execution, message);
@@ -273,83 +298,31 @@ public class InstantiateNsTask extends AbstractNetworkServiceTask {
setJobStatusToError(execution, "Instantiate NS workflow process failed");
}
- private NsdInfo getNsdInfo(final DelegateExecution execution, final String nsPackageId) {
- try {
- final Optional<NsdInfo> optional =
- etsiCatalogPackageManagementServiceProvider.getNSPackageModel(nsPackageId);
-
- if (optional.isPresent()) {
- final NsdInfo packageModel = optional.get();
- logger.info("NS Package exists {}", packageModel);
- return packageModel;
+ private Optional<Tenant> getTenant(final Map<String, String> additionalParams) {
+ final String vimId = additionalParams.get("vim_id");
+ if (vimId != null) {
+ final String[] splitString = vimId.split("_");
+ if (splitString.length == 3) {
+ logger.info("Found Tenant in additionalParams: {}", additionalParams);
+ return Optional.of(
+ new Tenant().cloudOwner(splitString[0]).regionName(splitString[1]).tenantId(splitString[2]));
}
- } catch (final EtsiCatalogManagerRequestFailureException failureException) {
- final String message =
- "Unexpected exception occured while getting ns package using nsPackageId: " + nsPackageId;
- logger.error(message, failureException);
-
- abortOperation(execution, message);
}
-
- final String message = "Unable to find NS package using NS package id: " + nsPackageId;
- logger.error(message);
- abortOperation(execution, message);
- return null;
-
- }
-
- private void updateNsInstanceStatus(final DelegateExecution execution, final State nsStatus) {
- final NfvoNsInst nfvoNsInst = getNfvoNsInst(execution);
- logger.info("Updating NfvoNsInst Status to {} and saving to DB", nsStatus);
- nfvoNsInst.setStatus(nsStatus);
- databaseServiceProvider.saveNfvoNsInst(nfvoNsInst);
- }
-
- private Optional<Tenant> getTenant(final String vnfPkgId,
- final List<NsInstancesnsInstanceIdinstantiateAdditionalParamsForVnf> additionalParamsForVnfList) {
-
- final Optional<NsInstancesnsInstanceIdinstantiateAdditionalParamsForVnf> optional = additionalParamsForVnfList
- .stream().filter(entry -> vnfPkgId.equals(entry.getVnfProfileId())).findFirst();
-
- if (optional.isPresent()) {
- final NsInstancesnsInstanceIdinstantiateAdditionalParamsForVnf additionalParamsForVnf = optional.get();
- @SuppressWarnings("unchecked")
- final Map<String, Object> additionalParams =
- (Map<String, Object>) additionalParamsForVnf.getAdditionalParams();
- final String vimId = (String) additionalParams.get("vim_id");
- if (vimId != null) {
- final String[] splitString = vimId.split("_");
- if (splitString.length == 3) {
- logger.info("Found Tenant in instantiateNsRequest using vnfPkgId: {}", vnfPkgId);
- return Optional.of(new Tenant().cloudOwner(splitString[0]).regionName(splitString[1])
- .tenantId(splitString[2]));
- }
-
- }
- }
-
- logger.error("Unable to find Tenant in instantiateNsRequest using vnfPkgId: {}", vnfPkgId);
+ logger.error("Unable to find Tenant in additionalParams: {}", additionalParams);
return Optional.empty();
}
- @SuppressWarnings("unchecked")
- private Map<String, String> getAdditionalParams(final String vnfPkgId,
+ private Optional<NsInstancesnsInstanceIdinstantiateAdditionalParamsForVnf> getAdditionalParamsForVnf(
+ final String vnfdId,
final List<NsInstancesnsInstanceIdinstantiateAdditionalParamsForVnf> additionalParamsForVnfList) {
-
- final Optional<NsInstancesnsInstanceIdinstantiateAdditionalParamsForVnf> optional = additionalParamsForVnfList
- .stream().filter(entry -> vnfPkgId.equals(entry.getVnfProfileId())).findFirst();
-
+ final Optional<NsInstancesnsInstanceIdinstantiateAdditionalParamsForVnf> optional =
+ additionalParamsForVnfList.stream().filter(entry -> vnfdId.equals(entry.getVnfProfileId())).findFirst();
if (optional.isPresent()) {
- final NsInstancesnsInstanceIdinstantiateAdditionalParamsForVnf additionalParamsForVnf = optional.get();
- if (additionalParamsForVnf instanceof Map) {
- logger.info("Found AdditionalParams in instantiateNsRequest using vnfPkgId: {}", vnfPkgId);
- return (Map<String, String>) additionalParamsForVnf.getAdditionalParams();
- }
- }
-
- return Collections.emptyMap();
+ logger.info("Found AdditionalParamsForVnf in instantiateNsRequest using vnfdId: {}", vnfdId);
+ }
+ return optional;
}
}
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/tasks/MonitorSol003AdapterNodeTask.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/tasks/MonitorSol003AdapterNodeTask.java
index e4dc3d5e07..001c369801 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/tasks/MonitorSol003AdapterNodeTask.java
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/tasks/MonitorSol003AdapterNodeTask.java
@@ -37,7 +37,7 @@ public abstract class MonitorSol003AdapterNodeTask extends AbstractNetworkServic
private static final Logger LOGGER = LoggerFactory.getLogger(MonitorSol003AdapterNodeTask.class);
private final AaiServiceProvider aaiServiceProvider;
- public MonitorSol003AdapterNodeTask(final DatabaseServiceProvider databaseServiceProvider,
+ protected MonitorSol003AdapterNodeTask(final DatabaseServiceProvider databaseServiceProvider,
final AaiServiceProvider aaiServiceProvider) {
super(databaseServiceProvider);
this.aaiServiceProvider = aaiServiceProvider;
@@ -56,7 +56,7 @@ public abstract class MonitorSol003AdapterNodeTask extends AbstractNetworkServic
LOGGER.debug("Query A&AI for generic VNF using vnfID: {}", vnfId);
final Optional<GenericVnf> aaiGenericVnfOptional = aaiServiceProvider.getGenericVnf(vnfId);
- if (!aaiGenericVnfOptional.isPresent()) {
+ if (aaiGenericVnfOptional.isEmpty()) {
abortOperation(execution, "Unable to find generic vnf in A&AI using vnfId" + vnfId);
}
final GenericVnf genericVnf = aaiGenericVnfOptional.get();
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/tasks/TerminateNsTask.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/tasks/TerminateNsTask.java
index 972e4d6de8..c0d1df8c50 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/tasks/TerminateNsTask.java
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/tasks/TerminateNsTask.java
@@ -22,7 +22,6 @@ package org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.tasks;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.CamundaVariableNameConstants;
import org.onap.so.etsi.nfvo.ns.lcm.database.beans.NfvoNfInst;
-import org.onap.so.etsi.nfvo.ns.lcm.database.beans.NfvoNsInst;
import org.onap.so.etsi.nfvo.ns.lcm.database.beans.State;
import org.onap.so.etsi.nfvo.ns.lcm.database.service.DatabaseServiceProvider;
import org.slf4j.Logger;
@@ -110,34 +109,24 @@ public class TerminateNsTask extends AbstractNetworkServiceTask {
final String nsInstId = (String) execution.getVariable(NS_INSTANCE_ID_PARAM_NAME);
final List<NfvoNfInst> nfInstances = databaseServiceProvider.getNfvoNfInstByNsInstId(nsInstId);
if (nfInstances != null) {
- nfInstances.stream().forEach(instance -> {
- logger.info("Current status {} of vnf: {}", instance.getStatus(), instance.getName());
- });
+ nfInstances.stream().forEach(
+ instance -> logger.info("Current status {} of vnf: {}", instance.getStatus(), instance.getName()));
}
}
- private void updateNsInstanceStatus(final DelegateExecution execution, final State nsStatus) {
- final NfvoNsInst nfvoNsInst = getNfvoNsInst(execution);
- logger.info("Updating NfvoNsInst Status to {} and saving to DB", nsStatus);
- nfvoNsInst.setStatus(nsStatus);
- databaseServiceProvider.saveNfvoNsInst(nfvoNsInst);
- }
-
private List<String> getNfvoNfInstIds(final DelegateExecution execution) {
final String nsInstId = (String) execution.getVariable(NS_INSTANCE_ID_PARAM_NAME);
logger.info("Getting NfvoNfInstList using nsInstId: {}", nsInstId);
final List<NfvoNfInst> nfvoNfInstList = databaseServiceProvider.getNfvoNfInstByNsInstId(nsInstId);
- if (nfvoNfInstList.size() == 0) {
+ if (nfvoNfInstList == null || nfvoNfInstList.isEmpty()) {
final String message = "Unable to find NF Instances in database using id: " + nsInstId;
abortOperation(execution, message);
}
final List<String> vnfIdsList = new ArrayList<>();
- nfvoNfInstList.stream().forEach(nfvoNfInst -> {
- vnfIdsList.add(nfvoNfInst.getNfInstId());
- });
+ nfvoNfInstList.stream().forEach(nfvoNfInst -> vnfIdsList.add(nfvoNfInst.getNfInstId()));
return vnfIdsList;
}
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/tasks/TerminateVnfTask.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/tasks/TerminateVnfTask.java
index 15eee22dd2..049a6f38b0 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/tasks/TerminateVnfTask.java
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/tasks/TerminateVnfTask.java
@@ -19,6 +19,13 @@
*/
package org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.tasks;
+import static org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.CamundaVariableNameConstants.DELETE_VNF_RESPONSE_PARAM_NAME;
+import static org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.CamundaVariableNameConstants.NF_INST_ID_PARAM_NAME;
+import static org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.CamundaVariableNameConstants.TERMINATE_VNF_VNFID_PARAM_NAME;
+import static org.onap.so.etsi.nfvo.ns.lcm.database.beans.JobStatusEnum.ERROR;
+import static org.onap.so.etsi.nfvo.ns.lcm.database.beans.JobStatusEnum.FINISHED;
+import static org.onap.so.etsi.nfvo.ns.lcm.database.beans.JobStatusEnum.IN_PROGRESS;
+import java.util.Optional;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.onap.so.adapters.etsisol003adapter.lcm.v1.model.DeleteVnfResponse;
import org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.extclients.aai.AaiServiceProvider;
@@ -31,13 +38,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
-import java.util.Optional;
-import static org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.CamundaVariableNameConstants.NF_INST_ID_PARAM_NAME;
-import static org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.CamundaVariableNameConstants.DELETE_VNF_RESPONSE_PARAM_NAME;
-import static org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.CamundaVariableNameConstants.TERMINATE_VNF_VNFID_PARAM_NAME;
-import static org.onap.so.etsi.nfvo.ns.lcm.database.beans.JobStatusEnum.ERROR;
-import static org.onap.so.etsi.nfvo.ns.lcm.database.beans.JobStatusEnum.FINISHED;
-import static org.onap.so.etsi.nfvo.ns.lcm.database.beans.JobStatusEnum.IN_PROGRESS;
/**
* @author Andrew Lamb (andrew.a.lamb@est.tech)
@@ -63,7 +63,7 @@ public class TerminateVnfTask extends AbstractNetworkServiceTask {
logger.info("vnfId: {}", vnfId);
execution.setVariable(NF_INST_ID_PARAM_NAME, vnfId);
- setJobStatus(execution, JobStatusEnum.IN_PROGRESS,
+ addJobStatus(execution, JobStatusEnum.IN_PROGRESS,
"Checking if VNF Instance with id: " + vnfId + " exists in database.");
if (!databaseServiceProvider.isNfInstExists(vnfId)) {
abortOperation(execution,
@@ -78,7 +78,7 @@ public class TerminateVnfTask extends AbstractNetworkServiceTask {
final String vnfId = (String) execution.getVariable(TERMINATE_VNF_VNFID_PARAM_NAME);
try {
- setJobStatus(execution, IN_PROGRESS, "Invoking SOL003 adapter for terminating VNF with vnfId: " + vnfId);
+ addJobStatus(execution, IN_PROGRESS, "Invoking SOL003 adapter for terminating VNF with vnfId: " + vnfId);
final Optional<DeleteVnfResponse> optional = sol003AdapterServiceProvider.invokeTerminationRequest(vnfId);
@@ -92,7 +92,7 @@ public class TerminateVnfTask extends AbstractNetworkServiceTask {
logger.info("Vnf delete response: {}", vnfResponse);
execution.setVariable(DELETE_VNF_RESPONSE_PARAM_NAME, vnfResponse);
- setJobStatus(execution, IN_PROGRESS, "Successfully invoked SOL003 adapter terminate VNF with vnfId: "
+ addJobStatus(execution, IN_PROGRESS, "Successfully invoked SOL003 adapter terminate VNF with vnfId: "
+ vnfId + " DeleteVnfResponse Job Id: " + vnfResponse.getJobId());
logger.debug("Finished executing invokeTerminateRequest ...");
} catch (final Exception exception) {
@@ -108,7 +108,7 @@ public class TerminateVnfTask extends AbstractNetworkServiceTask {
final String vnfId = (String) execution.getVariable(TERMINATE_VNF_VNFID_PARAM_NAME);
try {
- setJobStatus(execution, IN_PROGRESS, "Deleting GenericVnf record from AAI for vnfId: " + vnfId);
+ addJobStatus(execution, IN_PROGRESS, "Deleting GenericVnf record from AAI for vnfId: " + vnfId);
aaiServiceProvider.deleteGenericVnf(vnfId);
} catch (final Exception exception) {
@@ -124,10 +124,10 @@ public class TerminateVnfTask extends AbstractNetworkServiceTask {
logger.info("Executing deleteNfInstanceFromDb");
final String vnfId = (String) execution.getVariable(TERMINATE_VNF_VNFID_PARAM_NAME);
- setJobStatus(execution, IN_PROGRESS, "Deleting NF Instance record from Database for vnfId: " + vnfId);
+ addJobStatus(execution, IN_PROGRESS, "Deleting NF Instance record from Database for vnfId: " + vnfId);
databaseServiceProvider.deleteNfvoNfInst(vnfId);
- setJobStatus(execution, FINISHED, "Successfully finished terminating VNF with vnfId: " + vnfId);
+ addJobStatus(execution, FINISHED, "Successfully finished terminating VNF with vnfId: " + vnfId);
logger.info("Finished executing deleteNfInstanceFromDb ...");
}
@@ -136,7 +136,7 @@ public class TerminateVnfTask extends AbstractNetworkServiceTask {
updateNfInstanceStatus(execution, State.TERMINATING);
final String vnfId = (String) execution.getVariable(TERMINATE_VNF_VNFID_PARAM_NAME);
- setJobStatus(execution, IN_PROGRESS,
+ addJobStatus(execution, IN_PROGRESS,
"Terminating VNF with vnfId: " + vnfId + " will set status to " + State.TERMINATING);
logger.info("Finished executing updateNfInstanceStatusToTerminating ...");
@@ -148,7 +148,7 @@ public class TerminateVnfTask extends AbstractNetworkServiceTask {
updateNfInstanceStatus(execution, State.NOT_INSTANTIATED);
final String vnfId = (String) execution.getVariable(TERMINATE_VNF_VNFID_PARAM_NAME);
- setJobStatus(execution, IN_PROGRESS,
+ addJobStatus(execution, IN_PROGRESS,
"Successfully terminated VNF with vnfId: " + vnfId + " will set status to " + State.NOT_INSTANTIATED);
logger.info("Finished executing updateNfInstanceStatusToInstantiated ...");
@@ -160,7 +160,7 @@ public class TerminateVnfTask extends AbstractNetworkServiceTask {
updateNfInstanceStatus(execution, State.FAILED);
final String vnfId = (String) execution.getVariable(TERMINATE_VNF_VNFID_PARAM_NAME);
- setJobStatus(execution, ERROR,
+ addJobStatus(execution, ERROR,
"Failed to terminate VNF with vnfId: " + vnfId + " will set status to " + State.FAILED);
logger.info("Finished executing updateNfInstanceStatusToFailed ...");
@@ -174,9 +174,7 @@ public class TerminateVnfTask extends AbstractNetworkServiceTask {
if (optional.isEmpty()) {
final String message = "Unable to find NfvoNfInst record in database using vnfId: " + vnfId;
logger.error(message);
-
abortOperation(execution, message);
-
}
final NfvoNfInst nfvoNfInst = optional.get();
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/utils/LocalDateTimeTypeAdapter.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/utils/LocalDateTimeTypeAdapter.java
index 34959ee0f0..9f21d2b449 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/utils/LocalDateTimeTypeAdapter.java
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/utils/LocalDateTimeTypeAdapter.java
@@ -24,6 +24,7 @@ import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import com.google.gson.TypeAdapter;
import com.google.gson.stream.JsonReader;
+import com.google.gson.stream.JsonToken;
import com.google.gson.stream.JsonWriter;
/**
@@ -45,14 +46,14 @@ public class LocalDateTimeTypeAdapter extends TypeAdapter<LocalDateTime> {
@Override
public LocalDateTime read(final JsonReader in) throws IOException {
- switch (in.peek()) {
- case NULL:
- in.nextNull();
- return null;
- default:
- final String dateTime = in.nextString();
- return LocalDateTime.parse(dateTime, FORMATTER);
+ if (JsonToken.NULL == in.peek()) {
+ in.nextNull();
+ return null;
+
}
+ final String dateTime = in.nextString();
+ return LocalDateTime.parse(dateTime, FORMATTER);
+
}
}
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/resources/CreateNs.bpmn b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/resources/CreateNs.bpmn
index 815b76c907..4c24f91cf9 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/resources/CreateNs.bpmn
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/resources/CreateNs.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_1l4zor5" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.0.0">
+<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_1l4zor5" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.2.0">
<bpmn:process id="CreateNs" name="&#10;CreateNs" isExecutable="true">
<bpmn:startEvent id="StartEvent_1" name="Start Process">
<bpmn:outgoing>Flow_1tqn5q5</bpmn:outgoing>
@@ -102,7 +102,7 @@
<bpmn:sequenceFlow id="Flow_1rtsvpm" sourceRef="Activity_03ht66t" targetRef="Activity_1r4l8w8" />
</bpmn:process>
<bpmn:error id="Error_0s855yd" name="java.lang.Exception" errorCode="java.lang.Exception" />
- <bpmn:error id="Error_0rqvnym" name="CreateNsProcessingException" errorCode="CREATE_NS_PROCESSING_EXCEPTION" />
+ <bpmn:error id="Error_0rqvnym" name="NsWorkflowProcessingException" errorCode="CREATE_NS_WORKFLOW_PROCESSING_EXCEPTION" />
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="CreateNs">
<bpmndi:BPMNEdge id="Flow_1rtsvpm_di" bpmnElement="Flow_1rtsvpm">
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/resources/DeleteNs.bpmn b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/resources/DeleteNs.bpmn
new file mode 100644
index 0000000000..a6bb214440
--- /dev/null
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/resources/DeleteNs.bpmn
@@ -0,0 +1,260 @@
+<?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_1l4zor5" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.2.0">
+ <bpmn:process id="DeleteNs" name="DeleteNs" isExecutable="true">
+ <bpmn:startEvent id="StartEvent_1" name="Start Process">
+ <bpmn:outgoing>Flow_1tqn5q5</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:endEvent id="EndEvent_1" name="End Process">
+ <bpmn:incoming>Flow_0t87ov3</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="Flow_1tqn5q5" sourceRef="StartEvent_1" targetRef="Activity_15ksfz6" />
+ <bpmn:serviceTask id="Activity_15ksfz6" name="Set Job Status to STARTED" camunda:asyncBefore="true" camunda:expression="${DeleteNsTask.setJobStatusToStarted(execution)}">
+ <bpmn:incoming>Flow_1tqn5q5</bpmn:incoming>
+ <bpmn:outgoing>Flow_0fhodlp</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:serviceTask id="Activity_1r4l8w8" name="Set Job Status to FINISHED" camunda:expression="${DeleteNsTask.setJobStatusToFinished(execution)}">
+ <bpmn:incoming>Flow_1rtsvpm</bpmn:incoming>
+ <bpmn:outgoing>Flow_0t87ov3</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="Flow_0t87ov3" sourceRef="Activity_1r4l8w8" targetRef="EndEvent_1" />
+ <bpmn:subProcess id="Activity_06ko4e2" name="Error Handling" triggeredByEvent="true">
+ <bpmn:startEvent id="Event_1ibvrn2" name="error">
+ <bpmn:outgoing>Flow_0554tjv</bpmn:outgoing>
+ <bpmn:errorEventDefinition id="ErrorEventDefinition_0lc46mh" />
+ </bpmn:startEvent>
+ <bpmn:endEvent id="Event_02f7sr1" name="end">
+ <bpmn:incoming>Flow_04xvpee</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="Flow_0554tjv" sourceRef="Event_1ibvrn2" targetRef="Activity_1sj0nvr" />
+ <bpmn:serviceTask id="Activity_1sj0nvr" name="Set Job Status to ERROR" camunda:asyncBefore="true" camunda:expression="${DeleteNsTask.setJobStatusToError(execution)}">
+ <bpmn:incoming>Flow_0554tjv</bpmn:incoming>
+ <bpmn:outgoing>Flow_04xvpee</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="Flow_04xvpee" sourceRef="Activity_1sj0nvr" targetRef="Event_02f7sr1" />
+ </bpmn:subProcess>
+ <bpmn:subProcess id="Activity_1dx9fz6" name="Java Exception Handling" triggeredByEvent="true">
+ <bpmn:startEvent id="Event_0zne7ch" name="error">
+ <bpmn:outgoing>Flow_0j1otrx</bpmn:outgoing>
+ <bpmn:errorEventDefinition id="ErrorEventDefinition_1p3h4ta" errorRef="Error_0rqvnym" camunda:errorCodeVariable="BPMN_javaExpCode" camunda:errorMessageVariable="BPMN_javaExpMsg" />
+ </bpmn:startEvent>
+ <bpmn:endEvent id="Event_0bcyh7u">
+ <bpmn:incoming>Flow_0oqv7vl</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="Flow_0j1otrx" sourceRef="Event_0zne7ch" targetRef="Activity_15uwy90" />
+ <bpmn:serviceTask id="Activity_15uwy90" name="Set Job Status to ERROR" camunda:asyncBefore="true" camunda:expression="${DeleteNsTask.setJobStatusToError(execution)}">
+ <bpmn:incoming>Flow_0j1otrx</bpmn:incoming>
+ <bpmn:outgoing>Flow_0oqv7vl</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="Flow_0oqv7vl" sourceRef="Activity_15uwy90" targetRef="Event_0bcyh7u" />
+ </bpmn:subProcess>
+ <bpmn:serviceTask id="Activity_0vlb2nk" name="Check NS Instance exists In DB " camunda:expression="${DeleteNsTask.checkIfNsInstanceExistsInDb(execution)}">
+ <bpmn:incoming>Flow_0fhodlp</bpmn:incoming>
+ <bpmn:outgoing>Flow_1duwqzf</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:serviceTask id="Activity_09tqz8x" name="Check that NS Instance in DB is in NOT_INSTANTIATED state" camunda:expression="${DeleteNsTask.checkthatNsInstanceInDbIsInNotInstantiatedState(execution)}">
+ <bpmn:incoming>Flow_02g3nbb</bpmn:incoming>
+ <bpmn:outgoing>Flow_1ihvsfs</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:serviceTask id="Activity_03ht66t" name="Delete NS Instance from DB" camunda:expression="${DeleteNsTask.deleteNsInstanceFromDb(execution)}">
+ <bpmn:incoming>Flow_04wub0a</bpmn:incoming>
+ <bpmn:outgoing>Flow_1rtsvpm</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="Flow_1rtsvpm" sourceRef="Activity_03ht66t" targetRef="Activity_1r4l8w8" />
+ <bpmn:sequenceFlow id="Flow_0fhodlp" sourceRef="Activity_15ksfz6" targetRef="Activity_0vlb2nk" />
+ <bpmn:sequenceFlow id="Flow_1duwqzf" sourceRef="Activity_0vlb2nk" targetRef="Gateway_1tjajb0" />
+ <bpmn:sequenceFlow id="Flow_1ihvsfs" sourceRef="Activity_09tqz8x" targetRef="Gateway_1voek52" />
+ <bpmn:serviceTask id="Activity_1rrzri0" name="Delete NS Instance from AAI" camunda:expression="${DeleteNsTask.deleteNsInstanceFromAai(execution)}">
+ <bpmn:incoming>Flow_1buncqe</bpmn:incoming>
+ <bpmn:outgoing>Flow_04wub0a</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="Flow_04wub0a" sourceRef="Activity_1rrzri0" targetRef="Activity_03ht66t" />
+ <bpmn:exclusiveGateway id="Gateway_1tjajb0" name="Does NS Instance Exist?">
+ <bpmn:incoming>Flow_1duwqzf</bpmn:incoming>
+ <bpmn:outgoing>Flow_02g3nbb</bpmn:outgoing>
+ <bpmn:outgoing>Flow_1swnlzf</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:sequenceFlow id="Flow_02g3nbb" name="Yes" sourceRef="Gateway_1tjajb0" targetRef="Activity_09tqz8x">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{nsInstanceExists}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:exclusiveGateway id="Gateway_1voek52" name="Is NS Instance in NOT INSTANTIATED State?">
+ <bpmn:incoming>Flow_1ihvsfs</bpmn:incoming>
+ <bpmn:outgoing>Flow_1buncqe</bpmn:outgoing>
+ <bpmn:outgoing>Flow_1eozcur</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:sequenceFlow id="Flow_1buncqe" name="Yes" sourceRef="Gateway_1voek52" targetRef="Activity_1rrzri0">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{isInNotInstantiatedState}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:endEvent id="Event_0dqc93c">
+ <bpmn:incoming>Flow_1swnlzf</bpmn:incoming>
+ <bpmn:incoming>Flow_1eozcur</bpmn:incoming>
+ <bpmn:errorEventDefinition id="ErrorEventDefinition_0pfrgad" errorRef="Error_0rqvnym" />
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="Flow_1swnlzf" name="No" sourceRef="Gateway_1tjajb0" targetRef="Event_0dqc93c">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{not nsInstanceExists}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="Flow_1eozcur" name="No" sourceRef="Gateway_1voek52" targetRef="Event_0dqc93c">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{not isInNotInstantiatedState}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ </bpmn:process>
+ <bpmn:error id="Error_0s855yd" name="java.lang.Exception" errorCode="java.lang.Exception" />
+ <bpmn:error id="Error_0rqvnym" name="NsWorkflowProcessingException" errorCode="DELETE_NS_WORKFLOW_PROCESSING_EXCEPTION" />
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DeleteNs">
+ <bpmndi:BPMNEdge id="Flow_1eozcur_di" bpmnElement="Flow_1eozcur">
+ <di:waypoint x="830" y="192" />
+ <di:waypoint x="830" y="270" />
+ <di:waypoint x="708" y="270" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="843" y="228" width="14" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_1swnlzf_di" bpmnElement="Flow_1swnlzf">
+ <di:waypoint x="550" y="192" />
+ <di:waypoint x="550" y="270" />
+ <di:waypoint x="672" y="270" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="558" y="228" width="14" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_1buncqe_di" bpmnElement="Flow_1buncqe">
+ <di:waypoint x="855" y="167" />
+ <di:waypoint x="960" y="167" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="890" y="149" width="19" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_02g3nbb_di" bpmnElement="Flow_02g3nbb">
+ <di:waypoint x="575" y="167" />
+ <di:waypoint x="640" y="167" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="598" y="149" width="19" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_04wub0a_di" bpmnElement="Flow_04wub0a">
+ <di:waypoint x="1060" y="167" />
+ <di:waypoint x="1100" y="167" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_1ihvsfs_di" bpmnElement="Flow_1ihvsfs">
+ <di:waypoint x="740" y="167" />
+ <di:waypoint x="805" y="167" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_1duwqzf_di" bpmnElement="Flow_1duwqzf">
+ <di:waypoint x="490" y="167" />
+ <di:waypoint x="525" y="167" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_0fhodlp_di" bpmnElement="Flow_0fhodlp">
+ <di:waypoint x="350" y="167" />
+ <di:waypoint x="390" y="167" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_1rtsvpm_di" bpmnElement="Flow_1rtsvpm">
+ <di:waypoint x="1200" y="167" />
+ <di:waypoint x="1240" y="167" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_0t87ov3_di" bpmnElement="Flow_0t87ov3">
+ <di:waypoint x="1340" y="167" />
+ <di:waypoint x="1382" y="167" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_1tqn5q5_di" bpmnElement="Flow_1tqn5q5">
+ <di:waypoint x="208" y="167" />
+ <di:waypoint x="250" y="167" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
+ <dc:Bounds x="172" y="149" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="158" y="192" width="67" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Event_0db1w1a_di" bpmnElement="EndEvent_1">
+ <dc:Bounds x="1382" y="149" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1369" y="192" width="63" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_15ksfz6_di" bpmnElement="Activity_15ksfz6">
+ <dc:Bounds x="250" y="127" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_1r4l8w8_di" bpmnElement="Activity_1r4l8w8">
+ <dc:Bounds x="1240" y="127" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_06ko4e2_di" bpmnElement="Activity_06ko4e2" isExpanded="true">
+ <dc:Bounds x="431" y="360" width="438" height="130" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="Flow_04xvpee_di" bpmnElement="Flow_04xvpee">
+ <di:waypoint x="681" y="423" />
+ <di:waypoint x="813" y="423" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_0554tjv_di" bpmnElement="Flow_0554tjv">
+ <di:waypoint x="489" y="423" />
+ <di:waypoint x="581" y="423" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="Event_1ibvrn2_di" bpmnElement="Event_1ibvrn2">
+ <dc:Bounds x="453" y="405" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="459" y="448" width="24" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Event_02f7sr1_di" bpmnElement="Event_02f7sr1">
+ <dc:Bounds x="813" y="405" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="823" y="447" width="19" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_1sj0nvr_di" bpmnElement="Activity_1sj0nvr">
+ <dc:Bounds x="581" y="383" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_1dx9fz6_di" bpmnElement="Activity_1dx9fz6" isExpanded="true">
+ <dc:Bounds x="431" y="520" width="438" height="130" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="Flow_0oqv7vl_di" bpmnElement="Flow_0oqv7vl">
+ <di:waypoint x="680" y="583" />
+ <di:waypoint x="772" y="583" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_0j1otrx_di" bpmnElement="Flow_0j1otrx">
+ <di:waypoint x="522" y="583" />
+ <di:waypoint x="580" y="583" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="Event_0zne7ch_di" bpmnElement="Event_0zne7ch">
+ <dc:Bounds x="486" y="565" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="493" y="608" width="24" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Event_0bcyh7u_di" bpmnElement="Event_0bcyh7u">
+ <dc:Bounds x="772" y="565" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_15uwy90_di" bpmnElement="Activity_15uwy90">
+ <dc:Bounds x="580" y="543" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_0vlb2nk_di" bpmnElement="Activity_0vlb2nk">
+ <dc:Bounds x="390" y="127" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_09tqz8x_di" bpmnElement="Activity_09tqz8x">
+ <dc:Bounds x="640" y="127" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_03ht66t_di" bpmnElement="Activity_03ht66t">
+ <dc:Bounds x="1100" y="127" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_1rrzri0_di" bpmnElement="Activity_1rrzri0">
+ <dc:Bounds x="960" y="127" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Gateway_1tjajb0_di" bpmnElement="Gateway_1tjajb0" isMarkerVisible="true">
+ <dc:Bounds x="525" y="142" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="505" y="106" width="89" height="27" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Gateway_1voek52_di" bpmnElement="Gateway_1voek52" isMarkerVisible="true">
+ <dc:Bounds x="805" y="142" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="791" y="83" width="79" height="53" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Event_029a1ih_di" bpmnElement="Event_0dqc93c">
+ <dc:Bounds x="672" y="252" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="646" y="245" width="88" height="27" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/resources/InstantiateNs.bpmn b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/resources/InstantiateNs.bpmn
index ba9e641d84..bc34c144c9 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/resources/InstantiateNs.bpmn
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/resources/InstantiateNs.bpmn
@@ -133,7 +133,7 @@
</bpmn:serviceTask>
<bpmn:sequenceFlow id="Flow_1i36dw4" sourceRef="Activity_0gkpdft" targetRef="Activity_1w09i1k" />
</bpmn:process>
- <bpmn:error id="Error_0jsct8p" name="InstantiateNsProcessingException" errorCode="INSTANTIATE_NS_PROCESSING_EXCEPTION" />
+ <bpmn:error id="Error_0jsct8p" name="NsWorkflowProcessingException" errorCode="INSTANTIATE_NS_WORKFLOW_PROCESSING_EXCEPTION" />
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="InstantiateNs">
<bpmndi:BPMNEdge id="Flow_1p21p1m_di" bpmnElement="Flow_1p21p1m">
@@ -328,4 +328,4 @@
</bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
-</bpmn:definitions>
+</bpmn:definitions> \ No newline at end of file
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/resources/TerminateNs.bpmn b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/resources/TerminateNs.bpmn
index 36c52c8ad6..e971f6acf0 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/resources/TerminateNs.bpmn
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/resources/TerminateNs.bpmn
@@ -123,7 +123,7 @@
</bpmn:serviceTask>
<bpmn:sequenceFlow id="Flow_1i36dw4" sourceRef="Activity_0gkpdft" targetRef="Activity_1w09i1k" />
</bpmn:process>
- <bpmn:error id="Error_0jsct8p" name="TerminateNsProcessingException" errorCode="TERMINATE_NS_PROCESSING_EXCEPTION" />
+ <bpmn:error id="Error_0jsct8p" name="NsWorkflowProcessingException" errorCode="TERMINATE_NS_WORKFLOW_PROCESSING_EXCEPTION" />
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="TerminateNs">
<bpmndi:BPMNEdge id="Flow_1i36dw4_di" bpmnElement="Flow_1i36dw4">
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/BaseTest.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/BaseTest.java
index 86f2879966..b6fd9e407a 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/BaseTest.java
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/BaseTest.java
@@ -147,4 +147,9 @@ public abstract class BaseTest {
return runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult() == null;
}
+ protected String getAaiServiceInstanceEndPoint() {
+ return "/aai/v[0-9]+/business/customers/customer/" + GLOBAL_CUSTOMER_ID
+ + "/service-subscriptions/service-subscription/" + SERVICE_TYPE
+ + "/service-instances/service-instance/.*";
+ }
}
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/PojoClassesTests.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/PojoClassesTests.java
new file mode 100644
index 0000000000..edfb20afd2
--- /dev/null
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/PojoClassesTests.java
@@ -0,0 +1,63 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows;
+
+import java.util.Arrays;
+import java.util.List;
+import org.junit.Test;
+import org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.nsd.FileEntry;
+import org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.nsd.NetworkServiceDescriptor;
+import org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.nsd.ToscaMetadata;
+import org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.nsd.VirtualNetworkFunction;
+import org.onap.so.openpojo.rules.ToStringTester;
+import com.openpojo.reflection.filters.FilterPackageInfo;
+import com.openpojo.validation.Validator;
+import com.openpojo.validation.ValidatorBuilder;
+import com.openpojo.validation.test.impl.GetterTester;
+import com.openpojo.validation.test.impl.SetterTester;
+import nl.jqno.equalsverifier.EqualsVerifier;
+import nl.jqno.equalsverifier.Warning;
+
+/**
+ * @author Waqas Ikram (waqas.ikram@est.tech)
+ *
+ */
+public class PojoClassesTests {
+
+ @Test
+ public void test_nsd_parser_pojo_classes() throws ClassNotFoundException {
+
+ final Validator validator = ValidatorBuilder.create().with(new SetterTester()).with(new GetterTester())
+ .with(new ToStringTester()).build();
+ validator.validate(FileEntry.class.getPackageName(), new FilterPackageInfo());
+ }
+
+
+ @Test
+ public void test_nsd_parser_pojo_classes_equalAndHashMethod() throws ClassNotFoundException {
+ final List<Class<?>> classes = Arrays.asList(FileEntry.class, NetworkServiceDescriptor.class,
+ ToscaMetadata.class, VirtualNetworkFunction.class);
+ for (final Class<?> clazz : classes) {
+ EqualsVerifier.forClass(clazz).suppress(Warning.STRICT_INHERITANCE, Warning.NONFINAL_FIELDS,
+ Warning.INHERITED_DIRECTLY_FROM_OBJECT).verify();
+ }
+ }
+
+}
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/nsd/NetworkServiceDescriptorParserTest.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/nsd/parser/NetworkServiceDescriptorParserTest.java
index 2bebf1c30a..4a8c715e5c 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/nsd/NetworkServiceDescriptorParserTest.java
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/nsd/parser/NetworkServiceDescriptorParserTest.java
@@ -17,7 +17,7 @@
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-package org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.nsd;
+package org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.nsd.parser;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -31,6 +31,8 @@ import java.util.Optional;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.TestApplication;
+import org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.nsd.NetworkServiceDescriptor;
+import org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.nsd.parser.NetworkServiceDescriptorParser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/java/org/onap/so/etsi/nfvo/ns/workflow/engine/tasks/CreateNsTaskTest.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/java/org/onap/so/etsi/nfvo/ns/workflow/engine/tasks/CreateNsTaskTest.java
index 05213a344f..3686cd620d 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/java/org/onap/so/etsi/nfvo/ns/workflow/engine/tasks/CreateNsTaskTest.java
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/java/org/onap/so/etsi/nfvo/ns/workflow/engine/tasks/CreateNsTaskTest.java
@@ -234,7 +234,7 @@ public class CreateNsTaskTest extends BaseTest {
assertNull(nsResponseVariable);
final HistoricVariableInstance workflowExceptionVariable = getVariable(processInstance.getProcessInstanceId(),
- CamundaVariableNameConstants.CREATE_NS_WORKFLOW_PROCESSING_EXCEPTION_PARAM_NAME);
+ CamundaVariableNameConstants.NS_WORKFLOW_PROCESSING_EXCEPTION_PARAM_NAME);
final InlineResponse400 problemDetails = (InlineResponse400) workflowExceptionVariable.getValue();
assertNotNull(problemDetails);
@@ -306,7 +306,7 @@ public class CreateNsTaskTest extends BaseTest {
mockEtsiCatalogEndpoints(nsdId);
- final String modelEndpoint = getAiaServiceInstancelEndPoint(createNsRequest);
+ final String modelEndpoint = getAaiServiceInstanceEndPoint();
wireMockServer.stubFor(put(urlMatching(modelEndpoint)).willReturn(WireMock.serverError()));
wireMockServer.stubFor(get(urlMatching(modelEndpoint)).willReturn(WireMock.serverError()));
@@ -339,18 +339,12 @@ public class CreateNsTaskTest extends BaseTest {
}
private void mockAAIEndpoints(final CreateNsRequest createNsRequest) {
- final String modelEndpoint = getAiaServiceInstancelEndPoint(createNsRequest);
+ final String modelEndpoint = getAaiServiceInstanceEndPoint();
wireMockServer.stubFor(put(urlMatching(modelEndpoint)).willReturn(ok()));
wireMockServer.stubFor(get(urlMatching(modelEndpoint)).willReturn(notFound()));
}
- private String getAiaServiceInstancelEndPoint(final CreateNsRequest createNsRequest) {
- return "/aai/v[0-9]+/business/customers/customer/" + GLOBAL_CUSTOMER_ID
- + "/service-subscriptions/service-subscription/" + SERVICE_TYPE
- + "/service-instances/service-instance/.*";
- }
-
private void mockEtsiCatalogEndpoints(final String nsdId) {
mockRestServiceServer.expect(requestTo(ETSI_CATALOG_URL + "/nsd/v1/ns_descriptors/" + nsdId))
.andExpect(method(HttpMethod.GET))
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/java/org/onap/so/etsi/nfvo/ns/workflow/engine/tasks/DeleteNsTaskTest.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/java/org/onap/so/etsi/nfvo/ns/workflow/engine/tasks/DeleteNsTaskTest.java
new file mode 100644
index 0000000000..adb8a9e69b
--- /dev/null
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/java/org/onap/so/etsi/nfvo/ns/workflow/engine/tasks/DeleteNsTaskTest.java
@@ -0,0 +1,185 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.etsi.nfvo.ns.workflow.engine.tasks;
+
+import com.google.gson.Gson;
+import org.camunda.bpm.engine.history.HistoricProcessInstance;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.BaseTest;
+import org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.GsonProvider;
+import org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.exceptions.NsRequestProcessingException;
+import org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.service.JobExecutorService;
+import org.onap.so.etsi.nfvo.ns.lcm.database.beans.NfvoJob;
+import org.onap.so.etsi.nfvo.ns.lcm.database.beans.NfvoNsInst;
+import org.onap.so.etsi.nfvo.ns.lcm.database.beans.State;
+import org.springframework.beans.factory.annotation.Autowired;
+import java.time.LocalDateTime;
+import java.util.Optional;
+import java.util.UUID;
+import static com.github.tomakehurst.wiremock.client.WireMock.delete;
+import static com.github.tomakehurst.wiremock.client.WireMock.get;
+import static com.github.tomakehurst.wiremock.client.WireMock.ok;
+import static com.github.tomakehurst.wiremock.client.WireMock.okJson;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+/**
+ * @author Andrew Lamb (andrew.a.lamb@est.tech)
+ *
+ */
+public class DeleteNsTaskTest extends BaseTest {
+
+ @Autowired
+ private JobExecutorService objUnderTest;
+
+ @Autowired
+ private GsonProvider gsonProvider;
+
+ @Rule
+ public ExpectedException expectedException = ExpectedException.none();
+
+ private Gson gson;
+
+ @Before
+ public void before() {
+ wireMockServer.resetAll();
+ gson = gsonProvider.getGson();
+ }
+
+ @After
+ public void after() {
+ wireMockServer.resetAll();
+ }
+
+ @Test
+ public void testRunDeleteNsJob_nsInstanceIdNotInDatabase_throwsException() {
+ final String nsInstanceId = UUID.randomUUID().toString();
+ assertTrue(databaseServiceProvider.getNfvoNsInst(nsInstanceId).isEmpty());
+
+ expectedException.expect(NsRequestProcessingException.class);
+ objUnderTest.runDeleteNsJob(nsInstanceId);
+ }
+
+ @Test
+ public void testRunDeleteNsJob_nsInstanceStateInstantiated_throwsException() {
+ final String nsInstanceId = UUID.randomUUID().toString();
+ addDummyNsToDatabase(nsInstanceId, State.INSTANTIATED);
+
+ final Optional<NfvoNsInst> optionalNfvoNsInst = databaseServiceProvider.getNfvoNsInst(nsInstanceId);
+ assertTrue(optionalNfvoNsInst.isPresent());
+ assertEquals(State.INSTANTIATED, optionalNfvoNsInst.get().getStatus());
+
+ expectedException.expect(NsRequestProcessingException.class);
+ objUnderTest.runDeleteNsJob(nsInstanceId);
+ }
+
+ @Test
+ public void testRunDeleteNsJob_nsInstanceStateInstantiating_throwsException() {
+ final String nsInstanceId = UUID.randomUUID().toString();
+ addDummyNsToDatabase(nsInstanceId, State.INSTANTIATING);
+
+ final Optional<NfvoNsInst> optionalNfvoNsInst = databaseServiceProvider.getNfvoNsInst(nsInstanceId);
+ assertTrue(optionalNfvoNsInst.isPresent());
+ assertEquals(State.INSTANTIATING, optionalNfvoNsInst.get().getStatus());
+
+ expectedException.expect(NsRequestProcessingException.class);
+ objUnderTest.runDeleteNsJob(nsInstanceId);
+ }
+
+ @Test
+ public void testRunDeleteNsJob_nsInstanceStateTerminating_throwsException() {
+ final String nsInstanceId = UUID.randomUUID().toString();
+ addDummyNsToDatabase(nsInstanceId, State.TERMINATING);
+
+ final Optional<NfvoNsInst> optionalNfvoNsInst = databaseServiceProvider.getNfvoNsInst(nsInstanceId);
+ assertTrue(optionalNfvoNsInst.isPresent());
+ assertEquals(State.TERMINATING, optionalNfvoNsInst.get().getStatus());
+
+ expectedException.expect(NsRequestProcessingException.class);
+ objUnderTest.runDeleteNsJob(nsInstanceId);
+ }
+
+ @Test
+ public void testRunDeleteNsJob_nsInstanceStateFailed_throwsException() {
+ final String nsInstanceId = UUID.randomUUID().toString();
+ addDummyNsToDatabase(nsInstanceId, State.FAILED);
+
+ final Optional<NfvoNsInst> optionalNfvoNsInst = databaseServiceProvider.getNfvoNsInst(nsInstanceId);
+ assertTrue(optionalNfvoNsInst.isPresent());
+ assertEquals(State.FAILED, optionalNfvoNsInst.get().getStatus());
+
+ expectedException.expect(NsRequestProcessingException.class);
+ objUnderTest.runDeleteNsJob(nsInstanceId);
+ }
+
+ @Test
+ public void testRunDeleteNsJob_SuccessfulCase() throws InterruptedException {
+ final String nsInstanceId = UUID.randomUUID().toString();
+ addDummyNsToDatabase(nsInstanceId, State.NOT_INSTANTIATED);
+ mockAaiEndpoints();
+
+ final Optional<NfvoNsInst> optionalNfvoNsInst = databaseServiceProvider.getNfvoNsInst(nsInstanceId);
+ assertTrue(optionalNfvoNsInst.isPresent());
+ assertEquals(State.NOT_INSTANTIATED, optionalNfvoNsInst.get().getStatus());
+
+ objUnderTest.runDeleteNsJob(nsInstanceId);
+
+ final Optional<NfvoJob> optional = getJobByResourceId(nsInstanceId);
+ assertTrue(optional.isPresent());
+ final NfvoJob nfvoJob = optional.get();
+
+ // Confirm Process finishes in STATE_COMPLETED
+ assertTrue(waitForProcessInstanceToFinish(nfvoJob.getProcessInstanceId()));
+ final HistoricProcessInstance historicProcessInstance =
+ getHistoricProcessInstance(nfvoJob.getProcessInstanceId());
+ assertNotNull(historicProcessInstance);
+ assertEquals(HistoricProcessInstance.STATE_COMPLETED, historicProcessInstance.getState());
+
+ // Confirm NS Instance no longer in database
+ final Optional<NfvoNsInst> optionalNfvoNsInstance = databaseServiceProvider.getNfvoNsInst(nsInstanceId);
+ assertTrue(optionalNfvoNsInstance.isEmpty());
+ }
+
+ private void addDummyNsToDatabase(final String nsInstanceId, final State state) {
+ final String nsPackageId = UUID.randomUUID().toString();
+ final NfvoNsInst nfvoNsInst = new NfvoNsInst().nsInstId(nsInstanceId).name("nsName").nsPackageId(nsPackageId)
+ .nsdId("nsdId").nsdInvariantId("nsdId").status(state).statusUpdatedTime(LocalDateTime.now())
+ .globalCustomerId(GLOBAL_CUSTOMER_ID).serviceType(SERVICE_TYPE);
+ databaseServiceProvider.saveNfvoNsInst(nfvoNsInst);
+ }
+
+ private void mockAaiEndpoints() {
+ final String modelEndpoint = getAaiServiceInstanceEndPoint();
+ final String resourceVersion = "12345";
+
+ final String body =
+ "{\"resource-version\": \"" + resourceVersion + "\",\n\"orchestration-status\": \"Assigned\"}";
+ wireMockServer.stubFor(get(urlMatching(modelEndpoint)).willReturn(ok()).willReturn(okJson(body)));
+
+ wireMockServer.stubFor(
+ delete(urlMatching(modelEndpoint + "\\?resource-version=" + resourceVersion)).willReturn(ok()));
+ }
+}
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/java/org/onap/so/etsi/nfvo/ns/workflow/engine/tasks/InstantiateNsTaskTest.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/java/org/onap/so/etsi/nfvo/ns/workflow/engine/tasks/InstantiateNsTaskTest.java
index 00e9433eac..f1373bd4ea 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/java/org/onap/so/etsi/nfvo/ns/workflow/engine/tasks/InstantiateNsTaskTest.java
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/java/org/onap/so/etsi/nfvo/ns/workflow/engine/tasks/InstantiateNsTaskTest.java
@@ -271,7 +271,7 @@ public class InstantiateNsTaskTest extends BaseTest {
for (final Entry<String, String> entry : VNFD_ID_TO_VNFPKG_ID_MAPPING.entrySet()) {
instantiateNsRequest
.addAdditionalParamsForVnfItem(new NsInstancesnsInstanceIdinstantiateAdditionalParamsForVnf()
- .vnfProfileId(entry.getValue()).additionalParams(additionalParams));
+ .vnfProfileId(entry.getKey()).additionalParams(additionalParams));
}
return instantiateNsRequest;
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/java/org/onap/so/etsi/nfvo/ns/workflow/engine/tasks/MonitorSol003AdapterCreateJobTaskTest.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/java/org/onap/so/etsi/nfvo/ns/workflow/engine/tasks/MonitorSol003AdapterCreateJobTaskTest.java
index ff5c2a9105..aa8d8cf10e 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/java/org/onap/so/etsi/nfvo/ns/workflow/engine/tasks/MonitorSol003AdapterCreateJobTaskTest.java
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/java/org/onap/so/etsi/nfvo/ns/workflow/engine/tasks/MonitorSol003AdapterCreateJobTaskTest.java
@@ -132,7 +132,7 @@ public class MonitorSol003AdapterCreateJobTaskTest extends BaseTest {
assertNull(nsResponseVariable);
final HistoricVariableInstance workflowExceptionVariable = getVariable(processInstance.getProcessInstanceId(),
- CamundaVariableNameConstants.CREATE_NS_WORKFLOW_PROCESSING_EXCEPTION_PARAM_NAME);
+ CamundaVariableNameConstants.NS_WORKFLOW_PROCESSING_EXCEPTION_PARAM_NAME);
final InlineResponse400 problemDetails = (InlineResponse400) workflowExceptionVariable.getValue();
assertNotNull(problemDetails);
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/java/org/onap/so/etsi/nfvo/ns/workflow/engine/tasks/TerminateNsTaskTest.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/java/org/onap/so/etsi/nfvo/ns/workflow/engine/tasks/TerminateNsTaskTest.java
index 14e5b1cafc..b821c85edd 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/java/org/onap/so/etsi/nfvo/ns/workflow/engine/tasks/TerminateNsTaskTest.java
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/java/org/onap/so/etsi/nfvo/ns/workflow/engine/tasks/TerminateNsTaskTest.java
@@ -75,15 +75,9 @@ import static org.springframework.test.web.client.response.MockRestResponseCreat
public class TerminateNsTaskTest extends BaseTest {
@Autowired
- @Qualifier(ETSI_CATALOG_REST_TEMPLATE_BEAN)
- private RestTemplate etsiCatalogRestTemplate;
-
- @Autowired
@Qualifier(SOL003_ADAPTER_REST_TEMPLATE_BEAN)
private RestTemplate sol003AdapterRestTemplate;
- private MockRestServiceServer mockEtsiCatalogRestServiceServer;
-
private MockRestServiceServer mockSol003AdapterRestServiceServer;
@Autowired
@@ -101,21 +95,14 @@ public class TerminateNsTaskTest extends BaseTest {
public void before() {
wireMockServer.resetAll();
gson = gsonProvider.getGson();
-
- mockEtsiCatalogRestServiceServer =
- MockRestServiceServer.bindTo(etsiCatalogRestTemplate).ignoreExpectOrder(true).build();
mockSol003AdapterRestServiceServer =
MockRestServiceServer.bindTo(sol003AdapterRestTemplate).ignoreExpectOrder(true).build();
-
- etsiCatalogRestTemplate.getMessageConverters().add(new GsonHttpMessageConverter(gson));
sol003AdapterRestTemplate.getMessageConverters().add(new GsonHttpMessageConverter(gson));
-
}
@After
public void after() {
wireMockServer.resetAll();
- mockEtsiCatalogRestServiceServer.reset();
}
@Test
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/pom.xml b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/pom.xml
index e0439073bb..cf852c14b0 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/pom.xml
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/pom.xml
@@ -31,5 +31,17 @@
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>nl.jqno.equalsverifier</groupId>
+ <artifactId>equalsverifier</artifactId>
+ <version>${equalsverifier-version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.so</groupId>
+ <artifactId>common</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
</project> \ No newline at end of file
diff --git a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/config/WebSecurityConfig.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/beans/CancelModeType.java
index dfb2b61978..627250535e 100644
--- a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/config/WebSecurityConfig.java
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/beans/CancelModeType.java
@@ -1,8 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2020 Huawei Technologies Co., Ltd. All rights reserved.
+ * Copyright (C) 2020 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,23 +13,16 @@
* 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.etsi.nfvo.ns.lcm.database.beans;
-package org.onap.so.adapters.nssmf.config;
-
-import org.springframework.context.annotation.Configuration;
-import org.springframework.security.config.annotation.web.builders.HttpSecurity;
-import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
-import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
-
-@EnableWebSecurity
-@Configuration
-public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
-
- @Override
- protected void configure(HttpSecurity http) throws Exception {
- http.csrf().disable();
- }
-
+/**
+ * @author Andrew Lamb (andrew.a.lamb@est.tech)
+ *
+ */
+public enum CancelModeType {
+ GRACEFUL, FORCEFUL;
}
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/beans/NfvoJob.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/beans/NfvoJob.java
index 9453caac9e..60b06e1061 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/beans/NfvoJob.java
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/beans/NfvoJob.java
@@ -42,24 +42,24 @@ import org.onap.so.etsi.nfvo.ns.lcm.database.beans.utils.Utils;
public class NfvoJob {
@Id
- @Column(name = "JOB_ID")
+ @Column(name = "JOB_ID", nullable = false)
private String jobId;
- @Column(name = "JOB_TYPE")
+ @Column(name = "JOB_TYPE", nullable = false)
private String jobType;
@Enumerated(EnumType.STRING)
- @Column(name = "JOB_ACTION")
+ @Column(name = "JOB_ACTION", nullable = false)
private JobAction jobAction;
- @Column(name = "RESOURCE_ID")
+ @Column(name = "RESOURCE_ID", nullable = false)
private String resourceId;
@Column(name = "RESOURCE_NAME")
private String resourceName;
@Enumerated(EnumType.STRING)
- @Column(name = "STATUS")
+ @Column(name = "STATUS", nullable = false)
private JobStatusEnum status;
@Column(name = "START_TIME")
@@ -238,14 +238,17 @@ public class NfvoJob {
@Override
public boolean equals(final Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null || getClass() != obj.getClass())
+ return false;
if (obj instanceof NfvoJob) {
final NfvoJob other = (NfvoJob) obj;
return Objects.equals(jobId, other.jobId) && Objects.equals(processInstanceId, other.processInstanceId)
&& Objects.equals(jobType, other.jobType) && Objects.equals(jobAction, other.jobAction)
&& Objects.equals(progress, other.progress) && Objects.equals(status, other.status)
&& Objects.equals(startTime, other.startTime) && Objects.equals(endTime, other.endTime)
- && Objects.equals(status, other.status) && Objects.equals(resourceId, other.resourceId)
- && Objects.equals(resourceName, other.resourceName)
+ && Objects.equals(resourceId, other.resourceId) && Objects.equals(resourceName, other.resourceName)
&& Utils.isEquals(nfvoJobStatuses, other.nfvoJobStatuses);
}
return false;
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/beans/NfvoJobStatus.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/beans/NfvoJobStatus.java
index 89e07701ed..66ae0e503c 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/beans/NfvoJobStatus.java
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/beans/NfvoJobStatus.java
@@ -44,17 +44,17 @@ public class NfvoJobStatus {
private int id;
@Enumerated(EnumType.STRING)
- @Column(name = "STATUS")
+ @Column(name = "STATUS", nullable = false)
private JobStatusEnum status;
@Column(name = "DESCRIPTION", columnDefinition = "LONGTEXT")
private String description;
- @Column(name = "UPDATED_TIME")
+ @Column(name = "UPDATED_TIME", nullable = false)
private LocalDateTime updatedTime;
@ManyToOne(fetch = FetchType.LAZY)
- @JoinColumn(name = "JOB_ID")
+ @JoinColumn(name = "JOB_ID", nullable = false)
private NfvoJob nfvoJob;
public int getId() {
@@ -116,17 +116,21 @@ public class NfvoJobStatus {
@Override
public int hashCode() {
- return Objects.hash(id, status, updatedTime, description, nfvoJob.getJobId());
+ return Objects.hash(id, status, updatedTime, description, nfvoJob != null ? nfvoJob.getJobId() : 0);
}
@Override
public boolean equals(final Object obj) {
-
+ if (this == obj)
+ return true;
+ if (obj == null || getClass() != obj.getClass())
+ return false;
if (obj instanceof NfvoJobStatus) {
final NfvoJobStatus other = (NfvoJobStatus) obj;
return Objects.equals(id, other.id) && Objects.equals(status, other.status)
&& Objects.equals(updatedTime, other.updatedTime) && Objects.equals(description, other.description)
- && Objects.equals(nfvoJob.getJobId(), other.nfvoJob.getJobId());
+ && (nfvoJob == null ? other.nfvoJob == null
+ : other.nfvoJob != null && Objects.equals(nfvoJob.getJobId(), other.nfvoJob.getJobId()));
}
return false;
}
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/beans/NfvoNfInst.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/beans/NfvoNfInst.java
index e901e10596..570355fb37 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/beans/NfvoNfInst.java
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/beans/NfvoNfInst.java
@@ -41,7 +41,7 @@ import javax.persistence.Table;
public class NfvoNfInst {
@Id
- @Column(name = "NF_INST_ID")
+ @Column(name = "NF_INST_ID", nullable = false)
private String nfInstId;
@Column(name = "NAME")
@@ -54,11 +54,11 @@ public class NfvoNfInst {
private String packageId;
@ManyToOne(fetch = FetchType.LAZY)
- @JoinColumn(name = "NS_INST_ID")
+ @JoinColumn(name = "NS_INST_ID", nullable = false)
private NfvoNsInst nsInst;
@Enumerated(EnumType.STRING)
- @Column(name = "STATUS")
+ @Column(name = "STATUS", nullable = false)
private State status;
@Column(name = "CREATE_TIME")
@@ -184,13 +184,15 @@ public class NfvoNfInst {
final NfvoNfInst that = (NfvoNfInst) object;
return Objects.equals(nfInstId, that.nfInstId) && Objects.equals(name, that.name)
&& Objects.equals(vnfdId, that.vnfdId) && Objects.equals(packageId, that.packageId)
- && Objects.equals(nsInst, that.nsInst) && Objects.equals(status, that.status)
- && Objects.equals(createTime, that.createTime) && Objects.equals(lastUpdateTime, that.lastUpdateTime);
+ && (nsInst == null ? that.nsInst == null : that.nsInst != null && Objects.equals(nsInst, that.nsInst))
+ && Objects.equals(status, that.status) && Objects.equals(createTime, that.createTime)
+ && Objects.equals(lastUpdateTime, that.lastUpdateTime);
}
@Override
public int hashCode() {
- return Objects.hash(nfInstId, name, vnfdId, packageId, nsInst, status, createTime, lastUpdateTime);
+ return Objects.hash(nfInstId, name, vnfdId, packageId, nsInst != null ? nsInst.getNsInstId() : 0, status,
+ createTime, lastUpdateTime);
}
@Override
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/beans/NfvoNsInst.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/beans/NfvoNsInst.java
index dd8448fe56..04f988c2fc 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/beans/NfvoNsInst.java
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/beans/NfvoNsInst.java
@@ -44,29 +44,29 @@ import static org.onap.so.etsi.nfvo.ns.lcm.database.beans.utils.Utils.toIndented
public class NfvoNsInst {
@Id
- @Column(name = "NS_INST_ID")
+ @Column(name = "NS_INST_ID", nullable = false)
private String nsInstId;
- @Column(name = "NAME")
+ @Column(name = "NAME", nullable = false)
private String name;
@Column(name = "NS_PACKAGE_ID")
private String nsPackageId;
- @Column(name = "NSD_ID")
+ @Column(name = "NSD_ID", nullable = false)
private String nsdId;
- @Column(name = "NSD_INVARIANT_ID")
+ @Column(name = "NSD_INVARIANT_ID", nullable = false)
private String nsdInvariantId;
@Column(name = "DESCRIPTION", columnDefinition = "LONGTEXT")
private String description;
@Enumerated(EnumType.STRING)
- @Column(name = "STATUS")
+ @Column(name = "STATUS", nullable = false)
private State status;
- @Column(name = "STATUS_UPDATED_TIME")
+ @Column(name = "STATUS_UPDATED_TIME", nullable = false)
private LocalDateTime statusUpdatedTime;
@Column(name = "GLOBAL_CUSTOMER_ID")
@@ -251,6 +251,10 @@ public class NfvoNsInst {
@Override
public boolean equals(final Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null || getClass() != obj.getClass())
+ return false;
if (obj instanceof NfvoNsInst) {
final NfvoNsInst other = (NfvoNsInst) obj;
return Objects.equals(nsInstId, other.nsInstId) && Objects.equals(name, other.name)
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/beans/NsLcmOpOcc.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/beans/NsLcmOpOcc.java
index c47bbdbefb..4846e5a361 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/beans/NsLcmOpOcc.java
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/beans/NsLcmOpOcc.java
@@ -41,11 +41,11 @@ import javax.persistence.Table;
public class NsLcmOpOcc {
@Id
- @Column(name = "ID")
+ @Column(name = "ID", nullable = false)
private String id;
@Enumerated(EnumType.STRING)
- @Column(name = "OPERATION_STATE")
+ @Column(name = "OPERATION_STATE", nullable = false)
private OperationStateEnum operationState;
@Column(name = "STATE_ENTERED_TIME")
@@ -55,22 +55,26 @@ public class NsLcmOpOcc {
private LocalDateTime startTime;
@ManyToOne(fetch = FetchType.LAZY)
- @JoinColumn(name = "NS_INST_ID")
+ @JoinColumn(name = "NS_INST_ID", nullable = false)
private NfvoNsInst nfvoNsInst;
@Enumerated(EnumType.STRING)
- @Column(name = "OPERATION")
+ @Column(name = "OPERATION", nullable = false)
private NsLcmOpType operation;
- @Column(name = "IS_AUTO_INNOVATION")
- private boolean isAutoInnovation;
+ @Column(name = "IS_AUTO_INVOCATION", nullable = false)
+ private boolean isAutoInvocation;
- @Column(name = "OPERATION_PARAMS", columnDefinition = "LONGTEXT")
+ @Column(name = "OPERATION_PARAMS", columnDefinition = "LONGTEXT", nullable = false)
private String operationParams;
- @Column(name = "IS_CANCEL_PENDING")
+ @Column(name = "IS_CANCEL_PENDING", nullable = false)
private boolean isCancelPending;
+ @Enumerated(EnumType.STRING)
+ @Column(name = "CANCEL_MODE")
+ private CancelModeType cancelMode;
+
public NsLcmOpOcc() {
this.id = UUID.randomUUID().toString();
}
@@ -153,16 +157,29 @@ public class NsLcmOpOcc {
return this;
}
- public boolean getIsAutoInnovation() {
- return isAutoInnovation;
+ public boolean getIsAutoInvocation() {
+ return isAutoInvocation;
+ }
+
+ public void setIsAutoInvocation(final boolean isAutoInvocation) {
+ this.isAutoInvocation = isAutoInvocation;
+ }
+
+ public NsLcmOpOcc isAutoInvocation(final boolean isAutoInvocation) {
+ this.isAutoInvocation = isAutoInvocation;
+ return this;
+ }
+
+ public CancelModeType getCancelMode() {
+ return cancelMode;
}
- public void setIsAutoInnovation(final boolean isAutoInnovation) {
- this.isAutoInnovation = isAutoInnovation;
+ public void setCancelMode(final CancelModeType cancelMode) {
+ this.cancelMode = cancelMode;
}
- public NsLcmOpOcc isAutoInnovation(final boolean isAutoInnovation) {
- this.isAutoInnovation = isAutoInnovation;
+ public NsLcmOpOcc cancelMode(final CancelModeType cancelMode) {
+ this.cancelMode = cancelMode;
return this;
}
@@ -193,24 +210,26 @@ public class NsLcmOpOcc {
}
@Override
- public boolean equals(final Object object) {
- if (this == object)
+ public boolean equals(final Object obj) {
+ if (this == obj)
return true;
- if (object == null || getClass() != object.getClass())
+ if (obj == null || getClass() != obj.getClass())
return false;
- final NsLcmOpOcc that = (NsLcmOpOcc) object;
+ final NsLcmOpOcc that = (NsLcmOpOcc) obj;
return Objects.equals(id, that.id) && Objects.equals(operationState, that.operationState)
&& Objects.equals(stateEnteredTime, that.stateEnteredTime) && Objects.equals(startTime, that.startTime)
- && Objects.equals(nfvoNsInst, that.nfvoNsInst) && Objects.equals(operation, that.operation)
- && Objects.equals(isAutoInnovation, that.isAutoInnovation)
+ && (nfvoNsInst == null ? that.nfvoNsInst == null
+ : that.nfvoNsInst != null && Objects.equals(nfvoNsInst, that.nfvoNsInst))
+ && Objects.equals(operation, that.operation) && Objects.equals(isAutoInvocation, that.isAutoInvocation)
&& Objects.equals(operationParams, that.operationParams)
- && Objects.equals(isCancelPending, that.isCancelPending);
+ && Objects.equals(isCancelPending, that.isCancelPending) && Objects.equals(cancelMode, that.cancelMode);
}
@Override
public int hashCode() {
- return Objects.hash(id, operationState, stateEnteredTime, startTime, nfvoNsInst, operation, isAutoInnovation,
- operationParams, isCancelPending);
+ return Objects.hash(id, operationState, stateEnteredTime, startTime,
+ nfvoNsInst != null ? nfvoNsInst.getNsInstId() : 0, operation, isAutoInvocation, operationParams,
+ isCancelPending, cancelMode);
}
@Override
@@ -224,9 +243,10 @@ public class NsLcmOpOcc {
sb.append(" nfvoNsInst: ").append(nfvoNsInst != null ? toIndentedString(nfvoNsInst.getNsInstId()) : null)
.append("\n");
sb.append(" operation: ").append(toIndentedString(operation)).append("\n");
- sb.append(" isAutoInnovation: ").append(toIndentedString(isAutoInnovation)).append("\n");
+ sb.append(" isAutoInvocation: ").append(toIndentedString(isAutoInvocation)).append("\n");
sb.append(" operationParams: ").append(toIndentedString(operationParams)).append("\n");
sb.append(" isCancelPending: ").append(toIndentedString(isCancelPending)).append("\n");
+ sb.append(" cancelMode: ").append(toIndentedString(cancelMode)).append("\n");
sb.append("}");
return sb.toString();
}
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/beans/utils/Utils.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/beans/utils/Utils.java
index c55ef5728e..b84f95aa50 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/beans/utils/Utils.java
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/beans/utils/Utils.java
@@ -39,10 +39,11 @@ public class Utils {
if (first == null) {
return second == null;
}
+
if (first.isEmpty()) {
return second.isEmpty();
}
- if (first.size() == second.size()) {
+ if ((first != null && second != null) && (first.size() == second.size())) {
for (int index = 0; index < first.size(); index++) {
if (!Objects.equals(first.get(index), second.get(index))) {
return false;
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/service/DatabaseServiceProvider.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/service/DatabaseServiceProvider.java
index 1aaddebc5e..1487b630c7 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/service/DatabaseServiceProvider.java
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/database/service/DatabaseServiceProvider.java
@@ -120,11 +120,6 @@ public class DatabaseServiceProvider {
return nfvoNfInstRepository.save(nfvoNfInst) != null;
}
- public Optional<NfvoNfInst> getNfvoNfInstByNfInstId(final String nfInstId) {
- logger.info("Querying database for NfvoNfInst using nfInstId: {}", nfInstId);
- return nfvoNfInstRepository.findByNfInstId(nfInstId);
- }
-
public List<NfvoNfInst> getNfvoNfInstByNsInstId(final String nsInstId) {
logger.info("Querying database for NfvoNfInst using nsInstId: {}", nsInstId);
return nfvoNfInstRepository.findByNsInstNsInstId(nsInstId);
@@ -160,5 +155,8 @@ public class DatabaseServiceProvider {
return nsLcmOpOccRepository.findById(id);
}
-
+ public void deleteNfvoNsInst(final String nsInstId) {
+ logger.info("Deleting NfvoNsInst with nsInstId: {}", nsInstId);
+ nfvoNsInstRepository.deleteById(nsInstId);
+ }
}
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/resources/db/migration/V1_1__create_nfvo_tables.sql b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/resources/db/migration/V1_1__create_nfvo_tables.sql
index f41a8206e0..85a732b83e 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/resources/db/migration/V1_1__create_nfvo_tables.sql
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/main/resources/db/migration/V1_1__create_nfvo_tables.sql
@@ -64,9 +64,10 @@ CREATE TABLE IF NOT EXISTS `NS_LCM_OP_OCCS` (
`START_TIME` DATETIME DEFAULT NULL,
`NS_INST_ID` varchar(255) NOT NULL,
`OPERATION` varchar(255) NOT NULL,
- `IS_AUTO_INNOVATION` varchar(255) NOT NULL,
+ `IS_AUTO_INVOCATION` varchar(255) NOT NULL,
`OPERATION_PARAMS` longtext NOT NULL,
`IS_CANCEL_PENDING` varchar(255) NOT NULL,
+ `CANCEL_MODE` varchar(255) DEFAULT NULL,
PRIMARY KEY (`ID`),
FOREIGN KEY (NS_INST_ID)
REFERENCES NS_INST(NS_INST_ID)
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/test/java/org/onap/so/etsi/nfvo/ns/lcm/database/DatabaseServiceProviderTest.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/test/java/org/onap/so/etsi/nfvo/ns/lcm/database/DatabaseServiceProviderTest.java
index 8108749d48..fcf7f9c373 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/test/java/org/onap/so/etsi/nfvo/ns/lcm/database/DatabaseServiceProviderTest.java
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/test/java/org/onap/so/etsi/nfvo/ns/lcm/database/DatabaseServiceProviderTest.java
@@ -133,7 +133,7 @@ public class DatabaseServiceProviderTest {
.status(State.NOT_INSTANTIATED).createTime(CURRENT_DATE_TIME).lastUpdateTime(CURRENT_DATE_TIME);
databaseServiceProvider.saveNfvoNfInst(nfInst);
- final Optional<NfvoNfInst> actual = databaseServiceProvider.getNfvoNfInstByNfInstId(nfInst.getNfInstId());
+ final Optional<NfvoNfInst> actual = databaseServiceProvider.getNfvoNfInst(nfInst.getNfInstId());
final NfvoNfInst actualNfvoNfInst = actual.get();
assertEquals(nsInst.getNsInstId(), actualNfvoNfInst.getNsInst().getNsInstId());
assertEquals(nfInst.getNfInstId(), actualNfvoNfInst.getNfInstId());
@@ -164,7 +164,7 @@ public class DatabaseServiceProviderTest {
databaseServiceProvider.saveNfvoNsInst(nsInst);
final NsLcmOpOcc nsLcmOpOcc = new NsLcmOpOcc().nfvoNsInst(nsInst).operationState(OperationStateEnum.PROCESSING)
- .isCancelPending(false).isAutoInnovation(false).operation(NsLcmOpType.INSTANTIATE)
+ .isCancelPending(false).isAutoInvocation(false).operation(NsLcmOpType.INSTANTIATE)
.startTime(CURRENT_DATE_TIME).stateEnteredTime(CURRENT_DATE_TIME).operationParams("");
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/test/java/org/onap/so/etsi/nfvo/ns/lcm/database/PojoClassesTests.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/test/java/org/onap/so/etsi/nfvo/ns/lcm/database/PojoClassesTests.java
new file mode 100644
index 0000000000..5f033a2438
--- /dev/null
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-database-service/src/test/java/org/onap/so/etsi/nfvo/ns/lcm/database/PojoClassesTests.java
@@ -0,0 +1,93 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.etsi.nfvo.ns.lcm.database;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import org.junit.Test;
+import org.onap.so.etsi.nfvo.ns.lcm.database.beans.NfvoJob;
+import org.onap.so.etsi.nfvo.ns.lcm.database.beans.NfvoJobStatus;
+import org.onap.so.etsi.nfvo.ns.lcm.database.beans.NfvoNfInst;
+import org.onap.so.etsi.nfvo.ns.lcm.database.beans.NfvoNsInst;
+import org.onap.so.etsi.nfvo.ns.lcm.database.beans.NsLcmOpOcc;
+import org.onap.so.openpojo.rules.ToStringTester;
+import com.openpojo.reflection.filters.FilterPackageInfo;
+import com.openpojo.validation.Validator;
+import com.openpojo.validation.ValidatorBuilder;
+import com.openpojo.validation.test.impl.GetterTester;
+import com.openpojo.validation.test.impl.SetterTester;
+import nl.jqno.equalsverifier.EqualsVerifier;
+import nl.jqno.equalsverifier.Warning;
+
+/**
+ * @author Waqas Ikram (waqas.ikram@est.tech)
+ */
+public class PojoClassesTests {
+
+ @Test
+ public void test_database_beans() throws ClassNotFoundException {
+
+ final Validator validator = ValidatorBuilder.create().with(new SetterTester()).with(new GetterTester())
+ .with(new ToStringTester()).build();
+ validator.validate(NfvoNsInst.class.getPackageName(), new FilterPackageInfo());
+ }
+
+ @Test
+ public void test_database_nfvoJob_equalAndHashMethod() throws ClassNotFoundException {
+ EqualsVerifier.forClass(NfvoJob.class)
+ .suppress(Warning.STRICT_INHERITANCE, Warning.NONFINAL_FIELDS, Warning.INHERITED_DIRECTLY_FROM_OBJECT)
+ .withPrefabValues(NfvoJobStatus.class, new NfvoJobStatus().nfvoJob(new NfvoJob()),
+ new NfvoJobStatus().nfvoJob(new NfvoJob()))
+ .withIgnoredAnnotations(Entity.class, Id.class).verify();
+ }
+
+ @Test
+ public void test_database_nfvoJobStatus_equalAndHashMethod() throws ClassNotFoundException {
+ EqualsVerifier.forClass(NfvoJobStatus.class)
+ .suppress(Warning.STRICT_INHERITANCE, Warning.NONFINAL_FIELDS, Warning.INHERITED_DIRECTLY_FROM_OBJECT)
+ .withPrefabValues(NfvoJob.class, new NfvoJob(), new NfvoJob())
+ .withIgnoredAnnotations(Entity.class, Id.class).verify();
+ }
+
+ @Test
+ public void test_database_nfvoNsInst_equalAndHashMethod() throws ClassNotFoundException {
+ EqualsVerifier.forClass(NfvoNsInst.class)
+ .suppress(Warning.STRICT_INHERITANCE, Warning.NONFINAL_FIELDS, Warning.INHERITED_DIRECTLY_FROM_OBJECT)
+ .withPrefabValues(NfvoNfInst.class, new NfvoNfInst(), new NfvoNfInst())
+ .withPrefabValues(NsLcmOpOcc.class, new NsLcmOpOcc(), new NsLcmOpOcc())
+ .withIgnoredAnnotations(Entity.class, Id.class).verify();
+ }
+
+ @Test
+ public void test_database_nfvoNfInst_equalAndHashMethod() throws ClassNotFoundException {
+ EqualsVerifier.forClass(NfvoNfInst.class)
+ .suppress(Warning.STRICT_INHERITANCE, Warning.NONFINAL_FIELDS, Warning.INHERITED_DIRECTLY_FROM_OBJECT)
+ .withPrefabValues(NfvoNsInst.class, new NfvoNsInst(), new NfvoNsInst())
+ .withIgnoredAnnotations(Entity.class, Id.class).verify();
+ }
+
+ @Test
+ public void test_database_nsLcmOpOcc_equalAndHashMethod() throws ClassNotFoundException {
+ EqualsVerifier.forClass(NsLcmOpOcc.class)
+ .suppress(Warning.STRICT_INHERITANCE, Warning.NONFINAL_FIELDS, Warning.INHERITED_DIRECTLY_FROM_OBJECT)
+ .withPrefabValues(NfvoNsInst.class, new NfvoNsInst(), new NfvoNsInst())
+ .withIgnoredAnnotations(Entity.class, Id.class).verify();
+ }
+}
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/lifecycle/NsLcmOperationOccurrenceManager.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/lifecycle/NsLcmOperationOccurrenceManager.java
new file mode 100644
index 0000000000..8a5cee6d75
--- /dev/null
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/lifecycle/NsLcmOperationOccurrenceManager.java
@@ -0,0 +1,122 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.etsi.nfvo.ns.lcm.lifecycle;
+
+import static org.slf4j.LoggerFactory.getLogger;
+import org.onap.so.etsi.nfvo.ns.lcm.EtsiSoNsLcmManagerUrlProvider;
+import org.onap.so.etsi.nfvo.ns.lcm.database.beans.NsLcmOpOcc;
+import org.onap.so.etsi.nfvo.ns.lcm.database.service.DatabaseServiceProvider;
+import org.onap.so.etsi.nfvo.ns.lcm.model.NsInstancesNsInstanceLinksSelf;
+import org.onap.so.etsi.nfvo.ns.lcm.model.NsLcmOpOccsNsLcmOpOcc;
+import org.onap.so.etsi.nfvo.ns.lcm.model.NsLcmOpOccsNsLcmOpOccLinks;
+import org.slf4j.Logger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import java.util.Optional;
+
+/**
+ * @author Waqas Ikram (waqas.ikram@est.tech)
+ * @author Andrew Lamb (andrew.a.lamb@est.tech)
+ *
+ */
+@Service
+public class NsLcmOperationOccurrenceManager {
+
+ private static final Logger logger = getLogger(NsLcmOperationOccurrenceManager.class);
+
+ private final DatabaseServiceProvider databaseServiceProvider;
+ private final EtsiSoNsLcmManagerUrlProvider etsiSoNsLcmManagerUrlProvider;
+
+ @Autowired
+ public NsLcmOperationOccurrenceManager(final DatabaseServiceProvider databaseServiceProvider,
+ final EtsiSoNsLcmManagerUrlProvider etsiSoNsLcmManagerUrlProvider) {
+ this.databaseServiceProvider = databaseServiceProvider;
+ this.etsiSoNsLcmManagerUrlProvider = etsiSoNsLcmManagerUrlProvider;
+ }
+
+ public Optional<NsLcmOpOccsNsLcmOpOcc> getNsLcmOperationOccurrence(final String nsLcmOpOccId) {
+ logger.info("Getting NS LCM Operation Occurrence Operation for id: {}", nsLcmOpOccId);
+ final Optional<NsLcmOpOcc> optionalNsLcmOpOcc = databaseServiceProvider.getNsLcmOpOcc(nsLcmOpOccId);
+
+ if (optionalNsLcmOpOcc.isEmpty()) {
+ logger.info("No NS LCM Operation Occurrence found for id: {}", nsLcmOpOccId);
+ return Optional.empty();
+ }
+
+ logger.info("Found NS LCM Operation Occurrence for id: {}", nsLcmOpOccId);
+ final NsLcmOpOcc nsLcmOpOcc = optionalNsLcmOpOcc.get();
+ final NsLcmOpOccsNsLcmOpOcc nsLcmOpOccsNsLcmOpOcc = convertToNsLcmOpOccsNsLcmOpOcc(nsLcmOpOcc);
+ return Optional.of(nsLcmOpOccsNsLcmOpOcc);
+ }
+
+ private NsLcmOpOccsNsLcmOpOcc convertToNsLcmOpOccsNsLcmOpOcc(final NsLcmOpOcc nsLcmOpOcc) {
+ logger.info("Converting Database NsLcmOpOcc to API NsLcmOpOcc... ");
+ final NsLcmOpOccsNsLcmOpOcc nsLcmOpOccsNsLcmOpOcc =
+ new NsLcmOpOccsNsLcmOpOcc().id(nsLcmOpOcc.getId()).statusEnteredTime(nsLcmOpOcc.getStateEnteredTime())
+ .startTime(nsLcmOpOcc.getStartTime()).isAutomaticInvocation(nsLcmOpOcc.getIsAutoInvocation())
+ .isCancelPending(nsLcmOpOcc.getIsCancelPending());
+
+ if (nsLcmOpOcc.getNfvoNsInst() != null) {
+ nsLcmOpOccsNsLcmOpOcc.setNsInstanceId(nsLcmOpOcc.getNfvoNsInst().getNsInstId());
+ }
+
+ if (nsLcmOpOcc.getOperationState() != null) {
+ nsLcmOpOccsNsLcmOpOcc.setOperationState(
+ NsLcmOpOccsNsLcmOpOcc.OperationStateEnum.fromValue(nsLcmOpOcc.getOperationState().toString()));
+ }
+
+ if (nsLcmOpOcc.getOperation() != null) {
+ nsLcmOpOccsNsLcmOpOcc.setLcmOperationType(
+ NsLcmOpOccsNsLcmOpOcc.LcmOperationTypeEnum.fromValue(nsLcmOpOcc.getOperation().toString()));
+ }
+
+ if (nsLcmOpOcc.getOperationParams() != null) {
+ nsLcmOpOccsNsLcmOpOcc.setOperationParams(nsLcmOpOcc.getOperationParams());
+ }
+
+ if (nsLcmOpOcc.getCancelMode() != null) {
+ nsLcmOpOccsNsLcmOpOcc.setCancelMode(
+ NsLcmOpOccsNsLcmOpOcc.CancelModeEnum.fromValue(nsLcmOpOcc.getCancelMode().toString()));
+ }
+
+ nsLcmOpOccsNsLcmOpOcc.setLinks(generateLinks(nsLcmOpOcc));
+
+ logger.info("Database NsLcmOpOcc converted to API NsLcmOpOcc successfully... {}", nsLcmOpOccsNsLcmOpOcc);
+ return nsLcmOpOccsNsLcmOpOcc;
+ }
+
+ private NsLcmOpOccsNsLcmOpOccLinks generateLinks(final NsLcmOpOcc nsLcmOpOcc) {
+ logger.info("Generating links...");
+ final String nsLcmOpOccId = nsLcmOpOcc.getId();
+ final NsInstancesNsInstanceLinksSelf linksSelfNsLcmOpOcc = new NsInstancesNsInstanceLinksSelf()
+ .href(etsiSoNsLcmManagerUrlProvider.getNsLcmOpOccUri(nsLcmOpOccId).toString());
+ final NsLcmOpOccsNsLcmOpOccLinks links = new NsLcmOpOccsNsLcmOpOccLinks().self(linksSelfNsLcmOpOcc);
+
+ if (nsLcmOpOcc.getNfvoNsInst() != null) {
+ final String nsInstId = nsLcmOpOcc.getNfvoNsInst().getNsInstId();
+ final NsInstancesNsInstanceLinksSelf linksSelfNsInst = new NsInstancesNsInstanceLinksSelf()
+ .href(etsiSoNsLcmManagerUrlProvider.getCreatedNsResourceUri(nsInstId).toString());
+ links.setNsInstance(linksSelfNsInst);
+ }
+
+ return links;
+ }
+
+}
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/lifecycle/NsLifeCycleManager.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/lifecycle/NsLifeCycleManager.java
index 2ebf55ff7f..ae9f55e1c5 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/lifecycle/NsLifeCycleManager.java
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/lifecycle/NsLifeCycleManager.java
@@ -82,4 +82,9 @@ public class NsLifeCycleManager {
return etsiSoNsLcmManagerUrlProvider.getNsLcmOpOccUri(nsLcmOpOccId);
}
+
+ public void deleteNs(final String nsInstanceId) {
+ logger.info("Will execute Delete Ns for nsInstanceId: {}", nsInstanceId);
+ jobExecutorService.runDeleteNsJob(nsInstanceId);
+ }
}
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/rest/NsLcmOperationOccurrencesController.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/rest/NsLcmOperationOccurrencesController.java
index ec79ce6329..207f0ff387 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/rest/NsLcmOperationOccurrencesController.java
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/rest/NsLcmOperationOccurrencesController.java
@@ -22,20 +22,25 @@ package org.onap.so.etsi.nfvo.ns.lcm.rest;
import static org.onap.so.etsi.nfvo.ns.lcm.Constants.NS_LIFE_CYCLE_MANAGEMENT_BASE_URL;
import static org.slf4j.LoggerFactory.getLogger;
import javax.ws.rs.core.MediaType;
+import org.onap.so.etsi.nfvo.ns.lcm.lifecycle.NsLcmOperationOccurrenceManager;
+import org.onap.so.etsi.nfvo.ns.lcm.model.InlineResponse400;
import org.onap.so.etsi.nfvo.ns.lcm.model.NsLcmOpOccsNsLcmOpOcc;
import org.slf4j.Logger;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
+import java.util.Optional;
/**
* Controller for handling NS lifecycle management operation occurrence requests see clause 6.4.9 and 6.4.10 in
* https://www.etsi.org/deliver/etsi_gs/NFV-SOL/001_099/005/02.07.01_60/gs_NFV-SOL005v020701p.pdf
*
* @author Waqas Ikram (waqas.ikram@est.tech)
+ * @author Andrew Lamb (andrew.a.lamb@est.tech)
*
*/
@Controller
@@ -43,6 +48,12 @@ import org.springframework.web.bind.annotation.RequestMapping;
public class NsLcmOperationOccurrencesController {
private static final Logger logger = getLogger(NsLcmOperationOccurrencesController.class);
+ private final NsLcmOperationOccurrenceManager nsLcmOperationOccurrenceManager;
+
+ @Autowired
+ public NsLcmOperationOccurrencesController(final NsLcmOperationOccurrenceManager nsLcmOperationOccurrenceManager) {
+ this.nsLcmOperationOccurrenceManager = nsLcmOperationOccurrenceManager;
+ }
/**
* The GET method to retrieve status information about a NS lifecycle management operation occurrence by reading an
@@ -57,7 +68,18 @@ public class NsLcmOperationOccurrencesController {
produces = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
public ResponseEntity<?> getOperationStatus(@PathVariable("nsLcmOpOccId") final String nsLcmOpOccId) {
logger.info("Received request to retrieve operation status for nsLcmOpOccId: {}", nsLcmOpOccId);
- return ResponseEntity.status(HttpStatus.NOT_IMPLEMENTED).body("Operation is not supported yet");
+ final Optional<NsLcmOpOccsNsLcmOpOcc> optionalNsLcmOpOccs =
+ nsLcmOperationOccurrenceManager.getNsLcmOperationOccurrence(nsLcmOpOccId);
+
+ if (optionalNsLcmOpOccs.isPresent()) {
+ final NsLcmOpOccsNsLcmOpOcc nsLcmOpOcc = optionalNsLcmOpOccs.get();
+ logger.info("Sending back NsLcmOpOcc: {}", nsLcmOpOcc);
+ return ResponseEntity.ok().body(nsLcmOpOcc);
+ }
+
+ final String errorMessage = "Unable to retrieve operation occurrence status for nsLcmOpOccId: " + nsLcmOpOccId;
+ logger.error(errorMessage);
+ return ResponseEntity.status(HttpStatus.NOT_FOUND).body(new InlineResponse400().detail(errorMessage));
}
}
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/rest/NsLifecycleManagementController.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/rest/NsLifecycleManagementController.java
index cfda89f3f0..2390cef564 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/rest/NsLifecycleManagementController.java
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/rest/NsLifecycleManagementController.java
@@ -35,7 +35,6 @@ import org.onap.so.etsi.nfvo.ns.lcm.model.NsInstancesNsInstance;
import org.onap.so.etsi.nfvo.ns.lcm.model.TerminateNsRequest;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.DeleteMapping;
@@ -78,7 +77,7 @@ public class NsLifecycleManagementController {
*/
@PostMapping(value = "/ns_instances", produces = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML},
consumes = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
- public ResponseEntity<?> createNs(
+ public ResponseEntity<NsInstancesNsInstance> createNs(
@RequestHeader(value = HTTP_GLOBAL_CUSTOMER_ID_HTTP_HEADER_PARM_NAME,
required = true) final String globalCustomerId,
@RequestHeader(value = HTTP_SERVICETYPE_HEADER_PARM_NAME, required = false,
@@ -107,9 +106,11 @@ public class NsLifecycleManagementController {
*/
@DeleteMapping(value = "/ns_instances/{nsInstanceId}",
produces = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
- public ResponseEntity<?> deleteNs(@PathVariable("nsInstanceId") final String nsInstanceId) {
+ public ResponseEntity<Void> deleteNs(@PathVariable("nsInstanceId") final String nsInstanceId) {
logger.debug("Received delete NS request for nsInstanceId: {}", nsInstanceId);
- return ResponseEntity.status(HttpStatus.NOT_IMPLEMENTED).body("Operation is not supported yet");
+ nsLifeCycleManager.deleteNs(nsInstanceId);
+ logger.info("Successfully deleted NS for nsInstanceId: {}", nsInstanceId);
+ return ResponseEntity.noContent().build();
}
/**
@@ -123,7 +124,7 @@ public class NsLifecycleManagementController {
@PostMapping(value = "/ns_instances/{nsInstanceId}/instantiate",
produces = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML},
consumes = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
- public ResponseEntity<?> instantiateNs(@PathVariable("nsInstanceId") final String nsInstanceId,
+ public ResponseEntity<Void> instantiateNs(@PathVariable("nsInstanceId") final String nsInstanceId,
@RequestBody final InstantiateNsRequest instantiateNsRequest) {
logger.debug("Received instantiate NS request: {}\n with nsInstanceId: {}", instantiateNsRequest, nsInstanceId);
final URI resourceUri = nsLifeCycleManager.instantiateNs(nsInstanceId, instantiateNsRequest);
@@ -143,7 +144,7 @@ public class NsLifecycleManagementController {
@PostMapping(value = "/ns_instances/{nsInstanceId}/terminate",
produces = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML},
consumes = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
- public ResponseEntity<?> terminateNs(@PathVariable("nsInstanceId") final String nsInstanceId,
+ public ResponseEntity<Void> terminateNs(@PathVariable("nsInstanceId") final String nsInstanceId,
@RequestBody final TerminateNsRequest terminateNsRequest) {
logger.debug("Received terminate NS request: {}\n with nsInstanceId: {}", terminateNsRequest, nsInstanceId);
final URI resourceUri = nsLifeCycleManager.terminateNs(nsInstanceId, terminateNsRequest);
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-service/src/test/java/org/onap/so/etsi/nfvo/ns/lcm/rest/NsLcmOperationOccurrencesControllerTest.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-service/src/test/java/org/onap/so/etsi/nfvo/ns/lcm/rest/NsLcmOperationOccurrencesControllerTest.java
index 9eace927d6..c5862569f2 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-service/src/test/java/org/onap/so/etsi/nfvo/ns/lcm/rest/NsLcmOperationOccurrencesControllerTest.java
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-service/src/test/java/org/onap/so/etsi/nfvo/ns/lcm/rest/NsLcmOperationOccurrencesControllerTest.java
@@ -20,13 +20,26 @@
package org.onap.so.etsi.nfvo.ns.lcm.rest;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import java.time.LocalDateTime;
+import java.util.Optional;
import java.util.UUID;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.onap.so.etsi.nfvo.ns.lcm.Constants;
-import org.onap.so.etsi.nfvo.ns.lcm.JSON;
import org.onap.so.etsi.nfvo.ns.lcm.TestApplication;
+import org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.GsonProvider;
+import org.onap.so.etsi.nfvo.ns.lcm.database.beans.NfvoNsInst;
+import org.onap.so.etsi.nfvo.ns.lcm.database.beans.NsLcmOpOcc;
+import org.onap.so.etsi.nfvo.ns.lcm.database.beans.NsLcmOpType;
+import org.onap.so.etsi.nfvo.ns.lcm.database.beans.OperationStateEnum;
+import org.onap.so.etsi.nfvo.ns.lcm.database.beans.State;
+import org.onap.so.etsi.nfvo.ns.lcm.database.service.DatabaseServiceProvider;
+import org.onap.so.etsi.nfvo.ns.lcm.model.InlineResponse400;
+import org.onap.so.etsi.nfvo.ns.lcm.model.NsLcmOpOccsNsLcmOpOcc;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.web.client.TestRestTemplate;
import org.springframework.boot.web.client.RestTemplateBuilder;
@@ -42,32 +55,75 @@ import org.springframework.test.context.junit4.SpringRunner;
import com.google.gson.Gson;
/**
- *
* @author Waqas Ikram (waqas.ikram@est.tech)
+ * @author Andrew Lamb (andrew.a.lamb@est.tech)
+ *
*/
@RunWith(SpringRunner.class)
@SpringBootTest(classes = TestApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@ActiveProfiles("test")
public class NsLcmOperationOccurrencesControllerTest {
+
+ private static final String NS_LCM_OP_OCCS = "/ns_lcm_op_occs/";
+
@LocalServerPort
private int port;
+
+ @Autowired
+ private DatabaseServiceProvider databaseServiceProvider;
+
+ @Autowired
+ private GsonProvider gsonProvider;
+
private TestRestTemplate testRestTemplate;
@Before
public void setUp() {
- final Gson gson = JSON.createGson().create();
+ final Gson gson = gsonProvider.getGson();
testRestTemplate = new TestRestTemplate(
new RestTemplateBuilder().additionalMessageConverters(new GsonHttpMessageConverter(gson)));
}
@Test
- public void testGetOperationStatusS_ValidNsLcmOpOccId() {
- final String baseUrl = getNsLcmBaseUrl() + "/ns_lcm_op_occs/" + UUID.randomUUID().toString();
+ public void testGetOperationStatus_validNsLcmOpOccId_returnsNsLcmOpOcc() {
+ final String nsLcmOpOccId = addDummyNsLcmOpOccToDatabase();
+ final String baseUrl = getNsLcmBaseUrl() + NS_LCM_OP_OCCS + nsLcmOpOccId;
final HttpEntity<?> request = new HttpEntity<>(new HttpHeaders());
- final ResponseEntity<Void> responseEntity =
- testRestTemplate.exchange(baseUrl, HttpMethod.GET, request, Void.class);
- assertEquals(HttpStatus.NOT_IMPLEMENTED, responseEntity.getStatusCode());
+ final ResponseEntity<NsLcmOpOccsNsLcmOpOcc> responseEntity =
+ testRestTemplate.exchange(baseUrl, HttpMethod.GET, request, NsLcmOpOccsNsLcmOpOcc.class);
+ assertEquals(HttpStatus.OK, responseEntity.getStatusCode());
+ assertTrue(responseEntity.hasBody());
+ assertNotNull(responseEntity.getBody());
+ }
+
+ @Test
+ public void testGetOperationStatus_nsLcmOpOccIdNotFound_returnsInlineResponse400() {
+ final String nsLcmOpOccId = UUID.randomUUID().toString();
+ final Optional<NsLcmOpOcc> optionalNsLcmOpOcc = databaseServiceProvider.getNsLcmOpOcc(nsLcmOpOccId);
+ assertTrue(optionalNsLcmOpOcc.isEmpty());
+ final String baseUrl = getNsLcmBaseUrl() + NS_LCM_OP_OCCS + nsLcmOpOccId;
+ final HttpEntity<?> request = new HttpEntity<>(new HttpHeaders());
+ final ResponseEntity<InlineResponse400> responseEntity =
+ testRestTemplate.exchange(baseUrl, HttpMethod.GET, request, InlineResponse400.class);
+ assertEquals(HttpStatus.NOT_FOUND, responseEntity.getStatusCode());
+ assertTrue(responseEntity.hasBody());
+ assertNotNull(responseEntity.getBody());
+ }
+
+ private String addDummyNsLcmOpOccToDatabase() {
+ final LocalDateTime currentDateTime = LocalDateTime.now();
+
+ final NfvoNsInst nsInst = new NfvoNsInst().name("name").nsdId("id").status(State.NOT_INSTANTIATED)
+ .nsdInvariantId("id").statusUpdatedTime(currentDateTime);
+ databaseServiceProvider.saveNfvoNsInst(nsInst);
+
+ final NsLcmOpOcc nsLcmOpOcc = new NsLcmOpOcc().nfvoNsInst(nsInst).operationState(OperationStateEnum.PROCESSING)
+ .isCancelPending(false).isAutoInvocation(false).operation(NsLcmOpType.INSTANTIATE)
+ .startTime(currentDateTime).stateEnteredTime(currentDateTime).operationParams("");
+ databaseServiceProvider.addNSLcmOpOcc(nsLcmOpOcc);
+
+ return nsLcmOpOcc.getId();
}
private String getNsLcmBaseUrl() {
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-service/src/test/java/org/onap/so/etsi/nfvo/ns/lcm/rest/NsLifecycleManagementControllerTest.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-service/src/test/java/org/onap/so/etsi/nfvo/ns/lcm/rest/NsLifecycleManagementControllerTest.java
index 4b1195244c..585b0e1811 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-service/src/test/java/org/onap/so/etsi/nfvo/ns/lcm/rest/NsLifecycleManagementControllerTest.java
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-service/src/test/java/org/onap/so/etsi/nfvo/ns/lcm/rest/NsLifecycleManagementControllerTest.java
@@ -19,17 +19,14 @@
*/
package org.onap.so.etsi.nfvo.ns.lcm.rest;
-/**
- * @author Waqas Ikram (waqas.ikram@est.tech)
- *
- */
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.when;
import java.net.URISyntaxException;
-import java.time.LocalDateTime;
import java.util.List;
import java.util.UUID;
import org.junit.Before;
@@ -173,11 +170,30 @@ public class NsLifecycleManagementControllerTest {
}
@Test
- public void testCreateNs_ValidDeleteNsRequest() {
- final String baseUrl = getNsLcmBaseUrl() + "/ns_instances/" + UUID.randomUUID().toString();
+ public void testDeleteNs_SuccessfulCase() {
+ final String nsInstId = UUID.randomUUID().toString();
+ doNothing().when(mockedJobExecutorService).runDeleteNsJob(eq(nsInstId));
+
+ final String baseUrl = getNsLcmBaseUrl() + "/ns_instances/" + nsInstId;
final ResponseEntity<Void> responseEntity =
testRestTemplate.exchange(baseUrl, HttpMethod.DELETE, null, Void.class);
- assertEquals(HttpStatus.NOT_IMPLEMENTED, responseEntity.getStatusCode());
+ assertEquals(HttpStatus.NO_CONTENT, responseEntity.getStatusCode());
+ }
+
+ @Test
+ public void testDeleteNs_nsRequestProcessingExceptionThrown_returnInlineResponse400() {
+ final String nsInstId = UUID.randomUUID().toString();
+ final String message = "Unable to process request";
+ doThrow(new NsRequestProcessingException(message, new InlineResponse400().detail(message)))
+ .when(mockedJobExecutorService).runDeleteNsJob(eq(nsInstId));
+
+ final String baseUrl = getNsLcmBaseUrl() + "/ns_instances/" + nsInstId;
+ final ResponseEntity<InlineResponse400> responseEntity =
+ testRestTemplate.exchange(baseUrl, HttpMethod.DELETE, null, InlineResponse400.class);
+
+ assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, responseEntity.getStatusCode());
+ assertTrue(responseEntity.hasBody());
+ assertNotNull(responseEntity.getBody());
}
@Test
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-service/src/test/resources/application.yaml b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-service/src/test/resources/application.yaml
index 44acda20a4..6f2b4d26c5 100644
--- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-service/src/test/resources/application.yaml
+++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-service/src/test/resources/application.yaml
@@ -29,11 +29,13 @@ spring:
pool-name: ns-lcm-nfvo-pool
registerMbeans: true
jpa:
+ generate-ddl: true
hibernate:
- ddl-auto: none
+ ddl-auto: create
logging:
level:
org.reflections.Reflections: ERROR
+
etsi-catalog-manager:
base:
- endpoint: http://modeling-etsicatalog.onap:8806/api \ No newline at end of file
+ endpoint: http://modeling-etsicatalog.onap:8806/api
diff --git a/version.properties b/version.properties
index f56901fc20..e783874dbf 100644
--- a/version.properties
+++ b/version.properties
@@ -4,7 +4,7 @@
major=1
minor=7
-patch=2
+patch=3
base_version=${major}.${minor}.${patch}