Merge "Add userParams as inputs"
authorLukasz Muszkieta <lukasz.muszkieta@nokia.com>
Fri, 25 Sep 2020 09:38:23 +0000 (09:38 +0000)
committerGerrit Code Review <gerrit@onap.org>
Fri, 25 Sep 2020 09:38:23 +0000 (09:38 +0000)
411 files changed:
adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/aai/AaiConnection.java
adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/extclients/aai/AaiServiceProviderImpl.java
adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/test/java/org/onap/so/adapters/etsisol003adapter/lcm/rest/EtsiSol003AdapterControllerTest.java
adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/test/java/org/onap/so/adapters/etsisol003adapter/lcm/rest/Sol003GrantControllerTest.java
adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/test/java/org/onap/so/adapters/etsisol003adapter/lcm/rest/Sol003LcnControllerTest.java
adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-api/pom.xml
adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/AuthenticationMethodFactory.java
adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoCommonUtils.java
adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoKeystoneV3Utils.java
adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceMacroHolder.java
adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/MSOCnfApplication.java
adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/GroupVersionKind.java [new file with mode: 0644]
adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/InstanceMiniResponse.java [new file with mode: 0644]
adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/InstanceMiniResponseList.java [new file with mode: 0644]
adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/InstanceResponse.java [new file with mode: 0644]
adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/InstanceStatusResponse.java [new file with mode: 0644]
adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/PodStatus.java [new file with mode: 0644]
adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/Resource.java [new file with mode: 0644]
adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/Response.java [new file with mode: 0644]
adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/rest/CnfAdapterRest.java
adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/service/CnfAdapterService.java [new file with mode: 0644]
adapters/mso-cnf-adapter/src/main/resources/META-INF/services/org.onap.so.client.RestProperties
adapters/mso-cnf-adapter/src/main/resources/application.yaml
adapters/mso-cnf-adapter/src/test/java/org/onap/so/adapters/cnf/CnfAdapterRestTest.java
adapters/mso-cnf-adapter/src/test/java/org/onap/so/adapters/cnf/rest/CnfAdapterRestTest.java [new file with mode: 0644]
adapters/mso-cnf-adapter/src/test/java/org/onap/so/adapters/cnf/service/CnfAdapterServiceTest.java [new file with mode: 0644]
adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/enums/ActionType.java
adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/extclients/aai/AaiServiceProviderImpl.java
adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/ExternalNssmfManager.java
adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/InternalNssmfManager.java
adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/service/impl/NssmfManagerServiceImpl.java
adapters/mso-nssmf-adapter/src/test/java/org/onap/so/adapters/nssmf/NssmfAdapterRestTest.java
adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/cloudregion/CloudRestImpl.java
adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/delete/DeleteAAIInventory.java
adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditVServer.java
adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/HeatStackAudit.java
adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/CreateAAIInventory.java
adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeApi.java
adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java
adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java
adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/cloudregion/CloudRegionRestImplTest.java
adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AuditVServerTest.java
adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java
asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java
asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java
asdc-controller/src/main/java/org/onap/so/asdc/tenantIsolation/WatchdogDistribution.java
bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtils.groovy
bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupName.groovy
bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenant.groovy
bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModule.groovy
bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleVolumeGroup.groovy
bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModule.groovy
bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DoHandleOofRequest.groovy
bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy
bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy
bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModule.groovy
bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/RequestDBUtil.groovy
bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy
bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModule.groovy
bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPnf.java
bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java
bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/CloudInfoFromAAI.java
bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/dmaapproperties/SdnrDmaapPublisher.java [new file with mode: 0644]
bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java
bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/common/SendRequestToSdnr.java [new file with mode: 0644]
bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtilsTest.groovy
bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupNameTest.groovy
bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenantTest.groovy
bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleVolumeGroupTest.groovy
bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/MsoGroovyTest.groovy
bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModuleTest.groovy
bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java
bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java
bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java
bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/CloudInfoFromAAITest.java
bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderTest.java
bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_withRelatedInstanceList.json
bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/aaiL3NetworkInputWithSubnets.json
bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/l3NetworkExpectedWithSubnet.json
bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CnfAdapterBB.bpmn [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateCommunicationService.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSliceService.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSliceSubnet.groovy [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/AllocateSliceSubnet.groovy [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/AnNssmfutils.groovy [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCommunicationService.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceService.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeAllocateSliceSubnet.groovy [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Delete3rdONAPE2EServiceInstance.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCommunicationService.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteDeviceResource.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSliceService.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateAccessNSSI.groovy [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateCoreNSSI.groovy [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateTnNssi.groovy [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateAccessNSSI.groovy [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNSSI.groovy [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNonSharedSlice.groovy [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreSharedSlice.groovy [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSSI.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCommonCoreNSSI.groovy [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelofE2EServiceInstance.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateCommunicationService.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstanceRollback.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceInstance.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOption.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateTnNssiInstance.groovy [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeRollback.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeAllocateAccessNSSI.groovy [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateCoreNSSI.groovy [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateNSSI.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateTnNssi.groovy [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteServiceInstance.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteSliceService.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnf.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyAccessNSSI.groovy [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyCoreNSSI.groovy [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyRanNfNssi.groovy [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyTnNssi.groovy [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstanceRollback.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstance.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ModifySliceSubnet.groovy [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/QueryJobStatus.groovy [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnAllocateNssi.groovy [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnNssmfUtils.groovy [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolume.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfCmBase.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfConfigUpdate.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfInPlaceUpdate.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy
bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAICreateResources.java
bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAIDeleteServiceInstance.java
bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAICreateResources.java
bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAIDeleteServiceInstance.java
bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/management/PnfManagementImpl.java
bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java
bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSliceSubnetTest.groovy [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/AllocateSliceSubnetTest.groovy [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceServiceTest.groovy
bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResourceTest.groovy
bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1Test.groovy
bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeAllocateSliceSubnetTest.groovy [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCommunicationServiceTest.groovy
bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSliceServiceTest.groovy
bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1Test.groovy
bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateCoreNSSITest.groovy [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateTnNssiTest.groovy [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNSSITest.groovy [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNonSharedSliceTest.groovy [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreSharedSliceTest.groovy [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateTnNssiTest.groovy [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCommonCoreNSSITest.groovy [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstanceTest.groovy
bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollbackTest.groovy
bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeRollbackTest.groovy
bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2Test.groovy
bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2Test.groovy
bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateCoreNSSITest.groovy [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateNSSITest.groovy
bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateTnNssiTest.groovy [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstanceTest.groovy
bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteSliceServiceTest.groovy
bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstanceTest.groovy
bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnfTest.groovy
bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleTest.groovy
bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2Test.groovy
bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModulesTest.groovy
bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyCoreNSSITest.groovy [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyTnNssiTest.groovy [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/ModifySliceSubnetTest.groovy [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1Test.groovy
bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeTest.groovy
bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGTest.groovy
bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCTest.groovy
bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/aai/AAICreateResourcesTest.java
bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ActivateSliceSubnet.bpmn [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/AllocateSliceSubnet.bpmn [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateSDNCNetworkResource.bpmn
bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateSliceService.bpmn
bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeAllocateSliceSubnet.bpmn [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/GenericPnfSWUPDownload.bpmn
bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/GenericPnfSoftwareUpgrade.bpmn
bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ModifySliceSubnet.bpmn [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ServiceLevelUpgrade.bpmn
bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoActivateAccessNSSI.bpmn [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoActivateCoreNSSI.bpmn [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoActivateTransportNSSI.bpmn [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateAccessNSSI.bpmn [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateCoreNSSI.bpmn [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateCoreNonSharedSlice.bpmn [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateCoreSharedSlice.bpmn [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateNSIandNSSI.bpmn
bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateNSSI.bpmn
bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateTransportNSSI.bpmn [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateSliceServiceInstance.bpmn
bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateSliceServiceOption.bpmn
bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateTnNssiInstance.bpmn [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateAccessNSSI.bpmn [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateCoreNSSI.bpmn [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateNSSI.bpmn
bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateTransportNSSI.bpmn [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteSliceService.bpmn
bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoHandleOofRequest.bpmn
bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoHandleSdnrDmaapRequest.bpmn [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoModifyAccessNSSI.bpmn [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoModifyCoreNSSI.bpmn [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoModifyRanNfNssi.bpmn [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoModifyTransportNSSI.bpmn [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/QueryJobStatus.bpmn [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/ServiceLevelUpgradeTest.java
bpmn/so-bpmn-infrastructure-flows/src/test/resources/response/PnfDemo1_aai.json [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-flows/src/test/resources/response/PnfDemo_aai.json [moved from bpmn/so-bpmn-infrastructure-flows/src/test/resources/response/Pnf_aai.json with 100% similarity]
bpmn/so-bpmn-infrastructure-flows/src/test/resources/response/Service_instance_aai.json
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIQueryTasks.java
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnf/tasks/CnfAdapter.java [new file with mode: 0644]
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessor.java
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/service/level/ServiceLevel.java [moved from bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/service/level/ServiceLevelPreparable.java with 80% similarity]
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/service/level/impl/ServiceLevelConstants.java
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/service/level/impl/ServiceLevelPostcheck.java
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/service/level/impl/ServiceLevelPreparation.java
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/service/level/impl/ServiceLevelRequestDispatcher.java
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/service/level/impl/ServiceLevelUpgrade.java
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/vfmodule/CreateVFModule.java
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/VrfValidation.java
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionExtractResourcesAAI.java
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAICollectionResources.java
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIInstanceGroupResources.java
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIPnfResources.java
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIServiceInstanceResources.java
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVfModuleResources.java
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVolumeGroupResources.java
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVpnBindingResources.java
bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/service/level/impl/ServiceLevelUpgradeTest.java [new file with mode: 0644]
bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/vfmodule/DeleteVfModuleTest.java [new file with mode: 0644]
bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/VrfValidationTest.java
bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java
bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAICollectionResourcesTest.java
bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java
bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIInstanceGroupResourcesTest.java
bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAINetworkResourcesTest.java
bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIPnfResourcesTest.java
bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIServiceInstanceResourcesTest.java
bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVfModuleResourcesTest.java
bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVnfResourcesTest.java
bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVolumeGroupResourcesTest.java
common/src/main/java/org/onap/so/beans/nsmf/ActDeActNssi.java
common/src/main/java/org/onap/so/beans/nsmf/AllocateAnNssi.java
common/src/main/java/org/onap/so/beans/nsmf/AllocateCnNssi.java
common/src/main/java/org/onap/so/beans/nsmf/DeAllocateNssi.java
common/src/main/java/org/onap/so/beans/nsmf/ResponseDescriptor.java
common/src/main/java/org/onap/so/beans/nsmf/ServiceInfo.java
common/src/main/java/org/onap/so/beans/nsmf/SliceTaskInfo.java [new file with mode: 0644]
common/src/main/java/org/onap/so/beans/nsmf/SliceTaskParamsAdapter.java [new file with mode: 0644]
common/src/main/java/org/onap/so/beans/nsmf/TnSliceProfile.java
common/src/main/java/org/onap/so/beans/nsmf/oof/NsiReqBody.java [new file with mode: 0644]
common/src/main/java/org/onap/so/beans/nsmf/oof/NssiReqBody.java [new file with mode: 0644]
common/src/main/java/org/onap/so/beans/nsmf/oof/RequestInfo.java [new file with mode: 0644]
common/src/main/java/org/onap/so/beans/nsmf/oof/SubnetCapability.java [new file with mode: 0644]
common/src/main/java/org/onap/so/beans/nsmf/oof/SubnetType.java [new file with mode: 0644]
common/src/main/java/org/onap/so/beans/nsmf/oof/TemplateInfo.java [new file with mode: 0644]
common/src/main/java/org/onap/so/utils/ExternalTaskServiceUtils.java
docs/developer_info/BBUnderstanding.rst
docs/developer_info/Cxf_Logging.rst [new file with mode: 0644]
docs/developer_info/developer_information.rst
docs/developer_info/mso_adapter_restinterface.rst [new file with mode: 0644]
docs/images/AssignServiceInstanceBB.png [new file with mode: 0644]
docs/images/ExecuteBuildingBlock.png [new file with mode: 0644]
docs/images/flowchart.png [new file with mode: 0644]
docs/images/module_structure.png [new file with mode: 0644]
docs/images/msoexception.png [new file with mode: 0644]
docs/images/nwrest.png [new file with mode: 0644]
docs/images/tenantrest.png [new file with mode: 0644]
docs/images/vnfrest.png [new file with mode: 0644]
docs/images/workflow.png [new file with mode: 0644]
graph-inventory/aai-client/pom.xml
graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIObjectPlurals.java
graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIObjectType.java
graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIRestClientImpl.java
graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIVersion.java
graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAIFluentTypeReverseLookup.java
graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAIPluralFragment.java [new file with mode: 0644]
graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAIResourceUri.java
graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAISimpleUri.java
graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAISingleFragment.java [new file with mode: 0644]
graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAIUriFactory.java
graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AllottedResourceLookupUri.java
graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/HttpLookupUri.java
graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/ServiceInstanceUri.java
graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryFluentTypeBase.java
graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryFragmentBase.java [new file with mode: 0644]
graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryPluralFragment.java [new file with mode: 0644]
graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryResourcesClient.java
graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventorySingleFragment.java [new file with mode: 0644]
graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryTransactionClient.java
graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/GraphInventoryRelationships.java
graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/uri/GraphInventorySingleResourceUri.java
graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/uri/SimpleBaseUri.java
graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/uri/SimplePluralUri.java
graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/uri/SimpleUri.java
graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAIObjectTypeTest.java
graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAIQueryClientTest.java
graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAIResourcesClientTest.java
graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAIResourcesClientWithServiceInstanceUriTest.java
graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAISingleTransactionClientTest.java
graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAITransactionalClientTest.java
graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAIURITest.java
graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/DSLQueryBuilderTest.java
graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/entities/RelationshipsTest.java
graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/entities/uri/AAISimpleUriFromParentUriTest.java
graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/entities/uri/AAISimpleUriFromUriTest.java
graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/entities/uri/AAISimpleUriTest.java
graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/entities/uri/AAIUriFactoryTest.java
graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/entities/uri/AllottedResourceLookupUriTest.java
graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/entities/uri/IncorrectNumberOfUriKeysTest.java [deleted file]
graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/entities/uri/ServiceInstanceUriTest.java
graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/graphinventory/entities/uri/parsers/UriParserSpringImplTest.java
graph-inventory/fluent-builder-maven-plugin/pom.xml
graph-inventory/fluent-builder-maven-plugin/src/main/java/org/onap/graphinventory/generate/FluentGenerator.java
graph-inventory/fluent-builder-maven-plugin/src/main/java/org/onap/graphinventory/generate/FluentGeneratorMojo.java
mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java
mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Onap3gppServiceInstances.java
mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java
mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java
mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/AAIDataRetrieval.java
mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/BpmnRequestBuilder.java
mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/VolumeGroupDeleteValidator.java
mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/onap3gppserviceinstancebeans/QuerySubnetCapability.java
mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/AAIClientHelper.java
mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironment.java
mso-api-handlers/mso-api-handler-infra/src/main/resources/subnetCapability.json [new file with mode: 0644]
mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/Onap3gppServiceInstancesTest.java
mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/RequestHandlerUtilsTest.java
mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/AAIDataRetrievalTest.java
mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/BpmnRequestBuilderTest.java
mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/validator/VolumeGroupDeleteValidatorTest.java
mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/AllottedResource.java
packages/docker/src/main/docker/docker-files/configs/logging/logback-spring.xml
pom.xml
so-etsi-nfvo/pom.xml
so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-application/src/main/resources/application.yaml
so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/pom.xml
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/CamundaDatabaseConfiguration.java
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
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/EtsiCatalogPackageManagementServiceProvider.java
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
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
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/CreateInstantiateRequest.java [new file with mode: 0644]
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 [new file with mode: 0644]
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 [new file with mode: 0644]
so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/resources/CreateInstantiateVnf.bpmn [new file with mode: 0644]
so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/resources/InstantiateNs.bpmn [new file with mode: 0644]
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
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 [new file with mode: 0644]
so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/test/resources/application.yaml
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
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/State.java
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/config/NfvoDatabaseConfiguration.java
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
so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-service/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/EtsiSoNsLcmManagerUrlProvider.java
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
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
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/exceptions/NsLcmControllerExceptionHandler.java
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
so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-service/src/test/resources/application.yaml
so-sdn-clients/src/main/java/org/onap/so/client/sdno/SDNOValidatorImpl.java
so-simulator/src/main/java/org/onap/so/simulator/actions/aai/DeleteVServers.java
so-simulator/src/main/java/org/onap/so/simulator/actions/aai/ProcessNetwork.java
so-simulator/src/main/java/org/onap/so/simulator/actions/aai/ProcessVnfc.java
so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/CreateAAInventory.java
so-simulator/src/main/resources/openstack/gr_api/GetNeutronNetwork2.json

index 3995185..f326d92 100644 (file)
@@ -25,11 +25,22 @@ import java.util.LinkedList;
 import java.util.List;
 import java.util.Optional;
 import org.apache.logging.log4j.util.Strings;
-import org.onap.aai.domain.yang.*;
-import org.onap.aaiclient.client.aai.AAIObjectType;
+import org.onap.aai.domain.yang.EsrSystemInfo;
+import org.onap.aai.domain.yang.EsrSystemInfoList;
+import org.onap.aai.domain.yang.EsrVnfm;
+import org.onap.aai.domain.yang.EsrVnfmList;
+import org.onap.aai.domain.yang.GenericVnf;
+import org.onap.aai.domain.yang.GenericVnfs;
+import org.onap.aai.domain.yang.RelatedToProperty;
+import org.onap.aai.domain.yang.Relationship;
+import org.onap.aai.domain.yang.RelationshipData;
+import org.onap.aai.domain.yang.RelationshipList;
+import org.onap.aai.domain.yang.Vserver;
 import org.onap.aaiclient.client.aai.AAIResourcesClient;
+import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
 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.uri.Depth;
 import org.onap.so.adapters.vevnfm.exception.VeVnfmException;
 import org.slf4j.Logger;
@@ -104,7 +115,7 @@ public class AaiConnection {
     }
 
     private List<EsrSystemInfo> receiveVnfmInternal() {
-        final AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VNFM_LIST);
+        final AAIPluralResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.externalSystem().esrVnfmList());
         final Optional<EsrVnfmList> response = getResourcesClient().get(EsrVnfmList.class, resourceUri);
 
         if (response.isPresent()) {
@@ -127,7 +138,7 @@ public class AaiConnection {
 
     private List<EsrSystemInfo> receiveVnfmServiceUrl(final String vnfmId) {
         final Optional<EsrVnfm> response = getResourcesClient().get(EsrVnfm.class,
-                AAIUriFactory.createResourceUri(AAIObjectType.VNFM, vnfmId).depth(Depth.ONE));
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.externalSystem().esrVnfm(vnfmId)).depth(Depth.ONE));
 
         if (response.isPresent()) {
             final EsrVnfm esrVnfm = response.get();
@@ -143,8 +154,8 @@ public class AaiConnection {
     }
 
     public String receiveGenericVnfId(final String href) {
-        final AAIResourceUri resourceUri =
-                AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNFS).queryParam(SELFLINK, href);
+        final AAIPluralResourceUri resourceUri =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnfs()).queryParam(SELFLINK, href);
         final Optional<GenericVnfs> response = getResourcesClient().get(GenericVnfs.class, resourceUri);
 
         if (response.isPresent()) {
@@ -165,7 +176,7 @@ public class AaiConnection {
     }
 
     public String receiveVserverName(final String genericId) {
-        final AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, genericId);
+        final AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(genericId));
         final Optional<GenericVnf> response = getResourcesClient().get(GenericVnf.class, resourceUri);
 
         if (response.isPresent()) {
@@ -199,7 +210,7 @@ public class AaiConnection {
     private String receiveVserverNameFromParams(final String cloudOwner, final String cloudId, final String tenantId,
             final String vserverId) {
         final AAIResourceUri resourceUri =
-                AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, cloudOwner, cloudId, tenantId, vserverId);
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(cloudOwner, cloudId).tenant(tenantId).vserver(vserverId));
         final Optional<Vserver> response = getResourcesClient().get(Vserver.class, resourceUri);
 
         if (response.isPresent()) {
index d9450b3..8f95d8a 100644 (file)
@@ -26,8 +26,8 @@ import org.onap.aai.domain.yang.EsrVnfmList;
 import org.onap.aai.domain.yang.GenericVnf;
 import org.onap.aai.domain.yang.GenericVnfs;
 import org.onap.aai.domain.yang.Vserver;
-import org.onap.aaiclient.client.aai.AAIObjectType;
 import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
 import org.onap.aaiclient.client.graphinventory.entities.uri.Depth;
 import org.onap.so.adapters.etsisol003adapter.lcm.v1.model.Tenant;
 import org.slf4j.Logger;
@@ -49,7 +49,8 @@ public class AaiServiceProviderImpl implements AaiServiceProvider {
     @Override
     public GenericVnf invokeGetGenericVnf(final String vnfId) {
         return aaiClientProvider.getAaiClient()
-                .get(GenericVnf.class, AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId))
+                .get(GenericVnf.class,
+                        AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)))
                 .orElseGet(() -> {
                     logger.debug("No vnf found in AAI with ID: {}", vnfId);
                     return null;
@@ -58,9 +59,8 @@ public class AaiServiceProviderImpl implements AaiServiceProvider {
 
     @Override
     public GenericVnfs invokeQueryGenericVnf(final String selfLink) {
-        return aaiClientProvider.getAaiClient()
-                .get(GenericVnfs.class,
-                        AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNFS).queryParam("selflink", selfLink))
+        return aaiClientProvider.getAaiClient().get(GenericVnfs.class, AAIUriFactory
+                .createResourceUri(AAIFluentTypeBuilder.network().genericVnfs()).queryParam("selflink", selfLink))
                 .orElseGet(() -> {
                     logger.debug("No vnf found in AAI with selflink: {}", selfLink);
                     return null;
@@ -70,7 +70,9 @@ public class AaiServiceProviderImpl implements AaiServiceProvider {
     @Override
     public EsrVnfmList invokeGetVnfms() {
         return aaiClientProvider.getAaiClient()
-                .get(EsrVnfmList.class, AAIUriFactory.createResourceUri(AAIObjectType.VNFM_LIST)).orElseGet(() -> {
+                .get(EsrVnfmList.class,
+                        AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.externalSystem().esrVnfmList()))
+                .orElseGet(() -> {
                     logger.debug("No VNFMs in AAI");
                     return null;
                 });
@@ -79,7 +81,8 @@ public class AaiServiceProviderImpl implements AaiServiceProvider {
     @Override
     public EsrVnfm invokeGetVnfm(final String vnfmId) {
         return aaiClientProvider.getAaiClient()
-                .get(EsrVnfm.class, AAIUriFactory.createResourceUri(AAIObjectType.VNFM, vnfmId).depth(Depth.ONE))
+                .get(EsrVnfm.class, AAIUriFactory
+                        .createResourceUri(AAIFluentTypeBuilder.externalSystem().esrVnfm(vnfmId)).depth(Depth.ONE))
                 .orElseGet(() -> {
                     logger.debug("VNFM not found in AAI");
                     return null;
@@ -90,7 +93,8 @@ public class AaiServiceProviderImpl implements AaiServiceProvider {
     public EsrSystemInfoList invokeGetVnfmEsrSystemInfoList(final String vnfmId) {
         return aaiClientProvider.getAaiClient()
                 .get(EsrSystemInfoList.class,
-                        AAIUriFactory.createResourceUri(AAIObjectType.VNFM_ESR_SYSTEM_INFO_LIST, vnfmId))
+                        AAIUriFactory.createResourceUri(
+                                AAIFluentTypeBuilder.externalSystem().esrVnfm(vnfmId).esrSystemInfoList()))
                 .orElseGet(() -> {
                     logger.debug("VNFM ESR system info list not found in AAI");
                     return null;
@@ -99,45 +103,47 @@ public class AaiServiceProviderImpl implements AaiServiceProvider {
 
     @Override
     public void invokePatchGenericVnf(final GenericVnf vnf) {
-        aaiClientProvider.getAaiClient()
-                .update(AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId()), vnf);
+        aaiClientProvider.getAaiClient().update(
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId())), vnf);
     }
 
     @Override
     public void invokePutGenericVnfToVnfmRelationship(final GenericVnf vnf, final String vnfmId) {
-        aaiClientProvider.getAaiClient().connect(AAIUriFactory.createResourceUri(AAIObjectType.VNFM, vnfmId),
-                AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId()));
+        aaiClientProvider.getAaiClient().connect(
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.externalSystem().esrVnfm(vnfmId)),
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId())));
     }
 
     @Override
     public void invokePutVserver(final String cloudOwner, final String cloudRegion, final String tenant,
             final Vserver vserver) {
-        aaiClientProvider.getAaiClient().create(AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, cloudOwner,
-                cloudRegion, tenant, vserver.getVserverId()), vserver);
+        aaiClientProvider
+                .getAaiClient().create(
+                        AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+                                .cloudRegion(cloudOwner, cloudRegion).tenant(tenant).vserver(vserver.getVserverId())),
+                        vserver);
     }
 
     @Override
     public void invokePutVserverToVnfRelationship(final String cloudOwner, final String cloudRegion,
             final String tenant, final Vserver vserver, final String vnfId) {
-        aaiClientProvider.getAaiClient()
-                .connect(
-                        AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, cloudOwner, cloudRegion, tenant,
-                                vserver.getVserverId()),
-                        AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId));
+        aaiClientProvider.getAaiClient().connect(
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+                        .cloudRegion(cloudOwner, cloudRegion).tenant(tenant).vserver(vserver.getVserverId())),
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)));
     }
 
     @Override
     public void invokeDeleteVserver(final String cloudOwner, final String cloudRegion, final String tenant,
             final String vserverId) {
-        aaiClientProvider.getAaiClient().delete(
-                AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, cloudOwner, cloudRegion, tenant, vserverId));
+        aaiClientProvider.getAaiClient().delete(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder
+                .cloudInfrastructure().cloudRegion(cloudOwner, cloudRegion).tenant(tenant).vserver(vserverId)));
     }
 
     @Override
     public Tenant invokeGetTenant(final String cloudOwner, final String cloudRegion, final String tenantId) {
-        return aaiClientProvider.getAaiClient()
-                .get(Tenant.class,
-                        AAIUriFactory.createResourceUri(AAIObjectType.TENANT, cloudOwner, cloudRegion, tenantId))
+        return aaiClientProvider.getAaiClient().get(Tenant.class, AAIUriFactory.createResourceUri(
+                AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(cloudOwner, cloudRegion).tenant(tenantId)))
                 .orElseGet(() -> {
                     logger.debug("Tenant not found in AAI");
                     return null;
@@ -147,8 +153,8 @@ public class AaiServiceProviderImpl implements AaiServiceProvider {
     @Override
     public EsrSystemInfoList invokeGetCloudRegionEsrSystemInfoList(final String cloudOwner, final String cloudRegion) {
         return aaiClientProvider
-                .getAaiClient().get(EsrSystemInfoList.class, AAIUriFactory
-                        .createResourceUri(AAIObjectType.CLOUD_ESR_SYSTEM_INFO_LIST, cloudOwner, cloudRegion))
+                .getAaiClient().get(EsrSystemInfoList.class, AAIUriFactory.createResourceUri(AAIFluentTypeBuilder
+                        .cloudInfrastructure().cloudRegion(cloudOwner, cloudRegion).esrSystemInfoList()))
                 .orElseGet(() -> {
                     logger.debug("Cloud esr system info list not found in AAI");
                     return null;
index 9aed675..5bc4daa 100644 (file)
@@ -53,6 +53,7 @@ import org.onap.aai.domain.yang.RelationshipData;
 import org.onap.aai.domain.yang.RelationshipList;
 import org.onap.aaiclient.client.aai.AAIResourcesClient;
 import org.onap.aaiclient.client.aai.AAIVersion;
+import org.onap.aaiclient.client.aai.entities.uri.AAIBaseResourceUri;
 import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
 import org.onap.so.adapters.etsisol003adapter.lcm.extclients.EtsiPackageProvider;
 import org.onap.so.adapters.etsisol003adapter.lcm.extclients.vnfm.VnfmRestTemplateConfiguration;
@@ -534,7 +535,7 @@ public class EtsiSol003AdapterControllerTest {
     }
 
 
-    private class AaiResourceUriMatcher extends BaseMatcher<AAIResourceUri> {
+    private class AaiResourceUriMatcher extends BaseMatcher<AAIBaseResourceUri<?, ?>> {
 
         final String uriAsString;
 
@@ -544,12 +545,12 @@ public class EtsiSol003AdapterControllerTest {
 
         @Override
         public boolean matches(final Object item) {
-            if (item instanceof AAIResourceUri) {
+            if (item instanceof AAIBaseResourceUri<?, ?>) {
                 if (uriAsString.endsWith("...")) {
-                    return ((AAIResourceUri) item).build().toString()
+                    return ((AAIBaseResourceUri<?, ?>) item).build().toString()
                             .startsWith(uriAsString.substring(0, uriAsString.indexOf("...")));
                 }
-                return ((AAIResourceUri) item).build().toString().equals(uriAsString);
+                return ((AAIBaseResourceUri<?, ?>) item).build().toString().equals(uriAsString);
             }
             return false;
         }
index 21e5661..99b8c71 100644 (file)
@@ -43,7 +43,7 @@ import org.onap.aai.domain.yang.Relationship;
 import org.onap.aai.domain.yang.RelationshipData;
 import org.onap.aai.domain.yang.RelationshipList;
 import org.onap.aaiclient.client.aai.AAIResourcesClient;
-import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
+import org.onap.aaiclient.client.aai.entities.uri.AAIBaseResourceUri;
 import org.onap.so.adapters.etsisol003adapter.lcm.grant.model.GrantRequest;
 import org.onap.so.adapters.etsisol003adapter.lcm.grant.model.GrantRequest.OperationEnum;
 import org.onap.so.adapters.etsisol003adapter.lcm.grant.model.GrantsAddResources;
@@ -224,7 +224,7 @@ public class Sol003GrantControllerTest {
                         "/network/generic-vnfs?selflink=http%3A%2F%2Fvnfm%3A8080%2Fvnfs%2FmyTestVnfIdOnVnfm")));
     }
 
-    private class AaiResourceUriMatcher extends BaseMatcher<AAIResourceUri> {
+    private class AaiResourceUriMatcher extends BaseMatcher<AAIBaseResourceUri<?, ?>> {
 
         final String uriAsString;
 
@@ -234,12 +234,12 @@ public class Sol003GrantControllerTest {
 
         @Override
         public boolean matches(final Object item) {
-            if (item instanceof AAIResourceUri) {
+            if (item instanceof AAIBaseResourceUri) {
                 if (uriAsString.endsWith("...")) {
-                    return ((AAIResourceUri) item).build().toString()
+                    return ((AAIBaseResourceUri<?, ?>) item).build().toString()
                             .startsWith(uriAsString.substring(0, uriAsString.indexOf("...")));
                 }
-                return ((AAIResourceUri) item).build().toString().equals(uriAsString);
+                return ((AAIBaseResourceUri<?, ?>) item).build().toString().equals(uriAsString);
             }
             return false;
         }
index 86eda0a..0d5bcd2 100644 (file)
@@ -54,6 +54,7 @@ import org.onap.aai.domain.yang.RelationshipData;
 import org.onap.aai.domain.yang.RelationshipList;
 import org.onap.aai.domain.yang.Vserver;
 import org.onap.aaiclient.client.aai.AAIResourcesClient;
+import org.onap.aaiclient.client.aai.entities.uri.AAIBaseResourceUri;
 import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
 import org.onap.so.adapters.etsisol003adapter.lcm.extclients.aai.AaiHelper;
 import org.onap.so.adapters.etsisol003adapter.lcm.extclients.aai.OamIpAddressSource;
@@ -385,7 +386,7 @@ public class Sol003LcnControllerTest {
         genericVnf.getRelationshipList().getRelationship().add(relationshipToVserver);
     }
 
-    private class AaiResourceUriMatcher extends BaseMatcher<AAIResourceUri> {
+    private class AaiResourceUriMatcher extends BaseMatcher<AAIBaseResourceUri<?, ?>> {
 
         final String uriAsString;
 
@@ -395,12 +396,12 @@ public class Sol003LcnControllerTest {
 
         @Override
         public boolean matches(final Object item) {
-            if (item instanceof AAIResourceUri) {
+            if (item instanceof AAIBaseResourceUri<?, ?>) {
                 if (uriAsString.endsWith("...")) {
-                    return ((AAIResourceUri) item).build().toString()
+                    return ((AAIBaseResourceUri<?, ?>) item).build().toString()
                             .startsWith(uriAsString.substring(0, uriAsString.indexOf("...")));
                 }
-                return ((AAIResourceUri) item).build().toString().equals(uriAsString);
+                return ((AAIBaseResourceUri<?, ?>) item).build().toString().equals(uriAsString);
             }
             return false;
         }
index 01ba94d..b636f68 100644 (file)
                 <source>${project.basedir}/target/generated-sources/vnfmadapter/src/gen/java/main</source>
                 <source>${project.basedir}/target/generated-sources/sol003-vnf-lcn/src/gen/java/main</source>
                 <source>${project.basedir}/target/generated-sources/sol003-vnf-grant/src/gen/java/main</source>
+                <source>${project.basedir}/target/generated-sources/etsisol003adapter/src/gen/java/main</source>
               </sources>
             </configuration>
           </execution>
index fa5c57f..ab02390 100644 (file)
@@ -90,22 +90,31 @@ public final class AuthenticationMethodFactory {
         return v3Auth;
     }
 
-    public final com.woorea.openstack.keystone.v3.model.Authentication getAuthenticationForV3(
-            CloudIdentity cloudIdentity) {
+    public final com.woorea.openstack.keystone.v3.model.Authentication getAuthenticationForV3ByName(
+            CloudIdentity cloudIdentity, String name) {
         Identity identity = new Identity();
         Password password = new Password();
         User user = new User();
         Domain userDomain = new Domain();
+        Scope scope = new Scope();
+        Project project = new Project();
+        Project.Domain projectDomain = new Project.Domain();
         userDomain.setName(cloudIdentity.getUserDomainName());
+        projectDomain.setName(cloudIdentity.getProjectDomainName());
         user.setName(cloudIdentity.getMsoId());
         user.setPassword(CryptoUtils.decryptCloudConfigPassword(cloudIdentity.getMsoPass()));
         user.setDomain(userDomain);
         password.setUser(user);
+        project.setDomain(projectDomain);
+        project.setName(name);
+        scope.setProject(project);
         identity.setPassword(password);
         identity.setMethods(Collections.singletonList("password"));
         com.woorea.openstack.keystone.v3.model.Authentication v3Auth =
                 new com.woorea.openstack.keystone.v3.model.Authentication();
         v3Auth.setIdentity(identity);
+        v3Auth.setScope(scope);
         return v3Auth;
     }
+
 }
index 50ebcc6..6800428 100644 (file)
@@ -97,7 +97,7 @@ public class MsoCommonUtils {
      * openstack-java-sdk classname of the OpenStackRequest<T> parameter).
      */
 
-    protected <T> T executeAndRecordOpenstackRequest(OpenStackRequest<T> request) {
+    public <T> T executeAndRecordOpenstackRequest(OpenStackRequest<T> request) {
         return executeAndRecordOpenstackRequest(request, true);
     }
 
@@ -174,7 +174,7 @@ public class MsoCommonUtils {
      * Convert an Openstack Exception on a Keystone call to an MsoException. This method supports both
      * OpenstackResponseException and OpenStackConnectException.
      */
-    protected MsoException keystoneErrorToMsoException(OpenStackBaseException e, String context) {
+    public MsoException keystoneErrorToMsoException(OpenStackBaseException e, String context) {
         MsoException me = null;
 
         if (e instanceof OpenStackResponseException) {
@@ -455,15 +455,16 @@ public class MsoCommonUtils {
      */
     protected KeystoneAuthHolder getKeystoneAuthHolder(String cloudSiteId, String tenantId, String serviceName)
             throws MsoException {
-        CloudSite cloudSite =
-                cloudConfig.getCloudSite(cloudSiteId).orElseThrow(() -> new MsoCloudSiteNotFound(cloudSiteId));
-        String cloudId = cloudSite.getId();
-        String region = cloudSite.getRegionId();
-        CloudIdentity cloudIdentity = cloudSite.getIdentityService();
-        MsoTenantUtils tenantUtils =
-                tenantUtilsFactory.getTenantUtilsByServerType(cloudIdentity.getIdentityServerType());
-        String keystoneUrl = tenantUtils.getKeystoneUrl(cloudId, cloudIdentity);
+        CloudIdentity cloudIdentity = null;
         try {
+            CloudSite cloudSite =
+                    cloudConfig.getCloudSite(cloudSiteId).orElseThrow(() -> new MsoCloudSiteNotFound(cloudSiteId));
+            String cloudId = cloudSite.getId();
+            String region = cloudSite.getRegionId();
+            cloudIdentity = cloudSite.getIdentityService();
+            MsoTenantUtils tenantUtils =
+                    tenantUtilsFactory.getTenantUtilsByServerType(cloudIdentity.getIdentityServerType());
+            String keystoneUrl = tenantUtils.getKeystoneUrl(cloudId, cloudIdentity);
             if (ServerType.KEYSTONE.equals(cloudIdentity.getIdentityServerType())) {
                 Access access = getKeystone(tenantId, cloudIdentity, keystoneUrl);
                 try {
index 072ab5a..63bc235 100644 (file)
 package org.onap.so.openstack.utils;
 
 import java.util.Map;
-import org.onap.so.cloud.authentication.AuthenticationMethodFactory;
 import org.onap.so.db.catalog.beans.CloudIdentity;
-import org.onap.so.db.catalog.beans.CloudSite;
 import org.onap.so.openstack.beans.MsoTenant;
 import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound;
 import org.onap.so.openstack.exceptions.MsoException;
-import org.onap.so.utils.CryptoUtils;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
-import com.woorea.openstack.keystone.v3.model.Token;
-import com.woorea.openstack.base.client.OpenStackConnectException;
-import com.woorea.openstack.base.client.OpenStackResponseException;
-import com.woorea.openstack.keystone.v3.Keystone;
-import com.woorea.openstack.keystone.v3.api.TokensResource.Authenticate;
-import com.woorea.openstack.keystone.v3.model.Authentication;
-import com.woorea.openstack.keystone.v3.model.Authentication.Identity;
 
 @Component
 public class MsoKeystoneV3Utils extends MsoTenantUtils {
 
-    @Autowired
-    private AuthenticationMethodFactory authenticationMethodFactory;
-
     @Override
     public String createTenant(String tenantName, String cloudSiteId, Map<String, String> metadata, boolean backout)
             throws MsoException {
@@ -71,22 +57,4 @@ public class MsoKeystoneV3Utils extends MsoTenantUtils {
         return cloudIdentity.getIdentityUrl();
     }
 
-    public Token getKeystoneToken(CloudSite cloudSite) throws MsoException {
-        try {
-            CloudIdentity cloudIdentity = cloudSite.getIdentityService();
-
-            Keystone keystone = new Keystone(cloudIdentity.getIdentityUrl());
-
-            Authentication auth = authenticationMethodFactory.getAuthenticationForV3(cloudIdentity);
-
-            Authenticate authenticate = keystone.tokens().authenticate(auth);
-            return executeAndRecordOpenstackRequest(authenticate);
-
-        } catch (OpenStackResponseException e) {
-            throw keystoneErrorToMsoException(e, "TokenAuth");
-        } catch (OpenStackConnectException e) {
-            throw keystoneErrorToMsoException(e, "TokenAuth");
-        }
-    }
-
 }
index 305d52a..89fd9a0 100644 (file)
@@ -37,10 +37,11 @@ public class QueryServiceMacroHolder extends CatalogQuery {
             + "\t\t\"modelUuid\"          : <SERVICE_MODEL_UUID>,\n"
             + "\t\t\"modelInvariantUuid\" : <SERVICE_MODEL_INVARIANT_ID>,\n"
             + "\t\t\"modelVersion\"       : <SERVICE_MODEL_VERSION>\n" + "\t},\n"
-            + "\t\"serviceType\"        : <SERVICE_TYPE>,\n" + "\t\"serviceRole\"        : <SERVICE_ROLE>,\n"
-            + "\t\"environmentContext\" : <ENVIRONMENT_CONTEXT>,\n" + "\t\"resourceOrder\"      : <RESOURCE_ORDER>,\n"
-            + "\t\"workloadContext\"    : <WORKLOAD_CONTEXT>,\n" + "<_SERVICEVNFS_>,\n" + "<_SERVICENETWORKS_>,\n"
-            + "<_SERVICEINFO_>,\n" + "<_SERVICEPROXY_>,\n" + "<_SERVICEALLOTTEDRESOURCES_>\n" + "\t}}";
+            + "\t\"serviceCategory\"    : <SERVICE_CATEGORY>,\n" + "\t\"serviceType\"        : <SERVICE_TYPE>,\n"
+            + "\t\"serviceRole\"        : <SERVICE_ROLE>,\n" + "\t\"environmentContext\" : <ENVIRONMENT_CONTEXT>,\n"
+            + "\t\"resourceOrder\"      : <RESOURCE_ORDER>,\n" + "\t\"workloadContext\"    : <WORKLOAD_CONTEXT>,\n"
+            + "<_SERVICEVNFS_>,\n" + "<_SERVICENETWORKS_>,\n" + "<_SERVICEINFO_>,\n" + "<_SERVICEPROXY_>,\n"
+            + "<_SERVICEALLOTTEDRESOURCES_>\n" + "\t}}";
 
     public QueryServiceMacroHolder() {
         super();
@@ -80,6 +81,7 @@ public class QueryServiceMacroHolder extends CatalogQuery {
         put(valueMap, "SERVICE_MODEL_VERSION", service.getModelVersion());
         put(valueMap, "SERVICE_TYPE", service.getServiceType());
         put(valueMap, "SERVICE_ROLE", service.getServiceRole());
+        put(valueMap, "SERVICE_CATEGORY", service.getCategory());
         put(valueMap, "ENVIRONMENT_CONTEXT", service.getEnvironmentContext());
         put(valueMap, "WORKLOAD_CONTEXT", service.getWorkloadContext());
         put(valueMap, "RESOURCE_ORDER", service.getResourceOrder());
index e94c283..0ba40e2 100644 (file)
@@ -28,8 +28,10 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerA
 import org.springframework.boot.autoconfigure.liquibase.LiquibaseAutoConfiguration;
 import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
 import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration;
+import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.ComponentScan;
 import org.springframework.context.annotation.Configuration;
+import org.springframework.web.client.RestTemplate;
 
 @SpringBootApplication
 @ComponentScan(basePackages = {"org.onap.so.adapters.cnf"})
@@ -42,4 +44,9 @@ public class MSOCnfApplication {
     public static void main(String... args) {
         SpringApplication.run(MSOCnfApplication.class, args);
     }
+
+    @Bean
+    public RestTemplate restTemplate() {
+        return new RestTemplate();
+    }
 }
diff --git a/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/GroupVersionKind.java b/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/GroupVersionKind.java
new file mode 100644 (file)
index 0000000..bfa5505
--- /dev/null
@@ -0,0 +1,66 @@
+
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.adapters.cnf.model;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({"Group", "Version", "Kind"})
+public class GroupVersionKind {
+    @JsonProperty("Group")
+    private String group;
+    @JsonProperty("Version")
+    private String version;
+    @JsonProperty("Kind")
+    private String kind;
+
+    @JsonProperty("Group")
+    public String getGroup() {
+        return group;
+    }
+
+    @JsonProperty("Group")
+    public void setGroup(String group) {
+        this.group = group;
+    }
+
+    @JsonProperty("Version")
+    public String getVersion() {
+        return version;
+    }
+
+    @JsonProperty("Version")
+    public void setVersion(String version) {
+        this.version = version;
+    }
+
+    @JsonProperty("Kind")
+    public String getKind() {
+        return kind;
+    }
+
+    @JsonProperty("Kind")
+    public void setKind(String kind) {
+        this.kind = kind;
+    }
+}
diff --git a/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/InstanceMiniResponse.java b/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/InstanceMiniResponse.java
new file mode 100644 (file)
index 0000000..5804082
--- /dev/null
@@ -0,0 +1,62 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.cnf.model;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonIgnoreProperties(value = "true")
+public class InstanceMiniResponse extends Response {
+
+    private String id;
+    private MulticloudInstanceRequest request;
+    private String nameSpace;
+
+    public InstanceMiniResponse(String errorMsg) {
+        super(errorMsg);
+    }
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public MulticloudInstanceRequest getRequest() {
+        return request;
+    }
+
+    public void setRequest(MulticloudInstanceRequest request) {
+        this.request = request;
+    }
+
+    public String getNameSpace() {
+        return nameSpace;
+    }
+
+    public void setNameSpace(String nameSpace) {
+        this.nameSpace = nameSpace;
+    }
+
+}
diff --git a/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/InstanceMiniResponseList.java b/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/InstanceMiniResponseList.java
new file mode 100644 (file)
index 0000000..ad70fbb
--- /dev/null
@@ -0,0 +1,45 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.cnf.model;
+
+import java.util.List;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonIgnoreProperties(value = "true")
+public class InstanceMiniResponseList extends Response {
+
+    public InstanceMiniResponseList(String errorMsg) {
+        super(errorMsg);
+    }
+
+    private List<InstanceMiniResponse> instancList;
+
+    public List<InstanceMiniResponse> getInstancList() {
+        return instancList;
+    }
+
+    public void setInstancList(List<InstanceMiniResponse> instancList) {
+        this.instancList = instancList;
+    }
+
+}
diff --git a/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/InstanceResponse.java b/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/InstanceResponse.java
new file mode 100644 (file)
index 0000000..effaaf5
--- /dev/null
@@ -0,0 +1,87 @@
+
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.adapters.cnf.model;
+
+import java.util.List;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({"id", "request", "namespace", "resources"})
+@JsonIgnoreProperties(value = "true")
+public class InstanceResponse extends Response {
+
+    @JsonProperty("id")
+    private String id;
+    @JsonProperty("request")
+    private MulticloudInstanceRequest request;
+    @JsonProperty("namespace")
+    private String namespace;
+    @JsonProperty("resources")
+    private List<Resource> resources = null;
+
+    public InstanceResponse(String errorMsg) {
+        super(errorMsg);
+    }
+
+    @JsonProperty("id")
+    public String getId() {
+        return id;
+    }
+
+    @JsonProperty("id")
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    @JsonProperty("request")
+    public MulticloudInstanceRequest getRequest() {
+        return request;
+    }
+
+    @JsonProperty("request")
+    public void setRequest(MulticloudInstanceRequest request) {
+        this.request = request;
+    }
+
+    @JsonProperty("namespace")
+    public String getNamespace() {
+        return namespace;
+    }
+
+    @JsonProperty("namespace")
+    public void setNamespace(String namespace) {
+        this.namespace = namespace;
+    }
+
+    @JsonProperty("resources")
+    public List<Resource> getResources() {
+        return resources;
+    }
+
+    @JsonProperty("resources")
+    public void setResources(List<Resource> resources) {
+        this.resources = resources;
+    }
+
+}
diff --git a/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/InstanceStatusResponse.java b/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/InstanceStatusResponse.java
new file mode 100644 (file)
index 0000000..2472684
--- /dev/null
@@ -0,0 +1,84 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.adapters.cnf.model;
+
+import java.util.List;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonIgnoreProperties(value = "true")
+public class InstanceStatusResponse extends Response {
+
+    public InstanceStatusResponse(String errorMsg) {
+        super(errorMsg);
+    }
+
+    private MulticloudInstanceRequest request;
+
+    private boolean ready;
+
+    private String resourceCount;
+
+    private List<PodStatus> podStatuses;
+
+    private List<?> servicesStatuses;
+
+    public MulticloudInstanceRequest getRequest() {
+        return request;
+    }
+
+    public void setRequest(MulticloudInstanceRequest request) {
+        this.request = request;
+    }
+
+    public boolean isReady() {
+        return ready;
+    }
+
+    public void setReady(boolean ready) {
+        this.ready = ready;
+    }
+
+    public String getResourceCount() {
+        return resourceCount;
+    }
+
+    public void setResourceCount(String resourceCount) {
+        this.resourceCount = resourceCount;
+    }
+
+    public List<PodStatus> getPodStatuses() {
+        return podStatuses;
+    }
+
+    public void setPodStatuses(List<PodStatus> podStatuses) {
+        this.podStatuses = podStatuses;
+    }
+
+    public List<?> getServicesStatuses() {
+        return servicesStatuses;
+    }
+
+    public void setServicesStatuses(List<?> servicesStatuses) {
+        this.servicesStatuses = servicesStatuses;
+    }
+
+}
diff --git a/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/PodStatus.java b/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/PodStatus.java
new file mode 100644 (file)
index 0000000..ed04601
--- /dev/null
@@ -0,0 +1,71 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.cnf.model;
+
+public class PodStatus {
+
+    private String name;
+    private String nameSpace;
+    private boolean ready;
+    private String status;
+    private String[] ipAddresses;
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getNameSpace() {
+        return nameSpace;
+    }
+
+    public void setNameSpace(String nameSpace) {
+        this.nameSpace = nameSpace;
+    }
+
+    public boolean isReady() {
+        return ready;
+    }
+
+    public void setReady(boolean ready) {
+        this.ready = ready;
+    }
+
+    public String getStatus() {
+        return status;
+    }
+
+    public void setStatus(String status) {
+        this.status = status;
+    }
+
+    public String[] getIpAddresses() {
+        return ipAddresses;
+    }
+
+    public void setIpAddresses(String[] ipAddresses) {
+        this.ipAddresses = ipAddresses;
+    }
+
+}
diff --git a/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/Resource.java b/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/Resource.java
new file mode 100644 (file)
index 0000000..d18cd76
--- /dev/null
@@ -0,0 +1,54 @@
+
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.adapters.cnf.model;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({"GVK", "Name"})
+public class Resource {
+    @JsonProperty("GVK")
+    private GroupVersionKind gVK;
+    @JsonProperty("Name")
+    private String name;
+
+    @JsonProperty("GVK")
+    public GroupVersionKind getGVK() {
+        return gVK;
+    }
+
+    @JsonProperty("GVK")
+    public void setGVK(GroupVersionKind gVK) {
+        this.gVK = gVK;
+    }
+
+    @JsonProperty("Name")
+    public String getName() {
+        return name;
+    }
+
+    @JsonProperty("Name")
+    public void setName(String name) {
+        this.name = name;
+    }
+}
diff --git a/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/Response.java b/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/model/Response.java
new file mode 100644 (file)
index 0000000..4230223
--- /dev/null
@@ -0,0 +1,39 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.cnf.model;
+
+public class Response {
+
+    private String errorMsg;
+
+    public Response(String errorMsg) {
+        this.errorMsg = errorMsg;
+    }
+
+    public String getErrorMsg() {
+        return errorMsg;
+    }
+
+    public void setErrorMsg(String errorMsg) {
+        this.errorMsg = errorMsg;
+    }
+
+}
index b6d50da..825778b 100644 (file)
@@ -1,6 +1,27 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
 package org.onap.so.adapters.cnf.rest;
 
 import java.io.File;
+import java.io.IOException;
 import org.apache.http.HttpEntity;
 import org.apache.http.client.methods.CloseableHttpResponse;
 import org.apache.http.client.methods.HttpDelete;
@@ -20,12 +41,17 @@ import org.onap.so.adapters.cnf.model.ConfigTemplateEntity;
 import org.onap.so.adapters.cnf.model.ConfigurationEntity;
 import org.onap.so.adapters.cnf.model.ConfigurationRollbackEntity;
 import org.onap.so.adapters.cnf.model.ConnectivityInfo;
-import org.onap.so.adapters.cnf.model.MulticloudInstanceRequest;
+import org.onap.so.adapters.cnf.model.InstanceMiniResponseList;
+import org.onap.so.adapters.cnf.model.InstanceResponse;
+import org.onap.so.adapters.cnf.model.InstanceStatusResponse;
 import org.onap.so.adapters.cnf.model.ProfileEntity;
 import org.onap.so.adapters.cnf.model.ResourceBundleEntity;
 import org.onap.so.adapters.cnf.model.Tag;
+import org.onap.so.adapters.cnf.service.CnfAdapterService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.ResponseEntity;
 import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -34,6 +60,8 @@ import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.ResponseBody;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.multipart.MultipartFile;
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.databind.JsonMappingException;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.databind.SerializationFeature;
 
@@ -43,23 +71,78 @@ public class CnfAdapterRest {
     private static final Logger logger = LoggerFactory.getLogger(CnfAdapterRest.class);
     private final CloseableHttpClient httpClient = HttpClients.createDefault();
 
+    @Autowired
+    private CnfAdapterService cnfAdapterService;
+
     @ResponseBody
     @RequestMapping(value = {"/api/cnf-adapter/v1/healthcheck"}, method = RequestMethod.GET,
             produces = "application/json")
-    public String healthCheck() throws Exception {
+    public ResponseEntity<String> healthCheck() throws Exception {
 
-        logger.info("health check called.");
+        logger.info("healthCheck called.");
+        return cnfAdapterService.healthCheck();
+
+    }
+
+    @ResponseBody
+    @RequestMapping(value = {"/api/cnf-adapter/v1/instance"}, method = RequestMethod.POST,
+            produces = "application/json", consumes = "application/json")
+    public ResponseEntity<InstanceResponse> createInstance(@RequestBody BpmnInstanceRequest bpmnInstanceRequest)
+            throws JsonParseException, JsonMappingException, IOException {
+
+        logger.info("createInstance called.");
+        return cnfAdapterService.createInstance(bpmnInstanceRequest);
+    }
+
+    @ResponseBody
+    @RequestMapping(value = {"/api/cnf-adapter/v1/instance/{instID}"}, method = RequestMethod.GET,
+            produces = "application/json")
+    public ResponseEntity<InstanceResponse> getInstanceByInstanceId(@PathVariable("instID") String instanceId)
+            throws JsonParseException, JsonMappingException, IOException {
+
+        logger.info("getInstanceByInstanceId called.");
+
+        return cnfAdapterService.getInstanceByInstanceId(instanceId);
+
+    }
+
+    @ResponseBody
+    @RequestMapping(value = {"/api/cnf-adapter/v1/instance/{instID}/status"}, method = RequestMethod.GET,
+            produces = "application/json")
+    public ResponseEntity<InstanceStatusResponse> getInstanceStatusByInstanceId(
+            @PathVariable("instID") String instanceId) throws JsonParseException, JsonMappingException, IOException {
+
+        logger.info("getInstanceStatusByInstanceId called.");
+
+        return cnfAdapterService.getInstanceStatusByInstanceId(instanceId);
+
+    }
+
+    @RequestMapping(value = {"/api/cnf-adapter/v1/instance"}, method = RequestMethod.GET, produces = "application/json")
+    public ResponseEntity<InstanceMiniResponseList> getInstanceByRBNameOrRBVersionOrProfileName(
+            @RequestParam(value = "rb-name", required = false) String rbName,
+            @RequestParam(value = "rb-version", required = false) String rbVersion,
+            @RequestParam(value = "profile-name", required = false) String profileName)
+            throws JsonParseException, JsonMappingException, IOException {
+
+        logger.info("getInstanceByRBNameOrRBVersionOrProfileName called.");
+        return cnfAdapterService.getInstanceByRBNameOrRBVersionOrProfileName(rbName, rbVersion, profileName);
+
+    }
+
+    @ResponseBody
+    @RequestMapping(value = {"/api/cnf-adapter/v1/instance/{instID}"}, method = RequestMethod.DELETE,
+            produces = "application/json")
+    public ResponseEntity<String> deleteInstanceByInstanceId(@PathVariable("instID") String instanceID)
+            throws JsonParseException, JsonMappingException, IOException {
+
+        logger.info("deleteInstanceByInstanceId called.");
+        return cnfAdapterService.deleteInstanceByInstanceId(instanceID);
 
-        // TODO
-        HttpGet req = new HttpGet("http://172.17.0.2:31770/v1/healthcheck");
-        try (CloseableHttpResponse response = httpClient.execute(req)) {
-            logger.info("response:" + response.getEntity());
-            return EntityUtils.toString(response.getEntity());
-        }
     }
 
     @ResponseBody
-    @RequestMapping(value = {"/api/cnf-adapter/v1/v1/rb/definition"}, method = RequestMethod.POST,
+    @RequestMapping(value = {"/api/cnf-adapter/v1/rb/definition"}, method = RequestMethod.POST,
             produces = "application/json")
     public String createRB(@RequestBody ResourceBundleEntity rB) throws Exception {
 
@@ -67,7 +150,7 @@ public class CnfAdapterRest {
 
         // TODO
         // Below URL should be changed as appropriate multicloud URL.
-        HttpPost post = new HttpPost("http://172.17.0.2:31770/v1/rb/definition");
+        HttpPost post = new HttpPost("http://multicloud-k8s:9015/v1/rb/definition");
         ObjectMapper objectMapper = new ObjectMapper();
         objectMapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
         String requestBody = objectMapper.writeValueAsString(rB);
@@ -82,7 +165,7 @@ public class CnfAdapterRest {
     }
 
     @ResponseBody
-    @RequestMapping(value = {"/api/cnf-adapter/v1/v1/rb/definition/{rb-name}/{rb-version}"}, method = RequestMethod.GET,
+    @RequestMapping(value = {"/api/cnf-adapter/v1/rb/definition/{rb-name}/{rb-version}"}, method = RequestMethod.GET,
             produces = "application/json")
     public String getRB(@PathVariable("rb-name") String rbName, @PathVariable("rb-version") String rbVersion)
             throws Exception {
@@ -91,7 +174,7 @@ public class CnfAdapterRest {
 
         // TODO
         // Below URL should be changed as appropriate multicloud URL.
-        HttpGet req = new HttpGet("http://172.17.0.2:31770/v1/rb/definition/" + rbName + "/" + rbVersion);
+        HttpGet req = new HttpGet("http://multicloud-k8s:9015/v1/rb/definition/" + rbName + "/" + rbVersion);
         try (CloseableHttpResponse response = httpClient.execute(req)) {
             logger.info("response:" + response.getEntity());
             return EntityUtils.toString(response.getEntity());
@@ -99,8 +182,8 @@ public class CnfAdapterRest {
     }
 
     @ResponseBody
-    @RequestMapping(value = {"/api/cnf-adapter/v1/v1/rb/definition/{rb-name}/{rb-version}"},
-            method = RequestMethod.DELETE, produces = "application/json")
+    @RequestMapping(value = {"/api/cnf-adapter/v1/rb/definition/{rb-name}/{rb-version}"}, method = RequestMethod.DELETE,
+            produces = "application/json")
     public String deleteRB(@PathVariable("rb-name") String rbName, @PathVariable("rb-version") String rbVersion)
             throws Exception {
 
@@ -108,7 +191,7 @@ public class CnfAdapterRest {
 
         // TODO
         // Below URL should be changed as appropriate multicloud URL.
-        HttpDelete req = new HttpDelete("http://172.17.0.2:31770/v1/rb/definition/" + rbName + "/" + rbVersion);
+        HttpDelete req = new HttpDelete("http://multicloud-k8s:9015/v1/rb/definition/" + rbName + "/" + rbVersion);
 
         try (CloseableHttpResponse response = httpClient.execute(req)) {
             logger.info("response:" + response.getEntity());
@@ -118,7 +201,7 @@ public class CnfAdapterRest {
     }
 
     @ResponseBody
-    @RequestMapping(value = {"/api/cnf-adapter/v1/v1/rb/definition/{rb-name}"}, method = RequestMethod.GET,
+    @RequestMapping(value = {"/api/cnf-adapter/v1/rb/definition/{rb-name}"}, method = RequestMethod.GET,
             produces = "application/json")
     public String getListOfRB(@PathVariable("rb-name") String rbName) throws Exception {
 
@@ -126,7 +209,7 @@ public class CnfAdapterRest {
 
         // TODO
         // Below URL should be changed as appropriate multicloud URL.
-        HttpGet req = new HttpGet("http://172.17.0.2:31770/v1/rb/definition/" + rbName);
+        HttpGet req = new HttpGet("http://multicloud-k8s:9015/v1/rb/definition/" + rbName);
 
         try (CloseableHttpResponse response = httpClient.execute(req)) {
             logger.info("response:" + response.getEntity());
@@ -136,7 +219,7 @@ public class CnfAdapterRest {
     }
 
     @ResponseBody
-    @RequestMapping(value = {"/api/cnf-adapter/v1/v1/rb/definition"}, method = RequestMethod.GET,
+    @RequestMapping(value = {"/api/cnf-adapter/v1/rb/definition"}, method = RequestMethod.GET,
             produces = "application/json")
     public String getListOfRBWithoutUsingRBName() throws Exception {
 
@@ -144,7 +227,7 @@ public class CnfAdapterRest {
 
         // TODO
         // Below URL should be changed as appropriate multicloud URL.
-        HttpGet req = new HttpGet("http://172.17.0.2:31770/v1/rb/definition");
+        HttpGet req = new HttpGet("http://multicloud-k8s:9015/v1/rb/definition");
 
         try (CloseableHttpResponse response = httpClient.execute(req)) {
             logger.info("response:" + response.getEntity());
@@ -154,7 +237,7 @@ public class CnfAdapterRest {
     }
 
     @ResponseBody
-    @RequestMapping(value = {"/api/cnf-adapter/v1/v1/rb/definition/{rb-name}/{rb-version}/content"},
+    @RequestMapping(value = {"/api/cnf-adapter/v1/rb/definition/{rb-name}/{rb-version}/content"},
             method = RequestMethod.POST, produces = "multipart/form-data")
     public String uploadArtifactForRB(@RequestParam("file") MultipartFile file, @PathVariable("rb-name") String rbName,
             @PathVariable("rb-version") String rbVersion) throws Exception {
@@ -172,7 +255,7 @@ public class CnfAdapterRest {
         // TODO
         // Below URL should be changed as appropriate multicloud URL.
         HttpPost post =
-                new HttpPost("http://172.17.0.2:31770/v1/rb/definition/" + rbName + "/" + rbVersion + "/content");
+                new HttpPost("http://multicloud-k8s:9015/v1/rb/definition/" + rbName + "/" + rbVersion + "/content");
         post.setHeader("Content-Type", "multipart/form-data");
         logger.info(String.valueOf(post));
         post.setEntity(entity);
@@ -185,7 +268,7 @@ public class CnfAdapterRest {
     }
 
     @ResponseBody
-    @RequestMapping(value = {"/api/cnf-adapter/v1/v1/rb/definition/{rb-name}/{rb-version}/profile"},
+    @RequestMapping(value = {"/api/cnf-adapter/v1/rb/definition/{rb-name}/{rb-version}/profile"},
             method = RequestMethod.POST, produces = "application/json")
     public String createProfile(@RequestBody ProfileEntity fE, @PathVariable("rb-name") String rbName,
             @PathVariable("rb-version") String rbVersion) throws Exception {
@@ -195,7 +278,7 @@ public class CnfAdapterRest {
         // TODO
         // Below URL should be changed as appropriate multicloud URL.
         HttpPost post =
-                new HttpPost("http://172.17.0.2:31770/v1/rb/definition/" + rbName + "/" + rbVersion + "/profile");
+                new HttpPost("http://multicloud-k8s:9015/v1/rb/definition/" + rbName + "/" + rbVersion + "/profile");
         ObjectMapper objectMapper = new ObjectMapper();
         String requestBody = objectMapper.writeValueAsString(fE);
         StringEntity requestEntity = new StringEntity(requestBody, ContentType.APPLICATION_JSON);
@@ -209,7 +292,7 @@ public class CnfAdapterRest {
     }
 
     @ResponseBody
-    @RequestMapping(value = {"/api/cnf-adapter/v1/v1/rb/definition/{rb-name}/{rb-version}/profile/{pr-name}"},
+    @RequestMapping(value = {"/api/cnf-adapter/v1/rb/definition/{rb-name}/{rb-version}/profile/{pr-name}"},
             method = RequestMethod.GET, produces = "application/json")
     public String getProfile(@PathVariable("rb-name") String rbName, @PathVariable("rb-version") String rbVersion,
             @PathVariable("pr-name") String prName) throws Exception {
@@ -219,7 +302,7 @@ public class CnfAdapterRest {
         // TODO
         // Below URL should be changed as appropriate multicloud URL.
         HttpGet req = new HttpGet(
-                "http://172.17.0.2:31770/v1/rb/definition/" + rbName + "/" + rbVersion + "/profile/" + prName);
+                "http://multicloud-k8s:9015/v1/rb/definition/" + rbName + "/" + rbVersion + "/profile/" + prName);
 
         try (CloseableHttpResponse response = httpClient.execute(req)) {
             logger.info("response:" + response.getEntity());
@@ -228,7 +311,7 @@ public class CnfAdapterRest {
     }
 
     @ResponseBody
-    @RequestMapping(value = {"/api/cnf-adapter/v1/v1/rb/definition/{rb-name}/{rb-version}/profile"},
+    @RequestMapping(value = {"/api/cnf-adapter/v1/rb/definition/{rb-name}/{rb-version}/profile"},
             method = RequestMethod.GET, produces = "application/json")
     public String getListOfProfile(@PathVariable("rb-name") String rbName, @PathVariable("rb-version") String rbVersion)
             throws Exception {
@@ -237,7 +320,8 @@ public class CnfAdapterRest {
 
         // TODO
         // Below URL should be changed as appropriate multicloud URL.
-        HttpGet req = new HttpGet("http://172.17.0.2:31770/v1/rb/definition/" + rbName + "/" + rbVersion + "/profile");
+        HttpGet req =
+                new HttpGet("http://multicloud-k8s:9015/v1/rb/definition/" + rbName + "/" + rbVersion + "/profile");
 
         try (CloseableHttpResponse response = httpClient.execute(req)) {
             logger.info("response:" + response.getEntity());
@@ -246,7 +330,7 @@ public class CnfAdapterRest {
     }
 
     @ResponseBody
-    @RequestMapping(value = {"/api/cnf-adapter/v1/v1/rb/definition/{rb-name}/{rb-version}/profile/{pr-name}"},
+    @RequestMapping(value = {"/api/cnf-adapter/v1/rb/definition/{rb-name}/{rb-version}/profile/{pr-name}"},
             method = RequestMethod.DELETE, produces = "application/json")
     public String deleteProfile(@PathVariable("rb-name") String rbName, @PathVariable("rb-version") String rbVersion,
             @PathVariable("pr-name") String prName) throws Exception {
@@ -256,7 +340,7 @@ public class CnfAdapterRest {
         // TODO
         // Below URL should be changed as appropriate multicloud URL.
         HttpDelete req = new HttpDelete(
-                "http://172.17.0.2:31770/v1/rb/definition/" + rbName + "/" + rbVersion + "/profile/" + prName);
+                "http://multicloud-k8s:9015/v1/rb/definition/" + rbName + "/" + rbVersion + "/profile/" + prName);
 
         try (CloseableHttpResponse response = httpClient.execute(req)) {
             logger.info("response:" + response.getEntity());
@@ -266,7 +350,7 @@ public class CnfAdapterRest {
     }
 
     @ResponseBody
-    @RequestMapping(value = {"/api/cnf-adapter/v1/v1/rb/definition/{rb-name}/{rb-version}/profile/{pr-name}/content"},
+    @RequestMapping(value = {"/api/cnf-adapter/v1/rb/definition/{rb-name}/{rb-version}/profile/{pr-name}/content"},
             method = RequestMethod.POST, produces = "multipart/form-data")
     public String uploadArtifactForProfile(@RequestParam("file") MultipartFile file,
             @PathVariable("rb-name") String rbName, @PathVariable("rb-version") String rbVersion,
@@ -284,7 +368,7 @@ public class CnfAdapterRest {
 
         // TODO
         // Below URL should be changed as appropriate multicloud URL.
-        HttpPost post = new HttpPost("http://172.17.0.2:31770/v1/rb/definition/" + rbName + "/" + rbVersion
+        HttpPost post = new HttpPost("http://multicloud-k8s:9015/v1/rb/definition/" + rbName + "/" + rbVersion
                 + "/profile/" + prName + "/content");
         post.setHeader("Content-Type", "multipart/form-data");
 
@@ -299,144 +383,7 @@ public class CnfAdapterRest {
     }
 
     @ResponseBody
-    @RequestMapping(value = {"/api/cnf-adapter/v1/v1/instance"}, method = RequestMethod.POST,
-            produces = "application/json")
-    public String createInstance(@RequestBody BpmnInstanceRequest bpmnInstanceRequest) throws Exception {
-
-        logger.info("create Instance called.");
-
-        MulticloudInstanceRequest multicloudInstanceRequest = new MulticloudInstanceRequest();
-
-        if (bpmnInstanceRequest.getK8sRBProfileName() != null) {
-            multicloudInstanceRequest.setCloudRegion(bpmnInstanceRequest.getCloudRegionId());
-            multicloudInstanceRequest.setLabels(bpmnInstanceRequest.getLabels());
-            multicloudInstanceRequest.setOverrideValues(bpmnInstanceRequest.getOverrideValues());
-            multicloudInstanceRequest.setProfileName(bpmnInstanceRequest.getK8sRBProfileName());
-            multicloudInstanceRequest.setRbName(bpmnInstanceRequest.getModelInvariantId());
-            multicloudInstanceRequest.setRbVersion(bpmnInstanceRequest.getModelVersionId());
-            multicloudInstanceRequest.setVfModuleUuid(bpmnInstanceRequest.getVfModuleUUID());
-        } else {
-
-            logger.info("K8sRBProfileName is required");
-            return "K8sRBProfileName is required";
-        }
-
-        // TODO
-        // Below URL should be changed as appropriate multicloud URL.
-        HttpPost post = new HttpPost("http://172.17.0.2:31770/v1/instance");
-        ObjectMapper objectMapper = new ObjectMapper();
-
-        String requestBody = objectMapper.writeValueAsString(multicloudInstanceRequest);
-        StringEntity requestEntity = new StringEntity(requestBody, ContentType.APPLICATION_JSON);
-        post.setEntity(requestEntity);
-
-        try (CloseableHttpClient httpClient = HttpClients.createDefault();
-                CloseableHttpResponse response = httpClient.execute(post)) {
-            logger.info("response:" + response.getEntity());
-            return EntityUtils.toString(response.getEntity());
-        }
-    }
-
-    // This api is not enabled in multicloud project ,but this is required in
-    // future.
-    @ResponseBody
-    @RequestMapping(value = {"/api/cnf-adapter/v1/v1/instance/{vnfInstanceId}"}, method = RequestMethod.PUT,
-            produces = "application/json")
-    public String updateInstance(@RequestBody MulticloudInstanceRequest iE,
-            @PathVariable("vnfInstanceId") String instanceId) throws Exception {
-
-        logger.info("create Instance called.");
-
-        // TODO
-        // Below URL should be changed as appropriate multicloud URL.
-        HttpPut post = new HttpPut("http://172.17.0.2:31770/v1/instance/" + instanceId);
-        ObjectMapper objectMapper = new ObjectMapper();
-
-        String requestBody = objectMapper.writeValueAsString(iE);
-        StringEntity requestEntity = new StringEntity(requestBody, ContentType.APPLICATION_JSON);
-        post.setEntity(requestEntity);
-
-        try (CloseableHttpClient httpClient = HttpClients.createDefault();
-                CloseableHttpResponse response = httpClient.execute(post)) {
-            logger.info("response:" + response.getEntity());
-            return EntityUtils.toString(response.getEntity());
-        }
-    }
-
-    @ResponseBody
-    @RequestMapping(value = {"/api/cnf-adapter/v1/v1/instance/{instID}"}, method = RequestMethod.GET,
-            produces = "application/json")
-    public String getInstance(@PathVariable("instID") String instanceId) throws Exception {
-
-        logger.info("get Instance called.");
-
-        // TODO
-        // Below URL should be changed as appropriate multicloud URL.
-        HttpGet req = new HttpGet("http://172.17.0.2:31770/v1/instance/" + instanceId);
-
-        try (CloseableHttpResponse response = httpClient.execute(req)) {
-            logger.info("response:" + response.getEntity());
-            return EntityUtils.toString(response.getEntity());
-        }
-    }
-
-    @ResponseBody
-    @RequestMapping(value = {"/api/cnf-adapter/v1/v1/instance/{instID}/status"}, method = RequestMethod.GET,
-            produces = "application/json")
-    public String getInstanceStatus(@PathVariable("instID") String instanceId) throws Exception {
-
-        logger.info("getInstanceStatus called.");
-
-        // TODO
-        // Below URL should be changed as appropriate multicloud URL.
-        HttpGet req = new HttpGet("http://172.17.0.2:31770/v1/instance/" + instanceId + "/status");
-
-        try (CloseableHttpResponse response = httpClient.execute(req)) {
-            logger.info("response:" + response.getEntity());
-            return EntityUtils.toString(response.getEntity());
-        }
-    }
-
-    @RequestMapping(value = {"/api/cnf-adapter/v1/v1/instance"}, method = RequestMethod.GET,
-            produces = "application/json")
-    public String getInstanceBasedOnRBNameOrRBVersionOrProfileName(
-            @RequestParam(value = "rb-name", required = false) String rbName,
-            @RequestParam(value = "rb-version", required = false) String rbVersion,
-            @RequestParam(value = "profile-name", required = false) String profileName) throws Exception {
-
-        logger.info("getInstanceBasedOnRBNameOrRBVersionOrProfileName called.");
-
-        // TODO
-        // Below URL should be changed as appropriate multicloud URL.
-        HttpGet req = new HttpGet("http://172.17.0.2:31770/v1/instance?rb-name=" + rbName + "&rb-version=" + rbVersion
-                + "&profile-name=" + profileName);
-
-        try (CloseableHttpResponse response = httpClient.execute(req)) {
-            logger.info("response:" + response.getEntity());
-            return EntityUtils.toString(response.getEntity());
-        }
-    }
-
-    @ResponseBody
-    @RequestMapping(value = {"/api/cnf-adapter/v1/v1/instance/{instID}"}, method = RequestMethod.DELETE,
-            produces = "application/json")
-    public String deleteInstance(@PathVariable("instID") String instanceID) throws Exception {
-
-        logger.info("delete Instance called.");
-
-        // TODO
-        // Below URL should be changed as appropriate multicloud URL.
-        HttpDelete req = new HttpDelete("http://172.17.0.2:31770/v1/instance/" + instanceID);
-
-        try (CloseableHttpResponse response = httpClient.execute(req)) {
-            logger.info("response:" + response.getEntity());
-            return EntityUtils.toString(response.getEntity());
-        }
-
-    }
-
-    @ResponseBody
-    @RequestMapping(value = {"/api/cnf-adapter/v1/v1/definition/{rb-name}/{rb-version}/profile/{profile-name}/config"},
+    @RequestMapping(value = {"/api/cnf-adapter/v1/definition/{rb-name}/{rb-version}/profile/{profile-name}/config"},
             method = RequestMethod.POST, produces = "application/json")
     public String createConfiguration(@RequestBody ConfigurationEntity cE, @PathVariable("rb-name") String rbName,
             @PathVariable("rb-version") String rbVersion, @PathVariable("profile-name") String prName)
@@ -446,8 +393,8 @@ public class CnfAdapterRest {
 
         // TODO
         // Below URL should be changed as appropriate multicloud URL.
-        HttpPost post = new HttpPost(
-                "http://172.17.0.2:31770/v1/definition/" + rbName + "/" + rbVersion + "/profile/" + prName + "/config");
+        HttpPost post = new HttpPost("http://multicloud-k8s:9015/v1/definition/" + rbName + "/" + rbVersion
+                + "/profile/" + prName + "/config");
         ObjectMapper objectMapper = new ObjectMapper();
         String requestBody = objectMapper.writeValueAsString(cE);
         StringEntity requestEntity = new StringEntity(requestBody, ContentType.APPLICATION_JSON);
@@ -461,8 +408,8 @@ public class CnfAdapterRest {
     }
 
     @ResponseBody
-    @RequestMapping(value = {
-            "/api/cnf-adapter/v1/v1/definition/{rb-name}/{rb-version}/profile/{profile-name}/config/{cfg-name}"},
+    @RequestMapping(
+            value = {"/api/cnf-adapter/v1/definition/{rb-name}/{rb-version}/profile/{profile-name}/config/{cfg-name}"},
             method = RequestMethod.GET, produces = "application/json")
     public String getConfiguration(@PathVariable("rb-name") String rbName, @PathVariable("rb-version") String rbVersion,
             @PathVariable("profile-name") String prName, @PathVariable("cfg-name") String cfgName) throws Exception {
@@ -471,7 +418,7 @@ public class CnfAdapterRest {
 
         // TODO
         // Below URL should be changed as appropriate multicloud URL.
-        HttpGet req = new HttpGet("http://172.17.0.2:31770/v1/definition/" + rbName + "/" + rbVersion + "/profile/"
+        HttpGet req = new HttpGet("http://multicloud-k8s:9015/v1/definition/" + rbName + "/" + rbVersion + "/profile/"
                 + prName + "/config/" + cfgName);
 
         try (CloseableHttpResponse response = httpClient.execute(req)) {
@@ -481,8 +428,8 @@ public class CnfAdapterRest {
     }
 
     @ResponseBody
-    @RequestMapping(value = {
-            "/api/cnf-adapter/v1/v1/definition/{rb-name}/{rb-version}/profile/{profile-name}/config/{cfg-name}"},
+    @RequestMapping(
+            value = {"/api/cnf-adapter/v1/definition/{rb-name}/{rb-version}/profile/{profile-name}/config/{cfg-name}"},
             method = RequestMethod.DELETE, produces = "application/json")
     public String deleteConfiguration(@PathVariable("rb-name") String rbName,
             @PathVariable("rb-version") String rbVersion, @PathVariable("profile-name") String prName,
@@ -492,7 +439,7 @@ public class CnfAdapterRest {
 
         // TODO
         // Below URL should be changed as appropriate multicloud URL.
-        HttpDelete req = new HttpDelete("http://172.17.0.2:31770/v1/definition/" + rbName + "/" + rbVersion
+        HttpDelete req = new HttpDelete("http://multicloud-k8s:9015/v1/definition/" + rbName + "/" + rbVersion
                 + "/profile/" + prName + "/config/" + cfgName);
 
         try (CloseableHttpResponse response = httpClient.execute(req)) {
@@ -503,8 +450,8 @@ public class CnfAdapterRest {
     }
 
     @ResponseBody
-    @RequestMapping(value = {
-            "/api/cnf-adapter/v1/v1/definition/{rb-name}/{rb-version}/profile/{profile-name}/config/{cfg-name}"},
+    @RequestMapping(
+            value = {"/api/cnf-adapter/v1/definition/{rb-name}/{rb-version}/profile/{profile-name}/config/{cfg-name}"},
             method = RequestMethod.PUT, produces = "application/json")
     public String updateConfiguration(@RequestBody ConfigurationEntity cE, @PathVariable("rb-name") String rbName,
             @PathVariable("rb-version") String rbVersion, @PathVariable("profile-name") String prName,
@@ -514,7 +461,7 @@ public class CnfAdapterRest {
 
         // TODO
         // Below URL should be changed as appropriate multicloud URL.
-        HttpPut post = new HttpPut("http://172.17.0.2:31770/v1/definition/" + rbName + "/" + rbVersion + "/profile/"
+        HttpPut post = new HttpPut("http://multicloud-k8s:9015/v1/definition/" + rbName + "/" + rbVersion + "/profile/"
                 + prName + "/config/" + cfgName);
         ObjectMapper objectMapper = new ObjectMapper();
         String requestBody = objectMapper.writeValueAsString(cE);
@@ -529,7 +476,7 @@ public class CnfAdapterRest {
     }
 
     @ResponseBody
-    @RequestMapping(value = {"/api/cnf-adapter/v1/v1/definition/{rb-name}/{rb-version}/profile/{profile-name}/tagit"},
+    @RequestMapping(value = {"/api/cnf-adapter/v1/definition/{rb-name}/{rb-version}/profile/{profile-name}/tagit"},
             method = RequestMethod.POST, produces = "application/json")
     public String tagConfigurationValue(@RequestBody Tag tag, @PathVariable("rb-name") String rbName,
             @PathVariable("rb-version") String rbVersion, @PathVariable("pr-name") String prName) throws Exception {
@@ -537,8 +484,8 @@ public class CnfAdapterRest {
 
         // TODO
         // Below URL should be changed as appropriate multicloud URL.
-        HttpPost post = new HttpPost("http://172.17.0.2:31770/v1/definition/" + rbName + "/" + rbVersion + "/profile/"
-                + prName + "/config/tagit");
+        HttpPost post = new HttpPost("http://multicloud-k8s:9015/v1/definition/" + rbName + "/" + rbVersion
+                + "/profile/" + prName + "/config/tagit");
 
         ObjectMapper objectMapper = new ObjectMapper();
         String requestBody = objectMapper.writeValueAsString(tag);
@@ -553,7 +500,7 @@ public class CnfAdapterRest {
     }
 
     @ResponseBody
-    @RequestMapping(value = {"/api/cnf-adapter/v1/v1/connectivity-info"}, method = RequestMethod.POST,
+    @RequestMapping(value = {"/api/cnf-adapter/v1/connectivity-info"}, method = RequestMethod.POST,
             produces = "application/json")
     public String createConnectivityInfo(@RequestBody ConnectivityInfo cIE) throws Exception {
 
@@ -561,7 +508,7 @@ public class CnfAdapterRest {
 
         // TODO
         // Below URL should be changed as appropriate multicloud URL.
-        HttpPost post = new HttpPost("http://172.17.0.2:31770/v1/connectivity-info");
+        HttpPost post = new HttpPost("http://multicloud-k8s:9015/v1/connectivity-info");
         ObjectMapper objectMapper = new ObjectMapper();
         String requestBody = objectMapper.writeValueAsString(cIE);
         StringEntity requestEntity = new StringEntity(requestBody, ContentType.APPLICATION_JSON);
@@ -575,7 +522,7 @@ public class CnfAdapterRest {
     }
 
     @ResponseBody
-    @RequestMapping(value = {"/api/cnf-adapter/v1/v1/connectivity-info/{connname}"}, method = RequestMethod.GET,
+    @RequestMapping(value = {"/api/cnf-adapter/v1/connectivity-info/{connname}"}, method = RequestMethod.GET,
             produces = "application/json")
     public String getConnectivityInfo(@PathVariable("connname") String connName) throws Exception {
 
@@ -583,7 +530,7 @@ public class CnfAdapterRest {
 
         // TODO
         // Below URL should be changed as appropriate multicloud URL.
-        HttpGet req = new HttpGet("http://172.17.0.2:31770/v1/connectivity-info/" + connName);
+        HttpGet req = new HttpGet("http://multicloud-k8s:9015/v1/connectivity-info/" + connName);
 
         try (CloseableHttpResponse response = httpClient.execute(req)) {
             logger.info("response:" + response.getEntity());
@@ -592,7 +539,7 @@ public class CnfAdapterRest {
     }
 
     @ResponseBody
-    @RequestMapping(value = {"/api/cnf-adapter/v1/v1/connectivity-info/{connname}"}, method = RequestMethod.DELETE,
+    @RequestMapping(value = {"/api/cnf-adapter/v1/connectivity-info/{connname}"}, method = RequestMethod.DELETE,
             produces = "application/json")
     public String deleteConnectivityInfo(@PathVariable("connname") String connName) throws Exception {
 
@@ -600,7 +547,7 @@ public class CnfAdapterRest {
 
         // TODO
         // Below URL should be changed as appropriate multicloud URL.
-        HttpDelete req = new HttpDelete("http://172.17.0.2:31770/v1/connectivity-info/" + connName);
+        HttpDelete req = new HttpDelete("http://multicloud-k8s:9015/v1/connectivity-info/" + connName);
 
         try (CloseableHttpResponse response = httpClient.execute(req)) {
             logger.info("response:" + response.getEntity());
@@ -610,7 +557,7 @@ public class CnfAdapterRest {
     }
 
     @ResponseBody
-    @RequestMapping(value = {"/api/cnf-adapter/v1/v1/rb/definition/{rb-name}/{rb-version}/config-template"},
+    @RequestMapping(value = {"/api/cnf-adapter/v1/rb/definition/{rb-name}/{rb-version}/config-template"},
             method = RequestMethod.POST, produces = "application/json")
     public String createConfigTemplate(@RequestBody ConfigTemplateEntity tE, @PathVariable("rb-name") String rbName,
             @PathVariable("rb-version") String rbVersion) throws Exception {
@@ -620,7 +567,7 @@ public class CnfAdapterRest {
         // TODO
         // Below URL should be changed as appropriate multicloud URL.
         HttpPost post = new HttpPost(
-                "http://172.17.0.2:31770/v1/rb/definition/" + rbName + "/" + rbVersion + "/config-template");
+                "http://multicloud-k8s:9015/v1/rb/definition/" + rbName + "/" + rbVersion + "/config-template");
         ObjectMapper objectMapper = new ObjectMapper();
         String requestBody = objectMapper.writeValueAsString(tE);
         StringEntity requestEntity = new StringEntity(requestBody, ContentType.APPLICATION_JSON);
@@ -634,7 +581,7 @@ public class CnfAdapterRest {
     }
 
     @ResponseBody
-    @RequestMapping(value = {"/api/cnf-adapter/v1/v1/rb/definition/{rb-name}/{rb-version}/config-template/{tname}"},
+    @RequestMapping(value = {"/api/cnf-adapter/v1/rb/definition/{rb-name}/{rb-version}/config-template/{tname}"},
             method = RequestMethod.GET, produces = "application/json")
     public String getConfigTemplate(@PathVariable("rb-name") String rbName,
             @PathVariable("rb-version") String rbVersion, @PathVariable("tname") String tName) throws Exception {
@@ -643,8 +590,8 @@ public class CnfAdapterRest {
 
         // TODO
         // Below URL should be changed as appropriate multicloud URL.
-        HttpGet req = new HttpGet(
-                "http://172.17.0.2:31770/v1/rb/definition/" + rbName + "/" + rbVersion + "/config-template/" + tName);
+        HttpGet req = new HttpGet("http://multicloud-k8s:9015/v1/rb/definition/" + rbName + "/" + rbVersion
+                + "/config-template/" + tName);
 
         try (CloseableHttpResponse response = httpClient.execute(req)) {
             logger.info("response:" + response.getEntity());
@@ -653,7 +600,7 @@ public class CnfAdapterRest {
     }
 
     @ResponseBody
-    @RequestMapping(value = {"/api/cnf-adapter/v1/v1/rb/definition/{rb-name}/{rb-version}/config-template/{tname}"},
+    @RequestMapping(value = {"/api/cnf-adapter/v1/rb/definition/{rb-name}/{rb-version}/config-template/{tname}"},
             method = RequestMethod.DELETE, produces = "application/json")
     public String deleteTemplate(@PathVariable("rb-name") String rbName, @PathVariable("rb-version") String rbVersion,
             @PathVariable("tname") String tName) throws Exception {
@@ -662,8 +609,8 @@ public class CnfAdapterRest {
 
         // TODO
         // Below URL should be changed as appropriate multicloud URL.
-        HttpDelete req = new HttpDelete(
-                "http://172.17.0.2:31770/v1/rb/definition/" + rbName + "/" + rbVersion + "/config-template/" + tName);
+        HttpDelete req = new HttpDelete("http://multicloud-k8s:9015/v1/rb/definition/" + rbName + "/" + rbVersion
+                + "/config-template/" + tName);
 
         try (CloseableHttpResponse response = httpClient.execute(req)) {
             logger.info("response:" + response.getEntity());
@@ -674,7 +621,7 @@ public class CnfAdapterRest {
 
     @ResponseBody
     @RequestMapping(
-            value = {"/api/cnf-adapter/v1/v1/rb/definition/{rb-name}/{rb-version}/config-template/{tname}/content"},
+            value = {"/api/cnf-adapter/v1/rb/definition/{rb-name}/{rb-version}/config-template/{tname}/content"},
             method = RequestMethod.POST, produces = "multipart/form-data")
     public String uploadTarFileForTemplate(@RequestParam("file") MultipartFile file,
             @PathVariable("rb-name") String rbName, @PathVariable("rb-version") String rbVersion,
@@ -692,7 +639,7 @@ public class CnfAdapterRest {
 
         // TODO
         // Below URL should be changed as appropriate multicloud URL.
-        HttpPost post = new HttpPost("http://172.17.0.2:31770/v1/rb/definition/" + rbName + "/" + rbVersion
+        HttpPost post = new HttpPost("http://multicloud-k8s:9015/v1/rb/definition/" + rbName + "/" + rbVersion
                 + "/config-template/" + tName + "/content");
         post.setHeader("Content-Type", "multipart/form-data");
 
@@ -707,7 +654,7 @@ public class CnfAdapterRest {
     }
 
     @ResponseBody
-    @RequestMapping(value = {"/api/cnf-adapter/v1/v1/definition/{rbName}/{rbVersion}/profile/{prName}/config/rollback"},
+    @RequestMapping(value = {"/api/cnf-adapter/v1/definition/{rbName}/{rbVersion}/profile/{prName}/config/rollback"},
             method = RequestMethod.DELETE, produces = "application/json")
     public String rollbackConfiguration(@RequestBody ConfigurationRollbackEntity rE,
             @PathVariable("rbName") String rbName, @PathVariable("rbVersion") String rbVersion,
@@ -716,8 +663,8 @@ public class CnfAdapterRest {
 
         // TODO
         // Below URL should be changed as appropriate multicloud URL.
-        HttpPost post = new HttpPost("http://172.17.0.2:31770/v1/definition/" + rbName + "/" + rbVersion + "/profile/"
-                + prName + "/config/rollback");
+        HttpPost post = new HttpPost("http://multicloud-k8s:9015/v1/definition/" + rbName + "/" + rbVersion
+                + "/profile/" + prName + "/config/rollback");
 
         ObjectMapper objectMapper = new ObjectMapper();
         String requestBody = objectMapper.writeValueAsString(rE);
diff --git a/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/service/CnfAdapterService.java b/adapters/mso-cnf-adapter/src/main/java/org/onap/so/adapters/cnf/service/CnfAdapterService.java
new file mode 100644 (file)
index 0000000..06c09e3
--- /dev/null
@@ -0,0 +1,269 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.cnf.service;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import javax.persistence.EntityNotFoundException;
+import javax.ws.rs.core.UriBuilder;
+import org.apache.http.HttpStatus;
+import org.onap.so.adapters.cnf.model.BpmnInstanceRequest;
+import org.onap.so.adapters.cnf.model.InstanceMiniResponse;
+import org.onap.so.adapters.cnf.model.InstanceMiniResponseList;
+import org.onap.so.adapters.cnf.model.InstanceResponse;
+import org.onap.so.adapters.cnf.model.InstanceStatusResponse;
+import org.onap.so.adapters.cnf.model.MulticloudInstanceRequest;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.MediaType;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Service;
+import org.springframework.web.client.HttpClientErrorException;
+import org.springframework.web.client.HttpStatusCodeException;
+import org.springframework.web.client.RestTemplate;
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.databind.JsonMappingException;
+
+@Service
+public class CnfAdapterService {
+    private static final Logger logger = LoggerFactory.getLogger(CnfAdapterService.class);
+    @Autowired
+    private RestTemplate restTemplate;
+    private static final String INSTANCE_CREATE_PATH = "/v1/instance";
+    private static final String HEALTH_CHECK = "/v1/healthcheck";
+
+    public ResponseEntity<String> healthCheck() {
+
+        logger.info("CnfAdapterService createInstance called");
+        ResponseEntity<String> result = null;
+        try {
+
+            logger.info("CnfAdapterService createInstance called");
+
+            // String uri = env.getRequiredProperty("multicloud.endpoint"); //TODO:
+            // This needs to be added as well
+            // for configuration
+            String uri = "http://multicloud-k8s:9015"; // TODO: What is the correct uri?
+            String endpoint = UriBuilder.fromUri(uri).path(HEALTH_CHECK).build().toString();
+            HttpEntity<?> requestEntity = new HttpEntity<>(getHttpHeaders());
+            result = restTemplate.exchange(endpoint, HttpMethod.GET, requestEntity, String.class);
+            return result;
+        } catch (HttpClientErrorException e) {
+            logger.error("Error Calling Multicloud, e");
+            if (HttpStatus.SC_NOT_FOUND == e.getStatusCode().value()) {
+                throw new EntityNotFoundException(e.getResponseBodyAsString());
+            }
+            throw e;
+        } catch (HttpStatusCodeException e) {
+            logger.error("Error in Multicloud, e");
+            String responseString = e.getResponseBodyAsString();
+            return ResponseEntity.status(e.getStatusCode()).body(responseString);
+        }
+    }
+
+    public ResponseEntity<InstanceResponse> createInstance(BpmnInstanceRequest bpmnInstanceRequest)
+            throws JsonParseException, JsonMappingException, IOException {
+        try {
+            logger.info("CnfAdapterService createInstance called");
+            MulticloudInstanceRequest multicloudInstanceRequest = new MulticloudInstanceRequest();
+            ResponseEntity<InstanceResponse> instanceResponse = null;
+            if (bpmnInstanceRequest.getK8sRBProfileName() != null) {
+                multicloudInstanceRequest.setCloudRegion(bpmnInstanceRequest.getCloudRegionId());
+                multicloudInstanceRequest.setLabels(bpmnInstanceRequest.getLabels());
+                multicloudInstanceRequest.setOverrideValues(bpmnInstanceRequest.getOverrideValues());
+                multicloudInstanceRequest.setProfileName(bpmnInstanceRequest.getK8sRBProfileName());
+                multicloudInstanceRequest.setRbName(bpmnInstanceRequest.getModelInvariantId());
+                multicloudInstanceRequest.setRbVersion(bpmnInstanceRequest.getModelVersionId());
+                multicloudInstanceRequest.setVfModuleUuid(bpmnInstanceRequest.getVfModuleUUID());
+            } else {
+                logger.error("k8sProfileName should not be null");
+                return instanceResponse;
+            }
+            // String uri = env.getRequiredProperty("multicloud.endpoint"); //TODO:
+            // This needs to be added as well
+            // for configuration
+            String uri = "http://multicloud-k8s:9015"; // TODO: What is the correct uri?
+            String endpoint = UriBuilder.fromUri(uri).path(INSTANCE_CREATE_PATH).build().toString();
+            HttpEntity<?> entity = getHttpEntity(multicloudInstanceRequest);
+            instanceResponse = restTemplate.exchange(endpoint, HttpMethod.POST, entity, InstanceResponse.class);
+            return instanceResponse;
+        } catch (HttpClientErrorException e) {
+            logger.error("Error Calling Multicloud, e");
+            if (HttpStatus.SC_NOT_FOUND == e.getStatusCode().value()) {
+                throw new EntityNotFoundException(e.getResponseBodyAsString());
+            }
+            throw e;
+        } catch (HttpStatusCodeException e) {
+            logger.error("Error in Multicloud, e");
+            String responseString = e.getResponseBodyAsString();
+            InstanceResponse result = new InstanceResponse(responseString.trim());
+            return ResponseEntity.status(e.getStatusCode()).body(result);
+        }
+    }
+
+    public ResponseEntity<InstanceResponse> getInstanceByInstanceId(String instanceId)
+            throws JsonParseException, JsonMappingException, IOException {
+
+        logger.info("CnfAdapterService createInstance called");
+        ResponseEntity<InstanceResponse> instanceResponse = null;
+        try {
+
+            // String uri = env.getRequiredProperty("multicloud.endpoint"); //TODO:
+            // This needs to be added as well
+            // for configuration
+            String uri = "http://multicloud-k8s:9015"; // TODO: What is the correct uri?
+            String path = "/v1/instance/" + instanceId;
+            String endpoint = UriBuilder.fromUri(uri).path(path).build().toString();
+            HttpEntity<?> requestEntity = new HttpEntity<>(getHttpHeaders());
+            instanceResponse = restTemplate.exchange(endpoint, HttpMethod.GET, requestEntity, InstanceResponse.class);
+            return instanceResponse;
+        } catch (HttpClientErrorException e) {
+            logger.error("Error Calling Multicloud, e");
+            if (HttpStatus.SC_NOT_FOUND == e.getStatusCode().value()) {
+                throw new EntityNotFoundException(e.getResponseBodyAsString());
+            }
+            throw e;
+        } catch (HttpStatusCodeException e) {
+            logger.error("Error in Multicloud, e");
+            String responseString = e.getResponseBodyAsString();
+            InstanceResponse result = new InstanceResponse(responseString.trim());
+            return ResponseEntity.status(e.getStatusCode()).body(result);
+        }
+    }
+
+    public ResponseEntity<InstanceStatusResponse> getInstanceStatusByInstanceId(String instanceId)
+            throws JsonParseException, JsonMappingException, IOException {
+
+        logger.info("CnfAdapterService createInstance called");
+        ResponseEntity<InstanceStatusResponse> instanceResponse = null;
+        try {
+
+            // String uri = env.getRequiredProperty("multicloud.endpoint"); //TODO:
+            // This needs to be added as well
+            // for configuration
+            String uri = "http://multicloud-k8s:9015"; // TODO: What is the correct uri?
+            String path = "/v1/instance/" + instanceId + "/status";
+            String endpoint = UriBuilder.fromUri(uri).path(path).build().toString();
+            HttpEntity<?> requestEntity = new HttpEntity<>(getHttpHeaders());
+            instanceResponse =
+                    restTemplate.exchange(endpoint, HttpMethod.GET, requestEntity, InstanceStatusResponse.class);
+            return instanceResponse;
+        } catch (HttpClientErrorException e) {
+            logger.error("Error Calling Multicloud, e");
+            if (HttpStatus.SC_NOT_FOUND == e.getStatusCode().value()) {
+                throw new EntityNotFoundException(e.getResponseBodyAsString());
+            }
+            throw e;
+        } catch (HttpStatusCodeException e) {
+            logger.error("Error in Multicloud, e");
+            String responseString = e.getResponseBodyAsString();
+            InstanceStatusResponse result = new InstanceStatusResponse(responseString.trim());
+            return ResponseEntity.status(e.getStatusCode()).body(result);
+        }
+
+    }
+
+    public ResponseEntity<InstanceMiniResponseList> getInstanceByRBNameOrRBVersionOrProfileName(String rbName,
+            String rbVersion, String profileName) throws JsonParseException, JsonMappingException, IOException {
+
+        logger.info("CnfAdapterService createInstance called");
+        ResponseEntity<InstanceMiniResponseList> instanceMiniResponseList = null;
+        try {
+
+            // String uri = env.getRequiredProperty("multicloud.endpoint"); //TODO:
+            // This needs to be added as well
+            // for configuration
+            String uri = "http://multicloud-k8s:9015"; // TODO: What is the correct uri?
+            String path =
+                    "/v1/instance" + "?rb-name=" + rbName + "&rb-version=" + rbVersion + "&profile-name=" + profileName;
+            String endPoint = uri + path;
+            HttpEntity<?> requestEntity = new HttpEntity<>(getHttpHeaders());
+            instanceMiniResponseList =
+                    restTemplate.exchange(endPoint, HttpMethod.GET, requestEntity, InstanceMiniResponseList.class);
+            return instanceMiniResponseList;
+        } catch (HttpClientErrorException e) {
+            logger.error("Error Calling Multicloud, e");
+            if (HttpStatus.SC_NOT_FOUND == e.getStatusCode().value()) {
+                throw new EntityNotFoundException(e.getResponseBodyAsString());
+            }
+            throw e;
+        } catch (HttpStatusCodeException e) {
+            logger.error("Error in Multicloud, e");
+            String responseString = e.getResponseBodyAsString();
+            InstanceMiniResponseList result = new InstanceMiniResponseList(responseString.trim());
+            return ResponseEntity.status(e.getStatusCode()).body(result);
+        }
+    }
+
+    public ResponseEntity<String> deleteInstanceByInstanceId(String instanceId)
+            throws JsonParseException, JsonMappingException, IOException {
+
+        logger.info("CnfAdapterService createInstance called");
+        ResponseEntity<String> result = null;
+        try {
+
+            // String uri = env.getRequiredProperty("multicloud.endpoint"); //TODO:
+            // This needs to be added as well
+            // for configuration
+            String uri = "http://multicloud-k8s:9015"; // TODO: What is the correct uri?
+            String path = "/v1/instance/" + instanceId;
+            String endpoint = UriBuilder.fromUri(uri).path(path).build().toString();
+            HttpEntity<?> requestEntity = new HttpEntity<>(getHttpHeaders());
+            result = restTemplate.exchange(endpoint, HttpMethod.DELETE, requestEntity, String.class);
+            return result;
+        } catch (HttpClientErrorException e) {
+            logger.error("Error Calling Multicloud, e");
+            if (HttpStatus.SC_NOT_FOUND == e.getStatusCode().value()) {
+                throw new EntityNotFoundException(e.getResponseBodyAsString());
+            }
+            throw e;
+        } catch (HttpStatusCodeException e) {
+            logger.error("Error in Multicloud, e");
+            String responseString = e.getResponseBodyAsString();
+            return ResponseEntity.status(e.getStatusCode()).body(responseString);
+        }
+    }
+
+    protected HttpHeaders getHttpHeaders() {
+        HttpHeaders headers = new HttpHeaders();
+        List<MediaType> acceptableMediaTypes = new ArrayList<>();
+        acceptableMediaTypes.add(MediaType.APPLICATION_JSON);
+        headers.setAccept(acceptableMediaTypes);
+        headers.setContentType(MediaType.APPLICATION_JSON);
+        /*
+         * try { String userCredentials = CryptoUtils.decrypt(env.getRequiredProperty("mso.cnf.adapter.auth"),
+         * env.getRequiredProperty("mso.msoKey")); if (userCredentials != null) { headers.add(HttpHeaders.AUTHORIZATION,
+         * "Basic " + DatatypeConverter.printBase64Binary(userCredentials.getBytes())); } } catch
+         * (GeneralSecurityException e) { logger.error("Security exception", e); }
+         */
+        return headers;
+    }
+
+    protected HttpEntity<?> getHttpEntity(MulticloudInstanceRequest request) {
+        HttpHeaders headers = getHttpHeaders();
+        return new HttpEntity<>(request, headers);
+    }
+}
index 30b1b62..5a9adbf 100644 (file)
  #     naming-strategy: org.hibernate.cfg.ImprovedNamingStrategy
  #     enable-lazy-load-no-trans: true
 server:
-  port: 9013
+  port: 9012
   tomcat:
     max-threads: 50
 
 #mso:
  # key: 07a7159d3bf51a0e53be7a8f89699be7
  # site-name: localSite
-#  logPath: ./logs/nssmf
+#  logPath: ./logs/cnf
  # msb-ip: msb-iag.{{ include "common.namespace" . }}
  # msb-port: 80
  # adapters:
index 38a1091..ee7a771 100644 (file)
@@ -16,7 +16,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * ============LICENSE_END=========================================================
- */
 
 package org.onap.so.adapters.cnf;
 
@@ -60,3 +60,4 @@ public class CnfAdapterRestTest {
     }
 
 }
+*/
diff --git a/adapters/mso-cnf-adapter/src/test/java/org/onap/so/adapters/cnf/rest/CnfAdapterRestTest.java b/adapters/mso-cnf-adapter/src/test/java/org/onap/so/adapters/cnf/rest/CnfAdapterRestTest.java
new file mode 100644 (file)
index 0000000..df21a42
--- /dev/null
@@ -0,0 +1,161 @@
+
+/*
+ * ============LICENSE_START======================================================= ONAP - SO
+ * ================================================================================ Copyright (C) 2020 Huawei
+ * Technologies Co., Ltd. All rights reserved.
+ * ================================================================================ Licensed under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy
+ * of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.cnf.rest;
+
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.onap.so.adapters.cnf.model.BpmnInstanceRequest;
+import org.onap.so.adapters.cnf.model.InstanceMiniResponse;
+import org.onap.so.adapters.cnf.model.InstanceMiniResponseList;
+import org.onap.so.adapters.cnf.model.InstanceResponse;
+import org.onap.so.adapters.cnf.model.InstanceStatusResponse;
+import org.onap.so.adapters.cnf.model.MulticloudInstanceRequest;
+import org.onap.so.adapters.cnf.model.Resource;
+import org.onap.so.adapters.cnf.service.CnfAdapterService;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.test.context.junit4.SpringRunner;
+
+
+@RunWith(SpringRunner.class)
+public class CnfAdapterRestTest {
+
+    @InjectMocks
+    CnfAdapterRest cnfAdapterRest;
+
+    @Mock
+    CnfAdapterService cnfAdapterService;
+
+    @Mock
+    ResponseEntity<InstanceResponse> createInstanceResponse;
+
+    @Mock
+    ResponseEntity<InstanceMiniResponseList> instacneMiniResponseList;
+
+    @Mock
+    ResponseEntity<InstanceStatusResponse> instanceStatusResponse;
+
+    @Test
+    public void healthCheckTest() throws Exception {
+
+        ResponseEntity<String> response = new ResponseEntity<String>(HttpStatus.OK);
+        CnfAdapterService cnfAdapterService = Mockito.mock(CnfAdapterService.class);
+        Mockito.when(cnfAdapterService.healthCheck()).thenReturn(response);
+        cnfAdapterRest.healthCheck();
+        Assert.assertNotNull(response);
+        Assert.assertEquals(HttpStatus.OK, response.getStatusCode());
+    }
+
+    @Test
+    public void createInstanceTest() throws Exception {
+
+        Map<String, String> labels = new HashMap<String, String>();
+        labels.put("custom-label-1", "label1");
+        Map<String, String> overrideValues = new HashMap<String, String>();
+        labels.put("image.tag", "latest");
+        labels.put("dcae_collector_ip", "1.2.3.4");
+        BpmnInstanceRequest bpmnInstanceRequest = new BpmnInstanceRequest();
+        bpmnInstanceRequest.setCloudRegionId("v1");
+        bpmnInstanceRequest.setLabels(labels);
+        bpmnInstanceRequest.setModelInvariantId("krd");
+        bpmnInstanceRequest.setModelVersionId("p1");
+        bpmnInstanceRequest.setOverrideValues(overrideValues);
+        bpmnInstanceRequest.setVfModuleUUID("20200824");
+        List<Resource> resourceList = new ArrayList<Resource>();
+        InstanceResponse instanceResponse = new InstanceResponse(HttpStatus.CREATED.toString());
+        instanceResponse.setId("123");
+        instanceResponse.setNamespace("testNamespace");
+        instanceResponse.setRequest(new MulticloudInstanceRequest());
+        instanceResponse.setResources(resourceList);
+        createInstanceResponse = new ResponseEntity<InstanceResponse>(instanceResponse, HttpStatus.CREATED);
+        CnfAdapterService cnfAdapterService = Mockito.mock(CnfAdapterService.class);
+        Mockito.when(cnfAdapterService.createInstance(bpmnInstanceRequest)).thenReturn(createInstanceResponse);
+        cnfAdapterRest.createInstance(bpmnInstanceRequest);
+        Assert.assertNotNull(createInstanceResponse);
+        Assert.assertEquals(HttpStatus.CREATED, createInstanceResponse.getStatusCode());
+    }
+
+    @Test
+    public void getInstanceByInstanceIdTest() throws Exception {
+
+        String instanceId = "123";
+        createInstanceResponse = new ResponseEntity<InstanceResponse>(HttpStatus.OK);
+        CnfAdapterService cnfAdapterService = Mockito.mock(CnfAdapterService.class);
+        Mockito.when(cnfAdapterService.getInstanceByInstanceId(instanceId)).thenReturn(createInstanceResponse);
+        cnfAdapterRest.getInstanceByInstanceId(instanceId);
+        Assert.assertNotNull(createInstanceResponse);
+        Assert.assertEquals(HttpStatus.OK, createInstanceResponse.getStatusCode());
+    }
+
+    @Test
+    public void deleteInstanceByInstanceIdTest() throws Exception {
+
+        String instanceId = "123";
+        ResponseEntity<String> response = new ResponseEntity<String>(HttpStatus.OK);
+        CnfAdapterService cnfAdapterService = Mockito.mock(CnfAdapterService.class);
+        Mockito.when(cnfAdapterService.deleteInstanceByInstanceId(instanceId)).thenReturn(response);
+        cnfAdapterRest.deleteInstanceByInstanceId(instanceId);
+        Assert.assertNotNull(response);
+        Assert.assertEquals(HttpStatus.OK, response.getStatusCode());
+    }
+
+    @Test
+    public void getInstanceStatusByInstanceIdTest() throws Exception {
+
+        String instanceId = "123";
+        instanceStatusResponse = new ResponseEntity<InstanceStatusResponse>(HttpStatus.OK);
+        CnfAdapterService cnfAdapterService = Mockito.mock(CnfAdapterService.class);
+        Mockito.when(cnfAdapterService.getInstanceStatusByInstanceId(instanceId)).thenReturn(instanceStatusResponse);
+        cnfAdapterRest.getInstanceStatusByInstanceId(instanceId);
+        Assert.assertNotNull(instanceStatusResponse);
+        Assert.assertEquals(HttpStatus.OK, instanceStatusResponse.getStatusCode());
+    }
+
+    @Test
+    public void getInstanceByRBNameOrRBVersionOrProfileNameTest() throws Exception {
+
+        String rbName = "xyz";
+        String rbVersion = "v1";
+        String profileName = "p1";
+        InstanceMiniResponse instanceMiniResponse = new InstanceMiniResponse(HttpStatus.OK.toString());
+        List<InstanceMiniResponse> instancList = new ArrayList<InstanceMiniResponse>();
+        instancList.add(instanceMiniResponse);
+        InstanceMiniResponseList instanceMiniRespList = new InstanceMiniResponseList(HttpStatus.OK.toString());
+        instanceMiniRespList.setInstancList(instancList);
+        instanceMiniRespList.setErrorMsg(HttpStatus.OK.toString());
+        ResponseEntity<InstanceMiniResponseList> respone =
+                new ResponseEntity<InstanceMiniResponseList>(instanceMiniRespList, HttpStatus.OK);
+        CnfAdapterService cnfAdapterService = Mockito.mock(CnfAdapterService.class);
+        Mockito.when(cnfAdapterService.getInstanceByRBNameOrRBVersionOrProfileName(rbName, rbVersion, profileName))
+                .thenReturn(instacneMiniResponseList);
+        cnfAdapterRest.getInstanceByRBNameOrRBVersionOrProfileName(rbName, rbVersion, profileName);
+        Assert.assertNotNull(instacneMiniResponseList);
+        Assert.assertEquals(HttpStatus.OK.toString(), instanceMiniRespList.getErrorMsg());
+    }
+
+}
+
diff --git a/adapters/mso-cnf-adapter/src/test/java/org/onap/so/adapters/cnf/service/CnfAdapterServiceTest.java b/adapters/mso-cnf-adapter/src/test/java/org/onap/so/adapters/cnf/service/CnfAdapterServiceTest.java
new file mode 100644 (file)
index 0000000..0d3d859
--- /dev/null
@@ -0,0 +1,139 @@
+package org.onap.so.adapters.cnf.service;
+
+import javax.ws.rs.InternalServerErrorException;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Matchers;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.onap.so.adapters.cnf.model.BpmnInstanceRequest;
+import org.onap.so.adapters.cnf.model.InstanceMiniResponseList;
+import org.onap.so.adapters.cnf.model.InstanceResponse;
+import org.onap.so.adapters.cnf.model.InstanceStatusResponse;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.test.context.junit4.SpringRunner;
+import org.springframework.web.client.RestTemplate;
+
+@RunWith(SpringRunner.class)
+public class CnfAdapterServiceTest {
+
+    @InjectMocks
+    CnfAdapterService cnfAdapterService;
+
+    @Mock
+    ResponseEntity<InstanceResponse> createInstanceResponse;
+
+    @Mock
+    ResponseEntity<InstanceMiniResponseList> instacneMiniResponseList;
+
+    @Mock
+    ResponseEntity<InstanceStatusResponse> instanceStatusResponse;
+
+    @Mock
+    private RestTemplate restTemplate;
+
+    @Test
+    public void healthCheckTest() throws Exception {
+
+        ResponseEntity<String> response = new ResponseEntity<String>(HttpStatus.OK);
+
+        Mockito.when(restTemplate.exchange(Matchers.anyString(), Matchers.any(HttpMethod.class),
+                Matchers.<HttpEntity<?>>any(), Matchers.<Class<String>>any())).thenReturn(response);
+
+        ResponseEntity<String> actualResponse = cnfAdapterService.healthCheck();
+        Assert.assertNotNull(actualResponse);
+        Assert.assertEquals(HttpStatus.OK, actualResponse.getStatusCode());
+
+    }
+
+    @Test
+    public void createInstanceTest() throws Exception {
+
+        ResponseEntity<InstanceResponse> response = new ResponseEntity<InstanceResponse>(HttpStatus.OK);
+        BpmnInstanceRequest bpmnInstanceRequest = new BpmnInstanceRequest();
+        bpmnInstanceRequest.setK8sRBProfileName("k8sRBProfileName");
+        Mockito.when(restTemplate.exchange(Matchers.anyString(), Matchers.any(HttpMethod.class),
+                Matchers.<HttpEntity<?>>any(), Matchers.<Class<InstanceResponse>>any())).thenReturn(response);
+
+        ResponseEntity<InstanceResponse> actualResponse = cnfAdapterService.createInstance(bpmnInstanceRequest);
+        Assert.assertNotNull(response);
+        Assert.assertEquals(actualResponse.getStatusCode(), response.getStatusCode());
+
+    }
+
+    @Test
+    public void createInstanceExceptionTest() throws Exception {
+
+        BpmnInstanceRequest bpmnInstanceRequest = new BpmnInstanceRequest();
+        ResponseEntity<InstanceResponse> response = cnfAdapterService.createInstance(bpmnInstanceRequest);
+        Assert.assertNull(response);
+
+    }
+
+    @Test
+    public void getInstanceByInstanceIdTest() throws Exception {
+
+        ResponseEntity<InstanceResponse> response = new ResponseEntity<InstanceResponse>(HttpStatus.OK);
+        String instanceId = "123";
+        Mockito.when(restTemplate.exchange(Matchers.anyString(), Matchers.any(HttpMethod.class),
+                Matchers.<HttpEntity<?>>any(), Matchers.<Class<InstanceResponse>>any())).thenReturn(response);
+
+        ResponseEntity<InstanceResponse> actualResponse = cnfAdapterService.getInstanceByInstanceId(instanceId);
+        Assert.assertNotNull(actualResponse);
+        Assert.assertEquals(HttpStatus.OK, actualResponse.getStatusCode());
+
+    }
+
+    @Test
+    public void getInstanceStatusByInstanceIdTest() throws Exception {
+
+        ResponseEntity<InstanceStatusResponse> response = new ResponseEntity<InstanceStatusResponse>(HttpStatus.OK);
+        String instanceId = "123";
+        Mockito.when(restTemplate.exchange(Matchers.anyString(), Matchers.any(HttpMethod.class),
+                Matchers.<HttpEntity<?>>any(), Matchers.<Class<InstanceStatusResponse>>any())).thenReturn(response);
+
+        ResponseEntity<InstanceStatusResponse> actualResponse =
+                cnfAdapterService.getInstanceStatusByInstanceId(instanceId);
+        Assert.assertNotNull(actualResponse);
+        Assert.assertEquals(HttpStatus.OK, response.getStatusCode());
+
+    }
+
+    @Test
+    public void getInstanceByRBNameOrRBVersionOrProfileNameTest() throws Exception {
+
+        ResponseEntity<InstanceMiniResponseList> response = new ResponseEntity<InstanceMiniResponseList>(HttpStatus.OK);
+        String rbName = "xyz";
+        String rbVersion = "v1";
+        String profileName = "p1";
+
+        Mockito.when(restTemplate.exchange(Matchers.anyString(), Matchers.any(HttpMethod.class),
+                Matchers.<HttpEntity<?>>any(), Matchers.<Class<InstanceMiniResponseList>>any())).thenReturn(response);
+
+        ResponseEntity<InstanceMiniResponseList> actualResponse =
+                cnfAdapterService.getInstanceByRBNameOrRBVersionOrProfileName(rbName, rbVersion, profileName);
+        Assert.assertNotNull(actualResponse);
+        Assert.assertEquals(HttpStatus.OK, actualResponse.getStatusCode());
+
+    }
+
+    @Test
+    public void deleteInstanceByInstanceIdTest() throws Exception {
+
+        ResponseEntity<String> response = new ResponseEntity<String>(HttpStatus.OK);
+        String instanceId = "123";
+        Mockito.when(restTemplate.exchange(Matchers.anyString(), Matchers.any(HttpMethod.class),
+                Matchers.<HttpEntity<?>>any(), Matchers.<Class<String>>any())).thenReturn(response);
+
+        ResponseEntity<String> actualResponse = cnfAdapterService.deleteInstanceByInstanceId(instanceId);
+        Assert.assertNotNull(response);
+        Assert.assertEquals(HttpStatus.OK, response.getStatusCode());
+
+    }
+
+}
index ed327fd..9df20ba 100644 (file)
 
 package org.onap.so.adapters.nssmf.enums;
 
+import lombok.Getter;
+
+@Getter
 public enum ActionType {
-    ALLOCATE,
+    ALLOCATE("allocate"),
+
+    DEALLOCATE("deallocate"),
+
+    CREATE("create"),
+
+    TERMINATE("terminate"),
 
-    DEALLOCATE,
+    ACTIVATE("activate"),
 
-    CREATE,
+    DEACTIVATE("deactivate"),
 
-    TERMINATE,
+    QUERY_JOB_STATUS("query_job_status"),
 
-    ACTIVATE,
+    MODIFY_BY_ID("modify_by_id"),
 
-    DEACTIVATE,
+    MODIFY("modify"),
 
-    QUERY_JOB_STATUS,
+    QUERY_NSSI_SELECTION_CAPABILITY("query_nssi_selection_capability"),
 
-    MODIFY_BY_ID,
+    QUERY_SUB_NET_CAPABILITY("query_sub_net_capability"),;
 
-    MODIFY,
+    private String type;
 
-    QUERY_NSSI_SELECTION_CAPABILITY,
 
-    QUERY_SUB_NET_CAPABILITY
+    ActionType(String type) {
+        this.type = type;
+    }
 }
index 3f2e5b2..442339d 100644 (file)
@@ -24,9 +24,9 @@ package org.onap.so.adapters.nssmf.extclients.aai;
 import org.onap.aai.domain.yang.EsrSystemInfoList;
 import org.onap.aai.domain.yang.EsrThirdpartySdncList;
 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;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -47,7 +47,8 @@ public class AaiServiceProviderImpl implements AaiServiceProvider {
     @Override
     public EsrThirdpartySdncList invokeGetThirdPartySdncList() {
         return aaiClientProvider.getAaiClient()
-                .get(EsrThirdpartySdncList.class, AAIUriFactory.createResourceUri(AAIObjectType.THIRDPARTY_SDNC_LIST))
+                .get(EsrThirdpartySdncList.class,
+                        AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.externalSystem().esrThirdpartySdncList()))
                 .orElseGet(() -> {
                     logger.debug("No VNFMs in AAI");
                     return null;
@@ -58,7 +59,8 @@ public class AaiServiceProviderImpl implements AaiServiceProvider {
     public EsrSystemInfoList invokeGetThirdPartySdncEsrSystemInfo(String sdncId) {
         return aaiClientProvider.getAaiClient()
                 .get(EsrSystemInfoList.class,
-                        AAIUriFactory.createResourceUri(AAIObjectType.THIRDPARTY_SDNC_SYSTEM_INFO_LIST, sdncId))
+                        AAIUriFactory
+                                .createResourceUri(AAIFluentTypeBuilder.externalSystem().esrThirdpartySdnc((sdncId))))
                 .orElseGet(() -> {
                     logger.debug("VNFM not found in AAI");
                     return null;
@@ -69,8 +71,8 @@ public class AaiServiceProviderImpl implements AaiServiceProvider {
     @Override
     public void invokeCreateServiceInstance(ServiceInstance nssiInstance, String globalSubscriberId, String serviceType,
             String serviceInstanceId) {
-        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId,
-                serviceType, serviceInstanceId);
+        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business()
+                .customer(globalSubscriberId).serviceSubscription(serviceType).serviceInstance(serviceInstanceId));
         aaiClientProvider.getAaiClient().create(uri, nssiInstance);
     }
 }
index 16a5b2a..d8a9088 100644 (file)
@@ -92,8 +92,13 @@ public abstract class ExternalNssmfManager extends BaseNssmfManager {
 
     private RestResponse doResponseStatus(ResourceOperationStatus status) throws ApplicationException {
         RestResponse restResponse = sendRequest(null);
-        ResponseDescriptor rspDesc =
-                unMarshal(restResponse.getResponseContent(), JobStatusResponse.class).getResponseDescriptor();
+        JobStatusResponse jobStatusResponse = unMarshal(restResponse.getResponseContent(), JobStatusResponse.class);
+
+        ResponseDescriptor rspDesc = jobStatusResponse.getResponseDescriptor();
+        rspDesc.setNssiId(status.getResourceInstanceID());
+
+        jobStatusResponse.setResponseDescriptor(rspDesc);
+        restResponse.setResponseContent(marshal(jobStatusResponse));
         updateRequestDbJobStatus(rspDesc, status, restResponse);
         return restResponse;
     }
index f439b40..348bf12 100644 (file)
@@ -76,6 +76,7 @@ public abstract class InternalNssmfManager extends BaseNssmfManager {
         descriptor.setStatus(status.getStatus());
         descriptor.setStatusDescription(status.getStatusDescription());
         descriptor.setProgress(Integer.parseInt(status.getProgress()));
+        descriptor.setNssiId(status.getResourceInstanceID());
         // descriptor.setResponseId(status.getOperationId());
         return restUtil.createResponse(200, marshal(descriptor));
     }
index 5f7fe76..5b53856 100644 (file)
@@ -106,7 +106,7 @@ public class NssmfManagerServiceImpl implements NssmfManagerService {
     public ResponseEntity queryNSSISelectionCapability(NssmfAdapterNBIRequest nbiRequest) {
         EsrInfo esrInfo = nbiRequest.getEsrInfo();
         try {
-            return buildResponse(buildNssmfManager(esrInfo, ActionType.QUERY_JOB_STATUS, null)
+            return buildResponse(buildNssmfManager(esrInfo, ActionType.QUERY_NSSI_SELECTION_CAPABILITY, null)
                     .queryNSSISelectionCapability(nbiRequest));
         } catch (ApplicationException e) {
             return e.buildErrorResponse();
@@ -117,8 +117,8 @@ public class NssmfManagerServiceImpl implements NssmfManagerService {
     public ResponseEntity querySubnetCapability(NssmfAdapterNBIRequest nbiRequest) {
         EsrInfo esrInfo = nbiRequest.getEsrInfo();
         try {
-            return buildResponse(
-                    buildNssmfManager(esrInfo, ActionType.QUERY_JOB_STATUS, null).querySubnetCapability(nbiRequest));
+            return buildResponse(buildNssmfManager(esrInfo, ActionType.QUERY_SUB_NET_CAPABILITY, null)
+                    .querySubnetCapability(nbiRequest));
         } catch (ApplicationException e) {
             return e.buildErrorResponse();
         }
index 67cd913..f150f47 100644 (file)
 
 package org.onap.so.adapters.nssmf;
 
+import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.doAnswer;
+import static org.mockito.Mockito.when;
+import static org.mockito.MockitoAnnotations.initMocks;
+import static org.onap.so.adapters.nssmf.util.NssmfAdapterUtil.marshal;
+import static org.onap.so.adapters.nssmf.util.NssmfAdapterUtil.unMarshal;
+import static org.onap.so.beans.nsmf.NetworkType.CORE;
+import static org.onap.so.beans.nsmf.ResourceSharingLevel.NON_SHARED;
 import java.io.ByteArrayInputStream;
 import java.io.InputStream;
 import java.util.LinkedList;
@@ -56,19 +67,9 @@ import org.onap.so.beans.nsmf.NssiResponse;
 import org.onap.so.beans.nsmf.PerfReq;
 import org.onap.so.beans.nsmf.PerfReqEmbb;
 import org.onap.so.db.request.data.repository.ResourceOperationStatusRepository;
+import org.skyscreamer.jsonassert.JSONAssert;
 import org.springframework.http.ResponseEntity;
 import org.springframework.test.context.junit4.SpringRunner;
-import static java.nio.charset.StandardCharsets.UTF_8;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.doAnswer;
-import static org.mockito.Mockito.when;
-import static org.mockito.MockitoAnnotations.initMocks;
-import static org.onap.so.adapters.nssmf.util.NssmfAdapterUtil.marshal;
-import static org.onap.so.adapters.nssmf.util.NssmfAdapterUtil.unMarshal;
-import static org.onap.so.beans.nsmf.NetworkType.CORE;
-import static org.onap.so.beans.nsmf.ResourceSharingLevel.NON_SHARED;
 
 @RunWith(SpringRunner.class)
 public class NssmfAdapterRestTest {
@@ -281,7 +282,7 @@ public class NssmfAdapterRestTest {
     //
     @Test
     public void testAllocateJsonSerDeSer() throws Exception {
-        assertEquals(marshal(allocateNssi()), ALLOCATE);
+        JSONAssert.assertEquals(marshal(allocateNssi()), ALLOCATE, false);
         NssiAllocateRequest all = unMarshal(ALLOCATE, NssiAllocateRequest.class);
         assertNotNull(all);
         assertNotNull(all.getAllocateCnNssi());
index 2849907..bb2c938 100644 (file)
@@ -5,12 +5,11 @@ import java.util.Optional;
 import org.onap.aai.domain.yang.CloudRegion;
 import org.onap.aai.domain.yang.Complex;
 import org.onap.aai.domain.yang.NetworkTechnologies;
-import org.onap.aaiclient.client.aai.AAIObjectPlurals;
-import org.onap.aaiclient.client.aai.AAIObjectType;
 import org.onap.aaiclient.client.aai.AAIResourcesClient;
 import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
 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.so.db.catalog.beans.CloudSite;
 import org.onap.so.db.catalog.beans.NetworkTechnologyReference;
 import org.onap.so.db.catalog.client.CatalogDbClient;
@@ -68,11 +67,12 @@ public class CloudRestImpl {
             if (complex.isPresent()) {
                 cloudRegion.setComplexName(complex.get().getComplexName());
             }
-            AAIResourceUri cloudRegionURI = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION,
-                    cloudRegion.getCloudOwner(), cloudRegion.getCloudRegionId());
+            AAIResourceUri cloudRegionURI = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+                    .cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getCloudRegionId()));
             getAaiClient().createIfNotExists(cloudRegionURI, Optional.of(cloudRegion));
             if (complex.isPresent()) {
-                AAIResourceUri complexURI = AAIUriFactory.createResourceUri(AAIObjectType.COMPLEX, cloudSite.getClli());
+                AAIResourceUri complexURI = AAIUriFactory
+                        .createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().complex(cloudSite.getClli()));
                 getAaiClient().connect(cloudRegionURI, complexURI);
             }
             createCloudRegionNetworkTechnologyRelationship(cloudSite, cloudRegionURI);
@@ -88,18 +88,21 @@ public class CloudRestImpl {
     }
 
     protected Optional<Complex> retrieveComplex(CloudSite cloudSite) {
-        AAIResourceUri complexURI = AAIUriFactory.createResourceUri(AAIObjectType.COMPLEX, cloudSite.getClli());
+        AAIResourceUri complexURI = AAIUriFactory
+                .createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().complex(cloudSite.getClli()));
         return getAaiClient().get(Complex.class, complexURI);
     }
 
     protected void linkCloudAndTechnology(String networkTechnologyName, AAIResourceUri cloudRegionURI) {
-        AAIPluralResourceUri technologyPluralUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_TECHNOLOGY)
-                .queryParam("network-technology-name", networkTechnologyName);
+        AAIPluralResourceUri technologyPluralUri =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().networkTechnologies())
+                        .queryParam("network-technology-name", networkTechnologyName);
         Optional<NetworkTechnologies> networkTechnology =
                 getAaiClient().get(NetworkTechnologies.class, technologyPluralUri);
         if (networkTechnology.isPresent()) {
-            AAIResourceUri networkTechnologyURI = AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_TECHNOLOGY,
-                    networkTechnology.get().getNetworkTechnology().get(0).getNetworkTechnologyId());
+            AAIResourceUri networkTechnologyURI =
+                    AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().networkTechnology(
+                            networkTechnology.get().getNetworkTechnology().get(0).getNetworkTechnologyId()));
             getAaiClient().connect(cloudRegionURI, networkTechnologyURI);
         }
     }
index 1f0422b..22e6b1f 100644 (file)
@@ -54,9 +54,9 @@ public class DeleteAAIInventory {
             CloudSite cloudSite = cloudConfig.getCloudSite(cloudInformation.getRegionId())
                     .orElseThrow(() -> new MsoCloudSiteNotFound(cloudInformation.getRegionId()));
             CloudIdentity cloudIdentity = cloudSite.getIdentityService();
-            HeatBridgeApi heatBridgeClient =
-                    new HeatBridgeImpl(new AAIResourcesClient(), cloudIdentity, cloudInformation.getOwner(),
-                            cloudInformation.getRegionId(), cloudSite.getRegionId(), cloudInformation.getTenantId());
+            HeatBridgeApi heatBridgeClient = new HeatBridgeImpl(new AAIResourcesClient(), cloudIdentity,
+                    cloudInformation.getOwner(), cloudInformation.getRegionId(), cloudSite.getRegionId(),
+                    cloudInformation.getTenantId(), cloudInformation.getNodeType());
             heatBridgeClient.authenticate();
             heatBridgeClient.deleteVfModuleData(cloudInformation.getVnfId(), cloudInformation.getVfModuleId());
 
index 1445622..6f87b6b 100644 (file)
@@ -27,12 +27,13 @@ import org.onap.aai.domain.yang.LInterface;
 import org.onap.aai.domain.yang.VfModule;
 import org.onap.aai.domain.yang.VfModules;
 import org.onap.aai.domain.yang.Vserver;
-import org.onap.aaiclient.client.aai.AAIObjectPlurals;
 import org.onap.aaiclient.client.aai.AAIObjectType;
 import org.onap.aaiclient.client.aai.entities.AAIResultWrapper;
 import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
 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.aaiclient.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
 import org.onap.so.objects.audit.AAIObjectAudit;
 import org.onap.so.objects.audit.AAIObjectAuditList;
@@ -49,20 +50,20 @@ public class AuditVServer extends AbstractAudit {
     public void auditVservers(AAIObjectAuditList aaiObjectAuditList) {
 
         aaiObjectAuditList.getAuditList().forEach(aaiObjectAudit -> {
-            boolean vserverExist = getAaiClient().exists(AAIUriFactory
-                    .createResourceFromExistingURI(AAIObjectType.VSERVER, aaiObjectAudit.getResourceURI()));
+            boolean vserverExist = getAaiClient().exists(
+                    AAIUriFactory.createResourceFromExistingURI(Types.VSERVER, aaiObjectAudit.getResourceURI()));
             aaiObjectAudit.setDoesObjectExist(vserverExist);
         });
     }
 
     public Optional<AAIObjectAuditList> auditVserversThroughRelationships(String genericVnfId, String vfModuleName) {
         AAIObjectAuditList auditList = new AAIObjectAuditList();
-        AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VF_MODULE, genericVnfId)
-                .queryParam("vf-module-name", vfModuleName);
+        AAIPluralResourceUri uri =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(genericVnfId).vfModules())
+                        .queryParam("vf-module-name", vfModuleName);
         Optional<AAIResultWrapper> wrapper = getAaiClient().getFirstWrapper(VfModules.class, VfModule.class, uri);
         if (wrapper.isPresent() && wrapper.get().getRelationships().isPresent()) {
-            List<AAIResourceUri> relatedVservers =
-                    wrapper.get().getRelationships().get().getRelatedUris(AAIObjectType.VSERVER);
+            List<AAIResourceUri> relatedVservers = wrapper.get().getRelationships().get().getRelatedUris(Types.VSERVER);
             if (!relatedVservers.isEmpty()) {
                 relatedVservers.forEach(vserverUri -> {
                     Optional<Vserver> vserver = getAaiClient().get(vserverUri).asBean(Vserver.class);
@@ -70,7 +71,7 @@ public class AuditVServer extends AbstractAudit {
                     BeanUtils.copyProperties(vserver, vServerShallow);
                     AAIObjectAudit vServerAudit = new AAIObjectAudit();
                     vServerAudit.setAaiObject(vServerShallow);
-                    vServerAudit.setAaiObjectType(AAIObjectType.VSERVER.typeName());
+                    vServerAudit.setAaiObjectType(Types.VSERVER.typeName());
                     vServerAudit.setDoesObjectExist(true);
                     auditList.getAuditList().add(vServerAudit);
                 });
@@ -103,8 +104,8 @@ public class AuditVServer extends AbstractAudit {
             String cloudRegion) {
         AAIObjectAuditList auditList = new AAIObjectAuditList();
         AAIObjectAudit vServerAudit = new AAIObjectAudit();
-        AAIResourceUri vserverURI = AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, cloudOwner, cloudRegion,
-                tenantId, vServer.getVserverId());
+        AAIResourceUri vserverURI = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+                .cloudRegion(cloudOwner, cloudRegion).tenant(tenantId).vserver(vServer.getVserverId()));
         Vserver vServerShallow = new Vserver();
         BeanUtils.copyProperties(vServer, vServerShallow, "LInterfaces");
         boolean vServerExists = getAaiClient().exists(vserverURI);
@@ -112,7 +113,7 @@ public class AuditVServer extends AbstractAudit {
         vServerAudit.setAaiObject(vServerShallow);
         vServerAudit.setDoesObjectExist(vServerExists);
         vServerAudit.setResourceURI(vserverURI.build());
-        vServerAudit.setAaiObjectType(AAIObjectType.VSERVER.typeName());
+        vServerAudit.setAaiObjectType(Types.VSERVER.typeName());
         auditList.getAuditList().add(vServerAudit);
         if (vServer.getLInterfaces() != null) {
             vServer.getLInterfaces().getLInterface().stream().forEach(lInterface -> auditList.getAuditList().addAll(
@@ -126,8 +127,9 @@ public class AuditVServer extends AbstractAudit {
             String cloudOwner, String cloudRegion) {
         AAIObjectAuditList auditList = new AAIObjectAuditList();
         AAIObjectAudit lInterfaceAudit = new AAIObjectAudit();
-        AAIResourceUri linterfaceURI = AAIUriFactory.createResourceUri(AAIObjectType.L_INTERFACE, cloudOwner,
-                cloudRegion, tenantId, vServerId, lInterface.getInterfaceName());
+        AAIResourceUri linterfaceURI = AAIUriFactory
+                .createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(cloudOwner, cloudRegion)
+                        .tenant(tenantId).vserver(vServerId).lInterface(lInterface.getInterfaceName()));
         Optional<LInterface> queriedLInterface = getAaiClient().get(LInterface.class, linterfaceURI);
         if (queriedLInterface.isPresent()) {
             lInterfaceAudit.setDoesObjectExist(true);
@@ -135,7 +137,7 @@ public class AuditVServer extends AbstractAudit {
         }
         lInterfaceAudit.setAaiObject(lInterface);
         lInterfaceAudit.setResourceURI(linterfaceURI.build());
-        lInterfaceAudit.setAaiObjectType(AAIObjectType.L_INTERFACE.typeName());
+        lInterfaceAudit.setAaiObjectType(Types.L_INTERFACE.typeName());
         auditList.getAuditList().add(lInterfaceAudit);
         logger.info("l-interface id:{} name: {} exists: {} ", lInterface.getInterfaceId(),
                 lInterface.getInterfaceName(), lInterfaceAudit.isDoesObjectExist());
index 3ff15ff..c58e568 100644 (file)
@@ -37,8 +37,9 @@ import org.onap.aai.domain.yang.LInterfaces;
 import org.onap.aai.domain.yang.Vlan;
 import org.onap.aai.domain.yang.Vlans;
 import org.onap.aai.domain.yang.Vserver;
-import org.onap.aaiclient.client.aai.AAIObjectType;
 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.objects.audit.AAIObjectAudit;
 import org.onap.so.objects.audit.AAIObjectAuditList;
 import org.onap.so.openstack.utils.MsoHeatUtils;
@@ -260,10 +261,12 @@ public class HeatStackAudit {
         Vserver vServerShallow = new Vserver();
         BeanUtils.copyProperties(vServer, vServerShallow);
         aaiObjectAudit.setAaiObject(vServerShallow);
-        aaiObjectAudit.setAaiObjectType(AAIObjectType.VSERVER.typeName());
-        aaiObjectAudit.setResourceURI(AAIUriFactory
-                .createResourceUri(AAIObjectType.VSERVER, cloudOwner, cloudRegion, tenantId, vServer.getVserverId())
-                .build());
+        aaiObjectAudit.setAaiObjectType(Types.VSERVER.typeName());
+        aaiObjectAudit
+                .setResourceURI(AAIUriFactory
+                        .createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+                                .cloudRegion(cloudOwner, cloudRegion).tenant(tenantId).vserver(vServer.getVserverId()))
+                        .build());
 
         return aaiObjectAudit;
     }
index 12751f8..3f79c43 100644 (file)
@@ -64,9 +64,9 @@ public class CreateAAIInventory {
 
             List<String> oobMgtNetNames = new ArrayList<>();
 
-            HeatBridgeApi heatBridgeClient =
-                    new HeatBridgeImpl(new AAIResourcesClient(), cloudIdentity, cloudInformation.getOwner(),
-                            cloudInformation.getRegionId(), cloudSite.getRegionId(), cloudInformation.getTenantId());
+            HeatBridgeApi heatBridgeClient = new HeatBridgeImpl(new AAIResourcesClient(), cloudIdentity,
+                    cloudInformation.getOwner(), cloudInformation.getRegionId(), cloudSite.getRegionId(),
+                    cloudInformation.getTenantId(), cloudInformation.getNodeType());
 
             heatBridgeClient.authenticate();
 
@@ -119,8 +119,8 @@ public class CreateAAIInventory {
                     "Successfully queried neutron resources and built AAI actions to add l-interfaces to vservers.");
 
             // Update AAI
-            logger.debug("Current Dry Run Value: {}", env.getProperty("heatBridgeDryrun", Boolean.class, true));
-            heatBridgeClient.submitToAai(env.getProperty("heatBridgeDryrun", Boolean.class, true));
+            logger.debug("Current Dry Run Value: {}", env.getProperty("heatBridgeDryrun", Boolean.class, false));
+            heatBridgeClient.submitToAai(env.getProperty("heatBridgeDryrun", Boolean.class, false));
         } catch (Exception ex) {
             logger.debug("Heatbrige failed for stackId: " + cloudInformation.getTemplateInstanceId(), ex);
         }
index a4e6ccc..bafba3e 100644 (file)
@@ -155,7 +155,7 @@ public interface HeatBridgeApi {
      * @param cloudOwner
      */
     void buildAddVserverLInterfacesToAaiAction(List<Resource> stackResources, List<String> oobMgtNetIds,
-            String cloudOwner);
+            String cloudOwner) throws HeatBridgeException;
 
     /**
      * Query and build AAI actions for Openstack Compute resources to AAI's pserver and pinterface objects
index 7e25ed6..90a578d 100644 (file)
@@ -32,6 +32,8 @@
  */
 package org.onap.so.heatbridge;
 
+import java.io.IOException;
+import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -60,22 +62,31 @@ 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.SriovVfs;
 import org.onap.aai.domain.yang.VfModule;
 import org.onap.aai.domain.yang.Vlan;
-import org.onap.aai.domain.yang.Vlans;
 import org.onap.aai.domain.yang.Vserver;
-import org.onap.aaiclient.client.aai.AAIObjectType;
+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.AAIResultWrapper;
 import org.onap.aaiclient.client.aai.entities.Relationships;
+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.generated.fluentbuilders.AAIFluentTypeBuilder.Types;
+import org.onap.aaiclient.client.graphinventory.Format;
+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.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;
 import org.onap.so.heatbridge.constants.HeatBridgeConstants;
@@ -97,6 +108,8 @@ import org.openstack4j.model.network.Subnet;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.core.env.Environment;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
 import com.google.common.base.Preconditions;
 import com.google.common.base.Strings;
 import com.google.common.collect.ImmutableMap;
@@ -111,21 +124,34 @@ public class HeatBridgeImpl implements HeatBridgeApi {
     private static final String ERR_MSG_NULL_OS_CLIENT =
             "Initialization error: Null openstack client. Authenticate with Keystone first.";
     private static final String OOB_MGT_NETWORK_IDENTIFIER = "Management";
+
+    protected static final String DIRECT = "direct";
+    protected static final String PCI_SLOT = "pci_slot";
+    protected static final String OVSNET = "ovsnet";
+    protected static final String SRIOV = "SRIOV";
+    protected static final String RESOURCE_LINK = "resource-link";
+
+    protected static final Object PRIVATE_VLANS = "private_vlans";
+    protected static final Object PUBLIC_VLANS = "public_vlans";
+
+    protected ObjectMapper mapper = new ObjectMapper();
+
     private OpenstackClient osClient;
     private AAIResourcesClient resourcesClient;
+    private AAIDSLQueryClient aaiDSLClient;
     private AAISingleTransactionClient transaction;
     private String cloudOwner;
     private String cloudRegionId;
     private String regionId;
     private String tenantId;
+    private NodeType nodeType;
     private AaiHelper aaiHelper = new AaiHelper();
     private CloudIdentity cloudIdentity;
     private Environment env;
 
-
     public HeatBridgeImpl(AAIResourcesClient resourcesClient, final CloudIdentity cloudIdentity,
             @Nonnull final String cloudOwner, @Nonnull final String cloudRegionId, @Nonnull final String regionId,
-            @Nonnull final String tenantId) {
+            @Nonnull final String tenantId, @Nonnull final NodeType nodeType) {
         Objects.requireNonNull(cloudOwner, "Null cloud-owner value!");
         Objects.requireNonNull(cloudRegionId, "Null cloud-region identifier!");
         Objects.requireNonNull(tenantId, "Null tenant identifier!");
@@ -137,6 +163,7 @@ public class HeatBridgeImpl implements HeatBridgeApi {
         this.regionId = regionId;
         this.tenantId = tenantId;
         this.resourcesClient = resourcesClient;
+        this.nodeType = nodeType;
         if (resourcesClient != null)
             this.transaction = resourcesClient.beginSingleTransaction();
         if (SpringContextHelper.getAppContext() != null)
@@ -202,6 +229,11 @@ public class HeatBridgeImpl implements HeatBridgeApi {
         return serverIds.stream().map(serverId -> osClient.getServerById(serverId)).collect(Collectors.toList());
     }
 
+
+    protected Server getOpenstackServerById(String deviceId) {
+        return osClient.getServerById(deviceId);
+    }
+
     @Override
     public List<Network> getAllOpenstackProviderNetworks(final List<Resource> stackResources) {
         Objects.requireNonNull(osClient, ERR_MSG_NULL_OS_CLIENT);
@@ -241,7 +273,8 @@ public class HeatBridgeImpl implements HeatBridgeApi {
 
                 l3Network.setRelationshipList(relationshipList);
                 transaction.createIfNotExists(
-                        AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, l3Network.getNetworkId()),
+                        AAIUriFactory
+                                .createResourceUri(AAIFluentTypeBuilder.network().l3Network(l3Network.getNetworkId())),
                         Optional.of(l3Network));
             }
         });
@@ -253,8 +286,8 @@ public class HeatBridgeImpl implements HeatBridgeApi {
         for (org.openstack4j.model.compute.Image image : images) {
             Image aaiImage = aaiHelper.buildImage(image);
             try {
-                AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.IMAGE, cloudOwner, cloudRegionId,
-                        aaiImage.getImageId());
+                AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+                        .cloudRegion(cloudOwner, cloudRegionId).image(aaiImage.getImageId()));
                 if (!resourcesClient.exists(uri)) {
                     transaction.create(uri, aaiImage);
                     logger.debug("Queuing AAI command to add image: " + aaiImage.getImageId());
@@ -274,8 +307,8 @@ public class HeatBridgeImpl implements HeatBridgeApi {
         for (org.openstack4j.model.compute.Flavor flavor : flavors) {
             Flavor aaiFlavor = aaiHelper.buildFlavor(flavor);
             try {
-                AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.FLAVOR, cloudOwner, cloudRegionId,
-                        aaiFlavor.getFlavorId());
+                AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+                        .cloudRegion(cloudOwner, cloudRegionId).flavor(aaiFlavor.getFlavorId()));
                 transaction.createIfNotExists(uri, Optional.of(aaiFlavor));
             } catch (WebApplicationException e) {
                 throw new HeatBridgeException(
@@ -293,20 +326,24 @@ public class HeatBridgeImpl implements HeatBridgeApi {
             // Build vserver relationships to: image, flavor, pserver, vf-module
             vserver.setRelationshipList(
                     aaiHelper.getVserverRelationshipList(cloudOwner, cloudRegionId, genericVnfId, vfModuleId, server));
-            transaction.createIfNotExists(AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, cloudOwner,
-                    cloudRegionId, tenantId, vserver.getVserverId()), Optional.of(vserver));
+            transaction.createIfNotExists(
+                    AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+                            .cloudRegion(cloudOwner, cloudRegionId).tenant(tenantId).vserver(vserver.getVserverId())),
+                    Optional.of(vserver));
         });
     }
 
     @Override
     public void buildAddVserverLInterfacesToAaiAction(final List<Resource> stackResources,
-            final List<String> oobMgtNetIds, String cloudOwner) {
+            final List<String> oobMgtNetIds, String cloudOwner) throws HeatBridgeException {
         Objects.requireNonNull(osClient, ERR_MSG_NULL_OS_CLIENT);
         List<String> portIds =
                 extractStackResourceIdsByResourceType(stackResources, HeatBridgeConstants.OS_PORT_RESOURCE_TYPE);
+
         if (portIds == null)
             return;
         for (String portId : portIds) {
+            boolean isL2Multicast = false;
             Port port = osClient.getPortById(portId);
             Network network = osClient.getNetworkById(port.getNetworkId());
             LInterface lIf = new LInterface();
@@ -317,12 +354,7 @@ public class HeatBridgeImpl implements HeatBridgeApi {
             lIf.setIsPortMirrored(false);
             lIf.setIsIpUnnumbered(false);
             lIf.setInMaint(false);
-            if (oobMgtNetIds != null && oobMgtNetIds.contains(port.getNetworkId())) {
-                lIf.setInterfaceRole(OOB_MGT_NETWORK_IDENTIFIER);
-            } else {
-                lIf.setInterfaceRole(port.getvNicType());
-            }
-            boolean isL2Multicast = false;
+
             if (port.getProfile() != null && port.getProfile().get("trusted") != null) {
                 String trusted = port.getProfile().get("trusted").toString();
                 if (Boolean.parseBoolean(trusted)) {
@@ -330,19 +362,46 @@ public class HeatBridgeImpl implements HeatBridgeApi {
                 }
             }
             lIf.setL2Multicasting(isL2Multicast);
+            lIf.setInterfaceType(getInterfaceType(nodeType, port.getvNicType()));
+            lIf.setRelationshipList(new RelationshipList());
 
-            transaction.createIfNotExists(AAIUriFactory.createResourceUri(AAIObjectType.L_INTERFACE, cloudOwner,
-                    cloudRegionId, tenantId, port.getDeviceId(), lIf.getInterfaceName()), Optional.of(lIf));
+            if (oobMgtNetIds != null && oobMgtNetIds.contains(port.getNetworkId())) {
+                lIf.setInterfaceRole(OOB_MGT_NETWORK_IDENTIFIER);
+            } else {
+                lIf.setInterfaceRole(port.getvNicType());
+            }
+
+            // Update l-interface to the vserver
+            transaction.createIfNotExists(
+                    AAIUriFactory.createResourceUri(
+                            AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(cloudOwner, cloudRegionId)
+                                    .tenant(tenantId).vserver(port.getDeviceId()).lInterface(lIf.getInterfaceName())),
+                    Optional.of(lIf));
 
             updateLInterfaceIps(port, lIf);
+
             if (cloudOwner.equals(env.getProperty("mso.cloudOwner.included", ""))) {
-                updateLInterfaceVlan(port, lIf);
+                Server server = getOpenstackServerById(port.getDeviceId());
+                updateLInterfaceVlan(port, lIf, server.getHypervisorHostname());
             }
 
             updateSriovPfToPserver(port, lIf);
         }
     }
 
+    protected String getInterfaceType(NodeType nodeType, String nicType) {
+        logger.debug("nicType: " + nicType + "nodeType: " + nodeType);
+        if (DIRECT.equalsIgnoreCase(nicType)) {
+            return SRIOV;
+        } else {
+            if (nodeType == NodeType.GREENFIELD) {
+                return NodeType.GREENFIELD.getNetworkTechnologyName();
+            } else {
+                return NodeType.BROWNFIELD.getNetworkTechnologyName();
+            }
+        }
+    }
+
     @Override
     public void createPserversAndPinterfacesIfNotPresentInAai(final List<Resource> stackResources)
             throws HeatBridgeException {
@@ -356,8 +415,10 @@ public class HeatBridgeImpl implements HeatBridgeApi {
         for (String portId : portIds) {
             Port port = osClient.getPortById(portId);
             if (port.getvNicType().equalsIgnoreCase(HeatBridgeConstants.OS_SRIOV_PORT_TYPE)) {
-                createPServerPInterfaceIfNotExists(serverHostnames.get(port.getHostId()).getHostname(),
-                        aaiHelper.buildPInterface(port));
+                Pserver foundServer = serverHostnames.get(port.getHostId());
+                if (foundServer != null) {
+                    createPServerPInterfaceIfNotExists(foundServer.getHostname(), aaiHelper.buildPInterface(port));
+                }
             }
         }
     }
@@ -369,6 +430,7 @@ public class HeatBridgeImpl implements HeatBridgeApi {
             for (Server server : osServers) {
                 Pserver pserver = aaiHelper.buildPserver(server);
                 if (pserver != null) {
+                    logger.debug("Adding Pserver: " + server.getHost());
                     pserverMap.put(server.getHost(), pserver);
                 }
             }
@@ -392,18 +454,21 @@ public class HeatBridgeImpl implements HeatBridgeApi {
 
     private void createPServerIfNotExists(Map<String, Pserver> serverHostnames) {
         for (Pserver pserver : serverHostnames.values()) {
-            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.PSERVER, pserver.getHostname());
+            AAIResourceUri uri = AAIUriFactory
+                    .createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().pserver(pserver.getHostname()));
             resourcesClient.createIfNotExists(uri, Optional.of(pserver));
         }
     }
 
     private void createPServerPInterfaceIfNotExists(String pserverHostname, PInterface pInterface) {
-        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.P_INTERFACE, pserverHostname,
-                pInterface.getInterfaceName());
+        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+                .pserver(pserverHostname).pInterface(pInterface.getInterfaceName()));
         resourcesClient.createIfNotExists(uri, Optional.of(pInterface));
     }
 
-    private void updateLInterfaceVlan(final Port port, final LInterface lIf) {
+    private void updateLInterfaceVlan(final Port port, final LInterface lIf, final String hostName)
+            throws HeatBridgeException {
+        // add back all vlan logic
         Vlan vlan = new Vlan();
         Network network = osClient.getNetworkById(port.getNetworkId());
         if (network.getNetworkType() != null && network.getNetworkType().equals(NetworkType.VLAN)) {
@@ -413,7 +478,6 @@ public class HeatBridgeImpl implements HeatBridgeApi {
             vlan.setInMaint(false);
             vlan.setIsIpUnnumbered(false);
             vlan.setIsPrivate(false);
-
             transaction
                     .createIfNotExists(
                             AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
@@ -422,6 +486,32 @@ 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());
+        }
+
+        List<String> privateVlans = (ArrayList<String>) port.getProfile().get(PRIVATE_VLANS);
+        List<String> publicVlans = (ArrayList<String>) port.getProfile().get(PUBLIC_VLANS);
+        List<String> vlans = null;
+        if (publicVlans != null && !publicVlans.isEmpty()) {
+            vlans = publicVlans.stream().filter(publicVlan -> !Strings.isNullOrEmpty(publicVlan))
+                    .collect(Collectors.toList());
+        } else {
+            vlans = new ArrayList<>();
+        }
+
+        if (privateVlans != null && !privateVlans.isEmpty()) {
+            List<String> temp = privateVlans.stream().filter(privateVlan -> !Strings.isNullOrEmpty(privateVlan))
+                    .collect(Collectors.toList());
+            vlans.addAll(temp);
+        }
+        vlans.stream().forEach(vlanLocal -> logger.debug("Vlan Id: {}", vlanLocal));
+
+        processVlanTag(lIf, vlans);
+
         if (port.getvNicType() != null && port.getvNicType().equalsIgnoreCase(HeatBridgeConstants.OS_SRIOV_PORT_TYPE)) {
             SriovVf sriovVf = new SriovVf();
             sriovVf.setPciId(port.getProfile().get(HeatBridgeConstants.OS_PCI_SLOT_KEY).toString());
@@ -439,6 +529,49 @@ public class HeatBridgeImpl implements HeatBridgeApi {
         }
     }
 
+    protected String createVlanTagUri(String vlanIdOuter) throws HeatBridgeException {
+        int vlanOuterInt = Integer.parseInt(vlanIdOuter);
+        DSLQueryBuilder<Start, Node> builder = TraversalBuilder
+                .fragment(new DSLStartNode(Types.CLOUD_REGION, __.key("cloud-owner", cloudOwner),
+                        __.key("cloud-region-id", cloudRegionId)))
+                .to(__.node(Types.VLAN_RANGE))
+                .to(__.node(Types.VLAN_TAG, __.key("vlan-id-outer", vlanOuterInt)).output());
+        String results = getAAIDSLClient().query(Format.PATHED, new DSLQuery(builder.build()));
+        Optional<String> vlanTagURI = findLinkedURI(results);
+        if (vlanTagURI.isPresent())
+            return vlanTagURI.get();
+        else
+            throw new HeatBridgeException("Cannot find VlanTag Related Link " + vlanIdOuter);
+    }
+
+
+    protected void processVlanTag(LInterface lInterface, List<String> vlanTags) throws HeatBridgeException {
+        for (String vlanTag : vlanTags) {
+            Relationship vlanTagRelationship = new Relationship();
+            vlanTagRelationship.setRelatedLink(createVlanTagUri(vlanTag));
+            lInterface.getRelationshipList().getRelationship().add(vlanTagRelationship);
+        }
+    }
+
+    protected void validatePhysicalNetwork(Port neutronPort, Network network) throws HeatBridgeException {
+        String physicalNetworkType = network.getProviderPhyNet();
+        if (!OVSNET.equalsIgnoreCase(physicalNetworkType)) {
+            String exceptionMessage = String.format(
+                    "The OVS-DPDK port is expected to have a physical network of type ovsnet but was found to have %s instead.",
+                    physicalNetworkType);
+            throw new HeatBridgeException(exceptionMessage);
+        }
+    }
+
+    protected void processOVS(LInterface lInterface, String hostName, String interfaceName) {
+        Relationship lagRelationship = new Relationship();
+        lagRelationship.setRelatedLink(AAIUriFactory
+                .createResourceUri(
+                        AAIFluentTypeBuilder.cloudInfrastructure().pserver(hostName).lagInterface(interfaceName))
+                .build().toString());
+        lInterface.getRelationshipList().getRelationship().add(lagRelationship);
+    }
+
     /**
      * Needs to be corrected according to the specification that is in draft If pserver/p-interface does not have a
      * SRIOV-PF object matching the PCI-ID of the Openstack port object, then create it in AAI. Openstack SRIOV Port
@@ -464,9 +597,11 @@ public class HeatBridgeImpl implements HeatBridgeApi {
                 lIf.setInterfaceDescription(
                         "Attached to SR-IOV port: " + pserverHostName + "::" + matchingPifName.get());
                 try {
-                    Optional<PInterface> matchingPIf = resourcesClient.get(PInterface.class, AAIUriFactory
-                            .createResourceUri(AAIObjectType.P_INTERFACE, pserverHostName, matchingPifName.get())
-                            .depth(Depth.ONE));
+                    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) {
@@ -484,16 +619,18 @@ public class HeatBridgeImpl implements HeatBridgeApi {
                             logger.debug("Queuing AAI command to update sriov-pf object to pserver: " + pserverHostName
                                     + "/" + matchingPifName.get());
 
-                            AAIResourceUri sriovPfUri = AAIUriFactory.createResourceUri(AAIObjectType.SRIOV_PF,
-                                    pserverHostName, matchingPifName.get(), sriovPf.getPfPciId());
+                            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(AAIObjectType.SRIOV_VF,
-                                        cloudOwner, cloudRegionId, tenantId, port.getDeviceId(), lIf.getInterfaceName(),
-                                        port.getProfile().get(HeatBridgeConstants.OS_PCI_SLOT_KEY).toString());
-
+                                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);
                             }
                         }
@@ -562,17 +699,16 @@ public class HeatBridgeImpl implements HeatBridgeApi {
         Objects.requireNonNull(vnfId, "Null vnf-id!");
         Objects.requireNonNull(vfModuleId, "Null vf-module-id!");
         try {
-            Optional<VfModule> vfModule = resourcesClient
-                    .get(AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId).depth(Depth.ONE),
-                            NotFoundException.class)
-                    .asBean(VfModule.class);
+            Optional<VfModule> vfModule = resourcesClient.get(AAIUriFactory
+                    .createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId).vfModule(vfModuleId))
+                    .depth(Depth.ONE), NotFoundException.class).asBean(VfModule.class);
 
             AAIResultWrapper resultWrapper = new AAIResultWrapper(vfModule.get());
             Optional<Relationships> relationships = resultWrapper.getRelationships();
             logger.debug("VfModule contains relationships in AAI: {}", relationships.isPresent());
             if (relationships.isPresent()) {
 
-                List<AAIResourceUri> l3NetworkUris = relationships.get().getRelatedUris(AAIObjectType.L3_NETWORK);
+                List<AAIResourceUri> l3NetworkUris = relationships.get().getRelatedUris(Types.L3_NETWORK);
                 logger.debug("L3Network contains {} relationships in AAI", l3NetworkUris.size());
 
                 if (!l3NetworkUris.isEmpty()) {
@@ -585,13 +721,13 @@ public class HeatBridgeImpl implements HeatBridgeApi {
                     }
                 }
 
-                List<AAIResourceUri> vserverUris = relationships.get().getRelatedUris(AAIObjectType.VSERVER);
+                List<AAIResourceUri> vserverUris = relationships.get().getRelatedUris(Types.VSERVER);
                 logger.debug("VServer contains {} relationships in AAI", vserverUris.size());
                 createTransactionToDeleteSriovPfFromPserver(vserverUris);
 
                 if (!vserverUris.isEmpty()) {
                     for (AAIResourceUri vserverUri : vserverUris) {
-                        if (env.getProperty("heatBridgeDryrun", Boolean.class, true)) {
+                        if (env.getProperty("heatBridgeDryrun", Boolean.class, false)) {
                             logger.debug("Would delete Vserver: {}", vserverUri.build().toString());
                         } else {
                             resourcesClient.delete(vserverUri);
@@ -617,7 +753,8 @@ public class HeatBridgeImpl implements HeatBridgeApi {
             String pserverName = entry.getKey();
             List<String> pciIds = entry.getValue();
             Optional<Pserver> pserver = resourcesClient.get(Pserver.class,
-                    AAIUriFactory.createResourceUri(AAIObjectType.PSERVER, pserverName).depth(Depth.TWO));
+                    AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().pserver(pserverName))
+                            .depth(Depth.TWO));
             if (pserver.isPresent()) {
                 // For each pserver/p-interface match sriov-vfs by pic-id and delete them.
                 pserver.get().getPInterfaces().getPInterface().stream().filter(
@@ -626,15 +763,15 @@ public class HeatBridgeImpl implements HeatBridgeApi {
                             if (pciIds.contains(sriovPf.getPfPciId())) {
                                 logger.debug("creating transaction to delete SR-IOV PF: " + pIf.getInterfaceName()
                                         + " from PServer: " + pserverName);
-                                if (env.getProperty("heatBridgeDryrun", Boolean.class, true)) {
+                                if (env.getProperty("heatBridgeDryrun", Boolean.class, false)) {
                                     logger.debug("Would delete Sriov Pf: {}",
-                                            AAIUriFactory
-                                                    .createResourceUri(AAIObjectType.SRIOV_PF, pserverName,
-                                                            pIf.getInterfaceName(), sriovPf.getPfPciId())
-                                                    .build().toString());
+                                            AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+                                                    .pserver(pserverName).pInterface(pIf.getInterfaceName())
+                                                    .sriovPf(sriovPf.getPfPciId())).build());
                                 } else {
-                                    resourcesClient.delete(AAIUriFactory.createResourceUri(AAIObjectType.SRIOV_PF,
-                                            pserverName, pIf.getInterfaceName(), sriovPf.getPfPciId()));
+                                    resourcesClient.delete(AAIUriFactory.createResourceUri(
+                                            AAIFluentTypeBuilder.cloudInfrastructure().pserver(pserverName)
+                                                    .pInterface(pIf.getInterfaceName()).sriovPf(sriovPf.getPfPciId())));
                                 }
                             }
                         }));
@@ -648,12 +785,11 @@ public class HeatBridgeImpl implements HeatBridgeApi {
             AAIResultWrapper vserverWrapper = resourcesClient.get(vserverUri.depth(Depth.TWO));
             Optional<Relationships> vserverRelationships = vserverWrapper.getRelationships();
             if (vserverRelationships.isPresent()
-                    && CollectionUtils.isNotEmpty(vserverRelationships.get().getRelatedLinks(AAIObjectType.PSERVER))) {
+                    && CollectionUtils.isNotEmpty(vserverRelationships.get().getRelatedLinks(Types.PSERVER))) {
                 Vserver vserver = vserverWrapper.asBean(Vserver.class).get();
                 List<String> pciIds = HeatBridgeUtils.extractPciIdsFromVServer(vserver);
                 if (CollectionUtils.isNotEmpty(pciIds)) {
-                    List<AAIResourceUri> matchingPservers =
-                            vserverRelationships.get().getRelatedUris(AAIObjectType.PSERVER);
+                    List<AAIResourceUri> matchingPservers = vserverRelationships.get().getRelatedUris(Types.PSERVER);
                     if (matchingPservers != null && matchingPservers.size() == 1) {
                         pserverToPciIdMap.put(matchingPservers.get(0).getURIKeys().get("hostname"), pciIds);
                     }
@@ -667,4 +803,28 @@ public class HeatBridgeImpl implements HeatBridgeApi {
         Map<Object, Boolean> map = new ConcurrentHashMap<>();
         return t -> map.putIfAbsent(keyExtractor.apply(t), Boolean.TRUE) == null;
     }
+
+    protected Optional<String> findLinkedURI(String jsonResultsString) {
+        Results<Map<String, String>> results;
+        try {
+            results = mapper.readValue(jsonResultsString, new TypeReference<Results<Map<String, String>>>() {});
+            if (results.getResult().size() == 1) {
+                return Optional.of(results.getResult().get(0).get(RESOURCE_LINK));
+            } else if (results.getResult().isEmpty()) {
+                return Optional.empty();
+            } else {
+                throw new IllegalStateException("more than one result returned");
+            }
+        } catch (IOException e) {
+            logger.error("Error retrieving URI from Results JSON", e);
+            return Optional.empty();
+        }
+    }
+
+    protected AAIDSLQueryClient getAAIDSLClient() {
+        if (aaiDSLClient == null) {
+            aaiDSLClient = new AAIDSLQueryClient();
+        }
+        return aaiDSLClient;
+    }
 }
index 7d4e92d..c1a97ce 100644 (file)
@@ -50,9 +50,9 @@ import org.onap.aai.domain.yang.RelationshipData;
 import org.onap.aai.domain.yang.RelationshipList;
 import org.onap.aai.domain.yang.SriovVf;
 import org.onap.aai.domain.yang.Vserver;
-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;
 import org.onap.so.heatbridge.constants.HeatBridgeConstants;
 import org.openstack4j.model.compute.Server;
 import org.openstack4j.model.network.Network;
@@ -82,39 +82,39 @@ public class AaiHelper {
 
         // vserver to pserver relationship
         if (!StringUtils.isEmpty(server.getHypervisorHostname())) {
-            Relationship pserverRelationship = buildRelationship(
-                    AAIUriFactory.createResourceUri(AAIObjectType.PSERVER, server.getHypervisorHostname()));
+            Relationship pserverRelationship = buildRelationship(AAIUriFactory.createResourceUri(
+                    AAIFluentTypeBuilder.cloudInfrastructure().pserver(server.getHypervisorHostname())));
             relationships.add(pserverRelationship);
         }
 
         // vserver to generic-vnf relationship
-        Relationship genericVnfRelationship =
-                buildRelationship(AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, genericVnfId));
+        Relationship genericVnfRelationship = buildRelationship(
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(genericVnfId)));
         relationships.add(genericVnfRelationship);
 
         // vserver to vnfc relationship
         if (!StringUtils.isEmpty(server.getName())) {
-            Relationship vnfcRelationship =
-                    buildRelationship(AAIUriFactory.createResourceUri(AAIObjectType.VNFC, server.getName()));
+            Relationship vnfcRelationship = buildRelationship(
+                    AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().vnfc(server.getName())));
             relationships.add(vnfcRelationship);
         }
 
         // vserver to vf-module relationship
-        Relationship vfModuleRelationship =
-                buildRelationship(AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, genericVnfId, vfModuleId));
+        Relationship vfModuleRelationship = buildRelationship(AAIUriFactory
+                .createResourceUri(AAIFluentTypeBuilder.network().genericVnf(genericVnfId).vfModule(vfModuleId)));
         relationships.add(vfModuleRelationship);
 
         // vserver to image relationship
         if (server.getImage() != null) {
-            Relationship imageRel = buildRelationship(AAIUriFactory.createResourceUri(AAIObjectType.IMAGE, cloudOwner,
-                    cloudRegionId, server.getImage().getId()));
+            Relationship imageRel = buildRelationship(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder
+                    .cloudInfrastructure().cloudRegion(cloudOwner, cloudRegionId).image(server.getImage().getId())));
             relationships.add(imageRel);
         }
 
         // vserver to flavor relationship
         if (server.getFlavor() != null) {
-            Relationship flavorRel = buildRelationship(AAIUriFactory.createResourceUri(AAIObjectType.FLAVOR, cloudOwner,
-                    cloudRegionId, server.getFlavor().getId()));
+            Relationship flavorRel = buildRelationship(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder
+                    .cloudInfrastructure().cloudRegion(cloudOwner, cloudRegionId).flavor(server.getFlavor().getId())));
             relationships.add(flavorRel);
         }
 
@@ -127,20 +127,21 @@ public class AaiHelper {
         List<Relationship> relationships = relationshipList.getRelationship();
 
         // sriov-vf to sriov-pf relationship
-        Relationship sriovPfRelationship = buildRelationship(
-                AAIUriFactory.createResourceUri(AAIObjectType.SRIOV_PF, pserverName, pIfName, pfPciId));
+        Relationship sriovPfRelationship = buildRelationship(AAIUriFactory.createResourceUri(
+                AAIFluentTypeBuilder.cloudInfrastructure().pserver(pserverName).pInterface(pIfName).sriovPf(pfPciId)));
         relationships.add(sriovPfRelationship);
 
         return relationshipList;
     }
 
     public Relationship getRelationshipToVfModule(String vnfId, String vfModuleId) {
-        return buildRelationship(AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId));
+        return buildRelationship(
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId).vfModule(vfModuleId)));
     }
 
     public Relationship getRelationshipToTenant(String cloudOwner, String cloudRegionId, String tenantId) {
-        return buildRelationship(
-                AAIUriFactory.createResourceUri(AAIObjectType.TENANT, cloudOwner, cloudRegionId, tenantId));
+        return buildRelationship(AAIUriFactory.createResourceUri(
+                AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(cloudOwner, cloudRegionId).tenant(tenantId)));
     }
 
     public org.onap.aai.domain.yang.Subnet buildSubnet(Subnet subnet) {
@@ -252,6 +253,9 @@ public class AaiHelper {
                     .filter(link -> link.getRel().equals(HeatBridgeConstants.OS_RESOURCES_SELF_LINK_KEY)).findFirst()
                     .ifPresent(link -> aaiImage.setImageSelflink(link.getHref()));
         }
+        if (aaiImage.getImageSelflink() == null || aaiImage.getImageSelflink().isEmpty()) {
+            aaiImage.setImageSelflink("NA");
+        }
         return aaiImage;
     }
 
index 76bc8d2..9d5a4c6 100644 (file)
@@ -17,10 +17,10 @@ import org.mockito.Mockito;
 import org.mockito.Spy;
 import org.mockito.junit.MockitoJUnitRunner;
 import org.onap.aai.domain.yang.CloudRegion;
-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.so.db.catalog.beans.CloudSite;
 import org.onap.so.db.catalog.client.CatalogDbClient;
 import org.onap.so.db.catalog.data.repository.NetworkTechnologyReferenceRepository;
@@ -94,7 +94,8 @@ public class CloudRegionRestImplTest {
     public void createCloudRegionTest() {
         when(catalogDbClientMock.getCloudSite("region1")).thenReturn(null);
         when(catalogDbClientMock.postCloudSite(cloudSite)).thenReturn(cloudSite);
-        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, "bob", "region1");
+        AAIResourceUri uri = AAIUriFactory
+                .createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion("bob", "region1"));
         cloudRestImpl.createCloudRegion(cloudSite);
         ArgumentCaptor<AAIResourceUri> actualURI = ArgumentCaptor.forClass(AAIResourceUri.class);
         ArgumentCaptor<Optional<Object>> actualCloudRegion = ArgumentCaptor.forClass(Optional.class);
index e70b56d..2e496c5 100644 (file)
@@ -41,12 +41,12 @@ import org.onap.aai.domain.yang.LInterfaces;
 import org.onap.aai.domain.yang.VfModule;
 import org.onap.aai.domain.yang.VfModules;
 import org.onap.aai.domain.yang.Vserver;
-import org.onap.aaiclient.client.aai.AAIObjectPlurals;
 import org.onap.aaiclient.client.aai.AAIObjectType;
 import org.onap.aaiclient.client.aai.AAIResourcesClient;
 import org.onap.aaiclient.client.aai.entities.AAIResultWrapper;
 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.so.objects.audit.AAIObjectAudit;
 import org.onap.so.objects.audit.AAIObjectAuditList;
 import org.skyscreamer.jsonassert.JSONAssert;
@@ -70,35 +70,43 @@ public class AuditVServerTest extends AuditVServer {
     private String cloudRegion = "cloudRegion";
     private String tenantId = "tenantId";
 
-    private AAIResourceUri vserverURI = AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, cloudOwner, cloudRegion,
-            tenantId, "3a4c2ca5-27b3-4ecc-98c5-06804867c4db");
+    private AAIResourceUri vserverURI = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+            .cloudRegion(cloudOwner, cloudRegion).tenant(tenantId).vserver("3a4c2ca5-27b3-4ecc-98c5-06804867c4db"));
 
-    private AAIResourceUri vserverURI2 = AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, cloudOwner, cloudRegion,
-            tenantId, "3a4c2ca5-27b3-4ecc-98c5-06804867c4dz");
+    private AAIResourceUri vserverURI2 = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+            .cloudRegion(cloudOwner, cloudRegion).tenant(tenantId).vserver("3a4c2ca5-27b3-4ecc-98c5-06804867c4dz"));
 
-    private AAIResourceUri ssc_1_trusted_port_0_uri = AAIUriFactory.createResourceUri(AAIObjectType.L_INTERFACE,
-            cloudOwner, cloudRegion, tenantId, "3a4c2ca5-27b3-4ecc-98c5-06804867c4db", "ssc_1_trusted_port_0");
+    private AAIResourceUri ssc_1_trusted_port_0_uri = AAIUriFactory.createResourceUri(
+            AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(cloudOwner, cloudRegion).tenant(tenantId)
+                    .vserver("3a4c2ca5-27b3-4ecc-98c5-06804867c4db").lInterface("ssc_1_trusted_port_0"));
 
-    private AAIResourceUri ssc_1_service1_port_0_uri = AAIUriFactory.createResourceUri(AAIObjectType.L_INTERFACE,
-            cloudOwner, cloudRegion, tenantId, "3a4c2ca5-27b3-4ecc-98c5-06804867c4db", "ssc_1_service1_port_0");
+    private AAIResourceUri ssc_1_service1_port_0_uri = AAIUriFactory.createResourceUri(
+            AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(cloudOwner, cloudRegion).tenant(tenantId)
+                    .vserver("3a4c2ca5-27b3-4ecc-98c5-06804867c4db").lInterface("ssc_1_service1_port_0"));
 
-    private AAIResourceUri ssc_1_mgmt_port_1_uri = AAIUriFactory.createResourceUri(AAIObjectType.L_INTERFACE,
-            cloudOwner, cloudRegion, tenantId, "3a4c2ca5-27b3-4ecc-98c5-06804867c4db", "ssc_1_mgmt_port_1");
+    private AAIResourceUri ssc_1_mgmt_port_1_uri = AAIUriFactory
+            .createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(cloudOwner, cloudRegion)
+                    .tenant(tenantId).vserver("3a4c2ca5-27b3-4ecc-98c5-06804867c4db").lInterface("ssc_1_mgmt_port_1"));
 
-    private AAIResourceUri ssc_1_mgmt_port_0_uri = AAIUriFactory.createResourceUri(AAIObjectType.L_INTERFACE,
-            cloudOwner, cloudRegion, tenantId, "3a4c2ca5-27b3-4ecc-98c5-06804867c4db", "ssc_1_mgmt_port_0");
+    private AAIResourceUri ssc_1_mgmt_port_0_uri = AAIUriFactory
+            .createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(cloudOwner, cloudRegion)
+                    .tenant(tenantId).vserver("3a4c2ca5-27b3-4ecc-98c5-06804867c4db").lInterface("ssc_1_mgmt_port_0"));
 
-    private AAIResourceUri ssc_1_service2_port_0_uri = AAIUriFactory.createResourceUri(AAIObjectType.L_INTERFACE,
-            cloudOwner, cloudRegion, tenantId, "3a4c2ca5-27b3-4ecc-98c5-06804867c4db", "ssc_1_service2_port_0");
+    private AAIResourceUri ssc_1_service2_port_0_uri = AAIUriFactory.createResourceUri(
+            AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(cloudOwner, cloudRegion).tenant(tenantId)
+                    .vserver("3a4c2ca5-27b3-4ecc-98c5-06804867c4db").lInterface("ssc_1_service2_port_0"));
 
-    private AAIResourceUri ssc_1_int_ha_port_0_uri = AAIUriFactory.createResourceUri(AAIObjectType.L_INTERFACE,
-            cloudOwner, cloudRegion, tenantId, "3a4c2ca5-27b3-4ecc-98c5-06804867c4db", "ssc_1_int_ha_port_0");
+    private AAIResourceUri ssc_1_int_ha_port_0_uri = AAIUriFactory.createResourceUri(
+            AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(cloudOwner, cloudRegion).tenant(tenantId)
+                    .vserver("3a4c2ca5-27b3-4ecc-98c5-06804867c4db").lInterface("ssc_1_int_ha_port_0"));
 
-    private AAIResourceUri test_port_1_uri = AAIUriFactory.createResourceUri(AAIObjectType.L_INTERFACE, cloudOwner,
-            cloudRegion, tenantId, "3a4c2ca5-27b3-4ecc-98c5-06804867c4dz", "test_port_1");
+    private AAIResourceUri test_port_1_uri = AAIUriFactory
+            .createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(cloudOwner, cloudRegion)
+                    .tenant(tenantId).vserver("3a4c2ca5-27b3-4ecc-98c5-06804867c4dz").lInterface("test_port_1"));
 
-    private AAIResourceUri test_port_2_uri = AAIUriFactory.createResourceUri(AAIObjectType.L_INTERFACE, cloudOwner,
-            cloudRegion, tenantId, "3a4c2ca5-27b3-4ecc-98c5-06804867c4dz", "test_port_2");
+    private AAIResourceUri test_port_2_uri = AAIUriFactory
+            .createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(cloudOwner, cloudRegion)
+                    .tenant(tenantId).vserver("3a4c2ca5-27b3-4ecc-98c5-06804867c4dz").lInterface("test_port_2"));
 
     private AAIResourceUri service2_sub_1_uri =
             AAIUriFactory.createResourceUri(AAIObjectType.SUB_L_INTERFACE, cloudOwner, cloudRegion, tenantId,
@@ -368,17 +376,20 @@ public class AuditVServerTest extends AuditVServer {
         Vserver vserver = new Vserver();
         vserver.setVserverId("testVserverId");
         obj1.setAaiObject(vserver);
-        obj1.setResourceURI(AAIUriFactory
-                .createResourceUri(AAIObjectType.VSERVER, cloudOwner, cloudRegion, tenantId, "testVserverId").build());
+        obj1.setResourceURI(
+                AAIUriFactory
+                        .createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+                                .cloudRegion(cloudOwner, cloudRegion).tenant(tenantId).vserver("testVserverId"))
+                        .build());
         auditList.getAuditList().add(obj1);
 
-        doReturn(false).when(aaiResourcesMock).exists(AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, cloudOwner,
-                cloudRegion, tenantId, "testVserverId"));
+        doReturn(false).when(aaiResourcesMock).exists(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder
+                .cloudInfrastructure().cloudRegion(cloudOwner, cloudRegion).tenant(tenantId).vserver("testVserverId")));
 
         auditNova.auditVservers(auditList);
 
-        Mockito.verify(aaiResourcesMock).exists(AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, cloudOwner,
-                cloudRegion, tenantId, "testVserverId"));
+        Mockito.verify(aaiResourcesMock).exists(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder
+                .cloudInfrastructure().cloudRegion(cloudOwner, cloudRegion).tenant(tenantId).vserver("testVserverId")));
 
         Assert.assertEquals(false, auditList.getAuditList().get(0).isDoesObjectExist());
     }
@@ -392,8 +403,8 @@ public class AuditVServerTest extends AuditVServer {
         AAIResultWrapper wrapper = new AAIResultWrapper(vfModule);
 
         doReturn(Optional.of(wrapper)).when(aaiResourcesMock).getFirstWrapper(VfModules.class, VfModule.class,
-                AAIUriFactory.createResourceUri(AAIObjectPlurals.VF_MODULE, "genericVnfId").queryParam("vf-module-name",
-                        "vfModuleName"));
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("genericVnfId").vfModules())
+                        .queryParam("vf-module-name", "vfModuleName"));
 
         Optional<AAIObjectAuditList> auditList =
                 auditNova.auditVserversThroughRelationships("genericVnfId", "vfModuleName");
@@ -410,11 +421,12 @@ public class AuditVServerTest extends AuditVServer {
         AAIResultWrapper vserverWrapper = new AAIResultWrapper(new Vserver());
 
         doReturn(Optional.of(wrapper)).when(aaiResourcesMock).getFirstWrapper(VfModules.class, VfModule.class,
-                AAIUriFactory.createResourceUri(AAIObjectPlurals.VF_MODULE, "genericVnfId").queryParam("vf-module-name",
-                        "vfModuleName"));
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("genericVnfId").vfModules())
+                        .queryParam("vf-module-name", "vfModuleName"));
 
-        doReturn(vserverWrapper).when(aaiResourcesMock).get(AAIUriFactory.createResourceUri(AAIObjectType.VSERVER,
-                "cloud-owner", "cloud-region-id", "tenant-id", "VUSCHGA1"));
+        doReturn(vserverWrapper).when(aaiResourcesMock)
+                .get(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+                        .cloudRegion("cloud-owner", "cloud-region-id").tenant("tenant-id").vserver("VUSCHGA1")));
 
         Optional<AAIObjectAuditList> auditList =
                 auditNova.auditVserversThroughRelationships("genericVnfId", "vfModuleName");
index 18348f1..110faaf 100644 (file)
@@ -45,7 +45,6 @@ import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
-import static org.mockito.Mockito.doReturn;
 import java.io.File;
 import java.io.IOException;
 import java.nio.charset.Charset;
@@ -66,20 +65,19 @@ 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;
 import org.onap.aai.domain.yang.PInterface;
 import org.onap.aai.domain.yang.SriovPf;
-import org.onap.aaiclient.client.aai.AAIObjectType;
+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.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.GraphInventoryCommonObjectMapperProvider;
 import org.onap.aaiclient.client.graphinventory.exceptions.BulkProcessFailed;
+import org.onap.so.cloud.resource.beans.NodeType;
 import org.onap.so.db.catalog.beans.CloudIdentity;
 import org.onap.so.heatbridge.constants.HeatBridgeConstants;
 import org.onap.so.heatbridge.helpers.AaiHelper;
@@ -103,10 +101,9 @@ import com.fasterxml.jackson.core.JsonParseException;
 import com.fasterxml.jackson.databind.JsonMappingException;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.google.common.collect.ImmutableMap;
-import inet.ipaddr.IPAddressString;
 
 
-@RunWith(MockitoJUnitRunner.class)
+@RunWith(MockitoJUnitRunner.Silent.class)
 public class HeatBridgeImplTest {
 
     private static final String CLOUD_OWNER = "CloudOwner";
@@ -125,34 +122,25 @@ public class HeatBridgeImplTest {
     @Mock
     private AAISingleTransactionClient transaction;
 
+    @Mock
+    private AAIDSLQueryClient mockDSLClient;
+
     @Mock
     private Environment env;
 
+    @Mock
+    private Server server;
+
     @InjectMocks
-    private HeatBridgeImpl heatbridge =
-            new HeatBridgeImpl(resourcesClient, cloudIdentity, CLOUD_OWNER, REGION_ID, REGION_ID, TENANT_ID);
+    private HeatBridgeImpl heatbridge = new HeatBridgeImpl(resourcesClient, cloudIdentity, CLOUD_OWNER, REGION_ID,
+            REGION_ID, TENANT_ID, NodeType.GREENFIELD);
 
     @Before
     public void setUp() throws HeatBridgeException, OpenstackClientException, BulkProcessFailed {
         when(resourcesClient.beginSingleTransaction()).thenReturn(transaction);
     }
 
-    @Ignore
-    @Test
-    public void testQueryNestedHeatStackResources() throws HeatBridgeException {
-        // Arrange
-        String heatStackId = "1234567";
-        List<Resource> expectedResourceList = (List<Resource>) extractTestStackResources();
-        when(osClient.getStackBasedResources(heatStackId, HeatBridgeConstants.OS_DEFAULT_HEAT_NESTING))
-                .thenReturn(expectedResourceList);
-
-        // Act
-        List<Resource> resourceList = heatbridge.queryNestedHeatStackResources(heatStackId);
 
-        // Assert
-        verify(osClient).getStackBasedResources(heatStackId, HeatBridgeConstants.OS_DEFAULT_HEAT_NESTING);
-        assertEquals(resourceList, expectedResourceList);
-    }
 
     @Test
     public void testExtractStackResourceIdsByResourceType() throws HeatBridgeException {
@@ -169,73 +157,6 @@ public class HeatBridgeImplTest {
         assertEquals(expectedServerIds, serverIds);
     }
 
-    @Ignore
-    @Test
-    public void testGetAllOpenstackServers() {
-        // Arrange
-        List<Resource> stackResources = (List<Resource>) extractTestStackResources();
-
-        Server server1 = mock(Server.class);
-        Server server2 = mock(Server.class);
-        List<Server> expectedServers = Arrays.asList(server1, server2);
-
-        when(osClient.getServerById("43c2159b-2c04-46ac-bda5-594110cae2d3")).thenReturn(server1);
-        when(osClient.getServerById("7cff109a-b2b7-4933-97b4-ec44a8365568")).thenReturn(server2);
-
-        // Act
-        List<Server> servers = heatbridge.getAllOpenstackServers(stackResources);
-
-        // Assert
-        assertEquals(expectedServers, servers);
-    }
-
-    @Ignore
-    @Test
-    public void testExtractOpenstackImagesFromServers() {
-        // Arrange
-        Server server1 = mock(Server.class);
-        Server server2 = mock(Server.class);
-        List<Server> servers = Arrays.asList(server1, server2);
-
-        Image image1 = mock(Image.class);
-        Image image2 = mock(Image.class);
-        when(image1.getId()).thenReturn("1");
-        when(image2.getId()).thenReturn("1");
-        List<Image> expectedDistinctImages = Collections.singletonList(image1);
-
-        when(server1.getImage()).thenReturn(image1);
-        when(server2.getImage()).thenReturn(image2);
-
-        // Act
-        List<Image> images = heatbridge.extractOpenstackImagesFromServers(servers);
-
-        // Assert
-        assertEquals(expectedDistinctImages, images);
-    }
-
-    @Ignore
-    @Test
-    public void testExtractOpenstackFlavorsFromServers() {
-        // Arrange
-        Server server1 = mock(Server.class);
-        Server server2 = mock(Server.class);
-        List<Server> servers = Arrays.asList(server1, server2);
-
-        Flavor flavor1 = mock(Flavor.class);
-        Flavor flavor2 = mock(Flavor.class);
-        when(flavor1.getId()).thenReturn("1");
-        when(flavor2.getId()).thenReturn("2");
-        List<Flavor> expectedFlavors = Arrays.asList(flavor1, flavor2);
-
-        when(server1.getFlavor()).thenReturn(flavor1);
-        when(server2.getFlavor()).thenReturn(flavor2);
-
-        // Act
-        List<Flavor> flavors = heatbridge.extractOpenstackFlavorsFromServers(servers);
-
-        // Assert
-        assertEquals(expectedFlavors, flavors);
-    }
 
     @Test
     public void testUpdateVserversToAai() throws HeatBridgeException {
@@ -276,10 +197,10 @@ public class HeatBridgeImplTest {
         verify(transaction, times(2)).createIfNotExists(captor.capture(), any(Optional.class));
 
         List<AAIResourceUri> uris = captor.getAllValues();
-        assertEquals(AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, CLOUD_OWNER, REGION_ID, TENANT_ID,
-                server1.getId()), uris.get(0));
-        assertEquals(AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, CLOUD_OWNER, REGION_ID, TENANT_ID,
-                server2.getId()), uris.get(1));
+        assertEquals(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+                .cloudRegion(CLOUD_OWNER, REGION_ID).tenant(TENANT_ID).vserver(server1.getId())), uris.get(0));
+        assertEquals(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+                .cloudRegion(CLOUD_OWNER, REGION_ID).tenant(TENANT_ID).vserver(server2.getId())), uris.get(1));
 
     }
 
@@ -320,10 +241,10 @@ public class HeatBridgeImplTest {
         verify(transaction, times(2)).createIfNotExists(captor.capture(), any(Optional.class));
 
         List<AAIResourceUri> uris = captor.getAllValues();
-        assertEquals(AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, CLOUD_OWNER, REGION_ID, TENANT_ID,
-                server1.getId()), uris.get(0));
-        assertEquals(AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, CLOUD_OWNER, REGION_ID, TENANT_ID,
-                server2.getId()), uris.get(1));
+        assertEquals(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+                .cloudRegion(CLOUD_OWNER, REGION_ID).tenant(TENANT_ID).vserver(server1.getId())), uris.get(0));
+        assertEquals(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+                .cloudRegion(CLOUD_OWNER, REGION_ID).tenant(TENANT_ID).vserver(server2.getId())), uris.get(1));
     }
 
     @Test
@@ -428,6 +349,9 @@ public class HeatBridgeImplTest {
         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");
+
+        when(osClient.getServerById("test-device-id")).thenReturn(server);
+        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"));
@@ -448,6 +372,7 @@ public class HeatBridgeImplTest {
         when(network.getId()).thenReturn("test-network-id");
         when(network.getNetworkType()).thenReturn(NetworkType.VLAN);
         when(network.getProviderSegID()).thenReturn("2345");
+        when(network.getProviderPhyNet()).thenReturn("ovsnet");
 
         when(osClient.getPortById("212a203a-9764-4f42-84ea-731536a8f13a")).thenReturn(port);
         when(osClient.getPortById("387e3904-8948-43d1-8635-b6c2042b54da")).thenReturn(port);
index 61c0cdb..44ea2a2 100644 (file)
@@ -971,8 +971,10 @@ public class ASDCController {
     private void processNsstNotification(INotificationData iNotif, ToscaResourceStructure toscaResourceStructure) {
         Metadata serviceMetadata = toscaResourceStructure.getServiceMetadata();
         try {
-            if (serviceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_CATEGORY).equalsIgnoreCase("NSST")) {
-
+            String category = serviceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_CATEGORY);
+            boolean isNeedInital = (category.contains("NSST") || category.equalsIgnoreCase("TN Network Requirement"))
+                    && iNotif.getResources().isEmpty();
+            if (isNeedInital) {
                 String artifactContent = null;
                 List<IArtifactInfo> serviceArtifacts = iNotif.getServiceArtifacts();
                 Optional<IArtifactInfo> artifactOpt = serviceArtifacts.stream()
@@ -986,14 +988,18 @@ public class ASDCController {
                     artifactContent = zipParserInstance.parseJsonForZip(filePath);
                     logger.debug(
                             "serviceArtifact parsing success! serviceArtifactUUID: " + artifactInfo.getArtifactUUID());
+
+                    ResourceStructure resourceStructure = new VfResourceStructure(iNotif, new ResourceInstance());
+                    resourceStructure.setResourceType(ResourceType.OTHER);
+                    toscaInstaller.installNsstService(toscaResourceStructure, (VfResourceStructure) resourceStructure,
+                            artifactContent);
                 } else {
                     logger.debug("serviceArtifact is null");
+                    toscaInstaller.installNsstService(toscaResourceStructure, null, null);
                 }
-                ResourceStructure resourceStructure = new VfResourceStructure(iNotif, new ResourceInstance());
-                resourceStructure.setResourceType(ResourceType.OTHER);
-                toscaInstaller.installTheNsstService(toscaResourceStructure, (VfResourceStructure) resourceStructure,
-                        artifactContent);
+
             }
+
         } catch (IOException e) {
             logger.error("serviceArtifact parse failure for service uuid:  "
                     + serviceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_CATEGORY));
index d023df3..49fef1d 100644 (file)
@@ -2870,7 +2870,15 @@ public class ToscaResourceInstaller {
         List<Input> serviceInputs = sdcCsarHelper.getServiceInputs();
         if (!serviceInputs.isEmpty()) {
             serviceInputList = new ArrayList<>();
-            serviceInputs.forEach(input -> {
+            List<Input> filterList;
+            filterList = serviceInputs.stream()
+                    .filter(input -> !SKIP_POST_INST_CONF.equals(input.getName())
+                            && !CDS_MODEL_NAME.equalsIgnoreCase(input.getName())
+                            && !CDS_MODEL_VERSION.equalsIgnoreCase(input.getName())
+                            && !CONTROLLER_ACTOR.equalsIgnoreCase(input.getName()))
+                    .collect(Collectors.toList());
+
+            filterList.forEach(input -> {
                 Map<String, Object> serviceInputMap = new HashMap<>();
                 serviceInputMap.put("name", input.getName());
                 serviceInputMap.put("type", input.getType());
@@ -2894,7 +2902,7 @@ public class ToscaResourceInstaller {
     }
 
     @Transactional(rollbackFor = {ArtifactInstallerException.class})
-    public void installTheNsstService(ToscaResourceStructure toscaResourceStruct, VfResourceStructure vfResourceStruct,
+    public void installNsstService(ToscaResourceStructure toscaResourceStruct, VfResourceStructure vfResourceStruct,
             String artifactContent) {
         createToscaCsar(toscaResourceStruct);
         createService(toscaResourceStruct, vfResourceStruct);
@@ -2925,6 +2933,10 @@ public class ToscaResourceInstaller {
     }
 
     private void createServiceInfo(ToscaResourceStructure toscaResourceStruct, Service service) {
+        if (!service.getServiceInfos().isEmpty()) {
+            return;
+        }
+
         List<ServiceInfo> serviceInfos = new ArrayList<>();
 
         ServiceInfo serviceInfo = new ServiceInfo();
@@ -2945,42 +2957,67 @@ public class ToscaResourceInstaller {
         ISdcCsarHelper helper = toscaResourceStruct.getSdcCsarHelper();
         String typeName = helper.getServiceSubstitutionMappingsTypeName();
         Optional<NodeTemplate> nodeTemplate = helper.getServiceNodeTemplates().stream().findAny();
-        List<Object> serviceProperties = new ArrayList<>();
-        Map<String, Object> servicePropertiesMap;
+
         if (nodeTemplate.isPresent()) {
+            String serviceUUID = nodeTemplate.get().getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID);
             LinkedHashMap<String, Object> customDef = nodeTemplate.get().getCustomDef();
-            Optional<String> machKey =
-                    customDef.keySet().stream().filter(key -> key.equalsIgnoreCase(typeName)).findFirst();
-            if (machKey.isPresent()) {
-                Object obj = customDef.get(machKey.get());
-                try {
-                    if (obj instanceof Map) {
-                        Object properties = ((HashMap) obj).get("properties");
-                        if (null != properties) {
-                            for (Object propertyName : ((Map) properties).keySet()) {
-                                servicePropertiesMap = new HashMap<>();
-                                servicePropertiesMap.put("name", propertyName);
-                                Object object = ((Map) properties).get(propertyName);
-                                for (Object entry : ((Map) object).entrySet()) {
-                                    servicePropertiesMap.put((String) ((Map.Entry) entry).getKey(),
-                                            ((Map.Entry) entry).getValue());
-                                }
-                                servicePropertiesMap.remove("description");
-                                serviceProperties.add(servicePropertiesMap);
+            List<Object> serviceProperties = getPropertiesFromCustomDef(customDef, typeName);
+
+            try {
+                propertiesJson = objectMapper.writeValueAsString(serviceProperties);
+                propertiesJson = propertiesJson.replace("\"", "\\\"");
+            } catch (JsonProcessingException e) {
+                logger.error("serviceProperties could not be deserialized for service uuid:  " + serviceUUID);
+            } catch (Exception ex) {
+                logger.error("service properties parsing failed. service uuid:" + serviceUUID);
+            }
+
+        } else {
+            logger.debug("ServiceNodeTemplates is null");
+        }
+        return propertiesJson;
+    }
+
+    private static List<Object> getPropertiesFromCustomDef(LinkedHashMap<String, Object> customDef,
+            final String typeName) {
+        Optional<String> machKey =
+                customDef.keySet().stream().filter(key -> key.equalsIgnoreCase(typeName)).findFirst();
+        Map<String, Object> servicePropertiesMap;
+        List<Object> serviceProperties = new ArrayList<>();
+
+        if (machKey.isPresent()) {
+            Object obj = customDef.get(machKey.get());
+            if (obj instanceof Map) {
+                Object properties = ((HashMap) obj).get("properties");
+                if (null != properties) {
+                    for (Object propertyName : ((Map) properties).keySet()) {
+                        if (propertyName.toString().split("_").length >= 2) {
+                            continue;
+                        }
+
+                        servicePropertiesMap = new HashMap<>();
+                        servicePropertiesMap.put("name", propertyName);
+                        Object object = ((Map) properties).get(propertyName);
+                        for (Object entry : ((Map) object).entrySet()) {
+                            servicePropertiesMap.put((String) ((Map.Entry) entry).getKey(),
+                                    ((Map.Entry) entry).getValue());
+                        }
+
+                        String type = servicePropertiesMap.get("type").toString();
+                        if (type.split("\\.").length >= 2) {
+                            List<Object> subProperties = getPropertiesFromCustomDef(customDef, type);
+                            if (subProperties.size() > 0) {
+                                serviceProperties.addAll(subProperties);
                             }
-                            propertiesJson = objectMapper.writeValueAsString(serviceProperties);
-                            propertiesJson = propertiesJson.replace("\"", "\\\"");
+                            continue;
                         }
+                        servicePropertiesMap.remove("description");
+                        serviceProperties.add(servicePropertiesMap);
                     }
-                } catch (JsonProcessingException e) {
-                    logger.error("serviceProperties could not be deserialized for service uuid:  "
-                            + nodeTemplate.get().getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
                 }
             }
-        } else {
-            logger.debug("ServiceNodeTemplates is null");
         }
-        return propertiesJson;
+        return serviceProperties;
     }
 }
 
index 8544267..e081902 100644 (file)
@@ -25,10 +25,10 @@ package org.onap.so.asdc.tenantIsolation;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-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.graphinventory.entities.uri.Depth;
 import org.onap.so.db.catalog.beans.Service;
 import org.onap.so.db.catalog.data.repository.ServiceRepository;
@@ -183,8 +183,8 @@ public class WatchdogDistribution {
 
 
 
-            AAIResourceUri aaiUri = AAIUriFactory.createResourceUri(AAIObjectType.MODEL_VER, serviceModelInvariantUUID,
-                    serviceModelVersionId);
+            AAIResourceUri aaiUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.serviceDesignAndCreation()
+                    .model(serviceModelInvariantUUID).modelVer(serviceModelVersionId));
             aaiUri.depth(Depth.ZERO); // Do not return relationships if any
             logger.debug("Target A&AI Resource URI: {}", aaiUri.build().toString());
 
index d85c387..fe36867 100644 (file)
 
 package org.onap.so.bpmn.common.scripts
 
-import org.onap.so.logger.LoggingAnchor
-import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
-import org.onap.logging.filter.base.ErrorCode
-
 import static org.apache.commons.lang3.StringUtils.isBlank;
-
 import javax.ws.rs.NotFoundException
 import javax.ws.rs.core.UriBuilder
-
 import org.apache.commons.lang.StringUtils
 import org.camunda.bpm.engine.delegate.BpmnError
 import org.camunda.bpm.engine.delegate.DelegateExecution
 import org.onap.aai.domain.yang.AllottedResource
-import org.onap.so.bpmn.core.WorkflowException
-import org.onap.so.client.PreconditionFailedException
 import org.onap.aaiclient.client.aai.AAIObjectType
 import org.onap.aaiclient.client.aai.AAIResourcesClient
+import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
 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.ErrorCode
+import org.onap.so.bpmn.core.WorkflowException
+import org.onap.so.client.PreconditionFailedException
+import org.onap.so.logger.LoggingAnchor
 import org.onap.so.logger.MessageEnum
 import org.slf4j.Logger
 import org.slf4j.LoggerFactory
@@ -115,7 +114,7 @@ class AllottedResourceUtils {
        public boolean ifExistsAR(DelegateExecution execution, String allottedResourceId) {
                logger.trace("ifExistsAR ")
                try {
-                       AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.ALLOTTED_RESOURCE, allottedResourceId)
+                       AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(Types.ALLOTTED_RESOURCE.getFragment(allottedResourceId))
             AAIResultWrapper wrapper = getAAIClient().get(resourceUri)
             Optional<AllottedResource> allottedResource = wrapper.asBean(AllottedResource.class)
             if(allottedResource.isPresent()) {
@@ -150,7 +149,7 @@ class AllottedResourceUtils {
                Optional<AllottedResource> allottedResource = Optional.empty()
                try {
                        logger.debug("GET AR Aai Path is: \n" + link)
-                       AAIResourceUri uri = AAIUriFactory.createResourceFromExistingURI(AAIObjectType.ALLOTTED_RESOURCE, UriBuilder.fromPath(link).build())
+                       AAIResourceUri uri = AAIUriFactory.createResourceFromExistingURI(Types.ALLOTTED_RESOURCE, UriBuilder.fromPath(link).build())
                        allottedResource = getAAIClient().get(AllottedResource.class,uri);
                        if(allottedResource.isPresent()) {
                                if (!isBlank(role)) {
@@ -193,7 +192,7 @@ class AllottedResourceUtils {
                        allottedResource.setOrchestrationStatus(status)
                        logger.debug('AAI AR URI: ' + aaiARPath)
 
-                       AAIResourceUri uri = AAIUriFactory.createResourceFromExistingURI(AAIObjectType.ALLOTTED_RESOURCE, UriBuilder.fromPath(aaiARPath).build())
+                       AAIResourceUri uri = AAIUriFactory.createResourceFromExistingURI(Types.ALLOTTED_RESOURCE, UriBuilder.fromPath(aaiARPath).build())
                        getAAIClient().update(uri,allottedResource)
                }catch(Exception e){
                        logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
@@ -208,7 +207,7 @@ class AllottedResourceUtils {
                logger.trace(" deleteAR - aaiARPath:" + aaiARPath)
                try {
 
-                       AAIResourceUri uri = AAIUriFactory.createResourceFromExistingURI(AAIObjectType.ALLOTTED_RESOURCE, UriBuilder.fromPath(aaiARPath).build())
+                       AAIResourceUri uri = AAIUriFactory.createResourceFromExistingURI(Types.ALLOTTED_RESOURCE, UriBuilder.fromPath(aaiARPath).build())
                        getAAIClient().delete(uri);
                }catch(NotFoundException ex){
                        logger.debug("  Delete AR Received a Not Found (404) Response")
index c5a0e46..2f09ca2 100644 (file)
@@ -29,6 +29,8 @@ import org.onap.aai.domain.yang.VolumeGroup
 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
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types
 import org.onap.so.constants.Defaults
 import org.onap.logging.filter.base.ErrorCode
 import org.onap.so.logger.LoggingAnchor
@@ -74,7 +76,7 @@ public class ConfirmVolumeGroupName extends AbstractServiceTaskProcessor{
         execution.setVariable("CVGN_volumeGroupName", volumeGroupName)
         execution.setVariable("CVGN_aicCloudRegion", aicCloudRegion)
 
-        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, Defaults.CLOUD_OWNER.toString(), aicCloudRegion, volumeGroupId)
+        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(Defaults.CLOUD_OWNER.toString(), aicCloudRegion).volumeGroup(volumeGroupId))
         execution.setVariable("CVGN_volumeGroupGetEndpoint", uri)
     }
 
index f5cf541..fce9286 100644 (file)
@@ -31,6 +31,7 @@ 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.ErrorCode
 import org.onap.so.constants.Defaults
 import org.onap.so.logger.LoggingAnchor
@@ -62,7 +63,7 @@ class ConfirmVolumeGroupTenant extends AbstractServiceTaskProcessor{
                        String incomingGroupName = execution.getVariable("volumeGroupName")
                        String incomingTenantId = execution.getVariable("tenantId")
                        String aicCloudRegion = execution.getVariable("aicCloudRegion")
-                       AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, Defaults.CLOUD_OWNER.toString(), aicCloudRegion, volumeGroupId)
+                       AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(Defaults.CLOUD_OWNER.toString(), aicCloudRegion).volumeGroup(volumeGroupId))
                        AAIResultWrapper wrapper = getAAIClient().get(uri);
                        Optional<VolumeGroup> volumeGroup = wrapper.asBean(VolumeGroup.class)
                        Optional<Relationships> relationships = wrapper.getRelationships()
@@ -70,7 +71,7 @@ class ConfirmVolumeGroupTenant extends AbstractServiceTaskProcessor{
                                execution.setVariable("queryAAIVolumeGroupResponse", volumeGroup.get())
                                String volumeGroupTenantId = ""
                                if(relationships.isPresent()){
-                                       List<AAIResourceUri> tenantUris = relationships.get().getRelatedAAIUris(AAIObjectType.TENANT)
+                                       List<AAIResourceUri> tenantUris = relationships.get().getRelatedUris(Types.TENANT)
                                        for (AAIResourceUri tenantURI: tenantUris){
                                                        volumeGroupTenantId = tenantURI.getURIKeys().get(AAIFluentTypeBuilder.Types.TENANT.getUriParams().tenantId)
                                        }
index 9758c12..40b9388 100644 (file)
@@ -26,14 +26,13 @@ import org.apache.commons.lang.StringUtils
 import org.camunda.bpm.engine.delegate.DelegateExecution
 import org.onap.aai.domain.yang.GenericVnf
 import org.onap.aai.domain.yang.GenericVnfs
-import org.onap.so.bpmn.core.RollbackData
-import org.onap.aaiclient.client.aai.AAIObjectPlurals
-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
 import org.onap.aaiclient.client.graphinventory.entities.uri.Depth
-import org.onap.so.db.catalog.beans.OrchestrationStatus
 import org.onap.logging.filter.base.ErrorCode
+import org.onap.so.bpmn.core.RollbackData
+import org.onap.so.db.catalog.beans.OrchestrationStatus
 import org.onap.so.logger.LoggingAnchor
 import org.onap.so.logger.MessageEnum
 import org.slf4j.Logger
@@ -154,9 +153,9 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{
                def vnfName = execution.getVariable("CAAIVfMod_vnfName")
         Optional<GenericVnf> genericVnfOp
                if (vnfId == null || vnfId.isEmpty()) {
-                       genericVnfOp = getAAIClient().getFirst(GenericVnfs.class, GenericVnf.class, AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", vnfName).depth(Depth.ONE))
+                       genericVnfOp = getAAIClient().getFirst(GenericVnfs.class, GenericVnf.class, AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnfs()).queryParam("vnf-name", vnfName).depth(Depth.ONE))
                } else {
-                       genericVnfOp = getAAIClient().get(GenericVnf.class,  AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId))
+                       genericVnfOp = getAAIClient().get(GenericVnf.class,  AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)))
                }
                try {
             if(genericVnfOp.isPresent()){
@@ -214,7 +213,7 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{
         genericVnf.setModelVersionId(execution.getVariable("CAAIVfMod_vnfPersonaVer"))
 
                try {
-                       AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, newVnfId)
+                       AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(newVnfId))
             getAAIClient().create(uri,genericVnf)
                        execution.setVariable("CAAIVfMod_createGenericVnfResponseCode", 201)
                        execution.setVariable("CAAIVfMod_createGenericVnfResponse", "Vnf Created")
@@ -266,7 +265,7 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{
 
                try {
 
-                       AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, newModuleId)
+                       AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId).vfModule(newModuleId))
             getAAIClient().create(uri,vfModule)
             def statusCode = 201
                        execution.setVariable("CAAIVfMod_createVfModuleResponseCode", statusCode)
index 8a74307..511cd8d 100644 (file)
@@ -27,6 +27,8 @@ import org.camunda.bpm.engine.delegate.DelegateExecution
 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
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types
 import org.slf4j.Logger
 import org.slf4j.LoggerFactory
 
@@ -111,7 +113,7 @@ public class CreateAAIVfModuleVolumeGroup extends AbstractServiceTaskProcessor {
                        def vnfId = execution.getVariable('CAAIVfModVG_vnfId')
                        def vfModuleId = execution.getVariable('CAAIVfModVG_vfModuleId')
                        try {
-                               AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId);
+                               AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId).vfModule(vfModuleId));
                                Optional<org.onap.aai.domain.yang.VfModule> vfModule = getAAIClient().get(org.onap.aai.domain.yang.VfModule.class, resourceUri)
                                if(vfModule.isPresent()){
                                        execution.setVariable('CAAIVfModVG_getVfModuleResponseCode', 200)
@@ -164,8 +166,8 @@ public class CreateAAIVfModuleVolumeGroup extends AbstractServiceTaskProcessor {
                        def volumeGroupId = execution.getVariable('CAAIVfModVG_volumeGroupId')
 
                        try {
-                               AAIResourceUri vfModuleUri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId,vfModuleId);
-                               AAIResourceUri volumeGroupUri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, cloudOwner, aicCloudRegion,volumeGroupId);
+                               AAIResourceUri vfModuleUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId).vfModule(vfModuleId));
+                               AAIResourceUri volumeGroupUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(cloudOwner, aicCloudRegion).volumeGroup(volumeGroupId));
                                logger.debug("Creating relationship between Vf Module: " + vfModuleUri.build().toString() + " and Volume Group: " + volumeGroupUri.build().toString())
                                getAAIClient().connect(vfModuleUri,volumeGroupUri)
                                execution.setVariable('CAAIVfModVG_updateVfModuleResponseCode', 200)
index 8c6ebef..02d0cd0 100644 (file)
@@ -28,6 +28,8 @@ import org.onap.aai.domain.yang.GenericVnf
 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
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types
 import org.onap.aaiclient.client.graphinventory.entities.uri.Depth
 import org.onap.logging.filter.base.ErrorCode
 import org.onap.so.logger.MessageEnum
@@ -83,7 +85,7 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{
 
                try {
                        AaiUtil aaiUriUtil = new AaiUtil(this)
-                       AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
+                       AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId))
                        uri.depth(Depth.ONE)
             Optional<GenericVnf> genericVnf = getAAIClient().get(GenericVnf.class, uri)
 
@@ -109,7 +111,7 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{
 
                try {
                        String vnfId = execution.getVariable("DAAIVfMod_vnfId")
-                       AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
+                       AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId))
             getAAIClient().delete(uri)
                        execution.setVariable("DAAIVfMod_deleteGenericVnfResponseCode", 200)
                        execution.setVariable("DAAIVfMod_deleteGenericVnfResponse", "Vnf Deleted")
@@ -126,7 +128,7 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{
                        String vnfId = execution.getVariable("DAAIVfMod_vnfId")
                        String vfModuleId = execution.getVariable("DAAIVfMod_vfModuleId")
 
-                       AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId)
+                       AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId).vfModule(vfModuleId))
 
             getAAIClient().delete(uri)
                        execution.setVariable("DAAIVfMod_deleteVfModuleResponseCode", 200)
index ebc5f4a..644cf5e 100644 (file)
@@ -79,7 +79,7 @@ class DoHandleOofRequest extends AbstractServiceTaskProcessor {
                oofRequestPayload.setApiPath(apiPath)
                oofRequestPayload.setRequestDetails(requestDetails)
                ObjectMapper objectMapper = new ObjectMapper()
-               String requestJson = objectMapper.writeValueAsString(oofRequestPayload)
+               String requestJson = objectMapper.writeValueAsString(oofRequestPayload)
                execution.setVariable("oofRequestPayload", requestJson)
        }
        
index 9593aa1..63dd9af 100644 (file)
@@ -41,6 +41,8 @@ import org.onap.so.client.HttpClient
 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
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types
 import org.onap.aaiclient.client.graphinventory.entities.uri.Depth
 import org.onap.logging.filter.base.ONAPComponents;
 import org.onap.so.logger.MessageEnum
@@ -85,7 +87,7 @@ public class GenerateVfModuleName extends AbstractServiceTaskProcessor{
                        def personaModelId = execution.getVariable('personaModelId')
 
                        AaiUtil aaiUtil = new AaiUtil(this)
-                       AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
+                       AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId))
                        uri.depth(Depth.ONE)
                        String endPoint = aaiUtil.createAaiUri(uri)
 
index 2c96e7d..44188b4 100644 (file)
 
 package org.onap.so.bpmn.common.scripts
 
+import org.onap.so.beans.nsmf.oof.NsiReqBody
+import org.onap.so.beans.nsmf.oof.RequestInfo
+import org.onap.so.beans.nsmf.oof.SubnetCapability
+import org.onap.so.beans.nsmf.oof.TemplateInfo
+
 import static org.onap.so.bpmn.common.scripts.GenericUtils.*
 
 import javax.ws.rs.core.UriBuilder
@@ -42,6 +47,7 @@ import org.onap.so.db.catalog.beans.CloudSite
 import org.onap.so.db.catalog.beans.HomingInstance
 import org.slf4j.Logger
 import org.slf4j.LoggerFactory
+import com.google.gson.JsonObject
 
 import com.fasterxml.jackson.databind.ObjectMapper
 
@@ -571,5 +577,113 @@ class OofUtils {
         response.append("\n  }\n")
         return response.toString()
     }
+/**
+* Method to create select NSSI request
+* @param requestId - mso-request-id
+* @param messageType - Message type for callback correlation
+* @param UUID - UUID of NSST
+* @param invariantUUID - Invariant UUID of NSST
+* @param name - name of the NSST model
+* @param profileInfo - A JSON object containing slice profile parameters
+* @return
+*/
+public String buildSelectNSSIRequest(String requestId, String messageType, String UUID,String invariantUUID,
+String name, Map<String, Object> profileInfo){
+
+def transactionId = requestId
+logger.debug( "transactionId is: " + transactionId)
+String correlator = requestId
+String callbackUrl = UrnPropertiesReader.getVariable("mso.adapters.oof.callback.endpoint") + "/" + messageType + "/" + correlator
+ObjectMapper objectMapper = new ObjectMapper();
+String profileJson = objectMapper.writeValueAsString(profileInfo);
+
+//Prepare requestInfo object
+JsonObject requestInfo = new JsonObject()
+requestInfo.addProperty("transactionId", transactionId)
+requestInfo.addProperty("requestId", requestId)
+requestInfo.addProperty("callbackUrl", callbackUrl)
+requestInfo.addProperty("sourceId","SO" )
+requestInfo.addProperty("timeout", 600)
+requestInfo.addProperty("numSolutions", 1)
+
+//Prepare serviceInfo object
+JsonObject nsstInfo = new JsonObject()
+nsstInfo.addProperty("UUID", UUID)
+nsstInfo.addProperty("invariantUUID", invariantUUID)
+nsstInfo.addProperty("name", name)
+
+JsonObject json = new JsonObject()
+json.add("requestInfo", requestInfo)
+json.add("NSSTInfo", nsstInfo)
+json.addProperty("sliceProfile", profileJson)
+return json.toString()
+}
+/**
+* Method to create NSI/NSSI termination request
+* (OOF response will be synchronous in G-Release)
+* @param requestId - mso-request-id
+* @param nxlId        - NSI/NSSI Id to be terminated
+* @param messageType - Message type for callback correlation
+* @param serviceInstanceId - NSI/NSSI Id related to nxlId
+* @return
+*/
+public String buildTerminateNxiRequest(String requestId,String nxlId, String nxlType, String messageType, String serviceInstanceId) {
+def transactionId = requestId
+logger.debug( "transactionId is: " + transactionId)
+String correlator = requestId
+String callbackUrl = UrnPropertiesReader.getVariable("mso.adapters.oof.callback.endpoint") + "/" + messageType + "/" + correlator
+//Prepare Terminate Nxl Json
+JsonObject json = new JsonObject()
+json.addProperty("type", nxlType)
+json.addProperty("NxIId", nxlId)
+//Prepare requestInfo object
+JsonObject requestInfo = new JsonObject()
+requestInfo.addProperty("transactionId", transactionId)
+requestInfo.addProperty("requestId", requestId)
+requestInfo.addProperty("callbackUrl", callbackUrl)
+requestInfo.addProperty("sourceId","SO" )
+requestInfo.addProperty("timeout", 600)
+//Prepare addtnlArgs object
+JsonObject addtnlArgs = new JsonObject()
+addtnlArgs.addProperty("serviceInstanceId", serviceInstanceId)
+requestInfo.add("addtnlArgs", addtnlArgs)
+json.add("requestInfo", requestInfo)
+return json.toString()
+}
+
+    public String buildSelectNSIRequest(String requestId, TemplateInfo nstInfo, List<TemplateInfo> nsstInfo,
+                                        String messageType, Map<String, Object> serviceProfile,
+                                        List<SubnetCapability> subnetCapabilities, Integer timeOut){
+
+        def transactionId = requestId
+        logger.debug( "transactionId is: " + transactionId)
+
+        String callbackUrl = UrnPropertiesReader.getVariable("mso.adapters.oof.callback.endpoint") + "/" + messageType + "/" + correlator
+
+        NsiReqBody nsiReqBody = new NsiReqBody()
+
+        RequestInfo requestInfo = new RequestInfo()
+        requestInfo.setRequestId(requestId)
+        requestInfo.setTransactionId(transactionId)
+        requestInfo.setCallbackUrl(callbackUrl)
+        requestInfo.setSourceId("so")
+        requestInfo.setTimeout(timeOut)
+        //requestInfo.setNumSolutions()
+
+        nsiReqBody.setRequestInfo(requestInfo)
+        nsiReqBody.setNSTInfo(nstInfo)
+        nsiReqBody.setServiceProfile(serviceProfile)
+        nsiReqBody.setSubnetCapabilities(subnetCapabilities)
+        nsiReqBody.setNSSTInfo(nsstInfo)
 
+
+        ObjectMapper objectMapper = new ObjectMapper()
+
+        return objectMapper.writeValueAsString(nsiReqBody)
+    }
 }
index 051f693..f7fbc3a 100644 (file)
@@ -35,6 +35,8 @@ import org.onap.aaiclient.client.aai.AAIResourcesClient
 import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
 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.aaiclient.client.graphinventory.entities.uri.Depth
 import org.springframework.web.util.UriUtils
 import org.onap.so.logger.MessageEnum
@@ -123,7 +125,7 @@ public class PrepareUpdateAAIVfModule extends VfModuleBase {
 
 
                        try {
-                               AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
+                               AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId))
                                AAIResourcesClient resourceClient = new AAIResourcesClient()
                                AAIResultWrapper wrapper = resourceClient.get(uri.depth(Depth.ONE), NotFoundException.class)
                                GenericVnf responseData = wrapper.asBean(GenericVnf.class).get()
@@ -167,7 +169,7 @@ public class PrepareUpdateAAIVfModule extends VfModuleBase {
                        def vnfName = genericVnf.getVnfName()
                        execution.setVariable('PUAAIVfMod_vnfName', vnfName)
 
-                       AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId)
+                       AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId).vfModule(vfModuleId))
                        AAIResourcesClient resourceClient = new AAIResourcesClient()
 
 
@@ -224,7 +226,7 @@ public class PrepareUpdateAAIVfModule extends VfModuleBase {
                        vfModule.setOrchestrationStatus(orchestrationStatus)
 
                        AAIResourcesClient client = new AAIResourcesClient()
-                       AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId)
+                       AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId).vfModule(vfModuleId))
                        client.update(uri, vfModule)
                        execution.setVariable('PUAAIVfMod_updateVfModuleResponseCode', 200)
                        // Set the output for this flow.  The updated VfModule is an output, the generic VNF name, and for
index b35042e..23dfdce 100644 (file)
@@ -22,6 +22,7 @@ package org.onap.so.bpmn.common.scripts
 import org.camunda.bpm.engine.delegate.DelegateExecution
 import org.onap.so.bpmn.core.UrnPropertiesReader
 import org.onap.so.db.request.beans.OperationStatus
+import org.onap.so.db.request.beans.ResourceOperationStatus
 import org.slf4j.Logger
 import org.slf4j.LoggerFactory
 import org.springframework.web.util.UriUtils
@@ -116,4 +117,100 @@ class RequestDBUtil {
             exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
         }
     }
+       
+       /**
+        * init resource  operation status in requestDB
+        * @param execution
+        * @param resourceoperationStatus
+        */
+       void prepareInitResourceOperationStatus(DelegateExecution execution, final ResourceOperationStatus resourceoperationStatus){
+               logger.debug("start prepareinitResourceOperationStatus")
+               try{
+                       def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution)
+                       execution.setVariable("dbAdapterEndpoint", dbAdapterEndpoint)
+                       logger.debug("DB Adapter Endpoint is: " + dbAdapterEndpoint)
+
+                       String serviceId = resourceoperationStatus.getServiceId()
+                       serviceId = UriUtils.encode(serviceId,"UTF-8")
+                       String operationId = resourceoperationStatus.getOperationId()
+                       String resourceTemplateUUID = resourceoperationStatus.getResourceTemplateUUID()
+                       String operType = resourceoperationStatus.getOperType()
+
+                       String payload =
+                                       """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
+                        xmlns:ns="http://org.onap.so/requestsdb">
+                            <soapenv:Header/>
+                            <soapenv:Body>
+                                <ns:initResourceOperationStatus xmlns:ns="http://org.onap.so/requestsdb">
+                                    <serviceId>${MsoUtils.xmlEscape(serviceId)}</serviceId>
+                                    <operationId>${MsoUtils.xmlEscape(operationId)}</operationId>
+                                    <operationType>${MsoUtils.xmlEscape(operType)}</operationType>
+                                    <resourceTemplateUUIDs>${MsoUtils.xmlEscape(resourceTemplateUUID)}</resourceTemplateUUIDs>
+                                </ns:initResourceOperationStatus>
+                            </soapenv:Body>
+                        </soapenv:Envelope>
+                    """
+                       execution.setVariable("initResourceOperationStatus", payload)
+
+               }catch(any){
+                       String exceptionMessage = "Prepare init ResourceOperationStatus failed. cause - " + any.getMessage()
+                       logger.debug(exceptionMessage)
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
+               }
+               logger.trace("finished init ResourceOperationStatus")
+       }
+       
+       /**
+        * update resource operation status in requestDB
+        * @param execution
+        * @param resourceoperationStatus
+        */
+       void prepareUpdateResourceOperationStatus(DelegateExecution execution, final ResourceOperationStatus resourceoperationStatus){
+               logger.debug("start prepareUpdateResourceOperationStatus")
+               try{
+                       def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution)
+                       execution.setVariable("dbAdapterEndpoint", dbAdapterEndpoint)
+                       logger.debug("DB Adapter Endpoint is: " + dbAdapterEndpoint)
+
+                       String serviceId = resourceoperationStatus.getServiceId()
+                       serviceId = UriUtils.encode(serviceId,"UTF-8")
+                       String operationId = resourceoperationStatus.getOperationId()
+                       String resourceTemplateUUID = resourceoperationStatus.getResourceTemplateUUID()
+                       String operType = resourceoperationStatus.getOperType()
+                       String resourceInstanceID = resourceoperationStatus.getResourceInstanceID()
+                       String jobId = resourceoperationStatus.getJobId()
+                       String status = resourceoperationStatus.getStatus()
+                       String progress = resourceoperationStatus.getProgress()
+                       String errorCode = resourceoperationStatus.getErrorCode()?: ""
+                       String statusDescription = resourceoperationStatus.getStatusDescription()?: ""
+
+                       String payload =
+                                       """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
+                        xmlns:ns="http://org.onap.so/requestsdb">
+                            <soapenv:Header/>
+                            <soapenv:Body>
+                                <ns:updateResourceOperationStatus xmlns:ns="http://org.onap.so/requestsdb">
+                                    <serviceId>${MsoUtils.xmlEscape(serviceId)}</serviceId>
+                                    <operationId>${MsoUtils.xmlEscape(operationId)}</operationId>
+                                                                       <resourceTemplateUUIDs>${MsoUtils.xmlEscape(resourceTemplateUUID)}</resourceTemplateUUIDs>
+                                    <operationType>${MsoUtils.xmlEscape(operType)}</operationType>
+                                    <jobId>${MsoUtils.xmlEscape(jobId)}</jobId>
+                                    <status>${MsoUtils.xmlEscape(status)}</status>
+                                    <progress>${MsoUtils.xmlEscape(progress)}</progress>
+                                    <errorCode>${MsoUtils.xmlEscape(errorCode)}</errorCode>
+                                                                       <statusDescription>${MsoUtils.xmlEscape(statusDescription)}</statusDescription>
+                                </ns:updateResourceOperationStatus>
+                            </soapenv:Body>
+                        </soapenv:Envelope>
+                    """
+                       execution.setVariable("updateResourceOperationStatus", payload)
+
+               }catch(any){
+                       String exceptionMessage = "Prepare update ResourceOperationStatus failed. cause - " + any.getMessage()
+                       logger.debug(exceptionMessage)
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
+               }
+               logger.trace("finished update ResourceOperationStatus")
+       }
+
 }
index 9a78472..b68bf7b 100644 (file)
@@ -30,6 +30,8 @@ import org.onap.so.bpmn.core.WorkflowException
 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
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types
 import org.onap.aaiclient.client.graphinventory.entities.uri.Depth
 import org.onap.logging.filter.base.ErrorCode
 import org.onap.so.logger.MessageEnum
@@ -134,7 +136,7 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor {
                try {
                        def vnfId = execution.getVariable('UAAIGenVnf_vnfId')
 
-                       AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
+                       AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId))
                        uri.depth(Depth.ONE)
                        try {
                                Optional<GenericVnf> genericVnf = getAAIClient().get(GenericVnf.class,uri)
@@ -223,7 +225,7 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor {
                        payload.setManagementV6Address(managementV6AddressEntry)
                        payload.setOrchestrationStatus(orchestrationStatusEntry)
 
-                       AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
+                       AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId))
 
                        try {
                                getAAIClient().update(uri,payload)
index 20f9721..a8a289d 100644 (file)
@@ -30,6 +30,8 @@ import org.onap.so.bpmn.core.WorkflowException
 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
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types
 import org.slf4j.Logger
 import org.slf4j.LoggerFactory
 
@@ -106,7 +108,7 @@ public class UpdateAAIVfModule extends AbstractServiceTaskProcessor {
                        def vnfId = execution.getVariable('UAAIVfMod_vnfId')
                        def vfModuleId = execution.getVariable('UAAIVfMod_vfModuleId')
                        try {
-                               AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId);
+                               AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId).vfModule(vfModuleId));
                                Optional<org.onap.aai.domain.yang.VfModule> vfModule = getAAIClient().get(org.onap.aai.domain.yang.VfModule.class, resourceUri)
                                if (vfModule.isPresent()) {
                                        execution.setVariable('UAAIVfMod_getVfModuleResponseCode', 200)
@@ -185,7 +187,7 @@ public class UpdateAAIVfModule extends AbstractServiceTaskProcessor {
                        payload.setContrailServiceInstanceFqdn(contrailServiceInstanceFqdnEntry)
 
             try {
-                AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId)
+                AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId).vfModule(vfModuleId))
                 getAAIClient().update(resourceUri, payload)
                                execution.setVariable('UAAIVfMod_updateVfModuleResponseCode', 200)
                                execution.setVariable('UAAIVfMod_updateVfModuleResponse', "Success")
index 5a82442..8923051 100644 (file)
@@ -35,12 +35,12 @@ import org.camunda.bpm.engine.delegate.DelegateExecution;
 import org.camunda.bpm.engine.delegate.JavaDelegate;
 import org.javatuples.Pair;
 import org.onap.aaiclient.client.aai.AAICommonObjectMapperProvider;
-import org.onap.aaiclient.client.aai.AAIObjectType;
 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.so.bpmn.common.BuildingBlockExecution;
 import org.onap.so.bpmn.common.DelegateExecutionImpl;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
@@ -54,6 +54,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.NetworkPolicy;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.OwningEntity;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.Project;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTableReference;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
@@ -62,7 +63,6 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.Tenant;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.Vnfc;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding;
 import org.onap.so.bpmn.servicedecomposition.entities.ConfigurationResourceKeys;
@@ -443,6 +443,17 @@ public class BBInputSetup implements JavaDelegate {
 
     protected void populateConfiguration(BBInputSetupParameter parameter) {
         Configuration configuration = null;
+        String replaceVnfModelCustomizationUUID = "";
+        if (parameter.getRelatedInstanceList() != null) {
+            for (RelatedInstanceList relatedInstList : parameter.getRelatedInstanceList()) {
+                RelatedInstance relatedInstance = relatedInstList.getRelatedInstance();
+                if (relatedInstance.getModelInfo().getModelType().equals(ModelType.vnf)) {
+                    if (parameter.getIsReplace()) {
+                        replaceVnfModelCustomizationUUID = relatedInstance.getModelInfo().getModelCustomizationId();
+                    }
+                }
+            }
+        }
         for (Configuration configurationTemp : parameter.getServiceInstance().getConfigurations()) {
             if (parameter.getLookupKeyMap().get(ResourceKey.CONFIGURATION_ID) != null
                     && configurationTemp.getConfigurationId()
@@ -465,8 +476,17 @@ public class BBInputSetup implements JavaDelegate {
         if (configuration != null && parameter.getBbName().contains("Fabric")) {
             Vnfc vnfc = getVnfcToConfiguration(parameter.getConfigurationResourceKeys().getVnfcName());
             configuration.setVnfc(vnfc);
-            this.mapCatalogConfiguration(configuration, parameter.getModelInfo(), parameter.getService(),
-                    parameter.getConfigurationResourceKeys());
+            if (!parameter.getBbName().contains("Delete")) {
+                if (parameter.getIsReplace()) {
+                    parameter.getConfigurationResourceKeys()
+                            .setVnfResourceCustomizationUUID(replaceVnfModelCustomizationUUID);
+                    mapCatalogConfiguration(configuration, parameter.getModelInfo(),
+                            parameter.getServiceModel().getNewService(), parameter.getConfigurationResourceKeys());
+                } else {
+                    mapCatalogConfiguration(configuration, parameter.getModelInfo(),
+                            parameter.getServiceModel().getCurrentService(), parameter.getConfigurationResourceKeys());
+                }
+            }
         } else if (configuration != null && parameter.getBbName().contains("Vrf")) {
             configuration.setModelInfoConfiguration(mapperLayer.mapCatalogConfigurationToConfiguration(
                     findConfigurationResourceCustomization(parameter.getModelInfo(), parameter.getService()), null));
@@ -476,7 +496,7 @@ public class BBInputSetup implements JavaDelegate {
     }
 
     protected Vnfc getVnfcToConfiguration(String vnfcName) {
-        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VNFC, vnfcName);
+        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().vnfc(vnfcName));
         Optional<org.onap.aai.domain.yang.Vnfc> vnfcOp =
                 bbInputSetupUtils.getAAIResourceDepthOne(uri).asBean(org.onap.aai.domain.yang.Vnfc.class);
         if (vnfcOp.isPresent()) {
@@ -1863,15 +1883,13 @@ public class BBInputSetup implements JavaDelegate {
     }
 
     private void mapRelationship(ServiceInstance serviceInstance, Relationships relationships) {
-        this.mapProject(relationships.getByType(AAIObjectType.PROJECT, uri -> uri.nodesOnly(true)), serviceInstance);
-        this.mapOwningEntity(relationships.getByType(AAIObjectType.OWNING_ENTITY, uri -> uri.nodesOnly(true)),
-                serviceInstance);
-        this.mapL3Networks(relationships.getRelatedAAIUris(AAIObjectType.L3_NETWORK), serviceInstance.getNetworks());
-        this.mapGenericVnfs(relationships.getRelatedAAIUris(AAIObjectType.GENERIC_VNF), serviceInstance.getVnfs());
-        this.mapPnfs(relationships.getRelatedAAIUris(AAIObjectType.PNF), serviceInstance.getPnfs());
-        this.mapCollection(relationships.getByType(AAIObjectType.COLLECTION), serviceInstance);
-        this.mapConfigurations(relationships.getRelatedAAIUris(AAIObjectType.CONFIGURATION),
-                serviceInstance.getConfigurations());
+        this.mapProject(relationships.getByType(Types.PROJECT, uri -> uri.nodesOnly(true)), serviceInstance);
+        this.mapOwningEntity(relationships.getByType(Types.OWNING_ENTITY, uri -> uri.nodesOnly(true)), serviceInstance);
+        this.mapL3Networks(relationships.getRelatedUris(Types.L3_NETWORK), serviceInstance.getNetworks());
+        this.mapGenericVnfs(relationships.getRelatedUris(Types.GENERIC_VNF), serviceInstance.getVnfs());
+        this.mapPnfs(relationships.getRelatedUris(Types.PNF), serviceInstance.getPnfs());
+        this.mapCollection(relationships.getByType(Types.COLLECTION), serviceInstance);
+        this.mapConfigurations(relationships.getRelatedUris(Types.CONFIGURATION), serviceInstance.getConfigurations());
     }
 
     protected void mapConfigurations(List<AAIResourceUri> relatedAAIUris, List<Configuration> configurations) {
@@ -1910,11 +1928,10 @@ public class BBInputSetup implements JavaDelegate {
         Optional<Relationships> relationshipsOp = aaiGenericVnfWrapper.getRelationships();
         if (relationshipsOp.isPresent()) {
             Relationships relationships = relationshipsOp.get();
-            this.mapPlatform(relationships.getByType(AAIObjectType.PLATFORM), genericVnf);
-            this.mapLineOfBusiness(relationships.getByType(AAIObjectType.LINE_OF_BUSINESS), genericVnf);
-            genericVnf.getVolumeGroups().addAll(mapVolumeGroups(relationships.getByType(AAIObjectType.VOLUME_GROUP)));
-            genericVnf.getInstanceGroups()
-                    .addAll(mapInstanceGroups(relationships.getByType(AAIObjectType.INSTANCE_GROUP)));
+            this.mapPlatform(relationships.getByType(Types.PLATFORM), genericVnf);
+            this.mapLineOfBusiness(relationships.getByType(Types.LINE_OF_BUSINESS), genericVnf);
+            genericVnf.getVolumeGroups().addAll(mapVolumeGroups(relationships.getByType(Types.VOLUME_GROUP)));
+            genericVnf.getInstanceGroups().addAll(mapInstanceGroups(relationships.getByType(Types.INSTANCE_GROUP)));
         }
 
         return genericVnf;
@@ -2021,8 +2038,7 @@ public class BBInputSetup implements JavaDelegate {
     }
 
     private void setInstanceGroupForCollection(Collection collection, Relationships relationships) {
-        List<InstanceGroup> instanceGroupsList =
-                mapInstanceGroups(relationships.getByType(AAIObjectType.INSTANCE_GROUP));
+        List<InstanceGroup> instanceGroupsList = mapInstanceGroups(relationships.getByType(Types.INSTANCE_GROUP));
         if (!instanceGroupsList.isEmpty()) {
             collection.setInstanceGroup(instanceGroupsList.get(0));
         }
@@ -2059,9 +2075,8 @@ public class BBInputSetup implements JavaDelegate {
         Optional<Relationships> relationshipsOp = aaiNetworkWrapper.getRelationships();
         if (relationshipsOp.isPresent()) {
             Relationships relationships = relationshipsOp.get();
-            this.mapNetworkPolicies(relationships.getByType(AAIObjectType.NETWORK_POLICY),
-                    network.getNetworkPolicies());
-            mapRouteTableReferences(relationships.getByType(AAIObjectType.ROUTE_TABLE_REFERENCE),
+            this.mapNetworkPolicies(relationships.getByType(Types.NETWORK_POLICY), network.getNetworkPolicies());
+            mapRouteTableReferences(relationships.getByType(Types.ROUTE_TABLE_REFERENCE),
                     network.getContrailNetworkRouteTableReferences());
         }
 
index 68161a8..54922d4 100644 (file)
@@ -34,6 +34,8 @@ final class BBInputSetupPnf {
     }
 
     static void populatePnfToServiceInstance(Pnfs pnfs, String pnfId, ServiceInstance serviceInstance) {
+        removePnfFromServiceIfExists(serviceInstance, pnfId);
+
         Pnf pnf = new Pnf();
         pnf.setPnfId(pnfId);
         pnf.setPnfName(pnfs.getInstanceName());
@@ -45,4 +47,9 @@ final class BBInputSetupPnf {
 
         serviceInstance.getPnfs().add(pnf);
     }
+
+    private static void removePnfFromServiceIfExists(ServiceInstance serviceInstance, String pnfId) {
+        serviceInstance.getPnfs().stream().filter(pnf -> pnf.getPnfId().equals(pnfId)).findFirst()
+                .ifPresent(serviceInstance.getPnfs()::remove);
+    }
 }
index 4e0b563..9205cae 100644 (file)
@@ -43,19 +43,20 @@ import org.onap.aai.domain.yang.VfModule;
 import org.onap.aai.domain.yang.VolumeGroup;
 import org.onap.aai.domain.yang.VolumeGroups;
 import org.onap.aai.domain.yang.VpnBinding;
-import org.onap.so.bpmn.common.InjectionHelper;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
-import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
-import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.MultipleObjectsFoundException;
-import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.NoServiceInstanceFoundException;
-import org.onap.aaiclient.client.aai.AAIObjectPlurals;
-import org.onap.aaiclient.client.aai.AAIObjectType;
 import org.onap.aaiclient.client.aai.AAIResourcesClient;
 import org.onap.aaiclient.client.aai.entities.AAIResultWrapper;
+import org.onap.aaiclient.client.aai.entities.uri.AAIFluentSingleType;
 import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
 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.aaiclient.client.graphinventory.entities.uri.Depth;
+import org.onap.so.bpmn.common.InjectionHelper;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
+import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.MultipleObjectsFoundException;
+import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.NoServiceInstanceFoundException;
 import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization;
 import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization;
 import org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization;
@@ -237,7 +238,7 @@ public class BBInputSetupUtils {
     }
 
     public Map<String, String> getURIKeysFromServiceInstance(String serviceInstanceId) {
-        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId);
+        AAIResourceUri uri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId));
         return uri.getURIKeys();
     }
 
@@ -266,8 +267,10 @@ public class BBInputSetupUtils {
             String cloudRegionId = cloudConfiguration.getLcpCloudRegionId();
             String cloudOwner = cloudConfiguration.getCloudOwner();
             if (cloudRegionId != null && cloudOwner != null && !cloudRegionId.isEmpty() && !cloudOwner.isEmpty()) {
-                return injectionHelper.getAaiClient().get(CloudRegion.class, AAIUriFactory
-                        .createResourceUri(AAIObjectType.CLOUD_REGION, cloudOwner, cloudRegionId).depth(Depth.TWO))
+                return injectionHelper.getAaiClient()
+                        .get(CloudRegion.class, AAIUriFactory.createResourceUri(
+                                AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(cloudOwner, cloudRegionId))
+                                .depth(Depth.TWO))
                         .orElse(null);
 
             } else {
@@ -279,13 +282,17 @@ public class BBInputSetupUtils {
     }
 
     public InstanceGroup getAAIInstanceGroup(String instanceGroupId) {
-        return injectionHelper.getAaiClient().get(InstanceGroup.class,
-                AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroupId)).orElse(null);
+        return injectionHelper.getAaiClient()
+                .get(InstanceGroup.class,
+                        AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroupId)))
+                .orElse(null);
     }
 
     public org.onap.aai.domain.yang.Customer getAAICustomer(String globalSubscriberId) {
-        return injectionHelper.getAaiClient().get(org.onap.aai.domain.yang.Customer.class,
-                AAIUriFactory.createResourceUri(AAIObjectType.CUSTOMER, globalSubscriberId)).orElse(null);
+        return injectionHelper.getAaiClient()
+                .get(org.onap.aai.domain.yang.Customer.class,
+                        AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId)))
+                .orElse(null);
     }
 
     public ServiceSubscription getAAIServiceSubscription(String globalSubscriberId, String subscriptionServiceType) {
@@ -294,8 +301,9 @@ public class BBInputSetupUtils {
                 || subscriptionServiceType.equals("")) {
             return null;
         } else {
-            return injectionHelper.getAaiClient().get(ServiceSubscription.class, AAIUriFactory
-                    .createResourceUri(AAIObjectType.SERVICE_SUBSCRIPTION, globalSubscriberId, subscriptionServiceType))
+            return injectionHelper
+                    .getAaiClient().get(ServiceSubscription.class, AAIUriFactory.createResourceUri(AAIFluentTypeBuilder
+                            .business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType)))
                     .orElse(null);
         }
 
@@ -304,25 +312,25 @@ public class BBInputSetupUtils {
     public ServiceInstance getAAIServiceInstanceById(String serviceInstanceId) {
         return injectionHelper.getAaiClient()
                 .get(ServiceInstance.class, AAIUriFactory
-                        .createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId).depth(Depth.TWO))
+                        .createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId)).depth(Depth.TWO))
                 .orElse(null);
     }
 
     protected ServiceInstance getAAIServiceInstanceByIdAndCustomer(String globalCustomerId, String serviceType,
             String serviceInstanceId) {
-        return injectionHelper.getAaiClient().get(ServiceInstance.class, AAIUriFactory
-                .createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalCustomerId, serviceType, serviceInstanceId)
-                .depth(Depth.TWO)).orElse(null);
+        return injectionHelper.getAaiClient().get(ServiceInstance.class,
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalCustomerId)
+                        .serviceSubscription(serviceType).serviceInstance(serviceInstanceId)).depth(Depth.TWO))
+                .orElse(null);
     }
 
     public org.onap.aai.domain.yang.ServiceInstance getAAIServiceInstanceByName(String serviceInstanceName,
             Customer customer) throws Exception {
-        Optional<org.onap.aai.domain.yang.ServiceInstance> aaiServiceInstance =
-                injectionHelper.getAaiClient()
-                        .getOne(ServiceInstances.class, org.onap.aai.domain.yang.ServiceInstance.class, AAIUriFactory
-                                .createResourceUri(AAIObjectPlurals.SERVICE_INSTANCE, customer.getGlobalCustomerId(),
-                                        customer.getServiceSubscription().getServiceType())
-                                .queryParam("service-instance-name", serviceInstanceName).depth(Depth.TWO));
+        Optional<org.onap.aai.domain.yang.ServiceInstance> aaiServiceInstance = injectionHelper.getAaiClient().getOne(
+                ServiceInstances.class, org.onap.aai.domain.yang.ServiceInstance.class,
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(customer.getGlobalCustomerId())
+                        .serviceSubscription(customer.getServiceSubscription().getServiceType()).serviceInstances())
+                        .queryParam("service-instance-name", serviceInstanceName).depth(Depth.TWO));
 
         return aaiServiceInstance.orElse(null);
     }
@@ -331,7 +339,9 @@ public class BBInputSetupUtils {
             String serviceInstanceName) {
 
         return injectionHelper.getAaiClient().getOne(ServiceInstances.class, ServiceInstance.class,
-                AAIUriFactory.createResourceUri(AAIObjectPlurals.SERVICE_INSTANCE, globalCustomerId, serviceType)
+                AAIUriFactory
+                        .createResourceUri(AAIFluentTypeBuilder.business().customer(globalCustomerId)
+                                .serviceSubscription(serviceType).serviceInstances())
                         .queryParam("service-instance-name", serviceInstanceName).depth(Depth.TWO));
     }
 
@@ -356,43 +366,46 @@ public class BBInputSetupUtils {
     }
 
     public Configuration getAAIConfiguration(String configurationId) {
-        return this.getConcreteAAIResource(Configuration.class, AAIObjectType.CONFIGURATION, configurationId);
+        return this.getConcreteAAIResource(Configuration.class,
+                AAIFluentTypeBuilder.network().configuration(configurationId));
     }
 
     public GenericVnf getAAIGenericVnf(String vnfId) {
-        return getConcreteAAIResource(GenericVnf.class, AAIObjectType.GENERIC_VNF, vnfId);
+        return getConcreteAAIResource(GenericVnf.class, AAIFluentTypeBuilder.network().genericVnf(vnfId));
     }
 
     public VpnBinding getAAIVpnBinding(String vpnBindingId) {
-        return getConcreteAAIResource(VpnBinding.class, AAIObjectType.VPN_BINDING, vpnBindingId);
+        return getConcreteAAIResource(VpnBinding.class, AAIFluentTypeBuilder.network().vpnBinding(vpnBindingId));
     }
 
     public VolumeGroup getAAIVolumeGroup(String cloudOwnerId, String cloudRegionId, String volumeGroupId) {
-        return getConcreteAAIResource(VolumeGroup.class, AAIObjectType.VOLUME_GROUP, cloudOwnerId, cloudRegionId,
-                volumeGroupId);
+        return getConcreteAAIResource(VolumeGroup.class, AAIFluentTypeBuilder.cloudInfrastructure()
+                .cloudRegion(cloudOwnerId, cloudRegionId).volumeGroup(volumeGroupId));
     }
 
     public VfModule getAAIVfModule(String vnfId, String vfModuleId) {
-        return getConcreteAAIResource(VfModule.class, AAIObjectType.VF_MODULE, vnfId, vfModuleId);
+        return getConcreteAAIResource(VfModule.class,
+                AAIFluentTypeBuilder.network().genericVnf(vnfId).vfModule(vfModuleId));
     }
 
     public L3Network getAAIL3Network(String networkId) {
-        return getConcreteAAIResource(L3Network.class, AAIObjectType.L3_NETWORK, networkId);
+        return getConcreteAAIResource(L3Network.class, AAIFluentTypeBuilder.network().l3Network(networkId));
     }
 
-    private <T> T getConcreteAAIResource(Class<T> clazz, AAIObjectType objectType, Object... ids) {
-        return injectionHelper.getAaiClient()
-                .get(clazz, AAIUriFactory.createResourceUri(objectType, ids).depth(Depth.ONE)).orElseGet(() -> {
-                    logger.debug("No resource of type: {} matched by ids: {}", objectType.typeName(),
-                            Arrays.toString(ids));
+    private <T> T getConcreteAAIResource(Class<T> clazz, AAIFluentSingleType type) {
+        return injectionHelper.getAaiClient().get(clazz, AAIUriFactory.createResourceUri(type).depth(Depth.ONE))
+                .orElseGet(() -> {
+                    logger.debug("No resource of type: {} matched by ids: {}", type.build().typeName(),
+                            Arrays.toString(type.values()));
                     return null;
                 });
     }
 
     public Optional<ServiceInstance> getRelatedServiceInstanceFromInstanceGroup(String instanceGroupId)
             throws Exception {
-        AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroupId)
-                .relatedTo(AAIObjectPlurals.SERVICE_INSTANCE);
+        AAIPluralResourceUri uri =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroupId))
+                        .relatedTo(Types.SERVICE_INSTANCES.getFragment());
         Optional<ServiceInstances> serviceInstances = injectionHelper.getAaiClient().get(ServiceInstances.class, uri);
         ServiceInstance serviceInstance = null;
         if (!serviceInstances.isPresent()) {
@@ -414,8 +427,9 @@ public class BBInputSetupUtils {
 
     public Optional<L3Network> getRelatedNetworkByNameFromServiceInstance(String serviceInstanceId, String networkName)
             throws MultipleObjectsFoundException {
-        AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId)
-                .relatedTo(AAIObjectPlurals.L3_NETWORK).queryParam("network-name", networkName);
+        AAIPluralResourceUri uri =
+                AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId))
+                        .relatedTo(Types.L3_NETWORKS.getFragment()).queryParam("network-name", networkName);
         Optional<L3Networks> networks = injectionHelper.getAaiClient().get(L3Networks.class, uri);
         L3Network network = null;
         if (!networks.isPresent()) {
@@ -435,34 +449,37 @@ public class BBInputSetupUtils {
     }
 
     public Optional<GenericVnf> getRelatedVnfByNameFromServiceInstance(String serviceInstanceId, String vnfName) {
-        AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId)
-                .relatedTo(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", vnfName);
+        AAIPluralResourceUri uri =
+                AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId))
+                        .relatedTo(Types.GENERIC_VNFS.getFragment()).queryParam("vnf-name", vnfName);
         return injectionHelper.getAaiClient().getOne(GenericVnfs.class, GenericVnf.class, uri);
 
     }
 
     public Optional<VolumeGroup> getRelatedVolumeGroupByNameFromVnf(String vnfId, String volumeGroupName) {
-        AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
-                .relatedTo(AAIObjectPlurals.VOLUME_GROUP).queryParam("volume-group-name", volumeGroupName);
+        AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId))
+                .relatedTo(Types.VOLUME_GROUPS.getFragment()).queryParam("volume-group-name", volumeGroupName);
         return injectionHelper.getAaiClient().getOne(VolumeGroups.class, VolumeGroup.class, uri);
     }
 
     public Optional<VolumeGroup> getRelatedVolumeGroupByIdFromVnf(String vnfId, String volumeGroupId) {
-        AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
-                .relatedTo(AAIObjectPlurals.VOLUME_GROUP).queryParam("volume-group-id", volumeGroupId);
+        AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId))
+                .relatedTo(Types.VOLUME_GROUPS.getFragment()).queryParam("volume-group-id", volumeGroupId);
         return injectionHelper.getAaiClient().getOne(VolumeGroups.class, VolumeGroup.class, uri);
     }
 
     public Optional<VolumeGroup> getRelatedVolumeGroupByNameFromVfModule(String vnfId, String vfModuleId,
             String volumeGroupName) throws Exception {
-        AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId)
-                .relatedTo(AAIObjectPlurals.VOLUME_GROUP).queryParam("volume-group-name", volumeGroupName);
+        AAIPluralResourceUri uri =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId).vfModule(vfModuleId))
+                        .relatedTo(Types.VOLUME_GROUPS.getFragment()).queryParam("volume-group-name", volumeGroupName);
         return injectionHelper.getAaiClient().getOne(VolumeGroups.class, VolumeGroup.class, uri);
     }
 
     public Optional<VolumeGroup> getRelatedVolumeGroupFromVfModule(String vnfId, String vfModuleId) throws Exception {
-        AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId)
-                .relatedTo(AAIObjectPlurals.VOLUME_GROUP);
+        AAIPluralResourceUri uri =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId).vfModule(vfModuleId))
+                        .relatedTo(Types.VOLUME_GROUPS.getFragment());
         return injectionHelper.getAaiClient().getOne(VolumeGroups.class, VolumeGroup.class, uri);
     }
 
@@ -470,9 +487,9 @@ public class BBInputSetupUtils {
             org.onap.aai.domain.yang.L3Network aaiLocalNetwork) {
         AAIResultWrapper networkWrapper = new AAIResultWrapper(aaiLocalNetwork);
         if (networkWrapper.getRelationships().isPresent()
-                && !networkWrapper.getRelationships().get().getRelatedUris(AAIObjectType.VPN_BINDING).isEmpty()) {
+                && !networkWrapper.getRelationships().get().getRelatedUris(Types.VPN_BINDING).isEmpty()) {
             return getAAIResourceDepthOne(
-                    networkWrapper.getRelationships().get().getRelatedUris(AAIObjectType.VPN_BINDING).get(0))
+                    networkWrapper.getRelationships().get().getRelatedUris(Types.VPN_BINDING).get(0))
                             .asBean(org.onap.aai.domain.yang.VpnBinding.class);
         }
         return Optional.empty();
@@ -481,7 +498,7 @@ public class BBInputSetupUtils {
     public ServiceInstances getAAIServiceInstancesGloballyByName(String serviceInstanceName) {
 
         return injectionHelper.getAaiClient()
-                .get(ServiceInstances.class, AAIUriFactory.createNodesUri(AAIObjectPlurals.SERVICE_INSTANCE)
+                .get(ServiceInstances.class, AAIUriFactory.createNodesUri(Types.SERVICE_INSTANCES.getFragment())
                         .queryParam("service-instance-name", serviceInstanceName))
                 .orElseGet(() -> {
                     logger.debug("No Service Instance matched by name");
@@ -491,26 +508,27 @@ public class BBInputSetupUtils {
 
     public boolean existsAAINetworksGloballyByName(String networkName) {
 
-        AAIPluralResourceUri l3networkUri =
-                AAIUriFactory.createResourceUri(AAIObjectPlurals.L3_NETWORK).queryParam("network-name", networkName);
+        AAIPluralResourceUri l3networkUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Networks())
+                .queryParam("network-name", networkName);
         AAIResourcesClient aaiRC = injectionHelper.getAaiClient();
         return aaiRC.exists(l3networkUri);
     }
 
     public boolean existsAAIVfModuleGloballyByName(String vfModuleName) {
         AAIPluralResourceUri vfModuleUri =
-                AAIUriFactory.createNodesUri(AAIObjectPlurals.VF_MODULE).queryParam("vf-module-name", vfModuleName);
+                AAIUriFactory.createNodesUri(Types.VF_MODULES.getFragment()).queryParam("vf-module-name", vfModuleName);
         return injectionHelper.getAaiClient().exists(vfModuleUri);
     }
 
     public boolean existsAAIConfigurationGloballyByName(String configurationName) {
-        AAIPluralResourceUri configUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.CONFIGURATION)
-                .queryParam("configuration-name", configurationName);
+        AAIPluralResourceUri configUri =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().configurations())
+                        .queryParam("configuration-name", configurationName);
         return injectionHelper.getAaiClient().exists(configUri);
     }
 
     public boolean existsAAIVolumeGroupGloballyByName(String volumeGroupName) {
-        AAIPluralResourceUri volumeGroupUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VOLUME_GROUP)
+        AAIPluralResourceUri volumeGroupUri = AAIUriFactory.createNodesUri(Types.VOLUME_GROUPS.getFragment())
                 .queryParam("volume-group-name", volumeGroupName);
         return injectionHelper.getAaiClient().exists(volumeGroupUri);
     }
@@ -519,7 +537,7 @@ public class BBInputSetupUtils {
 
         return injectionHelper.getAaiClient()
                 .get(GenericVnfs.class,
-                        AAIUriFactory.createNodesUri(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", vnfName))
+                        AAIUriFactory.createNodesUri(Types.GENERIC_VNFS.getFragment()).queryParam("vnf-name", vnfName))
                 .orElseGet(() -> {
                     logger.debug("No GenericVnfs matched by name");
                     return null;
@@ -528,8 +546,9 @@ public class BBInputSetupUtils {
 
     public Optional<Configuration> getRelatedConfigurationByNameFromServiceInstance(String serviceInstanceId,
             String configurationName) {
-        AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId)
-                .relatedTo(AAIObjectPlurals.CONFIGURATION).queryParam("configuration-name", configurationName);
+        AAIPluralResourceUri uri = AAIUriFactory
+                .createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId))
+                .relatedTo(Types.CONFIGURATIONS.getFragment()).queryParam("configuration-name", configurationName);
         return injectionHelper.getAaiClient().getOne(Configurations.class, Configuration.class, uri);
     }
 }
index c7e3234..cae18a1 100644 (file)
@@ -24,14 +24,14 @@ package org.onap.so.bpmn.servicedecomposition.tasks;
 
 import java.util.List;
 import java.util.Optional;
+import org.onap.aaiclient.client.aai.AAICommonObjectMapperProvider;
+import org.onap.aaiclient.client.aai.entities.AAIResultWrapper;
+import org.onap.aaiclient.client.aai.entities.Relationships;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
-import org.onap.aaiclient.client.aai.AAICommonObjectMapperProvider;
-import org.onap.aaiclient.client.aai.AAIObjectType;
-import org.onap.aaiclient.client.aai.entities.AAIResultWrapper;
-import org.onap.aaiclient.client.aai.entities.Relationships;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -88,8 +88,8 @@ public class CloudInfoFromAAI {
 
     protected Optional<CloudRegion> getRelatedCloudRegionAndTenant(Relationships relationships) {
         CloudRegion cloudRegion = new CloudRegion();
-        List<AAIResultWrapper> cloudRegions = relationships.getByType(AAIObjectType.CLOUD_REGION);
-        List<AAIResultWrapper> tenants = relationships.getByType(AAIObjectType.TENANT);
+        List<AAIResultWrapper> cloudRegions = relationships.getByType(Types.CLOUD_REGION);
+        List<AAIResultWrapper> tenants = relationships.getByType(Types.TENANT);
         if (!cloudRegions.isEmpty()) {
             AAIResultWrapper cloudRegionWrapper = cloudRegions.get(0);
             Optional<org.onap.aai.domain.yang.CloudRegion> aaiCloudRegionOp =
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/dmaapproperties/SdnrDmaapPublisher.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/dmaapproperties/SdnrDmaapPublisher.java
new file mode 100644 (file)
index 0000000..0f35b38
--- /dev/null
@@ -0,0 +1,62 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Wipro Limited.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.client.dmaapproperties;
+
+import java.io.IOException;
+import java.util.Optional;
+import org.onap.so.bpmn.core.UrnPropertiesReader;
+import org.onap.so.client.dmaap.DmaapPublisher;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Component;
+
+@Component
+@Scope("prototype")
+public class SdnrDmaapPublisher extends DmaapPublisher {
+
+
+    public SdnrDmaapPublisher() throws IOException {
+        super();
+    }
+
+    @Override
+    public String getAuth() {
+
+        return UrnPropertiesReader.getVariable("mso.global.dmaap.auth");
+    }
+
+    @Override
+    public String getKey() {
+
+        return UrnPropertiesReader.getVariable("mso.msoKey");
+    }
+
+    @Override
+    public String getTopic() {
+        return UrnPropertiesReader.getVariable("sdnc.dmaap.publisher.topic");
+    }
+
+    @Override
+    public Optional<String> getHost() {
+        return Optional.ofNullable(UrnPropertiesReader.getVariable("sdnc.dmaap.host"));
+    }
+}
+
+
index 948c932..843cca0 100644 (file)
@@ -30,6 +30,9 @@ import org.camunda.bpm.engine.delegate.BpmnError;
 import org.camunda.bpm.engine.delegate.DelegateExecution;
 import org.onap.aai.domain.yang.LInterface;
 import org.onap.aai.domain.yang.Vserver;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types;
+import org.onap.aaiclient.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
+import org.onap.logging.filter.base.ErrorCode;
 import org.onap.logging.filter.base.ONAPComponents;
 import org.onap.logging.filter.base.ONAPComponentsList;
 import org.onap.so.bpmn.common.BuildingBlockExecution;
@@ -38,9 +41,6 @@ import org.onap.so.bpmn.core.WorkflowException;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
 import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
 import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
-import org.onap.aaiclient.client.aai.AAIObjectType;
-import org.onap.aaiclient.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
-import org.onap.logging.filter.base.ErrorCode;
 import org.onap.so.logger.LoggingAnchor;
 import org.onap.so.logger.MessageEnum;
 import org.onap.so.objects.audit.AAIObjectAudit;
@@ -280,20 +280,19 @@ public class ExceptionBuilder {
                         + auditList.getAuditType() + "d in AAI: ");
 
                 Stream<AAIObjectAudit> vServerLInterfaceAuditStream = auditList.getAuditList().stream()
-                        .filter(auditObject -> auditObject.getAaiObjectType().equals(AAIObjectType.VSERVER.typeName())
-                                || auditObject.getAaiObjectType().equals(AAIObjectType.L_INTERFACE.typeName()));
+                        .filter(auditObject -> auditObject.getAaiObjectType().equals(Types.VSERVER.typeName())
+                                || auditObject.getAaiObjectType().equals(Types.L_INTERFACE.typeName()));
                 List<AAIObjectAudit> filteredAuditStream =
                         vServerLInterfaceAuditStream.filter(a -> !a.isDoesObjectExist()).collect(Collectors.toList());
 
                 for (AAIObjectAudit object : filteredAuditStream) {
-                    if (object.getAaiObjectType().equals(AAIObjectType.L_INTERFACE.typeName())) {
+                    if (object.getAaiObjectType().equals(Types.L_INTERFACE.typeName())) {
                         LInterface li = objectMapper.getMapper().convertValue(object.getAaiObject(), LInterface.class);
-                        errorMessage = errorMessage
-                                .append(AAIObjectType.L_INTERFACE.typeName() + " " + li.getInterfaceId() + ", ");
+                        errorMessage =
+                                errorMessage.append(Types.L_INTERFACE.typeName() + " " + li.getInterfaceId() + ", ");
                     } else {
                         Vserver vs = objectMapper.getMapper().convertValue(object.getAaiObject(), Vserver.class);
-                        errorMessage =
-                                errorMessage.append(AAIObjectType.VSERVER.typeName() + " " + vs.getVserverId() + ", ");
+                        errorMessage = errorMessage.append(Types.VSERVER.typeName() + " " + vs.getVserverId() + ", ");
                     }
                 }
 
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/common/SendRequestToSdnr.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/common/SendRequestToSdnr.java
new file mode 100644 (file)
index 0000000..d9656f7
--- /dev/null
@@ -0,0 +1,76 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Wipro Limited.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.client.sdnc.common;
+
+import static org.onap.so.bpmn.common.scripts.GenericUtils.isBlank;
+import javax.inject.Provider;
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.camunda.bpm.engine.delegate.JavaDelegate;
+import org.onap.so.bpmn.common.scripts.ExceptionUtil;
+import org.onap.so.bpmn.core.UrnPropertiesReader;
+import org.onap.so.client.dmaapproperties.SdnrDmaapPublisher;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component("SendRequestToSdnr")
+public class SendRequestToSdnr implements JavaDelegate {
+    private static final Logger logger = LoggerFactory.getLogger(SendRequestToSdnr.class);
+    ExceptionUtil exceptionUtil = new ExceptionUtil();
+
+    @Autowired
+    private Provider<SdnrDmaapPublisher> sdnrDmaapPublisher;
+
+    @Override
+    public void execute(DelegateExecution execution) throws Exception {
+
+        logger.debug("SendRequestToSdnr_start");
+
+        String requestId = (String) execution.getVariable("correlator");
+        if (isBlank(requestId)) {
+            String msg = "Cannot process SDNR Request : correlator is null";
+            exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg);
+        }
+
+        String messageType = (String) execution.getVariable("messageType");
+        if (isBlank(messageType)) {
+            String msg = "Cannot process SDNR Request : messageType is null";
+            exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg);
+        }
+
+        String timeout = (String) execution.getVariable("timeout");
+        if (isBlank(timeout)) {
+            timeout = UrnPropertiesReader.getVariable("sdnc.dmaap.callback.timeout", execution);
+            if (isBlank(timeout)) {
+                logger.debug("Setting SDNR timeout to default : PT30M");
+                timeout = "PT30M";
+            }
+        }
+        logger.debug("Async Callback Timeout will be: " + timeout);
+        String msg = (String) execution.getVariable("sdnrRequest");
+        logger.debug("msg to be sent on dmaap " + msg);
+        sdnrDmaapPublisher.get().send(msg);
+
+    }
+}
+
+
index f0b1bfe..7509233 100644 (file)
 
 package org.onap.so.bpmn.common.scripts
 
-import org.camunda.bpm.engine.delegate.DelegateExecution
+import static org.junit.Assert.assertEquals
+import static org.junit.Assert.assertTrue
+import static org.mockito.ArgumentMatchers.any
+import static org.mockito.Mockito.atLeastOnce
+import static org.mockito.Mockito.mock
+import static org.mockito.Mockito.spy
+import static org.mockito.Mockito.verify
+import static org.mockito.Mockito.when
+import javax.ws.rs.core.UriBuilder
 import org.junit.Before
 import org.junit.Ignore
 import org.junit.Test
-import org.mockito.Mockito
 import org.mockito.internal.stubbing.answers.DoesNothing
 import org.onap.aai.domain.yang.AllottedResource
 import org.onap.aaiclient.client.aai.AAIObjectType
 import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
 import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
 import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
-import javax.ws.rs.core.UriBuilder
-import static org.junit.Assert.assertEquals
-import static org.junit.Assert.assertTrue
-import static org.mockito.ArgumentMatchers.any
-import static org.mockito.ArgumentMatchers.anyObject
-import static org.mockito.ArgumentMatchers.isA
-import static org.mockito.Mockito.atLeastOnce
-import static org.mockito.Mockito.doNothing
-import static org.mockito.Mockito.doThrow
-import static org.mockito.Mockito.mock
-import static org.mockito.Mockito.spy
-import static org.mockito.Mockito.verify
-import static org.mockito.Mockito.when
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types
 
 
 class AllottedResourceUtilsTest extends MsoGroovyTest{
@@ -67,7 +63,7 @@ class AllottedResourceUtilsTest extends MsoGroovyTest{
         expectedAllottedResource.setId("ID")
         expectedAllottedResource.setResourceVersion("1.2")
         when(client.get(any(AAIResourceUri.class))).thenReturn(new AAIResultWrapper(expectedAllottedResource))
-        AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.ALLOTTED_RESOURCE, allottedResourceId)
+        AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(Types.ALLOTTED_RESOURCE.getFragment(allottedResourceId))
         when(allottedResourceUtils.setExecutionVariables(mockExecution,expectedAllottedResource,resourceUri)).thenAnswer(new DoesNothing())
         boolean allottedResource = allottedResourceUtils.ifExistsAR(mockExecution,allottedResourceId)
         assertTrue(allottedResource)
@@ -79,7 +75,7 @@ class AllottedResourceUtilsTest extends MsoGroovyTest{
 
         AllottedResource expectedAllottedResource = new AllottedResource()
         expectedAllottedResource.setId("ID")
-        AAIResourceUri uri = AAIUriFactory.createResourceFromExistingURI(AAIObjectType.ALLOTTED_RESOURCE, UriBuilder.fromPath(ALLOTTED_RESOURSE_URI).build())
+        AAIResourceUri uri = AAIUriFactory.createResourceFromExistingURI(Types.ALLOTTED_RESOURCE, UriBuilder.fromPath(ALLOTTED_RESOURSE_URI).build())
         when(client.get(AllottedResource.class, uri)).thenReturn(Optional.of(expectedAllottedResource))
         Optional<AllottedResource> allottedResource = allottedResourceUtils.getARbyLink(mockExecution, ALLOTTED_RESOURSE_URI,"")
         assertEquals(expectedAllottedResource.getId(),allottedResource.get().getId())
index 8a80d79..df4d371 100644 (file)
 
 package org.onap.so.bpmn.common.scripts
 
+import static org.assertj.core.api.Assertions.catchThrowableOfType
+import static org.junit.Assert.assertEquals
+import static org.junit.Assert.assertFalse
+import static org.junit.Assert.assertTrue
+import static org.mockito.Mockito.spy
+import static org.mockito.Mockito.when
+import javax.ws.rs.core.UriBuilder
 import org.camunda.bpm.engine.delegate.BpmnError
 import org.camunda.bpm.engine.delegate.DelegateExecution
 import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake
@@ -31,29 +38,18 @@ import org.mockito.Mock
 import org.mockito.MockitoAnnotations
 import org.onap.aai.domain.yang.RelationshipList
 import org.onap.aai.domain.yang.VolumeGroup
-import org.onap.so.bpmn.common.scripts.ConfirmVolumeGroupName
-import org.onap.so.bpmn.common.scripts.ConfirmVolumeGroupNameFactory
-import org.onap.so.bpmn.common.scripts.ExceptionUtil
-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.constants.Defaults
 import org.springframework.http.HttpStatus
 
-import javax.ws.rs.core.UriBuilder
-
-import static org.assertj.core.api.Assertions.catchThrowableOfType
-import static org.junit.Assert.assertEquals
-import static org.junit.Assert.assertFalse
-import static org.junit.Assert.assertTrue
-import static org.mockito.Mockito.spy
-import static org.mockito.Mockito.when
-
 class ConfirmVolumeGroupNameTest {
 
     private static final AAIResourceUri RESOURCE_URI = AAIUriFactory.createResourceFromExistingURI(
-            AAIObjectType.VOLUME_GROUP, UriBuilder.fromPath('/aai/test/volume-groups/volume-group/testVolumeGroup').build())
+            Types.VOLUME_GROUP, UriBuilder.fromPath('/aai/test/volume-groups/volume-group/testVolumeGroup').build())
 
     private ConfirmVolumeGroupName confirmVolumeGroupName
     @Mock
@@ -79,7 +75,7 @@ class ConfirmVolumeGroupNameTest {
         String volumeGroupId = "volume-group-id-1"
         String volumeGroupName = "volume-group-name-1"
         String aicCloudRegion = "aic-cloud-region-1"
-        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, Defaults.CLOUD_OWNER, aicCloudRegion, volumeGroupId)
+        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(Defaults.CLOUD_OWNER.toString(), aicCloudRegion).volumeGroup(volumeGroupId))
 
         delegateExecution.setVariable("ConfirmVolumeGroupName_volumeGroupId", volumeGroupId)
         delegateExecution.setVariable("ConfirmVolumeGroupName_volumeGroupName", volumeGroupName)
index cd57434..3b7179d 100644 (file)
@@ -40,6 +40,8 @@ import org.onap.aaiclient.client.aai.AAIObjectType
 import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
 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.constants.Defaults
 
 class ConfirmVolumeGroupTenantTest extends MsoGroovyTest {
@@ -79,7 +81,7 @@ class ConfirmVolumeGroupTenantTest extends MsoGroovyTest {
         when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8')
         when(mockExecution.getVariable("mso.workflow.default.aai.v8.cloud-region.uri")).thenReturn('/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner')
         when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/')
-        AAIResourceUri arURI = AAIUriFactory. createResourceUri(AAIObjectType.VOLUME_GROUP, Defaults.CLOUD_OWNER.toString(), "aicCloudRegionId","volumeGroupId")
+        AAIResourceUri arURI = AAIUriFactory. createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(Defaults.CLOUD_OWNER.toString(), "aicCloudRegionId").volumeGroup("volumeGroupId"))
         AAIResultWrapper wrapper = new AAIResultWrapper(expectedVolumeGroup)
         when(client.get(arURI)).thenReturn(wrapper)
         confirmVolumeGroupTenant.preProcessRequest(mockExecution)
index 4f36aec..cd9061c 100644 (file)
@@ -31,6 +31,8 @@ import org.mockito.Spy
 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
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types
 import org.onap.so.constants.Defaults
 
 class CreateAAIVfModuleVolumeGroupTest extends MsoGroovyTest{
@@ -50,7 +52,7 @@ class CreateAAIVfModuleVolumeGroupTest extends MsoGroovyTest{
         when(mockExecution.getVariable("CAAIVfModVG_vfModuleId")).thenReturn("VfModule123")
         org.onap.aai.domain.yang.VfModule vfModuleExpected = new  org.onap.aai.domain.yang.VfModule()
         vfModuleExpected.setVfModuleId("VfModule123")
-        AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, "Vnf123", "VfModule123");
+        AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("Vnf123").vfModule("VfModule123"));
         when(client.get(org.onap.aai.domain.yang.VfModule.class,resourceUri)).thenReturn(Optional.of(vfModuleExpected))
         createAAIVfModuleVolumeGroup.getVfModule(mockExecution)
         Mockito.verify(mockExecution).setVariable("CAAIVfModVG_getVfModuleResponseCode", 200)
@@ -61,7 +63,7 @@ class CreateAAIVfModuleVolumeGroupTest extends MsoGroovyTest{
     void testGetVfModuleNotFound (){
         when(mockExecution.getVariable("CAAIVfModVG_vnfId")).thenReturn("Vnf123")
         when(mockExecution.getVariable("CAAIVfModVG_vfModuleId")).thenReturn("VfModule123")
-        AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, "Vnf123", "VfModule123");
+        AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("Vnf123").vfModule("VfModule123"));
         when(client.get(org.onap.aai.domain.yang.VfModule.class,resourceUri)).thenReturn(Optional.empty())
         createAAIVfModuleVolumeGroup.getVfModule(mockExecution)
         Mockito.verify(mockExecution).setVariable("CAAIVfModVG_getVfModuleResponseCode", 404)
@@ -72,7 +74,7 @@ class CreateAAIVfModuleVolumeGroupTest extends MsoGroovyTest{
     void testGetVfModuleException (){
         when(mockExecution.getVariable("CAAIVfModVG_vnfId")).thenReturn("Vnf123")
         when(mockExecution.getVariable("CAAIVfModVG_vfModuleId")).thenReturn("VfModule123")
-        AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, "Vnf123", "VfModule123");
+        AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("Vnf123").vfModule("VfModule123"));
         when(client.get(org.onap.aai.domain.yang.VfModule.class,resourceUri)).thenThrow(new NullPointerException("Error in AAI client"))
         createAAIVfModuleVolumeGroup.getVfModule(mockExecution)
         Mockito.verify(mockExecution).setVariable("CAAIVfModVG_getVfModuleResponseCode", 500)
@@ -90,8 +92,8 @@ class CreateAAIVfModuleVolumeGroupTest extends MsoGroovyTest{
         vfModuleExpected.setVfModuleId("VfModule123")
         vfModuleExpected.setResourceVersion("12345")
         when(mockExecution.getVariable("CAAIVfModVG_getVfModuleResponse")).thenReturn(vfModuleExpected)
-        AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, "Vnf123", "VfModule123");
-        AAIResourceUri resourceUri1 = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, Defaults.CLOUD_OWNER.toString(),"CloudRegion1", "VolumeGroup1")
+        AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("Vnf123").vfModule("VfModule123"));
+        AAIResourceUri resourceUri1 = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(Defaults.CLOUD_OWNER.toString(), "CloudRegion1").volumeGroup("VolumeGroup1"))
         doNothing().when(client).connect(resourceUri ,resourceUri1 )
         createAAIVfModuleVolumeGroup.updateVfModule(mockExecution)
         Mockito.verify(mockExecution).setVariable("CAAIVfModVG_updateVfModuleResponseCode", 200)
@@ -109,8 +111,8 @@ class CreateAAIVfModuleVolumeGroupTest extends MsoGroovyTest{
         vfModuleExpected.setResourceVersion("12345")
         when(mockExecution.getVariable("CAAIVfModVG_cloudOwner")).thenReturn("cloudOwner")
         when(mockExecution.getVariable("CAAIVfModVG_getVfModuleResponse")).thenReturn(vfModuleExpected)
-        AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, "Vnf123", "VfModule123");
-        AAIResourceUri resourceUri1 = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, 'cloudOwner',"CloudRegion1", "VolumeGroup1")
+        AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("Vnf123").vfModule("VfModule123"));
+        AAIResourceUri resourceUri1 = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion('cloudOwner', "CloudRegion1").volumeGroup("VolumeGroup1"))
         doThrow(new NullPointerException("Error in AAI client")).when(client).connect(resourceUri ,resourceUri1 )
         createAAIVfModuleVolumeGroup.updateVfModule(mockExecution)
         Mockito.verify(mockExecution).setVariable("CAAIVfModVG_updateVfModuleResponseCode", 500)
index c8eeb0a..77e4374 100644 (file)
@@ -31,16 +31,15 @@ import org.junit.rules.ExpectedException
 import org.junit.runner.RunWith
 import org.mockito.junit.MockitoJUnitRunner
 import org.onap.aai.domain.yang.GenericVnf
-import org.onap.so.bpmn.mock.FileUtil
-import org.onap.so.client.HttpClient
-import org.onap.aaiclient.client.aai.AAIObjectPlurals
-import org.onap.aaiclient.client.aai.AAIObjectType
 import org.onap.aaiclient.client.aai.AAIResourcesClient
 import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
 import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri
 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.uri.Depth
+import org.onap.so.bpmn.mock.FileUtil
+import org.onap.so.client.HttpClient
 import org.onap.so.constants.Defaults
 
 @RunWith(MockitoJUnitRunner.Silent.class)
@@ -111,8 +110,8 @@ abstract class MsoGroovyTest {
     }
        
     protected Optional<GenericVnf> mockAAIGenericVnf(String vnfId,String file){
-        AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
-        AAIResourceUri resourceUriDepthOne = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId).depth(Depth.ONE)
+        AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId))
+        AAIResourceUri resourceUriDepthOne = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)).depth(Depth.ONE)
         Optional<GenericVnf> genericVnf = getAAIObjectFromJson(GenericVnf.class,file);
         when(client.get(GenericVnf.class, resourceUri)).thenReturn(genericVnf)
         when(client.get(GenericVnf.class, resourceUriDepthOne)).thenReturn(genericVnf)
@@ -120,8 +119,8 @@ abstract class MsoGroovyTest {
     }
 
     protected Optional<GenericVnf> mockAAIGenericVnfByName(String vnfName){
-        AAIPluralResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", vnfName)
-        AAIPluralResourceUri resourceUriDepthOne = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", vnfName).depth(Depth.ONE)
+        AAIPluralResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnfs()).queryParam("vnf-name", vnfName)
+        AAIPluralResourceUri resourceUriDepthOne = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnfs()).queryParam("vnf-name", vnfName).depth(Depth.ONE)
         Optional<GenericVnf> genericVnf = getAAIObjectFromJson(GenericVnf.class,"__files/aai/GenericVnf.json");
         when(client.get(GenericVnf.class, resourceUri)).thenReturn(genericVnf)
         when(client.get(GenericVnf.class, resourceUriDepthOne)).thenReturn(genericVnf)
@@ -129,21 +128,21 @@ abstract class MsoGroovyTest {
     }
 
     protected void mockAAIGenericVnfNotFound(String vnfId){
-        AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId).depth(Depth.ONE)
-        AAIResourceUri resourceUriDepthOne = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId).depth(Depth.ONE)
+        AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)).depth(Depth.ONE)
+        AAIResourceUri resourceUriDepthOne = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)).depth(Depth.ONE)
         when(client.get(GenericVnf.class, resourceUri)).thenReturn(Optional.empty())
         when(client.get(GenericVnf.class, resourceUriDepthOne)).thenReturn(Optional.empty())
     }
 
     protected void mockAAIGenericVnfByNameNotFound(String vnfName){
-        AAIPluralResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", vnfName)
-        AAIPluralResourceUri resourceUriDepthOne = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", vnfName).depth(Depth.ONE)
+        AAIPluralResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnfs()).queryParam("vnf-name", vnfName)
+        AAIPluralResourceUri resourceUriDepthOne = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnfs()).queryParam("vnf-name", vnfName).depth(Depth.ONE)
         when(client.get(GenericVnf.class, resourceUri)).thenReturn(Optional.empty())
         when(client.get(GenericVnf.class, resourceUriDepthOne)).thenReturn(Optional.empty())
     }
 
     protected AAIResultWrapper mockVolumeGroupWrapper(String region, String volumeGroupId, String file){
-        AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP,CLOUD_OWNER, region,volumeGroupId)
+        AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(CLOUD_OWNER, region).volumeGroup(volumeGroupId))
         String json = FileUtil.readResourceFile(file)
         AAIResultWrapper resultWrapper = new AAIResultWrapper(json)
         when(client.get(resourceUri)).thenReturn(resultWrapper)
index 1918d10..94317f4 100644 (file)
@@ -38,6 +38,8 @@ import org.mockito.Spy
 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
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types
 import org.onap.aai.domain.yang.VfModule
 
 import com.github.tomakehurst.wiremock.junit.WireMockRule
@@ -67,7 +69,7 @@ class UpdateAAIVfModuleTest  extends MsoGroovyTest {
         when(mockExecution.getVariable(prefix + "vfModuleId")).thenReturn("supercool")
         VfModule vfModule = new VfModule()
         vfModule.setVfModuleId("supercool")
-        AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, "skask", "supercool");
+        AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("skask").vfModule("supercool"));
         when(client.get(VfModule.class,resourceUri)).thenReturn(Optional.of(vfModule))
         updateAAIVfModule.getVfModule(mockExecution)
         verify(mockExecution).setVariable(prefix + "getVfModuleResponseCode", 200)
@@ -79,7 +81,7 @@ class UpdateAAIVfModuleTest  extends MsoGroovyTest {
         when(mockExecution.getVariable("prefix")).thenReturn(prefix)
         when(mockExecution.getVariable(prefix + "vnfId")).thenReturn("skask")
         when(mockExecution.getVariable(prefix + "vfModuleId")).thenReturn("supercool")
-        AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, "skask", "supercool");
+        AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("skask").vfModule("supercool"));
         when(client.get(VfModule.class,resourceUri)).thenReturn(Optional.empty())
         updateAAIVfModule.getVfModule(mockExecution)
         verify(mockExecution).setVariable(prefix + "getVfModuleResponseCode", 404)
@@ -91,7 +93,7 @@ class UpdateAAIVfModuleTest  extends MsoGroovyTest {
         when(mockExecution.getVariable("prefix")).thenReturn(prefix)
         when(mockExecution.getVariable(prefix + "vnfId")).thenReturn("skask")
         when(mockExecution.getVariable(prefix + "vfModuleId")).thenReturn("supercool")
-        AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, "skask", "supercool");
+        AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("skask").vfModule("supercool"));
         when(client.get(VfModule.class,resourceUri)).thenThrow(new NullPointerException("Error from AAI client"))
         updateAAIVfModule.getVfModule(mockExecution)
         verify(mockExecution).setVariable(prefix + "getVfModuleResponseCode", 500)
index 4755e58..9195df0 100644 (file)
@@ -39,12 +39,12 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.NetworkPolicy;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.OwningEntity;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.Project;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTableReference;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
@@ -80,6 +80,7 @@ import org.onap.so.db.catalog.beans.VnfcCustomization;
 import org.onap.so.serviceinstancebeans.CloudConfiguration;
 import org.onap.so.serviceinstancebeans.RequestDetails;
 import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.databind.DeserializationFeature;
 import com.fasterxml.jackson.databind.JsonMappingException;
 import com.fasterxml.jackson.databind.ObjectMapper;
 
@@ -87,10 +88,11 @@ public class BBInputSetupMapperLayerTest {
 
     BBInputSetupMapperLayer bbInputSetupMapperLayer = new BBInputSetupMapperLayer();
 
-    ObjectMapper mapper = new ObjectMapper();
+    ObjectMapper mapper = new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 
     private static final String RESOURCE_PATH = "src/test/resources/__files/ExecuteBuildingBlock/";
 
+
     @Test
     public void testMapOrchestrationStatusFromAAI() {
         OrchestrationStatus expected = OrchestrationStatus.INVENTORIED;
index dd79d27..127253a 100644 (file)
@@ -59,7 +59,6 @@ import org.mockito.Mockito;
 import org.mockito.Spy;
 import org.mockito.junit.MockitoJUnitRunner;
 import org.onap.aaiclient.client.aai.AAICommonObjectMapperProvider;
-import org.onap.aaiclient.client.aai.AAIObjectType;
 import org.onap.aaiclient.client.aai.entities.AAIResultWrapper;
 import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
 import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
@@ -69,12 +68,12 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.OwningEntity;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.Project;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTableReference;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
@@ -1337,6 +1336,10 @@ public class BBInputSetupTest {
         Map<ResourceKey, String> lookupKeyMap = new HashMap<>();
         lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, "configurationId");
         String bbName = AssignFlows.FABRIC_CONFIGURATION.toString();
+
+        ServiceModel serviceModel = new ServiceModel();
+        serviceModel.setCurrentService(service);
+
         ConfigurationResourceKeys configResourceKeys = prepareConfigurationResourceKeys();
         configResourceKeys.setVnfcName(vnfcName);
         Vnfc vnfc = new Vnfc();
@@ -1348,7 +1351,8 @@ public class BBInputSetupTest {
         BBInputSetupParameter parameter = new BBInputSetupParameter.Builder().setRequestId(REQUEST_ID)
                 .setModelInfo(modelInfo).setService(service).setBbName(bbName).setServiceInstance(serviceInstance)
                 .setLookupKeyMap(lookupKeyMap).setResourceId(resourceId).setInstanceName(instanceName)
-                .setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails).build();
+                .setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails)
+                .setServiceModel(serviceModel).build();
         SPY_bbInputSetup.populateConfiguration(parameter);
         verify(SPY_bbInputSetup, times(1)).mapCatalogConfiguration(configuration, modelInfo, service,
                 configResourceKeys);
@@ -1373,6 +1377,52 @@ public class BBInputSetupTest {
                 configResourceKeys);
     }
 
+    @Test
+    public void testPopulateConfigurationReplace() throws JsonParseException, JsonMappingException, IOException {
+        String instanceName = "configurationName";
+        ModelInfo modelInfo = new ModelInfo();
+        modelInfo.setModelCustomizationUuid("72d9d1cd-f46d-447a-abdb-451d6fb05fa9");
+
+        ServiceInstance serviceInstance = new ServiceInstance();
+        Configuration configuration = new Configuration();
+        configuration.setConfigurationId("configurationId");
+        configuration.setConfigurationName("configurationName");
+        serviceInstance.getConfigurations().add(configuration);
+        String resourceId = "configurationId";
+        String vnfcName = "vnfcName";
+        // Mock service
+        Service service = mapper.readValue(
+                new File(RESOURCE_PATH + "CatalogDBService_getServiceInstanceNOAAIInput.json"), Service.class);
+        ConfigurationResourceCustomization configurationCust = new ConfigurationResourceCustomization();
+        configurationCust.setModelCustomizationUUID("72d9d1cd-f46d-447a-abdb-451d6fb05fa9");
+        service.getConfigurationCustomizations().add(configurationCust);
+        Map<ResourceKey, String> lookupKeyMap = new HashMap<>();
+        lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, "configurationId");
+        String bbName = AssignFlows.FABRIC_CONFIGURATION.toString();
+
+        ServiceModel serviceModel = new ServiceModel();
+        serviceModel.setNewService(service);
+
+        ConfigurationResourceKeys configResourceKeys = prepareConfigurationResourceKeys();
+        configResourceKeys.setVnfcName(vnfcName);
+        Vnfc vnfc = new Vnfc();
+        vnfc.setVnfcName(vnfcName);
+        RequestDetails requestDetails = mapper.readValue(
+                new File(RESOURCE_PATH + "RequestDetailsInput_withRelatedInstanceList.json"), RequestDetails.class);
+        doNothing().when(SPY_bbInputSetup).mapCatalogConfiguration(configuration, modelInfo, service,
+                configResourceKeys);
+        doReturn(vnfc).when(SPY_bbInputSetup).getVnfcToConfiguration(vnfcName);
+        BBInputSetupParameter parameter = new BBInputSetupParameter.Builder().setRequestId(REQUEST_ID)
+                .setModelInfo(modelInfo).setService(service).setBbName(bbName).setServiceInstance(serviceInstance)
+                .setLookupKeyMap(lookupKeyMap).setResourceId(resourceId).setInstanceName(instanceName)
+                .setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails)
+                .setServiceModel(serviceModel).setIsReplace(true).build();
+        SPY_bbInputSetup.populateConfiguration(parameter);
+        configResourceKeys.setVnfResourceCustomizationUUID("my-test-uuid");
+        verify(SPY_bbInputSetup, times(1)).mapCatalogConfiguration(configuration, modelInfo, service,
+                configResourceKeys);
+    }
+
     @Test
     public void testMapCatalogConfiguration() {
         ModelInfoNetwork modelInfoNetwork = new ModelInfoNetwork();
@@ -1420,6 +1470,9 @@ public class BBInputSetupTest {
         vnfc.setVnfcName(vnfcName);
         RequestDetails requestDetails = new RequestDetails();
 
+        ServiceModel serviceModel = new ServiceModel();
+        serviceModel.setCurrentService(service);
+
         CvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization =
                 new CvnfcConfigurationCustomization();
         ConfigurationResource configurationResource = new ConfigurationResource();
@@ -1432,7 +1485,8 @@ public class BBInputSetupTest {
         BBInputSetupParameter parameter = new BBInputSetupParameter.Builder().setRequestId(REQUEST_ID)
                 .setModelInfo(modelInfo).setService(service).setBbName(bbName).setServiceInstance(serviceInstance)
                 .setLookupKeyMap(lookupKeyMap).setResourceId(resourceId).setInstanceName(instanceName)
-                .setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails).build();
+                .setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails)
+                .setServiceModel(serviceModel).build();
         SPY_bbInputSetup.populateConfiguration(parameter);
         verify(SPY_bbInputSetup, times(1)).mapCatalogConfiguration(configuration, modelInfo, service,
                 configResourceKeys);
@@ -1462,6 +1516,10 @@ public class BBInputSetupTest {
         lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, "genericVnfId");
         String bbName = AssignFlows.VNF.toString();
 
+
+        ServiceModel serviceModel = new ServiceModel();
+        serviceModel.setCurrentService(service);
+
         Platform expectedPlatform = new Platform();
         LineOfBusiness expectedLineOfBusiness = new LineOfBusiness();
         String resourceId = "123";
@@ -1481,7 +1539,8 @@ public class BBInputSetupTest {
                 .setLineOfBusiness(lineOfBusiness).setService(service).setBbName(bbName)
                 .setServiceInstance(serviceInstance).setLookupKeyMap(lookupKeyMap)
                 .setRelatedInstanceList(requestDetails.getRelatedInstanceList()).setResourceId(resourceId)
-                .setVnfType(vnfType).setProductFamilyId(requestDetails.getRequestInfo().getProductFamilyId()).build();
+                .setVnfType(vnfType).setProductFamilyId(requestDetails.getRequestInfo().getProductFamilyId())
+                .setServiceModel(serviceModel).build();
         SPY_bbInputSetup.populateGenericVnf(parameter);
 
         lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, null);
@@ -1770,7 +1829,8 @@ public class BBInputSetupTest {
         expectedAAI.setRelationshipList(relationshipList);
 
         Configuration expected = new Configuration();
-        AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, "configurationId");
+        AAIResourceUri aaiResourceUri =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().configuration("configurationId"));
         AAIResultWrapper configurationWrapper =
                 new AAIResultWrapper(new AAICommonObjectMapperProvider().getMapper().writeValueAsString(expectedAAI));
 
@@ -1794,7 +1854,8 @@ public class BBInputSetupTest {
         expectedAAI.setRelationshipList(relationshipList);
 
         GenericVnf expected = new GenericVnf();
-        AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "vnfId");
+        AAIResourceUri aaiResourceUri =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("vnfId"));
         AAIResultWrapper vnfWrapper =
                 new AAIResultWrapper(new AAICommonObjectMapperProvider().getMapper().writeValueAsString(expectedAAI));
 
@@ -1824,7 +1885,7 @@ public class BBInputSetupTest {
         expectedAAI.setRelationshipList(relationshipList);
 
         Pnf expected = new Pnf();
-        AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.PNF, "pnfId");
+        AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().pnf("pnfId"));
         AAIResultWrapper pnfWrapper =
                 new AAIResultWrapper(new AAICommonObjectMapperProvider().getMapper().writeValueAsString(expectedAAI));
 
@@ -1948,7 +2009,8 @@ public class BBInputSetupTest {
         List<L3Network> l3Networks = new ArrayList<>();
         AAIResultWrapper l3NetworksWrapper =
                 new AAIResultWrapper(new AAICommonObjectMapperProvider().getMapper().writeValueAsString(expectedAAI));
-        AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, "networkId");
+        AAIResourceUri aaiResourceUri =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network("networkId"));
 
         doReturn(l3NetworksWrapper).when(SPY_bbInputSetupUtils).getAAIResourceDepthTwo(aaiResourceUri);
         doReturn(expected).when(bbInputSetupMapperLayer).mapAAIL3Network(isA(org.onap.aai.domain.yang.L3Network.class));
@@ -3362,7 +3424,7 @@ public class BBInputSetupTest {
 
         String vnfcName = "vnfcName";
         org.onap.aai.domain.yang.Configuration expectedAAI = new org.onap.aai.domain.yang.Configuration();
-        AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VNFC, vnfcName);
+        AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().vnfc(vnfcName));
         AAIResultWrapper configurationWrapper =
                 new AAIResultWrapper(new AAICommonObjectMapperProvider().getMapper().writeValueAsString(expectedAAI));
 
index b623475..c65b36a 100644 (file)
@@ -24,7 +24,6 @@ package org.onap.so.bpmn.servicedecomposition.tasks;
 
 import static com.shazam.shazamcrest.MatcherAssert.assertThat;
 import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
-import static org.hamcrest.CoreMatchers.containsString;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
@@ -65,33 +64,35 @@ import org.onap.aai.domain.yang.ServiceInstances;
 import org.onap.aai.domain.yang.VolumeGroup;
 import org.onap.aai.domain.yang.VolumeGroups;
 import org.onap.aai.domain.yang.VpnBinding;
+import org.onap.aaiclient.client.aai.AAIResourcesClient;
+import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
+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.aaiclient.client.graphinventory.entities.uri.Depth;
 import org.onap.so.bpmn.common.InjectionHelper;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription;
 import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
 import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.MultipleObjectsFoundException;
 import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.NoServiceInstanceFoundException;
-import org.onap.aaiclient.client.aai.AAIObjectPlurals;
-import org.onap.aaiclient.client.aai.AAIObjectType;
-import org.onap.aaiclient.client.aai.AAIResourcesClient;
-import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
-import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
-import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
-import org.onap.aaiclient.client.graphinventory.entities.uri.Depth;
-import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization;
 import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization;
 import org.onap.so.db.catalog.beans.Service;
+import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization;
 import org.onap.so.db.catalog.client.CatalogDbClient;
 import org.onap.so.db.request.beans.InfraActiveRequests;
 import org.onap.so.db.request.beans.RequestProcessingData;
 import org.onap.so.db.request.client.RequestsDbClient;
 import org.onap.so.serviceinstancebeans.CloudConfiguration;
 import org.onap.so.serviceinstancebeans.RequestDetails;
+import com.fasterxml.jackson.databind.DeserializationFeature;
 import com.fasterxml.jackson.databind.ObjectMapper;
 
 @RunWith(MockitoJUnitRunner.class)
 public class BBInputSetupUtilsTest {
-    protected ObjectMapper mapper = new ObjectMapper();
+    protected ObjectMapper mapper =
+            new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);;
     private static final String RESOURCE_PATH = "src/test/resources/__files/ExecuteBuildingBlock/";
 
     @InjectMocks
@@ -178,8 +179,10 @@ public class BBInputSetupUtilsTest {
         Optional<CloudRegion> expected = Optional.of(new CloudRegion());
 
         doReturn(expected).when(MOCK_aaiResourcesClient).get(CloudRegion.class,
-                AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, cloudConfig.getCloudOwner(),
-                        cloudConfig.getLcpCloudRegionId()).depth(Depth.TWO));
+                AAIUriFactory
+                        .createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+                                .cloudRegion(cloudConfig.getCloudOwner(), cloudConfig.getLcpCloudRegionId()))
+                        .depth(Depth.TWO));
 
         assertThat(bbInputSetupUtils.getCloudRegion(cloudConfig), sameBeanAs(expected.get()));
     }
@@ -207,7 +210,7 @@ public class BBInputSetupUtilsTest {
         expected.get().setId(instanceGroupId);
 
         doReturn(expected).when(MOCK_aaiResourcesClient).get(InstanceGroup.class,
-                AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroupId));
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroupId)));
 
         assertThat(bbInputSetupUtils.getAAIInstanceGroup(instanceGroupId), sameBeanAs(expected.get()));
     }
@@ -224,7 +227,7 @@ public class BBInputSetupUtilsTest {
         expected.get().setGlobalCustomerId(globalSubscriberId);
 
         doReturn(expected).when(MOCK_aaiResourcesClient).get(org.onap.aai.domain.yang.Customer.class,
-                AAIUriFactory.createResourceUri(AAIObjectType.CUSTOMER, globalSubscriberId));
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId)));
 
         assertThat(bbInputSetupUtils.getAAICustomer(globalSubscriberId), sameBeanAs(expected.get()));
     }
@@ -243,8 +246,8 @@ public class BBInputSetupUtilsTest {
 
         expected.get().setServiceType(subscriptionServiceType);
         doReturn(expected).when(MOCK_aaiResourcesClient).get(org.onap.aai.domain.yang.ServiceSubscription.class,
-                AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_SUBSCRIPTION, globalSubscriberId,
-                        subscriptionServiceType));
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId)
+                        .serviceSubscription(subscriptionServiceType)));
 
         assertThat(bbInputSetupUtils.getAAIServiceSubscription(globalSubscriberId, subscriptionServiceType),
                 sameBeanAs(expected.get()));
@@ -285,9 +288,12 @@ public class BBInputSetupUtilsTest {
         ServiceInstance expected = new ServiceInstance();
         expected.setServiceInstanceId(serviceInstanceId);
 
-        doReturn(Optional.of(expected)).when(MOCK_aaiResourcesClient).get(ServiceInstance.class, AAIUriFactory
-                .createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalCustomerId, serviceType, serviceInstanceId)
-                .depth(Depth.TWO));
+        doReturn(Optional.of(expected)).when(MOCK_aaiResourcesClient)
+                .get(ServiceInstance.class,
+                        AAIUriFactory
+                                .createResourceUri(AAIFluentTypeBuilder.business().customer(globalCustomerId)
+                                        .serviceSubscription(serviceType).serviceInstance(serviceInstanceId))
+                                .depth(Depth.TWO));
 
         assertThat(bbInputSetupUtils.getAAIServiceInstanceByIdAndCustomer(globalCustomerId, serviceType,
                 serviceInstanceId), sameBeanAs(expected));
@@ -319,8 +325,8 @@ public class BBInputSetupUtilsTest {
         serviceInstances.getServiceInstance().add(expectedServiceInstance);
 
         AAIPluralResourceUri expectedUri = AAIUriFactory
-                .createResourceUri(AAIObjectPlurals.SERVICE_INSTANCE, customer.getGlobalCustomerId(),
-                        customer.getServiceSubscription().getServiceType())
+                .createResourceUri(AAIFluentTypeBuilder.business().customer(customer.getGlobalCustomerId())
+                        .serviceSubscription(customer.getServiceSubscription().getServiceType()).serviceInstances())
                 .queryParam("service-instance-name", serviceInstanceName).depth(Depth.TWO);
         bbInputSetupUtils.getAAIServiceInstanceByName(serviceInstanceName, customer);
 
@@ -401,14 +407,15 @@ public class BBInputSetupUtilsTest {
                 mapper.readValue(new File(RESOURCE_PATH + "aaiGenericVnfInput.json"), GenericVnf.class);
 
         doReturn(Optional.of(expectedAaiVnf)).when(MOCK_aaiResourcesClient).get(isA(Class.class),
-                eq(AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId).depth(Depth.ONE)));
+                eq(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)).depth(Depth.ONE)));
 
         assertThat(bbInputSetupUtils.getAAIGenericVnf(vnfId), sameBeanAs(expectedAaiVnf));
     }
 
     @Test
     public void getAAIResourceDepthOneTest() {
-        AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "anyVnfId");
+        AAIResourceUri aaiResourceUri =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("anyVnfId"));
         AAIResourceUri expectedUri = aaiResourceUri.clone().depth(Depth.ONE);
         AAIResourceUri aaiResourceUriClone = aaiResourceUri.clone();
 
@@ -420,7 +427,8 @@ public class BBInputSetupUtilsTest {
 
     @Test
     public void getAAIResourceDepthTwoTest() {
-        AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "anyVnfId");
+        AAIResourceUri aaiResourceUri =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("anyVnfId"));
         AAIResourceUri expectedUri = aaiResourceUri.clone().depth(Depth.TWO);
         AAIResourceUri aaiResourceUriClone = aaiResourceUri.clone();
 
@@ -515,8 +523,8 @@ public class BBInputSetupUtilsTest {
         vnf.setVnfId(vnfId);
         vnf.setVnfName(vnfName);
         doReturn(Optional.of(vnf)).when(MOCK_aaiResourcesClient).getOne(GenericVnfs.class, GenericVnf.class,
-                AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId)
-                        .relatedTo(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", vnfName));
+                AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId))
+                        .relatedTo(Types.GENERIC_VNFS.getFragment()).queryParam("vnf-name", vnfName));
         Optional<GenericVnf> actual =
                 this.bbInputSetupUtils.getRelatedVnfByNameFromServiceInstance(serviceInstanceId, vnfName);
         assertTrue(actual.isPresent());
@@ -544,8 +552,8 @@ public class BBInputSetupUtilsTest {
         volumeGroup.setVolumeGroupId(volumeGroupId);
         volumeGroup.setVolumeGroupName(volumeGroupName);
         doReturn(Optional.of(volumeGroup)).when(MOCK_aaiResourcesClient).getOne(VolumeGroups.class, VolumeGroup.class,
-                AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
-                        .relatedTo(AAIObjectPlurals.VOLUME_GROUP).queryParam("volume-group-name", volumeGroupName));
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId))
+                        .relatedTo(Types.VOLUME_GROUPS.getFragment()).queryParam("volume-group-name", volumeGroupName));
         Optional<VolumeGroup> actual =
                 this.bbInputSetupUtils.getRelatedVolumeGroupByNameFromVnf(vnfId, volumeGroupName);
         assertEquals(volumeGroup.getVolumeGroupId(), actual.get().getVolumeGroupId());
@@ -571,8 +579,10 @@ public class BBInputSetupUtilsTest {
         volumeGroup.setVolumeGroupId("id123");
         volumeGroup.setVolumeGroupName("name123");
         doReturn(Optional.of(volumeGroup)).when(MOCK_aaiResourcesClient).getOne(VolumeGroups.class, VolumeGroup.class,
-                AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, "vnf-id123", "vf-module-id123")
-                        .relatedTo(AAIObjectPlurals.VOLUME_GROUP)
+                AAIUriFactory
+                        .createResourceUri(
+                                AAIFluentTypeBuilder.network().genericVnf("vnf-id123").vfModule("vf-module-id123"))
+                        .relatedTo(Types.VOLUME_GROUPS.getFragment())
                         .queryParam("volume-group-name", "volume-group-name123"));
         Optional<VolumeGroup> actual = this.bbInputSetupUtils.getRelatedVolumeGroupByNameFromVfModule("vnf-id123",
                 "vf-module-id123", "volume-group-name123");
@@ -619,8 +629,10 @@ public class BBInputSetupUtilsTest {
         VolumeGroup volumeGroup = new VolumeGroup();
         volumeGroup.setVolumeGroupId("id123");
         doReturn(Optional.of(volumeGroup)).when(MOCK_aaiResourcesClient).getOne(VolumeGroups.class, VolumeGroup.class,
-                AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, "vnf-id123", "vf-module-id123")
-                        .relatedTo(AAIObjectPlurals.VOLUME_GROUP));
+                AAIUriFactory
+                        .createResourceUri(
+                                AAIFluentTypeBuilder.network().genericVnf("vnf-id123").vfModule("vf-module-id123"))
+                        .relatedTo(Types.VOLUME_GROUPS.getFragment()));
         Optional<VolumeGroup> actual =
                 this.bbInputSetupUtils.getRelatedVolumeGroupFromVfModule("vnf-id123", "vf-module-id123");
         assertTrue(actual.isPresent());
@@ -678,8 +690,8 @@ public class BBInputSetupUtilsTest {
         configuration.setConfigurationId("id123");
         doReturn(Optional.of(configuration)).when(MOCK_aaiResourcesClient).getOne(Configurations.class,
                 Configuration.class,
-                AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, "service-instance-id123")
-                        .relatedTo(AAIObjectPlurals.CONFIGURATION)
+                AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment("service-instance-id123"))
+                        .relatedTo(Types.CONFIGURATIONS.getFragment())
                         .queryParam("configuration-name", "configuration-name123"));
         Optional<Configuration> actual = this.bbInputSetupUtils
                 .getRelatedConfigurationByNameFromServiceInstance("service-instance-id123", "configuration-name123");
@@ -689,8 +701,8 @@ public class BBInputSetupUtilsTest {
 
     @Test
     public void existsAAIVfModuleGloballyByNameTest() {
-        AAIPluralResourceUri expectedUri =
-                AAIUriFactory.createNodesUri(AAIObjectPlurals.VF_MODULE).queryParam("vf-module-name", "testVfModule");
+        AAIPluralResourceUri expectedUri = AAIUriFactory.createNodesUri(Types.VF_MODULES.getFragment())
+                .queryParam("vf-module-name", "testVfModule");
         bbInputSetupUtils.existsAAIVfModuleGloballyByName("testVfModule");
 
         verify(MOCK_aaiResourcesClient, times(1)).exists(expectedUri);
@@ -698,8 +710,9 @@ public class BBInputSetupUtilsTest {
 
     @Test
     public void existsAAIConfigurationGloballyByNameTest() {
-        AAIPluralResourceUri expectedUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.CONFIGURATION)
-                .queryParam("configuration-name", "testConfig");
+        AAIPluralResourceUri expectedUri =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().configurations())
+                        .queryParam("configuration-name", "testConfig");
         bbInputSetupUtils.existsAAIConfigurationGloballyByName("testConfig");
 
         verify(MOCK_aaiResourcesClient, times(1)).exists(expectedUri);
@@ -707,8 +720,8 @@ public class BBInputSetupUtilsTest {
 
     @Test
     public void existsAAINetworksGloballyByNameTest() {
-        AAIPluralResourceUri expectedUri =
-                AAIUriFactory.createResourceUri(AAIObjectPlurals.L3_NETWORK).queryParam("network-name", "testNetwork");
+        AAIPluralResourceUri expectedUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Networks())
+                .queryParam("network-name", "testNetwork");
         bbInputSetupUtils.existsAAINetworksGloballyByName("testNetwork");
 
         verify(MOCK_aaiResourcesClient, times(1)).exists(expectedUri);
@@ -716,7 +729,7 @@ public class BBInputSetupUtilsTest {
 
     @Test
     public void existsAAIVolumeGroupGloballyByNameTest() {
-        AAIPluralResourceUri expectedUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VOLUME_GROUP)
+        AAIPluralResourceUri expectedUri = AAIUriFactory.createNodesUri(Types.VOLUME_GROUPS.getFragment())
                 .queryParam("volume-group-name", "testVoumeGroup");
 
         bbInputSetupUtils.existsAAIVolumeGroupGloballyByName("testVoumeGroup");
index edd214f..4d034a1 100644 (file)
@@ -23,7 +23,6 @@ package org.onap.so.bpmn.servicedecomposition.tasks;
 import static com.shazam.shazamcrest.MatcherAssert.assertThat;
 import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
 import static org.mockito.ArgumentMatchers.isA;
 import static org.mockito.Mockito.doReturn;
 import java.io.File;
@@ -38,14 +37,14 @@ import org.mockito.Mock;
 import org.mockito.Mockito;
 import org.mockito.Spy;
 import org.mockito.runners.MockitoJUnitRunner;
+import org.onap.aaiclient.client.aai.AAICommonObjectMapperProvider;
+import org.onap.aaiclient.client.aai.entities.AAIResultWrapper;
+import org.onap.aaiclient.client.aai.entities.Relationships;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
-import org.onap.aaiclient.client.aai.AAICommonObjectMapperProvider;
-import org.onap.aaiclient.client.aai.AAIObjectType;
-import org.onap.aaiclient.client.aai.entities.AAIResultWrapper;
-import org.onap.aaiclient.client.aai.entities.Relationships;
 import com.fasterxml.jackson.core.JsonParseException;
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.databind.JsonMappingException;
@@ -143,14 +142,14 @@ public class CloudInfoFromAAITest {
                 new AAIResultWrapper(new AAICommonObjectMapperProvider().getMapper().writeValueAsString(cloudRegion));
         cloudRegions.add(cloudRegionWrapper);
 
-        doReturn(cloudRegions).when(relationships).getByType(AAIObjectType.CLOUD_REGION);
+        doReturn(cloudRegions).when(relationships).getByType(Types.CLOUD_REGION);
         List<AAIResultWrapper> tenants = new ArrayList<>();
         org.onap.aai.domain.yang.Tenant tenant = new org.onap.aai.domain.yang.Tenant();
         tenant.setTenantId(tenantId);
         AAIResultWrapper tenantWrapper =
                 new AAIResultWrapper(new AAICommonObjectMapperProvider().getMapper().writeValueAsString(tenant));
         tenants.add(tenantWrapper);
-        doReturn(tenants).when(relationships).getByType(AAIObjectType.TENANT);
+        doReturn(tenants).when(relationships).getByType(Types.TENANT);
 
         Optional<CloudRegion> actual = SPY_CloudInfoFromAAI.getRelatedCloudRegionAndTenant(relationships);
 
index e05a3bd..fff495f 100644 (file)
@@ -34,14 +34,14 @@ import org.mockito.Mock;
 import org.mockito.Mockito;
 import org.mockito.Spy;
 import org.onap.aai.domain.yang.Vserver;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types;
+import org.onap.aaiclient.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
 import org.onap.so.BaseTest;
 import org.onap.so.bpmn.common.DelegateExecutionImpl;
 import org.onap.so.bpmn.core.WorkflowException;
 import org.onap.so.bpmn.mock.FileUtil;
 import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
 import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
-import org.onap.aaiclient.client.aai.AAIObjectType;
-import org.onap.aaiclient.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
 import org.onap.so.objects.audit.AAIObjectAudit;
 import org.onap.so.objects.audit.AAIObjectAuditList;
 import org.springframework.beans.BeanUtils;
@@ -71,7 +71,7 @@ public class ExceptionBuilderTest extends BaseTest {
         auditList.setAuditType("create");
         auditList.setHeatStackName("testStackName");
         AAIObjectAudit vserver = new AAIObjectAudit();
-        vserver.setAaiObjectType(AAIObjectType.VSERVER.typeName());
+        vserver.setAaiObjectType(Types.VSERVER.typeName());
         vserver.setDoesObjectExist(false);
         Vserver vs = new Vserver();
         vs.setVserverId("testVServerId");
index bb1612b..cad8b91 100644 (file)
                                "modelUuid":"modelUUID"
                        }
                }
+       },
+       {
+               "relatedInstance":{
+                       "instanceId":"instanceId",      
+                       "modelInfo": {
+                               "modelType": "vnf",
+                               "modelCustomizationId": "my-test-uuid"
+                       }
+               }
        }]
 }
index 9b32a4c..0360c10 100644 (file)
@@ -71,8 +71,7 @@
        },
        "aggregateRoutes": {
                "aggregateRoute": [
-                       {
-                               "routeId": "routeId",
+                       {                               
                                "networkStartAddress": "10.80.12.0",
                                "cidrMask": "23",
                                "ipVersion": "4"
@@ -80,4 +79,4 @@
                ]
        },
        "relationshipList": null
-}
\ No newline at end of file
+}
index f65fe17..7c83df9 100644 (file)
@@ -53,8 +53,7 @@
                }
        ],
        "aggregate-routes": [
-               {
-                       "route-id": "routeId",
+               {                       
                        "network-start-address": "10.80.12.0",
                        "cidr-mask": "23",
                        "ip-version": "4"
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CnfAdapterBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CnfAdapterBB.bpmn
new file mode 100644 (file)
index 0000000..6cd2c20
--- /dev/null
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0">
+  <bpmn:process id="Process_1" isExecutable="true">
+    <bpmn:startEvent id="StartEvent_1">
+      <bpmn:outgoing>SequenceFlow_0xb4elc</bpmn:outgoing>
+    </bpmn:startEvent>
+    <bpmn:endEvent id="EndEvent_1ee5kqt">
+      <bpmn:incoming>SequenceFlow_0lc785k</bpmn:incoming>
+    </bpmn:endEvent>
+    <bpmn:sequenceFlow id="SequenceFlow_0xb4elc" sourceRef="StartEvent_1" targetRef="Task_0amo55n" />
+    <bpmn:sequenceFlow id="SequenceFlow_0lc785k" sourceRef="Task_0amo55n" targetRef="EndEvent_1ee5kqt" />
+    <bpmn:serviceTask id="Task_0amo55n" name="Call CnfAdapter" camunda:expression="${CnfAdapter.callCnfAdapter(execution)}">
+      <bpmn:incoming>SequenceFlow_0xb4elc</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0lc785k</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:subProcess id="SubProcess_12ghmoa" name="Java Exception Handling Sub Process" triggeredByEvent="true">
+      <bpmn:startEvent id="StartEvent_1pwqeib" name="error">
+        <bpmn:outgoing>SequenceFlow_0hqxgyk</bpmn:outgoing>
+        <bpmn:errorEventDefinition errorRef="Error_0oqb77k" camunda:errorCodeVariable="BPMN_javaExpCode" camunda:errorMessageVariable="BPMN_javaExpMsg" />
+      </bpmn:startEvent>
+      <bpmn:endEvent id="EndEvent_1ysk6aa">
+        <bpmn:incoming>SequenceFlow_0hqxgyk</bpmn:incoming>
+      </bpmn:endEvent>
+      <bpmn:sequenceFlow id="SequenceFlow_0hqxgyk" sourceRef="StartEvent_1pwqeib" targetRef="EndEvent_1ysk6aa" />
+    </bpmn:subProcess>
+  </bpmn:process>
+  <bpmn:error id="Error_0oqb77k" name="java.lang.Exception" errorCode="java.lang.Exception" />
+  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1">
+      <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
+        <dc:Bounds x="173" y="102" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="EndEvent_1ee5kqt_di" bpmnElement="EndEvent_1ee5kqt">
+        <dc:Bounds x="636" y="102" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="654" y="142" width="0" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_0xb4elc_di" bpmnElement="SequenceFlow_0xb4elc">
+        <di:waypoint xsi:type="dc:Point" x="209" y="120" />
+        <di:waypoint xsi:type="dc:Point" x="377" y="120" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="293" y="99" width="0" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0lc785k_di" bpmnElement="SequenceFlow_0lc785k">
+        <di:waypoint xsi:type="dc:Point" x="477" y="120" />
+        <di:waypoint xsi:type="dc:Point" x="636" y="120" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="556.5" y="99" width="0" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="ServiceTask_1vbkgmd_di" bpmnElement="Task_0amo55n">
+        <dc:Bounds x="377" y="80" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="SubProcess_12ghmoa_di" bpmnElement="SubProcess_12ghmoa" isExpanded="true">
+        <dc:Bounds x="225" y="284" width="404" height="165" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="StartEvent_1pwqeib_di" bpmnElement="StartEvent_1pwqeib">
+        <dc:Bounds x="340" y="350" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="346" y="393" width="26" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="EndEvent_1ysk6aa_di" bpmnElement="EndEvent_1ysk6aa">
+        <dc:Bounds x="472" y="350" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="-235" y="114" width="0" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_0hqxgyk_di" bpmnElement="SequenceFlow_0hqxgyk">
+        <di:waypoint xsi:type="dc:Point" x="376" y="368" />
+        <di:waypoint xsi:type="dc:Point" x="472" y="368" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="424" y="347" width="0" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+    </bpmndi:BPMNPlane>
+  </bpmndi:BPMNDiagram>
+</bpmn:definitions>
index 8e3bef6..1130158 100644 (file)
 
 package org.onap.so.bpmn.infrastructure.scripts
 
+import static org.apache.commons.lang3.StringUtils.isBlank
+import javax.ws.rs.NotFoundException
 import org.camunda.bpm.engine.delegate.BpmnError
 import org.camunda.bpm.engine.delegate.DelegateExecution
 import org.onap.aai.domain.yang.Relationship
 import org.onap.aai.domain.yang.RelationshipData
 import org.onap.aai.domain.yang.RelationshipList
 import org.onap.aai.domain.yang.ServiceInstance
+import org.onap.aaiclient.client.aai.AAIResourcesClient
+import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
+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.common.scripts.MsoUtils
@@ -33,19 +41,10 @@ import org.onap.so.bpmn.common.scripts.RequestDBUtil
 import org.onap.so.bpmn.core.UrnPropertiesReader
 import org.onap.so.bpmn.core.WorkflowException
 import org.onap.so.bpmn.core.json.JsonUtils
-import org.onap.aaiclient.client.aai.AAIObjectType
-import org.onap.aaiclient.client.aai.AAIResourcesClient
-import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
-import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
-import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
 import org.onap.so.db.request.beans.OperationStatus
 import org.slf4j.Logger
 import org.slf4j.LoggerFactory
 
-import javax.ws.rs.NotFoundException
-
-import static org.apache.commons.lang3.StringUtils.isBlank
-
 class ActivateCommunicationService extends AbstractServiceTaskProcessor {
 
     String Prefix="ACS_"
@@ -130,8 +129,7 @@ class ActivateCommunicationService extends AbstractServiceTaskProcessor {
 
         //check the cms status
         try {
-            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
-                    globalSubscriberId, subscriptionServiceType, serviceInstanceId)
+            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(serviceInstanceId))
 
             if (!client.exists(uri)) {
                 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service Instance was not found in aai")
@@ -394,8 +392,7 @@ class ActivateCommunicationService extends AbstractServiceTaskProcessor {
             // create service
             ServiceInstance csi = new ServiceInstance()
             csi.setOrchestrationStatus(orchestrationStatus)
-            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
-                    globalSubscriberId, subscriptionServiceType, serviceInstanceId)
+            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(serviceInstanceId))
             client.update(uri, csi)
 
         } catch (BpmnError e) {
index 334f5b4..36d579c 100644 (file)
 
 package org.onap.so.bpmn.infrastructure.scripts
 
-import com.google.gson.Gson
-import com.google.gson.reflect.TypeToken
+import static org.apache.commons.lang3.StringUtils.isBlank
+import java.lang.reflect.Type
+import javax.ws.rs.NotFoundException
 import org.camunda.bpm.engine.delegate.BpmnError
 import org.camunda.bpm.engine.delegate.DelegateExecution
 import org.onap.aai.domain.yang.*
+import org.onap.aaiclient.client.aai.AAIResourcesClient
+import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
+import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri
+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.ErrorCode
 import org.onap.so.beans.nsmf.NSSI
 import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
 import org.onap.so.bpmn.common.scripts.ExceptionUtil
@@ -32,22 +41,13 @@ import org.onap.so.bpmn.common.scripts.MsoUtils
 import org.onap.so.bpmn.common.scripts.RequestDBUtil
 import org.onap.so.bpmn.core.WorkflowException
 import org.onap.so.bpmn.core.json.JsonUtils
-import org.onap.aaiclient.client.aai.AAIObjectType
-import org.onap.aaiclient.client.aai.AAIResourcesClient
-import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
-import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
-import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
 import org.onap.so.db.request.beans.OperationStatus
-import org.onap.logging.filter.base.ErrorCode
 import org.onap.so.logger.LoggingAnchor
 import org.onap.so.logger.MessageEnum
 import org.slf4j.Logger
 import org.slf4j.LoggerFactory
-
-import javax.ws.rs.NotFoundException
-import java.lang.reflect.Type
-
-import static org.apache.commons.lang3.StringUtils.isBlank
+import com.google.gson.Gson
+import com.google.gson.reflect.TypeToken
 
 /**
  * This groovy class supports the <class>ActivateSliceService.bpmn</class> process.
@@ -248,8 +248,7 @@ class ActivateSliceService extends AbstractServiceTaskProcessor {
         String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
 
         AAIResourcesClient client = new AAIResourcesClient()
-        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
-                globalSubscriberId, subscriptionServiceType, NSIServiceId)
+        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(NSIServiceId))
         if (!client.exists(uri)) {
             exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service Instance was not found in aai")
         }
@@ -271,8 +270,7 @@ class ActivateSliceService extends AbstractServiceTaskProcessor {
                     }
                     for (String snssi : SNSSIList) {
                         AAIResourcesClient client01 = new AAIResourcesClient()
-                        AAIResourceUri uri01 = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
-                                globalSubscriberId, subscriptionServiceType, snssi)
+                        AAIResourceUri uri01 = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(snssi))
                         if (!client.exists(uri01)) {
                             exceptionUtil.buildAndThrowWorkflowException(execution, 2500,
                                     "Service Instance was not found in aai")
@@ -339,8 +337,7 @@ class ActivateSliceService extends AbstractServiceTaskProcessor {
 
         try {
             AAIResourcesClient client = new AAIResourcesClient()
-            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
-                    globalCustId, serviceType, serviceId)
+            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalCustId).serviceSubscription(serviceType).serviceInstance(serviceId))
             if (!client.exists(uri)) {
                 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service Instance was not found in aai")
             }
@@ -392,8 +389,7 @@ class ActivateSliceService extends AbstractServiceTaskProcessor {
         try {
             //get the TN NSSI id by NSI id, active NSSI TN slicing
             AAIResourcesClient client = new AAIResourcesClient()
-            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
-                    globalSubscriberId, subscriptionServiceType, NSIserviceInstanceId)
+            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(NSIserviceInstanceId))
             if (!client.exists(uri)) {
                 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service Instance was not found in aai")
             }
@@ -410,8 +406,7 @@ class ActivateSliceService extends AbstractServiceTaskProcessor {
                                 relatioshipurl.substring(relatioshipurl.lastIndexOf("/") + 1, relatioshipurl.length())
 
                         AAIResourcesClient client01 = new AAIResourcesClient()
-                        AAIResourceUri uri01 = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
-                                globalSubscriberId, subscriptionServiceType, nssiserviceid)
+                        AAIResourceUri uri01 = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(nssiserviceid))
                         if (!client.exists(uri01)) {
                             exceptionUtil.buildAndThrowWorkflowException(execution, 2500,
                                     "Service Instance was not found in aai")
@@ -477,8 +472,7 @@ class ActivateSliceService extends AbstractServiceTaskProcessor {
         try {
             try {
                 AAIResourcesClient client = new AAIResourcesClient()
-                AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
-                        globalSubscriberId, subscriptionServiceType, serviceInstanceId)
+                AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(serviceInstanceId))
                 if (!client.exists(uri)) {
                     exceptionUtil.buildAndThrowWorkflowException(execution, 2500,
                             "Service Instance was not found in aai")
@@ -516,8 +510,8 @@ class ActivateSliceService extends AbstractServiceTaskProcessor {
 
                 //get the allotted-resources by e2e slice id
                 AAIResourcesClient client_allotted = new AAIResourcesClient()
-                AAIResourceUri uri_allotted = AAIUriFactory.createResourceUri(AAIObjectType.ALLOTTED_RESOURCE_ALL,
-                        globalSubscriberId, subscriptionServiceType, serviceInstanceId)
+                AAIPluralResourceUri uri_allotted = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(serviceInstanceId).allottedResources()
+                        )
                 if (!client_allotted.exists(uri_allotted)) {
                     exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service Instance was not found in aai")
                 }
@@ -536,8 +530,7 @@ class ActivateSliceService extends AbstractServiceTaskProcessor {
                     try {
                         //get the NSI id by e2e slice id
                         AAIResourcesClient client = new AAIResourcesClient()
-                        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
-                                globalSubscriberId, subscriptionServiceType, nsiserviceid)
+                        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(nsiserviceid))
                         if (!client.exists(uri)) {
                             exceptionUtil.buildAndThrowWorkflowException(execution, 2500,
                                     "Service Instance was not found in aai")
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
new file mode 100644 (file)
index 0000000..c7fe7e3
--- /dev/null
@@ -0,0 +1,181 @@
+/*
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ # Copyright (c) 2020, Wipro Limited.
+ #
+ # Licensed under the Apache License, Version 2.0 (the "License")
+ # you may not use this file except in compliance with the License.
+ # You may obtain a copy of the License at
+ #
+ #       http://www.apache.org/licenses/LICENSE-2.0
+ #
+ # Unless required by applicable law or agreed to in writing, software
+ # distributed under the License is distributed on an "AS IS" BASIS,
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ # See the License for the specific language governing permissions and
+ # limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.scripts
+
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
+import org.onap.so.bpmn.common.scripts.ExceptionUtil
+import org.onap.so.bpmn.common.scripts.RequestDBUtil
+import org.onap.so.bpmn.core.json.JsonUtils
+import org.onap.so.db.request.beans.ResourceOperationStatus
+import org.slf4j.Logger
+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")
+       }
+       
+}
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
new file mode 100644 (file)
index 0000000..5a7722d
--- /dev/null
@@ -0,0 +1,190 @@
+/*
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ # Copyright (c) 2020, Wipro Limited.
+ #
+ # Licensed under the Apache License, Version 2.0 (the "License")
+ # you may not use this file except in compliance with the License.
+ # You may obtain a copy of the License at
+ #
+ #       http://www.apache.org/licenses/LICENSE-2.0
+ #
+ # Unless required by applicable law or agreed to in writing, software
+ # distributed under the License is distributed on an "AS IS" BASIS,
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ # See the License for the specific language governing permissions and
+ # limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.scripts
+
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
+import org.onap.so.bpmn.common.scripts.ExceptionUtil
+import org.onap.so.bpmn.common.scripts.RequestDBUtil
+import org.onap.so.bpmn.core.json.JsonUtils
+import org.onap.so.db.request.beans.ResourceOperationStatus
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+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")
+       }
+       
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/AnNssmfutils.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/AnNssmfutils.groovy
new file mode 100644 (file)
index 0000000..4108cce
--- /dev/null
@@ -0,0 +1,449 @@
+/*
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ # Copyright (c) 2020, Wipro Limited.
+ #
+ # Licensed under the Apache License, Version 2.0 (the "License")
+ # you may not use this file except in compliance with the License.
+ # You may obtain a copy of the License at
+ #
+ #       http://www.apache.org/licenses/LICENSE-2.0
+ #
+ # Unless required by applicable law or agreed to in writing, software
+ # distributed under the License is distributed on an "AS IS" BASIS,
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ # See the License for the specific language governing permissions and
+ # limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.scripts
+
+
+import com.google.gson.JsonArray
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
+import org.onap.so.bpmn.common.scripts.ExceptionUtil
+import org.onap.so.bpmn.common.scripts.NssmfAdapterUtils
+import org.onap.so.bpmn.common.scripts.OofUtils
+import org.onap.so.bpmn.common.scripts.RequestDBUtil
+import org.onap.so.bpmn.core.json.JsonUtils
+import org.onap.so.db.request.beans.ResourceOperationStatus
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+import java.sql.Timestamp
+import java.util.List
+import static org.apache.commons.lang3.StringUtils.isBlank
+import com.google.gson.JsonObject
+import com.fasterxml.jackson.databind.ObjectMapper
+import org.onap.aaiclient.client.aai.AAIObjectType
+import org.onap.aaiclient.client.aai.AAIResourcesClient
+import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
+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 javax.ws.rs.NotFoundException
+import org.onap.so.beans.nsmf.AllocateTnNssi
+import org.onap.so.beans.nsmf.DeAllocateNssi
+import org.onap.so.beans.nsmf.EsrInfo
+import org.onap.so.beans.nsmf.ServiceInfo
+import org.onap.so.bpmn.core.UrnPropertiesReader
+import org.onap.aai.domain.yang.ServiceInstance
+import org.onap.aai.domain.yang.SliceProfile
+import org.onap.aai.domain.yang.SliceProfiles
+import org.onap.aai.domain.yang.Relationship
+
+
+class AnNssmfUtils {
+
+       private static final Logger logger = LoggerFactory.getLogger(AnNssmfUtils.class)
+       ObjectMapper objectMapper = new ObjectMapper();
+       ExceptionUtil exceptionUtil = new ExceptionUtil()
+       JsonUtils jsonUtil = new JsonUtils()
+       public String buildSelectRANNSSIRequest(String requestId, String messageType, String UUID,String invariantUUID,
+               String name, Map<String, Object> profileInfo, List<String> nsstInfoList, JsonArray capabilitiesList, Boolean preferReuse){
+
+       def transactionId = requestId
+       logger.debug( "transactionId is: " + transactionId)
+       String correlator = requestId
+       String callbackUrl = UrnPropertiesReader.getVariable("mso.adapters.oof.callback.endpoint") + "/" + messageType + "/" + correlator
+       ObjectMapper objectMapper = new ObjectMapper();
+       String profileJson = objectMapper.writeValueAsString(profileInfo);
+       String nsstInfoListString = objectMapper.writeValueAsString(nsstInfoList);
+       //Prepare requestInfo object
+       JsonObject requestInfo = new JsonObject()
+       requestInfo.addProperty("transactionId", transactionId)
+       requestInfo.addProperty("requestId", requestId)
+       requestInfo.addProperty("callbackUrl", callbackUrl)
+       requestInfo.addProperty("sourceId","SO" )
+       requestInfo.addProperty("timeout", 600)
+       requestInfo.addProperty("numSolutions", 1)
+
+       //Prepare serviceInfo object
+       JsonObject ranNsstInfo = new JsonObject()
+       ranNsstInfo.addProperty("UUID", UUID)
+       ranNsstInfo.addProperty("invariantUUID", invariantUUID)
+       ranNsstInfo.addProperty("name", name)
+
+       JsonObject json = new JsonObject()
+       json.add("requestInfo", requestInfo)
+       json.add("NSTInfo", ranNsstInfo)
+       json.addProperty("serviceProfile", profileJson)
+       json.addProperty("NSSTInfo", nsstInfoListString)
+       json.add("subnetCapabilities", capabilitiesList)
+       json.addProperty("preferReuse", preferReuse)
+
+       return json.toString()
+}
+
+public String buildCreateTNNSSMFSubnetCapabilityRequest() {
+       EsrInfo esrInfo = new EsrInfo()
+       esrInfo.setNetworkType("TN")
+       esrInfo.setVendor("ONAP")
+
+       JsonArray subnetTypes = new JsonArray()
+       subnetTypes.add("TN_FH")
+       subnetTypes.add("TN_MH")
+       JsonObject response = new JsonObject()
+       response.add("subnetCapabilityQuery", subnetTypes)
+       response.addProperty("esrInfo", objectMapper.writeValueAsString(esrInfo))
+       return response.toString()
+}
+
+public String buildCreateANNFNSSMFSubnetCapabilityRequest() {
+       EsrInfo esrInfo = new EsrInfo()
+       esrInfo.setNetworkType("AN")
+       esrInfo.setVendor("ONAP")
+
+       JsonArray subnetTypes = new JsonArray()
+       subnetTypes.add("AN_NF")
+       JsonObject response = new JsonObject()
+       response.add("subnetCapabilityQuery", subnetTypes)
+       response.addProperty("esrInfo", objectMapper.writeValueAsString(esrInfo))
+       return response.toString()
+}
+public void createDomainWiseSliceProfiles(List<String> ranConstituentSliceProfiles, DelegateExecution execution) {
+       
+       for(String profile : ranConstituentSliceProfiles) {
+               String domainType = jsonUtil.getJsonValue(profile, "domainType")
+               switch(domainType) {
+                       case "AN_NF":
+                               execution.setVariable("ranNfSliceProfile", profile)
+                               break
+                       case "TN_FH":
+                               execution.setVariable("tnFhSliceProfile", profile)
+                               break
+                       case "TN_MH":
+                               execution.setVariable("tnMhSliceProfile", profile)
+                               break
+                       default:
+                               logger.debug("No expected match found for current domainType")
+                               logger.error("No expected match found for current domainType "+ domainType)
+                               exceptionUtil.buildAndThrowWorkflowException(execution, 1000,"No expected match found for current domainType "+ domainType)
+               }
+               
+       }
+}
+
+public void createSliceProfilesInAai(DelegateExecution execution) {
+       
+       org.onap.aai.domain.yang.ServiceInstance ANNF_sliceProfileInstance = new ServiceInstance();
+       org.onap.aai.domain.yang.ServiceInstance TNFH_sliceProfileInstance = new ServiceInstance();
+       org.onap.aai.domain.yang.ServiceInstance TNMH_sliceProfileInstance = new ServiceInstance();
+       //generate slice profile ids and slice profile instance ids
+       String ANNF_sliceProfileInstanceId = UUID.randomUUID().toString()
+       String ANNF_sliceProfileId = UUID.randomUUID().toString()
+       String TNFH_sliceProfileInstanceId = UUID.randomUUID().toString()
+       String TNFH_sliceProfileId = UUID.randomUUID().toString()
+       String TNMH_sliceProfileInstanceId = UUID.randomUUID().toString()
+       String TNMH_sliceProfileId = UUID.randomUUID().toString()
+       execution.setVariable("ANNF_sliceProfileInstanceId",ANNF_sliceProfileInstanceId)
+       execution.setVariable("ANNF_sliceProfileId",ANNF_sliceProfileId)
+       execution.setVariable("TNFH_sliceProfileInstanceId",TNFH_sliceProfileInstanceId)
+       execution.setVariable("TNFH_sliceProfileId",TNFH_sliceProfileId)
+       execution.setVariable("TNMH_sliceProfileInstanceId",TNMH_sliceProfileInstanceId)
+       execution.setVariable("TNMH_sliceProfileId",TNMH_sliceProfileId)
+       //slice profiles assignment
+       org.onap.aai.domain.yang.SliceProfiles ANNF_SliceProfiles = new SliceProfiles()
+       org.onap.aai.domain.yang.SliceProfiles TNFH_SliceProfiles = new SliceProfiles()
+       org.onap.aai.domain.yang.SliceProfiles TNMH_SliceProfiles = new SliceProfiles()
+       org.onap.aai.domain.yang.SliceProfile ANNF_SliceProfile = new SliceProfile()
+       org.onap.aai.domain.yang.SliceProfile TNFH_SliceProfile = new SliceProfile()
+       org.onap.aai.domain.yang.SliceProfile TNMH_SliceProfile = new SliceProfile()
+       ANNF_SliceProfile = createSliceProfile("AN-NF", execution)
+       TNFH_SliceProfile = createSliceProfile("TN-FH",execution)
+       TNMH_SliceProfile = createSliceProfile("TN-MH",execution)
+       
+       ANNF_SliceProfiles.getSliceProfile().add(ANNF_SliceProfile)
+       TNFH_SliceProfiles.getSliceProfile().add(TNFH_SliceProfile)
+       TNMH_SliceProfiles.getSliceProfile().add(TNMH_SliceProfile)
+       
+       logger.debug("sliceProfiles : 1. "+ANNF_SliceProfiles.toString()+"\n 2. "+TNFH_SliceProfiles.toString()+"\n 3. "+TNMH_SliceProfiles.toString())
+       //ANNF slice profile instance creation
+       ANNF_sliceProfileInstance.setServiceInstanceId(ANNF_sliceProfileInstanceId)
+       String sliceInstanceName = "sliceprofile_"+ANNF_sliceProfileId
+       ANNF_sliceProfileInstance.setServiceInstanceName(sliceInstanceName)
+       String serviceType = jsonUtil.getJsonValue(execution.getVariable("ranNfSliceProfile"), "sST")
+       ANNF_sliceProfileInstance.setServiceType(serviceType)
+       String serviceStatus = "deactivated"
+       ANNF_sliceProfileInstance.setOrchestrationStatus(serviceStatus)
+       String serviceInstanceLocationid = jsonUtil.getJsonValue(execution.getVariable("ranNfSliceProfile"), "plmnIdList")
+       ANNF_sliceProfileInstance.setServiceInstanceLocationId(serviceInstanceLocationid)
+       String serviceRole = "slice-profile-instance"
+       ANNF_sliceProfileInstance.setServiceRole(serviceRole)
+       List<String> snssaiList = objectMapper.readValue(execution.getVariable("snssaiList"), List.class)
+       String snssai = snssaiList.get(0)
+       ANNF_sliceProfileInstance.setEnvironmentContext(snssai)
+       ANNF_sliceProfileInstance.setWorkloadContext("AN-NF")    
+       ANNF_sliceProfileInstance.setSliceProfiles(ANNF_SliceProfiles)
+       logger.debug("completed ANNF sliceprofileinstance build "+ ANNF_sliceProfileInstance.toString())
+       //TNFH slice profile instance creation
+       TNFH_sliceProfileInstance.setServiceInstanceId(TNFH_sliceProfileInstanceId)
+       sliceInstanceName = "sliceprofile_"+TNFH_sliceProfileId
+       TNFH_sliceProfileInstance.setServiceInstanceName(sliceInstanceName)
+       serviceType = jsonUtil.getJsonValue(execution.getVariable("tnFhSliceProfile"), "sST")
+       TNFH_sliceProfileInstance.setServiceType(serviceType)
+       TNFH_sliceProfileInstance.setOrchestrationStatus(serviceStatus)
+       serviceInstanceLocationid = jsonUtil.getJsonValue(execution.getVariable("tnFhSliceProfile"), "plmnIdList")
+       TNFH_sliceProfileInstance.setServiceInstanceLocationId(serviceInstanceLocationid)
+       TNFH_sliceProfileInstance.setServiceRole(serviceRole)
+       TNFH_sliceProfileInstance.setEnvironmentContext(snssai)
+       TNFH_sliceProfileInstance.setWorkloadContext("TN-FH")
+       TNFH_sliceProfileInstance.setSliceProfiles(TNFH_SliceProfiles)
+       logger.debug("completed TNFH sliceprofileinstance build "+TNFH_sliceProfileInstance)
+       //TNMH slice profile instance creation
+       TNMH_sliceProfileInstance.setServiceInstanceId(TNMH_sliceProfileInstanceId)
+       sliceInstanceName = "sliceprofile_"+TNMH_sliceProfileId
+       TNMH_sliceProfileInstance.setServiceInstanceName(sliceInstanceName)
+       serviceType = jsonUtil.getJsonValue(execution.getVariable("tnMhSliceProfile"), "sST")
+       TNMH_sliceProfileInstance.setServiceType(serviceType)
+       TNMH_sliceProfileInstance.setOrchestrationStatus(serviceStatus)
+       serviceInstanceLocationid = jsonUtil.getJsonValue(execution.getVariable("tnMhSliceProfile"), "plmnIdList")
+       TNMH_sliceProfileInstance.setServiceInstanceLocationId(serviceInstanceLocationid)
+       TNMH_sliceProfileInstance.setServiceRole(serviceRole)
+       TNMH_sliceProfileInstance.setEnvironmentContext(snssai)
+       TNMH_sliceProfileInstance.setWorkloadContext("TN-MH")
+       TNMH_sliceProfileInstance.setSliceProfiles(TNMH_SliceProfiles)
+       logger.debug("completed TNMH sliceprofileinstance build "+TNMH_sliceProfileInstance)
+       String msg = ""
+       try {
+
+               AAIResourcesClient client = new AAIResourcesClient()
+               AAIResourceUri sliceProfileUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(ANNF_sliceProfileInstanceId))
+               client.create(sliceProfileUri, ANNF_sliceProfileInstance)
+
+               AAIResourceUri sliceProfileUri1 = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(TNFH_sliceProfileInstanceId))
+               client.create(sliceProfileUri1, TNFH_sliceProfileInstance)
+
+               AAIResourceUri sliceProfileUri2 = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(TNMH_sliceProfileInstanceId))
+               client.create(sliceProfileUri2, TNMH_sliceProfileInstance)
+
+       } catch (BpmnError e) {
+               throw e
+       } catch (Exception ex) {
+               msg = "Exception in AnNssmfUtils.createSliceProfilesInAai " + ex.getMessage()
+               logger.info(msg)
+               exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+       }
+
+}
+private SliceProfile createSliceProfile(String domainType, DelegateExecution execution) {
+
+       SliceProfile result = new SliceProfile()
+       Map<String,Object> profile
+       switch(domainType) {
+               case "AN-NF":
+                       profile = objectMapper.readValue(execution.getVariable("ranNfSliceProfile"), Map.class)//pending fields - maxBandwidth, sST, pLMNIdList, cSReliabilityMeanTime, 
+                                                                                                                                                                                                       //msgSizeByte, maxNumberofPDUSessions,overallUserDensity,transferIntervalTarget
+                       result.setJitter(profile.get("jitter"))
+                       result.setLatency(profile.get("latency"))
+                       result.setResourceSharingLevel(profile.get("resourceSharingLevel"))
+                       result.setSNssai(profile.get("sNSSAI"))
+                       result.setUeMobilityLevel(profile.get("uEMobilityLevel"))
+                       result.setMaxNumberOfUEs(profile.get("maxNumberofUEs"))
+                       result.setActivityFactor(profile.get("activityFactor"))
+                       result.setCoverageAreaTAList(profile.get("coverageAreaTAList"))
+                       result.setCsAvailability(profile.get("cSAvailabilityTarget"))
+                       result.setExpDataRateDL(profile.get("expDataRateDL"))
+                       result.setExpDataRateUL(profile.get("expDataRateUL"))
+                       result.setSurvivalTime(profile.get("survivalTime"))
+                       result.setAreaTrafficCapDL(profile.get("areaTrafficCapDL"))
+                       result.setAreaTrafficCapUL(profile.get("areaTrafficCapUL"))
+                       result.setExpDataRate(profile.get("expDataRate"))
+                       result.setProfileId(execution.getVariable("ANNF_sliceProfileId"))
+                       break
+               case "TN-FH":
+                       profile = objectMapper.readValue(execution.getVariable("tnFhSliceProfile"), Map.class) //pending fields - maxBandwidth, sST, pLMNIdList
+                       result.setJitter(profile.get("jitter"))
+                       result.setLatency(profile.get("latency"))
+                       result.setResourceSharingLevel(profile.get("resourceSharingLevel"))
+                       result.setSNssai(profile.get("sNSSAI"))
+                       result.setProfileId(execution.getVariable("TNFH_sliceProfileId"))
+                       break
+               case "TN-MH":
+                       profile = objectMapper.readValue(execution.getVariable("tnMhSliceProfile"), Map.class)//pending fields - maxBandwidth, sST, pLMNIdList
+                       result.setJitter(profile.get("jitter"))
+                       result.setLatency(profile.get("latency"))
+                       result.setResourceSharingLevel(profile.get("resourceSharingLevel"))
+                       result.setSNssai(profile.get("sNSSAI"))
+                       result.setProfileId(execution.getVariable("TNMH_sliceProfileId"))
+                       break
+               default:
+                       logger.debug("No expected match found for current domainType")
+                       logger.error("No expected match found for current domainType "+ domainType)
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 1000,"No expected match found for current domainType "+ domainType)
+       }
+       return result
+}
+
+ /**
+     * create relationship in AAI
+     */
+    public createRelationShipInAAI = { DelegateExecution execution, final Relationship relationship, String instanceId ->
+        logger.debug("createRelationShipInAAI Start")
+        String msg
+               AAIResourcesClient client = new AAIResourcesClient()
+        try {
+            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(instanceId).relationshipAPI())
+            client.create(uri, relationship)
+
+        } catch (BpmnError e) {
+            throw e
+        } catch (Exception ex) {
+            msg = "Exception in CreateCommunicationService.createRelationShipInAAI. " + ex.getMessage()
+            logger.info(msg)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+        }
+        logger.debug("createRelationShipInAAI Exit")
+
+    }
+       
+       public void processRanNfModifyRsp(DelegateExecution execution) {
+               String status = execution.getVariable("ranNfStatus")
+               if(status.equals("success")) {
+                       logger.debug("completed Ran NF NSSI modification ... proceeding with the flow")
+               }
+               else {
+                       logger.error("failed to modify ran Nf nssi")
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 1000, "modify ran nf nssi not successfull")
+               }
+       }
+       
+       public String buildCreateNSSMFRequest(DelegateExecution execution, String domainType, String action) {
+               EsrInfo esrInfo = new EsrInfo()
+               esrInfo.setNetworkType("TN")
+               esrInfo.setVendor("ONAP")
+               String esrInfoString = objectMapper.writeValueAsString(esrInfo)
+               JsonObject response = new JsonObject()
+               JsonObject allocateTnNssi = new JsonObject()
+               JsonObject serviceInfo = new JsonObject()
+               JsonArray transportSliceNetworksList  = new JsonArray()
+               JsonArray connectionLinksList = new JsonArray()
+               JsonObject connectionLinks = new JsonObject()
+               if(action.equals("allocate")){
+                       Map<String, String> endpoints
+                       if(domainType.equals("TN_FH")) {
+                               serviceInfo.addProperty("serviceInvariantUuid", execution.getVariable("TNFH_modelInvariantUuid"))
+                               serviceInfo.addProperty("serviceUuid", execution.getVariable("TNFH_modelUuid"))
+                               allocateTnNssi.addProperty("nsstId", execution.getVariable("TNFH_modelUuid"))
+                               allocateTnNssi.addProperty("nssiName", execution.getVariable("TNFH_modelName"))
+                               Map<String,Object> sliceProfile = objectMapper.readValue(execution.getVariable("tnFhSliceProfile"), Map.class)
+                               sliceProfile.put("sliceProfileId", execution.getVariable("TNFH_sliceProfileInstanceId"))
+                               String sliceProfileString = objectMapper.writeValueAsString(sliceProfile)
+                               allocateTnNssi.addProperty("sliceProfile", sliceProfileString)
+                               endpoints.put("transportEndpointA", execution.getVariable("tranportEp_ID_RU"))
+                               endpoints.put("transportEndpointB", execution.getVariable("tranportEp_ID_DUIN"))
+                               String endpointsString = objectMapper.writeValueAsString(endpoints)
+                               connectionLinksList.add(endpointsString)
+                       }else if(domainType.equals("TN_MH")) {
+                               serviceInfo.addProperty("serviceInvariantUuid", execution.getVariable("TNMH_modelInvariantUuid"))
+                               serviceInfo.addProperty("serviceUuid", execution.getVariable("TNMH_modelUuid"))
+                               allocateTnNssi.addProperty("nsstId", execution.getVariable("TNMH_modelUuid"))
+                               allocateTnNssi.addProperty("nssiName", execution.getVariable("TNMH_modelName"))
+                               Map<String,Object> sliceProfile = objectMapper.readValue(execution.getVariable("tnMhSliceProfile"), Map.class)
+                               sliceProfile.put("sliceProfileId", execution.getVariable("TNMH_sliceProfileInstanceId"))
+                               String sliceProfileString = objectMapper.writeValueAsString(sliceProfile)
+                               allocateTnNssi.addProperty("sliceProfile", sliceProfileString)
+                               endpoints.put("transportEndpointA", execution.getVariable("tranportEp_ID_DUEG"))
+                               endpoints.put("transportEndpointB", execution.getVariable("tranportEp_ID_CUIN"))
+                               String endpointsString = objectMapper.writeValueAsString(endpoints)
+                               connectionLinksList.add(endpointsString)
+                       }
+                       
+                       //Connection links
+                       connectionLinks.add("connectionLinks", connectionLinksList)
+                       transportSliceNetworksList.add(connectionLinks)
+                       allocateTnNssi.add("transportSliceNetworks", transportSliceNetworksList)
+                       allocateTnNssi.addProperty("nssiId", null)
+                       serviceInfo.addProperty("nssiId", null)
+               }else if(action.equals("modify-allocate")) {
+                       if(domainType.equals("TN_FH")) {
+                               serviceInfo.addProperty("serviceInvariantUuid", null)
+                               serviceInfo.addProperty("serviceUuid", null)
+                               allocateTnNssi.addProperty("nsstId", null)
+                               allocateTnNssi.addProperty("nssiName", execution.getVariable("TNFH_nssiName"))
+                               allocateTnNssi.addProperty("sliceProfileId", execution.getVariable("TNFH_sliceProfileInstanceId"))
+                               allocateTnNssi.addProperty("nssiId", execution.getVariable("TNFH_NSSI"))
+                               serviceInfo.addProperty("nssiId", execution.getVariable("TNFH_NSSI"))
+                       }else if(domainType.equals("TN_MH")) {
+                               serviceInfo.addProperty("serviceInvariantUuid", null)
+                               serviceInfo.addProperty("serviceUuid", null)
+                               allocateTnNssi.addProperty("nsstId", null)
+                               allocateTnNssi.addProperty("nssiName", execution.getVariable("TNMH_nssiName"))
+                               allocateTnNssi.addProperty("sliceProfileId", execution.getVariable("TNMH_sliceProfileInstanceId"))
+                               allocateTnNssi.addProperty("nssiId", execution.getVariable("TNMH_NSSI"))
+                               serviceInfo.addProperty("nssiId", execution.getVariable("TNMH_NSSI"))
+                       }
+               }
+               String nsiInfo = jsonUtil.getJsonValue(execution.getVariable("sliceParams"), "nsiInfo")
+               allocateTnNssi.addProperty("nsiInfo", nsiInfo)
+               allocateTnNssi.addProperty("scriptName", "TN1")
+               serviceInfo.addProperty("nsiId", execution.getVariable("nsiId"))
+               serviceInfo.addProperty("globalSubscriberId", execution.getVariable("globalSubscriberId"))
+               serviceInfo.addProperty("subscriptionServiceType", execution.getVariable("subscriptionServiceType"))
+               response.addProperty("esrInfo", esrInfoString)
+               response.add("serviceInfo", serviceInfo)
+               response.add("allocateTnNssi", allocateTnNssi)
+               return response.toString()
+       }
+       
+       public String buildDeallocateNssiRequest(DelegateExecution execution,String domainType) {
+               String globalSubscriberId = execution.getVariable("globalSubscriberId")
+               String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
+          
+               JsonObject deAllocateNssi = new JsonObject()
+               deAllocateNssi.addProperty("snssaiList", execution.getVariable("snssaiList"))
+               deAllocateNssi.addProperty("nsiId", execution.getVariable("nsiId"))
+               deAllocateNssi.addProperty("modifyAction", true)
+               deAllocateNssi.addProperty("terminateNssiOption", 0)
+               deAllocateNssi.addProperty("scriptName", "TN1")
+               
+               if(domainType.equals("TN_FH")) {
+                       deAllocateNssi.addProperty("nssiId", execution.getVariable("TNFH_NSSI"))
+                       deAllocateNssi.addProperty("sliceProfileId", execution.getVariable("TNFH_sliceProfileInstanceId"))
+               }else if(domainType.equals("TN_MH")) {
+                       deAllocateNssi.addProperty("nssiId", execution.getVariable("TNMH_NSSI"))
+                       deAllocateNssi.addProperty("sliceProfileId", execution.getVariable("TNMH_sliceProfileInstanceId"))
+               }
+               
+               EsrInfo esrInfo = new EsrInfo()
+               esrInfo.setVendor("ONAP")
+               esrInfo.setNetworkType("TN")
+          
+               JsonObject serviceInfo = new JsonObject()
+               serviceInfo.addProperty("serviceInvariantUuid", null)
+               serviceInfo.addProperty("serviceUuid", null)
+               serviceInfo.addProperty("globalSubscriberId", globalSubscriberId)
+               serviceInfo.addProperty("subscriptionServiceType", subscriptionServiceType)
+          
+               JsonObject json = new JsonObject()
+               json.add("deAllocateNssi", deAllocateNssi)
+               json.addProperty("esrInfo", objectMapper.writeValueAsString(esrInfo))
+               json.add("serviceInfo", serviceInfo)
+               return json.toString()
+          
+       }
+}
\ No newline at end of file
index be5a029..7b8b79f 100644 (file)
 
 package org.onap.so.bpmn.infrastructure.scripts
 
-import com.google.gson.JsonObject
+import static org.apache.commons.lang3.StringUtils.*
+import javax.ws.rs.core.Response
+import org.camunda.bpm.engine.delegate.DelegateExecution
 import org.json.JSONArray
 import org.json.JSONObject
-import org.json.XML
-import org.onap.so.bpmn.common.scripts.ExternalAPIUtilFactory
-
-import static org.apache.commons.lang3.StringUtils.*
-import groovy.xml.XmlUtil
-import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
-import org.onap.so.bpmn.common.scripts.ExceptionUtil
-import org.onap.so.bpmn.common.scripts.ExternalAPIUtil
-import org.onap.so.bpmn.common.scripts.MsoUtils
 import org.onap.aai.domain.yang.SpPartner
-import org.onap.so.bpmn.common.recipe.ResourceInput
-import org.onap.so.bpmn.common.resource.ResourceRequestBuilder
-import org.onap.so.bpmn.core.WorkflowException
-import org.onap.so.bpmn.core.json.JsonUtils
-import org.onap.so.bpmn.core.UrnPropertiesReader
-import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.builder.AbstractBuilder
-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.so.bpmn.common.scripts.SDNCAdapterUtils
-import org.onap.so.bpmn.infrastructure.workflow.service.ServicePluginFactory
-import java.util.Map
-import java.util.UUID
-import javax.ws.rs.core.Response
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types
+import org.onap.so.bpmn.common.recipe.ResourceInput
+import org.onap.so.bpmn.common.resource.ResourceRequestBuilder
+import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
+import org.onap.so.bpmn.common.scripts.ExceptionUtil
+import org.onap.so.bpmn.common.scripts.ExternalAPIUtil
+import org.onap.so.bpmn.common.scripts.ExternalAPIUtilFactory
+import org.onap.so.bpmn.core.UrnPropertiesReader
+import org.onap.so.bpmn.core.json.JsonUtils
 import org.slf4j.Logger
 import org.slf4j.LoggerFactory
 
-import org.camunda.bpm.engine.runtime.Execution
-import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.delegate.DelegateExecution
-import org.apache.commons.lang3.*
-import org.apache.commons.codec.binary.Base64
-
 
 /**
  * This groovy class supports the <class>Create3rdONAPE2EServiceInstance.bpmn</class> process.
@@ -604,12 +589,12 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
                partner.setModelCustomizationId(resourceModelCustomizationUuid)
 
                AAIResourcesClient client = new AAIResourcesClient()
-               AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SP_PARTNER, sppartnerId)
+               AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().spPartner(sppartnerId))
                logger.info("sending request to create sp-partner: " +  uri.toString())
                logger.info("requestbody: " + partner)
                client.create(uri, partner)
 
-               AAIResourceUri siUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId, serviceType, serviceInstanceId)
+               AAIResourceUri siUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(serviceType).serviceInstance(serviceInstanceId))
                client.connect(uri, siUri)
         } catch (Exception ex) {
             String msg = "Exception in Create3rdONAPE2EServiceInstance.saveSPPartnerInAAI. " + ex.getMessage()
index 12cd0dd..e253855 100644 (file)
 
 package org.onap.so.bpmn.infrastructure.scripts
 
-import groovy.json.JsonSlurper
+import static org.apache.commons.lang3.StringUtils.isBlank
 import org.camunda.bpm.engine.delegate.BpmnError
 import org.camunda.bpm.engine.delegate.DelegateExecution
 import org.json.JSONObject
 import org.onap.aai.domain.yang.Relationship
 import org.onap.aai.domain.yang.ServiceInstance
+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.so.bpmn.common.scripts.AbstractServiceTaskProcessor
 import org.onap.so.bpmn.common.scripts.ExceptionUtil
 import org.onap.so.bpmn.common.scripts.MsoUtils
@@ -36,16 +40,11 @@ import org.onap.so.bpmn.core.domain.ServiceDecomposition
 import org.onap.so.bpmn.core.domain.ServiceInfo
 import org.onap.so.bpmn.core.domain.ServiceProxy
 import org.onap.so.bpmn.core.json.JsonUtils
-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.so.db.request.beans.OperationStatus
 import org.slf4j.Logger
 import org.slf4j.LoggerFactory
 import org.springframework.web.util.UriUtils
-
-import static org.apache.commons.lang3.StringUtils.isBlank
+import groovy.json.JsonSlurper
 
 /**
  * This groovy class supports the <class>DoCreateCommunicationService.bpmn</class> process.
@@ -184,7 +183,7 @@ class CreateCommunicationService extends AbstractServiceTaskProcessor {
         logger.debug(Prefix + "prepareInitOperationStatus Start")
 
         String serviceId = execution.getVariable("serviceInstanceId")
-        // 生成 operationId
+        //operationId is generated
         String operationId = execution.getVariable("operationId")
         logger.debug("Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId)
 
@@ -370,20 +369,23 @@ class CreateCommunicationService extends AbstractServiceTaskProcessor {
 
 
             for (String e2eInput in e2eInputs) {
-                if (jsonUtil.getJsonValue(e2eInput, "type") == "integer") {
+                key = jsonUtil.getJsonValue(e2eInput, "name")
+                String type = jsonUtil.getJsonValue(e2eInput, "type")
+                if (type == "integer") {
                     def temp
-                    key = jsonUtil.getJsonValue(e2eInput, "name")
                     value = csInputMap.containsKey(key) ? csInputMap.getOrDefault(key, 0) : (isBlank(temp = jsonUtil.getJsonValue(e2eInput, "default")) ? 0 : temp)
 
                     e2eInputMap.put(key, value as Integer)
-                } else {
-                    e2eInputMap.put(key = jsonUtil.getJsonValue(e2eInput, "name"), csInputMap.containsKey(key)
+                } else if(type == "string") {
+                    e2eInputMap.put(key, csInputMap.containsKey(key)
                             ? csInputMap.getOrDefault(key, null) : (jsonUtil.getJsonValue(e2eInput, "default")))
+
                 }
             }
 
+            //TODO
             e2eInputMap.put("sNSSAI", execution.getVariable("sNSSAI_id"))
-           e2eInputMap.put("sST", execution.getVariable("csServiceType"))
+               e2eInputMap.put("sST", execution.getVariable("csServiceType"))
             execution.setVariable("e2eInputMap", e2eInputMap)
             execution.setVariable("e2eServiceType", e2eServiceDecomposition.getServiceType())
             execution.setVariable("e2eModelInvariantUuid", e2eServiceDecomposition.getModelInfo().getModelInvariantUuid())
@@ -535,10 +537,7 @@ class CreateCommunicationService extends AbstractServiceTaskProcessor {
         String msg
         try {
             String serviceInstanceId = execution.getVariable("serviceInstanceId")
-            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
-                    execution.getVariable("globalSubscriberId"),
-                    execution.getVariable("subscriptionServiceType"),
-                    serviceInstanceId).relationshipAPI()
+            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(serviceInstanceId)).relationshipAPI()
             client.create(uri, relationship)
 
         } catch (BpmnError e) {
@@ -630,8 +629,7 @@ class CreateCommunicationService extends AbstractServiceTaskProcessor {
             // create service
             ServiceInstance csi = new ServiceInstance()
             csi.setOrchestrationStatus(orchestrationStatus)
-            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
-                    globalSubscriberId, subscriptionServiceType, serviceInstanceId)
+            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(serviceInstanceId))
             client.update(uri, csi)
             logger.debug(Prefix + "updateFinishStatusInAAI update communication service status to deactivated")
 
index c9ad18b..b7edc02 100644 (file)
@@ -39,6 +39,8 @@ 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.logging.filter.base.ErrorCode
 import org.onap.so.logger.LoggingAnchor
 import org.onap.so.logger.MessageEnum
@@ -361,7 +363,7 @@ public class CreateCustomE2EServiceInstance extends AbstractServiceTaskProcessor
                                si.setOrchestrationStatus("Pending")
                        }
                        AAIResourcesClient client = new AAIResourcesClient()
-                       AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId)
+                       AAIResourceUri uri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId))
                        client.update(uri, si)
                } catch (BpmnError e) {
                        throw e
index 2b9e431..eb67b8f 100644 (file)
@@ -32,20 +32,19 @@ import org.onap.aai.domain.yang.ServiceInstance
 import org.onap.aai.domain.yang.ServiceInstances
 import org.onap.aai.domain.yang.v13.Metadata
 import org.onap.aai.domain.yang.v13.Metadatum
+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.recipe.ResourceInput
 import org.onap.so.bpmn.common.resource.ResourceRequestBuilder
 import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
 import org.onap.so.bpmn.common.scripts.ExceptionUtil
 import org.onap.so.bpmn.common.scripts.MsoUtils
+import org.onap.so.bpmn.core.UrnPropertiesReader
 import org.onap.so.bpmn.core.domain.ModelInfo
-import org.onap.so.bpmn.core.domain.ResourceType
 import org.onap.so.bpmn.core.json.JsonUtils
-import org.onap.so.bpmn.core.UrnPropertiesReader
-import org.onap.aaiclient.client.aai.AAIObjectPlurals
-import org.onap.aaiclient.client.aai.AAIResourcesClient
-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.slf4j.Logger
 import org.slf4j.LoggerFactory
 
@@ -142,8 +141,7 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
         AAIResourcesClient client = new AAIResourcesClient()
 
         // think how AAI queried for PNF name using the name
-        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE_METADATA,
-                customerId, serviceType, serId)
+        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(customerId).serviceSubscription(serviceType).serviceInstance(serId).metadata())
         logger.debug("uri for pnf get:" + uri.toString())
 
         Metadata metadata = client.get(uri).asBean(Metadata.class).get()
@@ -265,6 +263,7 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
                 String uResourceInput = jsonUtil.addJsonValue(resourceInput, "requestInputs.service-name", inputParameters.get("name"))
                 resourceInputObj.setResourceParameters(uResourceInput)
                 execution.setVariable(Prefix + "resourceInput", resourceInputObj.toString())
+                execution.setVariable("isAsyncRequired", "Yes")
                 break
 
             case ~/[\w\s\W]*sdwanvpnattachment[\w\s\W]*/ :
@@ -293,7 +292,7 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
 
         AAIResourcesClient client = new AAIResourcesClient()
         logger.info("sending request to resolve vpn-name:" + vpnName)
-        AAIResourceUri uri = AAIUriFactory.createResourceUri(new AAIObjectPlurals("/nodes", "/service-instances", "queryByName")).queryParam("service-instance-name", parentServiceName)
+        AAIResourceUri uri = AAIUriFactory.createNodesUri(Types.SERVICE_INSTANCES.getFragment()).queryParam("service-instance-name", parentServiceName)
         Optional<ServiceInstances> serviceInstancesOpt = client.get(ServiceInstances.class, uri)
 
         if(serviceInstancesOpt.isPresent()) {
index 389f0a0..65398eb 100644 (file)
@@ -2,54 +2,51 @@
  * ============LICENSE_START=======================================================
  * ONAP - SO
  * ================================================================================
* Copyright (C) 2019 Huawei Technologies Co., Ltd. All rights reserved.
- * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
*      http://www.apache.org/licenses/LICENSE-2.0
- *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
# Copyright (c) 2020, CMCC Technologies Co., Ltd.
+ #
# Licensed under the Apache License, Version 2.0 (the "License")
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
+ #
      http://www.apache.org/licenses/LICENSE-2.0
+ #
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
  * ============LICENSE_END=========================================================
  */
 
 package org.onap.so.bpmn.infrastructure.scripts
 
-import com.fasterxml.jackson.databind.ObjectMapper
+import static org.apache.commons.lang3.StringUtils.*
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.delegate.DelegateExecution
 import org.onap.aai.domain.yang.ServiceInstance
-import org.onap.so.client.HttpClient
-import org.onap.so.client.HttpClientFactory
-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 javax.ws.rs.core.Response
-
-import static org.apache.commons.lang3.StringUtils.*
-import org.springframework.web.util.UriUtils
-import groovy.json.JsonSlurper
-import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.delegate.DelegateExecution
-import org.onap.logging.filter.base.ONAPComponents
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types
+import org.onap.logging.filter.base.ErrorCode
 import org.onap.so.beans.nsmf.SliceTaskParams
-import org.onap.so.db.request.beans.OrchestrationTask
+import org.onap.so.beans.nsmf.SliceTaskParamsAdapter
+import org.onap.so.beans.nsmf.oof.TemplateInfo
 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.NssmfAdapterUtils
 import org.onap.so.bpmn.common.scripts.OofUtils
 import org.onap.so.bpmn.core.UrnPropertiesReader
-import org.onap.so.bpmn.common.scripts.MsoUtils
 import org.onap.so.bpmn.core.json.JsonUtils
-import org.onap.logging.filter.base.ErrorCode
+import org.onap.so.db.request.beans.OrchestrationTask
 import org.onap.so.logger.LoggingAnchor
 import org.onap.so.logger.MessageEnum
 import org.slf4j.Logger
 import org.slf4j.LoggerFactory
+import org.springframework.web.util.UriUtils
+import com.fasterxml.jackson.databind.ObjectMapper
+import groovy.json.JsonSlurper
 
 public class CreateSliceService extends AbstractServiceTaskProcessor {
     String Prefix = "CRESS_"
@@ -59,8 +56,10 @@ public class CreateSliceService extends AbstractServiceTaskProcessor {
     JsonSlurper jsonSlurper = new JsonSlurper()
     ObjectMapper objectMapper = new ObjectMapper()
     OofUtils oofUtils = new OofUtils()
-    private static final Logger logger = LoggerFactory.getLogger(CreateSliceService.class)
+    NssmfAdapterUtils nssmfAdapterUtils = new NssmfAdapterUtils(httpClientFactory, jsonUtil)
+    AAIResourcesClient client = getAAIClient()
 
+    private static final Logger logger = LoggerFactory.getLogger(CreateSliceService.class)
 
     public void preProcessRequest(DelegateExecution execution) {
         logger.debug("Start preProcessRequest")
@@ -150,7 +149,7 @@ public class CreateSliceService extends AbstractServiceTaskProcessor {
 
             logger.debug("User Input Parameters map: " + inputMap.toString())
             String uuiRequest = inputMap.get("UUIRequest")
-            Map uuiReqMap = jsonSlurper.parseText(uuiRequest)
+            Map uuiReqMap = jsonSlurper.parseText(uuiRequest) as Map
             Map<String, Object> serviceObject = (Map<String, Object>) uuiReqMap.get("service")
             Map<String, Object> parameterObject = (Map<String, Object>) serviceObject.get("parameters")
             Map<String, Object> requestInputs = (Map<String, Object>) parameterObject.get("requestInputs")
@@ -162,7 +161,8 @@ public class CreateSliceService extends AbstractServiceTaskProcessor {
 
             execution.setVariable("serviceInputParams", inputMap)
             execution.setVariable("uuiRequest", uuiRequest)
-            execution.setVariable("serviceProfile", serviceProfile)
+            execution.setVariable("se" +
+                    "rviceProfile", serviceProfile)
 
             //TODO
             //execution.setVariable("serviceInputParams", jsonUtil.getJsonValue(siRequest, "requestDetails.requestParameters.userParams"))
@@ -178,76 +178,69 @@ public class CreateSliceService extends AbstractServiceTaskProcessor {
         logger.debug("Finish preProcessRequest")
     }
 
-    public void prepareSelectNSTRequest(DelegateExecution execution) {
-        logger.debug("Start prepareSelectNSTRequest")
-        String requestId = execution.getVariable("msoRequestId")
-       String messageType = "NSTSelectionResponse"
-        Map<String, Object> serviceProfile = execution.getVariable("serviceProfile")
-               execution.setVariable("nstSelectionUrl", "/api/oof/v1/selection/nst")
-               execution.setVariable("nstSelection_messageType",messageType)
-               execution.setVariable("nstSelection_correlator",requestId)
-               String timeout = UrnPropertiesReader.getVariable("mso.adapters.oof.timeout", execution);
-               execution.setVariable("nstSelection_timeout",timeout)
-        String oofRequest = oofUtils.buildSelectNSTRequest(requestId,messageType, serviceProfile)
-        execution.setVariable("nstSelection_oofRequest",oofRequest)
-        logger.debug("Finish prepareSelectNSTRequest")
-
-    }
-       
-       public void processNSTSolutions(DelegateExecution execution) {
-               Map<String, Object> nstSolution
-               try {
-                       logger.debug("Start processing NSTSolutions")
-                       Map<String, Object> resMap = objectMapper.readValue(execution.getVariable("nstSelection_oofResponse"),Map.class)
-                       List<Map<String, Object>> nstSolutions = (List<Map<String, Object>>) resMap.get("solutions")
-                       nstSolution = nstSolutions.get(0)
-                       execution.setVariable("nstSolution", nstSolution)
-               } catch (Exception ex) {
-                       logger.debug( "Failed to get NST solution suggested by OOF.")
-                       exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Failed to get NST solution suggested by OOF.")
-               }
-
-       }
-
-    public void prepareDecomposeService(DelegateExecution execution) {
-        logger.debug("Start prepareDecomposeService")
-        String uuiRequest = execution.getVariable("uuiRequest")
-        String ssModelInvariantUuid = jsonUtil.getJsonValue(uuiRequest, "service.serviceInvariantUuid")
-        String ssModelUuid = jsonUtil.getJsonValue(uuiRequest, "service.serviceUuid")
-        String ssServiceModelInfo = """{
-            "modelInvariantUuid":"${ssModelInvariantUuid}",
-            "modelUuid":"${ssModelUuid}",
-            "modelVersion":""
-             }"""
-        execution.setVariable("ssServiceModelInfo", ssServiceModelInfo)
-
-        logger.debug("Finish prepareDecomposeService")
-    }
-
-    public void processDecomposition(DelegateExecution execution) {
-        logger.debug("Start processDecomposition")
-        String uuiRequest = execution.getVariable("uuiRequest")
-        Map<String, Object> serviceProfile = execution.getVariable("serviceProfile")
-        Map<String, Object> nstSolution = execution.getVariable("nstSolution")
-
-        Map uuiReqMap = jsonSlurper.parseText(uuiRequest)
-        Map<String, Object> serviceObject = (Map<String, Object>) uuiReqMap.get("service")
-        String subscriptionServiceType = serviceObject.get("serviceType")
+    /**
+     *
+     * @param execution
+     */
+    public void prepareInitServiceOperationStatus(DelegateExecution execution) {
+        logger.debug("Start prepareInitServiceOperationStatus")
+        try{
+            String serviceId = execution.getVariable("serviceInstanceId")
+            String operationId = execution.getVariable("operationId")
+            String operationType = "CREATE"
+            String userId = execution.getVariable("globalSubscriberId")
+            String result = "processing"
+            String progress = "0"
+            String reason = ""
+            String operationContent = "Prepare service creation"
+            logger.debug("Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId)
+            serviceId = UriUtils.encode(serviceId,"UTF-8")
+            execution.setVariable("serviceInstanceId", serviceId)
+            execution.setVariable("operationType", operationType)
 
-        String serviceType = (String) serviceProfile.get("sST")
-        String resourceSharingLevel = (String) serviceProfile.get("resourceSharingLevel")
-        String nstModelUuid = (String) nstSolution.get("UUID")
-        String nstModelInvariantUuid = (String) nstSolution.get("invariantUUID")
+            def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint",execution)
+            execution.setVariable("CSSOS_dbAdapterEndpoint", dbAdapterEndpoint)
+            logger.debug("DB Adapter Endpoint is: " + dbAdapterEndpoint)
+            def dbAdapterAuth = UrnPropertiesReader.getVariable("mso.requestDb.auth")
+            Map<String, String> CSSOS_headerMap = [:]
+            CSSOS_headerMap.put("content-type", "application/soap+xml")
+            CSSOS_headerMap.put("Authorization", dbAdapterAuth)
+            execution.setVariable("CSSOS_headerMap", CSSOS_headerMap)
+            logger.debug("DB Adapter Header is: " + CSSOS_headerMap)
 
-        execution.setVariable("subscriptionServiceType", subscriptionServiceType)
-        execution.setVariable("serviceType", serviceType)
-        execution.setVariable("resourceSharingLevel", resourceSharingLevel)
-        execution.setVariable("nstModelUuid", nstModelUuid)
-        execution.setVariable("nstModelInvariantUuid", nstModelInvariantUuid)
+            String payload =
+                    """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
+                        xmlns:ns="http://org.onap.so/requestsdb">
+                        <soapenv:Header/>
+                        <soapenv:Body>
+                            <ns:initServiceOperationStatus xmlns:ns="http://org.onap.so/requestsdb">
+                            <serviceId>${MsoUtils.xmlEscape(serviceId)}</serviceId>
+                            <operationId>${MsoUtils.xmlEscape(operationId)}</operationId>
+                            <operationType>${MsoUtils.xmlEscape(operationType)}</operationType>
+                            <userId>${MsoUtils.xmlEscape(userId)}</userId>
+                            <result>${MsoUtils.xmlEscape(result)}</result>
+                            <operationContent>${MsoUtils.xmlEscape(operationContent)}</operationContent>
+                            <progress>${MsoUtils.xmlEscape(progress)}</progress>
+                            <reason>${MsoUtils.xmlEscape(reason)}</reason>
+                        </ns:initServiceOperationStatus>
+                    </soapenv:Body>
+                </soapenv:Envelope>"""
 
-        logger.debug("Finish processDecomposition")
+            payload = utils.formatXml(payload)
+            execution.setVariable("CSSOS_updateServiceOperStatusRequest", payload)
+            logger.debug("Outgoing updateServiceOperStatusRequest: \n" + payload)
+        }catch(Exception e){
+            logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+                    "Exception Occured Processing prepareInitServiceOperationStatus.", "BPMN",
+                    ErrorCode.UnknownError.getValue(), "Exception is:\n" + e)
+        }
+        logger.debug("Finish prepareInitServiceOperationStatus")
     }
 
+    /**
+     * prepare create OrchestrationTask
+     * @param execution
+     */
     public void prepareCreateOrchestrationTask(DelegateExecution execution) {
         logger.debug("Start createOrchestrationTask")
         String taskId = execution.getBusinessKey()
@@ -265,21 +258,104 @@ public class CreateSliceService extends AbstractServiceTaskProcessor {
         execution.setVariable("CSSOT_isManual", isManual)
         execution.setVariable("CSSOT_requestMethod", requestMethod)
 
-        Map<String, Object> serviceProfile = execution.getVariable("serviceProfile")
+        Map<String, Object> serviceProfile = execution.getVariable("serviceProfile") as Map<String, Object>
 
-        SliceTaskParams sliceTaskParams = new SliceTaskParams()
+        SliceTaskParamsAdapter sliceTaskParams = new SliceTaskParamsAdapter()
         sliceTaskParams.setServiceId(serviceInstanceId)
         sliceTaskParams.setServiceName(serviceInstanceName)
         sliceTaskParams.setServiceProfile(serviceProfile)
+
         execution.setVariable("sliceTaskParams", sliceTaskParams)
 
-        String paramJson = sliceTaskParams.convertToJson()
-        execution.setVariable("CSSOT_paramJson", paramJson)
-        logger.debug("CSSOT_paramJson: " + paramJson)
+        //todo:----------------------------------------
+//        String paramJson = sliceTaskParams.convertToJson()
+//        execution.setVariable("CSSOT_paramJson", paramJson)
+        /*-------------------------------------------*/
 
         logger.debug("Finish createOrchestrationTask")
     }
 
+    /**
+     *  send sync response to csmf
+     * @param execution
+     */
+    public void sendSyncResponse(DelegateExecution execution) {
+        logger.debug("Start sendSyncResponse")
+        try {
+            String operationId = execution.getVariable("operationId")
+            String serviceInstanceId = execution.getVariable("serviceInstanceId")
+            // RESTResponse for API Handler (APIH) Reply Task
+            String createServiceRestRequest = """
+                {
+                   "service": {
+                        "serviceId":"${serviceInstanceId}",
+                        "operationId":"${operationId}"
+                   }
+                }
+                """.trim()
+
+            logger.debug("sendSyncResponse to APIH:" + "\n" + createServiceRestRequest)
+            sendWorkflowResponse(execution, 202, createServiceRestRequest)
+            execution.setVariable("sentSyncResponse", true)
+        } catch (Exception e) {
+            String msg = "Exceptuion in sendSyncResponse:" + e.getMessage()
+            logger.debug(msg)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+        }
+        logger.debug("Finish sendSyncResponse")
+    }
+
+    public void prepareSelectNSTRequest(DelegateExecution execution) {
+        logger.debug("Start prepareSelectNSTRequest")
+        String requestId = execution.getVariable("msoRequestId")
+        String messageType = "NSTSelectionResponse"
+        Map<String, Object> serviceProfile = execution.getVariable("serviceProfile") as Map<String, Object>
+        execution.setVariable("nstSelectionUrl", "/api/oof/v1/selection/nst")
+        execution.setVariable("nstSelection_messageType", messageType)
+        execution.setVariable("nstSelection_correlator", requestId)
+        String timeout = UrnPropertiesReader.getVariable("mso.adapters.oof.timeout", execution);
+        execution.setVariable("nstSelection_timeout", timeout)
+        String oofRequest = oofUtils.buildSelectNSTRequest(requestId, messageType, serviceProfile)
+        execution.setVariable("nstSelection_oofRequest", oofRequest)
+        logger.debug("Finish prepareSelectNSTRequest")
+
+    }
+
+    /**
+     * process async response of oof, put the {@solutions} at {@nstSolution}
+     * @param execution
+     */
+    public void processNSTSolutions(DelegateExecution execution) {
+        Map<String, Object> nstSolution
+        try {
+            logger.debug("Start processing NSTSolutions")
+            Map<String, Object> resMap =
+                    objectMapper.readValue(execution.getVariable("nstSelection_oofResponse") as String,
+                            Map.class)
+
+            List<Map<String, Object>> nstSolutions = (List<Map<String, Object>>) resMap.get("solutions")
+            nstSolution = nstSolutions.get(0)
+            execution.setVariable("nstSolution", nstSolution)
+
+            //set nst info into sliceTaskParams
+            SliceTaskParamsAdapter sliceTaskParams =
+                    execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter
+            TemplateInfo nstInfo = new TemplateInfo()
+            nstInfo.setUUID(nstSolution.get("UUID") as String)
+            nstInfo.setInvariantUUID(nstSolution.get("invariantUUID") as String)
+            nstInfo.setName(nstSolution.get("name") as String)
+
+            sliceTaskParams.setNSTInfo(nstInfo)
+
+            execution.setVariable("sliceTaskParams", sliceTaskParams)
+
+        } catch (Exception ex) {
+            logger.debug( "Failed to get NST solution suggested by OOF.")
+            exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Failed to get NST solution suggested by OOF.")
+        }
+
+    }
+
     public void prepareUpdateOrchestrationTask(DelegateExecution execution) {
         logger.debug("Start prepareUpdateOrchestrationTask")
         String requestMethod = "PUT"
@@ -292,6 +368,7 @@ public class CreateSliceService extends AbstractServiceTaskProcessor {
         logger.debug("Finish prepareUpdateOrchestrationTask")
     }
 
+
     public void prepareGetUserOptions(DelegateExecution execution) {
         logger.debug("Start prepareGetUserOptions")
         String requestMethod = "GET"
@@ -325,10 +402,10 @@ public class CreateSliceService extends AbstractServiceTaskProcessor {
         String orchStatus = execution.getVariable("orchestrationStatus")
 
         try {
-            ServiceInstance si = ServiceInstance si = new ServiceInstance()
+            ServiceInstance si = new ServiceInstance()
             si.setOrchestrationStatus(orchStatus)
             AAIResourcesClient client = new AAIResourcesClient()
-            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId)
+            AAIResourceUri uri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId))
             client.update(uri, si)
         } catch (BpmnError e) {
             throw e
@@ -341,61 +418,6 @@ public class CreateSliceService extends AbstractServiceTaskProcessor {
         logger.debug("Finish updateAAIOrchStatus")
     }
 
-    public void prepareInitServiceOperationStatus(DelegateExecution execution) {
-        logger.debug("Start prepareInitServiceOperationStatus")
-        try{
-            String serviceId = execution.getVariable("serviceInstanceId")
-            String operationId = execution.getVariable("operationId")
-            String operationType = "CREATE"
-            String userId = execution.getVariable("globalSubscriberId")
-            String result = "processing"
-            String progress = "0"
-            String reason = ""
-            String operationContent = "Prepare service creation"
-            logger.debug("Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId)
-            serviceId = UriUtils.encode(serviceId,"UTF-8")
-            execution.setVariable("serviceInstanceId", serviceId)
-            execution.setVariable("operationType", operationType)
-
-            def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint",execution)
-            execution.setVariable("CSSOS_dbAdapterEndpoint", dbAdapterEndpoint)
-            logger.debug("DB Adapter Endpoint is: " + dbAdapterEndpoint)
-            def dbAdapterAuth = UrnPropertiesReader.getVariable("mso.requestDb.auth")
-            Map<String, String> CSSOS_headerMap = [:]
-            CSSOS_headerMap.put("content-type", "application/soap+xml")
-            CSSOS_headerMap.put("Authorization", dbAdapterAuth)
-            execution.setVariable("CSSOS_headerMap", CSSOS_headerMap)
-            logger.debug("DB Adapter Header is: " + CSSOS_headerMap)
-
-            String payload =
-                    """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
-                        xmlns:ns="http://org.onap.so/requestsdb">
-                        <soapenv:Header/>
-                        <soapenv:Body>
-                            <ns:initServiceOperationStatus xmlns:ns="http://org.onap.so/requestsdb">
-                            <serviceId>${MsoUtils.xmlEscape(serviceId)}</serviceId>
-                            <operationId>${MsoUtils.xmlEscape(operationId)}</operationId>
-                            <operationType>${MsoUtils.xmlEscape(operationType)}</operationType>
-                            <userId>${MsoUtils.xmlEscape(userId)}</userId>
-                            <result>${MsoUtils.xmlEscape(result)}</result>
-                            <operationContent>${MsoUtils.xmlEscape(operationContent)}</operationContent>
-                            <progress>${MsoUtils.xmlEscape(progress)}</progress>
-                            <reason>${MsoUtils.xmlEscape(reason)}</reason>
-                        </ns:initServiceOperationStatus>
-                    </soapenv:Body>
-                </soapenv:Envelope>"""
-
-            payload = utils.formatXml(payload)
-            execution.setVariable("CSSOS_updateServiceOperStatusRequest", payload)
-            logger.debug("Outgoing updateServiceOperStatusRequest: \n" + payload)
-        }catch(Exception e){
-            logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
-                    "Exception Occured Processing prepareInitServiceOperationStatus.", "BPMN",
-                    ErrorCode.UnknownError.getValue(), "Exception is:\n" + e)
-        }
-        logger.debug("Finish prepareInitServiceOperationStatus")
-    }
-
     public void prepareUpdateServiceOperationStatus(DelegateExecution execution) {
         logger.debug("Start preUpdateServiceOperationStatus")
         try{
@@ -438,23 +460,7 @@ public class CreateSliceService extends AbstractServiceTaskProcessor {
         logger.debug("Finish preUpdateServiceOperationStatus")
     }
 
-    public void sendSyncResponse(DelegateExecution execution) {
-        logger.debug("Start sendSyncResponse")
-        try {
-            String operationId = execution.getVariable("operationId")
-            String serviceInstanceId = execution.getVariable("serviceInstanceId")
-            // RESTResponse for API Handler (APIH) Reply Task
-            String createServiceRestRequest = """{"service":{"serviceId":"${serviceInstanceId}","operationId":"${operationId}"}}""".trim()
-            logger.debug("sendSyncResponse to APIH:" + "\n" + createServiceRestRequest)
-            sendWorkflowResponse(execution, 202, createServiceRestRequest)
-            execution.setVariable("sentSyncResponse", true)
-        } catch (Exception e) {
-            String msg = "Exceptuion in sendSyncResponse:" + e.getMessage()
-            logger.debug(msg)
-            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
-        }
-        logger.debug("Finish sendSyncResponse")
-    }
+
 
     public void prepareCompletionRequest (DelegateExecution execution) {
         logger.trace("Start prepareCompletionRequest")
index 80b6641..4cebb92 100644 (file)
@@ -26,6 +26,8 @@ import org.onap.so.client.HttpClientFactory
 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
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types
 import org.camunda.bpm.engine.delegate.BpmnError
 import org.camunda.bpm.engine.delegate.DelegateExecution
 import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
@@ -245,8 +247,8 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
         String serviceType = execution.getVariable("serviceType")
         String serviceId = execution.getVariable("serviceInstanceId")
 
-        AAIResourceUri nsUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,globalSubscriberId,serviceType,nsInstanceId)
-        AAIResourceUri relatedServiceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,globalSubscriberId,serviceType,serviceId)
+        AAIResourceUri nsUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(serviceType).serviceInstance(nsInstanceId))
+        AAIResourceUri relatedServiceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(serviceType).serviceInstance(serviceId))
 
         try{
             getAAIClient().connect(nsUri,relatedServiceUri)
index 1dfe137..4725f9a 100644 (file)
 
 package org.onap.so.bpmn.infrastructure.scripts
 
-import org.onap.so.logger.LoggingAnchor
 import org.camunda.bpm.engine.delegate.BpmnError
 import org.camunda.bpm.engine.delegate.DelegateExecution
+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.ErrorCode
 import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor;
 import org.onap.so.bpmn.common.scripts.ExceptionUtil;
 import org.onap.so.bpmn.common.scripts.MsoUtils
 import org.onap.so.bpmn.core.WorkflowException
-import org.onap.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.logging.filter.base.ErrorCode
+import org.onap.so.logger.LoggingAnchor
 import org.onap.so.logger.MessageEnum
 import org.slf4j.Logger
 import org.slf4j.LoggerFactory
-
 import groovy.json.JsonOutput
 import groovy.json.JsonSlurper
 
@@ -324,7 +324,7 @@ class CreateVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor {
                ExceptionUtil exceptionUtil = new ExceptionUtil()
                try {
 
-                       AAIResourceUri uri = AAIUriFactory.createNodesUri(AAIObjectType.SERVICE_INSTANCE,serviceInstanceId)
+                       AAIResourceUri uri = AAIUriFactory.createNodesUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId))
                        if(getAAIClient().exists(uri)){
                                logger.debug('Service instance ' + serviceInstanceId + ' found in AAI.')
                        }else{
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
new file mode 100644 (file)
index 0000000..964baa7
--- /dev/null
@@ -0,0 +1,170 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ # Copyright (c) 2020, Wipro Limited.
+ #
+ # Licensed under the Apache License, Version 2.0 (the "License")
+ # you may not use this file except in compliance with the License.
+ # You may obtain a copy of the License at
+ #
+ #       http://www.apache.org/licenses/LICENSE-2.0
+ #
+ # Unless required by applicable law or agreed to in writing, software
+ # distributed under the License is distributed on an "AS IS" BASIS,
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ # See the License for the specific language governing permissions and
+ # limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.scripts
+
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
+import org.onap.so.bpmn.common.scripts.ExceptionUtil
+import org.onap.so.bpmn.common.scripts.RequestDBUtil
+import org.onap.so.bpmn.core.json.JsonUtils
+import org.onap.so.db.request.beans.ResourceOperationStatus
+import org.slf4j.Logger
+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
+    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)
+            }
+            
+            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 DeAllocateSliceSubnet.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("Deallocate")
+        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 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")
+       }
+
+}
index 057863b..3062b1c 100644 (file)
@@ -45,6 +45,8 @@ 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.slf4j.Logger
 import org.slf4j.LoggerFactory
 
@@ -473,7 +475,7 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
                String id = execution.getVariable(Prefix + "SppartnerId")
 
                AAIResourcesClient client = new AAIResourcesClient()
-               AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SP_PARTNER, id)
+               AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().spPartner(id))
                SpPartner sp = client.get(uri).asBean(SpPartner.class).get()
 
                logger.debug("GET sppartner Received a Good Response")
@@ -508,7 +510,7 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
                String sppartnerId = execution.getVariable(Prefix + "SppartnerId")
 
                AAIResourcesClient client = new AAIResourcesClient()
-               AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SP_PARTNER, sppartnerId)
+               AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().spPartner(sppartnerId))
                client.delete(uri)
                logger.debug("Delete sppartner Received a Good Response")
                execution.setVariable(Prefix + "SuccessIndicator", true)
index 26936bf..8cab146 100644 (file)
 package org.onap.so.bpmn.infrastructure.scripts
 
 
+import static org.apache.commons.lang3.StringUtils.isBlank
+import javax.ws.rs.NotFoundException
+import javax.ws.rs.core.Response
 import org.camunda.bpm.engine.delegate.BpmnError
 import org.camunda.bpm.engine.delegate.DelegateExecution
-import org.onap.aai.domain.yang.Relationship
-import org.onap.aai.domain.yang.ServiceInstance
 import org.onap.aai.domain.yang.CommunicationServiceProfile
 import org.onap.aai.domain.yang.CommunicationServiceProfiles
+import org.onap.aai.domain.yang.Relationship
+import org.onap.aai.domain.yang.ServiceInstance
+import org.onap.aaiclient.client.aai.AAIObjectName
+import org.onap.aaiclient.client.aai.AAIObjectType
+import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
+import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri
+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
@@ -35,21 +46,10 @@ import org.onap.so.bpmn.core.UrnPropertiesReader
 import org.onap.so.bpmn.core.WorkflowException
 import org.onap.so.bpmn.core.json.JsonUtils
 import org.onap.so.client.HttpClient
-import org.onap.so.client.HttpClientFactory
-import org.onap.aaiclient.client.aai.AAIObjectType
-import org.onap.aaiclient.client.aai.AAIResourcesClient
-import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
-import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
-import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
 import org.onap.so.db.request.beans.OperationStatus
 import org.slf4j.Logger
 import org.slf4j.LoggerFactory
 
-import javax.ws.rs.NotFoundException
-import javax.ws.rs.core.Response
-
-import static org.apache.commons.lang3.StringUtils.isBlank
-
 class DeleteCommunicationService extends AbstractServiceTaskProcessor {
     private final String PREFIX ="DeleteCommunicationService"
     private final Long TIMEOUT = 60 * 60 * 1000
@@ -147,7 +147,7 @@ class DeleteCommunicationService extends AbstractServiceTaskProcessor {
         String serviceInstanceId = execution.getVariable("serviceInstanceId")
 
         String errorMsg = "query communication service from aai failed"
-        AAIResultWrapper wrapper = queryAAI(execution, AAIObjectType.SERVICE_INSTANCE, serviceInstanceId, errorMsg)
+        AAIResultWrapper wrapper = queryAAI(execution, Types.SERVICE_INSTANCE, serviceInstanceId, errorMsg)
         Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class)
         if(si.isPresent())
         {
@@ -177,16 +177,16 @@ class DeleteCommunicationService extends AbstractServiceTaskProcessor {
     /**
      * query AAI
      * @param execution
-     * @param aaiObjectType
+     * @param aaiObjectName
      * @param instanceId
      * @return AAIResultWrapper
      */
-    private AAIResultWrapper queryAAI(DelegateExecution execution, AAIObjectType aaiObjectType, String instanceId, String errorMsg)
+    private AAIResultWrapper queryAAI(DelegateExecution execution, AAIObjectName aaiObjectName, String instanceId, String errorMsg)
     {
         String globalSubscriberId = execution.getVariable("globalSubscriberId")
         String serviceType = execution.getVariable("serviceType")
 
-        AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(aaiObjectType, globalSubscriberId, serviceType, instanceId)
+        AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(serviceType).serviceInstance(instanceId))
         if (!getAAIClient().exists(resourceUri)) {
             exceptionUtil.buildAndThrowWorkflowException(execution, 2500, errorMsg)
         }
@@ -310,7 +310,7 @@ class DeleteCommunicationService extends AbstractServiceTaskProcessor {
         String profileId
         try
         {
-            AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.COMMUNICATION_PROFILE_ALL, globalSubscriberId, serviceType, serviceInstanceId)
+            AAIPluralResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(serviceType).serviceInstance(serviceInstanceId).communicationServiceProfiles())
             AAIResultWrapper wrapper = getAAIClient().get(resourceUri, NotFoundException.class)
             Optional<CommunicationServiceProfiles> csProfilesOpt = wrapper.asBean(CommunicationServiceProfiles.class)
             if(csProfilesOpt.isPresent()){
@@ -318,7 +318,7 @@ class DeleteCommunicationService extends AbstractServiceTaskProcessor {
                 CommunicationServiceProfile csProfile = csProfiles.getCommunicationServiceProfile().get(0)
                 profileId = csProfile ? csProfile.getProfileId() : ""
             }
-            resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.COMMUNICATION_SERVICE_PROFILE, globalSubscriberId, serviceType, serviceInstanceId, profileId)
+            resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(serviceType).serviceInstance(serviceInstanceId).communicationServiceProfile(profileId))
             if (!getAAIClient().exists(resourceUri)) {
                 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "communication service profile was not found in aai")
             }
@@ -344,7 +344,7 @@ class DeleteCommunicationService extends AbstractServiceTaskProcessor {
         try
         {
             LOGGER.debug("start delete communication service from AAI")
-            AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, execution.getVariable("globalSubscriberId"), execution.getVariable("serviceType"), execution.getVariable("serviceInstanceId"))
+            AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("serviceType")).serviceInstance(execution.getVariable("serviceInstanceId")))
             getAAIClient().delete(serviceInstanceUri)
 
             execution.setVariable("progress", "100")
index 99289b8..036fa51 100644 (file)
@@ -41,6 +41,8 @@ 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.slf4j.Logger
 import org.slf4j.LoggerFactory
 import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils
@@ -115,7 +117,7 @@ public class DeleteDeviceResource extends AbstractServiceTaskProcessor {
                String deviceId = execution.getVariable(Prefix + "DeviceId")
         
         AAIResourcesClient client = new AAIResourcesClient()
-        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.DEVICE, deviceId)
+        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().device(deviceId))
         Device dev = client.get(uri).asBean(Device.class).get()
         
         String devClass = dev.getClass ()
index cc5b8cf..6d699d3 100644 (file)
@@ -43,6 +43,8 @@ import org.onap.aaiclient.client.aai.AAIResourcesClient
 import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
 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.slf4j.Logger
 import org.slf4j.LoggerFactory
 
@@ -149,7 +151,7 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor {
         try {
             String parentServiceId = "";
             AAIResourcesClient resourceClient = new AAIResourcesClient();
-            AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.ALLOTTED_RESOURCE, globalCustId, serviceType, serviceInstanceId, allotedResourceId)
+            AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalCustId).serviceSubscription(serviceType).serviceInstance(serviceInstanceId).allottedResource(allotedResourceId))
             AAIResultWrapper aaiResult = resourceClient.get(serviceInstanceUri, NotFoundException.class)
             Optional<AllottedResource> si = aaiResult.asBean(AllottedResource.class)
             if((si.present) && (null != si.get().getRelationshipList()) && (null != si.get().getRelationshipList().getRelationship())) {
index d22ee5e..4c008a2 100644 (file)
 
 package org.onap.so.bpmn.infrastructure.scripts
 
+import static org.apache.commons.lang3.StringUtils.isBlank
+import javax.ws.rs.NotFoundException
 import org.camunda.bpm.engine.delegate.BpmnError
 import org.camunda.bpm.engine.delegate.DelegateExecution
 import org.onap.aai.domain.yang.ServiceProfile
 import org.onap.aai.domain.yang.ServiceProfiles
+import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
+import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri
+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.common.scripts.MsoUtils
 import org.onap.so.bpmn.common.scripts.RequestDBUtil
 import org.onap.so.bpmn.core.WorkflowException
 import org.onap.so.bpmn.core.json.JsonUtils
-import org.onap.aaiclient.client.aai.AAIObjectType
-import org.onap.aaiclient.client.aai.AAIResourcesClient
-import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
-import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
-import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
 import org.onap.so.db.request.beans.OperationStatus
 import org.slf4j.Logger
 import org.slf4j.LoggerFactory
 
-import javax.ws.rs.NotFoundException
-
-import static org.apache.commons.lang3.StringUtils.isBlank
-
 class DeleteSliceService extends AbstractServiceTaskProcessor {
 
     private final String PREFIX ="DeleteSliceService"
@@ -122,7 +121,7 @@ class DeleteSliceService extends AbstractServiceTaskProcessor {
         LOGGER.trace("${PREFIX} Start deleteSliceServiceInstance")
         try {
 
-            AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, execution.getVariable("globalSubscriberId"), execution.getVariable("serviceType"), execution.getVariable("serviceInstanceId"))
+            AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("serviceType")).serviceInstance(execution.getVariable("serviceInstanceId")))
             getAAIClient().delete(serviceInstanceUri)
 
             execution.setVariable("progress", "100")
@@ -169,7 +168,7 @@ class DeleteSliceService extends AbstractServiceTaskProcessor {
 
         try
         {
-            AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_PROFILE_ALL, globalSubscriberId, serviceType, serviceInstanceId)
+            AAIPluralResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(serviceType).serviceInstance(serviceInstanceId).serviceProfiles())
             AAIResultWrapper wrapper = getAAIClient().get(resourceUri, NotFoundException.class)
             Optional<ServiceProfiles> serviceProfilesOpt =wrapper.asBean(ServiceProfiles.class)
             if(serviceProfilesOpt.isPresent()){
@@ -177,7 +176,7 @@ class DeleteSliceService extends AbstractServiceTaskProcessor {
                 ServiceProfile serviceProfile = serviceProfiles.getServiceProfile().get(0)
                 profileId = serviceProfile ? serviceProfile.getProfileId() : ""
             }
-            resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_PROFILE, globalSubscriberId, serviceType, serviceInstanceId, profileId)
+            resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(serviceType).serviceInstance(serviceInstanceId).serviceProfile(profileId))
             if (!getAAIClient().exists(resourceUri)) {
                 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service Instance was not found in aai")
             }
index 005f0f3..1bcf615 100644 (file)
@@ -31,6 +31,7 @@ import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
 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.ErrorCode
 import org.onap.so.bpmn.common.scripts.AaiUtil;
 import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor;
@@ -197,7 +198,7 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor {
 
                AaiUtil aaiUtil = new AaiUtil(this)
 
-               AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, Defaults.CLOUD_OWNER.toString(), cloudRegion)
+               AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(Defaults.CLOUD_OWNER.toString(), cloudRegion))
                def queryCloudRegionRequest = aaiUtil.createAaiUri(uri)
 
                execution.setVariable("DELVfModVol_queryCloudRegionRequest", queryCloudRegionRequest)
@@ -240,7 +241,7 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor {
                String cloudRegion = execution.getVariable('DELVfModVol_aicCloudRegion')
 
         try {
-            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, Defaults.CLOUD_OWNER.toString(), cloudRegion, volumeGroupId)
+            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(Defaults.CLOUD_OWNER.toString(), cloudRegion).volumeGroup(volumeGroupId))
             AAIResultWrapper volumeGroupWrapper = getAAIClient().get(uri)
 
             if (!volumeGroupWrapper.isEmpty()) {
@@ -249,7 +250,7 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor {
                 def heatStackId = volumeGroupOp.get().getHeatStackId() ?: ""
                 execution.setVariable('DELVfModVol_volumeGroupHeatStackId', heatStackId)
 
-                if ( volumeGroupWrapper.getRelationships().isPresent() && !volumeGroupWrapper.getRelationships().get().getRelatedAAIUris(AAIObjectType.VF_MODULE).isEmpty()) {
+                if ( volumeGroupWrapper.getRelationships().isPresent() && !volumeGroupWrapper.getRelationships().get().getRelatedUris(Types.VF_MODULE).isEmpty()) {
                     logger.debug('Volume Group ' + volumeGroupId + ' currently in use')
                     exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Volume Group ${volumeGroupId} currently in use - found vf-module relationship.")
                 }
@@ -283,7 +284,7 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor {
         */
        private String getTenantIdFromVolumeGroup(AAIResultWrapper wrapper) {
         if(wrapper.getRelationships().isPresent()) {
-            List<AAIResourceUri> tenantURIList = wrapper.getRelationships().get().getRelatedAAIUris(AAIObjectType.TENANT)
+            List<AAIResourceUri> tenantURIList = wrapper.getRelationships().get().getRelatedUris(Types.TENANT)
             if(!tenantURIList.isEmpty()){
                 return tenantURIList.get(0).getURIKeys().get(AAIFluentTypeBuilder.Types.TENANT.getUriParams().tenantId)
             }
@@ -356,7 +357,7 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor {
 
         ExceptionUtil exceptionUtil = new ExceptionUtil()
         try {
-            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, Defaults.CLOUD_OWNER.toString(), cloudRegion, groupId)
+            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(Defaults.CLOUD_OWNER.toString(), cloudRegion).volumeGroup(groupId))
             getAAIClient().delete(uri)
             logger.debug("Volume group $groupId deleted.")
         }catch(NotFoundException e){
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateAccessNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateAccessNSSI.groovy
new file mode 100644 (file)
index 0000000..9ccc695
--- /dev/null
@@ -0,0 +1,588 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Wipro Limited. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.scripts
+import static org.apache.commons.lang3.StringUtils.isBlank
+
+import javax.ws.rs.NotFoundException
+
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.onap.aai.domain.yang.Relationship
+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.AAIResultWrapper
+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.beans.nsmf.ActDeActNssi
+import org.onap.so.beans.nsmf.EsrInfo
+import org.onap.so.beans.nsmf.ServiceInfo
+import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
+import org.onap.so.bpmn.common.scripts.ExceptionUtil
+import org.onap.so.bpmn.common.scripts.NssmfAdapterUtils
+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.db.request.beans.ResourceOperationStatus
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+
+import com.fasterxml.jackson.databind.ObjectMapper
+import com.google.gson.JsonObject
+
+
+/**
+ * Internal AN NSSMF to handle NSSI Activation/Deactivation
+ *
+ */
+class DoActivateAccessNSSI extends AbstractServiceTaskProcessor {
+       
+       String Prefix="DoActivateAccessNSSI"
+       ExceptionUtil exceptionUtil = new ExceptionUtil()
+       RequestDBUtil requestDBUtil = new RequestDBUtil()
+       JsonUtils jsonUtil = new JsonUtils()
+       ObjectMapper objectMapper = new ObjectMapper()
+       private NssmfAdapterUtils nssmfAdapterUtils = new NssmfAdapterUtils(httpClientFactory, jsonUtil)
+
+       private static final Logger logger = LoggerFactory.getLogger(DoActivateAccessNSSI.class)
+       private static final String ROLE_SLICE_PROFILE = "slice-profile-instance"
+       private static final String  ROLE_NSSI = "nssi"
+
+       private static final String KEY_SLICE_PROFILE = "SliceProfile"
+       private static final String KEY_NSSI = "NSSI"
+
+       private static final String AN_NF = "AN-NF"
+       private static final String TN_FH = "TN-FH"
+       private static final String TN_MH = "TN-MH"
+
+       private static final String ACTIVATE = "activateInstance"
+       private static final String DEACTIVATE = "deactivateInstance"
+
+       private static final String VENDOR_ONAP = "ONAP"
+
+       Map<String,String> orchStatusMap = new HashMap<>()
+
+       @Override
+       public void preProcessRequest(DelegateExecution execution) {
+               logger.debug("${Prefix} - Start preProcessRequest")
+
+               String sliceParams = execution.getVariable("sliceParams")
+               String sNssaiList = jsonUtil.getJsonValue(sliceParams, "snssaiList")
+               String anSliceProfileId = jsonUtil.getJsonValue(sliceParams, "sliceProfileId")
+               String nsiId = execution.getVariable("nsiId")
+               String globalSubscriberId = execution.getVariable("globalSubscriberId")
+               String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
+               String anNssiId = execution.getVariable("serviceInstanceID")
+               String operationType = execution.getVariable("operationType")
+
+               if(isBlank(sNssaiList) || isBlank(anSliceProfileId) || isBlank(nsiId)) {
+                       String msg = "Input fields cannot be null : Mandatory attributes : [snssaiList, sliceProfileId, nsiId]"
+                       logger.debug(msg)
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+               }
+
+               if( isBlank(anNssiId) || isBlank(globalSubscriberId) || isBlank(subscriptionServiceType) || isBlank(operationType)) {
+                       String msg = "Missing Input fields from main process : [serviceInstanceID, globalSubscriberId, subscriptionServiceType, operationType]"
+                       logger.debug(msg)
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+               }
+
+               execution.setVariable("sNssaiList", sNssaiList)
+               execution.setVariable("anSliceProfileId", anSliceProfileId)
+               execution.setVariable("nsiId", nsiId)
+               execution.setVariable("anNssiId", anNssiId)
+
+               orchStatusMap.put(ACTIVATE, "activated")
+               orchStatusMap.put(DEACTIVATE, "deactivated")
+
+               logger.debug("${Prefix} - Preprocessing completed with sliceProfileId : ${anSliceProfileId} , nsiId : ${nsiId} , nssiId : ${anNssiId}")
+
+       }
+       
+       /**
+        * Method to fetch AN NSSI Constituents and Slice Profile constituents
+        * @param execution
+        */
+       void getRelatedInstances(DelegateExecution execution) {
+               logger.debug("${Prefix} - Get Related Instances")
+               String anSliceProfileId = execution.getVariable("anSliceProfileId")
+               String anNssiId = execution.getVariable("anNssiId")
+
+               Map<String,ServiceInstance> relatedSPs = new HashMap<>()
+               execution.setVariable("relatedSPs", getRelatedInstancesByRole(execution, ROLE_SLICE_PROFILE,KEY_SLICE_PROFILE, anSliceProfileId))
+
+               Map<String,ServiceInstance> relatedNssis = new HashMap<>()
+               execution.setVariable("relatedNssis", getRelatedInstancesByRole(execution, ROLE_NSSI,KEY_NSSI, anNssiId))
+               logger.trace("${Prefix} - Exit Get Related instances")
+       }
+       
+       /**
+        * Method to check Slice profile orchestration status
+        * @param execution
+        */
+       void getSPOrchStatus(DelegateExecution execution) {
+               logger.debug("${Prefix} - Start getSPOrchStatus")
+               ServiceInstance sliceProfileInstance = execution.getVariable(KEY_SLICE_PROFILE)
+               String orchStatus = sliceProfileInstance.getOrchestrationStatus()
+               String operationType = execution.getVariable("operationType")
+               if(orchStatusMap.get(operationType).equalsIgnoreCase(orchStatus)) {
+                       execution.setVariable("shouldChangeSPStatus", true)
+               }else {
+                       execution.setVariable("shouldChangeSPStatus", false)
+               }
+               logger.debug("${Prefix} -  SPOrchStatus  : ${orchStatus}")
+       }
+       
+       /**
+        * Method to check AN NF's  Slice profile instance orchestration status
+        * @param execution
+        */
+       void getAnNfSPOrchStatus(DelegateExecution execution) {
+               logger.debug("${Prefix} -  getAnNfSPOrchStatus ")
+               ServiceInstance sliceProfileInstance = getInstanceByWorkloadContext(execution.getVariable("relatedSPs"), AN_NF)
+               String anNfNssiId = getInstanceIdByWorkloadContext(execution.getVariable("relatedNssis"), AN_NF)
+               execution.setVariable("anNfNssiId", anNfNssiId)
+               String anNfSPId = sliceProfileInstance.getServiceInstanceId()
+               execution.setVariable("anNfSPId", anNfSPId)
+
+               String orchStatus = sliceProfileInstance.getOrchestrationStatus()
+               String operationType = execution.getVariable("operationType")
+               if(orchStatusMap.get(operationType).equalsIgnoreCase(orchStatus)) {
+                       execution.setVariable("shouldChangeAN_NF_SPStatus", true)
+               }else {
+                       execution.setVariable("shouldChangeAN_NF_SPStatus", false)
+               }
+               logger.debug("${Prefix} -  getAnNfSPOrchStatus AN_NF SP ID:${anNfSPId}  : ${orchStatus}")
+       }
+
+       void prepareSdnrActivationRequest(DelegateExecution execution) {
+               logger.debug("${Prefix} - start prepareSdnrActivationRequest")
+               String operationType = execution.getVariable("operationType")
+               String action = operationType.equalsIgnoreCase(ACTIVATE) ? "activate":"deactivate"
+
+               String anNfNssiId = execution.getVariable("anNfNssiId")
+               String sNssai = execution.getVariable("sNssaiList")
+               String reqId = execution.getVariable("msoRequestId")
+               String messageType = "SDNRActivateResponse"
+               StringBuilder callbackURL = new StringBuilder(UrnPropertiesReader.getVariable("mso.workflow.message.endpoint", execution))
+               callbackURL.append("/").append(messageType).append("/").append(reqId)
+
+               JsonObject input = new JsonObject()
+               input.addProperty("RANNFNSSIId", anNfNssiId)
+               input.addProperty("callbackURL", callbackURL.toString())
+               input.addProperty("s-NSSAI", sNssai)
+
+               JsonObject Payload = new JsonObject()
+               Payload.addProperty("version", "1.0")
+               Payload.addProperty("rpc-name", "activateRANSlice")
+               Payload.addProperty("correlation-id", reqId)
+               Payload.addProperty("type", "request")
+
+               JsonObject wrapinput = new JsonObject()
+               wrapinput.addProperty("Action", action)
+
+               JsonObject CommonHeader = new JsonObject()
+               CommonHeader.addProperty("TimeStamp", new Date(System.currentTimeMillis()).format("yyyy-MM-ddTHH:mm:ss.sss", TimeZone.getDefault()))
+               CommonHeader.addProperty("APIver", "1.0")
+               CommonHeader.addProperty("RequestID", reqId)
+               CommonHeader.addProperty("SubRequestID", "1")
+
+               JsonObject body = new JsonObject()
+               body.add("input", wrapinput)
+
+               JsonObject sdnrRequest = new JsonObject()
+               Payload.add("input", input)
+               wrapinput.add("Payload", Payload)
+               wrapinput.add("CommonHeader", CommonHeader)
+               body.add("input", wrapinput)
+               sdnrRequest.add("body", body)
+
+               String json = sdnrRequest.toString()
+               execution.setVariable("sdnrRequest", sdnrRequest)
+               execution.setVariable("SDNR_messageType", messageType)
+               execution.setVariable("SDNR_timeout", "PT10M")
+
+               logger.debug("${Prefix} -  prepareSdnrActivationRequest : SDNR Request : ${json}")
+       }
+
+       void processSdnrResponse(DelegateExecution execution) {
+               logger.debug("${Prefix} processing SdnrResponse")
+               Map<String, Object> resMap = objectMapper.readValue(execution.getVariable("SDNR_Response"),Map.class)
+               String status = resMap.get("status")
+               String reason = resMap.get("reason")
+               if("success".equalsIgnoreCase(status)) {
+                       execution.setVariable("isANactivationSuccess", true)
+               }else {
+                       execution.setVariable("isANactivationSuccess", false)
+                       logger.debug("AN NF Activation/Deactivation failed with reason ${reason}")
+               }
+               logger.debug("${Prefix} processed SdnrResponse")
+       }
+       
+       /**
+        * Update AN NF - NSSI and SP Instance status
+        * @param execution
+        */
+       void updateAnNfStatus(DelegateExecution execution) {
+               logger.debug("${Prefix}Start updateAnNfStatus")
+               String anNfNssiId = execution.getVariable("anNfNssiId")
+               String anNfSPId =  execution.getVariable("anNfSPId")
+
+               updateOrchStatus(execution, anNfSPId)
+               updateOrchStatus(execution, anNfNssiId)
+               logger.debug("${Prefix}Exit  updateAnNfStatus")
+       }
+       
+       /**
+        * Method to check AN NF's  Slice profile instance orchestration status
+        * @param execution
+        */
+       void getTnFhSPOrchStatus(DelegateExecution execution) {
+               logger.debug("${Prefix} start getTnFhSPOrchStatus ")
+               ServiceInstance sliceProfileInstance = getInstanceByWorkloadContext(execution.getVariable("relatedSPs"), TN_FH)
+               String tnFhNssiId = getInstanceIdByWorkloadContext(execution.getVariable("relatedNssis"), TN_FH)
+               execution.setVariable("tnFhNssiId", tnFhNssiId)
+               String tnFhSPId = sliceProfileInstance.getServiceInstanceId()
+               execution.setVariable("tnFhSPId", tnFhSPId)
+
+               String orchStatus = sliceProfileInstance.getOrchestrationStatus()
+               String operationType = execution.getVariable("operationType")
+               if(orchStatusMap.get(operationType).equalsIgnoreCase(orchStatus)) {
+                       execution.setVariable("shouldChangeTN_FH_SPStatus", true)
+               }else {
+                       execution.setVariable("shouldChangeTN_FH_SPStatus", false)
+               }
+
+               logger.debug("${Prefix} Exit getTnFhSPOrchStatus TN_FH SP ID:${tnFhSPId}  : ${orchStatus}")
+       }
+       
+       void doTnFhNssiActivation(DelegateExecution execution){
+               logger.debug("Start doTnFhNssiActivation in ${Prefix}")
+               String nssmfRequest = buildTNActivateNssiRequest(execution, TN_FH)
+               String operationType = execution.getVariable("operationType")
+               String urlOpType = operationType.equalsIgnoreCase(ACTIVATE) ? "activation":"deactivation"
+
+               List<String> sNssaiList =  execution.getVariable("sNssaiList")
+               String snssai = sNssaiList != null ? sNssaiList.get(0) : ""
+
+               String urlString = "/api/rest/provMns/v1/NSS/" + snssai + urlOpType
+                               String nssmfResponse = nssmfAdapterUtils.sendPostRequestNSSMF(execution, urlString, nssmfRequest)
+                               if (nssmfResponse != null) {
+                                       String jobId = jsonUtil.getJsonValue(nssmfResponse, "jobId")
+                                       execution.setVariable("TN_FH_jobId",jobId)
+                               } else {
+                                       logger.error("received error message from NSSMF : "+ nssmfResponse)
+                                       exceptionUtil.buildAndThrowWorkflowException(execution, 7000,"Received a Bad Sync Response from NSSMF.")
+                               }
+               logger.debug("Exit doTnFhNssiActivation in ${Prefix}")
+       }
+
+       void getTnMhSPOrchStatus(DelegateExecution execution) {
+               logger.debug("${Prefix} Start getTnMhSPOrchStatus ")
+               ServiceInstance sliceProfileInstance = getInstanceByWorkloadContext(execution.getVariable("relatedSPs"), TN_MH)
+               String tnFhNssiId = getInstanceIdByWorkloadContext(execution.getVariable("relatedNssis"), TN_MH)
+               execution.setVariable("tnMhNssiId", tnFhNssiId)
+               String tnFhSPId = sliceProfileInstance.getServiceInstanceId()
+               execution.setVariable("tnMhSPId", tnFhSPId)
+
+               String orchStatus = sliceProfileInstance.getOrchestrationStatus()
+               String operationType = execution.getVariable("operationType")
+               if(orchStatusMap.get(operationType).equalsIgnoreCase(orchStatus)) {
+                       execution.setVariable("shouldChangeTN_MH_SPStatus", true)
+               }else {
+                       execution.setVariable("shouldChangeTN_MH_SPStatus", false)
+               }
+                       logger.debug("${Prefix} Exit getTnMhSPOrchStatus TN_MH SP ID:${tnFhSPId}  : ${orchStatus}")
+       }
+       
+       void doTnMhNssiActivation(DelegateExecution execution){
+               logger.debug("Start doTnMhNssiActivation in ${Prefix}")
+               String nssmfRequest = buildTNActivateNssiRequest(execution, TN_MH)
+               String operationType = execution.getVariable("operationType")
+               String urlOpType = operationType.equalsIgnoreCase(ACTIVATE) ? "activation":"deactivation"
+
+               List<String> sNssaiList =  execution.getVariable("sNssaiList")
+               String snssai = sNssaiList != null ? sNssaiList.get(0) : ""
+
+               String urlString = "/api/rest/provMns/v1/NSS/" + snssai + urlOpType
+                               String nssmfResponse = nssmfAdapterUtils.sendPostRequestNSSMF(execution, urlString, nssmfRequest)
+                               if (nssmfResponse != null) {
+                                       String jobId = jsonUtil.getJsonValue(nssmfResponse, "jobId")
+                                       execution.setVariable("TN_MH_jobId",jobId)
+                               } else {
+                                       logger.error("received error message from NSSMF : "+ nssmfResponse)
+                                       exceptionUtil.buildAndThrowWorkflowException(execution, 7000,"Received a Bad Sync Response from NSSMF.")
+                               }
+                               logger.debug("Exit doTnMhNssiActivation in ${Prefix}")
+               
+       }
+       
+       /**
+        * Update TN FH - NSSI and SP Instance status
+        * @param execution
+        */
+       void updateTNFHStatus(DelegateExecution execution) {
+               logger.debug("${Prefix} Start updateTNFHStatus")
+
+               String tnFhNssiId = execution.getVariable("tnFhNssiId")
+               String tnFhSPId =  execution.getVariable("tnFhSPId")
+               updateOrchStatus(execution, tnFhSPId)
+               updateOrchStatus(execution, tnFhNssiId)
+
+               logger.debug("${Prefix} Exit updateTNFHStatus")
+               
+       }
+       
+       /**
+        * Update TN MH - NSSI and SP Instance status
+        * @param execution
+        */
+       void updateTNMHStatus(DelegateExecution execution) {
+               logger.debug("${Prefix} Start updateTNMHStatus")
+
+               String tnMhNssiId = execution.getVariable("tnMhNssiId")
+               String tnMhSPId =  execution.getVariable("tnMhSPId")
+               updateOrchStatus(execution, tnMhSPId)
+               updateOrchStatus(execution, tnMhNssiId)
+
+               logger.debug("${Prefix} Exit updateTNMHStatus")
+       }
+       
+       /**
+        * Update AN - NSSI and SP Instance status
+        * @param execution
+        */
+       void updateANStatus(DelegateExecution execution) {
+               logger.debug("${Prefix} Start updateANStatus")
+               String anNssiId = execution.getVariable("anNssiId")
+               String anSliceProfileId =  execution.getVariable("anSliceProfileId")
+               updateOrchStatus(execution, anNssiId)
+               updateOrchStatus(execution, anSliceProfileId)
+               logger.debug("${Prefix} Start updateANStatus")
+       }
+       
+       void prepareQueryJobStatus(DelegateExecution execution,String jobId,String networkType,String instanceId) {
+               logger.debug("${Prefix} Start prepareQueryJobStatus : ${jobId}")
+               String responseId = "1"
+               String globalSubscriberId = execution.getVariable("globalSubscriberId")
+               String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
+
+               EsrInfo esrInfo = new EsrInfo()
+               esrInfo.setNetworkType(networkType)
+               esrInfo.setVendor(VENDOR_ONAP)
+
+               ServiceInfo serviceInfo = new ServiceInfo()
+               serviceInfo.setNssiId(instanceId)
+               serviceInfo.setNsiId(execution.getVariable("nsiId"))
+               serviceInfo.setGlobalSubscriberId(globalSubscriberId)
+               serviceInfo.setSubscriptionServiceType(subscriptionServiceType)
+
+               execution.setVariable("${networkType}_esrInfo", esrInfo)
+               execution.setVariable("${networkType}_responseId", responseId)
+               execution.setVariable("${networkType}_serviceInfo", serviceInfo)
+               
+       }
+       
+       void validateJobStatus(DelegateExecution execution,String responseDescriptor) {
+               logger.debug("validateJobStatus ${responseDescriptor}")
+               String status = jsonUtil.getJsonValue(responseDescriptor, "responseDescriptor.status")
+               String statusDescription = jsonUtil.getJsonValue(responseDescriptor, "responseDescriptor.statusDescription")
+               if("finished".equalsIgnoreCase(status)) {
+                       execution.setVariable("isSuccess", true)
+               }else {
+                       execution.setVariable("isSuccess", false)
+               }
+       }
+       
+       
+       private void updateOrchStatus(DelegateExecution execution,String serviceId) {
+               logger.debug("${Prefix} Start updateOrchStatus : ${serviceId}")
+               String globalSubscriberId = execution.getVariable("globalSubscriberId")
+               String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
+               String operationType = execution.getVariable("operationType")
+
+               try {
+                       AAIResourcesClient client = new AAIResourcesClient()
+                       AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(serviceId))
+                       if (!client.exists(uri)) {
+                               exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service Instance was not found in aai")
+                       }
+                       AAIResultWrapper wrapper = client.get(uri, NotFoundException.class)
+                       Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class)
+                       if (si.isPresent()) {
+                               String orchStatus = si.get().getOrchestrationStatus()
+                               logger.debug("Orchestration status of instance ${serviceId} is ${orchStatus}")
+                               if (ACTIVATE.equalsIgnoreCase(operationType) && "deactivated".equalsIgnoreCase(orchStatus)) {
+                                               si.get().setOrchestrationStatus("activated")
+                                               client.update(uri, si.get())
+                               } else if(DEACTIVATE.equalsIgnoreCase(operationType) && "activated".equalsIgnoreCase(orchStatus)){
+                                               si.get().setOrchestrationStatus("deactivated")
+                                               client.update(uri, si.get())
+                               }
+                       }
+               } catch (Exception e) {
+                       logger.info("Service is already in active state")
+                       String msg = "Service is already in active state, " + e.getMessage()
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+               }
+               logger.debug("${Prefix} Exit updateOrchStatus : ${serviceId}")
+       }
+       
+       void prepareUpdateJobStatus(DelegateExecution execution,String status,String progress,String statusDescription) {
+               logger.debug("${Prefix} Start prepareUpdateJobStatus : ${statusDescription}")
+               String serviceId = execution.getVariable("anNssiId")
+               String jobId = execution.getVariable("jobId")
+               String nsiId = execution.getVariable("nsiId")
+               String operationType = execution.getVariable("operationType")
+
+               ResourceOperationStatus roStatus = new ResourceOperationStatus()
+               roStatus.setServiceId(serviceId)
+               roStatus.setOperationId(jobId)
+               roStatus.setResourceTemplateUUID(nsiId)
+               roStatus.setOperType(operationType)
+               roStatus.setProgress(progress)
+               roStatus.setStatus(status)
+               roStatus.setStatusDescription(statusDescription)
+               requestDBUtil.prepareUpdateResourceOperationStatus(execution, status)
+       }
+       
+       
+       
+       /**
+        * Fetches a collection of service instances with the specific role and maps it based on workload context
+        * (AN-NF,TN-FH,TN-MH)
+        * @param execution
+        * @param role                  - nssi/slice profile instance
+        * @param key                   - NSSI/Sliceprofile corresponding to instanceId
+        * @param instanceId    - id to which the related list to be found
+        * @return
+        */
+       private Map<String,ServiceInstance> getRelatedInstancesByRole(DelegateExecution execution,String role,String key, String instanceId) {
+               logger.debug("${Prefix} - Fetching related ${role} from AAI")
+               String globalSubscriberId = execution.getVariable("globalSubscriberId")
+               String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
+               
+               if( isBlank(role) || isBlank(instanceId)) {
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Role and instanceId are mandatory")
+               }
+
+               Map<String,ServiceInstance> relatedInstances = new HashMap<>()
+               
+               AAIResourcesClient client = getAAIClient()
+               AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(instanceId))
+               if (!client.exists(uri)) {
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service Instance was not found in aai : ${instanceId}")
+               }
+               AAIResultWrapper wrapper = client.get(uri, NotFoundException.class)
+               Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class)
+               if(si.isPresent()) {
+               execution.setVariable(key, si.get())
+               List<Relationship> relationshipList = si.get().getRelationshipList().getRelationship()
+               for (Relationship relationship : relationshipList) {
+                       String relatedTo = relationship.getRelatedTo()
+                       if (relatedTo.toLowerCase() == "service-instance") {
+                               String relatioshipurl = relationship.getRelatedLink()
+                               String serviceInstanceId =
+                                               relatioshipurl.substring(relatioshipurl.lastIndexOf("/") + 1, relatioshipurl.length())
+                               uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(serviceInstanceId))
+                               if (!client.exists(uri)) {
+                                       exceptionUtil.buildAndThrowWorkflowException(execution, 2500,
+                                                       "Service Instance was not found in aai: ${serviceInstanceId} related to ${instanceId}")
+                               }
+                               AAIResultWrapper wrapper01 = client.get(uri, NotFoundException.class)
+                               Optional<ServiceInstance> serviceInstance = wrapper01.asBean(ServiceInstance.class)
+                               if (serviceInstance.isPresent()) {
+                                       ServiceInstance instance = serviceInstance.get()
+                                       if (role.equalsIgnoreCase(instance.getServiceRole())) {
+                                               relatedInstances.put(instance.getWorkloadContext(),instance)
+                                       }
+                               }
+                       }
+               }
+               }
+               logger.debug("Found ${relatedInstances.size()} ${role} related to ${instanceId} ")
+               return relatedInstances
+       }
+       
+       private ServiceInstance getInstanceByWorkloadContext(Map<String,ServiceInstance> instances,String workloadContext ) {
+               ServiceInstance instance = instances.get(workloadContext)
+               if(instance == null) {
+                       throw new BpmnError( 2500, "${workloadContext} Instance ID is not found.")
+               }
+               return instance
+       }
+       
+       private String getInstanceIdByWorkloadContext(Map<String,ServiceInstance> instances,String workloadContext ) {
+               String instanceId = instances.get(workloadContext).getServiceInstanceId()
+               if(instanceId == null) {
+                       throw new BpmnError( 2500, "${workloadContext} instance ID is not found.")
+               }
+               return instanceId
+       }
+       
+       
+       /**
+        * Method to handle deallocation of RAN NSSI constituents(TN_FH/TN_MH)
+        * @param execution
+        * @param serviceFunction - TN_FH/TN_MH
+        * @return
+        */
+       private String buildTNActivateNssiRequest(DelegateExecution execution,String serviceFunction) {
+               logger.debug("${Prefix} Exit buildTNActivateNssiRequest : ${serviceFunction}")
+               String globalSubscriberId = execution.getVariable("globalSubscriberId")
+               String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
+               Map<String, ServiceInstance> relatedNssis = execution.getVariable("relatedNssis")
+
+               String anNssiId = execution.getVariable("anNssiId")
+               List<String> sNssaiList =  execution.getVariable("sNssaiList")
+
+               ServiceInstance tnNssi = relatedNssis.get(serviceFunction)
+               String nssiId = tnNssi.getServiceInstanceId()
+
+               Map<String, ServiceInstance> relatedSPs = execution.getVariable("relatedSPs")
+
+               ActDeActNssi actDeactNssi = new ActDeActNssi()
+               actDeactNssi.setNssiId(nssiId)
+               actDeactNssi.setNsiId(anNssiId)
+               actDeactNssi.setSliceProfileId(relatedSPs.get(serviceFunction).getServiceInstanceId())
+               actDeactNssi.setSnssaiList(sNssaiList)
+
+               EsrInfo esrInfo = new EsrInfo()
+               esrInfo.setVendor(VENDOR_ONAP)
+               esrInfo.setNetworkType("TN")
+
+               ServiceInfo serviceInfo = new ServiceInfo()
+               serviceInfo.setServiceInvariantUuid(tnNssi.getModelInvariantId())
+               serviceInfo.setServiceUuid(tnNssi.getModelVersionId())
+               serviceInfo.setGlobalSubscriberId(globalSubscriberId)
+               serviceInfo.setSubscriptionServiceType(subscriptionServiceType)
+
+               JsonObject json = new JsonObject()
+               json.addProperty("actDeActNssi", objectMapper.writeValueAsString(actDeactNssi))
+               json.addProperty("esrInfo", objectMapper.writeValueAsString(esrInfo))
+               json.addProperty("serviceInfo", objectMapper.writeValueAsString(serviceInfo))
+               return json.toString()
+               
+       }
+       
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateCoreNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateCoreNSSI.groovy
new file mode 100644 (file)
index 0000000..5e50b9d
--- /dev/null
@@ -0,0 +1,677 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020  Tech Mahindra
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.scripts
+
+import javax.ws.rs.NotFoundException
+import javax.ws.rs.core.Response
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.onap.aai.domain.yang.GenericVnf
+import org.onap.aai.domain.yang.RelatedToProperty
+import org.onap.aai.domain.yang.Relationship
+import org.onap.aai.domain.yang.RelationshipData
+import org.onap.aai.domain.yang.ServiceInstance
+import org.onap.aaiclient.client.aai.AAIObjectName
+import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
+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.CatalogDbUtils
+import org.onap.so.bpmn.common.scripts.CatalogDbUtilsFactory
+import org.onap.so.bpmn.common.scripts.ExceptionUtil
+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.ResourceOperationStatus
+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.Platform
+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.SubscriberInfo
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+import com.fasterxml.jackson.databind.ObjectMapper
+
+class DoActivateCoreNSSI extends AbstractServiceTaskProcessor {
+    String Prefix="DACTCNSSI_"
+    private static final Logger logger = LoggerFactory.getLogger(DoActivateCoreNSSI.class);
+    CatalogDbUtils catalogDbUtils = new CatalogDbUtilsFactory().create()
+    private RequestDBUtil requestDBUtil = new RequestDBUtil()
+    ExceptionUtil exceptionUtil = new ExceptionUtil()
+    ObjectMapper mapper = new ObjectMapper();
+
+    JsonUtils jsonUtil = new JsonUtils()
+
+    private final Long TIMEOUT = 60 * 60 * 1000
+
+    @Override
+    public void preProcessRequest(DelegateExecution execution) {
+        logger.debug(Prefix +" **** Enter DoActivateCoreNSSI ::: preProcessRequest ****")
+
+        String operationType = execution.getVariable("operationType")
+        String oStatus= ""
+
+        if(operationType.equals("activateInstance")) {
+            oStatus ="activated"
+        } else {
+            oStatus ="deactivated"
+        }
+
+        execution.setVariable("oStatus", oStatus)
+        String sNssaiListAsString = jsonUtil.getJsonValue(execution.getVariable("sliceParams"), "snssaiList")
+
+        logger.debug("sNssaiListAsString "+sNssaiListAsString)
+
+        List<String> sNssaiList = jsonUtil.StringArrayToList(sNssaiListAsString)
+
+        logger.debug("sNssaiList "+sNssaiList)
+
+
+        String sNssai = sNssaiList.get(0)
+        execution.setVariable("sNssai", sNssai)
+
+        logger.debug("sNssai: "+sNssai)
+
+        String serviceType = execution.getVariable("subscriptionServiceType")
+        execution.setVariable("serviceType", serviceType)
+        logger.debug(Prefix +" **** Exit DoActivateCoreNSSI ::: preProcessRequest ****")
+    }
+
+    public void getNetworkInstanceWithSPInstanceAssociatedWithNssiId(DelegateExecution execution) {
+        logger.debug(Prefix +" **** Enter DoActivateCoreNSSI ::: getNetworkInstanceWithSPInstanceAssociatedWithNssiId ****")
+        //NSSI Id as service Instance Id to get from Request
+        String serviceInstanceId = execution.getVariable("serviceInstanceID")
+        String errorMsg = "query Network Service Instance from AAI failed"
+        AAIResultWrapper wrapper = queryAAI(execution, Types.SERVICE_INSTANCE, serviceInstanceId, errorMsg)
+        Optional<ServiceInstance> nsi = wrapper.asBean(ServiceInstance.class)
+        String networkServiceInstanceName = ""
+        String networkServiceInstanceId =""
+        if(nsi.isPresent()) {
+            List<Relationship> relationshipList = nsi.get().getRelationshipList()?.getRelationship()
+            List spiWithsNssaiAndOrchStatusList = new ArrayList<>()
+
+            for (Relationship relationship : relationshipList) {
+                String relatedTo = relationship.getRelatedTo()
+                if (relatedTo == "service-instance") {
+                    List<RelationshipData> relationshipDataList = relationship.getRelationshipData()
+                    List<RelatedToProperty> relatedToPropertyList = relationship.getRelatedToProperty()
+                    for (RelationshipData relationshipData : relationshipDataList) {
+                        if (relationshipData.getRelationshipKey() == "service-instance.service-instance-id") {
+                            execution.setVariable("networkServiceInstanceId", relationshipData.getRelationshipValue())
+                        }
+                    }
+                    for (RelatedToProperty relatedToProperty : relatedToPropertyList) {
+                        if (relatedToProperty.getPropertyKey() == "service-instance.service-instance-name") {
+                            execution.setVariable("networkServiceInstanceName", relatedToProperty.getPropertyValue())
+                        }
+                    }
+                }
+
+                //If related to is allotted-Resource
+                if (relatedTo == "allotted-resource") {
+                    //get slice Profile Instance Id from allotted resource in list by nssi
+                    List<String> sliceProfileInstanceIdList = new ArrayList<>()
+                    List<RelationshipData> relationshipDataList = relationship.getRelationshipData()
+                    for (RelationshipData relationshipData : relationshipDataList) {
+                        if (relationshipData.getRelationshipKey() == "service-instance.service-instance-id") {
+                            sliceProfileInstanceIdList.add(relationshipData.getRelationshipValue())
+                        }
+                    }
+                    for (String sliceProfileServiceInstanceId : sliceProfileInstanceIdList) {
+                        String errorSliceProfileMsg = "Slice Profile Service Instance was not found in aai"
+
+                        //Query Slice Profile Service Instance From AAI by sliceProfileServiceInstanceId
+                        AAIResultWrapper sliceProfileInstanceWrapper = queryAAI(execution, Types.SERVICE_INSTANCE, sliceProfileServiceInstanceId, errorSliceProfileMsg)
+                        Optional<ServiceInstance> sliceProfileServiceInstance = sliceProfileInstanceWrapper.asBean(ServiceInstance.class)
+                        if (sliceProfileServiceInstance.isPresent()) {
+                            String orchestrationStatus= sliceProfileServiceInstance.get().getOrchestrationStatus()
+                            String sNssai = sliceProfileServiceInstance.get().getSliceProfiles().getSliceProfile().get(0).getSNssai()
+                            if(sNssai.equals(execution.getVariable("sNssai"))) {
+                                orchestrationStatus = execution.getVariable("oStatus")
+                                //Slice Profile Service Instance to be updated in AAI
+                                execution.setVariable("sliceProfileServiceInstance", sliceProfileServiceInstance)
+                            }
+
+                            Map<String, Object> spiWithsNssaiAndOrchStatus = new LinkedHashMap<>()
+                            spiWithsNssaiAndOrchStatus.put("snssai", sNssai)
+                            spiWithsNssaiAndOrchStatus.put("status", orchestrationStatus)
+                            spiWithsNssaiAndOrchStatusList.add(spiWithsNssaiAndOrchStatus)
+                        }
+                    }
+                }
+            }
+            execution.setVariable("snssaiAndOrchStatusList", spiWithsNssaiAndOrchStatusList)
+        }
+        logger.debug("NSSI Id: ${serviceInstanceId}, network Service Instance Id: ${networkServiceInstanceId}, serviceName: ${networkServiceInstanceName}")
+        //Get ServiceInstance Relationships
+        getServiceInstanceRelationships(execution)
+        //Get Vnf Relationships
+        getVnfRelationships(execution)
+        logger.debug(Prefix +" **** Exit DoActivateCoreNSSI ::: getNetworkInstanceWithSPInstanceAssociatedWithNssiId ****")
+    }
+
+
+    private String prepareVnfInstanceParamsJson(DelegateExecution execution) {
+        logger.debug(Prefix +" **** Enter DoActivateCoreNSSI ::: prepareVnfInstanceParamsJson ****")
+        List instanceParamsvalues = execution.getVariable("snssaiAndOrchStatusList")
+        Map<String, Object> nSsai= new LinkedHashMap<>()
+        nSsai.put("sNssai", instanceParamsvalues)
+        String supportedsNssaiJson = mapper.writeValueAsString(nSsai)
+        //SupportedNssai
+        Map<String, Object> supportedNssai= new LinkedHashMap<>()
+        supportedNssai.put("supportedNssai", supportedsNssaiJson)
+        logger.debug("****  supportedsNssaiJson**** "+supportedNssai)
+        logger.debug(Prefix +" **** Exit DoActivateCoreNSSI ::: prepareVnfInstanceParamsJson ****")
+        return supportedNssai
+    }
+
+    private void getServiceInstanceRelationships(DelegateExecution execution) {
+        logger.debug(Prefix +" **** Enter DoActivateCoreNSSI ::: getServiceInstanceRelationships ****")
+        String serviceInstanceId = execution.getVariable("networkServiceInstanceId")
+        logger.debug("**** serviceInstanceId :: getServiceInstanceRelationships  :: "+serviceInstanceId)
+        String errorMsg = "query Network Service Instance from AAI failed"
+        AAIResultWrapper wrapper = queryAAI(execution, Types.SERVICE_INSTANCE, serviceInstanceId, errorMsg)
+        Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class)
+
+        String networkServiceModelInvariantUuid = si.get().getModelInvariantId()
+        execution.setVariable("networkServiceModelInvariantUuid", networkServiceModelInvariantUuid)
+        if(si.isPresent()) {
+            List<Relationship> relationshipList = si.get().getRelationshipList()?.getRelationship()
+            for (Relationship relationship : relationshipList) {
+                String relatedTo = relationship.getRelatedTo()
+                if (relatedTo == "owning-entity") {
+                    List<RelationshipData> relationshipDataList = relationship.getRelationshipData()
+                    for (RelationshipData relationshipData : relationshipDataList) {
+                        if (relationshipData.getRelationshipKey() == "owning-entity.owning-entity-id") {
+                            execution.setVariable("owningEntityId", relationshipData.getRelationshipValue())
+                        }
+                    }
+                } else if (relatedTo == "generic-vnf") {
+                    List<RelationshipData> relationshipDataList = relationship.getRelationshipData()
+                    List<RelatedToProperty> relatedToPropertyList = relationship.getRelatedToProperty()
+
+                    //Get VnfId
+                    for (RelationshipData relationshipData : relationshipDataList) {
+                        if (relationshipData.getRelationshipKey() == "generic-vnf.vnf-id") {
+                            execution.setVariable("vnfId", relationshipData.getRelationshipValue())
+                            String vnfId = relationshipData.getRelationshipValue()
+                            logger.debug("vnfId   :"+vnfId)
+                        }
+                    }
+                } else if (relatedTo == "project") {
+                    List<RelationshipData> relationshipDataList = relationship.getRelationshipData()
+                    for (RelationshipData relationshipData : relationshipDataList) {
+                        if (relationshipData.getRelationshipKey() == "project.project-name") {
+                            execution.setVariable("projectName", relationshipData.getRelationshipValue())
+                        }
+                    }
+                }
+            }
+            logger.debug(Prefix +" **** Exit DoActivateCoreNSSI ::: getServiceInstanceRelationships ****")
+        }
+    }
+
+    private void getVnfRelationships(DelegateExecution execution) {
+
+        logger.debug(Prefix +" **** Enter DoActivateCoreNSSI ::: getVnfRelationships ****")
+        String msg = "query Generic Vnf from AAI failed"
+        try {
+            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(execution.getVariable('vnfId')))
+            if (!getAAIClient().exists(uri)) {
+                exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
+            }
+            AAIResultWrapper wrapper = getAAIClient().get(uri, NotFoundException.class)
+            Optional<GenericVnf> vnf = wrapper.asBean(GenericVnf.class)
+            if(vnf.isPresent()) {
+                List<Relationship> relationshipList = vnf.get().getRelationshipList()?.getRelationship()
+                for (Relationship relationship : relationshipList) {
+                    String relatedTo = relationship.getRelatedTo()
+                    if (relatedTo == "tenant") {
+                        List<RelationshipData> relationshipDataList = relationship.getRelationshipData()
+                        for (RelationshipData relationshipData : relationshipDataList) {
+                            if (relationshipData.getRelationshipKey() == "tenant.tenant-id") {
+                                execution.setVariable("tenantId", relationshipData.getRelationshipValue())
+                            }
+                        }
+                    } else if (relatedTo == "cloud-region") {
+                        List<RelationshipData> relationshipDataList = relationship.getRelationshipData()
+
+                        for (RelationshipData relationshipData : relationshipDataList) {
+                            if (relationshipData.getRelationshipKey() == "cloud-region.cloud-owner") {
+                                execution.setVariable("cloudOwner", relationshipData.getRelationshipValue())
+                            } else if (relationshipData.getRelationshipKey() == "cloud-region.cloud-region-id") {
+                                execution.setVariable("lcpCloudRegionId", relationshipData.getRelationshipValue())
+                            }
+                        }
+                    } else if (relatedTo == "platform") {
+                        List<RelationshipData> relationshipDataList = relationship.getRelationshipData()
+                        for (RelationshipData relationshipData : relationshipDataList) {
+                            if (relationshipData.getRelationshipKey() == "platform.platform-name") {
+                                execution.setVariable("platformName", relationshipData.getRelationshipValue())
+                            }
+                        }
+                    } else if (relatedTo == "line-of-business") {
+                        List<RelationshipData> relationshipDataList = relationship.getRelationshipData()
+                        for (RelationshipData relationshipData : relationshipDataList) {
+                            if (relationshipData.getRelationshipKey() == "line-of-business.line-of-business-name") {
+                                execution.setVariable("lineOfBusinessName", relationshipData.getRelationshipValue())
+                            }
+                        }
+                    }
+                }
+            }
+        } catch(BpmnError e){
+            throw e
+        } catch (Exception ex){
+            msg = "Exception in getVnfRelationships " + ex.getMessage()
+            logger.debug(msg)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+        }
+        logger.debug(Prefix +" **** Exit DoActivateCoreNSSI ::: getVnfRelationships ****")
+    }
+
+
+    /**
+     * query AAI
+     * @param execution
+     * @param aaiObjectType
+     * @param instanceId
+     * @return AAIResultWrapper
+     */
+    private AAIResultWrapper queryAAI(DelegateExecution execution, AAIObjectName aaiObjectName, String instanceId, String errorMsg) {
+        logger.debug(Prefix +" **** Enter DoActivateCoreNSSI ::: queryAAI ****")
+
+        String globalSubscriberId = execution.getVariable("globalSubscriberId")
+        String serviceType = execution.getVariable("serviceType")
+
+        AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(serviceType).serviceInstance(instanceId))
+        if (!getAAIClient().exists(resourceUri)) {
+            exceptionUtil.buildAndThrowWorkflowException(execution, 2500, errorMsg)
+        }
+        AAIResultWrapper wrapper = getAAIClient().get(resourceUri, NotFoundException.class)
+
+        logger.debug(Prefix +" **** Exit DoActivateCoreNSSI ::: queryAAI ****")
+        return wrapper
+    }
+
+    public void getServiceVNFAndVFsFromCatalogDB(DelegateExecution execution) {
+        logger.debug(Prefix +" **** Exit DoActivateCoreNSSI ::: getServiceVNFAndVFsFromCatalogDB ****")
+
+        String modelInvariantUuid = execution.getVariable("networkServiceModelInvariantUuid")
+
+        try{
+            CatalogDbUtils catalogDbUtils = new CatalogDbUtilsFactory().create()
+            String json = catalogDbUtils.getServiceResourcesByServiceModelInvariantUuidString(execution, modelInvariantUuid)
+            logger.debug("***** JSON IS: "+json)
+
+            String serviceVnfs = jsonUtil.getJsonValue(json, "serviceResources.serviceVnfs") ?: ""
+            String serviceModelInfo = jsonUtil.getJsonValue(json, "serviceResources.modelInfo") ?: ""
+
+
+            execution.setVariable("serviceVnfs",serviceVnfs)
+            execution.setVariable("serviceModelInfo", serviceModelInfo)
+            logger.debug(Prefix +" ***** serviceVnfs is: "+ serviceVnfs)
+        }catch(BpmnError e){
+            throw e
+        } catch (Exception ex){
+            String msg = "Exception in getServiceVNFAndVFsFromCatalogDB " + ex.getMessage()
+            logger.debug(msg)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+        }
+        logger.debug(Prefix +" **** Exit DoActivateCoreNSSI ::: getServiceVNFAndVFsFromCatalogDB ****")
+    }
+
+    public void prepareSOMacroRequestPayLoad(DelegateExecution execution) {
+        logger.debug("**** Enter DoActivateCoreNSSI ::: prepareSOMacroRequestPayLoad ****")
+        String json = execution.getVariable("serviceVnfs")
+        logger.debug(">>>> json "+json)
+        List<Object> vnfList = mapper.readValue(json, List.class);
+        logger.debug("vnfList:  "+vnfList)
+        Map<String,Object> serviceMap = mapper.readValue(execution.getVariable("serviceModelInfo"), Map.class);
+        ModelInfo serviceModelInfo = new ModelInfo()
+        serviceModelInfo.setModelType(ModelType.service)
+        serviceModelInfo.setModelInvariantId(serviceMap.get("modelInvariantUuid"))
+        serviceModelInfo.setModelVersionId(serviceMap.get("modelUuid"))
+        serviceModelInfo.setModelName(serviceMap.get("modelName"))
+        serviceModelInfo.setModelVersion(serviceMap.get("modelVersion"))
+
+        logger.debug("serviceModelInfo:  "+serviceModelInfo)
+        //List of Vnfs
+        List<Object> vnfModelInfoList = new ArrayList<>()
+
+        Map vnfMap = vnfList.get(0)
+        ModelInfo vnfModelInfo = vnfMap.get("modelInfo")
+        logger.debug("vnfModelInfo "+vnfModelInfo)
+
+        //List of VFModules
+        List<Map<String, Object>> vfModuleList = vnfMap.get("vfModules")
+        logger.debug("vfModuleList "+vfModuleList)
+
+        //List of VfModules
+        List<ModelInfo> vfModelInfoList = new ArrayList<>()
+
+        //Traverse VFModules List and add in vfModelInfoList
+        for (vfModule in vfModuleList) {
+            ModelInfo vfModelInfo = vfModule.get("modelInfo")
+            logger.debug("vfModelInfo "+vfModelInfo)
+            vfModelInfoList.add(vfModelInfo)
+        }
+
+        //RequestInfo
+        RequestInfo requestInfo = new RequestInfo()
+
+        //Dummy Product FamilyId
+        requestInfo.setProductFamilyId("test1234")
+        requestInfo.setSource("VID")
+        requestInfo.setInstanceName(execution.getVariable("networkServiceInstanceName"))
+        requestInfo.setSuppressRollback(false)
+        requestInfo.setRequestorId("NBI")
+
+        //Service Level InstanceParams
+        List<Map<String, Object>> serviceParams = new ArrayList<>()
+        Map<String, Object> serviceParamsValues = new LinkedHashMap<>()
+        serviceParams.add(serviceParamsValues)
+
+        //Cloud Configuration
+        CloudConfiguration cloudConfiguration = new CloudConfiguration()
+        cloudConfiguration.setLcpCloudRegionId(execution.getVariable("lcpCloudRegionId"))
+        cloudConfiguration.setTenantId(execution.getVariable("tenantId"))
+        cloudConfiguration.setCloudOwner(execution.getVariable("cloudOwner"))
+
+        //VFModules List
+        List<Map<String, Object>> vfModules = new ArrayList<>()
+        for (ModelInfo vfModuleModelInfo : vfModelInfoList) {
+            //Individual VFModule List
+            Map<String, Object> vfModuleValues = new LinkedHashMap<>()
+            vfModuleValues.put("modelInfo", vfModuleModelInfo)
+            vfModuleValues.put("instanceName", vfModuleModelInfo.getModelInstanceName())
+
+            //VFModule InstanceParams should be empty or this field should not be there?
+            List<Map<String, Object>> vfModuleInstanceParams = new ArrayList<>()
+            vfModuleValues.put("instanceParams", vfModuleInstanceParams)
+        }
+
+        //Vnf intsanceParams
+        ObjectMapper objectMapper = new ObjectMapper();
+        Map<String, Object> sliceProfile = objectMapper.readValue(execution.getVariable("sliceProfile"), Map.class);
+
+        List vnfInstanceParamsList = new ArrayList<>()
+        String supportedsNssaiJson= prepareVnfInstanceParamsJson(execution)
+        vnfInstanceParamsList.add(supportedsNssaiJson)
+
+        Platform platform = new Platform()
+        platform.setPlatformName(execution.getVariable("platform"))
+
+        LineOfBusiness lineOfbusiness = new LineOfBusiness()
+        lineOfbusiness.setLineOfBusinessName(execution.getVariable("lineOfBusiness"))
+
+        //Vnf Values
+        Map<String, Object> vnfValues = new LinkedHashMap<>()
+        vnfValues.put("lineOfBusiness", lineOfbusiness)
+        vnfValues.put("platform", platform)
+        vnfValues.put("productFamilyId", "test1234")
+        vnfValues.put("cloudConfiguration", cloudConfiguration)
+        vnfValues.put("vfModules", vfModules)
+        vnfValues.put("modelInfo", vnfModelInfo)
+        vnfValues.put("instanceName", execution.getVariable("vnfInstanceName"))
+        vnfValues.put("instanceParams",vnfInstanceParamsList)
+
+        vnfModelInfoList.add(vnfValues)
+        //Service Level Resources
+        Map<String, Object> serviceResources = new LinkedHashMap<>()
+        serviceResources.put("vnfs", vnfModelInfoList)
+
+        //Service Values
+        Map<String, Object> serviceValues = new LinkedHashMap<>()
+        serviceValues.put("modelInfo", serviceModelInfo)
+        serviceValues.put("instanceName", execution.getVariable("networkServiceInstanceName"))
+        serviceValues.put("resources", serviceResources)
+        serviceValues.put("instanceParams", serviceParams)
+
+        //UserParams Values
+        Map<String, Object> userParamsValues = new LinkedHashMap<>()
+
+        Map<String, Object> homingSolution = new LinkedHashMap<>()
+        homingSolution.put("Homing_Solution", "none")
+
+        userParamsValues.put("service", serviceValues)
+
+        //UserParams
+        List<Map<String, Object>> userParams = new ArrayList<>()
+        userParams.add(homingSolution)
+        userParams.add(userParamsValues)
+
+        //Request Parameters
+        RequestParameters requestParameters = new RequestParameters()
+        requestParameters.setaLaCarte(false)
+        requestParameters.setSubscriptionServiceType(execution.getVariable("serviceType"))
+        requestParameters.setUserParams(userParams)
+
+        //SubscriberInfo
+        SubscriberInfo subscriberInfo = new SubscriberInfo()
+        subscriberInfo.setGlobalSubscriberId(execution.getVariable("globalSubscriberId"))
+
+        //Owning Entity
+        OwningEntity owningEntity = new OwningEntity()
+        owningEntity.setOwningEntityId(execution.getVariable("owningEntityId"))
+
+        //Project
+        Project project = new Project()
+        project.setProjectName(execution.getVariable("projectName"))
+
+        RequestDetails requestDetails = new RequestDetails()
+        requestDetails.setModelInfo(serviceModelInfo)
+        requestDetails.setSubscriberInfo(subscriberInfo)
+        requestDetails.setRequestInfo(requestInfo)
+        requestDetails.setRequestParameters(requestParameters)
+        requestDetails.setCloudConfiguration(cloudConfiguration)
+        requestDetails.setOwningEntity(owningEntity)
+        requestDetails.setProject(project)
+
+        Map<String, Object> requestDetailsMap = new LinkedHashMap<>()
+        requestDetailsMap.put("requestDetails", requestDetails)
+        String requestPayload = objectMapper.writeValueAsString(requestDetailsMap)
+
+        logger.debug("requestDetails "+requestPayload)
+        execution.setVariable("requestPayload", requestPayload)
+
+        logger.debug(Prefix +" **** Exit DoActivateCoreNSSI ::: prepareSOMacroRequestPayLoad ****")
+    }
+
+    public void sendPutRequestToSOMacro(DelegateExecution execution) {
+
+        logger.debug(Prefix +" **** Enter DoActivateCoreNSSI ::: sendPutRequestToSOMacro ****")
+        try {
+            String msoEndpoint = UrnPropertiesReader.getVariable("mso.infra.endpoint.url", execution)
+            String url = msoEndpoint+"/serviceInstantiation/v7/serviceInstances/"+execution.getVariable("networkServiceInstanceId")+"/vnfs/"+execution.getVariable("vnfId")
+            String requestBody = execution.getVariable("requestPayload")
+            String msoKey = UrnPropertiesReader.getVariable("mso.msoKey", execution)
+            String basicAuth =  UrnPropertiesReader.getVariable("mso.infra.endpoint.auth", execution)
+            String basicAuthValue = utils.encrypt(basicAuth, msoKey)
+            String encodeString = utils.getBasicAuth(basicAuthValue, msoKey)
+
+            HttpClient httpClient = getHttpClientFactory().newJsonClient(new URL(url), ONAPComponents.SO)
+            httpClient.addAdditionalHeader("Authorization", encodeString)
+            httpClient.addAdditionalHeader("Accept", "application/json")
+            Response httpResponse = httpClient.put(requestBody)
+            handleSOResponse(httpResponse, execution)
+
+        } catch (BpmnError e) {
+            throw e
+        } catch (any) {
+            String msg = "Exception in DoActivateCoreNSSSI " + any.getCause()
+            logger.error(msg)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+        }
+        logger.debug(Prefix +" **** Exit DoActivateCoreNSSI ::: sendPostRequestToSOMacro ****")
+    }
+
+    /**
+     * Handle SO Response for PUT and prepare update operation status
+     * @param execution
+     */
+    private void handleSOResponse(Response httpResponse, DelegateExecution execution){
+        logger.debug(Prefix +" **** Enter DoActivateCoreNSSI ::: handleSOResponse ****")
+
+        int soResponseCode = httpResponse.getStatus()
+        logger.debug("soResponseCode : "+soResponseCode)
+
+        if (soResponseCode >= 200 && soResponseCode < 204 && httpResponse.hasEntity()) {
+            String soResponse = httpResponse.readEntity(String.class)
+            String operationId = execution.getVariable("operationId")
+            def macroOperationId = jsonUtil.getJsonValue(soResponse, "operationId")
+            execution.setVariable("macroOperationId", macroOperationId)
+            execution.setVariable("isSOTimeOut", "no")
+            execution.setVariable("isSOResponseSucceed","yes")
+        }
+        else
+        {
+            String serviceName = execution.getVariable("serviceInstanceName")
+            execution.setVariable("isSOResponseSucceed","no")
+            prepareFailedOperationStatusUpdate(execution)
+        }
+
+        logger.debug(Prefix +" **** Exit DoActivateCoreNSSI ::: handleSOResponse ****")
+    }
+
+    /**
+     * prepare to call sub process CheckProcessStatus
+     * @param execution
+     */
+    void prepareCallCheckProcessStatus(DelegateExecution execution){
+        logger.debug(Prefix +" **** Enter DoActivateCoreNSSI ::: prepareCallCheckProcessStatus ****")
+        def successConditions = new ArrayList<>()
+        successConditions.add("finished")
+        execution.setVariable("successConditions", successConditions)
+        def errorConditions = new ArrayList<>()
+        errorConditions.add("error")
+        execution.setVariable("errorConditions", errorConditions)
+        execution.setVariable("processServiceType", "Network service")
+        execution.setVariable("subOperationType", "PUT")
+        execution.setVariable("initProgress", 20)
+        execution.setVariable("endProgress",90)
+        execution.setVariable("timeOut", TIMEOUT)
+        logger.debug(Prefix +" **** Exit DoActivateCoreNSSI ::: prepareCallCheckProcessStatus ****")
+    }
+
+    void prepareUpdateResourceOperationStatus(DelegateExecution execution) {
+
+        logger.debug(Prefix +" **** Enter DoActivateCoreNSSI ::: prepareUpdateResourceOperationStatus ****")
+
+        String nssiOperationId = execution.getVariable("nssiOperationId")
+        execution.setVariable("operationId", nssiOperationId)
+        //Prepare Update Status for PUT failure and success
+        if(execution.getVariable("isTimeOut").equals("YES")) {
+            logger.debug("TIMEOUT - SO PUT Failure")
+            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "SO PUT Failure")
+        }
+        logger.debug(Prefix +" **** Exit DoActivateCoreNSSI ::: prepareUpdateResourceOperationStatus ****")
+    }
+
+    void updateSliceProfileOrchestrationStatus(DelegateExecution execution) {
+
+        logger.debug(Prefix +" **** Enter DoActivateCoreNSSI ::: updateSliceProfileOrchestrationStatus ****")
+
+        String globalCustId = execution.getVariable("globalSubscriberId")
+        String serviceType = execution.getVariable("serviceType")
+        String oStatus = execution.getVariable("oStatus")
+
+        ServiceInstance si = execution.getVariable("sliceProfileServiceInstance")
+        String sliceProfileInstanceId = si.getServiceInstanceId()
+        si.setOrchestrationStatus(oStatus)
+
+        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalCustId).serviceSubscription(serviceType).serviceInstance(sliceProfileInstanceId))
+        try {
+
+            Response response = getAAIClient().update(uri, si)
+
+            if(response.getStatus()!=200 || response.getStatus()!=201 || response.getStatus()!=202) {
+                exceptionUtil.buildAndThrowWorkflowException(execution, response.getStatus(), "AAI failed to update sliceProlie service Instance orchestration status")
+            } else {
+                setResourceOperationStatus(execution)
+            }
+        } catch (Exception e) {
+            logger.info("Update OrchestrationStatus in AAI failed")
+            String msg = "Update OrchestrationStatus in AAI failed, " + e.getMessage()
+            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+        }
+
+        logger.debug(Prefix +" **** Exit DoActivateCoreNSSI ::: updateSliceProfileOrchestrationStatus ****")
+    }
+
+    /**
+     * prepare ResourceOperation status
+     * @param execution
+     * @param operationType
+     */
+    private void setResourceOperationStatus(DelegateExecution execution) {
+
+        logger.debug(Prefix +" **** Enter DoActivateCoreNSSI ::: setResourceOperationStatus ****")
+
+        String serviceId = execution.getVariable("nssiId")
+        String jobId = execution.getVariable("jobId")
+        String nsiId = execution.getVariable("nsiId")
+        String operationType = execution.getVariable("operationType")
+        ResourceOperationStatus resourceOperationStatus = new ResourceOperationStatus()
+        resourceOperationStatus.setServiceId(serviceId)
+        resourceOperationStatus.setOperationId(jobId)
+        resourceOperationStatus.setResourceTemplateUUID(nsiId)
+        resourceOperationStatus.setOperType(operationType)
+        resourceOperationStatus.setStatus("finished")
+        resourceOperationStatus.setProgress("100")
+        resourceOperationStatus.setStatusDescription("Core Activation Successful")
+        requestDBUtil.prepareUpdateResourceOperationStatus(execution, resourceOperationStatus)
+
+        logger.debug(Prefix +" **** Exit DoActivateCoreNSSI ::: setResourceOperationStatus ****")
+    }
+
+    void prepareFailedOperationStatusUpdate(DelegateExecution execution){
+        logger.debug(Prefix + " **** Enter DoActivateCoreNSSI ::: prepareFailedOperationStatusUpdate ****")
+
+        String serviceId = execution.getVariable("nssiId")
+        String jobId = execution.getVariable("jobId")
+        String nsiId = execution.getVariable("nsiId")
+        String operationType = execution.getVariable("operationType")
+
+        ResourceOperationStatus resourceOperationStatus = new ResourceOperationStatus()
+        resourceOperationStatus.setServiceId(serviceId)
+        resourceOperationStatus.setOperationId(jobId)
+        resourceOperationStatus.setResourceTemplateUUID(nsiId)
+        resourceOperationStatus.setOperType(operationType)
+        resourceOperationStatus.setProgress(0)
+        resourceOperationStatus.setStatus("failed")
+        resourceOperationStatus.setStatusDescription("Core NSSI Activation Failed")
+        requestDBUtil.prepareUpdateResourceOperationStatus(execution, resourceOperationStatus)
+
+        logger.debug(Prefix + " **** Exit DoActivateCoreNSSI ::: prepareFailedOperationStatusUpdate ****")
+    }
+
+}
\ No newline at end of file
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
new file mode 100644 (file)
index 0000000..0900863
--- /dev/null
@@ -0,0 +1,165 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.scripts
+
+import com.fasterxml.jackson.databind.ObjectMapper
+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
+import org.onap.so.bpmn.common.scripts.RequestDBUtil
+import org.onap.so.bpmn.core.json.JsonUtils
+import org.onap.so.db.request.beans.ResourceOperationStatus
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+
+
+public class DoActivateTnNssi extends AbstractServiceTaskProcessor {
+    String Prefix = "TNACT_"
+
+    ExceptionUtil exceptionUtil = new ExceptionUtil()
+    JsonUtils jsonUtil = new JsonUtils()
+    RequestDBUtil requestDBUtil = new RequestDBUtil()
+    TnNssmfUtils tnNssmfUtils = new TnNssmfUtils()
+    JsonSlurper jsonSlurper = new JsonSlurper()
+    ObjectMapper objectMapper = new ObjectMapper()
+    private static final Logger logger = LoggerFactory.getLogger(DoActivateTnNssi.class)
+
+
+    public void preProcessRequest(DelegateExecution execution) {
+        logger.debug("Start preProcessRequest")
+
+        execution.setVariable("startTime", System.currentTimeMillis())
+        String msg = tnNssmfUtils.getExecutionInputParams(execution)
+        logger.debug("Activate TN NSSI input parameters: " + msg)
+
+        execution.setVariable("prefix", Prefix)
+
+        tnNssmfUtils.setSdncCallbackUrl(execution, true)
+        logger.debug("SDNC Callback URL: " + execution.getVariable("sdncCallbackUrl"))
+
+        String modelInvariantUuid = execution.getVariable("modelInvariantUuid")
+        String modelUuid = execution.getVariable("modelUuid")
+        //here modelVersion is not set, we use modelUuid to decompose the service.
+        def isDebugLogEnabled = true
+        execution.setVariable("isDebugLogEnabled", isDebugLogEnabled)
+        String serviceModelInfo = """{
+            "modelInvariantUuid":"${modelInvariantUuid}",
+            "modelUuid":"${modelUuid}",
+            "modelVersion":""
+             }"""
+        execution.setVariable("serviceModelInfo", serviceModelInfo)
+
+        String sliceServiceInstanceId = execution.getVariable("serviceInstanceID")
+        execution.setVariable("sliceServiceInstanceId", sliceServiceInstanceId)
+
+        String sliceServiceInstanceName = execution.getVariable("servicename")
+        execution.setVariable("sliceServiceInstanceName", sliceServiceInstanceName)
+
+        String operationType = execution.getVariable("operationType")
+        String actionType = operationType.equals("activateInstance") ? "activate" : "deactivate"
+        execution.setVariable("actionType", actionType)
+
+
+        logger.debug("Finish preProcessRequest")
+    }
+
+    void preprocessSdncActOrDeactTnNssiRequest(DelegateExecution execution) {
+        def method = getClass().getSimpleName() + '.preprocessSdncActivateTnNssiRequest(' +
+                'execution=' + execution.getId() + ')'
+        def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+        logger.trace('Entered ' + method)
+
+        try {
+            String serviceInstanceId = execution.getVariable("sliceServiceInstanceId")
+            String actionType = execution.getVariable("actionType")
+
+            String sdncRequest = tnNssmfUtils.buildSDNCRequest(execution, serviceInstanceId, actionType)
+
+            execution.setVariable("TNNSSMF_SDNCRequest", sdncRequest)
+            logger.debug("Outgoing SDNCRequest is: \n" + sdncRequest)
+
+        } catch (Exception e) {
+            logger.debug("Exception Occured Processing preprocessSdncDeallocateTnNssiRequest. Exception is:\n" + e)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during  preProcessSDNCActivateRequest Method:\n" + e.getMessage())
+        }
+        logger.trace("COMPLETED preprocessSdncActivateTnNssiRequest Process")
+    }
+
+
+    void validateSDNCResponse(DelegateExecution execution, String response) {
+        tnNssmfUtils.validateSDNCResponse(execution, response, method)
+    }
+
+
+    void updateAAIOrchStatus(DelegateExecution execution) {
+        logger.debug("Start updateAAIOrchStatus")
+        String tnNssiId = execution.getVariable("tnNssiId")
+        String orchStatus = execution.getVariable("orchestrationStatus")
+
+        try {
+            ServiceInstance si = new ServiceInstance()
+            si.setOrchestrationStatus(orchStatus)
+            AAIResourcesClient client = getAAIClient()
+            AAIResourceUri uri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(tnNssiId))
+            client.update(uri, si)
+        } catch (BpmnError e) {
+            throw e
+        } catch (Exception ex) {
+            String msg = "Exception in CreateSliceService.updateAAIOrchStatus " + ex.getMessage()
+            logger.info(msg)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+        }
+
+        logger.debug("Finish updateAAIOrchStatus")
+    }
+
+    void prepareUpdateJobStatus(DelegateExecution execution,
+                                String status,
+                                String progress,
+                                String statusDescription) {
+        String serviceId = execution.getVariable("serviceInstanceID")
+        String jobId = execution.getVariable("jobId")
+        String nsiId = execution.getVariable("nsiId")
+        String operType = execution.getVariable("actionType")
+
+
+        ResourceOperationStatus roStatus = new ResourceOperationStatus()
+        roStatus.setServiceId(serviceId)
+        roStatus.setOperationId(jobId)
+        roStatus.setResourceTemplateUUID(nsiId)
+        roStatus.setOperType(operType)
+        roStatus.setProgress(progress)
+        roStatus.setStatus(status)
+        roStatus.setStatusDescription(statusDescription)
+        requestDBUtil.prepareUpdateResourceOperationStatus(execution, status)
+    }
+
+}
+
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateAccessNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateAccessNSSI.groovy
new file mode 100644 (file)
index 0000000..fc14da3
--- /dev/null
@@ -0,0 +1,1043 @@
+/*
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ # Copyright (c) 2020, Wipro Limited.
+ #
+ # Licensed under the Apache License, Version 2.0 (the "License")
+ # you may not use this file except in compliance with the License.
+ # You may obtain a copy of the License at
+ #
+ #       http://www.apache.org/licenses/LICENSE-2.0
+ #
+ # Unless required by applicable law or agreed to in writing, software
+ # distributed under the License is distributed on an "AS IS" BASIS,
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ # See the License for the specific language governing permissions and
+ # limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.scripts
+
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
+import org.onap.so.bpmn.common.scripts.ExceptionUtil
+import org.onap.so.bpmn.common.scripts.NssmfAdapterUtils
+import org.onap.so.bpmn.common.scripts.OofUtils
+import org.onap.so.bpmn.common.scripts.RequestDBUtil
+import org.onap.so.bpmn.core.json.JsonUtils
+import org.onap.so.db.request.beans.ResourceOperationStatus
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+import java.sql.Timestamp
+import java.util.List
+import static org.apache.commons.lang3.StringUtils.isBlank
+import com.google.gson.JsonObject
+import com.fasterxml.jackson.databind.ObjectMapper
+import com.google.gson.JsonArray
+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.beans.nsmf.AllocateTnNssi
+import org.onap.so.beans.nsmf.EsrInfo
+import org.onap.so.bpmn.core.UrnPropertiesReader
+import org.onap.so.bpmn.core.domain.ServiceDecomposition
+import org.onap.so.bpmn.core.domain.ServiceInstance
+import org.onap.so.bpmn.core.domain.ServiceProxy
+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.aaiclient.client.aai.AAINamespaceConstants
+import org.onap.aaiclient.client.aai.AAIObjectType
+import org.onap.aai.domain.yang.NetworkPolicy
+import org.onap.aai.domain.yang.NetworkRoute
+
+class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor {
+
+       String Prefix="AASS_"
+       ExceptionUtil exceptionUtil = new ExceptionUtil()
+       RequestDBUtil requestDBUtil = new RequestDBUtil()
+       JsonUtils jsonUtil = new JsonUtils()
+       OofUtils oofUtils = new OofUtils()
+       AnNssmfUtils anNssmfUtils = new AnNssmfUtils()
+       ObjectMapper objectMapper = new ObjectMapper();
+       private NssmfAdapterUtils nssmfAdapterUtils = new NssmfAdapterUtils(httpClientFactory, jsonUtil)
+
+       private static final Logger logger = LoggerFactory.getLogger(DoAllocateAccessNSSI.class)
+
+       @Override
+       void preProcessRequest(DelegateExecution execution) {
+               logger.debug(Prefix + "preProcessRequest Start")
+               execution.setVariable("prefix", Prefix)
+               execution.setVariable("startTime", System.currentTimeMillis())
+               def msg
+               try {
+
+                       logger.debug("input variables : msoRequestId - "+execution.getVariable("msoRequestId")
+                                       +" modelInvariantUuid - "+execution.getVariable("modelInvariantUuid")+
+                                       " modelUuid - "+execution.getVariable("modelUuid")+
+                                       " globalSubscriberId - "+execution.getVariable("globalSubscriberId")+
+                                       " dummyServiceId - "+ execution.getVariable("dummyServiceId")+
+                                       " nsiId - "+execution.getVariable("nsiId")+
+                                       " networkType - "+execution.getVariable("networkType")+
+                                       " subscriptionServiceType - "+execution.getVariable("subscriptionServiceType")+
+                                       " jobId - "+execution.getVariable("jobId")+
+                                       " sliceParams - "+execution.getVariable("sliceParams")+
+                                       " servicename - "+ execution.getVariable("servicename"))
+
+                       //validate slice subnet inputs
+
+                       String sliceParams = execution.getVariable("sliceParams")
+                       String sliceProfile = jsonUtil.getJsonValue(sliceParams, "sliceProfile")
+                       if (isBlank(sliceProfile)) {
+                               msg = "Input sliceProfile is null"
+                               logger.debug(msg)
+                               exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+                       } else {
+                               execution.setVariable("sliceProfile", sliceProfile)
+                       }
+                       String sliceProfileId = jsonUtil.getJsonValue(sliceProfile, "sliceProfileId")
+                       def snssaiList = jsonUtil.StringArrayToList(jsonUtil.getJsonValue(sliceProfile, "snssaiList"))
+                       def plmnIdList = jsonUtil.StringArrayToList(jsonUtil.getJsonValue(sliceProfile, "plmnIdList"))
+                       def coverageAreaTAList = jsonUtil.StringArrayToList(jsonUtil.getJsonValue(sliceProfile, "coverageAreaTAList"))
+
+                       if (isBlank(sliceProfileId) || (snssaiList.empty) || (plmnIdList.empty)
+                       || (coverageAreaTAList.empty)) {
+
+                               msg = "Mandatory slice profile fields are empty"
+                               logger.debug(msg)
+                               exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+                       } else {
+                               execution.setVariable("sliceProfileId", sliceProfileId)
+                               execution.setVariable("snssaiList", snssaiList)
+                               execution.setVariable("plmnIdList", plmnIdList)
+                               execution.setVariable("coverageAreaTAList", coverageAreaTAList)
+                       }
+                       String nsiName = jsonUtil.getJsonValue(sliceParams, "nsiInfo.nsiName")
+                       String scriptName = jsonUtil.getJsonValue(sliceParams, "scriptName")
+                       execution.setVariable("nsiName", nsiName)
+                       execution.setVariable("scriptName", scriptName)
+                       //generate RAN,RAN NF NSSIs - will be re assigned if oof returns existing NSSI
+                       String RANServiceInstanceId = UUID.randomUUID().toString()
+                       String RANNFServiceInstanceId = UUID.randomUUID().toString()
+                       logger.debug("RAN serviceInstance Id "+RANServiceInstanceId)
+                       logger.debug("RAN NF serviceInstance Id "+RANNFServiceInstanceId)                       
+                       execution.setVariable("RANServiceInstanceId", RANServiceInstanceId)
+                       execution.setVariable("RANNFServiceInstanceId", RANNFServiceInstanceId)
+                       execution.setVariable("ranNssiPreferReuse", true)
+                       execution.setVariable("ranNfNssiPreferReuse", true)
+                       execution.setVariable("job_timeout", 10)
+                       
+                       //set BH end point
+                       List<String> BH_endPoints = jsonUtil.StringArrayToList(jsonUtil.getJsonValue(sliceParams, "endPoints"))
+                       logger.debug("BH end points list : "+BH_endPoints)
+                       if(BH_endPoints.empty) {
+                               msg = "End point info is empty"
+                               logger.debug(msg)
+                               exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+                       }else {
+                               execution.setVariable("bh_endpoint", BH_endPoints.get(0))
+                       }
+                       
+               } catch(BpmnError e) {
+                       throw e
+               } catch(Exception ex) {
+                       msg = "Exception in DoAllocateAccessNSSI.preProcessRequest " + ex.getMessage()
+                       logger.debug(msg)
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+               }
+               logger.debug(Prefix + "preProcessRequest Exit")
+       }
+
+       /*
+        * Prepare request params for decomposing RAN NSST
+        */
+
+       def prepareDecomposeService = { DelegateExecution execution ->
+               logger.debug(Prefix+"prepareDecomposeService method start")
+               String RANServiceInstanceId = execution.getVariable("RANServiceInstanceId")
+               String modelInvariantUuid = execution.getVariable("modelInvariantUuid")
+               String modelUuid = execution.getVariable("modelUuid")
+               String serviceModelInfo = """{
+            "modelInvariantUuid":"${modelInvariantUuid}",
+            "modelUuid":"${modelUuid}",
+            "modelVersion":""
+             }"""
+               execution.setVariable("serviceModelInfo", serviceModelInfo)
+               execution.setVariable("serviceInstanceId", RANServiceInstanceId)
+               logger.debug("serviceModelInfo : "+serviceModelInfo)
+               logger.debug("Finish RAN NSST prepareDecomposeService")
+       }
+
+       /* process the decompose service(RAN NSST) response
+        * 
+        */
+       def processDecomposition = { DelegateExecution execution ->
+               logger.debug(Prefix+"processDecomposition method start")
+               ServiceDecomposition ranNsstServiceDecomposition = execution.getVariable("ranNsstServiceDecomposition")
+               logger.debug("ranNsstServiceDecomposition : "+ranNsstServiceDecomposition.toString())
+               //RAN NSST decomposition
+               String ranModelVersion = ranNsstServiceDecomposition.getModelInfo().getModelVersion()
+               String ranModelName = ranNsstServiceDecomposition.getModelInfo().getModelName()
+               List<ServiceProxy> serviceProxyList = ranNsstServiceDecomposition.getServiceProxy()
+               List<String> nsstInfoList = new ArrayList<>()
+               for(ServiceProxy serviceProxy : serviceProxyList)
+               {
+                       String nsstModelUuid = serviceProxy.getModelInfo().getModelUuid()
+                       String nsstModelInvariantUuid = serviceProxy.getModelInfo().getModelInvariantUuid()
+                       String name = serviceProxy.getModelInfo().getModelName()
+                       String nsstServiceModelInfo = """{
+            "UUID":"${nsstModelUuid}",
+            "invariantUUID":"${nsstModelInvariantUuid}",
+            "name":"${name}"
+             }"""
+                       nsstInfoList.add(nsstServiceModelInfo)
+               }
+               int currentIndex=0
+               int maxIndex=nsstInfoList.size()
+               if(maxIndex < 1)
+               {
+                       String msg = "Exception in RAN NSST processDecomposition. There is no NSST associated with RAN NSST "
+                       logger.info(msg)
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+               }
+               execution.setVariable("ranNsstInfoList",nsstInfoList)
+               execution.setVariable("ranModelVersion", ranModelVersion)
+               execution.setVariable("ranModelName", ranModelName)
+               execution.setVariable("currentIndex",currentIndex)
+               execution.setVariable("maxIndex",maxIndex)
+               logger.debug(Prefix+"processDecomposition maxIndex value - "+maxIndex)
+       }
+
+       /*
+        * Function to subnet capabilities from nssmf adapter
+        */
+       def getSubnetCapabilities = { DelegateExecution execution ->
+               logger.debug(Prefix+"getSubnetCapabilities method start")
+
+               String tnNssmfRequest = anNssmfUtils.buildCreateTNNSSMFSubnetCapabilityRequest()
+
+               String urlString = "/api/rest/provMns/v1/NSS/subnetCapabilityQuery"
+
+               String tnNssmfResponse = nssmfAdapterUtils.sendPostRequestNSSMF(execution, urlString, tnNssmfRequest)
+
+               if (tnNssmfResponse != null) {
+                       String FHCapabilities= jsonUtil.getJsonValue(tnNssmfResponse, "TN_FH")
+                       String MHCapabilities = jsonUtil.getJsonValue(tnNssmfResponse, "TN_MH")
+                       execution.setVariable("FHCapabilities",FHCapabilities)
+                       execution.setVariable("MHCapabilities",MHCapabilities)
+
+               } else {
+                       logger.error("received error message from NSSMF : "+ tnNssmfResponse)
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 7000,"Received a Bad Sync Response from NSSMF.")
+               }
+               String anNssmfRequest = anNssmfUtils.buildCreateANNFNSSMFSubnetCapabilityRequest()
+
+               String anNssmfResponse = nssmfAdapterUtils.sendPostRequestNSSMF(execution, urlString, anNssmfRequest)
+
+               if (anNssmfResponse != null) {
+                       String ANNFCapabilities = jsonUtil.getJsonValue(anNssmfResponse, "AN_NF")
+                       execution.setVariable("ANNFCapabilities",ANNFCapabilities)
+
+               } else {
+                       logger.error("received error message from NSSMF : "+ anNssmfResponse)
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 7000,"Received a Bad Sync Response from NSSMF.")
+               }
+       }
+
+       /*
+        * prepare OOF request for RAN NSSI selection
+        */
+       def prepareOofRequestForRanNSS = { DelegateExecution execution ->
+               logger.debug(Prefix+"prepareOofRequestForRanNSS method start")
+
+               String urlString = UrnPropertiesReader.getVariable("mso.oof.endpoint", execution)
+               logger.debug( "get NSSI option OOF Url: " + urlString)
+
+               //build oof request body
+               boolean ranNssiPreferReuse = execution.getVariable("ranNssiPreferReuse");
+               String requestId = execution.getVariable("msoRequestId")
+               String messageType = "NSISelectionResponse"
+               Map<String, Object> profileInfo = objectMapper.readValue(execution.getVariable("sliceProfile"), Map.class)
+               String modelUuid = execution.getVariable("modelUuid")
+               String modelInvariantUuid = execution.getVariable("modelInvariantUuid")
+               String modelName = execution.getVariable("ranModelName")
+               String timeout = UrnPropertiesReader.getVariable("mso.adapters.oof.timeout", execution);
+               List<String> nsstInfoList =  objectMapper.readValue(execution.getVariable("nsstInfoList"), List.class)
+               JsonArray capabilitiesList = new JsonArray()
+               String FHCapabilities = execution.getVariable("FHCapabilities")
+               String MHCapabilities = execution.getVariable("MHCapabilities")
+               String ANNFCapabilities = execution.getVariable("ANNFCapabilities")
+               JsonObject FH = new JsonObject()
+               JsonObject MH = new JsonObject()
+               JsonObject ANNF = new JsonObject()
+               FH.addProperty("domainType", "TN_FH")
+               FH.addProperty("capabilityDetails", FHCapabilities)
+               MH.addProperty("domainType", "TN_MH")
+               MH.addProperty("capabilityDetails", MHCapabilities)
+               ANNF.addProperty("domainType", "AN_NF")
+               ANNF.addProperty("capabilityDetails", FHCapabilities)
+               capabilitiesList.add(FH)
+               capabilitiesList.add(MH)
+               capabilitiesList.add(ANNF)
+
+               execution.setVariable("nssiSelection_Url", "/api/oof/selection/nsi/v1")
+               execution.setVariable("nssiSelection_messageType",messageType)
+               execution.setVariable("nssiSelection_correlator",requestId)
+               execution.setVariable("nssiSelection_timeout",timeout)
+
+               String oofRequest = anNssmfUtils.buildSelectRANNSSIRequest(requestId, messageType, modelUuid,modelInvariantUuid,
+                               modelName, profileInfo, nsstInfoList, capabilitiesList, ranNssiPreferReuse)
+
+               execution.setVariable("nssiSelection_oofRequest",oofRequest)
+               logger.debug("Sending request to OOF: " + oofRequest)
+       }
+       /*
+        * process OOF response for RAN NSSI selection
+        */
+       def processOofResponseForRanNSS = { DelegateExecution execution ->
+               logger.debug(Prefix+"processOofResponseForRanNSS method start")
+               String oofResponse = execution.getVariable("nssiSelection_asyncCallbackResponse")
+               String requestStatus = jsonUtil.getJsonValue(oofResponse, "requestStatus")
+               if(requestStatus.equals("completed")) {
+                       List<String> solution = jsonUtil.StringArrayToList(jsonUtil.getJsonValue(oofResponse, "solutions"))
+                       boolean existingNSI = jsonUtil.getJsonValue(solution.get(0), "existingNSI")
+                       if(existingNSI) {
+                               def sharedNSISolution = jsonUtil.getJsonValue(solution.get(0), "sharedNSISolution")
+                               execution.setVariable("sharedRanNSSISolution", sharedNSISolution)
+                               logger.debug("sharedRanNSSISolution from OOF "+sharedNSISolution)
+                               String RANServiceInstanceId = jsonUtil.getJsonValue(solution.get(0), "sharedNSISolution.NSIId")
+                               execution.setVariable("RANServiceInstanceId", RANServiceInstanceId)
+                               ServiceInstance serviceInstance = new ServiceInstance();
+                               serviceInstance.setInstanceId(RANServiceInstanceId);
+                               ServiceDecomposition serviceDecomposition = execution.getVariable("ranNsstServiceDecomposition")
+                               serviceDecomposition.setServiceInstance(serviceInstance);
+                               execution.setVariable("ranNsstServiceDecomposition", serviceDecomposition)
+                               execution.setVariable("isRspRanNssi", true)
+                       }else {
+                               def sliceProfiles = jsonUtil.getJsonValue(solution.get(0), "newNSISolution.sliceProfiles")
+                               execution.setVariable("RanConstituentSliceProfiles", sliceProfiles)
+                               logger.debug("RanConstituentSliceProfiles list from OOF "+sliceProfiles)
+                       }
+               }else {
+                       String statusMessage = jsonUtil.getJsonValue(oofResponse, "statusMessage")
+                       logger.error("received failed status from oof "+ statusMessage)
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 7000,"Received a failed Async Response from OOF : "+statusMessage)
+               }
+
+       }
+
+       def prepareModifyAccessNssiInputs = { DelegateExecution execution ->
+               logger.debug(Prefix+"prepareModifyAccessNssiInputs method start")
+               String jobId = UUID.randomUUID().toString()
+               execution.setVariable("modifyRanNssiJobId", jobId)              
+               String snssaiList = execution.getVariable("snssaiList")
+               String sliceParams = execution.getVariable("sliceParams")
+               String sliceProfileId = execution.getVariable("sliceProfileId")
+               String nsiInfo = jsonUtil.getJsonValue(sliceParams, "nsiInfo")
+               String scriptName = execution.getVariable("scriptName")
+               
+               JsonObject modifySliceParams = new JsonObject()
+               modifySliceParams.addProperty("modifyAction", "allocate")
+               modifySliceParams.addProperty("snssaiList", snssaiList)
+               modifySliceParams.addProperty("sliceProfileId", sliceProfileId)
+               modifySliceParams.addProperty("nsiInfo", nsiInfo)
+               modifySliceParams.addProperty("scriptName", scriptName)
+               
+               execution.setVariable("modifySliceParams", modifySliceParams.toString())
+               //create operation status in request db
+               String serviceId = execution.getVariable("RANServiceInstanceId")
+               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)
+       }
+       
+       def createModifyNssiQueryJobStatus = { DelegateExecution execution ->
+               logger.debug(Prefix+"createModifyNssiQueryJobStatus method start")
+               EsrInfo esrInfo = new EsrInfo()
+               esrInfo.setNetworkType("AN")
+               esrInfo.setVendor("ONAP")
+               String esrInfoString = objectMapper.writeValueAsString(esrInfo)
+               execution.setVariable("esrInfo", esrInfoString)
+               JsonObject serviceInfo = new JsonObject()
+               serviceInfo.addProperty("nssiId", execution.getVariable("RANServiceInstanceId"))
+               serviceInfo.addProperty("nsiId", execution.getVariable("nsiId"))
+               serviceInfo.addProperty("nssiName", execution.getVariable("servicename"))
+               String sST = jsonUtil.getJsonValue(execution.getVariable("sliceProfile"), "sST")
+               serviceInfo.addProperty("sST", sST)
+               serviceInfo.addProperty("PLMNIdList", objectMapper.writeValueAsString(execution.getVariable("plmnIdList")))
+               serviceInfo.addProperty("globalSubscriberId", execution.getVariable("globalSubscriberId"))
+               serviceInfo.addProperty("subscriptionServiceType", execution.getVariable("subscriptionServiceType"))
+               serviceInfo.addProperty("serviceInvariantUuid", execution.getVariable("modelInvariantUuid"))
+               serviceInfo.addProperty("serviceUuid", execution.getVariable("modelUuid"))
+               execution.setVariable("serviceInfo", serviceInfo.toString())
+               execution.setVariable("responseId", "")
+       }
+       def prepareNsstDecomposeService = { DelegateExecution execution ->
+               logger.debug(Prefix+"prepareNsstDecomposeService method start")
+               List<String> nsstInfoList = objectMapper.readValue(execution.getVariable("ranNsstInfoList"), List.class)
+               int currentIndex = execution.getVariable("currentIndex")
+               int maxIndex = execution.getVariable("maxIndex")
+               logger.debug(Prefix+"prepareNsstDecomposeService : currentIndex value - "+currentIndex+" maxIndex : "+maxIndex)
+               if(currentIndex<maxIndex) {
+                       String nsstInfo = nsstInfoList.get(currentIndex)
+                       String modelInvariantUuid = jsonUtil.getJsonValue(nsstInfo, "invariantUUID")
+                       String modelUuid = jsonUtil.getJsonValue(nsstInfo, "UUID")
+                       
+                       String serviceModelInfo = """{
+            "modelInvariantUuid":"${modelInvariantUuid}",
+            "modelUuid":"${modelUuid}",
+            "modelVersion":""
+             }"""
+                       execution.setVariable("serviceModelInfo", serviceModelInfo)
+                       execution.setVariable("serviceInstanceId", "")
+                       logger.debug("serviceModelInfo : "+serviceModelInfo)
+                       currentIndex++
+                       execution.setVariable("currentIndex", currentIndex)
+               }else {
+                       logger.error("nsstList decomposition error ")
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 1000, "nsstList decomposition error ")
+               }
+               
+       }
+       def processNsstDecomposition = { DelegateExecution execution ->
+               logger.debug(Prefix+"processNsstDecomposition method start")
+               ServiceDecomposition decomposedNsst = execution.getVariable("nsstServiceDecomposition")
+               logger.debug("decomposedNsst : "+decomposedNsst.toString())
+               
+               String nsstType = decomposedNsst.getServiceRole() //domainType
+               String modelVersion = decomposedNsst.getModelInfo().getModelVersion()
+               String modelName = decomposedNsst.getModelInfo().getModelName()
+               String modelUuid = decomposedNsst.getModelInfo().getModelUuid()
+               String modelInvariantUuid = decomposedNsst.getModelInfo().getModelInvariantUuid()
+               
+               switch(nsstType) {
+                       case "AN_NF":
+                               execution.setVariable("ANNF_modelInvariantUuid", modelInvariantUuid)
+                               execution.setVariable("ANNF_modelUuid", modelUuid)
+                               execution.setVariable("ANNF_modelVersion", modelVersion)
+                               execution.setVariable("ANNF_modelName", modelName)
+                               execution.setVariable("ANNF_ServiceDecomposition", decomposedNsst)
+                               break
+                       case "TN_FH":
+                               execution.setVariable("TNFH_modelInvariantUuid", modelInvariantUuid)
+                               execution.setVariable("TNFH_modelUuid", modelUuid)
+                               execution.setVariable("TNFH_modelVersion", modelVersion)
+                               execution.setVariable("TNFH_modelName", modelName)
+                               execution.setVariable("TNFH_ServiceDecomposition", decomposedNsst)
+                               break
+                       case "TN_MH":
+                               execution.setVariable("TNMH_modelInvariantUuid", modelInvariantUuid)
+                               execution.setVariable("TNMH_modelUuid", modelUuid)
+                               execution.setVariable("TNMH_modelVersion", modelVersion)
+                               execution.setVariable("TNMH_modelName", modelName)
+                               execution.setVariable("TNMH_ServiceDecomposition", decomposedNsst)
+                               break
+                       default:
+                               logger.debug("No expected match found for current nsstType")
+                               logger.error("No expected match found for current nsstType "+ nsstType)
+                               exceptionUtil.buildAndThrowWorkflowException(execution, 1000,"No expected match found for current nsstType "+ nsstType)
+               }
+               boolean isAllNsstsDecomposed = false
+               int currentIndex = execution.getVariable("currentIndex")
+               int maxIndex = execution.getVariable("maxIndex")
+               if(currentIndex == maxIndex) {
+                       isAllNsstsDecomposed = true
+               }
+               execution.setVariable("isAllNsstsDecomposed", isAllNsstsDecomposed)
+       }
+       /*
+        * prepare OOF request for NF RAN NSSI selection
+        */
+       def prepareOofRequestForRanNfNSS = { DelegateExecution execution ->
+               logger.debug(Prefix+"prepareOofRequestForRanNfNSS method start")
+               String urlString = UrnPropertiesReader.getVariable("mso.oof.endpoint", execution)
+               logger.debug( "get NSSI option OOF Url: " + urlString)
+
+               //build oof request body
+               boolean ranNfNssiPreferReuse = execution.getVariable("ranNfNssiPreferReuse");
+               String requestId = execution.getVariable("msoRequestId")
+               String messageType = "NSSISelectionResponse"
+               List<String> ranConstituentSliceProfiles = jsonUtil.StringArrayToList(execution.getVariable("RanConstituentSliceProfiles"))
+               anNssmfUtils.createDomainWiseSliceProfiles(ranConstituentSliceProfiles, execution)
+               Map<String, Object> profileInfo = objectMapper.readValue(execution.getVariable("ranNfSliceProfile"), Map.class)
+               String modelUuid = execution.getVariable("ANNF_modelUuid")
+               String modelInvariantUuid = execution.getVariable("ANNF_modelInvariantUuid")
+               String modelName = execution.getVariable("ANNF_modelName")
+               String timeout = UrnPropertiesReader.getVariable("mso.adapters.oof.timeout", execution);
+
+               execution.setVariable("nssiSelection_Url", "/api/oof/selection/nssi/v1")
+               execution.setVariable("nssiSelection_messageType",messageType)
+               execution.setVariable("nssiSelection_correlator",requestId)
+               execution.setVariable("nssiSelection_timeout",timeout)
+
+               String oofRequest = oofUtils.buildSelectNSSIRequest(requestId, messageType, modelUuid, modelInvariantUuid, modelName, profileInfo)
+
+               execution.setVariable("nssiSelection_oofRequest",oofRequest)
+       }
+       /*
+        * process OOF response for RAN NF NSSI selection
+        */
+       def processOofResponseForRanNfNSS = { DelegateExecution execution ->
+               logger.debug(Prefix+"processOofResponseForRanNfNSS method start")
+               String oofResponse = execution.getVariable("nfNssiSelection_asyncCallbackResponse")
+               String requestStatus = jsonUtil.getJsonValue(oofResponse, "requestStatus")
+               if(requestStatus.equals("completed")) {
+                       List<String> solution = jsonUtil.StringArrayToList(jsonUtil.getJsonValue(oofResponse, "solutions"))             
+                       if(solution.size()>=1) {
+                               String ranNfNssiId = jsonUtil.getJsonValue(solution.get(0), "NSSIId")
+                               String invariantUuid = jsonUtil.getJsonValue(solution.get(0), "invariantUUID")
+                               String uuid = jsonUtil.getJsonValue(solution.get(0), "UUID")
+                               String nssiName = jsonUtil.getJsonValue(solution.get(0), "NSSIName")
+                               execution.setVariable("RANNFServiceInstanceId", ranNfNssiId)
+                               execution.setVariable("RANNFInvariantUUID", invariantUuid)
+                               execution.setVariable("RANNFUUID", uuid)
+                               execution.setVariable("RANNFNssiName", nssiName)
+                               logger.debug("RANNFServiceInstanceId from OOF "+ranNfNssiId)
+                               
+                               ServiceInstance serviceInstance = new ServiceInstance();
+                               serviceInstance.setInstanceId(ranNfNssiId);
+                               ServiceDecomposition serviceDecomposition = execution.getVariable("ANNF_ServiceDecomposition")
+                               serviceDecomposition.setServiceInstance(serviceInstance);
+                               execution.setVariable("ANNF_ServiceDecomposition", serviceDecomposition)
+                               execution.setVariable("isRspRanNfNssi", true)
+                       }else {
+                               logger.debug("No solutions returned from OOF .. Create new RAN NF NSSI")
+                       }
+               }else {
+                       String statusMessage = jsonUtil.getJsonValue(oofResponse, "statusMessage")
+                       logger.error("received failed status from oof "+ statusMessage)
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 7000,"Received a failed Async Response from OOF : "+statusMessage)
+               }
+       }
+
+       def createSliceProfilesInAai = { DelegateExecution execution ->
+               logger.debug(Prefix+"createSliceProfilesInAai method start")
+               anNssmfUtils.createSliceProfilesInAai(execution)
+       }
+
+       def processRanNfModifyRsp = { DelegateExecution execution ->
+               logger.debug(Prefix+"processRanNfModifyRsp method start")
+               anNssmfUtils.processRanNfModifyRsp(execution)
+               //create RAN NSSI 
+               org.onap.aai.domain.yang.ServiceInstance ANServiceInstance = new ServiceInstance();
+               //AN instance creation
+               ANServiceInstance.setServiceInstanceId(execution.getVariable("RANServiceInstanceId"))
+               String sliceInstanceName = execution.getVariable("servicename")
+               ANServiceInstance.setServiceInstanceName(sliceInstanceName)
+               String serviceType = jsonUtil.getJsonValue(execution.getVariable("sliceProfile"), "sST")
+               ANServiceInstance.setServiceType(serviceType)
+               String serviceStatus = "deactivated"
+               ANServiceInstance.setOrchestrationStatus(serviceStatus)
+               String serviceInstanceLocationid = jsonUtil.getJsonValue(execution.getVariable("sliceProfile"), "plmnIdList")
+               ANServiceInstance.setServiceInstanceLocationId(serviceInstanceLocationid)
+               String serviceRole = "nssi"
+               ANServiceInstance.setServiceRole(serviceRole)
+               List<String> snssaiList = objectMapper.readValue(execution.getVariable("snssaiList"), List.class)
+               String snssai = snssaiList.get(0)
+               ANServiceInstance.setEnvironmentContext(snssai)
+               ANServiceInstance.setWorkloadContext("AN")
+               
+               logger.debug("completed AN service instance build "+ ANServiceInstance.toString())
+               String msg = ""
+               try {
+       
+                       AAIResourcesClient client = new AAIResourcesClient()
+                       AAIResourceUri nssiServiceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(execution.getVariable("RANServiceInstanceId")))
+                       client.create(nssiServiceUri, ANServiceInstance)
+       
+               } catch (BpmnError e) {
+                       throw e
+               } catch (Exception ex) {
+                       msg = "Exception in AnNssmfUtils.createSliceProfilesInAai " + ex.getMessage()
+                       logger.info(msg)
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+               }
+               //end point update
+               createEndPointsInAai(execution)
+       }
+       
+       def createSdnrRequest = { DelegateExecution execution ->
+               logger.debug(Prefix+"createSdnrRequest method start")
+               String callbackUrl = UrnPropertiesReader.getVariable("mso.workflow.message.endpoint") + "/AsyncSdnrResponse/"+execution.getVariable("msoRequestId")
+               String sdnrRequest = buildSdnrAllocateRequest(execution, "allocate", "InstantiateRANSlice", callbackUrl)
+               execution.setVariable("createNSSI_sdnrRequest", sdnrRequest)
+               execution.setVariable("createNSSI_timeout", "PT10M")
+               execution.setVariable("createNSSI_correlator", execution.getVariable("msoRequestId"))
+               execution.setVariable("createNSSI_messageType", "AsyncSdnrResponse");
+       }
+
+       def processSdnrResponse = { DelegateExecution execution ->
+               logger.debug(Prefix+"processSdnrResponse method start")
+               String SDNRResponse = execution.getVariable("SDNR_asyncCallbackResponse")
+               String status = jsonUtil.getJsonValue(SDNRResponse, "status")
+               if(status.equalsIgnoreCase("success")) {
+                       String nfIds = jsonUtil.getJsonValue(SDNRResponse, "nfIds")
+                       execution.setVariable("ranNfIdsJson", nfIds)
+               }else {
+                       String reason = jsonUtil.getJsonValue(SDNRResponse, "reason")
+                       logger.error("received failed status from SDNR "+ reason)
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 7000,"received failed status from SDNR "+ reason)
+               }
+               logger.debug("response from SDNR "+SDNRResponse)
+       }
+
+       def updateAaiWithRANInstances = { DelegateExecution execution ->
+               logger.debug(Prefix+"updateAaiWithRANInstances method start")
+               //create RAN NSSI 
+               org.onap.aai.domain.yang.ServiceInstance ANServiceInstance = new ServiceInstance();
+               org.onap.aai.domain.yang.ServiceInstance ANNFServiceInstance = new ServiceInstance();
+               //AN instance creation
+               ANServiceInstance.setServiceInstanceId(execution.getVariable("RANServiceInstanceId"))
+               String sliceInstanceName = execution.getVariable("servicename")
+               ANServiceInstance.setServiceInstanceName(sliceInstanceName)
+               String serviceType = jsonUtil.getJsonValue(execution.getVariable("sliceProfile"), "sST")
+               ANServiceInstance.setServiceType(serviceType)
+               String serviceStatus = "deactivated"
+               ANServiceInstance.setOrchestrationStatus(serviceStatus)
+               String serviceInstanceLocationid = jsonUtil.getJsonValue(execution.getVariable("sliceProfile"), "plmnIdList")
+               ANServiceInstance.setServiceInstanceLocationId(serviceInstanceLocationid)
+               String serviceRole = "nssi"
+               ANServiceInstance.setServiceRole(serviceRole)
+               List<String> snssaiList = objectMapper.readValue(execution.getVariable("snssaiList"), List.class)
+               String snssai = snssaiList.get(0)
+               ANServiceInstance.setEnvironmentContext(snssai)
+               ANServiceInstance.setWorkloadContext("AN")
+               
+               logger.debug("completed AN service instance build "+ ANServiceInstance.toString())
+               //create RAN NF NSSI
+               ANNFServiceInstance.setServiceInstanceId(execution.getVariable("RANNFServiceInstanceId"))
+               sliceInstanceName = execution.getVariable("ANNF_modelName")
+               ANNFServiceInstance.setServiceInstanceName(sliceInstanceName)
+               ANNFServiceInstance.setServiceType(serviceType)
+               ANNFServiceInstance.setOrchestrationStatus(serviceStatus)
+               serviceInstanceLocationid = jsonUtil.getJsonValue(execution.getVariable("ranNfSliceProfile"), "plmnIdList")
+               ANNFServiceInstance.setServiceInstanceLocationId(serviceInstanceLocationid)
+               ANNFServiceInstance.setServiceRole(serviceRole)
+               snssaiList = objectMapper.readValue(execution.getVariable("snssaiList"), List.class)
+               snssai = snssaiList.get(0)
+               ANNFServiceInstance.setEnvironmentContext(snssai)
+               ANNFServiceInstance.setWorkloadContext("AN-NF")
+               logger.debug("completed AN service instance build "+ ANNFServiceInstance.toString())
+               
+               String msg = ""
+               try {
+       
+                       AAIResourcesClient client = new AAIResourcesClient()
+                       AAIResourceUri nssiServiceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(execution.getVariable("RANServiceInstanceId")))
+                       client.create(nssiServiceUri, ANServiceInstance)
+       
+                       AAIResourceUri nssiServiceUri1 = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(execution.getVariable("RANNFServiceInstanceId")))
+                       client.create(nssiServiceUri1, ANNFServiceInstance)
+       
+               } catch (BpmnError e) {
+                       throw e
+               } catch (Exception ex) {
+                       msg = "Exception in AnNssmfUtils.createSliceProfilesInAai " + ex.getMessage()
+                       logger.info(msg)
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+               }
+               //end point update
+               createEndPointsInAai(execution)
+       }
+       def prepareTnFhRequest = { DelegateExecution execution ->
+               logger.debug(Prefix+"prepareTnFhRequest method start")
+
+               String nssmfRequest = anNssmfUtils.buildCreateNSSMFRequest(execution, "TN_FH", "allocate")
+               String urlString = "/api/rest/provMns/v1/NSS/SliceProfiles"
+               String nssmfResponse = nssmfAdapterUtils.sendPostRequestNSSMF(execution, urlString, nssmfRequest)
+
+               if (nssmfResponse != null) {
+                       execution.setVariable("nssmfResponse", nssmfResponse)
+                       String jobId = jsonUtil.getJsonValue(nssmfResponse, "jobId")
+                       execution.setVariable("TNFH_jobId",jobId)
+               } else {
+                       logger.error("received error message from NSSMF : "+ nssmfResponse)
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 7000,"Received a Bad Sync Response from NSSMF.")
+               }
+               logger.debug("Exit prepareTnFhRequest")
+
+       }
+       def prepareTnMhRequest = { DelegateExecution execution ->
+               logger.debug(Prefix+"prepareTnMhRequest method start")
+
+               String nssmfRequest = anNssmfUtils.buildCreateNSSMFRequest(execution, "TN_MH", "allocate")
+               String urlString = "/api/rest/provMns/v1/NSS/SliceProfiles"
+               String nssmfResponse = nssmfAdapterUtils.sendPostRequestNSSMF(execution, urlString, nssmfRequest)
+
+               if (nssmfResponse != null) {
+                       execution.setVariable("nssmfResponse", nssmfResponse)
+                       String jobId = jsonUtil.getJsonValue(nssmfResponse, "jobId")
+                       execution.setVariable("TNMH_jobId",jobId)
+               } else {
+                       logger.error("received error message from NSSMF : "+ nssmfResponse)
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 7000,"Received a Bad Sync Response from NSSMF.")
+               }
+               logger.debug("Exit prepareTnMhRequest")
+       }
+       
+       def createFhAllocateNssiJobQuery = { DelegateExecution execution ->
+               logger.debug(Prefix+"createModifyNssiQueryJobStatus method start")
+               createTnAllocateNssiJobQuery(execution, "TN_FH")                
+       }
+       
+       def createMhAllocateNssiJobQuery = { DelegateExecution execution ->
+               logger.debug(Prefix+"createModifyNssiQueryJobStatus method start")
+               createTnAllocateNssiJobQuery(execution, "TN_MH")
+       }
+       
+       private void createTnAllocateNssiJobQuery(DelegateExecution execution, String domainType) {
+               EsrInfo esrInfo = new EsrInfo()
+               esrInfo.setNetworkType("TN")
+               esrInfo.setVendor("ONAP")
+               String esrInfoString = objectMapper.writeValueAsString(esrInfo)
+               execution.setVariable("esrInfo", esrInfoString)
+               JsonObject serviceInfo = new JsonObject()
+               serviceInfo.addProperty("nssiId", null)
+               serviceInfo.addProperty("nsiId", execution.getVariable("nsiId"))
+               String sST = jsonUtil.getJsonValue(execution.getVariable("sliceProfile"), "sST")
+               serviceInfo.addProperty("sST", sST)
+               serviceInfo.addProperty("PLMNIdList", objectMapper.writeValueAsString(execution.getVariable("plmnIdList")))
+               serviceInfo.addProperty("globalSubscriberId", execution.getVariable("globalSubscriberId"))
+               serviceInfo.addProperty("subscriptionServiceType", execution.getVariable("subscriptionServiceType"))
+               if(domainType.equals("TN_FH")) {
+                       serviceInfo.addProperty("nssiName", execution.getVariable("TNFH_modelName"))
+                       serviceInfo.addProperty("serviceInvariantUuid", execution.getVariable("TNFH_modelInvariantUuid"))
+                       serviceInfo.addProperty("serviceUuid", execution.getVariable("TNFH_modelUuid"))
+               }else if(domainType.equals("TN_MH")) {
+                       serviceInfo.addProperty("nssiName", execution.getVariable("TNMH_modelName"))
+                       serviceInfo.addProperty("serviceInvariantUuid", execution.getVariable("TNMH_modelInvariantUuid"))
+                       serviceInfo.addProperty("serviceUuid", execution.getVariable("TNMH_modelUuid"))
+               }
+               execution.setVariable("serviceInfo", serviceInfo.toString())
+               execution.setVariable("responseId", "")
+       }
+       
+       def processFhAllocateNssiJobStatusRsp = { DelegateExecution execution ->
+               logger.debug(Prefix+"processJobStatusRsp method start")
+               String jobResponse = execution.getVariable("TNFH_jobResponse")
+               logger.debug("Job status response "+jobResponse)
+               String status = jsonUtil.getJsonValue(jobResponse, "responseDescriptor.status")
+               String nssi = jsonUtil.getJsonValue(jobResponse, "responseDescriptor.nssi")
+               if(status.equalsIgnoreCase("finished")) {
+                       execution.setVariable("TNFH_NSSI", nssi)
+                       logger.debug("Job successfully completed ... proceeding with flow for nssi : "+nssi)
+               }
+               else {
+                       String statusDescription = jsonUtil.getJsonValue(jobResponse, "responseDescriptor.statusDescription")
+                       logger.error("received failed status from job status query for nssi : "+nssi+" with status description : "+ statusDescription)
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 7000,"received failed status from job status query for nssi : "+nssi+" with status description : "+ statusDescription)
+               }
+       }
+       
+       def processMhAllocateNssiJobStatusRsp = { DelegateExecution execution ->
+               logger.debug(Prefix+"processJobStatusRsp method start")
+               String jobResponse = execution.getVariable("TNMH_jobResponse")
+               logger.debug("Job status response "+jobResponse)
+               String status = jsonUtil.getJsonValue(jobResponse, "responseDescriptor.status")
+               String nssi = jsonUtil.getJsonValue(jobResponse, "responseDescriptor.nssi")
+               if(status.equalsIgnoreCase("finished")) {
+                       execution.setVariable("TNMH_NSSI", nssi)
+                       logger.debug("Job successfully completed ... proceeding with flow for nssi : "+nssi)
+               }
+               else {
+                       String statusDescription = jsonUtil.getJsonValue(jobResponse, "responseDescriptor.statusDescription")
+                       logger.error("received failed status from job status query for nssi : "+nssi+" with status description : "+ statusDescription)
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 7000,"received failed status from job status query for nssi : "+nssi+" with status description : "+ statusDescription)
+               }
+       }
+       
+       def processModifyJobStatusRsp = { DelegateExecution execution ->
+               logger.debug(Prefix+"processJobStatusRsp method start")
+               String jobResponse = execution.getVariable("jobResponse")
+               logger.debug("Job status response "+jobResponse)
+               String status = jsonUtil.getJsonValue(jobResponse, "responseDescriptor.status")
+               String nssi = jsonUtil.getJsonValue(jobResponse, "responseDescriptor.nssi")
+               if(status.equalsIgnoreCase("finished")) {
+                       logger.debug("Job successfully completed ... proceeding with flow for nssi : "+nssi)
+               }
+               else {
+                       String statusDescription = jsonUtil.getJsonValue(jobResponse, "responseDescriptor.statusDescription")
+                       logger.error("received failed status from job status query for nssi : "+nssi+" with status description : "+ statusDescription)
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 7000,"received failed status from job status query for nssi : "+nssi+" with status description : "+ statusDescription)
+               }
+       }
+
+       def updateAairelationships = { DelegateExecution execution ->
+               logger.debug(Prefix + "updateAairelationships Start")
+               String msg = ""
+               try {
+                       def ANNF_serviceInstanceId = execution.getVariable("RANNFServiceInstanceId")
+                       def TNFH_serviceInstanceId = execution.getVariable("TNFH_NSSI")
+                       def TNMH_serviceInstanceId = execution.getVariable("TNMH_NSSI")
+                       def AN_profileInstanceId = execution.getVariable("sliceProfileId")
+                       def AN_NSSI = execution.getVariable("RANServiceInstanceId")
+                       def ANNF_profileInstanceId = execution.getVariable("ANNF_sliceProfileInstanceId")
+                       def TNFH_profileInstanceId = execution.getVariable("TNFH_sliceProfileInstanceId")
+                       def TNMH_profileInstanceId = execution.getVariable("TNMH_sliceProfileInstanceId")
+                       String globalSubscriberId = execution.getVariable("globalSubscriberId")
+                       String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
+
+                       Relationship ANNF_relationship = new Relationship()
+                       Relationship TNFH_relationship = new Relationship()
+                       Relationship TNMH_relationship = new Relationship()
+                       
+                       String ANNF_relatedLink = "aai/v21/business/customers/customer/${globalSubscriberId}/service-subscriptions/service-subscription/${subscriptionServiceType}/service-instances/service-instance/${ANNF_profileInstanceId}"
+                       String TNFH_relatedLink = "aai/v21/business/customers/customer/${globalSubscriberId}/service-subscriptions/service-subscription/${subscriptionServiceType}/service-instances/service-instance/${TNFH_profileInstanceId}"
+                       String TNMH_relatedLink = "aai/v21/business/customers/customer/${globalSubscriberId}/service-subscriptions/service-subscription/${subscriptionServiceType}/service-instances/service-instance/${TNMH_profileInstanceId}"
+                       
+                       String ANNF_NSSI_relatedLink = "aai/v21/business/customers/customer/${globalSubscriberId}/service-subscriptions/service-subscription/${subscriptionServiceType}/service-instances/service-instance/${ANNF_serviceInstanceId}"
+                       String TNFH_NSSI_relatedLink = "aai/v21/business/customers/customer/${globalSubscriberId}/service-subscriptions/service-subscription/${subscriptionServiceType}/service-instances/service-instance/${TNFH_serviceInstanceId}"
+                       String TNMH_NSSI_relatedLink = "aai/v21/business/customers/customer/${globalSubscriberId}/service-subscriptions/service-subscription/${subscriptionServiceType}/service-instances/service-instance/${TNMH_serviceInstanceId}"
+                       
+                       ANNF_relationship.setRelatedLink(ANNF_relatedLink)
+                       ANNF_relationship.setRelatedTo("service-instance")
+                       ANNF_relationship.setRelationshipLabel("org.onap.relationships.inventory.ComposedOf")
+                       TNFH_relationship.setRelatedLink(TNFH_relatedLink)
+                       TNFH_relationship.setRelatedTo("service-instance")
+                       TNFH_relationship.setRelationshipLabel("org.onap.relationships.inventory.ComposedOf")
+                       TNMH_relationship.setRelatedLink(TNMH_relatedLink)
+                       TNMH_relationship.setRelatedTo("service-instance")
+                       TNMH_relationship.setRelationshipLabel("org.onap.relationships.inventory.ComposedOf")
+                       
+                       // create SliceProfile and NSSI relationship in AAI
+                       anNssmfUtils.createRelationShipInAAI(execution, ANNF_relationship,ANNF_serviceInstanceId)
+                       anNssmfUtils.createRelationShipInAAI(execution, TNFH_relationship,TNFH_serviceInstanceId)
+                       anNssmfUtils.createRelationShipInAAI(execution, TNMH_relationship,TNMH_serviceInstanceId)
+                       anNssmfUtils.createRelationShipInAAI(execution, ANNF_relationship,AN_profileInstanceId)
+                       anNssmfUtils.createRelationShipInAAI(execution, TNFH_relationship,AN_profileInstanceId)
+                       anNssmfUtils.createRelationShipInAAI(execution, TNMH_relationship,AN_profileInstanceId)
+                       
+                       //create AN NSSI and ANNF,TNFH,TNMH relationship in AAI
+                       ANNF_relationship.setRelatedLink(ANNF_NSSI_relatedLink)
+                       TNFH_relationship.setRelatedLink(TNFH_NSSI_relatedLink)
+                       TNMH_relationship.setRelatedLink(TNMH_NSSI_relatedLink)
+                       anNssmfUtils.createRelationShipInAAI(execution, ANNF_relationship,AN_NSSI)
+                       anNssmfUtils.createRelationShipInAAI(execution, TNFH_relationship,AN_NSSI)
+                       anNssmfUtils.createRelationShipInAAI(execution, TNMH_relationship,AN_NSSI)
+
+               } catch (BpmnError e) {
+                       throw e
+               } catch (Exception ex) {
+
+                       msg = "Exception in DoCreateE2EServiceInstance.createCustomRelationship. " + ex.getMessage()
+                       logger.info(msg)
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+               }
+       }
+       
+       /**
+        * update operation status in request db
+        *
+        */
+       def prepareOperationStatusUpdate = { DelegateExecution execution ->
+               logger.debug(Prefix + "prepareOperationStatusUpdate Start")
+
+               String serviceId = execution.getVariable("dummyServiceId")
+               String jobId = execution.getVariable("jobId")
+               String nsiId = execution.getVariable("nsiId")
+               String nssiId = execution.getVariable("RANServiceInstanceId")
+               logger.debug("Service Instance serviceId:" + serviceId + " jobId:" + jobId)
+
+               ResourceOperationStatus updateStatus = new ResourceOperationStatus()
+               updateStatus.setServiceId(serviceId)
+               updateStatus.setOperationId(jobId)
+               updateStatus.setResourceTemplateUUID(nsiId)
+               updateStatus.setResourceInstanceID(nssiId)
+               updateStatus.setOperType("Allocate")
+               updateStatus.setProgress(100)
+               updateStatus.setStatus("finished")
+               requestDBUtil.prepareUpdateResourceOperationStatus(execution, updateStatus)
+
+               logger.debug(Prefix + "prepareOperationStatusUpdate Exit")
+       }
+
+       def prepareFailedOperationStatusUpdate = { DelegateExecution execution ->
+               logger.debug(Prefix + "prepareFailedOperationStatusUpdate Start")
+               
+               String serviceId = execution.getVariable("dummyServiceId")
+               String jobId = execution.getVariable("jobId")
+               String nsiId = execution.getVariable("nsiId")
+               String nssiId = execution.getVariable("RANServiceInstanceId")
+               logger.debug("Service Instance serviceId:" + serviceId + " jobId:" + jobId)
+
+               ResourceOperationStatus updateStatus = new ResourceOperationStatus()
+               updateStatus.setServiceId(serviceId)
+               updateStatus.setOperationId(jobId)
+               updateStatus.setResourceTemplateUUID(nsiId)
+               updateStatus.setResourceInstanceID(nssiId)
+               updateStatus.setOperType("Allocate")
+               updateStatus.setProgress(0)
+               updateStatus.setStatus("failed")
+               requestDBUtil.prepareUpdateResourceOperationStatus(execution, updateStatus)
+       }
+       
+       private String buildSdnrAllocateRequest(DelegateExecution execution, String action, String rpcName, String callbackUrl) {
+               
+               String requestId = execution.getVariable("msoRequestId")
+               Date date = new Date().getTime()
+               Timestamp time = new Timestamp(date)
+               Map<String,Object> sliceProfile = objectMapper.readValue(execution.getVariable("ranNfSliceProfile"), Map.class)
+               sliceProfile.put("sliceProfileId", execution.getVariable("ANNF_sliceProfileInstanceId"))
+               sliceProfile.put("maxNumberofConns", sliceProfile.get("maxNumberofPDUSessions"))
+               sliceProfile.put("uLThptPerSlice", sliceProfile.get("expDataRateUL"))
+               sliceProfile.put("dLThptPerSlice", sliceProfile.get("expDataRateDL"))
+               String sliceProfileString = objectMapper.writeValueAsString(sliceProfile)
+               JsonObject response = new JsonObject()
+               JsonObject body = new JsonObject()
+               JsonObject input = new JsonObject()
+               JsonObject commonHeader = new JsonObject()
+               JsonObject payload = new JsonObject()
+               JsonObject payloadInput = new JsonObject()
+               commonHeader.addProperty("TimeStamp", time.toString())
+               commonHeader.addProperty("APIver", "1.0")
+               commonHeader.addProperty("RequestID", requestId)
+               commonHeader.addProperty("SubRequestID", "1")
+               commonHeader.add("RequestTrack", new JsonObject())
+               commonHeader.add("Flags", new JsonObject())
+               payloadInput.addProperty("sliceProfile", sliceProfileString)
+               payloadInput.addProperty("RANNSSIId", execution.getVariable("RANServiceInstanceId"))
+               payloadInput.addProperty("NSIID", execution.getVariable("nsiId"))
+               payloadInput.addProperty("RANNFNSSIId", execution.getVariable("RANNFServiceInstanceId"))
+               payloadInput.addProperty("callbackURL", callbackUrl)
+               payloadInput.add("additionalproperties", new JsonObject())
+               payload.add("input", payloadInput)
+               input.add("CommonHeader", commonHeader)
+               input.addProperty("Action", action)
+               input.add("Payload", payload)
+               body.add("input", input)
+               response.add("body", body)
+               response.addProperty("version", "1.0")
+               response.addProperty("rpc-name", rpcName)
+               response.addProperty("correlation-id", requestId+"-1")
+               response.addProperty("type", "request")
+               return response.toString()
+       }
+       
+       private void createEndPointsInAai(DelegateExecution execution) {
+               String type = "endpoint"
+               String function = "transport_EP"
+               int prefixLength = 24
+               String addressFamily = "ipv4"
+               //BH RAN end point update
+               String bh_endpoint = execution.getVariable("bh_endpoint")
+               String bh_routeId = UUID.randomUUID().toString()
+               execution.setVariable("tranportEp_ID_bh", bh_routeId)
+               String role = "CU"
+               String CU_IpAddress = jsonUtil.getJsonValue(bh_endpoint, "IpAddress")
+               String LogicalLinkId = jsonUtil.getJsonValue(bh_endpoint, "LogicalLinkId")
+               String nextHopInfo = jsonUtil.getJsonValue(bh_endpoint, "nextHopInfo")
+               NetworkRoute bh_ep = new NetworkRoute()
+               bh_ep.setRouteId(bh_routeId)
+               bh_ep.setFunction(function)
+               bh_ep.setRole(role)
+               bh_ep.setType(type)
+               bh_ep.setIpAddress(CU_IpAddress)
+               bh_ep.setLogicalInterfaceId(LogicalLinkId)
+               bh_ep.setNextHop(nextHopInfo)
+               bh_ep.setPrefixLength(prefixLength)
+               bh_ep.setAddressFamily(addressFamily)
+               //FH RAN end points update
+               //RU
+               String RU_routeId = UUID.randomUUID().toString()
+               execution.setVariable("tranportEp_ID_RU", RU_routeId)
+               role = "RU"
+               NetworkRoute RU_ep = new NetworkRoute()
+               RU_ep.setRouteId(RU_routeId)
+               RU_ep.setFunction(function)
+               RU_ep.setRole(role)
+               RU_ep.setType(type)
+               RU_ep.setIpAddress("192.168.100.4")
+               RU_ep.setLogicalInterfaceId("1234")
+               RU_ep.setNextHop("Host1")
+               RU_ep.setPrefixLength(prefixLength)
+               RU_ep.setAddressFamily(addressFamily)
+               //DU Ingress
+               String DUIN_routeId = UUID.randomUUID().toString()
+               execution.setVariable("tranportEp_ID_DUIN", DUIN_routeId)
+               role = "DU"
+               NetworkRoute DU_ep = new NetworkRoute()
+               DU_ep.setRouteId(DUIN_routeId)
+               DU_ep.setFunction(function)
+               DU_ep.setRole(role)
+               DU_ep.setType(type)
+               DU_ep.setIpAddress("192.168.100.5")
+               DU_ep.setLogicalInterfaceId("1234")
+               DU_ep.setNextHop("Host2")
+               DU_ep.setPrefixLength(prefixLength)
+               DU_ep.setAddressFamily(addressFamily)
+               //MH RAN end point update
+               //DUEG
+               String DUEG_routeId = UUID.randomUUID().toString()
+               execution.setVariable("tranportEp_ID_DUEG", DUEG_routeId)
+               NetworkRoute DUEG_ep = new NetworkRoute()
+               DU_ep.setRouteId(DUEG_routeId)
+               DU_ep.setNextHop("Host3")
+               //CUIN
+               String CUIN_routeId = UUID.randomUUID().toString()
+               execution.setVariable("tranportEp_ID_CUIN", CUIN_routeId)
+               NetworkRoute CUIN_ep = new NetworkRoute()
+               CUIN_ep.setRouteId(CUIN_routeId)
+               CUIN_ep.setFunction(function)
+               CUIN_ep.setRole(role)
+               CUIN_ep.setType(type)
+               CUIN_ep.setIpAddress("192.168.100.6")
+               CUIN_ep.setLogicalInterfaceId("1234")
+               CUIN_ep.setNextHop("Host4")
+               CUIN_ep.setPrefixLength(prefixLength)
+               CUIN_ep.setAddressFamily(addressFamily)
+               try {
+                       AAIResourcesClient client = new AAIResourcesClient()
+                       logger.debug("creating bh endpoint . ID : "+bh_routeId+" node details : "+bh_ep.toString())
+                       AAIResourceUri networkRouteUri = AAIUriFactory.createResourceUri( new AAIObjectType(AAINamespaceConstants.NETWORK, NetworkRoute.class), bh_routeId)
+                       client.create(networkRouteUri, bh_ep)
+                       logger.debug("creating RU endpoint . ID : "+RU_routeId+" node details : "+RU_ep.toString())
+                       networkRouteUri = AAIUriFactory.createResourceUri( new AAIObjectType(AAINamespaceConstants.NETWORK, NetworkRoute.class), RU_routeId)
+                       client.create(networkRouteUri, RU_ep)
+                       logger.debug("creating DUIN endpoint . ID : "+DUIN_routeId+" node details : "+DU_ep.toString())
+                       networkRouteUri = AAIUriFactory.createResourceUri( new AAIObjectType(AAINamespaceConstants.NETWORK, NetworkRoute.class), DUIN_routeId)
+                       client.create(networkRouteUri, DU_ep)
+                       logger.debug("creating DUEG endpoint . ID : "+DUEG_routeId+" node details : "+DU_ep.toString())
+                       networkRouteUri = AAIUriFactory.createResourceUri( new AAIObjectType(AAINamespaceConstants.NETWORK, NetworkRoute.class), DUEG_routeId)
+                       client.create(networkRouteUri, DU_ep)
+                       logger.debug("creating CUIN endpoint . ID : "+CUIN_routeId+" node details : "+CUIN_ep.toString())
+                       networkRouteUri = AAIUriFactory.createResourceUri( new AAIObjectType(AAINamespaceConstants.NETWORK, NetworkRoute.class), CUIN_routeId)
+                       client.create(networkRouteUri, CUIN_ep)
+                       //relationship b/w bh_ep and RAN NSSI
+                       def AN_NSSI = execution.getVariable("RANServiceInstanceId")
+                       Relationship relationship = new Relationship()
+                       String relatedLink = "aai/v21/network/network-routes/network-route/${bh_routeId}"               
+                       relationship.setRelatedLink(relatedLink)
+                       relationship.setRelatedTo("network-route")
+                       relationship.setRelationshipLabel("org.onap.relationships.inventory.ComposedOf")
+                       anNssmfUtils.createRelationShipInAAI(execution, relationship, AN_NSSI)
+                       def ANNF_serviceInstanceId = execution.getVariable("RANNFServiceInstanceId")
+                       relatedLink = "aai/v21/network/network-routes/network-route/${RU_routeId}"
+                       relationship.setRelatedLink(relatedLink)
+                       anNssmfUtils.createRelationShipInAAI(execution, relationship, ANNF_serviceInstanceId)
+                       relatedLink = "aai/v21/network/network-routes/network-route/${DUIN_routeId}"
+                       relationship.setRelatedLink(relatedLink)
+                       anNssmfUtils.createRelationShipInAAI(execution, relationship, ANNF_serviceInstanceId)
+                       relatedLink = "aai/v21/network/network-routes/network-route/${DUEG_routeId}"
+                       relationship.setRelatedLink(relatedLink)
+                       anNssmfUtils.createRelationShipInAAI(execution, relationship, ANNF_serviceInstanceId)
+                       relatedLink = "aai/v21/network/network-routes/network-route/${CUIN_routeId}"
+                       relationship.setRelatedLink(relatedLink)
+                       anNssmfUtils.createRelationShipInAAI(execution, relationship, ANNF_serviceInstanceId)
+               } catch (BpmnError e) {
+               throw e
+       } catch (Exception ex) {
+               String msg = "Exception in createEndPointsInAai " + 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/DoAllocateCoreNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNSSI.groovy
new file mode 100644 (file)
index 0000000..64c36e7
--- /dev/null
@@ -0,0 +1,157 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020  Tech Mahindra
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.scripts
+import org.apache.commons.collections.map.HashedMap
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.onap.so.beans.nsmf.SliceTaskParams
+import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
+import org.onap.so.bpmn.common.scripts.CatalogDbUtils
+import org.onap.so.bpmn.common.scripts.CatalogDbUtilsFactory
+import org.onap.so.bpmn.common.scripts.ExceptionUtil
+import org.onap.so.bpmn.core.domain.ServiceDecomposition
+import org.onap.so.bpmn.core.domain.ServiceProxy
+import org.onap.so.bpmn.core.json.JsonUtils
+import org.onap.so.db.request.beans.OperationStatus
+import org.onap.so.db.request.beans.ResourceOperationStatus
+import org.onap.so.serviceinstancebeans.ModelInfo
+import org.onap.so.bpmn.core.UrnPropertiesReader
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+import static org.apache.commons.lang3.StringUtils.*;
+import com.fasterxml.jackson.databind.ObjectMapper
+import groovy.json.JsonSlurper
+import javax.ws.rs.core.Response
+import org.onap.so.bpmn.common.scripts.OofUtils
+import org.onap.so.bpmn.common.scripts.RequestDBUtil
+
+class DoAllocateCoreNSSI extends AbstractServiceTaskProcessor {
+    String Prefix="DACNSSI_"
+    private static final Logger logger = LoggerFactory.getLogger( DoAllocateCoreNSSI.class);
+    ExceptionUtil exceptionUtil = new ExceptionUtil()
+    CatalogDbUtils catalogDbUtils = new CatalogDbUtilsFactory().create()
+    JsonUtils jsonUtil = new JsonUtils()
+    RequestDBUtil requestDBUtil = new RequestDBUtil()
+    ObjectMapper mapper = new ObjectMapper()
+    OofUtils oofUtils = new OofUtils()
+    void preProcessRequest(DelegateExecution execution) {
+        logger.debug(Prefix+" **** Enter DoAllocateCoreNSSI ::: preProcessRequest ****")
+        execution.setVariable("prefix", Prefix)
+        String msg = ""
+        //Get SliceProfile from sliceParams JSON
+        String sliceProfile = jsonUtil.getJsonValue(execution.getVariable("sliceParams"), "sliceProfile")
+        if (isBlank(sliceProfile)) {
+            msg = "Slice Profile is null"
+            exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+        } else {
+            execution.setVariable("sliceProfile", sliceProfile)
+        }
+        String coreServiceInstanceId = UUID.randomUUID().toString()
+        execution.setVariable("coreServiceInstanceId", coreServiceInstanceId)
+        logger.debug(Prefix+" **** Exit DoAllocateCoreNSSI ::: preProcessRequest ****")
+    }
+    /**
+     * Query NSST name from CatalogDB
+     * @param execution
+     */
+    void getNSSTName(DelegateExecution execution){
+        logger.debug(Prefix+" **** Enter DoAllocateCoreNSSI ::: getNSSTName ****")
+        String nsstModelInvariantUuid = execution.getVariable("modelInvariantUuid")
+        try{
+            String json = catalogDbUtils.getServiceResourcesByServiceModelInvariantUuidString(execution, nsstModelInvariantUuid)
+            logger.debug("***** JSON Response is: "+json)
+            String nsstName = jsonUtil.getJsonValue(json, "serviceResources.modelInfo.modelName") ?: ""
+            String networkServiceModelInfo = jsonUtil.getJsonValue(json, "serviceResources.serviceProxy.modelInfo") ?: ""
+
+            execution.setVariable("networkServiceModelInfo", networkServiceModelInfo)
+            logger.debug("***** nsstName is: "+ nsstName)
+            execution.setVariable("nsstName",nsstName)
+        }catch(BpmnError e){
+            throw e
+        } catch (Exception ex){
+            String msg = "Exception in preProcessRequest " + ex.getMessage()
+            logger.debug(msg)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+        }
+        logger.debug(Prefix+" **** Exit DoAllocateCoreNSSI ::: getNSSTName ****")
+    }
+    void prepareOOFRequest(DelegateExecution execution){
+        logger.debug(Prefix+" **** Enter DoAllocateCoreNSSI ::: prepareOOFRequest ****")
+        //API Path
+        String apiPath =  "/api/oof/selection/nssi/v1"
+        logger.debug("API path for DoAllocateCoreNSSI: "+apiPath)
+        execution.setVariable("NSSI_apiPath", apiPath)
+        //Setting correlator as requestId
+        String requestId = execution.getVariable("msoRequestId")
+        execution.setVariable("NSSI_correlator", requestId)
+        //Setting messageType for all Core slice as cn
+        String messageType = "cn"
+        execution.setVariable("NSSI_messageType", messageType)
+        //Is there any specific timeout we have to set or else we don't need to send
+        //if blank will be set default value in DoHandleOofRequest
+        String timeout = "PT30M"
+        execution.setVariable("NSSI_timeout", timeout)
+        Map<String, Object> profileInfo = mapper.readValue(execution.getVariable("sliceProfile"), Map.class)
+        String nsstModelUuid = execution.getVariable("modelUuid")
+        String nsstModelInvariantUuid = execution.getVariable("modelInvariantUuid")
+        String nsstName = execution.getVariable("nsstName")
+        String oofRequest = oofUtils.buildSelectNSSIRequest(requestId, messageType, nsstModelUuid, nsstModelInvariantUuid, nsstName, profileInfo)
+        logger.debug("**** OOfRequest for Core Slice: "+oofRequest)
+        execution.setVariable("NSSI_oofRequest", oofRequest)
+        logger.debug(Prefix+" **** Exit DoAllocateCoreNSSI ::: prepareOOFRequest ****")
+    }
+
+    void processOOFAsyncResponse(DelegateExecution execution) {
+        logger.debug(Prefix+ " **** Enter DoAllocateCoreNSSI ::: processOOFAsyncResponse ****")
+        String OOFResponse = execution.getVariable("NSSI_asyncCallbackResponse")
+        String requestStatus = jsonUtil.getJsonValue(OOFResponse, "requestStatus")
+        logger.debug("NSSI OOFResponse is: " + OOFResponse)
+        execution.setVariable("OOFResponse", OOFResponse)
+        String solutions =""
+        if(requestStatus.equals("completed")) {
+            solutions = jsonUtil.getJsonValue(OOFResponse, "solutions")
+        } else {
+            String statusMessage = jsonUtil.getJsonValue(OOFResponse, "statusMessage")
+            logger.error("received failed status from oof "+ statusMessage)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 7000,"Received a failed Async Response from OOF : "+statusMessage)
+        }
+        execution.setVariable("solutions", solutions)
+        logger.debug(Prefix+" **** Exit DoAllocateCoreNSSI ::: processOOFAsyncResponse ****")
+    }
+
+    void prepareFailedOperationStatusUpdate(DelegateExecution execution){
+        logger.debug(Prefix + " **** Enter DoAllocateCoreNSSI ::: prepareFailedOperationStatusUpdate ****")
+        String serviceId = execution.getVariable("nssiId")
+        String jobId = execution.getVariable("jobId")
+        String nsiId = execution.getVariable("nsiId")
+        String operationType = execution.getVariable("operationType")
+        ResourceOperationStatus resourceOperationStatus = new ResourceOperationStatus()
+        resourceOperationStatus.setServiceId(serviceId)
+        resourceOperationStatus.setOperationId(jobId)
+        resourceOperationStatus.setResourceTemplateUUID(nsiId)
+        resourceOperationStatus.setOperType(operationType)
+        resourceOperationStatus.setProgress(0)
+        resourceOperationStatus.setStatus("failed")
+        resourceOperationStatus.setStatusDescription("Core NSSI Allocate Failed")
+        requestDBUtil.prepareUpdateResourceOperationStatus(execution, resourceOperationStatus)
+        logger.debug(Prefix + " **** Exit DoAllocateCoreNSSI ::: prepareFailedOperationStatusUpdate ****")
+    }
+}
\ No newline at end of file
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNonSharedSlice.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNonSharedSlice.groovy
new file mode 100644 (file)
index 0000000..b5e1e6b
--- /dev/null
@@ -0,0 +1,433 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020  Tech Mahindra
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.scripts
+
+import com.fasterxml.jackson.databind.ObjectMapper
+
+import groovy.json.JsonOutput
+
+import static org.hamcrest.CoreMatchers.instanceOf
+
+import javax.json.JsonArray
+import javax.ws.rs.core.Response
+import org.apache.commons.collections.map.HashedMap
+import org.apache.commons.lang.StringEscapeUtils
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.json.JSONArray
+import org.json.JSONObject
+import org.onap.aaiclient.client.aai.AAIResourcesClient
+import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
+import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
+import org.onap.so.bpmn.common.scripts.CatalogDbUtils
+import org.onap.so.bpmn.common.scripts.CatalogDbUtilsFactory
+import org.onap.so.bpmn.common.scripts.ExceptionUtil
+import org.onap.so.bpmn.common.scripts.ExternalAPIUtil
+import org.onap.so.bpmn.common.scripts.ExternalAPIUtilFactory
+import org.onap.so.bpmn.common.scripts.RequestDBUtil
+import org.onap.so.db.request.beans.OperationStatus
+import org.onap.so.db.request.beans.ResourceOperationStatus
+import org.onap.so.client.HttpClient
+import org.onap.so.client.HttpClientFactory
+import org.onap.logging.filter.base.ONAPComponents
+import org.onap.so.bpmn.core.UrnPropertiesReader
+import org.onap.aai.domain.yang.v19.ServiceInstance
+import org.onap.aaiclient.client.aai.AAIObjectType
+import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
+import org.onap.aaiclient.client.aai.entities.AAIEdgeLabel
+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.core.domain.ServiceDecomposition
+import org.onap.so.bpmn.core.domain.ServiceProxy
+import org.onap.so.bpmn.core.json.JsonUtils
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+import org.springframework.http.HttpEntity
+
+import javax.ws.rs.NotFoundException
+
+class DoAllocateCoreNonSharedSlice extends AbstractServiceTaskProcessor {
+    String Prefix="DACNSNSSI_"
+    private static final Logger logger = LoggerFactory.getLogger( DoAllocateCoreNonSharedSlice.class);
+    private CatalogDbUtils catalogDbUtils = new CatalogDbUtilsFactory().create()
+    private RequestDBUtil requestDBUtil = new RequestDBUtil()
+    private ExceptionUtil exceptionUtil = new ExceptionUtil()
+    private JsonUtils jsonUtil = new JsonUtils()
+
+    @Override
+    public void preProcessRequest(DelegateExecution execution) {
+        logger.debug(Prefix+ "**** Enter DoAllocateCoreNonSharedSlice:::  preProcessRequest ****")
+        String nssiServiceInstanceId= execution.getVariable("serviceInstanceId")
+        execution.setVariable("nssiServiceInstanceId", nssiServiceInstanceId)
+        //Set orchestration-status as created
+        execution.setVariable("orchestrationStatus", "created")
+        //networkServiceName
+        String networkServiceName = jsonUtil.getJsonValue(execution.getVariable("networkServiceModelInfo"), "modelName") ?: ""
+        execution.setVariable("networkServiceName", networkServiceName.replaceAll(" Service Proxy", ""))
+        //networkServiceModelUuid
+        String networkServiceModelUuid = jsonUtil.getJsonValue(execution.getVariable("networkServiceModelInfo"), "modelUuid") ?: ""
+        execution.setVariable("networkServiceModelUuid", networkServiceModelUuid)
+        logger.debug(Prefix+ " **** Exit DoAllocateCoreNonSharedSlice:::  preProcessRequest ****")
+    }
+
+    void createNSSIinAAI(DelegateExecution execution) {
+        logger.debug(Prefix+ " ****  Enter DoAllocateCoreNonSharedSlice ::: Enter createNSSIinAAI ****")
+        String msg=""
+        String serviceInstanceId= execution.getVariable("nssiServiceInstanceId")
+        logger.debug("ServiceInstanceId: "+serviceInstanceId)
+        try {
+            String serviceType = execution.getVariable("subscriptionServiceType")
+            String oStatus = execution.getVariable("orchestrationStatus")
+            //Get workload context and environment context from DB
+            String environmentContext = ""
+            String workloadContext =""
+            String modelInvariantUuid = execution.getVariable("modelInvariantUuid")
+            try{
+                String json = catalogDbUtils.getServiceResourcesByServiceModelInvariantUuidString(execution,modelInvariantUuid )
+                logger.debug("JSON Response from DB: "+json)
+                environmentContext = jsonUtil.getJsonValue(json, "serviceResources.environmentContext") ?: ""
+                workloadContext = jsonUtil.getJsonValue(json, "serviceResources.workloadContext") ?: ""
+                logger.debug("Env Context is: "+ environmentContext)
+                logger.debug("Workload Context is: "+ workloadContext)
+            } catch(BpmnError e){
+                throw e
+            } catch (Exception ex){
+                msg = "Exception in createNSSIinAAI ::: DoAllocateCoreNonSharedSlice  " + ex.getMessage()
+                logger.debug(msg)
+                exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+            }
+            String serviceInstanceName = "nssi_"+execution.getVariable("nsstName")
+            ServiceInstance si = new ServiceInstance()
+            si.setServiceInstanceId(execution.getVariable("nssiServiceInstanceId"))
+            si.setServiceInstanceName(serviceInstanceName)
+            si.setServiceType(serviceType)
+            si.setServiceRole("nssi")
+            si.setOrchestrationStatus(oStatus)
+            si.setModelInvariantId(modelInvariantUuid)
+            si.setModelVersionId(execution.getVariable("modelUuid"))
+            si.setEnvironmentContext(environmentContext)
+            si.setWorkloadContext(workloadContext)
+            logger.debug("AAI service Instance Request Payload : "+si.toString())
+            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(serviceType).serviceInstance(serviceInstanceId))
+            Response response = getAAIClient().create(uri, si)
+            if(response.getStatus()!=200) {
+                exceptionUtil.buildAndThrowWorkflowException(execution, response.getStatus(), "AAI instance creation failed")
+            }
+            execution.setVariable("nssiServiceInstance", si)
+        } catch (BpmnError e) {
+            throw e;
+        } catch (Exception ex) {
+            msg = "Exception in create AAI Instance" + ex.getMessage()
+            logger.debug(msg)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+        }
+        logger.debug(Prefix+ " Exit DoAllocateCoreNonSharedSlice ::: Enter createNSSIinAAI ****")
+    }
+
+    public void prepareServiceOrderRequest(DelegateExecution execution) {
+        logger.debug("**** Enter DoAllocateCoreNonSharedSlice :::  prepareServiceOrderRequest ****")
+        String extAPIPath = UrnPropertiesReader.getVariable("extapi.endpoint", execution) + '/serviceOrder'
+        execution.setVariable("ExternalAPIURL", extAPIPath)
+        ObjectMapper objectMapper = new ObjectMapper();
+        Map<String, Object> serviceOrder = new LinkedHashMap()
+        //ExternalId
+        serviceOrder.put("externalId", "ONAP001")
+        //Requested Start Date
+        String requestedStartDate = utils.generateCurrentTimeInUtc()
+        String requestedCompletionDate = utils.generateCurrentTimeInUtc()
+        serviceOrder.put("requestedStartDate", requestedStartDate)
+        serviceOrder.put("requestedCompletionDate", requestedCompletionDate)
+        //RelatedParty Fields
+        String relatedPartyId = execution.getVariable("globalSubscriberId")
+        String relatedPartyRole = "ONAPcustomer"
+        Map<String, String> relatedParty = new LinkedHashMap()
+        relatedParty.put("id", relatedPartyId)
+        relatedParty.put("role", relatedPartyRole)
+        List<Map<String, String>> relatedPartyList = new ArrayList()
+        relatedPartyList.add(relatedParty)
+        serviceOrder.put("relatedParty", relatedPartyList)
+        Map<String, Object> orderItem = new LinkedHashMap()
+        //orderItem id
+        String orderItemId = "1"
+        orderItem.put("id", orderItemId)
+        //order item action will always be add as we are triggering request for instantiation
+        String orderItemAction = "add"
+        orderItem.put("action", orderItemAction)
+        // service Details
+        Map<String, Object> service = new LinkedHashMap()
+        //ServiceName
+        String serviceName= "nsi_"+execution.getVariable("networkServiceName")
+        service.put("name",  serviceName)
+        // Service Type
+        service.put("serviceType", execution.getVariable("serviceType"))
+        //Service State
+        service.put("serviceState", "active")
+        Map<String, String> serviceSpecification = new LinkedHashMap()
+        serviceSpecification.put("id", execution.getVariable("networkServiceModelUuid"))
+        service.put("serviceSpecification", serviceSpecification)
+        //serviceCharacteristic List
+        List serviceCharacteristicList = new ArrayList()
+        Map<String, Object> serviceCharacteristic = objectMapper.readValue(execution.getVariable("sliceProfile"), Map.class);
+        List serviceCharacteristicListMap = retrieveServiceCharacteristicsAsKeyValue(serviceCharacteristic)
+        logger.debug("serviceCharacteristicListMap  "+serviceCharacteristicListMap)
+        serviceCharacteristicList.add(serviceCharacteristic)
+        //service.put("serviceCharacteristic", serviceCharacteristicList)
+        service.put("serviceCharacteristic", serviceCharacteristicListMap)
+        orderItem.put("service", service)
+        List<Map<String, String>> orderItemList = new ArrayList()
+        orderItemList.add(orderItem)
+        serviceOrder.put("orderItem", orderItemList)
+        String jsonServiceOrder = objectMapper.writeValueAsString(serviceOrder);
+        logger.debug("******* ServiceOrder :: "+jsonServiceOrder)
+        execution.setVariable("serviceOrderRequest", jsonServiceOrder)
+        logger.debug(Prefix+ " **** Exit DoAllocateCoreNonSharedSlice ::: prepareServiceOrderRequest****")
+    }
+
+    private List retrieveServiceCharacteristicsAsKeyValue(Map serviceCharacteristics) {
+        logger.debug(Prefix+ " **** Enter DoAllocateCoreNonSharedSlice ::: retrieveServiceCharacteristicsAsKeyValue ****")
+        List serviceCharacteristicsList = new ArrayList()
+        ObjectMapper mapperObj = new ObjectMapper();
+        Map<String, Object> serviceCharacteristicsObject = new LinkedHashMap()
+        for (Map.Entry<String, Integer> entry : serviceCharacteristics.entrySet()) {
+            Map<String, Object> ServiceCharacteristicValueObject = new LinkedHashMap<>()
+            System.out.println(entry.getKey() + ":" + entry.getValue());
+            //For G Release we are sending single value from  snssaiList
+            if(entry.getKey().equals("snssaiList")) {
+                List sNssaiValue = entry.getValue()
+                serviceCharacteristicsObject.put("name", "snssai")
+                ServiceCharacteristicValueObject.put("serviceCharacteristicValue", sNssaiValue.get(0))
+                serviceCharacteristicsObject.put("value", ServiceCharacteristicValueObject)
+            }
+        }
+        serviceCharacteristicsList.add(serviceCharacteristicsObject)
+        logger.debug(Prefix+ " **** Exit DoAllocateCoreNonSharedSlice ::: retrieveServiceCharacteristicsAsKeyValue ****")
+        return serviceCharacteristicsList
+    }
+
+    public void postNBIServiceOrder(DelegateExecution execution) {
+        logger.debug(Prefix+ " **** Enter DoAllocateCoreNonSharedSlice ::: postNBIServiceOrder ****")
+        String msg=""
+        try {
+            String extAPIPath = execution.getVariable("ExternalAPIURL")
+            String payload = execution.getVariable("serviceOrderRequest")
+            logger.debug("externalAPIURL is: " + extAPIPath)
+            logger.debug("ServiceOrder payload is: " + payload)
+            ExternalAPIUtil externalAPIUtil = new ExternalAPIUtilFactory().create()
+            execution.setVariable("ServiceOrderId", "")
+            Response response = externalAPIUtil.executeExternalAPIPostCall(execution, extAPIPath, payload)
+            int responseCode = response.getStatus()
+            execution.setVariable("PostServiceOrderResponseCode", responseCode)
+            logger.debug("Post ServiceOrder response code is: " + responseCode)
+            String extApiResponse = response.readEntity(String.class)
+            JSONObject responseObj = new JSONObject(extApiResponse)
+            execution.setVariable("PostServiceOrderResponse", extApiResponse)
+            logger.debug("ServiceOrder response body is: " + extApiResponse)
+            //Process Response
+            if(responseCode == 200 || responseCode == 201 || responseCode == 202 )
+                //200 OK 201 CREATED 202 ACCEPTED
+            {
+                logger.debug("Post ServiceOrder Received a Good Response")
+                String serviceOrderId = responseObj.get("id")
+                execution.setVariable("ServiceOrderId", serviceOrderId)
+                logger.info("Post ServiceOrderid is: " + serviceOrderId)
+            }
+            else{
+                exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Post ServiceOrder Received a bad response from extAPI serviceOrder API")
+            }
+        }catch (BpmnError e) {
+            throw e;
+        } catch (Exception ex) {
+            msg = "Exception in ServiceOrder ExtAPI" + ex.getMessage()
+            logger.debug(msg)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+        }
+        logger.debug("**** Exit DoAllocateCoreNonSharedSlice ::: postNBIServiceOrder ****")
+    }
+
+    public void getNBIServiceOrderProgress(DelegateExecution execution) {
+        logger.debug(Prefix+ " **** Enter DoAllocateCoreNonSharedSlice ::: getNBIServiceOrderProgress ****")
+        String msg=""
+        try {
+            String extAPIPath = execution.getVariable("ExternalAPIURL")
+            extAPIPath += "/" + execution.getVariable("ServiceOrderId")
+            logger.debug("getNBIServiceOrderProgress externalAPIURL is: " + extAPIPath)
+            ExternalAPIUtil externalAPIUtil = new ExternalAPIUtilFactory().create()
+            Response response = externalAPIUtil.executeExternalAPIGetCall(execution, extAPIPath)
+            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("status", "processing")
+                }
+                else if("INPROGRESS".equalsIgnoreCase(serviceOrderState)) {
+                    execution.setVariable("status", "processing")
+                }
+                else if("COMPLETED".equalsIgnoreCase(serviceOrderState)) {
+                    execution.setVariable("status", "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())
+        }
+        logger.debug(Prefix+ " **** Exit DoAllocateCoreNonSharedSlice ::: getNBIServiceOrderProgress ****")
+    }
+
+    /**
+     * delay 5 sec
+     */
+    public void timeDelay(DelegateExecution execution) {
+        try {
+            logger.debug(Prefix+ " **** DoAllocateCoreNonSharedSlice ::: timeDelay going to sleep for 5 sec")
+            Thread.sleep(5000)
+            logger.debug("**** DoAllocateCoreNonSharedSlice ::: timeDelay wakeup after 5 sec")
+        } catch(InterruptedException e) {
+            logger.error(Prefix+ " **** DoAllocateCoreNonSharedSlice ::: timeDelay exception" + e)
+        }
+    }
+
+
+    void updateRelationship(DelegateExecution execution) {
+        logger.debug(Prefix+ " **** Enter DoAllocateCoreNonSharedSlice ::: updateRelationship ****")
+
+        String networkServiceInstanceId = execution.getVariable("networkServiceId")
+        String nssiId = execution.getVariable("nssiServiceInstanceId")
+        String globalCustId = execution.getVariable("globalSubscriberId")
+        String serviceType = execution.getVariable("serviceType")
+        try{
+            //Update NSSI orchestration status nssiServiceInstance
+            ServiceInstance si = execution.getVariable("nssiServiceInstance")
+            si.setOrchestrationStatus("activated")
+
+            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalCustId).serviceSubscription(serviceType).serviceInstance(networkServiceInstanceId))
+            try {
+                getAAIClient().update(uri, si)
+            } catch (Exception e) {
+                logger.info("Update OrchestrationStatus in AAI failed")
+                String msg = "Update OrchestrationStatus in AAI failed, " + e.getMessage()
+                exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+            }
+
+            //URI for NSSI
+            AAIResourceUri nssiUri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(nssiId));
+
+            //URI for Network Service Instance
+            AAIResourceUri networkServiceInstanceUri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(networkServiceInstanceId))
+
+            // Update Relationship in AAI
+            Response response = getAAIClient().connect(nssiUri, networkServiceInstanceUri, AAIEdgeLabel.COMPOSED_OF);
+
+            if(response.getStatus()!=200 || response.getStatus()!=201 || response.getStatus()!=202) {
+                exceptionUtil.buildAndThrowWorkflowException(execution, response.getStatus(), "Set association of NSSI and Network service instance has failed in AAI")
+            } else {
+                execution.setVariable("progress", 100)
+                execution.setVariable("status", "finished")
+                execution.setVariable("statusDescription", "DoAllocateCoreNonSharedNSSI success")
+                setResourceOperationStatus(execution)
+            }
+        }catch(Exception ex) {
+            String msg = "Exception while creating relationship " + ex.getMessage()
+            logger.info(msg)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+        }
+        logger.debug(Prefix+ " **** Exit DoAllocateCoreNonSharedSlice ::: updateRelationship ****")
+    }
+
+    /**
+     * prepare ResourceOperation status
+     * @param execution
+     * @param operationType
+     */
+    private void setResourceOperationStatus(DelegateExecution execution) {
+        logger.debug(Prefix+ " **** Enter DoAllocateCoreNonSharedSlice ::: setResourceOperationStatus ****")
+        String serviceId = execution.getVariable("nssiId")
+        String jobId = execution.getVariable("jobId")
+        String nsiId = execution.getVariable("nsiId")
+        String operationType = execution.getVariable("operationType")
+        ResourceOperationStatus resourceOperationStatus = new ResourceOperationStatus()
+        resourceOperationStatus.setServiceId(serviceId)
+        resourceOperationStatus.setOperationId(jobId)
+        resourceOperationStatus.setResourceTemplateUUID(nsiId)
+        resourceOperationStatus.setOperType(operationType)
+        resourceOperationStatus.setStatus(execution.getVariable("status"))
+        resourceOperationStatus.setProgress(execution.getVariable("progress"))
+        resourceOperationStatus.setStatusDescription(execution.getVariable("statusDescription"))
+        requestDBUtil.prepareUpdateResourceOperationStatus(execution, resourceOperationStatus)
+        logger.debug(Prefix+ " **** Exit DoAllocateCoreNonSharedSlice ::: setResourceOperationStatus ****")
+    }
+
+    void prepareFailedOperationStatusUpdate(DelegateExecution execution){
+        logger.debug(Prefix + " **** Enter DoAllocateCoreNonSharedSlice ::: prepareFailedOperationStatusUpdate ****")
+        String serviceId = execution.getVariable("nssiId")
+        String jobId = execution.getVariable("jobId")
+        String nsiId = execution.getVariable("nsiId")
+        String operationType = execution.getVariable("operationType")
+
+        ResourceOperationStatus resourceOperationStatus = new ResourceOperationStatus()
+        resourceOperationStatus.setServiceId(serviceId)
+        resourceOperationStatus.setOperationId(jobId)
+        resourceOperationStatus.setResourceTemplateUUID(nsiId)
+        resourceOperationStatus.setOperType(operationType)
+        resourceOperationStatus.setProgress(0)
+        resourceOperationStatus.setStatus("failed")
+        resourceOperationStatus.setStatusDescription("Core NSSI Allocate Failed")
+        requestDBUtil.prepareUpdateResourceOperationStatus(execution, resourceOperationStatus)
+        logger.debug(Prefix + " **** Exit DoAllocateCoreNonSharedSlice ::: prepareFailedOperationStatusUpdate ****")
+    }
+}
\ No newline at end of file
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreSharedSlice.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreSharedSlice.groovy
new file mode 100644 (file)
index 0000000..5ecfc9a
--- /dev/null
@@ -0,0 +1,653 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020  Tech Mahindra
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.scripts
+
+import static org.apache.commons.lang3.StringUtils.isBlank
+import javax.ws.rs.NotFoundException
+import javax.ws.rs.core.Response
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.onap.aai.domain.yang.GenericVnf
+import org.onap.aai.domain.yang.RelatedToProperty
+import org.onap.aai.domain.yang.Relationship
+import org.onap.aai.domain.yang.RelationshipData
+import org.onap.aai.domain.yang.ServiceInstance
+import org.onap.aaiclient.client.aai.AAIObjectName
+import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
+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.CatalogDbUtils
+import org.onap.so.bpmn.common.scripts.CatalogDbUtilsFactory
+import org.onap.so.bpmn.common.scripts.ExceptionUtil
+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.ResourceOperationStatus
+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.Platform
+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.SubscriberInfo
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+import com.fasterxml.jackson.databind.ObjectMapper
+
+
+class DoAllocateCoreSharedSlice extends AbstractServiceTaskProcessor {
+
+    String Prefix="DACSNSSI_"
+    private static final Logger logger = LoggerFactory.getLogger(DoAllocateCoreSharedSlice.class);
+    private CatalogDbUtils catalogDbUtils = new CatalogDbUtilsFactory().create()
+    private RequestDBUtil requestDBUtil = new RequestDBUtil()
+    private ExceptionUtil exceptionUtil = new ExceptionUtil()
+    private JsonUtils jsonUtil = new JsonUtils()
+    ObjectMapper mapper = new ObjectMapper();
+
+    private final Long TIMEOUT = 60 * 60 * 1000
+
+    @Override
+    public void preProcessRequest(DelegateExecution execution) {
+
+        logger.debug(Prefix+" **** Enter DoAllocateCoreSharedSlice ::: preProcessRequest ****")
+        //Get NSSI Solutions
+        String nssisolutions = execution.getVariable("solutions")
+
+        //Get First Object
+        List<String> nssiSolutionList = jsonUtil.StringArrayToList(nssisolutions)
+
+        logger.debug("nssiSolutionList : "+nssiSolutionList)
+
+        String nssiId = jsonUtil.getJsonValue(nssiSolutionList.get(0), "NSSIId")
+        logger.debug("NSSIId  : "+nssiId)
+
+        if (isBlank(nssiId)) {
+            String msg = "solution nssiId is null"
+            logger.debug(msg)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+        } else {
+            execution.setVariable("nssiId", nssiId)
+        }
+
+        String sNssaiListAsString = jsonUtil.getJsonValue(execution.getVariable("sliceProfile"), "snssaiList")
+        logger.debug("sNssaiListAsString "+sNssaiListAsString)
+        List<String> sNssaiList = jsonUtil.StringArrayToList(sNssaiListAsString)
+        logger.debug("sNssaiList "+sNssaiList)
+        String sNssai = sNssaiList.get(0)
+        execution.setVariable("sNssai", sNssai)
+        logger.debug("sNssai: "+sNssai)
+
+        String serviceType = execution.getVariable("subscriptionServiceType")
+        execution.setVariable("serviceType", serviceType)
+        logger.debug(Prefix+" **** Exit DoAllocateCoreSharedSlice ::: preProcessRequest ****")
+    }
+
+    public void getNetworkInstanceAssociatedWithNssiId(DelegateExecution execution) {
+
+        logger.debug(Prefix+" **** Enter DoAllocateCoreSharedSlice ::: getNetworkInstanceAssociatedWithNssiId ****")
+
+        //NSSI Id as service Instance Id to get from Request
+        String serviceInstanceId = execution.getVariable("serviceInstanceID")
+
+        String errorMsg = "query Network Service Instance from AAI failed"
+        AAIResultWrapper wrapper = queryAAI(execution, Types.SERVICE_INSTANCE, serviceInstanceId, errorMsg)
+        Optional<ServiceInstance> nsi = wrapper.asBean(ServiceInstance.class)
+
+        String networkServiceInstanceName = ""
+        String networkServiceInstanceId =""
+        if(nsi.isPresent()) {
+            List<Relationship> relationshipList = nsi.get().getRelationshipList()?.getRelationship()
+            List spiWithsNssaiAndOrchStatusList = new ArrayList<>()
+
+            for (Relationship relationship : relationshipList) {
+                String relatedTo = relationship.getRelatedTo()
+                if (relatedTo == "service-instance") {
+                    List<RelationshipData> relationshipDataList = relationship.getRelationshipData()
+                    List<RelatedToProperty> relatedToPropertyList = relationship.getRelatedToProperty()
+                    for (RelationshipData relationshipData : relationshipDataList) {
+                        if (relationshipData.getRelationshipKey() == "service-instance.service-instance-id") {
+                            logger.debug("**** service-instance.service-instance-id 1 :: getServiceInstanceRelationships  :: "+ relationshipData.getRelationshipValue())
+                            execution.setVariable("networkServiceInstanceId", relationshipData.getRelationshipValue())
+                        }
+                    }
+                    for (RelatedToProperty relatedToProperty : relatedToPropertyList) {
+                        if (relatedToProperty.getPropertyKey() == "service-instance.service-instance-name") {
+                            execution.setVariable("networkServiceInstanceName", relatedToProperty.getPropertyValue())
+                        }
+                    }
+                }
+                //If related to is allotted-Resource
+                if (relatedTo == "allotted-resource") {
+                    //get slice Profile Instance Id from allotted resource in list by nssi
+                    List<String> sliceProfileInstanceIdList = new ArrayList<>()
+                    List<RelationshipData> relationshipDataList = relationship.getRelationshipData()
+                    for (RelationshipData relationshipData : relationshipDataList) {
+                        if (relationshipData.getRelationshipKey() == "service-instance.service-instance-id") {
+                            sliceProfileInstanceIdList.add(relationshipData.getRelationshipValue())
+                        }
+                    }
+                    for (String sliceProfileServiceInstanceId : sliceProfileInstanceIdList) {
+                        String errorSliceProfileMsg = "Slice Profile Service Instance was not found in aai"
+
+                        //Query Slice Profile Service Instance From AAI by sliceProfileServiceInstanceId
+                        AAIResultWrapper sliceProfileInstanceWrapper = queryAAI(execution, Types.SERVICE_INSTANCE, sliceProfileServiceInstanceId, errorSliceProfileMsg)
+                        Optional<ServiceInstance> sliceProfileServiceInstance = sliceProfileInstanceWrapper.asBean(ServiceInstance.class)
+                        if (sliceProfileServiceInstance.isPresent()) {
+                            String orchestrationStatus= sliceProfileServiceInstance.get().getOrchestrationStatus()
+                            String sNssai = sliceProfileServiceInstance.get().getSliceProfiles().getSliceProfile().get(0).getSNssai()
+                            if(sNssai.equals(execution.getVariable("sNssai"))) {
+                                orchestrationStatus = execution.getVariable("oStatus")
+                                //Slice Profile Service Instance to be updated in AAI
+                                execution.setVariable("sliceProfileServiceInstance", sliceProfileServiceInstance)
+                            }
+
+                            Map<String, Object> spiWithsNssaiAndOrchStatus = new LinkedHashMap<>()
+                            spiWithsNssaiAndOrchStatus.put("snssai", sNssai)
+                            spiWithsNssaiAndOrchStatus.put("status", orchestrationStatus)
+                            spiWithsNssaiAndOrchStatusList.add(spiWithsNssaiAndOrchStatus)
+                            logger.debug("service Profile's NSSAI And Orchestration Status:  "+spiWithsNssaiAndOrchStatus)
+                        }
+                    }
+                }
+            }
+            execution.setVariable("snssaiAndOrchStatusList", spiWithsNssaiAndOrchStatusList)
+        }
+
+        logger.debug("NSSI Id: ${serviceInstanceId}, network Service Instance Id: ${networkServiceInstanceId}, serviceName: ${networkServiceInstanceName}")
+
+        //Get ServiceInstance Relationships
+        getServiceInstanceRelationships(execution)
+
+        //Get Vnf Relationships
+        getVnfRelationships(execution)
+
+        logger.debug(Prefix+" **** Exit DoAllocateCoreSharedSlice ::: getNetworkInstanceAssociatedWithNssiId ****")
+    }
+
+    private void getServiceInstanceRelationships(DelegateExecution execution) {
+
+        logger.debug(Prefix+" **** Enter DoAllocateCoreSharedSlice ::: getServiceInstanceRelationships ****")
+
+        String serviceInstanceId = execution.getVariable("networkServiceInstanceId")
+
+        String errorMsg = "query Network Service Instance from AAI failed"
+        AAIResultWrapper wrapper = queryAAI(execution, Types.SERVICE_INSTANCE, serviceInstanceId, errorMsg)
+        Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class)
+
+        String networkServiceModelInvariantUuid = si.get().getModelInvariantId()
+        execution.setVariable("networkServiceModelInvariantUuid", networkServiceModelInvariantUuid)
+        if(si.isPresent()) {
+            List<Relationship> relationshipList = si.get().getRelationshipList()?.getRelationship()
+            for (Relationship relationship : relationshipList) {
+                String relatedTo = relationship.getRelatedTo()
+                if (relatedTo == "owning-entity") {
+                    List<RelationshipData> relationshipDataList = relationship.getRelationshipData()
+                    for (RelationshipData relationshipData : relationshipDataList) {
+                        if (relationshipData.getRelationshipKey() == "owning-entity.owning-entity-id") {
+                            execution.setVariable("owningEntityId", relationshipData.getRelationshipValue())
+                        }
+                    }
+                } else if (relatedTo == "generic-vnf") {
+                    List<RelationshipData> relationshipDataList = relationship.getRelationshipData()
+                    List<RelatedToProperty> relatedToPropertyList = relationship.getRelatedToProperty()
+
+                    //Get VnfId
+                    for (RelationshipData relationshipData : relationshipDataList) {
+                        if (relationshipData.getRelationshipKey() == "generic-vnf.vnf-id") {
+                            execution.setVariable("vnfId", relationshipData.getRelationshipValue())
+                        }
+                    }
+
+                    //Get Vnf Name Check If necessary
+                    for (RelatedToProperty relatedToProperty : relatedToPropertyList) {
+                        if (relatedToProperty.getPropertyKey() == "generic-vnf.vnf-name") {
+                            execution.setVariable("vnfName", relatedToProperty.getPropertyValue())
+                        }
+                    }
+                } else if (relatedTo == "project") {
+                    List<RelationshipData> relationshipDataList = relationship.getRelationshipData()
+                    for (RelationshipData relationshipData : relationshipDataList) {
+                        if (relationshipData.getRelationshipKey() == "project.project-name") {
+                            execution.setVariable("projectName", relationshipData.getRelationshipValue())
+                        }
+                    }
+                }
+            }
+
+            logger.debug(Prefix+" **** Exit DoAllocateCoreSharedSlice ::: getServiceInstanceRelationships ****")
+        }
+    }
+
+    private void getVnfRelationships(DelegateExecution execution) {
+
+        logger.debug(Prefix+" **** Enter DoAllocateCoreSharedSlice ::: getVnfRelationships ****")
+        String msg = "query Generic Vnf from AAI failed"
+        try {
+            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(execution.getVariable('vnfId')))
+            if (!getAAIClient().exists(uri)) {
+                exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
+            }
+            AAIResultWrapper wrapper = getAAIClient().get(uri, NotFoundException.class)
+            Optional<GenericVnf> vnf = wrapper.asBean(GenericVnf.class)
+            if(vnf.isPresent()) {
+                List<Relationship> relationshipList = vnf.get().getRelationshipList()?.getRelationship()
+                for (Relationship relationship : relationshipList) {
+                    String relatedTo = relationship.getRelatedTo()
+                    if (relatedTo == "tenant") {
+                        List<RelationshipData> relationshipDataList = relationship.getRelationshipData()
+                        for (RelationshipData relationshipData : relationshipDataList) {
+                            if (relationshipData.getRelationshipKey() == "tenant.tenant-id") {
+                                execution.setVariable("tenantId", relationshipData.getRelationshipValue())
+                            }
+                        }
+                    } else if (relatedTo == "cloud-region") {
+                        List<RelationshipData> relationshipDataList = relationship.getRelationshipData()
+                        for (RelationshipData relationshipData : relationshipDataList) {
+                            if (relationshipData.getRelationshipKey() == "cloud-region.cloud-owner") {
+                                execution.setVariable("cloudOwner", relationshipData.getRelationshipValue())
+                            } else if (relationshipData.getRelationshipKey() == "cloud-region.cloud-region-id") {
+                                execution.setVariable("lcpCloudRegionId", relationshipData.getRelationshipValue())
+                            }
+                        }
+                    } else if (relatedTo == "platform") {
+                        List<RelationshipData> relationshipDataList = relationship.getRelationshipData()
+                        for (RelationshipData relationshipData : relationshipDataList) {
+                            if (relationshipData.getRelationshipKey() == "platform.platform-name") {
+                                execution.setVariable("platformName", relationshipData.getRelationshipValue())
+                            }
+                        }
+                    } else if (relatedTo == "line-of-business") {
+                        List<RelationshipData> relationshipDataList = relationship.getRelationshipData()
+                        for (RelationshipData relationshipData : relationshipDataList) {
+                            if (relationshipData.getRelationshipKey() == "line-of-business.line-of-business-name") {
+                                execution.setVariable("lineOfBusinessName", relationshipData.getRelationshipValue())
+                            }
+                        }
+                    }
+                }
+            }
+        } catch(BpmnError e){
+            throw e
+        } catch (Exception ex){
+            msg = "Exception in getVnfRelationships " + ex.getMessage()
+            logger.debug(msg)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+        }
+        logger.debug(Prefix+" **** Exit DoAllocateCoreSharedSlice ::: getVnfRelationships ****")
+    }
+
+
+    /**
+     * query AAI
+     * @param execution
+     * @param aaiObjectName
+     * @param instanceId
+     * @return AAIResultWrapper
+     */
+    private AAIResultWrapper queryAAI(DelegateExecution execution, AAIObjectName aaiObjectName, String instanceId, String errorMsg) {
+        logger.debug(Prefix+" **** Enter DoAllocateCoreSharedSlice ::: queryAAI ****")
+        String globalSubscriberId = execution.getVariable("globalSubscriberId")
+        String serviceType = execution.getVariable("serviceType")
+        AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(serviceType).serviceInstance(instanceId))
+        if (!getAAIClient().exists(resourceUri)) {
+            exceptionUtil.buildAndThrowWorkflowException(execution, 2500, errorMsg)
+        }
+        AAIResultWrapper wrapper = getAAIClient().get(resourceUri, NotFoundException.class)
+        logger.debug(Prefix+" **** Exit DoAllocateCoreSharedSlice ::: queryAAI ****")
+        return wrapper
+    }
+
+    public void getServiceVNFAndVFsFromCatalogDB(DelegateExecution execution) {
+        logger.debug(Prefix+" **** Enter DoAllocateCoreSharedSlice ::: getServiceVNFAndVFsFromCatalogDB ****")
+        String serviceVnfs="";
+        String msg=""
+        String modelInvariantUuid = execution.getVariable("networkServiceModelInvariantUuid")
+        try{
+            CatalogDbUtils catalogDbUtils = new CatalogDbUtilsFactory().create()
+            String json = catalogDbUtils.getServiceResourcesByServiceModelInvariantUuidString(execution, modelInvariantUuid)
+            logger.debug("***** JSON IS: "+json)
+            serviceVnfs = jsonUtil.getJsonValue(json, "serviceResources.serviceVnfs") ?: ""
+            String serviceModelInfo = jsonUtil.getJsonValue(json, "serviceResources.modelInfo") ?: ""
+            execution.setVariable("serviceModelInfo", serviceModelInfo)
+            execution.setVariable("serviceVnfs",serviceVnfs)
+            logger.debug("***** serviceVnfs is: "+ serviceVnfs)
+        }catch(BpmnError e){
+            throw e
+        } catch (Exception ex){
+            msg = "Exception in preProcessRequest " + ex.getMessage()
+            logger.debug(msg)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+        }
+        logger.debug(Prefix+" **** Exit DoAllocateCoreSharedSlice ::: getServiceVNFAndVFsFromCatalogDB ****")
+    }
+
+    public void prepareSOMacroRequestPayload(DelegateExecution execution) {
+        logger.debug(Prefix+" **** Enter DoAllocateCoreSharedSlice ::: prepareSOMacroRequestPayLoad ****")
+        String json = execution.getVariable("serviceVnfs")
+        logger.debug(">>>> json "+json)
+        List<Object> vnfList = mapper.readValue(json, List.class);
+        logger.debug("vnfList:  "+vnfList)
+        Map<String,Object> serviceMap = mapper.readValue(execution.getVariable("serviceModelInfo"), Map.class);
+        ModelInfo serviceModelInfo = new ModelInfo()
+        serviceModelInfo.setModelType(ModelType.service)
+        serviceModelInfo.setModelInvariantId(serviceMap.get("modelInvariantUuid"))
+        serviceModelInfo.setModelVersionId(serviceMap.get("modelUuid"))
+        serviceModelInfo.setModelName(serviceMap.get("modelName"))
+        serviceModelInfo.setModelVersion(serviceMap.get("modelVersion"))
+        logger.debug("serviceModelInfo:  "+serviceModelInfo)
+        //List of Vnfs
+        List<Object> vnfModelInfoList = new ArrayList<>()
+
+        Map vnfMap = vnfList.get(0)
+        ModelInfo vnfModelInfo = vnfMap.get("modelInfo")
+        logger.debug("vnfModelInfo "+vnfModelInfo)
+
+        //List of VFModules
+        List<Map<String, Object>> vfModuleList = vnfMap.get("vfModules")
+        logger.debug("vfModuleList "+vfModuleList)
+
+        //List of VfModules
+        List<ModelInfo> vfModelInfoList = new ArrayList<>()
+
+        //Traverse VFModules List and add in vfModelInfoList
+        for (vfModule in vfModuleList) {
+            ModelInfo vfModelInfo = vfModule.get("modelInfo")
+            logger.debug("vfModelInfo "+vfModelInfo)
+            vfModelInfoList.add(vfModelInfo)
+        }
+        //RequestInfo
+        RequestInfo requestInfo = new RequestInfo()
+
+        //Dummy Product FamilyId
+        requestInfo.setProductFamilyId("test1234")
+        requestInfo.setSource("VID")
+        requestInfo.setInstanceName(execution.getVariable("networkServiceInstanceName"))
+        requestInfo.setSuppressRollback(false)
+        requestInfo.setRequestorId("NBI")
+
+        //Service Level InstanceParams
+        List<Map<String, Object>> serviceParams = new ArrayList<>()
+        Map<String, Object> serviceParamsValues = new LinkedHashMap<>()
+        serviceParams.add(serviceParamsValues)
+
+        //Cloud Configuration
+        CloudConfiguration cloudConfiguration = new CloudConfiguration()
+        cloudConfiguration.setLcpCloudRegionId(execution.getVariable("lcpCloudRegionId"))
+        cloudConfiguration.setTenantId(execution.getVariable("tenantId"))
+        cloudConfiguration.setCloudOwner(execution.getVariable("cloudOwner"))
+
+        //VFModules List
+        List<Map<String, Object>> vfModules = new ArrayList<>()
+        for (ModelInfo vfModuleModelInfo : vfModelInfoList) {
+            //Individual VFModule List
+            Map<String, Object> vfModuleValues = new LinkedHashMap<>()
+            vfModuleValues.put("modelInfo", vfModuleModelInfo)
+            vfModuleValues.put("instanceName", vfModuleModelInfo.getModelInstanceName())
+
+            //VFModule InstanceParams should be empty or this field should not be there?
+            List<Map<String, Object>> vfModuleInstanceParams = new ArrayList<>()
+            vfModuleValues.put("instanceParams", vfModuleInstanceParams)
+        }
+
+        //Vnf intsanceParams
+        Map<String, Object> sliceProfile = mapper.readValue(execution.getVariable("sliceProfile"), Map.class);
+
+        List vnfInstanceParamsList = new ArrayList<>()
+        String supportedsNssaiJson= prepareVnfInstanceParamsJson(execution)
+        vnfInstanceParamsList.add(supportedsNssaiJson)
+
+        Platform platform = new Platform()
+        platform.setPlatformName(execution.getVariable("platform"))
+
+        LineOfBusiness lineOfbusiness = new LineOfBusiness()
+        lineOfbusiness.setLineOfBusinessName(execution.getVariable("lineOfBusiness"))
+
+        //Vnf Values
+        Map<String, Object> vnfValues = new LinkedHashMap<>()
+        vnfValues.put("lineOfBusiness", lineOfbusiness)
+        vnfValues.put("platform", platform)
+        vnfValues.put("productFamilyId", "test1234")
+        vnfValues.put("cloudConfiguration", cloudConfiguration)
+        vnfValues.put("vfModules", vfModules)
+        vnfValues.put("modelInfo", vnfModelInfo)
+        vnfValues.put("instanceName", execution.getVariable("vnfInstanceName"))
+        vnfValues.put("instanceParams",vnfInstanceParamsList)
+
+        vnfModelInfoList.add(vnfValues)
+        //Service Level Resources
+        Map<String, Object> serviceResources = new LinkedHashMap<>()
+        serviceResources.put("vnfs", vnfModelInfoList)
+
+        //Service Values
+        Map<String, Object> serviceValues = new LinkedHashMap<>()
+        serviceValues.put("modelInfo", serviceModelInfo)
+        serviceValues.put("instanceName", execution.getVariable("networkServiceInstanceName"))
+        serviceValues.put("resources", serviceResources)
+        serviceValues.put("instanceParams", serviceParams)
+
+        //UserParams Values
+        Map<String, Object> userParamsValues = new LinkedHashMap<>()
+
+        Map<String, Object> homingSolution = new LinkedHashMap<>()
+        homingSolution.put("Homing_Solution", "none")
+
+        userParamsValues.put("service", serviceValues)
+
+        //UserParams
+        List<Map<String, Object>> userParams = new ArrayList<>()
+        userParams.add(homingSolution)
+        userParams.add(userParamsValues)
+
+        //Request Parameters
+        RequestParameters requestParameters = new RequestParameters()
+        requestParameters.setaLaCarte(false)
+        requestParameters.setSubscriptionServiceType(execution.getVariable("serviceType"))
+        requestParameters.setUserParams(userParams)
+
+        //SubscriberInfo
+        SubscriberInfo subscriberInfo = new SubscriberInfo()
+        subscriberInfo.setGlobalSubscriberId(execution.getVariable("globalSubscriberId"))
+
+        //Owning Entity
+        OwningEntity owningEntity = new OwningEntity()
+        owningEntity.setOwningEntityId(execution.getVariable("owningEntityId"))
+
+        //Project
+        Project project = new Project()
+        project.setProjectName(execution.getVariable("projectName"))
+
+        RequestDetails requestDetails = new RequestDetails()
+        requestDetails.setModelInfo(serviceModelInfo)
+        requestDetails.setSubscriberInfo(subscriberInfo)
+        requestDetails.setRequestInfo(requestInfo)
+        requestDetails.setRequestParameters(requestParameters)
+        requestDetails.setCloudConfiguration(cloudConfiguration)
+        requestDetails.setOwningEntity(owningEntity)
+        requestDetails.setProject(project)
+
+        Map<String, Object> requestDetailsMap = new LinkedHashMap<>()
+        requestDetailsMap.put("requestDetails", requestDetails)
+        String requestPayload = mapper.writeValueAsString(requestDetailsMap)
+
+        logger.debug("requestDetails "+requestPayload)
+        execution.setVariable("requestPayload", requestPayload)
+
+        logger.debug(Prefix+" **** Exit DoAllocateCoreSharedSlice ::: prepareSOMacroRequestPayLoad ****")
+    }
+
+    private String prepareVnfInstanceParamsJson(DelegateExecution execution) {
+        logger.debug(Prefix+" **** Enter DoAllocateCoreSharedSlice ::: prepareVnfInstanceParamsJson ****")
+        List instanceParamsvalues = execution.getVariable("snssaiAndOrchStatusList")
+        Map<String, Object> nSsai= new LinkedHashMap<>()
+        nSsai.put("sNssai", instanceParamsvalues)
+
+        String supportedsNssaiJson = mapper.writeValueAsString(nSsai)
+        //SupportedNssai
+        Map<String, Object> supportedNssai= new LinkedHashMap<>()
+        supportedNssai.put("supportedNssai", supportedsNssaiJson)
+        logger.debug("****  supportedsNssaiJson**** "+supportedNssai)
+        logger.debug(Prefix+" **** Exit DoAllocateCoreSharedSlice ::: prepareVnfInstanceParamsJson ****")
+        return supportedNssai
+    }
+
+    public void sendPutRequestToSOMacro(DelegateExecution execution) {
+        logger.debug(Prefix+" **** Enter DoAllocateCoreSharedSlice ::: sendPutRequestToSOMacro ****")
+        try {
+            String msoEndpoint = UrnPropertiesReader.getVariable("mso.infra.endpoint.url", execution)
+            String url = msoEndpoint+"/serviceInstantiation/v7/serviceInstances/"+execution.getVariable("networkServiceInstanceId")+"/vnfs/"+execution.getVariable("vnfId")
+
+            String requestBody = execution.getVariable("requestPayload")
+
+            String msoKey = UrnPropertiesReader.getVariable("mso.msoKey", execution)
+            String basicAuth =  UrnPropertiesReader.getVariable("mso.infra.endpoint.auth", execution)
+            String basicAuthValue = utils.encrypt(basicAuth, msoKey)
+            String encodeString = utils.getBasicAuth(basicAuthValue, msoKey)
+
+            HttpClient httpClient = getHttpClientFactory().newJsonClient(new URL(url), ONAPComponents.SO)
+            httpClient.addAdditionalHeader("Authorization", encodeString)
+            httpClient.addAdditionalHeader("Accept", "application/json")
+            Response httpResponse = httpClient.put(requestBody)
+            handleSOResponse(httpResponse, execution)
+        } catch (BpmnError e) {
+            throw e
+        } catch (any) {
+            String msg = Prefix+" Exception in DoAllocateCoreSharedSlice " + any.getCause()
+            logger.error(msg)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+        }
+        logger.debug(Prefix+" **** Exit DoAllocateCoreSharedSlice ::: sendPostRequestToSOMacro ****")
+    }
+
+    /**
+     * Handle SO Response for PUT and prepare update operation status
+     * @param execution
+     */
+    private void handleSOResponse(Response httpResponse, DelegateExecution execution){
+        logger.debug(Prefix+" **** Enter DoAllocateCoreSharedSlice ::: handleSOResponse ****")
+
+        int soResponseCode = httpResponse.getStatus()
+        logger.debug("soResponseCode : "+soResponseCode)
+
+        if (soResponseCode >= 200 && soResponseCode < 204 && httpResponse.hasEntity()) {
+            String soResponse = httpResponse.readEntity(String.class)
+            String operationId = execution.getVariable("operationId")
+            def macroOperationId = jsonUtil.getJsonValue(soResponse, "operationId")
+            execution.setVariable("macroOperationId", macroOperationId)
+            execution.setVariable("isSOTimeOut", "no")
+            execution.setVariable("isSOResponseSucceed","yes")
+        }
+        else {
+            String serviceName = execution.getVariable("serviceInstanceName")
+            execution.setVariable("isSOResponseSucceed","no")
+            prepareFailedOperationStatusUpdate(execution)
+        }
+        logger.debug(Prefix+" **** Exit DoAllocateCoreSharedSlice ::: handleSOResponse ****")
+    }
+
+    /**
+     * prepare to call sub process CheckProcessStatus
+     * @param execution
+     */
+    void prepareCallCheckProcessStatus(DelegateExecution execution){
+        logger.debug(Prefix+" **** Enter DoAllocateCoreSharedSlice ::: prepareCallCheckProcessStatus ****")
+        def successConditions = new ArrayList<>()
+        successConditions.add("finished")
+        execution.setVariable("successConditions", successConditions)
+        def errorConditions = new ArrayList<>()
+        errorConditions.add("error")
+        execution.setVariable("errorConditions", errorConditions)
+        execution.setVariable("processServiceType", "Network service")
+        execution.setVariable("subOperationType", "PUT")
+        execution.setVariable("initProgress", 20)
+        execution.setVariable("endProgress",90)
+        execution.setVariable("timeOut", TIMEOUT)
+        logger.debug(Prefix+" **** Exit DoAllocateCoreSharedSlice ::: prepareCallCheckProcessStatus ****")
+    }
+
+    void prepareUpdateResourceOperationStatus(DelegateExecution execution) {
+
+        logger.debug(Prefix+" **** Enter DoAllocateCoreSharedSlice ::: prepareUpdateResourceOperationStatus ****")
+        //Prepare Update Status for PUT failure and success
+        if(execution.getVariable("isTimeOut").equals("YES")) {
+            logger.debug("TIMEOUT - SO PUT Failure")
+            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "SO PUT Failure")
+        } else {
+            execution.setVariable("progress", "100")
+            execution.setVariable("status", "finished")
+            execution.setVariable("operationContent", "AllocteCoreNSSI successful.")
+            logger.debug("prepareFailureStatus,result:${execution.getVariable("result")}, reason: ${execution.getVariable("reason")}")
+        }
+        setResourceOperationStatus(execution)
+        logger.debug(Prefix+" **** Exit DoAllocateCoreSharedSlice ::: prepareUpdateResourceOperationStatus ****")
+    }
+
+    /**
+     * prepare ResourceOperation status
+     * @param execution
+     * @param operationType
+     */
+    private void setResourceOperationStatus(DelegateExecution execution) {
+        logger.debug(Prefix+" **** Enter DoAllocateCoreSharedSlice ::: setResourceOperationStatus ****")
+        String serviceId = execution.getVariable("nssiId")
+        String jobId = execution.getVariable("jobId")
+        String nsiId = execution.getVariable("nsiId")
+        String operationType = execution.getVariable("operationType")
+        ResourceOperationStatus resourceOperationStatus = new ResourceOperationStatus()
+        resourceOperationStatus.setServiceId(serviceId)
+        resourceOperationStatus.setOperationId(jobId)
+        resourceOperationStatus.setResourceTemplateUUID(nsiId)
+        resourceOperationStatus.setOperType(operationType)
+        resourceOperationStatus.setStatus("finished")
+        resourceOperationStatus.setProgress("100")
+        resourceOperationStatus.setStatusDescription("Core Allocate successful")
+        requestDBUtil.prepareUpdateResourceOperationStatus(execution, resourceOperationStatus)
+        logger.debug(Prefix+" **** Exit DoAllocateCoreSharedSlice ::: setResourceOperationStatus ****")
+    }
+
+    void prepareFailedOperationStatusUpdate(DelegateExecution execution){
+        logger.debug(Prefix + " **** Enter DoAllocateCoreSharedSlice ::: prepareFailedOperationStatusUpdate ****")
+        String serviceId = execution.getVariable("nssiId")
+        String jobId = execution.getVariable("jobId")
+        String nsiId = execution.getVariable("nsiId")
+        String operationType = execution.getVariable("operationType")
+
+        ResourceOperationStatus resourceOperationStatus = new ResourceOperationStatus()
+        resourceOperationStatus.setServiceId(serviceId)
+        resourceOperationStatus.setOperationId(jobId)
+        resourceOperationStatus.setResourceTemplateUUID(nsiId)
+        resourceOperationStatus.setOperType(operationType)
+        resourceOperationStatus.setProgress(0)
+        resourceOperationStatus.setStatus("failed")
+        resourceOperationStatus.setStatusDescription("Core NSSI Allocate Failed")
+        requestDBUtil.prepareUpdateResourceOperationStatus(execution, resourceOperationStatus)
+        logger.debug(Prefix + " **** Exit DoAllocateCoreSharedSlice ::: prepareFailedOperationStatusUpdate ****")
+    }
+}
\ No newline at end of file
index 4a8469c..c497fc4 100644 (file)
@@ -2,56 +2,63 @@
  * ============LICENSE_START=======================================================
  * ONAP - SO
  * ================================================================================
* Copyright (C) 2019 Huawei Technologies Co., Ltd. All rights reserved.
- * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
*      http://www.apache.org/licenses/LICENSE-2.0
- *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
# Copyright (c) 2020, CMCC Technologies Co., Ltd.
+ #
# Licensed under the Apache License, Version 2.0 (the "License")
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
+ #
      http://www.apache.org/licenses/LICENSE-2.0
+ #
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
  * ============LICENSE_END=========================================================
  */
 
 package org.onap.so.bpmn.infrastructure.scripts
 
+import static org.apache.commons.lang3.StringUtils.isBlank
+import javax.ws.rs.NotFoundException
 import org.camunda.bpm.engine.delegate.BpmnError
 import org.camunda.bpm.engine.delegate.DelegateExecution
 import org.onap.aai.domain.yang.Relationship
-import org.onap.aai.domain.yang.RelationshipList
 import org.onap.aai.domain.yang.ServiceInstance
-import org.onap.so.beans.nsmf.SliceTaskParams
-import org.onap.so.bpmn.common.scripts.ExceptionUtil
-import org.onap.so.bpmn.common.scripts.NssmfAdapterUtils
-import org.onap.so.bpmn.core.domain.ServiceDecomposition
-import org.onap.so.bpmn.core.domain.ServiceProxy
-import org.onap.so.bpmn.core.json.JsonUtils
-import org.onap.aaiclient.client.aai.AAIObjectType
+import org.onap.aai.domain.yang.SliceProfile
 import org.onap.aaiclient.client.aai.AAIResourcesClient
 import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
 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.so.beans.nsmf.AllocateAnNssi
+import org.onap.so.beans.nsmf.AllocateCnNssi
+import org.onap.so.beans.nsmf.AllocateTnNssi
+import org.onap.so.beans.nsmf.AnSliceProfile
+import org.onap.so.beans.nsmf.CnSliceProfile
+import org.onap.so.beans.nsmf.EsrInfo
+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.ServiceInfo
+import org.onap.so.beans.nsmf.SliceTaskInfo
+import org.onap.so.beans.nsmf.SliceTaskParamsAdapter
+import org.onap.so.beans.nsmf.TnSliceProfile
+import org.onap.so.bpmn.common.scripts.ExceptionUtil
+import org.onap.so.bpmn.core.json.JsonUtils
 import org.slf4j.Logger
 import org.slf4j.LoggerFactory
 
-import javax.ws.rs.NotFoundException
-
-import static org.apache.commons.lang3.StringUtils.isBlank
-
 class DoAllocateNSIandNSSI extends org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor{
 
-    private static final Logger logger = LoggerFactory.getLogger( DoAllocateNSIandNSSI.class);
+    private static final Logger logger = LoggerFactory.getLogger(DoAllocateNSIandNSSI.class);
 
     ExceptionUtil exceptionUtil = new ExceptionUtil()
 
     JsonUtils jsonUtil = new JsonUtils()
 
-    private NssmfAdapterUtils nssmfAdapterUtils = new NssmfAdapterUtils(httpClientFactory, jsonUtil)
+    AAIResourcesClient client = getAAIClient()
 
     /**
      * Pre Process the BPMN Flow Request
@@ -72,165 +79,74 @@ class DoAllocateNSIandNSSI extends org.onap.so.bpmn.common.scripts.AbstractServi
         logger.trace("Exit preProcessRequest")
     }
 
+    /**
+     * Process NSI options
+     * @param execution
+     */
     void retriveSliceOption(DelegateExecution execution) {
         logger.trace("Enter retriveSliceOption() of DoAllocateNSIandNSSI")
-        String uuiRequest = execution.getVariable("uuiRequest")
-        boolean isNSIOptionAvailable = false
-        List<String> nssiAssociated = new ArrayList<>()
-        SliceTaskParams sliceParams = execution.getVariable("sliceTaskParams")
-        try
-        {
-            Map<String, Object> nstSolution = execution.getVariable("nstSolution") as Map
-            String modelUuid = nstSolution.get("UUID")
-            String modelInvariantUuid = nstSolution.get("invariantUUID")
-            String serviceModelInfo = """{
-            "modelInvariantUuid":"${modelInvariantUuid}",
-            "modelUuid":"${modelUuid}",
-            "modelVersion":""
-             }"""
-            execution.setVariable("serviceModelInfo", serviceModelInfo)
-            //Params sliceParams = new Gson().fromJson(params, new TypeToken<Params>() {}.getType());
-            execution.setVariable("sliceParams", sliceParams)
-        }catch (Exception ex) {
-            logger.debug( "Unable to get the task information from request DB: " + ex)
-            exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Unable to get task information from request DB.")
-        }
-
-        if(isBlank(sliceParams.getSuggestNsiId()))
-        {
-            isNSIOptionAvailable=false
-        }
-        else
-        {
-            isNSIOptionAvailable=true
-            execution.setVariable('nsiServiceInstanceId',sliceParams.getSuggestNsiId())
-            execution.setVariable('nsiServiceInstanceName',sliceParams.getSuggestNsiName())
-        }
-        execution.setVariable("isNSIOptionAvailable",isNSIOptionAvailable)
-        logger.trace("Exit retriveSliceOption() of DoAllocateNSIandNSSI")
-    }
 
-    void updateRelationship(DelegateExecution execution) {
-        logger.debug("Enter update relationship in DoAllocateNSIandNSSI()")
-        String allottedResourceId = execution.getVariable("allottedResourceId")
-        //Need to check whether nsi exist : Begin
-        org.onap.aai.domain.yang.ServiceInstance nsiServiceInstance = new org.onap.aai.domain.yang.ServiceInstance()
-        SliceTaskParams sliceParams = execution.getVariable("sliceParams")
-        String nsiServiceInstanceID = sliceParams.getSuggestNsiId()
+        boolean isNSIOptionAvailable
 
-        AAIResourcesClient resourceClient = new AAIResourcesClient()
-        AAIResourceUri nsiServiceuri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, execution.getVariable("globalSubscriberId"), execution.getVariable("subscriptionServiceType"), nsiServiceInstanceID)
-        //AAIResourceUri nsiServiceuri = AAIUriFactory.createResourceUri(AAIObjectType.QUERY_ALLOTTED_RESOURCE, execution.getVariable("globalSubscriberId"), execution.getVariable("serviceType"), nsiServiceInstanceID)
+        SliceTaskParamsAdapter sliceParams =
+                execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter
 
-        try {
-            AAIResultWrapper wrapper = resourceClient.get(nsiServiceuri, NotFoundException.class)
-            Optional<org.onap.aai.domain.yang.ServiceInstance> si = wrapper.asBean(org.onap.aai.domain.yang.ServiceInstance.class)
-            nsiServiceInstance = si.get()
-            //allottedResourceId=nsiServiceInstance.getAllottedResources().getAllottedResource().get(0).getId()
-
-//            if(resourceClient.exists(nsiServiceuri)){
-//                execution.setVariable("nsi_resourceLink", nsiServiceuri.build().toString())
-//            }else{
-//                exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service instance was not found in aai to " +
-//                        "associate for service :"+serviceInstanceId)
-//            }
-
-        AAIResourceUri allottedResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.ALLOTTED_RESOURCE, execution.getVariable("globalSubscriberId"), execution.getVariable("subscriptionServiceType"), execution.getVariable("sliceServiceInstanceId"), allottedResourceId)
-        getAAIClient().connect(allottedResourceUri,nsiServiceuri)
-
-        List<String> nssiAssociated = new ArrayList<>()
-        RelationshipList relationshipList = nsiServiceInstance.getRelationshipList()
-        List<Relationship> relationships = relationshipList.getRelationship()
-        for(Relationship relationship in relationships)
-        {
-            if(relationship.getRelatedTo().equalsIgnoreCase("service-instance"))
-            {
-                String NSSIassociated = relationship.getRelatedLink().substring(relationship.getRelatedLink().lastIndexOf("/") + 1);
-                if(!NSSIassociated.equals(nsiServiceInstanceID))
-                    nssiAssociated.add(NSSIassociated)
-            }
+        if(isBlank(sliceParams.getSuggestNsiId())) {
+            isNSIOptionAvailable = false
         }
-        execution.setVariable("nssiAssociated",nssiAssociated)
-        execution.setVariable("nsiServiceInstanceName",nsiServiceInstance.getServiceInstanceName())
-        }catch(BpmnError e) {
-            throw e
-        }catch (Exception ex){
-            String msg = "NSI suggested in the option doesn't exist. " + nsiServiceInstanceID
-            logger.debug(msg)
-            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+        else {
+            isNSIOptionAvailable = true
+            execution.setVariable('nsiServiceInstanceId', sliceParams.getSuggestNsiId())
+            execution.setVariable('nsiServiceInstanceName', sliceParams.getSuggestNsiName())
         }
-        logger.debug("Exit update relationship in DoAllocateNSIandNSSI()")
+        execution.setVariable("isNSIOptionAvailable", isNSIOptionAvailable)
+        logger.trace("Exit retriveSliceOption() of DoAllocateNSIandNSSI")
     }
 
-    void prepareNssiModelInfo(DelegateExecution execution){
-        logger.trace("Enter prepareNssiModelInfo in DoAllocateNSIandNSSI()")
-        List<String> nssiAssociated = new ArrayList<>()
-        Map<String, Object> nssiMap = new HashMap<>()
-        nssiAssociated=execution.getVariable("nssiAssociated")
-        for(String nssiID in nssiAssociated)
-        {
-            try {
-                AAIResourcesClient resourceClient = new AAIResourcesClient()
-                AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, execution.getVariable("globalSubscriberId"), execution.getVariable("subscriptionServiceType"), nssiID)
-                AAIResultWrapper wrapper = resourceClient.get(serviceInstanceUri, NotFoundException.class)
-                Optional<org.onap.aai.domain.yang.ServiceInstance> si = wrapper.asBean(org.onap.aai.domain.yang.ServiceInstance.class)
-                org.onap.aai.domain.yang.ServiceInstance nssi = si.get()
-                nssiMap.put(nssi.getEnvironmentContext(),"""{
-                    "serviceInstanceId":"${nssi.getServiceInstanceId()}",
-                    "modelUuid":"${nssi.getModelVersionId()}"
-                     }""")
-
-            }catch(NotFoundException e)
-            {
-                logger.debug("NSSI Service Instance not found in AAI: " + nssiID)
-            }catch(Exception e)
-            {
-                logger.debug("NSSI Service Instance not found in AAI: " + nssiID)
-            }
-            execution.setVariable("nssiMap",nssiMap)
-
-        }
-        logger.trace("Exit prepareNssiModelInfo in DoAllocateNSIandNSSI()")
-    }
 
+    /**
+     * create nsi instance in aai
+     * @param execution
+     */
     void createNSIinAAI(DelegateExecution execution) {
         logger.debug("Enter CreateNSIinAAI in DoAllocateNSIandNSSI()")
-        ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
-        org.onap.aai.domain.yang.ServiceInstance nsi = new ServiceInstance();
+
         String sliceInstanceId = UUID.randomUUID().toString()
-        execution.setVariable("sliceInstanceId",sliceInstanceId)
-        nsi.setServiceInstanceId(sliceInstanceId)
+        SliceTaskParamsAdapter sliceParams =
+                execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter
+
+        //set new nsiId to sliceParams suggestNsiId
+        sliceParams.setSuggestNsiId(sliceInstanceId)
+
+        ServiceInstance nsi = new ServiceInstance()
+
+
         String sliceInstanceName = "nsi_"+execution.getVariable("sliceServiceInstanceName")
-        nsi.setServiceInstanceName(sliceInstanceName)
         String serviceType = execution.getVariable("serviceType")
-        nsi.setServiceType(serviceType)
         String serviceStatus = "deactivated"
+        String modelInvariantUuid = sliceParams.getNSTInfo().invariantUUID
+        String modelUuid = sliceParams.getNSTInfo().UUID
+
+        String uuiRequest = execution.getVariable("uuiRequest")
+        String serviceInstanceLocationid = jsonUtil.getJsonValue(uuiRequest, "service.parameters.requestInputs.plmnIdList")
+        String serviceRole = "nsi"
+
+        execution.setVariable("sliceInstanceId", sliceInstanceId)
+        nsi.setServiceInstanceId(sliceInstanceId)
+        nsi.setServiceInstanceName(sliceInstanceName)
+        nsi.setServiceType(serviceType)
         nsi.setOrchestrationStatus(serviceStatus)
-        String modelInvariantUuid = serviceDecomposition.getModelInfo().getModelInvariantUuid()
-        String modelUuid = serviceDecomposition.getModelInfo().getModelUuid()
         nsi.setModelInvariantId(modelInvariantUuid)
         nsi.setModelVersionId(modelUuid)
-        String uuiRequest = execution.getVariable("uuiRequest")
-        String serviceInstanceLocationid = jsonUtil.getJsonValue(uuiRequest, "service.parameters.requestInputs.plmnIdList")
         nsi.setServiceInstanceLocationId(serviceInstanceLocationid)
-        //String snssai = jsonUtil.getJsonValue(uuiRequest, "service.requestInputs.snssai")
-        //nsi.setEnvironmentContext(snssai)
-        String serviceRole = "nsi"
         nsi.setServiceRole(serviceRole)
-        String msg = ""
+        String msg
         try {
 
-            AAIResourcesClient client = new AAIResourcesClient()
-            AAIResourceUri nsiServiceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, execution.getVariable("globalSubscriberId"), execution.getVariable("subscriptionServiceType"), sliceInstanceId)
+            AAIResourceUri nsiServiceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(sliceInstanceId))
             client.create(nsiServiceUri, nsi)
 
-            Relationship relationship = new Relationship()
-            logger.info("Creating Allotted resource relationship, nsiServiceUri: " + nsiServiceUri.build().toString())
-            relationship.setRelatedLink(nsiServiceUri.build().toString())
-            AAIResourceUri allottedResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.ALLOTTED_RESOURCE,
-                    execution.getVariable("globalSubscriberId"),execution.getVariable("subscriptionServiceType"),
-                    execution.getVariable("sliceServiceInstanceId"), execution.getVariable("allottedResourceId")).relationshipAPI()
-            client.create(allottedResourceUri, relationship)
+            execution.setVariable("nsiServiceUri", nsiServiceUri)
 
         } catch (BpmnError e) {
             throw e
@@ -239,124 +155,527 @@ class DoAllocateNSIandNSSI extends org.onap.so.bpmn.common.scripts.AbstractServi
             logger.info(msg)
             exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
         }
-        Map<String, Object> nssiMap = new HashMap<>()
-        List<ServiceProxy> serviceProxyList = serviceDecomposition.getServiceProxy()
-        List<String> nsstModelInfoList = new ArrayList<>()
-        for(ServiceProxy serviceProxy : serviceProxyList)
-        {
-            //String nsstModelUuid = serviceProxy.getModelInfo().getModelUuid()
-            String nsstModelUuid = serviceProxy.getSourceModelUuid()
-            //String nsstModelInvariantUuid = serviceProxy.getModelInfo().getModelInvariantUuid()
-            String nsstServiceModelInfo = """{
-            "modelInvariantUuid":"",
-            "modelUuid":"${nsstModelUuid}",
-            "modelVersion":""
-             }"""
-            nsstModelInfoList.add(nsstServiceModelInfo)
-        }
-        int currentIndex=0
-        int maxIndex=nsstModelInfoList.size()
-        if(maxIndex < 1)
-        {
-            msg = "Exception in DoAllocateNSIandNSSI. There is no NSST associated with NST "
-            logger.info(msg)
+
+        logger.debug("Exit CreateNSIinAAI in DoAllocateNSIandNSSI()")
+    }
+
+
+    /**
+     * create relationship between nsi and service profile instance
+     * @param execution
+     */
+    void createRelationship(DelegateExecution execution) {
+        //relation ship
+        String allottedResourceId = execution.getVariable("allottedResourceId")
+        SliceTaskParamsAdapter sliceParams =
+                execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter
+
+        AAIResourceUri nsiServiceUri = execution.getVariable("nsiServiceUri") as AAIResourceUri
+        logger.info("Creating Allotted resource relationship, nsiServiceUri: " + nsiServiceUri)
+
+        AAIResourceUri allottedResourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(sliceParams.suggestNsiId).allottedResource(allottedResourceId))
+
+        client.connect(allottedResourceUri, nsiServiceUri)
+    }
+
+    /**
+     *
+     * @param execution
+     */
+    void updateRelationship(DelegateExecution execution) {
+        logger.debug("Enter update relationship in DoAllocateNSIandNSSI()")
+        //todo: allottedResourceId
+        String allottedResourceId = execution.getVariable("allottedResourceId")
+        //Need to check whether nsi exist : Begin
+
+        SliceTaskParamsAdapter sliceParams =
+                execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter
+
+        String nsiServiceInstanceID = sliceParams.getSuggestNsiId()
+        //sliceParams.setServiceId(nsiServiceInstanceID)
+
+        AAIResourceUri nsiServiceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(nsiServiceInstanceID))
+
+        try {
+            AAIResultWrapper wrapper = client.get(nsiServiceUri, NotFoundException.class)
+            Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class)
+            //todo: if exists
+            if (!si.ifPresent()) {
+                String msg = "NSI suggested in the option doesn't exist. " + nsiServiceInstanceID
+                logger.debug(msg)
+                exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+            }
+
+            AAIResourceUri allottedResourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(sliceParams.suggestNsiId).allottedResource(allottedResourceId))
+
+            client.connect(allottedResourceUri, nsiServiceUri)
+
+            execution.setVariable("sliceTaskParams", sliceParams)
+        }catch(BpmnError e) {
+            throw e
+        }catch (Exception ex){
+            String msg = "NSI suggested in the option doesn't exist. " + nsiServiceInstanceID
+            logger.debug(msg)
             exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
         }
-        execution.setVariable("nsstModelInfoList",nsstModelInfoList)
-        execution.setVariable("currentIndex",currentIndex)
-        execution.setVariable("maxIndex",maxIndex)
-        execution.setVariable('nsiServiceInstanceId',sliceInstanceId)
-        execution.setVariable("nsiServiceInstanceName",sliceInstanceName)
-        logger.debug("Exit CreateNSIinAAI in DoAllocateNSIandNSSI()")
+        logger.debug("Exit update relationship in DoAllocateNSIandNSSI()")
     }
 
-    void getOneNsstInfo(DelegateExecution execution){
-        List<String> nsstModelInfoList = new ArrayList<>()
-        nsstModelInfoList = execution.getVariable("nsstModelInfoList")
-        int currentIndex = execution.getVariable("currentIndex")
-        int maxIndex = execution.getVariable("maxIndex")
-        boolean isMoreNSSTtoProcess = true
-        String nsstServiceModelInfo = nsstModelInfoList.get(currentIndex)
-        execution.setVariable("serviceModelInfo", nsstServiceModelInfo)
-        execution.setVariable("currentIndex", currentIndex)
-        currentIndex = currentIndex+1
-        if(currentIndex <= maxIndex )
-            isMoreNSSTtoProcess = false
-        execution.setVariable("isMoreNSSTtoProcess", isMoreNSSTtoProcess)
+    /**
+     * create RAN Slice Profile Instance
+     * @param execution
+     */
+    void createAnSliceProfileInstance(DelegateExecution execution) {
+
+        String globalSubscriberId = execution.getVariable("globalSubscriberId")
+        String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
+        String serviceInstanceId = UUID.randomUUID().toString()
+        execution.setVariable("ranSliceProfileInstanceId", serviceInstanceId) //todo:
+
+        String serviceType = ""
+        String serviceRole = "slice-profile"
+        String oStatus = "deactivated"
+
+        SliceTaskParamsAdapter sliceParams =
+                execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter
+        SliceTaskInfo<AnSliceProfile> sliceTaskInfo = sliceParams.anSliceTaskInfo
+        sliceTaskInfo.setSliceInstanceId(serviceInstanceId)
+
+        // create slice profile
+        ServiceInstance rspi = new ServiceInstance()
+        rspi.setServiceInstanceName(sliceTaskInfo.NSSTInfo.name)
+        rspi.setServiceType(serviceType)
+        rspi.setServiceRole(serviceRole)
+        rspi.setOrchestrationStatus(oStatus)
+        rspi.setModelInvariantId(sliceTaskInfo.NSSTInfo.invariantUUID)
+        rspi.setModelVersionId(sliceTaskInfo.NSSTInfo.UUID)
+        rspi.setInputParameters(uuiRequest)
+        rspi.setWorkloadContext(useInterval)
+        rspi.setEnvironmentContext(sNSSAI_id)
+
+        //timestamp format YYYY-MM-DD hh:mm:ss
+        rspi.setCreatedAt(new Date(System.currentTimeMillis()).format("yyyy-MM-dd HH:mm:ss", TimeZone.getDefault()))
+
+        execution.setVariable("communicationServiceInstance", rspi)
+
+        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(serviceInstanceId))
+        client.create(uri, rspi)
+
+        execution.setVariable("sliceTaskParams", sliceParams)
     }
 
-    void createNSSTMap(DelegateExecution execution){
-        ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
-        String modelUuid= serviceDecomposition.getModelInfo().getModelUuid()
-        String content = serviceDecomposition.getServiceInfo().getServiceArtifact().get(0).getContent()
-        //String nsstID = jsonUtil.getJsonValue(content, "metadata.id")
-        //String vendor = jsonUtil.getJsonValue(content, "metadata.vendor")
-        //String type = jsonUtil.getJsonValue(content, "metadata.type")
-        String domain = jsonUtil.getJsonValue(content, "metadata.domainType")
-
-        Map<String, Object> nssiMap = execution.getVariable("nssiMap")
-        String servicename = execution.getVariable("sliceServiceInstanceName")
-        String nsiname = "nsi_"+servicename
-        nssiMap.put(domain,"""{
-                    "serviceInstanceId":"",
-                    "modelUuid":"${modelUuid}"
-                     }""")
-        execution.setVariable("nssiMap",nssiMap)
+    /**
+     * create An Slice Profile
+     * @param execution
+     */
+    void createAnSliceProfile(DelegateExecution execution) {
+
+        String globalSubscriberId = execution.getVariable("globalSubscriberId")
+        String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
+        //String serviceInstanceId = execution.getVariable("ranSliceProfileInstanceId")
+
+        SliceTaskParamsAdapter sliceParams =
+                execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter
+        SliceTaskInfo<AnSliceProfile> sliceTaskInfo = sliceParams.anSliceTaskInfo
+        AnSliceProfile anSliceProfile = sliceTaskInfo.sliceProfile
+
+        String profileId = UUID.randomUUID().toString()
+        anSliceProfile.setSliceProfileId(profileId)
+
+        SliceProfile sliceProfile = new SliceProfile()
+        sliceProfile.setProfileId(profileId)
+        sliceProfile.setCoverageAreaTAList(anSliceProfile.coverageAreaTAList as String)
+        //todo:...
+        AAIResourceUri uri = AAIUriFactory.createResourceUri(
+            AAIFluentTypeBuilder.business().customer(globalSubscriberId)
+            .serviceSubscription(subscriptionServiceType)
+            .serviceInstance(sliceTaskInfo.sliceInstanceId)
+            .sliceProfile(profileId)
+        )
+        client.create(uri, sliceProfile)
+        execution.setVariable("sliceTaskParams", sliceParams)
     }
 
-    void prepareNSSIList(DelegateExecution execution){
-        logger.trace("Enter prepareNSSIList in DoAllocateNSIandNSSI()")
-        Map<String, Object> nssiMap = new HashMap<>()
-        Boolean isMoreNSSI = false
-        nssiMap = execution.getVariable("nssiMap")
-        List<String> keys=new ArrayList<String>(nssiMap.values())
-        List<String> nsstSequence = execution.getVariable("nsstSequence")
-        Integer currentIndex=0;
-        execution.setVariable("currentNssiIndex",currentIndex)
-        Integer maxIndex=keys.size()
-        execution.setVariable("maxIndex",maxIndex)
-        if(maxIndex>0)
-            isMoreNSSI=true
-        execution.setVariable("isMoreNSSI",isMoreNSSI)
-        logger.trace("Exit prepareNSSIList in DoAllocateNSIandNSSI()")
+    /**
+     * prepare AllocateAnNssi
+     * @param execution
+     */
+    void prepareAllocateAnNssi(DelegateExecution execution) {
+
+        //todo:
+        SliceTaskParamsAdapter sliceParams =
+                execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter
+        SliceTaskInfo<AnSliceProfile> sliceTaskInfo = sliceParams.anSliceTaskInfo
+
+        NssmfAdapterNBIRequest nbiRequest = new NssmfAdapterNBIRequest()
+
+        AllocateAnNssi allocateAnNssi = new AllocateAnNssi()
+        allocateAnNssi.nsstId = sliceTaskInfo.NSSTInfo.UUID
+        allocateAnNssi.nssiId = sliceTaskInfo.NSSTInfo.UUID
+        allocateAnNssi.nssiName = sliceTaskInfo.NSSTInfo.name
+        allocateAnNssi.sliceProfile = sliceTaskInfo.sliceProfile
+        allocateAnNssi.nsiInfo.nsiId = sliceParams.suggestNsiId
+
+        EsrInfo esrInfo = new EsrInfo()
+        //todo: vendor and network
+        esrInfo.setVendor(sliceTaskInfo.getVendor())
+        esrInfo.setNetworkType(sliceTaskInfo.getNetworkType())
+
+        String globalSubscriberId = execution.getVariable("globalSubscriberId")
+        String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
+
+        //todo: service info
+        ServiceInfo serviceInfo = new ServiceInfo()
+        serviceInfo.globalSubscriberId = globalSubscriberId
+        serviceInfo.subscriptionServiceType = subscriptionServiceType
+        serviceInfo.nsiId = sliceParams.suggestNsiId
+        serviceInfo.serviceInvariantUuid = sliceTaskInfo.NSSTInfo.invariantUUID
+        serviceInfo.serviceUuid = sliceTaskInfo.NSSTInfo.UUID
+
+        nbiRequest.setServiceInfo(serviceInfo)
+        nbiRequest.setEsrInfo(esrInfo)
+        nbiRequest.setAllocateAnNssi(allocateAnNssi)
+
+        execution.setVariable("AnAllocateNssiNbiRequest", nbiRequest)
+        execution.setVariable("anBHSliceTaskInfo", sliceTaskInfo)
     }
 
 
-    void getOneNSSIInfo(DelegateExecution execution){
-        logger.trace("Enter getOneNSSIInfo in DoAllocateNSIandNSSI()")
-
-        //ServiceDecomposition serviceDecompositionObj = execution.getVariable("serviceDecompositionObj")
-        Map<String, Object> nssiMap=execution.getVariable("nssiMap")
-        List<String> nsstSequence = execution.getVariable("nsstSequence")
-        String currentNSST= nsstSequence.get(execution.getVariable("currentNssiIndex"))
-        boolean isNSSIOptionAvailable = false
-        String nsstInput=nssiMap.get(currentNSST)
-        execution.setVariable("nsstInput",nsstInput)
-        String modelUuid = jsonUtil.getJsonValue(nsstInput, "modelUuid")
-        String nssiInstanceId = jsonUtil.getJsonValue(nsstInput, "serviceInstanceId")
-        String nssiserviceModelInfo = """{
-            "modelInvariantUuid":"",
-            "modelUuid":"${modelUuid}",
-            "modelVersion":""
-             }"""
-        Integer currentIndex = execution.getVariable("currentNssiIndex")
-        currentIndex=currentIndex+1;
-        execution.setVariable("currentNssiIndex",currentIndex)
-        execution.setVariable("nssiserviceModelInfo",nssiserviceModelInfo)
-        execution.setVariable("nssiInstanceId",nssiInstanceId)
-        logger.trace("Exit getOneNSSIInfo in DoAllocateNSIandNSSI()")
+    /**
+     * create RAN Slice Profile Instance
+     * @param execution
+     */
+    void createCnSliceProfileInstance(DelegateExecution execution) {
+
+        String globalSubscriberId = execution.getVariable("globalSubscriberId")
+        String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
+        String serviceInstanceId = UUID.randomUUID().toString()
+        execution.setVariable("cnSliceProfileInstanceId", serviceInstanceId) //todo:
+
+        String serviceType = ""
+        String serviceRole = "slice-profile"
+        String oStatus = "deactivated"
+
+        SliceTaskParamsAdapter sliceParams =
+                execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter
+        SliceTaskInfo<CnSliceProfile> sliceTaskInfo = sliceParams.cnSliceTaskInfo
+        sliceTaskInfo.setSliceInstanceId(serviceInstanceId)
+
+        // create slice profile
+        ServiceInstance rspi = new ServiceInstance()
+        rspi.setServiceInstanceName(sliceTaskInfo.NSSTInfo.name)
+        rspi.setServiceType(serviceType)
+        rspi.setServiceRole(serviceRole)
+        rspi.setOrchestrationStatus(oStatus)
+        rspi.setModelInvariantId(sliceTaskInfo.NSSTInfo.invariantUUID)
+        rspi.setModelVersionId(sliceTaskInfo.NSSTInfo.UUID)
+        rspi.setInputParameters(uuiRequest)
+        rspi.setWorkloadContext(useInterval)
+        rspi.setEnvironmentContext(sNSSAI_id)
+
+        //timestamp format YYYY-MM-DD hh:mm:ss
+        rspi.setCreatedAt(new Date(System.currentTimeMillis()).format("yyyy-MM-dd HH:mm:ss", TimeZone.getDefault()))
+
+        execution.setVariable("communicationServiceInstance", rspi)
+
+        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(serviceInstanceId))
+        client.create(uri, rspi)
+        execution.setVariable("sliceTaskParams", sliceParams)
     }
 
-    void updateCurrentIndex(DelegateExecution execution){
+    /**
+     * create An Slice Profile
+     * @param execution
+     */
+    void createCnSliceProfile(DelegateExecution execution) {
 
-        logger.trace("Enter updateCurrentIndex in DoAllocateNSIandNSSI()")
-        Integer currentIndex = execution.getVariable("currentNssiIndex")
-        Integer maxIndex = execution.getVariable("maxIndex")
-        if(currentIndex>=maxIndex)
-        {
-            Boolean isMoreNSSI=false
-            execution.setVariable("isMoreNSSI",isMoreNSSI)
-        }
-        logger.trace("Exit updateCurrentIndex in DoAllocateNSIandNSSI()")
+        String globalSubscriberId = execution.getVariable("globalSubscriberId")
+        String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
+        //String serviceInstanceId = execution.getVariable("ranSliceProfileInstanceId")
+
+        SliceTaskParamsAdapter sliceParams =
+                execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter
+
+        SliceTaskInfo<CnSliceProfile> sliceTaskInfo = sliceParams.cnSliceTaskInfo
+        CnSliceProfile cnSliceProfile = sliceTaskInfo.sliceProfile
+
+        String profileId = UUID.randomUUID().toString()
+        cnSliceProfile.setSliceProfileId(profileId)
+
+        SliceProfile sliceProfile = new SliceProfile()
+        sliceProfile.setProfileId(profileId)
+        sliceProfile.setCoverageAreaTAList(cnSliceProfile.coverageAreaTAList as String)
+        //todo:...
+        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(sliceTaskInfo.sliceInstanceId).sliceProfile(profileId))
+        client.create(uri, sliceProfile)
+        execution.setVariable("sliceTaskParams", sliceParams)
+    }
+
+    /**
+     * prepare AllocateCnNssi
+     * @param execution
+     */
+    void prepareAllocateCnNssi(DelegateExecution execution) {
+
+        //todo:
+        SliceTaskParamsAdapter sliceParams =
+                execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter
+        SliceTaskInfo<CnSliceProfile> sliceTaskInfo = sliceParams.cnSliceTaskInfo
+
+        NssmfAdapterNBIRequest nbiRequest = new NssmfAdapterNBIRequest()
+
+        AllocateCnNssi allocateCnNssi = new AllocateCnNssi()
+        allocateCnNssi.nsstId = sliceTaskInfo.NSSTInfo.UUID
+        allocateCnNssi.nssiId = sliceTaskInfo.NSSTInfo.UUID
+        allocateCnNssi.nssiName = sliceTaskInfo.NSSTInfo.name
+        allocateCnNssi.sliceProfile = sliceTaskInfo.sliceProfile
+        allocateCnNssi.nsiInfo.nsiId = sliceParams.suggestNsiId
+
+        EsrInfo esrInfo = new EsrInfo()
+        //todo: vendor and network
+        esrInfo.setVendor(sliceTaskInfo.getVendor())
+        esrInfo.setNetworkType(sliceTaskInfo.getNetworkType())
+
+        String globalSubscriberId = execution.getVariable("globalSubscriberId")
+        String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
+
+        //todo: service info
+        ServiceInfo serviceInfo = new ServiceInfo()
+        serviceInfo.globalSubscriberId = globalSubscriberId
+        serviceInfo.subscriptionServiceType = subscriptionServiceType
+        serviceInfo.nsiId = sliceParams.suggestNsiId
+        serviceInfo.serviceInvariantUuid = sliceTaskInfo.NSSTInfo.invariantUUID
+        serviceInfo.serviceUuid = sliceTaskInfo.NSSTInfo.UUID
+
+        nbiRequest.setServiceInfo(serviceInfo)
+        nbiRequest.setEsrInfo(esrInfo)
+        nbiRequest.setAllocateCnNssi(allocateCnNssi)
+
+        execution.setVariable("CnAllocateNssiNbiRequest", nbiRequest)
+        execution.setVariable("cnSliceTaskInfo", sliceTaskInfo)
+    }
+
+
+    /**
+     * create TN Slice Profile Instance
+     * @param execution
+     */
+    void createTnBHSliceProfileInstance(DelegateExecution execution) {
+        String globalSubscriberId = execution.getVariable("globalSubscriberId")
+        String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
+
+        String serviceType = ""
+        String serviceRole = "slice-profile"
+        String oStatus = "deactivated"
+
+        SliceTaskParamsAdapter sliceParams =
+                execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter
+
+        SliceTaskInfo<TnSliceProfile> sliceTaskInfo = sliceParams.tnBHSliceTaskInfo
+        String serviceInstanceId = UUID.randomUUID().toString()
+
+        sliceTaskInfo.setSliceInstanceId(serviceInstanceId)
+        //execution.setVariable("cnSliceProfileInstanceId", serviceInstanceId) //todo:
+
+        // create slice profile
+        ServiceInstance rspi = new ServiceInstance()
+        rspi.setServiceInstanceName(sliceTaskInfo.NSSTInfo.name)
+        rspi.setServiceType(serviceType)
+        rspi.setServiceRole(serviceRole)
+        rspi.setOrchestrationStatus(oStatus)
+        rspi.setModelInvariantId(sliceTaskInfo.NSSTInfo.invariantUUID)
+        rspi.setModelVersionId(sliceTaskInfo.NSSTInfo.UUID)
+        rspi.setInputParameters(uuiRequest)
+        rspi.setWorkloadContext(useInterval)
+        rspi.setEnvironmentContext(sNSSAI_id)
+
+        //timestamp format YYYY-MM-DD hh:mm:ss
+        rspi.setCreatedAt(new Date(System.currentTimeMillis()).format("yyyy-MM-dd HH:mm:ss", TimeZone.getDefault()))
+
+        execution.setVariable("communicationServiceInstance", rspi)
+
+        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(serviceInstanceId))
+        client.create(uri, rspi)
+
+        execution.setVariable("sliceTaskParams", sliceParams)
     }
-}
\ No newline at end of file
+
+    /**
+     * create An Slice Profile
+     * @param execution
+     */
+    void createTnBHSliceProfile(DelegateExecution execution) {
+
+        String globalSubscriberId = execution.getVariable("globalSubscriberId")
+        String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
+
+        SliceTaskParamsAdapter sliceParams =
+                execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter
+
+        SliceTaskInfo<TnSliceProfile> sliceTaskInfo = sliceParams.tnBHSliceTaskInfo
+
+        TnSliceProfile tnSliceProfile = sliceTaskInfo.sliceProfile
+        String profileId = UUID.randomUUID().toString()
+        tnSliceProfile.setSliceProfileId(profileId)
+
+        SliceProfile sliceProfile = new SliceProfile()
+        sliceProfile.setProfileId(profileId)
+        //todo:...
+        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(sliceTaskInfo.sliceInstanceId).sliceProfile(profileId))
+        client.create(uri, sliceProfile)
+
+        execution.setVariable("sliceTaskParams", sliceParams)
+    }
+
+    /**
+     * prepare AllocateCnNssi
+     * @param execution
+     */
+    void prepareAllocateTnBHNssi(DelegateExecution execution) {
+
+        //todo:
+        SliceTaskParamsAdapter sliceParams =
+                execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter
+        SliceTaskInfo<TnSliceProfile> sliceTaskInfo = sliceParams.tnBHSliceTaskInfo
+
+        NssmfAdapterNBIRequest nbiRequest = new NssmfAdapterNBIRequest()
+
+        AllocateTnNssi allocateTnNssi = new AllocateTnNssi()
+        //todo: AllocateTnNssi
+        allocateTnNssi.setTransportSliceNetworks()
+        allocateTnNssi.setNetworkSliceInfos()
+
+
+        //allocateTnNssi.networkSliceInfos
+
+        EsrInfo esrInfo = new EsrInfo()
+        esrInfo.setVendor(sliceTaskInfo.getVendor())
+        esrInfo.setNetworkType(sliceTaskInfo.getNetworkType())
+
+        String globalSubscriberId = execution.getVariable("globalSubscriberId")
+        String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
+
+        ServiceInfo serviceInfo = new ServiceInfo()
+        serviceInfo.globalSubscriberId = globalSubscriberId
+        serviceInfo.subscriptionServiceType = subscriptionServiceType
+        serviceInfo.nsiId = sliceParams.suggestNsiId
+        serviceInfo.serviceInvariantUuid = sliceTaskInfo.NSSTInfo.invariantUUID
+        serviceInfo.serviceUuid = sliceTaskInfo.NSSTInfo.UUID
+
+        nbiRequest.setServiceInfo(serviceInfo)
+        nbiRequest.setEsrInfo(esrInfo)
+        nbiRequest.setAllocateTnNssi(allocateTnNssi)
+
+        execution.setVariable("TnBHAllocateNssiNbiRequest", nbiRequest)
+        execution.setVariable("tnBHSliceTaskInfo", sliceTaskInfo)
+    }
+
+    /**
+     * Update relationship between
+     * 1. NSI and NSSI
+     * 2. Slice Profile and Service Profile
+     * 3. SliceProfile and NSSI
+     * 4. sliceProfile and endpoint
+     *
+     * @param execution
+     */
+    public void updateAnRelationship(DelegateExecution execution) {
+        //todo:
+        SliceTaskParamsAdapter sliceParams =
+                execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter
+
+        ResponseDescriptor result = execution.getVariable("anNssiAllocateResult") as ResponseDescriptor
+        String nssiId = result.getNssiId()
+        String endPointId = result.getEndPointId()
+        String nsiId = sliceParams.getSuggestNsiId()
+        String sliceProfileInstanceId = sliceParams.anSliceTaskInfo.sliceInstanceId
+        String serviceProfileInstanceId = sliceParams.serviceId
+        //nsi id
+
+        updateRelationship(execution, nsiId, nssiId)
+
+        updateRelationship(execution, serviceProfileInstanceId, sliceProfileInstanceId)
+
+        updateRelationship(execution, sliceProfileInstanceId, nssiId)
+
+        updateRelationship(execution, sliceProfileInstanceId, endPointId)
+
+    }
+
+
+    /**
+     * Update relationship between
+     * 1. NSI and NSSI
+     * 2. Slice Profile and Service Profile
+     * 3. SliceProfile and NSSI
+     *
+     * @param execution
+     */
+    public void updateCnRelationship(DelegateExecution execution) {
+        //todo:
+        SliceTaskParamsAdapter sliceParams =
+                execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter
+
+        NssiResponse result = execution.getVariable("cnNssiAllocateResult") as NssiResponse
+        String nssiId = result.getNssiId()
+        String nsiId = sliceParams.getSuggestNsiId()
+        String sliceProfileInstanceId = sliceParams.cnSliceTaskInfo.sliceInstanceId
+        String serviceProfileInstanceId = sliceParams.serviceId
+        //nsi id
+
+        updateRelationship(execution, nsiId, nssiId)
+
+        updateRelationship(execution, serviceProfileInstanceId, sliceProfileInstanceId)
+
+        updateRelationship(execution,sliceProfileInstanceId, nssiId)
+
+
+    }
+
+    /**
+     * Update relationship between
+     * 1. NSI and NSSI
+     * 2. Slice Profile and Service Profile
+     * 3. SliceProfile and NSSI
+     *
+     * @param execution
+     */
+    public void updateTnBHRelationship(DelegateExecution execution) {
+        SliceTaskParamsAdapter sliceParams =
+                execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter
+
+        NssiResponse result = execution.getVariable("tnBHNssiAllocateResult") as NssiResponse
+        String nssiId = result.getNssiId()
+        String nsiId = sliceParams.getSuggestNsiId()
+        String sliceProfileInstanceId = sliceParams.tnBHSliceTaskInfo.sliceInstanceId
+        String serviceProfileInstanceId = sliceParams.serviceId
+        //nsi id
+
+        updateRelationship(execution, nsiId, nssiId)
+
+        updateRelationship(execution, serviceProfileInstanceId, sliceProfileInstanceId)
+
+        updateRelationship(execution,sliceProfileInstanceId, nssiId)
+    }
+
+    /**
+     * sourceId -> targetId
+     * @param execution
+     * @param sourceId
+     * @param targetId
+     */
+    void updateRelationship(DelegateExecution execution, String sourceId, String targetId) {
+        //relation ship
+        Relationship relationship = new Relationship()
+
+        AAIResourceUri nsiServiceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(targetId))
+
+        logger.info("Creating Allotted resource relationship, nsiServiceUri: " + nsiServiceUri)
+
+        relationship.setRelatedLink(nsiServiceUri.build().toString())
+
+        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(sourceId).relationshipAPI())
+        client.create(uri, relationship)
+    }
+
+}
index 88edd79..35f7257 100644 (file)
@@ -1,29 +1,16 @@
 package org.onap.so.bpmn.infrastructure.scripts
 
-import org.camunda.bpm.engine.delegate.BpmnError
+import com.fasterxml.jackson.databind.ObjectMapper
 import org.camunda.bpm.engine.delegate.DelegateExecution
-import org.onap.aai.domain.yang.ServiceInstance
-import org.onap.aai.domain.yang.SliceProfile
-import org.onap.so.beans.nsmf.AllocateAnNssi
-import org.onap.so.beans.nsmf.AllocateCnNssi
-import org.onap.so.beans.nsmf.AllocateTnNssi
-import org.onap.so.beans.nsmf.AnSliceProfile
-import org.onap.so.beans.nsmf.CnSliceProfile
 import org.onap.so.beans.nsmf.EsrInfo
-import org.onap.so.beans.nsmf.JobStatusRequest
-import org.onap.so.beans.nsmf.NetworkType
-import org.onap.so.beans.nsmf.NsiInfo
-import org.onap.so.beans.nsmf.NssiAllocateRequest
-import org.onap.so.beans.nsmf.PerfReq
-import org.onap.so.beans.nsmf.PerfReqEmbb
-import org.onap.so.beans.nsmf.PerfReqUrllc
-import org.onap.so.beans.nsmf.ResourceSharingLevel
-import org.onap.so.beans.nsmf.SliceTaskParams
-import org.onap.so.beans.nsmf.TnSliceProfile
-import org.onap.so.beans.nsmf.UeMobilityLevel
+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.ServiceInfo
+import org.onap.so.beans.nsmf.SliceTaskInfo
+import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
 import org.onap.so.bpmn.common.scripts.ExceptionUtil
 import org.onap.so.bpmn.common.scripts.NssmfAdapterUtils
-import org.onap.so.bpmn.core.RollbackData
 import org.onap.so.bpmn.core.domain.ModelInfo
 import org.onap.so.bpmn.core.domain.ServiceDecomposition
 import org.onap.so.bpmn.core.json.JsonUtils
@@ -32,682 +19,103 @@ import org.onap.aaiclient.client.aai.AAIResourcesClient
 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
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types
 import org.slf4j.Logger
 import org.slf4j.LoggerFactory
-import com.fasterxml.jackson.databind.ObjectMapper;
+import org.springframework.http.ResponseEntity
 
 import static org.apache.commons.lang3.StringUtils.isBlank
 
+class DoAllocateNSSI extends AbstractServiceTaskProcessor {
 
-class DoAllocateNSSI extends org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor{
-
-    private static final Logger logger = LoggerFactory.getLogger( DoAllocateNSSI.class);
-    private static final ObjectMapper MAPPER = new ObjectMapper();
+    private static final Logger logger = LoggerFactory.getLogger(DoAllocateNSSI.class);
 
     ExceptionUtil exceptionUtil = new ExceptionUtil()
 
     JsonUtils jsonUtil = new JsonUtils()
 
-    private NssmfAdapterUtils nssmfAdapterUtils = new NssmfAdapterUtils(httpClientFactory, jsonUtil)
-
-    /**
-     * Pre Process the BPMN Flow Request
-     * Inclouds:
-     * generate the nsOperationKey
-     * generate the nsParameters
-     */
-    void preProcessRequest (DelegateExecution execution) {
-        logger.trace("Enter preProcessRequest()")
-        String msg = ""
-        String nssmfOperation = ""
-        String msoRequestId = execution.getVariable("msoRequestId")
-        String nsstInput = execution.getVariable("nsstInput")
-        String modelUuid = jsonUtil.getJsonValue(nsstInput, "modelUuid")
-        //modelUuid="2763777c-27bd-4df7-93b8-c690e23f4d3f"
-        String nssiInstanceId = jsonUtil.getJsonValue(nsstInput, "serviceInstanceId")
-        String serviceModelInfo = """{
-            "modelInvariantUuid":"",
-            "modelUuid":"${modelUuid}",
-            "modelVersion":""
-             }"""
-        execution.setVariable("serviceModelInfo",serviceModelInfo)
-        execution.setVariable("nssiInstanceId",nssiInstanceId)
-        String nssiProfileID = UUID.randomUUID().toString()
-        execution.setVariable("nssiProfileID",nssiProfileID)
-        if(isBlank(nssiInstanceId))
-        {
-            nssmfOperation="create"
-            nssiInstanceId = UUID.randomUUID().toString()
-        }else {
-            nssmfOperation = "update"
-        }
-        execution.setVariable("nssmfOperation",nssmfOperation)
-        execution.setVariable("nssiInstanceId",nssiInstanceId)
-
-        def isDebugLogEnabled ="false"
-        def isNSSICreated = false
-        execution.setVariable("isNSSICreated",isNSSICreated)
-
-        int currentCycle = 0
-        execution.setVariable("currentCycle", currentCycle)
-
-        logger.trace("Exit preProcessRequest")
-    }
-
-
-    void getNSSTInfo(DelegateExecution execution){
-        logger.trace("Enter getNSSTInfo in DoAllocateNSSI()")
-        ServiceDecomposition serviceDecomposition= execution.getVariable("serviceDecomposition")
-        ModelInfo modelInfo = serviceDecomposition.getModelInfo()
-        String serviceRole = "nssi"
-        String nssiServiceInvariantUuid = serviceDecomposition.modelInfo.getModelInvariantUuid()
-        String nssiServiceUuid = serviceDecomposition.modelInfo.getModelUuid()
-        String nssiServiceType = serviceDecomposition.getServiceType()
-        String uuiRequest = execution.getVariable("uuiRequest")
-        String nssiServiceName = "nssi_"+jsonUtil.getJsonValue(uuiRequest, "service.name")
-        execution.setVariable("nssiServiceName",nssiServiceName)
-        execution.setVariable("nssiServiceType",nssiServiceType)
-        execution.setVariable("nssiServiceInvariantUuid",nssiServiceInvariantUuid)
-        execution.setVariable("nssiServiceUuid",nssiServiceUuid)
-        execution.setVariable("serviceRole",serviceRole)
-
-        String content = serviceDecomposition.getServiceInfo().getServiceArtifact().get(0).getContent()
-        String nsstID = jsonUtil.getJsonValue(content, "metadata.id")
-        String nsstVendor = jsonUtil.getJsonValue(content, "metadata.vendor")
-        String nsstDomain = jsonUtil.getJsonValue(content, "metadata.domainType")
-        String nsstType = jsonUtil.getJsonValue(content, "metadata.type")
+    ObjectMapper objectMapper = new ObjectMapper()
 
-        execution.setVariable("nsstID",nsstID)
-        execution.setVariable("nsstVendor",nsstVendor)
-        execution.setVariable("nsstDomain",nsstDomain)
-        execution.setVariable("nssiServiceUuid",nssiServiceUuid)
-        execution.setVariable("nsstType",nsstType)
-
-        String nsstContentInfo = """{
-        "NsstID":"${nsstID}",
-        "Vendor":"${nsstVendor}",
-        "type":"${nsstType}"
-         }"""
-
-        logger.trace("Exit getNSSTInfo in DoAllocateNSSI()")
-    }
-
-    void timeDelay(DelegateExecution execution) {
-        logger.trace("Enter timeDelay in DoAllocateNSSI()")
-        try {
-            Thread.sleep(60000);
-            int currentCycle = execution.getVariable("currentCycle")
-            currentCycle=currentCycle+1
-            if(currentCycle>60)
-            {
-                logger.trace("Completed all the retry times... but still nssmf havent completed the creation process...")
-                exceptionUtil.buildAndThrowWorkflowException(execution, 500, "NSSMF creation didnt complete by time...")
-            }
-            execution.setVariable("currentCycle",currentCycle)
-        } catch(InterruptedException e) {
-            logger.info("Time Delay exception" + e)
-        }
-        logger.trace("Exit timeDelay in DoAllocateNSSI()")
-    }
+    private NssmfAdapterUtils nssmfAdapterUtils = new NssmfAdapterUtils(httpClientFactory, jsonUtil)
 
+    private static final NSSMF_ALLOCATE_URL = "/api/rest/provMns/v1/NSS/SliceProfiles"
 
-    void sendUpdateRequestNSSMF(DelegateExecution execution) {
-        logger.debug("Enter sendUpdateRequestNSSMF in DoAllocateNSSI()")
-        String domain = execution.getVariable("nsstDomain")
-        String nssmfRequest = buildUpdateNSSMFRequest(execution, domain.toUpperCase())
+    private static final NSSMF_QUERY_JOB_STATUS_URL = "/NSS/jobs/%s"
 
-        String urlString = "/api/rest/provMns/v1/NSS/SliceProfiles"
+    @Override
+    void preProcessRequest(DelegateExecution execution) {
+        logger.trace("Enter preProcessRequest()")
 
-        String nssmfResponse = nssmfAdapterUtils.sendPostRequestNSSMF(execution, urlString, nssmfRequest)
+        NssmfAdapterNBIRequest nbiRequest = execution.getVariable("nbiRequest") as NssmfAdapterNBIRequest
 
-        if (nssmfResponse != null) {
-            execution.setVariable("nssmfResponse", nssmfResponse)
-            String nssiId = jsonUtil.getJsonValue(nssmfResponse, "nssiId")
-            String jobId = jsonUtil.getJsonValue(nssmfResponse, "jobId")
-            execution.setVariable("nssiId",nssiId)
-            execution.setVariable("jobId",jobId)
+        //SliceTaskInfo sliceTaskInfo = execution.getVariable("sliceTaskInfo") as SliceTaskInfo
+        boolean isNSIOptionAvailable = execution.getVariable("isNSIOptionAvailable") as Boolean
 
+        if (isNSIOptionAvailable) {
+            nbiRequest.serviceInfo.setActionType("modify")
         } else {
-            logger.error("received error message from NSSMF : "+ nssmfResponse)
-            exceptionUtil.buildAndThrowWorkflowException(execution, 7000,"Received a Bad Sync Response from NSSMF.")
+            nbiRequest.serviceInfo.setActionType("allocate")
         }
-        logger.trace("Exit sendUpdateRequestNSSMF in DoAllocateNSSI()")
+        execution.setVariable("nbiRequest", nbiRequest)
+        logger.trace("Exit preProcessRequest")
     }
 
+    /**
+     * send Create Request NSSMF
+     * @param execution
+     */
     void sendCreateRequestNSSMF(DelegateExecution execution) {
-        logger.debug("Enter sendCreateRequestNSSMF in DoAllocateNSSI()")
-        //Prepare auth for NSSMF - Begin
-        String domain = execution.getVariable("nsstDomain")
-        String nssmfRequest = buildCreateNSSMFRequest(execution, domain.toUpperCase())
-
-        String urlString = "/api/rest/provMns/v1/NSS/SliceProfiles"
-
-        String nssmfResponse = nssmfAdapterUtils.sendPostRequestNSSMF(execution, urlString, nssmfRequest)
-
-        if (nssmfResponse != null) {
-            execution.setVariable("nssmfResponse", nssmfResponse)
-            String nssiId = jsonUtil.getJsonValue(nssmfResponse, "nssiId")
-            String jobId = jsonUtil.getJsonValue(nssmfResponse, "jobId")
-            execution.setVariable("nssiId",nssiId)
-            execution.setVariable("jobId",jobId)
-
-        } else {
-            logger.error("received error message from NSSMF : "+ nssmfResponse)
-            exceptionUtil.buildAndThrowWorkflowException(execution, 7000,"Received a Bad Sync Response from NSSMF.")
-        }
-
-        logger.debug("Exit sendCreateRequestNSSMF in DoAllocateNSSI()")
+        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:
+        execution.setVariable("serviceInfo", nbiRequest.getServiceInfo())
+        execution.setVariable("esrInfo", nbiRequest.getEsrInfo())
     }
 
-    void getNSSMFProgresss(DelegateExecution execution) {
-        logger.debug("Enter getNSSMFProgresss in DoAllocateNSSI()")
-
-        String nssmfRequest = buildNSSMFProgressRequest(execution)
-        String strUrl="/api/rest/provMns/v1/NSS/jobs/" + execution.getVariable("jobId")
-
-        String nssmfResponse = nssmfAdapterUtils.sendPostRequestNSSMF(execution, strUrl, nssmfRequest)
-
-        if(nssmfResponse != null){
-            Boolean isNSSICreated = false
-            execution.setVariable("nssmfResponse", nssmfResponse)
-            Integer progress = Integer.parseInt(jsonUtil.getJsonValue(nssmfResponse, "responseDescriptor.progress"))
-            String status = jsonUtil.getJsonValue(nssmfResponse, "responseDescriptor.status")
-            String statusDescription = jsonUtil.getJsonValue(nssmfResponse, "responseDescriptor.statusDescription")
-            execution.setVariable("nssmfProgress",progress)
-            execution.setVariable("nssmfStatus",status)
-            execution.setVariable("nddmfStatusDescription",statusDescription)
-            if(progress > 99)
-                isNSSICreated = true
-            execution.setVariable("isNSSICreated",isNSSICreated)
-        } else {
-            logger.error("received error message from NSSMF : "+ nssmfResponse)
-            exceptionUtil.buildAndThrowWorkflowException(execution, 7000,"Received a Bad Sync Response from NSSMF.")
-        }
-        logger.debug("Exit getNSSMFProgresss in DoAllocateNSSI()")
-    }
-
-    void updateRelationship(DelegateExecution execution) {
-        logger.debug("Enter updateRelationship in DoAllocateNSSI()")
-        String nssiInstanceId = execution.getVariable("nssiInstanceId")
-        String nsiInstanceId = execution.getVariable("nsiServiceInstanceId")
-        try{
-            AAIResourceUri nsiServiceuri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, nsiInstanceId);
-            AAIResourceUri nssiServiceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, nssiInstanceId)
-            getAAIClient().connect(nsiServiceuri, nssiServiceUri, AAIEdgeLabel.COMPOSED_OF);
-        }catch(Exception ex) {
-            String msg = "Exception in DoAllocateNSSI InstantiateNSSI service while creating relationship " + ex.getMessage()
-            logger.info(msg)
-            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
-        }
-        logger.debug("Exit updateRelationship in DoAllocateNSSI()")
-    }
-
-
-    void instantiateNSSIService(DelegateExecution execution) {
-        logger.trace("Enter instantiateNSSIService in DoAllocateNSSI()")
-        //String nssiInstanceId = execution.getVariable("nssiInstanceId")
-        String nssiInstanceId = execution.getVariable("nssiId")
-        execution.setVariable("nssiInstanceId",nssiInstanceId)
-        String sliceInstanceId = execution.getVariable("nsiServiceInstanceId")
-        try {
-            org.onap.aai.domain.yang.ServiceInstance nssi = new ServiceInstance();
-            Map<String, Object> serviceProfileMap = execution.getVariable("serviceProfile")
-
-            nssi.setServiceInstanceId(nssiInstanceId)
-            nssi.setServiceInstanceName(execution.getVariable("nssiServiceName"))
-            //nssi.setServiceType(execution.getVariable("nssiServiceType"))
-            nssi.setServiceType(serviceProfileMap.get("sST").toString())
-            String serviceStatus = "deactivated"
-            nssi.setOrchestrationStatus(serviceStatus)
-            String modelInvariantUuid = execution.getVariable("nssiServiceInvariantUuid")
-            String modelUuid = execution.getVariable("nssiServiceUuid")
-            nssi.setModelInvariantId(modelInvariantUuid)
-            nssi.setModelVersionId(modelUuid)
-            String uuiRequest = execution.getVariable("uuiRequest")
-            String serviceInstanceLocationid = jsonUtil.getJsonValue(uuiRequest, "service.parameters.requestInputs.plmnIdList")
-            nssi.setServiceInstanceLocationId(serviceInstanceLocationid)
-            //String snssai = jsonUtil.getJsonValue(uuiRequest, "service.parameters.requestInputs.sNSSAI")
-            String envContext=execution.getVariable("nsstDomain")
-            nssi.setEnvironmentContext(envContext)
-            nssi.setServiceRole(execution.getVariable("serviceRole"))
-            AAIResourcesClient client = new AAIResourcesClient()
-            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, execution.getVariable("globalSubscriberId"), execution.getVariable("subscriptionServiceType"), nssiInstanceId)
-            client.create(uri, nssi)
-        } catch (BpmnError e) {
-            throw e
-        } catch (Exception ex) {
-            String msg = "Exception in DoCreateSliceServiceInstance.instantiateSliceService. " + ex.getMessage()
-            logger.info(msg)
-            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
-        }
-        try{
-            AAIResourceUri nsiServiceuri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, sliceInstanceId);
-            AAIResourceUri nssiServiceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, nssiInstanceId)
-            getAAIClient().connect(nsiServiceuri, nssiServiceUri, AAIEdgeLabel.COMPOSED_OF);
-        }catch(Exception ex) {
-            String msg = "Exception in DoAllocateNSSI InstantiateNSSI service while creating relationship " + ex.getMessage()
-            logger.info(msg)
-            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
-        }
-
-
-
-        def rollbackData = execution.getVariable("RollbackData")
-        if (rollbackData == null) {
-            rollbackData = new RollbackData();
-        }
-        //rollbackData.put("SERVICEINSTANCE", "disableRollback", idisableRollback.toStrng())
-        rollbackData.put("SERVICEINSTANCE", "rollbackAAI", "true")
-        rollbackData.put("SERVICEINSTANCE", "serviceInstanceId", nssiInstanceId)
-        rollbackData.put("SERVICEINSTANCE", "subscriptionServiceType", execution.getVariable("subscriptionServiceType"))
-        rollbackData.put("SERVICEINSTANCE", "globalSubscriberId", execution.getVariable("globalSubscriberId"))
-        execution.setVariable("rollbackData", rollbackData)
-        execution.setVariable("RollbackData", rollbackData)
-        logger.debug("RollbackData:" + rollbackData)
-        logger.trace("Exit instantiateNSSIService in DoAllocateNSSI()")
-    }
-
-
-    void createSliceProfile(DelegateExecution execution) {
-        logger.trace("Enter createSliceProfile in DoAllocateNSSI()")
-        String sliceserviceInstanceId = execution.getVariable("nssiInstanceId")
-        String nssiProfileID = execution.getVariable("nssiProfileID")
-        Map<String, Object> sliceProfileMap = execution.getVariable("sliceProfileCn")
-        Map<String, Object> serviceProfileMap = execution.getVariable("serviceProfile")
-        SliceProfile sliceProfile = new SliceProfile()
-        sliceProfile.setServiceAreaDimension("")
-        sliceProfile.setPayloadSize(0)
-        sliceProfile.setJitter(0)
-        sliceProfile.setSurvivalTime(0)
-        //sliceProfile.setCsAvailability()
-        //sliceProfile.setReliability()
-        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.setProfileId(nssiProfileID)
-        sliceProfile.setE2ELatency(0)
-
-        try {
-            AAIResourcesClient client = new AAIResourcesClient()
-            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SLICE_PROFILE,
-                    execution.getVariable("globalSubscriberId"), execution.getVariable("subscriptionServiceType"), sliceserviceInstanceId, nssiProfileID)
-            client.create(uri, sliceProfile)
-        } catch (BpmnError e) {
-            throw e
-        } catch (Exception ex) {
-            String msg = "Exception in DoCreateSliceServiceInstance.instantiateSliceService. " + ex.getMessage()
-            logger.info(msg)
-            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
-        }
-
-        def rollbackData = execution.getVariable("RollbackData")
-        if (rollbackData == null) {
-            rollbackData = new RollbackData();
-        }
-        //rollbackData.put("SERVICEINSTANCE", "disableRollback", disableRollback.toString())
-        rollbackData.put("SERVICEINSTANCE", "rollbackAAI", "true")
-        rollbackData.put("SERVICEINSTANCE", "serviceInstanceId", sliceserviceInstanceId)
-        rollbackData.put("SERVICEINSTANCE", "subscriptionServiceType", execution.getVariable("serviceType"))
-        rollbackData.put("SERVICEINSTANCE", "globalSubscriberId", execution.getVariable("globalSubscriberId"))
-        execution.setVariable("rollbackData", rollbackData)
-        execution.setVariable("RollbackData", rollbackData)
-        logger.debug("RollbackData:" + rollbackData)
-        logger.trace("Exit createSliceProfile in DoAllocateNSSI()")
-    }
-
-
-    String buildCreateNSSMFRequest(DelegateExecution execution, String domain) {
-
-        NssiAllocateRequest request = new NssiAllocateRequest()
-        String strRequest = ""
-        //String uuiRequest = execution.getVariable("uuiRequest")
-        SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams")
-
-        switch (domain) {
-            case "AN":
-                EsrInfo esrInfo = new EsrInfo()
-                esrInfo.setNetworkType(execution.getVariable("networkType"))
-                esrInfo.setVendor(execution.getVariable("nsstVendor"))
-
-                NsiInfo nsiInfo = new NsiInfo()
-                nsiInfo.setNsiId(execution.getVariable("nsiInstanceID"))
-                nsiInfo.setNsiName(execution.getVariable("nsiInstanceName"))
-
-                AnSliceProfile anSliceProfile = new AnSliceProfile()
-                anSliceProfile.setLatency(execution.getVariable("latency"))
-                anSliceProfile.setCoverageAreaTAList(execution.getVariable("coverageAreaList"))
-                anSliceProfile.setQi(execution.getVariable("qi"))
-
-                AllocateAnNssi allocateAnNssi = new AllocateAnNssi()
-                allocateAnNssi.setNsstId(execution.getVariable("nsstId"))
-                allocateAnNssi.setNssiName(execution.getVariable("nssiName"))
-                allocateAnNssi.setNsiInfo(nsiInfo)
-                allocateAnNssi.setSliceProfile(anSliceProfile)
-                String anScriptName = sliceTaskParams.getAnScriptName()
-                allocateAnNssi.setScriptName(anScriptName)
-
-                request.setAllocateAnNssi(allocateAnNssi)
-                request.setEsrInfo(esrInfo)
-                break;
-            case "CN":
-                Map<String, Object> sliceProfileCn =execution.getVariable("sliceProfileCn")
-                Map<String, Object> serviceProfile = execution.getVariable("serviceProfile")
-                NsiInfo nsiInfo = new NsiInfo()
-                nsiInfo.setNsiId(execution.getVariable("nsiServiceInstanceId"))
-                nsiInfo.setNsiName(execution.getVariable("nsiServiceInstanceName"))
-
-                EsrInfo esrInfo = new EsrInfo()
-                esrInfo.setNetworkType(NetworkType.fromString(domain))
-                esrInfo.setVendor(execution.getVariable("nsstVendor"))
-                execution.setVariable("esrInfo",esrInfo)
-
-
-                PerfReqEmbb perfReqEmbb = new PerfReqEmbb()
-                perfReqEmbb.setActivityFactor(sliceProfileCn.get("activityFactor"))
-                perfReqEmbb.setAreaTrafficCapDL(sliceProfileCn.get("areaTrafficCapDL"))
-                perfReqEmbb.setAreaTrafficCapUL(sliceProfileCn.get("areaTrafficCapUL"))
-                perfReqEmbb.setExpDataRateDL(sliceProfileCn.get("expDataRateDL"))
-                perfReqEmbb.setExpDataRateUL(sliceProfileCn.get("expDataRateUL"))
-
-                List<PerfReqEmbb> listPerfReqEmbbList = new ArrayList<>()
-                listPerfReqEmbbList.add(perfReqEmbb)
-
-                PerfReq perfReq = new PerfReq()
-                perfReq.setPerfReqEmbbList(listPerfReqEmbbList)
-
-                PerfReqUrllc perfReqUrllc = new PerfReqUrllc()
-                perfReqUrllc.setConnDensity(0)
-                perfReqUrllc.setTrafficDensity(0)
-                perfReqUrllc.setExpDataRate(0)
-                perfReqUrllc.setReliability(0)
-                perfReqUrllc.setCsAvailability(0)
-                perfReqUrllc.setSurvivalTime(0)
-                perfReqUrllc.setJitter(0)
-                perfReqUrllc.setE2eLatency(0)
-                perfReqUrllc.setPayloadSize("0")
-                perfReqUrllc.setServiceAreaDimension("")
-
-                List<PerfReqUrllc> perfReqUrllcList = new ArrayList<>()
-                perfReqUrllcList.add(perfReqUrllc)
-                perfReq.setPerfReqUrllcList(perfReqUrllcList)
-
-                CnSliceProfile cnSliceProfile = new CnSliceProfile()
-                cnSliceProfile.setSliceProfileId(execution.getVariable("nssiProfileID"))
-                String plmnStr = serviceProfile.get("plmnIdList")
-                List<String> plmnIdList=Arrays.asList(plmnStr.split("\\|"))
-                cnSliceProfile.setPlmnIdList(plmnIdList)
-
-                String resourceSharingLevel = serviceProfile.get("resourceSharingLevel").toString()
-                cnSliceProfile.setResourceSharingLevel(ResourceSharingLevel.fromString(resourceSharingLevel))
-
-                String coverageArea = serviceProfile.get("coverageAreaTAList")
-                List<String> coverageAreaList=Arrays.asList(coverageArea.split("\\|"))
-                cnSliceProfile.setCoverageAreaTAList(coverageAreaList)
-
-                String ueMobilityLevel = serviceProfile.get("uEMobilityLevel").toString()
-                cnSliceProfile.setUeMobilityLevel(UeMobilityLevel.fromString(ueMobilityLevel))
-
-                int latency = serviceProfile.get("latency")
-                cnSliceProfile.setLatency(latency)
-
-                int maxUE = serviceProfile.get("maxNumberofUEs")
-                cnSliceProfile.setMaxNumberofUEs(maxUE)
-
-                String snssai = serviceProfile.get("sNSSAI")
-                List<String> snssaiList = Arrays.asList(snssai.split("\\|"))
-                cnSliceProfile.setSnssaiList(snssaiList)
-
-                cnSliceProfile.setPerfReq(perfReq)
-
-                AllocateCnNssi allocateCnNssi = new AllocateCnNssi()
-                allocateCnNssi.setNsstId(execution.getVariable("nsstid"))
-                allocateCnNssi.setNssiName(execution.getVariable("nssiName"))
-                allocateCnNssi.setSliceProfile(cnSliceProfile)
-                allocateCnNssi.setNsiInfo(nsiInfo)
-                String cnScriptName = sliceTaskParams.getCnScriptName()
-                allocateCnNssi.setScriptName(cnScriptName)
-                request.setAllocateCnNssi(allocateCnNssi)
-                request.setEsrInfo(esrInfo)
-                break;
-            case "TN":
-                EsrInfo esrInfo = new EsrInfo()
-                esrInfo.setNetworkType(execution.getVariable("networkType"))
-                esrInfo.setVendor(execution.getVariable("vendor"))
-
-                TnSliceProfile tnSliceProfile = new TnSliceProfile()
-                tnSliceProfile.setLatency(execution.getVariable("latency"))
-                tnSliceProfile.setBandwidth(execution.getVariable("bandWidth"))
-
-                NsiInfo nsiInfo = new NsiInfo()
-                nsiInfo.setNsiId(execution.getVariable("nsiInstanceID"))
-                nsiInfo.setNsiName(execution.getVariable("nsiInstanceName"))
-
-                AllocateTnNssi allocateTnNssi = new AllocateTnNssi()
-                allocateTnNssi.setSliceProfile(tnSliceProfile)
-                allocateTnNssi.setNsiInfo(nsiInfo)
-                allocateTnNssi.setNsstId(execution.getVariable("nsstid"))
-                String tnScriptName = sliceTaskParams.getTnScriptName()
-                allocateTnNssi.setScriptName(tnScriptName)
-
-                request.setAllocateTnNssi(allocateTnNssi)
-                request.setEsrInfo(esrInfo)
-                break;
-            default:
-                break;
-        }
-        try {
-            strRequest = MAPPER.writeValueAsString(request);
-        } catch (IOException e) {
-            logger.error("Invalid get progress request bean to convert as string");
-            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Invalid get progress request bean to convert as string")
-        }
-        return strRequest
-    }
-
-
-    String buildUpdateNSSMFRequest(DelegateExecution execution, String domain) {
-        NssiAllocateRequest request = new NssiAllocateRequest()
-        String nsstInput = execution.getVariable("nsstInput")
-        String nssiId = jsonUtil.getJsonValue(nsstInput, "serviceInstanceId")
-        String strRequest = ""
-        SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams")
-        switch (domain) {
-            case "AN":
-                EsrInfo esrInfo = new EsrInfo()
-                esrInfo.setNetworkType(execution.getVariable("nsstType"))
-                esrInfo.setVendor(execution.getVariable("vendor"))
-
-                NsiInfo nsiInfo = new NsiInfo()
-                nsiInfo.setNsiId(execution.getVariable("nsiInstanceID"))
-                nsiInfo.setNsiName(execution.getVariable("nsiInstanceName"))
-
-                AnSliceProfile anSliceProfile = new AnSliceProfile()
-                anSliceProfile.setLatency(execution.getVariable("latency"))
-                anSliceProfile.setCoverageAreaTAList(execution.getVariable("coverageAreaList"))
-                anSliceProfile.setQi(execution.getVariable("qi"))
-
-                AllocateAnNssi allocateAnNssi = new AllocateAnNssi()
-                allocateAnNssi.setNsstId(execution.getVariable("nsstId"))
-                allocateAnNssi.setNssiName(execution.getVariable("nssiName"))
-                allocateAnNssi.setNsiInfo(nsiInfo)
-                allocateAnNssi.setSliceProfile(anSliceProfile)
-                String anScriptName = sliceTaskParams.getAnScriptName()
-                allocateAnNssi.setScriptName(anScriptName)
-                request.setAllocateAnNssi(allocateAnNssi)
-                request.setEsrInfo(esrInfo)
-                break;
-            case "CN":
-                Map<String, Object> sliceProfileCn =execution.getVariable("sliceProfileCn")
-                Map<String, Object> serviceProfile = execution.getVariable("serviceProfile")
-                NsiInfo nsiInfo = new NsiInfo()
-                nsiInfo.setNsiId(execution.getVariable("nsiServiceInstanceId"))
-                nsiInfo.setNsiName(execution.getVariable("nsiServiceInstanceName"))
-
-                EsrInfo esrInfo = new EsrInfo()
-                esrInfo.setNetworkType(NetworkType.fromString(domain))
-                esrInfo.setVendor(execution.getVariable("nsstVendor"))
-                execution.setVariable("esrInfo",esrInfo)
-
-
-                PerfReqEmbb perfReqEmbb = new PerfReqEmbb()
-                perfReqEmbb.setActivityFactor(sliceProfileCn.get("activityFactor"))
-                perfReqEmbb.setAreaTrafficCapDL(sliceProfileCn.get("areaTrafficCapDL"))
-                perfReqEmbb.setAreaTrafficCapUL(sliceProfileCn.get("areaTrafficCapUL"))
-                perfReqEmbb.setExpDataRateDL(sliceProfileCn.get("expDataRateDL"))
-                perfReqEmbb.setExpDataRateUL(sliceProfileCn.get("expDataRateUL"))
-
-                List<PerfReqEmbb> listPerfReqEmbbList = new ArrayList<>()
-                listPerfReqEmbbList.add(perfReqEmbb)
-
-                PerfReq perfReq = new PerfReq()
-                perfReq.setPerfReqEmbbList(listPerfReqEmbbList)
-
-                PerfReqUrllc perfReqUrllc = new PerfReqUrllc()
-                perfReqUrllc.setConnDensity(0)
-                perfReqUrllc.setTrafficDensity(0)
-                perfReqUrllc.setExpDataRate(0)
-                perfReqUrllc.setReliability(0)
-                perfReqUrllc.setCsAvailability(0)
-                perfReqUrllc.setSurvivalTime(0)
-                perfReqUrllc.setJitter(0)
-                perfReqUrllc.setE2eLatency(0)
-                perfReqUrllc.setPayloadSize("0")
-                perfReqUrllc.setServiceAreaDimension("")
-
-                List<PerfReqUrllc> perfReqUrllcList = new ArrayList<>()
-                perfReqUrllcList.add(perfReqUrllc)
-                perfReq.setPerfReqUrllcList(perfReqUrllcList)
-
-                CnSliceProfile cnSliceProfile = new CnSliceProfile()
-                cnSliceProfile.setSliceProfileId(execution.getVariable("nssiProfileID"))
-                String plmnStr = serviceProfile.get("plmnIdList")
-                List<String> plmnIdList=Arrays.asList(plmnStr.split("\\|"))
-                cnSliceProfile.setPlmnIdList(plmnIdList)
-
-                String resourceSharingLevel = serviceProfile.get("resourceSharingLevel").toString()
-                cnSliceProfile.setResourceSharingLevel(ResourceSharingLevel.fromString(resourceSharingLevel))
-
-                String coverageArea = serviceProfile.get("coverageAreaTAList")
-                List<String> coverageAreaList=Arrays.asList(coverageArea.split("\\|"))
-                cnSliceProfile.setCoverageAreaTAList(coverageAreaList)
-
-                String ueMobilityLevel = serviceProfile.get("uEMobilityLevel").toString()
-                cnSliceProfile.setUeMobilityLevel(UeMobilityLevel.fromString(ueMobilityLevel))
-
-                int latency = serviceProfile.get("latency")
-                cnSliceProfile.setLatency(latency)
-
-                int maxUE = serviceProfile.get("maxNumberofUEs")
-                cnSliceProfile.setMaxNumberofUEs(maxUE)
+    /**
+     * query nssi allocate status
+     * @param execution
+     */
+    void queryNSSIStatus(DelegateExecution execution) {
+        NssmfAdapterNBIRequest nbiRequest = new NssmfAdapterNBIRequest()
+        NssiResponse nssiAllocateResult = execution.getVariable("nssiAllocateResult") as NssiResponse
+        String jobId = nssiAllocateResult.getJobId()
+        String nssiId = nssiAllocateResult.getNssiId()
 
-                String snssai = serviceProfile.get("sNSSAI")
-                List<String> snssaiList = Arrays.asList(snssai.split("\\|"))
-                cnSliceProfile.setSnssaiList(snssaiList)
+        ServiceInfo serviceInfo = execution.getVariable("serviceInfo") as ServiceInfo
+        serviceInfo.setNssiId(nssiId)
+        EsrInfo esrInfo = execution.getVariable("esrInfo") as EsrInfo
 
-                cnSliceProfile.setPerfReq(perfReq)
+        //nbiRequest.setResponseId(jobId)
+        nbiRequest.setServiceInfo(serviceInfo)
+        nbiRequest.setEsrInfo(esrInfo)
 
-                AllocateCnNssi allocateCnNssi = new AllocateCnNssi()
-                allocateCnNssi.setNsstId(execution.getVariable("nsstid"))
-                allocateCnNssi.setNssiName(execution.getVariable("nssiName"))
-                allocateCnNssi.setSliceProfile(cnSliceProfile)
-                allocateCnNssi.setNsiInfo(nsiInfo)
-                allocateCnNssi.setNssiId(nssiId)              // need to check this
-                String cnScriptName = sliceTaskParams.getCnScriptName()
-                allocateCnNssi.setScriptName(cnScriptName)
-                request.setAllocateCnNssi(allocateCnNssi)
-                request.setEsrInfo(esrInfo)
-                break;
-            case "TN":
-                EsrInfo esrInfo = new EsrInfo()
-                esrInfo.setNetworkType(execution.getVariable("networkType"))
-                esrInfo.setVendor(execution.getVariable("vendor"))
+        String endpoint = String.format(NSSMF_QUERY_JOB_STATUS_URL, jobId)
 
-                TnSliceProfile tnSliceProfile = new TnSliceProfile()
-                tnSliceProfile.setLatency(execution.getVariable("latency"))
-                tnSliceProfile.setBandwidth(execution.getVariable("bandWidth"))
+        String response =
+                nssmfAdapterUtils.sendPostRequestNSSMF(execution, endpoint, objectMapper.writeValueAsString(nbiRequest))
 
-                NsiInfo nsiInfo = new NsiInfo()
-                nsiInfo.setNsiId(execution.getVariable("nsiInstanceID"))
-                nsiInfo.setNsiName(execution.getVariable("nsiInstanceName"))
+        ResponseEntity responseEntity = objectMapper.readValue(response, ResponseEntity.class)
+        String result = responseEntity.getBody()
+        //todo;if success
+        ResponseDescriptor responseDescriptor = objectMapper.readValue(result, ResponseDescriptor.class)
 
-                AllocateTnNssi allocateTnNssi = new AllocateTnNssi()
-                allocateTnNssi.setSliceProfile(tnSliceProfile)
-                allocateTnNssi.setNsiInfo(nsiInfo)
-                allocateTnNssi.setNsstId(execution.getVariable("nsstid"))
-                String tnScriptName = sliceTaskParams.getTnScriptName()
-                allocateTnNssi.setScriptName(tnScriptName)
-                request.setAllocateTnNssi(allocateTnNssi)
-                request.setEsrInfo(esrInfo)
-                break;
-            default:
-                break;
-        }
-        try {
-            strRequest = MAPPER.writeValueAsString(request);
-        } catch (IOException e) {
-            logger.error("Invalid get progress request bean to convert as string");
-            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Invalid get progress request bean to convert as string")
-        }
-        return strRequest
+        //todo: handle status
+        execution.setVariable("nssiAllocateResult", responseDescriptor)
     }
 
-    String buildNSSMFProgressRequest(DelegateExecution execution){
-        JobStatusRequest request = new JobStatusRequest()
-        String strRequest = ""
-        EsrInfo esrInfo = execution.getVariable("esrInfo")
-        request.setNsiId(execution.getVariable("nsiServiceInstanceId"))
-        request.setNssiId(execution.getVariable("nssiId"))
-        request.setEsrInfo(esrInfo)
-
-        try {
-            strRequest = MAPPER.writeValueAsString(request);
-        } catch (IOException e) {
-            logger.error("Invalid get progress request bean to convert as string");
-            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Invalid get progress request bean to convert as string")
-        }
-        return strRequest
+    void prepareUpdateOrchestrationTask(DelegateExecution execution) {
+        //todo;update orchestration task
     }
 
-    public void prepareUpdateOrchestrationTask(DelegateExecution execution) {
-        logger.debug("Start prepareUpdateOrchestrationTask progress")
-        String requestMethod = "PUT"
-        String progress = execution.getVariable("nssmfProgress")
-        String status = execution.getVariable("nssmfStatus")
-        String statusDescription=execution.getVariable("nddmfStatusDescription")
-        SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams")
-        String domain = execution.getVariable("nsstDomain")
-        switch (domain.toUpperCase()) {
-            case "AN":
-                sliceTaskParams.setAnProgress(progress)
-                sliceTaskParams.setAnStatus(status)
-                sliceTaskParams.setAnStatusDescription(statusDescription)
-                break;
-            case "CN":
-                sliceTaskParams.setCnProgress(progress)
-                sliceTaskParams.setCnStatus(status)
-                sliceTaskParams.setCnStatusDescription(statusDescription)
-                break;
-            case "TN":
-                sliceTaskParams.setTnProgress(progress)
-                sliceTaskParams.setTnStatus(status)
-                sliceTaskParams.setTnStatusDescription(statusDescription)
-                break;
-            default:
-                break;
-        }
-        String paramJson = sliceTaskParams.convertToJson()
-        execution.setVariable("CSSOT_paramJson", paramJson)
-        execution.setVariable("CSSOT_requestMethod", requestMethod)
-        logger.debug("Finish prepareUpdateOrchestrationTask progress")
+    void timeDelay(DelegateExecution execution) {
+        //todo: time delay
     }
 
 }
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
new file mode 100644 (file)
index 0000000..e225c36
--- /dev/null
@@ -0,0 +1,1014 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020  Telecom Italia
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.scripts
+
+import 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.onap.aaiclient.client.aai.AAIResourcesClient
+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.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.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
+
+import javax.ws.rs.core.Response
+
+
+ class DoCommonCoreNSSI extends AbstractServiceTaskProcessor {
+
+    private final String PREFIX ="DoCommonCoreNSSI"
+
+    private static final Logger LOGGER = LoggerFactory.getLogger( DoCommonCoreNSSI.class)
+
+    private JsonUtils jsonUtil = new JsonUtils()
+    private ExceptionUtil exceptionUtil = new ExceptionUtil()
+    private RequestDBUtil requestDBUtil = new RequestDBUtil()
+
+    @Override
+    void preProcessRequest(DelegateExecution execution) {
+        LOGGER.trace("${getPrefix()} Start preProcessRequest")
+
+        def currentNSSI = execution.getVariable("currentNSSI")
+        if (!currentNSSI) {
+            String msg = "currentNSSI is null"
+            LOGGER.error(msg)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+        }
+
+        LOGGER.trace("***** ${getPrefix()} Exit preProcessRequest")
+    }
+
+
+    /**
+     * Queries Network Service Instance in AAI
+     * @param execution
+     */
+    void getNetworkServiceInstance(DelegateExecution execution) {
+        LOGGER.trace("${getPrefix()} Start getNetworkServiceInstance")
+
+        AAIResourcesClient client = getAAIClient()
+
+        def currentNSSI = execution.getVariable("currentNSSI")
+
+        String nssiId = currentNSSI['nssiId']
+
+        AAIResourceUri nssiUri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(nssiId))
+        Optional<ServiceInstance> nssiOpt = client.get(ServiceInstance.class, nssiUri)
+
+        if (nssiOpt.isPresent()) {
+            ServiceInstance nssi = nssiOpt.get()
+            currentNSSI['nssi'] = nssi
+
+            ServiceInstance networkServiceInstance = handleNetworkInstance(execution, nssiId, nssiUri, client)
+            currentNSSI['networkServiceInstance'] = networkServiceInstance
+        }
+        else {
+            String msg = String.format("NSSI %s not found in AAI", nssiId)
+            LOGGER.error(msg)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
+        }
+
+        LOGGER.trace("${getPrefix()} Exit getNetworkServiceInstance")
+    }
+
+
+    /**
+     * Handles Network Service
+     * @param nssiId
+     * @param nssiUri
+     * @param client
+     * @return Network Service Instance
+     */
+    private ServiceInstance handleNetworkInstance(DelegateExecution execution, String nssiId, AAIResourceUri nssiUri, AAIResourcesClient client ) {
+        ServiceInstance networkServiceInstance = null
+
+        def currentNSSI = execution.getVariable("currentNSSI")
+
+        AAIResultWrapper wrapper = client.get(nssiUri)
+        Optional<Relationships> relationships = wrapper.getRelationships()
+
+        if (relationships.isPresent()) {
+            for (AAIResourceUri networkServiceInstanceUri : relationships.get().getRelatedUris(Types.SERVICE_INSTANCE)) {
+                Optional<ServiceInstance> networkServiceInstanceOpt = client.get(ServiceInstance.class, networkServiceInstanceUri)
+                if (networkServiceInstanceOpt.isPresent()) {
+                    networkServiceInstance = networkServiceInstanceOpt.get()
+
+                    if (networkServiceInstance.getServiceRole() == "Network Service") { // Network Service role
+                        currentNSSI['networkServiceInstanceUri'] = networkServiceInstanceUri
+                        break
+                    }
+                }
+                else {
+                    String msg = String.format("No Network Service Instance found for NSSI %s in AAI", nssiId)
+                    LOGGER.error(msg)
+                    exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
+                }
+            }
+        }
+        else {
+            String msg = String.format("No relationship presented for NSSI %s in AAI", nssiId)
+            LOGGER.error(msg)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
+        }
+
+        if(networkServiceInstance == null) {
+            String msg = String.format("No Network Service Instance found for NSSI %s in AAI", nssiId)
+            LOGGER.error(msg)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
+        }
+
+        return networkServiceInstance
+    }
+
+
+    /**
+     * Queries constitute VNF from Network Service Instance
+     * @param execution
+     */
+    void getConstituteVNFFromNetworkServiceInst(DelegateExecution execution) {
+        LOGGER.trace("${getPrefix()} Start getConstituteVNFFromNetworkServiceInst")
+
+        def currentNSSI = execution.getVariable("currentNSSI")
+
+        AAIResourcesClient client = getAAIClient()
+
+        AAIResourceUri networkServiceInstanceUri = (AAIResourceUri)currentNSSI['networkServiceInstanceUri']
+        AAIResultWrapper wrapper = client.get(networkServiceInstanceUri);
+        Optional<Relationships> relationships = wrapper.getRelationships()
+        if (relationships.isPresent()) {
+            for (AAIResourceUri constituteVnfUri : relationships.get().getRelatedUris(Types.GENERIC_VNF)) {
+                currentNSSI['constituteVnfUri'] = constituteVnfUri
+                Optional<GenericVnf> constituteVnfOpt = client.get(GenericVnf.class, constituteVnfUri)
+                if(constituteVnfOpt.isPresent()) {
+                    GenericVnf constituteVnf = constituteVnfOpt.get()
+                    currentNSSI['constituteVnf'] = constituteVnf
+                }
+                else {
+                    String msg = String.format("No constitute VNF found for Network Service Instance %s in AAI", ((ServiceInstance)currentNSSI['networkServiceInstance']).getServiceInstanceId())
+                    LOGGER.error(msg)
+                    exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
+                }
+
+                break  // Should be only one constitute VNF
+            }
+        }
+        else {
+            String msg = String.format("No relationship presented for Network Service Instance %s in AAI", ((ServiceInstance)currentNSSI['networkServiceInstance']).getServiceInstanceId())
+            LOGGER.error(msg)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
+        }
+
+        LOGGER.trace("${getPrefix()} Exit getConstituteVNFFromNetworkServiceInst")
+
+    }
+
+
+    /**
+     * Retrieves NSSI associated profiles from AAI
+     * @param execution
+     */
+    void getNSSIAssociatedProfiles(DelegateExecution execution) {
+        LOGGER.trace("${getPrefix()} Start getNSSIAssociatedProfiles")
+
+        def currentNSSI = execution.getVariable("currentNSSI")
+
+        ServiceInstance nssi = (ServiceInstance)currentNSSI['nssi']
+
+        List<SliceProfile> associatedProfiles = nssi.getSliceProfiles().getSliceProfile()
+
+        if(associatedProfiles.isEmpty()) {
+            String msg = String.format("No associated profiles found for NSSI %s in AAI", nssi.getServiceInstanceId())
+            LOGGER.error(msg)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
+        }
+        else {
+            currentNSSI['associatedProfiles'] =  associatedProfiles
+        }
+
+        LOGGER.trace("${getPrefix()} Exit getNSSIAssociatedProfiles")
+    }
+
+
+    /**
+     * Calculates a final list of S-NSSAI
+     * @param execution
+     */
+    void calculateSNSSAI(DelegateExecution execution) {
+        LOGGER.trace("${getPrefix()} Start calculateSNSSAI")
+
+        def currentNSSI = execution.getVariable("currentNSSI")
+
+        List<SliceProfile> associatedProfiles = (List<SliceProfile>)currentNSSI['associatedProfiles']
+
+        String currentSNSSAI = currentNSSI['S-NSSAI']
+
+        List<String> snssais = new ArrayList<>()
+
+        String isCreateSliceProfileInstanceVar = execution.getVariable("isCreateSliceProfileInstance" )
+
+        boolean isCreateSliceProfileInstance = Boolean.parseBoolean(isCreateSliceProfileInstanceVar)
+
+        if(isCreateSliceProfileInstance) { // Slice Profile Instance has to be created
+            for (SliceProfile associatedProfile : associatedProfiles) {
+                snssais.add(associatedProfile.getSNssai())
+            }
+
+            snssais.add(currentSNSSAI)
+        }
+        else { // Slice profile instance has to be deleted
+            for (SliceProfile associatedProfile : associatedProfiles) {
+                if (!associatedProfile.getSNssai().equals(currentSNSSAI)) { // not current S-NSSAI
+                    snssais.add(associatedProfile.getSNssai())
+                } else {
+                    currentNSSI['sliceProfileS-NSSAI'] = associatedProfile
+                }
+            }
+        }
+
+        currentNSSI['S-NSSAIs'] = snssais
+
+        LOGGER.trace("${getPrefix()} Exit calculateSNSSAI")
+    }
+
+
+    /**
+     * Invoke PUT Service Instance API
+     * @param execution
+     */
+    void invokePUTServiceInstance(DelegateExecution execution) {
+        LOGGER.trace("${getPrefix()} Start invokePUTServiceInstance")
+
+        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) // ???
+
+            ServiceInstance networkServiceInstance = (ServiceInstance)currentNSSI['networkServiceInstance']
+
+            GenericVnf constituteVnf = (GenericVnf)currentNSSI['constituteVnf']
+
+            String url = String.format("${nsmfЕndpoint}/serviceInstantiation/v7/serviceInstances/%s/vnfs/%s", networkServiceInstance.getServiceInstanceId(), constituteVnf.getVnfId())
+
+            String msoKey = UrnPropertiesReader.getVariable("mso.msoKey", execution)
+            String basicAuth =  UrnPropertiesReader.getVariable("mso.infra.endpoint.auth", execution)
+
+            def authHeader = ""
+            String basicAuthValue = encryptBasicAuth(basicAuth, msoKey) //utils.encrypt(basicAuth, msoKey)
+            String responseAuthHeader = getAuthHeader(execution, basicAuthValue, msoKey) //utils.getBasicAuth(basicAuthValue, msoKey)
+
+            String errorCode = jsonUtil.getJsonValue(responseAuthHeader, "errorCode")
+            if(errorCode == null || errorCode.isEmpty()) { // No error
+                authHeader = responseAuthHeader
+            }
+            else {
+                exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(errorCode), jsonUtil.getJsonValue(responseAuthHeader, "errorMessage"))
+            }
+
+            def requestDetails = ""
+            String prepareRequestDetailsResponse = prepareRequestDetails(execution)
+            errorCode = jsonUtil.getJsonValue(prepareRequestDetailsResponse, "errorCode")
+            if(errorCode == null || errorCode.isEmpty()) { // No error
+                requestDetails = prepareRequestDetailsResponse
+            }
+            else {
+                exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(errorCode), jsonUtil.getJsonValue(prepareRequestDetailsResponse, "errorMessage"))
+            }
+
+            String callPUTServiceInstanceResponse = callPUTServiceInstance(url, authHeader, requestDetails)
+            String putServiceInstanceResponse = ""
+
+            if(errorCode == null || errorCode.isEmpty()) { // No error
+                putServiceInstanceResponse = callPUTServiceInstanceResponse // check the response ???
+            }
+            else {
+                LOGGER.error(jsonUtil.getJsonValue(callPUTServiceInstanceResponse, "errorMessage"))
+                exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(errorCode), jsonUtil.getJsonValue(callPUTServiceInstanceResponse, "errorMessage"))
+            }
+
+        } catch (any) {
+            String msg = "Exception in ${getPrefix()}.invokePUTServiceInstance. " + any.getCause()
+            LOGGER.error(msg)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+        }
+
+        LOGGER.trace("${getPrefix()} Exit invokePUTServiceInstance")
+    }
+
+
+    String callPUTServiceInstance(String url, String authHeader, String requestDetailsStr) {
+        String errorCode = ""
+        String errorMessage = ""
+        String response
+
+        try {
+            HttpClient httpClient = getHttpClientFactory().newJsonClient(new URL(url), ONAPComponents.EXTERNAL)
+            httpClient.addAdditionalHeader("Authorization", authHeader)
+            httpClient.addAdditionalHeader("Accept", "application/json")
+
+            Response httpResponse = httpClient.put(requestDetailsStr) // check http code ???
+
+
+            if (httpResponse.hasEntity()) {
+                response = httpResponse.readEntity(String.class)
+            }
+            else {
+                errorCode = 500
+                errorMessage = "No response received."
+
+                response =  "{\n" +
+                        " \"errorCode\": \"${errorCode}\",\n" +
+                        " \"errorMessage\": \"${errorMessage}\"\n" +
+                        "}"
+            }
+        }
+        catch (any) {
+            String msg = "Exception in ${getPrefix()}.invokePUTServiceInstance. " + any.getCause()
+            LOGGER.error(msg)
+
+            response =  "{\n" +
+                    " \"errorCode\": \"7000\",\n" +
+                    " \"errorMessage\": \"${msg}\"\n" +
+                    "}"
+
+        }
+
+        return response
+
+    }
+
+
+    /**
+     * Prepare model info
+     * @param execution
+     * @param requestDetails
+     * @return ModelInfo
+     */
+    ModelInfo prepareModelInfo(DelegateExecution execution) {
+
+        def currentNSSI = execution.getVariable("currentNSSI")
+        ServiceInstance networkServiceInstance = (ServiceInstance)currentNSSI['networkServiceInstance']
+
+        ModelInfo modelInfo = new ModelInfo()
+
+        modelInfo.setModelType(ModelType.service)
+        modelInfo.setModelInvariantId(networkServiceInstance.getModelInvariantId())
+
+        AAIResourcesClient client = getAAIClient()
+
+        AAIResourceUri modelVerUrl = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.serviceDesignAndCreation().model(networkServiceInstance.getModelInvariantId()).modelVer(networkServiceInstance.getModelVersionId()))
+        Optional<ModelVer> modelVerOpt = client.get(ModelVer.class, modelVerUrl)
+
+        if (modelVerOpt.isPresent()) {
+            modelInfo.setModelVersionId(modelVerOpt.get().getModelVersionId())
+            modelInfo.setModelName(modelVerOpt.get().getModelName())
+            modelInfo.setModelVersion(modelVerOpt.get().getModelVersion())
+        }
+
+        return modelInfo
+    }
+
+
+    /**
+     * Prepares subscriber info
+     * @param execution
+     * @return SubscriberInfo
+     */
+    SubscriberInfo prepareSubscriberInfo(DelegateExecution execution) {
+        def currentNSSI = execution.getVariable("currentNSSI")
+
+        String globalSubscriberId = currentNSSI['globalSubscriberId']
+
+        String subscriberName = currentNSSI['subscriberName']
+
+        SubscriberInfo subscriberInfo = new SubscriberInfo()
+        subscriberInfo.setGlobalSubscriberId(globalSubscriberId)
+        subscriberInfo.setSubscriberName(subscriberName)
+
+        /*
+        AAIResourcesClient client = getAAIClient()
+
+        Customer customer = null
+
+        AAIResourceUri networkServiceInstanceUri = currentNSSI['networkServiceInstanceUri']
+        AAIResultWrapper wrapper = client.get(networkServiceInstanceUri)
+        Optional<Relationships> serviceSubscriptionRelationshipsOps = wrapper.getRelationships()
+        if(serviceSubscriptionRelationshipsOps.isPresent()) {
+            List<AAIResourceUri> serviceSubscriptionRelatedAAIUris = serviceSubscriptionRelationshipsOps.get().getRelatedUris(Types.SERVICE_SUBSCRIPTION)
+            if(!(serviceSubscriptionRelatedAAIUris == null || serviceSubscriptionRelatedAAIUris.isEmpty())) {
+                AAIResourceUri serviceSubscriptionUri = serviceSubscriptionRelatedAAIUris.get(0) // Many-To-One relation
+                Optional<ServiceSubscription> serviceSubscriptionOpt = client.get(ServiceSubscription.class, serviceSubscriptionUri)
+
+                if(serviceSubscriptionOpt.isPresent()) {
+                    currentNSSI['serviceSubscription'] = serviceSubscriptionOpt.get()
+                }
+
+                wrapper = client.get(serviceSubscriptionUri)
+                Optional<Relationships> customerRelationshipsOps = wrapper.getRelationships()
+                if(customerRelationshipsOps.isPresent()) {
+                    List<AAIResourceUri> customerRelatedAAIUris = customerRelationshipsOps.get().getRelatedUris(Types.CUSTOMER)
+                    if(!(customerRelatedAAIUris == null || customerRelatedAAIUris.isEmpty())) {
+                        Optional<Customer> customerOpt = client.get(Customer.class, customerRelatedAAIUris.get(0)) // Many-To-One relation
+                        if(customerOpt.isPresent()) {
+                            customer = customerOpt.get()
+                            subscriberInfo.setSubscriberName(customer.getSubscriberName())
+                        }
+                    }
+                }
+            }
+
+        } */
+
+        return subscriberInfo
+    }
+
+
+    /**
+     * Prepares Request Info
+     * @param execution
+     * @return RequestInfo
+     */
+    RequestInfo prepareRequestInfo(DelegateExecution execution, ServiceInstance networkServiceInstance) {
+        def currentNSSI = execution.getVariable("currentNSSI")
+
+        String serviceId = currentNSSI['serviceId']
+
+        RequestInfo requestInfo = new RequestInfo()
+
+        requestInfo.setInstanceName(networkServiceInstance.getServiceInstanceName())
+        requestInfo.setSource("VID")
+        requestInfo.setProductFamilyId(serviceId)
+        requestInfo.setRequestorId("NBI")
+
+        return requestInfo
+    }
+
+
+    /**
+     * Prepares Model Info
+     * @param networkServiceInstance
+     * @param modelInfo
+     * @return ModelInfo
+     */
+    ModelInfo prepareServiceModelInfo(ServiceInstance networkServiceInstance, ModelInfo modelInfo) {
+
+        ModelInfo serviceModelInfo = new ModelInfo()
+        serviceModelInfo.setModelType(ModelType.service)
+        serviceModelInfo.setModelInvariantId(networkServiceInstance.getModelInvariantId())
+
+        serviceModelInfo.setModelVersionId(modelInfo.getModelVersionId())
+        serviceModelInfo.setModelName(modelInfo.getModelName())
+        serviceModelInfo.setModelVersion(modelInfo.getModelVersion())
+
+        return serviceModelInfo
+    }
+
+
+    /**
+     * Prepares Cloud configuration
+     * @param execution
+     * @return CloudConfiguration
+     */
+    CloudConfiguration prepareCloudConfiguration(DelegateExecution execution) {
+        def currentNSSI = execution.getVariable("currentNSSI")
+
+        CloudConfiguration cloudConfiguration = new CloudConfiguration()
+
+        AAIResourcesClient client = getAAIClient()
+
+        AAIResourceUri constituteVnfUri = currentNSSI['constituteVnfUri']
+        AAIResultWrapper wrapper = client.get(constituteVnfUri)
+        Optional<Relationships> cloudRegionRelationshipsOps = wrapper.getRelationships()
+
+        if(cloudRegionRelationshipsOps.isPresent()) {
+            List<AAIResourceUri> cloudRegionRelatedAAIUris = cloudRegionRelationshipsOps.get().getRelatedUris(Types.CLOUD_REGION)
+            if (!(cloudRegionRelatedAAIUris == null || cloudRegionRelatedAAIUris.isEmpty())) {
+                AAIResourceUri cloudRegionRelatedAAIUri = cloudRegionRelatedAAIUris.get(0)
+                currentNSSI['cloudRegionRelatedAAIUri'] = cloudRegionRelatedAAIUri
+
+                Optional<CloudRegion> cloudRegionrOpt = client.get(CloudRegion.class, cloudRegionRelatedAAIUris.get(0))
+                CloudRegion cloudRegion = null
+                if (cloudRegionrOpt.isPresent()) {
+                    cloudRegion = cloudRegionrOpt.get()
+                    cloudConfiguration.setLcpCloudRegionId(cloudRegion.getCloudRegionId())
+                    for (Tenant tenant : cloudRegion.getTenants().getTenant()) {
+                        cloudConfiguration.setTenantId(tenant.getTenantId())
+                        break // only one is required
+                    }
+
+                    cloudConfiguration.setCloudOwner(cloudRegion.getCloudOwner())
+                }
+            }
+        }
+
+        return cloudConfiguration
+    }
+
+
+    /**
+     * Prepares a list of VF Modules
+     * @param execution
+     * @param constituteVnf
+     * @return List<VfModules>
+     */
+    List<VfModules> prepareVfModules(DelegateExecution execution, GenericVnf constituteVnf) {
+
+        AAIResourcesClient client = getAAIClient()
+
+        List<VfModules> vfModuless = new ArrayList<>()
+        for (VfModule vfModule : constituteVnf.getVfModules().getVfModule()) {
+            VfModules vfmodules = new VfModules()
+
+            ModelInfo vfModuleModelInfo = new ModelInfo()
+            vfModuleModelInfo.setModelInvariantUuid(vfModule.getModelInvariantId())
+            vfModuleModelInfo.setModelCustomizationId(vfModule.getModelCustomizationId())
+
+            AAIResourceUri vfModuleUrl = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.serviceDesignAndCreation().model(vfModule.getModelInvariantId()).modelVer(vfModule.getModelVersionId()))
+
+            Optional<ModelVer> vfModuleModelVerOpt = client.get(ModelVer.class, vfModuleUrl)
+
+            if (vfModuleModelVerOpt.isPresent()) {
+                vfModuleModelInfo.setModelVersionId(vfModuleModelVerOpt.get().getModelVersionId())
+                vfModuleModelInfo.setModelName(vfModuleModelVerOpt.get().getModelName())
+                vfModuleModelInfo.setModelVersion(vfModuleModelVerOpt.get().getModelVersion())
+            }
+            vfmodules.setModelInfo(vfModuleModelInfo)
+
+            vfmodules.setInstanceName(vfModule.getVfModuleName())
+
+            vfModuless.add(vfmodules)
+        }
+
+        return vfModuless
+    }
+
+
+    /**
+     * prepares VNF Model Info
+     * @param execution
+     * @param constituteVnf
+     * @return ModelInfo
+     */
+    ModelInfo prepareVNFModelInfo(DelegateExecution execution, GenericVnf constituteVnf) {
+        ModelInfo vnfModelInfo = new ModelInfo()
+
+        AAIResourcesClient client = getAAIClient()
+
+        vnfModelInfo.setModelInvariantUuid(constituteVnf.getModelInvariantId())
+        vnfModelInfo.setModelCustomizationId(constituteVnf.getModelCustomizationId())
+        vnfModelInfo.setModelInstanceName(constituteVnf.getVnfName())
+
+        AAIResourceUri vnfModelUrl = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.serviceDesignAndCreation().model(constituteVnf.getModelInvariantId()).modelVer(constituteVnf.getModelVersionId()))
+
+        Optional<ModelVer> vnfModelVerOpt = client.get(ModelVer.class, vnfModelUrl)
+
+        if (vnfModelVerOpt.isPresent()) {
+            vnfModelInfo.setModelVersionId(vnfModelVerOpt.get().getModelVersionId())
+            vnfModelInfo.setModelName(vnfModelVerOpt.get().getModelName())
+            vnfModelInfo.setModelVersion(vnfModelVerOpt.get().getModelVersion())
+        }
+
+        return vnfModelInfo
+    }
+
+
+    List<Map<String, Object>> prepareInstanceParams(DelegateExecution execution) {
+        def currentNSSI = execution.getVariable("currentNSSI")
+
+        List<Map<String, Object>> instanceParams = new ArrayList<>()
+        Map<String, Object> instanceParamsMap = new HashMap<>()
+
+        // Supported S-NSSAI
+        List<String> snssais = (List<String>) currentNSSI['S-NSSAIs']
+
+        ServiceInstance nssi = (ServiceInstance) currentNSSI['nssi']
+
+        String orchStatus = nssi.getOrchestrationStatus()
+
+
+        List<Map<String, String>> snssaiList = new ArrayList<>()
+
+        for(String snssai:snssais) {
+            Map<String, String> snssaisMap = new HashMap<>()
+            snssaisMap.put("snssai", snssai)
+            snssaisMap.put("status", orchStatus)
+            snssaiList.add(snssaisMap)
+        }
+
+        //    Map<String, List<Map<String, String>>> supportedNssaiDetails = new HashMap<>()
+        //    supportedNssaiDetails.put("sNssai", supportedNssaiDetails)
+
+        ObjectMapper mapper = new ObjectMapper()
+
+        String supportedNssaiDetailsStr = mapper.writeValueAsString(snssaiList)
+
+
+        instanceParamsMap.put("k8s-rb-profile-name", "default") // ???
+        instanceParamsMap.put("config-type", "day2") // ???
+        instanceParamsMap.put("supportedNssai", supportedNssaiDetailsStr)
+        instanceParams.add(instanceParamsMap)
+
+        return instanceParams
+    }
+
+    /**
+     * Prepares Resources
+     * @param execution
+     * @return Resources
+     */
+    Resources prepareResources(DelegateExecution execution) {
+        def currentNSSI = execution.getVariable("currentNSSI")
+
+        Resources resources = new Resources()
+
+        // VNFs
+        List<Vnfs> vnfs = new ArrayList<>()
+        // VNF
+        Vnfs vnf = new Vnfs()
+
+        // Line of Business
+        LineOfBusiness lob = new LineOfBusiness()
+        lob.setLineOfBusinessName("VNF")
+        vnf.setLineOfBusiness(lob)
+
+        // Product family ID
+        GenericVnf constituteVnf = (GenericVnf)currentNSSI['constituteVnf']
+        vnf.setProductFamilyId(constituteVnf.getServiceId())
+
+        // Cloud configuration
+        vnf.setCloudConfiguration(prepareCloudConfiguration(execution))
+
+        // VF Modules
+        vnf.setVfModules(prepareVfModules(execution, constituteVnf))
+
+        // Model Info
+        vnf.setModelInfo(prepareVNFModelInfo(execution, constituteVnf))
+
+        // Instance name
+        vnf.setInstanceName(constituteVnf.getVnfName())
+
+        // Instance params
+        vnf.setInstanceParams(prepareInstanceParams(execution))
+
+        // No platform data
+
+        vnfs.add(vnf)
+        resources.setVnfs(vnfs)
+
+        return resources
+    }
+
+
+    /**
+     * Prepare Service
+     * @return Service
+     */
+    Service prepareService(DelegateExecution execution, ServiceInstance networkServiceInstance, ModelInfo modelInfo) {
+        Service service = new Service()
+
+        // Model Info
+        service.setModelInfo(prepareServiceModelInfo(networkServiceInstance, modelInfo))
+
+        service.setInstanceName(networkServiceInstance.getServiceInstanceName())
+
+        // Resources
+        service.setResources(prepareResources(execution))
+
+        return service
+
+    }
+
+
+    /**
+     * Prepares request parameters
+     * @param execution
+     * @return RequestParameters
+     */
+    RequestParameters prepareRequestParameters(DelegateExecution execution, ServiceInstance networkServiceInstance, ModelInfo modelInfo) {
+        def currentNSSI = execution.getVariable("currentNSSI")
+
+        RequestParameters requestParameters = new RequestParameters()
+
+        ServiceSubscription serviceSubscription = (ServiceSubscription)currentNSSI['serviceSubscription']
+
+        if(serviceSubscription != null) {
+            requestParameters.setSubscriptionServiceType(serviceSubscription.getServiceType())
+        }
+
+        // User params
+        List<Map<String, Object>> userParams = new ArrayList<>()
+
+        Map<String, Object> userParam = new HashMap<>()
+        userParam.put("Homing_Solution", "none")
+        userParams.add(userParam)
+
+        // Service
+        Map<String, Object> serviceMap = new HashMap<>()
+        serviceMap.put("service", prepareService(execution, networkServiceInstance, modelInfo))
+        userParams.add(serviceMap)
+        requestParameters.setUserParams(userParams)
+
+        return requestParameters
+    }
+
+
+    /**
+     * Prepare Owning Entity
+     * @param execution
+     * @return OwningEntity
+     */
+    OwningEntity prepareOwningEntity(DelegateExecution execution) {
+        def currentNSSI = execution.getVariable("currentNSSI")
+
+        AAIResourcesClient client = getAAIClient()
+
+        AAIResourceUri networkServiceInstanceUri = (AAIResourceUri)currentNSSI['networkServiceInstanceUri']
+
+        OwningEntity owningEntity = new 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
+                if (owningEntityOpt.isPresent()) {
+                    owningEntity.setOwningEntityId(owningEntityOpt.get().getOwningEntityId())
+                    owningEntity.setOwningEntityName(owningEntityOpt.get().getOwningEntityName())
+
+                }
+            }
+        }
+
+        return owningEntity
+    }
+
+
+    /**
+     * Prepares Project
+     * @param execution
+     * @return Project
+     */
+    Project prepareProject(DelegateExecution execution) {
+        def currentNSSI = execution.getVariable("currentNSSI")
+
+        AAIResourcesClient client = getAAIClient()
+
+        Project project = new Project()
+
+        AAIResourceUri cloudRegionRelatedAAIUri = (AAIResourceUri)currentNSSI['cloudRegionRelatedAAIUri']
+
+        if (cloudRegionRelatedAAIUri != null) {
+            AAIResultWrapper wrapper = client.get(cloudRegionRelatedAAIUri)
+            Optional<Relationships> cloudRegionOps = wrapper.getRelationships()
+            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))
+                    if (projectOpt.isPresent()) {
+                        project.setProjectName(projectOpt.get().getProjectName())
+                    }
+                }
+            }
+        }
+
+        return project
+    }
+
+
+    /**
+     * Prepares RequestDetails object
+     * @param execution
+     * @return
+     */
+    String prepareRequestDetails(DelegateExecution execution) {
+        String errorCode = ""
+        String errorMessage = ""
+        String response
+
+        RequestDetails requestDetails = new RequestDetails()
+
+        def currentNSSI = execution.getVariable("currentNSSI")
+
+        ServiceInstance networkServiceInstance = (ServiceInstance)currentNSSI['networkServiceInstance']
+
+        try {
+            // Model Info
+            ModelInfo modelInfo = prepareModelInfo(execution)
+            requestDetails.setModelInfo(modelInfo)
+
+            // Subscriber Info
+            requestDetails.setSubscriberInfo(prepareSubscriberInfo(execution))
+
+            // Request Info
+            requestDetails.setRequestInfo(prepareRequestInfo(execution, networkServiceInstance))
+
+            // Request Parameters
+            requestDetails.setRequestParameters(prepareRequestParameters(execution, networkServiceInstance, modelInfo))
+
+            // Cloud configuration
+            requestDetails.setCloudConfiguration(prepareCloudConfiguration(execution))
+
+            // Owning entity
+            requestDetails.setOwningEntity(prepareOwningEntity(execution))
+
+            // Project
+            requestDetails.setProject(prepareProject(execution))
+
+            ObjectMapper mapper = new ObjectMapper()
+
+            response = mapper.writeValueAsString(requestDetails)
+        }
+        catch (any) {
+            String msg = "Exception in ${getPrefix()}.prepareRequestDetails. " + any.getCause()
+            LOGGER.error(msg)
+
+            response =  "{\n" +
+                    " \"errorCode\": \"7000\",\n" +
+                    " \"errorMessage\": \"${msg}\"\n" +
+                    "}"
+
+        }
+
+        return response
+    }
+
+
+    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
+    }
+
+
+    String encryptBasicAuth(String basicAuth, String msoKey) {
+        return utils.encrypt(basicAuth, msoKey)
+    }
+
+
+    /**
+     * Removes Slice Profile association with NSSI
+     * @param execution
+     */
+    void removeSPAssociationWithNSSI(DelegateExecution execution) {
+        LOGGER.trace("${getPrefix()} Start removeSPAssociationWithNSSI")
+
+        AAIResourcesClient client = getAAIClient()
+
+        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()
+
+        String currentSNSSAI = currentNSSI['S-NSSAI']
+
+        associatedProfiles.removeIf({ associatedProfile -> (associatedProfile.getSNssai().equals(currentSNSSAI)) })
+
+        try {
+            getAAIClient().update(nssiUri, nssi)
+        }catch(Exception e){
+            exceptionUtil.buildAndThrowWorkflowException(execution, 25000, "Exception occured while Slice Profile association with NSSI update call: " + e.getMessage())
+        }
+
+        LOGGER.trace("${getPrefix()} Exit removeSPAssociationWithNSSI")
+    }
+
+
+    /**
+     * Deletes Slice Profile Instance
+     * @param execution
+     */
+    void deleteSliceProfileInstance(DelegateExecution execution) {
+        LOGGER.trace("${getPrefix()} Start deleteSliceProfileInstance")
+
+        AAIResourcesClient client = getAAIClient()
+
+        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()))
+
+        try {
+            getAAIClient().delete(sliceProfileUri)
+        }catch(Exception e){
+            exceptionUtil.buildAndThrowWorkflowException(execution, 25000, "Exception occured while Slice Profile Instance delete call: " + e.getMessage())
+        }
+
+        LOGGER.trace("${getPrefix()} Exit deleteSliceProfileInstance")
+    }
+
+
+    /**
+     * Updates operation status
+     * @param execution
+     */
+    void updateServiceOperationStatus(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)
+
+        requestDBUtil.prepareUpdateOperationStatus(execution, operationStatus)
+
+        LOGGER.trace("${getPrefix()} Exit updateServiceOperationStatus")
+    }
+
+
+    /**
+     * Returns AAI client
+     * @return AAI client
+     */
+    AAIResourcesClient getAAIClient() {
+        return new AAIResourcesClient()
+    }
+
+
+    String getPrefix() {
+        return PREFIX
+    }
+}
index 8cd9dee..47e059c 100644 (file)
@@ -42,6 +42,8 @@ import org.onap.aaiclient.client.aai.AAIResourcesClient
 import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
 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.slf4j.Logger
 import org.slf4j.LoggerFactory
 
@@ -142,7 +144,7 @@ public class DoCompareModelofE2EServiceInstance extends AbstractServiceTaskProce
                        String serviceType = execution.getVariable('serviceType')
 
                        AAIResourcesClient resourceClient = new AAIResourcesClient()
-                       AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId, serviceType, serviceInstanceId)
+                       AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(serviceType).serviceInstance(serviceInstanceId))
                        AAIResultWrapper wrapper = resourceClient.get(serviceInstanceUri, NotFoundException.class)
 
                        Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class)
index 26dcaa7..9f2ad5b 100644 (file)
@@ -31,6 +31,8 @@ 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.slf4j.Logger
 import org.slf4j.LoggerFactory
 
@@ -123,12 +125,7 @@ class DoCreateCommunicationService extends AbstractServiceTaskProcessor{
 
             execution.setVariable("communicationServiceInstanceProfile", csp)
 
-            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.COMMUNICATION_SERVICE_PROFILE,
-                    globalSubscriberId,
-                    subscriptionServiceType,
-                    serviceInstanceId,
-                    profileId
-            )
+            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(serviceInstanceId).communicationServiceProfile(profileId))
             client.create(uri, csp)
 
 
@@ -158,11 +155,11 @@ class DoCreateCommunicationService extends AbstractServiceTaskProcessor{
             String sNSSAI_id = generateNSSAI(serviceInstanceId)
 
             execution.setVariable("sNSSAI_id", sNSSAI_id)
-            // 创建service
+            // create communication service
             String serviceInstanceName = execution.getVariable("serviceInstanceName")
             String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
             String csServiceType = execution.getVariable("csServiceType")
-            String aaiServiceRole = "communication-service" //待确定
+            String aaiServiceRole = "communication-service"
 
             String oStatus = "processing"
             String uuiRequest = execution.getVariable("uuiRequest")
@@ -188,7 +185,7 @@ class DoCreateCommunicationService extends AbstractServiceTaskProcessor{
 
             execution.setVariable("communicationServiceInstance", csi)
 
-            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId, subscriptionServiceType, serviceInstanceId)
+            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(serviceInstanceId))
             client.create(uri, csi)
 
         } catch (BpmnError e) {
index b90a34e..d1e61ac 100644 (file)
  */
 package org.onap.so.bpmn.infrastructure.scripts
 
-import com.fasterxml.jackson.databind.ObjectMapper
-import com.fasterxml.jackson.databind.SerializationFeature
-
-import org.onap.so.logger.LoggingAnchor
-import org.onap.logging.filter.base.ErrorCode
-
 import static org.apache.commons.lang3.StringUtils.*
-
 import javax.ws.rs.NotFoundException
-
 import org.camunda.bpm.engine.delegate.BpmnError
 import org.camunda.bpm.engine.delegate.DelegateExecution
 import org.onap.aai.domain.yang.Relationship
 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.AAIResultWrapper
+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.logging.filter.base.ErrorCode
 import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
 import org.onap.so.bpmn.common.scripts.ExceptionUtil
 import org.onap.so.bpmn.common.scripts.MsoUtils
 import org.onap.so.bpmn.core.RollbackData
+import org.onap.so.bpmn.core.UrnPropertiesReader
 import org.onap.so.bpmn.core.WorkflowException
 import org.onap.so.bpmn.core.domain.Resource
 import org.onap.so.bpmn.core.domain.ServiceDecomposition
 import org.onap.so.bpmn.core.json.JsonUtils
-import org.onap.aaiclient.client.aai.AAIObjectType
-import org.onap.aaiclient.client.aai.AAIResourcesClient
-import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
-import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
 import org.onap.so.bpmn.infrastructure.workflow.service.ServicePluginFactory
-import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
+import org.onap.so.logger.LoggingAnchor
 import org.onap.so.logger.MessageEnum
 import org.slf4j.Logger
 import org.slf4j.LoggerFactory
-
 import org.springframework.web.util.UriUtils
-import org.onap.so.bpmn.core.UrnPropertiesReader
+import com.fasterxml.jackson.databind.ObjectMapper
+import com.fasterxml.jackson.databind.SerializationFeature
 
 /**
  * This groovy class supports the <class>DoCreateServiceInstance.bpmn</class> process.
@@ -272,7 +268,7 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
                        org.onap.aai.domain.yang.ServiceInstance si = execution.getVariable("serviceInstanceData")
 
                        AAIResourcesClient client = new AAIResourcesClient()
-                       AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, execution.getVariable("globalSubscriberId"), execution.getVariable("serviceType"), serviceInstanceId)
+                       AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("serviceType")).serviceInstance(serviceInstanceId))
                        client.create(uri, si)
 
                } catch (BpmnError e) {
@@ -345,7 +341,7 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
                try {
                        String serviceInstanceId = execution.getVariable("serviceInstanceId")
                        AAIResourcesClient client = new AAIResourcesClient()
-                       AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, execution.getVariable("globalSubscriberId"), execution.getVariable("serviceType"), serviceInstanceId).relationshipAPI()
+                       AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("serviceType")).serviceInstance(serviceInstanceId)).relationshipAPI()
                        client.create(uri, relationship)
 
                } catch (BpmnError e) {
@@ -402,7 +398,7 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
                        String serviceType = execution.getVariable('subscriptionServiceType')
 
                        AAIResourcesClient resourceClient = new AAIResourcesClient()
-                       AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId, serviceType, serviceInstanceId)
+                       AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(serviceType).serviceInstance(serviceInstanceId))
                        AAIResultWrapper wrapper = resourceClient.get(serviceInstanceUri, NotFoundException.class)
 
                        Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class)
index 3638d89..bb6697b 100644 (file)
@@ -40,6 +40,8 @@ import org.onap.so.logger.MessageEnum
 import org.onap.so.bpmn.common.scripts.ExceptionUtil;
 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.aaiclient.client.aai.AAIObjectType
 import org.onap.aaiclient.client.aai.AAIResourcesClient
 
@@ -190,7 +192,7 @@ public class DoCreateE2EServiceInstanceRollback extends AbstractServiceTaskProce
                        String serviceInstanceId = execution.getVariable("serviceInstanceId")
 
                        AAIResourcesClient resourceClient = new AAIResourcesClient();
-                       AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalCustId, serviceType, serviceInstanceId)
+                       AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalCustId).serviceSubscription(serviceType).serviceInstance(serviceInstanceId))
                        resourceClient.delete(serviceInstanceUri)
 
                        logger.trace("Completed Delete Service Instance")
index 22e5819..cc142ca 100644 (file)
@@ -33,7 +33,6 @@ import org.onap.aai.domain.yang.RouteTableReference
 import org.onap.aai.domain.yang.RouteTarget
 import org.onap.aai.domain.yang.Subnet
 import org.onap.aai.domain.yang.VpnBinding
-import org.onap.aaiclient.client.aai.AAIObjectPlurals
 import org.onap.aaiclient.client.aai.AAIObjectType
 import org.onap.aaiclient.client.aai.AAIResourcesClient
 import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
@@ -42,6 +41,7 @@ import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri
 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.aaiclient.client.graphinventory.entities.uri.Depth
 import org.onap.so.bpmn.common.scripts.AaiUtil
 import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
@@ -335,7 +335,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
             String serviceInstanceId = execution.getVariable('CRENWKI_serviceInstanceId')
 
             AAIResourcesClient resourceClient = new AAIResourcesClient()
-            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId)
+            AAIResourceUri uri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId))
 
             if(!resourceClient.exists(uri)){
                 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service instance was not found in aai")
@@ -367,7 +367,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
             String networkName   = utils.getNodeText(networkInputs, "network-name")
 
             AAIResourcesClient client = new AAIResourcesClient()
-            AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.L3_NETWORK).queryParam("network-name", networkName)
+            AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Networks()).queryParam("network-name", networkName)
             L3Networks networks = client.get(uri, NotFoundException.class).asBean(L3Networks.class).get()
             L3Network network = networks.getL3Network().get(0)
 
@@ -405,7 +405,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
             // Prepare AA&I url
             AaiUtil aaiUtil = new AaiUtil(this)
 
-            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, Defaults.CLOUD_OWNER.toString(), cloudRegion)
+            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(Defaults.CLOUD_OWNER.toString(), cloudRegion))
             def queryCloudRegionRequest = aaiUtil.createAaiUri(uri)
 
             execution.setVariable(Prefix + "queryCloudRegionRequest", queryCloudRegionRequest)
@@ -478,7 +478,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
             execution.setVariable(Prefix + "networkName", networkName)
 
             AAIResourcesClient client = new AAIResourcesClient()
-            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, networkId).depth(Depth.ONE)
+            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(networkId)).depth(Depth.ONE)
             L3Network network = client.get(uri, NotFoundException.class).asBean(L3Network.class).get()
 
             execution.setVariable(Prefix + "queryIdAAIResponse", network)
@@ -514,7 +514,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
             String netId = networkId
 
             AAIResourcesClient client = new AAIResourcesClient()
-            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, networkId).depth(Depth.ONE)
+            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(networkId)).depth(Depth.ONE)
             L3Network network = client.get(uri, NotFoundException.class).asBean(L3Network.class).get()
 
             execution.setVariable(Prefix + "aaiRequeryIdReturnCode", "200")
@@ -553,10 +553,10 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
         try {
 
             AAIResourcesClient client = new AAIResourcesClient()
-            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, execution.getVariable(Prefix + "networkId"))
+            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(execution.getVariable(Prefix + "networkId")))
             Optional<Relationships> relationships = client.get(uri, NotFoundException.class).getRelationships()
             if(relationships.isPresent()){
-                List<AAIResourceUri> uris = relationships.get().getRelatedAAIUris(AAIObjectType.VPN_BINDING)
+                List<AAIResourceUri> uris = relationships.get().getRelatedUris(Types.VPN_BINDING)
 
                 logger.debug(Prefix + "vpnCount - " + uris.size())
 
@@ -625,10 +625,10 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
 
         try {
             AAIResourcesClient client = new AAIResourcesClient()
-            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, execution.getVariable(Prefix + "networkId"))
+            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(execution.getVariable(Prefix + "networkId")))
             Optional<Relationships> relationships = client.get(uri, NotFoundException.class).getRelationships()
             if(relationships.isPresent()){
-                List<AAIResourceUri> uris = relationships.get().getRelatedAAIUris(AAIObjectType.NETWORK_POLICY)
+                List<AAIResourceUri> uris = relationships.get().getRelatedUris(Types.NETWORK_POLICY)
 
                 execution.setVariable(Prefix + "networkPolicyCount", uris.size())
                 logger.debug(Prefix + "networkPolicyCount - " + uris.size())
@@ -692,10 +692,10 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
         try {
 
             AAIResourcesClient client = new AAIResourcesClient()
-            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, execution.getVariable(Prefix + "networkId"))
+            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(execution.getVariable(Prefix + "networkId")))
             Optional<Relationships> relationships = client.get(uri, NotFoundException.class).getRelationships()
             if(relationships.isPresent()){
-                List<AAIResourceUri> uris = relationships.get().getRelatedAAIUris(AAIObjectType.ROUTE_TABLE_REFERENCE)
+                List<AAIResourceUri> uris = relationships.get().getRelatedUris(Types.ROUTE_TABLE_REFERENCE)
 
                 execution.setVariable(Prefix + "networkTableRefCount", uris.size())
                 logger.debug(Prefix + "networkTableRefCount - " + uris.size())
@@ -791,7 +791,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
             logger.debug("Updating l3-network in AAI" )
 
             AAIResourcesClient client = new AAIResourcesClient()
-            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, networkId)
+            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(networkId))
             client.update(uri, l3Network)
 
             if(requeryIdAAIResponse.getSubnets() != null){
@@ -807,7 +807,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
                     }
 
                     logger.debug("Updating subnet in AAI" )
-                    AAIResourceUri subUri = AAIUriFactory.createResourceUri(AAIObjectType.SUBNET, networkId, subnetId)
+                    AAIResourceUri subUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(networkId).subnet(subnetId))
                     client.update(subUri, subnet)
 
                 }
index fce12e5..94aca5f 100644 (file)
@@ -44,6 +44,8 @@ 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.slf4j.Logger
 import org.slf4j.LoggerFactory
 
@@ -291,7 +293,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
                        String globalCustomerId = execution.getVariable("globalSubscriberId") //VID to AAI name map
                        logger.debug(" ***** getAAICustomerById ***** globalCustomerId:" + globalCustomerId)
 
-                       AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.CUSTOMER, globalCustomerId)
+                       AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalCustomerId))
                        if(!getAAIClient().exists(uri)){
                                exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "GlobalCustomerId:" + globalCustomerId + " not found (404) in AAI")
                        }
@@ -352,7 +354,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
                        si.setWorkloadContext(workloadContext)
 
                        AAIResourcesClient client = new AAIResourcesClient()
-                       AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, execution.getVariable("globalSubscriberId"), execution.getVariable("subscriptionServiceType"), serviceInstanceId)
+                       AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(serviceInstanceId))
                        client.create(uri, si)
 
                } catch (BpmnError e) {
index b713794..f64f5e8 100644 (file)
@@ -1,32 +1,41 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ # Copyright (c) 2020, CMCC Technologies Co., Ltd.
+ #
+ # Licensed under the Apache License, Version 2.0 (the "License")
+ # you may not use this file except in compliance with the License.
+ # You may obtain a copy of the License at
+ #
+ #       http://www.apache.org/licenses/LICENSE-2.0
+ #
+ # Unless required by applicable law or agreed to in writing, software
+ # distributed under the License is distributed on an "AS IS" BASIS,
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ # See the License for the specific language governing permissions and
+ # limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
 package org.onap.so.bpmn.infrastructure.scripts
 
 
-import org.onap.aai.domain.yang.AllottedResource
-
-import static org.apache.commons.lang3.StringUtils.*;
-
 import org.camunda.bpm.engine.delegate.BpmnError
 import org.camunda.bpm.engine.delegate.DelegateExecution
-import org.onap.aai.domain.yang.OwningEntity
+import org.onap.aai.domain.yang.AllottedResource
+import org.onap.aai.domain.yang.ServiceInstance
 import org.onap.aai.domain.yang.ServiceProfile;
+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.so.beans.nsmf.SliceTaskParamsAdapter
 import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
-import org.onap.so.bpmn.common.scripts.CatalogDbUtils
-import org.onap.so.bpmn.common.scripts.CatalogDbUtilsFactory
 import org.onap.so.bpmn.common.scripts.ExceptionUtil
-import org.onap.so.bpmn.common.scripts.MsoUtils
-import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils
 import org.onap.so.bpmn.core.RollbackData
-import org.onap.so.bpmn.core.UrnPropertiesReader
-import org.onap.so.bpmn.core.WorkflowException
 import org.onap.so.bpmn.core.domain.ModelInfo
 import org.onap.so.bpmn.core.domain.ServiceDecomposition
-import org.onap.so.bpmn.core.domain.ServiceInstance
 import org.onap.so.bpmn.core.json.JsonUtils
-import org.onap.so.bpmn.infrastructure.aai.groovyflows.AAICreateResources
-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.slf4j.Logger
 import org.slf4j.LoggerFactory
 
@@ -34,13 +43,13 @@ import org.slf4j.LoggerFactory
 
 class DoCreateSliceServiceInstance extends AbstractServiceTaskProcessor{
 
-    private static final Logger logger = LoggerFactory.getLogger( DoCreateSliceServiceInstance.class);
+    private static final Logger logger = LoggerFactory.getLogger( DoCreateSliceServiceInstance.class)
+
     JsonUtils jsonUtil = new JsonUtils()
 
     ExceptionUtil exceptionUtil = new ExceptionUtil()
 
-    CatalogDbUtils catalogDbUtils = new CatalogDbUtilsFactory().create()
-
+    AAIResourcesClient client = getAAIClient()
     /**
      * Pre Process the BPMN Flow Request
      * Inclouds:
@@ -48,86 +57,54 @@ class DoCreateSliceServiceInstance extends AbstractServiceTaskProcessor{
      * generate the nsParameters
      */
     void preProcessRequest (DelegateExecution execution) {
-        String msg = ""
         logger.trace("Enter preProcessRequest()")
-        //Need update
-        //1. Prepare service parameter.
-        //2. Prepare slice profile parameters.
+        //here modelVersion is not set, we use modelUuid to decompose the service.
+        def isDebugLogEnabled = true
+        execution.setVariable("isDebugLogEnabled", isDebugLogEnabled)
+
+        logger.trace("Exit preProcessRequest")
+    }
 
-        String sliceserviceInstanceId = execution.getVariable("serviceInstanceId")
-        String allottedResourceId = UUID.randomUUID().toString()
-        execution.setVariable("sliceserviceInstanceId", sliceserviceInstanceId)
-        execution.setVariable("allottedResourceId", allottedResourceId)
+    /**
+     * prepare decompose service profile instance template
+     * @param execution
+     */
+    public void prepareDecomposeService(DelegateExecution execution) {
 
         String uuiRequest = execution.getVariable("uuiRequest")
         String modelInvariantUuid = jsonUtil.getJsonValue(uuiRequest, "service.serviceInvariantUuid")
         String modelUuid = jsonUtil.getJsonValue(uuiRequest, "service.serviceUuid")
-        //here modelVersion is not set, we use modelUuid to decompose the service.
-        def isDebugLogEnabled = true
-        execution.setVariable("serviceInstanceId",sliceserviceInstanceId)
-        execution.setVariable("isDebugLogEnabled",isDebugLogEnabled)
         String serviceModelInfo = """{
             "modelInvariantUuid":"${modelInvariantUuid}",
             "modelUuid":"${modelUuid}",
             "modelVersion":""
              }"""
         execution.setVariable("serviceModelInfo", serviceModelInfo)
-
-        logger.trace("Exit preProcessRequest")
     }
 
+    /**
+     * create service-profile instance in aai
+     * @param execution
+     */
+    void createServiceProfileInstance(DelegateExecution execution) {
 
-    void createServiceProfile(DelegateExecution execution) {
-
-        String sliceserviceInstanceId = execution.getVariable("sliceserviceInstanceId")
-        Map<String, Object> serviceProfileMap = execution.getVariable("serviceProfile")
-        String serviceProfileID = UUID.randomUUID().toString()
-        ServiceProfile serviceProfile = new ServiceProfile();
-        serviceProfile.setProfileId(serviceProfileID)
-        serviceProfile.setLatency(Integer.parseInt(serviceProfileMap.get("latency").toString()))
-        serviceProfile.setMaxNumberOfUEs(Integer.parseInt(serviceProfileMap.get("maxNumberofUEs").toString()))
-        serviceProfile.setCoverageAreaTAList(serviceProfileMap.get("coverageAreaTAList").toString())
-        serviceProfile.setUeMobilityLevel(serviceProfileMap.get("uEMobilityLevel").toString())
-        serviceProfile.setResourceSharingLevel(serviceProfileMap.get("resourceSharingLevel").toString())
-        serviceProfile.setExpDataRateUL(Integer.parseInt(serviceProfileMap.get("expDataRateUL").toString()))
-        serviceProfile.setExpDataRateDL(Integer.parseInt(serviceProfileMap.get("expDataRateDL").toString()))
-        serviceProfile.setAreaTrafficCapUL(Integer.parseInt(serviceProfileMap.get("areaTrafficCapUL").toString()))
-        serviceProfile.setAreaTrafficCapDL(Integer.parseInt(serviceProfileMap.get("areaTrafficCapDL").toString()))
-        serviceProfile.setActivityFactor(Integer.parseInt(serviceProfileMap.get("activityFactor").toString()))
-
-        serviceProfile.setJitter(0)
-        serviceProfile.setSurvivalTime(0)
-        serviceProfile.setCsAvailability(new Object())
-        serviceProfile.setReliability(new Object())
-        serviceProfile.setExpDataRate(0)
-        serviceProfile.setTrafficDensity(0)
-        serviceProfile.setConnDensity(0)
-        try {
-            AAIResourcesClient client = new AAIResourcesClient()
-            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_PROFILE, execution.getVariable("globalSubscriberId"),
-                    execution.getVariable("subscriptionServiceType"), sliceserviceInstanceId, serviceProfileID)
-            client.create(uri, serviceProfile)
-
-        } catch (BpmnError e) {
-            throw e
-        } catch (Exception ex) {
-            String msg = "Exception in DoCreateSliceServiceInstance.instantiateSliceService. " + ex.getMessage()
-            logger.info(msg)
-            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
-        }
-    }
-
-    void instantiateSliceService(DelegateExecution execution) {
+        SliceTaskParamsAdapter sliceParams =
+                execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter
 
-        ServiceDecomposition serviceDecomposition= execution.getVariable("sliceServiceDecomposition")
-        String uuiRequest = execution.getVariable("uuiRequest")
+        ServiceDecomposition serviceDecomposition =
+                execution.getVariable("serviceProfileDecomposition") as ServiceDecomposition
         ModelInfo modelInfo = serviceDecomposition.getModelInfo()
-        String serviceRole = "e2eslice-service"
+        //String serviceRole = "e2eslice-service"
+        /**
+         * todo: ServiceProfile params changed
+         * todo: role
+         */
+        String serviceRole = "service-profile"
         String serviceType = execution.getVariable("serviceType")
-        Map<String, Object> serviceProfile = execution.getVariable("serviceProfile")
+        Map<String, Object> serviceProfile = sliceParams.getServiceProfile()
         String ssInstanceId = execution.getVariable("serviceInstanceId")
         try {
-            org.onap.aai.domain.yang.ServiceInstance ss = new org.onap.aai.domain.yang.ServiceInstance()
+            ServiceInstance ss = new ServiceInstance()
             ss.setServiceInstanceId(ssInstanceId)
             String sliceInstanceName = execution.getVariable("serviceInstanceName")
             ss.setServiceInstanceName(sliceInstanceName)
@@ -143,8 +120,8 @@ class DoCreateSliceServiceInstance extends AbstractServiceTaskProcessor{
             String snssai = serviceProfile.get("sNSSAI")
             ss.setEnvironmentContext(snssai)
             ss.setServiceRole(serviceRole)
-            AAIResourcesClient client = new AAIResourcesClient()
-            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, execution.getVariable("globalSubscriberId"), execution.getVariable("subscriptionServiceType"), 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
@@ -157,7 +134,7 @@ class DoCreateSliceServiceInstance extends AbstractServiceTaskProcessor{
 
         def rollbackData = execution.getVariable("RollbackData")
         if (rollbackData == null) {
-            rollbackData = new RollbackData();
+            rollbackData = new RollbackData()
         }
         //rollbackData.put("SERVICEINSTANCE", "disableRollback", disableRollback.toString())
         rollbackData.put("SERVICEINSTANCE", "rollbackAAI", "true")
@@ -170,57 +147,96 @@ class DoCreateSliceServiceInstance extends AbstractServiceTaskProcessor{
 
     }
 
+    /**
+     * create service profile in aai
+     * @param execution
+     */
+    void createServiceProfile(DelegateExecution execution) {
+
+        /**
+         * todo: ServiceProfile params changed
+         */
+        SliceTaskParamsAdapter sliceParams =
+                execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter
+        Map<String, Object> serviceProfileMap = sliceParams.getServiceProfile()
 
-    void createAllottedResource(DelegateExecution execution) {
-        String serviceInstanceId = execution.getVariable('sliceserviceInstanceId')
-
-        AAIResourcesClient resourceClient = new AAIResourcesClient()
-        AAIResourceUri ssServiceuri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId)
-
-//        try {
-//
-//            if(resourceClient.exists(ssServiceuri)){
-//                execution.setVariable("ssi_resourceLink", uri.build().toString())
-//            }else{
-//                exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service instance was not found in aai to " +
-//                        "associate allotted resource for service :"+serviceInstanceId)
-//            }
-//        }catch(BpmnError e) {
-//            throw e;
-//        }catch (Exception ex){
-//            String msg = "Exception in getServiceInstance. " + ex.getMessage()
-//            logger.debug(msg)
-//            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
-//        }
+        String serviceProfileInstanceId = execution.getVariable("serviceInstanceId")
+        String serviceProfileId = UUID.randomUUID().toString()
+        sliceParams.serviceProfile.put("profileId", serviceProfileId)
+
+        ServiceProfile serviceProfile = new ServiceProfile()
+        serviceProfile.setProfileId(serviceProfileId)
+        serviceProfile.setLatency(Integer.parseInt(serviceProfileMap.get("latency").toString()))
+        serviceProfile.setMaxNumberOfUEs(Integer.parseInt(serviceProfileMap.get("maxNumberofUEs").toString()))
+        serviceProfile.setCoverageAreaTAList(serviceProfileMap.get("coverageAreaTAList").toString())
+        serviceProfile.setUeMobilityLevel(serviceProfileMap.get("uEMobilityLevel").toString())
+        serviceProfile.setResourceSharingLevel(serviceProfileMap.get("resourceSharingLevel").toString())
+        serviceProfile.setExpDataRateUL(Integer.parseInt(serviceProfileMap.get("expDataRateUL").toString()))
+        serviceProfile.setExpDataRateDL(Integer.parseInt(serviceProfileMap.get("expDataRateDL").toString()))
+        serviceProfile.setAreaTrafficCapUL(Integer.parseInt(serviceProfileMap.get("areaTrafficCapUL").toString()))
+        serviceProfile.setAreaTrafficCapDL(Integer.parseInt(serviceProfileMap.get("areaTrafficCapDL").toString()))
+        serviceProfile.setActivityFactor(Integer.parseInt(serviceProfileMap.get("activityFactor").toString()))
+
+        serviceProfile.setJitter(0)
+        serviceProfile.setSurvivalTime("0")
+        serviceProfile.setCsAvailability(new Object())
+        serviceProfile.setReliability("")
+        serviceProfile.setExpDataRate(0)
+        serviceProfile.setTrafficDensity(0)
+        serviceProfile.setConnDensity(0)
+        try {
+            AAIResourceUri uri = AAIUriFactory.createResourceUri(
+                AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId"))
+                .serviceSubscription(execution.getVariable("subscriptionServiceType"))
+                .serviceInstance(serviceProfileInstanceId)
+                .serviceProfile(serviceProfileId))
+            client.create(uri, serviceProfile)
+            execution.setVariable("sliceTaskParams", sliceParams)
+
+        } catch (BpmnError e) {
+            throw e
+        } catch (Exception ex) {
+            String msg = "Exception in DoCreateSliceServiceInstance.instantiateSliceService. " + ex.getMessage()
+            logger.info(msg)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+        }
+    }
+
+    /**
+     * create allotted resource
+     * todo: unfinished
+     * @param execution
+     */
+    public void createAllottedResource(DelegateExecution execution) {
 
         try {
-            String allottedResourceId = execution.getVariable("allottedResourceId")
-            ServiceDecomposition serviceDecomposition = execution.getVariable("sliceServiceDecomposition")
+
+            ServiceDecomposition serviceDecomposition =
+                    execution.getVariable("serviceProfileDecomposition") as ServiceDecomposition
+
             List<org.onap.so.bpmn.core.domain.AllottedResource> allottedResourceList = serviceDecomposition.getAllottedResources()
-            for(org.onap.so.bpmn.core.domain.AllottedResource allottedResource : allottedResourceList)
-            {
-                //AAIResourceUri allottedResourceUri = AAIUriFactory.createResourceFromParentURI(ssServiceuri, AAIObjectType.ALLOTTED_RESOURCE, allottedResourceId)
-                AAIResourceUri allottedResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.ALLOTTED_RESOURCE,
-                        execution.getVariable("globalSubscriberId"),execution.getVariable("subscriptionServiceType"),
-                        execution.getVariable("sliceserviceInstanceId"), allottedResourceId)
+            for(org.onap.so.bpmn.core.domain.AllottedResource allottedResource : allottedResourceList) {
+                String allottedResourceId = UUID.randomUUID().toString()
+
+                AAIResourceUri allottedResourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(execution.getVariable("serviceInstanceId")).allottedResource(allottedResourceId))
+
                 execution.setVariable("allottedResourceUri", allottedResourceUri)
                 String arType = allottedResource.getAllottedResourceType()
                 String arRole = allottedResource.getAllottedResourceRole()
                 String modelInvariantId = allottedResource.getModelInfo().getModelInvariantUuid()
                 String modelVersionId = allottedResource.getModelInfo().getModelUuid()
 
-                org.onap.aai.domain.yang.AllottedResource resource = new org.onap.aai.domain.yang.AllottedResource()
+                AllottedResource resource = new AllottedResource()
                 resource.setId(allottedResourceId)
                 resource.setType(arType)
                 resource.setAllottedResourceName("Allotted_"+ execution.getVariable("serviceInstanceName"))
                 resource.setRole(arRole)
                 resource.setModelInvariantId(modelInvariantId)
                 resource.setModelVersionId(modelVersionId)
-                getAAIClient().create(allottedResourceUri, resource)
-                //AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceFromExistingURI(AAIObjectType.SERVICE_INSTANCE, UriBuilder.fromPath(ssServiceuri).build())
-                //getAAIClient().connect(allottedResourceUri,ssServiceuri)
+
+                client.create(allottedResourceUri, resource)
+
             }
-            //execution.setVariable("aaiARPath", allottedResourceUri.build().toString());
 
         }catch (Exception ex) {
             exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Exception in createAaiAR " + ex.getMessage())
index 9b78afb..161b920 100644 (file)
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP - SO
  * ================================================================================
- # Copyright (c) 2019, CMCC Technologies Co., Ltd.
+ # Copyright (c) 2020, CMCC Technologies Co., Ltd.
  #
  # Licensed under the Apache License, Version 2.0 (the "License")
  # you may not use this file except in compliance with the License.
 
 package org.onap.so.bpmn.infrastructure.scripts
 
-import com.fasterxml.jackson.core.type.TypeReference
 import com.fasterxml.jackson.databind.ObjectMapper
-import groovy.json.JsonSlurper
 import org.camunda.bpm.engine.delegate.DelegateExecution
-import org.onap.logging.filter.base.ONAPComponents
+import org.onap.so.beans.nsmf.AnSliceProfile
+import org.onap.so.beans.nsmf.CnSliceProfile
+import org.onap.so.beans.nsmf.EsrInfo
+import org.onap.so.beans.nsmf.NetworkType
+import org.onap.so.beans.nsmf.NssmfAdapterNBIRequest
 import org.onap.so.beans.nsmf.SliceTaskParams
+import org.onap.so.beans.nsmf.SliceTaskParamsAdapter
+import org.onap.so.beans.nsmf.TnSliceProfile
+import org.onap.so.beans.nsmf.oof.SubnetCapability
+import org.onap.so.beans.nsmf.oof.SubnetType
+import org.onap.so.beans.nsmf.oof.TemplateInfo
 import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
 import org.onap.so.bpmn.common.scripts.ExceptionUtil
+import org.onap.so.bpmn.common.scripts.NssmfAdapterUtils
 import org.onap.so.bpmn.common.scripts.OofUtils
 import org.onap.so.bpmn.core.UrnPropertiesReader
+import org.onap.so.bpmn.core.domain.AllottedResource
+import org.onap.so.bpmn.core.domain.ModelInfo
 import org.onap.so.bpmn.core.domain.ServiceDecomposition
-import org.onap.so.bpmn.core.domain.ServiceProxy
 import org.onap.so.bpmn.core.json.JsonUtils
 import org.onap.so.client.HttpClient
 import org.onap.so.client.HttpClientFactory
@@ -40,17 +49,15 @@ import org.onap.aaiclient.client.aai.AAIResourcesClient
 import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
 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.slf4j.Logger
 import org.slf4j.LoggerFactory
-
-import javax.ws.rs.NotFoundException
-import javax.ws.rs.core.Response
-
-import static org.apache.commons.lang3.StringUtils.isBlank
+import org.springframework.http.ResponseEntity
 
 class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
 
-    private static final Logger logger = LoggerFactory.getLogger( DoCreateSliceServiceOption.class)
+    private static final Logger logger = LoggerFactory.getLogger(DoCreateSliceServiceOption.class)
 
     ExceptionUtil exceptionUtil = new ExceptionUtil()
 
@@ -58,426 +65,528 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
 
     OofUtils oofUtils = new OofUtils()
 
-    ObjectMapper objectMapper = new ObjectMapper()
+    private static final ObjectMapper objectMapper = new ObjectMapper()
+
+    private NssmfAdapterUtils nssmfAdapterUtils = new NssmfAdapterUtils(httpClientFactory, jsonUtil)
+
+    private static final String QUERY_SUB_NET_CAPABILITY = "/api/rest/provMns/v1/NSS/subnetCapabilityQuery"
+
+    private static final String QUERY_NSSI_SELECTION_CAPABILITY = "/api/rest/provMns/v1/NSS/NSSISelectionCapability"
 
     void preProcessRequest (DelegateExecution execution) {
     }
 
+    /**
+     * prepare the params for decompose nst
+     * @param execution
+     */
+    public void prepareDecomposeNST(DelegateExecution execution) {
 
-    void prepareSelectNSIRequest(DelegateExecution execution) {
+        SliceTaskParamsAdapter sliceTaskParams =
+                execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter
 
-        String urlString = UrnPropertiesReader.getVariable("mso.oof.endpoint", execution)
-        logger.debug( "get NSI option OOF Url: " + urlString)
-
-        boolean isNSISuggested = true
-        execution.setVariable("isNSISuggested",isNSISuggested)
-        String requestId = execution.getVariable("msoRequestId")
-               String messageType = "NSISelectionResponse"
-               
-        Map<String, Object> profileInfo = execution.getVariable("serviceProfile")
-        Map<String, Object> nstSolution = execution.getVariable("nstSolution")
-        logger.debug("Get NST selection from OOF: " + nstSolution.toString())
-        String nstInfo = """{
-            "modelInvariantId":"${nstSolution.invariantUUID}",
-            "modelVersionId":"${nstSolution.UUID}",
-            "modelName":"${nstSolution.NSTName}"
-         }"""
-               
-                execution.setVariable("nsiSelectionUrl", "/api/oof/selection/nsi/v1")
-                execution.setVariable("nsiSelection_messageType",messageType)
-                execution.setVariable("nsiSelection_correlator",requestId)
-                String timeout = UrnPropertiesReader.getVariable("mso.adapters.oof.timeout", execution);
-                execution.setVariable("nsiSelection_timeout",timeout)
-                String oofRequest = oofUtils.buildSelectNSIRequest(requestId, nstInfo,messageType, profileInfo)
-                execution.setVariable("nsiSelection_oofRequest",oofRequest)
-                logger.debug("Sending request to OOF: " + oofRequest)
-    }
+        String modelUuid = sliceTaskParams.getNSTInfo().getUUID()
+        String modelInvariantUuid = sliceTaskParams.getNSTInfo().getInvariantUUID()
 
-    void processOOFResponse(Response httpResponse, DelegateExecution execution) {
-        int responseCode = httpResponse.getStatus()
-        SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams")
-            String OOFResponse = execution.getVariable("nsiSelection_oofResponse")
-            logger.debug("NSI OOFResponse is: " + OOFResponse)
-            execution.setVariable("OOFResponse", OOFResponse)
-            //This needs to be changed to derive a value when we add policy to decide the solution options.
-            Map OOFResponseObject = new JsonSlurper().parseText(OOFResponse)
-            Map solutions = OOFResponseObject.get("solutions")
-
-            String resourceSharingLevel = execution.getVariable("resourceSharingLevel")
-            Boolean isSharable = resourceSharingLevel.equals("shared")
-
-            if (solutions != null) {
-                if (isSharable && hasSharedNSIsolutions(solutions)) {
-                    //sharedNSISolution
-                    processSharedNSISolutions(solutions, execution)
-                }
-                else if(solutions.containsKey("newNSISolutions")) {
-                    processNewNSISolutions(solutions, execution)
-                }
-            }
-            execution.setVariable("sliceTaskParams", sliceTaskParams)
-            logger.debug("sliceTaskParams: "+sliceTaskParams.convertToJson())
-        logger.debug("*** Completed options Call to OOF ***")
-               //解析sliceProfile
-               logger.debug("start parseServiceProfile")
-               parseServiceProfile(execution)
-               logger.debug("end parseServiceProfile")
+        String serviceModelInfo = """{
+            "modelInvariantUuid":"${modelInvariantUuid}",
+            "modelUuid":"${modelUuid}",
+            "modelVersion":""
+             }"""
+        execution.setVariable("nstServiceModelInfo", serviceModelInfo)
     }
 
-    private boolean hasSharedNSIsolutions( Map solutions){
-        if(solutions.containsKey("sharedNSISolutions")){
-            List sharedNSIsolutions = solutions.get("sharedNSISolutions")
-            if (sharedNSIsolutions != null && !sharedNSIsolutions.isEmpty()) {
-                return  true
-            }
+    /**
+     * process the result of NST Decomposition
+     * @param execution
+     */
+    public void processDecompositionNST(DelegateExecution execution) {
+
+        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()
+            nsstInfo.setUUID(allottedResource.getProvidingServiceModelUuid())
+            nsstInfo.setInvariantUUID(allottedResource.getProvidingServiceModelInvariantUuid())
+            nsstInfo.setName(allottedResource.getProvidingServiceModelName())
+            nsstInfos.add(nsstInfo)
         }
-        return false
+        execution.setVariable("nsstInfos", nsstInfos)
+
+        execution.setVariable("maxNsstIndex", allottedResources.size() - 1)
+        execution.setVariable("currentNsstIndex", 0)
+
+        List<ServiceDecomposition> nsstServiceDecompositions = new ArrayList<>()
+        execution.setVariable("nsstServiceDecompositions", nsstServiceDecompositions)
     }
 
-    private void processNewNSISolutions(Map solutions, DelegateExecution execution) {
-        int index = 0
-        List<Map> newNSISolutions = solutions.get("newNSISolutions")
-        List<Map> NSSImap = new ArrayList<>()
-        if (newNSISolutions != null && newNSISolutions.size() > 0) {
-            NSSImap = newNSISolutions.get(index).get("NSSISolutions") as List<Map>
-            for (Map nssi : NSSImap) {
-                Map oofSliceProfile = nssi.get("sliceProfile")
-                String domain = oofSliceProfile.getOrDefault("domainType","")
-                logger.debug("OOF newNSISolutions SliceProfile: " +oofSliceProfile.toString()+",domain:${domain}")
-                if(null != domain){
-                    //TODO
-//                    def nssiSolution = nssi.get("NSSISolution") as Map<String, ?>
-//                    String nssiName = nssiSolution.getOrDefault("NSSIName", "")
-//                    String nssiId = nssiSolution.getOrDefault("NSSIId", "")
-//                    saveNSSIId(nssi, sliceTaskParams)
-                    Map<String, Object> sliceProfile = getSliceProfile(domain, execution, oofSliceProfile)
-                    saveSliceProfile(execution, domain, sliceProfile)
-
-                }
-            }
-        }
+    /**
+     * prepare the params for decompose nsst
+     * @param execution
+     */
+    public void prepareDecomposeNSST(DelegateExecution execution) {
+
+        List<TemplateInfo> nsstInfos = execution.getVariable("nsstInfos") as List<TemplateInfo>
+        int index = execution.getVariable("currentNsstIndex") as Integer
+
+        String modelUuid = nsstInfos.get(index).getUUID()
+        String modelInvariantUuid = nsstInfos.get(index).getInvariantUUID()
+
+        String serviceModelInfo = """{
+            "modelInvariantUuid":"${modelInvariantUuid}",
+            "modelUuid":"${modelUuid}",
+            "modelVersion":""
+             }"""
+        execution.setVariable("nsstServiceModelInfo", serviceModelInfo)
+
     }
 
-    private void processSharedNSISolutions(Map solutions, DelegateExecution execution) {
-        String nsiName, nsiInstanceId, nssiId, nssiName
-        SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams")
-
-        Map sharedNSIsolution = ((List) solutions.get("sharedNSISolutions"))?.get(0)
-        nsiInstanceId = sharedNSIsolution.getOrDefault("NSIId", "")
-        nsiName = sharedNSIsolution.getOrDefault("NSIName", "")
-        sliceTaskParams.setSuggestNsiId(nsiInstanceId)
-        sliceTaskParams.setSuggestNsiName(nsiName)
-
-        //Temporary modification
-        List NSSIs = sharedNSIsolution.get("NSSIs")
-        for(Map nssi : NSSIs){
-            Map oofSliceProfile = ((List)nssi.get("sliceProfile"))?.get(0)
-            String domain = oofSliceProfile.getOrDefault("domainType","")
-            nssiId = nssi.getOrDefault("NSSIId","")
-            nssiName = nssi.getOrDefault("NSSIName","")
-            saveNSSIId(domain, nssiId, nssiName,execution)
-            Map<String, Object> sliceProfile = getSliceProfile(domain, execution, oofSliceProfile)
-            saveSliceProfile(execution, domain, sliceProfile)
-            logger.debug("OOF sharedNSISolution SliceProfile:"+oofSliceProfile.toString()+",domain:${domain}")
-            logger.debug("OOF sharedNSISolution nsiInstanceId:${nsiInstanceId}, nsiName:${nsiName}, nssiId:${nssiId}, nssiName:${nssiName}")
+    /**
+     * process the result of NSST Decomposition
+     * @param execution
+     */
+    public void processDecompositionNSST(DelegateExecution execution) {
+
+        List<ServiceDecomposition> nsstServiceDecompositions =
+                execution.getVariable("nsstServiceDecompositions") as List<ServiceDecomposition>
+
+        ServiceDecomposition nsstServiceDecomposition =
+                execution.getVariable("nsstServiceDecomposition") as ServiceDecomposition
+
+        nsstServiceDecompositions.add(nsstServiceDecomposition)
+
+        execution.setVariable("nsstServiceDecompositions", nsstServiceDecompositions)
+
+
+
+
+        int num = execution.getVariable("maxNsstIndex") as Integer
+        int index = execution.getVariable("currentNsstIndex") as Integer
+
+        execution.setVariable("currentNsstIndex", index + 1)
+
+        if (index >= num) {
+            execution.setVariable("nsstHandleContinue", false)
+        } else {
+            execution.setVariable("nsstHandleContinue", true)
         }
+
     }
 
-    private void parseServiceProfile(DelegateExecution execution) {
-        logger.debug("Start parseServiceProfile")
-        String serviceType = execution.getVariable("serviceType")
-        Map<String, Object> serviceProfile = execution.getVariable("serviceProfile")
-        SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams")
-        // set sliceProfile for three domains
-        if(!sliceTaskParams.getSliceProfileAn()){
-            Map<String, Object> sliceProfileAn = getSliceProfile( "AN", execution,null)
-            saveSliceProfile(execution,"AN",sliceProfileAn)
-        }
+    /**
+     * set nsst info to sliceTaskParams by type
+     * @param execution
+     */
+    public void handleNsstByType(DelegateExecution execution) {
+        //todo: set to sliceTaskParams by type
 
-        if(!sliceTaskParams.getSliceProfileTn()){
-            Map<String, Object> sliceProfileTn = getSliceProfile( "TN", execution,null)
-            saveSliceProfile(execution,"TN",sliceProfileTn)
-        }
+        SliceTaskParamsAdapter sliceParams =
+                execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter
+
+        List<ServiceDecomposition> nsstServiceDecompositions =
+                execution.getVariable("nsstServiceDecompositions") as List<ServiceDecomposition>
+
+        List<SubnetCapability> subnetCapabilities = new ArrayList<>()
+
+
+
+        for (ServiceDecomposition serviceDecomposition : nsstServiceDecompositions) {
+            //todo:
+            SubnetCapability subnetCapability = new SubnetCapability()
+
+            handleByType(execution, serviceDecomposition, sliceParams, subnetCapability)
 
-        if(!sliceTaskParams.getSliceProfileCn()){
-            Map<String, Object> sliceProfileCn = getSliceProfile( "CN", execution,null, )
-           saveSliceProfile(execution,"CN",sliceProfileCn)
+            subnetCapabilities.add(subnetCapability)
         }
 
-        logger.debug("Finish parseServiceProfile")
+        execution.setVariable("sliceTaskParams", sliceParams)
+        execution.setVariable("subnetCapabilities", subnetCapabilities)
     }
 
-    private void saveSliceProfile(DelegateExecution execution, String domain, Map<String, Object> sliceProfile){
-        SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams")
-        if(domain.equalsIgnoreCase("AN")){
-            execution.setVariable("sliceProfileAn", sliceProfile)
-            sliceTaskParams.setSliceProfileAn(sliceProfile)
-            logger.debug("sliceProfileAn: " + sliceProfile)
+    private void handleByType(DelegateExecution execution, ServiceDecomposition serviceDecomposition,
+                              SliceTaskParamsAdapter sliceParams, SubnetCapability subnetCapability) {
+        //todo:
+        String domainType = ""
+        ModelInfo modelInfo = serviceDecomposition.getModelInfo()
+        String vendor = serviceDecomposition.getServiceRole()
+        SubnetType subnetType
+
+        switch (domainType) {
+            case "tn_bh":
+                subnetType = SubnetType.TN_BH
+                sliceParams.tnBHSliceTaskInfo.vendor = vendor
+                sliceParams.tnBHSliceTaskInfo.subnetType = subnetType
+                sliceParams.tnBHSliceTaskInfo.networkType = subnetType.networkType
+                sliceParams.tnBHSliceTaskInfo.NSSTInfo.UUID = modelInfo.getModelUuid()
+                sliceParams.tnBHSliceTaskInfo.NSSTInfo.invariantUUID = modelInfo.getModelInvariantUuid()
+                sliceParams.tnBHSliceTaskInfo.NSSTInfo.name = modelInfo.getModelName()
+
+                break
+            case "tn_mh":
+                subnetType = SubnetType.TN_MH
+                sliceParams.tnMHSliceTaskInfo.vendor = vendor
+                sliceParams.tnMHSliceTaskInfo.subnetType = subnetType
+                sliceParams.tnMHSliceTaskInfo.networkType = subnetType.networkType
+                sliceParams.tnMHSliceTaskInfo.NSSTInfo.UUID = modelInfo.getModelUuid()
+                sliceParams.tnMHSliceTaskInfo.NSSTInfo.invariantUUID = modelInfo.getModelInvariantUuid()
+                sliceParams.tnMHSliceTaskInfo.NSSTInfo.name = modelInfo.getModelName()
+
+                break
+            case "an_nf":
+                subnetType = SubnetType.AN_NF
+                sliceParams.anSliceTaskInfo.vendor = vendor
+                sliceParams.anSliceTaskInfo.subnetType = subnetType
+                sliceParams.anSliceTaskInfo.networkType = subnetType.networkType
+                sliceParams.anSliceTaskInfo.NSSTInfo.UUID = modelInfo.getModelUuid()
+                sliceParams.anSliceTaskInfo.NSSTInfo.invariantUUID = modelInfo.getModelInvariantUuid()
+                sliceParams.anSliceTaskInfo.NSSTInfo.name = modelInfo.getModelName()
+                break
+            case "cn":
+                subnetType = SubnetType.CN
+                sliceParams.cnSliceTaskInfo.vendor = vendor
+                sliceParams.cnSliceTaskInfo.subnetType = subnetType
+                sliceParams.cnSliceTaskInfo.networkType = subnetType.networkType
+                sliceParams.cnSliceTaskInfo.NSSTInfo.UUID = modelInfo.getModelUuid()
+                sliceParams.cnSliceTaskInfo.NSSTInfo.invariantUUID = modelInfo.getModelInvariantUuid()
+                sliceParams.cnSliceTaskInfo.NSSTInfo.name = modelInfo.getModelName()
+                break
+            default:
+                subnetType = null
+                break
+
+        //todo
+
         }
-        else if(domain.equalsIgnoreCase("TN")){
-            execution.setVariable("sliceProfileTn", sliceProfile)
-            sliceTaskParams.setSliceProfileTn(sliceProfile)
-            logger.debug("sliceProfileTn: " + sliceProfile)
+        if (subnetType == null) {
+            //todo: throw error
+            return
         }
-        else if(domain.equalsIgnoreCase("CN")){
-            execution.setVariable("sliceProfileCn", sliceProfile)
-            sliceTaskParams.setSliceProfileCn(sliceProfile)
-            logger.debug("sliceProfileCn: " + sliceProfile)
+        String response = querySubnetCapability(execution, vendor, subnetType)
+        ResponseEntity responseEntity = objectMapper.readValue(response, ResponseEntity.class)
+
+        Map<String, Object> result = responseEntity.getBody() as Map
+        for (Map.Entry<String, Object> entry : result.entrySet()) {
+            subnetCapability.setDomainType(entry.getKey())
+            subnetCapability.setCapabilityDetails(entry.getValue())
         }
     }
 
-    private void saveNSSIId(String domain, String nssiId, String nssiName, DelegateExecution execution) {
-        SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams")
-        if(domain.equalsIgnoreCase("AN")){
-            sliceTaskParams.setAnSuggestNssiId(nssiId)
-            sliceTaskParams.setAnSuggestNssiName(nssiName)
-        }
-        else if(domain.equalsIgnoreCase("CN")){
-            sliceTaskParams.setCnSuggestNssiId(nssiId)
-            sliceTaskParams.setCnSuggestNssiName(nssiName)
-        }
-        else if(domain.equalsIgnoreCase("TN")){
-            sliceTaskParams.setTnSuggestNssiId(nssiId)
-            sliceTaskParams.setTnSuggestNssiName(nssiName)
-        }
+    /**
+     * query Subnet Capability of TN AN CN
+     * @param execution
+     */
+    private String querySubnetCapability(DelegateExecution execution, String vendor, SubnetType subnetType) {
+
+        String strRequest = objectMapper.writeValueAsString(buildQuerySubnetCapRequest(vendor, subnetType))
+
+        String response = nssmfAdapterUtils.sendPostRequestNSSMF(execution, QUERY_SUB_NET_CAPABILITY, strRequest)
+        return response
     }
 
-    private Map getSliceProfile(String domain, DelegateExecution execution, Map<String, Object> oofSliceProfile) {
-        String profileMapStr
-        Map<String, Object> serviceProfile = execution.getVariable("serviceProfile")
-        Integer domainLatency = (Integer) serviceProfile.get("latency")/3
-
-        if(domain.equalsIgnoreCase("AN")){
-            profileMapStr = """ {
-                    "latency": ${domainLatency}, 
-                    "sNSSAI": "sNSSAI", 
-                    "uEMobilityLevel": "uEMobilityLevel", 
-                    "coverageAreaTAList": "coverageAreaTAList", 
-                    "5QI": 100
-                }"""
-        }
-        else if(domain.equalsIgnoreCase("TN")){
-            profileMapStr =""" {
-                    "latency":${domainLatency},
-                    "sNSSAI":"sNSSAI", 
-                    "e2eLatency":"latency", 
-                    "bandwidth": 100
-                }"""
-        }
-        else if(domain.equalsIgnoreCase("CN")){
-            profileMapStr = """ {
-                    "areaTrafficCapDL":"areaTrafficCapDL",
-                    "maxNumberofUEs":"maxNumberofUEs",
-                    "latency":${domainLatency},
-                    "expDataRateUL":"expDataRateUL", 
-                    "sNSSAI":"sNSSAI", 
-                    "areaTrafficCapUL":"areaTrafficCapUL",
-                    "uEMobilityLevel":"uEMobilityLevel", 
-                    "expDataRateDL":"expDataRateDL",  
-                    "activityFactor":"activityFactor",
-                    "resourceSharingLevel":"resourceSharingLevel"
-                }"""
-        }
+    /**
+     * build request body for querying Subnet Capability
+     * @param vendor
+     * @param subnetTypes
+     * @param networkType
+     * @return
+     */
+    private static String buildQuerySubnetCapRequest(String vendor, SubnetType subnetType) {
+        NssmfAdapterNBIRequest request = new NssmfAdapterNBIRequest()
 
-           logger.debug("Profile map for " + domain + " : " + profileMapStr)
-        Map<String, Object> profileMaps = objectMapper.readValue(profileMapStr.trim().replaceAll(" ", ""), new TypeReference<Map<String, String>>(){})
-        Map<String, Object> sliceProfile = [:]
-        for (Map.Entry<String, String> profileMap : profileMaps) {
-            String key = profileMap.key
-            String value = profileMaps.get(key)
-            if(null != oofSliceProfile && oofSliceProfile.keySet().contains(key)){
-                sliceProfile.put(key, oofSliceProfile.get(key))
-                logger.debug("Get from oof, key:${key}, value: ${oofSliceProfile.get(key)}")
+        List<String> subnetTypes =  new ArrayList<>()
+        subnetTypes.add(subnetType.subnetType)
+        Map<String, Object> paramMap = new HashMap()
+        paramMap.put("subnetTypes", subnetTypes)
+
+        request.setSubnetCapabilityQuery(objectMapper.writeValueAsString(paramMap))
+
+        EsrInfo esrInfo = new EsrInfo()
+        esrInfo.setVendor(vendor)
+        esrInfo.setNetworkType(subnetType.networkType)
+
+        request.setEsrInfo(esrInfo)
+
+        String strRequest = objectMapper.writeValueAsString(request)
+
+        return strRequest
+    }
+
+    /**
+     * todo: need rewrite
+     * prepare select nsi request
+     * @param execution
+     */
+    public void preNSIRequest(DelegateExecution execution) {
+
+        String urlString = UrnPropertiesReader.getVariable("mso.oof.endpoint", execution)
+        logger.debug( "get NSI option OOF Url: " + urlString)
+
+
+        String requestId = execution.getVariable("msoRequestId")
+        String messageType = "NSISelectionResponse"
+
+        execution.setVariable("nsiSelectionUrl", "/api/oof/selection/nsi/v1")
+        execution.setVariable("nsiSelection_messageType", messageType)
+        execution.setVariable("nsiSelection_correlator", requestId)
+        String timeout = UrnPropertiesReader.getVariable("mso.adapters.oof.timeout", execution)
+        execution.setVariable("nsiSelection_timeout", timeout)
+
+        SliceTaskParamsAdapter sliceParams =
+                execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter
+
+        Map<String, Object> profileInfo = sliceParams.getServiceProfile()
+        TemplateInfo nstInfo = sliceParams.getNSTInfo()
+
+        List<TemplateInfo> nsstInfos = execution.getVariable("nsstInfos") as List<TemplateInfo>
+
+        List<SubnetCapability> subnetCapabilities =
+                execution.getVariable("subnetCapabilities") as List<SubnetCapability>
+
+        String oofRequest = oofUtils.buildSelectNSIRequest(requestId, nstInfo, nsstInfos,
+                messageType, profileInfo, subnetCapabilities, timeout as Integer)
+
+        execution.setVariable("nsiSelection_oofRequest", oofRequest)
+        logger.debug("Sending request to OOF: " + oofRequest)
+    }
+
+    /**
+     * todo: need rewrite
+     * process select nsi response
+     * @param execution
+     */
+    public void processNSIResp(DelegateExecution execution) {
+
+        SliceTaskParamsAdapter sliceTaskParams =
+                execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter
+
+        String OOFResponse = execution.getVariable("nsiSelection_oofResponse")
+        logger.debug("NSI OOFResponse is: " + OOFResponse)
+        execution.setVariable("OOFResponse", OOFResponse)
+        //This needs to be changed to derive a value when we add policy to decide the solution options.
+
+        Map<String, Object> resMap = objectMapper.readValue(OOFResponse, Map.class)
+        List<Map<String, Object>> nsiSolutions = (List<Map<String, Object>>) resMap.get("solutions")
+        Map<String, Object> solution = nsiSolutions.get(0)
+
+        String resourceSharingLevel = execution.getVariable("resourceSharingLevel")
+        Boolean isSharable = resourceSharingLevel == "shared"
+
+        if (solution != null) {
+            if (isSharable && solution.get("existingNSI")) {
+                //sharedNSISolution
+                processSharedNSI(solution, sliceTaskParams)
             }
-            else if(serviceProfile.keySet().contains(value)){
-                sliceProfile.put(key, serviceProfile.get(value))
+            else if(solution.containsKey("newNSISolution")) {
+                processNewNSI(solution, sliceTaskParams)
             }
-            else{
-                sliceProfile.put(key, profileMaps.get(key))
+        }
+        execution.setVariable("sliceTaskParams", sliceTaskParams)
+        //logger.debug("sliceTaskParams: " + sliceTaskParams.convertToJson())
+        logger.debug("*** Completed options Call to OOF ***")
+    }
+
+    private void processSharedNSI(Map<String, Object> solution, SliceTaskParamsAdapter sliceParams) {
+        Map<String, Object> sharedNSISolution = solution.get("sharedNSISolution") as Map
+
+        String nsiId = sharedNSISolution.get("NSIId")
+        String nsiName = sharedNSISolution.get("NSIName")
+        sliceParams.setSuggestNsiId(nsiId)
+        sliceParams.setSuggestNsiName(nsiName)
+    }
+
+    private void processNewNSI(Map<String, Object> solution, SliceTaskParamsAdapter sliceParams) {
+        Map<String, Object> newNSISolution = solution.get("newNSISolution") as Map
+        List<Map> sliceProfiles = newNSISolution.get("sliceProfiles") as List<Map>
+        for (Map sliceProfile : sliceProfiles) {
+            String domainType = sliceProfile.get("domainType")
+            switch (domainType.toLowerCase()) {
+                case "tn-bh":
+                    sliceParams.tnBHSliceTaskInfo.sliceProfile = sliceProfile as TnSliceProfile
+                    break
+                case "an-nf":
+                    sliceParams.anSliceTaskInfo.sliceProfile = sliceProfile as AnSliceProfile
+                    break
+                case "cn":
+                    sliceParams.cnSliceTaskInfo.sliceProfile = sliceProfile as CnSliceProfile
+                    break
+                default:
+                    break
             }
+
+            //todo
+
         }
-        return sliceProfile
     }
 
-    void processDecomposition(DelegateExecution execution){
-        logger.debug("Start processDecomposition")
+    /**
+     * get NSSI Selection Capability for AN
+     * @param execution
+     */
+    public void getNSSISelectionCap4AN(DelegateExecution execution) {
+
+        def vendor = execution.getVariable("vendor") as String
+
+        String strRequest = buildNSSISelectionReq(vendor, NetworkType.ACCESS)
 
-        ServiceDecomposition serviceDecomposition= execution.getVariable("serviceDecomposition")
-        SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams")
-        String nstName = serviceDecomposition.getModelInfo().getModelName()
-        String nstId = serviceDecomposition.getModelInfo().getModelUuid()
-        sliceTaskParams.setNstName(nstName)
-        sliceTaskParams.setNstId(nstId)
+        String response = nssmfAdapterUtils.sendPostRequestNSSMF(execution, QUERY_NSSI_SELECTION_CAPABILITY, strRequest)
 
-        logger.debug("End processDecomposition")
+        Map<String, Object> resMap = objectMapper.readValue(response, Map.class)
+
+        String selection = resMap.get("selection")
+
+
+        if ("NSMF".equalsIgnoreCase(selection)) {
+            execution.setVariable("NEED_AN_NSSI_SELECTION", true)
+        }
     }
 
+    /**
+     * get NSSI Selection Capability for TN
+     * @param execution
+     */
+    public void getNSSISelectionCap4TN(DelegateExecution execution) {
 
-    void prepareNSTDecompose(DelegateExecution execution) {
+        def vendor = execution.getVariable("vendor") as String
 
-        String modelUuid = execution.getVariable("nstModelUuid")
-        String modelInvariantUuid = execution.getVariable("nstModelInvariantUuid")
+        String strRequest = buildNSSISelectionReq(vendor, NetworkType.TRANSPORT)
 
-        String serviceModelInfo = """{
-            "modelInvariantUuid":"${modelInvariantUuid}",
-            "modelUuid":"${modelUuid}",
-            "modelVersion":""
-             }"""
-        execution.setVariable("serviceModelInfo", serviceModelInfo)
+        String response = nssmfAdapterUtils.sendPostRequestNSSMF(execution, QUERY_NSSI_SELECTION_CAPABILITY, strRequest)
+
+        Map<String, Object> resMap = objectMapper.readValue(response, Map.class)
+
+        String selection = resMap.get("selection")
+
+        if ("NSMF".equalsIgnoreCase(selection)) {
+            execution.setVariable("NEED_TN_NSSI_SELECTION", true)
+        }
     }
 
-    void prepareNSSTDecompose(DelegateExecution execution) {
-        Boolean isMoreNSSTtoProcess = false
-        Integer maxNSST = execution.getVariable("maxNSST")
-        Integer currentNSST=execution.getVariable("currentNSST")
-        List<String> nsstModelUUIDList = new ArrayList<>()
-        nsstModelUUIDList = execution.getVariable("nsstModelUUIDList")
-        String modelUuid = nsstModelUUIDList.get(currentNSST)
-        String serviceModelInfo = """{
-            "modelInvariantUuid":"",
-            "modelUuid":"${modelUuid}",
-            "modelVersion":""
-             }"""
-        execution.setVariable("serviceModelInfo", serviceModelInfo)
-        currentNSST=currentNSST+1
-        if(currentNSST<maxNSST)
-            isMoreNSSTtoProcess=true
-        execution.setVariable("isMoreNSSTtoProcess",isMoreNSSTtoProcess)
-        execution.setVariable("maxNSST",maxNSST)
-        execution.setVariable("currentNSST",currentNSST)
+    /**
+     * get NSSI Selection Capability for CN
+     * @param execution
+     */
+    public void getNSSISelectionCap4CN(DelegateExecution execution) {
+
+        def vendor = execution.getVariable("vendor") as String
+
+        String strRequest = buildNSSISelectionReq(vendor, NetworkType.CORE)
+
+        String response = nssmfAdapterUtils.sendPostRequestNSSMF(execution, QUERY_NSSI_SELECTION_CAPABILITY, strRequest)
+
+        Map<String, Object> resMap = objectMapper.readValue(response, Map.class)
+
+        String selection = resMap.get("selection")
+
+        if ("NSMF".equalsIgnoreCase(selection)) {
+            execution.setVariable("NEED_CN_NSSI_SELECTION", true)
+        }
     }
 
+    /**
+     * build NSSI Selection Capability Request body to nssmf adapter
+     * @param vendor
+     * @param networkType
+     * @return
+     */
+    private static String buildNSSISelectionReq(String vendor, NetworkType networkType) {
+        NssmfAdapterNBIRequest request = new NssmfAdapterNBIRequest()
+        EsrInfo esrInfo = new EsrInfo()
+        esrInfo.setVendor(vendor)
+        esrInfo.setNetworkType(networkType)
+        request.setEsrInfo(esrInfo)
+
+        return objectMapper.writeValueAsString(request)
+    }
+
+    /**
+     * if exist nssi need to select?
+     * @param execution
+     */
+    public void handleNssiSelect(DelegateExecution execution) {
 
-    void prepareNSSTlistfromNST(DelegateExecution execution) {
-        //Need to update this part from decomposition.
-        logger.trace("Enter prepareNSSTlistfromNST()")
-        Boolean isMoreNSSTtoProcess = false
-        ServiceDecomposition serviceDecomposition= execution.getVariable("serviceDecomposition")
-        SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams")
-        String nstName = serviceDecomposition.getModelInfo().getModelName()
-        sliceTaskParams.setNstName(nstName)
-        String nstId = serviceDecomposition.getModelInfo().getModelUuid()
-        sliceTaskParams.setNstId(nstId)
-        execution.setVariable("sliceTaskParams",sliceTaskParams)
-
-        List<ServiceProxy> proxyList = serviceDecomposition.getServiceProxy()
-        List<String> nsstModelUUIDList = new ArrayList<>()
-        for(ServiceProxy serviceProxy:proxyList)
-            nsstModelUUIDList.add(serviceProxy.getSourceModelUuid())
-        execution.setVariable("nsstModelUUIDList",nsstModelUUIDList)
-        Integer maxNSST = nsstModelUUIDList.size()
-        Integer currentNSST=0
-        execution.setVariable("maxNSST",maxNSST)
-        execution.setVariable("currentNSST",currentNSST)
-        if(currentNSST<maxNSST)
-            isMoreNSSTtoProcess=true
-        execution.setVariable("isMoreNSSTtoProcess",isMoreNSSTtoProcess)
-        logger.trace("Exit prepareNSSTlistfromNST()")
+        SliceTaskParamsAdapter sliceTaskParams =
+                execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter
 
+        //todo
     }
 
-    void getNSSTOption(DelegateExecution execution) {
-        ServiceDecomposition serviceDecomposition= execution.getVariable("serviceDecomposition")
+    /**
+     * todo: need rewrite
+     * prepare select nssi request
+     * @param execution
+     */
+    public void preNSSIRequest(DelegateExecution execution) {
+
         String urlString = UrnPropertiesReader.getVariable("mso.oof.endpoint", execution)
-        String globalSubscriberId = execution.getVariable("globalSubscriberId")
-        String serviceType = execution.getVariable("subscriptionServiceType")
-        String nssiInstanceId =""
-        String nssiName =""
-        SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams")
         logger.debug( "get NSI option OOF Url: " + urlString)
-        boolean isNSISuggested = false
-        execution.setVariable("isNSISuggested",isNSISuggested)
-
-        //Prepare auth for OOF - Begin
-        def authHeader = ""
-        String basicAuth = UrnPropertiesReader.getVariable("mso.oof.auth", execution)
-        String msokey = UrnPropertiesReader.getVariable("mso.msoKey", execution)
-
-        String basicAuthValue = utils.encrypt(basicAuth, msokey)
-        if (basicAuthValue != null) {
-            logger.debug( "Obtained BasicAuth username and password for OOF: " + basicAuthValue)
-            try {
-                authHeader = utils.getBasicAuth(basicAuthValue, msokey)
-                execution.setVariable("BasicAuthHeaderValue", authHeader)
-            } catch (Exception ex) {
-                logger.debug( "Unable to encode username and password string: " + ex)
-                exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Internal Error - Unable to " +
-                        "encode username and password string")
-            }
-        } else {
-            logger.debug( "Unable to obtain BasicAuth - BasicAuth value null")
-            exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Internal Error - BasicAuth " +
-                    "value null")
-        }
-        //Prepare auth for OOF - End
-        //Prepare send request to OOF - Begin
+
+        boolean isNSISuggested = true
+        execution.setVariable("isNSISuggested", isNSISuggested)
         String requestId = execution.getVariable("msoRequestId")
-        Map<String, Object> profileInfo = execution.getVariable("serviceProfile")
-        String nsstModelInvariantUuid = serviceDecomposition.getModelInfo().getModelInvariantUuid()
-        String nsstModelUuid = serviceDecomposition.getModelInfo().getModelUuid()
-        String nsstInfo = """"NSSTInfo": {
-        "invariantUUID":"${nsstModelInvariantUuid}",
-        "UUID":"${nsstModelUuid}"
-         }"""
-        String oofRequest = oofUtils.buildSelectNSSIRequest(execution, requestId, nsstInfo ,profileInfo)
+        String messageType = "NSISelectionResponse"
 
+        Map<String, Object> profileInfo = execution.getVariable("serviceProfile") as Map
+        Map<String, Object> nstSolution = execution.getVariable("nstSolution") as Map
+        logger.debug("Get NST selection from OOF: " + nstSolution.toString())
+        String nstInfo = """{
+            "modelInvariantId":"${nstSolution.invariantUUID}",
+            "modelVersionId":"${nstSolution.UUID}",
+            "modelName":"${nstSolution.NSTName}"
+         }"""
 
-        URL url = new URL(urlString+"/api/oof/v1/selectnssi")
-        HttpClient httpClient = new HttpClientFactory().newJsonClient(url, ONAPComponents.OOF)
-        httpClient.addAdditionalHeader("Authorization", authHeader)
-        Response httpResponse = httpClient.post(oofRequest)
+        execution.setVariable("nsiSelectionUrl", "/api/oof/selection/nsi/v1")
+        execution.setVariable("nsiSelection_messageType", messageType)
+        execution.setVariable("nsiSelection_correlator", requestId)
+        String timeout = UrnPropertiesReader.getVariable("mso.adapters.oof.timeout", execution)
+        execution.setVariable("nsiSelection_timeout", timeout)
 
-        int responseCode = httpResponse.getStatus()
-        logger.debug("OOF sync response code is: " + responseCode)
+        //todo
+        String oofRequest = oofUtils.buildSelectNSIRequest(requestId, nstInfo, messageType, profileInfo)
 
-        if(responseCode != 200){
-            exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Sync Response from OOF.")
-        }
+        execution.setVariable("nsiSelection_oofRequest", oofRequest)
+        logger.debug("Sending request to OOF: " + oofRequest)
+    }
 
-        if(httpResponse.hasEntity()){
-            String OOFResponse = httpResponse.readEntity(String.class)
-            execution.setVariable("OOFResponse", OOFResponse)
-            nssiInstanceId = jsonUtil.getJsonValue(OOFResponse, "NSSIIInfo.NSSIID")
-            nssiName = jsonUtil.getJsonValue(OOFResponse, "NSSIInfo.NSSIName")
-            execution.setVariable("nssiInstanceId",nssiInstanceId)
-            execution.setVariable("nssiName",nssiName)
-        }
-        if(isBlank(nssiInstanceId)){
-            logger.debug( "There is no valid NSST suggested by OOF.")
-        }else
-        {
-            try {
-                AAIResourcesClient resourceClient = new AAIResourcesClient()
-                AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId, serviceType, nssiInstanceId)
-                AAIResultWrapper wrapper = resourceClient.get(serviceInstanceUri, NotFoundException.class)
-                Optional<org.onap.aai.domain.yang.ServiceInstance> si = wrapper.asBean(org.onap.aai.domain.yang.ServiceInstance.class)
-                org.onap.aai.domain.yang.ServiceInstance nssi = si.get()
-
-                String domain = nssi.getEnvironmentContext().toString().toUpperCase()
-                switch (domain) {
-                    case "AN":
-                        sliceTaskParams.setAnSuggestNssiId(nssi.getServiceInstanceId())
-                        sliceTaskParams.setAnSuggestNssiName(nssi.getServiceInstanceName())
-                        break
-                    case "CN":
-                        sliceTaskParams.setCnSuggestNssiId(nssi.getServiceInstanceId())
-                        sliceTaskParams.setCnSuggestNssiName(nssi.getServiceInstanceName())
-                        break
-                    case "TN":
-                        sliceTaskParams.setTnSuggestNssiId(nssi.getServiceInstanceId())
-                        sliceTaskParams.setTnSuggestNssiName(nssi.getServiceInstanceName())
-                        break
-                    default:
-                        break
-                }
-            }catch(NotFoundException e)
-            {
-                logger.debug("NSSI Service Instance not found in AAI: " + nssiInstanceId)
-            }catch(Exception e)
-            {
-                logger.debug("NSSI Service Instance not found in AAI: " + nssiInstanceId)
+    /**
+     * process select nssi response
+     * todo: unfinished
+     * @param execution
+     */
+    public void processNSSIResp(DelegateExecution execution) {
+
+        SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams") as SliceTaskParams
+        String OOFResponse = execution.getVariable("nsiSelection_oofResponse")
+        logger.debug("NSI OOFResponse is: " + OOFResponse)
+        execution.setVariable("OOFResponse", OOFResponse)
+        //This needs to be changed to derive a value when we add policy to decide the solution options.
+
+        Map<String, Object> resMap = objectMapper.readValue(OOFResponse, Map.class)
+        List<Map<String, Object>> nsiSolutions = (List<Map<String, Object>>) resMap.get("solutions")
+        Map<String, Object> solutions = nsiSolutions.get(0)
+
+        String resourceSharingLevel = execution.getVariable("resourceSharingLevel")
+        Boolean isSharable = resourceSharingLevel == "shared"
+
+        if (solutions != null) {
+            if (isSharable && solutions.get("existingNSI")) {
+                //sharedNSISolution
+                //processSharedNSISolutions(solutions, execution)
+            }
+            else if(solutions.containsKey("newNSISolution")) {
+                //processNewNSISolutions(solutions, execution)
             }
         }
-        logger.debug("Prepare NSSI option completed ")
+        execution.setVariable("sliceTaskParams", sliceTaskParams)
+        logger.debug("sliceTaskParams: "+sliceTaskParams.convertToJson())
+        logger.debug("*** Completed options Call to OOF ***")
+
+        logger.debug("start parseServiceProfile")
+        //parseServiceProfile(execution)
+        logger.debug("end parseServiceProfile")
     }
+
+
 }
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
new file mode 100644 (file)
index 0000000..0f1bf0d
--- /dev/null
@@ -0,0 +1,229 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.scripts
+
+import org.camunda.bpm.engine.delegate.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
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+
+class DoCreateTnNssiInstance extends AbstractServiceTaskProcessor {
+
+    private static final Logger logger = LoggerFactory.getLogger(DoCreateTnNssiInstance.class);
+    JsonUtils jsonUtil = new JsonUtils()
+    TnNssmfUtils tnNssmfUtils = new TnNssmfUtils()
+    ExceptionUtil exceptionUtil = new ExceptionUtil()
+    String Prefix = "DCTN_"
+
+    void preProcessRequest(DelegateExecution execution) {
+        String msg = ""
+        logger.trace("Enter preProcessRequest()")
+
+        execution.setVariable("prefix", Prefix)
+
+        String modelInvariantUuid = execution.getVariable("modelInvariantUuid")
+        String modelUuid = execution.getVariable("modelUuid")
+        //here modelVersion is not set, we use modelUuid to decompose the service.
+        def isDebugLogEnabled = true
+        execution.setVariable("isDebugLogEnabled", isDebugLogEnabled)
+        String serviceModelInfo = """{
+            "modelInvariantUuid":"${modelInvariantUuid}",
+            "modelUuid":"${modelUuid}",
+            "modelVersion":""
+             }"""
+        execution.setVariable("serviceModelInfo", serviceModelInfo)
+
+        logger.trace("Exit preProcessRequest")
+    }
+
+
+    void createSliceProfile(DelegateExecution execution) {
+
+        String sliceserviceInstanceId = 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.setE2ELatency(Integer.parseInt(jsonUtil.getJsonValue(sliceProfileStr, "latency")))
+        sliceProfile.setMaxBandwidth(Integer.parseInt(jsonUtil.getJsonValue(sliceProfileStr, "maxBandwidth")))
+
+        //TODO: new API
+        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))
+            client.create(uri, sliceProfile)
+
+        } catch (BpmnError e) {
+            throw e
+        } catch (Exception ex) {
+            String msg = "Exception in DoCreateSliceServiceInstance.instantiateSliceService. " + ex.getMessage()
+            logger.info(msg)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+        }
+    }
+
+
+    void createServiceInstance(DelegateExecution execution) {
+
+        String serviceRole = "TN"
+        String serviceType = execution.getVariable("subscriptionServiceType")
+        String ssInstanceId = execution.getVariable("sliceServiceInstanceId")
+        String sliceProfileStr = execution.getVariable("sliceProfile")
+        try {
+            org.onap.aai.domain.yang.ServiceInstance ss = new org.onap.aai.domain.yang.ServiceInstance()
+            ss.setServiceInstanceId(ssInstanceId)
+            String sliceInstanceName = execution.getVariable("sliceServiceInstanceName")
+            ss.setServiceInstanceName(sliceInstanceName)
+            ss.setServiceType(serviceType)
+            String serviceStatus = "allocated"
+            ss.setOrchestrationStatus(serviceStatus)
+            String modelInvariantUuid = execution.getVariable("modelInvariantUuid")
+            String modelUuid = execution.getVariable("modelUuid")
+            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))
+            client.create(uri, ss)
+        } catch (BpmnError e) {
+            throw e
+        } catch (Exception ex) {
+            String msg = "Exception in DoCreateTnNssiInstance.createServiceInstance. " + ex.getMessage()
+            logger.info(msg)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+        }
+    }
+
+
+    void createAllottedResource(DelegateExecution execution) {
+        String serviceInstanceId = execution.getVariable('sliceServiceInstanceId')
+
+        AAIResourcesClient resourceClient = getAAIClient()
+        AAIResourceUri ssServiceuri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId))
+
+        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))
+                execution.setVariable("allottedResourceUri", allottedResourceUri)
+                String modelInvariantId = execution.getVariable("modelInvariantUuid")
+                String modelVersionId = execution.getVariable("modelUuid")
+
+                org.onap.aai.domain.yang.AllottedResource resource = new org.onap.aai.domain.yang.AllottedResource()
+                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)
+            }
+
+        } catch (Exception ex) {
+            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Exception in createAaiAR " + ex.getMessage())
+        }
+    }
+
+    void createLogicalLinksForAllocatedResource(DelegateExecution execution,
+                                                String linkArrayStr, String serviceInstanceId,
+                                                String allottedResourceId) {
+
+        try {
+            List<String> linkStrList = jsonUtil.StringArrayToList(linkArrayStr)
+
+            for (String linkStr : linkStrList) {
+                String logicalLinkId = UUID.randomUUID().toString()
+                String epA = jsonUtil.getJsonValue(linkStr, "transportEndpointA")
+                String epB = jsonUtil.getJsonValue(linkStr, "transportEndpointB")
+                String modelInvariantId = execution.getVariable("modelInvariantUuid")
+                String modelVersionId = execution.getVariable("modelUuid")
+
+                org.onap.aai.domain.yang.LogicalLink resource = new org.onap.aai.domain.yang.LogicalLink()
+                resource.setLinkId(logicalLinkId)
+                resource.setLinkName(epA)
+                resource.setLinkName2(epB)
+                resource.setModelInvariantId(modelInvariantId)
+                resource.setModelVersionId(modelVersionId)
+
+                AAIResourceUri logicalLinkUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().logicalLink(logicalLinkId))
+                getAAIClient().create(logicalLinkUri, resource)
+            }
+        } catch (Exception ex) {
+            exceptionUtil.buildAndThrowWorkflowException(execution, 7000,
+                    "Exception in createLogicalLinksForAllocatedResource" + ex.getMessage())
+        }
+    }
+
+    void preprocessSdncAllocateTnNssiRequest(DelegateExecution execution) {
+        def method = getClass().getSimpleName() + '.preProcessSDNCActivateRequest(' +
+                'execution=' + execution.getId() +
+                ')'
+        def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+        logger.trace('Entered ' + method)
+
+        logger.trace("STARTED preProcessSDNCActivateRequest Process")
+        try {
+            String serviceInstanceId = execution.getVariable("sliceServiceInstanceId")
+
+            String createSDNCRequest = tnNssmfUtils.buildSDNCRequest(execution, serviceInstanceId, "create")
+
+            execution.setVariable("TNNSSMF_SDNCRequest", createSDNCRequest)
+            logger.debug("Outgoing SDNCRequest is: \n" + createSDNCRequest)
+
+        } catch (Exception e) {
+            logger.debug("Exception Occured Processing preProcessSDNCActivateRequest. Exception is:\n" + e)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 1002,
+                    "Error Occured during  preProcessSDNCActivateRequest Method:\n" + e.getMessage())
+        }
+        logger.trace("COMPLETED  preProcessSDNCActivateRequest Process")
+    }
+
+
+    void validateSDNCResponse(DelegateExecution execution, String response, String method) {
+        tnNssmfUtils.validateSDNCResponse(execution, response, method)
+    }
+}
index d5469c8..8eded75 100644 (file)
@@ -26,7 +26,9 @@ import org.onap.so.logger.LoggingAnchor
 import org.onap.so.client.HttpClientFactory
 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.aai.entities.uri.AAIUriFactory
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types
 import org.camunda.bpm.engine.delegate.BpmnError
 import org.camunda.bpm.engine.delegate.DelegateExecution
 import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
@@ -228,8 +230,8 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces
         String serviceType = execution.getVariable("serviceType")
         String serviceId = execution.getVariable("serviceId")
 
-        AAIResourceUri nsUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,globalSubscriberId,serviceType,nsInstanceId)
-        AAIResourceUri relatedServiceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,globalSubscriberId,serviceType,serviceId)
+        AAIResourceUri nsUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(serviceType).serviceInstance(nsInstanceId))
+        AAIResourceUri relatedServiceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(serviceType).serviceInstance(serviceId))
 
         try{
             getAAIClient().connect(nsUri,relatedServiceUri)
index 366cdfd..f19d064 100644 (file)
@@ -32,6 +32,14 @@ import org.json.JSONArray
 import org.json.JSONObject
 import org.onap.aai.domain.yang.GenericVnf
 import org.onap.aai.domain.yang.NetworkPolicy
+import org.onap.aaiclient.client.aai.AAIResourcesClient
+import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
+import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri
+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.aaiclient.client.graphinventory.entities.uri.Depth
 import org.onap.logging.filter.base.ErrorCode
 import org.onap.logging.filter.base.ONAPComponents;
 import org.onap.so.bpmn.common.scripts.AaiUtil
@@ -51,14 +59,6 @@ import org.onap.so.bpmn.core.json.DecomposeJsonUtil
 import org.onap.so.bpmn.core.json.JsonUtils
 import org.onap.so.client.HttpClient
 import org.onap.so.client.HttpClientFactory
-import org.onap.aaiclient.client.aai.AAIObjectPlurals
-import org.onap.aaiclient.client.aai.AAIObjectType;
-import org.onap.aaiclient.client.aai.AAIResourcesClient
-import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
-import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri
-import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
-import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
-import org.onap.aaiclient.client.graphinventory.entities.uri.Depth
 import org.onap.so.constants.Defaults
 import org.onap.so.db.catalog.beans.HomingInstance
 import org.onap.so.logger.LoggingAnchor
@@ -303,7 +303,7 @@ public class DoCreateVfModule extends VfModuleBase {
                                }
 
                                try{
-                                       AAIResourceUri serviceInstanceURI = AAIUriFactory.create(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId,serviceType,serviceInstanceId)
+                                       AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(serviceType).serviceInstance(serviceInstanceId))
                                        AAIResourcesClient aaiRC = new AAIResourcesClient()
                                        AAIResultWrapper aaiRW = aaiRC.get(serviceInstanceURI)
                                        Map<String, Object> aaiJson = aaiRW.asMap()
@@ -690,7 +690,7 @@ public class DoCreateVfModule extends VfModuleBase {
                        def vfModuleId = execution.getVariable('DCVFM_vfModuleId')
 
                        AaiUtil aaiUriUtil = new AaiUtil(this)
-                       AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId).depth(Depth.ONE)
+                       AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)).depth(Depth.ONE)
                        String endPoint = aaiUriUtil.createAaiUri(uri)
 
                        try {
@@ -774,7 +774,7 @@ public class DoCreateVfModule extends VfModuleBase {
                        def vfModuleName = execution.getVariable('DCVFM_vfModuleName')
 
                        AaiUtil aaiUriUtil = new AaiUtil(this)
-                       AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VF_MODULE, vnfId).queryParam("vf-module-name",vfModuleName)
+                       AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId).vfModules()).queryParam("vf-module-name",vfModuleName)
                        String endPoint = aaiUriUtil.createAaiUri(uri)
 
                        HttpClient client = httpClientFactory.newXmlClient(new URL(endPoint), ONAPComponents.AAI)
@@ -909,7 +909,7 @@ public class DoCreateVfModule extends VfModuleBase {
                        String serviceOperation = ""
                        if (element.equals("vnf")) {
                                AAIResourcesClient resourceClient = new AAIResourcesClient()
-                               AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, execution.getVariable('DCVFM_vnfId'))
+                               AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(execution.getVariable('DCVFM_vnfId')))
                                AAIResultWrapper wrapper = resourceClient.get(uri)
 
                                Optional<GenericVnf> vnf = wrapper.asBean(GenericVnf.class)
@@ -1792,7 +1792,7 @@ public class DoCreateVfModule extends VfModuleBase {
                        // Prepare AA&I url
                        AaiUtil aaiUtil = new AaiUtil(this)
 
-                       AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, Defaults.CLOUD_OWNER.toString(), cloudRegion)
+                       AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(Defaults.CLOUD_OWNER.toString(), cloudRegion))
                        def queryCloudRegionRequest = aaiUtil.createAaiUri(uri)
 
                        execution.setVariable("DCVFM_queryCloudRegionRequest", queryCloudRegionRequest)
@@ -1923,7 +1923,7 @@ public class DoCreateVfModule extends VfModuleBase {
                                        String fqdn = fqdnList[i]
 
                                        // Query AAI for this network policy FQDN
-                                       AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY)
+                                       AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().networkPolicies())
                                        uri.queryParam("network-policy-fqdn", fqdn)
 
                                        AAIResourcesClient resourceClient = new AAIResourcesClient()
@@ -1944,8 +1944,8 @@ public class DoCreateVfModule extends VfModuleBase {
                                                policy.setNetworkPolicyId(networkPolicyId)
                                                policy.setNetworkPolicyFqdn(fqdn)
                                                policy.setHeatStackId(execution.getVariable("DCVFM_heatStackId"))
-                                               
-                                               AAIResourceUri netUri = AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, networkPolicyId)
+
+                                               AAIResourceUri netUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().networkPolicy(networkPolicyId))
                                                resourceClient.create(netUri, policy)
 
                                                rollbackData.put("VFMODULE", "rollbackCreateNetworkPoliciesAAI", "true")
index b3c4698..4b495e3 100644 (file)
@@ -34,11 +34,12 @@ import org.onap.so.bpmn.common.scripts.MsoUtils
 import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils
 import org.onap.so.bpmn.core.UrnPropertiesReader
 import org.onap.so.bpmn.core.WorkflowException
-import org.onap.aaiclient.client.aai.AAIObjectPlurals
 import org.onap.aaiclient.client.aai.AAIObjectType
 import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri
 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.ErrorCode
 import org.onap.so.logger.MessageEnum
 import org.slf4j.Logger
@@ -507,7 +508,7 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{
 
                     try {
                         // Query AAI for this network policy FQDN
-                        AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY)
+                        AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().networkPolicies())
                         uri.queryParam("network-policy-fqdn", fqdn)
                         Optional<NetworkPolicies> networkPolicies = getAAIClient().get(NetworkPolicies.class, uri)
 
@@ -516,7 +517,7 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{
                             NetworkPolicy networkPolicy = networkPolicies.get().getNetworkPolicy().get(0)
 
                             try{
-                                AAIResourceUri delUri = AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, networkPolicy.getNetworkPolicyId())
+                                AAIResourceUri delUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().networkPolicy(networkPolicy.getNetworkPolicyId()))
                                 getAAIClient().delete(delUri)
                                 execution.setVariable(Prefix + "aaiDeleteNetworkPolicyReturnCode", 200)
                                 logger.debug("AAI delete network policy Response Code, NetworkPolicy #" + counting + " : " + 200)
index 80f6e0e..0e153b7 100644 (file)
 package org.onap.so.bpmn.infrastructure.scripts
 
 
+import javax.ws.rs.NotFoundException
 import org.camunda.bpm.engine.delegate.DelegateExecution
 import org.onap.aai.domain.yang.VolumeGroups
+import org.onap.aaiclient.client.aai.AAIObjectType
+import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri
+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.common.scripts.VidUtils
 import org.onap.so.bpmn.core.RollbackData
 import org.onap.so.bpmn.core.json.JsonUtils
-import org.onap.aaiclient.client.aai.AAIObjectPlurals
-import org.onap.aaiclient.client.aai.AAIObjectType
-import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri
-import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
-import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
 import org.onap.so.constants.Defaults
 import org.slf4j.Logger
 import org.slf4j.LoggerFactory
 
-import javax.ws.rs.NotFoundException
-
 public class DoCreateVfModuleVolumeRollback extends AbstractServiceTaskProcessor {
     private static final Logger logger = LoggerFactory.getLogger( DoCreateVfModuleVolumeRollback.class);
 
@@ -133,7 +133,7 @@ public class DoCreateVfModuleVolumeRollback extends AbstractServiceTaskProcessor
                        volumeGroupName = testVolumeGroupName
                }
 
-               AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VOLUME_GROUP, Defaults.CLOUD_OWNER.toString(), cloudRegion).queryParam("volume-group-name", volumeGroupName)
+               AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(Defaults.CLOUD_OWNER.toString(), cloudRegion).volumeGroups()).queryParam("volume-group-name", volumeGroupName)
                try {
                        Optional<VolumeGroups> volumeGroups = getAAIClient().get(VolumeGroups.class, uri)
                        if (volumeGroups.isPresent()) {
@@ -154,7 +154,7 @@ public class DoCreateVfModuleVolumeRollback extends AbstractServiceTaskProcessor
                String cloudRegion = execution.getVariable("DCVFMODVOLRBK_lcpCloudRegionId")
                String volumeGroupId = callRESTQueryAAIVolGrpName(execution, cloudRegion)
 
-               AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, Defaults.CLOUD_OWNER.toString(), cloudRegion, volumeGroupId)
+               AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(Defaults.CLOUD_OWNER.toString(), cloudRegion).volumeGroup(volumeGroupId))
                try {
                        getAAIClient().delete(uri)
                }catch(NotFoundException ignored){
index b1d909b..d65f144 100644 (file)
@@ -28,6 +28,12 @@ import org.camunda.bpm.engine.delegate.DelegateExecution
 import org.onap.aai.domain.yang.GenericVnf
 import org.onap.aai.domain.yang.VolumeGroup
 import org.onap.aai.domain.yang.VolumeGroups
+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.AaiUtil
 import org.onap.so.bpmn.common.scripts.ExceptionUtil
 import org.onap.so.bpmn.common.scripts.MsoUtils
@@ -36,11 +42,6 @@ import org.onap.so.bpmn.core.RollbackData
 import org.onap.so.bpmn.core.UrnPropertiesReader
 import org.onap.so.bpmn.core.WorkflowException
 import org.onap.so.bpmn.core.json.JsonUtils
-import org.onap.aaiclient.client.aai.AAIObjectPlurals
-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.so.constants.Defaults
 import org.onap.so.db.catalog.beans.OrchestrationStatus
 import org.slf4j.Logger
@@ -148,7 +149,7 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase {
             String serviceInstanceId = execution.getVariable('serviceInstanceId')
 
             AAIResourcesClient resourceClient = new AAIResourcesClient()
-            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId)
+            AAIResourceUri uri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId))
 
             if(!resourceClient.exists(uri)){
                 (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 2500, "Service instance was not found in aai")
@@ -174,7 +175,7 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase {
 
         AaiUtil aaiUtil = new AaiUtil(this)
 
-        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, Defaults.CLOUD_OWNER.toString(), cloudRegion)
+        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(Defaults.CLOUD_OWNER.toString(), cloudRegion))
         def queryCloudRegionRequest = aaiUtil.createAaiUri(uri)
 
         cloudRegion = aaiUtil.getAAICloudReqion(execution,  queryCloudRegionRequest, "PO", cloudRegion)
@@ -215,7 +216,7 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase {
         def cloudRegion = execution.getVariable('lcpCloudRegionId')
 
         try {
-            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VOLUME_GROUP, Defaults.CLOUD_OWNER.toString(), cloudRegion).queryParam("volume-group-name", volumeGroupName)
+            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(Defaults.CLOUD_OWNER.toString(), cloudRegion).volumeGroups()).queryParam("volume-group-name", volumeGroupName)
             Optional<VolumeGroups> volumeGroups = getAAIClient().get(VolumeGroups.class,uri)
             if(volumeGroups.isPresent()){
                 VolumeGroup volumeGroup = volumeGroups.get().getVolumeGroup().get(0);
@@ -292,9 +293,9 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase {
 
         logger.debug("volumeGroupId to be used: " + volumeGroupId)
 
-        AAIResourceUri volumeGroupUri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, cloudOwner, cloudRegion, volumeGroupId)
-        AAIResourceUri tenantUri = AAIUriFactory.createResourceUri(AAIObjectType.TENANT, cloudOwner, cloudRegion, tenantId)
-        AAIResourceUri vnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
+        AAIResourceUri volumeGroupUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(cloudOwner, cloudRegion).volumeGroup(volumeGroupId))
+        AAIResourceUri tenantUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(cloudOwner, cloudRegion).tenant(tenantId))
+        AAIResourceUri vnfUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId))
         try {
             getAAIClient().create(volumeGroupUri, volumeGroup)
             getAAIClient().connect(volumeGroupUri, vnfUri)
@@ -504,7 +505,7 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase {
         String cloudOwner = execution.getVariable('cloudOwner')
         String createVnfAResponse = execution.getVariable(prefix+"createVnfAResponse")
         def heatStackID = utils.getNodeText(createVnfAResponse, "volumeGroupStackId")
-        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, cloudOwner, cloudRegion, volumeGroupId)
+        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(cloudOwner, cloudRegion).volumeGroup(volumeGroupId))
 
         execution.setVariable(prefix+"heatStackId", heatStackID)
 
@@ -534,7 +535,7 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase {
     public void callRESTQueryAAIGenericVnf(DelegateExecution execution, isDebugEnabled) {
 
         def vnfId = execution.getVariable('vnfId')
-        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
+        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId))
         try {
             Optional<GenericVnf> genericVnf = getAAIClient().get(GenericVnf.class, uri)
             if (genericVnf.isPresent()) {
index 488f2d8..1bb5ad1 100644 (file)
@@ -30,6 +30,7 @@ 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.logging.filter.base.ErrorCode
 import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
 import org.onap.so.bpmn.common.scripts.ExceptionUtil
@@ -109,7 +110,7 @@ class DoCreateVnf extends AbstractServiceTaskProcessor {
                        String vnfName = execution.getVariable("vnfName")
                        if (vnfName.equals("") || vnfName.equals("null")) {
                                AAIResourcesClient resourceClient = new AAIResourcesClient()
-                               AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, execution.getVariable("vnfId"))
+                               AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(execution.getVariable("vnfId")))
                                if(resourceClient.exists(uri)){
                                        exceptionUtil.buildWorkflowException(execution, 5000, "Generic Vnf Already Exist.")
                                }
@@ -281,7 +282,7 @@ class DoCreateVnf extends AbstractServiceTaskProcessor {
                        String serviceInstanceId = execution.getVariable('DoCVNF_serviceInstanceId')
 
                        AAIResourcesClient resourceClient = new AAIResourcesClient()
-                       AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId)
+                       AAIResourceUri uri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId))
 
                        if(resourceClient.exists(uri)){
                                Map<String, String> keys = uri.getURIKeys()
@@ -355,10 +356,10 @@ class DoCreateVnf extends AbstractServiceTaskProcessor {
                        payload.put("nf-naming-code", nfNamingCode);
 
                        AAIResourcesClient resourceClient = new AAIResourcesClient();
-                       AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
+                       AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId))
                        resourceClient.create(uri, payload)
 
-                       AAIResourceUri siUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalCustId, serviceType, serviceInstanceId)
+                       AAIResourceUri siUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalCustId).serviceSubscription(serviceType).serviceInstance(serviceInstanceId))
                        resourceClient.connect(uri, siUri)
 
                }catch(Exception ex) {
index 76629dd..4a55550 100644 (file)
@@ -52,6 +52,8 @@ import org.w3c.dom.NodeList
 import org.xml.sax.InputSource
 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.aaiclient.client.aai.AAIObjectType
 import org.onap.aaiclient.client.aai.AAIResourcesClient
 
@@ -453,7 +455,7 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess
                        String serviceInstanceId = execution.getVariable("serviceInstanceId")
 
                        AAIResourcesClient resourceClient = new AAIResourcesClient()
-                       AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalCustId, serviceType, serviceInstanceId)
+                       AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalCustId).serviceSubscription(serviceType).serviceInstance(serviceInstanceId))
                        resourceClient.delete(serviceInstanceUri)
 
                        logger.trace("Exited deleteServiceInstance")
index 53a98c2..b9a3eab 100644 (file)
  */
 package org.onap.so.bpmn.infrastructure.scripts
 
-import org.onap.so.logger.LoggingAnchor
-import org.onap.aai.domain.yang.AllottedResource
-import org.onap.logging.filter.base.ErrorCode
-
-import javax.ws.rs.core.UriBuilder
-
 import static org.apache.commons.lang3.StringUtils.*;
-
+import javax.ws.rs.NotFoundException
+import javax.ws.rs.core.UriBuilder
 import org.apache.commons.lang3.*
 import org.camunda.bpm.engine.delegate.BpmnError
 import org.camunda.bpm.engine.delegate.DelegateExecution
 import org.json.JSONArray
+import org.json.JSONObject
+import org.onap.aai.domain.yang.AllottedResource
+import org.onap.aaiclient.client.aai.AAIResourcesClient
+import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
+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.ErrorCode
 import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
 import org.onap.so.bpmn.common.scripts.ExceptionUtil
 import org.onap.so.bpmn.common.scripts.MsoUtils
-import org.onap.so.bpmn.core.json.JsonUtils
 import org.onap.so.bpmn.core.UrnPropertiesReader
+import org.onap.so.bpmn.core.json.JsonUtils
+import org.onap.so.logger.LoggingAnchor
 import org.onap.so.logger.MessageEnum
 import org.slf4j.Logger
 import org.slf4j.LoggerFactory
-
 import org.springframework.web.util.UriUtils;
-import org.onap.aaiclient.client.aai.AAIResourcesClient
-import org.onap.aaiclient.client.aai.AAIObjectType
-import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
-import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
-import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
-import org.json.JSONObject
-import javax.ws.rs.NotFoundException
 import groovy.json.*
 
 
@@ -174,7 +171,7 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce
                        String serviceType = execution.getVariable('serviceType')
 
                        AAIResourcesClient resourceClient = new AAIResourcesClient()
-                       AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId, serviceType, serviceInstanceId)
+                       AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(serviceType).serviceInstance(serviceInstanceId))
                        AAIResultWrapper wrapper = resourceClient.get(serviceInstanceUri, NotFoundException.class)
                        String json = wrapper.getJson()
 
@@ -582,7 +579,7 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce
        private Optional<AllottedResource>  getAaiAr(DelegateExecution execution, String relink) {
                def method = getClass().getSimpleName() + '.getAaiAr(' +'execution=' + execution.getId() +')'
                logger.info("Entered " + method)
-               AAIResourceUri uri = AAIUriFactory.createResourceFromExistingURI(AAIObjectType.ALLOTTED_RESOURCE, UriBuilder.fromPath(relink).build())
+               AAIResourceUri uri = AAIUriFactory.createResourceFromExistingURI(Types.ALLOTTED_RESOURCE, UriBuilder.fromPath(relink).build())
         return getAAIClient().get(AllottedResource.class,uri)
        }
        /**
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeAllocateAccessNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeAllocateAccessNSSI.groovy
new file mode 100644 (file)
index 0000000..10a5594
--- /dev/null
@@ -0,0 +1,555 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Wipro Limited. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.scripts
+
+import static org.apache.commons.lang3.StringUtils.isBlank
+
+import javax.ws.rs.NotFoundException
+import javax.ws.rs.core.Response
+
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.onap.aai.domain.yang.*
+import org.onap.aaiclient.client.aai.AAIObjectType
+import org.onap.aaiclient.client.aai.AAIResourcesClient
+import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
+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.beans.nsmf.DeAllocateNssi
+import org.onap.so.beans.nsmf.EsrInfo
+import org.onap.so.beans.nsmf.ServiceInfo
+import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
+import org.onap.so.bpmn.common.scripts.ExceptionUtil
+import org.onap.so.bpmn.common.scripts.NssmfAdapterUtils
+import org.onap.so.bpmn.common.scripts.OofUtils
+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.client.HttpClientFactory
+import org.onap.so.client.oof.adapter.beans.payload.OofRequest
+import org.onap.so.db.request.beans.ResourceOperationStatus
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+
+import com.fasterxml.jackson.databind.ObjectMapper
+import com.google.gson.JsonObject
+
+
+/**
+ * Internal AN NSSMF to handle NSSI Deallocation
+ */
+class DoDeAllocateAccessNSSI extends AbstractServiceTaskProcessor {
+
+       String Prefix="DoDeAllocateAccessNSSI"
+       ExceptionUtil exceptionUtil = new ExceptionUtil()
+       RequestDBUtil requestDBUtil = new RequestDBUtil()
+       JsonUtils jsonUtil = new JsonUtils()
+       OofUtils oofUtils = new OofUtils()
+       ObjectMapper objectMapper = new ObjectMapper()
+       private NssmfAdapterUtils nssmfAdapterUtils = new NssmfAdapterUtils(httpClientFactory, jsonUtil)
+       
+       private static final Logger logger = LoggerFactory.getLogger(DoDeAllocateAccessNSSI.class)
+       private static final String ROLE_SLICE_PROFILE = "slice-profile-instance"
+       private static final String ROLE_NSSI = "nssi"
+
+       private static final String AN_NF = "AN-NF"
+       private static final String TN_FH = "TN-FH"
+       private static final String TN_MH = "TN-MH"
+
+       @Override
+       public void preProcessRequest(DelegateExecution execution) {
+               logger.debug("${Prefix} - Start preProcessRequest")
+
+               String sliceParams = execution.getVariable("sliceParams")
+               String sNssaiList = jsonUtil.getJsonValue(sliceParams, "snssaiList")
+               String anSliceProfileId = jsonUtil.getJsonValue(sliceParams, "sliceProfileId")
+               String nsiId = jsonUtil.getJsonValue(sliceParams, "nsiId")
+               String globalSubscriberId = execution.getVariable("globalSubscriberId")
+               String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
+               String anNssiId = execution.getVariable("serviceInstanceID")
+
+               if(isBlank(sNssaiList) || isBlank(anSliceProfileId) || isBlank(nsiId)) {
+                       String msg = "Input fields cannot be null : Mandatory attributes : [snssaiList, sliceProfileId, nsiId]"
+                       logger.debug(msg)
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+               }
+
+               if( isBlank(anNssiId) || isBlank(globalSubscriberId) || isBlank(subscriptionServiceType)) {
+                       String msg = "Missing Input fields from main process : [serviceInstanceID, globalSubscriberId, subscriptionServiceType]"
+                       logger.debug(msg)
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+               }
+
+               execution.setVariable("sNssaiList", sNssaiList)
+               execution.setVariable("anSliceProfileId", anSliceProfileId)
+               execution.setVariable("nsiId", nsiId)
+               execution.setVariable("anNssiId", anNssiId)
+
+               logger.debug("${Prefix} - Preprocessing completed with sliceProfileId : ${anSliceProfileId} , nsiId : ${nsiId} , nssiId : ${anNssiId}")
+       }
+
+       /**
+        * Method to fetch AN NSSI Constituents and Slice Profile constituents
+        * @param execution
+        */
+       void getRelatedInstances(DelegateExecution execution) {
+               logger.debug("${Prefix} - Get Related Instances")
+               String anSliceProfileId = execution.getVariable("anSliceProfileId")
+               String anNssiId = execution.getVariable("anNssiId")
+
+               Map<String,ServiceInstance> relatedSPs = new HashMap<>()
+               execution.setVariable("relatedSPs", getRelatedInstancesByRole(execution, ROLE_SLICE_PROFILE, anSliceProfileId))
+               execution.setVariable("anNfSliceProfileId", getInstanceIdByWorkloadContext(execution.getVariable("relatedSPs"), AN_NF))
+
+               Map<String,ServiceInstance> relatedNssis = new HashMap<>()
+               execution.setVariable("relatedNssis", getRelatedInstancesByRole(execution, ROLE_NSSI, anNssiId))
+       }
+       
+
+       /**
+        * @param execution
+        */
+       void prepareOOFAnNssiTerminationRequest(DelegateExecution execution) {
+               logger.debug("Start prepareOOFTerminationRequest")
+        String requestId = execution.getVariable("msoRequestId")
+               String messageType = "AN_NSSITermination"
+               String timeout = UrnPropertiesReader.getVariable("mso.adapters.oof.timeout", execution);
+               String serviceInstanceId = execution.getVariable("nsiId")
+               String anNssiId = execution.getVariable("anNssiId")
+        String oofRequest = oofUtils.buildTerminateNxiRequest(requestId,anNssiId, ROLE_NSSI,messageType,serviceInstanceId)
+        OofRequest oofPayload = new OofRequest()
+               oofPayload.setApiPath("/api/oof/terminate/nxi/v1")
+               oofPayload.setRequestDetails(oofRequest)
+               execution.setVariable("oofAnNssiPayload", oofPayload)
+        logger.debug("Finish prepareOOFTerminationRequest")
+
+       }
+       
+       void performOofAnNSSITerminationCall(DelegateExecution execution) {
+               boolean terminateAnNSSI = callOofAdapter(execution,execution.getVariable("oofAnNssiPayload"))
+               execution.setVariable("terminateAnNSSI", terminateAnNSSI)
+       }
+       
+       /**
+        * @param execution
+        */
+       void prepareOOFAnNfNssiTerminationRequest(DelegateExecution execution) {
+               logger.debug("Start prepareOOFAnNfNssiTerminationRequest")
+               String requestId = execution.getVariable("msoRequestId")
+               String messageType = "AN_NF_NSSITermination"
+               String timeout = UrnPropertiesReader.getVariable("mso.adapters.oof.timeout", execution);
+               String serviceInstanceId = execution.getVariable("anNssiId")
+
+               String anNfNssiId = getInstanceIdByWorkloadContext(execution.getVariable("relatedNssis"),AN_NF)
+               execution.setVariable("anNfNssiId", anNfNssiId)
+
+               String oofRequest = oofUtils.buildTerminateNxiRequest(requestId,anNfNssiId, ROLE_NSSI,messageType,serviceInstanceId)
+               OofRequest oofPayload = new OofRequest()
+               oofPayload.setApiPath("/api/oof/terminate/nxi/v1")
+               oofPayload.setRequestDetails(oofRequest)
+               execution.setVariable("oofAnNfNssiPayload", oofPayload)
+               logger.debug("Finish prepareOOFAnNfNssiTerminationRequest")
+
+       }
+
+       void performOofAnNfNSSITerminationCall(DelegateExecution execution) {
+               boolean terminateAnNfNSSI = callOofAdapter(execution,execution.getVariable("oofAnNfNssiPayload"))
+               execution.setVariable("terminateAnNfNSSI", terminateAnNfNSSI)
+               if(!terminateAnNfNSSI) {
+                       execution.setVariable("modifyAction",true)
+               }
+       }
+       
+       void prepareSdnrRequest(DelegateExecution execution) {
+
+               String anNfNssiId = execution.getVariable("anNfNssiId")
+               String sNssai = execution.getVariable("sNssaiList")
+               String reqId = execution.getVariable("msoRequestId")
+               String messageType = "SDNRTerminateResponse"
+               StringBuilder callbackURL = new StringBuilder(UrnPropertiesReader.getVariable("mso.workflow.message.endpoint", execution))
+               callbackURL.append("/").append(messageType).append("/").append(reqId)
+
+               JsonObject input = new JsonObject()
+               input.addProperty("RANNFNSSIId", anNfNssiId)
+               input.addProperty("callbackURL", callbackURL.toString())
+               input.addProperty("s-NSSAI", sNssai)
+
+               JsonObject Payload = new JsonObject()
+               Payload.addProperty("version", "1.0")
+               Payload.addProperty("rpc-name", "TerminateRANSlice")
+               Payload.addProperty("correlation-id", reqId)
+               Payload.addProperty("type", "request")
+
+               JsonObject wrapinput = new JsonObject()
+               wrapinput.addProperty("Action", "deallocate")
+
+               JsonObject CommonHeader = new JsonObject()
+               CommonHeader.addProperty("TimeStamp", new Date(System.currentTimeMillis()).format("yyyy-MM-ddTHH:mm:ss.sss", TimeZone.getDefault()))
+               CommonHeader.addProperty("APIver", "1.0")
+               CommonHeader.addProperty("RequestID", reqId)
+               CommonHeader.addProperty("SubRequestID", "1")
+
+               JsonObject body = new JsonObject()
+               body.add("input", wrapinput)
+
+               JsonObject sdnrRequest = new JsonObject()
+               Payload.add("input", input)
+               wrapinput.add("Payload", Payload)
+               wrapinput.add("CommonHeader", CommonHeader)
+               body.add("input", wrapinput)
+               sdnrRequest.add("body", body)
+
+               String json = sdnrRequest.toString()
+               execution.setVariable("sdnrRequest", sdnrRequest)
+               execution.setVariable("SDNR_messageType", messageType)
+               execution.setVariable("SDNR_timeout", "PT10M")
+
+       }
+       
+       void processSdnrResponse(DelegateExecution execution) {
+               logger.debug("${Prefix} processing SdnrResponse")
+               Map<String, Object> resMap = objectMapper.readValue(execution.getVariable("SDNR_Response"),Map.class)
+               String status = resMap.get("status")
+               String reason = resMap.get("reason")
+               if("success".equalsIgnoreCase(status)) {
+                       execution.setVariable("isAnNfTerminated", true)
+               }else {
+                       execution.setVariable("isAnNfTerminated", false)
+                       logger.debug("AN NF Termination failed with reason ${reason}")
+               }
+               logger.debug("${Prefix} processed SdnrResponse")
+       }
+       
+       /**
+        * @param execution
+        * @param oofRequest - Request payload to be sent to adapter
+        * @return
+        */
+       boolean callOofAdapter(DelegateExecution execution, OofRequest oofRequest) {
+               logger.debug("Start callOofAdapter")
+               String requestId = execution.getVariable("msoRequestId")
+               String oofAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.oof.endpoint", execution)
+               URL requestUrl = new URL(oofAdapterEndpoint)
+               logger.debug("Calling OOF adapter  : ${requestUrl} with payload : ${oofRequest}")
+               HttpClient httpClient = new HttpClientFactory().newJsonClient(requestUrl, ONAPComponents.EXTERNAL)
+               Response httpResponse = httpClient.post(oofRequest)
+               int responseCode = httpResponse.getStatus()
+               logger.debug("OOF sync response code is: " + responseCode)
+               if(responseCode != 200){
+                       logger.debug("OOF request failed with reason : " + httpResponse)
+                       exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Sync Response from OOF.")
+               }else {
+                       Map<String,Object> response = objectMapper.readValue(httpResponse.getEntity(),Map.class)
+                       boolean terminateResponse =  response.get("terminateResponse")
+                       if(!terminateResponse) {
+                               logger.debug("Terminate response is false because " + response.get("reason"))
+                       }
+                       return terminateResponse
+               }
+       }
+       
+       void deallocateAnNfNssi(DelegateExecution execution) {
+               logger.debug("${Prefix} - call deallocateAnNfNssi ")
+               String anNfNssiId = getInstanceIdByWorkloadContext(execution.getVariable("relatedNssis"), AN_NF)
+               String globalSubscriberId = execution.getVariable("globalSubscriberId")
+               String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
+
+               AAIResourcesClient client = new AAIResourcesClient()
+               AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(anNfNssiId))
+               if (!client.exists(uri)) {
+                       logger.debug("AN NF Service Instance was not found in aai : ${anNfNssiId}")
+               }else {
+                       client.delete(uri)
+               }
+       }
+       
+       /**
+        * Removes relationship between AN NSSI and AN_NF NSSI
+        * @param execution
+        */
+       void dissociateAnNfNssi(DelegateExecution execution) {
+               logger.debug("${Prefix} - call dissociateAnNfNssi ")
+               String anNfNssiId = getInstanceIdByWorkloadContext(execution.getVariable("relatedNssis"), AN_NF)
+               String globalSubscriberId = execution.getVariable("globalSubscriberId")
+               String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
+
+               AAIResourcesClient client = new AAIResourcesClient()
+               AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(anNfNssiId))
+               if (!client.exists(uri)) {
+                       logger.debug("AN NF Service Instance was not found in aai : ${anNfNssiId}")
+               }else {
+                       client.delete(uri)
+               }
+       }
+       
+       /**
+        * Method to prepare request for AN NSSI modification
+        * Call Modify AN NSSI in case OOF sends Terminate NSSI=False
+        * @param execution
+        */
+       void preparejobForANNSSIModification(DelegateExecution execution) {
+
+               String modificationJobId = UUID.randomUUID().toString()
+               execution.setVariable("modificationJobId", modificationJobId)
+
+               Map<String,Object> sliceParams = objectMapper.readValue(execution.getVariable("sliceParams"), Map.class)
+               sliceParams.put("modifyAction", "deallocate")
+               execution.setVariable("modificationsliceParams", sliceParams)
+
+               String serviceId = execution.getVariable("serviceInstanceId")
+               String nsiId = execution.getVariable("nsiId")
+               logger.debug("Generated new job for Service Instance serviceId:" + serviceId + " operationId:" + modificationJobId)
+
+               ResourceOperationStatus initStatus = new ResourceOperationStatus()
+               initStatus.setServiceId(serviceId)
+               initStatus.setOperationId(modificationJobId)
+               initStatus.setResourceTemplateUUID(nsiId)
+               initStatus.setOperType("Modify-Deallocate")
+               requestDBUtil.prepareInitResourceOperationStatus(execution, initStatus)
+
+               logger.debug(Prefix + "prepareInitOperationStatus Exit")
+       }
+
+       void prepareQueryJobStatus(DelegateExecution execution,String jobId,String networkType,String instanceId) {
+
+               String responseId = "1"
+               String globalSubscriberId = execution.getVariable("globalSubscriberId")
+               String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
+
+               EsrInfo esrInfo = new EsrInfo()
+               esrInfo.setNetworkType(networkType)
+               esrInfo.setVendor("ONAP")
+
+               ServiceInfo serviceInfo = new ServiceInfo()
+               serviceInfo.setNssiId(instanceId)
+               serviceInfo.setNsiId(execution.getVariable("nsiId"))
+               serviceInfo.setGlobalSubscriberId(globalSubscriberId)
+               serviceInfo.setSubscriptionServiceType(subscriptionServiceType)
+
+               execution.setVariable("${networkType}_esrInfo", esrInfo)
+               execution.setVariable("${networkType}_responseId", responseId)
+               execution.setVariable("${networkType}_serviceInfo", serviceInfo)
+
+       }
+
+       void validateJobStatus(DelegateExecution execution,String responseDescriptor) {
+               logger.debug("validateJobStatus ${responseDescriptor}")
+               String status = jsonUtil.getJsonValue(responseDescriptor, "responseDescriptor.status")
+               String statusDescription = jsonUtil.getJsonValue(responseDescriptor, "responseDescriptor.statusDescription")
+               if("finished".equalsIgnoreCase(status)) {
+                       execution.setVariable("isSuccess", true)
+               }else {
+                       execution.setVariable("isSuccess", false)
+               }
+       }
+       
+       void prepareUpdateJobStatus(DelegateExecution execution,String status,String progress,String statusDescription) {
+               String serviceId = execution.getVariable("anNssiId")
+               String jobId = execution.getVariable("jobId")
+               String nsiId = execution.getVariable("nsiId")
+
+               ResourceOperationStatus roStatus = new ResourceOperationStatus()
+               roStatus.setServiceId(serviceId)
+               roStatus.setOperationId(jobId)
+               roStatus.setResourceTemplateUUID(nsiId)
+               roStatus.setOperType("DeAllocate")
+               roStatus.setProgress(progress)
+               roStatus.setStatus(status)
+               roStatus.setStatusDescription(statusDescription)
+               requestDBUtil.prepareUpdateResourceOperationStatus(execution, status)
+       }
+       
+       void terminateTNFHNssi(DelegateExecution execution) {
+               logger.debug("Start terminateTNFHNssi in ${Prefix}")
+               String nssmfRequest = buildDeallocateNssiRequest(execution, TN_FH)
+               String nssiId = getInstanceIdByWorkloadContext(execution.getVariable("relatedNssis"), TN_FH)
+               execution.setVariable("tnFHNSSIId", nssiId)
+               String urlString = "/api/rest/provMns/v1/NSS/nssi/" + nssiId
+                               String nssmfResponse = nssmfAdapterUtils.sendPostRequestNSSMF(execution, urlString, nssmfRequest)
+                               if (nssmfResponse != null) {
+                                       String jobId = jsonUtil.getJsonValue(nssmfResponse, "jobId")
+                                       execution.setVariable("TN_FH_jobId",jobId)
+                               } else {
+                                       logger.error("received error message from NSSMF : "+ nssmfResponse)
+                                       exceptionUtil.buildAndThrowWorkflowException(execution, 7000,"Received a Bad Sync Response from NSSMF.")
+                               }
+                               logger.debug("Exit terminateTNFHNssi in ${Prefix}")
+       }
+       
+       void terminateTNMHNssi(DelegateExecution execution) {
+               logger.debug("Start terminateTNMHNssi in ${Prefix}")
+               String nssmfRequest = buildDeallocateNssiRequest(execution, TN_MH)
+               String nssiId = getInstanceIdByWorkloadContext(execution.getVariable("relatedNssis"), TN_MH)
+               execution.setVariable("tnMHNSSIId", nssiId)
+               String urlString = "/api/rest/provMns/v1/NSS/nssi/" + nssiId
+                               String nssmfResponse = nssmfAdapterUtils.sendPostRequestNSSMF(execution, urlString, nssmfRequest)
+                               if (nssmfResponse != null) {
+                                       String jobId = jsonUtil.getJsonValue(nssmfResponse, "jobId")
+                                       execution.setVariable("TN_MH_jobId",jobId)
+                               } else {
+                                       logger.error("received error message from NSSMF : "+ nssmfResponse)
+                                       exceptionUtil.buildAndThrowWorkflowException(execution, 7000,"Received a Bad Sync Response from NSSMF.")
+                               }
+                               logger.debug("Exit terminateTNMHNssi in ${Prefix}")
+       }
+       
+       void deleteRanNfSliceProfileInAAI(DelegateExecution execution) {
+               logger.debug("${Prefix} delete Ran NF SliceProfile In AAI")
+               String spId = execution.getVariable("anNfSliceProfileId")
+               deleteServiceInstanceInAAI(execution, spId)
+       }
+       
+       void deleteTNSliceProfileInAAI(DelegateExecution execution) {
+               logger.debug("${Prefix} delete TN FH SliceProfile In AAI")
+               String fhSP = getInstanceIdByWorkloadContext(execution.getVariable("relatedSPs"), TN_FH)
+               deleteServiceInstanceInAAI(execution, fhSP)
+               logger.debug("${Prefix} delete TN MH SliceProfile In AAI")
+               String mhSP = getInstanceIdByWorkloadContext(execution.getVariable("relatedSPs"), TN_MH)
+               deleteServiceInstanceInAAI(execution, mhSP)
+       }
+       
+       void deleteANNSSI(DelegateExecution execution) {
+               logger.debug("${Prefix} delete AN NSSI")
+               String nssiId = execution.getVariable("serviceInstanceID")
+               deleteServiceInstanceInAAI(execution, nssiId)
+       }
+       
+       /**
+        * Fetches a collection of service instances with the specific role and maps it based on workload context
+        * (AN-NF,TN-FH,TN-MH)
+        * @param execution
+        * @param role                  - nssi/slice profile instance
+        * @param instanceId    - id to which the related list to be found
+        * @return
+        */
+       private Map<String,ServiceInstance> getRelatedInstancesByRole(DelegateExecution execution,String role,String instanceId) {
+               logger.debug("${Prefix} - Fetching related ${role} from AAI")
+               String globalSubscriberId = execution.getVariable("globalSubscriberId")
+               String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
+
+               if( isBlank(role) || isBlank(instanceId)) {
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Role and instanceId are mandatory")
+               }
+
+               Map<String,ServiceInstance> relatedInstances = new HashMap<>()
+
+               AAIResourcesClient client = getAAIClient()
+               AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(instanceId))
+               if (!client.exists(uri)) {
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service Instance was not found in aai : ${instanceId}")
+               }
+               AAIResultWrapper wrapper = client.get(uri, NotFoundException.class)
+               Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class)
+               if(si.isPresent()) {
+               List<Relationship> relationshipList = si.get().getRelationshipList().getRelationship()
+               for (Relationship relationship : relationshipList) {
+                       String relatedTo = relationship.getRelatedTo()
+                       if (relatedTo.toLowerCase() == "service-instance") {
+                               String relatioshipurl = relationship.getRelatedLink()
+                               String serviceInstanceId =
+                                               relatioshipurl.substring(relatioshipurl.lastIndexOf("/") + 1, relatioshipurl.length())
+                               uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(serviceInstanceId))
+                               if (!client.exists(uri)) {
+                                       exceptionUtil.buildAndThrowWorkflowException(execution, 2500,
+                                                       "Service Instance was not found in aai: ${serviceInstanceId} related to ${instanceId}")
+                               }
+                               AAIResultWrapper wrapper01 = client.get(uri, NotFoundException.class)
+                               Optional<ServiceInstance> serviceInstance = wrapper01.asBean(ServiceInstance.class)
+                               if (serviceInstance.isPresent()) {
+                                       ServiceInstance instance = serviceInstance.get()
+                                       if (role.equalsIgnoreCase(instance.getServiceRole())) {
+                                               relatedInstances.put(instance.getWorkloadContext(),instance)
+                                       }
+                               }
+                       }
+               }
+               }
+               logger.debug("Found ${relatedInstances.size()} ${role} related to ${instanceId} ")
+               return relatedInstances
+       }
+       
+       private String getInstanceIdByWorkloadContext(Map<String,ServiceInstance> instances,String workloadContext ) {
+               String instanceId = instances.get(workloadContext).getServiceInstanceId()
+               if(instanceId == null) {
+                       throw new BpmnError( 2500, "${workloadContext} NSSI ID is not found.")
+               }
+               return instanceId
+       }
+       
+       /**
+        * Method to handle deallocation of RAN NSSI constituents(TN_FH/TN_MH)
+        * @param execution
+        * @param serviceFunction - TN_FH/TN_MH
+        * @return
+        */
+       private String buildDeallocateNssiRequest(DelegateExecution execution,String serviceFunction) {
+               String globalSubscriberId = execution.getVariable("globalSubscriberId")
+               String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
+               Map<String, ServiceInstance> relatedNssis = execution.getVariable("relatedNssis")
+
+               String anNssiId = execution.getVariable("anNssiId")
+               List<String> sNssaiList =  execution.getVariable("sNssaiList")
+
+               Map<String, ServiceInstance> relatedSPs = execution.getVariable("relatedSPs")
+
+               DeAllocateNssi deallocateNssi = new DeAllocateNssi()
+               deallocateNssi.setNsiId(anNssiId)
+               ServiceInstance tnNssi = relatedNssis.get(serviceFunction)
+               String nssiId = tnNssi.getServiceInstanceId()
+
+               deallocateNssi.setNssiId(nssiId)
+               deallocateNssi.setScriptName(tnNssi.getServiceInstanceName())
+               deallocateNssi.setSnssaiList(sNssaiList)
+               deallocateNssi.setSliceProfileId(relatedSPs.get(serviceFunction).getServiceInstanceId())
+
+               EsrInfo esrInfo = new EsrInfo()
+               esrInfo.setVendor("ONAP")
+               esrInfo.setNetworkType("TN")
+
+               ServiceInfo serviceInfo = new ServiceInfo()
+               serviceInfo.setServiceInvariantUuid(tnNssi.getModelInvariantId())
+               serviceInfo.setServiceUuid(tnNssi.getModelVersionId())
+               serviceInfo.setGlobalSubscriberId(globalSubscriberId)
+               serviceInfo.setSubscriptionServiceType(subscriptionServiceType)
+
+               JsonObject json = new JsonObject()
+               json.addProperty("deAllocateNssi", objectMapper.writeValueAsString(deallocateNssi))
+               json.addProperty("esrInfo", objectMapper.writeValueAsString(esrInfo))
+               json.addProperty("serviceInfo", objectMapper.writeValueAsString(serviceInfo))
+               return json.toString()
+               
+       }
+       
+       private void deleteServiceInstanceInAAI(DelegateExecution execution,String instanceId) {
+               try {
+                       AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("serviceType")).serviceInstance(instanceId))
+                       getAAIClient().delete(serviceInstanceUri)
+                       logger.debug("${Prefix} Exited deleteServiceInstance")
+               }catch(Exception e){
+                       logger.debug("Error occured within deleteServiceInstance method: " + e)
+               }
+       }
+
+}
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
new file mode 100644 (file)
index 0000000..c94e2dd
--- /dev/null
@@ -0,0 +1,403 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020  Telecom Italia
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.scripts
+
+import 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.aaiclient.client.aai.AAIResourcesClient
+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.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
+
+import javax.ws.rs.core.Response
+
+class DoDeallocateCoreNSSI extends DoCommonCoreNSSI {
+    private final String PREFIX ="DoDeallocateCoreNSSI"
+
+    private ExceptionUtil exceptionUtil = new ExceptionUtil()
+    private RequestDBUtil requestDBUtil = new RequestDBUtil()
+    private MsoUtils utils = new MsoUtils()
+    private JsonUtils jsonUtil = new JsonUtils()
+
+    private static final Logger LOGGER = LoggerFactory.getLogger( DoDeallocateCoreNSSI.class)
+
+/**
+     * Queries OOF for NSSI termination
+     * @param execution
+     */
+    void executeTerminateNSSIQuery(DelegateExecution execution) {
+        LOGGER.trace("${PREFIX} Start executeTerminateNSSIQuery")
+
+        String urlString = UrnPropertiesReader.getVariable("mso.oof.endpoint", execution)
+
+        //Prepare auth for OOF
+        def authHeader = ""
+        String basicAuth = UrnPropertiesReader.getVariable("mso.oof.auth", execution)
+        String msokey = UrnPropertiesReader.getVariable("mso.msoKey", execution)
+
+        String basicAuthValue = encryptBasicAuth(basicAuth, msokey)
+        if (basicAuthValue != null) {
+            String responseAuthHeader = getAuthHeader(execution, basicAuthValue, msokey)
+            String errorCode = jsonUtil.getJsonValue(responseAuthHeader, "errorCode")
+            if(errorCode == null || errorCode.isEmpty()) { // No error
+                authHeader = responseAuthHeader
+            }
+            else {
+                exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(errorCode), jsonUtil.getJsonValue(responseAuthHeader, "errorMessage"))
+            }
+        } else {
+            LOGGER.error( "Unable to obtain BasicAuth - BasicAuth value null")
+            exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Internal Error - BasicAuth " +
+                    "value null")
+        }
+
+        //Prepare send request to OOF
+        String oofRequest = buildOOFRequest(execution)
+
+        String callOOFResponse = callOOF(urlString, authHeader, oofRequest)
+        String errorCode = jsonUtil.getJsonValue(callOOFResponse, "errorCode")
+        if(errorCode == null || errorCode.isEmpty()) { // No error
+            String oofResponse = callOOFResponse
+            String isTerminateNSSI = jsonUtil.getJsonValue(oofResponse, "terminateResponse")
+
+            execution.setVariable("isTerminateNSSI", Boolean.parseBoolean(isTerminateNSSI))
+        }
+        else {
+            LOGGER.error(jsonUtil.getJsonValue(callOOFResponse, "errorMessage"))
+            exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(errorCode), jsonUtil.getJsonValue(callOOFResponse, "errorMessage"))
+        }
+
+
+        LOGGER.trace("${PREFIX} Exit executeTerminateNSSIQuery")
+    }
+
+
+    /**
+     * Executes sync call to OOF
+     * @return OOF response
+     */
+    String callOOF(String urlString, String authHeader, String oofRequest) {
+        String errorCode = ""
+        String errorMessage = ""
+        String response = ""
+
+        try {
+            URL url = new URL(urlString + "/api/oof/terminate/nxi/v1")
+            HttpClient httpClient = new HttpClientFactory().newJsonClient(url, ONAPComponents.OOF)
+            httpClient.addAdditionalHeader("Authorization", authHeader)
+            httpClient.addAdditionalHeader("Accept", "application/json")
+            httpClient.addAdditionalHeader("Content-Type", "application/json")
+
+            Response httpResponse = httpClient.post(oofRequest)
+
+            int responseCode = httpResponse.getStatus()
+            LOGGER.debug("OOF sync response code is: " + responseCode)
+
+            if (responseCode != 202) { // Accepted
+                errorCode = responseCode
+                errorMessage = "Received a Bad Sync Response from OOF."
+
+                response =  "{\n" +
+                        " \"errorCode\": \"${errorCode}\",\n" +
+                        " \"errorMessage\": \"${errorMessage}\"\n" +
+                        "}"
+                //exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Sync Response from OOF.")
+            }
+
+            if (httpResponse.hasEntity()) {
+                response = httpResponse.readEntity(String.class)
+            }
+            else {
+                errorCode = 500
+                errorMessage = "No response received from OOF."
+
+                response =  "{\n" +
+                        " \"errorCode\": \"${errorCode}\",\n" +
+                        " \"errorMessage\": \"${errorMessage}\"\n" +
+                        "}"
+            }
+        }
+        catch(Exception e) {
+            errorCode = 400
+            errorMessage = e.getMessage()
+
+            response =  "{\n" +
+                    " \"errorCode\": \"${errorCode}\",\n" +
+                    " \"errorMessage\": \"${errorMessage}\"\n" +
+                    "}"
+        }
+
+
+        return response
+    }
+
+
+    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
+     * @return
+     */
+    private String buildOOFRequest(DelegateExecution execution) {
+
+        def currentNSSI = execution.getVariable("currentNSSI")
+
+        String nssiId = currentNSSI['nssiId']
+        String requestId = execution.getVariable("mso-request-id")
+
+        String request =    "{\n" +
+                            "  \"type\": \"NSSI\",\n" +
+                            "  \"NxIId\": \"${nssiId}\",\n" +
+                            "  \"requestInfo\": {\n" +
+                            "    \"transactionId\": \"${requestId}\",\n" +
+                            "    \"requestId\": \"${requestId}\",\n" +
+                            "    \"sourceId\": \"so\",\n" +
+                            "    }\n" +
+                            "}"
+
+        return request
+    }
+
+
+
+    /**
+     * Invokes deleteServiceOrder external API
+     * @param execution
+     */
+    void deleteServiceOrder(DelegateExecution execution) {
+        LOGGER.trace("${PREFIX} Start deleteServiceOrder")
+
+        def currentNSSI = execution.getVariable("currentNSSI")
+
+        try {
+            //url:/nbi/api/v4/serviceOrder/"
+            def nbiEndpointUrl = UrnPropertiesReader.getVariable("nbi.endpoint.url", execution)
+
+            ServiceInstance networkServiceInstance = (ServiceInstance)currentNSSI['networkServiceInstance']
+
+            String url = String.format("${nbiEndpointUrl}/api/v4/serviceOrder/%s", networkServiceInstance.getServiceInstanceId()) // Service Order ID = Network Service Instance ID
+
+            String msoKey = UrnPropertiesReader.getVariable("mso.msoKey", execution)
+            String basicAuth =  UrnPropertiesReader.getVariable("mso.infra.endpoint.auth", execution)
+
+            String basicAuthValue = encryptBasicAuth(basicAuth, msoKey)
+            def authHeader = ""
+            if (basicAuthValue != null) {
+                String responseAuthHeader = getAuthHeader(execution, basicAuthValue, msoKey)
+                String errorCode = jsonUtil.getJsonValue(responseAuthHeader, "errorCode")
+                if(errorCode == null || errorCode.isEmpty()) { // No error
+                    authHeader = responseAuthHeader
+                }
+                else {
+                    exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(errorCode), jsonUtil.getJsonValue(responseAuthHeader, "errorMessage"))
+                }
+            } else {
+                LOGGER.error( "Unable to obtain BasicAuth - BasicAuth value null")
+                exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Internal Error - BasicAuth " +
+                        "value null")
+            }
+
+            String callDeleteServiceOrderResponse = callDeleteServiceOrder(execution, url, authHeader)
+            String errorCode = jsonUtil.getJsonValue(callDeleteServiceOrderResponse, "errorCode")
+            String deleteServcieResponse = ""
+
+            if(errorCode == null || errorCode.isEmpty()) { // No error
+                deleteServcieResponse = callDeleteServiceOrderResponse // check the response ???
+            }
+            else {
+                LOGGER.error(jsonUtil.getJsonValue(callDeleteServiceOrderResponse, "errorMessage"))
+                exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(errorCode), jsonUtil.getJsonValue(callDeleteServiceOrderResponse, "errorMessage"))
+            }
+        } catch (any) {
+            String msg = "Exception in DoDeallocateCoreNSSI.deleteServiceOrder. " + any.getCause()
+            LOGGER.error(msg)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+        }
+
+        LOGGER.trace("${PREFIX} Exit deleteServiceOrder")
+    }
+
+
+    String callDeleteServiceOrder(DelegateExecution execution, String urlString, String authHeader) {
+        String errorCode = ""
+        String errorMessage = ""
+        String response = ""
+
+        try {
+            HttpClient httpClient = getHttpClientFactory().newJsonClient(new URL(urlString), ONAPComponents.EXTERNAL)
+            httpClient.addAdditionalHeader("Authorization", authHeader)
+            httpClient.addAdditionalHeader("Accept", "application/json")
+            Response httpResponse = httpClient.delete()
+
+            if (httpResponse.hasEntity()) {
+                response = httpResponse.readEntity(String.class)
+            }
+            else {
+                errorCode = 500
+                errorMessage = "No response received."
+
+                response =  "{\n" +
+                        " \"errorCode\": \"${errorCode}\",\n" +
+                        " \"errorMessage\": \"${errorMessage}\"\n" +
+                        "}"
+            }
+        }
+        catch (any) {
+            String msg = "Exception in DoDeallocateCoreNSSI.deleteServiceOrder. " + any.getCause()
+
+            response =  "{\n" +
+                    " \"errorCode\": \"7000\",\n" +
+                    " \"errorMessage\": \"${msg}\"\n" +
+                    "}"
+        }
+
+        return response
+    }
+
+
+    /**
+     * Removes NSSI association with NSI
+     * @param execution
+     */
+    void removeNSSIAssociationWithNSI(DelegateExecution execution) {
+        LOGGER.trace("${PREFIX} Start removeNSSIAssociationWithNSI")
+
+        AAIResourcesClient client = getAAIClient()
+
+        def currentNSSI = execution.getVariable("currentNSSI")
+
+        String nssiId = currentNSSI['nssiId']
+        String nsiId = currentNSSI['nsiId']
+
+        AAIResourceUri nssiUri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(nssiId))
+        AAIResourceUri nsiUri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(nsiId))
+
+        try {
+            client.disconnect(nssiUri, nsiUri)
+        }catch(Exception e){
+            exceptionUtil.buildAndThrowWorkflowException(execution, 25000, "Exception occured while NSSI association with NSI disconnect call: " + e.getMessage())
+        }
+
+        LOGGER.trace("${PREFIX} Exit removeNSSIAssociationWithNSI")
+    }
+
+
+    /**
+     * Delets NSSI Service Instance
+     * @param execution
+     */
+    void deleteNSSIServiceInstance(DelegateExecution execution) {
+        LOGGER.trace("${PREFIX} Start deleteNSSIServiceInstance")
+
+        AAIResourcesClient client = getAAIClient()
+
+        def currentNSSI = execution.getVariable("currentNSSI")
+
+        String nssiId = currentNSSI['nssiId']
+        AAIResourceUri nssiUri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(nssiId))
+
+        try {
+            getAAIClient().delete(nssiUri)
+        }catch(Exception e){
+            exceptionUtil.buildAndThrowWorkflowException(execution, 25000, "Exception occured while NSSI Service Instance delete call: " + e.getMessage())
+        }
+
+        LOGGER.trace("${PREFIX} Exit deleteNSSIServiceInstance")
+    }
+
+
+
+    @Override
+    String getPrefix() {
+        return PREFIX
+    }
+
+}
index 547cb6c..9d6c4a1 100644 (file)
  */
 package org.onap.so.bpmn.infrastructure.scripts
 
-import com.fasterxml.jackson.databind.ObjectMapper
 import org.camunda.bpm.engine.delegate.DelegateExecution
-import org.onap.logging.filter.base.ONAPComponents
+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
 import org.onap.so.beans.nsmf.DeAllocateNssi
 import org.onap.so.beans.nsmf.EsrInfo
-import org.onap.so.beans.nsmf.JobStatusRequest
-import org.onap.so.beans.nsmf.JobStatusResponse
 import org.onap.so.beans.nsmf.NetworkType
-import org.onap.so.beans.nsmf.NssiDeAllocateRequest
 import org.onap.so.beans.nsmf.NssiResponse
+import org.onap.so.beans.nsmf.ServiceInfo
 import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
 import org.onap.so.bpmn.common.scripts.ExceptionUtil
 import org.onap.so.bpmn.common.scripts.NssmfAdapterUtils
 import org.onap.so.bpmn.common.scripts.RequestDBUtil
-import org.onap.so.bpmn.core.UrnPropertiesReader
 import org.onap.so.bpmn.core.domain.ServiceArtifact
 import org.onap.so.bpmn.core.domain.ServiceDecomposition
 import org.onap.so.bpmn.core.json.JsonUtils
-import org.onap.so.client.HttpClient
-import org.onap.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.so.db.request.beans.OperationStatus
 import org.slf4j.Logger
 import org.slf4j.LoggerFactory
 
-import javax.ws.rs.core.Response
-
 
 class DoDeallocateNSSI extends AbstractServiceTaskProcessor
 {
@@ -126,7 +119,7 @@ class DoDeallocateNSSI extends AbstractServiceTaskProcessor
         }
         LOGGER.debug("*****${PREFIX} Exit processDecomposition *****")
     }
-
+    
     /**
      * send deallocate request to nssmf
      * @param execution
@@ -140,61 +133,106 @@ 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 globalSubscriberId = currentNSSI['globalSubscriberId']
+        String subscriptionServiceType = execution.getVariable("serviceType")
+        
         DeAllocateNssi deAllocateNssi = new DeAllocateNssi()
         deAllocateNssi.setNsiId(nsiId)
         deAllocateNssi.setNssiId(nssiId)
         deAllocateNssi.setTerminateNssiOption(0)
         deAllocateNssi.setSnssaiList(Arrays.asList(snssai))
         deAllocateNssi.setScriptName(scriptName)
-
-        NssiDeAllocateRequest deAllocateRequest = new NssiDeAllocateRequest()
-        deAllocateRequest.setDeAllocateNssi(deAllocateNssi)
-        deAllocateRequest.setEsrInfo(getEsrInfo(currentNSSI))
-
-        ObjectMapper mapper = new ObjectMapper()
-        String nssmfRequest = mapper.writeValueAsString(deAllocateRequest)
-
-        String urlStr = String.format("/api/rest/provMns/v1/NSS/SliceProfiles/%s",profileId)
+        deAllocateNssi.setSliceProfileId(profileId)
+        deAllocateNssi.setModifyAction(modifyAction)
+        
+        ServiceInfo serviceInfo = new ServiceInfo()
+        serviceInfo.setServiceInvariantUuid(serviceInvariantUuid)
+        serviceInfo.setServiceUuid(serviceUuid)
+        serviceInfo.setGlobalSubscriberId(globalSubscriberId)
+        serviceInfo.setSubscriptionServiceType(subscriptionServiceType)
+        
+        EsrInfo esrInfo = getEsrInfo(currentNSSI)
+        
+        execution.setVariable("deAllocateNssi",deAllocateNssi)
+        execution.setVariable("esrInfo",esrInfo)
+        execution.setVariable("serviceInfo",serviceInfo)
+        String nssmfRequest = """
+                {
+                  "deAllocateNssi": "${execution.getVariable("deAllocateNssi") as JSONObject}",
+                  "esrInfo":  ${execution.getVariable("esrInfo") as JSONObject},
+                  "serviceInfo": ${execution.getVariable("serviceInfo") as JSONObject}
+                }
+              """
+
+        String urlStr = String.format("/api/rest/provMns/v1/NSS/nssi/%s",nssiId)
 
         NssiResponse nssmfResponse = nssmfAdapterUtils.sendPostRequestNSSMF(execution, urlStr, nssmfRequest, NssiResponse.class)
         if (nssmfResponse != null) {
-            currentNSSI['jobId']= nssmfResponse.getJobId() ?: ""
-            currentNSSI['jobProgress'] = 0
-            execution.setVariable("currentNSSI", currentNSSI)
-
-            LOGGER.debug("*****${PREFIX} Exit sendRequestToNSSMF *****")
-        } else {
+            currentNSSI['jobId']= nssmfResponse.getJobId() ?: "" 
+            currentNSSI['jobProgress'] = 0            
+            execution.setVariable("currentNSSI", currentNSSI)    
+            } 
+            else {
             exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Received a Bad Response from NSSMF.")
         }
-
+        LOGGER.debug("*****${PREFIX} Exit sendRequestToNSSMF *****")
     }
 
-    /**
+/**
      * send to nssmf query progress
      * @param execution
      */
-    void getJobStatus(DelegateExecution execution)
+    void prepareJobStatusRequest(DelegateExecution execution)
     {
         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)
+    }
 
-        JobStatusRequest jobStatusRequest = new JobStatusRequest()
-        jobStatusRequest.setNssiId(nssiId)
-        jobStatusRequest.setNsiId(nsiId)
-        jobStatusRequest.setEsrInfo(getEsrInfo(currentNSSI))
-
-        ObjectMapper mapper = new ObjectMapper()
-        String nssmfRequest = mapper.writeValueAsString(jobStatusRequest)
-
-        String urlStr = String.format("/api/rest/provMns/v1/NSS/jobs/%s", jobId)
-
-        JobStatusResponse jobStatusResponse = nssmfAdapterUtils.sendPostRequestNSSMF(execution, urlStr, nssmfRequest, JobStatusResponse.class)
-
-        if (jobStatusResponse != null) {
-            def progress = jobStatusResponse?.getResponseDescriptor()?.getProgress()
+    
+    /**
+     * send to nssmf query progress
+     * @param execution
+     */
+    void handleJobStatus(DelegateExecution execution)
+    {
+        try 
+        {
+        String jobStatusResponse = execution.getVariable("responseDescriptor")
+        String status = jsonUtil.getJsonValue(jobStatusResponse,"status")
+        def statusDescription = jsonUtil.getJsonValue(jobStatusResponse,"statusDescription")
+        def progress = jsonUtil.getJsonValue(jobStatusResponse,"progress")
+        if(!status.equalsIgnoreCase("failed"))
+        {
             if(!progress)
             {
                 LOGGER.error("job progress is null or empty!")
@@ -206,61 +244,60 @@ class DoDeallocateNSSI extends AbstractServiceTaskProcessor
             execution.setVariable("isNSSIDeAllocated", (currentProgress == 100))
             execution.setVariable("isNeedUpdateDB", (oldProgress != currentProgress))
             currentNSSI['jobProgress'] = currentProgress
-
-            def statusDescription = jobStatusResponse?.getResponseDescriptor()?.getStatusDescription()
+            currentNSSI['status'] = status
             currentNSSI['statusDescription'] = statusDescription
 
             LOGGER.debug("job status result: nsiId = ${nsiId}, nssiId=${nssiId}, oldProgress=${oldProgress}, progress = ${currentProgress}" )
-
-        } else {
+        }
+          else {
+            execution.setVariable("isNeedUpdateDB", "true")
             exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Received a Bad Response from NSSMF.")
         }
-
+        }
+        catch (any)
+        {
+            String msg = "Received a Bad Response from NSSMF." cause-"+any.getCause()"
+            LOGGER.error(any.printStackTrace())
+            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+        }
     }
 
     private EsrInfo getEsrInfo(def currentNSSI)
     {
         String domaintype = currentNSSI['domainType']
         String vendor = currentNSSI['vendor']
-
+        
         EsrInfo info = new EsrInfo()
         info.setNetworkType(NetworkType.fromString(domaintype))
         info.setVendor(vendor)
         return info
     }
 
   /**
+ /**
      * handle job status
      * prepare update requestdb
      * @param execution
      */
-    void handleJobStatus(DelegateExecution execution)
+    void prepareUpdateOperationStatus(DelegateExecution execution)
     {
         def currentNSSI = execution.getVariable("currentNSSI")
         int currentProgress = currentNSSI["jobProgress"]
         def proportion = currentNSSI['proportion']
         def statusDes = currentNSSI["statusDescription"]
         int progress = (currentProgress as int) == 0 ? 0 : (currentProgress as int) / 100 * (proportion as int)
-
+        def status = currentNSSI['status']
+        
         OperationStatus operationStatus = new OperationStatus()
         operationStatus.setServiceId(currentNSSI['e2eServiceInstanceId'] as String)
         operationStatus.setOperationId(currentNSSI['operationId'] as String)
         operationStatus.setOperation("DELETE")
-        operationStatus.setResult("processing")
+        operationStatus.setResult(status as String)
         operationStatus.setProgress(progress as String)
         operationStatus.setOperationContent(statusDes as String)
         requestDBUtil.prepareUpdateOperationStatus(execution, operationStatus)
         LOGGER.debug("update operation, currentProgress=${currentProgress}, proportion=${proportion}, progress = ${progress}" )
     }
-
-    void timeDelay(DelegateExecution execution) {
-        try {
-            Thread.sleep(10000);
-        } catch(InterruptedException e) {
-            LOGGER.error("Time Delay exception" + e)
-        }
-    }
-
+    
     /**
      * delete slice profile from aai
      * @param execution
@@ -277,7 +314,8 @@ class DoDeallocateNSSI extends AbstractServiceTaskProcessor
         try
         {
             LOGGER.debug("delete nssiServiceInstanceId:${nssiServiceInstanceId}, profileId:${profileId}")
-            AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.SLICE_PROFILE, globalSubscriberId, serviceType, nssiServiceInstanceId, profileId)
+            AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(
+                AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(serviceType).serviceInstance(nssiServiceInstanceId).sliceProfile(profileId))
             if (!getAAIClient().exists(resourceUri)) {
                 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service Instance was not found in aai")
             }
@@ -291,4 +329,4 @@ class DoDeallocateNSSI extends AbstractServiceTaskProcessor
         }
         LOGGER.debug("*****${PREFIX} Exist delSliceProfileFromAAI *****")
     }
-}
\ No newline at end of file
+}
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
new file mode 100644 (file)
index 0000000..a410b93
--- /dev/null
@@ -0,0 +1,168 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.scripts
+
+import com.fasterxml.jackson.databind.ObjectMapper
+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
+import org.onap.so.bpmn.common.scripts.RequestDBUtil
+import org.onap.so.bpmn.core.json.JsonUtils
+import org.onap.so.db.request.beans.ResourceOperationStatus
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+
+class DoDeallocateTnNssi extends AbstractServiceTaskProcessor {
+    String Prefix = "TNDEALLOC_"
+
+    ExceptionUtil exceptionUtil = new ExceptionUtil()
+    JsonUtils jsonUtil = new JsonUtils()
+    RequestDBUtil requestDBUtil = new RequestDBUtil()
+    TnNssmfUtils tnNssmfUtils = new TnNssmfUtils()
+    JsonSlurper jsonSlurper = new JsonSlurper()
+    ObjectMapper objectMapper = new ObjectMapper()
+    private static final Logger logger = LoggerFactory.getLogger(DoDeallocateTnNssi.class)
+
+
+    void preProcessRequest(DelegateExecution execution) {
+        logger.debug("Start preProcessRequest")
+
+        execution.setVariable("startTime", System.currentTimeMillis())
+        String msg = tnNssmfUtils.getExecutionInputParams(execution)
+        logger.debug("Deallocate TN NSSI input parameters: " + msg)
+
+        execution.setVariable("prefix", Prefix)
+
+        tnNssmfUtils.setSdncCallbackUrl(execution, true)
+        logger.debug("SDNC Callback URL: " + execution.getVariable("sdncCallbackUrl"))
+
+        String sliceServiceInstanceId = execution.getVariable("serviceInstanceID")
+        execution.setVariable("sliceServiceInstanceId", sliceServiceInstanceId)
+
+        String sliceServiceInstanceName = execution.getVariable("servicename")
+        execution.setVariable("sliceServiceInstanceName", sliceServiceInstanceName)
+
+
+        String modelInvariantUuid = execution.getVariable("modelInvariantUuid")
+        String modelUuid = execution.getVariable("modelUuid")
+        //here modelVersion is not set, we use modelUuid to decompose the service.
+        def isDebugLogEnabled = true
+        execution.setVariable("isDebugLogEnabled", isDebugLogEnabled)
+        String serviceModelInfo = """{
+            "modelInvariantUuid":"${modelInvariantUuid}",
+            "modelUuid":"${modelUuid}",
+            "modelVersion":""
+             }"""
+        execution.setVariable("serviceModelInfo", serviceModelInfo)
+        logger.debug("Finish preProcessRequest")
+    }
+
+    void preprocessSdncDeallocateTnNssiRequest(DelegateExecution execution) {
+        def method = getClass().getSimpleName() + '.preprocessSdncDeallocateTnNssiRequest(' +
+                'execution=' + execution.getId() + ')'
+        def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+        logger.trace('Entered ' + method)
+
+        try {
+            String serviceInstanceId = execution.getVariable("serviceInstanceID")
+
+            String sdncRequest = tnNssmfUtils.buildSDNCRequest(execution, serviceInstanceId, "deallocate")
+
+            execution.setVariable("TNNSSMF_SDNCRequest", sdncRequest)
+            logger.debug("Outgoing SDNCRequest is: \n" + sdncRequest)
+
+        } catch (Exception e) {
+            logger.debug("Exception Occured Processing preprocessSdncDeallocateTnNssiRequest. Exception is:\n" + e)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during  preProcessSDNCActivateRequest Method:\n" + e.getMessage())
+        }
+        logger.trace("COMPLETED preprocessSdncDeallocateTnNssiRequest Process")
+    }
+
+
+    void validateSDNCResponse(DelegateExecution execution, String response, String method) {
+        tnNssmfUtils.validateSDNCResponse(execution, response, method)
+    }
+
+    void deleteServiceInstance(DelegateExecution execution) {
+        try {
+            AAIResourcesClient client = getAAIClient()
+            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(execution.getVariable("serviceInstanceID")))
+            client.delete(uri)
+        } catch (BpmnError e) {
+            throw e
+        } catch (Exception ex) {
+            String msg = "Exception in DoDeallocateTnNssi.deleteServiceInstance. " + ex.getMessage()
+            logger.info(msg)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+        }
+    }
+
+    public void updateAAIOrchStatus(DelegateExecution execution) {
+        logger.debug("Start updateAAIOrchStatus")
+        String tnNssiId = execution.getVariable("serviceInstanceID")
+        String orchStatus = execution.getVariable("orchestrationStatus")
+
+        try {
+            ServiceInstance si = new ServiceInstance()
+            si.setOrchestrationStatus(orchStatus)
+            AAIResourcesClient client = getAAIClient()
+            AAIResourceUri uri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(tnNssiId))
+            client.update(uri, si)
+        } catch (BpmnError e) {
+            throw e
+        } catch (Exception ex) {
+            String msg = "Exception in CreateSliceService.updateAAIOrchStatus " + ex.getMessage()
+            logger.info(msg)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+        }
+
+        logger.debug("Finish updateAAIOrchStatus")
+    }
+
+    void prepareUpdateJobStatus(DelegateExecution execution,
+                                String status,
+                                String progress,
+                                String statusDescription) {
+        String serviceId = execution.getVariable("serviceInstanceID")
+        String jobId = execution.getVariable("jobId")
+        String nsiId = execution.getVariable("nsiId")
+
+        ResourceOperationStatus roStatus = new ResourceOperationStatus()
+        roStatus.setServiceId(serviceId)
+        roStatus.setOperationId(jobId)
+        roStatus.setResourceTemplateUUID(nsiId)
+        roStatus.setOperType("Deallocate")
+        roStatus.setProgress(progress)
+        roStatus.setStatus(status)
+        roStatus.setStatusDescription(statusDescription)
+        requestDBUtil.prepareUpdateResourceOperationStatus(execution, status)
+    }
+}
+
index 0a7753e..ef94ff1 100644 (file)
@@ -52,6 +52,8 @@ import org.onap.aaiclient.client.aai.AAIResourcesClient
 import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
 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.slf4j.Logger
 import org.slf4j.LoggerFactory
 import org.onap.logging.filter.base.ONAPComponents;
@@ -176,7 +178,7 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
             String globalSubscriberId = execution.getVariable('globalSubscriberId')
             String serviceType = execution.getVariable('serviceType')
             AAIResourcesClient resourceClient = new AAIResourcesClient()
-            AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId, serviceType, serviceInstanceId)
+            AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(serviceType).serviceInstance(serviceInstanceId))
             if (!resourceClient.exists(serviceInstanceUri)) {
                 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service Instance was not found in aai")
             }
@@ -658,7 +660,7 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
             String serviceInstanceId = execution.getVariable("serviceInstanceId")
 
             AAIResourcesClient resourceClient = new AAIResourcesClient()
-            AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalCustId, serviceType, serviceInstanceId)
+            AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalCustId).serviceSubscription(serviceType).serviceInstance(serviceInstanceId))
             resourceClient.delete(serviceInstanceUri)
 
             logger.trace("Exited deleteServiceInstance")
index bee9ad2..0220028 100644 (file)
@@ -32,6 +32,7 @@ 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.aaiclient.client.graphinventory.entities.uri.Depth
 import org.onap.logging.filter.base.ErrorCode
 import org.onap.logging.filter.base.ONAPComponents;
@@ -256,7 +257,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
         ExceptionUtil exceptionUtil = new ExceptionUtil()
         Boolean isVfRelationshipExist = false
         try {
-            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, networkId).depth(Depth.ALL)
+            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(networkId)).depth(Depth.ALL)
             Optional<L3Network> l3Network = getAAIClient().get(L3Network.class,uri);
             AAIResultWrapper wrapper = getAAIClient().get(uri);
             Optional<Relationships> relationships = wrapper.getRelationships()
@@ -266,13 +267,13 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
                 execution.setVariable(Prefix + "queryAAIResponse", l3Network.get())
                 execution.setVariable(Prefix + "isAAIGood", true)
                 if (relationships.isPresent()){
-                    if(!relationships.get().getRelatedAAIUris(AAIObjectType.VF_MODULE).isEmpty()){
+                    if(!relationships.get().getRelatedUris(Types.VF_MODULE).isEmpty()){
                         execution.setVariable(Prefix + "isVfRelationshipExist", true)
                         isVfRelationshipExist = true
                         String relationshipMessage = "AAI Query Success Response but 'vf-module' relationship exist, not allowed to delete: network Id: " + networkId
                         exceptionUtil.buildWorkflowException(execution, 2500, relationshipMessage)
                     }else{
-                        List<AAIResourceUri> tenantURIList = relationships.get().getRelatedAAIUris(AAIObjectType.TENANT)
+                        List<AAIResourceUri> tenantURIList = relationships.get().getRelatedUris(Types.TENANT)
                         for(AAIResourceUri tenantURI: tenantURIList){
                             if(execution.getVariable(Prefix + "tenantId") == null) {
                                 String tenantId = tenantURI.getURIKeys().get(AAIFluentTypeBuilder.Types.TENANT.getUriParams().tenantId)
@@ -280,7 +281,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
                                 logger.debug(" Get AAI getTenantId()  : " + tenantId)
                             }
                         }
-                        List<AAIResourceUri> cloudRegionURIList = relationships.get().getRelatedAAIUris(AAIObjectType.CLOUD_REGION)
+                        List<AAIResourceUri> cloudRegionURIList = relationships.get().getRelatedUris(Types.CLOUD_REGION)
                         for(AAIResourceUri tenantURI: cloudRegionURIList){
                             if(execution.getVariable(Prefix + "lcpCloudRegion") == null) {
                                 String lcpCloudRegion = tenantURI.getURIKeys().get(AAIFluentTypeBuilder.Types.CLOUD_REGION.getUriParams().cloudRegionId)
@@ -322,7 +323,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
             // Prepare AA&I url
             AaiUtil aaiUtil = new AaiUtil(this)
 
-            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, Defaults.CLOUD_OWNER.toString(), cloudRegion)
+            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(Defaults.CLOUD_OWNER.toString(), cloudRegion))
             def queryCloudRegionRequest = aaiUtil.createAaiUri(uri)
 
             execution.setVariable(Prefix + "queryCloudRegionRequest", queryCloudRegionRequest)
index cda7c32..85cbf32 100644 (file)
@@ -32,6 +32,7 @@ import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
 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.common.scripts.MsoUtils
@@ -285,7 +286,7 @@ public class DoDeleteServiceInstance extends AbstractServiceTaskProcessor {
                        String serviceInstanceId = execution.getVariable('serviceInstanceId')
 
                        AAIResourcesClient resourceClient = new AAIResourcesClient()
-                       AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId)
+                       AAIResourceUri uri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId))
 
                        if(resourceClient.exists(uri)){                         
                                execution.setVariable("GENGS_FoundIndicator", true)
@@ -307,9 +308,9 @@ public class DoDeleteServiceInstance extends AbstractServiceTaskProcessor {
 
                                AAIResultWrapper wrapper = resourceClient.get(uri)
                                if(wrapper.getRelationships().isPresent()){
-                                       List<AAIResourceUri> uriList = wrapper.getRelationships().get().getRelatedAAIUris(AAIObjectType.ALLOTTED_RESOURCE)
-                                       uriList.addAll(wrapper.getRelationships().get().getRelatedAAIUris(AAIObjectType.GENERIC_VNF))
-                                       uriList.addAll(wrapper.getRelationships().get().getRelatedAAIUris(AAIObjectType.L3_NETWORK))
+                                       List<AAIResourceUri> uriList = wrapper.getRelationships().get().getRelatedUris(Types.ALLOTTED_RESOURCE)
+                                       uriList.addAll(wrapper.getRelationships().get().getRelatedUris(Types.GENERIC_VNF))
+                                       uriList.addAll(wrapper.getRelationships().get().getRelatedUris(Types.L3_NETWORK))
 
                                        if(uriList.isEmpty()){
                                                Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class)
@@ -372,7 +373,7 @@ public class DoDeleteServiceInstance extends AbstractServiceTaskProcessor {
                        String serviceInstanceId = execution.getVariable("serviceInstanceId")
 
                        AAIResourcesClient resourceClient = new AAIResourcesClient();
-                       AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalCustId, serviceType, serviceInstanceId)
+                       AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalCustId).serviceSubscription(serviceType).serviceInstance(serviceInstanceId))
                        resourceClient.delete(serviceInstanceUri)
 
                        logger.trace("Exited deleteServiceInstance")
index 5354d52..c432122 100644 (file)
  */
 package org.onap.so.bpmn.infrastructure.scripts
 
+import static org.apache.commons.lang3.StringUtils.isBlank
+import javax.ws.rs.NotFoundException
+import javax.ws.rs.core.Response
 import org.camunda.bpm.engine.delegate.BpmnError
 import org.camunda.bpm.engine.delegate.DelegateExecution
 import org.onap.aai.domain.yang.AllottedResource
 import org.onap.aai.domain.yang.AllottedResources
 import org.onap.aai.domain.yang.Relationship
 import org.onap.aai.domain.yang.ServiceInstance
-import org.onap.aai.domain.yang.SliceProfiles
-import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
-import org.onap.so.bpmn.common.scripts.ExceptionUtil
-import org.onap.aaiclient.client.aai.AAIObjectType
+import org.onap.aai.domain.yang.ServiceProfile
+import org.onap.aai.domain.yang.ServiceProfiles
+import org.onap.aaiclient.client.aai.AAIObjectName
 import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
-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.OofUtils
+import org.onap.so.bpmn.core.UrnPropertiesReader
+import org.onap.so.client.HttpClient
+import org.onap.so.client.HttpClientFactory
 import org.slf4j.Logger
 import org.slf4j.LoggerFactory
 
-import javax.ws.rs.NotFoundException
-
-import static org.apache.commons.lang3.StringUtils.isBlank
-
 /**
  * This groovy class supports the <class>DoDeleteSliceService.bpmn</class> process.
  *
@@ -52,6 +58,7 @@ import static org.apache.commons.lang3.StringUtils.isBlank
 class DoDeleteSliceService extends AbstractServiceTaskProcessor {
     private final String PREFIX ="DoDeleteSliceService"
     ExceptionUtil exceptionUtil = new ExceptionUtil()
+    OofUtils oofUtils = new OofUtils()
     private static final Logger LOGGER = LoggerFactory.getLogger( DoDeleteSliceService.class)
 
     @Override
@@ -96,17 +103,47 @@ class DoDeleteSliceService extends AbstractServiceTaskProcessor {
     {
         LOGGER.trace(" *****${PREFIX} Start queryE2ESliceSeriveFromAAI *****")
         String serviceInstanceId = execution.getVariable("serviceInstanceId")
-
+        try
+        {
         String errorMsg = "query e2e slice service from aai failed"
-        AAIResultWrapper wrapper = queryAAI(execution, AAIObjectType.SERVICE_INSTANCE, serviceInstanceId, errorMsg)
+        AAIResultWrapper wrapper = queryAAI(execution, Types.SERVICE_INSTANCE, serviceInstanceId, errorMsg)
         Optional<ServiceInstance> si =wrapper.asBean(ServiceInstance.class)
         if(si.isPresent())
         {
             String snssai = si.get()?.getEnvironmentContext()
+            ServiceProfiles serviceProfiles = si.get()?.getServiceProfiles()
+            ServiceProfile serviceProfile = serviceProfiles.getServiceProfile().get(0)
+            String serviceProfileId = serviceProfile ? serviceProfile.getProfileId() : ""
             execution.setVariable("snssai", snssai ?: "")
-            LOGGER.info("serviceInstanceId: ${serviceInstanceId}, snssai: ${snssai}")
+            execution.setVariable("serviceProfileId",serviceProfileId)
+            List<ServiceInstance> sliceProfileList = []
+            List<Relationship> relationshipList = si.get().getRelationshipList().getRelationship()
+            for (Relationship relationship : relationshipList) {
+                String relatedTo = relationship.getRelatedTo()
+                if (relatedTo.toLowerCase() == "service-instance") {
+                    String relatioshipurl = relationship.getRelatedLink()
+                    String instanceId = relatioshipurl.substring(relatioshipurl.lastIndexOf("/") + 1, relatioshipurl.length())
+                    AAIResultWrapper wrapper1 = queryAAI(execution, Types.SERVICE_INSTANCE, instanceId, errorMsg)
+                    Optional<ServiceInstance> serviceInstance = wrapper1.asBean(ServiceInstance.class)
+                    if (serviceInstance.isPresent()) {
+                        ServiceInstance instance = serviceInstance.get()
+                        if ("slice-profile-instance".equalsIgnoreCase(instance.getServiceRole())) {
+                            sliceProfileList.add(instance)
+                        }
+                    }
+                }
+            }
+            execution.setVariable("sliceProfileList",sliceProfileList)
+            LOGGER.info("serviceInstanceId: ${serviceInstanceId}, snssai: ${snssai}, sliceProfileList: ${sliceProfileList}")
         }
         LOGGER.trace(" *****${PREFIX} Exit queryE2ESliceSeriveFromAAI *****")
+        }
+        catch (any)
+        {
+            String msg = "query E2E slice service from aai failed! cause-"+any.getCause()
+            LOGGER.error(any.printStackTrace())
+            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg);
+        }
     }
 
     /**
@@ -121,7 +158,7 @@ class DoDeleteSliceService extends AbstractServiceTaskProcessor {
         try
         {
             String errorMsg = "query allotted resource from aai failed."
-            AAIResultWrapper wrapper = queryAAI(execution, AAIObjectType.ALLOTTED_RESOURCE_ALL, serviceInstanceId, errorMsg)
+            AAIResultWrapper wrapper = queryAAI(execution, Types.ALLOTTED_RESOURCES, serviceInstanceId, errorMsg)
             Optional<AllottedResources> ars = wrapper?.asBean(AllottedResources.class)
             if(ars.isPresent() && ars.get().getAllottedResource())
             {
@@ -156,7 +193,7 @@ class DoDeleteSliceService extends AbstractServiceTaskProcessor {
         try
         {
             String errorMsg = "query nsi from aai failed."
-            AAIResultWrapper wrapper = queryAAI(execution, AAIObjectType.SERVICE_INSTANCE, nsiId, errorMsg)
+            AAIResultWrapper wrapper = queryAAI(execution, Types.SERVICE_INSTANCE, nsiId, errorMsg)
             Optional<ServiceInstance> si =wrapper.asBean(ServiceInstance.class)
             List<String> nssiIdList = []
             String msg = "nsiId:${nsiId},nssiIdList:"
@@ -169,7 +206,15 @@ class DoDeleteSliceService extends AbstractServiceTaskProcessor {
                     if (relatedTo == "service-instance")
                     {
                         String relatedLink = relationship.getRelatedLink()?:""
-                        String nssiId = relatedLink ? relatedLink.substring(relatedLink.lastIndexOf("/") + 1,relatedLink.length()) : ""
+                        String instanceId = relatedLink ? relatedLink.substring(relatedLink.lastIndexOf("/") + 1,relatedLink.length()) : ""
+                        AAIResultWrapper wrapper1 = queryAAI(execution, Types.SERVICE_INSTANCE, instanceId, errorMsg)
+                        Optional<ServiceInstance> serviceInstance = wrapper1.asBean(ServiceInstance.class)
+                        if (serviceInstance.isPresent()) {
+                            ServiceInstance instance = serviceInstance.get()
+                            if ("nssi".equalsIgnoreCase(instance.getServiceRole())) {
+                                nssiId = instance.getServiceInstanceId()
+                            }
+                        }
                         nssiIdList.add(nssiId)
                         msg+="${nssiId}, "
                     }
@@ -202,7 +247,7 @@ class DoDeleteSliceService extends AbstractServiceTaskProcessor {
         String errorMsg = "query nssi list from aai failed"
         for(String nssiId : nssiIdList)
         {
-            AAIResultWrapper wrapper = queryAAI(execution, AAIObjectType.SERVICE_INSTANCE, nssiId, errorMsg)
+            AAIResultWrapper wrapper = queryAAI(execution, Types.SERVICE_INSTANCE, nssiId, errorMsg)
             Optional<ServiceInstance> si =wrapper.asBean(ServiceInstance.class)
             if(si.isPresent())
             {
@@ -227,12 +272,24 @@ class DoDeleteSliceService extends AbstractServiceTaskProcessor {
     {
         LOGGER.trace(" *****${PREFIX} Start getCurrentNSSI *****")
         List<ServiceInstance> nssiInstanceList = execution.getVariable("nssiInstanceList")
+        List<ServiceInstance> sliceProfileList = execution.getVariable("sliceProfileList")
         int currentIndex = execution.getVariable("currentNSSIIndex") as int
+        String profileId = ""
         ServiceInstance nssi = nssiInstanceList?.get(currentIndex)
+        for(ServiceInstance sliceProfileInstance : sliceProfileList) {
+            if(sliceProfileInstance.getWorkloadContext().equalsIgnoreCase(nssi.getWorkloadContext()))
+            {
+                profileId = sliceProfileInstance.getServiceInstanceId()
+            }
+        }
         def currentNSSI = [:]
         currentNSSI['nssiServiceInstanceId'] = nssi?.getServiceInstanceId()
         currentNSSI['modelInvariantId'] = nssi?.getModelInvariantId()
         currentNSSI['modelVersionId'] = nssi?.getModelVersionId()
+        currentNSSI['nssiName'] = nssi?.getServiceInstanceName()
+        currentNSSI['sST'] = nssi?.getServiceType()
+        currentNSSI['PLMNIdList'] = nssi?.getServiceInstanceLocationId()
+        currentNSSI['profileId'] =  profileId
         currentNSSI['snssai'] = execution.getVariable("snssai") ?: ""
         currentNSSI['nsiServiceInstanceId'] = execution.getVariable("nsiId") ?: ""
         currentNSSI['operationId'] = execution.getVariable("operationId") ?: ""
@@ -271,50 +328,88 @@ class DoDeleteSliceService extends AbstractServiceTaskProcessor {
         LOGGER.trace(" *****${PREFIX} Exit parseNextNSSI *****")
     }
 
-
-    /**
-     * query sliceProfile from AAI
-     * save profileId
-     * @param execution
-     */
-    void querySliceProfileFromAAI(DelegateExecution execution)
-    {
-        LOGGER.trace(" *****${PREFIX} Start querySliceProfileFromAAI *****")
-        def currentNSSI = execution.getVariable("currentNSSI")
-        String nssiId = currentNSSI['nssiServiceInstanceId']
-        String errorMsg = "query slice profile failed"
-        AAIResultWrapper wrapper = queryAAI(execution, AAIObjectType.SLICE_PROFILE_ALL, nssiId, errorMsg)
-        Optional<SliceProfiles> sliceProfiles =wrapper.asBean(SliceProfiles.class)
-        if(sliceProfiles.isPresent())
-        {
-            String profileId = sliceProfiles.get().getSliceProfile()?.get(0)?.getProfileId()
-            currentNSSI['profileId'] =  profileId ?: ""
-            LOGGER.info("nssiId: ${nssiId}, profileId: ${profileId}")
-        }
-        execution.setVariable("currentNSSI", currentNSSI)
-        LOGGER.trace(" *****${PREFIX} Exit querySliceProfileFromAAI *****")
-    }
-
     /**
      * query AAI
      * @param execution
-     * @param aaiObjectType
+     * @param aaiObjectName
      * @param instanceId
      * @return AAIResultWrapper
      */
-    private AAIResultWrapper queryAAI(DelegateExecution execution, AAIObjectType aaiObjectType, String instanceId, String errorMsg)
+    private AAIResultWrapper queryAAI(DelegateExecution execution, AAIObjectName aaiObjectName, String instanceId, String errorMsg)
     {
         LOGGER.trace(" *****${PREFIX} Start queryAAI *****")
         String globalSubscriberId = execution.getVariable("globalSubscriberId")
         String serviceType = execution.getVariable("serviceType")
 
-        AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(aaiObjectType, globalSubscriberId, serviceType, instanceId)
-        if (!getAAIClient().exists(resourceUri)) {
+        org.onap.aaiclient.client.generated.fluentbuilders.ServiceInstance serviceInstanceType = AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(serviceType).serviceInstance(instanceId)
+        def type
+        if (aaiObjectName == Types.ALLOTTED_RESOURCES) {
+            type = serviceInstanceType.allottedResources()
+        } else if (aaiObjectName == Types.SLICE_PROFILES) {
+            type = serviceInstanceType.sliceProfiles()
+        } else {
+            type = serviceInstanceType
+        }
+        def uri = AAIUriFactory.createResourceUri(type)
+        if (!getAAIClient().exists(uri)) {
             exceptionUtil.buildAndThrowWorkflowException(execution, 2500, errorMsg)
         }
-        AAIResultWrapper wrapper = getAAIClient().get(resourceUri, NotFoundException.class)
+        AAIResultWrapper wrapper = getAAIClient().get(uri, NotFoundException.class)
         LOGGER.trace(" *****${PREFIX} Exit queryAAI *****")
         return wrapper
     }
 
+    void terminateNSIQuery(DelegateExecution execution)
+    {
+        logger.debug("Start terminateNSIQuery")
+        
+        String requestId = execution.getVariable("msoRequestId")
+        String nxlId = currentNSSI['nsiServiceInstanceId']
+        String nxlType = "NSI"
+        String messageType = "nsiTerminationResponse"
+        String serviceInstanceId = execution.getVariable("serviceInstanceId")
+        
+        def authHeader = ""
+        String basicAuth = UrnPropertiesReader.getVariable("mso.oof.auth", execution)
+        String msokey = UrnPropertiesReader.getVariable("mso.msoKey", execution)
+
+        String basicAuthValue = utils.encrypt(basicAuth, msokey)
+        if (basicAuthValue != null) {
+            logger.debug( "Obtained BasicAuth username and password for OOF: " + basicAuthValue)
+            try {
+                authHeader = utils.getBasicAuth(basicAuthValue, msokey)
+                execution.setVariable("BasicAuthHeaderValue", authHeader)
+            } catch (Exception ex) {
+                logger.debug( "Unable to encode username and password string: " + ex)
+                exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Internal Error - Unable to " +
+                        "encode username and password string")
+            }
+        } else {
+            logger.debug( "Unable to obtain BasicAuth - BasicAuth value null")
+            exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Internal Error - BasicAuth " +
+                    "value null")
+        }
+
+        URL requestUrl = new URL(oofUrl + "/api/oof/terminate/nxi/v1")
+        String oofRequest = oofUtils.buildTerminateNxiRequest(requestId, nxlId, nxlType, messageType, serviceInstanceId)
+        HttpClient httpClient = new HttpClientFactory().newJsonClient(requestUrl, ONAPComponents.OOF)
+        httpClient.addAdditionalHeader("Authorization", authHeader)
+        Response httpResponse = httpClient.post(oofRequest)
+
+        int responseCode = httpResponse.getStatus()
+        logger.debug("OOF sync response code is: " + responseCode)
+
+        if(responseCode != 200){
+            exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Sync Response from OOF.")
+        }       
+        try {
+            Map<String, String> resMap = httpResponse.readEntity(Map.class)
+            boolean terminateResponse = resMap.get("terminateResponse")
+            execution.setVariable("terminateNSI", terminateResponse)
+        } catch (Exception ex) {
+            logger.debug( "Failed to get terminate Response suggested by OOF.")
+            exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Failed to get terminate Response suggested by OOF.")
+        }
+        logger.debug("Finish terminateNSIQuery")
+    }
 }
index 42f4cb7..1ec11c6 100644 (file)
@@ -32,6 +32,8 @@ import org.onap.so.client.HttpClientFactory
 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
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types
 import org.slf4j.Logger
 import org.slf4j.LoggerFactory
 import org.onap.logging.filter.base.ONAPComponents;
@@ -121,8 +123,8 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces
         String globalSubscriberId = execution.getVariable("globalSubscriberId")
         String serviceType = execution.getVariable("serviceType")
         String serviceId = execution.getVariable("serviceId")
-        AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId, serviceType, serviceId)
-        AAIResourceUri nsServiceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId, serviceType, nsInstanceId)
+        AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(serviceType).serviceInstance(serviceId))
+        AAIResourceUri nsServiceInstanceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(serviceType).serviceInstance(nsInstanceId))
         try {
             getAAIClient().disconnect(serviceInstanceUri, nsServiceInstanceUri)
         }catch(Exception e){
index 33a1ece..3bc8daa 100644 (file)
@@ -39,11 +39,12 @@ import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils
 import org.onap.so.bpmn.core.UrnPropertiesReader
 import org.onap.so.bpmn.core.WorkflowException
 import org.onap.so.bpmn.core.json.JsonUtils
-import org.onap.aaiclient.client.aai.AAIObjectPlurals
 import org.onap.aaiclient.client.aai.AAIObjectType
 import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri
 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.logger.MessageEnum
 import org.slf4j.Logger
 import org.slf4j.LoggerFactory
@@ -486,7 +487,7 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{
                 for (i in 0..fqdnCount-1) {
                     String fqdn = fqdnList[i]
                     // Query AAI for this network policy FQDN
-                                       AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY)
+                                       AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().networkPolicies())
                     uri.queryParam("network-policy-fqdn", fqdn)
                     try {
                         Optional<NetworkPolicies> networkPolicies = getAAIClient().get(NetworkPolicies.class, uri)
@@ -498,7 +499,7 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{
                             def networkPolicyId = networkPolicy.getNetworkPolicyId()
                             logger.debug("Deleting network-policy with network-policy-id " + networkPolicyId)
                             try {
-                                AAIResourceUri delUri = AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, networkPolicyId)
+                                AAIResourceUri delUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().networkPolicy(networkPolicyId))
                                 getAAIClient().delete(delUri)
                                 execution.setVariable("DoDVfMod_aaiDeleteNetworkPolicyReturnCode", 200)
                             } catch (Exception e) {
@@ -606,7 +607,7 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{
             def vnfId = execution.getVariable('vnfId')
             def vfModuleId = execution.getVariable('vfModuleId')
 
-            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId)
+            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId).vfModule(vfModuleId))
 
             try {
                 Optional<org.onap.aai.domain.yang.VfModule> vfModule = getAAIClient().get(org.onap.aai.domain.yang.VfModule.class, uri);
index 786cd3d..00bebdf 100644 (file)
@@ -41,11 +41,12 @@ import org.onap.so.bpmn.core.UrnPropertiesReader
 import org.onap.so.bpmn.core.WorkflowException
 import org.onap.so.bpmn.core.json.JsonUtils
 import org.onap.aaiclient.client.graphinventory.entities.uri.Depth
-import org.onap.aaiclient.client.aai.AAIObjectPlurals
 import org.onap.aaiclient.client.aai.AAIObjectType
 import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri
 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.logger.MessageEnum
 import org.slf4j.Logger
 import org.slf4j.LoggerFactory
@@ -142,7 +143,7 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase {
         try {
             def vnfId = execution.getVariable('vnfId')
 
-            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId).depth(Depth.ONE)
+            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)).depth(Depth.ONE)
             try {
                 Optional<GenericVnf> genericVnf = getAAIClient().get(GenericVnf.class,uri)
 
@@ -514,7 +515,7 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase {
 
                     // Query AAI for this network policy FQDN
 
-                                       AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY)
+                                       AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().networkPolicies())
                     uri.queryParam("network-policy-fqdn", fqdn)
 
                     try {
@@ -530,7 +531,7 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase {
 
                             // Retrieve the resource version for this network policy
                             try {
-                                AAIResourceUri delUri = AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, networkPolicyId)
+                                AAIResourceUri delUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().networkPolicy(networkPolicyId))
                                 getAAIClient().delete(delUri)
                                 execution.setVariable("DDVFMV_aaiDeleteNetworkPolicyReturnCode", 200)
                                 logger.debug(" ***** AAI delete network policy Response Code, NetworkPolicy #" + counting + " : " + 200)
index 355b5f7..22b16d0 100644 (file)
@@ -32,6 +32,7 @@ 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.so.bpmn.common.scripts.AaiUtil
 import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
 import org.onap.so.bpmn.common.scripts.ExceptionUtil
@@ -122,7 +123,7 @@ class DoDeleteVfModuleVolumeV2 extends AbstractServiceTaskProcessor{
                String cloudRegion = execution.getVariable('lcpCloudRegionId')
                AaiUtil aaiUtil = new AaiUtil(this)
 
-               AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, Defaults.CLOUD_OWNER.toString(), cloudRegion)
+               AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(Defaults.CLOUD_OWNER.toString(), cloudRegion))
                def queryCloudRegionRequest = aaiUtil.createAaiUri(uri)
 
                cloudRegion = aaiUtil.getAAICloudReqion(execution,  queryCloudRegionRequest, "PO", cloudRegion)
@@ -159,7 +160,7 @@ class DoDeleteVfModuleVolumeV2 extends AbstractServiceTaskProcessor{
                String cloudRegion = execution.getVariable(prefix+'aicCloudRegion')
 
                try {
-                       AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP , Defaults.CLOUD_OWNER.toString(), cloudRegion,volumeGroupId)
+                       AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(Defaults.CLOUD_OWNER.toString(), cloudRegion).volumeGroup(volumeGroupId))
                        Optional<VolumeGroup> volumeGroupOps = getAAIClient().get(VolumeGroup.class,resourceUri)
             if(volumeGroupOps.present) {
                 VolumeGroup volumeGroup = volumeGroupOps.get()
@@ -173,11 +174,11 @@ class DoDeleteVfModuleVolumeV2 extends AbstractServiceTaskProcessor{
                                String volumeGroupTenantId = null
 
                                if(relationships.isPresent()){
-                                       if(relationships.get().getRelatedAAIUris(AAIObjectType.VF_MODULE)){
+                                       if(relationships.get().getRelatedUris(Types.VF_MODULE)){
                                                logger.debug('Volume Group ' + volumeGroupId + ' currently in use')
                                                exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Volume Group ${volumeGroupId} currently in use - found vf-module relationship.")
                                        }
-                                       for(AAIResourceUri aaiResourceUri: relationships.get().getRelatedAAIUris(AAIObjectType.TENANT)){
+                                       for(AAIResourceUri aaiResourceUri: relationships.get().getRelatedUris(Types.TENANT)){
                                                volumeGroupTenantId = aaiResourceUri.getURIKeys().get(AAIFluentTypeBuilder.Types.TENANT.getUriParams().tenantId)
                                        }
                                }
@@ -264,7 +265,7 @@ class DoDeleteVfModuleVolumeV2 extends AbstractServiceTaskProcessor{
                String cloudRegion = execution.getVariable(prefix+'aicCloudRegion')
 
         try {
-            AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP,Defaults.CLOUD_OWNER.toString(), cloudRegion, volumeGroupId)
+            AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(Defaults.CLOUD_OWNER.toString(), cloudRegion).volumeGroup(volumeGroupId))
             getAAIClient().delete(resourceUri)
             logger.debug("Volume group $volumeGroupId deleted.")
         }catch (NotFoundException ex) {
index 25fbc93..181e62e 100644 (file)
@@ -40,6 +40,8 @@ import org.onap.aaiclient.client.aai.AAIObjectType
 import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
 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.w3c.dom.Document
 import org.w3c.dom.Element
 import org.w3c.dom.Node
@@ -104,14 +106,14 @@ class DoDeleteVnf extends AbstractServiceTaskProcessor {
                try {
 
                        AAIResourcesClient resourceClient = new AAIResourcesClient()
-                       AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, execution.getVariable('vnfId'))
+                       AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(execution.getVariable('vnfId')))
 
                        if(resourceClient.exists(uri)){
                                execution.setVariable("GENGV_FoundIndicator", true)
                                AAIResultWrapper wrapper = resourceClient.get(uri.depth(Depth.ONE))
                                if(wrapper.getRelationships().isPresent()){
-                                       List<AAIResourceUri> relationships = wrapper.getRelationships().get().getRelatedAAIUris(AAIObjectType.CLOUD_REGION)
-                                       relationships.addAll(wrapper.getRelationships().get().getRelatedAAIUris(AAIObjectType.L3_NETWORK))
+                                       List<AAIResourceUri> relationships = wrapper.getRelationships().get().getRelatedUris(Types.CLOUD_REGION)
+                                       relationships.addAll(wrapper.getRelationships().get().getRelatedUris(Types.L3_NETWORK))
                                        if(!relationships.isEmpty()){
                                                execution.setVariable("DoDVNF_vnfInUse", true)
                                        }else{
@@ -148,7 +150,7 @@ class DoDeleteVnf extends AbstractServiceTaskProcessor {
                        String vnfId = execution.getVariable("DoDVNF_vnfId")
 
                        AAIResourcesClient resourceClient = new AAIResourcesClient();
-                       AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
+                       AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId))
                        resourceClient.delete(uri)
 
                        logger.trace("COMPLETED deleteVnf")
index 2a0cb5e..5d1e2a2 100644 (file)
@@ -44,6 +44,8 @@ import org.onap.so.bpmn.core.json.JsonUtils
 import org.onap.aaiclient.client.graphinventory.entities.uri.Depth
 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.aaiclient.client.aai.AAIObjectType
 import org.onap.logging.filter.base.ErrorCode
 import org.onap.so.logger.MessageEnum
@@ -263,7 +265,7 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor {
                try {
                        def vnfId = execution.getVariable('vnfId')
                        
-                       AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId).depth(Depth.ONE)
+                       AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)).depth(Depth.ONE)
 
                        try {
                                Optional<GenericVnf> genericVnfOp = getAAIClient().get(GenericVnf.class,uri)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyAccessNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyAccessNSSI.groovy
new file mode 100644 (file)
index 0000000..f591855
--- /dev/null
@@ -0,0 +1,655 @@
+/*
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ # Copyright (c) 2020, Wipro Limited.
+ #
+ # Licensed under the Apache License, Version 2.0 (the "License")
+ # you may not use this file except in compliance with the License.
+ # You may obtain a copy of the License at
+ #
+ #       http://www.apache.org/licenses/LICENSE-2.0
+ #
+ # Unless required by applicable law or agreed to in writing, software
+ # distributed under the License is distributed on an "AS IS" BASIS,
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ # See the License for the specific language governing permissions and
+ # limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.scripts
+
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
+import org.onap.so.bpmn.common.scripts.ExceptionUtil
+import org.onap.so.bpmn.common.scripts.NssmfAdapterUtils
+import org.onap.so.bpmn.common.scripts.OofUtils
+import org.onap.so.bpmn.common.scripts.RequestDBUtil
+import org.onap.so.bpmn.core.json.JsonUtils
+import org.onap.so.db.request.beans.ResourceOperationStatus
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+import java.sql.Timestamp
+import java.util.List
+import static org.apache.commons.lang3.StringUtils.isBlank
+import com.google.gson.JsonObject
+import com.fasterxml.jackson.databind.ObjectMapper
+import com.google.gson.JsonArray
+import org.onap.so.beans.nsmf.AllocateTnNssi
+import org.onap.so.beans.nsmf.EsrInfo
+import org.onap.so.bpmn.core.UrnPropertiesReader
+import org.onap.so.bpmn.core.domain.ServiceDecomposition
+import org.onap.so.bpmn.core.domain.ServiceProxy
+
+import org.onap.aai.domain.yang.Relationship
+import org.onap.aai.domain.yang.ServiceInstance
+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.AAIResultWrapper
+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 javax.ws.rs.NotFoundException
+
+class DoModifyAccessNSSI extends AbstractServiceTaskProcessor {
+
+       String Prefix="MASS_"
+       ExceptionUtil exceptionUtil = new ExceptionUtil()
+       RequestDBUtil requestDBUtil = new RequestDBUtil()
+       JsonUtils jsonUtil = new JsonUtils()
+       OofUtils oofUtils = new OofUtils()
+       ObjectMapper objectMapper = new ObjectMapper();
+       AnNssmfUtils anNssmfUtils = new AnNssmfUtils()
+       private NssmfAdapterUtils nssmfAdapterUtils = new NssmfAdapterUtils(httpClientFactory, jsonUtil)
+
+       private static final Logger logger = LoggerFactory.getLogger(DoModifyAccessNSSI.class)
+
+       @Override
+       void preProcessRequest(DelegateExecution execution) {
+               logger.debug(Prefix + "preProcessRequest Start")
+               execution.setVariable("prefix", Prefix)
+               execution.setVariable("startTime", System.currentTimeMillis())
+               def msg
+               try {
+
+                       logger.debug("input variables : msoRequestId - "+execution.getVariable("msoRequestId")+
+                                       " globalSubscriberId - "+execution.getVariable("globalSubscriberId")+
+                                       " serviceInstanceID - "+execution.getVariable("serviceInstanceID")+
+                                       " nsiId - "+execution.getVariable("nsiId")+
+                                       " networkType - "+execution.getVariable("networkType")+
+                                       " subscriptionServiceType - "+execution.getVariable("subscriptionServiceType")+
+                                       " jobId - "+execution.getVariable("jobId")+
+                                       " sliceParams - "+execution.getVariable("sliceParams")+
+                                       " servicename - "+ execution.getVariable("servicename"))
+
+                       //validate slice subnet inputs
+
+                       String sliceParams = execution.getVariable("sliceParams")
+                       String modifyAction = jsonUtil.getJsonValue(sliceParams, "modifyAction")
+                       if (isBlank(modifyAction)) {
+                               msg = "Input modifyAction is null"
+                               logger.debug(msg)
+                               exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+                       } else {
+                               execution.setVariable("modifyAction", modifyAction)
+                               switch(modifyAction) {
+                                       case "allocate":
+                                               execution.setVariable("isModifyallocate", true)
+                                               break
+                                       case "deallocate":
+                                               execution.setVariable("isModifydeallocate", true)
+                                               break
+                                       case "reconfigure":
+                                               execution.setVariable("isModifyreconfigure", true)
+                                               String resourceConfig = jsonUtil.getJsonValue(sliceParams, "resourceConfig")
+                                               execution.setVariable("additionalProperties", resourceConfig)
+                                               break
+                                       default:
+                                               logger.debug("Invalid modify Action")
+                                               exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Invalid modify Action : "+modifyAction)
+                               }
+                       }
+                       List<String> snssaiList = jsonUtil.StringArrayToList(jsonUtil.getJsonValue(sliceParams, "snssaiList"))
+                       String sliceProfileId = jsonUtil.getJsonValue(sliceParams, "sliceProfileId")
+                       if (isBlank(sliceProfileId) || (snssaiList.empty)) {
+                               msg = "Mandatory fields are empty"
+                               logger.debug(msg)
+                               exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+                       } else {
+                               execution.setVariable("sliceProfileId", sliceProfileId)
+                               execution.setVariable("snssaiList", snssaiList)
+                       }
+                       String nsiName = jsonUtil.getJsonValue(sliceParams, "nsiInfo.nsiName")
+                       String scriptName = jsonUtil.getJsonValue(sliceParams, "scriptName")
+                       execution.setVariable("nsiName", nsiName)
+                       execution.setVariable("scriptName", scriptName)
+                       execution.setVariable("job_timeout", 10)
+                       execution.setVariable("ranNssiPreferReuse", false)
+               } catch(BpmnError e) {
+                       throw e
+               } catch(Exception ex) {
+                       msg = "Exception in DoModifyAccessNSSI.preProcessRequest " + ex.getMessage()
+                       logger.debug(msg)
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+               }
+               logger.debug(Prefix + "preProcessRequest Exit")
+       }
+       
+       def getSliceProfile = { DelegateExecution execution ->
+               logger.debug(Prefix + "getSliceProfiles Start")
+               String instanceId = execution.getVariable("sliceProfileId")
+               ServiceInstance sliceProfileInstance = getServiceInstance(execution, instanceId)
+               SliceProfile ranSliceProfile = sliceProfileInstance.getSliceProfiles().getSliceProfile().get(0)
+               logger.debug("RAN slice profile : "+ranSliceProfile.toString())
+               execution.setVariable("RANSliceProfile", ranSliceProfile)
+               execution.setVariable("ranSliceProfileInstance", sliceProfileInstance)
+       }
+       
+       /*
+        * Function to subnet capabilities from nssmf adapter
+        */
+       def getSubnetCapabilities = { DelegateExecution execution ->
+               logger.debug(Prefix+"getSubnetCapabilities method start")
+
+               String tnNssmfRequest = anNssmfUtils.buildCreateTNNSSMFSubnetCapabilityRequest()
+
+               String urlString = "/api/rest/provMns/v1/NSS/subnetCapabilityQuery"
+
+               String tnNssmfResponse = nssmfAdapterUtils.sendPostRequestNSSMF(execution, urlString, tnNssmfRequest)
+
+               if (tnNssmfResponse != null) {
+                       String FHCapabilities= jsonUtil.getJsonValue(tnNssmfResponse, "TN_FH")
+                       String MHCapabilities = jsonUtil.getJsonValue(tnNssmfResponse, "TN_MH")
+                       execution.setVariable("FHCapabilities",FHCapabilities)
+                       execution.setVariable("MHCapabilities",MHCapabilities)
+
+               } else {
+                       logger.error("received error message from NSSMF : "+ tnNssmfResponse)
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 7000,"Received a Bad Sync Response from NSSMF.")
+               }
+               String anNssmfRequest = anNssmfUtils.buildCreateANNFNSSMFSubnetCapabilityRequest()
+
+               String anNssmfResponse = nssmfAdapterUtils.sendPostRequestNSSMF(execution, urlString, anNssmfRequest)
+
+               if (anNssmfResponse != null) {
+                       String ANNFCapabilities = jsonUtil.getJsonValue(anNssmfResponse, "AN_NF")
+                       execution.setVariable("ANNFCapabilities",ANNFCapabilities)
+
+               } else {
+                       logger.error("received error message from NSSMF : "+ anNssmfResponse)
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 7000,"Received a Bad Sync Response from NSSMF.")
+               }
+       }
+
+       
+       /*
+        * prepare OOF request for RAN NSSI selection
+        */
+       def prepareOofRequestForRanNSS = { DelegateExecution execution ->
+               logger.debug(Prefix+"prepareOofRequestForRanNSS method start")
+
+               String urlString = UrnPropertiesReader.getVariable("mso.oof.endpoint", execution)
+               logger.debug( "get NSSI option OOF Url: " + urlString)
+
+               //build oof request body
+               boolean ranNssiPreferReuse = execution.getVariable("ranNssiPreferReuse");
+               String requestId = execution.getVariable("msoRequestId")
+               String messageType = "NSISelectionResponse"
+               Map<String, Object> profileInfo = objectMapper.readValue(execution.getVariable("RANSliceProfile"), Map.class)
+               ServiceInstance ranSliceProfileInstance = objectMapper.readValue(execution.getVariable("ranSliceProfileInstance"), ServiceInstance.class)
+               String modelUuid = ranSliceProfileInstance.getModelVersionId()
+               String modelInvariantUuid = ranSliceProfileInstance.getModelInvariantId()
+               String modelName = execution.getVariable("servicename")
+               String timeout = UrnPropertiesReader.getVariable("mso.adapters.oof.timeout", execution);
+               List<String> nsstInfoList =  new ArrayList<>()
+               JsonArray capabilitiesList = new JsonArray()
+               String FHCapabilities = execution.getVariable("FHCapabilities")
+               String MHCapabilities = execution.getVariable("MHCapabilities")
+               String ANNFCapabilities = execution.getVariable("ANNFCapabilities")
+               JsonObject FH = new JsonObject()
+               JsonObject MH = new JsonObject()
+               JsonObject ANNF = new JsonObject()
+               FH.addProperty("domainType", "TN_FH")
+               FH.addProperty("capabilityDetails", FHCapabilities)
+               MH.addProperty("domainType", "TN_MH")
+               MH.addProperty("capabilityDetails", MHCapabilities)
+               ANNF.addProperty("domainType", "AN_NF")
+               ANNF.addProperty("capabilityDetails", FHCapabilities)
+               capabilitiesList.add(FH)
+               capabilitiesList.add(MH)
+               capabilitiesList.add(ANNF)
+
+               execution.setVariable("nssiSelection_Url", "/api/oof/selection/nsi/v1")
+               execution.setVariable("nssiSelection_messageType",messageType)
+               execution.setVariable("nssiSelection_correlator",requestId)
+               execution.setVariable("nssiSelection_timeout",timeout)
+               String oofRequest = anNssmfUtils.buildSelectRANNSSIRequest(requestId, messageType, modelUuid,modelInvariantUuid,
+                               modelName, profileInfo, nsstInfoList, capabilitiesList, ranNssiPreferReuse)
+
+               execution.setVariable("nssiSelection_oofRequest",oofRequest)
+               logger.debug("Sending request to OOF: " + oofRequest)
+       }
+       
+       /*
+        * process OOF response for RAN NSSI selection
+        */
+       def processOofResponseForRanNSS = { DelegateExecution execution ->
+               logger.debug(Prefix+"processOofResponseForRanNSS method start")
+               String oofResponse = execution.getVariable("nssiSelection_asyncCallbackResponse")
+               String requestStatus = jsonUtil.getJsonValue(oofResponse, "requestStatus")
+               if(requestStatus.equals("completed")) {
+                       List<String> solution = jsonUtil.StringArrayToList(jsonUtil.getJsonValue(oofResponse, "solutions"))
+                       boolean existingNSI = jsonUtil.getJsonValue(solution.get(0), "existingNSI")
+                       if(!existingNSI) {
+                               def sliceProfiles = jsonUtil.getJsonValue(solution.get(0), "newNSISolution.sliceProfiles")
+                               execution.setVariable("RanConstituentSliceProfiles", sliceProfiles)
+                               List<String> ranConstituentSliceProfiles = jsonUtil.StringArrayToList(sliceProfiles)
+                               anNssmfUtils.createDomainWiseSliceProfiles(ranConstituentSliceProfiles, execution)
+                               logger.debug("RanConstituentSliceProfiles list from OOF "+sliceProfiles)
+                       }else {
+                               String statusMessage = jsonUtil.getJsonValue(oofResponse, "statusMessage")
+                               logger.error("failed to get slice profiles from oof "+ statusMessage)
+                               exceptionUtil.buildAndThrowWorkflowException(execution, 7000,"failed to get slice profiles from oof "+statusMessage)
+                       }
+               }else {
+                       String statusMessage = jsonUtil.getJsonValue(oofResponse, "statusMessage")
+                       logger.error("received failed status from oof "+ statusMessage)
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 7000,"Received a failed Async Response from OOF : "+statusMessage)
+               }
+
+       }
+       def getNssisFromAai = { DelegateExecution execution ->
+               logger.debug(Prefix+"getNssisFromAai method start")
+               String instanceId = execution.getVariable("serviceInstanceID")
+               String role = "nssi"
+               Map<String,ServiceInstance> ranConstituentNssis = getRelatedInstancesByRole(execution, role, instanceId)
+               logger.debug("getNssisFromAai ranConstituentNssis : "+ranConstituentNssis.toString())
+               ranConstituentNssis.each { key, val -> 
+                       switch(key) {
+                               case "AN-NF":
+                                       execution.setVariable("ANNF_NSSI", val.getServiceInstanceId())
+                                       execution.setVariable("ANNF_nssiName", val.getServiceInstanceName())
+                                       break
+                               case "TN-FH":
+                                       execution.setVariable("TNFH_NSSI", val.getServiceInstanceId())
+                                       execution.setVariable("TNFH_nssiName", val.getServiceInstanceName())
+                                       break
+                               case "TN-MH":
+                                       execution.setVariable("TNMH_NSSI", val.getServiceInstanceId())
+                                       execution.setVariable("TNMH_nssiName", val.getServiceInstanceName())
+                                       break
+                               default:
+                                       logger.error("No expected match found for current domainType "+ key)
+                                       exceptionUtil.buildAndThrowWorkflowException(execution, 1000,"No expected match found for current domainType "+ key)
+                       }
+               }
+               
+       }
+       def createSliceProfiles = { DelegateExecution execution ->
+               logger.debug(Prefix+"createSliceProfiles method start")
+               anNssmfUtils.createSliceProfilesInAai(execution)
+       }
+       def updateRelationshipInAai = { DelegateExecution execution ->
+               logger.debug(Prefix+"updateRelationshipInAai method start")
+               String msg = ""
+               try {
+                       def ANNF_serviceInstanceId = execution.getVariable("ANNF_NSSI")
+                       def TNFH_serviceInstanceId = execution.getVariable("TNFH_NSSI")
+                       def TNMH_serviceInstanceId = execution.getVariable("TNMH_NSSI")
+                       def AN_profileInstanceId = execution.getVariable("sliceProfileId")
+                       def ANNF_profileInstanceId = execution.getVariable("ANNF_sliceProfileInstanceId")
+                       def TNFH_profileInstanceId = execution.getVariable("TNFH_sliceProfileInstanceId")
+                       def TNMH_profileInstanceId = execution.getVariable("TNMH_sliceProfileInstanceId")
+                       String globalSubscriberId = execution.getVariable("globalSubscriberId")
+                       String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
+
+                       Relationship ANNF_relationship = new Relationship()
+                       Relationship TNFH_relationship = new Relationship()
+                       Relationship TNMH_relationship = new Relationship()
+                       
+                       String ANNF_relatedLink = "aai/v16/business/customers/customer/${globalSubscriberId}/service-subscriptions/service-subscription/${subscriptionServiceType}/service-instances/service-instance/${ANNF_profileInstanceId}"
+                       String TNFH_relatedLink = "aai/v16/business/customers/customer/${globalSubscriberId}/service-subscriptions/service-subscription/${subscriptionServiceType}/service-instances/service-instance/${TNFH_profileInstanceId}"
+                       String TNMH_relatedLink = "aai/v16/business/customers/customer/${globalSubscriberId}/service-subscriptions/service-subscription/${subscriptionServiceType}/service-instances/service-instance/${TNMH_profileInstanceId}"
+                       
+                       ANNF_relationship.setRelatedLink(ANNF_relatedLink)
+                       ANNF_relationship.setRelatedTo("service-instance")
+                       ANNF_relationship.setRelationshipLabel("org.onap.relationships.inventory.ComposedOf")
+                       TNFH_relationship.setRelatedLink(TNFH_relatedLink)
+                       TNFH_relationship.setRelatedTo("service-instance")
+                       TNFH_relationship.setRelationshipLabel("org.onap.relationships.inventory.ComposedOf")
+                       TNMH_relationship.setRelatedLink(TNMH_relatedLink)
+                       TNMH_relationship.setRelatedTo("service-instance")
+                       TNMH_relationship.setRelationshipLabel("org.onap.relationships.inventory.ComposedOf")
+                       
+                       // create SliceProfile and NSSI relationship in AAI
+                       anNssmfUtils.createRelationShipInAAI(execution, ANNF_relationship,ANNF_serviceInstanceId)
+                       anNssmfUtils.createRelationShipInAAI(execution, TNFH_relationship,TNFH_serviceInstanceId)
+                       anNssmfUtils.createRelationShipInAAI(execution, TNMH_relationship,TNMH_serviceInstanceId)
+                       anNssmfUtils.createRelationShipInAAI(execution, ANNF_relationship,AN_profileInstanceId)
+                       anNssmfUtils.createRelationShipInAAI(execution, TNFH_relationship,AN_profileInstanceId)
+                       anNssmfUtils.createRelationShipInAAI(execution, TNMH_relationship,AN_profileInstanceId)
+
+               } catch (BpmnError e) {
+                       throw e
+               } catch (Exception ex) {
+
+                       msg = "Exception in DoCreateE2EServiceInstance.createCustomRelationship. " + ex.getMessage()
+                       logger.info(msg)
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+               }
+       }
+       
+       def processRanNfModifyRsp = { DelegateExecution execution ->
+               logger.debug(Prefix+"processRanNfModifyRsp method start")
+               anNssmfUtils.processRanNfModifyRsp(execution)
+       }
+       
+       def prepareTnFhRequest = { DelegateExecution execution ->
+               logger.debug(Prefix+"prepareTnFhRequest method start")
+
+               String nssmfRequest = anNssmfUtils.buildCreateNSSMFRequest(execution, "TN_FH", "modify-allocate")
+               String urlString = "/api/rest/provMns/v1/NSS/SliceProfiles"
+               String nssmfResponse = nssmfAdapterUtils.sendPostRequestNSSMF(execution, urlString, nssmfRequest)
+
+               if (nssmfResponse != null) {
+                       execution.setVariable("nssmfResponse", nssmfResponse)
+                       String jobId = jsonUtil.getJsonValue(nssmfResponse, "jobId")
+                       execution.setVariable("TNFH_jobId",jobId)
+               } else {
+                       logger.error("received error message from NSSMF : "+ nssmfResponse)
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 7000,"Received a Bad Sync Response from NSSMF.")
+               }
+               logger.debug("Exit prepareTnFhRequest")
+
+       }
+       def prepareTnMhRequest = { DelegateExecution execution ->
+               logger.debug(Prefix+"prepareTnMhRequest method start")
+
+               String nssmfRequest = anNssmfUtils.buildCreateNSSMFRequest(execution, "TN_MH", "modify-allocate")
+               String urlString = "/api/rest/provMns/v1/NSS/SliceProfiles"
+               String nssmfResponse = nssmfAdapterUtils.sendPostRequestNSSMF(execution, urlString, nssmfRequest)
+
+               if (nssmfResponse != null) {
+                       execution.setVariable("nssmfResponse", nssmfResponse)
+                       String jobId = jsonUtil.getJsonValue(nssmfResponse, "jobId")
+                       execution.setVariable("TNMH_jobId",jobId)
+               } else {
+                       logger.error("received error message from NSSMF : "+ nssmfResponse)
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 7000,"Received a Bad Sync Response from NSSMF.")
+               }
+               logger.debug("Exit prepareTnMhRequest")
+       }
+       
+       def createFhAllocateNssiJobQuery = { DelegateExecution execution ->
+               logger.debug(Prefix+"createModifyNssiQueryJobStatus method start")
+               createTnAllocateNssiJobQuery(execution, "TN_FH")
+       }
+       
+       def createMhAllocateNssiJobQuery = { DelegateExecution execution ->
+               logger.debug(Prefix+"createModifyNssiQueryJobStatus method start")
+               createTnAllocateNssiJobQuery(execution, "TN_MH")
+       }
+       
+       private void createTnAllocateNssiJobQuery(DelegateExecution execution, String domainType) {
+               EsrInfo esrInfo = new EsrInfo()
+               esrInfo.setNetworkType("TN")
+               esrInfo.setVendor("ONAP")
+               String esrInfoString = objectMapper.writeValueAsString(esrInfo)
+               execution.setVariable("esrInfo", esrInfoString)
+               JsonObject serviceInfo = new JsonObject()
+               
+               serviceInfo.addProperty("nsiId", execution.getVariable("nsiId"))
+               String sST = jsonUtil.getJsonValue(execution.getVariable("sliceProfile"), "sST")
+               serviceInfo.addProperty("sST", sST)
+               serviceInfo.addProperty("PLMNIdList", objectMapper.writeValueAsString(execution.getVariable("plmnIdList")))
+               serviceInfo.addProperty("globalSubscriberId", execution.getVariable("globalSubscriberId"))
+               serviceInfo.addProperty("subscriptionServiceType", execution.getVariable("subscriptionServiceType"))
+               serviceInfo.addProperty("serviceInvariantUuid", null)
+               serviceInfo.addProperty("serviceUuid", null)
+               if(domainType.equals("TN_FH")) {
+                       serviceInfo.addProperty("nssiId", execution.getVariable("TNFH_NSSI"))
+                       serviceInfo.addProperty("nssiName", execution.getVariable("TNFH_nssiName"))
+               }else if(domainType.equals("TN_MH")) {
+                       serviceInfo.addProperty("nssiId", execution.getVariable("TNMH_NSSI"))
+                       serviceInfo.addProperty("nssiName", execution.getVariable("TNMH_nssiName"))
+               }
+               execution.setVariable("serviceInfo", serviceInfo.toString())
+               execution.setVariable("responseId", "")
+       }
+       
+       def processFhAllocateNssiJobStatusRsp = { DelegateExecution execution ->
+               logger.debug(Prefix+"processJobStatusRsp method start")
+               String jobResponse = execution.getVariable("TNFH_jobResponse")
+               logger.debug("Job status response "+jobResponse)
+               String status = jsonUtil.getJsonValue(jobResponse, "responseDescriptor.status")
+               String nssi = jsonUtil.getJsonValue(jobResponse, "responseDescriptor.nssi")
+               if(status.equalsIgnoreCase("finished")) {
+                       logger.debug("Job successfully completed ... proceeding with flow for nssi : "+nssi)
+               }
+               else {
+                       String statusDescription = jsonUtil.getJsonValue(jobResponse, "responseDescriptor.statusDescription")
+                       logger.error("received failed status from job status query for nssi : "+nssi+" with status description : "+ statusDescription)
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 7000,"received failed status from job status query for nssi : "+nssi+" with status description : "+ statusDescription)
+               }
+       }
+       
+       def processMhAllocateNssiJobStatusRsp = { DelegateExecution execution ->
+               logger.debug(Prefix+"processJobStatusRsp method start")
+               String jobResponse = execution.getVariable("TNMH_jobResponse")
+               logger.debug("Job status response "+jobResponse)
+               String status = jsonUtil.getJsonValue(jobResponse, "responseDescriptor.status")
+               String nssi = jsonUtil.getJsonValue(jobResponse, "responseDescriptor.nssi")
+               if(status.equalsIgnoreCase("finished")) {
+                       logger.debug("Job successfully completed ... proceeding with flow for nssi : "+nssi)
+               }
+               else {
+                       String statusDescription = jsonUtil.getJsonValue(jobResponse, "responseDescriptor.statusDescription")
+                       logger.error("received failed status from job status query for nssi : "+nssi+" with status description : "+ statusDescription)
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 7000,"received failed status from job status query for nssi : "+nssi+" with status description : "+ statusDescription)
+               }
+       }
+       
+       def getSliceProfilesFromAai = { DelegateExecution execution ->
+               logger.debug(Prefix+"getSliceProfilesFromAai method start")
+               String instanceId = execution.getVariable("sliceProfileId")
+               String role = "slice-profile-instance"
+               Map<String,ServiceInstance> ranConstituentSliceProfiles = getRelatedInstancesByRole(execution, role, instanceId)
+               logger.debug("getSliceProfilesFromAai ranConstituentSliceProfiles : "+ranConstituentSliceProfiles.toString())
+               ranConstituentSliceProfiles.each { key, val ->
+                       switch(key) {
+                               case "AN-NF":
+                                       execution.setVariable("ANNF_sliceProfileInstanceId", val.getServiceInstanceId())
+                                       break
+                               case "TN-FH":
+                                       execution.setVariable("TNFH_sliceProfileInstanceId", val.getServiceInstanceId())
+                                       break
+                               case "TN-MH":
+                                       execution.setVariable("TNMH_sliceProfileInstanceId", val.getServiceInstanceId())
+                                       break
+                               default:
+                                       logger.error("No expected match found for current domainType "+ key)
+                                       exceptionUtil.buildAndThrowWorkflowException(execution, 1000,"No expected match found for current domainType "+ key)
+                       }
+               }
+       }
+       
+       def prepareTnFhDeallocateRequest = { DelegateExecution execution ->
+               logger.debug(Prefix+"prepareTnFhDeallocateRequest method start")
+               String nssmfRequest = anNssmfUtils.buildDeallocateNssiRequest(execution, "TN_FH")
+               String nssiId = execution.getVariable("TNFH_NSSI")
+               execution.setVariable("tnFHNSSIId", nssiId)
+               String urlString = "/api/rest/provMns/v1/NSS/nssi/" + nssiId
+                               String nssmfResponse = nssmfAdapterUtils.sendPostRequestNSSMF(execution, urlString, nssmfRequest)
+                               if (nssmfResponse != null) {
+                                       String jobId = jsonUtil.getJsonValue(nssmfResponse, "jobId")
+                                       execution.setVariable("TN_FH_jobId",jobId)
+                               } else {
+                                       logger.error("received error message from NSSMF : "+ nssmfResponse)
+                                       exceptionUtil.buildAndThrowWorkflowException(execution, 7000,"Received a Bad Sync Response from NSSMF.")
+                               }
+       }
+       
+       def prepareTnMhDeallocateRequest = { DelegateExecution execution ->
+               logger.debug(Prefix+"prepareTnFhDeallocateRequest method start")
+               String nssmfRequest = anNssmfUtils.buildDeallocateNssiRequest(execution, "TN_FH")
+               String nssiId = execution.getVariable("TNFH_NSSI")
+               execution.setVariable("tnFHNSSIId", nssiId)
+               String urlString = "/api/rest/provMns/v1/NSS/nssi/" + nssiId
+                               String nssmfResponse = nssmfAdapterUtils.sendPostRequestNSSMF(execution, urlString, nssmfRequest)
+                               if (nssmfResponse != null) {
+                                       String jobId = jsonUtil.getJsonValue(nssmfResponse, "jobId")
+                                       execution.setVariable("TN_MH_jobId",jobId)
+                               } else {
+                                       logger.error("received error message from NSSMF : "+ nssmfResponse)
+                                       exceptionUtil.buildAndThrowWorkflowException(execution, 7000,"Received a Bad Sync Response from NSSMF.")
+                               }
+       }
+       
+       def createFhDeAllocateNssiJobQuery = { DelegateExecution execution ->
+               logger.debug(Prefix+"createModifyNssiQueryJobStatus method start")
+               createTnAllocateNssiJobQuery(execution, "TN_FH")
+       }
+       
+       def createMhDeAllocateNssiJobQuery = { DelegateExecution execution ->
+               logger.debug(Prefix+"createModifyNssiQueryJobStatus method start")
+               createTnAllocateNssiJobQuery(execution, "TN_MH")
+       }
+       def deleteFhSliceProfile = { DelegateExecution execution ->
+               logger.debug(Prefix+"deleteFhSliceProfile method start")
+               deleteServiceInstanceInAAI(execution,execution.getVariable("TNFH_sliceProfileInstanceId"))
+       }
+       def deleteMhSliceProfile = { DelegateExecution execution ->
+               logger.debug(Prefix+"deleteMhSliceProfile method start")
+               deleteServiceInstanceInAAI(execution,execution.getVariable("TNMH_sliceProfileInstanceId"))      
+       }
+       def deleteAnSliceProfile = { DelegateExecution execution ->
+               logger.debug(Prefix+"deleteAnSliceProfile method start")
+               deleteServiceInstanceInAAI(execution,execution.getVariable("ANNF_sliceProfileInstanceId"))
+       }
+       /**
+        * update operation status in request db
+        *
+        */
+       def prepareOperationStatusUpdate = { DelegateExecution execution ->
+               logger.debug(Prefix + "prepareOperationStatusUpdate Start")
+
+               String serviceId = execution.getVariable("serviceInstanceID")
+               String jobId = execution.getVariable("jobId")
+               String nsiId = execution.getVariable("nsiId")
+               String nssiId = execution.getVariable("serviceInstanceID")
+               logger.debug("Service Instance serviceId:" + serviceId + " jobId:" + jobId)
+
+               ResourceOperationStatus updateStatus = new ResourceOperationStatus()
+               updateStatus.setServiceId(serviceId)
+               updateStatus.setOperationId(jobId)
+               updateStatus.setResourceTemplateUUID(nsiId)
+               updateStatus.setResourceInstanceID(nssiId)
+               updateStatus.setOperType("Modify")
+               updateStatus.setProgress(100)
+               updateStatus.setStatus("finished")
+               requestDBUtil.prepareUpdateResourceOperationStatus(execution, updateStatus)
+
+               logger.debug(Prefix + "prepareOperationStatusUpdate Exit")
+       }
+
+       def prepareFailedOperationStatusUpdate = { DelegateExecution execution ->
+               logger.debug(Prefix + "prepareFailedOperationStatusUpdate Start")
+               
+               String serviceId = execution.getVariable("serviceInstanceID")
+               String jobId = execution.getVariable("jobId")
+               String nsiId = execution.getVariable("nsiId")
+               String nssiId = execution.getVariable("serviceInstanceID")
+               logger.debug("Service Instance serviceId:" + serviceId + " jobId:" + jobId)
+
+               ResourceOperationStatus updateStatus = new ResourceOperationStatus()
+               updateStatus.setServiceId(serviceId)
+               updateStatus.setOperationId(jobId)
+               updateStatus.setResourceTemplateUUID(nsiId)
+               updateStatus.setResourceInstanceID(nssiId)
+               updateStatus.setOperType("Modify")
+               updateStatus.setProgress(0)
+               updateStatus.setStatus("failed")
+               requestDBUtil.prepareUpdateResourceOperationStatus(execution, updateStatus)
+       }
+       
+       /**
+        * @param execution
+        * @param role            - nssi/slice profile instance
+        * @param instanceId    - id to which the related list to be found
+        * @return
+        */
+       private Map<String,ServiceInstance> getRelatedInstancesByRole(DelegateExecution execution,String role,String instanceId) {
+               logger.debug("${Prefix} - Fetching related ${role} from AAI")
+               String globalSubscriberId = execution.getVariable("globalSubscriberId")
+               String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
+               
+               Map<String,ServiceInstance> relatedInstances = new HashMap<>()
+               
+               AAIResourcesClient client = new AAIResourcesClient()
+               AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(instanceId))
+               if (!client.exists(uri)) {
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service Instance was not found in aai : ${instanceId}")
+               }
+               AAIResultWrapper wrapper = client.get(uri, NotFoundException.class)
+               Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class)
+               if(si.isPresent()) {
+               List<Relationship> relationshipList = si.get().getRelationshipList().getRelationship()
+               for (Relationship relationship : relationshipList) {
+                       String relatedTo = relationship.getRelatedTo()
+                       if (relatedTo.toLowerCase() == "service-instance") {
+                               String relatioshipurl = relationship.getRelatedLink()
+                               String serviceInstanceId =
+                                               relatioshipurl.substring(relatioshipurl.lastIndexOf("/") + 1, relatioshipurl.length())
+
+                               AAIResourcesClient client01 = new AAIResourcesClient()
+                               AAIResourceUri uri01 = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(serviceInstanceId))
+                               if (!client.exists(uri01)) {
+                                       exceptionUtil.buildAndThrowWorkflowException(execution, 2500,
+                                                       "Service Instance was not found in aai: ${serviceInstanceId} related to ${instanceId}")
+                               }
+                               AAIResultWrapper wrapper01 = client01.get(uri01, NotFoundException.class)
+                               Optional<ServiceInstance> serviceInstance = wrapper01.asBean(ServiceInstance.class)
+                               if (serviceInstance.isPresent()) {
+                                       ServiceInstance instance = serviceInstance.get()
+                                       if (role.equalsIgnoreCase(instance.getServiceRole())) {
+                                               relatedInstances.put(instance.getWorkloadContext(),instance)
+                                       }
+                               }
+                       }
+               }
+               }
+               logger.debug("Found ${relatedInstances.size()} ${role} related to ${instanceId} ")
+               return relatedInstances
+       }
+       
+       private ServiceInstance getServiceInstance(DelegateExecution execution, String instanceId) {
+               String globalSubscriberId = execution.getVariable("globalSubscriberId")
+               String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
+               ServiceInstance serviceInstance = new ServiceInstance()
+               AAIResourcesClient client = new AAIResourcesClient()
+               AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(instanceId))
+               if (!client.exists(uri)) {
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service Instance was not found in aai : ${instanceId}")
+               }
+               AAIResultWrapper wrapper = client.get(uri, NotFoundException.class)
+               Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class)
+               
+               if(si.isPresent()) {
+                       serviceInstance = si
+               }
+               return serviceInstance
+       }
+       private void deleteServiceInstanceInAAI(DelegateExecution execution,String instanceId) {
+               try {
+                       AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("serviceType")).serviceInstance(instanceId))
+                       getAAIClient().delete(serviceInstanceUri)
+                       logger.debug("${Prefix} Exited deleteServiceInstance")
+               }catch(Exception e){
+                       logger.debug("Error occured within deleteServiceInstance method: " + e)
+               }
+       }
+}
\ No newline at end of file
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
new file mode 100644 (file)
index 0000000..ebeab3e
--- /dev/null
@@ -0,0 +1,174 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020  Telecom Italia
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.scripts
+
+import 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.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
+
+class DoModifyCoreNSSI extends DoCommonCoreNSSI {
+
+    private final String PREFIX ="DoModifyCoreNSSI"
+
+    private ExceptionUtil exceptionUtil = new ExceptionUtil()
+    private RequestDBUtil requestDBUtil = new RequestDBUtil()
+    private MsoUtils utils = new MsoUtils()
+    private JsonUtils jsonUtil = new JsonUtils()
+
+    private static final Logger LOGGER = LoggerFactory.getLogger( DoModifyCoreNSSI.class)
+
+    /**
+     * Creates Slice Profile Instance
+     * @param execution
+     */
+    void createSliceProfileInstance(DelegateExecution execution) {
+        LOGGER.trace("${PREFIX} Start createSliceProfileInstance")
+
+        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']
+
+        SliceProfile sliceProfile = new SliceProfile()
+        sliceProfile.setServiceAreaDimension("")
+        sliceProfile.setPayloadSize(0)
+        sliceProfile.setJitter(0)
+        sliceProfile.setSurvivalTime(0)
+        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.setProfileId(sliceProfileID)
+        sliceProfile.setE2ELatency(0)
+
+        try {
+            AAIResourcesClient client = getAAIClient()
+            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(serviceType).serviceInstance(nssiId).sliceProfile(sliceProfileID))
+            client.create(uri, sliceProfile)
+
+            currentNSSI['createdSliceProfile'] = sliceProfile
+        } catch (Exception ex) {
+            exceptionUtil.buildAndThrowWorkflowException(execution, 25000, "Exception occured while Slice Profile create call:" + ex.getMessage())
+        }
+
+        LOGGER.trace("${PREFIX} Exit createSliceProfileInstance")
+    }
+
+
+    /**
+     * 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))
+
+        try {
+            SliceProfile createdSliceProfile = (SliceProfile)currentNSSI['createdSliceProfile']
+            ServiceInstance nssi = (ServiceInstance)currentNSSI['nssi']
+            List<SliceProfile> associatedProfiles = nssi.getSliceProfiles().getSliceProfile()
+            associatedProfiles.add(createdSliceProfile)
+
+            getAAIClient().update(nssiUri, nssi)
+
+            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())
+        }
+
+        LOGGER.trace("${PREFIX} Exit associateSliceProfileInstanceWithNSSI")
+    }
+
+
+    @Override
+    String getPrefix() {
+        return PREFIX
+    }
+
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyRanNfNssi.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyRanNfNssi.groovy
new file mode 100644 (file)
index 0000000..6fdfbe3
--- /dev/null
@@ -0,0 +1,193 @@
+/*
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ # Copyright (c) 2020, Wipro Limited.
+ #
+ # Licensed under the Apache License, Version 2.0 (the "License")
+ # you may not use this file except in compliance with the License.
+ # You may obtain a copy of the License at
+ #
+ #       http://www.apache.org/licenses/LICENSE-2.0
+ #
+ # Unless required by applicable law or agreed to in writing, software
+ # distributed under the License is distributed on an "AS IS" BASIS,
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ # See the License for the specific language governing permissions and
+ # limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.scripts
+
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
+import org.onap.so.bpmn.common.scripts.ExceptionUtil
+import org.onap.so.bpmn.core.json.JsonUtils
+import com.fasterxml.jackson.databind.ObjectMapper
+import com.google.gson.JsonObject
+import java.sql.Timestamp
+
+import static org.apache.commons.lang3.StringUtils.isBlank
+import org.onap.so.bpmn.core.UrnPropertiesReader
+
+class DoModifyRanNfNssi extends AbstractServiceTaskProcessor {
+
+       String Prefix="MANNFNSS_"
+       ExceptionUtil exceptionUtil = new ExceptionUtil()
+       JsonUtils jsonUtil = new JsonUtils()
+       ObjectMapper objectMapper = new ObjectMapper();
+       AnNssmfUtils anNssmfUtils = new AnNssmfUtils()
+
+       private static final Logger logger = LoggerFactory.getLogger(DoModifyRanNfNssi.class)
+
+       @Override
+       void preProcessRequest(DelegateExecution execution) {
+               logger.debug(Prefix + "preProcessRequest Start")
+               execution.setVariable("prefix", Prefix)
+               execution.setVariable("startTime", System.currentTimeMillis())
+               def msg
+               try {
+
+                       logger.debug("input variables : msoRequestId - "+execution.getVariable("msoRequestId")+
+                                       " globalSubscriberId - "+execution.getVariable("globalSubscriberId")+
+                                       " serviceInstanceID - "+execution.getVariable("serviceInstanceID")+
+                                       " subscriptionServiceType - "+execution.getVariable("subscriptionServiceType")+
+                                       " sliceProfileId - "+execution.getVariable("sliceProfileId")+
+                                       " snssaiList - "+execution.getVariable("snssaiList")+
+                                       " modifyAction - "+execution.getVariable("modifyAction"))
+
+                       //validate RAN NF slice subnet inputs
+
+                       String modifyAction = execution.getVariable("modifyAction")
+                       if (isBlank(modifyAction)) {
+                               msg = "Input modifyAction is null"
+                               logger.debug(msg)
+                               exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+                       } else {
+                               execution.setVariable("modifyAction", modifyAction)
+                               switch(modifyAction) {
+                                       case "allocate":
+                                               String sliceProfile = execution.getVariable("additionalProperties")
+                                               execution.setVariable("sliceProfile", sliceProfile)
+                                               break
+                                       case "reconfigure":
+                                               String resourceConfig = execution.getVariable("additionalProperties")
+                                               execution.setVariable("resourceConfig", resourceConfig)
+                                               break
+                                       default:
+                                               logger.debug("Invalid modify Action")
+                                               exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Invalid modify Action : "+modifyAction)
+                               }
+                       }
+                       List<String> snssaiList = objectMapper.readValue(execution.getVariable("snssaiList"), List.class)
+                       String sliceProfileId = execution.getVariable("sliceProfileId")
+                       if (isBlank(sliceProfileId) || (snssaiList.empty)) {
+                               msg = "Mandatory fields are empty"
+                               logger.debug(msg)
+                               exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+                       } else {
+                               execution.setVariable("sliceProfileId", sliceProfileId)
+                               execution.setVariable("snssaiList", snssaiList)
+                               execution.setVariable("snssai", snssaiList.get(0))
+                       }
+                       
+               } catch(BpmnError e) {
+                       throw e
+               } catch(Exception ex) {
+                       msg = "Exception in DoModifyAccessNssi.preProcessRequest " + ex.getMessage()
+                       logger.debug(msg)
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+               }
+               logger.debug(Prefix + "preProcessRequest Exit")
+       }
+       
+       def createSdnrRequest = { DelegateExecution execution ->
+               logger.debug(Prefix+"createSdnrRequest method start")
+               String callbackUrl = UrnPropertiesReader.getVariable("mso.workflow.message.endpoint") + "/AsyncSdnrResponse/"+execution.getVariable("msoRequestId")
+               String modifyAction = execution.getVariable("modifyAction")
+               String sdnrRequest = buildSdnrAllocateRequest(execution, modifyAction, "InstantiateRANSlice", callbackUrl)
+               execution.setVariable("createNSSI_sdnrRequest", sdnrRequest)
+               execution.setVariable("createNSSI_timeout", "PT10M")
+               execution.setVariable("createNSSI_correlator", execution.getVariable("msoRequestId"))
+               execution.setVariable("createNSSI_messageType", "AsyncSdnrResponse");
+       }
+       
+       def processSdnrResponse = { DelegateExecution execution ->
+               logger.debug(Prefix+"processSdnrResponse method start")
+               String SDNRResponse = execution.getVariable("SDNR_asyncCallbackResponse")
+               String status = jsonUtil.getJsonValue(SDNRResponse, "status")
+               if(status.equalsIgnoreCase("success")) {
+                       String nfIds = jsonUtil.getJsonValue(SDNRResponse, "nfIds")
+                       execution.setVariable("ranNfIdsJson", nfIds)
+               }else {
+                       String reason = jsonUtil.getJsonValue(SDNRResponse, "reason")
+                       logger.error("received failed status from SDNR "+ reason)
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 7000,"received failed status from SDNR "+ reason)
+               }
+               logger.debug("response from SDNR "+SDNRResponse)
+       }
+       
+       private String buildSdnrAllocateRequest(DelegateExecution execution, String action, String rpcName, String callbackUrl) {
+               
+               String requestId = execution.getVariable("msoRequestId")
+               Date date = new Date().getTime()
+               Timestamp time = new Timestamp(date)
+               String sliceProfileString
+               JsonObject response = new JsonObject()
+               JsonObject body = new JsonObject()
+               JsonObject input = new JsonObject()
+               JsonObject commonHeader = new JsonObject()
+               JsonObject payload = new JsonObject()
+               JsonObject payloadInput = new JsonObject()
+               if(action.equals("allocate")) {
+                       Map<String,Object> sliceProfile = objectMapper.readValue(execution.getVariable("sliceProfile"), Map.class)
+                       sliceProfile.put("sliceProfileId", execution.getVariable("sliceProfileId"))
+                       sliceProfile.put("maxNumberofConns", sliceProfile.get("maxNumberofPDUSessions"))
+                       sliceProfile.put("uLThptPerSlice", sliceProfile.get("expDataRateUL"))
+                       sliceProfile.put("dLThptPerSlice", sliceProfile.get("expDataRateDL"))
+                       sliceProfileString = objectMapper.writeValueAsString(sliceProfile)
+                       action = "modify-"+action
+                       payloadInput.add("additionalproperties", new JsonObject())
+               }else if(action.equals("deallocate")) {
+                       action = "modify-"+action
+                       Map<String,Object> sliceProfile = new HashMap<>()
+                       sliceProfile.put("sliceProfileId", execution.getVariable("sliceProfileId"))
+                       sliceProfile.put("sNSSAI", execution.getVariable("snssai"))
+                       sliceProfileString = objectMapper.writeValueAsString(sliceProfile)
+                       payloadInput.add("additionalproperties", new JsonObject())
+               }else if(action.equals("reconfigure")) {
+                       Map<String,Object> sliceProfile = new HashMap<>()
+                       sliceProfile.put("sliceProfileId", execution.getVariable("sliceProfileId"))
+                       sliceProfile.put("sNSSAI", execution.getVariable("snssai"))
+                       sliceProfileString = objectMapper.writeValueAsString(sliceProfile)
+                       JsonObject resourceconfig = new JsonObject()
+                       resourceconfig.addProperty("resourceConfig", execution.getVariable("resourceConfig"))
+                       payloadInput.add("additionalproperties", resourceconfig)
+               }
+               commonHeader.addProperty("TimeStamp", time.toString())
+               commonHeader.addProperty("APIver", "1.0")
+               commonHeader.addProperty("RequestID", requestId)
+               commonHeader.addProperty("SubRequestID", "1")
+               commonHeader.add("RequestTrack", new JsonObject())
+               commonHeader.add("Flags", new JsonObject())
+               payloadInput.addProperty("sliceProfile", sliceProfileString)
+               payloadInput.addProperty("RANNFNSSIId", execution.getVariable("serviceInstanceID"))
+               payloadInput.addProperty("callbackURL", callbackUrl)
+               payload.add("input", payloadInput)
+               input.add("CommonHeader", commonHeader)
+               input.addProperty("Action", action)
+               input.add("Payload", payload)
+               body.add("input", input)
+               response.add("body", body)
+               response.addProperty("version", "1.0")
+               response.addProperty("rpc-name", rpcName)
+               response.addProperty("correlation-id", requestId+"-1")
+               response.addProperty("type", "request")
+               return response.toString()
+       }
+       
+}
\ No newline at end of file
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
new file mode 100644 (file)
index 0000000..03a726c
--- /dev/null
@@ -0,0 +1,394 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.scripts
+
+import com.fasterxml.jackson.databind.ObjectMapper
+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.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.common.scripts.RequestDBUtil
+import org.onap.so.bpmn.core.json.JsonUtils
+import org.onap.so.db.request.beans.ResourceOperationStatus
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+
+import static org.apache.commons.lang3.StringUtils.isBlank
+
+public class DoModifyTnNssi extends AbstractServiceTaskProcessor {
+    String Prefix = "TNMOD_"
+
+    ExceptionUtil exceptionUtil = new ExceptionUtil()
+    JsonUtils jsonUtil = new JsonUtils()
+    RequestDBUtil requestDBUtil = new RequestDBUtil()
+    TnNssmfUtils tnNssmfUtils = new TnNssmfUtils()
+    JsonSlurper jsonSlurper = new JsonSlurper()
+    ObjectMapper objectMapper = new ObjectMapper()
+    private static final Logger logger = LoggerFactory.getLogger(DoModifyTnNssi.class)
+
+
+    void preProcessRequest(DelegateExecution execution) {
+        logger.debug("Start preProcessRequest")
+        execution.setVariable("prefix", Prefix)
+        String msg = ""
+
+        try {
+            execution.setVariable("startTime", System.currentTimeMillis())
+            msg = tnNssmfUtils.getExecutionInputParams(execution)
+            logger.debug("Modify TN NSSI input parameters: " + msg)
+
+            execution.setVariable("prefix", Prefix)
+
+            tnNssmfUtils.setSdncCallbackUrl(execution, true)
+            logger.debug("SDNC Callback URL: " + execution.getVariable("sdncCallbackUrl"))
+
+            String additionalPropJsonStr = execution.getVariable("sliceParams")
+
+            String sliceServiceInstanceId = execution.getVariable("serviceInstanceID")
+            execution.setVariable("sliceServiceInstanceId", sliceServiceInstanceId)
+
+            String sliceServiceInstanceName = execution.getVariable("servicename")
+            execution.setVariable("sliceServiceInstanceName", sliceServiceInstanceName)
+
+            String operationId = UUID.randomUUID().toString()
+            execution.setVariable("operationId", operationId)
+
+            String modelInvariantUuid = execution.getVariable("modelInvariantUuid")
+            String modelUuid = execution.getVariable("modelUuid")
+            //here modelVersion is not set, we use modelUuid to decompose the service.
+            def isDebugLogEnabled = true
+            execution.setVariable("isDebugLogEnabled", isDebugLogEnabled)
+            String serviceModelInfo = """{
+            "modelInvariantUuid":"${modelInvariantUuid}",
+            "modelUuid":"${modelUuid}",
+            "modelVersion":""
+             }"""
+            execution.setVariable("serviceModelInfo", serviceModelInfo)
+
+            //additional properties
+            String sliceProfile = jsonUtil.getJsonValue(additionalPropJsonStr, "sliceProfile")
+            if (isBlank(sliceProfile)) {
+                msg = "Input sliceProfile is null"
+                logger.debug(msg)
+                exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+            } else {
+                execution.setVariable("sliceProfile", sliceProfile)
+            }
+
+            String transportSliceNetworks = jsonUtil.getJsonValue(additionalPropJsonStr, "transportSliceNetworks")
+            if (isBlank(transportSliceNetworks)) {
+                msg = "Input transportSliceNetworks is null"
+                logger.debug(msg)
+                exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+            } else {
+                execution.setVariable("transportSliceNetworks", transportSliceNetworks)
+            }
+            logger.debug("transportSliceNetworks: " + transportSliceNetworks)
+
+            String nsiInfo = jsonUtil.getJsonValue(additionalPropJsonStr, "nsiInfo")
+            if (isBlank(nsiInfo)) {
+                msg = "Input nsiInfo is null"
+                logger.debug(msg)
+                exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+            } else {
+                execution.setVariable("nsiInfo", nsiInfo)
+            }
+        } catch (BpmnError e) {
+            throw e
+        } catch (Exception ex) {
+            msg = "Exception in preProcessRequest " + ex.getMessage()
+            logger.debug(msg)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+        }
+        logger.debug("Finish preProcessRequest")
+    }
+
+
+    void deleteServiceInstance(DelegateExecution execution) {
+        try {
+            AAIResourcesClient client = getAAIClient()
+            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(execution.getVariable("serviceInstanceID")))
+            client.delete(uri)
+        } catch (BpmnError e) {
+            throw e
+        } catch (Exception ex) {
+            String msg = "Exception in DoDeallocateTnNssi.deleteServiceInstance. " + ex.getMessage()
+            logger.info(msg)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+        }
+    }
+
+
+    void getExistingServiceInstance(DelegateExecution execution) {
+        String serviceInstanceId = execution.getVariable("serviceInstanceID")
+
+        AAIResourcesClient resourceClient = getAAIClient()
+        AAIResourceUri ssServiceuri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId))
+
+        try {
+            if (resourceClient.exists(ssServiceuri)) {
+                execution.setVariable("ssi_resourceLink", ssServiceuri.build().toString())
+                org.onap.aai.domain.yang.ServiceInstance ss =
+                        resourceClient.get(org.onap.aai.domain.yang.ServiceInstance.class, ssServiceuri)
+                org.onap.aai.domain.yang.SliceProfile sliceProfile = ss.getSliceProfiles().getSliceProfile().get(0)
+                execution.setVariable("sliceProfileId", sliceProfile.getProfileId())
+
+                org.onap.aai.domain.yang.AllottedResources ars = ss.getAllottedResources()
+                List<org.onap.aai.domain.yang.AllottedResource> arList = ars.getAllottedResource()
+                List<String> arIdList = new ArrayList<>()
+                for (org.onap.aai.domain.yang.AllottedResource ar : arList) {
+                    String arId = ar.getId()
+                    arIdList.add(arId)
+                }
+                execution.setVariable("arIdList", arIdList)
+            } else {
+                exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service instance was not found in aai to " +
+                        "associate allotted resource for service :" + serviceInstanceId)
+            }
+        } catch (BpmnError e) {
+            throw e;
+        } catch (Exception ex) {
+            String msg = "Exception in getServiceInstance. " + ex.getMessage()
+            logger.debug(msg)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+        }
+
+    }
+
+    public void updateTnNssiInAAI(DelegateExecution execution) {
+        getExistingServiceInstance(execution)
+
+        updateServiceInstance(execution)
+        updateSliceProfile(execution)
+        updateAllottedResource(execution)
+    }
+
+    void updateServiceInstance(DelegateExecution execution) {
+        String serviceRole = "TN"
+        String serviceType = execution.getVariable("subscriptionServiceType")
+        String sliceProfileStr = execution.getVariable("sliceProfile")
+        String ssInstanceId = execution.getVariable("sliceServiceInstanceId")
+        try {
+            org.onap.aai.domain.yang.ServiceInstance ss = new org.onap.aai.domain.yang.ServiceInstance()
+            ss.setServiceInstanceId(ssInstanceId)
+            String sliceInstanceName = execution.getVariable("sliceServiceInstanceName")
+            ss.setServiceInstanceName(sliceInstanceName)
+            ss.setServiceType(serviceType)
+            String serviceStatus = "modified"
+            ss.setOrchestrationStatus(serviceStatus)
+            String modelInvariantUuid = execution.getVariable("modelInvariantUuid")
+            String modelUuid = execution.getVariable("modelUuid")
+            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))
+            client.update(uri, ss)
+        } catch (BpmnError e) {
+            throw e
+        } catch (Exception ex) {
+            String msg = "Exception in DoCreateTnNssiInstance.createServiceInstance. " + ex.getMessage()
+            logger.info(msg)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+        }
+    }
+
+    void updateSliceProfile(DelegateExecution execution) {
+
+        String sliceserviceInstanceId = execution.getVariable("sliceServiceInstanceId")
+        String sliceProfileStr = execution.getVariable("sliceProfile")
+        String sliceProfileId = execution.getVariable("sliceProfileId")
+        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.setE2ELatency(Integer.parseInt(jsonUtil.getJsonValue(sliceProfileStr, "latency")))
+        sliceProfile.setMaxBandwidth(Integer.parseInt(jsonUtil.getJsonValue(sliceProfileStr, "maxBandwidth")))
+
+        //TODO: new API
+        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))
+            client.update(uri, sliceProfile)
+
+        } catch (BpmnError e) {
+            throw e
+        } catch (Exception ex) {
+            String msg = "Exception in updateSliceProfile. " + ex.getMessage()
+            logger.info(msg)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+        }
+    }
+
+    void updateAllottedResource(DelegateExecution execution) {
+        String serviceInstanceId = execution.getVariable('serviceInstanceID')
+
+        List<String> arIdList = execution.getVariable("arIdList")
+        try {
+            for (String arId : arIdList) {
+                AAIResourceUri arUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(serviceInstanceId).allottedResource(arId))
+
+                getAAIClient().delete(arUri)
+            }
+
+            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))
+                execution.setVariable("allottedResourceUri", allottedResourceUri)
+                String modelInvariantId = execution.getVariable("modelInvariantUuid")
+                String modelVersionId = execution.getVariable("modelUuid")
+
+                org.onap.aai.domain.yang.AllottedResource resource = new org.onap.aai.domain.yang.AllottedResource()
+                resource.setId(allottedResourceId)
+                resource.setType("TsciNetwork")
+                resource.setAllottedResourceName("network_" + execution.getVariable("sliceServiceInstanceName"))
+                resource.setModelInvariantId(modelInvariantId)
+                resource.setModelVersionId(modelVersionId)
+                getAAIClient().create(allottedResourceUri, resource)
+
+                String linkArrayStr = jsonUtil.getJsonValue(networkStr, "connectionLinks")
+                createLogicalLinksForAllocatedResource(execution, linkArrayStr, serviceInstanceId, allottedResourceId)
+            }
+
+        } catch (Exception ex) {
+            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Exception in createAaiAR " + ex.getMessage())
+        }
+    }
+
+    void createLogicalLinksForAllocatedResource(DelegateExecution execution,
+                                                String linkArrayStr, String serviceInstanceId,
+                                                String allottedResourceId) {
+
+        try {
+            List<String> linkStrList = jsonUtil.StringArrayToList(linkArrayStr)
+
+            for (String linkStr : linkStrList) {
+                String logicalLinkId = UUID.randomUUID().toString()
+                String epA = jsonUtil.getJsonValue(linkStr, "transportEndpointA")
+                String epB = jsonUtil.getJsonValue(linkStr, "transportEndpointB")
+                String modelInvariantId = execution.getVariable("modelInvariantUuid")
+                String modelVersionId = execution.getVariable("modelUuid")
+
+                org.onap.aai.domain.yang.LogicalLink resource = new org.onap.aai.domain.yang.LogicalLink()
+                resource.setLinkId(logicalLinkId)
+                resource.setLinkName(epA)
+                resource.setLinkName2(epB)
+                resource.setModelInvariantId(modelInvariantId)
+                resource.setModelVersionId(modelVersionId)
+
+                AAIResourceUri logicalLinkUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().logicalLink(logicalLinkId))
+                getAAIClient().create(logicalLinkUri, resource)
+            }
+        } catch (Exception ex) {
+            exceptionUtil.buildAndThrowWorkflowException(execution, 7000,
+                    "Exception in createLogicalLinksForAllocatedResource" + ex.getMessage())
+        }
+    }
+
+
+    void preprocessSdncModifyTnNssiRequest(DelegateExecution execution) {
+        def method = getClass().getSimpleName() + '.preprocessSdncModifyTnNssiRequest(' +
+                'execution=' + execution.getId() + ')'
+        def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+        logger.trace('Entered ' + method)
+
+        try {
+            String serviceInstanceId = execution.getVariable("serviceInstanceID")
+
+            String sdncRequest = tnNssmfUtils.buildSDNCRequest(execution, serviceInstanceId, "modify")
+
+            execution.setVariable("TNNSSMF_SDNCRequest", sdncRequest)
+            logger.debug("Outgoing SDNCRequest is: \n" + sdncRequest)
+
+        } catch (Exception e) {
+            logger.debug("Exception Occured Processing preprocessSdncModifyTnNssiRequest. Exception is:\n" + e)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during  preProcessSDNCActivateRequest Method:\n" + e.getMessage())
+        }
+        logger.trace("COMPLETED preprocessSdncModifyTnNssiRequest Process")
+    }
+
+
+    void validateSDNCResponse(DelegateExecution execution, String response, String method) {
+        tnNssmfUtils.validateSDNCResponse(execution, response, method)
+    }
+
+
+    void updateAAIOrchStatus(DelegateExecution execution) {
+        logger.debug("Start updateAAIOrchStatus")
+        String sliceServiceInstanceId = execution.getVariable("sliceServiceInstanceId")
+        String orchStatus = execution.getVariable("orchestrationStatus")
+
+        try {
+            ServiceInstance si = new ServiceInstance()
+            si.setOrchestrationStatus(orchStatus)
+            AAIResourcesClient client = getAAIClient()
+            AAIResourceUri uri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(sliceServiceInstanceId))
+            client.update(uri, si)
+        } catch (BpmnError e) {
+            throw e
+        } catch (Exception ex) {
+            String msg = "Exception in CreateSliceService.updateAAIOrchStatus " + ex.getMessage()
+            logger.info(msg)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+        }
+
+        logger.debug("Finish updateAAIOrchStatus")
+    }
+
+    void prepareUpdateJobStatus(DelegateExecution execution,
+                                String status,
+                                String progress,
+                                String statusDescription) {
+        String serviceId = execution.getVariable("serviceInstanceID")
+        String jobId = execution.getVariable("jobId")
+        String nsiId = execution.getVariable("nsiId")
+
+        ResourceOperationStatus roStatus = new ResourceOperationStatus()
+        roStatus.setServiceId(serviceId)
+        roStatus.setOperationId(jobId)
+        roStatus.setResourceTemplateUUID(nsiId)
+        roStatus.setOperType("Modify")
+        roStatus.setProgress(progress)
+        roStatus.setStatus(status)
+        roStatus.setStatusDescription(statusDescription)
+        requestDBUtil.prepareUpdateResourceOperationStatus(execution, status)
+    }
+
+}
+
index 6b91fec..615afcb 100644 (file)
@@ -41,6 +41,8 @@ import org.onap.aaiclient.client.aai.AAIResourcesClient
 import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
 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.springframework.web.util.UriUtils;
 import org.slf4j.Logger
 import org.slf4j.LoggerFactory
@@ -315,7 +317,7 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor {
                        org.onap.aai.domain.yang.ServiceInstance si = execution.getVariable("serviceInstanceData")
 
             AAIResourcesClient client = new AAIResourcesClient()
-            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId)
+            AAIResourceUri uri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId))
                        client.update(uri, si)
 
                } catch (BpmnError e) {
index 154de6b..5b16838 100644 (file)
@@ -37,6 +37,8 @@ import org.onap.aaiclient.client.aai.AAIResourcesClient
 import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
 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.slf4j.Logger
 import org.slf4j.LoggerFactory
 import org.onap.so.bpmn.common.scripts.ExceptionUtil;
@@ -241,7 +243,7 @@ public class DoUpdateE2EServiceInstanceRollback extends AbstractServiceTaskProce
                        org.onap.aai.domain.yang.ServiceInstance si = execution.getVariable("serviceInstanceData")
 
                        AAIResourcesClient client = new AAIResourcesClient()
-                       AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId)
+                       AAIResourceUri uri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId))
                        client.update(uri, si)
 
                } catch (BpmnError e) {
index cf7bb22..be82562 100644 (file)
@@ -37,6 +37,7 @@ import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
 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.aaiclient.client.graphinventory.entities.uri.Depth
 import org.onap.so.bpmn.common.scripts.AaiUtil
 import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
@@ -328,7 +329,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor {
             String serviceInstanceId = execution.getVariable('serviceInstanceId')
 
             AAIResourcesClient resourceClient = new AAIResourcesClient()
-            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId)
+            AAIResourceUri uri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId))
 
             if(!resourceClient.exists(uri)){
                 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Service Instance not found in aai")
@@ -361,7 +362,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor {
             String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution)
             AaiUtil aaiUtil = new AaiUtil(this)
 
-            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, Defaults.CLOUD_OWNER.toString(), cloudRegion)
+            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(Defaults.CLOUD_OWNER.toString(), cloudRegion))
             def queryCloudRegionRequest = aaiUtil.createAaiUri(uri)
 
             execution.setVariable(Prefix + "queryCloudRegionRequest", queryCloudRegionRequest)
@@ -409,7 +410,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor {
             execution.setVariable(Prefix + "networkId", networkId)
 
             AAIResourcesClient client = new AAIResourcesClient()
-            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, networkId).depth(Depth.ONE)
+            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(networkId)).depth(Depth.ONE)
             AAIResultWrapper network = client.get(uri, NotFoundException.class)
 
             execution.setVariable(Prefix + "aaiIdReturnCode", "200")
@@ -442,7 +443,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor {
             String networkId   = utils.getNodeText(networkRequest, "network-id")
 
             AAIResourcesClient client = new AAIResourcesClient()
-            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, networkId).depth(Depth.ONE)
+            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(networkId)).depth(Depth.ONE)
             AAIResultWrapper network = client.get(uri, NotFoundException.class)
 
             execution.setVariable(Prefix + "aaiRequeryIdReturnCode", "200")
@@ -483,7 +484,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor {
             // get variables
             AAIResultWrapper queryIdAAIResponse = execution.getVariable(Prefix + "requeryIdAAIResponse")
             if(queryIdAAIResponse.getRelationships().isPresent()){
-                List<AAIResourceUri> uris = queryIdAAIResponse.getRelationships().get().getRelatedAAIUris(AAIObjectType.VPN_BINDING)
+                List<AAIResourceUri> uris = queryIdAAIResponse.getRelationships().get().getRelatedUris(Types.VPN_BINDING)
 
                 logger.debug(Prefix + "vpnCount - " + uris.size())
 
@@ -555,7 +556,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor {
             // get variables
             AAIResultWrapper queryIdAAIResponse = execution.getVariable(Prefix + "requeryIdAAIResponse")
             if(queryIdAAIResponse.getRelationships().isPresent()){
-                List<AAIResourceUri> uris = queryIdAAIResponse.getRelationships().get().getRelatedAAIUris(AAIObjectType.NETWORK_POLICY)
+                List<AAIResourceUri> uris = queryIdAAIResponse.getRelationships().get().getRelatedUris(Types.NETWORK_POLICY)
 
                 execution.setVariable(Prefix + "networkPolicyCount", uris.size())
                 logger.debug(Prefix + "networkPolicyCount - " + uris.size())
@@ -620,7 +621,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor {
         try {
             AAIResultWrapper queryIdAAIResponse = execution.getVariable(Prefix + "requeryIdAAIResponse")
             if(queryIdAAIResponse.getRelationships().isPresent()){
-                List<AAIResourceUri> uris = queryIdAAIResponse.getRelationships().get().getRelatedAAIUris(AAIObjectType.ROUTE_TABLE_REFERENCE)
+                List<AAIResourceUri> uris = queryIdAAIResponse.getRelationships().get().getRelatedUris(Types.ROUTE_TABLE_REFERENCE)
 
                 execution.setVariable(Prefix + "networkTableRefCount", uris.size())
                 logger.debug(Prefix + "networkTableRefCount - " + uris.size())
@@ -717,7 +718,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor {
             }
 
             AAIResourcesClient client = new AAIResourcesClient()
-            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, networkId)
+            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(networkId))
             client.update(uri, l3Network)
 
             List<Subnet> subnets = oldL3Network.getSubnets().getSubnet()
@@ -734,7 +735,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor {
                     subnet.setOrchestrationStatus("Active")
                 }
 
-                AAIResourceUri subUri = AAIUriFactory.createResourceUri(AAIObjectType.SUBNET, networkId, subnetId)
+                AAIResourceUri subUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(networkId).subnet(subnetId))
                 client.update(subUri, subnet)
             }
 
index 00cf2a3..b7bbbf9 100644 (file)
@@ -25,6 +25,14 @@ 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.GenericVnf
+import org.onap.aaiclient.client.aai.AAIObjectType;
+import org.onap.aaiclient.client.aai.AAIResourcesClient
+import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
+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.aaiclient.client.graphinventory.entities.uri.Depth
 import org.onap.logging.filter.base.ErrorCode
 import org.onap.so.bpmn.common.scripts.AaiUtil
 import org.onap.so.bpmn.common.scripts.CatalogDbUtils
@@ -37,12 +45,6 @@ import org.onap.so.bpmn.common.scripts.VfModuleBase
 import org.onap.so.bpmn.core.UrnPropertiesReader
 import org.onap.so.bpmn.core.WorkflowException
 import org.onap.so.bpmn.core.json.JsonUtils;
-import org.onap.aaiclient.client.aai.AAIObjectType;
-import org.onap.aaiclient.client.aai.AAIResourcesClient
-import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
-import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
-import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
-import org.onap.aaiclient.client.graphinventory.entities.uri.Depth
 import org.onap.so.constants.Defaults
 import org.onap.so.logger.LoggingAnchor
 import org.onap.so.logger.MessageEnum
@@ -273,7 +275,7 @@ public class DoUpdateVfModule extends VfModuleBase {
                                }
 
                                try{
-                                       AAIResourceUri serviceInstanceURI = AAIUriFactory.create(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId,serviceType,serviceInstanceId)
+                                       AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(serviceType).serviceInstance(serviceInstanceId))
                                        AAIResourcesClient aaiRC = new AAIResourcesClient()
                                        AAIResultWrapper aaiRW = aaiRC.get(serviceInstanceURI)
                                        Map<String, Object> aaiJson = aaiRW.asMap()
@@ -411,7 +413,7 @@ public class DoUpdateVfModule extends VfModuleBase {
                        // Prepare AA&I url
                        AaiUtil aaiUtil = new AaiUtil(this)
 
-                       AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, Defaults.CLOUD_OWNER.toString(), cloudRegion)
+                       AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(Defaults.CLOUD_OWNER.toString(), cloudRegion))
                        def queryCloudRegionRequest = aaiUtil.createAaiUri(uri)
 
                        execution.setVariable(prefix + "queryCloudRegionRequest", queryCloudRegionRequest)
@@ -1018,7 +1020,7 @@ public class DoUpdateVfModule extends VfModuleBase {
 
                try {
                        def vnfId = execution.getVariable('DOUPVfMod_vnfId')
-                       AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId).depth(Depth.ONE)
+                       AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)).depth(Depth.ONE)
 
                        try {
                                Optional<GenericVnf> genericVnf = getAAIClient().get(GenericVnf.class,uri)
index 7e180ca..0285ae2 100644 (file)
@@ -41,7 +41,9 @@ import org.onap.aaiclient.client.graphinventory.entities.uri.Depth
 import org.onap.so.client.HttpClient
 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.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.logger.MessageEnum
 import org.slf4j.Logger
 import org.slf4j.LoggerFactory
@@ -159,7 +161,7 @@ class DoUpdateVnfAndModules extends AbstractServiceTaskProcessor {
                        def vnfId = execution.getVariable('vnfId')
 
                        AaiUtil aaiUriUtil = new AaiUtil(this)
-                       AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId).depth(Depth.ONE)
+                       AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)).depth(Depth.ONE)
                        String endPoint = aaiUriUtil.createAaiUri(uri)
                        logger.debug("AAI endPoint: " + endPoint)
 
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
new file mode 100644 (file)
index 0000000..47489b7
--- /dev/null
@@ -0,0 +1,173 @@
+/*
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ # Copyright (c) 2020, Wipro Limited.
+ #
+ # Licensed under the Apache License, Version 2.0 (the "License")
+ # you may not use this file except in compliance with the License.
+ # You may obtain a copy of the License at
+ #
+ #       http://www.apache.org/licenses/LICENSE-2.0
+ #
+ # Unless required by applicable law or agreed to in writing, software
+ # distributed under the License is distributed on an "AS IS" BASIS,
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ # See the License for the specific language governing permissions and
+ # limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.scripts
+
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
+import org.onap.so.bpmn.common.scripts.ExceptionUtil
+import org.onap.so.bpmn.common.scripts.RequestDBUtil
+import org.onap.so.bpmn.core.json.JsonUtils
+import org.onap.so.db.request.beans.ResourceOperationStatus
+import org.slf4j.Logger
+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")
+       }
+
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/QueryJobStatus.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/QueryJobStatus.groovy
new file mode 100644 (file)
index 0000000..5cdf540
--- /dev/null
@@ -0,0 +1,141 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Wipro Limited.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.scripts
+
+import groovy.json.JsonSlurper
+import org.json.JSONObject
+import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
+import org.onap.so.bpmn.common.scripts.ExceptionUtil
+import org.onap.so.bpmn.core.json.JsonUtils
+import org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+import org.onap.so.bpmn.core.UrnPropertiesReader
+
+public class QueryJobStatus extends AbstractServiceTaskProcessor{
+    private static final Logger logger = LoggerFactory.getLogger(QueryJobStatus.class)
+
+    ExceptionUtil exceptionUtil = new ExceptionUtil()
+    JsonUtils jsonUtil = new JsonUtils()
+    
+    public void preProcessRequest(DelegateExecution execution) {
+        logger.debug("Start preProcessRequest")
+        
+        try{
+            String requestId = execution.getVariable("msoRequestId")
+            logger.debug("RequestId :" + requestId)
+            String responseId = execution.getVariable("responseId")
+            String jobId = execution.getVariable("jobId")   
+            def jsonSlurper = new JsonSlurper()
+            
+            HashMap<String,?> esrInfo=jsonSlurper.parseText(execution.getVariable("esrInfo"))
+            logger.debug("esrInfo" + esrInfo.toString())
+            
+            HashMap<String,?> serviceInfo=jsonSlurper.parseText(execution.getVariable("serviceInfo"))
+            logger.debug("serviceInfo" + serviceInfo.toString())
+            
+            execution.setVariable("esrInfo", esrInfo)
+            execution.setVariable("serviceInfo", serviceInfo)
+            
+            String nssmfEndpoint = UrnPropertiesReader.getVariable("mso.adapters.nssmf.endpoint",execution)          
+            String endPoint = String.format("/api/rest/provMns/v1/NSS/jobs/%s", jobId)          
+            String url = nssmfEndpoint + endPoint 
+            execution.setVariable("NSSMF_AdapterEndpoint", url)
+            
+            String payload = """
+                {
+                  "responseId": "${responseId}",
+                  "esrInfo":  ${execution.getVariable("esrInfo") as JSONObject},
+                  "serviceInfo": ${execution.getVariable("serviceInfo") as JSONObject}
+                }
+              """
+               
+            execution.setVariable("NSSMF_AdapterRequest", payload.replaceAll("\\s+", ""))   
+            execution.setVariable("startTime", System.currentTimeMillis())
+            logger.debug("Outgoing NSSMF_AdapterRequest: \n" + payload)
+        }catch(Exception e){
+            String msg = "Exception in QueryJobStatus.preProcessRequest " + ex.getMessage()
+            logger.error(msg)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+        }
+        logger.debug("exit preProcessRequest")
+    }
+
+    public void checkJobStatus(DelegateExecution execution) {
+        logger.debug(" *** checkJobStatus *** ")
+        def NSSMF_ResponseCode = execution.getVariable("NSSMF_ResponseCode") as Integer
+        logger.debug("NSSMF_ResponseCode:" + NSSMF_ResponseCode)
+        def NSSMF_Response = execution.getVariable("NSSMF_Response") as String
+        def status = jsonUtil.getJsonValue(NSSMF_Response, "responseDescriptor.status")
+        logger.debug("NSSMF_Response" + NSSMF_Response)
+        
+        Long startTime = execution.getVariable("startTime") as Long
+        Long timeout = execution.getVariable("timeout") as Long
+        timeout = timeout == null ? 600000 : timeout * 60000
+        
+        if(NSSMF_Response != null) {                            
+            if (status.equalsIgnoreCase("processing") && (System.currentTimeMillis() - startTime) > timeout) {
+                handleTimeOut(execution)
+            } 
+            else if(status.equalsIgnoreCase("finished") || status.equalsIgnoreCase("failed")) {
+                execution.setVariable("JobStatusCompleted", "TRUE")
+            } else {
+                execution.setVariable("JobStatusCompleted", "FALSE")
+            }
+            } else {
+                 Map<String, ?> responseDescriptorMap = new HashMap<>()
+                 responseDescriptorMap.put("status","failed")
+                 responseDescriptorMap.put("statusDescription","Exception while querying job status")
+                 String responseDescriptor = """
+                 {
+                   "responseDescriptor": "${responseDescriptorMap}",
+                 }
+               """
+                 execution.setVariable("JobStatusCompleted", "TRUE")
+                 execution.setVariable("NSSMF_Response",responseDescriptor.replaceAll("\\s+", ""))
+                exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Received a Bad Response from NSSMF.")
+            }
+        logger.debug("exit checkJobStatus")
+    }
+    
+    private handleTimeOut(DelegateExecution execution) {
+        Map<String, ?> responseDescriptorMap = new HashMap<>()
+        responseDescriptorMap.put("status","failed")
+        responseDescriptorMap.put("statusDescription","timeout")
+        String responseDescriptor = """
+                {
+                  "responseDescriptor": "${responseDescriptorMap}",
+                }
+              """
+        execution.setVariable("JobStatusCompleted", "TRUE")
+        execution.setVariable("NSSMF_Response",responseDescriptor.replaceAll("\\s+", ""))
+    }
+    
+    public void updateJobStatusDetails(DelegateExecution execution)
+    {
+        logger.debug("**updateJobStatusDetails**")
+        def NSSMF_Response = execution.getVariable("NSSMF_Response") as String
+        def responseDescriptor = jsonUtil.getJsonValue(NSSMF_Response, "responseDescriptor")
+        execution.setVariable("responseDescriptor",responseDescriptor)
+        logger.debug("**exit updateJobStatusDetails")
+    }
+}
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
new file mode 100644 (file)
index 0000000..7d2e536
--- /dev/null
@@ -0,0 +1,341 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.scripts
+
+import com.fasterxml.jackson.databind.ObjectMapper
+import com.google.gson.JsonArray
+import com.google.gson.JsonObject
+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
+import org.onap.so.bpmn.common.scripts.RequestDBUtil
+import org.onap.so.bpmn.core.UrnPropertiesReader
+import org.onap.so.bpmn.core.domain.ServiceDecomposition
+import org.onap.so.bpmn.core.domain.ServiceProxy
+import org.onap.so.bpmn.core.json.JsonUtils
+import org.onap.so.db.request.beans.ResourceOperationStatus
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+import org.springframework.web.util.UriUtils
+
+import static org.apache.commons.lang3.StringUtils.isBlank
+
+class TnAllocateNssi extends AbstractServiceTaskProcessor {
+    String Prefix = "TNALLOC_"
+
+    ExceptionUtil exceptionUtil = new ExceptionUtil()
+    JsonUtils jsonUtil = new JsonUtils()
+    RequestDBUtil requestDBUtil = new RequestDBUtil()
+    JsonSlurper jsonSlurper = new JsonSlurper()
+    ObjectMapper objectMapper = new ObjectMapper()
+    TnNssmfUtils tnNssmfUtils = new TnNssmfUtils()
+    private static final Logger logger = LoggerFactory.getLogger(TnAllocateNssi.class)
+
+    void preProcessRequest(DelegateExecution execution) {
+        logger.debug("Start preProcessRequest")
+        execution.setVariable("prefix", Prefix)
+        String msg = ""
+
+        try {
+            execution.setVariable("startTime", System.currentTimeMillis())
+
+            msg = tnNssmfUtils.getExecutionInputParams(execution)
+            logger.debug("Allocate TN NSSI input parameters: " + msg)
+
+            tnNssmfUtils.setSdncCallbackUrl(execution, true)
+            logger.debug("SDNC Callback URL: " + execution.getVariable("sdncCallbackUrl"))
+
+            String additionalPropJsonStr = execution.getVariable("sliceParams")
+
+            String tnNssiId = execution.getVariable("serviceInstanceID")
+            if (isBlank(tnNssiId)) {
+                tnNssiId = UUID.randomUUID().toString()
+            }
+
+            String operationId = UUID.randomUUID().toString()
+            execution.setVariable("operationId", operationId)
+
+            logger.debug("Generate new TN NSSI ID:" + tnNssiId)
+            tnNssiId = UriUtils.encode(tnNssiId, "UTF-8")
+            execution.setVariable("sliceServiceInstanceId", tnNssiId)
+
+            String sliceServiceInstanceName = execution.getVariable("servicename")
+            execution.setVariable("sliceServiceInstanceName", sliceServiceInstanceName)
+
+            //additional properties
+            String sliceProfile = jsonUtil.getJsonValue(additionalPropJsonStr, "sliceProfile")
+            if (isBlank(sliceProfile)) {
+                msg = "Input sliceProfile is null"
+                logger.debug(msg)
+                exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+            } else {
+                execution.setVariable("sliceProfile", sliceProfile)
+            }
+
+            String transportSliceNetworks = jsonUtil.getJsonValue(additionalPropJsonStr, "transportSliceNetworks")
+            if (isBlank(transportSliceNetworks)) {
+                msg = "Input transportSliceNetworks is null"
+                logger.debug(msg)
+                exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+            } else {
+                execution.setVariable("transportSliceNetworks", transportSliceNetworks)
+            }
+            logger.debug("transportSliceNetworks: " + transportSliceNetworks)
+
+            String nsiInfoStr = jsonUtil.getJsonValue(additionalPropJsonStr, "nsiInfo")
+            if (isBlank(nsiInfoStr)) {
+                msg = "Input nsiInfo is null"
+                logger.debug(msg)
+                exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+            } else {
+                execution.setVariable("nsiInfo", nsiInfoStr)
+            }
+
+            //nsiId is passed in from caller bpmn
+            //String nsiIdStr = jsonUtil.getJsonValue(nsiInfo, "nsiId")
+            //execution.setVariable("nsiId", nsiIdStr)
+
+        } catch (BpmnError e) {
+            throw e
+        } catch (Exception ex) {
+            msg = "Exception in preProcessRequest " + ex.getMessage()
+            logger.debug(msg)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+        }
+        logger.debug("Finish preProcessRequest")
+    }
+
+
+    void prepareDecomposeService(DelegateExecution execution) {
+        logger.debug("Start prepareDecomposeService")
+        String msg = ""
+        String modelUuid = execution.getVariable("modelUuid")
+        if (isBlank(modelUuid)) {
+            msg = "Input modelUuid is null"
+            logger.debug(msg)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+        }
+
+        String modelInvariantUuid = execution.getVariable("modelInvariantUuid")
+        if (isBlank(modelInvariantUuid)) {
+            msg = "Input modelInvariantUuid is null"
+            logger.debug(msg)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+        }
+
+        String serviceModelInfo = """{
+            "modelInvariantUuid":"${modelInvariantUuid}",
+            "modelUuid":"${modelUuid}",
+            "modelVersion":""
+             }"""
+        execution.setVariable("ssServiceModelInfo", serviceModelInfo)
+
+        logger.debug("Finish prepareDecomposeService")
+    }
+
+    void processDecomposition(DelegateExecution execution) {
+        logger.debug("Start processDecomposition")
+
+        ServiceDecomposition tnNsstServiceDecomposition = execution.getVariable("tnNsstServiceDecomposition")
+        logger.debug("tnNsstServiceDecomposition : " + tnNsstServiceDecomposition.toString())
+        //TN NSST decomposition
+        String tnModelVersion = tnNsstServiceDecomposition.getModelInfo().getModelVersion()
+        String tnModelName = tnNsstServiceDecomposition.getModelInfo().getModelName()
+        List<ServiceProxy> serviceProxyList = tnNsstServiceDecomposition.getServiceProxy()
+        List<String> nsstInfoList = new ArrayList<>()
+        for (ServiceProxy serviceProxy : serviceProxyList) {
+            String nsstModelUuid = serviceProxy.getModelInfo().getModelUuid()
+            String nsstModelInvariantUuid = serviceProxy.getModelInfo().getModelInvariantUuid()
+            String name = serviceProxy.getModelInfo().getModelName()
+            String nsstServiceModelInfo = """{
+            "UUID":"${nsstModelUuid}",
+            "invariantUUID":"${nsstModelInvariantUuid}",
+            "name":"${name}"
+             }"""
+            nsstInfoList.add(nsstServiceModelInfo)
+        }
+        int currentIndex = 0
+        int maxIndex = nsstInfoList.size()
+        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)
+        }
+        execution.setVariable("tnNsstInfoList", nsstInfoList)
+        execution.setVariable("tnModelVersion", tnModelVersion)
+        execution.setVariable("tnModelName", tnModelName)
+        execution.setVariable("currentIndex", currentIndex)
+        execution.setVariable("maxIndex", maxIndex)
+
+        logger.debug("End processDecomposition")
+    }
+
+    void prepareOofSelection(DelegateExecution execution) {
+        logger.debug("Start prepareOofSelection")
+
+        String urlString = UrnPropertiesReader.getVariable("mso.oof.endpoint", execution)
+        logger.debug("get NSSI option OOF Url: " + urlString)
+        //build oof request body
+        String requestId = execution.getVariable("msoRequestId")
+        String messageType = "NSISelectionResponse"
+        Map<String, Object> profileInfo = objectMapper.readValue(execution.getVariable("sliceProfile"), Map.class)
+        String modelUuid = execution.getVariable("modelUuid")
+        String modelInvariantUuid = execution.getVariable("modelInvariantUuid")
+        String modelName = execution.getVariable("tnModelName")
+        String timeout = UrnPropertiesReader.getVariable("mso.adapters.oof.timeout", execution);
+        List<String> nsstInfoList = objectMapper.readValue(execution.getVariable("nsstInfoList"), List.class)
+        JsonArray capabilitiesList = new JsonArray()
+
+        execution.setVariable("nssiSelection_Url", "/api/oof/selection/nsi/v1")
+        execution.setVariable("nssiSelection_messageType", messageType)
+        execution.setVariable("nssiSelection_correlator", requestId)
+        execution.setVariable("nssiSelection_timeout", timeout)
+        String oofRequest = buildSelectTnNssiRequest(requestId, messageType, modelUuid, modelInvariantUuid,
+                modelName, profileInfo, nsstInfoList, capabilitiesList, false)
+        execution.setVariable("nssiSelection_oofRequest", oofRequest)
+
+        logger.debug("Finish prepareOofSelection")
+    }
+
+    String buildSelectTnNssiRequest(String requestId, String messageType, String UUID, String invariantUUID,
+                                    String name, Map<String, Object> profileInfo,
+                                    List<String> nsstInfoList, JsonArray capabilitiesList, Boolean preferReuse) {
+
+        def transactionId = requestId
+        logger.debug("transactionId is: " + transactionId)
+        String correlator = requestId
+        String callbackUrl = UrnPropertiesReader.getVariable("mso.adapters.oof.callback.endpoint") + "/" + messageType + "/" + correlator
+        ObjectMapper objectMapper = new ObjectMapper()
+        String profileJson = objectMapper.writeValueAsString(profileInfo)
+        String nsstInfoListString = objectMapper.writeValueAsString(nsstInfoList)
+        //Prepare requestInfo object
+        JsonObject requestInfo = new JsonObject()
+        requestInfo.addProperty("transactionId", transactionId)
+        requestInfo.addProperty("requestId", requestId)
+        requestInfo.addProperty("callbackUrl", callbackUrl)
+        requestInfo.addProperty("sourceId", "SO")
+        requestInfo.addProperty("timeout", 600)
+        requestInfo.addProperty("numSolutions", 1)
+
+        //Prepare serviceInfo object
+        JsonObject ranNsstInfo = new JsonObject()
+        ranNsstInfo.addProperty("UUID", UUID)
+        ranNsstInfo.addProperty("invariantUUID", invariantUUID)
+        ranNsstInfo.addProperty("name", name)
+
+        JsonObject json = new JsonObject()
+        json.add("requestInfo", requestInfo)
+        json.add("NSTInfo", ranNsstInfo)
+        json.addProperty("serviceProfile", profileJson)
+        json.addProperty("NSSTInfo", nsstInfoListString)
+        json.add("subnetCapabilities", capabilitiesList)
+        json.addProperty("preferReuse", preferReuse)
+
+        return json.toString()
+    }
+
+    void processOofSelection(DelegateExecution execution) {
+        logger.debug(Prefix + "processOofSelection method start")
+        String oofResponse = execution.getVariable("nssiSelection_asyncCallbackResponse")
+        String requestStatus = jsonUtil.getJsonValue(oofResponse, "requestStatus")
+        if (requestStatus.equals("completed")) {
+            List<String> solution = jsonUtil.StringArrayToList(jsonUtil.getJsonValue(oofResponse, "solutions"))
+            boolean existingNSI = jsonUtil.getJsonValue(solution.get(0), "existingNSI")
+            if (existingNSI) {
+                def sharedNSISolution = jsonUtil.getJsonValue(solution.get(0), "sharedNSISolution")
+                execution.setVariable("sharedTnNssiSolution", sharedNSISolution)
+                logger.debug("sharedTnNssiSolution from OOF " + sharedNSISolution)
+                String tnServiceInstanceId = jsonUtil.getJsonValue(solution.get(0), "sharedNSISolution.NSIId")
+                execution.setVariable("tnServiceInstanceId", tnServiceInstanceId)
+                org.onap.so.bpmn.core.domain.ServiceInstance serviceInstance = new org.onap.so.bpmn.core.domain.ServiceInstance();
+                serviceInstance.setInstanceId(tnServiceInstanceId);
+                ServiceDecomposition serviceDecomposition = execution.getVariable("tnNsstServiceDecomposition")
+                serviceDecomposition.setServiceInstance(serviceInstance);
+                execution.setVariable("tnNsstServiceDecomposition", serviceDecomposition)
+                execution.setVariable("isOofTnNssiSelected", true)
+            } else {
+                def sliceProfiles = jsonUtil.getJsonValue(solution.get(0), "newNSISolution.sliceProfiles")
+                execution.setVariable("tnConstituentSliceProfiles", sliceProfiles)
+                execution.setVariable("isOofTnNssiSelected", false)
+                logger.debug("tnConstituentSliceProfiles list from OOF " + sliceProfiles)
+            }
+        } else {
+            String statusMessage = jsonUtil.getJsonValue(oofResponse, "statusMessage")
+            logger.error("received failed status from oof " + statusMessage)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Received a failed Async Response from OOF : " + statusMessage)
+        }
+
+        logger.debug(Prefix + "processOofSelection method finished")
+    }
+
+    void updateAAIOrchStatus(DelegateExecution execution) {
+        logger.debug("Start updateAAIOrchStatus")
+        String sliceServiceInstanceId = execution.getVariable("sliceServiceInstanceId")
+        String orchStatus = execution.getVariable("orchestrationStatus")
+
+        try {
+            ServiceInstance si = new ServiceInstance()
+            si.setOrchestrationStatus(orchStatus)
+            AAIResourcesClient client = new AAIResourcesClient()
+            AAIResourceUri uri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(sliceServiceInstanceId))
+            client.update(uri, si)
+        } catch (BpmnError e) {
+            throw e
+        } catch (Exception ex) {
+            String msg = "Exception in CreateSliceService.updateAAIOrchStatus " + ex.getMessage()
+            logger.info(msg)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+        }
+
+        logger.debug("Finish updateAAIOrchStatus")
+    }
+
+
+    void prepareUpdateJobStatus(DelegateExecution execution,
+                                String status,
+                                String progress,
+                                String statusDescription) {
+        String serviceId = execution.getVariable("sliceServiceInstanceId")
+        String jobId = execution.getVariable("jobId")
+        String nsiId = execution.getVariable("nsiId")
+
+        ResourceOperationStatus roStatus = new ResourceOperationStatus()
+        roStatus.setServiceId(serviceId)
+        roStatus.setOperationId(jobId)
+        roStatus.setResourceTemplateUUID(nsiId)
+        roStatus.setOperType("Allocate")
+        roStatus.setProgress(progress)
+        roStatus.setStatus(status)
+        roStatus.setStatusDescription(statusDescription)
+        requestDBUtil.prepareUpdateResourceOperationStatus(execution, status)
+    }
+
+}
+
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
new file mode 100644 (file)
index 0000000..a1b883c
--- /dev/null
@@ -0,0 +1,244 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.scripts
+
+
+import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.onap.so.bpmn.common.scripts.ExceptionUtil
+import org.onap.so.bpmn.common.scripts.MsoUtils
+import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils
+import org.onap.so.bpmn.core.RollbackData
+import org.onap.so.bpmn.core.UrnPropertiesReader
+import org.onap.so.bpmn.core.WorkflowException
+import org.onap.so.bpmn.core.json.JsonUtils
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+
+import static org.apache.commons.lang3.StringUtils.isBlank
+
+class TnNssmfUtils {
+    private static final Logger logger = LoggerFactory.getLogger(TnNssmfUtils.class);
+
+
+    ExceptionUtil exceptionUtil = new ExceptionUtil()
+    JsonUtils jsonUtil = new JsonUtils()
+    MsoUtils msoUtils = new MsoUtils()
+    SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils()
+
+    TnNssmfUtils() {
+    }
+
+
+    void setSdncCallbackUrl(DelegateExecution execution, boolean exceptionOnErr) {
+        setSdncCallbackUrl(execution, "sdncCallbackUrl", exceptionOnErr)
+    }
+
+    void setSdncCallbackUrl(DelegateExecution execution, String variableName, boolean exceptionOnErr) {
+        String sdncCallbackUrl = UrnPropertiesReader.getVariable('mso.workflow.sdncadapter.callback', execution)
+
+        if (isBlank(sdncCallbackUrl) && exceptionOnErr) {
+            String msg = "mso.workflow.sdncadapter.callback is null"
+            logger.debug(msg)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+        } else {
+            execution.setVariable(variableName, sdncCallbackUrl)
+        }
+    }
+
+    String buildSDNCRequest(DelegateExecution execution, String svcInstId, String action) {
+
+        String uuid = execution.getVariable('testReqId') // for junits
+        if (uuid == null) {
+            uuid = execution.getVariable("msoRequestId") + "-" + System.currentTimeMillis()
+        }
+
+        def callbackURL = execution.getVariable("sdncCallbackUrl")
+        def requestId = execution.getVariable("msoRequestId")
+        def serviceId = execution.getVariable("sliceServiceInstanceId")
+        def vnfType = execution.getVariable("serviceType")
+        def vnfName = execution.getVariable("sliceServiceInstanceName")
+        def tenantId = execution.getVariable("sliceServiceInstanceId")
+        def source = execution.getVariable("sliceServiceInstanceId")
+        def vnfId = execution.getVariable("sliceServiceInstanceId")
+        def cloudSiteId = execution.getVariable("sliceServiceInstanceId")
+        def serviceModelInfo = execution.getVariable("serviceModelInfo")
+        def vnfModelInfo = execution.getVariable("serviceModelInfo")
+        def globalSubscriberId = execution.getVariable("globalSubscriberId")
+
+        String vnfNameString = """<vnf-name>${MsoUtils.xmlEscape(vnfName)}</vnf-name>"""
+        String serviceEcompModelInformation = sdncAdapterUtils.modelInfoToEcompModelInformation(serviceModelInfo)
+        String vnfEcompModelInformation = sdncAdapterUtils.modelInfoToEcompModelInformation(vnfModelInfo)
+
+        String sdncVNFParamsXml = ""
+
+        if (execution.getVariable("vnfParamsExistFlag") == true) {
+            sdncVNFParamsXml = buildSDNCParamsXml(execution)
+        } else {
+            sdncVNFParamsXml = ""
+        }
+
+        String sdncRequest =
+                """<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.onap/so/request/types/v1"
+                                                                                                       xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"
+                                                                                                       xmlns:sdncadapter="http://org.onap/workflow/sdnc/adapter/schema/v1">
+          <sdncadapter:RequestHeader>
+                               <sdncadapter:RequestId>${MsoUtils.xmlEscape(uuid)}</sdncadapter:RequestId>
+                               <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(svcInstId)}</sdncadapter:SvcInstanceId>
+                               <sdncadapter:SvcAction>${MsoUtils.xmlEscape(action)}</sdncadapter:SvcAction>
+                               <sdncadapter:SvcOperation>vnf-topology-operation</sdncadapter:SvcOperation>
+                               <sdncadapter:CallbackUrl>${MsoUtils.xmlEscape(callbackURL)}</sdncadapter:CallbackUrl>
+                               <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction>
+               </sdncadapter:RequestHeader>
+       <sdncadapterworkflow:SDNCRequestData>
+               <request-information>
+                       <request-id>${MsoUtils.xmlEscape(requestId)}</request-id>
+                       <request-action>AllocateTnNssi</request-action>
+                       <source>${MsoUtils.xmlEscape(source)}</source>
+                       <notification-url/>
+                       <order-number/>
+                       <order-version/>
+               </request-information>
+               <service-information>
+                       <service-id>${MsoUtils.xmlEscape(serviceId)}</service-id>
+                       <subscription-service-type>${MsoUtils.xmlEscape(serviceId)}</subscription-service-type>
+                       ${serviceEcompModelInformation}
+                       <service-instance-id>${MsoUtils.xmlEscape(svcInstId)}</service-instance-id>
+                       <global-customer-id>${MsoUtils.xmlEscape(globalSubscriberId)}</global-customer-id>
+               </service-information>
+               <vnf-information>
+                       <vnf-id>${MsoUtils.xmlEscape(vnfId)}</vnf-id>
+                       <vnf-type>${MsoUtils.xmlEscape(vnfType)}</vnf-type>
+                       ${vnfEcompModelInformation}
+               </vnf-information>
+               <vnf-request-input>
+                       ${vnfNameString}
+                       <tenant>${MsoUtils.xmlEscape(tenantId)}</tenant>
+                       <aic-cloud-region>${MsoUtils.xmlEscape(cloudSiteId)}</aic-cloud-region>
+                       ${sdncVNFParamsXml}
+               </vnf-request-input>
+       </sdncadapterworkflow:SDNCRequestData>
+       </sdncadapterworkflow:SDNCAdapterWorkflowRequest>"""
+
+        logger.debug("sdncRequest:  " + sdncRequest)
+        return sdncRequest
+    }
+
+    String buildSDNCParamsXml(DelegateExecution execution) {
+        String params = ""
+        StringBuilder sb = new StringBuilder()
+        Map<String, String> paramsMap = execution.getVariable("TNNSSMF_vnfParamsMap")
+
+        for (Map.Entry<String, String> entry : paramsMap.entrySet()) {
+            String paramsXml
+            String key = entry.getKey();
+            String value = entry.getValue()
+            paramsXml = """<${key}>$value</$key>"""
+            params = sb.append(paramsXml)
+        }
+        return params
+    }
+
+    void validateSDNCResponse(DelegateExecution execution, String response, String method) {
+        validateSDNCResponse(execution, response, method, true)
+    }
+
+    void validateSDNCResponse(DelegateExecution execution, String response, String method, boolean exceptionOnErr) {
+        logger.debug("STARTED ValidateSDNCResponse Process")
+
+        String msg
+
+        String prefix = execution.setVariable("prefix")
+        if (isBlank(prefix)) {
+            if (exceptionOnErr) {
+                msg = "validateSDNCResponse: prefix is null"
+                logger.error(msg)
+                exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+            }
+            return
+        }
+
+        WorkflowException workflowException = execution.getVariable("WorkflowException")
+        boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator")
+
+        logger.debug("workflowException: " + workflowException)
+
+        sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator)
+
+        String sdncResponse = response
+        if (execution.getVariable(prefix + 'sdncResponseSuccess') == true) {
+            logger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call.  Response is: \n" + sdncResponse)
+            RollbackData rollbackData = execution.getVariable("rollbackData")
+
+            if (method.equals("allocate")) {
+                rollbackData.put("VNFMODULE", "rollbackSDNCRequestAllocate", "true")
+            } else if (method.equals("deallocate")) {
+                rollbackData.put("VNFMODULE", "rollbackSDNCRequestDeallocate", "true")
+            } else if (method.equals("activate")) {
+                rollbackData.put("VNFMODULE", "rollbackSDNCRequestActivate", "true")
+            } else if (method.equals("deactivate")) {
+                rollbackData.put("VNFMODULE", "rollbackSDNCRequestDeactivate", "true")
+            } else if (method.equals("modify")) {
+                rollbackData.put("VNFMODULE", "rollbackSDNCRequestModify", "true")
+            }
+            execution.setVariable("rollbackData", rollbackData)
+        } else {
+            if (exceptionOnErr) {
+                msg = "validateSDNCResponse: bad Response from SDNC Adapter for " + method + " SDNC Call."
+                logger.error(msg)
+                exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+            }
+        }
+
+        logger.debug("COMPLETED ValidateSDNCResponse Process")
+    }
+
+    String getExecutionInputParams(DelegateExecution execution) {
+        String res = "msoRequestId=" + execution.getVariable("msoRequestId") +
+                ", modelInvariantUuid=" + execution.getVariable("modelInvariantUuid") +
+                ", modelUuid=" + execution.getVariable("modelUuid") +
+                ", serviceInstanceID=" + execution.getVariable("serviceInstanceID") +
+                ", operationType=" + execution.getVariable("operationType") +
+                ", globalSubscriberId=" + execution.getVariable("globalSubscriberId") +
+                ", dummyServiceId=" + execution.getVariable("dummyServiceId") +
+                ", nsiId=" + execution.getVariable("nsiId") +
+                ", networkType=" + execution.getVariable("networkType") +
+                ", subscriptionServiceType=" + execution.getVariable("subscriptionServiceType") +
+                ", jobId=" + execution.getVariable("jobId") +
+                ", sliceParams=" + execution.getVariable("sliceParams") +
+                ", servicename=" + execution.getVariable("servicename")
+
+        return res
+    }
+
+    String getFirstSnssaiFromSliceProfile(String sliceProfileStr) {
+        String snssaiListStr = jsonUtil.getJsonValue(sliceProfileStr, "snssaiList")
+        String snssai = jsonUtil.StringArrayToList(snssaiListStr).get(0)
+
+        return snssai
+    }
+
+    String getFirstPlmnIdFromSliceProfile(String sliceProfileStr) {
+        String plmnListStr = jsonUtil.getJsonValue(sliceProfileStr, "plmnIdList")
+        String res = jsonUtil.StringArrayToList(plmnListStr).get(0)
+
+        return res
+    }
+}
index 282e961..3a19921 100644 (file)
@@ -44,6 +44,8 @@ import org.onap.aaiclient.client.aai.AAIResourcesClient
 import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
 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.springframework.web.util.UriUtils
 import org.slf4j.Logger
 import org.slf4j.LoggerFactory
@@ -178,7 +180,7 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor
                        String serviceType = execution.getVariable('serviceType')
 
                        AAIResourcesClient resourceClient = new AAIResourcesClient()
-                       AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId, serviceType, serviceInstanceId)
+                       AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(serviceType).serviceInstance(serviceInstanceId))
                        AAIResultWrapper wrapper = resourceClient.get(serviceInstanceUri, NotFoundException.class)
 
                        Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class)
index 148ab18..a50f96a 100644 (file)
@@ -33,6 +33,7 @@ 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.ErrorCode
 import org.onap.so.bpmn.common.scripts.ExceptionUtil
 import org.onap.so.bpmn.common.scripts.MsoUtils
@@ -185,7 +186,7 @@ class UpdateVfModuleVolume extends VfModuleBase {
                try {
                        def volumeGroupId = execution.getVariable('UPDVfModVol_volumeGroupId')
                        def aicCloudRegion = execution.getVariable('UPDVfModVol_aicCloudRegion')
-                       AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, Defaults.CLOUD_OWNER.toString(),aicCloudRegion,volumeGroupId)
+                       AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(Defaults.CLOUD_OWNER.toString(), aicCloudRegion).volumeGroup(volumeGroupId))
                        AAIResultWrapper wrapper =  getAAIClient().get(uri)
                        Optional<VolumeGroup> volumeGroup = wrapper.asBean(VolumeGroup.class)
                        if(volumeGroup.isPresent()){
@@ -193,7 +194,7 @@ class UpdateVfModuleVolume extends VfModuleBase {
                                execution.setVariable('UPDVfModVol_volumeGroupHeatStackId', heatStackId)
                                Optional<Relationships> relationships = wrapper.getRelationships()
                                if(relationships.isPresent()){
-                                       List<AAIResourceUri> resourceUriList = relationships.get().getRelatedAAIUris(AAIObjectType.TENANT)
+                                       List<AAIResourceUri> resourceUriList = relationships.get().getRelatedUris(Types.TENANT)
                                        if(CollectionUtils.isNotEmpty(resourceUriList)){
                                                AAIResourceUri tenantUri = resourceUriList.get(0)
                                                String volumeGroupTenantId = tenantUri.getURIKeys().get(AAIFluentTypeBuilder.Types.TENANT.getUriParams().tenantId)
index b6873a1..b775771 100644 (file)
@@ -29,12 +29,12 @@ import org.camunda.bpm.engine.delegate.DelegateExecution
 import org.onap.aai.domain.yang.GenericVnf
 import org.onap.aai.domain.yang.VfModule
 import org.onap.aai.domain.yang.VolumeGroup
-import org.onap.aaiclient.client.aai.AAIObjectType
 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.ErrorCode
 import org.onap.so.bpmn.common.scripts.ExceptionUtil
 import org.onap.so.bpmn.common.scripts.MsoUtils
@@ -207,14 +207,14 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase {
         def aicCloudRegion = execution.getVariable('UPDVfModVol_aicCloudRegion')
 
         try {
-            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, Defaults.CLOUD_OWNER.toString(), aicCloudRegion, volumeGroupId)
+            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(Defaults.CLOUD_OWNER.toString(), aicCloudRegion).volumeGroup(volumeGroupId))
             AAIResultWrapper wrapper = getAAIClient().get(uri)
             Optional<VolumeGroup> volumeGroup = wrapper.asBean(VolumeGroup.class)
             if (volumeGroup.isPresent()) {
                 execution.setVariable('UPDVfModVol_aaiVolumeGroupResponse', volumeGroup.get())
                 Optional<Relationships> relationships = wrapper.getRelationships()
                 if (relationships.isPresent()) {
-                    List<AAIResourceUri> tenantURIList = relationships.get().getRelatedAAIUris(AAIObjectType.TENANT)
+                    List<AAIResourceUri> tenantURIList = relationships.get().getRelatedUris(Types.TENANT)
                     if (!isEmpty(tenantURIList)) {
                         String volumeGroupTenantId = tenantURIList.get(0).getURIKeys().get(AAIFluentTypeBuilder.Types.TENANT.getUriParams().tenantId)
                         execution.setVariable('UPDVfModVol_volumeGroupTenantId', volumeGroupTenantId)
@@ -224,7 +224,7 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase {
                         exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Could not find Tenant Id element in Volume Group with Volume Group Id " + volumeGroupId
                                 + ", AIC Cloud Region " + aicCloudRegion)
                     }
-                    execution.setVariable('UPDVfModVol_relatedVfModuleLink', relationships.get().getRelatedLinks(AAIObjectType.VF_MODULE).get(0))
+                    execution.setVariable('UPDVfModVol_relatedVfModuleLink', relationships.get().getRelatedLinks(Types.VF_MODULE).get(0))
 
                 } else {
                     exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Could not find Tenant Id element in Volume Group with Volume Group Id " + volumeGroupId
@@ -249,7 +249,7 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase {
 
         def vnfId = execution.getVariable('vnfId')
 
-        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
+        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId))
         try {
             Optional<GenericVnf> genericVnf = getAAIClient().get(GenericVnf.class, uri)
             if (genericVnf.isPresent()) {
@@ -273,7 +273,7 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase {
 
         String queryAAIVfModuleRequest = execution.getVariable('UPDVfModVol_relatedVfModuleLink')
         execution.setVariable('UPDVfModVol_personaModelId', '')
-        AAIResourceUri uri = AAIUriFactory.createResourceFromExistingURI(AAIObjectType.VF_MODULE, UriBuilder.fromPath(queryAAIVfModuleRequest).build())
+        AAIResourceUri uri = AAIUriFactory.createResourceFromExistingURI(Types.VF_MODULE, UriBuilder.fromPath(queryAAIVfModuleRequest).build())
         try{
            Optional<VfModule> vfModule = getAAIClient().get(VfModule.class,uri)
             if(vfModule.isPresent()){
index aa35123..c797f92 100644 (file)
@@ -32,6 +32,7 @@ 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.appc.client.lcm.model.Action
 import org.onap.appc.client.lcm.model.ActionIdentifiers
 import org.onap.appc.client.lcm.model.Flags
@@ -218,7 +219,7 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor {
             logger.debug("cloudRegionId is: {}", cloudRegionId)
                        
                        AAIResourcesClient client = new AAIResourcesClient()
-                       AAIResourceUri genericVnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
+                       AAIResourceUri genericVnfUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId))
                        // Check if this VNF exists
                        if (!client.exists(genericVnfUri)) {
                 logger.debug("VNF with vnfId {} does not exist in A&AI", vnfId)
@@ -243,7 +244,7 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor {
                                Relationships relationships = aaiRW.getRelationships().get()
                                if (relationships != null) {
                                                
-                                       List<AAIResourceUri> vserverUris = relationships.getRelatedAAIUris(AAIObjectType.VSERVER)
+                                       List<AAIResourceUri> vserverUris = relationships.getRelatedUris(Types.VSERVER)
                                        JSONArray vserverIds = new JSONArray()
                                        JSONArray vserverSelfLinks = new JSONArray()
                                
@@ -436,7 +437,7 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor {
                        def vnfId = execution.getVariable("vnfId")
             logger.debug("vnfId is: {}", vnfId)
                        AAIResourcesClient client = new AAIResourcesClient()
-                       AAIResourceUri genericVnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
+                       AAIResourceUri genericVnfUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId))
                        AAIResultWrapper aaiRW = client.get(genericVnfUri)
                        Map<String, Object> result = aaiRW.asMap()
                        boolean isClosedLoopDisabled = result.getOrDefault("is-closed-loop-disabled", false)
@@ -488,7 +489,7 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor {
                        def transactionLoggingUuid = UUID.randomUUID().toString()
                        def vnfId = execution.getVariable("vnfId")
                        AAIResourcesClient client = new AAIResourcesClient()
-                       AAIResourceUri genericVnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
+                       AAIResourceUri genericVnfUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId))
                        
                        Map<String, Boolean> request = new HashMap<>()
                        request.put("is-closed-loop-disabled", setDisabled)
index ddc80f6..ee173ca 100644 (file)
@@ -32,6 +32,8 @@ import org.onap.aaiclient.client.aai.*
 import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
 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.logger.MessageEnum
 import org.slf4j.Logger
 import org.slf4j.LoggerFactory
@@ -360,7 +362,7 @@ public class VnfConfigUpdate extends VnfCmBase {
                        def vnfId = execution.getVariable("vnfId")
             logger.debug("vnfId is: {}", vnfId)
                        AAIResourcesClient client = new AAIResourcesClient()
-                       AAIResourceUri genericVnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
+                       AAIResourceUri genericVnfUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId))
                        AAIResultWrapper aaiRW = client.get(genericVnfUri)
                        Map<String, Object> result = aaiRW.asMap()
                        boolean isClosedLoopDisabled = result.getOrDefault("is-closed-loop-disabled", false)
@@ -412,7 +414,7 @@ public class VnfConfigUpdate extends VnfCmBase {
                        def transactionLoggingUuid = UUID.randomUUID().toString()
                        def vnfId = execution.getVariable("vnfId")
                        AAIResourcesClient client = new AAIResourcesClient()
-                       AAIResourceUri genericVnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
+                       AAIResourceUri genericVnfUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId))
 
                        Map<String, Boolean> request = new HashMap<>()
                        request.put("is-closed-loop-disabled", setDisabled)
index 603d5e4..4fad3c3 100644 (file)
@@ -35,6 +35,8 @@ import org.onap.aaiclient.client.aai.*
 import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
 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.client.appc.ApplicationControllerClient
 import org.onap.so.client.appc.ApplicationControllerSupport
 import org.onap.so.logger.LoggingAnchor
@@ -380,7 +382,7 @@ public class VnfInPlaceUpdate extends VnfCmBase {
                        def vnfId = execution.getVariable("vnfId")
                        logger.debug("vnfId is: " + vnfId)
                        AAIResourcesClient client = new AAIResourcesClient()
-                       AAIResourceUri genericVnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
+                       AAIResourceUri genericVnfUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId))
                        AAIResultWrapper aaiRW = client.get(genericVnfUri)
                        Map<String, Object> result = aaiRW.asMap()
                        boolean isClosedLoopDisabled = result.getOrDefault("is-closed-loop-disabled", false)
@@ -431,7 +433,7 @@ public class VnfInPlaceUpdate extends VnfCmBase {
                        def transactionLoggingUuid = UUID.randomUUID().toString()
                        def vnfId = execution.getVariable("vnfId")
                        AAIResourcesClient client = new AAIResourcesClient()
-                       AAIResourceUri genericVnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
+                       AAIResourceUri genericVnfUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId))
 
                        Map<String, Boolean> request = new HashMap<>()
                        request.put("is-closed-loop-disabled", setDisabled)
index dd1dae6..236e9d6 100644 (file)
@@ -31,6 +31,7 @@ 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.ErrorCode
 import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
 import org.onap.so.bpmn.common.scripts.ExceptionUtil
@@ -205,7 +206,7 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor {
                        String serviceInstanceId = execution.getVariable('serviceInstanceId')
 
                        AAIResourcesClient resourceClient = new AAIResourcesClient()
-                       AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId)
+                       AAIResourceUri uri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId))
 
                        if(resourceClient.exists(uri)){
                                AAIResultWrapper wrapper = resourceClient.get(uri, NotFoundException.class)
@@ -217,13 +218,13 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor {
 
                                if(relationships.isPresent()){
 
-                                       List<AAIResourceUri> vnfUris = relationships.get().getRelatedAAIUris(AAIObjectType.GENERIC_VNF)
+                                       List<AAIResourceUri> vnfUris = relationships.get().getRelatedUris(Types.GENERIC_VNF)
                                        for(AAIResourceUri u:vnfUris){
                                                Map<String, String> keys = u.getURIKeys()
                                                String vnfId = keys.get(AAIFluentTypeBuilder.Types.GENERIC_VNF.getUriParams().vnfId)
                                                relatedVnfIdList.add(vnfId)
                                        }
-                                       List<AAIResourceUri> arUris = relationships.get().getRelatedAAIUris(AAIObjectType.ALLOTTED_RESOURCE)
+                                       List<AAIResourceUri> arUris = relationships.get().getRelatedUris(Types.ALLOTTED_RESOURCE)
                                        for(AAIResourceUri u:arUris){
                                                String ar = resourceClient.get(u).getJson()
 
index 683b82e..87c2f67 100644 (file)
@@ -27,16 +27,17 @@ import javax.ws.rs.core.UriBuilder
 import org.camunda.bpm.engine.delegate.BpmnError
 import org.camunda.bpm.engine.delegate.DelegateExecution
 import org.onap.aai.domain.yang.AllottedResource
+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.logging.filter.base.ErrorCode
 import org.onap.so.bpmn.common.scripts.*
 import org.onap.so.bpmn.core.RollbackData
 import org.onap.so.bpmn.core.UrnPropertiesReader
 import org.onap.so.bpmn.core.WorkflowException
 import org.onap.so.bpmn.core.json.JsonUtils
-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.logging.filter.base.ErrorCode
 import org.onap.so.logger.LoggingAnchor
 import org.onap.so.logger.MessageEnum
 import org.slf4j.Logger
@@ -168,7 +169,7 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{
                        String serviceInstanceId = execution.getVariable('serviceInstanceId')
 
                        AAIResourcesClient resourceClient = new AAIResourcesClient()
-                       AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId)
+                       AAIResourceUri uri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId))
 
                        if(resourceClient.exists(uri)){
                                execution.setVariable("CSI_resourceLink", uri.build().toString())
@@ -230,7 +231,7 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{
                        String serviceInstanceId = execution.getVariable('parentServiceInstanceId')
 
                        AAIResourcesClient resourceClient = new AAIResourcesClient()
-                       AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId)
+                       AAIResourceUri uri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId))
 
                                //just to make sure the serviceInstance exists
                                if (resourceClient.exists(uri)) {
@@ -265,7 +266,7 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{
 
                        AAIResourceUri siResourceLink= execution.getVariable("PSI_resourceLink")
 
-                       AAIResourceUri allottedResourceUri = AAIUriFactory.createResourceFromParentURI(siResourceLink, AAIObjectType.ALLOTTED_RESOURCE, allottedResourceId)
+                       AAIResourceUri allottedResourceUri = AAIUriFactory.createResourceFromParentURI(siResourceLink, Types.ALLOTTED_RESOURCE.getFragment(allottedResourceId))
 
                        execution.setVariable("aaiARPath", allottedResourceUri.build().toString());
                        String arType = execution.getVariable("allottedResourceType")
@@ -283,7 +284,7 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{
                        resource.setModelInvariantId(modelInvariantId)
                        resource.setModelVersionId(modelVersionId)
                        getAAIClient().create(allottedResourceUri, resource)
-                       AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceFromExistingURI(AAIObjectType.SERVICE_INSTANCE, UriBuilder.fromPath(CSI_resourceLink).build())
+                       AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceFromExistingURI(Types.SERVICE_INSTANCE, UriBuilder.fromPath(CSI_resourceLink).build())
                        getAAIClient().connect(allottedResourceUri,serviceInstanceUri)
                }catch (Exception ex) {
                        exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Exception in createAaiAR " + ex.getMessage())
index 9782440..69ce713 100644 (file)
 
 package org.onap.so.bpmn.vcpe.scripts
 
-import org.onap.so.logger.LoggingAnchor
+import static org.apache.commons.lang3.StringUtils.isBlank
+import javax.ws.rs.core.UriBuilder
 import org.camunda.bpm.engine.delegate.BpmnError
 import org.camunda.bpm.engine.delegate.DelegateExecution
 import org.onap.aai.domain.yang.AllottedResource
+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.ErrorCode
 import org.onap.so.bpmn.common.scripts.*;
 import org.onap.so.bpmn.core.RollbackData
 import org.onap.so.bpmn.core.UrnPropertiesReader
 import org.onap.so.bpmn.core.WorkflowException
 import org.onap.so.bpmn.core.json.JsonUtils
-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.logging.filter.base.ErrorCode
+import org.onap.so.logger.LoggingAnchor
 import org.onap.so.logger.MessageEnum
 import org.slf4j.Logger
 import org.slf4j.LoggerFactory
 
-import javax.ws.rs.core.UriBuilder
-import static org.apache.commons.lang3.StringUtils.isBlank
-
 /**
  * This groovy class supports the <class>DoCreateAllottedResourceTXC.bpmn</class> process.
  *
@@ -206,7 +206,7 @@ public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{
 
                        AAIResourceUri siResourceLink= execution.getVariable("PSI_resourceLink")
 
-                       AAIResourceUri allottedResourceUri = AAIUriFactory.createResourceFromParentURI(siResourceLink, AAIObjectType.ALLOTTED_RESOURCE, allottedResourceId)
+                       AAIResourceUri allottedResourceUri = AAIUriFactory.createResourceFromParentURI(siResourceLink, Types.ALLOTTED_RESOURCE.getFragment(allottedResourceId))
 
                        execution.setVariable("aaiARPath", allottedResourceUri.build().toString());
                        String arType = execution.getVariable("allottedResourceType")
@@ -224,7 +224,7 @@ public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{
                        resource.setModelInvariantId(modelInvariantId)
                        resource.setModelVersionId(modelVersionId)
                        getAAIClient().create(allottedResourceUri, resource)
-                       AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceFromExistingURI(AAIObjectType.SERVICE_INSTANCE, UriBuilder.fromPath(CSI_resourceLink).build())
+                       AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceFromExistingURI(Types.SERVICE_INSTANCE, UriBuilder.fromPath(CSI_resourceLink).build())
                        getAAIClient().connect(allottedResourceUri,serviceInstanceUri)
 
                }catch (Exception ex) {
index 1cc6895..3021852 100644 (file)
@@ -23,11 +23,12 @@ package org.onap.so.bpmn.infrastructure.aai;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Optional;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
-import org.onap.aaiclient.client.aai.AAIObjectType;
 import org.onap.aaiclient.client.aai.entities.AAIResultWrapper;
 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.servicedecomposition.bbobjects.GenericVnf;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -36,17 +37,19 @@ public class AAICreateResources extends AAIResource {
     private static final Logger logger = LoggerFactory.getLogger(AAICreateResources.class);
 
     public void createAAIProject(String projectName, String serviceInstance) {
-        AAIResourceUri projectURI = AAIUriFactory.createResourceUri(AAIObjectType.PROJECT, projectName);
+        AAIResourceUri projectURI =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().project(projectName));
         AAIResourceUri serviceInstanceURI =
-                AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance);
+                AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstance));
         getAaiClient().createIfNotExists(projectURI, Optional.empty()).connect(projectURI, serviceInstanceURI);
 
     }
 
     public void createAAIOwningEntity(String owningEntityId, String owningEntityName, String serviceInstance) {
-        AAIResourceUri owningEntityURI = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntityId);
+        AAIResourceUri owningEntityURI =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().owningEntity(owningEntityId));
         AAIResourceUri serviceInstanceURI =
-                AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance);
+                AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstance));
         Map<String, String> hashMap = new HashMap<>();
         hashMap.put("owning-entity-name", owningEntityName);
         getAaiClient().createIfNotExists(owningEntityURI, Optional.of(hashMap)).connect(owningEntityURI,
@@ -54,39 +57,44 @@ public class AAICreateResources extends AAIResource {
     }
 
     public boolean existsOwningEntity(String owningEntityId) {
-        AAIResourceUri owningEntityURI = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntityId);
+        AAIResourceUri owningEntityURI =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().owningEntity(owningEntityId));
         return getAaiClient().exists(owningEntityURI);
     }
 
     public void connectOwningEntityandServiceInstance(String owningEntityId, String serviceInstance) {
-        AAIResourceUri owningEntityURI = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntityId);
+        AAIResourceUri owningEntityURI =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().owningEntity(owningEntityId));
         AAIResourceUri serviceInstanceURI =
-                AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance);
+                AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstance));
         getAaiClient().connect(owningEntityURI, serviceInstanceURI);
     }
 
     public void createAAIPlatform(String platformName, String vnfId) {
-        AAIResourceUri platformURI = AAIUriFactory.createResourceUri(AAIObjectType.PLATFORM, platformName);
-        AAIResourceUri genericVnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId);
+        AAIResourceUri platformURI =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().platform(platformName));
+        AAIResourceUri genericVnfURI =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId));
         getAaiClient().createIfNotExists(platformURI, Optional.empty()).connect(platformURI, genericVnfURI);
     }
 
     public void createAAILineOfBusiness(String lineOfBusiness, String vnfId) {
         AAIResourceUri lineOfBusinessURI =
-                AAIUriFactory.createResourceUri(AAIObjectType.LINE_OF_BUSINESS, lineOfBusiness);
-        AAIResourceUri genericVnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId);
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().lineOfBusiness(lineOfBusiness));
+        AAIResourceUri genericVnfURI =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId));
         getAaiClient().createIfNotExists(lineOfBusinessURI, Optional.empty()).connect(lineOfBusinessURI, genericVnfURI);
     }
 
     public void createAAIServiceInstance(String globalCustomerId, String serviceType, String serviceInstanceId) {
-        AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
-                globalCustomerId, serviceType, serviceInstanceId);
+        AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business()
+                .customer(globalCustomerId).serviceSubscription(serviceType).serviceInstance(serviceInstanceId));
         getAaiClient().createIfNotExists(serviceInstanceURI, Optional.empty());
     }
 
     public Optional<GenericVnf> getVnfInstance(String vnfId) {
         try {
-            AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId);
+            AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId));
             AAIResultWrapper aaiResponse = getAaiClient().get(vnfURI);
             Optional<GenericVnf> vnf = aaiResponse.asBean(GenericVnf.class);
             return vnf;
index 2216648..97adc4d 100644 (file)
@@ -22,10 +22,10 @@ package org.onap.so.bpmn.infrastructure.aai;
 
 import org.camunda.bpm.engine.delegate.DelegateExecution;
 import org.camunda.bpm.engine.delegate.JavaDelegate;
-import org.onap.so.bpmn.common.scripts.ExceptionUtil;
-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.Types;
+import org.onap.so.bpmn.common.scripts.ExceptionUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -43,7 +43,7 @@ public class AAIDeleteServiceInstance extends AAIResource implements JavaDelegat
         try {
             String serviceInstanceId = (String) execution.getVariable("serviceInstanceId");
             AAIResourceUri serviceInstanceURI =
-                    AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId);
+                    AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId));
             getAaiClient().delete(serviceInstanceURI);
             execution.setVariable("GENDS_SuccessIndicator", true);
         } catch (Exception ex) {
index c2e2a3c..cc7eefc 100644 (file)
@@ -27,11 +27,11 @@ import java.util.Map;
 import java.util.Optional;
 import org.onap.aai.domain.yang.OwningEntities;
 import org.onap.aai.domain.yang.OwningEntity;
-import org.onap.aaiclient.client.aai.AAIObjectPlurals;
-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.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -40,18 +40,20 @@ public class AAICreateResources {
     private static final Logger logger = LoggerFactory.getLogger(AAICreateResources.class);
 
     public void createAAIProject(String projectName, String serviceInstance) {
-        AAIResourceUri projectURI = AAIUriFactory.createResourceUri(AAIObjectType.PROJECT, projectName);
+        AAIResourceUri projectURI =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().project(projectName));
         AAIResourceUri serviceInstanceURI =
-                AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance);
+                AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstance));
         AAIResourcesClient aaiRC = new AAIResourcesClient();
         aaiRC.createIfNotExists(projectURI, Optional.empty()).connect(projectURI, serviceInstanceURI);
 
     }
 
     public void createAAIOwningEntity(String owningEntityId, String owningEntityName, String serviceInstance) {
-        AAIResourceUri owningEntityURI = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntityId);
+        AAIResourceUri owningEntityURI =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().owningEntity(owningEntityId));
         AAIResourceUri serviceInstanceURI =
-                AAIUriFactory.createNodesUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance);
+                AAIUriFactory.createNodesUri(Types.SERVICE_INSTANCE.getFragment(serviceInstance));
         Map<String, String> hashMap = new HashMap<>();
         hashMap.put("owning-entity-name", owningEntityName);
         AAIResourcesClient aaiRC = new AAIResourcesClient();
@@ -59,7 +61,8 @@ public class AAICreateResources {
     }
 
     public boolean existsOwningEntity(String owningEntityId) {
-        AAIResourceUri owningEntityURI = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntityId);
+        AAIResourceUri owningEntityURI =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().owningEntity(owningEntityId));
         AAIResourcesClient aaiRC = new AAIResourcesClient();
         return aaiRC.exists(owningEntityURI);
     }
@@ -67,8 +70,10 @@ public class AAICreateResources {
     protected OwningEntities getOwningEntityName(String owningEntityName) {
 
         AAIResourcesClient aaiRC = new AAIResourcesClient();
-        return aaiRC.get(OwningEntities.class, AAIUriFactory.createResourceUri(AAIObjectPlurals.OWNING_ENTITY)
-                .queryParam("owning-entity-name", owningEntityName)).orElseGet(() -> {
+        return aaiRC.get(OwningEntities.class,
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().owningEntities())
+                        .queryParam("owning-entity-name", owningEntityName))
+                .orElseGet(() -> {
                     logger.debug("No Owning Entity matched by name");
                     return null;
                 });
@@ -91,31 +96,35 @@ public class AAICreateResources {
     }
 
     public void connectOwningEntityandServiceInstance(String owningEntityId, String serviceInstance) {
-        AAIResourceUri owningEntityURI = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntityId);
+        AAIResourceUri owningEntityURI =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().owningEntity(owningEntityId));
         AAIResourceUri serviceInstanceURI =
-                AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance);
+                AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstance));
         AAIResourcesClient aaiRC = new AAIResourcesClient();
         aaiRC.connect(owningEntityURI, serviceInstanceURI);
     }
 
     public void createAAIPlatform(String platformName, String vnfId) {
-        AAIResourceUri platformURI = AAIUriFactory.createResourceUri(AAIObjectType.PLATFORM, platformName);
-        AAIResourceUri genericVnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId);
+        AAIResourceUri platformURI =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().platform(platformName));
+        AAIResourceUri genericVnfURI =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId));
         AAIResourcesClient aaiRC = new AAIResourcesClient();
         aaiRC.createIfNotExists(platformURI, Optional.empty()).connect(platformURI, genericVnfURI);
     }
 
     public void createAAILineOfBusiness(String lineOfBusiness, String vnfId) {
         AAIResourceUri lineOfBusinessURI =
-                AAIUriFactory.createResourceUri(AAIObjectType.LINE_OF_BUSINESS, lineOfBusiness);
-        AAIResourceUri genericVnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId);
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().lineOfBusiness(lineOfBusiness));
+        AAIResourceUri genericVnfURI =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId));
         AAIResourcesClient aaiRC = new AAIResourcesClient();
         aaiRC.createIfNotExists(lineOfBusinessURI, Optional.empty()).connect(lineOfBusinessURI, genericVnfURI);
     }
 
     public void createAAIServiceInstance(String globalCustomerId, String serviceType, String serviceInstanceId) {
-        AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
-                globalCustomerId, serviceType, serviceInstanceId);
+        AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business()
+                .customer(globalCustomerId).serviceSubscription(serviceType).serviceInstance(serviceInstanceId));
         AAIResourcesClient aaiRC = new AAIResourcesClient();
         aaiRC.createIfNotExists(serviceInstanceURI, Optional.empty());
     }
index bb7415d..df42e96 100644 (file)
@@ -22,11 +22,11 @@ package org.onap.so.bpmn.infrastructure.aai.groovyflows;
 
 import org.camunda.bpm.engine.delegate.DelegateExecution;
 import org.camunda.bpm.engine.delegate.JavaDelegate;
-import org.onap.so.bpmn.common.scripts.ExceptionUtil;
-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.Types;
+import org.onap.so.bpmn.common.scripts.ExceptionUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -42,7 +42,7 @@ public class AAIDeleteServiceInstance implements JavaDelegate {
         try {
             String serviceInstanceId = (String) execution.getVariable("serviceInstanceId");
             AAIResourceUri serviceInstanceURI =
-                    AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId);
+                    AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId));
             AAIResourcesClient aaiRC = new AAIResourcesClient();
             aaiRC.delete(serviceInstanceURI);
             execution.setVariable("GENDS_SuccessIndicator", true);
index 001e166..03ff55b 100644 (file)
@@ -22,11 +22,12 @@ package org.onap.so.bpmn.infrastructure.pnf.management;
 
 import java.util.Optional;
 import org.onap.aai.domain.yang.Pnf;
-import org.onap.aaiclient.client.aai.AAIObjectType;
 import org.onap.aaiclient.client.aai.AAIResourcesClient;
 import org.onap.aaiclient.client.aai.AAIRestClientImpl;
 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.springframework.stereotype.Component;
 
 @Component
@@ -52,8 +53,8 @@ public class PnfManagementImpl implements PnfManagement {
     @Override
     public void createRelation(String serviceInstanceId, String pnfName) {
         AAIResourceUri serviceInstanceURI =
-                AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId);
-        AAIResourceUri pnfUri = AAIUriFactory.createResourceUri(AAIObjectType.PNF, pnfName);
+                AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId));
+        AAIResourceUri pnfUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().pnf(pnfName));
         new AAIResourcesClient().connect(serviceInstanceURI, pnfUri);
     }
 }
index 99ed7b1..d1fc0a6 100644 (file)
@@ -54,19 +54,19 @@ import org.onap.aai.domain.yang.LogicalLinks;
 import org.onap.aai.domain.yang.PInterface;
 import org.onap.aai.domain.yang.Pnf;
 import org.onap.aai.domain.yang.Relationship;
-import org.onap.logging.filter.base.ErrorCode;
-import org.onap.so.bpmn.core.UrnPropertiesReader;
-import org.onap.so.bpmn.core.domain.Resource;
-import org.onap.so.bpmn.core.domain.ServiceDecomposition;
-import org.onap.so.bpmn.core.json.JsonUtils;
-import org.onap.aaiclient.client.aai.AAIObjectPlurals;
-import org.onap.aaiclient.client.aai.AAIObjectType;
 import org.onap.aaiclient.client.aai.AAIResourcesClient;
 import org.onap.aaiclient.client.aai.entities.AAIResultWrapper;
 import org.onap.aaiclient.client.aai.entities.Relationships;
 import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
 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.ErrorCode;
+import org.onap.so.bpmn.core.UrnPropertiesReader;
+import org.onap.so.bpmn.core.domain.Resource;
+import org.onap.so.bpmn.core.domain.ServiceDecomposition;
+import org.onap.so.bpmn.core.json.JsonUtils;
 import org.onap.so.logger.MessageEnum;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -448,7 +448,7 @@ public class ServicePluginFactory {
     public Map getTPsfromAAI(String serviceName) {
         Map<String, Object> tpInfo = new HashMap<>();
 
-        AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.LOGICAL_LINK);
+        AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().logicalLinks());
         AAIResourcesClient client = new AAIResourcesClient();
         Optional<LogicalLinks> result = client.get(LogicalLinks.class, uri);
 
@@ -464,10 +464,10 @@ public class ServicePluginFactory {
                 List<AAIResourceUri> pInterfaces = new ArrayList<>();
                 if (optRelationships.isPresent()) {
                     Relationships relationships = optRelationships.get();
-                    if (!relationships.getRelatedAAIUris(AAIObjectType.EXT_AAI_NETWORK).isEmpty()) {
+                    if (!relationships.getRelatedUris(Types.EXT_AAI_NETWORK).isEmpty()) {
                         isRemoteLink = true;
                     }
-                    pInterfaces.addAll(relationships.getRelatedAAIUris(AAIObjectType.P_INTERFACE));
+                    pInterfaces.addAll(relationships.getRelatedUris(Types.P_INTERFACE));
                     if (isRemoteLink) {
                         // find remote p interface
                         AAIResourceUri localTP = null;
@@ -502,8 +502,8 @@ public class ServicePluginFactory {
             tpInfo.put("local-access-node-id", localNodeId);
 
             logger.info("Get info for local TP :{}", localNodeId);
-            Optional<Pnf> optLocalPnf =
-                    client.get(Pnf.class, AAIUriFactory.createResourceUri(AAIObjectType.PNF, localNodeId));
+            Optional<Pnf> optLocalPnf = client.get(Pnf.class,
+                    AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().pnf(localNodeId)));
 
 
             getTpInfoFromLocalTp(tpInfo, optLocalPnf);
@@ -523,8 +523,8 @@ public class ServicePluginFactory {
             logger.info("Get info for remote TP:{}", remoteNodeId);
 
             String[] networkRefRemote = intfRemote.getNetworkRef().split("-");
-            Optional<Pnf> optRemotePnf =
-                    client.get(Pnf.class, AAIUriFactory.createResourceUri(AAIObjectType.PNF, remoteNodeId));
+            Optional<Pnf> optRemotePnf = client.get(Pnf.class,
+                    AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().pnf(remoteNodeId)));
 
             getTpInfoFromRemoteTp(tpInfo, networkRefRemote, optRemotePnf);
 
@@ -584,14 +584,14 @@ public class ServicePluginFactory {
         if (uriString != null) {
             // get the pnfname
             String[] token = uriString.split("/");
-            AAIResourceUri parent = AAIUriFactory.createResourceUri(AAIObjectType.PNF, token[4]);
+            AAIResourceUri parent = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().pnf(token[4]));
 
             AAIResultWrapper wrapper = client.get(parent);
             Optional<Relationships> optRelationships = wrapper.getRelationships();
             if (optRelationships.isPresent()) {
                 Relationships relationships = optRelationships.get();
 
-                return !relationships.getRelatedAAIUris(AAIObjectType.EXT_AAI_NETWORK).isEmpty();
+                return !relationships.getRelatedUris(Types.EXT_AAI_NETWORK).isEmpty();
             }
         }
 
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSliceSubnetTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSliceSubnetTest.groovy
new file mode 100644 (file)
index 0000000..adb83e7
--- /dev/null
@@ -0,0 +1,68 @@
+package org.onap.so.bpmn.infrastructure.scripts
+
+import static org.junit.Assert.*
+
+import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity
+import org.junit.Before
+import org.junit.Test
+import org.mockito.ArgumentCaptor
+import org.mockito.Captor
+
+class ActivateSliceSubnetTest {
+       @Before
+       void init() throws IOException {
+               super.init("ActivateSliceSubnet")
+       }
+
+       @Captor
+       static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class)
+
+       @Test
+       public void testPreProcessRequest() {
+               when(mockExecution.getVariable("bpmnRequest")).thenReturn("""
+        {
+                               "serviceInstanceID": "NSSI-C-001-HDBNJ-NSSMF-01-A-ZX ",
+                               "networkType": "an/cn/tn",
+                               "globalSubscriberId": "5GCustomer",
+                               "subscriptionServiceType": "5G",
+                               "additionalProperties": {
+                               "nsiInfo": {
+                                       "nsiId": "NSI-M-001-HDBNJ-NSMF-01-A-ZX",
+                                       "nsiName": "eMBB-001"
+                               },
+                               }
+}
+""".replaceAll("\\s+", ""))
+               when(mockExecution.getVariable("mso-request-id")).thenReturn("edb08d97-e0f9-4c71-840a-72080d7be42e")
+               when(mockExecution.getVariable("requestAction")).thenReturn("activateInstance")
+               ActivateSliceSubnet sliceSubnet = new ActivateSliceSubnet()
+               sliceSubnet.preProcessRequest(mockExecution)
+               Mockito.verify(mockExecution, times(1)).setVariable(captor.capture() as String, captor.capture())
+               List<ExecutionEntity> values = captor.getAllValues()
+               assertNotNull(values)
+       }
+       
+       @Test
+       void testPrepareInitOperationStatus() {
+               when(mockExecution.getVariable("serviceInstanceId")).thenReturn("54321")
+               when(mockExecution.getVariable("jobId")).thenReturn("54321")
+               when(mockExecution.getVariable("nsiId")).thenReturn("11111")
+               ActivateSliceSubnet sliceSubnet = new ActivateSliceSubnet()
+               sliceSubnet.prepareInitOperationStatus(mockExecution)
+               Mockito.verify(mockExecution, times(1)).setVariable(eq("initResourceOperationStatus"), captor.capture())
+               String res = captor.getValue()
+               assertNotNull(res)
+       }
+
+
+       @Test
+       void testSendSyncResponse() {
+               when(mockExecution.getVariable("jobId")).thenReturn("123456")
+               ActivateSliceSubnet sliceSubnet = new ActivateSliceSubnet()
+               sliceSubnet.sendSyncResponse(mockExecution)
+               Mockito.verify(mockExecution, times(1)).setVariable(eq("sentSyncResponse"), captor.capture())
+               def updateVolumeGroupRequest = captor.getValue()
+               assertEquals(updateVolumeGroupRequest, true)
+       }
+
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/AllocateSliceSubnetTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/AllocateSliceSubnetTest.groovy
new file mode 100644 (file)
index 0000000..a9b4e09
--- /dev/null
@@ -0,0 +1,135 @@
+/*
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ # Copyright (c) 2020, Wipro Limited.
+ #
+ # Licensed under the Apache License, Version 2.0 (the "License")
+ # you may not use this file except in compliance with the License.
+ # You may obtain a copy of the License at
+ #
+ #       http://www.apache.org/licenses/LICENSE-2.0
+ #
+ # Unless required by applicable law or agreed to in writing, software
+ # distributed under the License is distributed on an "AS IS" BASIS,
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ # See the License for the specific language governing permissions and
+ # limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.scripts
+
+import static org.junit.Assert.*
+import static org.mockito.Mockito.times
+import static org.mockito.Mockito.when
+
+import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity
+import org.junit.Before
+import org.junit.Test
+import org.mockito.ArgumentCaptor
+import org.mockito.Captor
+import org.mockito.Mockito
+import org.onap.so.bpmn.common.scripts.MsoGroovyTest
+
+
+class AllocateSliceSubnetTest extends MsoGroovyTest {
+       
+       @Before
+       void init() throws IOException {
+               super.init("AllocateSliceSubnet")
+       }
+
+       @Captor
+       static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class)
+
+       @Test
+       public void testPreProcessRequest() {
+               when(mockExecution.getVariable("serviceInstanceID")).thenReturn("12345")
+               when(mockExecution.getVariable("bpmnRequest")).thenReturn("""
+        {
+                               "name": "eMBB-001",
+                               "modelInvariantUuid": "NSST-C-001-HDBNJ-NSSMF-01-A-ZX",
+                               "modelUuid": "NSST-C-001-HDBNJ-NSSMF-01-A-ZX-UUID",
+                               "globalSubscriberId": "5GCustomer",
+                               "subscriptionServiceType": "5G",
+                               "networkType": "an/cn/tn",
+                               "additionalProperties": {
+                                       "sliceProfile": {
+                                       "snssaiList": [
+                                               "001-100001"
+                                       ],
+                                       "sliceProfileId": "ab9af40f13f721b5f13539d87484098",
+                                       "plmnIdList": [
+                                               "460-00",
+                                               "460-01"
+                                       ],
+                                       "perfReq": {
+                                       "perfReqEmbbList ": [
+                                               {
+                                                       "activityFactor": 50
+                                               }
+                                       ]
+                                       },
+                               "maxNumberofUEs": 200,
+                               "coverageAreaTAList": [
+                                               "1",
+                                               "2",
+                                               "3",
+                                               "4"
+                                       ],
+                               "latency": 2,
+                               "resourceSharingLevel": "non-shared"
+                                       },
+                               "endPoints": [
+                                       {
+                                               "nodeId": "",
+                                               "additionalInfo": {
+                                                       "xxx": "xxx"
+                                               }
+                                       }
+                                       ],
+                               "nsiInfo": {
+                                       "nsiId": "NSI-M-001-HDBNJ-NSMF-01-A-ZX",
+                                       "nsiName": "eMBB-001"
+                               },
+                               "scriptName": "AN1"
+                               }
+}
+""".replaceAll("\\s+", ""))
+               when(mockExecution.getVariable("mso-request-id")).thenReturn("edb08d97-e0f9-4c71-840a-72080d7be42e")
+               AllocateSliceSubnet sliceSubnet = new AllocateSliceSubnet()
+               sliceSubnet.preProcessRequest(mockExecution)
+               Mockito.verify(mockExecution, times(1)).setVariable(captor.capture() as String, captor.capture())
+               List<ExecutionEntity> values = captor.getAllValues()
+               assertNotNull(values)
+       }
+       
+       @Test
+       void testPrepareInitOperationStatus() {
+
+               when(mockExecution.getVariable("dummyServiceId")).thenReturn("12345")
+               when(mockExecution.getVariable("jobId")).thenReturn("54321")
+
+               when(mockExecution.getVariable("nsiId")).thenReturn("11111")
+
+               AllocateSliceSubnet sliceSubnet = new AllocateSliceSubnet()
+
+               sliceSubnet.prepareInitOperationStatus(mockExecution)
+               Mockito.verify(mockExecution, times(1)).setVariable(eq("initResourceOperationStatus"), captor.capture())
+               String res = captor.getValue()
+               assertNotNull(res)
+       }
+
+
+       @Test
+       void testSendSyncResponse() {
+               when(mockExecution.getVariable("jobId")).thenReturn("123456")
+               AllocateSliceSubnet sliceSubnet = new AllocateSliceSubnet()
+               sliceSubnet.sendSyncResponse(mockExecution)
+               Mockito.verify(mockExecution, times(1)).setVariable(eq("sentSyncResponse"), captor.capture())
+               def updateVolumeGroupRequest = captor.getValue()
+               assertEquals(updateVolumeGroupRequest, true)
+       }
+
+}
index 46f061d..01f4d6b 100644 (file)
@@ -159,45 +159,6 @@ class CreateSliceServiceTest extends MsoGroovyTest {
         assertNotNull(values)
     }
 
-    @Test
-    void testPrepareDecomposeService() {
-        when(mockExecution.getVariable("uuiRequest")).thenReturn(uuiRequest)
-        when(mockExecution.getVariable("serviceProfile")).thenReturn(serviceProfile)
-        CreateSliceService sliceService = new CreateSliceService()
-        sliceService.prepareDecomposeService(mockExecution)
-
-        String serviceModelInfoExcept = """{
-            "modelInvariantUuid":"123456",
-            "modelUuid":"123456",
-            "modelVersion":""
-            }"""
-        Mockito.verify(mockExecution, times(1)).setVariable(eq("ssServiceModelInfo"), captor.capture())
-        String serviceModelInfo = captor.getValue()
-        assertEquals(serviceModelInfoExcept.replaceAll("\\s+", ""),
-                serviceModelInfo.replaceAll("\\s+", ""))
-    }
-
-    @Test
-    void testProcessDecomposition() {
-        when(mockExecution.getVariable("uuiRequest")).thenReturn(uuiRequest)
-        when(mockExecution.getVariable("serviceProfile")).thenReturn(serviceProfile)
-        when(mockExecution.getVariable("nstSolution")).thenReturn(nstSolution)
-
-        CreateSliceService sliceService = new CreateSliceService()
-        sliceService.processDecomposition(mockExecution)
-
-        Mockito.verify(mockExecution, times(1)).setVariable(eq("subscriptionServiceType"), captor.capture())
-        assertEquals(captor.getValue(), "5G")
-        Mockito.verify(mockExecution, times(1)).setVariable(eq("serviceType"), captor.capture())
-        assertEquals(captor.getValue(), "embb")
-        Mockito.verify(mockExecution, times(1)).setVariable(eq("resourceSharingLevel"), captor.capture())
-        assertEquals(captor.getValue(), "shared")
-        Mockito.verify(mockExecution, times(1)).setVariable(eq("nstModelUuid"), captor.capture())
-        assertEquals(captor.getValue(), "aaaaaa")
-        Mockito.verify(mockExecution, times(1)).setVariable(eq("nstModelInvariantUuid"), captor.capture())
-        assertEquals(captor.getValue(), "bbbbbb")
-    }
-
     @Test
     void testPrepareCreateOrchestrationTask() {
         when(mockExecution.getVariable("serviceInstanceId")).thenReturn("123456")
index 1551533..61b4957 100644 (file)
@@ -30,6 +30,8 @@ import org.onap.so.bpmn.common.scripts.MsoGroovyTest
 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
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types
 
 import javax.ws.rs.NotFoundException
 
@@ -59,8 +61,8 @@ class CreateVFCNSResourceTest extends MsoGroovyTest{
         when(mockExecution.getVariable("nsInstanceId")).thenReturn("nsInstanceId")
         doNothing().when(client).connect(isA(AAIResourceUri.class),isA(AAIResourceUri.class))
         createVFCNSResource.addNSRelationship(mockExecution)
-        AAIResourceUri nsUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,"globalSubscriberId1","serviceType","nsInstanceId")
-        AAIResourceUri relatedServiceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,"globalSubscriberId1","serviceType","serviceInstanceId")
+        AAIResourceUri nsUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer("globalSubscriberId1").serviceSubscription("serviceType").serviceInstance("nsInstanceId"))
+        AAIResourceUri relatedServiceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer("globalSubscriberId1").serviceSubscription("serviceType").serviceInstance("serviceInstanceId"))
         Mockito.verify(client).connect(nsUri,relatedServiceUri)
     }
 
index 09b1770..c19cdfd 100644 (file)
@@ -38,6 +38,8 @@ import org.onap.aaiclient.client.aai.AAIObjectType
 import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
 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 static org.junit.Assert.assertEquals
 import static org.mockito.Mockito.*
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeAllocateSliceSubnetTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeAllocateSliceSubnetTest.groovy
new file mode 100644 (file)
index 0000000..a254a90
--- /dev/null
@@ -0,0 +1,72 @@
+package org.onap.so.bpmn.infrastructure.scripts
+
+import static org.junit.Assert.*
+
+import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity
+import org.junit.Before
+import org.junit.Test
+import org.mockito.ArgumentCaptor
+import org.mockito.Captor
+
+class DeAllocateSliceSubnetTest {
+       
+       @Before
+       void init() throws IOException {
+               super.init("DeAllocateSliceSubnet")
+       }
+
+       @Captor
+       static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class)
+
+       @Test
+       public void testPreProcessRequest() {
+               when(mockExecution.getVariable("bpmnRequest")).thenReturn("""
+        {
+                               "serviceInstanceID": "NSSI-C-001-HDBNJ-NSSMF-01-A-ZX ",
+                               "networkType": "an/cn/tn",
+                               "globalSubscriberId": "5GCustomer",
+                               "subscriptionServiceType": "5G",
+                               "additionalProperties": {
+                               "snssaiList": [
+                               "001-100001"
+                               ],
+                               "scriptName": "AN1",
+                               "nsiInfo": {
+                                       "nsiId": "NSI-M-001-HDBNJ-NSMF-01-A-ZX",
+                                       "nsiName": "eMBB-001"
+                               },
+                               }
+}
+""".replaceAll("\\s+", ""))
+               when(mockExecution.getVariable("mso-request-id")).thenReturn("edb08d97-e0f9-4c71-840a-72080d7be42e")
+               DeAllocateSliceSubnet sliceSubnet = new DeAllocateSliceSubnet()
+               sliceSubnet.preProcessRequest(mockExecution)
+               Mockito.verify(mockExecution, times(1)).setVariable(captor.capture() as String, captor.capture())
+               List<ExecutionEntity> values = captor.getAllValues()
+               assertNotNull(values)
+       }
+       
+       @Test
+       void testPrepareInitOperationStatus() {
+               when(mockExecution.getVariable("serviceInstanceId")).thenReturn("54321")
+               when(mockExecution.getVariable("jobId")).thenReturn("54321")
+               when(mockExecution.getVariable("nsiId")).thenReturn("11111")
+               DeAllocateSliceSubnet sliceSubnet = new DeAllocateSliceSubnet()
+               sliceSubnet.prepareInitOperationStatus(mockExecution)
+               Mockito.verify(mockExecution, times(1)).setVariable(eq("initResourceOperationStatus"), captor.capture())
+               String res = captor.getValue()
+               assertNotNull(res)
+       }
+
+
+       @Test
+       void testSendSyncResponse() {
+               when(mockExecution.getVariable("jobId")).thenReturn("123456")
+               DeAllocateSliceSubnet sliceSubnet = new DeAllocateSliceSubnet()
+               sliceSubnet.sendSyncResponse(mockExecution)
+               Mockito.verify(mockExecution, times(1)).setVariable(eq("sentSyncResponse"), captor.capture())
+               def updateVolumeGroupRequest = captor.getValue()
+               assertEquals(updateVolumeGroupRequest, true)
+       }
+
+}
index 39d0334..51d64af 100644 (file)
  */
 package org.onap.so.bpmn.infrastructure.scripts
 
+import static org.junit.Assert.assertEquals
+import static org.junit.Assert.assertNotNull
+import static org.mockito.Mockito.*
+import javax.ws.rs.NotFoundException
+import javax.ws.rs.core.Response
 import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity
 import org.junit.Before
 import org.junit.Test
 import org.mockito.ArgumentCaptor
 import org.mockito.Captor
 import org.mockito.Mockito
+import org.onap.aaiclient.client.aai.AAIObjectType
+import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
+import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri
+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.MsoGroovyTest
 import org.onap.so.bpmn.core.WorkflowException
 import org.onap.so.client.HttpClient
 import org.onap.so.client.HttpClientFactory
-import org.onap.aaiclient.client.aai.AAIObjectType
-import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
-import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
-import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
-
-import javax.ws.rs.NotFoundException
-import javax.ws.rs.core.Response
-
-import static org.junit.Assert.assertEquals
-import static org.junit.Assert.assertNotNull
-import static org.mockito.ArgumentMatchers.eq
-import static org.mockito.Mockito.*
 
 class DeleteCommunicationServiceTest extends MsoGroovyTest {
 
@@ -96,7 +96,7 @@ class DeleteCommunicationServiceTest extends MsoGroovyTest {
         when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer")
         when(mockExecution.getVariable("serviceType")).thenReturn("5G")
 
-        AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, "5GCustomer", "5G", "5ad89cf9-0569-4a93-9306-d8324321e2be")
+        AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer("5GCustomer").serviceSubscription("5G").serviceInstance("5ad89cf9-0569-4a93-9306-d8324321e2be"))
         DeleteCommunicationService obj = spy(DeleteCommunicationService.class)
 
         AAIResultWrapper wrapper = new AAIResultWrapper(mockQueryCommunicationServiceReturn())
@@ -126,8 +126,8 @@ class DeleteCommunicationServiceTest extends MsoGroovyTest {
         when(mockExecution.getVariable("serviceType")).thenReturn("5G")
 
         AAIResultWrapper wrapper = new AAIResultWrapper(mockQueryCommunicationServiceProfile())
-        AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.COMMUNICATION_PROFILE_ALL, "5GCustomer", "5G", "5ad89cf9-0569-4a93-9306-d8324321e2be")
-        AAIResourceUri profileUri = AAIUriFactory.createResourceUri(AAIObjectType.COMMUNICATION_SERVICE_PROFILE, "5GCustomer", "5G", "5ad89cf9-0569-4a93-9306-d8324321e2be", "5G-111111")
+        AAIPluralResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer("5GCustomer").serviceSubscription("5G").serviceInstance("5ad89cf9-0569-4a93-9306-d8324321e2be").communicationServiceProfiles())
+        AAIResourceUri profileUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer("5GCustomer").serviceSubscription("5G").serviceInstance("5ad89cf9-0569-4a93-9306-d8324321e2be").communicationServiceProfile("5G-111111"))
 
         DeleteCommunicationService obj = spy(DeleteCommunicationService.class)
         when(obj.getAAIClient()).thenReturn(client)
@@ -162,7 +162,7 @@ class DeleteCommunicationServiceTest extends MsoGroovyTest {
         when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer")
         when(mockExecution.getVariable("serviceType")).thenReturn("5G")
 
-        AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, "5GCustomer", "5G", "5ad89cf9-0569-4a93-9306-d8324321e2be")
+        AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer("5GCustomer").serviceSubscription("5G").serviceInstance("5ad89cf9-0569-4a93-9306-d8324321e2be"))
         DeleteCommunicationService obj = spy(DeleteCommunicationService.class)
         when(obj.getAAIClient()).thenReturn(client)
         doNothing().when(client).delete(serviceInstanceUri)
index 1a9c6bb..75b606c 100644 (file)
  */
 package org.onap.so.bpmn.infrastructure.scripts
 
+import static org.junit.Assert.assertNotNull
+import static org.mockito.ArgumentMatchers.eq
+import static org.mockito.Mockito.doNothing
+import static org.mockito.Mockito.spy
+import static org.mockito.Mockito.times
+import static org.mockito.Mockito.when
+import javax.ws.rs.NotFoundException
 import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity
 import org.junit.Before
 import org.junit.Test
 import org.mockito.ArgumentCaptor
 import org.mockito.Captor
 import org.mockito.Mockito
-import org.onap.so.bpmn.common.scripts.MsoGroovyTest
-import org.onap.so.bpmn.core.WorkflowException
-import org.onap.aaiclient.client.aai.AAIObjectType
 import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
+import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri
 import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
 import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
-
-import javax.ws.rs.NotFoundException
-
-import static org.junit.Assert.assertNotNull
-import static org.mockito.ArgumentMatchers.eq
-import static org.mockito.Mockito.doNothing
-import static org.mockito.Mockito.spy
-import static org.mockito.Mockito.times
-import static org.mockito.Mockito.when
-import static org.mockito.Mockito.when
-import static org.mockito.Mockito.when
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types
+import org.onap.so.bpmn.common.scripts.MsoGroovyTest
+import org.onap.so.bpmn.core.WorkflowException
 
 class DeleteSliceServiceTest extends MsoGroovyTest {
     @Before
@@ -86,7 +84,7 @@ class DeleteSliceServiceTest extends MsoGroovyTest {
         when(mockExecution.getVariable("progress")).thenReturn("100")
         when(mockExecution.getVariable("operationContent")).thenReturn("NSMF completes slicing service termination.")
 
-        AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, "5GCustomer", "5G", "5ad89cf9-0569-4a93-9306-d8324321e2be")
+        AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer("5GCustomer").serviceSubscription("5G").serviceInstance("5ad89cf9-0569-4a93-9306-d8324321e2be"))
         DeleteSliceService obj = spy(DeleteSliceService.class)
         when(obj.getAAIClient()).thenReturn(client)
         doNothing().when(client).delete(serviceInstanceUri)
@@ -104,8 +102,8 @@ class DeleteSliceServiceTest extends MsoGroovyTest {
         when(mockExecution.getVariable("serviceType")).thenReturn("5G")
 
         AAIResultWrapper wrapper = new AAIResultWrapper(mockQuerySliceServiceProfile())
-        AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_PROFILE_ALL, "5GCustomer", "5G", "5ad89cf9-0569-4a93-9306-d8324321e2be")
-        AAIResourceUri profileUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_PROFILE, "5GCustomer", "5G", "5ad89cf9-0569-4a93-9306-d8324321e2be", "5G-2222222")
+        AAIPluralResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer("5GCustomer").serviceSubscription("5G").serviceInstance("5ad89cf9-0569-4a93-9306-d8324321e2be").serviceProfiles())
+        AAIResourceUri profileUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer("5GCustomer").serviceSubscription("5G").serviceInstance("5ad89cf9-0569-4a93-9306-d8324321e2be").serviceProfile("5G-2222222"))
 
         DeleteSliceService obj = spy(DeleteSliceService.class)
         when(obj.getAAIClient()).thenReturn(client)
index 7137799..0f0946d 100644 (file)
@@ -39,6 +39,8 @@ import org.onap.aaiclient.client.aai.AAIObjectType
 import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
 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.aaiclient.client.graphinventory.exceptions.GraphInventoryUriComputationException
 
 import javax.ws.rs.NotFoundException
@@ -251,7 +253,7 @@ class DeleteVfModuleVolumeInfraV1Test extends MsoGroovyTest {
         volumeGroup.setVolumeGroupId("volumeGroupId1")
         when(mockExecution.getVariable("DELVfModVol_queryAAIVolGrpResponse")).thenReturn(volumeGroup)
         when(mockExecution.getVariable("DELVfModVol_aicCloudRegion")).thenReturn("region1")
-        AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP,CLOUD_OWNER, "region1","volumeGroupId1")
+        AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(CLOUD_OWNER, "region1").volumeGroup("volumeGroupId1"))
         doNothing().when(client).delete(resourceUri)
         deleteVfModuleVolumeInfraV1.deleteVolGrpId(mockExecution, true)
         verify(client).delete(resourceUri)
@@ -263,7 +265,7 @@ class DeleteVfModuleVolumeInfraV1Test extends MsoGroovyTest {
         volumeGroup.setVolumeGroupId("volumeGroupId1")
         when(mockExecution.getVariable("DELVfModVol_queryAAIVolGrpResponse")).thenReturn(volumeGroup)
         when(mockExecution.getVariable("DELVfModVol_aicCloudRegion")).thenReturn("region1")
-        AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP,CLOUD_OWNER, "region1","volumeGroupId1")
+        AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(CLOUD_OWNER, "region1").volumeGroup("volumeGroupId1"))
         doThrow(new NotFoundException("Not Found")).when(client).delete(resourceUri)
         try {
             deleteVfModuleVolumeInfraV1.deleteVolGrpId(mockExecution, true)
@@ -282,7 +284,7 @@ class DeleteVfModuleVolumeInfraV1Test extends MsoGroovyTest {
         volumeGroup.setVolumeGroupId("volumeGroupId1")
         when(mockExecution.getVariable("DELVfModVol_queryAAIVolGrpResponse")).thenReturn(volumeGroup)
         when(mockExecution.getVariable("DELVfModVol_aicCloudRegion")).thenReturn("region1")
-        AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP,CLOUD_OWNER, "region1","volumeGroupId1")
+        AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(CLOUD_OWNER, "region1").volumeGroup("volumeGroupId1"))
         doThrow(new GraphInventoryUriComputationException("Error")).when(client).delete(resourceUri)
         try {
             deleteVfModuleVolumeInfraV1.deleteVolGrpId(mockExecution, true)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateCoreNSSITest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateCoreNSSITest.groovy
new file mode 100644 (file)
index 0000000..6978093
--- /dev/null
@@ -0,0 +1,633 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020  Tech Mahindra
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.scripts
+
+import static org.junit.Assert.*
+
+import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity
+import org.junit.Before
+import org.junit.Test
+import org.mockito.ArgumentCaptor
+import org.mockito.Captor
+import org.onap.so.bpmn.common.scripts.MsoGroovyTest
+import org.slf4j.Logger
+import org.mockito.Mockito
+import org.onap.aaiclient.client.aai.AAIObjectType
+import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
+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 static org.mockito.Mockito.spy
+import static org.mockito.Mockito.times
+import static org.mockito.Mockito.verify
+import static org.mockito.Mockito.when
+import static org.mockito.ArgumentMatchers.eq
+
+import javax.ws.rs.NotFoundException
+
+class DoActivateCoreNSSITest extends MsoGroovyTest {
+
+    DoActivateCoreNSSI doActivate = new DoActivateCoreNSSI()
+    @Before
+    void init() throws IOException {
+        super.init("DoActivateCoreNSSI")
+    }
+
+    @Captor
+    static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class)
+
+    @Test
+    void testPreProcessRequest(){
+
+        setUpMockdataFromCommonActivateSliceSubnet()
+        doActivate.preProcessRequest(mockExecution)
+
+        Mockito.verify(mockExecution, times(1)).setVariable(eq("oStatus"), captor.capture())
+        def statusValue = captor.getValue()
+        assertEquals("deactivated", statusValue)
+
+        Mockito.verify(mockExecution, times(1)).setVariable(eq("sNssai"), captor.capture())
+        def sNssai = captor.getValue()
+        assertEquals("01-5B179BD4", sNssai)
+
+        Mockito.verify(mockExecution,times(3)).setVariable(captor.capture() as String, captor.capture())
+        List<ExecutionEntity> values = captor.getAllValues()
+        assertNotNull(values)
+    }
+
+    @Test
+    void testGetNetworkInstanceWithSPInstanceAssociatedWithNssiId(){
+
+        setUpMockdataFromCommonActivateSliceSubnet()
+        when(mockExecution.getVariable("serviceType")).thenReturn("5G")
+
+        DoActivateCoreNSSI obj = spy(DoActivateCoreNSSI.class)
+        when(obj.getAAIClient()).thenReturn(client)
+        AAIResourceUri resourceUri1 = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer("5GCustomer").serviceSubscription("5G").serviceInstance("NSSI-C-7Q4-HDBNJ-NSSMF-01-A-ZX"))
+        when(client.exists(resourceUri1)).thenReturn(true)
+        AAIResultWrapper wrapper1 = new AAIResultWrapper(mockQuerySliceServiceReturn())
+        when(client.get(resourceUri1, NotFoundException.class)).thenReturn(wrapper1)
+
+        //networkServiceInstanceId
+        when(mockExecution.getVariable("networkServiceInstanceId")).thenReturn("206535e7-77c9-4036-9387-3f1cf57b4379")
+
+        AAIResourceUri resourceUri2 = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer("5GCustomer").serviceSubscription("5G").serviceInstance("206535e7-77c9-4036-9387-3f1cf57b4379"))
+        when(client.exists(resourceUri2)).thenReturn(true)
+        AAIResultWrapper wrapper2 = new AAIResultWrapper(mockQueryNS())
+        when(client.get(resourceUri2, NotFoundException.class)).thenReturn(wrapper2)
+
+        //Check Vnf
+        when(mockExecution.getVariable("vnfId")).thenReturn("eeb66c6f-36bd-47ad-8294-48f46b1aa912")
+        AAIResourceUri resourceUri3 = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("eeb66c6f-36bd-47ad-8294-48f46b1aa912"))
+        when(client.exists(resourceUri3)).thenReturn(true)
+        AAIResultWrapper wrapper3 = new AAIResultWrapper(mockQueryVnf())
+        when(client.get(resourceUri3, NotFoundException.class)).thenReturn(wrapper3)
+
+
+        //Allotted Resources-1
+        //when(mockExecution.getVariable("vnfId")).thenReturn("eeb66c6f-36bd-47ad-8294-48f46b1aa912")
+        AAIResourceUri resourceUri4 = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer("5GCustomer").serviceSubscription("5G").serviceInstance("0d3d3cce-46a8-486d-816a-954e71697c4e"))
+        when(client.exists(resourceUri4)).thenReturn(true)
+        AAIResultWrapper wrapper4 = new AAIResultWrapper(mockServiceProfile1())
+        when(client.get(resourceUri4, NotFoundException.class)).thenReturn(wrapper4)
+
+        //Allotted Resources-2
+        //when(mockExecution.getVariable("vnfId")).thenReturn("eeb66c6f-36bd-47ad-8294-48f46b1aa912")
+        AAIResourceUri resourceUri5 = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer("5GCustomer").serviceSubscription("5G").serviceInstance("1c7046f2-a5a3-4d7f-9da8-388ee641a795"))
+        when(client.exists(resourceUri5)).thenReturn(true)
+        AAIResultWrapper wrapper5 = new AAIResultWrapper(mockServiceProfile2())
+        when(client.get(resourceUri5, NotFoundException.class)).thenReturn(wrapper5)
+
+        obj.getNetworkInstanceWithSPInstanceAssociatedWithNssiId(mockExecution)
+
+        Mockito.verify(mockExecution, times(1)).setVariable(eq("networkServiceInstanceId"), captor.capture())
+        assertEquals("206535e7-77c9-4036-9387-3f1cf57b4379", captor.getValue())
+
+        Mockito.verify(mockExecution, times(1)).setVariable(eq("networkServiceInstanceName"), captor.capture())
+        assertEquals("nsi_DemoEmbb", captor.getValue())
+
+        Mockito.verify(mockExecution, times(1)).setVariable(eq("networkServiceModelInvariantUuid"), captor.capture())
+        assertEquals("848c5656-5594-4d41-84bb-7afc7c64765c", captor.getValue())
+
+        Mockito.verify(mockExecution, times(1)).setVariable(eq("owningEntityId"), captor.capture())
+        assertEquals("OE-generic", captor.getValue())
+
+        //VnfId
+        Mockito.verify(mockExecution, times(1)).setVariable(eq("vnfId"), captor.capture())
+        assertEquals("eeb66c6f-36bd-47ad-8294-48f46b1aa912", captor.getValue())
+
+        Mockito.verify(mockExecution, times(1)).setVariable(eq("snssaiAndOrchStatusList"), captor.capture())
+        List<Map<String, Object>> snssaiList = new ArrayList<>()
+        Map<String, Object> snssaiMap = new LinkedHashMap<>()
+        snssaiMap.put("snssai", "01-5C83F071")
+        snssaiMap.put("status", "activated")
+        snssaiList.add(snssaiMap)
+        Map<String, Object> snssaiMap1 = new LinkedHashMap<>()
+        snssaiMap1.put("snssai", "01-5B179BD4")
+        snssaiMap1.put("status", "activated")
+        snssaiList.add(snssaiMap1)
+        assertEquals(snssaiList, captor.getValue())
+
+        //Verify Project
+        Mockito.verify(mockExecution, times(1)).setVariable(eq("projectName"), captor.capture())
+        assertEquals("Project-generic", captor.getValue())
+
+        Mockito.verify(mockExecution, times(1)).setVariable(eq("tenantId"), captor.capture())
+        assertEquals("3d5819f1542e4ef9a4ccb0bcb278ca10", captor.getValue())
+
+        Mockito.verify(mockExecution, times(1)).setVariable(eq("cloudOwner"), captor.capture())
+        assertEquals("k8scloudowner", captor.getValue())
+
+        Mockito.verify(mockExecution, times(1)).setVariable(eq("lcpCloudRegionId"), captor.capture())
+        assertEquals("k8sregion", captor.getValue())
+
+        Mockito.verify(mockExecution, times(1)).setVariable(eq("platformName"), captor.capture())
+        assertEquals("test", captor.getValue())
+
+        Mockito.verify(mockExecution, times(1)).setVariable(eq("lineOfBusinessName"), captor.capture())
+        assertEquals("LOB-Demonstration", captor.getValue())
+
+    }
+
+    @Test
+    void testPrepareVnfInstanceParamsJson() {
+        List<Map<String, Object>> snssaiList = new ArrayList<>()
+        Map<String, Object> snssaiMap = new LinkedHashMap<>()
+        snssaiMap.put("snssai", "01-5C83F071")
+        snssaiMap.put("status", "activated")
+        snssaiList.add(snssaiMap)
+        Map<String, Object> snssaiMap1 = new LinkedHashMap<>()
+        snssaiMap1.put("snssai", "01-5B179BD4")
+        snssaiMap1.put("status", "activated")
+        snssaiList.add(snssaiMap1)
+
+        when(mockExecution.getVariable("snssaiAndOrchStatusList")).thenReturn(snssaiList)
+
+        String returnedJsonAsString= doActivate.prepareVnfInstanceParamsJson(mockExecution)
+
+        String expectedJsonAsString = """{supportedNssai={"sNssai":[{"snssai":"01-5C83F071","status":"activated"},{"snssai":"01-5B179BD4","status":"activated"}]}}"""
+        assertEquals(expectedJsonAsString, returnedJsonAsString)
+    }
+
+
+    String mockQueryNS() {
+        return """
+   {
+ "service-instance-id": "206535e7-77c9-4036-9387-3f1cf57b4379",
+ "service-instance-name": "nsi_DemoEmbb",
+ "environment-context": "General_Revenue-Bearing",
+ "workload-context": "Production",
+ "model-invariant-id": "848c5656-5594-4d41-84bb-7afc7c64765c",
+ "model-version-id": "2de92587-3395-44e8-bb2c-b9529747e580",
+ "resource-version": "1599228110527",
+ "selflink": "restconf/config/GENERIC-RESOURCE-API:services/service/206535e7-77c9-4036-9387-3f1cf57b4379/service-data/service-topology/",
+ "orchestration-status": "Assigned",
+ "relationship-list": {
+  "relationship": [{
+   "related-to": "owning-entity",
+   "relationship-label": "org.onap.relationships.inventory.BelongsTo",
+   "related-link": "/aai/v19/business/owning-entities/owning-entity/OE-generic",
+   "relationship-data": [{
+    "relationship-key": "owning-entity.owning-entity-id",
+    "relationship-value": "OE-generic"
+   }]
+  }, {
+   "related-to": "generic-vnf",
+   "relationship-label": "org.onap.relationships.inventory.ComposedOf",
+   "related-link": "/aai/v19/network/generic-vnfs/generic-vnf/eeb66c6f-36bd-47ad-8294-48f46b1aa912",
+   "relationship-data": [{
+    "relationship-key": "generic-vnf.vnf-id",
+    "relationship-value": "eeb66c6f-36bd-47ad-8294-48f46b1aa912"
+   }],
+   "related-to-property": [{
+    "property-key": "generic-vnf.vnf-name",
+    "property-value": "vfwuctest 0"
+   }]
+  }, {
+   "related-to": "project",
+   "relationship-label": "org.onap.relationships.inventory.Uses",
+   "related-link": "/aai/v19/business/projects/project/Project-generic",
+   "relationship-data": [{
+    "relationship-key": "project.project-name",
+    "relationship-value": "Project-generic"
+   }]
+  }]
+ }
+}
+  """
+    }
+
+    String mockQueryVnf() {
+
+        return """
+  {
+  "vnf-id": "eeb66c6f-36bd-47ad-8294-48f46b1aa912",
+  "vnf-name": "vfwuctest 0",
+  "vnf-type": "vfwuctest/null",
+  "service-id": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
+  "prov-status": "PREPROV",
+  "orchestration-status": "ConfigAssigned",
+  "in-maint": false,
+  "is-closed-loop-disabled": false,
+  "resource-version": "1599228155361",
+  "model-invariant-id": "1086e068-c932-4b61-ae3b-2d2eb0cbe3ec",
+  "model-version-id": "7fbb28cf-7dfc-447a-892c-4a3130b371d2",
+  "model-customization-id": "471b3188-e8f2-470b-9f4d-89e74d45445f",
+  "relationship-list": {
+    "relationship": [{
+      "related-to": "tenant",
+      "relationship-label": "org.onap.relationships.inventory.BelongsTo",
+      "related-link": "/aai/v19/cloud-infrastructure/cloud-regions/cloud-region/k8scloudowner/k8sregion/tenants/tenant/3d5819f1542e4ef9a4ccb0bcb278ca10",
+      "relationship-data": [{
+        "relationship-key": "cloud-region.cloud-owner",
+        "relationship-value": "k8scloudowner"
+      }, {
+        "relationship-key": "cloud-region.cloud-region-id",
+        "relationship-value": "k8sregion"
+      }, {
+        "relationship-key": "tenant.tenant-id",
+        "relationship-value": "3d5819f1542e4ef9a4ccb0bcb278ca10"
+      }],
+      "related-to-property": [{
+        "property-key": "tenant.tenant-name",
+        "property-value": "onap-tm5g-dev"
+      }]
+    }, {
+      "related-to": "cloud-region",
+      "relationship-label": "org.onap.relationships.inventory.LocatedIn",
+      "related-link": "/aai/v19/cloud-infrastructure/cloud-regions/cloud-region/k8scloudowner/k8sregion",
+      "relationship-data": [{
+        "relationship-key": "cloud-region.cloud-owner",
+        "relationship-value": "k8scloudowner"
+      }, {
+        "relationship-key": "cloud-region.cloud-region-id",
+        "relationship-value": "k8sregion"
+      }],
+      "related-to-property": [{
+        "property-key": "cloud-region.owner-defined-type",
+        "property-value": "OwnerType"
+      }]
+    }, {
+      "related-to": "service-instance",
+      "relationship-label": "org.onap.relationships.inventory.ComposedOf",
+      "related-link": "/aai/v19/business/customers/customer/Demonstration/service-subscriptions/service-subscription/vfw-k8s/service-instances/service-instance/206535e7-77c9-4036-9387-3f1cf57b4379",
+      "relationship-data": [{
+        "relationship-key": "customer.global-customer-id",
+        "relationship-value": "Demonstration"
+      }, {
+        "relationship-key": "service-subscription.service-type",
+        "relationship-value": "vfw-k8s"
+      }, {
+        "relationship-key": "service-instance.service-instance-id",
+        "relationship-value": "206535e7-77c9-4036-9387-3f1cf57b4379"
+      }],
+      "related-to-property": [{
+        "property-key": "service-instance.service-instance-name",
+        "property-value": "vfw-0201"
+      }]
+    }, {
+      "related-to": "platform",
+      "relationship-label": "org.onap.relationships.inventory.Uses",
+      "related-link": "/aai/v19/business/platforms/platform/test",
+      "relationship-data": [{
+        "relationship-key": "platform.platform-name",
+        "relationship-value": "test"
+      }]
+    }, {
+      "related-to": "line-of-business",
+      "relationship-label": "org.onap.relationships.inventory.Uses",
+      "related-link": "/aai/v19/business/lines-of-business/line-of-business/LOB-Demonstration",
+      "relationship-data": [{
+        "relationship-key": "line-of-business.line-of-business-name",
+        "relationship-value": "LOB-Demonstration"
+      }]
+    }]
+  }
+}
+  """
+    }
+
+    String mockServiceProfile1() {
+        return """
+   {
+  "service-instance-id": "0d3d3cce-46a8-486d-816a-954e71697c4e",
+  "service-instance-name": "DemoEmbb2",
+  "service-role": "e2esliceprofile-service",
+  "environment-context": "01-5C83F071",
+  "model-invariant-id": "040b1b40-3120-446b-b8e3-4f21d153d11e",
+  "model-version-id": "8b7dabb3-3f27-4555-a9fe-803e862b0292",
+  "service-instance-location-id": "39-00",
+  "resource-version": "1593511782269",
+  "orchestration-status": "activated",
+  "relationship-list": {
+    "relationship": [{
+      "related-to": "service-instance",
+      "relationship-label": "org.onap.relationships.inventory.ComposedOf",
+      "related-link": "/aai/v19/business/customers/customer/5GCustomer/service-subscriptions/service-subscription/5G/service-instances/service-instance/4b2bdbc0-cf7e-4c50-882a-f660e3ab8520",
+      "relationship-data": [{
+        "relationship-key": "customer.global-customer-id",
+        "relationship-value": "5GCustomer"
+      }, {
+        "relationship-key": "service-subscription.service-type",
+        "relationship-value": "5G"
+      }, {
+        "relationship-key": "service-instance.service-instance-id",
+        "relationship-value": "4b2bdbc0-cf7e-4c50-882a-f660e3ab8520"
+      }],
+      "related-to-property": [{
+        "property-key": "service-instance.service-instance-name",
+        "property-value": "DemoEmbb"
+      }]
+    }]
+  },
+  "allotted-resources": {
+    "allotted-resource": [{
+      "id": "362e46c2-cd84-45e4-a6c1-77f4ef88328d",
+      "model-invariant-id": "e5941a50-ddb4-4f74-be03-25449ae02ddc",
+      "model-version-id": "ab171d60-c2cc-4903-ac1d-c451b647e461",
+      "resource-version": "1593511173712",
+      "type": "Allotted Resource",
+      "allotted-resource-name": "Allotted_DemoEmbb",
+      "relationship-list": {
+        "relationship": [{
+          "related-to": "service-instance",
+          "relationship-label": "org.onap.relationships.inventory.Uses",
+          "related-link": "/aai/v19/business/customers/customer/5GCustomer/service-subscriptions/service-subscription/5G/service-instances/service-instance/ea107578-9854-4718-8145-7c7febf0de6c",
+          "relationship-data": [{
+            "relationship-key": "customer.global-customer-id",
+            "relationship-value": "5GCustomer"
+          }, {
+            "relationship-key": "service-subscription.service-type",
+            "relationship-value": "5G"
+          }, {
+            "relationship-key": "service-instance.service-instance-id",
+            "relationship-value": "ea107578-9854-4718-8145-7c7febf0de6c"
+          }],
+          "related-to-property": [{
+            "property-key": "service-instance.service-instance-name",
+            "property-value": "nsi_DemoEmbb"
+          }]
+        }]
+      }
+    }]
+  },
+  "slice-profiles": {
+    "slice-profile": [{
+    "profile-id": "31a83df8-5bd0-4df7-a50f-7900476b81a2",
+    "latency": 3,
+    "max-number-of-UEs": 0,
+    "coverage-area-TA-list": "Beijing;Beijing;HaidianDistrict;WanshouluStreet",
+    "ue-mobility-level": "stationary",
+    "resource-sharing-level": "0",
+    "exp-data-rate-UL": 500,
+    "exp-data-rate-DL": 2000,
+    "activity-factor": 0,
+    "e2e-latency": 0,
+    "jitter": 0,
+    "survival-time": 0,
+    "exp-data-rate": 0,
+    "payload-size": 0,
+    "traffic-density": 0,
+    "conn-density": 0,
+    "s-nssai": "01-5C83F071",
+    "resource-version": "1593525640617"
+  }]
+  }
+}
+
+  """
+    }
+
+    String mockServiceProfile2() {
+        return """
+   {
+  "service-instance-id": "1c7046f2-a5a3-4d7f-9da8-388ee641a795",
+  "service-instance-name": "DemoEmbb",
+  "service-role": "e2esliceprofile-service",
+  "environment-context": "01-5B179BD4",
+  "model-invariant-id": "040b1b40-3120-446b-b8e3-4f21d153d12e",
+  "model-version-id": "8b7dabb3-3f27-4555-a9fe-803e862b0282",
+  "service-instance-location-id": "39-00",
+  "resource-version": "1593511782169",
+  "orchestration-status": "activated",
+  "relationship-list": {
+    "relationship": [{
+      "related-to": "service-instance",
+      "relationship-label": "org.onap.relationships.inventory.ComposedOf",
+      "related-link": "/aai/v19/business/customers/customer/5GCustomer/service-subscriptions/service-subscription/5G/service-instances/service-instance/4b2bdbc0-cf7e-4c50-882a-f660e3ab8520",
+      "relationship-data": [{
+        "relationship-key": "customer.global-customer-id",
+        "relationship-value": "5GCustomer"
+      }, {
+        "relationship-key": "service-subscription.service-type",
+        "relationship-value": "5G"
+      }, {
+        "relationship-key": "service-instance.service-instance-id",
+        "relationship-value": "4b2bdbc0-cf7e-4c50-882a-f660e3ab8520"
+      }],
+      "related-to-property": [{
+        "property-key": "service-instance.service-instance-name",
+        "property-value": "DemoEmbb"
+      }]
+    }]
+  },
+  "allotted-resources": {
+    "allotted-resource": [{
+      "id": "362e46c2-cd84-45e4-a6c1-77f4ef88328d",
+      "model-invariant-id": "e5941a50-ddb4-4f74-be03-25449ae02ddc",
+      "model-version-id": "ab171d60-c2cc-4903-ac1d-c451b647e461",
+      "resource-version": "1593511173712",
+      "type": "Allotted Resource",
+      "allotted-resource-name": "Allotted_DemoEmbb",
+      "relationship-list": {
+        "relationship": [{
+          "related-to": "service-instance",
+          "relationship-label": "org.onap.relationships.inventory.Uses",
+          "related-link": "/aai/v19/business/customers/customer/5GCustomer/service-subscriptions/service-subscription/5G/service-instances/service-instance/ea107578-9854-4718-8145-7c7febf0de6c",
+          "relationship-data": [{
+            "relationship-key": "customer.global-customer-id",
+            "relationship-value": "5GCustomer"
+          }, {
+            "relationship-key": "service-subscription.service-type",
+            "relationship-value": "5G"
+          }, {
+            "relationship-key": "service-instance.service-instance-id",
+            "relationship-value": "ea107578-9854-4718-8145-7c7febf0de6c"
+          }],
+          "related-to-property": [{
+            "property-key": "service-instance.service-instance-name",
+            "property-value": "nsi_DemoEmbb"
+          }]
+        }]
+      }
+    }]
+  },
+  "slice-profiles": {
+    "slice-profile": [{
+    "profile-id": "b86df550-9d70-452b-a5a9-eb8823417255",
+    "latency": 6,
+    "max-number-of-UEs": 0,
+    "coverage-area-TA-list": "Beijing;Beijing;HaidianDistrict;WanshouluStreet",
+    "ue-mobility-level": "stationary",
+    "resource-sharing-level": "0",
+    "exp-data-rate-UL": 500,
+    "exp-data-rate-DL": 1000,
+    "activity-factor": 0,
+    "e2e-latency": 0,
+    "jitter": 0,
+    "survival-time": 0,
+    "exp-data-rate": 0,
+    "payload-size": 0,
+    "traffic-density": 0,
+    "conn-density": 0,
+    "s-nssai": "01-5B179BD4",
+    "resource-version": "1593511356725"
+  }]
+  }
+}
+  """
+    }
+
+    String mockQuerySliceServiceReturn(){
+        String expect =
+                """{
+  "service-instance-id": "NSSI-C-7Q4-HDBNJ-NSSMF-01-A-ZX",
+  "service-instance-name": "nssi_DemoEmbb",
+  "service-role": "nssi",
+  "environment-context": "cn",
+  "model-invariant-id": "da575e8e-0863-4172-88b3-b3a9ead67895",
+  "model-version-id": "e398c92f-27da-44b9-a717-1dbfc1bdd82e",
+  "service-instance-location-id": "39-00",
+  "resource-version": "1593525640482",
+  "orchestration-status": "activated",
+  "relationship-list": {
+    "relationship": [{
+      "related-to": "service-instance",
+      "relationship-label": "org.onap.relationships.inventory.ComposedOf",
+      "related-link": "/aai/v19/business/customers/customer/5GCustomer/service-subscriptions/service-subscription/5G/service-instances/service-instance/206535e7-77c9-4036-9387-3f1cf57b4379",
+      "relationship-data": [{
+        "relationship-key": "customer.global-customer-id",
+        "relationship-value": "5GCustomer"
+      }, {
+        "relationship-key": "service-subscription.service-type",
+        "relationship-value": "5G"
+      }, {
+        "relationship-key": "service-instance.service-instance-id",
+        "relationship-value": "206535e7-77c9-4036-9387-3f1cf57b4379"
+      }],
+      "related-to-property": [{
+        "property-key": "service-instance.service-instance-name",
+        "property-value": "nsi_DemoEmbb"
+      }]
+    },
+ {
+      "related-to": "allotted-resource",
+      "relationship-label": "org.onap.relationships.inventory.Uses",
+      "related-link": "/aai/v19/business/customers/customer/5GCustomer/service-subscriptions/service-subscription/5G/service-instances/service-instance/0d3d3cce-46a8-486d-816a-954e71697c4e/allotted-resources/allotted-resource/d63c241a-4c0b-4294-b4c3-5a57421a1769",
+      "relationship-data": [{
+        "relationship-key": "customer.global-customer-id",
+        "relationship-value": "5GCustomer"
+      }, {
+        "relationship-key": "service-subscription.service-type",
+        "relationship-value": "5G"
+      }, {
+        "relationship-key": "service-instance.service-instance-id",
+        "relationship-value": "0d3d3cce-46a8-486d-816a-954e71697c4e"
+      }, {
+        "relationship-key": "allotted-resource.id",
+        "relationship-value": "d63c241a-4c0b-4294-b4c3-5a57421a1769"
+      }],
+      "related-to-property": [{
+        "property-key": "allotted-resource.description"
+      }, {
+        "property-key": "allotted-resource.allotted-resource-name",
+        "property-value": "Allotted_DemoEmbb_shared"
+      }]
+    }, {
+      "related-to": "allotted-resource",
+      "relationship-label": "org.onap.relationships.inventory.Uses",
+      "related-link": "/aai/v19/business/customers/customer/5GCustomer/service-subscriptions/service-subscription/5G/service-instances/service-instance/1c7046f2-a5a3-4d7f-9da8-388ee641a795/allotted-resources/allotted-resource/362e46c2-cd84-45e4-a6c1-77f4ef88328d",
+      "relationship-data": [{
+        "relationship-key": "customer.global-customer-id",
+        "relationship-value": "5GCustomer"
+      }, {
+        "relationship-key": "service-subscription.service-type",
+        "relationship-value": "5G"
+      }, {
+        "relationship-key": "service-instance.service-instance-id",
+        "relationship-value": "1c7046f2-a5a3-4d7f-9da8-388ee641a795"
+      }, {
+        "relationship-key": "allotted-resource.id",
+        "relationship-value": "362e46c2-cd84-45e4-a6c1-77f4ef88328d"
+      }],
+      "related-to-property": [{
+        "property-key": "allotted-resource.description"
+      }, {
+        "property-key": "allotted-resource.allotted-resource-name",
+        "property-value": "Allotted_DemoEmbb"
+      }]
+    }
+ ]
+  }
+}
+                """
+        return expect
+    }
+
+    void setUpMockdataFromCommonActivateSliceSubnet() {
+
+        String bpmnRequest = """
+      {
+       "serviceInstanceID": "NSSI-C-7Q4-HDBNJ-NSSMF-01-A-ZX",
+       "networkType": "an/cn/tn",
+       "globalSubscriberId": "5GCustomer",
+       "subscriptionServiceType": "5G",
+       "additionalProperties": {
+        "nsiId": "NSI-M-001-HDBNJ-NSMF-01-A-ZX",
+        "snssaiList": [
+         "01-5B179BD4"
+        ],
+        "sliceProfileId": "ab9af40f13f721b5f13539d87484098"
+       }
+      }
+    """
+
+        String sliceParams ="""{
+     "nsiId": "NSI-M-001-HDBNJ-NSMF-01-A-ZX",
+     "snssaiList": [
+         "01-5B179BD4"
+        ],
+     "sliceProfileId": "ab9af40f13f721b5f13539d87484098"
+    }"""
+
+        when(mockExecution.getVariable("msoRequestId")).thenReturn("5ad89cf9-0569-4a93-4509-d8324321e2be")
+        when(mockExecution.getVariable("serviceInstanceID")).thenReturn("NSSI-C-7Q4-HDBNJ-NSSMF-01-A-ZX")
+        when(mockExecution.getVariable("nsiId")).thenReturn("NSI-M-001-HDBNJ-NSMF-01-A-ZX")
+        when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer")
+        when(mockExecution.getVariable("subscriptionServiceType")).thenReturn("5G")
+        when(mockExecution.getVariable("operationType")).thenReturn("deactivateInstance")
+        when(mockExecution.getVariable("jobId")).thenReturn("5ad89cf9-0569-4a93-9999-d8324321e2be")
+        when(mockExecution.getVariable("bpmnRequest")).thenReturn(bpmnRequest)
+        when(mockExecution.getVariable("sliceParams")).thenReturn(sliceParams)
+    }
+}
\ No newline at end of file
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateTnNssiTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateTnNssiTest.groovy
new file mode 100644 (file)
index 0000000..93557a4
--- /dev/null
@@ -0,0 +1,178 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ #
+ # Licensed under the Apache License, Version 2.0 (the "License")
+ # you may not use this file except in compliance with the License.
+ # You may obtain a copy of the License at
+ #
+ #       http://www.apache.org/licenses/LICENSE-2.0
+ #
+ # Unless required by applicable law or agreed to in writing, software
+ # distributed under the License is distributed on an "AS IS" BASIS,
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ # See the License for the specific language governing permissions and
+ # limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.bpmn.infrastructure.scripts
+
+import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity
+import org.junit.Before
+import org.junit.Test
+import org.mockito.ArgumentCaptor
+import org.mockito.Captor
+import org.mockito.Mockito
+import org.onap.so.bpmn.common.scripts.MsoGroovyTest
+
+import static org.junit.Assert.assertNotNull
+import static org.mockito.ArgumentMatchers.eq
+import static org.mockito.Mockito.*
+
+class DoActivateTnNssiTest extends MsoGroovyTest {
+    @Before
+    void init() throws IOException {
+        super.init("DoActivateTnNssiTest")
+    }
+
+    @Captor
+    static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class)
+
+    @Test
+    void testPreProcessRequest() {
+        when(mockExecution.getVariable("msoRequestId")).thenReturn("4c614769-f58a-4556-8ad9-dcd903077c82")
+        when(mockExecution.getVariable("mso.workflow.sdncadapter.callback")).thenReturn("http://localhost:8090/SDNCAdapterCallback")
+        when(mockExecution.getVariable("modelInvariantUuid")).thenReturn("f85cbcc0-ad74-45d7-a5a1-17c8744fdb71")
+        when(mockExecution.getVariable("modelUuid")).thenReturn("36a3a8ea-49a6-4ac8-b06c-89a54544b9b6")
+        when(mockExecution.getVariable("serviceInstanceID")).thenReturn("eb0863e9-a69b-4b17-8a56-f05ad110bef7")
+        when(mockExecution.getVariable("operationId")).thenReturn("998c2081-5a71-4a39-9ae6-d6b7c5bb50c0")
+        when(mockExecution.getVariable("operationType")).thenReturn("opTypeTest")
+        when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer")
+        when(mockExecution.getVariable("servicename")).thenReturn("5G-test")
+        when(mockExecution.getVariable("networkType")).thenReturn("5G-network")
+        when(mockExecution.getVariable("subscriptionServiceType")).thenReturn("5G-service")
+        when(mockExecution.getVariable("nsiId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56")
+        when(mockExecution.getVariable("jobId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4")
+        when(mockExecution.getVariable("operationType")).thenReturn("activateInstance")
+        when(mockExecution.getVariable("sliceParams")).thenReturn(mockSliceParams())
+
+        DoActivateTnNssi obj = new DoActivateTnNssi()
+        obj.preProcessRequest(mockExecution)
+        Mockito.verify(mockExecution, times(1)).setVariable(eq("sliceServiceInstanceId"), captor.capture())
+        String sliceServiceInstanceId = captor.getValue()
+        assertNotNull(sliceServiceInstanceId)
+    }
+
+    @Test
+    void testPreprocessSdncRequest() {
+        when(mockExecution.getVariable("msoRequestId")).thenReturn("4c614769-f58a-4556-8ad9-dcd903077c82")
+        when(mockExecution.getVariable("mso.workflow.sdncadapter.callback")).thenReturn("http://localhost:8090/SDNCAdapterCallback")
+        when(mockExecution.getVariable("sliceServiceInstanceId")).thenReturn("5ad89cf9-0569-4a93-9306-d8324321e2be")
+        when(mockExecution.getVariable("sliceServiceInstanceName")).thenReturn("5G-service")
+        when(mockExecution.getVariable("actionType")).thenReturn("activate")
+        when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer")
+        when(mockExecution.getVariable("subscriptionServiceType")).thenReturn("5G")
+        when(mockExecution.getVariable("modelInvariantUuid")).thenReturn("f85cbcc0-ad74-45d7-a5a1-17c8744fdb71")
+        when(mockExecution.getVariable("modelUuid")).thenReturn("36a3a8ea-49a6-4ac8-b06c-89a54544b9b6")
+        when(mockExecution.getVariable("sliceParams")).thenReturn(mockSliceParams())
+        when(mockExecution.getVariable("serviceModelInfo")).thenReturn(mockServiceModelInfo())
+//        JsonUtils jsonUtil = new JsonUtils()
+//        String sliceProfile = jsonUtil.getJsonValue(mockSliceParams(), "sliceProfile")
+//        when(mockExecution.getVariable("sliceProfile")).thenReturn(sliceProfile)
+
+        DoActivateTnNssi obj = spy(DoActivateTnNssi.class)
+
+        obj.preprocessSdncActOrDeactTnNssiRequest(mockExecution)
+        Mockito.verify(mockExecution, times(1)).setVariable(eq("TNNSSMF_SDNCRequest"), captor.capture())
+        String request = captor.getValue()
+        assertNotNull(request)
+    }
+
+
+    private String mockSliceParams() {
+        String expect = """{
+    "sliceProfile": {
+      "snssaiList": [
+        "001-100001"
+      ],
+      "sliceProfileId": "ab9af40f13f721b5f13539d87484098",
+      "plmnIdList": [
+        "460-00",
+        "460-01"
+      ],
+      "perfReq": {
+      },
+      "coverageAreaTAList": [
+      ],
+      "latency": 2,
+      "maxBandwidth": 100,
+      "resourceSharingLevel": "non-shared"
+    },
+    "transportSliceNetworks": [
+            {
+                "connectionLinks": [
+                    {
+                        "transportEndpointA": "tranportEp_ID_XXX",
+                        "transportEndpointB": "tranportEp_ID_YYY"
+                    },
+                    {
+                        "transportEndpointA": "tranportEp_ID_AAA",
+                        "transportEndpointB": "tranportEp_ID_BBB"
+                    }
+                ]
+            },
+            {
+                "connectionLinks": [
+                    {
+                        "transportEndpointA": "tranportEp_ID_CCC",
+                        "transportEndpointB": "tranportEp_ID_DDD"
+                    },
+                    {
+                        "transportEndpointA": "tranportEp_ID_EEE",
+                        "transportEndpointB": "tranportEp_ID_FFF"
+                    }
+                ]
+            }
+    ],
+    "nsiInfo": {
+      "nsiId": "NSI-M-001-HDBNJ-NSMF-01-A-ZX",
+      "nsiName": "eMBB-001"
+    },
+    "scriptName": "AN1"
+        }"""
+        return expect.replaceAll("\\\\s+", "")
+    }
+
+    private String mockSliceProfile() {
+        String expect = """{
+      "snssaiList": [
+        "001-100001"
+      ],
+      "sliceProfileId": "ab9af40f13f721b5f13539d87484098",
+      "plmnIdList": [
+        "460-00",
+        "460-01"
+      ],
+      "perfReq": {
+      },
+      "coverageAreaTAList": [
+      ],
+      "latency": 2,
+      "maxBandwidth": 100,
+      "resourceSharingLevel": "non-shared"
+     }"""
+        return expect.replaceAll("\\\\s+", "")
+    }
+
+    private String mockServiceModelInfo() {
+        String expect = """{
+            "modelInvariantUuid":"f85cbcc0-ad74-45d7-a5a1-17c8744fdb71",
+            "modelUuid":"36a3a8ea-49a6-4ac8-b06c-89a54544b9b6",
+            "modelVersion":""
+            }"""
+        return expect.replaceAll("\\\\s+", "")
+    }
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNSSITest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNSSITest.groovy
new file mode 100644 (file)
index 0000000..dc7a429
--- /dev/null
@@ -0,0 +1,103 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020  Tech Mahindra
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.scripts
+
+import static org.junit.Assert.*
+
+import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity
+import org.junit.Before
+import org.junit.Test
+import org.mockito.ArgumentCaptor
+import org.mockito.Captor
+import org.mockito.Mockito
+import org.onap.so.bpmn.common.scripts.MsoGroovyTest
+
+import static org.mockito.Mockito.when
+import static org.mockito.Mockito.times
+import static org.mockito.ArgumentMatchers.eq
+
+class DoAllocateCoreNSSITest extends MsoGroovyTest {
+
+    @Before
+    void init() throws IOException {
+        super.init("DoAllocateCoreNSSI")
+    }
+
+    @Captor
+    static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class)
+
+    @Test
+    public void testPreProcessRequest() {
+
+        String sliceParams="""{
+    "sliceProfile": {
+        "snssaiList": [
+            "001-100001"
+        ],
+        "sliceProfileId": "ab9af40f13f721b5f13539d87484098",
+        "plmnIdList": [
+            "460-00",
+            "460-01"
+        ],
+        "perfReq": {
+            "perfReqEmbbList ": [{
+                "activityFactor": 50
+            }]
+        },
+        "maxNumberofUEs": 200,
+        "coverageAreaTAList": [
+            "1",
+            "2",
+            "3",
+            "4"
+        ],
+        "latency": 2,
+        "resourceSharingLevel": "non-shared"
+    },
+    "endPoints": [{
+            "nodeId": "",
+            "additionalInfo": {
+                "xxx": "xxx"
+            }
+        },
+        {
+            "nodeId": "",
+            "additionalInfo": {
+                "xxx": "xxx"
+            }
+        }
+    ],
+    "nsiInfo": {
+        "nsiId": "NSI-M-001-HDBNJ-NSMF-01-A-ZX",
+        "nsiName": "eMBB-001"
+    },
+    "scriptName": "AN1"
+}"""
+        String expected = """{"plmnIdList":["460-00","460-01"],"sliceProfileId":"ab9af40f13f721b5f13539d87484098","maxNumberofUEs":200,"latency":2,"snssaiList":["001-100001"],"perfReq":{"perfReqEmbbList ":[{"activityFactor":50}]},"coverageAreaTAList":["1","2","3","4"],"resourceSharingLevel":"non-shared"}"""
+        when(mockExecution.getVariable("sliceParams")).thenReturn(sliceParams)
+        DoAllocateCoreNSSI allocateNssi = new DoAllocateCoreNSSI()
+        allocateNssi.preProcessRequest(mockExecution)
+        Mockito.verify(mockExecution, times(1)).setVariable(eq("sliceProfile"), captor.capture())
+        def sliceProfile = captor.getValue()
+        assertEquals(expected, sliceProfile)
+        Mockito.verify(mockExecution, times(3)).setVariable(captor.capture() as String, captor.capture())
+    }
+}
\ No newline at end of file
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNonSharedSliceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNonSharedSliceTest.groovy
new file mode 100644 (file)
index 0000000..1eddf66
--- /dev/null
@@ -0,0 +1,118 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020  Tech Mahindra
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.scripts
+
+import static org.junit.Assert.*
+
+import org.junit.Before
+import org.junit.Test
+import org.mockito.ArgumentCaptor
+import org.mockito.Captor
+import org.mockito.Mockito
+import com.fasterxml.jackson.databind.ObjectMapper
+
+import static org.mockito.Mockito.when
+import static org.mockito.Mockito.times
+import static org.mockito.Mockito.eq
+
+import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity
+import org.onap.so.bpmn.common.scripts.MsoGroovyTest
+
+class DoAllocateCoreNonSharedSliceTest extends MsoGroovyTest {
+
+    @Before
+    void init() throws IOException {
+        super.init("DoAllocateCoreNonSharedSlice")
+    }
+
+    @Captor
+    static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class)
+
+    @Test
+    public void testPreProcessRequest() {
+
+        String networkServiceModelInfo=""" {
+                                "modelName"              : "5GC-eMBB Service Proxy",
+                                "modelUuid"              : "b666119e-4400-47c6-a0c1-bbe050a33b47",
+                                "modelInvariantUuid"     : "a26327e1-4a9b-4883-b7a5-5f37dcb7405a",
+                                "modelVersion"           : "1.0",
+                                "modelCustomizationUuid" : "cbc12c2a-67e6-4336-9236-eaf51eacdc75",
+                                "modelInstanceName"      : "5gcembb_proxy 0"
+        }"""
+
+        when(mockExecution.getVariable("serviceInstanceId")).thenReturn("123456")
+        when(mockExecution.getVariable("networkServiceModelInfo")).thenReturn(networkServiceModelInfo)
+
+        DoAllocateCoreNonSharedSlice allocateNssi = new DoAllocateCoreNonSharedSlice()
+        allocateNssi.preProcessRequest(mockExecution)
+
+        Mockito.verify(mockExecution, times(1)).setVariable(eq("networkServiceModelUuid"), captor.capture())
+        captor.getValue()
+        assertEquals("b666119e-4400-47c6-a0c1-bbe050a33b47", captor.getValue())
+
+        Mockito.verify(mockExecution, times(1)).setVariable(eq("networkServiceName"), captor.capture())
+        assertEquals("5GC-eMBB", captor.getValue())
+
+        Mockito.verify(mockExecution, times(1)).setVariable(eq("orchestrationStatus"), captor.capture())
+        assertEquals("created", captor.getValue())
+        Mockito.verify(mockExecution, times(4)).setVariable(captor.capture() as String, captor.capture())
+    }
+
+    @Test
+    void testPrepareServiceOrderRequest() {
+
+        String sliceProfile = "{\r\n      \"snssaiList\": [ \r\n        \"001-100001\"\r\n      ],\r\n      \"sliceProfileId\": \"ab9af40f13f721b5f13539d87484098\",\r\n      \"plmnIdList\": [\r\n        \"460-00\",\r\n        \"460-01\"\r\n      ],\r\n      \"perfReq\": {\r\n        \"perfReqEmbbList \": [\r\n          {\r\n            \"activityFactor\": 50\r\n          }\r\n        ]\r\n      },\r\n      \"maxNumberofUEs\": 200, \r\n      \"coverageAreaTAList\": [ \r\n        \"1\",\r\n        \"2\",\r\n        \"3\",\r\n        \"4\"\r\n      ],\r\n      \"latency\": 2,\r\n      \"resourceSharingLevel\": \"non-shared\" \r\n    }"
+        when(mockExecution.getVariable("sliceProfile")).thenReturn(sliceProfile)
+        when(mockExecution.getVariable("serviceType")).thenReturn("5g")
+        when(mockExecution.getVariable("networkServiceName")).thenReturn("5g_embb")
+        when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer")
+        when(mockExecution.getVariable("networkServiceModelUuid")).thenReturn("12345")
+
+        DoAllocateCoreNonSharedSlice allocateNssi = new DoAllocateCoreNonSharedSlice()
+        allocateNssi.prepareServiceOrderRequest(mockExecution)
+
+        Mockito.verify(mockExecution, times(1)).setVariable(eq("serviceOrderRequest"), captor.capture())
+        String value = captor.getValue()
+        assertNotNull(value)
+    }
+
+    @Test
+    void testRetrieveServiceCharacteristicsAsKeyValue() {
+
+        String sliceProfile = "{\r\n      \"snssaiList\": [ \r\n        \"001-100001\"\r\n      ],\r\n      \"sliceProfileId\": \"ab9af40f13f721b5f13539d87484098\",\r\n      \"plmnIdList\": [\r\n        \"460-00\",\r\n        \"460-01\"\r\n      ],\r\n      \"perfReq\": {\r\n        \"perfReqEmbbList \": [\r\n          {\r\n            \"activityFactor\": 50\r\n          }\r\n        ]\r\n      },\r\n      \"maxNumberofUEs\": 200, \r\n      \"coverageAreaTAList\": [ \r\n        \"1\",\r\n        \"2\",\r\n        \"3\",\r\n        \"4\"\r\n      ],\r\n      \"latency\": 2,\r\n      \"resourceSharingLevel\": \"non-shared\" \r\n    }"
+        Map<String, Object> ServiceCharacteristicValue = new LinkedHashMap<>()
+        Map<String, Object> ServiceCharacteristicValueObject = new LinkedHashMap<>()
+        ServiceCharacteristicValueObject.put("serviceCharacteristicValue","001-100001")
+        ServiceCharacteristicValue.put("name", "snssai")
+        ServiceCharacteristicValue.put("value", ServiceCharacteristicValueObject)
+
+        List expectedList= new ArrayList()
+        expectedList.add(ServiceCharacteristicValue)
+
+        ObjectMapper objectMapper = new ObjectMapper()
+        Map<String, Object> serviceCharacteristic = objectMapper.readValue(sliceProfile, Map.class);
+
+        DoAllocateCoreNonSharedSlice allocateNssi = new DoAllocateCoreNonSharedSlice()
+        List characteristicList=allocateNssi.retrieveServiceCharacteristicsAsKeyValue(serviceCharacteristic)
+
+        assertEquals(expectedList, characteristicList)
+    }
+}
\ No newline at end of file
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreSharedSliceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreSharedSliceTest.groovy
new file mode 100644 (file)
index 0000000..0ac48ad
--- /dev/null
@@ -0,0 +1,646 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020  Tech Mahindra
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.scripts
+
+import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity
+import org.junit.Before
+import org.junit.Test
+import org.mockito.ArgumentCaptor
+import org.mockito.Captor
+import org.onap.so.bpmn.common.scripts.MsoGroovyTest
+import org.mockito.Mockito
+import org.onap.aaiclient.client.aai.AAIObjectType
+import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
+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 static org.mockito.Mockito.spy
+import static org.mockito.Mockito.times
+import static org.mockito.Mockito.verify
+import static org.mockito.Mockito.when
+import static org.mockito.ArgumentMatchers.eq
+
+import javax.ws.rs.NotFoundException
+
+class DoAllocateCoreSharedSliceTest extends MsoGroovyTest {
+
+    DoAllocateCoreSharedSlice allocate = new DoAllocateCoreSharedSlice()
+
+    @Before
+    void init() throws IOException {
+        super.init("DoAllocateCoreSharedSlice")
+    }
+
+    @Captor
+    static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class)
+
+    @Test
+    void testPreProcessRequest(){
+
+        String solutions = """ [
+          {
+            "invariantUUID": "y7685f64-5717-4562-b3fc-2c963f66afa6",
+            "UUID": "8u785f64-5717-4562-b3fc-2c963f66afa6",
+            "NSSIName": "embb-core-ser",
+            "NSSIId": "f4485f64-5717-4562-b3fc-2c963f66afa6",
+            "matchLevel": {
+            "blob":"content"
+             }
+          }
+        ]"""
+        String sliceProfile = "{\r\n      \"snssaiList\": [ \r\n        \"001-100001\"\r\n      ],\r\n      \"sliceProfileId\": \"ab9af40f13f721b5f13539d87484098\",\r\n      \"plmnIdList\": [\r\n        \"460-00\",\r\n        \"460-01\"\r\n      ],\r\n      \"perfReq\": {\r\n        \"perfReqEmbbList \": [\r\n          {\r\n            \"activityFactor\": 50\r\n          }\r\n        ]\r\n      },\r\n      \"maxNumberofUEs\": 200, \r\n      \"coverageAreaTAList\": [ \r\n        \"1\",\r\n        \"2\",\r\n        \"3\",\r\n        \"4\"\r\n      ],\r\n      \"latency\": 2,\r\n      \"resourceSharingLevel\": \"non-shared\" \r\n    }"
+
+        setUpBaseMockData()
+
+        when(mockExecution.getVariable("solutions")).thenReturn(solutions)
+        when(mockExecution.getVariable("sliceProfile")).thenReturn(sliceProfile)
+
+        allocate.preProcessRequest(mockExecution)
+
+        Mockito.verify(mockExecution, times(1)).setVariable(eq("nssiId"), captor.capture())
+        def nssiId = captor.getValue()
+        assertEquals("f4485f64-5717-4562-b3fc-2c963f66afa6", nssiId)
+
+        Mockito.verify(mockExecution, times(1)).setVariable(eq("sNssai"), captor.capture())
+        def sNssai = captor.getValue()
+        assertEquals("001-100001", sNssai)
+
+        Mockito.verify(mockExecution,times(3)).setVariable(captor.capture() as String, captor.capture())
+        List<ExecutionEntity> values = captor.getAllValues()
+        assertNotNull(values)
+    }
+
+    @Test
+    public void tesPrepareSOMacroRequestPayload() {
+
+        String json ="{ \"serviceResources\"    : {\r\n\t\"modelInfo\"       : {\r\n\t\t\"modelName\"          : \"MSOTADevInfra_vSAMP10a_Service\",\r\n\t\t\"modelUuid\"          : \"5df8b6de-2083-11e7-93ae-92361f002671\",\r\n\t\t\"modelInvariantUuid\" : \"9647dfc4-2083-11e7-93ae-92361f002671\",\r\n\t\t\"modelVersion\"       : \"1.0\"\r\n\t},\r\n\t\"serviceType\"        : \"PortMirroring\",\r\n\t\"serviceRole\"        : \"InfraRole\",\r\n\t\"environmentContext\" : \"Luna\",\r\n\t\"workloadContext\"    : \"Oxygen\",\r\n\t\"serviceVnfs\": [\r\n\t\r\n\t\t{ \"modelInfo\"                    : {\r\n\t\t\t\"modelName\"              : \"vSAMP10a\",\r\n\t\t\t\"modelUuid\"              : \"ff2ae348-214a-11e7-93ae-92361f002671\",\r\n\t\t\t\"modelInvariantUuid\"     : \"2fff5b20-214b-11e7-93ae-92361f002671\",\r\n\t\t\t\"modelVersion\"           : \"1.0\",\r\n\t\t\t\"modelCustomizationUuid\" : \"68dc9a92-214c-11e7-93ae-92361f002671\",\r\n\t\t\t\"modelInstanceName\"      : \"vSAMP10a 1\"\r\n\t\t\t},\r\n\t\t\"toscaNodeType\"            : \"VF\",\r\n\t\t\"nfFunction\"           \t: null,\r\n\t\t\"nfType\"              \t\t: null,\r\n\t\t\"nfRole\"              \t\t: null,\r\n\t\t\"nfNamingCode\"         \t: null,\r\n\t\t\"multiStageDesign\"\t\t: null,\r\n\t\t\t\"vfModules\": [\r\n\t\t\t\t{\r\n\t\t\t\t\t\"modelInfo\"               : { \r\n\t\t\t\t\t\t\"modelName\"              : \"NetworkFqdnTest4\",\r\n\t\t\t\t\t\t\"modelUuid\"              : \"025606c1-4223-11e7-9252-005056850d2e\",\r\n\t\t\t\t\t\t\"modelInvariantUuid\"     : \"06bd0a18-65c0-4418-83c7-5b0d13cba01a\",\r\n\t\t\t\t\t\t\"modelVersion\"           : \"2.0\",\r\n\t\t\t\t\t\t\"modelCustomizationUuid\" : \"06bd0a18-65c0-4418-83c7-5b0d13cba01a\"\r\n\t\t\t\t\t},\t\t\"isBase\"                 : true,\r\n\t\t\t\t\t\"vfModuleLabel\"          : \"label\",\r\n\t\t\t\t\t\"initialCount\"           : 0,\r\n\t\t\t\t\t\"hasVolumeGroup\"           : true\r\n\t\t\t\t},\r\n\t\t\t\t{\r\n\t\t\t\t\t\"modelInfo\"               : { \r\n\t\t\t\t\t\t\"modelName\"              : \"NetworkFqdnTest3\",\r\n\t\t\t\t\t\t\"modelUuid\"              : \"02560575-4223-11e7-9252-005056850d2e\",\r\n\t\t\t\t\t\t\"modelInvariantUuid\"     : \"06bd0a18-65c0-4418-83c7-5b0d13cba0bb\",\r\n\t\t\t\t\t\t\"modelVersion\"           : \"1.0\",\r\n\t\t\t\t\t\t\"modelCustomizationUuid\" : \"06bd0a18-65c0-4418-83c7-5b0d13cba0bb\"\r\n\t\t\t\t\t},\t\t\"isBase\"                 : true,\r\n\t\t\t\t\t\"vfModuleLabel\"          : \"label\",\r\n\t\t\t\t\t\"initialCount\"           : 0,\r\n\t\t\t\t\t\"hasVolumeGroup\"           : false\r\n\t\t\t\t},\r\n\t\t\t\t{\r\n\t\t\t\t\t\"modelInfo\"               : { \r\n\t\t\t\t\t\t\"modelName\"              : \"NetworkFqdnTest5\",\r\n\t\t\t\t\t\t\"modelUuid\"              : \"025607e4-4223-11e7-9252-005056850d2e\",\r\n\t\t\t\t\t\t\"modelInvariantUuid\"     : \"06bd0a18-65c0-4418-83c7-5b0d14cba01a\",\r\n\t\t\t\t\t\t\"modelVersion\"           : \"1.0\",\r\n\t\t\t\t\t\t\"modelCustomizationUuid\" : \"06bd0a18-65c0-4418-83c7-5b0d14cba01a\"\r\n\t\t\t\t\t},\t\t\"isBase\"                 : false,\r\n\t\t\t\t\t\"vfModuleLabel\"          : \"label\",\r\n\t\t\t\t\t\"initialCount\"           : 0,\r\n\t\t\t\t\t\"hasVolumeGroup\"           : false\r\n\t\t\t\t},\r\n\t\t\t\t{\r\n\t\t\t\t\t\"modelInfo\"               : { \r\n\t\t\t\t\t\t\"modelName\"              : \"vSAMP10aDEV::PCM::module-2\",\r\n\t\t\t\t\t\t\"modelUuid\"              : \"7774b4e4-7d37-11e7-bb31-be2e44b06b34\",\r\n\t\t\t\t\t\t\"modelInvariantUuid\"     : \"93e9c1d2-7d37-11e7-bb31-be2e44b06b34\",\r\n\t\t\t\t\t\t\"modelVersion\"           : \"2\",\r\n\t\t\t\t\t\t\"modelCustomizationUuid\" : \"6728bee8-7d3a-11e7-bb31-be2e44b06b34\"\r\n\t\t\t\t\t},\t\t\"isBase\"                 : false,\r\n\t\t\t\t\t\"vfModuleLabel\"          : \"PCM\",\r\n\t\t\t\t\t\"initialCount\"           : 0,\r\n\t\t\t\t\t\"hasVolumeGroup\"           : true\r\n\t\t\t\t},\r\n\t\t\t\t{\r\n\t\t\t\t\t\"modelInfo\"               : { \r\n\t\t\t\t\t\t\"modelName\"              : \"vSAMP10aDEV::PCM::module-1\",\r\n\t\t\t\t\t\t\"modelUuid\"              : \"066de97e-253e-11e7-93ae-92361f002671\",\r\n\t\t\t\t\t\t\"modelInvariantUuid\"     : \"64efd51a-2544-11e7-93ae-92361f002671\",\r\n\t\t\t\t\t\t\"modelVersion\"           : \"2\",\r\n\t\t\t\t\t\t\"modelCustomizationUuid\" : \"b4ea86b4-253f-11e7-93ae-92361f002671\"\r\n\t\t\t\t\t},\t\t\"isBase\"                 : false,\r\n\t\t\t\t\t\"vfModuleLabel\"          : \"PCM\",\r\n\t\t\t\t\t\"initialCount\"           : 0,\r\n\t\t\t\t\t\"hasVolumeGroup\"           : true\r\n\t\t\t\t},\r\n\t\t\t\t{\r\n\t\t\t\t\t\"modelInfo\"               : { \r\n\t\t\t\t\t\t\"modelName\"              : \"vSAMP10aDEV::base::module-0\",\r\n\t\t\t\t\t\t\"modelUuid\"              : \"20c4431c-246d-11e7-93ae-92361f002671\",\r\n\t\t\t\t\t\t\"modelInvariantUuid\"     : \"78ca26d0-246d-11e7-93ae-92361f002671\",\r\n\t\t\t\t\t\t\"modelVersion\"           : \"2\",\r\n\t\t\t\t\t\t\"modelCustomizationUuid\" : \"cb82ffd8-252a-11e7-93ae-92361f002671\"\r\n\t\t\t\t\t},\t\t\"isBase\"                 : true,\r\n\t\t\t\t\t\"vfModuleLabel\"          : \"base\",\r\n\t\t\t\t\t\"initialCount\"           : 1,\r\n\t\t\t\t\t\"hasVolumeGroup\"           : true\r\n\t\t\t\t},\r\n\t\t\t\t{\r\n\t\t\t\t\t\"modelInfo\"               : { \r\n\t\t\t\t\t\t\"modelName\"              : \"vSAMP10a::base::module-0\",\r\n\t\t\t\t\t\t\"modelUuid\"              : \"02560de2-4223-11e7-9252-005056850d2e\",\r\n\t\t\t\t\t\t\"modelInvariantUuid\"     : null,\r\n\t\t\t\t\t\t\"modelVersion\"           : \"2\",\r\n\t\t\t\t\t\t\"modelCustomizationUuid\" : \"MIGRATED_36e76920-ef30-4793-9979-cbd7d4b2bfc4\"\r\n\t\t\t\t\t},\t\t\"isBase\"                 : true,\r\n\t\t\t\t\t\"vfModuleLabel\"          : \"base\",\r\n\t\t\t\t\t\"initialCount\"           : 1,\r\n\t\t\t\t\t\"hasVolumeGroup\"           : true\r\n\t\t\t\t},\r\n\t\t\t\t{\r\n\t\t\t\t\t\"modelInfo\"               : { \r\n\t\t\t\t\t\t\"modelName\"              : \"base::module-0\",\r\n\t\t\t\t\t\t\"modelUuid\"              : \"02561381-4223-11e7-9252-005056850d2e\",\r\n\t\t\t\t\t\t\"modelInvariantUuid\"     : null,\r\n\t\t\t\t\t\t\"modelVersion\"           : \"1\",\r\n\t\t\t\t\t\t\"modelCustomizationUuid\" : \"MIGRATED_51baae4c-b7c7-4f57-b77e-6e01acca89e5\"\r\n\t\t\t\t\t},\t\t\"isBase\"                 : true,\r\n\t\t\t\t\t\"vfModuleLabel\"          : \"module-0\",\r\n\t\t\t\t\t\"initialCount\"           : 1,\r\n\t\t\t\t\t\"hasVolumeGroup\"           : false\r\n\t\t\t\t},\r\n\t\t\t\t{\r\n\t\t\t\t\t\"modelInfo\"               : { \r\n\t\t\t\t\t\t\"modelName\"              : \"vSAMP10a::PCM::module-1\",\r\n\t\t\t\t\t\t\"modelUuid\"              : \"02560f1b-4223-11e7-9252-005056850d2e\",\r\n\t\t\t\t\t\t\"modelInvariantUuid\"     : null,\r\n\t\t\t\t\t\t\"modelVersion\"           : \"1\",\r\n\t\t\t\t\t\t\"modelCustomizationUuid\" : \"MIGRATED_e9be2ed7-45b6-479c-b06e-9093899f8ce8\"\r\n\t\t\t\t\t},\t\t\"isBase\"                 : true,\r\n\t\t\t\t\t\"vfModuleLabel\"          : \"PCM\",\r\n\t\t\t\t\t\"initialCount\"           : 1,\r\n\t\t\t\t\t\"hasVolumeGroup\"           : true\r\n\t\t\t\t}\r\n\t\t\t]\r\n\t\t}\r\n\t],\r\n\t\"serviceNetworks\": [],\r\n\t\"serviceAllottedResources\": [\r\n\t\t{\r\n\t\t\t\"modelInfo\"       : {\r\n\t\t\t\t\"modelName\"              : \"Tunnel_Xconn\",\r\n\t\t\t\t\"modelUuid\"              : \"f6b7d4c6-e8a4-46e2-81bc-31cad5072842\",\r\n\t\t\t\t\"modelInvariantUuid\"     : \"b7a1b78e-6b6b-4b36-9698-8c9530da14af\",\r\n\t\t\t\t\"modelVersion\"           : \"1.0\",\r\n\t\t\t\t\"modelCustomizationUuid\" : \"5b9bee43-f537-4fb3-9e8b-4de9f714d28a\",\r\n\t\t\t\t\"modelInstanceName\"      : \"Pri_Tunnel_Xconn 9\"\r\n\t\t\t},\r\n\t\t\t\"toscaNodeType\"              : null,\r\n\t\t\t\"allottedResourceType\"              : null,\r\n\t\t\t\"allottedResourceRole\"              : null,\r\n\t\t\t\"providingServiceModelInvariantUuid\"              : null,\r\n\t\t\t\"nfFunction\"              : null,\r\n\t\t\t\"nfType\"              : null,\r\n\t\t\t\"nfRole\"              : null,\r\n\t\t\t\"nfNamingCode\"              : null\r\n\t\t}\r\n\t],\r\n\t\"serviceConfigs\": [\r\n\t\t{\r\n\t\t\t\"modelInfo\"       : {\r\n\t\t\t\t\"modelName\"              : \"Mulder\",\r\n\t\t\t\t\"modelUuid\"              : \"025606c1-4fff-11e7-9252-005056850d2e\",\r\n\t\t\t\t\"modelInvariantUuid\"     : \"025606c1-4eee-11e7-9252-005056850d2e\",\r\n\t\t\t\t\"modelVersion\"           : \"1.0\",\r\n\t\t\t\t\"modelCustomizationUuid\" : \"025606c1-4ddd-11e7-9252-005056850d2e\",\r\n\t\t\t\t\"modelInstanceName\"      : \"X_FILES_001\"\r\n\t\t\t},\r\n\t\t\t\"toscaNodeType\"   : \"Scully\"\r\n\t\t},\r\n\t\t{\r\n\t\t\t\"modelInfo\"       : {\r\n\t\t\t\t\"modelName\"              : \"Krychuk\",\r\n\t\t\t\t\"modelUuid\"              : \"025606c1-5fff-11e7-9252-005056850d2e\",\r\n\t\t\t\t\"modelInvariantUuid\"     : \"025606c1-5eee-11e7-9252-005056850d2e\",\r\n\t\t\t\t\"modelVersion\"           : \"1.0\",\r\n\t\t\t\t\"modelCustomizationUuid\" : \"025606c1-5ddd-11e7-9252-005056850d2e\",\r\n\t\t\t\t\"modelInstanceName\"      : \"X_FILES_002\"\r\n\t\t\t},\r\n\t\t\t\"toscaNodeType\"   : \"Skinner\"\r\n\t\t}\r\n\t]\r\n\t}}\r\n\r\n"
+        String sliceProfile = "{\r\n      \"snssaiList\": [ \r\n        \"001-100001\"\r\n      ],\r\n      \"sliceProfileId\": \"ab9af40f13f721b5f13539d87484098\",\r\n      \"plmnIdList\": [\r\n        \"460-00\",\r\n        \"460-01\"\r\n      ],\r\n      \"perfReq\": {\r\n        \"perfReqEmbbList \": [\r\n          {\r\n            \"activityFactor\": 50\r\n          }\r\n        ]\r\n      },\r\n      \"maxNumberofUEs\": 200, \r\n      \"coverageAreaTAList\": [ \r\n        \"1\",\r\n        \"2\",\r\n        \"3\",\r\n        \"4\"\r\n      ],\r\n      \"latency\": 2,\r\n      \"resourceSharingLevel\": \"non-shared\" \r\n    }"
+        String vnfs="[{\"toscaNodeType\":\"VF\",\"vfModules\":[{\"initialCount\":0,\"vfModuleLabel\":\"label\",\"modelInfo\":{\"modelInvariantUuid\":\"06bd0a18-65c0-4418-83c7-5b0d13cba01a\",\"modelName\":\"NetworkFqdnTest4\",\"modelVersion\":\"2.0\",\"modelCustomizationUuid\":\"06bd0a18-65c0-4418-83c7-5b0d13cba01a\",\"modelUuid\":\"025606c1-4223-11e7-9252-005056850d2e\"},\"hasVolumeGroup\":true,\"isBase\":true},{\"initialCount\":0,\"vfModuleLabel\":\"label\",\"modelInfo\":{\"modelInvariantUuid\":\"06bd0a18-65c0-4418-83c7-5b0d13cba0bb\",\"modelName\":\"NetworkFqdnTest3\",\"modelVersion\":\"1.0\",\"modelCustomizationUuid\":\"06bd0a18-65c0-4418-83c7-5b0d13cba0bb\",\"modelUuid\":\"02560575-4223-11e7-9252-005056850d2e\"},\"hasVolumeGroup\":false,\"isBase\":true},{\"initialCount\":0,\"vfModuleLabel\":\"label\",\"modelInfo\":{\"modelInvariantUuid\":\"06bd0a18-65c0-4418-83c7-5b0d14cba01a\",\"modelName\":\"NetworkFqdnTest5\",\"modelVersion\":\"1.0\",\"modelCustomizationUuid\":\"06bd0a18-65c0-4418-83c7-5b0d14cba01a\",\"modelUuid\":\"025607e4-4223-11e7-9252-005056850d2e\"},\"hasVolumeGroup\":false,\"isBase\":false},{\"initialCount\":0,\"vfModuleLabel\":\"PCM\",\"modelInfo\":{\"modelInvariantUuid\":\"93e9c1d2-7d37-11e7-bb31-be2e44b06b34\",\"modelName\":\"vSAMP10aDEV::PCM::module-2\",\"modelVersion\":\"2\",\"modelCustomizationUuid\":\"6728bee8-7d3a-11e7-bb31-be2e44b06b34\",\"modelUuid\":\"7774b4e4-7d37-11e7-bb31-be2e44b06b34\"},\"hasVolumeGroup\":true,\"isBase\":false},{\"initialCount\":0,\"vfModuleLabel\":\"PCM\",\"modelInfo\":{\"modelInvariantUuid\":\"64efd51a-2544-11e7-93ae-92361f002671\",\"modelName\":\"vSAMP10aDEV::PCM::module-1\",\"modelVersion\":\"2\",\"modelCustomizationUuid\":\"b4ea86b4-253f-11e7-93ae-92361f002671\",\"modelUuid\":\"066de97e-253e-11e7-93ae-92361f002671\"},\"hasVolumeGroup\":true,\"isBase\":false},{\"initialCount\":1,\"vfModuleLabel\":\"base\",\"modelInfo\":{\"modelInvariantUuid\":\"78ca26d0-246d-11e7-93ae-92361f002671\",\"modelName\":\"vSAMP10aDEV::base::module-0\",\"modelVersion\":\"2\",\"modelCustomizationUuid\":\"cb82ffd8-252a-11e7-93ae-92361f002671\",\"modelUuid\":\"20c4431c-246d-11e7-93ae-92361f002671\"},\"hasVolumeGroup\":true,\"isBase\":true},{\"initialCount\":1,\"vfModuleLabel\":\"base\",\"modelInfo\":{\"modelInvariantUuid\":null,\"modelName\":\"vSAMP10a::base::module-0\",\"modelVersion\":\"2\",\"modelCustomizationUuid\":\"MIGRATED_36e76920-ef30-4793-9979-cbd7d4b2bfc4\",\"modelUuid\":\"02560de2-4223-11e7-9252-005056850d2e\"},\"hasVolumeGroup\":true,\"isBase\":true},{\"initialCount\":1,\"vfModuleLabel\":\"module-0\",\"modelInfo\":{\"modelInvariantUuid\":null,\"modelName\":\"base::module-0\",\"modelVersion\":\"1\",\"modelCustomizationUuid\":\"MIGRATED_51baae4c-b7c7-4f57-b77e-6e01acca89e5\",\"modelUuid\":\"02561381-4223-11e7-9252-005056850d2e\"},\"hasVolumeGroup\":false,\"isBase\":true},{\"initialCount\":1,\"vfModuleLabel\":\"PCM\",\"modelInfo\":{\"modelInvariantUuid\":null,\"modelName\":\"vSAMP10a::PCM::module-1\",\"modelVersion\":\"1\",\"modelCustomizationUuid\":\"MIGRATED_e9be2ed7-45b6-479c-b06e-9093899f8ce8\",\"modelUuid\":\"02560f1b-4223-11e7-9252-005056850d2e\"},\"hasVolumeGroup\":true,\"isBase\":true}],\"modelInfo\":{\"modelInvariantUuid\":\"2fff5b20-214b-11e7-93ae-92361f002671\",\"modelName\":\"vSAMP10a\",\"modelVersion\":\"1.0\",\"modelCustomizationUuid\":\"68dc9a92-214c-11e7-93ae-92361f002671\",\"modelInstanceName\":\"vSAMP10a 1\",\"modelUuid\":\"ff2ae348-214a-11e7-93ae-92361f002671\"},\"nfRole\":null,\"nfType\":null,\"multiStageDesign\":null,\"nfFunction\":null,\"nfNamingCode\":null}]\r\n"
+        String service = "{\r\n                \"modelName\"          : \"eMBB-NSST\",\r\n                \"modelUuid\"          : \"ecfa2329-8765-4665-84e0-a32a2ac2be90\",\r\n                \"modelInvariantUuid\" : \"2eeeb5ff-4655-47d8-8aa3-044682246b60\",\r\n                \"modelVersion\"       : \"1.0\"\r\n        }"
+
+        when(mockExecution.getVariable("serviceVnfs")).thenReturn(vnfs)
+
+        when(mockExecution.getVariable("serviceType")).thenReturn("5g")
+        when(mockExecution.getVariable("vnfs")).thenReturn(vnfs)
+        when(mockExecution.getVariable("serviceModelInfo")).thenReturn(service)
+        when(mockExecution.getVariable("sliceProfile")).thenReturn(sliceProfile)
+        allocate.prepareSOMacroRequestPayload(mockExecution)
+
+        Mockito.verify(mockExecution, times(1)).setVariable(eq("requestPayload"), captor.capture())
+        assertNotNull(captor.getValue())
+    }
+
+    @Test
+    void testPrepareVnfInstanceParamsJson() {
+        List<Map<String, Object>> snssaiList = new ArrayList<>()
+        Map<String, Object> snssaiMap = new LinkedHashMap<>()
+        snssaiMap.put("snssai", "01-5C83F071")
+        snssaiMap.put("status", "activated")
+        snssaiList.add(snssaiMap)
+        Map<String, Object> snssaiMap1 = new LinkedHashMap<>()
+        snssaiMap1.put("snssai", "01-5B179BD4")
+        snssaiMap1.put("status", "activated")
+        snssaiList.add(snssaiMap1)
+
+        when(mockExecution.getVariable("snssaiAndOrchStatusList")).thenReturn(snssaiList)
+
+        String returnedJsonAsString= allocate.prepareVnfInstanceParamsJson(mockExecution)
+        String expectedJsonAsString = """{supportedNssai={"sNssai":[{"snssai":"01-5C83F071","status":"activated"},{"snssai":"01-5B179BD4","status":"activated"}]}}"""
+        assertEquals(expectedJsonAsString, returnedJsonAsString)
+    }
+
+    @Test
+    void testGetNetworkInstanceWithSPInstanceAssociatedWithNssiId(){
+
+        setUpBaseMockData()
+        when(mockExecution.getVariable("serviceType")).thenReturn("5G")
+
+        DoAllocateCoreSharedSlice obj = spy(DoAllocateCoreSharedSlice.class)
+        when(obj.getAAIClient()).thenReturn(client)
+        AAIResourceUri resourceUri1 = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer("5GCustomer").serviceSubscription("5G").serviceInstance("NSSI-C-7Q4-HDBNJ-NSSMF-01-A-ZX"))
+        when(client.exists(resourceUri1)).thenReturn(true)
+        AAIResultWrapper wrapper1 = new AAIResultWrapper(mockQuerySliceServiceReturn())
+        when(client.get(resourceUri1, NotFoundException.class)).thenReturn(wrapper1)
+
+        //networkServiceInstanceId
+        when(mockExecution.getVariable("networkServiceInstanceId")).thenReturn("206535e7-77c9-4036-9387-3f1cf57b4379")
+
+        AAIResourceUri resourceUri2 = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer("5GCustomer").serviceSubscription("5G").serviceInstance("206535e7-77c9-4036-9387-3f1cf57b4379"))
+        when(client.exists(resourceUri2)).thenReturn(true)
+        AAIResultWrapper wrapper2 = new AAIResultWrapper(mockQueryNS())
+        when(client.get(resourceUri2, NotFoundException.class)).thenReturn(wrapper2)
+
+        //Check Vnf
+        when(mockExecution.getVariable("vnfId")).thenReturn("eeb66c6f-36bd-47ad-8294-48f46b1aa912")
+        AAIResourceUri resourceUri3 = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("eeb66c6f-36bd-47ad-8294-48f46b1aa912"))
+        when(client.exists(resourceUri3)).thenReturn(true)
+        AAIResultWrapper wrapper3 = new AAIResultWrapper(mockQueryVnf())
+        when(client.get(resourceUri3, NotFoundException.class)).thenReturn(wrapper3)
+
+
+        //Allotted Resources-1
+        AAIResourceUri resourceUri4 = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer("5GCustomer").serviceSubscription("5G").serviceInstance("0d3d3cce-46a8-486d-816a-954e71697c4e"))
+        when(client.exists(resourceUri4)).thenReturn(true)
+        AAIResultWrapper wrapper4 = new AAIResultWrapper(mockServiceProfile1())
+        when(client.get(resourceUri4, NotFoundException.class)).thenReturn(wrapper4)
+
+        //Allotted Resources-2
+        AAIResourceUri resourceUri5 = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer("5GCustomer").serviceSubscription("5G").serviceInstance("1c7046f2-a5a3-4d7f-9da8-388ee641a795"))
+        when(client.exists(resourceUri5)).thenReturn(true)
+        AAIResultWrapper wrapper5 = new AAIResultWrapper(mockServiceProfile2())
+        when(client.get(resourceUri5, NotFoundException.class)).thenReturn(wrapper5)
+
+        obj.getNetworkInstanceAssociatedWithNssiId(mockExecution)
+
+        //networkServiceInstanceId
+        Mockito.verify(mockExecution, times(1)).setVariable(eq("networkServiceInstanceId"), captor.capture())
+        assertEquals("206535e7-77c9-4036-9387-3f1cf57b4379", captor.getValue())
+
+        Mockito.verify(mockExecution, times(1)).setVariable(eq("networkServiceInstanceName"), captor.capture())
+        assertEquals("nsi_DemoEmbb", captor.getValue())
+
+        Mockito.verify(mockExecution, times(1)).setVariable(eq("networkServiceModelInvariantUuid"), captor.capture())
+        assertEquals("848c5656-5594-4d41-84bb-7afc7c64765c", captor.getValue())
+
+        Mockito.verify(mockExecution, times(1)).setVariable(eq("owningEntityId"), captor.capture())
+        assertEquals("OE-generic", captor.getValue())
+
+        //assertEquals("206535e7-77c9-4036-9387-3f1cf57b4379", captor.getValue())
+
+        //VnfId
+        Mockito.verify(mockExecution, times(1)).setVariable(eq("vnfId"), captor.capture())
+        assertEquals("eeb66c6f-36bd-47ad-8294-48f46b1aa912", captor.getValue())
+
+        //
+        Mockito.verify(mockExecution, times(1)).setVariable(eq("snssaiAndOrchStatusList"), captor.capture())
+        List<Map<String, Object>> snssaiList = new ArrayList<>()
+        Map<String, Object> snssaiMap = new LinkedHashMap<>()
+        snssaiMap.put("snssai", "01-5C83F071")
+        snssaiMap.put("orchestrationStatus", "activated")
+        snssaiList.add(snssaiMap)
+        Map<String, Object> snssaiMap1 = new LinkedHashMap<>()
+        snssaiMap1.put("snssai", "01-5B179BD4")
+        snssaiMap1.put("orchestrationStatus", "activated")
+        snssaiList.add(snssaiMap1)
+        assertEquals(snssaiList, captor.getValue())
+
+        //Verify Project
+        Mockito.verify(mockExecution, times(1)).setVariable(eq("projectName"), captor.capture())
+        assertEquals("Project-generic", captor.getValue())
+
+        Mockito.verify(mockExecution, times(1)).setVariable(eq("tenantId"), captor.capture())
+        assertEquals("3d5819f1542e4ef9a4ccb0bcb278ca10", captor.getValue())
+
+        Mockito.verify(mockExecution, times(1)).setVariable(eq("cloudOwner"), captor.capture())
+        assertEquals("k8scloudowner", captor.getValue())
+
+        Mockito.verify(mockExecution, times(1)).setVariable(eq("lcpCloudRegionId"), captor.capture())
+        assertEquals("k8sregion", captor.getValue())
+
+        Mockito.verify(mockExecution, times(1)).setVariable(eq("platformName"), captor.capture())
+        assertEquals("test", captor.getValue())
+
+        Mockito.verify(mockExecution, times(1)).setVariable(eq("lineOfBusinessName"), captor.capture())
+        assertEquals("LOB-Demonstration", captor.getValue())
+
+    }
+
+    void setUpBaseMockData() {
+
+        String sliceParams ="""{
+                                       "nsiId": "NSI-M-001-HDBNJ-NSMF-01-A-ZX",
+                                       "snssaiList": [
+                                                                       "01-5B179BD4"
+                                                               ],
+                                       "sliceProfileId": "ab9af40f13f721b5f13539d87484098"
+                               }"""
+
+        when(mockExecution.getVariable("msoRequestId")).thenReturn("5ad89cf9-0569-4a93-4509-d8324321e2be")
+        when(mockExecution.getVariable("serviceInstanceID")).thenReturn("NSSI-C-7Q4-HDBNJ-NSSMF-01-A-ZX")
+        when(mockExecution.getVariable("nsiId")).thenReturn("NSI-M-001-HDBNJ-NSMF-01-A-ZX")
+        when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer")
+        when(mockExecution.getVariable("subscriptionServiceType")).thenReturn("5G")
+        when(mockExecution.getVariable("operationType")).thenReturn("deactivateInstance")
+        when(mockExecution.getVariable("jobId")).thenReturn("5ad89cf9-0569-4a93-9999-d8324321e2be")
+        when(mockExecution.getVariable("sliceParams")).thenReturn(sliceParams)
+    }
+
+    String mockQueryNS() {
+        return """
+                       {
+       "service-instance-id": "206535e7-77c9-4036-9387-3f1cf57b4379",
+       "service-instance-name": "nsi_DemoEmbb",
+       "environment-context": "General_Revenue-Bearing",
+       "workload-context": "Production",
+       "model-invariant-id": "848c5656-5594-4d41-84bb-7afc7c64765c",
+       "model-version-id": "2de92587-3395-44e8-bb2c-b9529747e580",
+       "resource-version": "1599228110527",
+       "selflink": "restconf/config/GENERIC-RESOURCE-API:services/service/206535e7-77c9-4036-9387-3f1cf57b4379/service-data/service-topology/",
+       "orchestration-status": "Assigned",
+       "relationship-list": {
+               "relationship": [{
+                       "related-to": "owning-entity",
+                       "relationship-label": "org.onap.relationships.inventory.BelongsTo",
+                       "related-link": "/aai/v19/business/owning-entities/owning-entity/OE-generic",
+                       "relationship-data": [{
+                               "relationship-key": "owning-entity.owning-entity-id",
+                               "relationship-value": "OE-generic"
+                       }]
+               }, {
+                       "related-to": "generic-vnf",
+                       "relationship-label": "org.onap.relationships.inventory.ComposedOf",
+                       "related-link": "/aai/v19/network/generic-vnfs/generic-vnf/eeb66c6f-36bd-47ad-8294-48f46b1aa912",
+                       "relationship-data": [{
+                               "relationship-key": "generic-vnf.vnf-id",
+                               "relationship-value": "eeb66c6f-36bd-47ad-8294-48f46b1aa912"
+                       }],
+                       "related-to-property": [{
+                               "property-key": "generic-vnf.vnf-name",
+                               "property-value": "vfwuctest 0"
+                       }]
+               }, {
+                       "related-to": "project",
+                       "relationship-label": "org.onap.relationships.inventory.Uses",
+                       "related-link": "/aai/v19/business/projects/project/Project-generic",
+                       "relationship-data": [{
+                               "relationship-key": "project.project-name",
+                               "relationship-value": "Project-generic"
+                       }]
+               }]
+       }
+}
+               """
+    }
+
+    String mockQueryVnf() {
+
+        return """
+               {
+  "vnf-id": "eeb66c6f-36bd-47ad-8294-48f46b1aa912",
+  "vnf-name": "vfwuctest 0",
+  "vnf-type": "vfwuctest/null",
+  "service-id": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
+  "prov-status": "PREPROV",
+  "orchestration-status": "ConfigAssigned",
+  "in-maint": false,
+  "is-closed-loop-disabled": false,
+  "resource-version": "1599228155361",
+  "model-invariant-id": "1086e068-c932-4b61-ae3b-2d2eb0cbe3ec",
+  "model-version-id": "7fbb28cf-7dfc-447a-892c-4a3130b371d2",
+  "model-customization-id": "471b3188-e8f2-470b-9f4d-89e74d45445f",
+  "relationship-list": {
+    "relationship": [{
+      "related-to": "tenant",
+      "relationship-label": "org.onap.relationships.inventory.BelongsTo",
+      "related-link": "/aai/v19/cloud-infrastructure/cloud-regions/cloud-region/k8scloudowner/k8sregion/tenants/tenant/3d5819f1542e4ef9a4ccb0bcb278ca10",
+      "relationship-data": [{
+        "relationship-key": "cloud-region.cloud-owner",
+        "relationship-value": "k8scloudowner"
+      }, {
+        "relationship-key": "cloud-region.cloud-region-id",
+        "relationship-value": "k8sregion"
+      }, {
+        "relationship-key": "tenant.tenant-id",
+        "relationship-value": "3d5819f1542e4ef9a4ccb0bcb278ca10"
+      }],
+      "related-to-property": [{
+        "property-key": "tenant.tenant-name",
+        "property-value": "onap-tm5g-dev"
+      }]
+    }, {
+      "related-to": "cloud-region",
+      "relationship-label": "org.onap.relationships.inventory.LocatedIn",
+      "related-link": "/aai/v19/cloud-infrastructure/cloud-regions/cloud-region/k8scloudowner/k8sregion",
+      "relationship-data": [{
+        "relationship-key": "cloud-region.cloud-owner",
+        "relationship-value": "k8scloudowner"
+      }, {
+        "relationship-key": "cloud-region.cloud-region-id",
+        "relationship-value": "k8sregion"
+      }],
+      "related-to-property": [{
+        "property-key": "cloud-region.owner-defined-type",
+        "property-value": "OwnerType"
+      }]
+    }, {
+      "related-to": "service-instance",
+      "relationship-label": "org.onap.relationships.inventory.ComposedOf",
+      "related-link": "/aai/v19/business/customers/customer/Demonstration/service-subscriptions/service-subscription/vfw-k8s/service-instances/service-instance/206535e7-77c9-4036-9387-3f1cf57b4379",
+      "relationship-data": [{
+        "relationship-key": "customer.global-customer-id",
+        "relationship-value": "Demonstration"
+      }, {
+        "relationship-key": "service-subscription.service-type",
+        "relationship-value": "vfw-k8s"
+      }, {
+        "relationship-key": "service-instance.service-instance-id",
+        "relationship-value": "206535e7-77c9-4036-9387-3f1cf57b4379"
+      }],
+      "related-to-property": [{
+        "property-key": "service-instance.service-instance-name",
+        "property-value": "vfw-0201"
+      }]
+    }, {
+      "related-to": "platform",
+      "relationship-label": "org.onap.relationships.inventory.Uses",
+      "related-link": "/aai/v19/business/platforms/platform/test",
+      "relationship-data": [{
+        "relationship-key": "platform.platform-name",
+        "relationship-value": "test"
+      }]
+    }, {
+      "related-to": "line-of-business",
+      "relationship-label": "org.onap.relationships.inventory.Uses",
+      "related-link": "/aai/v19/business/lines-of-business/line-of-business/LOB-Demonstration",
+      "relationship-data": [{
+        "relationship-key": "line-of-business.line-of-business-name",
+        "relationship-value": "LOB-Demonstration"
+      }]
+    }]
+  }
+}
+               """
+    }
+
+    String mockQuerySliceServiceReturn(){
+        String expect =
+                """{
+  "service-instance-id": "NSSI-C-7Q4-HDBNJ-NSSMF-01-A-ZX",
+  "service-instance-name": "nssi_DemoEmbb",
+  "service-role": "nssi",
+  "environment-context": "cn",
+  "model-invariant-id": "da575e8e-0863-4172-88b3-b3a9ead67895",
+  "model-version-id": "e398c92f-27da-44b9-a717-1dbfc1bdd82e",
+  "service-instance-location-id": "39-00",
+  "resource-version": "1593525640482",
+  "orchestration-status": "activated",
+  "relationship-list": {
+    "relationship": [{
+      "related-to": "service-instance",
+      "relationship-label": "org.onap.relationships.inventory.ComposedOf",
+      "related-link": "/aai/v19/business/customers/customer/5GCustomer/service-subscriptions/service-subscription/5G/service-instances/service-instance/206535e7-77c9-4036-9387-3f1cf57b4379",
+      "relationship-data": [{
+        "relationship-key": "customer.global-customer-id",
+        "relationship-value": "5GCustomer"
+      }, {
+        "relationship-key": "service-subscription.service-type",
+        "relationship-value": "5G"
+      }, {
+        "relationship-key": "service-instance.service-instance-id",
+        "relationship-value": "206535e7-77c9-4036-9387-3f1cf57b4379"
+      }],
+      "related-to-property": [{
+        "property-key": "service-instance.service-instance-name",
+        "property-value": "nsi_DemoEmbb"
+      }]
+    },
+       {
+      "related-to": "allotted-resource",
+      "relationship-label": "org.onap.relationships.inventory.Uses",
+      "related-link": "/aai/v19/business/customers/customer/5GCustomer/service-subscriptions/service-subscription/5G/service-instances/service-instance/0d3d3cce-46a8-486d-816a-954e71697c4e/allotted-resources/allotted-resource/d63c241a-4c0b-4294-b4c3-5a57421a1769",
+      "relationship-data": [{
+        "relationship-key": "customer.global-customer-id",
+        "relationship-value": "5GCustomer"
+      }, {
+        "relationship-key": "service-subscription.service-type",
+        "relationship-value": "5G"
+      }, {
+        "relationship-key": "service-instance.service-instance-id",
+        "relationship-value": "0d3d3cce-46a8-486d-816a-954e71697c4e"
+      }, {
+        "relationship-key": "allotted-resource.id",
+        "relationship-value": "d63c241a-4c0b-4294-b4c3-5a57421a1769"
+      }],
+      "related-to-property": [{
+        "property-key": "allotted-resource.description"
+      }, {
+        "property-key": "allotted-resource.allotted-resource-name",
+        "property-value": "Allotted_DemoEmbb_shared"
+      }]
+    }, {
+      "related-to": "allotted-resource",
+      "relationship-label": "org.onap.relationships.inventory.Uses",
+      "related-link": "/aai/v19/business/customers/customer/5GCustomer/service-subscriptions/service-subscription/5G/service-instances/service-instance/1c7046f2-a5a3-4d7f-9da8-388ee641a795/allotted-resources/allotted-resource/362e46c2-cd84-45e4-a6c1-77f4ef88328d",
+      "relationship-data": [{
+        "relationship-key": "customer.global-customer-id",
+        "relationship-value": "5GCustomer"
+      }, {
+        "relationship-key": "service-subscription.service-type",
+        "relationship-value": "5G"
+      }, {
+        "relationship-key": "service-instance.service-instance-id",
+        "relationship-value": "1c7046f2-a5a3-4d7f-9da8-388ee641a795"
+      }, {
+        "relationship-key": "allotted-resource.id",
+        "relationship-value": "362e46c2-cd84-45e4-a6c1-77f4ef88328d"
+      }],
+      "related-to-property": [{
+        "property-key": "allotted-resource.description"
+      }, {
+        "property-key": "allotted-resource.allotted-resource-name",
+        "property-value": "Allotted_DemoEmbb"
+      }]
+    }
+       ]
+  }
+}
+                """
+        return expect
+    }
+
+    String mockServiceProfile1() {
+        return """{
+  "service-instance-id": "0d3d3cce-46a8-486d-816a-954e71697c4e",
+  "service-instance-name": "DemoEmbb2",
+  "service-role": "e2esliceprofile-service",
+  "environment-context": "01-5C83F071",
+  "model-invariant-id": "040b1b40-3120-446b-b8e3-4f21d153d11e",
+  "model-version-id": "8b7dabb3-3f27-4555-a9fe-803e862b0292",
+  "service-instance-location-id": "39-00",
+  "resource-version": "1593511782269",
+  "orchestration-status": "activated",
+  "relationship-list": {
+    "relationship": [{
+      "related-to": "service-instance",
+      "relationship-label": "org.onap.relationships.inventory.ComposedOf",
+      "related-link": "/aai/v19/business/customers/customer/5GCustomer/service-subscriptions/service-subscription/5G/service-instances/service-instance/4b2bdbc0-cf7e-4c50-882a-f660e3ab8520",
+      "relationship-data": [{
+        "relationship-key": "customer.global-customer-id",
+        "relationship-value": "5GCustomer"
+      }, {
+        "relationship-key": "service-subscription.service-type",
+        "relationship-value": "5G"
+      }, {
+        "relationship-key": "service-instance.service-instance-id",
+        "relationship-value": "4b2bdbc0-cf7e-4c50-882a-f660e3ab8520"
+      }],
+      "related-to-property": [{
+        "property-key": "service-instance.service-instance-name",
+        "property-value": "DemoEmbb"
+      }]
+    }]
+  },
+  "allotted-resources": {
+    "allotted-resource": [{
+      "id": "362e46c2-cd84-45e4-a6c1-77f4ef88328d",
+      "model-invariant-id": "e5941a50-ddb4-4f74-be03-25449ae02ddc",
+      "model-version-id": "ab171d60-c2cc-4903-ac1d-c451b647e461",
+      "resource-version": "1593511173712",
+      "type": "Allotted Resource",
+      "allotted-resource-name": "Allotted_DemoEmbb",
+      "relationship-list": {
+        "relationship": [{
+          "related-to": "service-instance",
+          "relationship-label": "org.onap.relationships.inventory.Uses",
+          "related-link": "/aai/v19/business/customers/customer/5GCustomer/service-subscriptions/service-subscription/5G/service-instances/service-instance/ea107578-9854-4718-8145-7c7febf0de6c",
+          "relationship-data": [{
+            "relationship-key": "customer.global-customer-id",
+            "relationship-value": "5GCustomer"
+          }, {
+            "relationship-key": "service-subscription.service-type",
+            "relationship-value": "5G"
+          }, {
+            "relationship-key": "service-instance.service-instance-id",
+            "relationship-value": "ea107578-9854-4718-8145-7c7febf0de6c"
+          }],
+          "related-to-property": [{
+            "property-key": "service-instance.service-instance-name",
+            "property-value": "nsi_DemoEmbb"
+          }]
+        }]
+      }
+    }]
+  },
+  "slice-profiles": {
+    "slice-profile": [{
+    "profile-id": "31a83df8-5bd0-4df7-a50f-7900476b81a2",
+    "latency": 3,
+    "max-number-of-UEs": 0,
+    "coverage-area-TA-list": "Beijing;Beijing;HaidianDistrict;WanshouluStreet",
+    "ue-mobility-level": "stationary",
+    "resource-sharing-level": "0",
+    "exp-data-rate-UL": 500,
+    "exp-data-rate-DL": 2000,
+    "activity-factor": 0,
+    "e2e-latency": 0,
+    "jitter": 0,
+    "survival-time": 0,
+    "exp-data-rate": 0,
+    "payload-size": 0,
+    "traffic-density": 0,
+    "conn-density": 0,
+    "s-nssai": "01-5C83F071",
+    "resource-version": "1593525640617"
+  }]
+  }
+}"""
+    }
+
+    String mockServiceProfile2() {
+        return """{
+  "service-instance-id": "1c7046f2-a5a3-4d7f-9da8-388ee641a795",
+  "service-instance-name": "DemoEmbb",
+  "service-role": "e2esliceprofile-service",
+  "environment-context": "01-5B179BD4",
+  "model-invariant-id": "040b1b40-3120-446b-b8e3-4f21d153d12e",
+  "model-version-id": "8b7dabb3-3f27-4555-a9fe-803e862b0282",
+  "service-instance-location-id": "39-00",
+  "resource-version": "1593511782169",
+  "orchestration-status": "activated",
+  "relationship-list": {
+    "relationship": [{
+      "related-to": "service-instance",
+      "relationship-label": "org.onap.relationships.inventory.ComposedOf",
+      "related-link": "/aai/v19/business/customers/customer/5GCustomer/service-subscriptions/service-subscription/5G/service-instances/service-instance/4b2bdbc0-cf7e-4c50-882a-f660e3ab8520",
+      "relationship-data": [{
+        "relationship-key": "customer.global-customer-id",
+        "relationship-value": "5GCustomer"
+      }, {
+        "relationship-key": "service-subscription.service-type",
+        "relationship-value": "5G"
+      }, {
+        "relationship-key": "service-instance.service-instance-id",
+        "relationship-value": "4b2bdbc0-cf7e-4c50-882a-f660e3ab8520"
+      }],
+      "related-to-property": [{
+        "property-key": "service-instance.service-instance-name",
+        "property-value": "DemoEmbb"
+      }]
+    }]
+  },
+  "allotted-resources": {
+    "allotted-resource": [{
+      "id": "362e46c2-cd84-45e4-a6c1-77f4ef88328d",
+      "model-invariant-id": "e5941a50-ddb4-4f74-be03-25449ae02ddc",
+      "model-version-id": "ab171d60-c2cc-4903-ac1d-c451b647e461",
+      "resource-version": "1593511173712",
+      "type": "Allotted Resource",
+      "allotted-resource-name": "Allotted_DemoEmbb",
+      "relationship-list": {
+        "relationship": [{
+          "related-to": "service-instance",
+          "relationship-label": "org.onap.relationships.inventory.Uses",
+          "related-link": "/aai/v19/business/customers/customer/5GCustomer/service-subscriptions/service-subscription/5G/service-instances/service-instance/ea107578-9854-4718-8145-7c7febf0de6c",
+          "relationship-data": [{
+            "relationship-key": "customer.global-customer-id",
+            "relationship-value": "5GCustomer"
+          }, {
+            "relationship-key": "service-subscription.service-type",
+            "relationship-value": "5G"
+          }, {
+            "relationship-key": "service-instance.service-instance-id",
+            "relationship-value": "ea107578-9854-4718-8145-7c7febf0de6c"
+          }],
+          "related-to-property": [{
+            "property-key": "service-instance.service-instance-name",
+            "property-value": "nsi_DemoEmbb"
+          }]
+        }]
+      }
+    }]
+  },
+  "slice-profiles": {
+    "slice-profile": [{
+    "profile-id": "b86df550-9d70-452b-a5a9-eb8823417255",
+    "latency": 6,
+    "max-number-of-UEs": 0,
+    "coverage-area-TA-list": "Beijing;Beijing;HaidianDistrict;WanshouluStreet",
+    "ue-mobility-level": "stationary",
+    "resource-sharing-level": "0",
+    "exp-data-rate-UL": 500,
+    "exp-data-rate-DL": 1000,
+    "activity-factor": 0,
+    "e2e-latency": 0,
+    "jitter": 0,
+    "survival-time": 0,
+    "exp-data-rate": 0,
+    "payload-size": 0,
+    "traffic-density": 0,
+    "conn-density": 0,
+    "s-nssai": "01-5B179BD4",
+    "resource-version": "1593511356725"
+  }]
+  }
+}"""
+    }
+}
\ No newline at end of file
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateTnNssiTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateTnNssiTest.groovy
new file mode 100644 (file)
index 0000000..6ea2be8
--- /dev/null
@@ -0,0 +1,169 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ #
+ # Licensed under the Apache License, Version 2.0 (the "License")
+ # you may not use this file except in compliance with the License.
+ # You may obtain a copy of the License at
+ #
+ #       http://www.apache.org/licenses/LICENSE-2.0
+ #
+ # Unless required by applicable law or agreed to in writing, software
+ # distributed under the License is distributed on an "AS IS" BASIS,
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ # See the License for the specific language governing permissions and
+ # limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.bpmn.infrastructure.scripts
+
+import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity
+import org.junit.Before
+import org.junit.Test
+import org.mockito.ArgumentCaptor
+import org.mockito.Captor
+import org.mockito.Mockito
+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
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types
+import org.onap.so.bpmn.common.scripts.MsoGroovyTest
+
+import static org.junit.Assert.assertNotNull
+import static org.mockito.ArgumentMatchers.eq
+import static org.mockito.Mockito.*
+
+class DoAllocateTnNssiTest extends MsoGroovyTest {
+    @Before
+    void init() throws IOException {
+        super.init("DoAllocateTnNssiTest")
+    }
+
+    @Captor
+    static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class)
+
+    @Test
+    void testPreProcessRequest() {
+        when(mockExecution.getVariable("msoRequestId")).thenReturn("4c614769-f58a-4556-8ad9-dcd903077c82")
+        when(mockExecution.getVariable("mso.workflow.sdncadapter.callback")).thenReturn("http://localhost:8090/SDNCAdapterCallback")
+        when(mockExecution.getVariable("modelInvariantUuid")).thenReturn("f85cbcc0-ad74-45d7-a5a1-17c8744fdb71")
+        when(mockExecution.getVariable("modelUuid")).thenReturn("36a3a8ea-49a6-4ac8-b06c-89a54544b9b6")
+        //when(mockExecution.getVariable("serviceInstanceID")).thenReturn("eb0863e9-a69b-4b17-8a56-f05ad110bef7")
+        //when(mockExecution.getVariable("operationId")).thenReturn("998c2081-5a71-4a39-9ae6-d6b7c5bb50c0")
+        when(mockExecution.getVariable("operationType")).thenReturn("opTypeTest")
+        when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer")
+        when(mockExecution.getVariable("servicename")).thenReturn("5G-test")
+        when(mockExecution.getVariable("networkType")).thenReturn("5G-network")
+        when(mockExecution.getVariable("subscriptionServiceType")).thenReturn("5G-service")
+        when(mockExecution.getVariable("nsiId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56")
+        when(mockExecution.getVariable("jobId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4")
+        when(mockExecution.getVariable("sliceParams")).thenReturn(mockSliceParams())
+
+        TnAllocateNssi obj = new TnAllocateNssi()
+        obj.preProcessRequest(mockExecution)
+        Mockito.verify(mockExecution, times(1)).setVariable(eq("sliceServiceInstanceId"), captor.capture())
+        String sliceServiceInstanceId = captor.getValue()
+        assertNotNull(sliceServiceInstanceId)
+    }
+
+    @Test
+    void testCreateServiceInstance() {
+        when(mockExecution.getVariable("sliceServiceInstanceId")).thenReturn("5ad89cf9-0569-4a93-9306-d8324321e2be")
+        when(mockExecution.getVariable("sliceServiceInstanceName")).thenReturn("5G-service")
+        when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer")
+        when(mockExecution.getVariable("subscriptionServiceType")).thenReturn("5G")
+        when(mockExecution.getVariable("modelInvariantUuid")).thenReturn("f85cbcc0-ad74-45d7-a5a1-17c8744fdb71")
+        when(mockExecution.getVariable("modelUuid")).thenReturn("36a3a8ea-49a6-4ac8-b06c-89a54544b9b6")
+        when(mockExecution.getVariable("sliceProfile")).thenReturn(mockSliceProfile())
+
+//        JsonUtils jsonUtil = new JsonUtils()
+//        String sliceProfile = jsonUtil.getJsonValue(mockSliceParams(), "sliceProfile")
+//        when(mockExecution.getVariable("sliceProfile")).thenReturn(sliceProfile)
+
+        AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer("5GCustomer").serviceSubscription("5G").serviceInstance("5ad89cf9-0569-4a93-9306-d8324321e2be"))
+        DoCreateTnNssiInstance obj = spy(DoCreateTnNssiInstance.class)
+        when(obj.getAAIClient()).thenReturn(client)
+
+        obj.createServiceInstance(mockExecution)
+    }
+
+
+    private String mockSliceParams() {
+        String expect = """{
+    "sliceProfile": {
+      "snssaiList": [
+        "001-100001"
+      ],
+      "sliceProfileId": "ab9af40f13f721b5f13539d87484098",
+      "plmnIdList": [
+        "460-00",
+        "460-01"
+      ],
+      "perfReq": {
+      },
+      "coverageAreaTAList": [
+      ],
+      "latency": 2,
+      "maxBandwidth": 100,
+      "resourceSharingLevel": "non-shared"
+    },
+    "transportSliceNetworks": [
+            {
+                "connectionLinks": [
+                    {
+                        "transportEndpointA": "tranportEp_ID_XXX",
+                        "transportEndpointB": "tranportEp_ID_YYY"
+                    },
+                    {
+                        "transportEndpointA": "tranportEp_ID_AAA",
+                        "transportEndpointB": "tranportEp_ID_BBB"
+                    }
+                ]
+            },
+            {
+                "connectionLinks": [
+                    {
+                        "transportEndpointA": "tranportEp_ID_CCC",
+                        "transportEndpointB": "tranportEp_ID_DDD"
+                    },
+                    {
+                        "transportEndpointA": "tranportEp_ID_EEE",
+                        "transportEndpointB": "tranportEp_ID_FFF"
+                    }
+                ]
+            }
+    ],
+    "nsiInfo": {
+      "nsiId": "NSI-M-001-HDBNJ-NSMF-01-A-ZX",
+      "nsiName": "eMBB-001"
+    },
+    "scriptName": "AN1"
+        }"""
+        return expect.replaceAll("\\\\s+", "")
+    }
+
+    private String mockSliceProfile() {
+        String expect = """{
+      "snssaiList": [
+        "001-100001"
+      ],
+      "sliceProfileId": "ab9af40f13f721b5f13539d87484098",
+      "plmnIdList": [
+        "460-00",
+        "460-01"
+      ],
+      "perfReq": {
+      },
+      "coverageAreaTAList": [
+      ],
+      "latency": 2,
+      "maxBandwidth": 100,
+      "resourceSharingLevel": "non-shared"
+     }"""
+        return expect.replaceAll("\\\\s+", "")
+    }
+}
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
new file mode 100644 (file)
index 0000000..2c943ff
--- /dev/null
@@ -0,0 +1,585 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020  Telecom Italia
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.scripts
+
+import 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.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.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.MsoGroovyTest
+import org.onap.so.serviceinstancebeans.RequestDetails
+
+import static org.junit.Assert.assertNotNull
+import static org.junit.Assert.assertTrue
+import static org.mockito.Mockito.*
+
+class DoCommonCoreNSSITest extends MsoGroovyTest {
+    @Before
+    void init() throws IOException {
+        super.init("DoCommonCoreNSSITest")
+    }
+
+
+    @Test
+    void testPreProcessRequest() {
+        def currentNSSI = [:]
+        currentNSSI.put("nssiId","5G-999")
+        when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI)
+
+        DoCommonCoreNSSI dcnssi = new DoCommonCoreNSSI()
+        dcnssi.preProcessRequest(mockExecution)
+        Mockito.verify(mockExecution,times(1)).getVariable("currentNSSI")
+    }
+
+
+    @Test
+    void testGetNetworkServiceInstance() {
+        def currentNSSI = [:]
+        currentNSSI.put("nssiId","5G-999")
+
+        when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI)
+
+        AAIResourceUri nssiUri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment("5G-999"))
+        AAIResourceUri networkServiceInstanceUri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment("NS-777"))
+
+        ServiceInstance nssi = new ServiceInstance()
+        nssi.setServiceInstanceId("5G-999")
+
+        ServiceInstance networkServiceInstance = new ServiceInstance()
+        networkServiceInstance.setServiceInstanceId("NS-777")
+        networkServiceInstance.setServiceRole("Network Service")
+
+        Optional<ServiceInstance> nssiOpt = Optional.of(nssi)
+        Optional<ServiceInstance> networkServiceInstaneOpt = Optional.of(networkServiceInstance)
+
+        DoCommonCoreNSSI spy = spy(DoCommonCoreNSSI.class)
+        when(spy.getAAIClient()).thenReturn(client)
+
+        when(client.get(ServiceInstance.class, nssiUri)).thenReturn(nssiOpt)
+
+        //String json = FileUtil.readResourceFile("__files/AAI/ServiceInstanceWithAR.json")
+        AAIResultWrapper wrapperMock = mock(AAIResultWrapper.class) //new AAIResultWrapper(json)
+        Relationships rsMock = mock(Relationships.class)
+        Optional<Relationships> orsMock = Optional.of(rsMock)
+        List<AAIResourceUri> arus = new ArrayList<>()
+        AAIResourceUri aru = new ServiceInstanceUri(networkServiceInstanceUri)
+        arus.add(aru)
+
+        when(client.get(nssiUri)).thenReturn(wrapperMock)
+        when(wrapperMock.getRelationships()).thenReturn(orsMock)
+
+        when(rsMockgetRelatedUris(Types.SERVICE_INSTANCE)).thenReturn(arus)
+        when(client.get(ServiceInstance.class, aru)).thenReturn(networkServiceInstaneOpt)
+
+        spy.getNetworkServiceInstance(mockExecution)
+
+        assertTrue("Either NSSI doesn't exist or unexpected NSSI Service Instance ID",
+                currentNSSI.get("nssi") != null && ((ServiceInstance)currentNSSI.get("nssi")).getServiceInstanceId().equals(nssi.getServiceInstanceId()))
+
+        assertTrue("Either Network Service Instance doesn't exist or unexpected Network Service Instance ID",
+                currentNSSI.get("networkServiceInstance") != null && ((ServiceInstance)currentNSSI.get("networkServiceInstance")).getServiceInstanceId().equals(networkServiceInstance.getServiceInstanceId()))
+
+        assertNotNull("networkServiceInstanceUri doesn't exist", currentNSSI.get("networkServiceInstanceUri"))
+    }
+
+
+    @Test
+    void getConstituteVNFFromNetworkServiceInst() {
+        def currentNSSI = [:]
+
+        when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI)
+
+        DoCommonCoreNSSI spy = spy(DoCommonCoreNSSI.class)
+        when(spy.getAAIClient()).thenReturn(client)
+
+        ServiceInstance networkServiceInstance = new ServiceInstance()
+        networkServiceInstance.setServiceInstanceId("NS-777")
+        networkServiceInstance.setServiceRole("Network Service")
+
+        GenericVnf genericVNF = new GenericVnf()
+        genericVNF.setVnfId("VNF-1")
+
+        AAIResourceUri networkServiceInstanceUri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(networkServiceInstance.getServiceInstanceId()))
+
+        Optional<GenericVnf> genericVnfOpt = Optional.of(genericVNF)
+        AAIResourceUri genericVNFUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(genericVNF.getVnfId()))
+
+        currentNSSI.put("networkServiceInstanceUri", networkServiceInstanceUri)
+        currentNSSI.put("networkServiceInstance", networkServiceInstance)
+
+        AAIResultWrapper wrapperMock = mock(AAIResultWrapper.class) //new AAIResultWrapper(json)
+        Relationships rsMock = mock(Relationships.class)
+        Optional<Relationships> orsMock = Optional.of(rsMock)
+        List<AAIResourceUri> arus = new ArrayList<>()
+        AAIResourceUri aru = new AAISimpleUri(genericVNFUri)
+        arus.add(aru)
+
+        when(client.get(networkServiceInstanceUri)).thenReturn(wrapperMock)
+        when(wrapperMock.getRelationships()).thenReturn(orsMock)
+
+        when(rsMockgetRelatedUris(Types.GENERIC_VNF)).thenReturn(arus)
+        when(client.get(GenericVnf.class, genericVNFUri)).thenReturn(genericVnfOpt)
+
+        spy.getConstituteVNFFromNetworkServiceInst(mockExecution)
+
+        assertNotNull("constituteVnfUri doesn't exist", currentNSSI.get("constituteVnfUri"))
+
+        assertTrue("Either Constitute VNF doesn't exist or unexpected VNF ID",
+                currentNSSI.get("constituteVnf") != null && ((GenericVnf)currentNSSI.get("constituteVnf")).getVnfId().equals(genericVNF.getVnfId()))
+    }
+
+
+    @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)
+
+        DoCommonCoreNSSI obj = new DoCommonCoreNSSI()
+        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 testInvokePUTServiceInstance() {
+        def currentNSSI = [:]
+
+        ServiceInstance networkServiceInstance = new ServiceInstance()
+        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")
+        when(mockExecution.getVariable("mso.infra.endpoint.auth")).thenReturn("mso.infra.endpoint.auth")
+
+        DoCommonCoreNSSI spy = spy(DoCommonCoreNSSI.class)
+        when(spy.getAAIClient()).thenReturn(client)
+
+        when(spy.encryptBasicAuth("mso.infra.endpoint.auth", "mso.msoKey")).thenReturn("auth-value")
+
+        String authHeaderResponse =  "auth-header"
+
+        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 callPUTServiceInstanceResponse = "put"
+
+        RequestDetails requestDetails = new RequestDetails()
+        ObjectMapper mapper = new ObjectMapper()
+        String requestDetailsStr = mapper.writeValueAsString(requestDetails)
+
+        when(spy.prepareRequestDetails(mockExecution)).thenReturn(requestDetailsStr)
+
+        when(spy.callPUTServiceInstance(urlString, "auth-header", requestDetailsStr)).thenReturn(callPUTServiceInstanceResponse)
+
+        spy.invokePUTServiceInstance(mockExecution)
+    }
+
+
+    @Test
+    void testRemoveSPAssociationWithNSSI() {
+        def currentNSSI = [:]
+
+        when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI)
+
+        String nssiId = "5G-999"
+        currentNSSI.put("nssiId", nssiId)
+        ServiceInstance nssi = new ServiceInstance()
+        nssi.setServiceInstanceId(nssiId)
+        nssi.setSliceProfiles(new SliceProfiles())
+
+        currentNSSI.put("nssi", nssi)
+
+        AAIResourceUri nssiUri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(nssiId))
+
+        DoCommonCoreNSSI spy = spy(DoCommonCoreNSSI.class)
+
+        when(spy.getAAIClient()).thenReturn(client)
+
+        String theSNSSAI = "theS-NSSAI"
+        currentNSSI.put("S-NSSAI", theSNSSAI)
+
+        List<SliceProfile> associatedProfiles = nssi.getSliceProfiles().getSliceProfile()
+
+        SliceProfile sliceProfile1 = new SliceProfile()
+        sliceProfile1.setSNssai("snssai1")
+
+        SliceProfile sliceProfile2 = new SliceProfile()
+        sliceProfile2.setSNssai(theSNSSAI)
+
+        SliceProfile sliceProfile3 = new SliceProfile()
+        sliceProfile3.setSNssai("snssai3")
+
+        associatedProfiles.add(sliceProfile1)
+        associatedProfiles.add(sliceProfile2)
+        associatedProfiles.add(sliceProfile3)
+
+        int sizeBefore = associatedProfiles.size()
+
+        doNothing().when(client).update(nssiUri, nssi)
+
+        spy.removeSPAssociationWithNSSI(mockExecution)
+
+        assertTrue("Association between slice profile and NSSI wasn't removed", ((ServiceInstance)currentNSSI.get("nssi")).getSliceProfiles().getSliceProfile().size() == (sizeBefore - 1))
+    }
+
+
+    @Test
+    void testDeleteSliceProfileInstance() {
+        def currentNSSI = [:]
+
+        when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI)
+
+        String globalSubscriberId = "global-id"
+        String serviceType = "service"
+        String nssiId = "5G-999"
+
+        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)
+
+        DoCommonCoreNSSI spy = spy(DoCommonCoreNSSI.class)
+
+        when(spy.getAAIClient()).thenReturn(client)
+
+        doNothing().when(client).delete(nssiUri)
+
+        spy.deleteSliceProfileInstance(mockExecution)
+
+    }
+
+
+    @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 = [:]
+
+        when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI)
+
+        ServiceInstance networkServiceInstance = new ServiceInstance()
+        networkServiceInstance.setServiceInstanceId("NS-777")
+        networkServiceInstance.setServiceRole("Network Service")
+        networkServiceInstance.setModelInvariantId("model-invariant-id")
+        networkServiceInstance.setServiceInstanceName("service-instance-name")
+
+        ServiceInstance nssi = new ServiceInstance()
+        nssi.setServiceInstanceId("5G-999")
+        nssi.setOrchestrationStatus("orchestration-status")
+
+        AAIResourceUri networkServiceInstanceUri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(networkServiceInstance.getServiceInstanceId()))
+
+        AAIResourceUri cloudRegionAAIUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion("cloud-owner", "cloud-region-id"))
+
+        currentNSSI.put("networkServiceInstanceUri", networkServiceInstanceUri)
+
+        currentNSSI.put("networkServiceInstance", networkServiceInstance)
+
+        currentNSSI.put("globalSubscriberId", "globalSubscriberId")
+
+        currentNSSI.put("subscriberName", "subscriber-name")
+
+        currentNSSI.put("serviceId", "service-id")
+
+        currentNSSI.put("nssi", nssi)
+
+        List<SliceProfile> associatedProfiles = new ArrayList<>()
+        SliceProfile sliceProfile1 = new SliceProfile()
+        sliceProfile1.setSNssai("snssai1")
+
+        SliceProfile sliceProfile2 = new SliceProfile()
+        sliceProfile2.setSNssai("snssai2")
+
+        associatedProfiles.add(sliceProfile1)
+        associatedProfiles.add(sliceProfile2)
+
+        List<String> snssais = new ArrayList<>()
+        snssais.add(sliceProfile1.getSNssai())
+        snssais.add(sliceProfile2.getSNssai())
+
+        currentNSSI.put("S-NSSAIs", snssais)
+
+
+        ServiceSubscription serviceSubscription = new ServiceSubscription()
+        serviceSubscription.setServiceType("service-type")
+
+        currentNSSI.put("serviceSubscription", serviceSubscription)
+
+        GenericVnf genericVnf = new GenericVnf()
+        genericVnf.setServiceId("service-id")
+        genericVnf.setVnfName("vnf-name")
+        genericVnf.setModelInvariantId("model-invariant-id")
+        genericVnf.setModelCustomizationId("model-customization-id")
+        genericVnf.setVnfName("vnf-name")
+        genericVnf.setVnfId("vnf-id")
+
+        VfModule vfModule = new VfModule()
+        vfModule.setModelInvariantId("model-invariant-id")
+        vfModule.setModelCustomizationId("model-customization-id")
+        vfModule.setModelVersionId("model-version-id")
+        vfModule.setVfModuleName("vf-module-name")
+
+        VfModules vfModules = new VfModules()
+        vfModules.getVfModule().add(vfModule)
+        genericVnf.setVfModules(vfModules)
+
+        currentNSSI.put("constituteVnf", genericVnf)
+
+        AAIResourceUri constituteVNFURI = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(genericVnf.getVnfId()))
+
+        currentNSSI.put("constituteVnfUri", constituteVNFURI)
+
+        DoCommonCoreNSSI spy = spy(DoCommonCoreNSSI.class)
+
+        when(spy.getAAIClient()).thenReturn(client)
+
+        prepareModelVer(networkServiceInstance)
+
+        //prepareSubscriberInfo(networkServiceInstanceUri)
+
+        prepareCloudConfiguration(constituteVNFURI, cloudRegionAAIUri)
+
+        prepareModelVer(genericVnf)
+
+        prepareModelVer(vfModule)
+
+        prepareOwningEntity(networkServiceInstanceUri)
+
+        prepareProject(cloudRegionAAIUri)
+
+        String requestDetails = spy.prepareRequestDetails(mockExecution)
+
+    }
+
+
+    void prepareProject(AAIResourceUri cloudRegionAAIUri) {
+        Project project = new Project()
+        project.setProjectName("project-name")
+
+        AAIResultWrapper wrapperMock = mock(AAIResultWrapper.class)
+        Relationships rsMock = mock(Relationships.class)
+        Optional<Relationships> orsMock = Optional.of(rsMock)
+
+        when(client.get(cloudRegionAAIUri)).thenReturn(wrapperMock)
+        when(wrapperMock.getRelationships()).thenReturn(orsMock)
+
+        List<AAIResourceUri> arus = new ArrayList<>()
+        AAIResourceUri aru = new AAISimpleUri(cloudRegionAAIUri)
+        arus.add(aru)
+
+        when(rsMockgetRelatedUris(Types.PROJECT)).thenReturn(arus)
+
+        Optional<Project> projectOpt = Optional.of(project)
+
+        when(client.get(Project.class, aru)).thenReturn(projectOpt)
+    }
+
+
+    void prepareOwningEntity(AAIResourceUri networkServiceInstanceUri) {
+        OwningEntity owningEntity = new OwningEntity()
+
+        owningEntity.setOwningEntityId("owning-entity-id")
+        owningEntity.setOwningEntityName("owning-entity-name")
+
+        AAIResultWrapper wrapperMock = mock(AAIResultWrapper.class)
+
+        Relationships rsMock = mock(Relationships.class)
+        Optional<Relationships> orsMock = Optional.of(rsMock)
+
+        when(client.get(networkServiceInstanceUri)).thenReturn(wrapperMock)
+        when(wrapperMock.getRelationships()).thenReturn(orsMock)
+
+        List<AAIResourceUri> arus = new ArrayList<>()
+        AAIResourceUri aru = new AAISimpleUri(networkServiceInstanceUri)
+        arus.add(aru)
+
+        when(rsMockgetRelatedUris(Types.OWNING_ENTITY)).thenReturn(arus)
+
+        Optional<OwningEntity> owningEntityOpt = Optional.of(owningEntity)
+
+        when(client.get(OwningEntity.class, aru)).thenReturn(owningEntityOpt)
+    }
+
+
+
+    void prepareCloudConfiguration(AAIResourceUri constituteVNFURI, cloudRegionAAIUri) {
+        AAIResultWrapper wrapperMock = mock(AAIResultWrapper.class)
+
+        Relationships rsMock = mock(Relationships.class)
+        Optional<Relationships> orsMock = Optional.of(rsMock)
+
+        when(client.get(constituteVNFURI)).thenReturn(wrapperMock)
+        when(wrapperMock.getRelationships()).thenReturn(orsMock)
+
+        List<AAIResourceUri> arus = new ArrayList<>()
+        AAIResourceUri aru = new AAISimpleUri(cloudRegionAAIUri)
+        arus.add(aru)
+
+        when(rsMockgetRelatedUris(Types.CLOUD_REGION)).thenReturn(arus)
+
+        CloudRegion cloudRegion = new CloudRegion()
+        cloudRegion.setCloudRegionId("cloud-region-id")
+        cloudRegion.setCloudOwner("cloud-owner")
+        Tenant tenant = new Tenant()
+        tenant.setTenantId("tenant-id")
+
+        Tenants tenants = new Tenants()
+        tenants.getTenant().add(tenant)
+        cloudRegion.setTenants(tenants)
+        Optional<CloudRegion> cloudRegionOpt = Optional.of(cloudRegion)
+
+        when(client.get(CloudRegion.class, aru)).thenReturn(cloudRegionOpt)
+    }
+
+
+    void prepareSubscriberInfo( AAIResourceUri networkServiceInstanceUri) {
+        AAIResultWrapper wrapperMock = mock(AAIResultWrapper.class)
+
+        Relationships rsMock = mock(Relationships.class)
+        Optional<Relationships> orsMock = Optional.of(rsMock)
+
+        when(client.get(networkServiceInstanceUri)).thenReturn(wrapperMock)
+        when(wrapperMock.getRelationships()).thenReturn(orsMock)
+
+        AAIResourceUri serviceSubscriptionUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer("global-customer-id").serviceSubscription("service-type"))
+
+        AAIResourceUri customerUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer("global-customer-id"))
+        List<AAIResourceUri> arus = new ArrayList<>()
+
+        arus.add(serviceSubscriptionUri)
+
+        when(rsMockgetRelatedUris(Types.SERVICE_SUBSCRIPTION)).thenReturn(arus)
+
+        ServiceSubscription serviceSubscription = new ServiceSubscription()
+        serviceSubscription.setServiceType("service-type")
+        Optional<ServiceSubscription> serviceSubscriptionOpt = Optional.of(serviceSubscription)
+
+        when(client.get(ServiceSubscription.class, serviceSubscriptionUri)).thenReturn(serviceSubscriptionOpt)
+
+        when(client.get(networkServiceInstanceUri)).thenReturn(wrapperMock)
+
+        when(rsMockgetRelatedUris(Types.CUSTOMER)).thenReturn(arus)
+
+        Customer customer = new Customer()
+        customer.setSubscriberName("subscriber-name")
+        Optional<Customer> customerOpt = Optional.of(customer)
+
+        when(client.get(Customer.class, customerUri)).thenReturn(customerOpt)
+    }
+
+
+    void prepareModelVer(ServiceInstance networkServiceInstance) {
+        ModelVer modelVer = new ModelVer()
+        modelVer.setModelVersionId("model-version-id")
+        modelVer.setModelName("model-name")
+        modelVer.setModelVersion("model-version")
+
+        Optional<ModelVer> modelVerOpt = Optional.of(modelVer)
+
+        AAIResourceUri modelVerUrl = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.serviceDesignAndCreation().model(networkServiceInstance.getModelInvariantId()).modelVer(networkServiceInstance.getModelVersionId()))
+        when(client.get(ModelVer.class, modelVerUrl)).thenReturn(modelVerOpt)
+    }
+
+    void prepareModelVer(GenericVnf genericVnf) {
+        ModelVer modelVer = new ModelVer()
+        modelVer.setModelVersionId("model-version-id")
+        modelVer.setModelName("model-name")
+        modelVer.setModelVersion("model-version")
+
+        Optional<ModelVer> modelVerOpt = Optional.of(modelVer)
+
+        AAIResourceUri modelVerUrl = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.serviceDesignAndCreation().model(genericVnf.getModelInvariantId()).modelVer(genericVnf.getModelVersionId()))
+        when(client.get(ModelVer.class, modelVerUrl)).thenReturn(modelVerOpt)
+    }
+
+    void prepareModelVer(VfModule vfModule) {
+        ModelVer modelVer = new ModelVer()
+        modelVer.setModelVersionId("model-version-id")
+        modelVer.setModelName("model-name")
+        modelVer.setModelVersion("model-version")
+
+        Optional<ModelVer> modelVerOpt = Optional.of(modelVer)
+
+        AAIResourceUri modelVerUrl = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.serviceDesignAndCreation().model(vfModule.getModelInvariantId()).modelVer(vfModule.getModelVersionId()))
+        when(client.get(ModelVer.class, modelVerUrl)).thenReturn(modelVerOpt)
+    }
+}
index 32ebf09..0de2c8c 100644 (file)
@@ -35,6 +35,8 @@ import org.onap.so.bpmn.common.scripts.MsoGroovyTest
 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
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types
 import javax.ws.rs.NotFoundException
 import static org.junit.Assert.assertEquals
 import static org.mockito.ArgumentMatchers.isA
@@ -65,8 +67,8 @@ class DoCreateVFCNetworkServiceInstanceTest extends MsoGroovyTest {
         when(mockExecution.getVariable("serviceId")).thenReturn("SER12345")
         doNothing().when(client).connect(isA(AAIResourceUri.class),isA(AAIResourceUri.class))
         doCreateVFCNetworkServiceInstance.addNSRelationship(mockExecution);
-        AAIResourceUri nsUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,"MSO_dev","MSO-dev-service-type","NS12345")
-        AAIResourceUri relatedServiceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,"MSO_dev","MSO-dev-service-type","SER12345")
+        AAIResourceUri nsUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer("MSO_dev").serviceSubscription("MSO-dev-service-type").serviceInstance("NS12345"))
+        AAIResourceUri relatedServiceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer("MSO_dev").serviceSubscription("MSO-dev-service-type").serviceInstance("SER12345"))
         Mockito.verify(client).connect(nsUri,relatedServiceUri)
     }
 
index b2573f1..1a15f0e 100644 (file)
@@ -43,11 +43,12 @@ import org.onap.so.bpmn.common.scripts.utils.XmlComparator
 import org.onap.so.bpmn.core.RollbackData
 import org.onap.so.bpmn.core.WorkflowException
 import org.onap.so.bpmn.mock.FileUtil
-import org.onap.aaiclient.client.aai.AAIObjectPlurals
 import org.onap.aaiclient.client.aai.AAIObjectType
 import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri
 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.aaiclient.client.graphinventory.exceptions.GraphInventoryUriComputationException
 
 import javax.ws.rs.NotFoundException
@@ -169,7 +170,7 @@ class DoCreateVfModuleRollbackTest extends MsoGroovyTest{
         fqdnList.add("test")
         when(mockExecution.getVariable(prefix + "createdNetworkPolicyFqdnList")).thenReturn(fqdnList)
 
-        AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY)
+        AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().networkPolicies())
         uri.queryParam("network-policy-fqdn", "test")
         NetworkPolicies networkPolicies = new NetworkPolicies();
         NetworkPolicy networkPolicy = new NetworkPolicy();
@@ -177,7 +178,7 @@ class DoCreateVfModuleRollbackTest extends MsoGroovyTest{
         networkPolicies.getNetworkPolicy().add(networkPolicy)
         when(client.get(NetworkPolicies.class, uri)).thenReturn(Optional.of(networkPolicies))
 
-        AAIResourceUri delUri = AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, networkPolicy.getNetworkPolicyId())
+        AAIResourceUri delUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().networkPolicy(networkPolicy.getNetworkPolicyId()))
         doNothing().when(client).delete(delUri)
 
         doCreateVfModuleRollback.deleteNetworkPoliciesFromAAI(mockExecution)
@@ -199,7 +200,7 @@ class DoCreateVfModuleRollbackTest extends MsoGroovyTest{
         fqdnList.add("test")
         when(mockExecution.getVariable(prefix + "createdNetworkPolicyFqdnList")).thenReturn(fqdnList)
 
-        AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY)
+        AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().networkPolicies())
         uri.queryParam("network-policy-fqdn", "test")
         NetworkPolicies networkPolicies = new NetworkPolicies();
         NetworkPolicy networkPolicy = new NetworkPolicy();
@@ -207,7 +208,7 @@ class DoCreateVfModuleRollbackTest extends MsoGroovyTest{
         networkPolicies.getNetworkPolicy().add(networkPolicy)
         when(client.get(NetworkPolicies.class, uri)).thenReturn(Optional.of(networkPolicies))
 
-        AAIResourceUri delUri = AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, networkPolicy.getNetworkPolicyId())
+        AAIResourceUri delUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().networkPolicy(networkPolicy.getNetworkPolicyId()))
         doThrow(new NotFoundException("Not Found!")).when(client).delete(delUri)
 
         doCreateVfModuleRollback.deleteNetworkPoliciesFromAAI(mockExecution)
@@ -229,7 +230,7 @@ class DoCreateVfModuleRollbackTest extends MsoGroovyTest{
         fqdnList.add("test")
         when(mockExecution.getVariable(prefix + "createdNetworkPolicyFqdnList")).thenReturn(fqdnList)
 
-        AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY)
+        AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().networkPolicies())
         uri.queryParam("network-policy-fqdn", "test")
         NetworkPolicies networkPolicies = new NetworkPolicies();
         NetworkPolicy networkPolicy = new NetworkPolicy();
@@ -237,7 +238,7 @@ class DoCreateVfModuleRollbackTest extends MsoGroovyTest{
         networkPolicies.getNetworkPolicy().add(networkPolicy)
         when(client.get(NetworkPolicies.class, uri)).thenReturn(Optional.of(networkPolicies))
 
-        AAIResourceUri delUri = AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, networkPolicy.getNetworkPolicyId())
+        AAIResourceUri delUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().networkPolicy(networkPolicy.getNetworkPolicyId()))
         doThrow(new GraphInventoryUriComputationException("Error!")).when(client).delete(delUri)
         try {
             doCreateVfModuleRollback.deleteNetworkPoliciesFromAAI(mockExecution)
index cc52254..1bc6fc5 100644 (file)
 
 package org.onap.so.bpmn.infrastructure.scripts;
 
+import static org.mockito.Mockito.spy
+import static org.mockito.Mockito.when;
 import org.junit.Before;
 import org.junit.Test
-import org.onap.aai.domain.yang.VfModule
 import org.onap.aai.domain.yang.VolumeGroup
 import org.onap.aai.domain.yang.VolumeGroups;
-import org.onap.so.bpmn.common.scripts.MsoGroovyTest
-import org.onap.aaiclient.client.aai.AAIObjectPlurals
 import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri
-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.MsoGroovyTest
 import org.onap.so.constants.Defaults
 
-import static org.mockito.Mockito.spy
-import static org.mockito.Mockito.when;
-
 public class DoCreateVfModuleVolumeRollbackTest extends MsoGroovyTest {
 
     private  DoCreateVfModuleVolumeRollback doCreateVfModuleVolumeRollback;
@@ -51,7 +49,7 @@ public class DoCreateVfModuleVolumeRollbackTest extends MsoGroovyTest {
         String cloudRegionId = "cloudRegionId"
         when(mockExecution.getVariable("DCVFMODVOLRBK_volumeGroupName")).thenReturn(volumeGroupName)
         when(mockExecution.getVariable("DCVFMODVOLRBK_lcpCloudRegionId")).thenReturn(cloudRegionId)
-        AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VOLUME_GROUP, Defaults.CLOUD_OWNER.toString(), cloudRegionId).queryParam("volume-group-name", volumeGroupName)
+        AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(Defaults.CLOUD_OWNER.toString(), cloudRegionId).volumeGroups()).queryParam("volume-group-name", volumeGroupName)
         VolumeGroup volumeGroup = new VolumeGroup();
         volumeGroup.setVolumeGroupId("volumeGroupId")
         VolumeGroups groups = new VolumeGroups();
index 7aa162c..d417abc 100644 (file)
 
 package org.onap.so.bpmn.infrastructure.scripts
 
+import static org.junit.Assert.assertEquals
+import static org.junit.Assert.assertNotNull
+import static org.mockito.ArgumentMatchers.anyObject
+import static org.mockito.Mockito.spy
+import static org.mockito.Mockito.times
+import static org.mockito.Mockito.verify
+import static org.mockito.Mockito.when
 import org.camunda.bpm.engine.delegate.BpmnError
 import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity
 import org.junit.Before
-import org.junit.Rule
 import org.junit.Test
-import org.junit.rules.ExpectedException
-import org.junit.runner.RunWith
 import org.mockito.ArgumentCaptor
 import org.mockito.Captor
 import org.mockito.Mockito
 import org.mockito.MockitoAnnotations
-import org.mockito.runners.MockitoJUnitRunner
 import org.onap.aai.domain.yang.GenericVnf
-import org.onap.aai.domain.yang.Volume
 import org.onap.aai.domain.yang.VolumeGroup
 import org.onap.aai.domain.yang.VolumeGroups
-import org.onap.so.bpmn.common.scripts.MsoGroovyTest
-import org.onap.so.bpmn.core.RollbackData
-import org.onap.aaiclient.client.aai.AAIObjectPlurals
 import org.onap.aaiclient.client.aai.AAIObjectType
 import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri
 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.MsoGroovyTest
+import org.onap.so.bpmn.core.RollbackData
 import org.onap.so.constants.Defaults
 
-import static org.junit.Assert.assertEquals
-import static org.junit.Assert.assertNotNull
-import static org.mockito.ArgumentMatchers.anyObject
-import static org.mockito.Mockito.spy
-import static org.mockito.Mockito.times
-import static org.mockito.Mockito.verify
-import static org.mockito.Mockito.when
-
 
 class DoCreateVfModuleVolumeV2Test extends MsoGroovyTest {
 
@@ -161,7 +156,7 @@ class DoCreateVfModuleVolumeV2Test extends MsoGroovyTest {
                String lcpCloudRegionId = "lcpCloudRegionId"
                when(mockExecution.getVariable(volumeGroupName)).thenReturn(volumeGroupName)
                when(mockExecution.getVariable(lcpCloudRegionId)).thenReturn(lcpCloudRegionId)
-               AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VOLUME_GROUP, Defaults.CLOUD_OWNER.toString(), lcpCloudRegionId).queryParam("volume-group-name", volumeGroupName)
+               AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(Defaults.CLOUD_OWNER.toString(), lcpCloudRegionId).volumeGroups()).queryParam("volume-group-name", volumeGroupName)
                VolumeGroups volumeGroups = new VolumeGroups();
                VolumeGroup volumeGroup = new  VolumeGroup()
                volumeGroup.setVolumeGroupId("volumeGroupId")
@@ -177,7 +172,7 @@ class DoCreateVfModuleVolumeV2Test extends MsoGroovyTest {
                String lcpCloudRegionId = "lcpCloudRegionId"
                when(mockExecution.getVariable(volumeGroupName)).thenReturn(volumeGroupName)
                when(mockExecution.getVariable(lcpCloudRegionId)).thenReturn(lcpCloudRegionId)
-               AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VOLUME_GROUP, Defaults.CLOUD_OWNER.toString(), lcpCloudRegionId).queryParam("volume-group-name", volumeGroupName)
+               AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(Defaults.CLOUD_OWNER.toString(), lcpCloudRegionId).volumeGroups()).queryParam("volume-group-name", volumeGroupName)
                when(client.get(VolumeGroup.class,uri)).thenReturn(Optional.empty())
                thrown.expect(BpmnError.class)
                doCreateVfModuleVolumeV2.callRESTQueryAAIVolGrpName(mockExecution,null)
@@ -215,7 +210,7 @@ class DoCreateVfModuleVolumeV2Test extends MsoGroovyTest {
        void testcallRESTQueryAAIGenericVnf(){
                String vnfId = "vnfId"
                when(mockExecution.getVariable(vnfId)).thenReturn(vnfId)
-               AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
+               AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId))
                GenericVnf genericVnf = new GenericVnf()
                genericVnf.setVnfId(vnfId)
                when(client.get(GenericVnf.class,uri)).thenReturn(Optional.of(genericVnf))
@@ -227,7 +222,7 @@ class DoCreateVfModuleVolumeV2Test extends MsoGroovyTest {
        void testcallRESTQueryAAIGenericVnf_NotFound(){
                String vnfId = "vnfId"
                when(mockExecution.getVariable(vnfId)).thenReturn(vnfId)
-               AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
+               AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId))
                when(client.get(GenericVnf.class,uri)).thenReturn(Optional.empty())
                thrown.expect(BpmnError.class)
                doCreateVfModuleVolumeV2.callRESTQueryAAIGenericVnf(mockExecution,null)
index a3b2a1c..2cb351c 100644 (file)
 
 package org.onap.so.bpmn.infrastructure.scripts
 
+import static org.mockito.Mockito.times
+import static org.mockito.Mockito.when
+import javax.ws.rs.core.UriBuilder
 import org.junit.Before
 import org.junit.Test
 import org.mockito.Mockito
 import org.mockito.Spy
 import org.onap.aai.domain.yang.AllottedResource
-import org.onap.so.bpmn.common.scripts.MsoGroovyTest
-import org.onap.so.bpmn.mock.FileUtil
-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 javax.ws.rs.core.UriBuilder
-import static org.mockito.Mockito.times
-import static org.mockito.Mockito.when
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types
+import org.onap.so.bpmn.common.scripts.MsoGroovyTest
+import org.onap.so.bpmn.mock.FileUtil
 
 class DoCustomDeleteE2EServiceInstanceV2Test extends MsoGroovyTest {
 
@@ -49,7 +50,7 @@ class DoCustomDeleteE2EServiceInstanceV2Test extends MsoGroovyTest {
     void testPrepareServiceDeleteResource(){
         when(mockExecution.getVariable("serviceInstance")).thenReturn(FileUtil.readResourceFile("__files/AAI/ServiceInstanceWithAR.json"))
         def relink = "/aai/v11/business/customers/customer/testCustIdInfra/service-subscriptions/service-subscription/HNPORTAL/service-instances/service-instance/testServiceInstanceIdPortalPri/allotted-resources/allotted-resource/testAllottedResourceIdPortalPri"
-        AAIResourceUri uri = AAIUriFactory.createResourceFromExistingURI(AAIObjectType.ALLOTTED_RESOURCE, UriBuilder.fromPath(relink).build())
+        AAIResourceUri uri = AAIUriFactory.createResourceFromExistingURI(Types.ALLOTTED_RESOURCE, UriBuilder.fromPath(relink).build())
         AllottedResource ar = new AllottedResource();
         ar.setId("ar1")
         ar.setType("ar")
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
new file mode 100644 (file)
index 0000000..eae7886
--- /dev/null
@@ -0,0 +1,266 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020  Telecom Italia
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.scripts
+
+
+import org.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.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.MsoGroovyTest
+
+import static org.junit.Assert.assertNotNull
+import static org.junit.Assert.assertTrue
+import static org.mockito.Mockito.*
+
+class DoDeallocateCoreNSSITest extends MsoGroovyTest {
+
+    @Before
+    void init() throws IOException {
+        super.init("DoDeallocateNSSITest")
+    }
+
+
+    @Test
+    void testExecuteTerminateNSSIQuery() {
+
+        def currentNSSI = [:]
+        currentNSSI.put("nssiId","5G-999")
+
+        when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI)
+
+        when(mockExecution.getVariable("mso.oof.endpoint")).thenReturn("http://oof.onap:8088")
+        when(mockExecution.getVariable("mso.oof.auth")).thenReturn("mso.oof.auth")
+        when(mockExecution.getVariable("mso.msoKey")).thenReturn("mso.msoKey")
+        when(mockExecution.getVariable("mso-request-id")).thenReturn("mso-request-id")
+
+        DoDeallocateCoreNSSI spy = spy(DoDeallocateCoreNSSI.class)
+        when(spy.getAAIClient()).thenReturn(client)
+
+        when(spy.encryptBasicAuth("mso.oof.auth", "mso.msoKey")).thenReturn("auth-value")
+
+        String authHeaderResponse =  "auth-header"
+
+      /*  String authHeaderResponse =  "{\n" +
+                " \"errorCode\": \"401\",\n" +
+                " \"errorMessage\": \"Bad request\"\n" +
+                "}" */
+
+        when(spy.getAuthHeader(mockExecution, "auth-value", "mso.msoKey")).thenReturn(authHeaderResponse)
+
+        String urlString = "http://oof.onap:8088"
+
+        String httpRequest =    "{\n" +
+                "  \"type\": \"NSSI\",\n" +
+                "  \"NxIId\": \"5G-999\",\n" +
+                "  \"requestInfo\": {\n" +
+                "    \"transactionId\": \"mso-request-id\",\n" +
+                "    \"requestId\": \"mso-request-id\",\n" +
+                "    \"sourceId\": \"so\",\n" +
+                "    }\n" +
+                "}"
+
+        boolean terminateResponse = true
+
+        String oofResponse =   "{\n" +
+                " \"requestId\": \"mso-request-id\",\n" +
+                " \"transactionId\": \"mso-request-id\",\n" +
+                " \"statusMessage\": \"\",\n" +
+                " \"requestStatus\": \"accepted\",\n" +
+                " \"terminateResponse\": \"${terminateResponse}\",\n" +
+                " \"reason\": \"\"\n" +
+                " }\n"
+
+        String oofCallResponse = oofResponse
+
+      /*  String oofCallResponse =  "{\n" +
+                " \"errorCode\": \"401\",\n" +
+                " \"errorMessage\": \"Exception during the call\"\n" +
+                "}" */
+
+        when(spy.callOOF(urlString, "auth-header", httpRequest)).thenReturn(oofCallResponse)
+
+        spy.executeTerminateNSSIQuery(mockExecution)
+
+        verify(mockExecution).setVariable("isTerminateNSSI", terminateResponse)
+
+    }
+
+
+    @Test
+    void testDeleteServiceOrder() {
+        def currentNSSI = [:]
+        currentNSSI.put("nssiId","5G-999")
+
+        ServiceInstance networkServiceInstance = new ServiceInstance()
+        networkServiceInstance.setServiceInstanceId("NS-777")
+        networkServiceInstance.setServiceRole("Network Service")
+
+        when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI)
+
+        currentNSSI.put("networkServiceInstance", networkServiceInstance)
+
+        when(mockExecution.getVariable("nbi.endpoint.url")).thenReturn("http://nbi.onap:8088")
+        when(mockExecution.getVariable("mso.msoKey")).thenReturn("mso.msoKey")
+        when(mockExecution.getVariable("mso.infra.endpoint.auth")).thenReturn("mso.infra.endpoint.auth")
+
+        DoDeallocateCoreNSSI spy = spy(DoDeallocateCoreNSSI.class)
+        when(spy.getAAIClient()).thenReturn(client)
+
+        when(spy.encryptBasicAuth("mso.infra.endpoint.auth", "mso.msoKey")).thenReturn("auth-value")
+
+        String authHeaderResponse =  "auth-header"
+
+        /*  String authHeaderResponse =  "{\n" +
+                  " \"errorCode\": \"401\",\n" +
+                  " \"errorMessage\": \"Bad request\"\n" +
+                  "}" */
+
+        when(spy.getAuthHeader(mockExecution, "auth-value", "mso.msoKey")).thenReturn(authHeaderResponse)
+
+        String urlString = String.format("http://nbi.onap:8088/api/v4/serviceOrder/%s", networkServiceInstance.getServiceInstanceId())
+
+        String callDeleteServiceOrderResponse = "deleted"
+
+        when(spy.callDeleteServiceOrder(mockExecution, urlString, "auth-header")).thenReturn(callDeleteServiceOrderResponse)
+
+        spy.deleteServiceOrder(mockExecution)
+    }
+
+
+    @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)
+
+        String theSNSSAI = "theS-NSSAI"
+
+        currentNSSI.put("S-NSSAI", theSNSSAI)
+
+        List<SliceProfile> associatedProfiles = new ArrayList<>()
+        SliceProfile sliceProfile1 = new SliceProfile()
+        sliceProfile1.setSNssai("snssai1")
+
+        SliceProfile sliceProfile2 = new SliceProfile()
+        sliceProfile2.setSNssai(theSNSSAI)
+
+        SliceProfile sliceProfile3 = new SliceProfile()
+        sliceProfile3.setSNssai("snssai3")
+
+        associatedProfiles.add(sliceProfile1)
+        associatedProfiles.add(sliceProfile2)
+        associatedProfiles.add(sliceProfile3)
+
+        int sizeBefore = associatedProfiles.size()
+
+        currentNSSI.put("associatedProfiles", associatedProfiles)
+
+        DoDeallocateCoreNSSI obj = new DoDeallocateCoreNSSI()
+        obj.calculateSNSSAI(mockExecution)
+
+        List<SliceProfile> snssais = (List<SliceProfile>)currentNSSI.get("S-NSSAIs")
+        SliceProfile sliceProfileContainsSNSSAI = (SliceProfile)currentNSSI.get("sliceProfileS-NSSAI")
+
+        assertTrue("Either snssais doesn't exist or size is incorrect", (snssais != null && snssais.size() == (sizeBefore - 1)))
+        assertNotNull("Slice Profile which contains given S-NSSAI not found", sliceProfileContainsSNSSAI)
+        assertTrue("Wrong Slice Profile", sliceProfileContainsSNSSAI.getSNssai().equals(theSNSSAI))
+    }
+
+
+    @Test
+    void testRemoveNSSIAssociationWithNSI() {
+        def currentNSSI = [:]
+
+        when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI)
+
+        DoDeallocateCoreNSSI spy = spy(DoDeallocateCoreNSSI.class)
+
+        when(spy.getAAIClient()).thenReturn(client)
+
+        String nssiId = "5G-999"
+        String nsiId = "5G-99"
+        currentNSSI.put("nssiId", nssiId)
+        currentNSSI.put("nsiId", nsiId)
+
+        AAIResourceUri nssiUri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(nssiId))
+        AAIResourceUri nsiUri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(nsiId))
+
+        doNothing().when(client).disconnect(nssiUri, nsiUri)
+
+        spy.removeNSSIAssociationWithNSI(mockExecution)
+
+    }
+
+
+    @Test
+    void testDeleteNSSIServiceInstance() {
+        def currentNSSI = [:]
+
+        when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI)
+
+        String nssiId = "5G-999"
+
+        currentNSSI.put("nssiId", nssiId)
+
+        AAIResourceUri nssiUri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(nssiId))
+
+        DoDeallocateCoreNSSI spy = spy(DoDeallocateCoreNSSI.class)
+
+        when(spy.getAAIClient()).thenReturn(client)
+
+        doNothing().when(client).delete(nssiUri)
+
+        spy.deleteNSSIServiceInstance(mockExecution)
+    }
+
+
+}
index 88140d8..852f053 100644 (file)
@@ -38,6 +38,8 @@ import org.onap.so.client.HttpClientFactory
 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
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types
 
 import javax.ws.rs.core.Response
 
@@ -137,7 +139,7 @@ class DoDeallocateNSSITest extends MsoGroovyTest {
         currentNSSI.put("serviceType","5G")
         when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI)
 
-        AAIResourceUri profileUri = AAIUriFactory.createResourceUri(AAIObjectType.SLICE_PROFILE, "5GCustomer", "5G", "5G-999", "ddf57704-fe8d-417b-882d-2f2a12ddb225")
+        AAIResourceUri profileUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer("5GCustomer").serviceSubscription("5G").serviceInstance("5G-999").sliceProfile("ddf57704-fe8d-417b-882d-2f2a12ddb225"))
         DoDeallocateNSSI obj = spy(DoDeallocateNSSI.class)
         when(obj.getAAIClient()).thenReturn(client)
         when(client.exists(profileUri)).thenReturn(true)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateTnNssiTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateTnNssiTest.groovy
new file mode 100644 (file)
index 0000000..31bd3b5
--- /dev/null
@@ -0,0 +1,138 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ #
+ # Licensed under the Apache License, Version 2.0 (the "License")
+ # you may not use this file except in compliance with the License.
+ # You may obtain a copy of the License at
+ #
+ #       http://www.apache.org/licenses/LICENSE-2.0
+ #
+ # Unless required by applicable law or agreed to in writing, software
+ # distributed under the License is distributed on an "AS IS" BASIS,
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ # See the License for the specific language governing permissions and
+ # limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.bpmn.infrastructure.scripts
+
+import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity
+import org.junit.Before
+import org.junit.Test
+import org.mockito.ArgumentCaptor
+import org.mockito.Captor
+import org.mockito.Mockito
+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
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types
+import org.onap.so.bpmn.common.scripts.MsoGroovyTest
+
+import static org.junit.Assert.assertNotNull
+import static org.mockito.ArgumentMatchers.eq
+import static org.mockito.Mockito.*
+
+
+class DoDeallocateTnNssiTest extends MsoGroovyTest {
+    @Before
+    void init() throws IOException {
+        super.init("DeallocateTnNssiTest")
+    }
+
+    @Captor
+    static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class)
+
+    @Test
+    void testPreProcessRequest() {
+        when(mockExecution.getVariable("msoRequestId")).thenReturn("4c614769-f58a-4556-8ad9-dcd903077c82")
+        when(mockExecution.getVariable("mso.workflow.sdncadapter.callback")).thenReturn("http://localhost:8090/SDNCAdapterCallback")
+        when(mockExecution.getVariable("modelInvariantUuid")).thenReturn("f85cbcc0-ad74-45d7-a5a1-17c8744fdb71")
+        when(mockExecution.getVariable("modelUuid")).thenReturn("36a3a8ea-49a6-4ac8-b06c-89a54544b9b6")
+        when(mockExecution.getVariable("serviceInstanceID")).thenReturn("eb0863e9-a69b-4b17-8a56-f05ad110bef7")
+        when(mockExecution.getVariable("operationId")).thenReturn("998c2081-5a71-4a39-9ae6-d6b7c5bb50c0")
+        when(mockExecution.getVariable("operationType")).thenReturn("opTypeTest")
+        when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer")
+        when(mockExecution.getVariable("servicename")).thenReturn("5G-test")
+        when(mockExecution.getVariable("networkType")).thenReturn("5G-network")
+        when(mockExecution.getVariable("subscriptionServiceType")).thenReturn("5G-service")
+        when(mockExecution.getVariable("nsiId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56")
+        when(mockExecution.getVariable("jobId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4")
+        when(mockExecution.getVariable("sliceParams")).thenReturn("""
+        {
+    "sliceProfile": {
+      "snssaiList": [
+        "001-100001"
+      ],
+      "sliceProfileId": "ab9af40f13f721b5f13539d87484098",
+      "plmnIdList": [
+        "460-00",
+        "460-01"
+      ],
+      "perfReq": {
+      },
+      "coverageAreaTAList": [
+      ],
+      "latency": 2,
+      "maxBandwidth": 100,
+      "resourceSharingLevel": "non-shared"
+    },
+    "transportSliceNetworks": [
+            {
+                "connectionLinks": [
+                    {
+                        "transportEndpointA": "tranportEp_ID_XXX",
+                        "transportEndpointB": "tranportEp_ID_YYY"
+                    },
+                    {
+                        "transportEndpointA": "tranportEp_ID_AAA",
+                        "transportEndpointB": "tranportEp_ID_BBB"
+                    }
+                ]
+            },
+            {
+                "connectionLinks": [
+                    {
+                        "transportEndpointA": "tranportEp_ID_CCC",
+                        "transportEndpointB": "tranportEp_ID_DDD"
+                    },
+                    {
+                        "transportEndpointA": "tranportEp_ID_EEE",
+                        "transportEndpointB": "tranportEp_ID_FFF"
+                    }
+                ]
+            }
+    ],
+    "nsiInfo": {
+      "nsiId": "NSI-M-001-HDBNJ-NSMF-01-A-ZX",
+      "nsiName": "eMBB-001"
+    },
+    "scriptName": "AN1"
+        }""".replaceAll("\\\\s+", ""))
+
+        DoDeallocateTnNssi runScript = new DoDeallocateTnNssi()
+        runScript.preProcessRequest(mockExecution)
+        Mockito.verify(mockExecution, times(1)).setVariable(eq("sliceServiceInstanceId"), captor.capture())
+        String sliceServiceInstanceId = captor.getValue()
+        assertNotNull(sliceServiceInstanceId)
+    }
+
+    @Test
+    void testDeleteServiceInstance() {
+        when(mockExecution.getVariable("serviceInstanceID")).thenReturn("5ad89cf9-0569-4a93-9306-d8324321e2be")
+        when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer")
+        when(mockExecution.getVariable("subscriptionServiceType")).thenReturn("5G")
+
+        AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer("5GCustomer").serviceSubscription("5G").serviceInstance("5ad89cf9-0569-4a93-9306-d8324321e2be"))
+        DoDeallocateTnNssi obj = spy(DoDeallocateTnNssi.class)
+        when(obj.getAAIClient()).thenReturn(client)
+        doNothing().when(client).delete(serviceInstanceUri)
+
+        obj.deleteServiceInstance(mockExecution)
+        Mockito.verify(client, times(1)).delete(serviceInstanceUri)
+    }
+}
index 3b172f3..8510611 100644 (file)
@@ -45,6 +45,8 @@ import org.onap.so.bpmn.core.WorkflowException
 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
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types
 import org.onap.aaiclient.client.graphinventory.entities.uri.Depth
 import org.onap.so.constants.Defaults
 
@@ -1609,7 +1611,7 @@ String sdncAdapterWorkflowFormattedResponse_404 =
             Relationship relationship = new Relationship();
             relationship.setRelatedTo("vf-module")
             l3Network.getRelationshipList().getRelationship().add(relationship)
-            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, networkId).depth(Depth.ALL)
+            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(networkId)).depth(Depth.ALL)
             when(client.get(L3Network.class,uri)).thenReturn(Optional.of(l3Network))
 
                        doDeleteNetworkInstance.callRESTQueryAAI(mockExecution)
@@ -1643,7 +1645,7 @@ String sdncAdapterWorkflowFormattedResponse_404 =
                        DoDeleteNetworkInstance doDeleteNetworkInstance = spy(DoDeleteNetworkInstance.class)
                        when(doDeleteNetworkInstance.getAAIClient()).thenReturn(client)
                        L3Network l3Network = getL3Network()
-            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, networkId).depth(Depth.ALL)
+            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(networkId)).depth(Depth.ALL)
                        when(client.get(L3Network.class,uri)).thenReturn(Optional.of(l3Network))
                        doDeleteNetworkInstance.callRESTQueryAAI(mockExecution)
 
@@ -1681,7 +1683,7 @@ String sdncAdapterWorkflowFormattedResponse_404 =
         relationship.setRelatedLink("http://localhost:18080/cloud-regions/cloud-region/" + Defaults.CLOUD_OWNER.toString() + "/lcpCloudRegion/")
         relationshipList.getRelationship().add(relationship)
         l3Network.setRelationshipList(relationshipList)
-        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, networkId).depth(Depth.ALL)
+        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(networkId)).depth(Depth.ALL)
         when(client.get(L3Network.class,uri)).thenReturn(Optional.of(l3Network))
         doDeleteNetworkInstance.callRESTQueryAAI(mockExecution)
 
index 9dbb6a5..7b65d16 100644 (file)
  */
 package org.onap.so.bpmn.infrastructure.scripts
 
+import static org.junit.Assert.assertNotNull
+import static org.junit.Assert.assertTrue
+import static org.mockito.ArgumentMatchers.eq
+import static org.mockito.Mockito.spy
+import static org.mockito.Mockito.times
+import static org.mockito.Mockito.verify
+import static org.mockito.Mockito.when
+import javax.ws.rs.NotFoundException
 import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity
 import org.junit.Before
 import org.junit.Test
@@ -26,23 +34,13 @@ import org.mockito.ArgumentCaptor
 import org.mockito.Captor
 import org.mockito.Mockito
 import org.onap.aai.domain.yang.ServiceInstance
-import org.onap.so.bpmn.common.scripts.MsoGroovyTest
-import org.onap.aaiclient.client.aai.AAIObjectType
 import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
+import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri
 import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
 import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
-
-import javax.ws.rs.NotFoundException
-
-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.spy
-import static org.mockito.Mockito.times
-import static org.mockito.Mockito.verify
-import static org.mockito.Mockito.when
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types
+import org.onap.so.bpmn.common.scripts.MsoGroovyTest
 
 class DoDeleteSliceServiceTest extends MsoGroovyTest {
     @Before
@@ -73,7 +71,7 @@ class DoDeleteSliceServiceTest extends MsoGroovyTest {
         when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer")
         when(mockExecution.getVariable("serviceType")).thenReturn("5G")
 
-        AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, "5GCustomer", "5G", "5ad89cf9-0569-4a93-9306-d8324321e2be")
+        AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer("5GCustomer").serviceSubscription("5G").serviceInstance("5ad89cf9-0569-4a93-9306-d8324321e2be"))
         DoDeleteSliceService obj = spy(DoDeleteSliceService.class)
 
         AAIResultWrapper wrapper = new AAIResultWrapper(mockQuerySliceServiceReturn())
@@ -92,8 +90,9 @@ class DoDeleteSliceServiceTest extends MsoGroovyTest {
         when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer")
         when(mockExecution.getVariable("serviceType")).thenReturn("5G")
 
-        AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.ALLOTTED_RESOURCE_ALL, "5GCustomer", "5G", "5ad89cf9-0569-4a93-9306-d8324321e2be")
-        DoDeleteSliceService obj = spy(DoDeleteSliceService.class)
+        AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(
+            AAIFluentTypeBuilder.business().customer("5GCustomer").serviceSubscription("5G").serviceInstance("5ad89cf9-0569-4a93-9306-d8324321e2be").allottedResources())
+            DoDeleteSliceService obj = spy(DoDeleteSliceService.class)
 
         AAIResultWrapper wrapper = new AAIResultWrapper(mockQueryAllottedResource())
         when(obj.getAAIClient()).thenReturn(client)
@@ -111,7 +110,7 @@ class DoDeleteSliceServiceTest extends MsoGroovyTest {
         when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer")
         when(mockExecution.getVariable("serviceType")).thenReturn("5G")
 
-        AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, "5GCustomer", "5G", "5G-888")
+        AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer("5GCustomer").serviceSubscription("5G").serviceInstance("5G-888"))
         DoDeleteSliceService obj = spy(DoDeleteSliceService.class)
 
         AAIResultWrapper wrapper = new AAIResultWrapper(mockNSIReturn())
@@ -133,7 +132,7 @@ class DoDeleteSliceServiceTest extends MsoGroovyTest {
         when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer")
         when(mockExecution.getVariable("serviceType")).thenReturn("5G")
 
-        AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, "5GCustomer", "5G", "5G-999")
+        AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer("5GCustomer").serviceSubscription("5G").serviceInstance("5G-999"))
         DoDeleteSliceService obj = spy(DoDeleteSliceService.class)
 
         AAIResultWrapper wrapper = new AAIResultWrapper(mockNSSIReturn())
@@ -181,7 +180,8 @@ class DoDeleteSliceServiceTest extends MsoGroovyTest {
         when(mockExecution.getVariable("serviceType")).thenReturn("5G")
 
         AAIResultWrapper wrapper = new AAIResultWrapper(mockSliceProfile())
-        AAIResourceUri profileUri = AAIUriFactory.createResourceUri(AAIObjectType.SLICE_PROFILE_ALL, "5GCustomer", "5G", "5G-999")
+        AAIPluralResourceUri profileUri = AAIUriFactory.createResourceUri(
+            AAIFluentTypeBuilder.business().customer("5GCustomer").serviceSubscription("5G").serviceInstance("5G-999").sliceProfiles())
 
         DoDeleteSliceService obj = spy(DoDeleteSliceService.class)
         when(obj.getAAIClient()).thenReturn(client)
index 0251eab..3780d42 100644 (file)
 
 package org.onap.so.bpmn.infrastructure.scripts
 
+import static org.mockito.ArgumentMatchers.isA
+import static org.mockito.Mockito.doThrow
+import static org.mockito.Mockito.spy
+import static org.mockito.Mockito.when
 import org.camunda.bpm.engine.delegate.BpmnError
 import org.junit.Before
 import org.junit.Rule
 import org.junit.Test
 import org.junit.rules.ExpectedException
-import org.onap.aai.domain.yang.VolumeGroup
-import org.onap.aai.domain.yang.VolumeGroups
-import org.onap.so.bpmn.common.scripts.MsoGroovyTest
-import org.onap.aaiclient.client.aai.AAIObjectPlurals
-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.so.constants.Defaults
-
-import static org.mockito.ArgumentMatchers.isA
-import static org.mockito.Mockito.doThrow
-import static org.mockito.Mockito.spy
-import static org.mockito.Mockito.when
+import org.onap.so.bpmn.common.scripts.MsoGroovyTest
 
 public class DoDeleteVFCNetworkServiceInstanceTest extends MsoGroovyTest {
 
index daf005e..da68a21 100644 (file)
@@ -42,11 +42,12 @@ import org.onap.aai.domain.yang.NetworkPolicies
 import org.onap.aai.domain.yang.NetworkPolicy
 import org.onap.so.bpmn.common.scripts.MsoGroovyTest
 import org.onap.so.bpmn.core.WorkflowException
-import org.onap.aaiclient.client.aai.AAIObjectPlurals
 import org.onap.aaiclient.client.aai.AAIObjectType
 import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri
 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.aaiclient.client.graphinventory.entities.uri.Depth
 
 import static com.github.tomakehurst.wiremock.client.WireMock.*
@@ -106,7 +107,7 @@ class DoDeleteVfModuleFromVnfTest extends MsoGroovyTest {
         List fqdnList = new ArrayList()
         fqdnList.add("test")
         when(mockExecution.getVariable("DDVFMV_contrailNetworkPolicyFqdnList")).thenReturn(fqdnList)
-        AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY)
+        AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().networkPolicies())
         uri.queryParam("network-policy-fqdn", "test")
         NetworkPolicies networkPolicies = new NetworkPolicies();
         NetworkPolicy networkPolicy = new NetworkPolicy();
@@ -114,7 +115,7 @@ class DoDeleteVfModuleFromVnfTest extends MsoGroovyTest {
         networkPolicies.getNetworkPolicy().add(networkPolicy)
         when(client.get(NetworkPolicies.class, uri)).thenReturn(Optional.of(networkPolicies))
 
-        AAIResourceUri delUri = AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, networkPolicy.getNetworkPolicyId())
+        AAIResourceUri delUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().networkPolicy(networkPolicy.getNetworkPolicyId()))
         doNothing().when(client).delete(delUri)
         deleteVfModuleFromVnf.deleteNetworkPoliciesFromAAI(mockExecution)
 
@@ -128,7 +129,7 @@ class DoDeleteVfModuleFromVnfTest extends MsoGroovyTest {
         List fqdnList = new ArrayList()
         fqdnList.add("test")
         when(mockExecution.getVariable("DDVFMV_contrailNetworkPolicyFqdnList")).thenReturn(fqdnList)
-        AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY)
+        AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().networkPolicies())
         uri.queryParam("network-policy-fqdn", "test")
         when(client.get(NetworkPolicies.class, uri)).thenReturn(Optional.empty())
         deleteVfModuleFromVnf.deleteNetworkPoliciesFromAAI(mockExecution)
@@ -142,7 +143,7 @@ class DoDeleteVfModuleFromVnfTest extends MsoGroovyTest {
     void testQueryAAIForVfModule() {
         ExecutionEntity mockExecution = setupMock()
         when(mockExecution.getVariable("vnfId")).thenReturn("12345")
-        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "12345").depth(Depth.ONE)
+        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("12345")).depth(Depth.ONE)
         GenericVnf genericVnf = new GenericVnf()
         genericVnf.setVnfId("test1")
         when(client.get(GenericVnf.class, uri)).thenReturn(Optional.of(genericVnf))
@@ -156,7 +157,7 @@ class DoDeleteVfModuleFromVnfTest extends MsoGroovyTest {
     void testQueryAAIForVfModuleNotFound() {
         ExecutionEntity mockExecution = setupMock()
         when(mockExecution.getVariable("vnfId")).thenReturn("12345")
-        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "12345").depth(Depth.ONE)
+        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("12345")).depth(Depth.ONE)
         when(client.get(GenericVnf.class, uri)).thenReturn(Optional.empty())
         deleteVfModuleFromVnf.queryAAIForVfModule(mockExecution)
         Mockito.verify(mockExecution, atLeastOnce()).setVariable("DDVMFV_getVnfResponseCode", 404)
index 0e47958..5882f73 100644 (file)
 
 package org.onap.so.bpmn.infrastructure.scripts
 
-import com.github.tomakehurst.wiremock.junit.WireMockRule
+import static com.github.tomakehurst.wiremock.client.WireMock.*
+import static org.mockito.Mockito.*
+import javax.ws.rs.NotFoundException
 import org.camunda.bpm.engine.ProcessEngineServices
 import org.camunda.bpm.engine.RepositoryService
 import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity
 import org.camunda.bpm.engine.repository.ProcessDefinition
-import org.junit.Assert
 import org.junit.Before
-import org.junit.Ignore
-import org.junit.Rule
 import org.junit.Test
 import org.junit.runner.RunWith
 import org.mockito.ArgumentCaptor
@@ -40,21 +39,13 @@ import org.mockito.runners.MockitoJUnitRunner
 import org.onap.aai.domain.yang.NetworkPolicies
 import org.onap.aai.domain.yang.NetworkPolicy
 import org.onap.aai.domain.yang.VfModule
-import org.onap.aai.domain.yang.VfModules
-import org.onap.so.bpmn.common.scripts.MsoGroovyTest
-import org.onap.so.bpmn.common.scripts.utils.XmlComparator
-import org.onap.so.bpmn.core.WorkflowException
-import org.onap.so.bpmn.mock.FileUtil
-import org.onap.aaiclient.client.aai.AAIObjectPlurals
-import org.onap.aaiclient.client.aai.AAIObjectType
 import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri
 import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
 import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
-
-import javax.ws.rs.NotFoundException
-
-import static com.github.tomakehurst.wiremock.client.WireMock.*
-import static org.mockito.Mockito.*
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder
+import org.onap.so.bpmn.common.scripts.MsoGroovyTest
+import org.onap.so.bpmn.common.scripts.utils.XmlComparator
+import org.onap.so.bpmn.mock.FileUtil
 
 @RunWith(MockitoJUnitRunner.class)
 class DoDeleteVfModuleTest extends MsoGroovyTest{
@@ -105,7 +96,7 @@ class DoDeleteVfModuleTest extends MsoGroovyTest{
         NetworkPolicy networkPolicy = new NetworkPolicy()
         networkPolicy.setNetworkPolicyId("NP1")
         networkPolicies.getNetworkPolicy().add(networkPolicy)
-        AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY)
+        AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().networkPolicies())
         uri.queryParam("network-policy-fqdn", "test")
         when(client.get(NetworkPolicies.class, uri)).thenReturn(Optional.of(networkPolicies))
         doDeleteVfModule.deleteNetworkPoliciesFromAAI(mockExecution)
@@ -121,10 +112,10 @@ class DoDeleteVfModuleTest extends MsoGroovyTest{
         NetworkPolicy networkPolicy = new NetworkPolicy()
         networkPolicy.setNetworkPolicyId("NP1")
         networkPolicies.getNetworkPolicy().add(networkPolicy)
-        AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY)
+        AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().networkPolicies())
         uri.queryParam("network-policy-fqdn", "test")
         when(client.get(NetworkPolicies.class, uri)).thenReturn(Optional.of(networkPolicies))
-        AAIResourceUri delUri = AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, "NP1")
+        AAIResourceUri delUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().networkPolicy("NP1"))
         doThrow(new NotFoundException(("Not Found !"))).when(client).delete(delUri)
         doDeleteVfModule.deleteNetworkPoliciesFromAAI(mockExecution)
         Mockito.verify(client).delete(delUri)
@@ -135,7 +126,7 @@ class DoDeleteVfModuleTest extends MsoGroovyTest{
         when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true")
         when(mockExecution.getVariable("vnfId")).thenReturn("12345")
         when(mockExecution.getVariable("vfModuleId")).thenReturn("module-0")
-        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE,"12345","module-0")
+        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("12345").vfModule("module-0"))
         VfModule vfModule = new VfModule()
         vfModule.setOrchestrationStatus("Created")
         when(client.get(VfModule.class, uri)).thenReturn(Optional.of(vfModule))
index dd8601f..84d88ff 100644 (file)
@@ -53,6 +53,8 @@ import org.onap.aaiclient.client.aai.AAIObjectType
 import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
 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.aaiclient.client.graphinventory.exceptions.GraphInventoryUriComputationException
 import org.springframework.core.env.Environment
 import org.springframework.mock.env.MockEnvironment
@@ -182,7 +184,7 @@ class DoDeleteVfModuleVolumeV2Test extends MsoGroovyTest{
         when(mockExecution.getVariable("tenantId")).thenReturn("Tenant123")
         when(mockExecution.getVariable("volumeGroupId")).thenReturn("VolumeGroup123")
         when(mockExecution.getVariable("DDVMV_aicCloudRegion")).thenReturn("Region1")
-        AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP,CLOUD_OWNER, "Region1","VolumeGroup123")
+        AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(CLOUD_OWNER, "Region1").volumeGroup("VolumeGroup123"))
         Optional<VolumeGroup> volumeGroup = getAAIObjectFromJson(VolumeGroup.class,"__files/AAI/VolumeGroupWithTenant.json");
         when(client.get(VolumeGroup.class,resourceUri)).thenReturn(volumeGroup)
         when(client.get(resourceUri)).thenReturn(
@@ -197,7 +199,7 @@ class DoDeleteVfModuleVolumeV2Test extends MsoGroovyTest{
         when(mockExecution.getVariable("tenantId")).thenReturn("Tenant123")
         when(mockExecution.getVariable("volumeGroupId")).thenReturn("VolumeGroup123")
         when(mockExecution.getVariable("DDVMV_aicCloudRegion")).thenReturn("Region1")
-        AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP,CLOUD_OWNER, "Region1","VolumeGroup123")
+        AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(CLOUD_OWNER, "Region1").volumeGroup("VolumeGroup123"))
         Optional<VolumeGroup> volumeGroup = getAAIObjectFromJson(VolumeGroup.class,"__files/aai/VolumeGroup.json");
         when(client.get(VolumeGroup.class,resourceUri)).thenReturn(volumeGroup)
         try {
@@ -212,7 +214,7 @@ class DoDeleteVfModuleVolumeV2Test extends MsoGroovyTest{
         when(mockExecution.getVariable("tenantId")).thenReturn("Tenant12345")
         when(mockExecution.getVariable("volumeGroupId")).thenReturn("VolumeGroup123")
         when(mockExecution.getVariable("DDVMV_aicCloudRegion")).thenReturn("Region1")
-        AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP,CLOUD_OWNER, "Region1","VolumeGroup123")
+        AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(CLOUD_OWNER, "Region1").volumeGroup("VolumeGroup123"))
         Optional<VolumeGroup> volumeGroup = getAAIObjectFromJson(VolumeGroup.class,"__files/AAI/VolumeGroupWithTenant.json");
         when(client.get(VolumeGroup.class,resourceUri)).thenReturn(volumeGroup)
         try {
@@ -227,7 +229,7 @@ class DoDeleteVfModuleVolumeV2Test extends MsoGroovyTest{
         when(mockExecution.getVariable("tenantId")).thenReturn("Tenant123")
         when(mockExecution.getVariable("volumeGroupId")).thenReturn("VolumeGroup123")
         when(mockExecution.getVariable("DDVMV_aicCloudRegion")).thenReturn("Region1")
-        AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP,CLOUD_OWNER, "Region1","VolumeGroup123")
+        AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(CLOUD_OWNER, "Region1").volumeGroup("VolumeGroup123"))
         when(client.get(VolumeGroup.class,resourceUri)).thenReturn(Optional.empty())
         try {
             deleteVfModuleVolumeV2.callRESTQueryAAIForVolumeGroup(mockExecution, "true")
@@ -241,7 +243,7 @@ class DoDeleteVfModuleVolumeV2Test extends MsoGroovyTest{
         when(mockExecution.getVariable("tenantId")).thenReturn("Tenant123")
         when(mockExecution.getVariable("volumeGroupId")).thenReturn("VolumeGroup123")
         when(mockExecution.getVariable("DDVMV_aicCloudRegion")).thenReturn("Region1")
-        AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP,CLOUD_OWNER, "Region1","VolumeGroup123")
+        AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(CLOUD_OWNER, "Region1").volumeGroup("VolumeGroup123"))
         Optional<VolumeGroup> volumeGroup = getAAIObjectFromJson(VolumeGroup.class,"__files/aai/VolumeGroupWithVfModule.json");
         when(client.get(VolumeGroup.class,resourceUri)).thenReturn(volumeGroup)
         try {
@@ -256,7 +258,7 @@ class DoDeleteVfModuleVolumeV2Test extends MsoGroovyTest{
         Optional<VolumeGroup> volumeGroup = getAAIObjectFromJson(VolumeGroup.class,"__files/aai/VolumeGroup.json");
         when(mockExecution.getVariable("DDVMV_queryAAIVolGrpResponse")).thenReturn(volumeGroup.get())
         when(mockExecution.getVariable("DDVMV_aicCloudRegion")).thenReturn("Region1")
-        AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP,CLOUD_OWNER, "Region1","VolumeGroup123")
+        AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(CLOUD_OWNER, "Region1").volumeGroup("VolumeGroup123"))
         doNothing().when(client).delete(resourceUri)
         deleteVfModuleVolumeV2.callRESTDeleteAAIVolumeGroup(mockExecution,"true")
     }
@@ -266,7 +268,7 @@ class DoDeleteVfModuleVolumeV2Test extends MsoGroovyTest{
         Optional<VolumeGroup> volumeGroup = getAAIObjectFromJson(VolumeGroup.class,"__files/aai/VolumeGroupWithVfModule.json");
         when(mockExecution.getVariable("DDVMV_queryAAIVolGrpResponse")).thenReturn(volumeGroup.get())
         when(mockExecution.getVariable("DDVMV_aicCloudRegion")).thenReturn("Region1")
-        AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP,CLOUD_OWNER, "Region1",volumeGroup.get().getVolumeGroupId())
+        AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(CLOUD_OWNER, "Region1").volumeGroup(volumeGroup.get()).getVolumeGroupId())
         doThrow(new GraphInventoryUriComputationException("Error")).when(client).delete(resourceUri)
         try {
             deleteVfModuleVolumeV2.callRESTDeleteAAIVolumeGroup(mockExecution, "true")
@@ -280,7 +282,7 @@ class DoDeleteVfModuleVolumeV2Test extends MsoGroovyTest{
         Optional<VolumeGroup> volumeGroup = getAAIObjectFromJson(VolumeGroup.class,"__files/aai/VolumeGroup.json");
         when(mockExecution.getVariable("DDVMV_queryAAIVolGrpResponse")).thenReturn(volumeGroup.get())
         when(mockExecution.getVariable("DDVMV_aicCloudRegion")).thenReturn("Region1")
-        AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP,CLOUD_OWNER, "Region1","VolumeGroup123")
+        AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(CLOUD_OWNER, "Region1").volumeGroup("VolumeGroup123"))
         doThrow(new NotFoundException("VolumeGroup Not found")).when(client).delete(resourceUri)
         try {
             deleteVfModuleVolumeV2.callRESTDeleteAAIVolumeGroup(mockExecution, "true")
index 2da6eca..e85b813 100644 (file)
@@ -42,6 +42,8 @@ import org.onap.so.bpmn.core.WorkflowException
 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
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types
 import org.onap.aaiclient.client.graphinventory.entities.uri.Depth
 import org.onap.aaiclient.client.graphinventory.exceptions.GraphInventoryUriComputationException
 import static com.github.tomakehurst.wiremock.client.WireMock.*
@@ -99,7 +101,7 @@ public class DoDeleteVnfAndModulesTest extends MsoGroovyTest{
     @Test
     public void testQueryAAIVfModuleNullEndPoint() {
         when(mockExecution.getVariable("vnfId")).thenReturn("12345")
-        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "12345").depth(Depth.ONE)
+        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("12345")).depth(Depth.ONE)
         doThrow(new GraphInventoryUriComputationException("Error in AAI")).when(client).get(GenericVnf.class,uri)
         try {
             doDeleteVnfAndModules.queryAAIVfModule(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
new file mode 100644 (file)
index 0000000..bbc237f
--- /dev/null
@@ -0,0 +1,244 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020  Telecom Italia
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.scripts
+
+
+import org.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.onap.aaiclient.client.aai.entities.AAIEdgeLabel
+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.MsoGroovyTest
+
+import static org.junit.Assert.assertNotNull
+import static org.junit.Assert.assertTrue
+import static org.mockito.Mockito.*
+
+class DoModifyCoreNSSITest extends MsoGroovyTest  {
+
+    @Before
+    void init() throws IOException {
+        super.init("DoModifyCoreNSSITest")
+    }
+
+
+    @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)
+
+        when(mockExecution.getVariable("isCreateSliceProfileInstance")).thenReturn("false")
+
+        String theSNSSAI = "theS-NSSAI"
+
+        currentNSSI.put("S-NSSAI", theSNSSAI)
+
+        List<SliceProfile> associatedProfiles = new ArrayList<>()
+        SliceProfile sliceProfile1 = new SliceProfile()
+        sliceProfile1.setSNssai("snssai1")
+
+        SliceProfile sliceProfile2 = new SliceProfile()
+        sliceProfile2.setSNssai(theSNSSAI)
+
+        SliceProfile sliceProfile3 = new SliceProfile()
+        sliceProfile3.setSNssai("snssai2")
+
+        associatedProfiles.add(sliceProfile1)
+        associatedProfiles.add(sliceProfile2)
+        associatedProfiles.add(sliceProfile3)
+
+        int sizeBefore = associatedProfiles.size()
+
+        currentNSSI.put("associatedProfiles", associatedProfiles)
+
+        DoModifyCoreNSSI obj = new DoModifyCoreNSSI()
+        obj.calculateSNSSAI(mockExecution)
+
+        List<SliceProfile> snssais = (List<SliceProfile>)currentNSSI.get("S-NSSAIs")
+        SliceProfile sliceProfileContainsSNSSAI = (SliceProfile)currentNSSI.get("sliceProfileS-NSSAI")
+
+        assertTrue("Either snssais doesn't exist or size is incorrect", (snssais != null && snssais.size() == (sizeBefore - 1)))
+        assertNotNull("Slice Profile which contains given S-NSSAI not found", sliceProfileContainsSNSSAI)
+        assertTrue("Wrong Slice Profile", sliceProfileContainsSNSSAI.getSNssai().equals(theSNSSAI))
+    }
+
+
+    @Test
+    void testCalculateSNSSAISliceProfileInstanceHasToBeCreated() {
+        def currentNSSI = [:]
+        when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI)
+
+        when(mockExecution.getVariable("isCreateSliceProfileInstance")).thenReturn("true")
+
+        String theSNSSAI = "theS-NSSAI"
+
+        currentNSSI.put("S-NSSAI", theSNSSAI)
+
+        List<SliceProfile> associatedProfiles = new ArrayList<>()
+        SliceProfile sliceProfile1 = new SliceProfile()
+        sliceProfile1.setSNssai("snssai1")
+
+        SliceProfile sliceProfile2 = new SliceProfile()
+        sliceProfile2.setSNssai("snssai2")
+
+        associatedProfiles.add(sliceProfile1)
+        associatedProfiles.add(sliceProfile2)
+
+        int sizeBefore = associatedProfiles.size()
+
+        currentNSSI.put("associatedProfiles", associatedProfiles)
+
+        DoModifyCoreNSSI obj = new DoModifyCoreNSSI()
+        obj.calculateSNSSAI(mockExecution)
+
+        List<SliceProfile> snssais = (List<SliceProfile>)currentNSSI.get("S-NSSAIs")
+
+        assertTrue("Either snssais doesn't exist or size is incorrect", (snssais != null && snssais.size() == (sizeBefore + 1)))
+
+    }
+
+
+    @Test
+    void testCreateSliceProfileInstance() {
+        def currentNSSI = [:]
+
+        when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI)
+
+        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)
+
+
+        DoModifyCoreNSSI spy = spy(DoModifyCoreNSSI.class)
+        when(spy.getAAIClient()).thenReturn(client)
+
+        String globalSubscriberId = "globalSubscriberId"
+        String serviceType = "serviceType"
+        String nssiId = "nssiId"
+
+        currentNSSI.put("globalSubscriberId", globalSubscriberId)
+        currentNSSI.put("serviceType", serviceType)
+        currentNSSI.put("nssiId", nssiId)
+        currentNSSI.put("sliceProfileId", sliceProfileId)
+
+        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(serviceType).serviceInstance(nssiId).sliceProfile(sliceProfileId))
+
+        SliceProfile sliceProfile = new SliceProfile()
+        sliceProfile.setProfileId(sliceProfileId)
+
+        doNothing().when(client).create(uri, sliceProfile)
+
+        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()))
+    }
+
+
+    @Test
+    void testAssociateSliceProfileInstanceWithNSSI() {
+        def currentNSSI = [:]
+
+        when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI)
+
+        DoModifyCoreNSSI spy = spy(DoModifyCoreNSSI.class)
+        when(spy.getAAIClient()).thenReturn(client)
+
+        String sliceProfileId = "sliceProfileId"
+
+        when(mockExecution.getVariable("sliceProfileID")).thenReturn(sliceProfileId)
+
+        String nssiId = "5G-999"
+        currentNSSI.put("nssiId", nssiId)
+
+        String globalSubscriberId = "globalSubscriberId"
+        String serviceType = "serviceType"
+
+        AAIResourceUri nssiUri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(nssiId))
+        AAIResourceUri sliceProfileUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(serviceType).serviceInstance(nssiId).sliceProfile(sliceProfileId))
+
+        currentNSSI.put("globalSubscriberId", globalSubscriberId)
+        currentNSSI.put("serviceType", serviceType)
+        currentNSSI.put("sliceProfileId", sliceProfileId)
+
+        SliceProfile sliceProfile = new SliceProfile()
+        currentNSSI.put("createdSliceProfile", sliceProfile)
+
+        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)
+
+        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-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyTnNssiTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyTnNssiTest.groovy
new file mode 100644 (file)
index 0000000..ef106f8
--- /dev/null
@@ -0,0 +1,177 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ #
+ # Licensed under the Apache License, Version 2.0 (the "License")
+ # you may not use this file except in compliance with the License.
+ # You may obtain a copy of the License at
+ #
+ #       http://www.apache.org/licenses/LICENSE-2.0
+ #
+ # Unless required by applicable law or agreed to in writing, software
+ # distributed under the License is distributed on an "AS IS" BASIS,
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ # See the License for the specific language governing permissions and
+ # limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.bpmn.infrastructure.scripts
+
+import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity
+import org.junit.Before
+import org.junit.Test
+import org.mockito.ArgumentCaptor
+import org.mockito.Captor
+import org.mockito.Mockito
+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
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types
+import org.onap.so.bpmn.common.scripts.MsoGroovyTest
+
+import static org.junit.Assert.assertNotNull
+import static org.mockito.ArgumentMatchers.eq
+import static org.mockito.Mockito.*
+
+
+class DoModifyTnNssiTest extends MsoGroovyTest {
+    @Before
+    void init() throws IOException {
+        super.init("DoModifyTnNssiTest")
+    }
+
+    @Captor
+    static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class)
+
+    @Test
+    void testPreProcessRequest() {
+        when(mockExecution.getVariable("msoRequestId")).thenReturn("4c614769-f58a-4556-8ad9-dcd903077c82")
+        when(mockExecution.getVariable("mso.workflow.sdncadapter.callback")).thenReturn("http://localhost:8090/SDNCAdapterCallback")
+        when(mockExecution.getVariable("modelInvariantUuid")).thenReturn("f85cbcc0-ad74-45d7-a5a1-17c8744fdb71")
+        when(mockExecution.getVariable("modelUuid")).thenReturn("36a3a8ea-49a6-4ac8-b06c-89a54544b9b6")
+        when(mockExecution.getVariable("serviceInstanceID")).thenReturn("eb0863e9-a69b-4b17-8a56-f05ad110bef7")
+        when(mockExecution.getVariable("operationId")).thenReturn("998c2081-5a71-4a39-9ae6-d6b7c5bb50c0")
+        when(mockExecution.getVariable("operationType")).thenReturn("opTypeTest")
+        when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer")
+        when(mockExecution.getVariable("servicename")).thenReturn("5G-test")
+        when(mockExecution.getVariable("networkType")).thenReturn("5G-network")
+        when(mockExecution.getVariable("subscriptionServiceType")).thenReturn("5G-service")
+        when(mockExecution.getVariable("nsiId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56")
+        when(mockExecution.getVariable("jobId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4")
+        when(mockExecution.getVariable("operationType")).thenReturn("activateInstance")
+        when(mockExecution.getVariable("sliceParams")).thenReturn(mockSliceParams())
+
+        DoModifyTnNssi obj = new DoModifyTnNssi()
+        obj.preProcessRequest(mockExecution)
+        Mockito.verify(mockExecution, times(1)).setVariable(eq("sliceServiceInstanceId"), captor.capture())
+        String sliceServiceInstanceId = captor.getValue()
+        assertNotNull(sliceServiceInstanceId)
+    }
+
+    @Test
+    void testUpdateServiceInstance() {
+        when(mockExecution.getVariable("sliceServiceInstanceId")).thenReturn("5ad89cf9-0569-4a93-9306-d8324321e2be")
+        when(mockExecution.getVariable("sliceServiceInstanceName")).thenReturn("5G-service")
+        when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer")
+        when(mockExecution.getVariable("subscriptionServiceType")).thenReturn("5G")
+        when(mockExecution.getVariable("sliceProfileId")).thenReturn("5ad89cf9-0569-4a93-9306-d8324321e2b1")
+        when(mockExecution.getVariable("modelInvariantUuid")).thenReturn("f85cbcc0-ad74-45d7-a5a1-17c8744fdb71")
+        when(mockExecution.getVariable("modelUuid")).thenReturn("36a3a8ea-49a6-4ac8-b06c-89a54544b9b6")
+        when(mockExecution.getVariable("sliceProfile")).thenReturn(mockSliceProfile())
+
+        AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer("5GCustomer").serviceSubscription("5G").serviceInstance("5ad89cf9-0569-4a93-9306-d8324321e2be"))
+        DoModifyTnNssi obj = spy(DoModifyTnNssi.class)
+        when(obj.getAAIClient()).thenReturn(client)
+
+        obj.updateServiceInstance(mockExecution)
+    }
+
+
+    private String mockSliceParams() {
+        String expect = """{
+    "sliceProfile": {
+      "snssaiList": [
+        "001-100001"
+      ],
+      "sliceProfileId": "ab9af40f13f721b5f13539d87484098",
+      "plmnIdList": [
+        "460-00",
+        "460-01"
+      ],
+      "perfReq": {
+      },
+      "coverageAreaTAList": [
+      ],
+      "latency": 2,
+      "maxBandwidth": 100,
+      "resourceSharingLevel": "non-shared"
+    },
+    "transportSliceNetworks": [
+            {
+                "connectionLinks": [
+                    {
+                        "transportEndpointA": "tranportEp_ID_XXX",
+                        "transportEndpointB": "tranportEp_ID_YYY"
+                    },
+                    {
+                        "transportEndpointA": "tranportEp_ID_AAA",
+                        "transportEndpointB": "tranportEp_ID_BBB"
+                    }
+                ]
+            },
+            {
+                "connectionLinks": [
+                    {
+                        "transportEndpointA": "tranportEp_ID_CCC",
+                        "transportEndpointB": "tranportEp_ID_DDD"
+                    },
+                    {
+                        "transportEndpointA": "tranportEp_ID_EEE",
+                        "transportEndpointB": "tranportEp_ID_FFF"
+                    }
+                ]
+            }
+    ],
+    "nsiInfo": {
+      "nsiId": "NSI-M-001-HDBNJ-NSMF-01-A-ZX",
+      "nsiName": "eMBB-001"
+    },
+    "scriptName": "AN1"
+        }"""
+        return expect.replaceAll("\\\\s+", "")
+    }
+
+    private String mockSliceProfile() {
+        String expect = """{
+      "snssaiList": [
+        "001-100001"
+      ],
+      "sliceProfileId": "ab9af40f13f721b5f13539d87484098",
+      "plmnIdList": [
+        "460-00",
+        "460-01"
+      ],
+      "perfReq": {
+      },
+      "coverageAreaTAList": [
+      ],
+      "latency": 2,
+      "maxBandwidth": 100,
+      "resourceSharingLevel": "non-shared"
+     }"""
+        return expect.replaceAll("\\\\s+", "")
+    }
+
+    private String mockServiceModelInfo() {
+        String expect = """{
+            "modelInvariantUuid":"f85cbcc0-ad74-45d7-a5a1-17c8744fdb71",
+            "modelUuid":"36a3a8ea-49a6-4ac8-b06c-89a54544b9b6",
+            "modelVersion":""
+            }"""
+        return expect.replaceAll("\\\\s+", "")
+    }
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/ModifySliceSubnetTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/ModifySliceSubnetTest.groovy
new file mode 100644 (file)
index 0000000..b7515a4
--- /dev/null
@@ -0,0 +1,72 @@
+package org.onap.so.bpmn.infrastructure.scripts
+
+import static org.junit.Assert.*
+
+import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity
+import org.junit.Before
+import org.junit.Test
+import org.mockito.ArgumentCaptor
+import org.mockito.Captor
+
+class ModifySliceSubnetTest {
+       @Before
+       void init() throws IOException {
+               super.init("ModifySliceSubnet")
+       }
+
+       @Captor
+       static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class)
+
+       @Test
+       public void testPreProcessRequest() {
+               when(mockExecution.getVariable("bpmnRequest")).thenReturn("""
+        {
+                               "serviceInstanceID": "NSSI-C-001-HDBNJ-NSSMF-01-A-ZX ",
+                               "networkType": "an/cn/tn",
+                               "globalSubscriberId": "5GCustomer",
+                               "subscriptionServiceType": "5G",
+                               "additionalProperties": {
+                               "nsiInfo": {
+                                       "nsiId": "NSI-M-001-HDBNJ-NSMF-01-A-ZX",
+                                       "nsiName": "eMBB-001"
+                               },
+                               }
+}
+""".replaceAll("\\s+", ""))
+               when(mockExecution.getVariable("mso-request-id")).thenReturn("edb08d97-e0f9-4c71-840a-72080d7be42e")
+               ModifySliceSubnet sliceSubnet = new ModifySliceSubnet()
+               sliceSubnet.preProcessRequest(mockExecution)
+               Mockito.verify(mockExecution, times(1)).setVariable(captor.capture() as String, captor.capture())
+               List<ExecutionEntity> values = captor.getAllValues()
+               assertNotNull(values)
+       }
+       
+       @Test
+       void testPrepareInitOperationStatus() {
+               when(mockExecution.getVariable("serviceInstanceId")).thenReturn("54321")
+               when(mockExecution.getVariable("jobId")).thenReturn("54321")
+               when(mockExecution.getVariable("nsiId")).thenReturn("11111")
+               ModifySliceSubnet sliceSubnet = new ModifySliceSubnet()
+               sliceSubnet.prepareInitOperationStatus(mockExecution)
+               Mockito.verify(mockExecution, times(1)).setVariable(eq("initResourceOperationStatus"), captor.capture())
+               String res = captor.getValue()
+               assertNotNull(res)
+       }
+
+
+       @Test
+       void testSendSyncResponse() {
+               when(mockExecution.getVariable("jobId")).thenReturn("123456")
+               ModifySliceSubnet sliceSubnet = new ModifySliceSubnet()
+               sliceSubnet.sendSyncResponse(mockExecution)
+               Mockito.verify(mockExecution, times(1)).setVariable(eq("sentSyncResponse"), captor.capture())
+               def updateVolumeGroupRequest = captor.getValue()
+               assertEquals(updateVolumeGroupRequest, true)
+       }
+
+       @Test
+       public void test() {
+               fail("Not yet implemented")
+       }
+
+}
index bf877bd..e2010ce 100644 (file)
@@ -23,6 +23,8 @@
 package org.onap.so.bpmn.infrastructure.scripts
 
 
+import static org.mockito.Mockito.*
+import javax.ws.rs.core.UriBuilder
 import org.camunda.bpm.engine.delegate.BpmnError
 import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity
 import org.junit.Assert
@@ -38,18 +40,16 @@ import org.mockito.junit.MockitoJUnitRunner
 import org.onap.aai.domain.yang.GenericVnf
 import org.onap.aai.domain.yang.VfModule
 import org.onap.aai.domain.yang.VolumeGroup
-import org.onap.so.bpmn.common.scripts.MsoGroovyTest
-import org.onap.so.bpmn.mock.FileUtil
 import org.onap.aaiclient.client.aai.AAIObjectType
 import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
 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.MsoGroovyTest
+import org.onap.so.bpmn.mock.FileUtil
 import org.onap.so.constants.Defaults
 
-import javax.ws.rs.core.UriBuilder
-
-import static org.mockito.Mockito.*
-
 @RunWith(MockitoJUnitRunner.Silent.class)
 class UpdateVfModuleVolumeInfraV1Test extends MsoGroovyTest{
 
@@ -79,7 +79,7 @@ class UpdateVfModuleVolumeInfraV1Test extends MsoGroovyTest{
 
         UpdateVfModuleVolumeInfraV1 obj = spy(UpdateVfModuleVolumeInfraV1.class)
         when(obj.getAAIClient()).thenReturn(client)
-        AAIResourceUri uri = AAIUriFactory.createResourceFromExistingURI(AAIObjectType.VF_MODULE, UriBuilder.fromPath("/aai/v8/network/generic-vnfs/generic-vnf/12345/vf-modules/vf-module/12345").build())
+        AAIResourceUri uri = AAIUriFactory.createResourceFromExistingURI(Types.VF_MODULE, UriBuilder.fromPath("/aai/v8/network/generic-vnfs/generic-vnf/12345/vf-modules/vf-module/12345").build())
         VfModule vfModule = new VfModule();
         vfModule.setVfModuleId("12345")
         vfModule.setModelInvariantId("ff5256d2-5a33-55df-13ab-12abad84e7ff")
@@ -98,7 +98,7 @@ class UpdateVfModuleVolumeInfraV1Test extends MsoGroovyTest{
 
         UpdateVfModuleVolumeInfraV1 obj = spy(UpdateVfModuleVolumeInfraV1.class)
         when(obj.getAAIClient()).thenReturn(client)
-        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, Defaults.CLOUD_OWNER.toString(), aicCloudRegion, volumeGroupId)
+        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(Defaults.CLOUD_OWNER.toString(), aicCloudRegion).volumeGroup(volumeGroupId))
         VolumeGroup volumeGroup = new VolumeGroup();
         volumeGroup.setVolumeGroupId(volumeGroupId)
 
@@ -116,7 +116,7 @@ class UpdateVfModuleVolumeInfraV1Test extends MsoGroovyTest{
         UpdateVfModuleVolumeInfraV1 obj = spy(UpdateVfModuleVolumeInfraV1.class)
         when(obj.getAAIClient()).thenReturn(client)
 
-        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
+        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId))
         GenericVnf genericVnf = new GenericVnf()
         genericVnf.setVnfId(vnfId)
         genericVnf.setVnfName("testvnfName")
@@ -133,7 +133,7 @@ class UpdateVfModuleVolumeInfraV1Test extends MsoGroovyTest{
         UpdateVfModuleVolumeInfraV1 obj = spy(UpdateVfModuleVolumeInfraV1.class)
         when(obj.getAAIClient()).thenReturn(client)
 
-        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
+        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId))
         when(client.get(GenericVnf.class,uri)).thenReturn(Optional.empty())
         thrown.expect(BpmnError.class)
         obj.queryAAIForGenericVnf(mockExecution, "true")
index 6a8465e..a505a7c 100644 (file)
@@ -42,6 +42,8 @@ import org.onap.aaiclient.client.aai.AAIObjectType
 import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
 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.constants.Defaults
 
 import javax.ws.rs.core.UriBuilder
@@ -75,7 +77,7 @@ class UpdateVfModuleVolumeTest extends MsoGroovyTest{
 
         UpdateVfModuleVolume obj = spy(UpdateVfModuleVolume.class)
         when(obj.getAAIClient()).thenReturn(client)
-        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, Defaults.CLOUD_OWNER.toString(), aicCloudRegion, volumeGroupId)
+        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(Defaults.CLOUD_OWNER.toString(), aicCloudRegion).volumeGroup(volumeGroupId))
         VolumeGroup volumeGroup = new VolumeGroup();
         volumeGroup.setVolumeGroupId(volumeGroupId)
 
@@ -94,7 +96,7 @@ class UpdateVfModuleVolumeTest extends MsoGroovyTest{
 
         UpdateVfModuleVolume obj = spy(UpdateVfModuleVolume.class)
         when(obj.getAAIClient()).thenReturn(client)
-        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, Defaults.CLOUD_OWNER.toString(), aicCloudRegion, volumeGroupId)
+        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(Defaults.CLOUD_OWNER.toString(), aicCloudRegion).volumeGroup(volumeGroupId))
         VolumeGroup volumeGroup = new VolumeGroup();
         volumeGroup.setVolumeGroupId(volumeGroupId)
 
index d7f7547..a385143 100644 (file)
 
 package org.onap.so.bpmn.vcpe.scripts
 
-import com.github.tomakehurst.wiremock.junit.WireMockRule
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse
+import static com.github.tomakehurst.wiremock.client.WireMock.put
+import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching
+import static org.junit.Assert.*
+import static org.mockito.Mockito.*
+import static org.onap.so.bpmn.mock.StubResponseAAI.*
+import javax.ws.rs.core.UriBuilder
 import org.camunda.bpm.engine.delegate.BpmnError
 import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity
 import org.junit.*
 import org.mockito.MockitoAnnotations
+import org.onap.aaiclient.client.aai.AAIResourcesClient
+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.core.RollbackData
 import org.onap.so.bpmn.core.UrnPropertiesReader
 import org.onap.so.bpmn.core.WorkflowException
 import org.onap.so.bpmn.mock.FileUtil
-import org.onap.aaiclient.client.aai.AAIObjectType
-import org.onap.aaiclient.client.aai.AAIResourcesClient
-import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
-
-import javax.ws.rs.core.UriBuilder
-
-import static com.github.tomakehurst.wiremock.client.WireMock.aResponse
-import static com.github.tomakehurst.wiremock.client.WireMock.put
-import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching
-import static org.junit.Assert.*
-import static org.mockito.Mockito.*
-import static org.onap.so.bpmn.mock.StubResponseAAI.*
+import com.github.tomakehurst.wiremock.junit.WireMockRule
 
 class DoCreateAllottedResourceBRGTest extends GroovyTestBase {
 
@@ -157,7 +156,7 @@ class DoCreateAllottedResourceBRGTest extends GroovyTestBase {
     public void createAaiAR() {
         ExecutionEntity mockExecution = setupMock()
         AAIResourcesClient client = mock(AAIResourcesClient.class)
-        when(mockExecution.getVariable("PSI_resourceLink")).thenReturn(AAIUriFactory.createResourceFromExistingURI(AAIObjectType.SERVICE_INSTANCE, UriBuilder.fromPath("/aai/v9/business/customers/customer/" + CUST + "/service-subscriptions/service-subscription/" + SVC + "/service-instances/service-instance/" + INST).build()))
+        when(mockExecution.getVariable("PSI_resourceLink")).thenReturn(AAIUriFactory.createResourceFromExistingURI(Types.SERVICE_INSTANCE, UriBuilder.fromPath("/aai/v9/business/customers/customer/" + CUST + "/service-subscriptions/service-subscription/" + SVC + "/service-instances/service-instance/" + INST).build()))
         when(mockExecution.getVariable("CSI_resourceLink")).thenReturn("/aai/v9/business/customers/customer/" + CUST + "/service-subscriptions/service-subscription/" + SVC + "/service-instances/service-instance/" + INST)
         when(mockExecution.getVariable("allottedResourceModelInfo")).thenReturn("{\n" +
                 "  \"modelInvariantUuid\":\"modelInvariantUuid\",\n" +
@@ -843,7 +842,7 @@ class DoCreateAllottedResourceBRGTest extends GroovyTestBase {
         when(mex.getVariable("allottedResourceId")).thenReturn(ARID)
         when(mex.getVariable("aai.endpoint")).thenReturn(aaiUriPfx)
         when(mex.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn(UrnPropertiesReader.getVariable("mso.workflow.global.default.aai.namespace"))
-        when(mex.getVariable("PSI_resourceLink")).thenReturn(AAIUriFactory.createResourceFromExistingURI(AAIObjectType.SERVICE_INSTANCE, UriBuilder.fromPath("/business/customers/customer/" + CUST + "/service-subscriptions/service-subscription/" + SVC + "/service-instances/service-instance/" + INST).build()))
+        when(mex.getVariable("PSI_resourceLink")).thenReturn(AAIUriFactory.createResourceFromExistingURI(Types.SERVICE_INSTANCE, UriBuilder.fromPath("/business/customers/customer/" + CUST + "/service-subscriptions/service-subscription/" + SVC + "/service-instances/service-instance/" + INST).build()))
         when(mex.getVariable("allottedResourceType")).thenReturn("BRGt")
         when(mex.getVariable("allottedResourceRole")).thenReturn("BRGr")
         when(mex.getVariable("CSI_resourceLink")).thenReturn(aaiUriPfx + "/aai/v9/mycsi")
index 2a68947..0e2c01a 100644 (file)
 
 package org.onap.so.bpmn.vcpe.scripts
 
-import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity
-import org.junit.*
-import org.mockito.MockitoAnnotations
-import org.onap.so.bpmn.core.UrnPropertiesReader
-import org.onap.so.bpmn.core.WorkflowException
-import org.onap.so.bpmn.mock.FileUtil
-import org.onap.aaiclient.client.aai.AAIObjectType
-import org.onap.aaiclient.client.aai.AAIResourcesClient
-import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
-
-import javax.ws.rs.core.UriBuilder
-
 import static org.junit.Assert.*
 import static org.mockito.Mockito.*
 import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetAllottedResource
 import static org.onap.so.bpmn.mock.StubResponseAAI.MockPatchAllottedResource
 import static org.onap.so.bpmn.mock.StubResponseAAI.MockPutAllottedResource
 import static org.onap.so.bpmn.mock.StubResponseAAI.MockPutAllottedResource_500
-
+import javax.ws.rs.core.UriBuilder
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity
+import org.junit.*
+import org.mockito.MockitoAnnotations
+import org.onap.aaiclient.client.aai.AAIResourcesClient
+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.core.RollbackData
-
+import org.onap.so.bpmn.core.UrnPropertiesReader
+import org.onap.so.bpmn.core.WorkflowException
+import org.onap.so.bpmn.mock.FileUtil
 import com.github.tomakehurst.wiremock.junit.WireMockRule
 
 class DoCreateAllottedResourceTXCTest extends GroovyTestBase {
@@ -157,7 +154,7 @@ class DoCreateAllottedResourceTXCTest extends GroovyTestBase {
     public void createAaiAR() {
         ExecutionEntity mex = setupMock()
         initCreateAaiAr(mex)
-        when(mex.getVariable("PSI_resourceLink")).thenReturn(AAIUriFactory.createResourceFromExistingURI(AAIObjectType.SERVICE_INSTANCE, UriBuilder.fromPath("/aai/v9/business/customers/customer/" + CUST + "/service-subscriptions/service-subscription/" + SVC + "/service-instances/service-instance/" + INST).build()))
+        when(mex.getVariable("PSI_resourceLink")).thenReturn(AAIUriFactory.createResourceFromExistingURI(Types.SERVICE_INSTANCE, UriBuilder.fromPath("/aai/v9/business/customers/customer/" + CUST + "/service-subscriptions/service-subscription/" + SVC + "/service-instances/service-instance/" + INST).build()))
         when(mex.getVariable("CSI_resourceLink")).thenReturn("/aai/v9/business/customers/customer/" + CUST + "/service-subscriptions/service-subscription/" + SVC + "/service-instances/service-instance/" + INST)
         when(mex.getVariable("allottedResourceModelInfo")).thenReturn("{\n" +
                 "  \"modelInvariantUuid\":\"modelInvariantUuid\",\n" +
@@ -788,7 +785,7 @@ class DoCreateAllottedResourceTXCTest extends GroovyTestBase {
         when(mex.getVariable("allottedResourceId")).thenReturn(ARID)
         when(mex.getVariable("aai.endpoint")).thenReturn(aaiUriPfx)
         when(mex.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn(UrnPropertiesReader.getVariable("mso.workflow.global.default.aai.namespace"))
-        when(mex.getVariable("PSI_resourceLink")).thenReturn(AAIUriFactory.createResourceFromExistingURI(AAIObjectType.SERVICE_INSTANCE, UriBuilder.fromPath("/business/customers/customer/" + CUST + "/service-subscriptions/service-subscription/" + SVC + "/service-instances/service-instance/" + INST).build()))
+        when(mex.getVariable("PSI_resourceLink")).thenReturn(AAIUriFactory.createResourceFromExistingURI(Types.SERVICE_INSTANCE, UriBuilder.fromPath("/business/customers/customer/" + CUST + "/service-subscriptions/service-subscription/" + SVC + "/service-instances/service-instance/" + INST).build()))
         when(mex.getVariable("allottedResourceType")).thenReturn("TXCt")
         when(mex.getVariable("allottedResourceRole")).thenReturn("TXCr")
         when(mex.getVariable("CSI_resourceLink")).thenReturn(aaiUriPfx + "/aai/v9/mycsi")
index 978814b..ddc30f8 100644 (file)
@@ -35,12 +35,12 @@ import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.Spy;
 import org.mockito.junit.MockitoJUnitRunner;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
-import org.onap.aaiclient.client.aai.AAIObjectType;
 import org.onap.aaiclient.client.aai.AAIResourcesClient;
 import org.onap.aaiclient.client.aai.entities.AAIResultWrapper;
 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.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
 
 @RunWith(MockitoJUnitRunner.class)
 public class AAICreateResourcesTest {
@@ -87,7 +87,8 @@ public class AAICreateResourcesTest {
 
         aaiCreateResources.createAAIProject(projectName, serviceInstanceId);
 
-        AAIResourceUri projectURI = AAIUriFactory.createResourceUri(AAIObjectType.PROJECT, projectName);
+        AAIResourceUri projectURI =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().project(projectName));
 
         verify(aaiResourcesClient, times(1)).createIfNotExists(projectURI, Optional.empty());
         verify(aaiResourcesClient, times(1)).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class));
@@ -103,7 +104,8 @@ public class AAICreateResourcesTest {
 
         HashMap<String, String> owningEntityMap = new HashMap<>();
         owningEntityMap.put("owning-entity-name", owningEntityName);
-        AAIResourceUri owningEntityURI = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntityId);
+        AAIResourceUri owningEntityURI =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().owningEntity(owningEntityId));
 
         verify(aaiResourcesClient, times(1)).createIfNotExists(owningEntityURI, Optional.of(owningEntityMap));
         verify(aaiResourcesClient, times(1)).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class));
@@ -115,7 +117,8 @@ public class AAICreateResourcesTest {
 
         boolean expectedBoolean = aaiCreateResources.existsOwningEntity(owningEntityId);
 
-        AAIResourceUri owningEntityURI = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntityId);
+        AAIResourceUri owningEntityURI =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().owningEntity(owningEntityId));
 
         verify(aaiResourcesClient, times(1)).exists(owningEntityURI);
         assertTrue(expectedBoolean);
@@ -138,7 +141,8 @@ public class AAICreateResourcesTest {
 
         aaiCreateResources.createAAIPlatform(platformName, vnfId);
 
-        AAIResourceUri platformURI = AAIUriFactory.createResourceUri(AAIObjectType.PLATFORM, platformName);
+        AAIResourceUri platformURI =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().platform(platformName));
 
         verify(aaiResourcesClient, times(1)).createIfNotExists(platformURI, Optional.empty());
         verify(aaiResourcesClient, times(1)).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class));
@@ -153,7 +157,7 @@ public class AAICreateResourcesTest {
         aaiCreateResources.createAAILineOfBusiness(lineOfBusiness, vnfId);
 
         AAIResourceUri lineOfBusinessURI =
-                AAIUriFactory.createResourceUri(AAIObjectType.LINE_OF_BUSINESS, lineOfBusiness);
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().lineOfBusiness(lineOfBusiness));
 
         verify(aaiResourcesClient, times(1)).createIfNotExists(lineOfBusinessURI, Optional.empty());
         verify(aaiResourcesClient, times(1)).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class));
@@ -166,8 +170,8 @@ public class AAICreateResourcesTest {
 
         aaiCreateResources.createAAIServiceInstance(globalCustomerId, serviceType, serviceInstanceId);
 
-        AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
-                globalCustomerId, serviceType, serviceInstanceId);
+        AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business()
+                .customer(globalCustomerId).serviceSubscription(serviceType).serviceInstance(serviceInstanceId));
 
         verify(aaiResourcesClient, times(1)).createIfNotExists(serviceInstanceURI, Optional.empty());
     }
@@ -180,7 +184,7 @@ public class AAICreateResourcesTest {
 
         Optional<GenericVnf> actualVnf = aaiCreateResources.getVnfInstance(vnfId);
 
-        AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId);
+        AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId));
 
         verify(aaiResourcesClient, times(1)).get(vnfURI);
         assertEquals(actualVnf, aaiResultWrapper.asBean(GenericVnf.class));
@@ -192,7 +196,7 @@ public class AAICreateResourcesTest {
 
         Optional<GenericVnf> actualVnf = aaiCreateResources.getVnfInstance(vnfId);
 
-        AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId);
+        AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId));
 
         verify(aaiResourcesClient, times(1)).get(vnfURI);
         assertEquals(actualVnf, Optional.empty());
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ActivateSliceSubnet.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ActivateSliceSubnet.bpmn
new file mode 100644 (file)
index 0000000..a2b7f4f
--- /dev/null
@@ -0,0 +1,224 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_04ua9m1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.1.1">
+  <bpmn:process id="ActivateSliceSubnet" name="ActivateSliceSubnet" isExecutable="true">
+    <bpmn:startEvent id="Event_1h6wq31" name="Start">
+      <bpmn:outgoing>Flow_1rnck9o</bpmn:outgoing>
+    </bpmn:startEvent>
+    <bpmn:scriptTask id="Activity_0r1fyr9" name="Preprocess Request" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1rnck9o</bpmn:incoming>
+      <bpmn:outgoing>Flow_1ruhu5s</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new ActivateSliceSubnet()
+nss.preProcessRequest(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_19eqlu7" name="Send Sync Response" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1da78f4</bpmn:incoming>
+      <bpmn:outgoing>Flow_17ebcpc</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new ActivateSliceSubnet()
+nss.sendSyncResponse(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:exclusiveGateway id="Gateway_150n9jp" name="Whether Network type">
+      <bpmn:incoming>Flow_17ebcpc</bpmn:incoming>
+      <bpmn:outgoing>Flow_1t9x0sg</bpmn:outgoing>
+      <bpmn:outgoing>Flow_1q1kc3c</bpmn:outgoing>
+      <bpmn:outgoing>Flow_0ptiwv3</bpmn:outgoing>
+    </bpmn:exclusiveGateway>
+    <bpmn:endEvent id="Event_07betxq">
+      <bpmn:incoming>Flow_0krl0oq</bpmn:incoming>
+      <bpmn:incoming>Flow_0wwue07</bpmn:incoming>
+      <bpmn:incoming>Flow_115ylm7</bpmn:incoming>
+    </bpmn:endEvent>
+    <bpmn:serviceTask id="Activity_1jbt8op" 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">${initResourceOperationStatus}</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_0wjhvtf</bpmn:incoming>
+      <bpmn:outgoing>Flow_1da78f4</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:sequenceFlow id="Flow_1rnck9o" sourceRef="Event_1h6wq31" targetRef="Activity_0r1fyr9" />
+    <bpmn:sequenceFlow id="Flow_1da78f4" sourceRef="Activity_1jbt8op" targetRef="Activity_19eqlu7" />
+    <bpmn:sequenceFlow id="Flow_17ebcpc" sourceRef="Activity_19eqlu7" targetRef="Gateway_150n9jp" />
+    <bpmn:sequenceFlow id="Flow_1t9x0sg" name="Is CN ?" sourceRef="Gateway_150n9jp" targetRef="CallDoActivateCoreNSSI">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("networkType") == "CN"}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:sequenceFlow id="Flow_1q1kc3c" name="Is TN ?" sourceRef="Gateway_150n9jp" targetRef="CallDoActivateTransportNSSI">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("networkType") == "TN"}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:callActivity id="CallDoActivateAccessNSSI" name="Call ANActivateNSSI" calledElement="DoActivateAccessNSSI">
+      <bpmn:extensionElements>
+        <camunda:in source="msoRequestId" target="msoRequestId" />
+        <camunda:in source="globalSubscriberId" target="globalSubscriberId" />
+        <camunda:in source="serviceInstanceID" target="serviceInstanceID" />
+        <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="operationType" target="operationType" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_0ptiwv3</bpmn:incoming>
+      <bpmn:outgoing>Flow_0krl0oq</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:sequenceFlow id="Flow_0ptiwv3" name="Is AN ?" sourceRef="Gateway_150n9jp" targetRef="CallDoActivateAccessNSSI">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("networkType") == "AN"}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:sequenceFlow id="Flow_0krl0oq" sourceRef="CallDoActivateAccessNSSI" targetRef="Event_07betxq" />
+    <bpmn:callActivity id="CallDoActivateCoreNSSI" name="Call CNActivateNSSI" calledElement="DoActivateCoreNSSI">
+      <bpmn:extensionElements>
+        <camunda:in source="msoRequestId" target="msoRequestId" />
+        <camunda:in source="globalSubscriberId" target="globalSubscriberId" />
+        <camunda:in source="serviceInstanceID" target="serviceInstanceID" />
+        <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="operationType" target="operationType" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_1t9x0sg</bpmn:incoming>
+      <bpmn:outgoing>Flow_0wwue07</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:sequenceFlow id="Flow_0wwue07" sourceRef="CallDoActivateCoreNSSI" targetRef="Event_07betxq" />
+    <bpmn:callActivity id="CallDoActivateTransportNSSI" name="Call TNActivateNSSI" calledElement="DoActivateTransportNSSI">
+      <bpmn:extensionElements>
+        <camunda:in source="msoRequestId" target="msoRequestId" />
+        <camunda:in source="globalSubscriberId" target="globalSubscriberId" />
+        <camunda:in source="serviceInstanceID" target="serviceInstanceID" />
+        <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="operationType" target="operationType" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_1q1kc3c</bpmn:incoming>
+      <bpmn:outgoing>Flow_115ylm7</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:sequenceFlow id="Flow_115ylm7" sourceRef="CallDoActivateTransportNSSI" targetRef="Event_07betxq" />
+    <bpmn:scriptTask id="Activity_13km4np" name="Init Resource Operation Status" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1ruhu5s</bpmn:incoming>
+      <bpmn:outgoing>Flow_0wjhvtf</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new ActivateSliceSubnet()
+nss.prepareInitOperationStatus(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_1ruhu5s" sourceRef="Activity_0r1fyr9" targetRef="Activity_13km4np" />
+    <bpmn:sequenceFlow id="Flow_0wjhvtf" sourceRef="Activity_13km4np" targetRef="Activity_1jbt8op" />
+  </bpmn:process>
+  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="ActivateSliceSubnet">
+      <bpmndi:BPMNEdge id="Flow_115ylm7_di" bpmnElement="Flow_115ylm7">
+        <di:waypoint x="1050" y="360" />
+        <di:waypoint x="1140" y="360" />
+        <di:waypoint x="1140" y="258" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0wwue07_di" bpmnElement="Flow_0wwue07">
+        <di:waypoint x="1050" y="240" />
+        <di:waypoint x="1122" y="240" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0krl0oq_di" bpmnElement="Flow_0krl0oq">
+        <di:waypoint x="1050" y="120" />
+        <di:waypoint x="1140" y="120" />
+        <di:waypoint x="1140" y="222" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0ptiwv3_di" bpmnElement="Flow_0ptiwv3">
+        <di:waypoint x="860" y="215" />
+        <di:waypoint x="860" y="120" />
+        <di:waypoint x="950" y="120" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="881" y="166" width="37" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1q1kc3c_di" bpmnElement="Flow_1q1kc3c">
+        <di:waypoint x="860" y="265" />
+        <di:waypoint x="860" y="360" />
+        <di:waypoint x="950" y="360" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="882" y="333" width="36" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1t9x0sg_di" bpmnElement="Flow_1t9x0sg">
+        <di:waypoint x="885" y="240" />
+        <di:waypoint x="950" y="240" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="894" y="222" width="37" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_17ebcpc_di" bpmnElement="Flow_17ebcpc">
+        <di:waypoint x="770" y="240" />
+        <di:waypoint x="835" y="240" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1da78f4_di" bpmnElement="Flow_1da78f4">
+        <di:waypoint x="620" y="240" />
+        <di:waypoint x="670" y="240" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1ruhu5s_di" bpmnElement="Flow_1ruhu5s">
+        <di:waypoint x="330" y="240" />
+        <di:waypoint x="390" y="240" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1rnck9o_di" bpmnElement="Flow_1rnck9o">
+        <di:waypoint x="188" y="240" />
+        <di:waypoint x="230" y="240" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0wjhvtf_di" bpmnElement="Flow_0wjhvtf">
+        <di:waypoint x="490" y="240" />
+        <di:waypoint x="520" y="240" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="Activity_19eqlu7_di" bpmnElement="Activity_19eqlu7">
+        <dc:Bounds x="670" y="200" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Gateway_150n9jp_di" bpmnElement="Gateway_150n9jp" isMarkerVisible="true">
+        <dc:Bounds x="835" y="215" width="50" height="50" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="817" y="258" width="85" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_07betxq_di" bpmnElement="Event_07betxq">
+        <dc:Bounds x="1122" y="222" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1jbt8op_di" bpmnElement="Activity_1jbt8op">
+        <dc:Bounds x="520" y="200" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0663qmy_di" bpmnElement="CallDoActivateAccessNSSI">
+        <dc:Bounds x="950" y="80" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0k9faej_di" bpmnElement="CallDoActivateCoreNSSI">
+        <dc:Bounds x="950" y="200" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0rmx5qf_di" bpmnElement="CallDoActivateTransportNSSI">
+        <dc:Bounds x="950" y="320" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_1h6wq31_di" bpmnElement="Event_1h6wq31">
+        <dc:Bounds x="152" y="222" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="158" y="265" width="24" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0r1fyr9_di" bpmnElement="Activity_0r1fyr9">
+        <dc:Bounds x="230" y="200" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_13km4np_di" bpmnElement="Activity_13km4np">
+        <dc:Bounds x="390" y="200" width="100" height="80" />
+      </bpmndi:BPMNShape>
+    </bpmndi:BPMNPlane>
+  </bpmndi:BPMNDiagram>
+</bpmn:definitions>
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
new file mode 100644 (file)
index 0000000..450faae
--- /dev/null
@@ -0,0 +1,219 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_04bdlh3" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.1.1">
+  <bpmn:process id="AllocateSliceSubnet" name="AllocateSliceSubnet" isExecutable="true">
+    <bpmn:startEvent id="Event_16inlk9" name="Start">
+      <bpmn:outgoing>Flow_0cmaj9d</bpmn:outgoing>
+    </bpmn:startEvent>
+    <bpmn:scriptTask id="Activity_1hyt0pb" name="Preprocess Request" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0cmaj9d</bpmn:incoming>
+      <bpmn:outgoing>Flow_0ou7wr9</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new AllocateSliceSubnet()
+nss.preProcessRequest(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_1usi32q" name="Send Sync Response" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0ayd6dj</bpmn:incoming>
+      <bpmn:outgoing>Flow_0m5n6md</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new AllocateSliceSubnet()
+nss.sendSyncResponse(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:exclusiveGateway id="Gateway_15a04ct" name="Whether Network type">
+      <bpmn:incoming>Flow_0m5n6md</bpmn:incoming>
+      <bpmn:outgoing>Flow_1fij4ds</bpmn:outgoing>
+      <bpmn:outgoing>Flow_0g7721r</bpmn:outgoing>
+      <bpmn:outgoing>Flow_1kk0exp</bpmn:outgoing>
+    </bpmn:exclusiveGateway>
+    <bpmn:endEvent id="Event_18u424w">
+      <bpmn:incoming>Flow_09b50tn</bpmn:incoming>
+      <bpmn:incoming>Flow_189zwjw</bpmn:incoming>
+      <bpmn:incoming>Flow_1coedjo</bpmn:incoming>
+    </bpmn:endEvent>
+    <bpmn:serviceTask id="Activity_0qlstj2" 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">${initResourceOperationStatus}</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_18cgkru</bpmn:incoming>
+      <bpmn:outgoing>Flow_0ayd6dj</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:sequenceFlow id="Flow_0cmaj9d" sourceRef="Event_16inlk9" targetRef="Activity_1hyt0pb" />
+    <bpmn:sequenceFlow id="Flow_0ayd6dj" sourceRef="Activity_0qlstj2" targetRef="Activity_1usi32q" />
+    <bpmn:sequenceFlow id="Flow_0m5n6md" sourceRef="Activity_1usi32q" targetRef="Gateway_15a04ct" />
+    <bpmn:sequenceFlow id="Flow_1fij4ds" name="Is CN ?" sourceRef="Gateway_15a04ct" targetRef="CallDoAllocateCoreNSSI">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("networkType") == "CN"}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:sequenceFlow id="Flow_0g7721r" name="Is TN ?" sourceRef="Gateway_15a04ct" targetRef="CallDoAllocateTransportNSSI">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("networkType") == "TN"}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:sequenceFlow id="Flow_1kk0exp" name="Is AN ?" sourceRef="Gateway_15a04ct" targetRef="CallDoAllocateAccessNSSI">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("networkType") == "AN"}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:sequenceFlow id="Flow_09b50tn" sourceRef="CallDoAllocateAccessNSSI" targetRef="Event_18u424w" />
+    <bpmn:callActivity id="CallDoAllocateAccessNSSI" name="Call ANAllocateNSSI" calledElement="DoAllocateAccessNSSI">
+      <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_1kk0exp</bpmn:incoming>
+      <bpmn:outgoing>Flow_09b50tn</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:scriptTask id="Activity_1ydx2rx" name="Init Resource Operation Status" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0ou7wr9</bpmn:incoming>
+      <bpmn:outgoing>Flow_18cgkru</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new AllocateSliceSubnet()
+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>
+        <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_1fij4ds</bpmn:incoming>
+      <bpmn:outgoing>Flow_1coedjo</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:sequenceFlow id="Flow_1coedjo" sourceRef="CallDoAllocateCoreNSSI" targetRef="Event_18u424w" />
+  </bpmn:process>
+  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="AllocateSliceSubnet">
+      <bpmndi:BPMNEdge id="Flow_1coedjo_di" bpmnElement="Flow_1coedjo">
+        <di:waypoint x="1080" y="190" />
+        <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="1170" y="208" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_18cgkru_di" bpmnElement="Flow_18cgkru">
+        <di:waypoint x="480" y="190" />
+        <di:waypoint x="550" y="190" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0ou7wr9_di" bpmnElement="Flow_0ou7wr9">
+        <di:waypoint x="320" y="190" />
+        <di:waypoint x="380" y="190" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_09b50tn_di" bpmnElement="Flow_09b50tn">
+        <di:waypoint x="1080" y="90" />
+        <di:waypoint x="1170" y="90" />
+        <di:waypoint x="1170" y="172" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1kk0exp_di" bpmnElement="Flow_1kk0exp">
+        <di:waypoint x="890" y="165" />
+        <di:waypoint x="890" y="90" />
+        <di:waypoint x="980" y="90" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="911" y="125" width="37" height="14" />
+        </bpmndi:BPMNLabel>
+      </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" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="912" y="273" width="36" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1fij4ds_di" bpmnElement="Flow_1fij4ds">
+        <di:waypoint x="915" y="190" />
+        <di:waypoint x="980" y="190" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="921" y="172" width="37" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0m5n6md_di" bpmnElement="Flow_0m5n6md">
+        <di:waypoint x="800" y="190" />
+        <di:waypoint x="865" y="190" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0ayd6dj_di" bpmnElement="Flow_0ayd6dj">
+        <di:waypoint x="650" y="190" />
+        <di:waypoint x="700" y="190" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0cmaj9d_di" bpmnElement="Flow_0cmaj9d">
+        <di:waypoint x="188" y="190" />
+        <di:waypoint x="220" y="190" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="Event_16inlk9_di" bpmnElement="Event_16inlk9">
+        <dc:Bounds x="152" y="172" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="158" y="215" width="24" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1hyt0pb_di" bpmnElement="Activity_1hyt0pb">
+        <dc:Bounds x="220" y="150" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1usi32q_di" bpmnElement="Activity_1usi32q">
+        <dc:Bounds x="700" y="150" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Gateway_15a04ct_di" bpmnElement="Gateway_15a04ct" isMarkerVisible="true">
+        <dc:Bounds x="865" y="165" width="50" height="50" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="847" y="208" width="85" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_18u424w_di" bpmnElement="Event_18u424w">
+        <dc:Bounds x="1152" y="172" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0qlstj2_di" bpmnElement="Activity_0qlstj2">
+        <dc:Bounds x="550" y="150" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0ezmthy_di" bpmnElement="CallDoAllocateAccessNSSI">
+        <dc:Bounds x="980" y="50" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <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:BPMNPlane>
+  </bpmndi:BPMNDiagram>
+</bpmn:definitions>
index 5a4b3ac..a1f7033 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.16.2">
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.4.1">
   <bpmn:process id="CreateSDNCNetworkResource" name="CreateSDNCNetworkResource" isExecutable="true">
     <bpmn:startEvent id="createNS_StartEvent" name="createNS_StartEvent">
       <bpmn:outgoing>SequenceFlow_1qo2pln</bpmn:outgoing>
@@ -26,7 +26,7 @@ dcsi.prepareSDNCRequest(execution)</bpmn:script>
         <camunda:out source="WorkflowException" target="WorkflowException" />
         <camunda:in source="sdncAdapterWorkflowRequest" target="sdncAdapterWorkflowRequest" />
       </bpmn:extensionElements>
-      <bpmn:incoming>SequenceFlow_15mvedq</bpmn:incoming>
+      <bpmn:incoming>SequenceFlow_11i5vrt</bpmn:incoming>
       <bpmn:outgoing>SequenceFlow_0u8d8j5</bpmn:outgoing>
     </bpmn:callActivity>
     <bpmn:sequenceFlow id="SequenceFlow_0w2es8j" sourceRef="Task_1dlrfiw" targetRef="Task_13sx2bp" />
@@ -46,7 +46,7 @@ def dcsi = new CreateSDNCNetworkResource()
 dcsi.preProcessRequest(execution)</bpmn:script>
     </bpmn:scriptTask>
     <bpmn:sequenceFlow id="SequenceFlow_1mz0vdx" sourceRef="Task_0tezqd4" targetRef="Task_18tomkl" />
-    <bpmn:sequenceFlow id="SequenceFlow_15mvedq" sourceRef="Task_18tomkl" targetRef="CallActivity_1600xlj" />
+    <bpmn:sequenceFlow id="SequenceFlow_15mvedq" sourceRef="Task_18tomkl" targetRef="ExclusiveGateway_08sinju" />
     <bpmn:scriptTask id="Task_0tezqd4" name="Create progress update parameters before create" scriptFormat="groovy">
       <bpmn:incoming>SequenceFlow_0khtova</bpmn:incoming>
       <bpmn:outgoing>SequenceFlow_1mz0vdx</bpmn:outgoing>
@@ -155,157 +155,210 @@ dcsi.updateResourceInput(execution)</bpmn:script>
     <bpmn:sequenceFlow id="SequenceFlow_0oqe2oa" sourceRef="Task_1czbh37" targetRef="ExclusiveGateway_0cdulnk" />
     <bpmn:scriptTask id="Task_1czbh37" name="post SDNC create call" scriptFormat="groovy">
       <bpmn:incoming>SequenceFlow_0u8d8j5</bpmn:incoming>
+      <bpmn:incoming>SequenceFlow_06wc3j9</bpmn:incoming>
       <bpmn:outgoing>SequenceFlow_0oqe2oa</bpmn:outgoing>
       <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
 def dcsi = new CreateSDNCNetworkResource()
 dcsi.afterCreateSDNCCall(execution)</bpmn:script>
     </bpmn:scriptTask>
+    <bpmn:exclusiveGateway id="ExclusiveGateway_08sinju" name="is Async Required" default="SequenceFlow_11i5vrt">
+      <bpmn:incoming>SequenceFlow_15mvedq</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_11i5vrt</bpmn:outgoing>
+      <bpmn:outgoing>SequenceFlow_1r9zpux</bpmn:outgoing>
+    </bpmn:exclusiveGateway>
+    <bpmn:sequenceFlow id="SequenceFlow_11i5vrt" name="No" sourceRef="ExclusiveGateway_08sinju" targetRef="CallActivity_1600xlj" />
+    <bpmn:callActivity id="CallActivity_12vwqrq" name="Call SDNC Service Create&#10; Adapter V2&#10;" calledElement="SDNCAdapterRestV2">
+      <bpmn:extensionElements>
+        <camunda:in source="mso-request-id" target="mso-request-id" />
+        <camunda:in source="mso-service-instance-id" target="mso-service-instance-id" />
+        <camunda:out source="sdncAdapterResponse" target="CRENWKI_createSDNCResponse" />
+        <camunda:out source="SDNCA_ResponseCode" target="CRESDNCRES_sdncCreateReturnCode" />
+        <camunda:out source="SDNCA_SuccessIndicator" target="CRESDNCRES_SuccessIndicator" />
+        <camunda:out source="WorkflowException" target="WorkflowException" />
+        <camunda:in source="sdncAdapterWorkflowRequest" target="sdncAdapterWorkflowRequest" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>SequenceFlow_1r9zpux</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_06wc3j9</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:sequenceFlow id="SequenceFlow_1r9zpux" name="Yes" sourceRef="ExclusiveGateway_08sinju" targetRef="CallActivity_12vwqrq">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isAsyncRequired") == "Yes")}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:sequenceFlow id="SequenceFlow_06wc3j9" sourceRef="CallActivity_12vwqrq" targetRef="Task_1czbh37" />
   </bpmn:process>
   <bpmndi:BPMNDiagram id="BPMNDiagram_1">
     <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="CreateSDNCNetworkResource">
       <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="createNS_StartEvent">
-        <dc:Bounds x="-188" y="111" width="36" height="36" />
+        <dc:Bounds x="182" y="111" width="36" height="36" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="-214" y="147" width="89" height="27" />
+          <dc:Bounds x="159" y="147" width="84" height="27" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="SequenceFlow_1qo2pln_di" bpmnElement="SequenceFlow_1qo2pln">
-        <di:waypoint x="-152" y="129" />
-        <di:waypoint x="-96" y="129" />
+        <di:waypoint x="218" y="129" />
+        <di:waypoint x="274" y="129" />
         <bpmndi:BPMNLabel>
           <dc:Bounds x="-87.5" y="108" width="90" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_0khtova_di" bpmnElement="SequenceFlow_0khtova">
-        <di:waypoint x="513" y="129" />
-        <di:waypoint x="573" y="129" />
+        <di:waypoint x="883" y="129" />
+        <di:waypoint x="943" y="129" />
         <bpmndi:BPMNLabel>
           <dc:Bounds x="391.5" y="108" width="90" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="ScriptTask_03j6ogo_di" bpmnElement="PreprocessIncomingRequest_task">
-        <dc:Bounds x="413" y="89" width="100" height="80" />
+        <dc:Bounds x="783" y="89" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="EndEvent_15pcuuc_di" bpmnElement="EndEvent_1x6k78c">
-        <dc:Bounds x="1046" y="317" width="36" height="36" />
+        <dc:Bounds x="1416" y="317" width="36" height="36" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="1009" y="359" width="84" height="27" />
+          <dc:Bounds x="1379" y="359" width="85" height="27" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="CallActivity_1600xlj_di" bpmnElement="CallActivity_1600xlj">
-        <dc:Bounds x="-10" y="295" width="100" height="80" />
+        <dc:Bounds x="380" y="295" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="SequenceFlow_0w2es8j_di" bpmnElement="SequenceFlow_0w2es8j">
-        <di:waypoint x="4" y="129" />
-        <di:waypoint x="67" y="129" />
+        <di:waypoint x="374" y="129" />
+        <di:waypoint x="437" y="129" />
         <bpmndi:BPMNLabel>
           <dc:Bounds x="74" y="108" width="90" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_18l3crb_di" bpmnElement="SequenceFlow_18l3crb">
-        <di:waypoint x="167" y="129" />
-        <di:waypoint x="231" y="129" />
+        <di:waypoint x="537" y="129" />
+        <di:waypoint x="601" y="129" />
         <bpmndi:BPMNLabel>
           <dc:Bounds x="235.5" y="108" width="90" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="ScriptTask_0lc6l7a_di" bpmnElement="Task_1dlrfiw">
-        <dc:Bounds x="-96" y="89" width="100" height="80" />
+        <dc:Bounds x="274" y="89" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="ScriptTask_14l9mlv_di" bpmnElement="Task_13sx2bp">
-        <dc:Bounds x="67" y="89" width="100" height="80" />
+        <dc:Bounds x="437" y="89" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="SequenceFlow_1mz0vdx_di" bpmnElement="SequenceFlow_1mz0vdx">
-        <di:waypoint x="673" y="129" />
-        <di:waypoint x="738" y="129" />
+        <di:waypoint x="1043" y="129" />
+        <di:waypoint x="1108" y="129" />
         <bpmndi:BPMNLabel>
           <dc:Bounds x="608" y="123" width="90" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_15mvedq_di" bpmnElement="SequenceFlow_15mvedq">
-        <di:waypoint x="788" y="169" />
-        <di:waypoint x="788" y="218" />
-        <di:waypoint x="-89" y="218" />
-        <di:waypoint x="-89" y="335" />
-        <di:waypoint x="-17" y="335" />
+        <di:waypoint x="1158" y="169" />
+        <di:waypoint x="1158" y="218" />
+        <di:waypoint x="220" y="218" />
+        <di:waypoint x="220" y="335" />
+        <di:waypoint x="265" y="335" />
         <bpmndi:BPMNLabel>
           <dc:Bounds x="349" y="197" width="90" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="ScriptTask_1kqf4ge_di" bpmnElement="Task_0tezqd4">
-        <dc:Bounds x="573" y="89" width="100" height="80" />
+        <dc:Bounds x="943" y="89" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="ServiceTask_1q6ssz7_di" bpmnElement="Task_18tomkl">
-        <dc:Bounds x="738" y="89" width="100" height="80" />
+        <dc:Bounds x="1108" y="89" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="ServiceTask_1cm8iwr_di" bpmnElement="ServiceTask_1cm8iwr">
-        <dc:Bounds x="720" y="295" width="100" height="80" />
+        <dc:Bounds x="1090" y="295" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="ScriptTask_1g5zyi6_di" bpmnElement="ScriptTask_1g5zyi6">
-        <dc:Bounds x="890" y="295" width="100" height="80" />
+        <dc:Bounds x="1260" y="295" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="ExclusiveGateway_0cdulnk_di" bpmnElement="ExclusiveGateway_0cdulnk" isMarkerVisible="true">
-        <dc:Bounds x="371" y="310" width="50" height="50" />
+        <dc:Bounds x="741" y="310" width="50" height="50" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="365" y="273" width="63" height="27" />
+          <dc:Bounds x="735" y="273" width="63" height="27" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="SequenceFlow_1dww8ye_di" bpmnElement="SequenceFlow_1dww8ye">
-        <di:waypoint x="396" y="360" />
-        <di:waypoint x="396" y="471" />
-        <di:waypoint x="440" y="471" />
+        <di:waypoint x="766" y="360" />
+        <di:waypoint x="766" y="471" />
+        <di:waypoint x="810" y="471" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="403" y="391" width="18" height="14" />
+          <dc:Bounds x="774" y="391" width="17" height="14" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="ScriptTask_0hu4lhm_di" bpmnElement="Task_0uwlr22">
-        <dc:Bounds x="553" y="295" width="100" height="80" />
+        <dc:Bounds x="923" y="295" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="SequenceFlow_05m2j56_di" bpmnElement="SequenceFlow_05m2j56">
-        <di:waypoint x="421" y="335" />
-        <di:waypoint x="553" y="335" />
+        <di:waypoint x="791" y="335" />
+        <di:waypoint x="923" y="335" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="480" y="317" width="15" height="14" />
+          <dc:Bounds x="850" y="317" width="15" height="14" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_05niqbf_di" bpmnElement="SequenceFlow_05niqbf">
-        <di:waypoint x="540" y="471" />
-        <di:waypoint x="603" y="471" />
-        <di:waypoint x="603" y="375" />
+        <di:waypoint x="910" y="471" />
+        <di:waypoint x="973" y="471" />
+        <di:waypoint x="973" y="375" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_1cd8ujq_di" bpmnElement="SequenceFlow_1cd8ujq">
-        <di:waypoint x="653" y="335" />
-        <di:waypoint x="720" y="335" />
+        <di:waypoint x="1023" y="335" />
+        <di:waypoint x="1090" y="335" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_0auvfvm_di" bpmnElement="SequenceFlow_0auvfvm">
-        <di:waypoint x="990" y="335" />
-        <di:waypoint x="1046" y="335" />
+        <di:waypoint x="1360" y="335" />
+        <di:waypoint x="1416" y="335" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="CallActivity_0aywvn3_di" bpmnElement="Task_0bga3e8">
-        <dc:Bounds x="440" y="431" width="100" height="80" />
+        <dc:Bounds x="810" y="431" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="SequenceFlow_0svppaq_di" bpmnElement="SequenceFlow_0svppaq">
-        <di:waypoint x="331" y="129" />
-        <di:waypoint x="413" y="129" />
+        <di:waypoint x="701" y="129" />
+        <di:waypoint x="783" y="129" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="ScriptTask_1kzr9lu_di" bpmnElement="Task_1mbzgl7">
-        <dc:Bounds x="231" y="89" width="100" height="80" />
+        <dc:Bounds x="601" y="89" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="SequenceFlow_0drbyvd_di" bpmnElement="SequenceFlow_0drbyvd">
-        <di:waypoint x="820" y="335" />
-        <di:waypoint x="890" y="335" />
+        <di:waypoint x="1190" y="335" />
+        <di:waypoint x="1260" y="335" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_0u8d8j5_di" bpmnElement="SequenceFlow_0u8d8j5">
-        <di:waypoint x="90" y="335" />
-        <di:waypoint x="185" y="335" />
+        <di:waypoint x="480" y="335" />
+        <di:waypoint x="555" y="335" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_0oqe2oa_di" bpmnElement="SequenceFlow_0oqe2oa">
-        <di:waypoint x="285" y="335" />
-        <di:waypoint x="371" y="335" />
+        <di:waypoint x="655" y="335" />
+        <di:waypoint x="741" y="335" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="ScriptTask_1njkyn8_di" bpmnElement="Task_1czbh37">
-        <dc:Bounds x="185" y="295" width="100" height="80" />
+        <dc:Bounds x="555" y="295" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ExclusiveGateway_08sinju_di" bpmnElement="ExclusiveGateway_08sinju" isMarkerVisible="true">
+        <dc:Bounds x="265" y="310" width="50" height="50" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="247" y="273" width="89" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_11i5vrt_di" bpmnElement="SequenceFlow_11i5vrt">
+        <di:waypoint x="315" y="335" />
+        <di:waypoint x="380" y="335" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="340" y="317" width="15" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="CallActivity_12vwqrq_di" bpmnElement="CallActivity_12vwqrq">
+        <dc:Bounds x="380" y="431" width="100" height="80" />
       </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_1r9zpux_di" bpmnElement="SequenceFlow_1r9zpux">
+        <di:waypoint x="290" y="360" />
+        <di:waypoint x="290" y="471" />
+        <di:waypoint x="380" y="471" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="296" y="413" width="18" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_06wc3j9_di" bpmnElement="SequenceFlow_06wc3j9">
+        <di:waypoint x="480" y="471" />
+        <di:waypoint x="605" y="471" />
+        <di:waypoint x="605" y="375" />
+      </bpmndi:BPMNEdge>
     </bpmndi:BPMNPlane>
   </bpmndi:BPMNDiagram>
 </bpmn:definitions>
index 27bd01b..60d7355 100644 (file)
@@ -1,11 +1,11 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_1wio50w" 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:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_1wio50w" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.4.1">
   <bpmn:process id="CreateSliceService" name="CreateSliceService" isExecutable="true">
     <bpmn:startEvent id="StartEvent_1nbljfd" name="Create Slice Service Creation Flow">
       <bpmn:outgoing>SequenceFlow_03s744c</bpmn:outgoing>
     </bpmn:startEvent>
     <bpmn:intermediateCatchEvent id="IntermediateCatchEvent_0vilb24" name="Waiting for confirmation">
-      <bpmn:outgoing>SequenceFlow_1fk37v7</bpmn:outgoing>
+      <bpmn:outgoing>SequenceFlow_060j650</bpmn:outgoing>
       <bpmn:linkEventDefinition id="LinkEventDefinition_197u5pe" name="WaitingForConfirmation" />
     </bpmn:intermediateCatchEvent>
     <bpmn:scriptTask id="ScriptTask_1tc44ge" name="PreProcess Incoming Request" scriptFormat="groovy">
@@ -16,7 +16,7 @@ def css= new CreateSliceService()
 css.preProcessRequest(execution)</bpmn:script>
     </bpmn:scriptTask>
     <bpmn:scriptTask id="ScriptTask_1jgtb0y" name="Process User Options" scriptFormat="groovy">
-      <bpmn:incoming>SequenceFlow_1cv0wop</bpmn:incoming>
+      <bpmn:incoming>SequenceFlow_1whq7vc</bpmn:incoming>
       <bpmn:outgoing>SequenceFlow_197cm2e</bpmn:outgoing>
       <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
 def css = new CreateSliceService()
@@ -27,50 +27,27 @@ css.processUserOptions(execution)</bpmn:script>
       <bpmn:outgoing>SequenceFlow_12t5exy</bpmn:outgoing>
       <bpmn:outgoing>SequenceFlow_038lb9m</bpmn:outgoing>
     </bpmn:exclusiveGateway>
-    <bpmn:scriptTask id="ScriptTask_0l3d1ai" name="Process Decomposition" scriptFormat="groovy">
-      <bpmn:incoming>SequenceFlow_1t19ips</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_0jrclmc</bpmn:outgoing>
-      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
-def css = new CreateSliceService()
-css.processDecomposition(execution)</bpmn:script>
-    </bpmn:scriptTask>
-    <bpmn:scriptTask id="ScriptTask_1eo3m4q" name="Prepare NST Selection" scriptFormat="groovy">
-      <bpmn:incoming>SequenceFlow_046irye</bpmn:incoming>
-      <bpmn:outgoing>Flow_1l8mfej</bpmn:outgoing>
-      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
-def css = new CreateSliceService()
-css.prepareSelectNSTRequest(execution)</bpmn:script>
-    </bpmn:scriptTask>
     <bpmn:callActivity id="CallActivity_139l55g" name="Call DoCreateSliceServiceInstance&#10;" calledElement="DoCreateSliceServiceInstance">
       <bpmn:extensionElements>
         <camunda:in source="msoRequestId" target="msoRequestId" />
         <camunda:in source="serviceInstanceId" target="serviceInstanceId" />
         <camunda:in source="serviceInstanceName" target="serviceInstanceName" />
-        <camunda:in source="serviceModelInfo" target="serviceModelInfo" />
-        <camunda:in source="productFamilyId" target="productFamilyId" />
-        <camunda:in source="serviceInputParams" target="serviceInputParams" />
         <camunda:in source="globalSubscriberId" target="globalSubscriberId" />
         <camunda:in source="subscriptionServiceType" target="subscriptionServiceType" />
         <camunda:in source="serviceType" target="serviceType" />
         <camunda:in source="uuiRequest" target="uuiRequest" />
-        <camunda:in source="requestAction" target="operationType" />
         <camunda:in source="operationId" target="operationId" />
-        <camunda:in source="serviceProfile" target="serviceProfile" />
-        <camunda:in source="sliceProfileTn" target="sliceProfileTn" />
-        <camunda:in source="sliceProfileCn" target="sliceProfileCn" />
-        <camunda:in source="sliceProfileAn" target="sliceProfileAn" />
-        <camunda:in source="sliceServiceDecomposition" target="sliceServiceDecomposition" />
         <camunda:out source="WorkflowException" target="WorkflowException" />
         <camunda:out source="rollbackData" target="rollbackData" />
         <camunda:out source="rolledBack" target="rolledBack" />
-        <camunda:out source="allottedResourceId" target="allottedResourceId" />
         <camunda:out source="serviceInstanceData" target="serviceInstanceData" />
+        <camunda:in source="sliceTaskParams" target="sliceTaskParams" />
       </bpmn:extensionElements>
-      <bpmn:incoming>SequenceFlow_1p8vxo5</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_1g8m7tq</bpmn:outgoing>
+      <bpmn:incoming>SequenceFlow_1dfon41</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0jhqtls</bpmn:outgoing>
     </bpmn:callActivity>
     <bpmn:intermediateThrowEvent id="IntermediateThrowEvent_1v96asi" name="Goto Waiting for Confirmation">
-      <bpmn:incoming>SequenceFlow_0it2g9j</bpmn:incoming>
+      <bpmn:incoming>SequenceFlow_00kcej9</bpmn:incoming>
       <bpmn:linkEventDefinition id="LinkEventDefinition_0uj34dx" name="WaitingForConfirmation" />
     </bpmn:intermediateThrowEvent>
     <bpmn:scriptTask id="ScriptTask_0gb975b" name="Prepare Update Orchestration Task" scriptFormat="groovy">
@@ -126,14 +103,6 @@ css.prepareUpdateOrchestrationTask(execution)</bpmn:script>
 def css = new CreateSliceService()
 css.prepareInitServiceOperationStatus(execution)</bpmn:script>
     </bpmn:scriptTask>
-    <bpmn:intermediateThrowEvent id="IntermediateThrowEvent_1ex8ke9" name="Goto Create Slice Service">
-      <bpmn:incoming>SequenceFlow_0jrclmc</bpmn:incoming>
-      <bpmn:linkEventDefinition id="LinkEventDefinition_0de65en" name="CreateSliceService" />
-    </bpmn:intermediateThrowEvent>
-    <bpmn:intermediateCatchEvent id="IntermediateCatchEvent_1wii8im" name="Create Slice Service">
-      <bpmn:outgoing>SequenceFlow_1o1tu0f</bpmn:outgoing>
-      <bpmn:linkEventDefinition id="LinkEventDefinition_1krpcdk" name="CreateSliceService" />
-    </bpmn:intermediateCatchEvent>
     <bpmn:scriptTask id="ScriptTask_1ssh2l9" name="Prepare Update Service Oper Status((finish)" scriptFormat="groovy">
       <bpmn:incoming>SequenceFlow_0lbdfmt</bpmn:incoming>
       <bpmn:outgoing>SequenceFlow_1qv8qw1</bpmn:outgoing>
@@ -161,34 +130,8 @@ css.prepareUpdateServiceOperationStatus(execution)</bpmn:script>
         </camunda:connector>
       </bpmn:extensionElements>
       <bpmn:incoming>SequenceFlow_0t094g7</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_046irye</bpmn:outgoing>
+      <bpmn:outgoing>SequenceFlow_0xmvg4v</bpmn:outgoing>
     </bpmn:serviceTask>
-    <bpmn:callActivity id="CallActivity_1bnkmaz" name="Call Decompose Service" calledElement="DecomposeService">
-      <bpmn:extensionElements>
-        <camunda:in source="msoRequestId" target="msoRequestId" />
-        <camunda:in source="serviceInstanceId" target="serviceInstanceId" />
-        <camunda:in source="serviceModelInfo" target="serviceModelInfo" />
-        <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" />
-        <camunda:out source="serviceDecomposition" target="sliceServiceDecomposition" />
-        <camunda:out source="WorkflowException" target="WorkflowException" />
-      </bpmn:extensionElements>
-      <bpmn:incoming>SequenceFlow_0q7yc2c</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_1t19ips</bpmn:outgoing>
-    </bpmn:callActivity>
-    <bpmn:scriptTask id="ScriptTask_0o2r07o" name="Prepare&#10;Decompose&#10;Service&#10;" scriptFormat="groovy">
-      <bpmn:incoming>Flow_1u4srgq</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_0q7yc2c</bpmn:outgoing>
-      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
-def dcsi= new CreateSliceService()
-dcsi.prepareDecomposeService(execution)</bpmn:script>
-    </bpmn:scriptTask>
-    <bpmn:scriptTask id="ScriptTask_0b7senu" name="Prepare Create OrchestrationTask" scriptFormat="groovy">
-      <bpmn:incoming>SequenceFlow_1o1tu0f</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_1sq6kp6</bpmn:outgoing>
-      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
-def css= new CreateSliceService()
-css.prepareCreateOrchestrationTask(execution)</bpmn:script>
-    </bpmn:scriptTask>
     <bpmn:callActivity id="CallActivity_0h88mep" name="Call HandleOrchestrationTask" calledElement="HandleOrchestrationTask">
       <bpmn:extensionElements>
         <camunda:out source="statusCode" target="CSSOT_dbResponseCode" />
@@ -201,8 +144,8 @@ css.prepareCreateOrchestrationTask(execution)</bpmn:script>
         <camunda:in source="CSSOT_paramJson" target="paramJson" />
         <camunda:in source="CSSOT_requestMethod" target="method" />
       </bpmn:extensionElements>
-      <bpmn:incoming>SequenceFlow_1sq6kp6</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_1p8vxo5</bpmn:outgoing>
+      <bpmn:incoming>SequenceFlow_1x4n7an</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1dfon41</bpmn:outgoing>
     </bpmn:callActivity>
     <bpmn:callActivity id="CallActivity_0n47zoh" name="Call HandleOrchestrationTask" calledElement="HandleOrchestrationTask">
       <bpmn:extensionElements>
@@ -217,7 +160,7 @@ css.prepareCreateOrchestrationTask(execution)</bpmn:script>
         <camunda:in source="CSSOT_requestMethod" target="method" />
       </bpmn:extensionElements>
       <bpmn:incoming>SequenceFlow_18kur12</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_0it2g9j</bpmn:outgoing>
+      <bpmn:outgoing>SequenceFlow_00kcej9</bpmn:outgoing>
     </bpmn:callActivity>
     <bpmn:scriptTask id="ScriptTask_12h8542" name="Prepare Update Orchestration Task" scriptFormat="groovy">
       <bpmn:incoming>SequenceFlow_12t5exy</bpmn:incoming>
@@ -242,28 +185,6 @@ css.prepareUpdateOrchestrationTask(execution)</bpmn:script>
       <bpmn:incoming>SequenceFlow_0thd6ny</bpmn:incoming>
       <bpmn:outgoing>SequenceFlow_0477975</bpmn:outgoing>
     </bpmn:callActivity>
-    <bpmn:callActivity id="CallActivity_0g98b71" name="Call HandleOrchestrationTask" calledElement="HandleOrchestrationTask">
-      <bpmn:extensionElements>
-        <camunda:out source="statusCode" target="CSSOT_dbResponseCode" />
-        <camunda:out source="response" target="CSSOT_dbResponse" />
-        <camunda:in source="CSSOT_taskId" target="taskId" />
-        <camunda:in source="msoRequestId" target="requestId" />
-        <camunda:in source="CSSOT_name" target="taskName" />
-        <camunda:in source="CSSOT_status" target="taskStatus" />
-        <camunda:in source="CSSOT_isManual" target="isManual" />
-        <camunda:in source="CSSOT_paramJson" target="paramJson" />
-        <camunda:in source="CSSOT_requestMethod" target="method" />
-      </bpmn:extensionElements>
-      <bpmn:incoming>SequenceFlow_0h2oree</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_1cv0wop</bpmn:outgoing>
-    </bpmn:callActivity>
-    <bpmn:scriptTask id="ScriptTask_08wim95" name="Prepare Get User Options" scriptFormat="groovy">
-      <bpmn:incoming>SequenceFlow_16uz2t9</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_0h2oree</bpmn:outgoing>
-      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
-def css = new CreateSliceService()
-css.prepareGetUserOptions(execution)</bpmn:script>
-    </bpmn:scriptTask>
     <bpmn:callActivity id="CallActivity_0jdzpem" name="Call HandleOrchestrationTask" calledElement="HandleOrchestrationTask">
       <bpmn:extensionElements>
         <camunda:out source="statusCode" target="CSSOT_dbResponseCode" />
@@ -332,13 +253,6 @@ css.prepareUpdateOrchestrationTask(execution)</bpmn:script>
       <bpmn:incoming>SequenceFlow_1qv8qw1</bpmn:incoming>
       <bpmn:outgoing>SequenceFlow_11rbv41</bpmn:outgoing>
     </bpmn:serviceTask>
-    <bpmn:scriptTask id="ScriptTask_1jj846g" name="Send Sync Ack Response" scriptFormat="groovy">
-      <bpmn:incoming>SequenceFlow_1g8m7tq</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_1ey6m1e</bpmn:outgoing>
-      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
-def css = new CreateSliceService()
-css.sendSyncResponse(execution)</bpmn:script>
-    </bpmn:scriptTask>
     <bpmn:callActivity id="CallActivity_0cxst1i" name="Call DoAllocateNSIandNSSI&#10;" calledElement="DoAllocateNSIandNSSI">
       <bpmn:extensionElements>
         <camunda:in source="msoRequestId" target="msoRequestId" />
@@ -354,42 +268,27 @@ css.sendSyncResponse(execution)</bpmn:script>
         <camunda:in source="uuiRequest" target="uuiRequest" />
         <camunda:in source="requestAction" target="operationType" />
         <camunda:in source="operationId" target="operationId" />
-        <camunda:in source="serviceProfile" target="serviceProfile" />
-        <camunda:in source="sliceProfileTn" target="sliceProfileTn" />
-        <camunda:in source="sliceProfileCn" target="sliceProfileCn" />
-        <camunda:in source="sliceProfileAn" target="sliceProfileAn" />
         <camunda:in source="sliceTaskParams" target="sliceTaskParams" />
         <camunda:in source="CSSOT_taskId" target="taskId" />
         <camunda:in source="CSSOT_name" target="taskName" />
         <camunda:in source="CSSOT_status" target="taskStatus" />
         <camunda:in source="CSSOT_isManual" target="isManual" />
         <camunda:in source="resourceSharingLevel" target="resourceSharingLevel" />
-        <camunda:in source="globalSubscriberId" target="globalSubscriberId" />
         <camunda:out source="WorkflowException" target="WorkflowException" />
         <camunda:out source="rollbackData" target="rollbackData" />
         <camunda:out source="rolledBack" target="rolledBack" />
         <camunda:in source="allottedResourceId" target="allottedResourceId" />
-        <camunda:in source="nstSolution" target="nstSolution" />
       </bpmn:extensionElements>
       <bpmn:incoming>SequenceFlow_1bevt3a</bpmn:incoming>
       <bpmn:outgoing>SequenceFlow_0mlrlbv</bpmn:outgoing>
     </bpmn:callActivity>
-    <bpmn:endEvent id="EndEvent_0bh0kwx">
-      <bpmn:incoming>SequenceFlow_12qt5ci</bpmn:incoming>
-      <bpmn:errorEventDefinition id="ErrorEventDefinition_1xa66sx" errorRef="Error_0p2naox" />
-    </bpmn:endEvent>
     <bpmn:sequenceFlow id="SequenceFlow_03s744c" sourceRef="StartEvent_1nbljfd" targetRef="ScriptTask_1tc44ge" />
     <bpmn:sequenceFlow id="SequenceFlow_07e12rt" sourceRef="ScriptTask_1tc44ge" targetRef="ScriptTask_1xxag1o" />
-    <bpmn:sequenceFlow id="SequenceFlow_1cv0wop" sourceRef="CallActivity_0g98b71" targetRef="ScriptTask_1jgtb0y" />
     <bpmn:sequenceFlow id="SequenceFlow_197cm2e" sourceRef="ScriptTask_1jgtb0y" targetRef="ExclusiveGateway_0elbczl" />
     <bpmn:sequenceFlow id="SequenceFlow_12t5exy" name="continue" sourceRef="ExclusiveGateway_0elbczl" targetRef="ScriptTask_12h8542">
       <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("taskAction") == "commit"}</bpmn:conditionExpression>
     </bpmn:sequenceFlow>
     <bpmn:sequenceFlow id="SequenceFlow_038lb9m" name="abort" sourceRef="ExclusiveGateway_0elbczl" targetRef="ScriptTask_1mscu5w" />
-    <bpmn:sequenceFlow id="SequenceFlow_1t19ips" sourceRef="CallActivity_1bnkmaz" targetRef="ScriptTask_0l3d1ai" />
-    <bpmn:sequenceFlow id="SequenceFlow_1p8vxo5" sourceRef="CallActivity_0h88mep" targetRef="CallActivity_139l55g" />
-    <bpmn:sequenceFlow id="SequenceFlow_1g8m7tq" sourceRef="CallActivity_139l55g" targetRef="ScriptTask_1jj846g" />
-    <bpmn:sequenceFlow id="SequenceFlow_0it2g9j" sourceRef="CallActivity_0n47zoh" targetRef="IntermediateThrowEvent_1v96asi" />
     <bpmn:sequenceFlow id="SequenceFlow_18kur12" sourceRef="ScriptTask_0gb975b" targetRef="CallActivity_0n47zoh" />
     <bpmn:sequenceFlow id="SequenceFlow_0mlrlbv" sourceRef="CallActivity_0cxst1i" targetRef="ExclusiveGateway_18eld2o" />
     <bpmn:sequenceFlow id="SequenceFlow_1c6ka9h" name="No" sourceRef="ExclusiveGateway_18eld2o" targetRef="EndEvent_0x406rw" />
@@ -399,36 +298,15 @@ css.sendSyncResponse(execution)</bpmn:script>
     <bpmn:sequenceFlow id="SequenceFlow_0klb3ey" sourceRef="ScriptTask_1ef3voz" targetRef="CallActivity_15pl4ld" />
     <bpmn:sequenceFlow id="SequenceFlow_11rbv41" sourceRef="ServiceTask_0esr949" targetRef="EndEvent_05h01gx" />
     <bpmn:sequenceFlow id="SequenceFlow_0t094g7" sourceRef="ScriptTask_1xxag1o" targetRef="ServiceTask_0kd6p6p" />
-    <bpmn:sequenceFlow id="SequenceFlow_1o1tu0f" sourceRef="IntermediateCatchEvent_1wii8im" targetRef="ScriptTask_0b7senu" />
     <bpmn:sequenceFlow id="SequenceFlow_0lbdfmt" sourceRef="CallActivity_15pl4ld" targetRef="ScriptTask_1ssh2l9" />
     <bpmn:sequenceFlow id="SequenceFlow_1qv8qw1" sourceRef="ScriptTask_1ssh2l9" targetRef="ServiceTask_0esr949" />
-    <bpmn:sequenceFlow id="SequenceFlow_0q7yc2c" sourceRef="ScriptTask_0o2r07o" targetRef="CallActivity_1bnkmaz" />
-    <bpmn:sequenceFlow id="SequenceFlow_1sq6kp6" sourceRef="ScriptTask_0b7senu" targetRef="CallActivity_0h88mep" />
     <bpmn:sequenceFlow id="SequenceFlow_0thd6ny" sourceRef="ScriptTask_12h8542" targetRef="CallActivity_0o89wmf" />
     <bpmn:sequenceFlow id="SequenceFlow_0477975" sourceRef="CallActivity_0o89wmf" targetRef="IntermediateThrowEvent_0ktwpki" />
-    <bpmn:sequenceFlow id="SequenceFlow_0h2oree" sourceRef="ScriptTask_08wim95" targetRef="CallActivity_0g98b71" />
     <bpmn:sequenceFlow id="SequenceFlow_19lsayh" sourceRef="ScriptTask_1mscu5w" targetRef="CallActivity_0jdzpem" />
     <bpmn:sequenceFlow id="SequenceFlow_10ng1vx" sourceRef="CallActivity_0jdzpem" targetRef="EndEvent_1oouvuh" />
     <bpmn:sequenceFlow id="SequenceFlow_1bevt3a" sourceRef="IntermediateCatchEvent_0pkvfun" targetRef="CallActivity_0cxst1i" />
-    <bpmn:sequenceFlow id="SequenceFlow_1ey6m1e" sourceRef="ScriptTask_1jj846g" targetRef="CallActivity_0v4mw2x" />
-    <bpmn:receiveTask id="Task_1b5t88h" name="Waiting for confirmation" messageRef="Message_0c4b2r5">
-      <bpmn:incoming>SequenceFlow_1fk37v7</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_16uz2t9</bpmn:outgoing>
-    </bpmn:receiveTask>
-    <bpmn:sequenceFlow id="SequenceFlow_1fk37v7" sourceRef="IntermediateCatchEvent_0vilb24" targetRef="Task_1b5t88h" />
-    <bpmn:sequenceFlow id="SequenceFlow_16uz2t9" sourceRef="Task_1b5t88h" targetRef="ScriptTask_08wim95" />
-    <bpmn:boundaryEvent id="BoundaryEvent_0clo9pv" attachedToRef="Task_1b5t88h">
-      <bpmn:outgoing>SequenceFlow_12qt5ci</bpmn:outgoing>
-      <bpmn:timerEventDefinition>
-        <bpmn:timeDuration xsi:type="bpmn:tFormalExpression">PT2H</bpmn:timeDuration>
-      </bpmn:timerEventDefinition>
-    </bpmn:boundaryEvent>
-    <bpmn:sequenceFlow id="SequenceFlow_12qt5ci" sourceRef="BoundaryEvent_0clo9pv" targetRef="EndEvent_0bh0kwx" />
     <bpmn:callActivity id="CallActivity_0v4mw2x" name="Call DoCreateSliceServiceOption&#10;" calledElement="DoCreateSliceServiceOption">
       <bpmn:extensionElements>
-        <camunda:in source="nstModelUuid" target="nstModelUuid" />
-        <camunda:in source="nstModelInvariantUuid" target="nstModelInvariantUuid" />
-        <camunda:in source="serviceProfile" target="serviceProfile" />
         <camunda:in source="msoRequestId" target="msoRequestId" />
         <camunda:in source="sliceTaskParams" target="sliceTaskParams" />
         <camunda:in source="resourceSharingLevel" target="resourceSharingLevel" />
@@ -436,17 +314,11 @@ css.sendSyncResponse(execution)</bpmn:script>
         <camunda:in source="globalSubscriberId" target="globalSubscriberId" />
         <camunda:in source="subscriptionServiceType" target="subscriptionServiceType" />
         <camunda:in source="serviceType" target="serviceType" />
-        <camunda:in source="nstSolution" target="nstSolution" />
-        <camunda:out source="sliceProfileTn" target="sliceProfileTn" />
-        <camunda:out source="sliceProfileCn" target="sliceProfileCn" />
-        <camunda:out source="sliceProfileAn" target="sliceProfileAn" />
       </bpmn:extensionElements>
-      <bpmn:incoming>SequenceFlow_1ey6m1e</bpmn:incoming>
+      <bpmn:incoming>SequenceFlow_1f6dyxo</bpmn:incoming>
       <bpmn:outgoing>SequenceFlow_1aaozcg</bpmn:outgoing>
     </bpmn:callActivity>
     <bpmn:sequenceFlow id="SequenceFlow_1aaozcg" sourceRef="CallActivity_0v4mw2x" targetRef="ScriptTask_0gb975b" />
-    <bpmn:sequenceFlow id="SequenceFlow_046irye" sourceRef="ServiceTask_0kd6p6p" targetRef="ScriptTask_1eo3m4q" />
-    <bpmn:sequenceFlow id="SequenceFlow_0jrclmc" sourceRef="ScriptTask_0l3d1ai" targetRef="IntermediateThrowEvent_1ex8ke9" />
     <bpmn:scriptTask id="ScriptTask_19uxoi8" name="Update AAI Status" scriptFormat="groovy">
       <bpmn:incoming>SequenceFlow_0n4xku8</bpmn:incoming>
       <bpmn:outgoing>SequenceFlow_0kixzdj</bpmn:outgoing>
@@ -456,8 +328,81 @@ def css = new CreateSliceService()
 css.updateAAIOrchStatus(execution)</bpmn:script>
     </bpmn:scriptTask>
     <bpmn:sequenceFlow id="SequenceFlow_0kixzdj" sourceRef="ScriptTask_19uxoi8" targetRef="ScriptTask_1ef3voz" />
-    <bpmn:sequenceFlow id="Flow_1l8mfej" sourceRef="ScriptTask_1eo3m4q" targetRef="Activity_1ge49xu" />
-    <bpmn:callActivity id="Activity_1ge49xu" name="Handle NST Selection OOF request" calledElement="DoHandleOofRequest">
+    <bpmn:scriptTask id="ScriptTask_09mxr0w" name="Send Sync Ack Response" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_0jhqtls</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_12wo878</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def css = new CreateSliceService()
+css.sendSyncResponse(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="ScriptTask_1ac05ww" name="Prepare Create OrchestrationTask" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_0xmvg4v</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1x4n7an</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def css= new CreateSliceService()
+css.prepareCreateOrchestrationTask(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="SequenceFlow_0xmvg4v" sourceRef="ServiceTask_0kd6p6p" targetRef="ScriptTask_1ac05ww" />
+    <bpmn:sequenceFlow id="SequenceFlow_1x4n7an" sourceRef="ScriptTask_1ac05ww" targetRef="CallActivity_0h88mep" />
+    <bpmn:sequenceFlow id="SequenceFlow_1dfon41" sourceRef="CallActivity_0h88mep" targetRef="CallActivity_139l55g" />
+    <bpmn:sequenceFlow id="SequenceFlow_0jhqtls" sourceRef="CallActivity_139l55g" targetRef="ScriptTask_09mxr0w" />
+    <bpmn:intermediateCatchEvent id="IntermediateCatchEvent_0gceuxu" name="Create Slice Service">
+      <bpmn:outgoing>SequenceFlow_14c2tav</bpmn:outgoing>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_0wnloof" name="CreateSliceService" />
+    </bpmn:intermediateCatchEvent>
+    <bpmn:sequenceFlow id="SequenceFlow_14c2tav" sourceRef="IntermediateCatchEvent_0gceuxu" targetRef="ScriptTask_1ayg9y8" />
+    <bpmn:sequenceFlow id="SequenceFlow_00kcej9" sourceRef="CallActivity_0n47zoh" targetRef="IntermediateThrowEvent_1v96asi" />
+    <bpmn:sequenceFlow id="SequenceFlow_060j650" sourceRef="IntermediateCatchEvent_0vilb24" targetRef="ScriptTask_04qudo2" />
+    <bpmn:intermediateThrowEvent id="IntermediateThrowEvent_0lpvnze" name="Goto Create Slice Service">
+      <bpmn:incoming>SequenceFlow_12wo878</bpmn:incoming>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_1oxsvp3" name="CreateSliceService" />
+    </bpmn:intermediateThrowEvent>
+    <bpmn:sequenceFlow id="SequenceFlow_12wo878" sourceRef="ScriptTask_09mxr0w" targetRef="IntermediateThrowEvent_0lpvnze" />
+    <bpmn:scriptTask id="ScriptTask_13roglo" name="Process NST Solutions" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_1r2jtal</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1f6dyxo</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def css = new CreateSliceService()
+css.processNSTSolutions(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="SequenceFlow_1f6dyxo" sourceRef="ScriptTask_13roglo" targetRef="CallActivity_0v4mw2x" />
+    <bpmn:receiveTask id="ReceiveTask_02qzb6i" name="Waiting for confirmation" />
+    <bpmn:endEvent id="EndEvent_0bz8a65">
+      <bpmn:incoming>SequenceFlow_1vesvto</bpmn:incoming>
+      <bpmn:errorEventDefinition id="ErrorEventDefinition_1hni1r1" errorRef="Error_0p2naox" />
+    </bpmn:endEvent>
+    <bpmn:boundaryEvent id="BoundaryEvent_0p4swyp" attachedToRef="ReceiveTask_02qzb6i">
+      <bpmn:outgoing>SequenceFlow_1vesvto</bpmn:outgoing>
+      <bpmn:timerEventDefinition id="TimerEventDefinition_112p48l">
+        <bpmn:timeDuration xsi:type="bpmn:tFormalExpression">PT2H</bpmn:timeDuration>
+      </bpmn:timerEventDefinition>
+    </bpmn:boundaryEvent>
+    <bpmn:sequenceFlow id="SequenceFlow_1vesvto" sourceRef="BoundaryEvent_0p4swyp" targetRef="EndEvent_0bz8a65" />
+    <bpmn:scriptTask id="ScriptTask_04qudo2" name="Prepare Get User Options" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_060j650</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0ti386y</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def css = new CreateSliceService()
+css.prepareGetUserOptions(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="SequenceFlow_0ti386y" sourceRef="ScriptTask_04qudo2" targetRef="CallActivity_1vu3zcv" />
+    <bpmn:callActivity id="CallActivity_1vu3zcv" name="Call HandleOrchestrationTask" calledElement="HandleOrchestrationTask">
+      <bpmn:extensionElements>
+        <camunda:out source="statusCode" target="CSSOT_dbResponseCode" />
+        <camunda:out source="response" target="CSSOT_dbResponse" />
+        <camunda:in source="CSSOT_taskId" target="taskId" />
+        <camunda:in source="msoRequestId" target="requestId" />
+        <camunda:in source="CSSOT_name" target="taskName" />
+        <camunda:in source="CSSOT_status" target="taskStatus" />
+        <camunda:in source="CSSOT_isManual" target="isManual" />
+        <camunda:in source="CSSOT_paramJson" target="paramJson" />
+        <camunda:in source="CSSOT_requestMethod" target="method" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>SequenceFlow_0ti386y</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1whq7vc</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:sequenceFlow id="SequenceFlow_1whq7vc" sourceRef="CallActivity_1vu3zcv" targetRef="ScriptTask_1jgtb0y" />
+    <bpmn:callActivity id="CallActivity_0xf2g6c" name="Handle NST Selection OOF request" calledElement="DoHandleOofRequest">
       <bpmn:extensionElements>
         <camunda:in source="nstSelectionUrl" target="apiPath" />
         <camunda:in source="nstSelection_correlator" target="correlator" />
@@ -467,18 +412,18 @@ css.updateAAIOrchStatus(execution)</bpmn:script>
         <camunda:out source="asyncCallbackResponse" target="nstSelection_oofResponse" />
         <camunda:in source="nstSelection_oofRequest" target="oofRequest" />
       </bpmn:extensionElements>
-      <bpmn:incoming>Flow_1l8mfej</bpmn:incoming>
-      <bpmn:outgoing>Flow_0vq2rmw</bpmn:outgoing>
+      <bpmn:incoming>SequenceFlow_02sve8o</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1r2jtal</bpmn:outgoing>
     </bpmn:callActivity>
-    <bpmn:sequenceFlow id="Flow_0vq2rmw" sourceRef="Activity_1ge49xu" targetRef="Activity_12v8ykp" />
-    <bpmn:scriptTask id="Activity_12v8ykp" name="Process NST Solutions" scriptFormat="groovy">
-      <bpmn:incoming>Flow_0vq2rmw</bpmn:incoming>
-      <bpmn:outgoing>Flow_1u4srgq</bpmn:outgoing>
+    <bpmn:sequenceFlow id="SequenceFlow_1r2jtal" sourceRef="CallActivity_0xf2g6c" targetRef="ScriptTask_13roglo" />
+    <bpmn:scriptTask id="ScriptTask_1ayg9y8" name="Prepare NST Selection" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_14c2tav</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_02sve8o</bpmn:outgoing>
       <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
 def css = new CreateSliceService()
-css.processNSTSolutions(execution)</bpmn:script>
+css.prepareSelectNSTRequest(execution)</bpmn:script>
     </bpmn:scriptTask>
-    <bpmn:sequenceFlow id="Flow_1u4srgq" sourceRef="Activity_12v8ykp" targetRef="ScriptTask_0o2r07o" />
+    <bpmn:sequenceFlow id="SequenceFlow_02sve8o" sourceRef="ScriptTask_1ayg9y8" targetRef="CallActivity_0xf2g6c" />
   </bpmn:process>
   <bpmn:message id="Message_0c4b2r5" name="SliceServiceTask" />
   <bpmn:error id="Error_03akl5v" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
@@ -486,360 +431,334 @@ css.processNSTSolutions(execution)</bpmn:script>
   <bpmndi:BPMNDiagram id="BPMNDiagram_1">
     <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="CreateSliceService">
       <bpmndi:BPMNEdge id="SequenceFlow_0kixzdj_di" bpmnElement="SequenceFlow_0kixzdj">
-        <di:waypoint x="745" y="801" />
-        <di:waypoint x="823" y="801" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_0jrclmc_di" bpmnElement="SequenceFlow_0jrclmc">
-        <di:waypoint x="1540" y="121" />
-        <di:waypoint x="1584" y="121" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_046irye_di" bpmnElement="SequenceFlow_046irye">
-        <di:waypoint x="650" y="121" />
-        <di:waypoint x="685" y="121" />
+        <di:waypoint x="684" y="965" />
+        <di:waypoint x="764" y="965" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_1aaozcg_di" bpmnElement="SequenceFlow_1aaozcg">
-        <di:waypoint x="1115" y="289" />
-        <di:waypoint x="1193" y="289" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_12qt5ci_di" bpmnElement="SequenceFlow_12qt5ci">
-        <di:waypoint x="335" y="514" />
-        <di:waypoint x="335" y="611" />
-        <di:waypoint x="335" y="593" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_16uz2t9_di" bpmnElement="SequenceFlow_16uz2t9">
-        <di:waypoint x="385" y="456" />
-        <di:waypoint x="467" y="456" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_1fk37v7_di" bpmnElement="SequenceFlow_1fk37v7">
-        <di:waypoint x="214" y="456" />
-        <di:waypoint x="285" y="456" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_1ey6m1e_di" bpmnElement="SequenceFlow_1ey6m1e">
-        <di:waypoint x="930" y="289" />
-        <di:waypoint x="1015" y="289" />
+        <di:waypoint x="980" y="350" />
+        <di:waypoint x="1060" y="350" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_1bevt3a_di" bpmnElement="SequenceFlow_1bevt3a">
-        <di:waypoint x="214" y="801" />
-        <di:waypoint x="285" y="801" />
+        <di:waypoint x="213" y="965" />
+        <di:waypoint x="274" y="965" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_10ng1vx_di" bpmnElement="SequenceFlow_10ng1vx">
-        <di:waypoint x="1471" y="645" />
-        <di:waypoint x="1584" y="645" />
+        <di:waypoint x="1294" y="805" />
+        <di:waypoint x="1396" y="805" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_19lsayh_di" bpmnElement="SequenceFlow_19lsayh">
-        <di:waypoint x="1293" y="645" />
-        <di:waypoint x="1371" y="645" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_0h2oree_di" bpmnElement="SequenceFlow_0h2oree">
-        <di:waypoint x="567" y="456" />
-        <di:waypoint x="645" y="456" />
+        <di:waypoint x="1124" y="805" />
+        <di:waypoint x="1194" y="805" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_0477975_di" bpmnElement="SequenceFlow_0477975">
-        <di:waypoint x="1471" y="456" />
-        <di:waypoint x="1584" y="456" />
+        <di:waypoint x="1294" y="620" />
+        <di:waypoint x="1396" y="620" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_0thd6ny_di" bpmnElement="SequenceFlow_0thd6ny">
-        <di:waypoint x="1293" y="456" />
-        <di:waypoint x="1371" y="456" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_1sq6kp6_di" bpmnElement="SequenceFlow_1sq6kp6">
-        <di:waypoint x="385" y="289" />
-        <di:waypoint x="467" y="289" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_0q7yc2c_di" bpmnElement="SequenceFlow_0q7yc2c">
-        <di:waypoint x="1240" y="121" />
-        <di:waypoint x="1280" y="121" />
+        <di:waypoint x="1124" y="620" />
+        <di:waypoint x="1194" y="620" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_1qv8qw1_di" bpmnElement="SequenceFlow_1qv8qw1">
-        <di:waypoint x="1297" y="801" />
-        <di:waypoint x="1375" y="801" />
+        <di:waypoint x="1174" y="965" />
+        <di:waypoint x="1244" y="965" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_0lbdfmt_di" bpmnElement="SequenceFlow_0lbdfmt">
-        <di:waypoint x="1105" y="801" />
-        <di:waypoint x="1197" y="801" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_1o1tu0f_di" bpmnElement="SequenceFlow_1o1tu0f">
-        <di:waypoint x="214" y="289" />
-        <di:waypoint x="285" y="289" />
+        <di:waypoint x="1034" y="965" />
+        <di:waypoint x="1074" y="965" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_0t094g7_di" bpmnElement="SequenceFlow_0t094g7">
-        <di:waypoint x="510" y="121" />
-        <di:waypoint x="550" y="121" />
+        <di:waypoint x="510" y="122" />
+        <di:waypoint x="564" y="122" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_11rbv41_di" bpmnElement="SequenceFlow_11rbv41">
-        <di:waypoint x="1475" y="801" />
-        <di:waypoint x="1585" y="801" />
+        <di:waypoint x="1344" y="965" />
+        <di:waypoint x="1396" y="965" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_0klb3ey_di" bpmnElement="SequenceFlow_0klb3ey">
-        <di:waypoint x="923" y="801" />
-        <di:waypoint x="1005" y="801" />
+        <di:waypoint x="864" y="965" />
+        <di:waypoint x="934" y="965" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_0n4xku8_di" bpmnElement="SequenceFlow_0n4xku8">
-        <di:waypoint x="538" y="801" />
-        <di:waypoint x="645" y="801" />
+        <di:waypoint x="489" y="965" />
+        <di:waypoint x="584" y="965" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="584" y="783" width="18" height="14" />
+          <dc:Bounds x="529" y="947" width="18" height="14" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_1c6ka9h_di" bpmnElement="SequenceFlow_1c6ka9h">
-        <di:waypoint x="513" y="826" />
-        <di:waypoint x="513" y="926" />
+        <di:waypoint x="464" y="990" />
+        <di:waypoint x="464" y="1090" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="521" y="832" width="15" height="14" />
+          <dc:Bounds x="472" y="998" width="15" height="14" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_0mlrlbv_di" bpmnElement="SequenceFlow_0mlrlbv">
-        <di:waypoint x="385" y="801" />
-        <di:waypoint x="488" y="801" />
+        <di:waypoint x="374" y="965" />
+        <di:waypoint x="439" y="965" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_18kur12_di" bpmnElement="SequenceFlow_18kur12">
-        <di:waypoint x="1293" y="289" />
-        <di:waypoint x="1371" y="289" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_0it2g9j_di" bpmnElement="SequenceFlow_0it2g9j">
-        <di:waypoint x="1471" y="289" />
-        <di:waypoint x="1584" y="289" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_1g8m7tq_di" bpmnElement="SequenceFlow_1g8m7tq">
-        <di:waypoint x="745" y="289" />
-        <di:waypoint x="830" y="289" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_1p8vxo5_di" bpmnElement="SequenceFlow_1p8vxo5">
-        <di:waypoint x="567" y="289" />
-        <di:waypoint x="645" y="289" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_1t19ips_di" bpmnElement="SequenceFlow_1t19ips">
-        <di:waypoint x="1380" y="121" />
-        <di:waypoint x="1440" y="121" />
+        <di:waypoint x="1160" y="350" />
+        <di:waypoint x="1220" y="350" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_038lb9m_di" bpmnElement="SequenceFlow_038lb9m">
-        <di:waypoint x="1065" y="481" />
-        <di:waypoint x="1065" y="645" />
-        <di:waypoint x="1193" y="645" />
+        <di:waypoint x="884" y="645" />
+        <di:waypoint x="884" y="805" />
+        <di:waypoint x="1024" y="805" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="1067" y="560" width="27" height="14" />
+          <dc:Bounds x="886" y="722" width="27" height="14" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_12t5exy_di" bpmnElement="SequenceFlow_12t5exy">
-        <di:waypoint x="1090" y="456" />
-        <di:waypoint x="1193" y="456" />
+        <di:waypoint x="909" y="620" />
+        <di:waypoint x="1024" y="620" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="1121.5" y="438" width="42" height="14" />
+          <dc:Bounds x="911" y="602" width="42" height="14" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_197cm2e_di" bpmnElement="SequenceFlow_197cm2e">
-        <di:waypoint x="930" y="456" />
-        <di:waypoint x="1040" y="456" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_1cv0wop_di" bpmnElement="SequenceFlow_1cv0wop">
-        <di:waypoint x="745" y="456" />
-        <di:waypoint x="830" y="456" />
+        <di:waypoint x="804" y="620" />
+        <di:waypoint x="859" y="620" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_07e12rt_di" bpmnElement="SequenceFlow_07e12rt">
-        <di:waypoint x="350" y="121" />
-        <di:waypoint x="410" y="121" />
+        <di:waypoint x="350" y="122" />
+        <di:waypoint x="410" y="122" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_03s744c_di" bpmnElement="SequenceFlow_03s744c">
-        <di:waypoint x="214" y="121" />
-        <di:waypoint x="250" y="121" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="Flow_1l8mfej_di" bpmnElement="Flow_1l8mfej">
-        <di:waypoint x="785" y="121" />
-        <di:waypoint x="830" y="121" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="Flow_0vq2rmw_di" bpmnElement="Flow_0vq2rmw">
-        <di:waypoint x="930" y="121" />
-        <di:waypoint x="1000" y="121" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="Flow_1u4srgq_di" bpmnElement="Flow_1u4srgq">
-        <di:waypoint x="1100" y="121" />
-        <di:waypoint x="1140" y="121" />
+        <di:waypoint x="214" y="122" />
+        <di:waypoint x="250" y="122" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="StartEvent_1nbljfd_di" bpmnElement="StartEvent_1nbljfd">
-        <dc:Bounds x="178" y="103" width="36" height="36" />
+        <dc:Bounds x="178" y="104" width="36" height="36" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="156" y="146" width="82" height="40" />
+          <dc:Bounds x="156" y="147" width="82" height="40" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="IntermediateCatchEvent_0vilb24_di" bpmnElement="IntermediateCatchEvent_0vilb24">
-        <dc:Bounds x="178" y="438" width="36" height="36" />
+        <dc:Bounds x="177" y="602" width="36" height="36" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="168" y="481" width="60" height="27" />
+          <dc:Bounds x="167" y="645" width="60" height="27" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="ScriptTask_1jgtb0y_di" bpmnElement="ScriptTask_1jgtb0y">
-        <dc:Bounds x="830" y="416" width="100" height="80" />
+        <dc:Bounds x="704" y="580" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="ExclusiveGateway_0elbczl_di" bpmnElement="ExclusiveGateway_0elbczl" isMarkerVisible="true">
-        <dc:Bounds x="1040" y="431" width="50" height="50" />
+        <dc:Bounds x="859" y="595" width="50" height="50" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="1027" y="413" width="78" height="14" />
+          <dc:Bounds x="846" y="577" width="78" height="14" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="CallActivity_139l55g_di" bpmnElement="CallActivity_139l55g">
-        <dc:Bounds x="645" y="249" width="100" height="80" />
+        <dc:Bounds x="1060" y="84" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="IntermediateThrowEvent_1v96asi_di" bpmnElement="IntermediateThrowEvent_1v96asi">
-        <dc:Bounds x="1584" y="271" width="36" height="36" />
+        <dc:Bounds x="1402" y="332" width="36" height="36" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="1567" y="312" width="81" height="27" />
+          <dc:Bounds x="1385" y="373" width="81" height="27" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="ScriptTask_0gb975b_di" bpmnElement="ScriptTask_0gb975b">
-        <dc:Bounds x="1193" y="249" width="100" height="80" />
+        <dc:Bounds x="1060" y="310" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="ExclusiveGateway_18eld2o_di" bpmnElement="ExclusiveGateway_18eld2o" isMarkerVisible="true">
-        <dc:Bounds x="488" y="776" width="50" height="50" />
+        <dc:Bounds x="439" y="940" width="50" height="50" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="483" y="746" width="60" height="27" />
+          <dc:Bounds x="434" y="910" width="60" height="27" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="EndEvent_0x406rw_di" bpmnElement="EndEvent_0x406rw">
-        <dc:Bounds x="495" y="926" width="36" height="36" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="ScriptTask_0l3d1ai_di" bpmnElement="ScriptTask_0l3d1ai">
-        <dc:Bounds x="1440" y="81" width="100" height="80" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="CallActivity_1bnkmaz_di" bpmnElement="CallActivity_1bnkmaz">
-        <dc:Bounds x="1280" y="81" width="100" height="80" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="ScriptTask_0o2r07o_di" bpmnElement="ScriptTask_0o2r07o">
-        <dc:Bounds x="1140" y="81" width="100" height="80" />
+        <dc:Bounds x="446" y="1090" width="36" height="36" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="ScriptTask_1tc44ge_di" bpmnElement="ScriptTask_1tc44ge">
-        <dc:Bounds x="250" y="81" width="100" height="80" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Activity_0yce5sp_di" bpmnElement="Activity_12v8ykp">
-        <dc:Bounds x="1000" y="81" width="100" height="80" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Activity_0uymgnp_di" bpmnElement="Activity_1ge49xu">
-        <dc:Bounds x="830" y="81" width="100" height="80" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="ScriptTask_1eo3m4q_di" bpmnElement="ScriptTask_1eo3m4q">
-        <dc:Bounds x="685" y="81" width="100" height="80" />
+        <dc:Bounds x="250" y="82" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="ServiceTask_0kd6p6p_di" bpmnElement="ServiceTask_0kd6p6p">
-        <dc:Bounds x="550" y="81" width="100" height="80" />
+        <dc:Bounds x="564" y="82" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="ScriptTask_1xxag1o_di" bpmnElement="ScriptTask_1xxag1o">
-        <dc:Bounds x="410" y="81" width="100" height="80" />
+        <dc:Bounds x="410" y="82" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="SubProcess_1yv9i68_di" bpmnElement="SubProcess_1yv9i68" isExpanded="true">
-        <dc:Bounds x="685" y="1080" width="781" height="196" />
+        <dc:Bounds x="688" y="1072" width="781" height="196" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="SequenceFlow_08mlzwz_di" bpmnElement="SequenceFlow_08mlzwz">
-        <di:waypoint x="1079" y="1184" />
-        <di:waypoint x="1353" y="1184" />
+        <di:waypoint x="1082" y="1176" />
+        <di:waypoint x="1356" y="1176" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_1w67v6s_di" bpmnElement="SequenceFlow_1w67v6s">
-        <di:waypoint x="751" y="1184" />
-        <di:waypoint x="979" y="1184" />
+        <di:waypoint x="754" y="1176" />
+        <di:waypoint x="982" y="1176" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="StartEvent_1omdx56_di" bpmnElement="StartEvent_1omdx56">
-        <dc:Bounds x="715" y="1166" width="36" height="36" />
+        <dc:Bounds x="718" y="1158" width="36" height="36" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="EndEvent_1jx3026_di" bpmnElement="EndEvent_1jx3026">
-        <dc:Bounds x="1353" y="1166" width="36" height="36" />
+        <dc:Bounds x="1356" y="1158" width="36" height="36" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="ScriptTask_1swzdpw_di" bpmnElement="ScriptTask_1swzdpw">
-        <dc:Bounds x="979" y="1144" width="100" height="80" />
+        <dc:Bounds x="982" y="1136" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="ScriptTask_1ef3voz_di" bpmnElement="ScriptTask_1ef3voz">
-        <dc:Bounds x="823" y="761" width="100" height="80" />
+        <dc:Bounds x="764" y="925" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="EndEvent_05h01gx_di" bpmnElement="EndEvent_05h01gx">
-        <dc:Bounds x="1585" y="783" width="36" height="36" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="1593" y="826" width="20" height="14" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="IntermediateThrowEvent_1ex8ke9_di" bpmnElement="IntermediateThrowEvent_1ex8ke9">
-        <dc:Bounds x="1584" y="103" width="36" height="36" />
+        <dc:Bounds x="1396" y="947" width="36" height="36" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="1564" y="144" width="87" height="27" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="IntermediateCatchEvent_1wii8im_di" bpmnElement="IntermediateCatchEvent_1wii8im">
-        <dc:Bounds x="178" y="271" width="36" height="36" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="171" y="314" width="60" height="27" />
+          <dc:Bounds x="1404" y="990" width="20" height="14" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="ScriptTask_1ssh2l9_di" bpmnElement="ScriptTask_1ssh2l9">
-        <dc:Bounds x="1197" y="761" width="100" height="80" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="ScriptTask_0b7senu_di" bpmnElement="ScriptTask_0b7senu">
-        <dc:Bounds x="285" y="249" width="100" height="80" />
+        <dc:Bounds x="1074" y="925" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="CallActivity_0h88mep_di" bpmnElement="CallActivity_0h88mep">
-        <dc:Bounds x="467" y="249" width="100" height="80" />
+        <dc:Bounds x="890" y="82" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="CallActivity_0n47zoh_di" bpmnElement="CallActivity_0n47zoh">
-        <dc:Bounds x="1371" y="249" width="100" height="80" />
+        <dc:Bounds x="1220" y="310" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="ScriptTask_12h8542_di" bpmnElement="ScriptTask_12h8542">
-        <dc:Bounds x="1193" y="416" width="100" height="80" />
+        <dc:Bounds x="1024" y="580" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="CallActivity_0o89wmf_di" bpmnElement="CallActivity_0o89wmf">
-        <dc:Bounds x="1371" y="416" width="100" height="80" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="CallActivity_0g98b71_di" bpmnElement="CallActivity_0g98b71">
-        <dc:Bounds x="645" y="416" width="100" height="80" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="ScriptTask_08wim95_di" bpmnElement="ScriptTask_08wim95">
-        <dc:Bounds x="467" y="416" width="100" height="80" />
+        <dc:Bounds x="1194" y="580" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="CallActivity_0jdzpem_di" bpmnElement="CallActivity_0jdzpem">
-        <dc:Bounds x="1371" y="605" width="100" height="80" />
+        <dc:Bounds x="1194" y="765" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="ScriptTask_1mscu5w_di" bpmnElement="ScriptTask_1mscu5w">
-        <dc:Bounds x="1193" y="605" width="100" height="80" />
+        <dc:Bounds x="1024" y="765" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="IntermediateCatchEvent_0pkvfun_di" bpmnElement="IntermediateCatchEvent_0pkvfun">
-        <dc:Bounds x="178" y="783" width="36" height="36" />
+        <dc:Bounds x="177" y="947" width="36" height="36" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="168" y="826" width="66" height="14" />
+          <dc:Bounds x="167" y="990" width="66" height="14" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="IntermediateThrowEvent_0ktwpki_di" bpmnElement="IntermediateThrowEvent_0ktwpki">
-        <dc:Bounds x="1584" y="438" width="36" height="36" />
+        <dc:Bounds x="1396" y="602" width="36" height="36" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="1577" y="479" width="67" height="27" />
+          <dc:Bounds x="1389" y="643" width="67" height="27" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="CallActivity_15pl4ld_di" bpmnElement="CallActivity_15pl4ld">
-        <dc:Bounds x="1005" y="761" width="100" height="80" />
+        <dc:Bounds x="934" y="925" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="EndEvent_1oouvuh_di" bpmnElement="EndEvent_1oouvuh">
-        <dc:Bounds x="1584" y="627" width="36" height="36" />
+        <dc:Bounds x="1396" y="787" width="36" height="36" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="1592" y="670" width="20" height="14" />
+          <dc:Bounds x="1404" y="830" width="20" height="14" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="ServiceTask_0esr949_di" bpmnElement="ServiceTask_0esr949">
-        <dc:Bounds x="1375" y="761" width="100" height="80" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="ScriptTask_1jj846g_di" bpmnElement="ScriptTask_1jj846g">
-        <dc:Bounds x="830" y="249" width="100" height="80" />
+        <dc:Bounds x="1244" y="925" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="CallActivity_0cxst1i_di" bpmnElement="CallActivity_0cxst1i">
-        <dc:Bounds x="285" y="761" width="100" height="80" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="EndEvent_0bh0kwx_di" bpmnElement="EndEvent_0bh0kwx">
-        <dc:Bounds x="317" y="593" width="36" height="36" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="ReceiveTask_0zkpdpa_di" bpmnElement="Task_1b5t88h">
-        <dc:Bounds x="285" y="416" width="100" height="80" />
+        <dc:Bounds x="274" y="925" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="CallActivity_0v4mw2x_di" bpmnElement="CallActivity_0v4mw2x">
-        <dc:Bounds x="1015" y="249" width="100" height="80" />
+        <dc:Bounds x="880" y="310" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="ScriptTask_19uxoi8_di" bpmnElement="ScriptTask_19uxoi8">
-        <dc:Bounds x="645" y="761" width="100" height="80" />
+        <dc:Bounds x="584" y="925" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_09mxr0w_di" bpmnElement="ScriptTask_09mxr0w">
+        <dc:Bounds x="1230" y="84" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_1ac05ww_di" bpmnElement="ScriptTask_1ac05ww">
+        <dc:Bounds x="720" y="82" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_0xmvg4v_di" bpmnElement="SequenceFlow_0xmvg4v">
+        <di:waypoint x="664" y="122" />
+        <di:waypoint x="720" y="122" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1x4n7an_di" bpmnElement="SequenceFlow_1x4n7an">
+        <di:waypoint x="820" y="122" />
+        <di:waypoint x="890" y="122" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1dfon41_di" bpmnElement="SequenceFlow_1dfon41">
+        <di:waypoint x="990" y="122" />
+        <di:waypoint x="1060" y="122" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0jhqtls_di" bpmnElement="SequenceFlow_0jhqtls">
+        <di:waypoint x="1160" y="124" />
+        <di:waypoint x="1230" y="124" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="IntermediateCatchEvent_0gceuxu_di" bpmnElement="IntermediateCatchEvent_0gceuxu">
+        <dc:Bounds x="168" y="332" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="161" y="375" width="60" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_14c2tav_di" bpmnElement="SequenceFlow_14c2tav">
+        <di:waypoint x="204" y="350" />
+        <di:waypoint x="310" y="350" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_00kcej9_di" bpmnElement="SequenceFlow_00kcej9">
+        <di:waypoint x="1320" y="350" />
+        <di:waypoint x="1402" y="350" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_060j650_di" bpmnElement="SequenceFlow_060j650">
+        <di:waypoint x="213" y="620" />
+        <di:waypoint x="394" y="620" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="IntermediateThrowEvent_0lpvnze_di" bpmnElement="IntermediateThrowEvent_0lpvnze">
+        <dc:Bounds x="1402" y="106" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1382" y="147" width="87" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_12wo878_di" bpmnElement="SequenceFlow_12wo878">
+        <di:waypoint x="1330" y="124" />
+        <di:waypoint x="1402" y="124" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="ScriptTask_13roglo_di" bpmnElement="ScriptTask_13roglo">
+        <dc:Bounds x="710" y="310" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_1f6dyxo_di" bpmnElement="SequenceFlow_1f6dyxo">
+        <di:waypoint x="810" y="350" />
+        <di:waypoint x="880" y="350" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="ReceiveTask_02qzb6i_di" bpmnElement="ReceiveTask_02qzb6i">
+        <dc:Bounds x="254" y="580" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="EndEvent_0bz8a65_di" bpmnElement="EndEvent_0bz8a65">
+        <dc:Bounds x="286" y="757" width="36" height="36" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="BoundaryEvent_15igwk2_di" bpmnElement="BoundaryEvent_0clo9pv">
-        <dc:Bounds x="317" y="478" width="36" height="36" />
+      <bpmndi:BPMNShape id="BoundaryEvent_0p4swyp_di" bpmnElement="BoundaryEvent_0p4swyp">
+        <dc:Bounds x="286" y="642" width="36" height="36" />
       </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_1vesvto_di" bpmnElement="SequenceFlow_1vesvto">
+        <di:waypoint x="304" y="678" />
+        <di:waypoint x="304" y="757" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="ScriptTask_04qudo2_di" bpmnElement="ScriptTask_04qudo2">
+        <dc:Bounds x="394" y="580" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_0ti386y_di" bpmnElement="SequenceFlow_0ti386y">
+        <di:waypoint x="494" y="620" />
+        <di:waypoint x="534" y="620" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="CallActivity_1vu3zcv_di" bpmnElement="CallActivity_1vu3zcv">
+        <dc:Bounds x="534" y="580" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_1whq7vc_di" bpmnElement="SequenceFlow_1whq7vc">
+        <di:waypoint x="634" y="620" />
+        <di:waypoint x="704" y="620" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="CallActivity_0xf2g6c_di" bpmnElement="CallActivity_0xf2g6c">
+        <dc:Bounds x="520" y="310" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_1r2jtal_di" bpmnElement="SequenceFlow_1r2jtal">
+        <di:waypoint x="620" y="350" />
+        <di:waypoint x="710" y="350" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="ScriptTask_1ayg9y8_di" bpmnElement="ScriptTask_1ayg9y8">
+        <dc:Bounds x="310" y="310" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_02sve8o_di" bpmnElement="SequenceFlow_02sve8o">
+        <di:waypoint x="410" y="350" />
+        <di:waypoint x="520" y="350" />
+      </bpmndi:BPMNEdge>
     </bpmndi:BPMNPlane>
   </bpmndi:BPMNDiagram>
 </bpmn:definitions>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeAllocateSliceSubnet.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeAllocateSliceSubnet.bpmn
new file mode 100644 (file)
index 0000000..bf08c6e
--- /dev/null
@@ -0,0 +1,224 @@
+<?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_1stoy5y" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.1.1">
+  <bpmn:process id="DeAllocateSliceSubnet" name="DeallocateSliceSubnet" isExecutable="true">
+    <bpmn:startEvent id="StartEvent_1" name="Start">
+      <bpmn:outgoing>Flow_143ck2k</bpmn:outgoing>
+    </bpmn:startEvent>
+    <bpmn:sequenceFlow id="Flow_143ck2k" sourceRef="StartEvent_1" targetRef="Activity_0zyhkvj" />
+    <bpmn:scriptTask id="Activity_0zyhkvj" name="Preprocess Request" scriptFormat="groovy">
+      <bpmn:incoming>Flow_143ck2k</bpmn:incoming>
+      <bpmn:outgoing>Flow_0pttfuf</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DeAllocateSliceSubnet()
+nss.preProcessRequest(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_0c6o2o7" name="Send Sync Response" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1c1j5i1</bpmn:incoming>
+      <bpmn:outgoing>Flow_1kljyhj</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DeAllocateSliceSubnet()
+nss.sendSyncResponse(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:serviceTask id="Activity_1dykbz9" 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">${initResourceOperationStatus}</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_04jsg9s</bpmn:incoming>
+      <bpmn:outgoing>Flow_1c1j5i1</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:sequenceFlow id="Flow_0pttfuf" sourceRef="Activity_0zyhkvj" targetRef="Activity_1fj0cge" />
+    <bpmn:sequenceFlow id="Flow_1c1j5i1" sourceRef="Activity_1dykbz9" targetRef="Activity_0c6o2o7" />
+    <bpmn:scriptTask id="Activity_1fj0cge" name="Init Resource Operation Status" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0pttfuf</bpmn:incoming>
+      <bpmn:outgoing>Flow_04jsg9s</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DeAllocateSliceSubnet()
+nss.prepareInitOperationStatus(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_04jsg9s" sourceRef="Activity_1fj0cge" targetRef="Activity_1dykbz9" />
+    <bpmn:exclusiveGateway id="Gateway_1jagvdq" name="Whether Network type">
+      <bpmn:incoming>Flow_1kljyhj</bpmn:incoming>
+      <bpmn:outgoing>Flow_0fp8gep</bpmn:outgoing>
+      <bpmn:outgoing>Flow_0zwyxxc</bpmn:outgoing>
+      <bpmn:outgoing>Flow_0roz1jy</bpmn:outgoing>
+    </bpmn:exclusiveGateway>
+    <bpmn:callActivity id="Activity_02dflyr" name="Call TNDeallocateNSSI" calledElement="DoDeallocateTransportNSSI">
+      <bpmn:extensionElements>
+        <camunda:in source="msoRequestId" target="msoRequestId" />
+        <camunda:in source="globalSubscriberId" target="globalSubscriberId" />
+        <camunda:in source="serviceInstanceID" target="serviceInstanceID" />
+        <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_0fp8gep</bpmn:incoming>
+      <bpmn:outgoing>Flow_1hij53h</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:callActivity id="Activity_1ceupdn" name="Call CNDeallocateNSSI" calledElement="DoDeallocateCoreNSSI">
+      <bpmn:extensionElements>
+        <camunda:in source="msoRequestId" target="msoRequestId" />
+        <camunda:in source="globalSubscriberId" target="globalSubscriberId" />
+        <camunda:in source="serviceInstanceID" target="serviceInstanceID" />
+        <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_0roz1jy</bpmn:incoming>
+      <bpmn:outgoing>Flow_1fth8go</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:callActivity id="Activity_0li16m1" name="Call ANDeallocateNSSI" calledElement="DoDeallocateAccessNSSI">
+      <bpmn:extensionElements>
+        <camunda:in source="msoRequestId" target="msoRequestId" />
+        <camunda:in source="globalSubscriberId" target="globalSubscriberId" />
+        <camunda:in source="serviceInstanceID" target="serviceInstanceID" />
+        <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_0zwyxxc</bpmn:incoming>
+      <bpmn:outgoing>Flow_1l74oic</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:endEvent id="Event_1ecylff">
+      <bpmn:incoming>Flow_1hij53h</bpmn:incoming>
+      <bpmn:incoming>Flow_1fth8go</bpmn:incoming>
+      <bpmn:incoming>Flow_1l74oic</bpmn:incoming>
+    </bpmn:endEvent>
+    <bpmn:sequenceFlow id="Flow_0fp8gep" name="Is TN ?" sourceRef="Gateway_1jagvdq" targetRef="Activity_02dflyr">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("networkType") == "TN"}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:sequenceFlow id="Flow_0zwyxxc" name="Is AN ?" sourceRef="Gateway_1jagvdq" targetRef="Activity_0li16m1">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("networkType") == "AN"}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:sequenceFlow id="Flow_0roz1jy" name="Is CN ?" sourceRef="Gateway_1jagvdq" targetRef="Activity_1ceupdn">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("networkType") == "CN"}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:sequenceFlow id="Flow_1hij53h" sourceRef="Activity_02dflyr" targetRef="Event_1ecylff" />
+    <bpmn:sequenceFlow id="Flow_1fth8go" sourceRef="Activity_1ceupdn" targetRef="Event_1ecylff" />
+    <bpmn:sequenceFlow id="Flow_1l74oic" sourceRef="Activity_0li16m1" targetRef="Event_1ecylff" />
+    <bpmn:sequenceFlow id="Flow_1kljyhj" sourceRef="Activity_0c6o2o7" targetRef="Gateway_1jagvdq" />
+  </bpmn:process>
+  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DeAllocateSliceSubnet">
+      <bpmndi:BPMNEdge id="Flow_1kljyhj_di" bpmnElement="Flow_1kljyhj">
+        <di:waypoint x="890" y="250" />
+        <di:waypoint x="975" y="250" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1l74oic_di" bpmnElement="Flow_1l74oic">
+        <di:waypoint x="1190" y="120" />
+        <di:waypoint x="1280" y="120" />
+        <di:waypoint x="1280" y="232" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1fth8go_di" bpmnElement="Flow_1fth8go">
+        <di:waypoint x="1190" y="250" />
+        <di:waypoint x="1262" y="250" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1hij53h_di" bpmnElement="Flow_1hij53h">
+        <di:waypoint x="1190" y="360" />
+        <di:waypoint x="1280" y="360" />
+        <di:waypoint x="1280" y="268" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0roz1jy_di" bpmnElement="Flow_0roz1jy">
+        <di:waypoint x="1025" y="250" />
+        <di:waypoint x="1090" y="250" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1035" y="232" width="37" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0zwyxxc_di" bpmnElement="Flow_0zwyxxc">
+        <di:waypoint x="1000" y="225" />
+        <di:waypoint x="1000" y="120" />
+        <di:waypoint x="1090" y="120" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="964" y="129" width="37" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0fp8gep_di" bpmnElement="Flow_0fp8gep">
+        <di:waypoint x="1000" y="275" />
+        <di:waypoint x="1000" y="360" />
+        <di:waypoint x="1090" y="360" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1000" y="345" width="36" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_04jsg9s_di" bpmnElement="Flow_04jsg9s">
+        <di:waypoint x="520" y="250" />
+        <di:waypoint x="600" y="250" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1c1j5i1_di" bpmnElement="Flow_1c1j5i1">
+        <di:waypoint x="700" y="250" />
+        <di:waypoint x="790" y="250" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0pttfuf_di" bpmnElement="Flow_0pttfuf">
+        <di:waypoint x="330" y="250" />
+        <di:waypoint x="420" y="250" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_143ck2k_di" bpmnElement="Flow_143ck2k">
+        <di:waypoint x="168" y="250" />
+        <di:waypoint x="230" y="250" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
+        <dc:Bounds x="132" y="232" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="138" y="275" width="24" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1jawdkz_di" bpmnElement="Activity_0zyhkvj">
+        <dc:Bounds x="230" y="210" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1n1ajr4_di" bpmnElement="Activity_0c6o2o7">
+        <dc:Bounds x="790" y="210" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1dykbz9_di" bpmnElement="Activity_1dykbz9">
+        <dc:Bounds x="600" y="210" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1fj0cge_di" bpmnElement="Activity_1fj0cge">
+        <dc:Bounds x="420" y="210" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Gateway_1jagvdq_di" bpmnElement="Gateway_1jagvdq" isMarkerVisible="true">
+        <dc:Bounds x="975" y="225" width="50" height="50" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="957" y="268" width="85" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_02dflyr_di" bpmnElement="Activity_02dflyr">
+        <dc:Bounds x="1090" y="320" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1ceupdn_di" bpmnElement="Activity_1ceupdn">
+        <dc:Bounds x="1090" y="210" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0li16m1_di" bpmnElement="Activity_0li16m1">
+        <dc:Bounds x="1090" y="80" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_1ecylff_di" bpmnElement="Event_1ecylff">
+        <dc:Bounds x="1262" y="232" width="36" height="36" />
+      </bpmndi:BPMNShape>
+    </bpmndi:BPMNPlane>
+  </bpmndi:BPMNDiagram>
+</bpmn:definitions>
index 8b1b836..6a0b260 100644 (file)
@@ -1,10 +1,10 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_0474hns" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.1.0">
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_0474hns" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.0.0">
   <bpmn:process id="GenericPnfSWUPDownload" name="GenericPnfSWUPDownload" isExecutable="true">
     <bpmn:startEvent id="download_StartEvent" name="Start Flow">
       <bpmn:outgoing>SequenceFlow_1fdclh0</bpmn:outgoing>
     </bpmn:startEvent>
-    <bpmn:serviceTask id="ServiceTask_1mpt2eq" name="NF Download Dispatcher" camunda:delegateExpression="${NfSoftwareUpgradeDispatcher}">
+    <bpmn:serviceTask id="ServiceTask_1mpt2eq" name="NF Download Dispatcher" camunda:delegateExpression="${GenericPnfDispatcher}">
       <bpmn:incoming>SequenceFlow_1fdclh0</bpmn:incoming>
       <bpmn:outgoing>SequenceFlow_0kusy70</bpmn:outgoing>
     </bpmn:serviceTask>
@@ -144,6 +144,88 @@ pnfSwUpgrade.prepareCompletion(execution)</bpmn:script>
   <bpmn:error id="Error_1q14dnd" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
   <bpmndi:BPMNDiagram id="BPMNDiagram_1">
     <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="GenericPnfSWUPDownload">
+      <bpmndi:BPMNEdge id="SequenceFlow_0mjjdia_di" bpmnElement="SequenceFlow_0mjjdia">
+        <di:waypoint x="455" y="481" />
+        <di:waypoint x="512" y="481" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1d2rfyx_di" bpmnElement="SequenceFlow_1d2rfyx">
+        <di:waypoint x="925" y="260" />
+        <di:waypoint x="970" y="260" />
+        <di:waypoint x="970" y="410" />
+        <di:waypoint x="160" y="410" />
+        <di:waypoint x="160" y="481" />
+        <di:waypoint x="202" y="481" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="938" y="242" width="43" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_183s0wo_di" bpmnElement="SequenceFlow_183s0wo">
+        <di:waypoint x="302" y="481" />
+        <di:waypoint x="355" y="481" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0kusy70_di" bpmnElement="SequenceFlow_0kusy70">
+        <di:waypoint x="370" y="121" />
+        <di:waypoint x="440" y="121" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0qznt4u_di" bpmnElement="SequenceFlow_0qznt4u">
+        <di:waypoint x="665" y="260" />
+        <di:waypoint x="720" y="260" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="671" y="242" width="43" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1gawssm_di" bpmnElement="SequenceFlow_1gawssm">
+        <di:waypoint x="900" y="285" />
+        <di:waypoint x="900" y="344" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="912" y="290" width="32" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1kaikh5_di" bpmnElement="SequenceFlow_1kaikh5">
+        <di:waypoint x="820" y="260" />
+        <di:waypoint x="875" y="260" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1tfbzn1_di" bpmnElement="SequenceFlow_1tfbzn1">
+        <di:waypoint x="380" y="285" />
+        <di:waypoint x="380" y="344" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="384" y="292" width="32" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0s6i4o9_di" bpmnElement="SequenceFlow_0s6i4o9">
+        <di:waypoint x="405" y="260" />
+        <di:waypoint x="480" y="260" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="398" y="242" width="43" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1ccldpp_di" bpmnElement="SequenceFlow_1ccldpp">
+        <di:waypoint x="300" y="260" />
+        <di:waypoint x="355" y="260" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_078xmlz_di" bpmnElement="SequenceFlow_078xmlz">
+        <di:waypoint x="640" y="285" />
+        <di:waypoint x="640" y="344" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="650" y="291" width="32" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0o6b6a8_di" bpmnElement="SequenceFlow_0o6b6a8">
+        <di:waypoint x="580" y="260" />
+        <di:waypoint x="615" y="260" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_12155q6_di" bpmnElement="SequenceFlow_12155q6">
+        <di:waypoint x="540" y="121" />
+        <di:waypoint x="570" y="121" />
+        <di:waypoint x="570" y="190" />
+        <di:waypoint x="160" y="190" />
+        <di:waypoint x="160" y="260" />
+        <di:waypoint x="200" y="260" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1fdclh0_di" bpmnElement="SequenceFlow_1fdclh0">
+        <di:waypoint x="208" y="121" />
+        <di:waypoint x="270" y="121" />
+      </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="StartEvent_1k8gssq_di" bpmnElement="download_StartEvent">
         <dc:Bounds x="172" y="103" width="36" height="36" />
         <bpmndi:BPMNLabel>
@@ -186,68 +268,21 @@ pnfSwUpgrade.prepareCompletion(execution)</bpmn:script>
       <bpmndi:BPMNShape id="ServiceTask_1nl90ao_di" bpmnElement="ServiceTask_1nl90ao">
         <dc:Bounds x="200" y="220" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_1fdclh0_di" bpmnElement="SequenceFlow_1fdclh0">
-        <di:waypoint x="208" y="121" />
-        <di:waypoint x="270" y="121" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_12155q6_di" bpmnElement="SequenceFlow_12155q6">
-        <di:waypoint x="540" y="121" />
-        <di:waypoint x="570" y="121" />
-        <di:waypoint x="570" y="190" />
-        <di:waypoint x="160" y="190" />
-        <di:waypoint x="160" y="260" />
-        <di:waypoint x="200" y="260" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_0o6b6a8_di" bpmnElement="SequenceFlow_0o6b6a8">
-        <di:waypoint x="580" y="260" />
-        <di:waypoint x="615" y="260" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_078xmlz_di" bpmnElement="SequenceFlow_078xmlz">
-        <di:waypoint x="640" y="285" />
-        <di:waypoint x="640" y="344" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="650" y="291" width="32" height="14" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_1ccldpp_di" bpmnElement="SequenceFlow_1ccldpp">
-        <di:waypoint x="300" y="260" />
-        <di:waypoint x="355" y="260" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_0s6i4o9_di" bpmnElement="SequenceFlow_0s6i4o9">
-        <di:waypoint x="405" y="260" />
-        <di:waypoint x="480" y="260" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="398" y="242" width="43" height="14" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_1tfbzn1_di" bpmnElement="SequenceFlow_1tfbzn1">
-        <di:waypoint x="380" y="285" />
-        <di:waypoint x="380" y="344" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="384" y="292" width="32" height="14" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_1kaikh5_di" bpmnElement="SequenceFlow_1kaikh5">
-        <di:waypoint x="820" y="260" />
-        <di:waypoint x="875" y="260" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_1gawssm_di" bpmnElement="SequenceFlow_1gawssm">
-        <di:waypoint x="900" y="285" />
-        <di:waypoint x="900" y="344" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="912" y="290" width="32" height="14" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_0qznt4u_di" bpmnElement="SequenceFlow_0qznt4u">
-        <di:waypoint x="665" y="260" />
-        <di:waypoint x="720" y="260" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="671" y="242" width="43" height="14" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="SubProcess_02e59i3_di" bpmnElement="SubProcess_02e59i3" isExpanded="true">
         <dc:Bounds x="190" y="580" width="650" height="190" />
       </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_0swi04u_di" bpmnElement="SequenceFlow_0swi04u">
+        <di:waypoint x="298" y="680" />
+        <di:waypoint x="360" y="680" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1ppn4a8_di" bpmnElement="SequenceFlow_1ppn4a8">
+        <di:waypoint x="460" y="680" />
+        <di:waypoint x="530" y="680" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1ahmdun_di" bpmnElement="SequenceFlow_1ahmdun">
+        <di:waypoint x="630" y="680" />
+        <di:waypoint x="702" y="680" />
+      </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="StartEvent_0uftj43_di" bpmnElement="StartEvent_0uftj43">
         <dc:Bounds x="262" y="662" width="36" height="36" />
         <bpmndi:BPMNLabel>
@@ -266,50 +301,15 @@ pnfSwUpgrade.prepareCompletion(execution)</bpmn:script>
           <dc:Bounds x="712" y="705" width="18" height="14" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_1ahmdun_di" bpmnElement="SequenceFlow_1ahmdun">
-        <di:waypoint x="630" y="680" />
-        <di:waypoint x="702" y="680" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_1ppn4a8_di" bpmnElement="SequenceFlow_1ppn4a8">
-        <di:waypoint x="460" y="680" />
-        <di:waypoint x="530" y="680" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_0swi04u_di" bpmnElement="SequenceFlow_0swi04u">
-        <di:waypoint x="298" y="680" />
-        <di:waypoint x="360" y="680" />
-      </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="ScriptTask_1ankfw8_di" bpmnElement="ScriptTask_1ankfw8">
         <dc:Bounds x="440" y="81" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_0kusy70_di" bpmnElement="SequenceFlow_0kusy70">
-        <di:waypoint x="370" y="121" />
-        <di:waypoint x="440" y="121" />
-      </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="ScriptTask_17f7m2t_di" bpmnElement="ScriptTask_17f7m2t">
         <dc:Bounds x="202" y="441" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="CallActivity_0tq2dug_di" bpmnElement="CallActivity_0tq2dug">
         <dc:Bounds x="355" y="441" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_183s0wo_di" bpmnElement="SequenceFlow_183s0wo">
-        <di:waypoint x="302" y="481" />
-        <di:waypoint x="355" y="481" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_1d2rfyx_di" bpmnElement="SequenceFlow_1d2rfyx">
-        <di:waypoint x="925" y="260" />
-        <di:waypoint x="970" y="260" />
-        <di:waypoint x="970" y="410" />
-        <di:waypoint x="160" y="410" />
-        <di:waypoint x="160" y="481" />
-        <di:waypoint x="202" y="481" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="938" y="242" width="43" height="14" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_0mjjdia_di" bpmnElement="SequenceFlow_0mjjdia">
-        <di:waypoint x="455" y="481" />
-        <di:waypoint x="512" y="481" />
-      </bpmndi:BPMNEdge>
     </bpmndi:BPMNPlane>
   </bpmndi:BPMNDiagram>
 </bpmn:definitions>
index f4a6196..9b8ce4a 100644 (file)
@@ -1,10 +1,10 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1yd8m0g" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.1.0">
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1yd8m0g" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.0.0">
   <bpmn:process id="GenericPnfSoftwareUpgrade" name="GenericPnfSoftwareUpgrade" isExecutable="true">
     <bpmn:startEvent id="softwareUpgrade_startEvent" name="Start Flow">
       <bpmn:outgoing>SequenceFlow_1ng4b6l</bpmn:outgoing>
     </bpmn:startEvent>
-    <bpmn:serviceTask id="ServiceTask_042uz7n" name="NF Upgrade Dispatcher" camunda:delegateExpression="${NfSoftwareUpgradeDispatcher}">
+    <bpmn:serviceTask id="ServiceTask_042uz7n" name="NF Upgrade Dispatcher" camunda:delegateExpression="${GenericPnfDispatcher}">
       <bpmn:incoming>SequenceFlow_1ng4b6l</bpmn:incoming>
       <bpmn:outgoing>SequenceFlow_12ejx4m</bpmn:outgoing>
     </bpmn:serviceTask>
@@ -174,6 +174,110 @@ pnfSwUpgrade.prepareFalloutHandler(execution)</bpmn:script>
   <bpmn:error id="Error_12cpov5" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
   <bpmndi:BPMNDiagram id="BPMNDiagram_1">
     <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="GenericPnfSoftwareUpgrade">
+      <bpmndi:BPMNEdge id="SequenceFlow_0tle5zb_di" bpmnElement="SequenceFlow_0tle5zb">
+        <di:waypoint x="480" y="480" />
+        <di:waypoint x="532" y="480" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0ipc3nt_di" bpmnElement="SequenceFlow_0ipc3nt">
+        <di:waypoint x="320" y="480" />
+        <di:waypoint x="380" y="480" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0ks3p41_di" bpmnElement="SequenceFlow_0ks3p41">
+        <di:waypoint x="540" y="120" />
+        <di:waypoint x="570" y="120" />
+        <di:waypoint x="570" y="190" />
+        <di:waypoint x="180" y="190" />
+        <di:waypoint x="180" y="260" />
+        <di:waypoint x="220" y="260" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_084orr1_di" bpmnElement="SequenceFlow_084orr1">
+        <di:waypoint x="1050" y="260" />
+        <di:waypoint x="1090" y="260" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0j26xlx_di" bpmnElement="SequenceFlow_0j26xlx">
+        <di:waypoint x="320" y="260" />
+        <di:waypoint x="355" y="260" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0g3qcd0_di" bpmnElement="SequenceFlow_0g3qcd0">
+        <di:waypoint x="1190" y="260" />
+        <di:waypoint x="1225" y="260" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_015y785_di" bpmnElement="SequenceFlow_015y785">
+        <di:waypoint x="820" y="260" />
+        <di:waypoint x="845" y="260" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0cchgih_di" bpmnElement="SequenceFlow_0cchgih">
+        <di:waypoint x="560" y="260" />
+        <di:waypoint x="615" y="260" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0eiif6e_di" bpmnElement="SequenceFlow_0eiif6e">
+        <di:waypoint x="895" y="260" />
+        <di:waypoint x="950" y="260" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="898" y="242" width="43" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1atiydu_di" bpmnElement="SequenceFlow_1atiydu">
+        <di:waypoint x="1275" y="260" />
+        <di:waypoint x="1320" y="260" />
+        <di:waypoint x="1320" y="410" />
+        <di:waypoint x="180" y="410" />
+        <di:waypoint x="180" y="480" />
+        <di:waypoint x="220" y="480" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1277" y="242" width="43" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1eljvek_di" bpmnElement="SequenceFlow_1eljvek">
+        <di:waypoint x="665" y="260" />
+        <di:waypoint x="720" y="260" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="668" y="242" width="43" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1p0axph_di" bpmnElement="SequenceFlow_1p0axph">
+        <di:waypoint x="1250" y="285" />
+        <di:waypoint x="1250" y="342" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1254" y="293" width="32" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0dqnb6c_di" bpmnElement="SequenceFlow_0dqnb6c">
+        <di:waypoint x="870" y="285" />
+        <di:waypoint x="870" y="342" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="874" y="293" width="32" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1lr7vgu_di" bpmnElement="SequenceFlow_1lr7vgu">
+        <di:waypoint x="640" y="285" />
+        <di:waypoint x="640" y="342" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="644" y="293" width="32" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0piri91_di" bpmnElement="SequenceFlow_0piri91">
+        <di:waypoint x="380" y="285" />
+        <di:waypoint x="380" y="342" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="384" y="293" width="32" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1nsmyr5_di" bpmnElement="SequenceFlow_1nsmyr5">
+        <di:waypoint x="405" y="260" />
+        <di:waypoint x="460" y="260" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="408" y="242" width="43" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1ng4b6l_di" bpmnElement="SequenceFlow_1ng4b6l">
+        <di:waypoint x="198" y="120" />
+        <di:waypoint x="270" y="120" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_12ejx4m_di" bpmnElement="SequenceFlow_12ejx4m">
+        <di:waypoint x="370" y="120" />
+        <di:waypoint x="440" y="120" />
+      </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="softwareUpgrade_startEvent">
         <dc:Bounds x="162" y="102" width="36" height="36" />
         <bpmndi:BPMNLabel>
@@ -183,20 +287,12 @@ pnfSwUpgrade.prepareFalloutHandler(execution)</bpmn:script>
       <bpmndi:BPMNShape id="ServiceTask_042uz7n_di" bpmnElement="ServiceTask_042uz7n">
         <dc:Bounds x="270" y="80" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_12ejx4m_di" bpmnElement="SequenceFlow_12ejx4m">
-        <di:waypoint x="370" y="120" />
-        <di:waypoint x="440" y="120" />
-      </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="EndEvent_1w3jv30_di" bpmnElement="softwareUpgrade_endEvent">
         <dc:Bounds x="532" y="462" width="36" height="36" />
         <bpmndi:BPMNLabel>
           <dc:Bounds x="542" y="505" width="18" height="14" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_1ng4b6l_di" bpmnElement="SequenceFlow_1ng4b6l">
-        <di:waypoint x="198" y="120" />
-        <di:waypoint x="270" y="120" />
-      </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="ExclusiveGateway_0v3l3wv_di" bpmnElement="ExclusiveGateway_0v3l3wv" isMarkerVisible="true">
         <dc:Bounds x="615" y="235" width="50" height="50" />
         <bpmndi:BPMNLabel>
@@ -212,160 +308,59 @@ pnfSwUpgrade.prepareFalloutHandler(execution)</bpmn:script>
       <bpmndi:BPMNShape id="ExclusiveGateway_0x6h0ni_di" bpmnElement="ExclusiveGateway_0x6h0ni" isMarkerVisible="true">
         <dc:Bounds x="355" y="235" width="50" height="50" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_1nsmyr5_di" bpmnElement="SequenceFlow_1nsmyr5">
-        <di:waypoint x="405" y="260" />
-        <di:waypoint x="460" y="260" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="408" y="242" width="43" height="14" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="EndEvent_180lm4y_di" bpmnElement="EndEvent_180lm4y">
         <dc:Bounds x="362" y="342" width="36" height="36" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_0piri91_di" bpmnElement="SequenceFlow_0piri91">
-        <di:waypoint x="380" y="285" />
-        <di:waypoint x="380" y="342" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="384" y="293" width="32" height="14" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_1lr7vgu_di" bpmnElement="SequenceFlow_1lr7vgu">
-        <di:waypoint x="640" y="285" />
-        <di:waypoint x="640" y="342" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="644" y="293" width="32" height="14" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="ExclusiveGateway_0ch3fef_di" bpmnElement="ExclusiveGateway_0ch3fef" isMarkerVisible="true">
         <dc:Bounds x="845" y="235" width="50" height="50" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="EndEvent_1ms4wdz_di" bpmnElement="EndEvent_1ms4wdz">
         <dc:Bounds x="852" y="342" width="36" height="36" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_0dqnb6c_di" bpmnElement="SequenceFlow_0dqnb6c">
-        <di:waypoint x="870" y="285" />
-        <di:waypoint x="870" y="342" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="874" y="293" width="32" height="14" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="ExclusiveGateway_1ny9b1z_di" bpmnElement="ExclusiveGateway_1ny9b1z" isMarkerVisible="true">
         <dc:Bounds x="1225" y="235" width="50" height="50" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="EndEvent_0l6n6x5_di" bpmnElement="EndEvent_0l6n6x5">
         <dc:Bounds x="1232" y="342" width="36" height="36" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_1p0axph_di" bpmnElement="SequenceFlow_1p0axph">
-        <di:waypoint x="1250" y="285" />
-        <di:waypoint x="1250" y="342" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="1254" y="293" width="32" height="14" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_1eljvek_di" bpmnElement="SequenceFlow_1eljvek">
-        <di:waypoint x="665" y="260" />
-        <di:waypoint x="720" y="260" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="668" y="242" width="43" height="14" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_1atiydu_di" bpmnElement="SequenceFlow_1atiydu">
-        <di:waypoint x="1275" y="260" />
-        <di:waypoint x="1320" y="260" />
-        <di:waypoint x="1320" y="410" />
-        <di:waypoint x="180" y="410" />
-        <di:waypoint x="180" y="480" />
-        <di:waypoint x="220" y="480" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="1277" y="242" width="43" height="14" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_0eiif6e_di" bpmnElement="SequenceFlow_0eiif6e">
-        <di:waypoint x="895" y="260" />
-        <di:waypoint x="950" y="260" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="898" y="242" width="43" height="14" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="ServiceTask_0x5cje8_di" bpmnElement="ServiceTask_0x5cje8">
         <dc:Bounds x="460" y="220" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_0cchgih_di" bpmnElement="SequenceFlow_0cchgih">
-        <di:waypoint x="560" y="260" />
-        <di:waypoint x="615" y="260" />
-      </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="ServiceTask_02lxf48_di" bpmnElement="ServiceTask_02lxf48">
         <dc:Bounds x="720" y="220" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_015y785_di" bpmnElement="SequenceFlow_015y785">
-        <di:waypoint x="820" y="260" />
-        <di:waypoint x="845" y="260" />
-      </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="ServiceTask_0y2uysu_di" bpmnElement="ServiceTask_0y2uysu">
         <dc:Bounds x="1090" y="220" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_0g3qcd0_di" bpmnElement="SequenceFlow_0g3qcd0">
-        <di:waypoint x="1190" y="260" />
-        <di:waypoint x="1225" y="260" />
-      </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="ServiceTask_0slpahe_di" bpmnElement="ServiceTask_0slpahe">
         <dc:Bounds x="220" y="220" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_0j26xlx_di" bpmnElement="SequenceFlow_0j26xlx">
-        <di:waypoint x="320" y="260" />
-        <di:waypoint x="355" y="260" />
-      </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="ServiceTask_1jo8vn7_di" bpmnElement="ServiceTask_1jo8vn7">
         <dc:Bounds x="950" y="220" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_084orr1_di" bpmnElement="SequenceFlow_084orr1">
-        <di:waypoint x="1050" y="260" />
-        <di:waypoint x="1090" y="260" />
-      </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="ScriptTask_10klpg8_di" bpmnElement="ScriptTask_10klpg8">
         <dc:Bounds x="440" y="80" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_0ks3p41_di" bpmnElement="SequenceFlow_0ks3p41">
-        <di:waypoint x="540" y="120" />
-        <di:waypoint x="570" y="120" />
-        <di:waypoint x="570" y="190" />
-        <di:waypoint x="180" y="190" />
-        <di:waypoint x="180" y="260" />
-        <di:waypoint x="220" y="260" />
-      </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="ScriptTask_1igtc83_di" bpmnElement="ScriptTask_1igtc83">
         <dc:Bounds x="220" y="440" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_0ipc3nt_di" bpmnElement="SequenceFlow_0ipc3nt">
-        <di:waypoint x="320" y="480" />
-        <di:waypoint x="380" y="480" />
-      </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="CallActivity_0o1mi8u_di" bpmnElement="CallActivity_0o1mi8u">
         <dc:Bounds x="380" y="440" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_0tle5zb_di" bpmnElement="SequenceFlow_0tle5zb">
-        <di:waypoint x="480" y="480" />
-        <di:waypoint x="532" y="480" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNShape id="ScriptTask_0gov132_di" bpmnElement="ScriptTask_0gov132">
-        <dc:Bounds x="540" y="630" width="100" height="80" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="CallActivity_00psvtk_di" bpmnElement="CallActivity_00psvtk">
-        <dc:Bounds x="710" y="630" width="100" height="80" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="EndEvent_1vq2glg_di" bpmnElement="EndEvent_1vq2glg">
-        <dc:Bounds x="882" y="652" width="36" height="36" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="892" y="695" width="18" height="14" />
-        </bpmndi:BPMNLabel>
+      <bpmndi:BPMNShape id="SubProcess_02p6q4s_di" bpmnElement="SubProcess_02p6q4s" isExpanded="true">
+        <dc:Bounds x="370" y="570" width="650" height="190" />
       </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_1tcjlty_di" bpmnElement="SequenceFlow_1tcjlty">
+        <di:waypoint x="810" y="670" />
+        <di:waypoint x="882" y="670" />
+      </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_09y0mpc_di" bpmnElement="SequenceFlow_09y0mpc">
         <di:waypoint x="640" y="670" />
         <di:waypoint x="710" y="670" />
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_1tcjlty_di" bpmnElement="SequenceFlow_1tcjlty">
-        <di:waypoint x="810" y="670" />
-        <di:waypoint x="882" y="670" />
+      <bpmndi:BPMNEdge id="SequenceFlow_05haut5_di" bpmnElement="SequenceFlow_05haut5">
+        <di:waypoint x="478" y="670" />
+        <di:waypoint x="540" y="670" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="StartEvent_1r4h504_di" bpmnElement="StartEvent_149ecdm">
         <dc:Bounds x="442" y="652" width="36" height="36" />
@@ -373,13 +368,18 @@ pnfSwUpgrade.prepareFalloutHandler(execution)</bpmn:script>
           <dc:Bounds x="422" y="693" width="76" height="14" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="SubProcess_02p6q4s_di" bpmnElement="SubProcess_02p6q4s" isExpanded="true">
-        <dc:Bounds x="370" y="570" width="650" height="190" />
+      <bpmndi:BPMNShape id="ScriptTask_0gov132_di" bpmnElement="ScriptTask_0gov132">
+        <dc:Bounds x="540" y="630" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="CallActivity_00psvtk_di" bpmnElement="CallActivity_00psvtk">
+        <dc:Bounds x="710" y="630" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="EndEvent_1vq2glg_di" bpmnElement="EndEvent_1vq2glg">
+        <dc:Bounds x="882" y="652" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="892" y="695" width="18" height="14" />
+        </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_05haut5_di" bpmnElement="SequenceFlow_05haut5">
-        <di:waypoint x="478" y="670" />
-        <di:waypoint x="540" y="670" />
-      </bpmndi:BPMNEdge>
     </bpmndi:BPMNPlane>
   </bpmndi:BPMNDiagram>
 </bpmn:definitions>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ModifySliceSubnet.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ModifySliceSubnet.bpmn
new file mode 100644 (file)
index 0000000..38ddf2e
--- /dev/null
@@ -0,0 +1,224 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_0fme930" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.1.1">
+  <bpmn:process id="ModifySliceSubnet" name="ModifySliceSubnet" isExecutable="true">
+    <bpmn:startEvent id="Event_05idy03" name="Start">
+      <bpmn:outgoing>Flow_1t0w8dn</bpmn:outgoing>
+    </bpmn:startEvent>
+    <bpmn:scriptTask id="Activity_0kd9pxx" name="Preprocess Request" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1t0w8dn</bpmn:incoming>
+      <bpmn:outgoing>Flow_0fzchbl</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new ModifySliceSubnet()
+nss.preProcessRequest(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_1dzkfh2" name="Send Sync Response" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1q030ul</bpmn:incoming>
+      <bpmn:outgoing>Flow_0ps6iyc</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new ModifySliceSubnet()
+nss.sendSyncResponse(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:exclusiveGateway id="Gateway_1baxf7k" name="Whether Network type">
+      <bpmn:incoming>Flow_0ps6iyc</bpmn:incoming>
+      <bpmn:outgoing>Flow_15luvlg</bpmn:outgoing>
+      <bpmn:outgoing>Flow_0usuozn</bpmn:outgoing>
+      <bpmn:outgoing>Flow_1dfyoe6</bpmn:outgoing>
+    </bpmn:exclusiveGateway>
+    <bpmn:endEvent id="Event_103vvkf">
+      <bpmn:incoming>Flow_1b2k523</bpmn:incoming>
+      <bpmn:incoming>Flow_0pklfqu</bpmn:incoming>
+      <bpmn:incoming>Flow_1bbqkjv</bpmn:incoming>
+    </bpmn:endEvent>
+    <bpmn:serviceTask id="Activity_0ptby3d" 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">${initResourceOperationStatus}</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_1grhlet</bpmn:incoming>
+      <bpmn:outgoing>Flow_1q030ul</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:sequenceFlow id="Flow_1t0w8dn" sourceRef="Event_05idy03" targetRef="Activity_0kd9pxx" />
+    <bpmn:sequenceFlow id="Flow_0fzchbl" sourceRef="Activity_0kd9pxx" targetRef="Activity_1s8ojcr" />
+    <bpmn:sequenceFlow id="Flow_1q030ul" sourceRef="Activity_0ptby3d" targetRef="Activity_1dzkfh2" />
+    <bpmn:sequenceFlow id="Flow_0ps6iyc" sourceRef="Activity_1dzkfh2" targetRef="Gateway_1baxf7k" />
+    <bpmn:sequenceFlow id="Flow_15luvlg" name="Is TN ?" sourceRef="Gateway_1baxf7k" targetRef="Activity_192bdyv">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("networkType") == "TN"}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:sequenceFlow id="Flow_0usuozn" name="Is AN ?" sourceRef="Gateway_1baxf7k" targetRef="Activity_0t1g4mp">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("networkType") == "AN"}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:scriptTask id="Activity_1s8ojcr" name="Init Resource Operation Status" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0fzchbl</bpmn:incoming>
+      <bpmn:outgoing>Flow_1grhlet</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new ModifySliceSubnet()
+nss.prepareInitOperationStatus(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_1grhlet" sourceRef="Activity_1s8ojcr" targetRef="Activity_0ptby3d" />
+    <bpmn:callActivity id="Activity_0t1g4mp" name="Call ANModifyNSSI" calledElement="DoModifyAccessNSSI">
+      <bpmn:extensionElements>
+        <camunda:in source="msoRequestId" target="msoRequestId" />
+        <camunda:in source="globalSubscriberId" target="globalSubscriberId" />
+        <camunda:in source="serviceInstanceID" target="serviceInstanceID" />
+        <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_0usuozn</bpmn:incoming>
+      <bpmn:outgoing>Flow_1b2k523</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:sequenceFlow id="Flow_1b2k523" sourceRef="Activity_0t1g4mp" targetRef="Event_103vvkf" />
+    <bpmn:callActivity id="Activity_0v2hxmv" name="Call CNModifyNSSI" calledElement="DoModifyCoreNSSI">
+      <bpmn:extensionElements>
+        <camunda:in source="msoRequestId" target="msoRequestId" />
+        <camunda:in source="globalSubscriberId" target="globalSubscriberId" />
+        <camunda:in source="serviceInstanceID" target="serviceInstanceID" />
+        <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_1dfyoe6</bpmn:incoming>
+      <bpmn:outgoing>Flow_0pklfqu</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:callActivity id="Activity_192bdyv" name="Call TNModifyNSSI" calledElement="DoModifyTransportNSSI">
+      <bpmn:extensionElements>
+        <camunda:in source="msoRequestId" target="msoRequestId" />
+        <camunda:in source="globalSubscriberId" target="globalSubscriberId" />
+        <camunda:in source="serviceInstanceID" target="serviceInstanceID" />
+        <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_15luvlg</bpmn:incoming>
+      <bpmn:outgoing>Flow_1bbqkjv</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:sequenceFlow id="Flow_0pklfqu" sourceRef="Activity_0v2hxmv" targetRef="Event_103vvkf" />
+    <bpmn:sequenceFlow id="Flow_1dfyoe6" name="Is CN ?" sourceRef="Gateway_1baxf7k" targetRef="Activity_0v2hxmv">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("networkType") == "CN"}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:sequenceFlow id="Flow_1bbqkjv" sourceRef="Activity_192bdyv" targetRef="Event_103vvkf" />
+  </bpmn:process>
+  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="ModifySliceSubnet">
+      <bpmndi:BPMNEdge id="Flow_0usuozn_di" bpmnElement="Flow_0usuozn">
+        <di:waypoint x="830" y="245" />
+        <di:waypoint x="830" y="140" />
+        <di:waypoint x="920" y="140" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="794" y="149" width="37" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_15luvlg_di" bpmnElement="Flow_15luvlg">
+        <di:waypoint x="830" y="295" />
+        <di:waypoint x="830" y="380" />
+        <di:waypoint x="920" y="380" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="830" y="365" width="36" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1dfyoe6_di" bpmnElement="Flow_1dfyoe6">
+        <di:waypoint x="855" y="270" />
+        <di:waypoint x="920" y="270" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="865" y="252" width="37" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0ps6iyc_di" bpmnElement="Flow_0ps6iyc">
+        <di:waypoint x="740" y="270" />
+        <di:waypoint x="805" y="270" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1q030ul_di" bpmnElement="Flow_1q030ul">
+        <di:waypoint x="590" y="270" />
+        <di:waypoint x="640" y="270" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0fzchbl_di" bpmnElement="Flow_0fzchbl">
+        <di:waypoint x="310" y="270" />
+        <di:waypoint x="340" y="270" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1t0w8dn_di" bpmnElement="Flow_1t0w8dn">
+        <di:waypoint x="188" y="270" />
+        <di:waypoint x="210" y="270" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1grhlet_di" bpmnElement="Flow_1grhlet">
+        <di:waypoint x="440" y="270" />
+        <di:waypoint x="490" y="270" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1b2k523_di" bpmnElement="Flow_1b2k523">
+        <di:waypoint x="1020" y="140" />
+        <di:waypoint x="1110" y="140" />
+        <di:waypoint x="1110" y="252" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0pklfqu_di" bpmnElement="Flow_0pklfqu">
+        <di:waypoint x="1020" y="270" />
+        <di:waypoint x="1092" y="270" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1bbqkjv_di" bpmnElement="Flow_1bbqkjv">
+        <di:waypoint x="1020" y="380" />
+        <di:waypoint x="1110" y="380" />
+        <di:waypoint x="1110" y="288" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="Activity_1dzkfh2_di" bpmnElement="Activity_1dzkfh2">
+        <dc:Bounds x="640" y="230" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Gateway_1baxf7k_di" bpmnElement="Gateway_1baxf7k" isMarkerVisible="true">
+        <dc:Bounds x="805" y="245" width="50" height="50" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="787" y="288" width="85" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_103vvkf_di" bpmnElement="Event_103vvkf">
+        <dc:Bounds x="1092" y="252" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0ptby3d_di" bpmnElement="Activity_0ptby3d">
+        <dc:Bounds x="490" y="230" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_05idy03_di" bpmnElement="Event_05idy03">
+        <dc:Bounds x="152" y="252" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="158" y="295" width="24" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0kd9pxx_di" bpmnElement="Activity_0kd9pxx">
+        <dc:Bounds x="210" y="230" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1s8ojcr_di" bpmnElement="Activity_1s8ojcr">
+        <dc:Bounds x="340" y="230" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0t1g4mp_di" bpmnElement="Activity_0t1g4mp">
+        <dc:Bounds x="920" y="100" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0v2hxmv_di" bpmnElement="Activity_0v2hxmv">
+        <dc:Bounds x="920" y="230" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_192bdyv_di" bpmnElement="Activity_192bdyv">
+        <dc:Bounds x="920" y="340" width="100" height="80" />
+      </bpmndi:BPMNShape>
+    </bpmndi:BPMNPlane>
+  </bpmndi:BPMNDiagram>
+</bpmn:definitions>
index 3d37430..8ff1a1e 100644 (file)
       <bpmn:incoming>Flow_10jgbxm</bpmn:incoming>
       <bpmn:terminateEventDefinition id="TerminateEventDefinition_1pnutu7" />
     </bpmn:endEvent>
-    <bpmn:exclusiveGateway id="Gateway_02fectw" default="Flow_0y1ebox">
+    <bpmn:exclusiveGateway id="Gateway_02fectw">
       <bpmn:incoming>Flow_1y3cptr</bpmn:incoming>
       <bpmn:outgoing>Flow_0y1ebox</bpmn:outgoing>
       <bpmn:outgoing>Flow_0mbp7mv</bpmn:outgoing>
+      <bpmn:outgoing>Flow_19tmp99</bpmn:outgoing>
     </bpmn:exclusiveGateway>
     <bpmn:endEvent id="Event_0ldlupa">
       <bpmn:incoming>Flow_0y1ebox</bpmn:incoming>
       <bpmn:errorEventDefinition id="ErrorEventDefinition_1dih7c9" errorRef="Error_01a8p43" />
     </bpmn:endEvent>
-    <bpmn:exclusiveGateway id="Gateway_1nr51kr" default="Flow_0mxq0qe">
-      <bpmn:incoming>Flow_0trmo7s</bpmn:incoming>
-      <bpmn:outgoing>Flow_1z06yyv</bpmn:outgoing>
+    <bpmn:exclusiveGateway id="Gateway_1nr51kr">
+      <bpmn:incoming>Flow_0zjsp5x</bpmn:incoming>
       <bpmn:outgoing>Flow_0mxq0qe</bpmn:outgoing>
+      <bpmn:outgoing>Flow_05x2cqc</bpmn:outgoing>
+      <bpmn:outgoing>Flow_02elm5b</bpmn:outgoing>
     </bpmn:exclusiveGateway>
     <bpmn:endEvent id="Event_16k9r1c">
       <bpmn:incoming>Flow_0mxq0qe</bpmn:incoming>
@@ -40,7 +42,7 @@
       <bpmn:errorEventDefinition id="ErrorEventDefinition_16r0jc3" errorRef="Error_04y00c4" />
     </bpmn:endEvent>
     <bpmn:serviceTask id="Activity_0snmatn" name="Service Level Upgrade" camunda:delegateExpression="${ServiceLevelUpgrade}">
-      <bpmn:incoming>Flow_1z06yyv</bpmn:incoming>
+      <bpmn:incoming>Flow_02elm5b</bpmn:incoming>
       <bpmn:outgoing>Flow_01gwzx9</bpmn:outgoing>
     </bpmn:serviceTask>
     <bpmn:serviceTask id="Activity_0ft7fa2" name="Service Level Postcheck" camunda:delegateExpression="${ServiceLevelPostcheck}">
       <bpmn:outgoing>Flow_1ru18s3</bpmn:outgoing>
     </bpmn:serviceTask>
     <bpmn:serviceTask id="Activity_09bqns0" name="Service Level Preparation" camunda:delegateExpression="${ServiceLevelPreparation}">
-      <bpmn:incoming>Flow_1v0mxe7</bpmn:incoming>
-      <bpmn:outgoing>Flow_1p4xkdj</bpmn:outgoing>
-    </bpmn:serviceTask>
-    <bpmn:scriptTask id="Activity_0qgmx7a" name="Send Response" scriptFormat="groovy">
       <bpmn:incoming>Flow_1b392qs</bpmn:incoming>
-      <bpmn:outgoing>Flow_1v0mxe7</bpmn:outgoing>
-      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
-def pnfSwUpgrade = new GenericPnfSoftwareUpgrade()
-pnfSwUpgrade.sendResponse(execution)</bpmn:script>
-    </bpmn:scriptTask>
+      <bpmn:outgoing>Flow_1ptk2a3</bpmn:outgoing>
+    </bpmn:serviceTask>
     <bpmn:scriptTask id="Activity_1n4rk7m" name="Prepare Completion" scriptFormat="groovy">
       <bpmn:incoming>Flow_0l67uzl</bpmn:incoming>
       <bpmn:outgoing>Flow_0frhsd0</bpmn:outgoing>
@@ -94,24 +89,23 @@ pnfSwUpgrade.prepareFalloutHandler(execution)</bpmn:script>
       <bpmn:sequenceFlow id="Flow_0iayg6u" sourceRef="Event_08f3m9h" targetRef="Activity_1k2f3ha" />
     </bpmn:subProcess>
     <bpmn:sequenceFlow id="Flow_0nrz340" sourceRef="Event_02mc8tr" targetRef="Activity_18vue7u" />
-    <bpmn:sequenceFlow id="Flow_1b392qs" sourceRef="Activity_18vue7u" targetRef="Activity_0qgmx7a" />
+    <bpmn:sequenceFlow id="Flow_1b392qs" sourceRef="Activity_18vue7u" targetRef="Activity_09bqns0" />
     <bpmn:sequenceFlow id="Flow_10jgbxm" sourceRef="Activity_1lz38px" targetRef="Event_12983th" />
-    <bpmn:sequenceFlow id="Flow_01gwzx9" sourceRef="Activity_0snmatn" targetRef="Activity_1q4o9fx" />
-    <bpmn:sequenceFlow id="Flow_0y1ebox" name="Failure" sourceRef="Gateway_02fectw" targetRef="Event_0ldlupa" />
-    <bpmn:sequenceFlow id="Flow_1p4xkdj" sourceRef="Activity_09bqns0" targetRef="Activity_0n17xou" />
-    <bpmn:sequenceFlow id="Flow_1z06yyv" name="Success" sourceRef="Gateway_1nr51kr" targetRef="Activity_0snmatn">
-      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("ControllerStatus").equals("Success")}</bpmn:conditionExpression>
+    <bpmn:sequenceFlow id="Flow_01gwzx9" sourceRef="Activity_0snmatn" targetRef="Activity_0e6w886" />
+    <bpmn:sequenceFlow id="Flow_0y1ebox" name="Failure" sourceRef="Gateway_02fectw" targetRef="Event_0ldlupa">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${!execution.getVariable("ControllerStatus").equals("Success")}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:sequenceFlow id="Flow_0mxq0qe" name="Failure" sourceRef="Gateway_1nr51kr" targetRef="Event_16k9r1c">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${!execution.getVariable("ControllerStatus").equals("Success")}</bpmn:conditionExpression>
     </bpmn:sequenceFlow>
-    <bpmn:sequenceFlow id="Flow_0mxq0qe" name="Failure" sourceRef="Gateway_1nr51kr" targetRef="Event_16k9r1c" />
     <bpmn:sequenceFlow id="Flow_1ru18s3" sourceRef="Activity_0ft7fa2" targetRef="Gateway_1vq11i7" />
     <bpmn:sequenceFlow id="Flow_1tcnzdx" name="Failure" sourceRef="Gateway_1vq11i7" targetRef="Event_03tpudy" />
     <bpmn:sequenceFlow id="Flow_0l67uzl" name="Success" sourceRef="Gateway_1vq11i7" targetRef="Activity_1n4rk7m">
       <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("ControllerStatus").equals("Success")}</bpmn:conditionExpression>
     </bpmn:sequenceFlow>
-    <bpmn:sequenceFlow id="Flow_1v0mxe7" sourceRef="Activity_0qgmx7a" targetRef="Activity_09bqns0" />
     <bpmn:sequenceFlow id="Flow_0frhsd0" sourceRef="Activity_1n4rk7m" targetRef="Activity_1lz38px" />
     <bpmn:sequenceFlow id="Flow_0mbp7mv" name="Success" sourceRef="Gateway_02fectw" targetRef="Activity_1hp67qz">
-      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("ControllerStatus").equals("Success")}</bpmn:conditionExpression>
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("pnfCounter") &gt;= execution.getVariable("pnfSize")}</bpmn:conditionExpression>
     </bpmn:sequenceFlow>
     <bpmn:callActivity id="Activity_0n17xou" name="BPMN to Execute" calledElement="${healthCheckWorkflow}">
       <bpmn:extensionElements>
@@ -123,10 +117,9 @@ pnfSwUpgrade.prepareFalloutHandler(execution)</bpmn:script>
         <camunda:in source="isRollback" target="isRollback" />
         <camunda:in source="pnfName" target="pnfName" />
       </bpmn:extensionElements>
-      <bpmn:incoming>Flow_1p4xkdj</bpmn:incoming>
-      <bpmn:outgoing>Flow_0trmo7s</bpmn:outgoing>
+      <bpmn:incoming>Flow_0rpnl02</bpmn:incoming>
+      <bpmn:outgoing>Flow_0zjsp5x</bpmn:outgoing>
     </bpmn:callActivity>
-    <bpmn:sequenceFlow id="Flow_0trmo7s" sourceRef="Activity_0n17xou" targetRef="Gateway_1nr51kr" />
     <bpmn:callActivity id="Activity_1q4o9fx" name="BPMN to Execute" calledElement="${softwareUpgradeWorkflow}">
       <bpmn:extensionElements>
         <camunda:in source="bpmnRequest" target="bpmnRequest" />
@@ -137,7 +130,7 @@ pnfSwUpgrade.prepareFalloutHandler(execution)</bpmn:script>
         <camunda:in source="isRollback" target="isRollback" />
         <camunda:in source="pnfName" target="pnfName" />
       </bpmn:extensionElements>
-      <bpmn:incoming>Flow_01gwzx9</bpmn:incoming>
+      <bpmn:incoming>Flow_0g6gkgx</bpmn:incoming>
       <bpmn:outgoing>Flow_1y3cptr</bpmn:outgoing>
     </bpmn:callActivity>
     <bpmn:sequenceFlow id="Flow_1y3cptr" sourceRef="Activity_1q4o9fx" targetRef="Gateway_02fectw" />
@@ -151,7 +144,7 @@ pnfSwUpgrade.prepareFalloutHandler(execution)</bpmn:script>
       <bpmn:outgoing>Flow_05ohtnj</bpmn:outgoing>
       <bpmn:outgoing>Flow_0ny61qm</bpmn:outgoing>
     </bpmn:exclusiveGateway>
-    <bpmn:sequenceFlow id="Flow_05ohtnj" name="Success&#10;&#10;" sourceRef="Gateway_18ch73t" targetRef="Activity_0ft7fa2">
+    <bpmn:sequenceFlow id="Flow_05ohtnj" name="Success&#10;" sourceRef="Gateway_18ch73t" targetRef="Activity_0ft7fa2">
       <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("ControllerStatus").equals("Success")}</bpmn:conditionExpression>
     </bpmn:sequenceFlow>
     <bpmn:endEvent id="Event_1fhov6x">
@@ -159,6 +152,29 @@ pnfSwUpgrade.prepareFalloutHandler(execution)</bpmn:script>
       <bpmn:errorEventDefinition id="ErrorEventDefinition_0od3xnw" errorRef="Error_01a8p43" />
     </bpmn:endEvent>
     <bpmn:sequenceFlow id="Flow_0ny61qm" name="Failure&#10;" sourceRef="Gateway_18ch73t" targetRef="Event_1fhov6x" />
+    <bpmn:sequenceFlow id="Flow_1ptk2a3" sourceRef="Activity_09bqns0" targetRef="Activity_02vp5np" />
+    <bpmn:sequenceFlow id="Flow_0rpnl02" sourceRef="Activity_02vp5np" targetRef="Activity_0n17xou" />
+    <bpmn:sequenceFlow id="Flow_0g6gkgx" sourceRef="Activity_0e6w886" targetRef="Activity_1q4o9fx" />
+    <bpmn:sequenceFlow id="Flow_0zjsp5x" sourceRef="Activity_0n17xou" targetRef="Gateway_1nr51kr" />
+    <bpmn:sequenceFlow id="Flow_19tmp99" name="pick next pnf" sourceRef="Gateway_02fectw" targetRef="Activity_0e6w886">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("pnfCounter") &lt; execution.getVariable("pnfSize")}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:sequenceFlow id="Flow_05x2cqc" name="pick next pnf" sourceRef="Gateway_1nr51kr" targetRef="Activity_02vp5np">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("pnfCounter") &lt; execution.getVariable("pnfSize")}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:sequenceFlow id="Flow_02elm5b" name="Success" sourceRef="Gateway_1nr51kr" targetRef="Activity_0snmatn">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("pnfCounter") &gt;= execution.getVariable("pnfSize")}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:serviceTask id="Activity_02vp5np" name="Pnf Counter Execution for HC" camunda:expression="${ServiceLevelPreparation.pnfCounterExecution(execution)}">
+      <bpmn:incoming>Flow_1ptk2a3</bpmn:incoming>
+      <bpmn:incoming>Flow_05x2cqc</bpmn:incoming>
+      <bpmn:outgoing>Flow_0rpnl02</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:serviceTask id="Activity_0e6w886" name="Pnf Counter Execution for SWU" camunda:expression="${ServiceLevelUpgrade.pnfCounterExecution(execution)}">
+      <bpmn:incoming>Flow_01gwzx9</bpmn:incoming>
+      <bpmn:incoming>Flow_19tmp99</bpmn:incoming>
+      <bpmn:outgoing>Flow_0g6gkgx</bpmn:outgoing>
+    </bpmn:serviceTask>
   </bpmn:process>
   <bpmn:error id="Error_01a8p43" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
   <bpmn:error id="Error_0e5owqi" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
@@ -166,212 +182,237 @@ pnfSwUpgrade.prepareFalloutHandler(execution)</bpmn:script>
   <bpmn:error id="Error_04y00c4" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
   <bpmndi:BPMNDiagram id="BPMNDiagram_1">
     <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="ServiceLevelUpgrade">
+      <bpmndi:BPMNEdge id="Flow_02elm5b_di" bpmnElement="Flow_02elm5b">
+        <di:waypoint x="1140" y="198" />
+        <di:waypoint x="1140" y="240" />
+        <di:waypoint x="210" y="240" />
+        <di:waypoint x="210" y="330" />
+        <di:waypoint x="262" y="330" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1148" y="222" width="43" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_05x2cqc_di" bpmnElement="Flow_05x2cqc">
+        <di:waypoint x="1140" y="166" />
+        <di:waypoint x="1140" y="100" />
+        <di:waypoint x="810" y="100" />
+        <di:waypoint x="810" y="142" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="944" y="82" width="63" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_19tmp99_di" bpmnElement="Flow_19tmp99">
+        <di:waypoint x="804" y="314" />
+        <di:waypoint x="804" y="260" />
+        <di:waypoint x="488" y="260" />
+        <di:waypoint x="488" y="290" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="616" y="242" width="63" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0zjsp5x_di" bpmnElement="Flow_0zjsp5x">
+        <di:waypoint x="1030" y="182" />
+        <di:waypoint x="1124" y="182" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0g6gkgx_di" bpmnElement="Flow_0g6gkgx">
+        <di:waypoint x="538" y="330" />
+        <di:waypoint x="590" y="330" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0rpnl02_di" bpmnElement="Flow_0rpnl02">
+        <di:waypoint x="860" y="182" />
+        <di:waypoint x="930" y="182" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1ptk2a3_di" bpmnElement="Flow_1ptk2a3">
+        <di:waypoint x="600" y="182" />
+        <di:waypoint x="760" y="182" />
+      </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="Flow_0ny61qm_di" bpmnElement="Flow_0ny61qm">
-        <di:waypoint x="1190" y="278" />
-        <di:waypoint x="1190" y="334" />
+        <di:waypoint x="1140" y="346" />
+        <di:waypoint x="1140" y="404" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="1152" y="290" width="35" height="27" />
+          <dc:Bounds x="1102" y="362" width="35" height="27" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="Flow_05ohtnj_di" bpmnElement="Flow_05ohtnj">
-        <di:waypoint x="1206" y="262" />
-        <di:waypoint x="1300" y="262" />
-        <di:waypoint x="1300" y="372" />
+        <di:waypoint x="1156" y="330" />
+        <di:waypoint x="1310" y="330" />
+        <di:waypoint x="1310" y="490" />
+        <di:waypoint x="1190" y="490" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="1232" y="244" width="43" height="40" />
+          <dc:Bounds x="1318" y="406" width="43" height="27" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="Flow_0dyc3kv_di" bpmnElement="Flow_0dyc3kv">
-        <di:waypoint x="1120" y="262" />
-        <di:waypoint x="1174" y="262" />
+        <di:waypoint x="1030" y="330" />
+        <di:waypoint x="1124" y="330" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="Flow_1y3cptr_di" bpmnElement="Flow_1y3cptr">
-        <di:waypoint x="860" y="262" />
-        <di:waypoint x="904" y="262" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="Flow_0trmo7s_di" bpmnElement="Flow_0trmo7s">
-        <di:waypoint x="450" y="262" />
-        <di:waypoint x="501" y="262" />
+        <di:waypoint x="690" y="330" />
+        <di:waypoint x="788" y="330" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="Flow_0mbp7mv_di" bpmnElement="Flow_0mbp7mv">
-        <di:waypoint x="936" y="262" />
-        <di:waypoint x="1020" y="262" />
+        <di:waypoint x="820" y="330" />
+        <di:waypoint x="930" y="330" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="948" y="248" width="43" height="14" />
+          <dc:Bounds x="845" y="316" width="43" height="14" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="Flow_0frhsd0_di" bpmnElement="Flow_0frhsd0">
-        <di:waypoint x="312" y="482" />
-        <di:waypoint x="372" y="482" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="Flow_1v0mxe7_di" bpmnElement="Flow_1v0mxe7">
-        <di:waypoint x="532" y="122" />
-        <di:waypoint x="562" y="122" />
-        <di:waypoint x="562" y="192" />
-        <di:waypoint x="172" y="192" />
-        <di:waypoint x="172" y="262" />
-        <di:waypoint x="212" y="262" />
+        <di:waypoint x="362" y="579" />
+        <di:waypoint x="450" y="579" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="Flow_0l67uzl_di" bpmnElement="Flow_0l67uzl">
-        <di:waypoint x="1054" y="412" />
-        <di:waypoint x="172" y="412" />
-        <di:waypoint x="172" y="482" />
-        <di:waypoint x="212" y="482" />
+        <di:waypoint x="964" y="490" />
+        <di:waypoint x="210" y="490" />
+        <di:waypoint x="210" y="579" />
+        <di:waypoint x="262" y="579" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="663" y="398" width="43" height="14" />
+          <dc:Bounds x="612" y="476" width="43" height="14" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="Flow_1tcnzdx_di" bpmnElement="Flow_1tcnzdx">
-        <di:waypoint x="1070" y="428" />
-        <di:waypoint x="1070" y="494" />
+        <di:waypoint x="980" y="506" />
+        <di:waypoint x="980" y="554" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="1032" y="451" width="35" height="14" />
+          <dc:Bounds x="942" y="526" width="35" height="14" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="Flow_1ru18s3_di" bpmnElement="Flow_1ru18s3">
-        <di:waypoint x="1250" y="412" />
-        <di:waypoint x="1086" y="412" />
+        <di:waypoint x="1090" y="490" />
+        <di:waypoint x="996" y="490" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="Flow_0mxq0qe_di" bpmnElement="Flow_0mxq0qe">
-        <di:waypoint x="517" y="278" />
-        <di:waypoint x="517" y="334" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="472" y="296" width="35" height="14" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="Flow_1z06yyv_di" bpmnElement="Flow_1z06yyv">
-        <di:waypoint x="533" y="262" />
-        <di:waypoint x="590" y="262" />
+        <di:waypoint x="1156" y="182" />
+        <di:waypoint x="1284" y="182" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="540" y="248" width="43" height="14" />
+          <dc:Bounds x="1192" y="163" width="35" height="14" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="Flow_1p4xkdj_di" bpmnElement="Flow_1p4xkdj">
-        <di:waypoint x="312" y="262" />
-        <di:waypoint x="350" y="262" />
-      </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="Flow_0y1ebox_di" bpmnElement="Flow_0y1ebox">
-        <di:waypoint x="920" y="278" />
-        <di:waypoint x="918" y="335" />
+        <di:waypoint x="804" y="346" />
+        <di:waypoint x="804" y="414" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="879" y="296" width="35" height="14" />
+          <dc:Bounds x="813" y="374" width="35" height="14" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="Flow_01gwzx9_di" bpmnElement="Flow_01gwzx9">
-        <di:waypoint x="690" y="262" />
-        <di:waypoint x="760" y="262" />
+        <di:waypoint x="362" y="330" />
+        <di:waypoint x="438" y="330" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="Flow_10jgbxm_di" bpmnElement="Flow_10jgbxm">
-        <di:waypoint x="472" y="482" />
-        <di:waypoint x="524" y="480" />
+        <di:waypoint x="550" y="580" />
+        <di:waypoint x="624" y="580" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="Flow_1b392qs_di" bpmnElement="Flow_1b392qs">
-        <di:waypoint x="362" y="122" />
-        <di:waypoint x="432" y="122" />
+        <di:waypoint x="362" y="182" />
+        <di:waypoint x="500" y="182" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="Flow_0nrz340_di" bpmnElement="Flow_0nrz340">
-        <di:waypoint x="186" y="120" />
-        <di:waypoint x="262" y="122" />
+        <di:waypoint x="186" y="180" />
+        <di:waypoint x="262" y="182" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="Event_02mc8tr_di" bpmnElement="Event_02mc8tr">
-        <dc:Bounds x="154" y="104" width="32" height="32" />
+        <dc:Bounds x="154" y="164" width="32" height="32" />
         <bpmndi:BPMNLabel>
           <dc:Bounds x="-6" y="-188" width="51" height="14" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="Activity_18vue7u_di" bpmnElement="Activity_18vue7u">
-        <dc:Bounds x="262" y="82" width="100" height="80" />
+        <dc:Bounds x="262" y="142" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Gateway_02fectw_di" bpmnElement="Gateway_02fectw" isMarkerVisible="true">
+        <dc:Bounds x="788" y="314" width="32" height="32" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Gateway_1nr51kr_di" bpmnElement="Gateway_1nr51kr" isMarkerVisible="true">
+        <dc:Bounds x="1124" y="166" width="32" height="32" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_16k9r1c_di" bpmnElement="Event_16k9r1c">
+        <dc:Bounds x="1284" y="166" width="32" height="32" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0snmatn_di" bpmnElement="Activity_0snmatn">
+        <dc:Bounds x="262" y="290" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_09bqns0_di" bpmnElement="Activity_09bqns0">
+        <dc:Bounds x="500" y="142" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_0ldlupa_di" bpmnElement="Event_0ldlupa">
+        <dc:Bounds x="788" y="414" width="32" height="32" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1lz38px_di" bpmnElement="Activity_1lz38px">
+        <dc:Bounds x="450" y="539" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1n4rk7m_di" bpmnElement="Activity_1n4rk7m">
+        <dc:Bounds x="262" y="539" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="Event_12983th_di" bpmnElement="Event_12983th">
-        <dc:Bounds x="524" y="464" width="32" height="32" />
+        <dc:Bounds x="624" y="565" width="32" height="32" />
         <bpmndi:BPMNLabel>
           <dc:Bounds x="-132" y="-188" width="20" height="14" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Gateway_02fectw_di" bpmnElement="Gateway_02fectw" isMarkerVisible="true">
-        <dc:Bounds x="904" y="246" width="32" height="32" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Event_0ldlupa_di" bpmnElement="Event_0ldlupa">
-        <dc:Bounds x="905" y="334" width="32" height="32" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Gateway_1nr51kr_di" bpmnElement="Gateway_1nr51kr" isMarkerVisible="true">
-        <dc:Bounds x="501" y="246" width="32" height="32" />
+      <bpmndi:BPMNShape id="Activity_0n17xou_di" bpmnElement="Activity_0n17xou">
+        <dc:Bounds x="930" y="142" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Event_16k9r1c_di" bpmnElement="Event_16k9r1c">
-        <dc:Bounds x="501" y="334" width="32" height="32" />
+      <bpmndi:BPMNShape id="Activity_1q4o9fx_di" bpmnElement="Activity_1q4o9fx">
+        <dc:Bounds x="590" y="290" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Gateway_1vq11i7_di" bpmnElement="Gateway_1vq11i7" isMarkerVisible="true">
-        <dc:Bounds x="1054" y="396" width="32" height="32" />
+      <bpmndi:BPMNShape id="Activity_1hp67qz_di" bpmnElement="Activity_1hp67qz">
+        <dc:Bounds x="930" y="290" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Event_03tpudy_di" bpmnElement="Event_03tpudy">
-        <dc:Bounds x="1054" y="494" width="32" height="32" />
+      <bpmndi:BPMNShape id="Gateway_18ch73t_di" bpmnElement="Gateway_18ch73t" isMarkerVisible="true">
+        <dc:Bounds x="1124" y="314" width="32" height="32" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Activity_0snmatn_di" bpmnElement="Activity_0snmatn">
-        <dc:Bounds x="590" y="222" width="100" height="80" />
+      <bpmndi:BPMNShape id="Event_1fhov6x_di" bpmnElement="Event_1fhov6x">
+        <dc:Bounds x="1124" y="404" width="32" height="32" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Activity_0ft7fa2_di" bpmnElement="Activity_0ft7fa2">
-        <dc:Bounds x="1250" y="372" width="100" height="80" />
+      <bpmndi:BPMNShape id="Activity_1bjlebw_di" bpmnElement="Activity_02vp5np">
+        <dc:Bounds x="760" y="142" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Activity_09bqns0_di" bpmnElement="Activity_09bqns0">
-        <dc:Bounds x="212" y="222" width="100" height="80" />
+      <bpmndi:BPMNShape id="Activity_1knf0nl_di" bpmnElement="Activity_0e6w886">
+        <dc:Bounds x="438" y="290" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Activity_0qgmx7a_di" bpmnElement="Activity_0qgmx7a">
-        <dc:Bounds x="432" y="82" width="100" height="80" />
+      <bpmndi:BPMNShape id="Event_03tpudy_di" bpmnElement="Event_03tpudy">
+        <dc:Bounds x="964" y="554" width="32" height="32" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Activity_1n4rk7m_di" bpmnElement="Activity_1n4rk7m">
-        <dc:Bounds x="212" y="442" width="100" height="80" />
+      <bpmndi:BPMNShape id="Activity_0ft7fa2_di" bpmnElement="Activity_0ft7fa2">
+        <dc:Bounds x="1090" y="450" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Activity_1lz38px_di" bpmnElement="Activity_1lz38px">
-        <dc:Bounds x="372" y="442" width="100" height="80" />
+      <bpmndi:BPMNShape id="Gateway_1vq11i7_di" bpmnElement="Gateway_1vq11i7" isMarkerVisible="true">
+        <dc:Bounds x="964" y="474" width="32" height="32" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="Activity_0ui6tp1_di" bpmnElement="Activity_0ui6tp1" isExpanded="true">
-        <dc:Bounds x="362" y="572" width="650" height="190" />
+        <dc:Bounds x="362" y="810" width="650" height="190" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="Flow_0iayg6u_di" bpmnElement="Flow_0iayg6u">
-        <di:waypoint x="466" y="670" />
-        <di:waypoint x="532" y="672" />
+        <di:waypoint x="466" y="908" />
+        <di:waypoint x="532" y="910" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="Flow_0lb7zv5_di" bpmnElement="Flow_0lb7zv5">
-        <di:waypoint x="632" y="672" />
-        <di:waypoint x="702" y="672" />
+        <di:waypoint x="632" y="910" />
+        <di:waypoint x="702" y="910" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="Flow_1peoyur_di" bpmnElement="Flow_1peoyur">
-        <di:waypoint x="802" y="672" />
-        <di:waypoint x="874" y="670" />
+        <di:waypoint x="802" y="910" />
+        <di:waypoint x="874" y="908" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="Event_08f3m9h_di" bpmnElement="Event_08f3m9h">
-        <dc:Bounds x="434" y="654" width="32" height="32" />
+        <dc:Bounds x="434" y="892" width="32" height="32" />
         <bpmndi:BPMNLabel>
           <dc:Bounds x="-161" y="-188" width="78" height="14" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="Activity_1k2f3ha_di" bpmnElement="Activity_1k2f3ha">
-        <dc:Bounds x="532" y="632" width="100" height="80" />
+        <dc:Bounds x="532" y="870" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="Activity_0ai3z2q_di" bpmnElement="Activity_0ai3z2q">
-        <dc:Bounds x="702" y="632" width="100" height="80" />
+        <dc:Bounds x="702" y="870" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="Event_0ngb9wx_di" bpmnElement="Event_0ngb9wx">
-        <dc:Bounds x="874" y="654" width="32" height="32" />
+        <dc:Bounds x="874" y="892" width="32" height="32" />
         <bpmndi:BPMNLabel>
           <dc:Bounds x="-132" y="-188" width="20" height="14" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Activity_0n17xou_di" bpmnElement="Activity_0n17xou">
-        <dc:Bounds x="350" y="222" width="100" height="80" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Activity_1q4o9fx_di" bpmnElement="Activity_1q4o9fx">
-        <dc:Bounds x="760" y="222" width="100" height="80" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Activity_1hp67qz_di" bpmnElement="Activity_1hp67qz">
-        <dc:Bounds x="1020" y="222" width="100" height="80" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Gateway_18ch73t_di" bpmnElement="Gateway_18ch73t" isMarkerVisible="true">
-        <dc:Bounds x="1174" y="246" width="32" height="32" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Event_1fhov6x_di" bpmnElement="Event_1fhov6x">
-        <dc:Bounds x="1174" y="334" width="32" height="32" />
-      </bpmndi:BPMNShape>
     </bpmndi:BPMNPlane>
   </bpmndi:BPMNDiagram>
 </bpmn:definitions>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoActivateAccessNSSI.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoActivateAccessNSSI.bpmn
new file mode 100644 (file)
index 0000000..d81f546
--- /dev/null
@@ -0,0 +1,1012 @@
+<?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" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_0rh5ux5" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.1.1">
+  <bpmn:process id="DoActivateAccessNSSI" name="DoActivateAccessNSSI" isExecutable="true">
+    <bpmn:startEvent id="Event_055gbp2" name="Start">
+      <bpmn:outgoing>Flow_0rh43xe</bpmn:outgoing>
+    </bpmn:startEvent>
+    <bpmn:sequenceFlow id="Flow_0rh43xe" sourceRef="Event_055gbp2" targetRef="Activity_1fv6ljk" />
+    <bpmn:sequenceFlow id="Flow_14z4acw" sourceRef="Activity_1fv6ljk" targetRef="Activity_089t9fj" />
+    <bpmn:exclusiveGateway id="Gateway_12oq1sa" name="Should update AN NF SP status?" default="Flow_0523saw">
+      <bpmn:incoming>Flow_00yl2jk</bpmn:incoming>
+      <bpmn:outgoing>Flow_00fb28f</bpmn:outgoing>
+      <bpmn:outgoing>Flow_0523saw</bpmn:outgoing>
+    </bpmn:exclusiveGateway>
+    <bpmn:sequenceFlow id="Flow_00yl2jk" sourceRef="Activity_1atych2" targetRef="Gateway_12oq1sa" />
+    <bpmn:sequenceFlow id="Flow_00fb28f" sourceRef="Gateway_12oq1sa" targetRef="Activity_0iluozh">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("shouldChangeAN_NF_SPStatus") == true}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:intermediateThrowEvent id="Event_1n5z71a" name="Goto TN NSSI Activation">
+      <bpmn:incoming>Flow_0mtkhmv</bpmn:incoming>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_0x6han6" name="TNNSSIActivation" />
+    </bpmn:intermediateThrowEvent>
+    <bpmn:intermediateCatchEvent id="Event_0kkeo9m" name="TN NSSI Activation">
+      <bpmn:outgoing>Flow_1q7frye</bpmn:outgoing>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_0j5y3mw" name="TNNSSIActivation" />
+    </bpmn:intermediateCatchEvent>
+    <bpmn:intermediateThrowEvent id="Event_09ey569" name="Goto AN NSSI Activation">
+      <bpmn:incoming>Flow_1b6vtso</bpmn:incoming>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_05qiudr" name="AN_NSSI_Activation" />
+    </bpmn:intermediateThrowEvent>
+    <bpmn:sequenceFlow id="Flow_0523saw" sourceRef="Gateway_12oq1sa" targetRef="Event_0rzo7gj" />
+    <bpmn:intermediateThrowEvent id="Event_0rzo7gj" name="Check TN NSSI Activation">
+      <bpmn:incoming>Flow_0523saw</bpmn:incoming>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_0s7s95j" name="TNNSSIActivation" />
+    </bpmn:intermediateThrowEvent>
+    <bpmn:sequenceFlow id="Flow_1cnfilb" sourceRef="Event_1azfo77" targetRef="Activity_1j0xkqc" />
+    <bpmn:endEvent id="Event_0gx3ps0" name="End">
+      <bpmn:incoming>Flow_1876ml0</bpmn:incoming>
+    </bpmn:endEvent>
+    <bpmn:sequenceFlow id="Flow_10f44ab" sourceRef="Activity_089t9fj" targetRef="Activity_19myg2v" />
+    <bpmn:exclusiveGateway id="Gateway_0xcg677" name="shouldChangeSPStatus?" default="Flow_0g9k299">
+      <bpmn:incoming>Flow_0uxerfg</bpmn:incoming>
+      <bpmn:outgoing>Flow_00vt4gf</bpmn:outgoing>
+      <bpmn:outgoing>Flow_0g9k299</bpmn:outgoing>
+    </bpmn:exclusiveGateway>
+    <bpmn:sequenceFlow id="Flow_0uxerfg" sourceRef="Activity_19myg2v" targetRef="Gateway_0xcg677" />
+    <bpmn:sequenceFlow id="Flow_00vt4gf" name="Yes" sourceRef="Gateway_0xcg677" targetRef="Activity_1atych2">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("shouldChangeSPStatus") == true}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:sequenceFlow id="Flow_0g9k299" name="No" sourceRef="Gateway_0xcg677" targetRef="Event_0ocuo1o" />
+    <bpmn:exclusiveGateway id="Gateway_0nr3me0" name="Shoud updateTN FH SP status" default="Flow_10b15um">
+      <bpmn:incoming>Flow_1yd57bl</bpmn:incoming>
+      <bpmn:outgoing>Flow_0zjaac9</bpmn:outgoing>
+      <bpmn:outgoing>Flow_10b15um</bpmn:outgoing>
+    </bpmn:exclusiveGateway>
+    <bpmn:sequenceFlow id="Flow_1yd57bl" sourceRef="Activity_1fzg56b" targetRef="Gateway_0nr3me0" />
+    <bpmn:sequenceFlow id="Flow_1q7frye" sourceRef="Event_0kkeo9m" targetRef="Activity_1fzg56b" />
+    <bpmn:sequenceFlow id="Flow_0zjaac9" name="Yes" sourceRef="Gateway_0nr3me0" targetRef="Activity_0gtw2p7">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("shouldChangeTN_FH_SPStatus") == true}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:sequenceFlow id="Flow_10b15um" sourceRef="Gateway_0nr3me0" targetRef="Event_1nqpg0o" />
+    <bpmn:intermediateCatchEvent id="Event_0j998yp" name="TN MH NSSI Activation">
+      <bpmn:outgoing>Flow_0wvzz2r</bpmn:outgoing>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_1jmgd64" name="TNMHNSSIActivation" />
+    </bpmn:intermediateCatchEvent>
+    <bpmn:intermediateThrowEvent id="Event_1nqpg0o" name="Call TN MH NSSI Activation">
+      <bpmn:incoming>Flow_10b15um</bpmn:incoming>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_1fw9349" name="TNMHNSSIActivation" />
+    </bpmn:intermediateThrowEvent>
+    <bpmn:intermediateThrowEvent id="Event_0ki3ncn" name="GotoTN MH NSSI Activation">
+      <bpmn:incoming>Flow_1qszzfv</bpmn:incoming>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_1hh8o8h" name="TNMHNSSIActivation" />
+    </bpmn:intermediateThrowEvent>
+    <bpmn:intermediateThrowEvent id="Event_1djcl9x" name="Ca AN NSSI Activation">
+      <bpmn:incoming>Flow_00clpwn</bpmn:incoming>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_02qbzt2" name="AN_NSSI_Activation" />
+    </bpmn:intermediateThrowEvent>
+    <bpmn:exclusiveGateway id="Gateway_0cemhjv" name="Shoud updateTN MH SP status" default="Flow_00clpwn">
+      <bpmn:incoming>Flow_0q02qno</bpmn:incoming>
+      <bpmn:outgoing>Flow_00clpwn</bpmn:outgoing>
+      <bpmn:outgoing>Flow_147tw7h</bpmn:outgoing>
+    </bpmn:exclusiveGateway>
+    <bpmn:sequenceFlow id="Flow_0q02qno" sourceRef="Activity_068a0cy" targetRef="Gateway_0cemhjv" />
+    <bpmn:sequenceFlow id="Flow_00clpwn" sourceRef="Gateway_0cemhjv" targetRef="Event_1djcl9x" />
+    <bpmn:sequenceFlow id="Flow_0wvzz2r" sourceRef="Event_0j998yp" targetRef="Activity_068a0cy" />
+    <bpmn:sequenceFlow id="Flow_147tw7h" sourceRef="Gateway_0cemhjv" targetRef="Activity_02vl5kt">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("shouldChangeTN_MH_SPStatus") == true}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:scriptTask id="Activity_089t9fj" name="Fetch Related NSSIs and Slice profile" scriptFormat="groovy">
+      <bpmn:incoming>Flow_14z4acw</bpmn:incoming>
+      <bpmn:outgoing>Flow_10f44ab</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def activator = new DoActivateAccessNSSI()
+activator.getRelatedInstances(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_1fv6ljk" name="Preprocess request" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0rh43xe</bpmn:incoming>
+      <bpmn:outgoing>Flow_14z4acw</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def activator = new DoActivateAccessNSSI()
+activator.preProcessRequest(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_19myg2v" name="Check AN Slice profile status" scriptFormat="groovy">
+      <bpmn:incoming>Flow_10f44ab</bpmn:incoming>
+      <bpmn:outgoing>Flow_0uxerfg</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def activator = new DoActivateAccessNSSI()
+activator.getSPOrchStatus(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_1atych2" name="Check Orchestration status of AN NF sliceprofile" scriptFormat="groovy">
+      <bpmn:incoming>Flow_00vt4gf</bpmn:incoming>
+      <bpmn:outgoing>Flow_00yl2jk</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def activator = new DoActivateAccessNSSI()
+activator.getAnNfSPOrchStatus(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_0iluozh" name="Prepare RAN NF NSSI activation request" scriptFormat="groovy">
+      <bpmn:incoming>Flow_00fb28f</bpmn:incoming>
+      <bpmn:outgoing>Flow_1gxv9id</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def activator = new DoActivateAccessNSSI()
+activator.prepareSdnrActivationRequest(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:callActivity id="Activity_0u2aqld" name="Call SDNR subprocess" calledElement="DoHandleSdnrDmaapRequest">
+      <bpmn:extensionElements>
+        <camunda:in source="sdnrRequest" target="sdnrRequest" />
+        <camunda:in source="SDNR_messageType" target="messageType" />
+        <camunda:in source="SDNR_timeout" target="timeout" />
+        <camunda:in source="msoRequestId" target="correlator" />
+        <camunda:out source="asyncCallbackResponse" target="SDNR_Response" />
+        <camunda:out source="WorkflowException" target="WorkflowException" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_1gxv9id</bpmn:incoming>
+      <bpmn:outgoing>Flow_0o7xomf</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:sequenceFlow id="Flow_1gxv9id" sourceRef="Activity_0iluozh" targetRef="Activity_0u2aqld" />
+    <bpmn:scriptTask id="Activity_1hr68mt" name="Process sdnr response" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0o7xomf</bpmn:incoming>
+      <bpmn:outgoing>Flow_1myzbqw</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def activator = new DoActivateAccessNSSI()
+activator.processSdnrResponse(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:exclusiveGateway id="Gateway_1xwu5f0" name="Is Success response" default="Flow_1v4zg98">
+      <bpmn:incoming>Flow_1myzbqw</bpmn:incoming>
+      <bpmn:outgoing>Flow_1yrel0t</bpmn:outgoing>
+      <bpmn:outgoing>Flow_1v4zg98</bpmn:outgoing>
+    </bpmn:exclusiveGateway>
+    <bpmn:endEvent id="Event_0yfi3mj" name="ActivationWorkflowError">
+      <bpmn:incoming>Flow_1v4zg98</bpmn:incoming>
+      <bpmn:errorEventDefinition id="ErrorEventDefinition_1n2vwxe" errorRef="Error_1beg2za" />
+    </bpmn:endEvent>
+    <bpmn:scriptTask id="Activity_03sbng2" name="Update Job status" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1sroz8o</bpmn:incoming>
+      <bpmn:outgoing>Flow_0rizzsm</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def activator = new DoActivateAccessNSSI()
+activator..prepareUpdateJobStatus(execution,"processing","40","AN NF NSSI activation completed")</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:serviceTask id="Activity_08yj5gq" 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_0rizzsm</bpmn:incoming>
+      <bpmn:outgoing>Flow_0mtkhmv</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:sequenceFlow id="Flow_1yrel0t" name="Yes" sourceRef="Gateway_1xwu5f0" targetRef="Activity_09e5oh6">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("isANactivationSuccess") == true}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:sequenceFlow id="Flow_1v4zg98" sourceRef="Gateway_1xwu5f0" targetRef="Event_0yfi3mj" />
+    <bpmn:sequenceFlow id="Flow_0rizzsm" sourceRef="Activity_03sbng2" targetRef="Activity_08yj5gq" />
+    <bpmn:sequenceFlow id="Flow_0o7xomf" sourceRef="Activity_0u2aqld" targetRef="Activity_1hr68mt" />
+    <bpmn:sequenceFlow id="Flow_1myzbqw" sourceRef="Activity_1hr68mt" targetRef="Gateway_1xwu5f0" />
+    <bpmn:sequenceFlow id="Flow_1sroz8o" sourceRef="Activity_09e5oh6" targetRef="Activity_03sbng2" />
+    <bpmn:subProcess id="Activity_1aesimf" name="Sub-process for FalloutHandler and Rollback" triggeredByEvent="true">
+      <bpmn:startEvent id="Event_156ogc4">
+        <bpmn:outgoing>Flow_0tw7xsp</bpmn:outgoing>
+        <bpmn:errorEventDefinition id="ErrorEventDefinition_06h72ej" errorRef="Error_1beg2za" />
+      </bpmn:startEvent>
+      <bpmn:endEvent id="Event_1n2qjvx">
+        <bpmn:incoming>Flow_0y0r82m</bpmn:incoming>
+      </bpmn:endEvent>
+      <bpmn:scriptTask id="Activity_1eedm9e" name="Handle Unexpected Error" scriptFormat="groovy">
+        <bpmn:incoming>Flow_1bqk5yt</bpmn:incoming>
+        <bpmn:outgoing>Flow_0y0r82m</bpmn:outgoing>
+        <bpmn:script>import org.onap.so.bpmn.common.scripts.*
+ExceptionUtil ex = new ExceptionUtil()
+ex.processJavaException(execution)</bpmn:script>
+      </bpmn:scriptTask>
+      <bpmn:serviceTask id="Activity_1szd5yp" 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_075rb1i</bpmn:incoming>
+        <bpmn:outgoing>Flow_1bqk5yt</bpmn:outgoing>
+      </bpmn:serviceTask>
+      <bpmn:scriptTask id="Activity_0lpw3j7" name="Update Job status" scriptFormat="groovy">
+        <bpmn:incoming>Flow_0tw7xsp</bpmn:incoming>
+        <bpmn:outgoing>Flow_075rb1i</bpmn:outgoing>
+        <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def activator = new DoActivateAccessNSSI()
+activator.prepareUpdateJobStatus(execution,"failed","0","AN NSSI activation Failed")</bpmn:script>
+      </bpmn:scriptTask>
+      <bpmn:sequenceFlow id="Flow_0y0r82m" sourceRef="Activity_1eedm9e" targetRef="Event_1n2qjvx" />
+      <bpmn:sequenceFlow id="Flow_075rb1i" sourceRef="Activity_0lpw3j7" targetRef="Activity_1szd5yp" />
+      <bpmn:sequenceFlow id="Flow_0tw7xsp" sourceRef="Event_156ogc4" targetRef="Activity_0lpw3j7" />
+      <bpmn:sequenceFlow id="Flow_1bqk5yt" sourceRef="Activity_1szd5yp" targetRef="Activity_1eedm9e" />
+    </bpmn:subProcess>
+    <bpmn:subProcess id="Activity_0hioign" name="Sub-process for FalloutHandler and Rollback" triggeredByEvent="true">
+      <bpmn:scriptTask id="Activity_1f3cipf" name="Handle Unexpected Error" scriptFormat="groovy">
+        <bpmn:incoming>Flow_0cvs8zk</bpmn:incoming>
+        <bpmn:outgoing>Flow_01jdnrt</bpmn:outgoing>
+        <bpmn:script>import org.onap.so.bpmn.common.scripts.*
+ExceptionUtil ex = new ExceptionUtil()
+ex.processJavaException(execution)</bpmn:script>
+      </bpmn:scriptTask>
+      <bpmn:endEvent id="Event_18qzt1n">
+        <bpmn:incoming>Flow_01jdnrt</bpmn:incoming>
+      </bpmn:endEvent>
+      <bpmn:startEvent id="Event_0lvvn7i">
+        <bpmn:outgoing>Flow_0cvs8zk</bpmn:outgoing>
+        <bpmn:errorEventDefinition id="ErrorEventDefinition_0c93dlp" />
+      </bpmn:startEvent>
+      <bpmn:sequenceFlow id="Flow_01jdnrt" sourceRef="Activity_1f3cipf" targetRef="Event_18qzt1n" />
+      <bpmn:sequenceFlow id="Flow_0cvs8zk" sourceRef="Event_0lvvn7i" targetRef="Activity_1f3cipf" />
+    </bpmn:subProcess>
+    <bpmn:scriptTask id="Activity_09e5oh6" name="Update RAN NF NSSI  and SP status" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1yrel0t</bpmn:incoming>
+      <bpmn:outgoing>Flow_1sroz8o</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def activator = new DoActivateAccessNSSI()
+activator.updateAnNfStatus(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_0mtkhmv" sourceRef="Activity_08yj5gq" targetRef="Event_1n5z71a" />
+    <bpmn:scriptTask id="Activity_1fzg56b" name="Check TN FH Slice profile status" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1q7frye</bpmn:incoming>
+      <bpmn:outgoing>Flow_1yd57bl</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def activator = new DoActivateAccessNSSI()
+activator.getTnFhSPOrchStatus(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_0gtw2p7" name="Handle TN FH NSSI Activation" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0zjaac9</bpmn:incoming>
+      <bpmn:outgoing>Flow_0heuc95</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def activator = new DoActivateAccessNSSI()
+activator.doTnFhNssiActivation(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_07cr1m2" name="Prepare job status query" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0heuc95</bpmn:incoming>
+      <bpmn:outgoing>Flow_1w3h345</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+
+String jobId = execution.getVariable("TN_FH_jobId")
+String networkType="tn"
+String nssiid=execution.getVariable("tnFhNssiId")
+
+def def activator = new DoActivateAccessNSSI()
+activator.prepareQueryJobStatus(execution, jobId,networkType, nssiid)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:callActivity id="Activity_03hbxfi" name="QueryJobStatus" calledElement="QueryJobStatus">
+      <bpmn:extensionElements>
+        <camunda:in source="tn_esrInfo" target="esrInfo" />
+        <camunda:in source="tn_responseId" target="responseId" />
+        <camunda:in source="TN_FH_jobId" target="jobId" />
+        <camunda:in source="tn_serviceInfo" target="serviceInfo" />
+        <camunda:out source="responseDescriptor" target="tn_responseDescriptor" />
+        <camunda:out source="WorkflowException" target="WorkflowException" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_1w3h345</bpmn:incoming>
+      <bpmn:outgoing>Flow_16pqv7g</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:scriptTask id="Activity_0br2i5b" name="Validate jobstatus" scriptFormat="groovy">
+      <bpmn:incoming>Flow_16pqv7g</bpmn:incoming>
+      <bpmn:outgoing>Flow_1i0s8nu</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+
+String responseDescriptor = execution.getVariable("tn_responseDescriptor")
+
+def activator = new DoActivateAccessNSSI()
+activator.validateJobStatus(execution, responseDescriptor)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:exclusiveGateway id="Gateway_1ot96tc" name="Is Job complete?" default="Flow_0ajre96">
+      <bpmn:incoming>Flow_1i0s8nu</bpmn:incoming>
+      <bpmn:outgoing>Flow_0bukcmf</bpmn:outgoing>
+      <bpmn:outgoing>Flow_0ajre96</bpmn:outgoing>
+    </bpmn:exclusiveGateway>
+    <bpmn:sequenceFlow id="Flow_1w3h345" sourceRef="Activity_07cr1m2" targetRef="Activity_03hbxfi" />
+    <bpmn:sequenceFlow id="Flow_16pqv7g" sourceRef="Activity_03hbxfi" targetRef="Activity_0br2i5b" />
+    <bpmn:sequenceFlow id="Flow_1i0s8nu" sourceRef="Activity_0br2i5b" targetRef="Gateway_1ot96tc" />
+    <bpmn:sequenceFlow id="Flow_0heuc95" sourceRef="Activity_0gtw2p7" targetRef="Activity_07cr1m2" />
+    <bpmn:sequenceFlow id="Flow_0bukcmf" name="Yes" sourceRef="Gateway_1ot96tc" targetRef="Activity_1xirwg3">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("isSuccess") == true}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:sequenceFlow id="Flow_0ajre96" sourceRef="Gateway_1ot96tc" targetRef="Event_0uco28x" />
+    <bpmn:endEvent id="Event_0uco28x" name="ActivationWorkflowError">
+      <bpmn:incoming>Flow_0ajre96</bpmn:incoming>
+      <bpmn:errorEventDefinition id="ErrorEventDefinition_0p0lfhq" errorRef="Error_1beg2za" />
+    </bpmn:endEvent>
+    <bpmn:serviceTask id="Activity_1t28p4r" 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_1ldkgyg</bpmn:incoming>
+      <bpmn:outgoing>Flow_1qszzfv</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:sequenceFlow id="Flow_1ldkgyg" sourceRef="Activity_1o0a55b" targetRef="Activity_1t28p4r" />
+    <bpmn:sequenceFlow id="Flow_1qszzfv" sourceRef="Activity_1t28p4r" targetRef="Event_0ki3ncn" />
+    <bpmn:scriptTask id="Activity_1o0a55b" name="Update Job status" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1b95clk</bpmn:incoming>
+      <bpmn:outgoing>Flow_1ldkgyg</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def activator = new DoActivateAccessNSSI()
+activator.prepareUpdateJobStatus(execution,"processing","60","TN FH NSSI activation completed")</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_068a0cy" name="Check TN MH Slice profile status" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0wvzz2r</bpmn:incoming>
+      <bpmn:outgoing>Flow_0q02qno</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def activator = new DoActivateAccessNSSI()
+activator.getTnMhSPOrchStatus(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:intermediateCatchEvent id="Event_1azfo77" name="AN NSSI Activation">
+      <bpmn:outgoing>Flow_1cnfilb</bpmn:outgoing>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_05vnzdd" name="AN_NSSI_Activation" />
+    </bpmn:intermediateCatchEvent>
+    <bpmn:scriptTask id="Activity_02vl5kt" name="Handle TN MH NSSI Activation" scriptFormat="groovy">
+      <bpmn:incoming>Flow_147tw7h</bpmn:incoming>
+      <bpmn:outgoing>Flow_1s0xcf5</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+
+def activator = new DoActivateAccessNSSI()
+activator.doTnMhNssiActivation(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_1kszh5k" name="Prepare job status query" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1s0xcf5</bpmn:incoming>
+      <bpmn:outgoing>Flow_0sqsq1x</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+
+String jobId = execution.getVariable("TN_MH_jobId")
+String networkType="tn"
+String nssiid=execution.getVariable("tnMhNssiId")
+
+def def activator = new DoActivateAccessNSSI()
+activator.prepareQueryJobStatus(execution, jobId,networkType, nssiid)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:callActivity id="Activity_09jt4b0" name="QueryJobStatus" calledElement="QueryJobStatus">
+      <bpmn:extensionElements>
+        <camunda:in source="tn_esrInfo" target="esrInfo" />
+        <camunda:in source="tn_responseId" target="responseId" />
+        <camunda:in source="TN_MH_jobId" target="jobId" />
+        <camunda:in source="tn_serviceInfo" target="serviceInfo" />
+        <camunda:out source="responseDescriptor" target="tn_responseDescriptor" />
+        <camunda:out source="WorkflowException" target="WorkflowException" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_0sqsq1x</bpmn:incoming>
+      <bpmn:outgoing>Flow_0b7aq1k</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:scriptTask id="Activity_1su25xm" name="Validate jobstatus" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0b7aq1k</bpmn:incoming>
+      <bpmn:outgoing>Flow_0to1idt</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+
+String responseDescriptor = execution.getVariable("tn_responseDescriptor")
+
+def activator = new DoActivateAccessNSSI()
+activator.validateJobStatus(execution, responseDescriptor)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:exclusiveGateway id="Gateway_114io6q" name="Is Job complete?" default="Flow_0rzuxa0">
+      <bpmn:incoming>Flow_0to1idt</bpmn:incoming>
+      <bpmn:outgoing>Flow_1i4cc7e</bpmn:outgoing>
+      <bpmn:outgoing>Flow_0rzuxa0</bpmn:outgoing>
+    </bpmn:exclusiveGateway>
+    <bpmn:endEvent id="Event_08ecfyj" name="ActivationWorkflowError">
+      <bpmn:incoming>Flow_0rzuxa0</bpmn:incoming>
+      <bpmn:errorEventDefinition id="ErrorEventDefinition_0ptrcor" errorRef="Error_1beg2za" />
+    </bpmn:endEvent>
+    <bpmn:scriptTask id="Activity_0ftm8b6" name="Update Job status" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0k5cyz7</bpmn:incoming>
+      <bpmn:outgoing>Flow_1wx5w6i</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def activator = new DoActivateAccessNSSI()
+activator.prepareUpdateJobStatus(execution,"processing","80","TN MH NSSI activation completed")</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:serviceTask id="Activity_1xnstqr" 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_1wx5w6i</bpmn:incoming>
+      <bpmn:outgoing>Flow_1b6vtso</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:sequenceFlow id="Flow_0sqsq1x" sourceRef="Activity_1kszh5k" targetRef="Activity_09jt4b0" />
+    <bpmn:sequenceFlow id="Flow_0b7aq1k" sourceRef="Activity_09jt4b0" targetRef="Activity_1su25xm" />
+    <bpmn:sequenceFlow id="Flow_0to1idt" sourceRef="Activity_1su25xm" targetRef="Gateway_114io6q" />
+    <bpmn:sequenceFlow id="Flow_1i4cc7e" name="Yes" sourceRef="Gateway_114io6q" targetRef="Activity_0xmezab">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("isSuccess") == true}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:sequenceFlow id="Flow_0rzuxa0" sourceRef="Gateway_114io6q" targetRef="Event_08ecfyj" />
+    <bpmn:sequenceFlow id="Flow_1wx5w6i" sourceRef="Activity_0ftm8b6" targetRef="Activity_1xnstqr" />
+    <bpmn:sequenceFlow id="Flow_1s0xcf5" sourceRef="Activity_02vl5kt" targetRef="Activity_1kszh5k" />
+    <bpmn:sequenceFlow id="Flow_1b6vtso" sourceRef="Activity_1xnstqr" targetRef="Event_09ey569" />
+    <bpmn:sequenceFlow id="Flow_1b95clk" sourceRef="Activity_1xirwg3" targetRef="Activity_1o0a55b" />
+    <bpmn:scriptTask id="Activity_1xirwg3" name="Update TN FH SP and NSSI Orch Status" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0bukcmf</bpmn:incoming>
+      <bpmn:outgoing>Flow_1b95clk</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def activator = new DoActivateAccessNSSI()
+activator.updateTNFHStatus(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_0xmezab" name="Update TN FH SP and NSSI Orch Status" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1i4cc7e</bpmn:incoming>
+      <bpmn:outgoing>Flow_0k5cyz7</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+
+def activator = new DoActivateAccessNSSI()
+activator.updateTNFHStatus(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_0k5cyz7" sourceRef="Activity_0xmezab" targetRef="Activity_0ftm8b6" />
+    <bpmn:scriptTask id="Activity_1j0xkqc" name="Check Orch status for AN NSSI activation" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1cnfilb</bpmn:incoming>
+      <bpmn:outgoing>Flow_0cblklk</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+
+def activator = new DoActivateAccessNSSI()
+activator.updateANStatus(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_0huy5ph" name="Update Job status" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0cblklk</bpmn:incoming>
+      <bpmn:outgoing>Flow_06nfip0</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def activator = new DoActivateAccessNSSI()
+activator.prepareUpdateJobStatus(execution,"finished","100","AN NSSI activation completed")</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:serviceTask id="Activity_1tbardv" 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_06nfip0</bpmn:incoming>
+      <bpmn:outgoing>Flow_1876ml0</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:sequenceFlow id="Flow_06nfip0" sourceRef="Activity_0huy5ph" targetRef="Activity_1tbardv" />
+    <bpmn:sequenceFlow id="Flow_0cblklk" sourceRef="Activity_1j0xkqc" targetRef="Activity_0huy5ph" />
+    <bpmn:sequenceFlow id="Flow_1876ml0" sourceRef="Activity_1tbardv" targetRef="Event_0gx3ps0" />
+    <bpmn:intermediateThrowEvent id="Event_0ocuo1o" name="Goto AN NSSI activation">
+      <bpmn:incoming>Flow_0g9k299</bpmn:incoming>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_1h9r8pc" name="AN_NSSI_Activation" />
+    </bpmn:intermediateThrowEvent>
+  </bpmn:process>
+  <bpmn:error id="Error_1beg2za" name="ActivationWorkflowError" errorCode="2500" />
+  <bpmn:error id="Error_0vgjqok" />
+  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoActivateAccessNSSI">
+      <bpmndi:BPMNEdge id="Flow_1876ml0_di" bpmnElement="Flow_1876ml0">
+        <di:waypoint x="660" y="940" />
+        <di:waypoint x="712" y="940" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0cblklk_di" bpmnElement="Flow_0cblklk">
+        <di:waypoint x="350" y="940" />
+        <di:waypoint x="390" y="940" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_06nfip0_di" bpmnElement="Flow_06nfip0">
+        <di:waypoint x="490" y="940" />
+        <di:waypoint x="560" y="940" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0k5cyz7_di" bpmnElement="Flow_0k5cyz7">
+        <di:waypoint x="1330" y="690" />
+        <di:waypoint x="1410" y="690" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1b95clk_di" bpmnElement="Flow_1b95clk">
+        <di:waypoint x="1320" y="450" />
+        <di:waypoint x="1410" y="450" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1b6vtso_di" bpmnElement="Flow_1b6vtso">
+        <di:waypoint x="1680" y="690" />
+        <di:waypoint x="1742" y="690" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1s0xcf5_di" bpmnElement="Flow_1s0xcf5">
+        <di:waypoint x="580" y="690" />
+        <di:waypoint x="640" y="690" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1wx5w6i_di" bpmnElement="Flow_1wx5w6i">
+        <di:waypoint x="1510" y="690" />
+        <di:waypoint x="1580" y="690" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0rzuxa0_di" bpmnElement="Flow_0rzuxa0">
+        <di:waypoint x="1140" y="715" />
+        <di:waypoint x="1140" y="762" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1i4cc7e_di" bpmnElement="Flow_1i4cc7e">
+        <di:waypoint x="1165" y="690" />
+        <di:waypoint x="1230" y="690" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1168" y="672" width="18" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0to1idt_di" bpmnElement="Flow_0to1idt">
+        <di:waypoint x="1070" y="690" />
+        <di:waypoint x="1115" y="690" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0b7aq1k_di" bpmnElement="Flow_0b7aq1k">
+        <di:waypoint x="900" y="690" />
+        <di:waypoint x="970" y="690" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0sqsq1x_di" bpmnElement="Flow_0sqsq1x">
+        <di:waypoint x="740" y="690" />
+        <di:waypoint x="800" y="690" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1qszzfv_di" bpmnElement="Flow_1qszzfv">
+        <di:waypoint x="1680" y="450" />
+        <di:waypoint x="1732" y="450" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1ldkgyg_di" bpmnElement="Flow_1ldkgyg">
+        <di:waypoint x="1510" y="450" />
+        <di:waypoint x="1580" y="450" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0ajre96_di" bpmnElement="Flow_0ajre96">
+        <di:waypoint x="1130" y="475" />
+        <di:waypoint x="1130" y="522" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0bukcmf_di" bpmnElement="Flow_0bukcmf">
+        <di:waypoint x="1155" y="450" />
+        <di:waypoint x="1220" y="450" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1158" y="432" width="18" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0heuc95_di" bpmnElement="Flow_0heuc95">
+        <di:waypoint x="580" y="450" />
+        <di:waypoint x="630" y="450" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1i0s8nu_di" bpmnElement="Flow_1i0s8nu">
+        <di:waypoint x="1060" y="450" />
+        <di:waypoint x="1105" y="450" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_16pqv7g_di" bpmnElement="Flow_16pqv7g">
+        <di:waypoint x="890" y="450" />
+        <di:waypoint x="960" y="450" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1w3h345_di" bpmnElement="Flow_1w3h345">
+        <di:waypoint x="730" y="450" />
+        <di:waypoint x="790" y="450" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0mtkhmv_di" bpmnElement="Flow_0mtkhmv">
+        <di:waypoint x="2110" y="230" />
+        <di:waypoint x="2152" y="230" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1sroz8o_di" bpmnElement="Flow_1sroz8o">
+        <di:waypoint x="1800" y="230" />
+        <di:waypoint x="1870" y="230" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1myzbqw_di" bpmnElement="Flow_1myzbqw">
+        <di:waypoint x="1500" y="230" />
+        <di:waypoint x="1565" y="230" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0o7xomf_di" bpmnElement="Flow_0o7xomf">
+        <di:waypoint x="1340" y="230" />
+        <di:waypoint x="1400" y="230" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0rizzsm_di" bpmnElement="Flow_0rizzsm">
+        <di:waypoint x="1970" y="230" />
+        <di:waypoint x="2010" y="230" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1v4zg98_di" bpmnElement="Flow_1v4zg98">
+        <di:waypoint x="1590" y="255" />
+        <di:waypoint x="1590" y="302" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1yrel0t_di" bpmnElement="Flow_1yrel0t">
+        <di:waypoint x="1615" y="230" />
+        <di:waypoint x="1700" y="230" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1649" y="212" width="18" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1gxv9id_di" bpmnElement="Flow_1gxv9id">
+        <di:waypoint x="1180" y="230" />
+        <di:waypoint x="1240" y="230" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_147tw7h_di" bpmnElement="Flow_147tw7h">
+        <di:waypoint x="435" y="690" />
+        <di:waypoint x="480" y="690" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0wvzz2r_di" bpmnElement="Flow_0wvzz2r">
+        <di:waypoint x="198" y="690" />
+        <di:waypoint x="240" y="690" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_00clpwn_di" bpmnElement="Flow_00clpwn">
+        <di:waypoint x="410" y="715" />
+        <di:waypoint x="410" y="800" />
+        <di:waypoint x="482" y="800" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0q02qno_di" bpmnElement="Flow_0q02qno">
+        <di:waypoint x="340" y="690" />
+        <di:waypoint x="385" y="690" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_10b15um_di" bpmnElement="Flow_10b15um">
+        <di:waypoint x="410" y="475" />
+        <di:waypoint x="410" y="560" />
+        <di:waypoint x="482" y="560" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0zjaac9_di" bpmnElement="Flow_0zjaac9">
+        <di:waypoint x="435" y="450" />
+        <di:waypoint x="480" y="450" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="449" y="432" width="18" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1q7frye_di" bpmnElement="Flow_1q7frye">
+        <di:waypoint x="198" y="450" />
+        <di:waypoint x="240" y="450" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1yd57bl_di" bpmnElement="Flow_1yd57bl">
+        <di:waypoint x="340" y="450" />
+        <di:waypoint x="385" y="450" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0g9k299_di" bpmnElement="Flow_0g9k299">
+        <di:waypoint x="690" y="205" />
+        <di:waypoint x="690" y="100" />
+        <di:waypoint x="752" y="100" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="698" y="150" width="15" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_00vt4gf_di" bpmnElement="Flow_00vt4gf">
+        <di:waypoint x="715" y="230" />
+        <di:waypoint x="800" y="230" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="749" y="212" width="18" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0uxerfg_di" bpmnElement="Flow_0uxerfg">
+        <di:waypoint x="620" y="230" />
+        <di:waypoint x="665" y="230" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_10f44ab_di" bpmnElement="Flow_10f44ab">
+        <di:waypoint x="480" y="230" />
+        <di:waypoint x="520" y="230" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1cnfilb_di" bpmnElement="Flow_1cnfilb">
+        <di:waypoint x="198" y="940" />
+        <di:waypoint x="250" y="940" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0523saw_di" bpmnElement="Flow_0523saw">
+        <di:waypoint x="990" y="205" />
+        <di:waypoint x="990" y="130" />
+        <di:waypoint x="1062" y="130" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_00fb28f_di" bpmnElement="Flow_00fb28f">
+        <di:waypoint x="1015" y="230" />
+        <di:waypoint x="1080" y="230" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_00yl2jk_di" bpmnElement="Flow_00yl2jk">
+        <di:waypoint x="900" y="230" />
+        <di:waypoint x="965" y="230" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_14z4acw_di" bpmnElement="Flow_14z4acw">
+        <di:waypoint x="340" y="230" />
+        <di:waypoint x="380" y="230" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0rh43xe_di" bpmnElement="Flow_0rh43xe">
+        <di:waypoint x="198" y="230" />
+        <di:waypoint x="240" y="230" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="Event_055gbp2_di" bpmnElement="Event_055gbp2">
+        <dc:Bounds x="162" y="212" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="168" y="255" width="24" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Gateway_12oq1sa_di" bpmnElement="Gateway_12oq1sa" isMarkerVisible="true">
+        <dc:Bounds x="965" y="205" width="50" height="50" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="945" y="265" width="90" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_1v7p5kl_di" bpmnElement="Event_1n5z71a">
+        <dc:Bounds x="2152" y="212" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="2137" y="255" width="71" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_01vyapf_di" bpmnElement="Event_0kkeo9m">
+        <dc:Bounds x="162" y="432" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="157" y="475" width="48" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_1u3s42m_di" bpmnElement="Event_09ey569">
+        <dc:Bounds x="1742" y="672" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1728" y="715" width="71" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_01fudey_di" bpmnElement="Event_0rzo7gj">
+        <dc:Bounds x="1062" y="112" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1042" y="155" width="78" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_0gx3ps0_di" bpmnElement="Event_0gx3ps0">
+        <dc:Bounds x="712" y="922" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="720" y="965" width="20" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Gateway_0xcg677_di" bpmnElement="Gateway_0xcg677" isMarkerVisible="true">
+        <dc:Bounds x="665" y="205" width="50" height="50" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="647" y="262" width="86" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Gateway_0nr3me0_di" bpmnElement="Gateway_0nr3me0" isMarkerVisible="true">
+        <dc:Bounds x="385" y="425" width="50" height="50" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="370" y="395" width="84" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_0j998yp_di" bpmnElement="Event_0j998yp">
+        <dc:Bounds x="162" y="672" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="150" y="715" width="64" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_05lm9ln_di" bpmnElement="Event_1nqpg0o">
+        <dc:Bounds x="482" y="542" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="457" y="585" width="86" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_0wv22e3_di" bpmnElement="Event_0ki3ncn">
+        <dc:Bounds x="1732" y="432" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1706" y="475" width="88" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_1djcl9x_di" bpmnElement="Event_1djcl9x">
+        <dc:Bounds x="482" y="782" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="469" y="825" width="62" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Gateway_0cemhjv_di" bpmnElement="Gateway_0cemhjv" isMarkerVisible="true">
+        <dc:Bounds x="385" y="665" width="50" height="50" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="368" y="635" width="84" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_00e6sqq_di" bpmnElement="Activity_089t9fj">
+        <dc:Bounds x="380" y="190" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_147vycg_di" bpmnElement="Activity_1fv6ljk">
+        <dc:Bounds x="240" y="190" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1465ih9_di" bpmnElement="Activity_19myg2v">
+        <dc:Bounds x="520" y="190" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_16l1ykw_di" bpmnElement="Activity_1atych2">
+        <dc:Bounds x="800" y="190" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_10uophi_di" bpmnElement="Activity_0iluozh">
+        <dc:Bounds x="1080" y="190" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0u2aqld_di" bpmnElement="Activity_0u2aqld">
+        <dc:Bounds x="1240" y="190" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1hr68mt_di" bpmnElement="Activity_1hr68mt">
+        <dc:Bounds x="1400" y="190" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Gateway_1xwu5f0_di" bpmnElement="Gateway_1xwu5f0" isMarkerVisible="true">
+        <dc:Bounds x="1565" y="205" width="50" height="50" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1564" y="175" width="54" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_0yfi3mj_di" bpmnElement="Event_0yfi3mj">
+        <dc:Bounds x="1572" y="302" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1607" y="286" width="85" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_03sbng2_di" bpmnElement="Activity_03sbng2">
+        <dc:Bounds x="1870" y="190" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_08yj5gq_di" bpmnElement="Activity_08yj5gq">
+        <dc:Bounds x="2010" y="190" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1aesimf_di" bpmnElement="Activity_1aesimf" isExpanded="true">
+        <dc:Bounds x="210" y="1130" width="770" height="170" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="Flow_1bqk5yt_di" bpmnElement="Flow_1bqk5yt">
+        <di:waypoint x="630" y="1234" />
+        <di:waypoint x="710" y="1234" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0tw7xsp_di" bpmnElement="Flow_0tw7xsp">
+        <di:waypoint x="278" y="1234" />
+        <di:waypoint x="380" y="1234" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_075rb1i_di" bpmnElement="Flow_075rb1i">
+        <di:waypoint x="480" y="1234" />
+        <di:waypoint x="530" y="1234" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0y0r82m_di" bpmnElement="Flow_0y0r82m">
+        <di:waypoint x="810" y="1234" />
+        <di:waypoint x="892" y="1234" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="Event_156ogc4_di" bpmnElement="Event_156ogc4">
+        <dc:Bounds x="242" y="1216" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_1n2qjvx_di" bpmnElement="Event_1n2qjvx">
+        <dc:Bounds x="892" y="1216" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1eedm9e_di" bpmnElement="Activity_1eedm9e">
+        <dc:Bounds x="710" y="1194" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1szd5yp_di" bpmnElement="Activity_1szd5yp">
+        <dc:Bounds x="530" y="1194" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0lpw3j7_di" bpmnElement="Activity_0lpw3j7">
+        <dc:Bounds x="380" y="1194" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0hioign_di" bpmnElement="Activity_0hioign" isExpanded="true">
+        <dc:Bounds x="320" y="1420" width="440" height="140" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="Flow_0cvs8zk_di" bpmnElement="Flow_0cvs8zk">
+        <di:waypoint x="408" y="1481" />
+        <di:waypoint x="473" y="1481" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_01jdnrt_di" bpmnElement="Flow_01jdnrt">
+        <di:waypoint x="573" y="1481" />
+        <di:waypoint x="672" y="1481" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="Activity_1f3cipf_di" bpmnElement="Activity_1f3cipf">
+        <dc:Bounds x="473" y="1441" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_18qzt1n_di" bpmnElement="Event_18qzt1n">
+        <dc:Bounds x="672" y="1463" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_0lvvn7i_di" bpmnElement="Event_0lvvn7i">
+        <dc:Bounds x="372" y="1463" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1u5yry2_di" bpmnElement="Activity_09e5oh6">
+        <dc:Bounds x="1700" y="190" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1ng1vyl_di" bpmnElement="Activity_1fzg56b">
+        <dc:Bounds x="240" y="410" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1vabe3f_di" bpmnElement="Activity_0gtw2p7">
+        <dc:Bounds x="480" y="410" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_07cr1m2_di" bpmnElement="Activity_07cr1m2">
+        <dc:Bounds x="630" y="410" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_03hbxfi_di" bpmnElement="Activity_03hbxfi">
+        <dc:Bounds x="790" y="410" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0br2i5b_di" bpmnElement="Activity_0br2i5b">
+        <dc:Bounds x="960" y="410" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Gateway_1ot96tc_di" bpmnElement="Gateway_1ot96tc" isMarkerVisible="true">
+        <dc:Bounds x="1105" y="425" width="50" height="50" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1088" y="395" width="84" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_0h9nwqd_di" bpmnElement="Event_0uco28x">
+        <dc:Bounds x="1112" y="522" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1088" y="565" width="85" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1t28p4r_di" bpmnElement="Activity_1t28p4r">
+        <dc:Bounds x="1580" y="410" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_03o12kw_di" bpmnElement="Activity_1o0a55b">
+        <dc:Bounds x="1410" y="410" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1hkx6j5_di" bpmnElement="Activity_068a0cy">
+        <dc:Bounds x="240" y="650" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_18xtkyi_di" bpmnElement="Event_1azfo77">
+        <dc:Bounds x="162" y="922" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="156" y="965" width="48" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1wvru6z_di" bpmnElement="Activity_02vl5kt">
+        <dc:Bounds x="480" y="650" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1kszh5k_di" bpmnElement="Activity_1kszh5k">
+        <dc:Bounds x="640" y="650" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_09jt4b0_di" bpmnElement="Activity_09jt4b0">
+        <dc:Bounds x="800" y="650" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1su25xm_di" bpmnElement="Activity_1su25xm">
+        <dc:Bounds x="970" y="650" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Gateway_114io6q_di" bpmnElement="Gateway_114io6q" isMarkerVisible="true">
+        <dc:Bounds x="1115" y="665" width="50" height="50" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1098" y="641" width="84" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_08ecfyj_di" bpmnElement="Event_08ecfyj">
+        <dc:Bounds x="1122" y="762" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1098" y="805" width="85" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0ftm8b6_di" bpmnElement="Activity_0ftm8b6">
+        <dc:Bounds x="1410" y="650" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1xnstqr_di" bpmnElement="Activity_1xnstqr">
+        <dc:Bounds x="1580" y="650" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_15f8u0i_di" bpmnElement="Activity_1xirwg3">
+        <dc:Bounds x="1220" y="410" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0xmezab_di" bpmnElement="Activity_0xmezab">
+        <dc:Bounds x="1230" y="650" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_17abdcy_di" bpmnElement="Activity_1j0xkqc">
+        <dc:Bounds x="250" y="900" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0huy5ph_di" bpmnElement="Activity_0huy5ph">
+        <dc:Bounds x="390" y="900" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1tbardv_di" bpmnElement="Activity_1tbardv">
+        <dc:Bounds x="560" y="900" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_0kp0sqc_di" bpmnElement="Event_0ocuo1o">
+        <dc:Bounds x="752" y="82" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="735" y="125" width="71" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+    </bpmndi:BPMNPlane>
+  </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoActivateCoreNSSI.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoActivateCoreNSSI.bpmn
new file mode 100644 (file)
index 0000000..b422545
--- /dev/null
@@ -0,0 +1,420 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1r4k2c2" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.0.0">
+  <bpmn:process id="DoActivateCoreNSSI" name="DoActivateCoreNSSI" isExecutable="true">
+    <bpmn:startEvent id="StartEvent_0lgslwq" name="Start">
+      <bpmn:outgoing>SequenceFlow_0wwo1lh</bpmn:outgoing>
+    </bpmn:startEvent>
+    <bpmn:scriptTask id="ScriptTask_1x13jc1" name="Pre-process  request&#10;Check operationType" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_0wwo1lh</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_139ejmn</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def activateNssi = new DoActivateCoreNSSI()
+activateNssi.preProcessRequest(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="ScriptTask_0usuysi" name="Call AAI&#10;get VNF/VFs and model info" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_1654pt0</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_09nihof</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def activateNssi = new DoActivateCoreNSSI()
+activateNssi.getServiceVNFAndVFsFromCatalogDB(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="ScriptTask_1t06mlw" name="Prepare request payload for SO macro service api" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_09nihof</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0fbr356</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def activateNssi = new DoActivateCoreNSSI()
+activateNssi.prepareSOMacroRequestPayLoad(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="ScriptTask_0lxbaxd" name="Call AAI &#10;update sliceProlie service Instance status" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_1e20i9g</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0j0egoi</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def activateNssi = new DoActivateCoreNSSI()
+activateNssi.updateSliceProfileOrchestrationStatus(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="ScriptTask_1rjha8r" name="get NSSI instance with relationships and sliceProfile instance" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_139ejmn</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1654pt0</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def activateNssi = new DoActivateCoreNSSI()
+activateNssi.getNetworkInstanceWithSPInstanceAssociatedWithNssiId(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="ScriptTask_1tfpgcs" name="PUT SO Macro" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_1mi4waj</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0rjd7tg</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def activateNssi = new DoActivateCoreNSSI()
+activateNssi.sendPutRequestToSOMacro(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="ScriptTask_1frasll" name="Prepare Call CheckServiceProcessStatus" scriptFormat="groovy">
+      <bpmn:incoming>Flow_039sx2v</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_18x9gdi</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def activateNssi = new DoActivateCoreNSSI()
+activateNssi.prepareCallCheckProcessStatus(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:callActivity id="CallActivity_11hntoj" name="CallCheckServiceProcessStatus" calledElement="CheckServiceProcessStatus">
+      <bpmn:extensionElements>
+        <camunda:in source="networkServiceInstanceId" target="serviceInstanceId" />
+        <camunda:in source="macroOperationId" target="operationId" />
+        <camunda:in source="successConditions" target="successConditions" />
+        <camunda:in source="errorConditions" target="errorConditions" />
+        <camunda:in source="processServiceType" target="processServiceType" />
+        <camunda:in source="timeOut" target="timeOut" />
+        <camunda:out source="operationStatus" target="result" />
+        <camunda:out source="operationContent" target="reason" />
+        <camunda:out source="WorkflowException" target="WorkflowException" />
+        <camunda:out source="isTimeOut" target="isTimeOut" />
+        <camunda:in source="subOperationType" target="operationType" />
+        <camunda:in source="initProgress" target="initProgress" />
+        <camunda:in source="endProgress" target="endProgress" />
+        <camunda:in source="serviceInstanceID" target="parentServiceInstanceId" />
+        <camunda:in source="globalSubscriberId" target="globalSubscriberId" />
+        <camunda:in source="operationId" target="parentOperationId" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>SequenceFlow_18x9gdi</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1l9ry0a</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:scriptTask id="ScriptTask_1sfn88d" name="Prepare update Service operation status " scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_1l9ry0a</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0wx21io</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def activateNssi = new DoActivateCoreNSSI()
+activateNssi.prepareUpdateResourceOperationStatus(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="SequenceFlow_0wwo1lh" sourceRef="StartEvent_0lgslwq" targetRef="ScriptTask_1x13jc1" />
+    <bpmn:sequenceFlow id="SequenceFlow_139ejmn" sourceRef="ScriptTask_1x13jc1" targetRef="ScriptTask_1rjha8r" />
+    <bpmn:sequenceFlow id="SequenceFlow_1654pt0" sourceRef="ScriptTask_1rjha8r" targetRef="ScriptTask_0usuysi" />
+    <bpmn:sequenceFlow id="SequenceFlow_09nihof" sourceRef="ScriptTask_0usuysi" targetRef="ScriptTask_1t06mlw" />
+    <bpmn:sequenceFlow id="SequenceFlow_1l9ry0a" sourceRef="CallActivity_11hntoj" targetRef="ScriptTask_1sfn88d" />
+    <bpmn:sequenceFlow id="SequenceFlow_0fbr356" sourceRef="ScriptTask_1t06mlw" targetRef="IntermediateThrowEvent_0gueutz" />
+    <bpmn:intermediateThrowEvent id="IntermediateThrowEvent_0gueutz" name="Call SO macro api">
+      <bpmn:incoming>SequenceFlow_0fbr356</bpmn:incoming>
+      <bpmn:linkEventDefinition name="CallSO" />
+    </bpmn:intermediateThrowEvent>
+    <bpmn:sequenceFlow id="SequenceFlow_1mi4waj" sourceRef="IntermediateThrowEvent_150o0dl" targetRef="ScriptTask_1tfpgcs" />
+    <bpmn:intermediateCatchEvent id="IntermediateThrowEvent_150o0dl" name="Call SO macro api">
+      <bpmn:outgoing>SequenceFlow_1mi4waj</bpmn:outgoing>
+      <bpmn:linkEventDefinition name="CallSO" />
+    </bpmn:intermediateCatchEvent>
+    <bpmn:sequenceFlow id="SequenceFlow_0rjd7tg" sourceRef="ScriptTask_1tfpgcs" targetRef="Gateway_03lo8jx" />
+    <bpmn:exclusiveGateway id="ExclusiveGateway_02nqn2k" name="is TimeOut?" default="SequenceFlow_07u1gfw">
+      <bpmn:incoming>SequenceFlow_0wx21io</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1e20i9g</bpmn:outgoing>
+      <bpmn:outgoing>SequenceFlow_07u1gfw</bpmn:outgoing>
+    </bpmn:exclusiveGateway>
+    <bpmn:sequenceFlow id="SequenceFlow_0wx21io" sourceRef="ScriptTask_1sfn88d" targetRef="ExclusiveGateway_02nqn2k" />
+    <bpmn:sequenceFlow id="SequenceFlow_1e20i9g" name="No" sourceRef="ExclusiveGateway_02nqn2k" targetRef="ScriptTask_0lxbaxd">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isTimeOut") == "NO")}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:endEvent id="EndEvent_1061mty" name="End">
+      <bpmn:incoming>SequenceFlow_0v0dntm</bpmn:incoming>
+    </bpmn:endEvent>
+    <bpmn:sequenceFlow id="SequenceFlow_18x9gdi" sourceRef="ScriptTask_1frasll" targetRef="CallActivity_11hntoj" />
+    <bpmn:exclusiveGateway id="Gateway_03lo8jx" name="is SO Response OK?" default="Flow_1jchhgj">
+      <bpmn:incoming>SequenceFlow_0rjd7tg</bpmn:incoming>
+      <bpmn:outgoing>Flow_039sx2v</bpmn:outgoing>
+      <bpmn:outgoing>Flow_1jchhgj</bpmn:outgoing>
+    </bpmn:exclusiveGateway>
+    <bpmn:sequenceFlow id="Flow_039sx2v" name="Yes" sourceRef="Gateway_03lo8jx" targetRef="ScriptTask_1frasll">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isSOResponseSucceed" )  == "yes")}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:serviceTask id="ServiceTask_02x7eqy" name="Update Service 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">${updateOperationStatus}</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_1jchhgj</bpmn:incoming>
+      <bpmn:incoming>SequenceFlow_0j0egoi</bpmn:incoming>
+      <bpmn:incoming>SequenceFlow_07u1gfw</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0v0dntm</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:sequenceFlow id="SequenceFlow_0v0dntm" sourceRef="ServiceTask_02x7eqy" targetRef="EndEvent_1061mty" />
+    <bpmn:sequenceFlow id="Flow_1jchhgj" name="No" sourceRef="Gateway_03lo8jx" targetRef="ServiceTask_02x7eqy" />
+    <bpmn:sequenceFlow id="SequenceFlow_0j0egoi" sourceRef="ScriptTask_0lxbaxd" targetRef="ServiceTask_02x7eqy" />
+    <bpmn:sequenceFlow id="SequenceFlow_07u1gfw" name="Yes" sourceRef="ExclusiveGateway_02nqn2k" targetRef="ServiceTask_02x7eqy" />
+    <bpmn:subProcess id="Activity_1tmdw60" name="Sub-process for FalloutHandler and Rollback" triggeredByEvent="true">
+      <bpmn:startEvent id="Event_159txw2">
+        <bpmn:outgoing>Flow_149oqyp</bpmn:outgoing>
+        <bpmn:errorEventDefinition id="ErrorEventDefinition_15ur8z3" />
+      </bpmn:startEvent>
+      <bpmn:endEvent id="Event_0c1ec2y">
+        <bpmn:incoming>Flow_1qooaff</bpmn:incoming>
+      </bpmn:endEvent>
+      <bpmn:scriptTask id="Activity_0u3yna7" name="Handle Unexpected Error" scriptFormat="groovy">
+        <bpmn:incoming>Flow_1iqw69c</bpmn:incoming>
+        <bpmn:outgoing>Flow_1qooaff</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_0u4a0ry" name="Prepare Resource Operation Status Update" scriptFormat="groovy">
+        <bpmn:incoming>Flow_149oqyp</bpmn:incoming>
+        <bpmn:outgoing>Flow_1dh5sht</bpmn:outgoing>
+        <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def activateNssi = new DoActivateCoreNSSI()
+activateNssi.prepareFailedOperationStatusUpdate(execution)</bpmn:script>
+      </bpmn:scriptTask>
+      <bpmn:serviceTask id="Activity_11422x1" 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_1dh5sht</bpmn:incoming>
+        <bpmn:outgoing>Flow_1iqw69c</bpmn:outgoing>
+      </bpmn:serviceTask>
+      <bpmn:sequenceFlow id="Flow_1iqw69c" sourceRef="Activity_11422x1" targetRef="Activity_0u3yna7" />
+      <bpmn:sequenceFlow id="Flow_1dh5sht" sourceRef="Activity_0u4a0ry" targetRef="Activity_11422x1" />
+      <bpmn:sequenceFlow id="Flow_149oqyp" sourceRef="Event_159txw2" targetRef="Activity_0u4a0ry" />
+      <bpmn:sequenceFlow id="Flow_1qooaff" sourceRef="Activity_0u3yna7" targetRef="Event_0c1ec2y" />
+    </bpmn:subProcess>
+  </bpmn:process>
+  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoActivateCoreNSSI">
+      <bpmndi:BPMNEdge id="SequenceFlow_07u1gfw_di" bpmnElement="SequenceFlow_07u1gfw">
+        <di:waypoint x="976" y="319" />
+        <di:waypoint x="1123" y="319" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1041" y="301" width="18" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0j0egoi_di" bpmnElement="SequenceFlow_0j0egoi">
+        <di:waypoint x="1099" y="258" />
+        <di:waypoint x="1173" y="258" />
+        <di:waypoint x="1173" y="279" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="376" y="387" width="0" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1jchhgj_di" bpmnElement="Flow_1jchhgj">
+        <di:waypoint x="400" y="344" />
+        <di:waypoint x="400" y="450" />
+        <di:waypoint x="1190" y="450" />
+        <di:waypoint x="1190" y="360" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="788" y="432" width="15" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0v0dntm_di" bpmnElement="SequenceFlow_0v0dntm">
+        <di:waypoint x="1223" y="319" />
+        <di:waypoint x="1263" y="319" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="483" y="448" width="0" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_039sx2v_di" bpmnElement="Flow_039sx2v">
+        <di:waypoint x="425" y="319" />
+        <di:waypoint x="470" y="319" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="439" y="301" width="18" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_18x9gdi_di" bpmnElement="SequenceFlow_18x9gdi">
+        <di:waypoint x="570" y="319" />
+        <di:waypoint x="610" y="319" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="-180.5" y="448" width="0" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1e20i9g_di" bpmnElement="SequenceFlow_1e20i9g">
+        <di:waypoint x="951" y="294" />
+        <di:waypoint x="951" y="258" />
+        <di:waypoint x="999" y="258" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="959" y="273" width="15" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0wx21io_di" bpmnElement="SequenceFlow_0wx21io">
+        <di:waypoint x="868" y="319" />
+        <di:waypoint x="926" y="319" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="137" y="448" width="0" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0rjd7tg_di" bpmnElement="SequenceFlow_0rjd7tg">
+        <di:waypoint x="330" y="319" />
+        <di:waypoint x="375" y="319" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="-336" y="448" width="0" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1mi4waj_di" bpmnElement="SequenceFlow_1mi4waj">
+        <di:waypoint x="178" y="319" />
+        <di:waypoint x="230" y="319" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="-489.5" y="448" width="0" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0fbr356_di" bpmnElement="SequenceFlow_0fbr356">
+        <di:waypoint x="1020" y="120" />
+        <di:waypoint x="1132" y="120" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="384" y="249" width="0" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1l9ry0a_di" bpmnElement="SequenceFlow_1l9ry0a">
+        <di:waypoint x="710" y="319" />
+        <di:waypoint x="768" y="319" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="-21" y="448" width="0" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_09nihof_di" bpmnElement="SequenceFlow_09nihof">
+        <di:waypoint x="820" y="120" />
+        <di:waypoint x="920" y="120" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="-460" y="189" width="0" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1654pt0_di" bpmnElement="SequenceFlow_1654pt0">
+        <di:waypoint x="610" y="120" />
+        <di:waypoint x="720" y="120" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="-910" y="189" width="0" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_139ejmn_di" bpmnElement="SequenceFlow_139ejmn">
+        <di:waypoint x="430" y="120" />
+        <di:waypoint x="510" y="120" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="-381" y="245" width="0" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0wwo1lh_di" bpmnElement="SequenceFlow_0wwo1lh">
+        <di:waypoint x="242" y="120" />
+        <di:waypoint x="330" y="120" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="-489.5" y="249" width="0" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="StartEvent_0lgslwq_di" bpmnElement="StartEvent_0lgslwq">
+        <dc:Bounds x="206" y="102" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="211" y="142" width="25" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_1x13jc1_di" bpmnElement="ScriptTask_1x13jc1">
+        <dc:Bounds x="330" y="80" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_0usuysi_di" bpmnElement="ScriptTask_0usuysi">
+        <dc:Bounds x="720" y="80" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_1t06mlw_di" bpmnElement="ScriptTask_1t06mlw">
+        <dc:Bounds x="920" y="80" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_0lxbaxd_di" bpmnElement="ScriptTask_0lxbaxd">
+        <dc:Bounds x="999" y="218" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_1rjha8r_di" bpmnElement="ScriptTask_1rjha8r">
+        <dc:Bounds x="510" y="80" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_1tfpgcs_di" bpmnElement="ScriptTask_1tfpgcs">
+        <dc:Bounds x="230" y="279" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_1frasll_di" bpmnElement="ScriptTask_1frasll">
+        <dc:Bounds x="470" y="279" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="CallActivity_11hntoj_di" bpmnElement="CallActivity_11hntoj">
+        <dc:Bounds x="610" y="279" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_1sfn88d_di" bpmnElement="ScriptTask_1sfn88d">
+        <dc:Bounds x="768" y="279" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="IntermediateThrowEvent_1808y0j_di" bpmnElement="IntermediateThrowEvent_0gueutz">
+        <dc:Bounds x="1132" y="102" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1106" y="142" width="90" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="IntermediateCatchEvent_11m7660_di" bpmnElement="IntermediateThrowEvent_150o0dl">
+        <dc:Bounds x="142" y="301" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="115" y="341" width="90" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ExclusiveGateway_02nqn2k_di" bpmnElement="ExclusiveGateway_02nqn2k" isMarkerVisible="true">
+        <dc:Bounds x="926" y="294" width="50" height="50" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="922" y="354" width="59" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="EndEvent_1061mty_di" bpmnElement="EndEvent_1061mty">
+        <dc:Bounds x="1263" y="301" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1271" y="344" width="20" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Gateway_03lo8jx_di" bpmnElement="Gateway_03lo8jx" isMarkerVisible="true">
+        <dc:Bounds x="375" y="294" width="50" height="50" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="360" y="264" width="80" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ServiceTask_02x7eqy_di" bpmnElement="ServiceTask_02x7eqy">
+        <dc:Bounds x="1123" y="279" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1tmdw60_di" bpmnElement="Activity_1tmdw60" isExpanded="true">
+        <dc:Bounds x="400" y="560" width="781" height="196" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="Flow_1qooaff_di" bpmnElement="Flow_1qooaff">
+        <di:waypoint x="960" y="664" />
+        <di:waypoint x="1068" y="664" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_149oqyp_di" bpmnElement="Flow_149oqyp">
+        <di:waypoint x="466" y="664" />
+        <di:waypoint x="530" y="664" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1dh5sht_di" bpmnElement="Flow_1dh5sht">
+        <di:waypoint x="630" y="664" />
+        <di:waypoint x="690" y="664" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1iqw69c_di" bpmnElement="Flow_1iqw69c">
+        <di:waypoint x="790" y="664" />
+        <di:waypoint x="860" y="664" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="Event_159txw2_di" bpmnElement="Event_159txw2">
+        <dc:Bounds x="430" y="646" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_0c1ec2y_di" bpmnElement="Event_0c1ec2y">
+        <dc:Bounds x="1068" y="646" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0u3yna7_di" bpmnElement="Activity_0u3yna7">
+        <dc:Bounds x="860" y="624" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0u4a0ry_di" bpmnElement="Activity_0u4a0ry">
+        <dc:Bounds x="530" y="624" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_11422x1_di" bpmnElement="Activity_11422x1">
+        <dc:Bounds x="690" y="624" width="100" height="80" />
+      </bpmndi:BPMNShape>
+    </bpmndi:BPMNPlane>
+  </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoActivateTransportNSSI.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoActivateTransportNSSI.bpmn
new file mode 100644 (file)
index 0000000..8ecce46
--- /dev/null
@@ -0,0 +1,207 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_1wio50w" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.1.1">
+  <bpmn:process id="DoActivateTransportNSSI" name="DoActivateTransportNSSI" isExecutable="true">
+    <bpmn:startEvent id="StartEvent_1nbljfd" name="Create Activate/Deactivate TN NSSMF Work Flow">
+      <bpmn:outgoing>SequenceFlow_03s744c</bpmn:outgoing>
+    </bpmn:startEvent>
+    <bpmn:subProcess id="SubProcess_1yv9i68" name="Sub-process for FalloutHandler and Rollback" triggeredByEvent="true">
+      <bpmn:startEvent id="StartEvent_1omdx56">
+        <bpmn:outgoing>SequenceFlow_1w67v6s</bpmn:outgoing>
+        <bpmn:errorEventDefinition id="ErrorEventDefinition_06xcioh" />
+      </bpmn:startEvent>
+      <bpmn:endEvent id="EndEvent_1jx3026">
+        <bpmn:incoming>SequenceFlow_08mlzwz</bpmn:incoming>
+      </bpmn:endEvent>
+      <bpmn:scriptTask id="ScriptTask_1swzdpw" name="Handle Unexpected Error" scriptFormat="groovy">
+        <bpmn:incoming>SequenceFlow_1w67v6s</bpmn:incoming>
+        <bpmn:outgoing>SequenceFlow_08mlzwz</bpmn:outgoing>
+        <bpmn:script>import org.onap.so.bpmn.common.scripts.*
+ExceptionUtil ex = new ExceptionUtil()
+ex.processJavaException(execution)</bpmn:script>
+      </bpmn:scriptTask>
+      <bpmn:sequenceFlow id="SequenceFlow_1w67v6s" sourceRef="StartEvent_1omdx56" targetRef="ScriptTask_1swzdpw" />
+      <bpmn:sequenceFlow id="SequenceFlow_08mlzwz" sourceRef="ScriptTask_1swzdpw" targetRef="EndEvent_1jx3026" />
+    </bpmn:subProcess>
+    <bpmn:endEvent id="EndEvent_05h01gx" name="End">
+      <bpmn:incoming>Flow_1032bi1</bpmn:incoming>
+    </bpmn:endEvent>
+    <bpmn:scriptTask id="ScriptTask_1ssh2l9" name="Prepare Update Resource Oper Status((finish)" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_0kixzdj</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1qv8qw1</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def runScript = new DoActivateTnNssi()
+runScript.prepareUpdateJobStatus(execution,"finished","100","Activate or Deactivate successfully")</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="SequenceFlow_03s744c" sourceRef="StartEvent_1nbljfd" targetRef="ScriptTask_1tc44ge" />
+    <bpmn:sequenceFlow id="SequenceFlow_1qv8qw1" sourceRef="ScriptTask_1ssh2l9" targetRef="Activity_0nhxd67" />
+    <bpmn:scriptTask id="ScriptTask_19uxoi8" name="Update AAI Status" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_1jdb2oq</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0kixzdj</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def actionType = execution.getVariable("actionType")
+execution.setVariable("orchestrationStatus", actionType)
+def runScript = new DoActivateTnNssi()
+runScript.updateAAIOrchStatus(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="SequenceFlow_0kixzdj" sourceRef="ScriptTask_19uxoi8" targetRef="ScriptTask_1ssh2l9" />
+    <bpmn:scriptTask id="Activity_1tw8eyy" name="PreProcess SDNC Activate or Deactivate TN NSSI Request" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_07e12rt</bpmn:incoming>
+      <bpmn:outgoing>Flow_0cpctye</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def runScript = new DoActivateTnNssi()
+runScript.preprocessSdncActOrDeactTnNssiRequest(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_0cpctye" sourceRef="Activity_1tw8eyy" targetRef="Activity_0p20esb" />
+    <bpmn:callActivity id="Activity_0p20esb" name="Call SDNC Adapter: Activate/Deactivate TN NSSI" calledElement="sdncAdapter">
+      <bpmn:extensionElements>
+        <camunda:in source="TNNSSMF_SDNCRequest" target="sdncAdapterWorkflowRequest" />
+        <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" />
+        <camunda:in source="mso-request-id" target="mso-request-id" />
+        <camunda:in source="mso-service-instance-id" target="mso-service-instance-id" />
+        <camunda:out source="WorkflowException" target="WorkflowException" />
+        <camunda:out source="sdncAdapterResponse" target="TNNSSMF_SDNCAdapterResponse" />
+        <camunda:out source="SDNCA_SuccessIndicator" target="SDNCA_SuccessIndicator" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_0cpctye</bpmn:incoming>
+      <bpmn:outgoing>Flow_0fuabjs</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:sequenceFlow id="Flow_0fuabjs" sourceRef="Activity_0p20esb" targetRef="Activity_0phv8e5" />
+    <bpmn:scriptTask id="Activity_0phv8e5" name="Postprocess SDNC Activate/Deactivate TN NSSI  Request" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0fuabjs</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1jdb2oq</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+
+String response = execution.getVariable("TNNSSMF_SDNCAdapterResponse")
+
+def runScript = new DoActivateTnNssi()
+runScript.validateSDNCResponse(execution, response)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="SequenceFlow_1jdb2oq" sourceRef="Activity_0phv8e5" targetRef="ScriptTask_19uxoi8" />
+    <bpmn:scriptTask id="ScriptTask_1tc44ge" name="PreProcess Incoming Request" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_03s744c</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_07e12rt</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def runScript = new DoActivateTnNssi()
+runScript.preProcessRequest(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="SequenceFlow_07e12rt" sourceRef="ScriptTask_1tc44ge" targetRef="Activity_1tw8eyy" />
+    <bpmn:serviceTask id="Activity_0nhxd67" 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>SequenceFlow_1qv8qw1</bpmn:incoming>
+      <bpmn:outgoing>Flow_1032bi1</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:sequenceFlow id="Flow_1032bi1" sourceRef="Activity_0nhxd67" targetRef="EndEvent_05h01gx" />
+  </bpmn:process>
+  <bpmn:message id="Message_0c4b2r5" name="SliceServiceTask" />
+  <bpmn:error id="Error_03akl5v" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
+  <bpmn:error id="Error_0p2naox" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
+  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoActivateTransportNSSI">
+      <bpmndi:BPMNEdge id="SequenceFlow_07e12rt_di" bpmnElement="SequenceFlow_07e12rt">
+        <di:waypoint x="385" y="121" />
+        <di:waypoint x="509" y="121" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1jdb2oq_di" bpmnElement="SequenceFlow_1jdb2oq">
+        <di:waypoint x="1080" y="121" />
+        <di:waypoint x="1220" y="121" />
+        <di:waypoint x="1220" y="210" />
+        <di:waypoint x="335" y="210" />
+        <di:waypoint x="335" y="310" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0fuabjs_di" bpmnElement="Flow_0fuabjs">
+        <di:waypoint x="850" y="121" />
+        <di:waypoint x="959" y="121" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0cpctye_di" bpmnElement="Flow_0cpctye">
+        <di:waypoint x="630" y="121" />
+        <di:waypoint x="729" y="121" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0kixzdj_di" bpmnElement="SequenceFlow_0kixzdj">
+        <di:waypoint x="385" y="350" />
+        <di:waypoint x="530" y="350" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1qv8qw1_di" bpmnElement="SequenceFlow_1qv8qw1">
+        <di:waypoint x="630" y="350" />
+        <di:waypoint x="740" y="350" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_03s744c_di" bpmnElement="SequenceFlow_03s744c">
+        <di:waypoint x="214" y="121" />
+        <di:waypoint x="285" y="121" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1032bi1_di" bpmnElement="Flow_1032bi1">
+        <di:waypoint x="840" y="350" />
+        <di:waypoint x="1002" y="350" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="StartEvent_1nbljfd_di" bpmnElement="StartEvent_1nbljfd">
+        <dc:Bounds x="178" y="103" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="163" y="146" width="81" height="53" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0nhxd67_di" bpmnElement="Activity_0nhxd67">
+        <dc:Bounds x="740" y="310" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="SubProcess_1yv9i68_di" bpmnElement="SubProcess_1yv9i68" isExpanded="true">
+        <dc:Bounds x="685" y="1080" width="781" height="196" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_08mlzwz_di" bpmnElement="SequenceFlow_08mlzwz">
+        <di:waypoint x="1079" y="1184" />
+        <di:waypoint x="1353" y="1184" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1w67v6s_di" bpmnElement="SequenceFlow_1w67v6s">
+        <di:waypoint x="751" y="1184" />
+        <di:waypoint x="979" y="1184" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="StartEvent_1omdx56_di" bpmnElement="StartEvent_1omdx56">
+        <dc:Bounds x="715" y="1166" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="EndEvent_1jx3026_di" bpmnElement="EndEvent_1jx3026">
+        <dc:Bounds x="1353" y="1166" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_1swzdpw_di" bpmnElement="ScriptTask_1swzdpw">
+        <dc:Bounds x="979" y="1144" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="EndEvent_05h01gx_di" bpmnElement="EndEvent_05h01gx">
+        <dc:Bounds x="1002" y="332" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1010" y="375" width="20" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_1ssh2l9_di" bpmnElement="ScriptTask_1ssh2l9">
+        <dc:Bounds x="530" y="310" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_19uxoi8_di" bpmnElement="ScriptTask_19uxoi8">
+        <dc:Bounds x="285" y="310" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1tw8eyy_di" bpmnElement="Activity_1tw8eyy">
+        <dc:Bounds x="509" y="74" width="121" height="94" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0p20esb_di" bpmnElement="Activity_0p20esb">
+        <dc:Bounds x="729" y="74" width="121" height="94" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0phv8e5_di" bpmnElement="Activity_0phv8e5">
+        <dc:Bounds x="959" y="74" width="121" height="94" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_1tc44ge_di" bpmnElement="ScriptTask_1tc44ge">
+        <dc:Bounds x="285" y="81" width="100" height="80" />
+      </bpmndi:BPMNShape>
+    </bpmndi:BPMNPlane>
+  </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateAccessNSSI.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateAccessNSSI.bpmn
new file mode 100644 (file)
index 0000000..9c12200
--- /dev/null
@@ -0,0 +1,960 @@
+<?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:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_05od9yd" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.7.1">
+  <bpmn:process id="DoAllocateAccessNSSI" name="DoAllocateAccessNSSI" isExecutable="true">
+    <bpmn:startEvent id="StartEvent_1" name="Start">
+      <bpmn:outgoing>Flow_163f3sq</bpmn:outgoing>
+    </bpmn:startEvent>
+    <bpmn:scriptTask id="Activity_1jj3kh9" name="Preprocess Request" scriptFormat="groovy">
+      <bpmn:incoming>Flow_163f3sq</bpmn:incoming>
+      <bpmn:outgoing>Flow_0tica8m</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoAllocateAccessNSSI()
+nss.preProcessRequest(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_0vhvubq" name="Get Subnet capabilities" scriptFormat="groovy">
+      <bpmn:incoming>Flow_00f37fu</bpmn:incoming>
+      <bpmn:outgoing>Flow_1w8whur</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoAllocateAccessNSSI()
+nss.getSubnetCapabilities(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_11vdo22" name="Prepare Resource Operation Status Update" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0833cha</bpmn:incoming>
+      <bpmn:outgoing>Flow_1xw4abx</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoAllocateAccessNSSI()
+nss.prepareOperationStatusUpdate(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:serviceTask id="Activity_1nfx154" 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_1xw4abx</bpmn:incoming>
+      <bpmn:outgoing>Flow_0ll5x3u</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:endEvent id="Event_0vh1hs2">
+      <bpmn:incoming>Flow_0ll5x3u</bpmn:incoming>
+    </bpmn:endEvent>
+    <bpmn:sequenceFlow id="Flow_0833cha" sourceRef="Event_05jtdqp" targetRef="Activity_11vdo22" />
+    <bpmn:sequenceFlow id="Flow_1xw4abx" sourceRef="Activity_11vdo22" targetRef="Activity_1nfx154" />
+    <bpmn:sequenceFlow id="Flow_0ll5x3u" sourceRef="Activity_1nfx154" targetRef="Event_0vh1hs2" />
+    <bpmn:sequenceFlow id="Flow_1x3y2tg" sourceRef="Event_18r5xkz" targetRef="Activity_03dgcg5" />
+    <bpmn:scriptTask id="Activity_19laorl" name="prepare OOF request for RAN NF NSSI selection" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0rb4j9r</bpmn:incoming>
+      <bpmn:outgoing>Flow_0d0f3ie</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoAllocateAccessNSSI()
+nss.prepareOofRequestForRanNfNSS(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_03dgcg5" name="send allocate FH NSSI request" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1x3y2tg</bpmn:incoming>
+      <bpmn:outgoing>Flow_0qhjtre</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoAllocateAccessNSSI()
+nss.prepareTnFhRequest(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_18y4ijb" name="send allocate MH NSSI request" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0zhr499</bpmn:incoming>
+      <bpmn:outgoing>Flow_04thflx</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoAllocateAccessNSSI()
+nss.prepareTnMhRequest(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:intermediateCatchEvent id="Event_05jtdqp" name="Start operation status update">
+      <bpmn:outgoing>Flow_0833cha</bpmn:outgoing>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_05sogjc" name="OperationStatusUpdate" />
+    </bpmn:intermediateCatchEvent>
+    <bpmn:intermediateThrowEvent id="Event_0u9308h" name="Go to start   operation status update">
+      <bpmn:incoming>Flow_0kcvava</bpmn:incoming>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_1o9trjv" name="OperationStatusUpdate" />
+    </bpmn:intermediateThrowEvent>
+    <bpmn:intermediateCatchEvent id="Event_18r5xkz" name="start TN allocate">
+      <bpmn:outgoing>Flow_1x3y2tg</bpmn:outgoing>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_15hz0uh" name="startTnAllocate" />
+    </bpmn:intermediateCatchEvent>
+    <bpmn:sequenceFlow id="Flow_0zhr499" sourceRef="Activity_0qn2fvh" targetRef="Activity_18y4ijb" />
+    <bpmn:scriptTask id="Activity_0qn2fvh" name="process Job status response" scriptFormat="groovy">
+      <bpmn:incoming>Flow_16z59pu</bpmn:incoming>
+      <bpmn:outgoing>Flow_0zhr499</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoAllocateAccessNSSI()
+nss.processFhAllocateNssiJobStatusRsp(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_12szahe" name="Process OOF response" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1b14415</bpmn:incoming>
+      <bpmn:outgoing>Flow_1h7iq8l</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoAllocateAccessNSSI()
+nss.processOofResponseForRanNSS(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_0vwhzem" name="prepare OOF request for RAN NSSI selection" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1w8whur</bpmn:incoming>
+      <bpmn:outgoing>Flow_0tkzfhb</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoAllocateAccessNSSI()
+nss.prepareOofRequestForRanNSS(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_163f3sq" sourceRef="StartEvent_1" targetRef="Activity_1jj3kh9" />
+    <bpmn:exclusiveGateway id="Gateway_1aesepd" name="Is Response NSSI?" default="Flow_0k39zt8">
+      <bpmn:incoming>Flow_09tjspa</bpmn:incoming>
+      <bpmn:outgoing>Flow_1ipsxgh</bpmn:outgoing>
+      <bpmn:outgoing>Flow_0k39zt8</bpmn:outgoing>
+    </bpmn:exclusiveGateway>
+    <bpmn:intermediateThrowEvent id="Event_142r2sx" name="Go to start   operation status update">
+      <bpmn:incoming>Flow_0k8yakp</bpmn:incoming>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_08wuatj" name="OperationStatusUpdate" />
+    </bpmn:intermediateThrowEvent>
+    <bpmn:intermediateThrowEvent id="Event_15zn4zi" name="Goto start TN allocate">
+      <bpmn:incoming>Flow_1exjm0h</bpmn:incoming>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_13crcza" name="startTnAllocate" />
+    </bpmn:intermediateThrowEvent>
+    <bpmn:scriptTask id="Activity_1pxd5wf" name="Process OOF response" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1nkqrpd</bpmn:incoming>
+      <bpmn:outgoing>Flow_1f9rw3m</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoAllocateAccessNSSI()
+nss.processOofResponseForRanNfNSS(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:exclusiveGateway id="Gateway_0en9ki5" name="Is Response NSSI?" default="Flow_178fenq">
+      <bpmn:incoming>Flow_1ryi6ym</bpmn:incoming>
+      <bpmn:outgoing>Flow_178fenq</bpmn:outgoing>
+      <bpmn:outgoing>Flow_0kn30g3</bpmn:outgoing>
+    </bpmn:exclusiveGateway>
+    <bpmn:scriptTask id="Activity_0a95zgv" name="prepare SDNR request" scriptFormat="groovy">
+      <bpmn:incoming>Flow_178fenq</bpmn:incoming>
+      <bpmn:outgoing>Flow_1pbiznt</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoAllocateAccessNSSI()
+nss.createSdnrRequest(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_118je0o" name="process SDNR response" scriptFormat="groovy">
+      <bpmn:incoming>Flow_05yqmnj</bpmn:incoming>
+      <bpmn:outgoing>Flow_0ikdlkf</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoAllocateAccessNSSI()
+nss.processSdnrResponse(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_1ipsxgh" name="yes" sourceRef="Gateway_1aesepd" targetRef="Activity_0xawnmh">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isRspRanNssi" )  == true)}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:sequenceFlow id="Flow_178fenq" name="No" sourceRef="Gateway_0en9ki5" targetRef="Activity_0a95zgv" />
+    <bpmn:sequenceFlow id="Flow_1w8whur" sourceRef="Activity_0vhvubq" targetRef="Activity_0vwhzem" />
+    <bpmn:sequenceFlow id="Flow_0tkzfhb" sourceRef="Activity_0vwhzem" targetRef="Activity_1u28lyv" />
+    <bpmn:sequenceFlow id="Flow_1h7iq8l" sourceRef="Activity_12szahe" targetRef="Event_0s8t1ji" />
+    <bpmn:intermediateThrowEvent id="Event_0s8t1ji" name="Go to start NSSI allocate">
+      <bpmn:incoming>Flow_1h7iq8l</bpmn:incoming>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_0yzxmpv" name="NSSIAllocate" />
+    </bpmn:intermediateThrowEvent>
+    <bpmn:intermediateCatchEvent id="Event_1glt41l" name="start NSSI allocate">
+      <bpmn:outgoing>Flow_09tjspa</bpmn:outgoing>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_05u2hpg" name="NSSIAllocate" />
+    </bpmn:intermediateCatchEvent>
+    <bpmn:sequenceFlow id="Flow_09tjspa" sourceRef="Event_1glt41l" targetRef="Gateway_1aesepd" />
+    <bpmn:sequenceFlow id="Flow_0k39zt8" name="No" sourceRef="Gateway_1aesepd" targetRef="Activity_0fdm3in" />
+    <bpmn:scriptTask id="Activity_0p02joo" name="Prepare&#10;Decompose&#10;Service&#10;" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0tica8m</bpmn:incoming>
+      <bpmn:outgoing>Flow_0mcd9bo</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoAllocateAccessNSSI()
+nss.prepareDecomposeService(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_0tica8m" sourceRef="Activity_1jj3kh9" targetRef="Activity_0p02joo" />
+    <bpmn:callActivity id="Activity_1u28lyv" name="Call DoCreateSubnetOption" calledElement="DoHandleOofRequest">
+      <bpmn:extensionElements>
+        <camunda:in source="nssiSelection_Url" target="apiPath" />
+        <camunda:in source="nssiSelection_correlator" target="correlator" />
+        <camunda:in source="nssiSelection_messageType" target="messageType" />
+        <camunda:in source="nssiSelection_timeout" target="timeout" />
+        <camunda:in source="nssiSelection_oofRequest" target="oofRequest" />
+        <camunda:out source="WorkflowException" target="WorkflowException" />
+        <camunda:out source="asyncCallbackResponse" target="nssiSelection_asyncCallbackResponse" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_0tkzfhb</bpmn:incoming>
+      <bpmn:outgoing>Flow_1b14415</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:sequenceFlow id="Flow_1b14415" sourceRef="Activity_1u28lyv" targetRef="Activity_12szahe" />
+    <bpmn:callActivity id="Activity_1ux83hz" name="Query Job status" calledElement="QueryJobStatus ">
+      <bpmn:extensionElements>
+        <camunda:in source="esrInfo" target="esrInfo" />
+        <camunda:in source="serviceInfo" target="serviceInfo" />
+        <camunda:in source="TNFH_jobId" target="jobId" />
+        <camunda:out source="jobResponse" target="TNFH_jobResponse" />
+        <camunda:in source="responseId" target="responseId" />
+        <camunda:in source="job_timeout" target="timeout" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_1p48xbl</bpmn:incoming>
+      <bpmn:outgoing>Flow_16z59pu</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:sequenceFlow id="Flow_16z59pu" sourceRef="Activity_1ux83hz" targetRef="Activity_0qn2fvh" />
+    <bpmn:callActivity id="Activity_0c0cq9d" name="Query Job status" calledElement="QueryJobStatus ">
+      <bpmn:extensionElements>
+        <camunda:in source="esrInfo" target="esrInfo" />
+        <camunda:in source="serviceInfo" target="serviceInfo" />
+        <camunda:in source="TNMH_jobId" target="jobId" />
+        <camunda:out source="jobResponse" target="TNMH_jobResponse" />
+        <camunda:in source="responseId" target="responseId" />
+        <camunda:in source="job_timeout" target="timeout" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_0fdetmo</bpmn:incoming>
+      <bpmn:outgoing>Flow_1v3wpa2</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:callActivity id="Activity_0y9xgkl" name="Call DoCreateSubnetOption" calledElement="DoHandleOofRequest">
+      <bpmn:extensionElements>
+        <camunda:in source="nssiSelection_Url" target="apiPath" />
+        <camunda:in source="nssiSelection_correlator" target="correlator" />
+        <camunda:in source="nssiSelection_messageType" target="messageType" />
+        <camunda:in source="nssiSelection_timeout" target="timeout" />
+        <camunda:in source="nssiSelection_oofRequest" target="oofRequest" />
+        <camunda:out source="WorkflowException" target="WorkflowException" />
+        <camunda:out source="asyncCallbackResponse" target="nfNssiSelection_asyncCallbackResponse" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_0d0f3ie</bpmn:incoming>
+      <bpmn:outgoing>Flow_1nkqrpd</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:sequenceFlow id="Flow_1nkqrpd" sourceRef="Activity_0y9xgkl" targetRef="Activity_1pxd5wf" />
+    <bpmn:sequenceFlow id="Flow_0kn30g3" name="yes" sourceRef="Gateway_0en9ki5" targetRef="Activity_08i0hzk">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isRspRanNfNssi" )  == true)}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:callActivity id="Activity_0vbzhej" name="call sdnr for RAN NF NSSI creation" calledElement="DoHandleSdnrDmaapRequest">
+      <bpmn:extensionElements>
+        <camunda:in source="createNSSI_sdnrRequest" target="sdnrRequest" />
+        <camunda:out source="asyncCallbackResponse" target="SDNR_asyncCallbackResponse" />
+        <camunda:out source="WorkflowException" target="WorkflowException" />
+        <camunda:in source="createNSSI_correlator" target="correlator" />
+        <camunda:in source="createNSSI_messageType" target="messageType" />
+        <camunda:in source="createNSSI_timeout" target="timeout" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_1pbiznt</bpmn:incoming>
+      <bpmn:outgoing>Flow_05yqmnj</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:sequenceFlow id="Flow_1pbiznt" sourceRef="Activity_0a95zgv" targetRef="Activity_0vbzhej" />
+    <bpmn:sequenceFlow id="Flow_05yqmnj" sourceRef="Activity_0vbzhej" targetRef="Activity_118je0o" />
+    <bpmn:sequenceFlow id="Flow_0qhjtre" sourceRef="Activity_03dgcg5" targetRef="Activity_12vtq69" />
+    <bpmn:sequenceFlow id="Flow_04thflx" sourceRef="Activity_18y4ijb" targetRef="Activity_0qpy2sg" />
+    <bpmn:scriptTask id="Activity_0zn4e4n" name="process Job status response" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1v3wpa2</bpmn:incoming>
+      <bpmn:outgoing>Flow_0bd6dhi</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoAllocateAccessNSSI()
+nss.processMhAllocateNssiJobStatusRsp(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_1v3wpa2" sourceRef="Activity_0c0cq9d" targetRef="Activity_0zn4e4n" />
+    <bpmn:scriptTask id="Activity_1ll0nr1" name="Process Decomposition" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1i10qog</bpmn:incoming>
+      <bpmn:outgoing>Flow_00f37fu</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoAllocateAccessNSSI()
+nss.processDecomposition(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_00f37fu" sourceRef="Activity_1ll0nr1" targetRef="Activity_0vhvubq" />
+    <bpmn:callActivity id="Activity_06hcbu6" name="Call Decompose Service" calledElement="DecomposeService">
+      <bpmn:extensionElements>
+        <camunda:in source="msoRequestId" target="msoRequestId" />
+        <camunda:in source="serviceInstanceId" target="serviceInstanceId" />
+        <camunda:in source="serviceModelInfo" target="serviceModelInfo" />
+        <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" />
+        <camunda:out source="serviceDecomposition" target="ranNsstServiceDecomposition" />
+        <camunda:out source="WorkflowException" target="WorkflowException" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_0mcd9bo</bpmn:incoming>
+      <bpmn:outgoing>Flow_1i10qog</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:sequenceFlow id="Flow_0mcd9bo" sourceRef="Activity_0p02joo" targetRef="Activity_06hcbu6" />
+    <bpmn:sequenceFlow id="Flow_1i10qog" sourceRef="Activity_06hcbu6" targetRef="Activity_1ll0nr1" />
+    <bpmn:scriptTask id="Activity_1aweui4" name="post process RAN NF NSSI modify" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1k3vqxg</bpmn:incoming>
+      <bpmn:outgoing>Flow_0n1mh5c</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoAllocateAccessNSSI()
+nss.processRanNfModifyRsp(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:serviceTask id="Activity_1bjike9" 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">${initResourceOperationStatus}</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_1k0z6lp</bpmn:incoming>
+      <bpmn:outgoing>Flow_10j50jb</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:sequenceFlow id="Flow_1k0z6lp" sourceRef="Activity_0xawnmh" targetRef="Activity_1bjike9" />
+    <bpmn:scriptTask id="Activity_0xawnmh" name="prepare Modify Access NSSI inputs" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1ipsxgh</bpmn:incoming>
+      <bpmn:outgoing>Flow_1k0z6lp</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoAllocateAccessNSSI()
+nss.prepareModifyAccessNssiInputs(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:callActivity id="Activity_0ffp1no" name="Query Job status" calledElement="QueryJobStatus ">
+      <bpmn:extensionElements>
+        <camunda:in source="esrInfo" target="esrInfo" />
+        <camunda:in source="serviceInfo" target="serviceInfo" />
+        <camunda:in source="modifyRanNssiJobId" target="jobId" />
+        <camunda:out source="jobResponse" target="jobResponse" />
+        <camunda:in source="responseId" target="responseId" />
+        <camunda:in source="job_timeout" target="timeout" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_0ile39j</bpmn:incoming>
+      <bpmn:outgoing>Flow_0mmpy7h</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:scriptTask id="Activity_0yfrqtb" name="process Job status response" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0mmpy7h</bpmn:incoming>
+      <bpmn:outgoing>Flow_0k8yakp</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoAllocateAccessNSSI()
+nss.processModifyJobStatusRsp(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_0mmpy7h" sourceRef="Activity_0ffp1no" targetRef="Activity_0yfrqtb" />
+    <bpmn:sequenceFlow id="Flow_0k8yakp" sourceRef="Activity_0yfrqtb" targetRef="Event_142r2sx" />
+    <bpmn:sequenceFlow id="Flow_0ile39j" sourceRef="Activity_1k94obj" targetRef="Activity_0ffp1no" />
+    <bpmn:scriptTask id="Activity_1k94obj" name="prepare query job status" scriptFormat="groovy">
+      <bpmn:incoming>Flow_05s0wso</bpmn:incoming>
+      <bpmn:outgoing>Flow_0ile39j</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoAllocateAccessNSSI()
+nss.createModifyNssiQueryJobStatus(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:callActivity id="Activity_16w4zg9" name="Call ANModifyNSSI" calledElement="DoModifyAccessNSSI">
+      <bpmn:extensionElements>
+        <camunda:in source="msoRequestId" target="msoRequestId" />
+        <camunda:in source="globalSubscriberId" target="globalSubscriberId" />
+        <camunda:in source="RANServiceInstanceId" target="serviceInstanceID" />
+        <camunda:in source="nsiId" target="nsiId" />
+        <camunda:in source="networkType" target="networkType" />
+        <camunda:in source="subscriptionServiceType" target="subscriptionServiceType" />
+        <camunda:in source="modifyRanNssiJobId" target="jobId" />
+        <camunda:in source="modifySliceParams" target="sliceParams" />
+        <camunda:out source="WorkflowException" target="WorkflowException" />
+        <camunda:in source="servicename" target="servicename" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_10j50jb</bpmn:incoming>
+      <bpmn:outgoing>Flow_05s0wso</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:sequenceFlow id="Flow_10j50jb" sourceRef="Activity_1bjike9" targetRef="Activity_16w4zg9" />
+    <bpmn:sequenceFlow id="Flow_05s0wso" sourceRef="Activity_16w4zg9" targetRef="Activity_1k94obj" />
+    <bpmn:scriptTask id="Activity_0fdm3in" name="Prepare&#10;Decompose&#10;Service&#10;" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0k39zt8</bpmn:incoming>
+      <bpmn:incoming>Flow_083bb3k</bpmn:incoming>
+      <bpmn:outgoing>Flow_0reg6l5</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoAllocateAccessNSSI()
+nss.prepareNsstDecomposeService(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:callActivity id="Activity_0a7a04p" name="Call Decompose Service" calledElement="DecomposeService">
+      <bpmn:extensionElements>
+        <camunda:in source="msoRequestId" target="msoRequestId" />
+        <camunda:in source="serviceInstanceId" target="serviceInstanceId" />
+        <camunda:in source="serviceModelInfo" target="serviceModelInfo" />
+        <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" />
+        <camunda:out source="serviceDecomposition" target="nsstServiceDecomposition" />
+        <camunda:out source="WorkflowException" target="WorkflowException" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_0reg6l5</bpmn:incoming>
+      <bpmn:outgoing>Flow_0jdjta3</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:exclusiveGateway id="Gateway_1cmraqs" name="Is all nsst decomposed?" default="Flow_083bb3k">
+      <bpmn:incoming>Flow_0y78v1q</bpmn:incoming>
+      <bpmn:outgoing>Flow_0rb4j9r</bpmn:outgoing>
+      <bpmn:outgoing>Flow_083bb3k</bpmn:outgoing>
+    </bpmn:exclusiveGateway>
+    <bpmn:scriptTask id="Activity_1nmk2rt" name="Process Decomposition" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0jdjta3</bpmn:incoming>
+      <bpmn:outgoing>Flow_0y78v1q</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoAllocateAccessNSSI()
+nss.processNsstDecomposition(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_0reg6l5" sourceRef="Activity_0fdm3in" targetRef="Activity_0a7a04p" />
+    <bpmn:sequenceFlow id="Flow_0jdjta3" sourceRef="Activity_0a7a04p" targetRef="Activity_1nmk2rt" />
+    <bpmn:sequenceFlow id="Flow_0y78v1q" sourceRef="Activity_1nmk2rt" targetRef="Gateway_1cmraqs" />
+    <bpmn:sequenceFlow id="Flow_0rb4j9r" name="yes" sourceRef="Gateway_1cmraqs" targetRef="Activity_19laorl">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isAllNsstsDecomposed" )  == true)}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:sequenceFlow id="Flow_0d0f3ie" sourceRef="Activity_19laorl" targetRef="Activity_0y9xgkl" />
+    <bpmn:scriptTask id="Activity_027ic3j" name="create slice profiles in AAI" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1f9rw3m</bpmn:incoming>
+      <bpmn:outgoing>Flow_1ryi6ym</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoAllocateAccessNSSI()
+nss.createSliceProfilesInAai(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_1f9rw3m" sourceRef="Activity_1pxd5wf" targetRef="Activity_027ic3j" />
+    <bpmn:sequenceFlow id="Flow_1ryi6ym" sourceRef="Activity_027ic3j" targetRef="Gateway_0en9ki5" />
+    <bpmn:scriptTask id="Activity_12vtq69" name="prepare query job status" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0qhjtre</bpmn:incoming>
+      <bpmn:outgoing>Flow_1p48xbl</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoAllocateAccessNSSI()
+nss.createFhAllocateNssiJobQuery(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_1p48xbl" sourceRef="Activity_12vtq69" targetRef="Activity_1ux83hz" />
+    <bpmn:scriptTask id="Activity_0qpy2sg" name="prepare query job status" scriptFormat="groovy">
+      <bpmn:incoming>Flow_04thflx</bpmn:incoming>
+      <bpmn:outgoing>Flow_0fdetmo</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoAllocateAccessNSSI()
+nss.createMhAllocateNssiJobQuery(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_0fdetmo" sourceRef="Activity_0qpy2sg" targetRef="Activity_0c0cq9d" />
+    <bpmn:scriptTask id="Activity_0pa8al6" name="create RAN NSSI and RAN NF NSSI in AAI" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0ikdlkf</bpmn:incoming>
+      <bpmn:outgoing>Flow_1exjm0h</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoAllocateAccessNSSI()
+nss.updateAaiWithRANInstances(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_0ikdlkf" sourceRef="Activity_118je0o" targetRef="Activity_0pa8al6" />
+    <bpmn:sequenceFlow id="Flow_1exjm0h" sourceRef="Activity_0pa8al6" targetRef="Event_15zn4zi" />
+    <bpmn:sequenceFlow id="Flow_0bd6dhi" sourceRef="Activity_0zn4e4n" targetRef="Activity_0vf28ld" />
+    <bpmn:sequenceFlow id="Flow_0kcvava" sourceRef="Activity_0vf28ld" targetRef="Event_0u9308h" />
+    <bpmn:scriptTask id="Activity_0vf28ld" name="update AAI relationships">
+      <bpmn:incoming>Flow_0bd6dhi</bpmn:incoming>
+      <bpmn:outgoing>Flow_0kcvava</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoAllocateAccessNSSI()
+nss.updateAairelationships(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:subProcess id="Activity_0bcs8g1" name="Sub-process for FalloutHandler and Rollback" triggeredByEvent="true">
+      <bpmn:startEvent id="Event_077lf7i">
+        <bpmn:outgoing>Flow_18rrdsq</bpmn:outgoing>
+        <bpmn:errorEventDefinition id="ErrorEventDefinition_1chyysm" />
+      </bpmn:startEvent>
+      <bpmn:endEvent id="Event_1p00v8c">
+        <bpmn:incoming>Flow_0c9dr7z</bpmn:incoming>
+      </bpmn:endEvent>
+      <bpmn:scriptTask id="Activity_084fqbd" name="Handle Unexpected Error" scriptFormat="groovy">
+        <bpmn:incoming>Flow_0umohws</bpmn:incoming>
+        <bpmn:outgoing>Flow_0c9dr7z</bpmn:outgoing>
+        <bpmn:script>import org.onap.so.bpmn.common.scripts.*
+ExceptionUtil ex = new ExceptionUtil()
+ex.processJavaException(execution)</bpmn:script>
+      </bpmn:scriptTask>
+      <bpmn:sequenceFlow id="Flow_0c9dr7z" sourceRef="Activity_084fqbd" targetRef="Event_1p00v8c" />
+      <bpmn:scriptTask id="Activity_1adxijg" name="Prepare Resource Operation Status Update" scriptFormat="groovy">
+        <bpmn:incoming>Flow_18rrdsq</bpmn:incoming>
+        <bpmn:outgoing>Flow_11qgtdm</bpmn:outgoing>
+        <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoAllocateAccessNSSI()
+nss.prepareFailedOperationStatusUpdate(execution)</bpmn:script>
+      </bpmn:scriptTask>
+      <bpmn:serviceTask id="Activity_0p0mwue" 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_11qgtdm</bpmn:incoming>
+        <bpmn:outgoing>Flow_0umohws</bpmn:outgoing>
+      </bpmn:serviceTask>
+      <bpmn:sequenceFlow id="Flow_18rrdsq" sourceRef="Event_077lf7i" targetRef="Activity_1adxijg" />
+      <bpmn:sequenceFlow id="Flow_11qgtdm" sourceRef="Activity_1adxijg" targetRef="Activity_0p0mwue" />
+      <bpmn:sequenceFlow id="Flow_0umohws" sourceRef="Activity_0p0mwue" targetRef="Activity_084fqbd" />
+    </bpmn:subProcess>
+    <bpmn:intermediateThrowEvent id="Event_1cqde7p" name="Goto start TN allocate">
+      <bpmn:incoming>Flow_0n1mh5c</bpmn:incoming>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_0da795k" name="startTnAllocate" />
+    </bpmn:intermediateThrowEvent>
+    <bpmn:sequenceFlow id="Flow_0n1mh5c" sourceRef="Activity_1aweui4" targetRef="Event_1cqde7p" />
+    <bpmn:callActivity id="Activity_08i0hzk" name="DoModifyRanNfNssi" calledElement="DoModifyRanNfNssi">
+      <bpmn:extensionElements>
+        <camunda:in source="msoRequestId" target="msoRequestId" />
+        <camunda:in source="globalSubscriberId" target="globalSubscriberId" />
+        <camunda:in source="ANNF_NSSI" target="serviceInstanceID" />
+        <camunda:in source="subscriptionServiceType" target="subscriptionServiceType" />
+        <camunda:in source="ANNF_sliceProfileInstanceId" target="sliceProfileId" />
+        <camunda:in source="snssaiList" target="snssaiList" />
+        <camunda:out source="ranNfStatus" target="ranNfStatus" />
+        <camunda:in source="modifyAction" target="modifyAction" />
+        <camunda:in source="ranNfSliceProfile" target="additionalProperties" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_0kn30g3</bpmn:incoming>
+      <bpmn:outgoing>Flow_1k3vqxg</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:sequenceFlow id="Flow_1k3vqxg" sourceRef="Activity_08i0hzk" targetRef="Activity_1aweui4" />
+    <bpmn:sequenceFlow id="Flow_083bb3k" sourceRef="Gateway_1cmraqs" targetRef="Activity_0fdm3in" />
+  </bpmn:process>
+  <bpmn:message id="Message_1r7nv8u" name="WorkflowMessage" />
+  <bpmn:error id="Error_047rteq" name="MSO Workflow Exception" errorCode="MSOWorkflowException" />
+  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoAllocateAccessNSSI">
+      <bpmndi:BPMNEdge id="Flow_0kcvava_di" bpmnElement="Flow_0kcvava">
+        <di:waypoint x="1800" y="820" />
+        <di:waypoint x="1882" y="820" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0bd6dhi_di" bpmnElement="Flow_0bd6dhi">
+        <di:waypoint x="1620" y="820" />
+        <di:waypoint x="1700" y="820" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1exjm0h_di" bpmnElement="Flow_1exjm0h">
+        <di:waypoint x="1850" y="680" />
+        <di:waypoint x="1882" y="680" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0ikdlkf_di" bpmnElement="Flow_0ikdlkf">
+        <di:waypoint x="1720" y="680" />
+        <di:waypoint x="1750" y="680" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0fdetmo_di" bpmnElement="Flow_0fdetmo">
+        <di:waypoint x="1260" y="820" />
+        <di:waypoint x="1340" y="820" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1p48xbl_di" bpmnElement="Flow_1p48xbl">
+        <di:waypoint x="580" y="820" />
+        <di:waypoint x="640" y="820" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1ryi6ym_di" bpmnElement="Flow_1ryi6ym">
+        <di:waypoint x="1330" y="531" />
+        <di:waypoint x="1355" y="531" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1f9rw3m_di" bpmnElement="Flow_1f9rw3m">
+        <di:waypoint x="1210" y="531" />
+        <di:waypoint x="1230" y="531" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0d0f3ie_di" bpmnElement="Flow_0d0f3ie">
+        <di:waypoint x="950" y="530" />
+        <di:waypoint x="980" y="530" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0rb4j9r_di" bpmnElement="Flow_0rb4j9r">
+        <di:waypoint x="815" y="529" />
+        <di:waypoint x="833" y="529" />
+        <di:waypoint x="833" y="530" />
+        <di:waypoint x="850" y="530" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="824" y="543" width="17" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0y78v1q_di" bpmnElement="Flow_0y78v1q">
+        <di:waypoint x="720" y="529" />
+        <di:waypoint x="765" y="529" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0jdjta3_di" bpmnElement="Flow_0jdjta3">
+        <di:waypoint x="600" y="529" />
+        <di:waypoint x="620" y="529" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0reg6l5_di" bpmnElement="Flow_0reg6l5">
+        <di:waypoint x="470" y="529" />
+        <di:waypoint x="485" y="529" />
+        <di:waypoint x="485" y="530" />
+        <di:waypoint x="500" y="530" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_05s0wso_di" bpmnElement="Flow_05s0wso">
+        <di:waypoint x="770" y="380" />
+        <di:waypoint x="810" y="380" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_10j50jb_di" bpmnElement="Flow_10j50jb">
+        <di:waypoint x="630" y="380" />
+        <di:waypoint x="670" y="380" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0ile39j_di" bpmnElement="Flow_0ile39j">
+        <di:waypoint x="910" y="380" />
+        <di:waypoint x="950" y="380" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0k8yakp_di" bpmnElement="Flow_0k8yakp">
+        <di:waypoint x="1190" y="380" />
+        <di:waypoint x="1242" y="380" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0mmpy7h_di" bpmnElement="Flow_0mmpy7h">
+        <di:waypoint x="1050" y="380" />
+        <di:waypoint x="1090" y="380" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1k0z6lp_di" bpmnElement="Flow_1k0z6lp">
+        <di:waypoint x="490" y="380" />
+        <di:waypoint x="530" y="380" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1i10qog_di" bpmnElement="Flow_1i10qog">
+        <di:waypoint x="630" y="120" />
+        <di:waypoint x="690" y="120" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0mcd9bo_di" bpmnElement="Flow_0mcd9bo">
+        <di:waypoint x="480" y="120" />
+        <di:waypoint x="530" y="120" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_00f37fu_di" bpmnElement="Flow_00f37fu">
+        <di:waypoint x="790" y="120" />
+        <di:waypoint x="830" y="120" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1v3wpa2_di" bpmnElement="Flow_1v3wpa2">
+        <di:waypoint x="1440" y="820" />
+        <di:waypoint x="1520" y="820" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_04thflx_di" bpmnElement="Flow_04thflx">
+        <di:waypoint x="1100" y="820" />
+        <di:waypoint x="1160" y="820" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0qhjtre_di" bpmnElement="Flow_0qhjtre">
+        <di:waypoint x="410" y="820" />
+        <di:waypoint x="480" y="820" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_05yqmnj_di" bpmnElement="Flow_05yqmnj">
+        <di:waypoint x="1580" y="680" />
+        <di:waypoint x="1620" y="680" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1pbiznt_di" bpmnElement="Flow_1pbiznt">
+        <di:waypoint x="1430" y="680" />
+        <di:waypoint x="1480" y="680" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0kn30g3_di" bpmnElement="Flow_0kn30g3">
+        <di:waypoint x="1403" y="529" />
+        <di:waypoint x="1460" y="529" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1413" y="513" width="17" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1nkqrpd_di" bpmnElement="Flow_1nkqrpd">
+        <di:waypoint x="1080" y="531" />
+        <di:waypoint x="1110" y="531" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_16z59pu_di" bpmnElement="Flow_16z59pu">
+        <di:waypoint x="740" y="820" />
+        <di:waypoint x="810" y="820" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1b14415_di" bpmnElement="Flow_1b14415">
+        <di:waypoint x="1200" y="120" />
+        <di:waypoint x="1240" y="120" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0tica8m_di" bpmnElement="Flow_0tica8m">
+        <di:waypoint x="340" y="120" />
+        <di:waypoint x="380" y="120" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0k39zt8_di" bpmnElement="Flow_0k39zt8">
+        <di:waypoint x="270" y="405" />
+        <di:waypoint x="270" y="529" />
+        <di:waypoint x="370" y="529" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="249" y="421" width="15" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_09tjspa_di" bpmnElement="Flow_09tjspa">
+        <di:waypoint x="198" y="380" />
+        <di:waypoint x="245" y="380" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1h7iq8l_di" bpmnElement="Flow_1h7iq8l">
+        <di:waypoint x="1340" y="120" />
+        <di:waypoint x="1372" y="120" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0tkzfhb_di" bpmnElement="Flow_0tkzfhb">
+        <di:waypoint x="1060" y="120" />
+        <di:waypoint x="1100" y="120" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1w8whur_di" bpmnElement="Flow_1w8whur">
+        <di:waypoint x="930" y="120" />
+        <di:waypoint x="960" y="120" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_178fenq_di" bpmnElement="Flow_178fenq">
+        <di:waypoint x="1380" y="556" />
+        <di:waypoint x="1380" y="640" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1386" y="574" width="15" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1ipsxgh_di" bpmnElement="Flow_1ipsxgh">
+        <di:waypoint x="295" y="380" />
+        <di:waypoint x="390" y="380" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="319" y="363" width="17" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_163f3sq_di" bpmnElement="Flow_163f3sq">
+        <di:waypoint x="198" y="120" />
+        <di:waypoint x="240" y="120" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0zhr499_di" bpmnElement="Flow_0zhr499">
+        <di:waypoint x="910" y="820" />
+        <di:waypoint x="1000" y="820" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1x3y2tg_di" bpmnElement="Flow_1x3y2tg">
+        <di:waypoint x="228" y="820" />
+        <di:waypoint x="310" y="820" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0ll5x3u_di" bpmnElement="Flow_0ll5x3u">
+        <di:waypoint x="600" y="1010" />
+        <di:waypoint x="692" y="1010" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1xw4abx_di" bpmnElement="Flow_1xw4abx">
+        <di:waypoint x="420" y="1010" />
+        <di:waypoint x="500" y="1010" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0833cha_di" bpmnElement="Flow_0833cha">
+        <di:waypoint x="228" y="1010" />
+        <di:waypoint x="320" y="1010" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0n1mh5c_di" bpmnElement="Flow_0n1mh5c">
+        <di:waypoint x="1690" y="529" />
+        <di:waypoint x="1742" y="529" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1k3vqxg_di" bpmnElement="Flow_1k3vqxg">
+        <di:waypoint x="1560" y="529" />
+        <di:waypoint x="1590" y="529" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_083bb3k_di" bpmnElement="Flow_083bb3k">
+        <di:waypoint x="790" y="554" />
+        <di:waypoint x="790" y="730" />
+        <di:waypoint x="420" y="730" />
+        <di:waypoint x="420" y="569" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
+        <dc:Bounds x="162" y="102" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="167" y="152" width="25" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_01iduqx_di" bpmnElement="Activity_1jj3kh9">
+        <dc:Bounds x="240" y="80" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1gdi5bo_di" bpmnElement="Activity_0vhvubq">
+        <dc:Bounds x="830" y="80" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_11vdo22_di" bpmnElement="Activity_11vdo22">
+        <dc:Bounds x="320" y="970" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1nfx154_di" bpmnElement="Activity_1nfx154">
+        <dc:Bounds x="500" y="970" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_0vh1hs2_di" bpmnElement="Event_0vh1hs2">
+        <dc:Bounds x="692" y="992" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0icw8wt_di" bpmnElement="Activity_19laorl">
+        <dc:Bounds x="850" y="490" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_10z6k5t_di" bpmnElement="Activity_03dgcg5">
+        <dc:Bounds x="310" y="780" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1dracjc_di" bpmnElement="Activity_18y4ijb">
+        <dc:Bounds x="1000" y="780" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_0g0i472_di" bpmnElement="Event_05jtdqp">
+        <dc:Bounds x="192" y="992" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="174" y="1035" width="73" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_1ea1h0i_di" bpmnElement="Event_0u9308h">
+        <dc:Bounds x="1882" y="802" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1860" y="850" width="79" height="40" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_1fj3anx_di" bpmnElement="Event_18r5xkz">
+        <dc:Bounds x="192" y="802" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="170" y="845" width="81" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0nm8unl_di" bpmnElement="Activity_0qn2fvh">
+        <dc:Bounds x="810" y="780" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_12szahe_di" bpmnElement="Activity_12szahe">
+        <dc:Bounds x="1240" y="80" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1oepxwk_di" bpmnElement="Activity_0vwhzem">
+        <dc:Bounds x="960" y="80" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Gateway_1aesepd_di" bpmnElement="Gateway_1aesepd" isMarkerVisible="true">
+        <dc:Bounds x="245" y="355" width="50" height="50" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="239" y="326" width="62" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_142r2sx_di" bpmnElement="Event_142r2sx">
+        <dc:Bounds x="1242" y="362" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1220" y="397" width="79" height="40" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_15zn4zi_di" bpmnElement="Event_15zn4zi">
+        <dc:Bounds x="1882" y="662" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1868" y="705" width="67" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1pxd5wf_di" bpmnElement="Activity_1pxd5wf">
+        <dc:Bounds x="1110" y="491" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Gateway_0en9ki5_di" bpmnElement="Gateway_0en9ki5" isMarkerVisible="true">
+        <dc:Bounds x="1355" y="506" width="50" height="50" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1349" y="476" width="62" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0a95zgv_di" bpmnElement="Activity_0a95zgv">
+        <dc:Bounds x="1330" y="640" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_118je0o_di" bpmnElement="Activity_118je0o">
+        <dc:Bounds x="1620" y="640" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_0qwruv5_di" bpmnElement="Event_0s8t1ji">
+        <dc:Bounds x="1372" y="102" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1351" y="145" width="81" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_1vfrb2l_di" bpmnElement="Event_1glt41l">
+        <dc:Bounds x="162" y="362" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="155" y="405" width="51" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0p02joo_di" bpmnElement="Activity_0p02joo">
+        <dc:Bounds x="380" y="80" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1u28lyv_di" bpmnElement="Activity_1u28lyv">
+        <dc:Bounds x="1100" y="80" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1ux83hz_di" bpmnElement="Activity_1ux83hz">
+        <dc:Bounds x="640" y="780" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0c0cq9d_di" bpmnElement="Activity_0c0cq9d">
+        <dc:Bounds x="1340" y="780" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0y9xgkl_di" bpmnElement="Activity_0y9xgkl">
+        <dc:Bounds x="980" y="491" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0vbzhej_di" bpmnElement="Activity_0vbzhej">
+        <dc:Bounds x="1480" y="640" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0zn4e4n_di" bpmnElement="Activity_0zn4e4n">
+        <dc:Bounds x="1520" y="780" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1ll0nr1_di" bpmnElement="Activity_1ll0nr1">
+        <dc:Bounds x="690" y="80" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_06hcbu6_di" bpmnElement="Activity_06hcbu6">
+        <dc:Bounds x="530" y="80" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1xke4xc_di" bpmnElement="Activity_1aweui4">
+        <dc:Bounds x="1590" y="489" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1bjike9_di" bpmnElement="Activity_1bjike9">
+        <dc:Bounds x="530" y="340" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_02rsimm_di" bpmnElement="Activity_0xawnmh">
+        <dc:Bounds x="390" y="340" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0ffp1no_di" bpmnElement="Activity_0ffp1no">
+        <dc:Bounds x="950" y="340" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0yfrqtb_di" bpmnElement="Activity_0yfrqtb">
+        <dc:Bounds x="1090" y="340" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1wagv3s_di" bpmnElement="Activity_1k94obj">
+        <dc:Bounds x="810" y="340" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_16w4zg9_di" bpmnElement="Activity_16w4zg9">
+        <dc:Bounds x="670" y="340" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0fdm3in_di" bpmnElement="Activity_0fdm3in">
+        <dc:Bounds x="370" y="489" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0a7a04p_di" bpmnElement="Activity_0a7a04p">
+        <dc:Bounds x="500" y="489" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Gateway_1cmraqs_di" bpmnElement="Gateway_1cmraqs" isMarkerVisible="true">
+        <dc:Bounds x="765" y="504" width="50" height="50" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="755" y="467" width="70" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1nmk2rt_di" bpmnElement="Activity_1nmk2rt">
+        <dc:Bounds x="620" y="489" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_027ic3j_di" bpmnElement="Activity_027ic3j">
+        <dc:Bounds x="1230" y="491" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_12vtq69_di" bpmnElement="Activity_12vtq69">
+        <dc:Bounds x="480" y="780" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0qpy2sg_di" bpmnElement="Activity_0qpy2sg">
+        <dc:Bounds x="1160" y="780" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0pa8al6_di" bpmnElement="Activity_0pa8al6">
+        <dc:Bounds x="1750" y="640" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1riw9uv_di" bpmnElement="Activity_0vf28ld">
+        <dc:Bounds x="1700" y="780" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_1cqde7p_di" bpmnElement="Event_1cqde7p">
+        <dc:Bounds x="1742" y="511" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1728" y="554" width="67" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_08i0hzk_di" bpmnElement="Activity_08i0hzk">
+        <dc:Bounds x="1460" y="489" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0bcs8g1_di" bpmnElement="Activity_0bcs8g1" isExpanded="true">
+        <dc:Bounds x="410" y="1160" width="781" height="196" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="Flow_0umohws_di" bpmnElement="Flow_0umohws">
+        <di:waypoint x="800" y="1264" />
+        <di:waypoint x="870" y="1264" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_11qgtdm_di" bpmnElement="Flow_11qgtdm">
+        <di:waypoint x="640" y="1264" />
+        <di:waypoint x="700" y="1264" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_18rrdsq_di" bpmnElement="Flow_18rrdsq">
+        <di:waypoint x="476" y="1264" />
+        <di:waypoint x="540" y="1264" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0c9dr7z_di" bpmnElement="Flow_0c9dr7z">
+        <di:waypoint x="970" y="1264" />
+        <di:waypoint x="1078" y="1264" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="Event_077lf7i_di" bpmnElement="Event_077lf7i">
+        <dc:Bounds x="440" y="1246" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_1p00v8c_di" bpmnElement="Event_1p00v8c">
+        <dc:Bounds x="1078" y="1246" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_084fqbd_di" bpmnElement="Activity_084fqbd">
+        <dc:Bounds x="870" y="1224" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1adxijg_di" bpmnElement="Activity_1adxijg">
+        <dc:Bounds x="540" y="1224" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0p0mwue_di" bpmnElement="Activity_0p0mwue">
+        <dc:Bounds x="700" y="1224" width="100" height="80" />
+      </bpmndi:BPMNShape>
+    </bpmndi:BPMNPlane>
+  </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateCoreNSSI.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateCoreNSSI.bpmn
new file mode 100644 (file)
index 0000000..92407e9
--- /dev/null
@@ -0,0 +1,309 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_19c8rxx" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.0.0">
+  <bpmn:process id="DoAllocateCoreNSSI" name="DoAllocateCoreNSSI" isExecutable="true">
+    <bpmn:startEvent id="allocateNSSI_startEvent" name="Start">
+      <bpmn:outgoing>SequenceFlow_0bjz7up</bpmn:outgoing>
+    </bpmn:startEvent>
+    <bpmn:sequenceFlow id="SequenceFlow_0bjz7up" sourceRef="allocateNSSI_startEvent" targetRef="processRequest_ScriptTask" />
+    <bpmn:sequenceFlow id="SequenceFlow_1xiszom" sourceRef="processRequest_ScriptTask" targetRef="ScriptTask_13krb7d" />
+    <bpmn:sequenceFlow id="SequenceFlow_1r5aycw" sourceRef="ScriptTask_0ybe0w9" targetRef="Activity_16u5d39" />
+    <bpmn:exclusiveGateway id="ExclusiveGateway_1xjahhp" default="SequenceFlow_1scva4p">
+      <bpmn:incoming>Flow_0kbpihh</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1scva4p</bpmn:outgoing>
+      <bpmn:outgoing>SequenceFlow_1ygklb8</bpmn:outgoing>
+    </bpmn:exclusiveGateway>
+    <bpmn:sequenceFlow id="SequenceFlow_1scva4p" name="No Existing &#10;s-nssai" sourceRef="ExclusiveGateway_1xjahhp" targetRef="CallActivity_0ue7vug" />
+    <bpmn:sequenceFlow id="SequenceFlow_1ygklb8" sourceRef="ExclusiveGateway_1xjahhp" targetRef="CallActivity_0e6drr2">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("solutions") !="" }</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:sequenceFlow id="SequenceFlow_0enouyb" sourceRef="ScriptTask_13krb7d" targetRef="ScriptTask_0ybe0w9" />
+    <bpmn:endEvent id="EndEvent_1e80uuk" name="End">
+      <bpmn:incoming>SequenceFlow_0tytimn</bpmn:incoming>
+      <bpmn:incoming>SequenceFlow_0tubodn</bpmn:incoming>
+    </bpmn:endEvent>
+    <bpmn:scriptTask id="processRequest_ScriptTask" name="Preprocess request" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_0bjz7up</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1xiszom</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def allocateNssi = new DoAllocateCoreNSSI()
+allocateNssi.preProcessRequest(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="ScriptTask_13krb7d" name="Get NSST name from CatalogDB" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_1xiszom</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0enouyb</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def allocateNssi = new DoAllocateCoreNSSI()
+allocateNssi.getNSSTName(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="ScriptTask_0ybe0w9" name="Prepare OOF request" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_0enouyb</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1r5aycw</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def allocateNssi = new DoAllocateCoreNSSI()
+allocateNssi.prepareOOFRequest(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:callActivity id="CallActivity_0ue7vug" name="Call non-shared slice flow" calledElement="DoAllocateCoreNonSharedSlice">
+      <bpmn:extensionElements>
+        <camunda:in source="coreServiceInstanceId" target="serviceInstanceId" />
+        <camunda:in source="networkServiceModelInfo" target="networkServiceModelInfo" />
+        <camunda:in source="subscriptionServiceType" target="subscriptionServiceType" />
+        <camunda:in source="modelInvariantUuid" target="modelInvariantUuid" />
+        <camunda:in source="nsstName" target="nsstName" />
+        <camunda:in source="modelUuid" target="modelUuid" />
+        <camunda:in source="globalSubscriberId" target="globalSubscriberId" />
+        <camunda:out source="WorkflowException" target="WorkflowException" />
+        <camunda:in source="jobId" target="jobId" />
+        <camunda:in source="nsiId" target="nsiId" />
+        <camunda:in source="sliceParams" target="sliceParams" />
+        <camunda:in source="servicename" target="servicename" />
+        <camunda:in source="msoRequestId" target="msoRequestId" />
+        <camunda:in source="sliceProfile" target="sliceProfile" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>SequenceFlow_1scva4p</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0tubodn</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:callActivity id="CallActivity_0e6drr2" name="Call shared slice flow&#10;" calledElement="DoAllocateCoreSharedSlice">
+      <bpmn:extensionElements>
+        <camunda:in source="solutions" target="solutions" />
+        <camunda:in source="globalSubscriberId" target="globalSubscriberId" />
+        <camunda:in source="modelInvariantUuid" target="modelInvariantUuid" />
+        <camunda:in source="nsstName" target="nsstName" />
+        <camunda:in source="dummyServiceId" target="dummyServiceId" />
+        <camunda:in source="networkServiceModelInfo" target="networkServiceModelInfo" />
+        <camunda:in source="subscriptionServiceType" target="subscriptionServiceType" />
+        <camunda:in source="modelUuid" target="modelUuid" />
+        <camunda:out source="WorkflowException" target="WorkflowException" />
+        <camunda:in source="nsiId" target="nsiId" />
+        <camunda:in source="sliceParams" target="sliceParams" />
+        <camunda:in source="servicename" target="servicename" />
+        <camunda:in source="msoRequestId" target="msoRequestId" />
+        <camunda:in source="sliceProfile" target="sliceProfile" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>SequenceFlow_1ygklb8</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0tytimn</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:sequenceFlow id="SequenceFlow_0tytimn" sourceRef="CallActivity_0e6drr2" targetRef="EndEvent_1e80uuk" />
+    <bpmn:sequenceFlow id="SequenceFlow_0tubodn" sourceRef="CallActivity_0ue7vug" targetRef="EndEvent_1e80uuk" />
+    <bpmn:callActivity id="Activity_16u5d39" name="Call DoHandleOofRequest" calledElement="DoHandleOofRequest">
+      <bpmn:extensionElements>
+        <camunda:in source="NSSI_apiPath" target="apiPath" />
+        <camunda:in source="NSSI_correlator" target="correlator" />
+        <camunda:in source="NSSI_messageType" target="messageType" />
+        <camunda:in source="NSSI_timeout" target="timeout" />
+        <camunda:in source="NSSI_oofRequest" target="oofRequest" />
+        <camunda:out source="WorkflowException" target="WorkflowException" />
+        <camunda:out source="asyncCallbackResponse" target="NSSI_asyncCallbackResponse" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>SequenceFlow_1r5aycw</bpmn:incoming>
+      <bpmn:outgoing>Flow_1navrbe</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:sequenceFlow id="Flow_1navrbe" sourceRef="Activity_16u5d39" targetRef="ScriptTask_1bg09vu" />
+    <bpmn:scriptTask id="ScriptTask_1bg09vu" name="Process OOF Async&#10;ressponse" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1navrbe</bpmn:incoming>
+      <bpmn:outgoing>Flow_0kbpihh</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def allocateNssi = new DoAllocateCoreNSSI()
+allocateNssi.processOOFAsyncResponse(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_0kbpihh" sourceRef="ScriptTask_1bg09vu" targetRef="ExclusiveGateway_1xjahhp" />
+    <bpmn:subProcess id="Activity_0nliikd" name="Sub-process for FalloutHandler and Rollback" triggeredByEvent="true">
+      <bpmn:startEvent id="Event_0jeyy28">
+        <bpmn:outgoing>Flow_1bd9s44</bpmn:outgoing>
+        <bpmn:errorEventDefinition id="ErrorEventDefinition_00bn0ig" />
+      </bpmn:startEvent>
+      <bpmn:endEvent id="Event_0f5seph">
+        <bpmn:incoming>Flow_1rrkw3k</bpmn:incoming>
+      </bpmn:endEvent>
+      <bpmn:scriptTask id="Activity_016fs4l" name="Handle Unexpected Error" scriptFormat="groovy">
+        <bpmn:incoming>Flow_1jn84pa</bpmn:incoming>
+        <bpmn:outgoing>Flow_1rrkw3k</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_1wmb5hd" name="Prepare Resource Operation Status Update" scriptFormat="groovy">
+        <bpmn:incoming>Flow_1bd9s44</bpmn:incoming>
+        <bpmn:outgoing>Flow_167qlhy</bpmn:outgoing>
+        <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def allocateNssi= new DoAllocateCoreNSSI()
+allocateNssi.prepareFailedOperationStatusUpdate(execution)</bpmn:script>
+      </bpmn:scriptTask>
+      <bpmn:serviceTask id="Activity_0frxrqx" 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_167qlhy</bpmn:incoming>
+        <bpmn:outgoing>Flow_1jn84pa</bpmn:outgoing>
+      </bpmn:serviceTask>
+      <bpmn:sequenceFlow id="Flow_1jn84pa" sourceRef="Activity_0frxrqx" targetRef="Activity_016fs4l" />
+      <bpmn:sequenceFlow id="Flow_167qlhy" sourceRef="Activity_1wmb5hd" targetRef="Activity_0frxrqx" />
+      <bpmn:sequenceFlow id="Flow_1bd9s44" sourceRef="Event_0jeyy28" targetRef="Activity_1wmb5hd" />
+      <bpmn:sequenceFlow id="Flow_1rrkw3k" sourceRef="Activity_016fs4l" targetRef="Event_0f5seph" />
+    </bpmn:subProcess>
+  </bpmn:process>
+  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoAllocateCoreNSSI">
+      <bpmndi:BPMNEdge id="Flow_0kbpihh_di" bpmnElement="Flow_0kbpihh">
+        <di:waypoint x="868" y="180" />
+        <di:waypoint x="929" y="180" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="753.5" y="155" width="90" height="20" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1navrbe_di" bpmnElement="Flow_1navrbe">
+        <di:waypoint x="735" y="180" />
+        <di:waypoint x="768" y="180" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0tubodn_di" bpmnElement="SequenceFlow_0tubodn">
+        <di:waypoint x="1096" y="115" />
+        <di:waypoint x="1136" y="115" />
+        <di:waypoint x="1136" y="184" />
+        <di:waypoint x="1176" y="184" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1051" y="143.5" width="0" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0tytimn_di" bpmnElement="SequenceFlow_0tytimn">
+        <di:waypoint x="1096" y="266" />
+        <di:waypoint x="1136" y="266" />
+        <di:waypoint x="1136" y="184" />
+        <di:waypoint x="1176" y="184" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1051" y="219" width="0" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0enouyb_di" bpmnElement="SequenceFlow_0enouyb">
+        <di:waypoint x="468" y="184" />
+        <di:waypoint x="501" y="184" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="339.5" y="163" width="90" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1ygklb8_di" bpmnElement="SequenceFlow_1ygklb8">
+        <di:waypoint x="954" y="205" />
+        <di:waypoint x="954" y="266" />
+        <di:waypoint x="996" y="266" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="824" y="229.5" width="90" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1scva4p_di" bpmnElement="SequenceFlow_1scva4p">
+        <di:waypoint x="954" y="155" />
+        <di:waypoint x="954" y="115" />
+        <di:waypoint x="996" y="115" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="897" y="116" width="56" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1r5aycw_di" bpmnElement="SequenceFlow_1r5aycw">
+        <di:waypoint x="601" y="184" />
+        <di:waypoint x="635" y="184" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="470.5" y="163" width="90" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1xiszom_di" bpmnElement="SequenceFlow_1xiszom">
+        <di:waypoint x="343" y="184" />
+        <di:waypoint x="368" y="184" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="210.5" y="163" width="90" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0bjz7up_di" bpmnElement="SequenceFlow_0bjz7up">
+        <di:waypoint x="195" y="184" />
+        <di:waypoint x="243" y="184" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="74" y="163" width="90" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="allocateNSSI_startEvent">
+        <dc:Bounds x="159" y="166" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="166" y="209" width="25" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ExclusiveGateway_1xjahhp_di" bpmnElement="ExclusiveGateway_1xjahhp" isMarkerVisible="true">
+        <dc:Bounds x="929" y="155" width="50" height="50" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="975" y="284" width="90" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="EndEvent_1e80uuk_di" bpmnElement="EndEvent_1e80uuk">
+        <dc:Bounds x="1176" y="166" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1184" y="209" width="20" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1eo0wn0_di" bpmnElement="processRequest_ScriptTask">
+        <dc:Bounds x="243" y="144" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0cs9cfh_di" bpmnElement="ScriptTask_13krb7d">
+        <dc:Bounds x="368" y="144" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1v669aj_di" bpmnElement="ScriptTask_0ybe0w9">
+        <dc:Bounds x="501" y="144" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_04schfi_di" bpmnElement="CallActivity_0ue7vug">
+        <dc:Bounds x="996" y="75" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1vy16mp_di" bpmnElement="CallActivity_0e6drr2">
+        <dc:Bounds x="996" y="226" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_16u5d39_di" bpmnElement="Activity_16u5d39">
+        <dc:Bounds x="635" y="144" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_19cc8m2_di" bpmnElement="ScriptTask_1bg09vu">
+        <dc:Bounds x="768" y="140" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0nliikd_di" bpmnElement="Activity_0nliikd" isExpanded="true">
+        <dc:Bounds x="300" y="360" width="781" height="196" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="Flow_1rrkw3k_di" bpmnElement="Flow_1rrkw3k">
+        <di:waypoint x="860" y="464" />
+        <di:waypoint x="968" y="464" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1bd9s44_di" bpmnElement="Flow_1bd9s44">
+        <di:waypoint x="366" y="464" />
+        <di:waypoint x="430" y="464" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_167qlhy_di" bpmnElement="Flow_167qlhy">
+        <di:waypoint x="530" y="464" />
+        <di:waypoint x="590" y="464" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1jn84pa_di" bpmnElement="Flow_1jn84pa">
+        <di:waypoint x="690" y="464" />
+        <di:waypoint x="760" y="464" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="Event_0jeyy28_di" bpmnElement="Event_0jeyy28">
+        <dc:Bounds x="330" y="446" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_0f5seph_di" bpmnElement="Event_0f5seph">
+        <dc:Bounds x="968" y="446" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_016fs4l_di" bpmnElement="Activity_016fs4l">
+        <dc:Bounds x="760" y="424" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1wmb5hd_di" bpmnElement="Activity_1wmb5hd">
+        <dc:Bounds x="430" y="424" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0frxrqx_di" bpmnElement="Activity_0frxrqx">
+        <dc:Bounds x="590" y="424" width="100" height="80" />
+      </bpmndi:BPMNShape>
+    </bpmndi:BPMNPlane>
+  </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateCoreNonSharedSlice.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateCoreNonSharedSlice.bpmn
new file mode 100644 (file)
index 0000000..22eecee
--- /dev/null
@@ -0,0 +1,368 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_021ltql" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.0.0">
+  <bpmn:process id="DoAllocateCoreNonSharedSlice" name="DoAllocateCoreNonSharedSlice" isExecutable="true">
+    <bpmn:startEvent id="StartEvent_0niin4a" name="Start">
+      <bpmn:outgoing>SequenceFlow_0vxnxew</bpmn:outgoing>
+    </bpmn:startEvent>
+    <bpmn:exclusiveGateway id="ExclusiveGateway_09xlga4" default="Flow_0ebyiqk">
+      <bpmn:incoming>SequenceFlow_0pkw03j</bpmn:incoming>
+      <bpmn:outgoing>Flow_1xofp8o</bpmn:outgoing>
+      <bpmn:outgoing>Flow_0ebyiqk</bpmn:outgoing>
+    </bpmn:exclusiveGateway>
+    <bpmn:sequenceFlow id="SequenceFlow_0vxnxew" sourceRef="StartEvent_0niin4a" targetRef="Activity_0kvdq8n" />
+    <bpmn:sequenceFlow id="SequenceFlow_1terk7m" sourceRef="Task_0n4n0mx" targetRef="Task_0nowehc" />
+    <bpmn:sequenceFlow id="SequenceFlow_0pkw03j" sourceRef="Task_1p5lbp7" targetRef="ExclusiveGateway_09xlga4" />
+    <bpmn:scriptTask id="Task_0n4n0mx" name="Call AAI&#10;Create NSSI" scriptFormat="groovy">
+      <bpmn:incoming>Flow_13lzgo4</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1terk7m</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def allocateNssi = new DoAllocateCoreNonSharedSlice()
+allocateNssi.createNSSIinAAI(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Task_0nowehc" name="Prepare serviceOrder request" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_1terk7m</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0qeif6i</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def allocateNssi = new DoAllocateCoreNonSharedSlice()
+allocateNssi.prepareServiceOrderRequest(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Task_1p5lbp7" name="Call serviceOrder api" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_0cqjgbm</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0pkw03j</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def allocateNssi = new DoAllocateCoreNonSharedSlice()
+allocateNssi.postNBIServiceOrder(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_1xofp8o" name="ACK" sourceRef="ExclusiveGateway_09xlga4" targetRef="Task_15tmmrz">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("ServiceOrderId" )  != null &amp;&amp; execution.getVariable("ServiceOrderId" )  != "" )}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:exclusiveGateway id="ExclusiveGateway_0bq5wvj" name="Status = processing" default="Flow_1hjbkma">
+      <bpmn:incoming>SequenceFlow_1g8lnjx</bpmn:incoming>
+      <bpmn:outgoing>Flow_1hjbkma</bpmn:outgoing>
+      <bpmn:outgoing>SequenceFlow_0zuc4mh</bpmn:outgoing>
+    </bpmn:exclusiveGateway>
+    <bpmn:sequenceFlow id="SequenceFlow_1g8lnjx" sourceRef="Task_15tmmrz" targetRef="ExclusiveGateway_0bq5wvj" />
+    <bpmn:endEvent id="EndEvent_1pb7jxo" name="End">
+      <bpmn:incoming>Flow_0ginxdy</bpmn:incoming>
+    </bpmn:endEvent>
+    <bpmn:sequenceFlow id="Flow_13lzgo4" sourceRef="Activity_0kvdq8n" targetRef="Task_0n4n0mx" />
+    <bpmn:scriptTask id="Activity_0kvdq8n" name="Preprocess Request" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_0vxnxew</bpmn:incoming>
+      <bpmn:outgoing>Flow_13lzgo4</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def allocateNssi = new DoAllocateCoreNonSharedSlice()
+allocateNssi.preProcessRequest(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Task_15tmmrz" name="Call Get ServiceOrder Progress" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1xofp8o</bpmn:incoming>
+      <bpmn:incoming>Flow_0d9xaja</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1g8lnjx</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def allocateNssi = new DoAllocateCoreNonSharedSlice()
+allocateNssi.getNBIServiceOrderProgress(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:serviceTask id="Activity_19ywbh2" 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_0ebyiqk</bpmn:incoming>
+      <bpmn:incoming>Flow_140j38y</bpmn:incoming>
+      <bpmn:outgoing>Flow_0ginxdy</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:sequenceFlow id="Flow_0ebyiqk" name="Failed" sourceRef="ExclusiveGateway_09xlga4" targetRef="Activity_19ywbh2" />
+    <bpmn:sequenceFlow id="Flow_1hjbkma" sourceRef="ExclusiveGateway_0bq5wvj" targetRef="Activity_0luwonx" />
+    <bpmn:sequenceFlow id="Flow_0ginxdy" sourceRef="Activity_19ywbh2" targetRef="EndEvent_1pb7jxo" />
+    <bpmn:sequenceFlow id="SequenceFlow_0zuc4mh" name="Yes" sourceRef="ExclusiveGateway_0bq5wvj" targetRef="Activity_0h5vkls">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("status" ) == "processing" )}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:sequenceFlow id="Flow_0d9xaja" sourceRef="Activity_0h5vkls" targetRef="Task_15tmmrz" />
+    <bpmn:scriptTask id="Activity_0h5vkls" name="Time Delay" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_0zuc4mh</bpmn:incoming>
+      <bpmn:outgoing>Flow_0d9xaja</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def allocateNssi = new DoAllocateCoreNonSharedSlice()
+allocateNssi.timeDelay(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_0luwonx" name="Call AAI associate NSSI with network service instance" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1hjbkma</bpmn:incoming>
+      <bpmn:outgoing>Flow_140j38y</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def allocateNssi = new DoAllocateCoreNonSharedSlice()
+allocateNssi.updateRelationship(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_140j38y" sourceRef="Activity_0luwonx" targetRef="Activity_19ywbh2" />
+    <bpmn:sequenceFlow id="SequenceFlow_0qeif6i" sourceRef="Task_0nowehc" targetRef="IntermediateThrowEvent_0m8avak" />
+    <bpmn:intermediateThrowEvent id="IntermediateThrowEvent_0m8avak" name="callServiceOrder">
+      <bpmn:incoming>SequenceFlow_0qeif6i</bpmn:incoming>
+      <bpmn:linkEventDefinition name="callServiceOrder" />
+    </bpmn:intermediateThrowEvent>
+    <bpmn:intermediateCatchEvent id="IntermediateThrowEvent_0nz9fnn" name="callServiceOrder">
+      <bpmn:outgoing>SequenceFlow_0cqjgbm</bpmn:outgoing>
+      <bpmn:linkEventDefinition name="callServiceOrder" />
+    </bpmn:intermediateCatchEvent>
+    <bpmn:sequenceFlow id="SequenceFlow_0cqjgbm" sourceRef="IntermediateThrowEvent_0nz9fnn" targetRef="Task_1p5lbp7" />
+    <bpmn:subProcess id="Activity_0uegdhh" name="Sub-process for FalloutHandler and Rollback" triggeredByEvent="true">
+      <bpmn:startEvent id="Event_054d9nj">
+        <bpmn:outgoing>Flow_022y6dc</bpmn:outgoing>
+        <bpmn:errorEventDefinition id="ErrorEventDefinition_1e3e8ia" />
+      </bpmn:startEvent>
+      <bpmn:endEvent id="Event_1kmtbm7">
+        <bpmn:incoming>Flow_0luurk9</bpmn:incoming>
+      </bpmn:endEvent>
+      <bpmn:scriptTask id="Activity_1ov9qpp" name="Handle Unexpected Error" scriptFormat="groovy">
+        <bpmn:incoming>Flow_07lojd9</bpmn:incoming>
+        <bpmn:outgoing>Flow_0luurk9</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_016j574" name="Prepare Resource Operation Status Update" scriptFormat="groovy">
+        <bpmn:incoming>Flow_022y6dc</bpmn:incoming>
+        <bpmn:outgoing>Flow_0g444ik</bpmn:outgoing>
+        <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def allocateNssi = new DoAllocateCoreNonSharedSlice()
+allocateNssi.prepareFailedOperationStatusUpdate(execution)</bpmn:script>
+      </bpmn:scriptTask>
+      <bpmn:serviceTask id="Activity_1wz7ppl" 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_0g444ik</bpmn:incoming>
+        <bpmn:outgoing>Flow_07lojd9</bpmn:outgoing>
+      </bpmn:serviceTask>
+      <bpmn:sequenceFlow id="Flow_0luurk9" sourceRef="Activity_1ov9qpp" targetRef="Event_1kmtbm7" />
+      <bpmn:sequenceFlow id="Flow_022y6dc" sourceRef="Event_054d9nj" targetRef="Activity_016j574" />
+      <bpmn:sequenceFlow id="Flow_0g444ik" sourceRef="Activity_016j574" targetRef="Activity_1wz7ppl" />
+      <bpmn:sequenceFlow id="Flow_07lojd9" sourceRef="Activity_1wz7ppl" targetRef="Activity_1ov9qpp" />
+    </bpmn:subProcess>
+  </bpmn:process>
+  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoAllocateCoreNonSharedSlice">
+      <bpmndi:BPMNEdge id="SequenceFlow_0cqjgbm_di" bpmnElement="SequenceFlow_0cqjgbm">
+        <di:waypoint x="188" y="295" />
+        <di:waypoint x="250" y="295" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="219" y="274" width="0" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0qeif6i_di" bpmnElement="SequenceFlow_0qeif6i">
+        <di:waypoint x="672" y="117" />
+        <di:waypoint x="732" y="117" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="702" y="96" width="0" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_140j38y_di" bpmnElement="Flow_140j38y">
+        <di:waypoint x="825" y="379" />
+        <di:waypoint x="868" y="379" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="801.5" y="354" width="90" height="20" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0d9xaja_di" bpmnElement="Flow_0d9xaja">
+        <di:waypoint x="589" y="483" />
+        <di:waypoint x="508" y="483" />
+        <di:waypoint x="508" y="419" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="503.5" y="458" width="90" height="20" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0zuc4mh_di" bpmnElement="SequenceFlow_0zuc4mh">
+        <di:waypoint x="639" y="404" />
+        <di:waypoint x="639" y="443" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="649" y="414" width="19" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0ginxdy_di" bpmnElement="Flow_0ginxdy">
+        <di:waypoint x="968" y="379" />
+        <di:waypoint x="1013" y="379" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="945.5" y="354" width="90" height="20" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1hjbkma_di" bpmnElement="Flow_1hjbkma">
+        <di:waypoint x="664" y="379" />
+        <di:waypoint x="725" y="379" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="649.5" y="354" width="90" height="20" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0ebyiqk_di" bpmnElement="Flow_0ebyiqk">
+        <di:waypoint x="449" y="295" />
+        <di:waypoint x="918" y="295" />
+        <di:waypoint x="918" y="339" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="669" y="277" width="30" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_13lzgo4_di" bpmnElement="Flow_13lzgo4">
+        <di:waypoint x="350" y="117" />
+        <di:waypoint x="412" y="117" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="456" y="92" width="90" height="20" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1g8lnjx_di" bpmnElement="SequenceFlow_1g8lnjx">
+        <di:waypoint x="558" y="379" />
+        <di:waypoint x="614" y="379" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="541" y="358" width="90" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1xofp8o_di" bpmnElement="Flow_1xofp8o">
+        <di:waypoint x="424" y="320" />
+        <di:waypoint x="424" y="379" />
+        <di:waypoint x="458" y="379" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="396" y="344" width="24" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0pkw03j_di" bpmnElement="SequenceFlow_0pkw03j">
+        <di:waypoint x="350" y="295" />
+        <di:waypoint x="399" y="295" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="329.5" y="274" width="90" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1terk7m_di" bpmnElement="SequenceFlow_1terk7m">
+        <di:waypoint x="512" y="117" />
+        <di:waypoint x="572" y="117" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="617" y="96" width="90" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0vxnxew_di" bpmnElement="SequenceFlow_0vxnxew">
+        <di:waypoint x="188" y="117" />
+        <di:waypoint x="250" y="117" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="294" y="96" width="90" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="StartEvent_0niin4a_di" bpmnElement="StartEvent_0niin4a">
+        <dc:Bounds x="152" y="99" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="158" y="142" width="25" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ExclusiveGateway_09xlga4_di" bpmnElement="ExclusiveGateway_09xlga4" isMarkerVisible="true">
+        <dc:Bounds x="399" y="270" width="50" height="50" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="-256" y="579" width="90" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0rs2nd3_di" bpmnElement="Task_0n4n0mx">
+        <dc:Bounds x="412" y="77" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0m5z0ww_di" bpmnElement="Task_0nowehc">
+        <dc:Bounds x="572" y="77" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1d5c0io_di" bpmnElement="Task_1p5lbp7">
+        <dc:Bounds x="250" y="255" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ExclusiveGateway_0bq5wvj_di" bpmnElement="ExclusiveGateway_0bq5wvj" isMarkerVisible="true">
+        <dc:Bounds x="614" y="354" width="50" height="50" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="613" y="332" width="54" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="EndEvent_1pb7jxo_di" bpmnElement="EndEvent_1pb7jxo">
+        <dc:Bounds x="1013" y="361" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1021" y="404" width="20" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0e7umcn_di" bpmnElement="Activity_0kvdq8n">
+        <dc:Bounds x="250" y="77" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_18jxe7s_di" bpmnElement="Task_15tmmrz">
+        <dc:Bounds x="458" y="339" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_19ywbh2_di" bpmnElement="Activity_19ywbh2">
+        <dc:Bounds x="868" y="339" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_07789nc_di" bpmnElement="Activity_0h5vkls">
+        <dc:Bounds x="589" y="443" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0luwonx_di" bpmnElement="Activity_0luwonx">
+        <dc:Bounds x="725" y="339" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="IntermediateThrowEvent_0fs6uqw_di" bpmnElement="IntermediateThrowEvent_0m8avak">
+        <dc:Bounds x="732" y="99" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="714" y="139" width="83" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="IntermediateCatchEvent_16ljm3v_di" bpmnElement="IntermediateThrowEvent_0nz9fnn">
+        <dc:Bounds x="152" y="277" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="130" y="317" width="83" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0uegdhh_di" bpmnElement="Activity_0uegdhh" isExpanded="true">
+        <dc:Bounds x="231" y="580" width="781" height="196" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="Flow_0luurk9_di" bpmnElement="Flow_0luurk9">
+        <di:waypoint x="791" y="684" />
+        <di:waypoint x="899" y="684" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_022y6dc_di" bpmnElement="Flow_022y6dc">
+        <di:waypoint x="297" y="684" />
+        <di:waypoint x="361" y="684" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0g444ik_di" bpmnElement="Flow_0g444ik">
+        <di:waypoint x="461" y="684" />
+        <di:waypoint x="521" y="684" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_07lojd9_di" bpmnElement="Flow_07lojd9">
+        <di:waypoint x="621" y="684" />
+        <di:waypoint x="691" y="684" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="Event_054d9nj_di" bpmnElement="Event_054d9nj">
+        <dc:Bounds x="261" y="666" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_1kmtbm7_di" bpmnElement="Event_1kmtbm7">
+        <dc:Bounds x="899" y="666" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1ov9qpp_di" bpmnElement="Activity_1ov9qpp">
+        <dc:Bounds x="691" y="644" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_016j574_di" bpmnElement="Activity_016j574">
+        <dc:Bounds x="361" y="644" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1wz7ppl_di" bpmnElement="Activity_1wz7ppl">
+        <dc:Bounds x="521" y="644" width="100" height="80" />
+      </bpmndi:BPMNShape>
+    </bpmndi:BPMNPlane>
+  </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateCoreSharedSlice.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateCoreSharedSlice.bpmn
new file mode 100644 (file)
index 0000000..0a482be
--- /dev/null
@@ -0,0 +1,367 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1px21lh" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.0.0">
+  <bpmn:process id="DoAllocateCoreSharedSlice" name="DoAllocateCoreSharedSlice" isExecutable="true">
+    <bpmn:startEvent id="StartEvent_1" name="Start">
+      <bpmn:outgoing>SequenceFlow_1ym7ydc</bpmn:outgoing>
+    </bpmn:startEvent>
+    <bpmn:sequenceFlow id="SequenceFlow_1ym7ydc" sourceRef="StartEvent_1" targetRef="Activity_1264hec" />
+    <bpmn:endEvent id="EndEvent_1av4kxa" name="End">
+      <bpmn:incoming>Flow_09uu75h</bpmn:incoming>
+    </bpmn:endEvent>
+    <bpmn:sequenceFlow id="Flow_0da7dao" sourceRef="Activity_0no0sxa" targetRef="Task_16983t3" />
+    <bpmn:scriptTask id="Task_1htaioi" name="Call AAI&#10;get network service instance associated with NSSI id" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1r07vnu</bpmn:incoming>
+      <bpmn:outgoing>Flow_1973d9m</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def allocateNssi = new DoAllocateCoreSharedSlice()
+allocateNssi.getNetworkInstanceAssociatedWithNssiId(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_1r07vnu" sourceRef="Activity_1264hec" targetRef="Task_1htaioi" />
+    <bpmn:scriptTask id="Activity_1264hec" name="Preprocess Request" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_1ym7ydc</bpmn:incoming>
+      <bpmn:outgoing>Flow_1r07vnu</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def allocateNssi = new DoAllocateCoreSharedSlice()
+allocateNssi.preProcessRequest(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_1973d9m" sourceRef="Task_1htaioi" targetRef="Activity_0no0sxa" />
+    <bpmn:scriptTask id="Task_16983t3" name="Prepare request payload for SO macro service call" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0da7dao</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1j1qqcs</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def allocateNssi = new DoAllocateCoreSharedSlice()
+allocateNssi.prepareSOMacroRequestPayload(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_12jcmzc" name="PUT SO Macro" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_013bc74</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_08q2fd9</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def allocateNssi = new DoAllocateCoreSharedSlice()
+allocateNssi.sendPutRequestToSOMacro(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_0ge2y0l" name="Prepare Call CheckServiceProcessStatus" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0x7shtq</bpmn:incoming>
+      <bpmn:outgoing>Flow_1c9nkx4</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def allocateNssi = new DoAllocateCoreSharedSlice()
+allocateNssi.prepareCallCheckProcessStatus(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:callActivity id="Activity_19xwwnc" name="CallCheckServiceProcessStatus" calledElement="CheckServiceProcessStatus">
+      <bpmn:extensionElements>
+        <camunda:in source="networkServiceInstanceId" target="serviceInstanceId" />
+        <camunda:in source="macroOperationId" target="operationId" />
+        <camunda:in source="successConditions" target="successConditions" />
+        <camunda:in source="errorConditions" target="errorConditions" />
+        <camunda:in source="processServiceType" target="processServiceType" />
+        <camunda:in source="timeOut" target="timeOut" />
+        <camunda:out source="operationStatus" target="result" />
+        <camunda:out source="operationContent" target="reason" />
+        <camunda:out source="WorkflowException" target="WorkflowException" />
+        <camunda:out source="isTimeOut" target="isTimeOut" />
+        <camunda:in source="subOperationType" target="operationType" />
+        <camunda:in source="initProgress" target="initProgress" />
+        <camunda:in source="endProgress" target="endProgress" />
+        <camunda:in source="serviceInstanceID" target="parentServiceInstanceId" />
+        <camunda:in source="globalSubscriberId" target="globalSubscriberId" />
+        <camunda:in source="operationId" target="parentOperationId" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_1c9nkx4</bpmn:incoming>
+      <bpmn:outgoing>Flow_0c94gye</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:sequenceFlow id="Flow_1c9nkx4" sourceRef="Activity_0ge2y0l" targetRef="Activity_19xwwnc" />
+    <bpmn:sequenceFlow id="Flow_0c94gye" sourceRef="Activity_19xwwnc" targetRef="Activity_1t49t6c" />
+    <bpmn:scriptTask id="Activity_0no0sxa" name="Get VNF/VFs modelInfo from CatalogDB" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1973d9m</bpmn:incoming>
+      <bpmn:outgoing>Flow_0da7dao</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def allocateNssi = new DoAllocateCoreSharedSlice()
+allocateNssi.getServiceVNFAndVFsFromCatalogDB(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_1t49t6c" name="Prepare Update Operation Status" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0c94gye</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1re5jor</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def allocateNssi = new DoAllocateCoreSharedSlice()
+allocateNssi.prepareUpdateResourceOperationStatus(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:serviceTask id="Activity_0t6viuq" name="Update Service 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">${updateOperationStatus}</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>SequenceFlow_1re5jor</bpmn:incoming>
+      <bpmn:incoming>Flow_1nn15tq</bpmn:incoming>
+      <bpmn:outgoing>Flow_09uu75h</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:sequenceFlow id="Flow_09uu75h" sourceRef="Activity_0t6viuq" targetRef="EndEvent_1av4kxa" />
+    <bpmn:sequenceFlow id="SequenceFlow_08q2fd9" sourceRef="Activity_12jcmzc" targetRef="Gateway_0sfmiku" />
+    <bpmn:sequenceFlow id="SequenceFlow_1re5jor" sourceRef="Activity_1t49t6c" targetRef="Activity_0t6viuq" />
+    <bpmn:sequenceFlow id="SequenceFlow_1j1qqcs" sourceRef="Task_16983t3" targetRef="IntermediateThrowEvent_09rhn4h" />
+    <bpmn:intermediateThrowEvent id="IntermediateThrowEvent_09rhn4h" name="Call SO macro api">
+      <bpmn:incoming>SequenceFlow_1j1qqcs</bpmn:incoming>
+      <bpmn:linkEventDefinition name="CallSO" />
+    </bpmn:intermediateThrowEvent>
+    <bpmn:intermediateCatchEvent id="IntermediateThrowEvent_0qh9wy2" name="Call SO macro api">
+      <bpmn:outgoing>SequenceFlow_013bc74</bpmn:outgoing>
+      <bpmn:linkEventDefinition name="CallSO" />
+    </bpmn:intermediateCatchEvent>
+    <bpmn:sequenceFlow id="SequenceFlow_013bc74" sourceRef="IntermediateThrowEvent_0qh9wy2" targetRef="Activity_12jcmzc" />
+    <bpmn:exclusiveGateway id="Gateway_0sfmiku" name="is SO Response OK?" default="Flow_0x7shtq">
+      <bpmn:incoming>SequenceFlow_08q2fd9</bpmn:incoming>
+      <bpmn:outgoing>Flow_0x7shtq</bpmn:outgoing>
+      <bpmn:outgoing>Flow_1nn15tq</bpmn:outgoing>
+    </bpmn:exclusiveGateway>
+    <bpmn:sequenceFlow id="Flow_0x7shtq" name="Yes" sourceRef="Gateway_0sfmiku" targetRef="Activity_0ge2y0l" />
+    <bpmn:sequenceFlow id="Flow_1nn15tq" name="No" sourceRef="Gateway_0sfmiku" targetRef="Activity_0t6viuq">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isSOResponseSucceed" )  == "no")}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:subProcess id="Activity_08h38js" name="Sub-process for FalloutHandler and Rollback" triggeredByEvent="true">
+      <bpmn:startEvent id="Event_07tr56z">
+        <bpmn:outgoing>Flow_0nauwik</bpmn:outgoing>
+        <bpmn:errorEventDefinition id="ErrorEventDefinition_154c21j" />
+      </bpmn:startEvent>
+      <bpmn:endEvent id="Event_02arrfq">
+        <bpmn:incoming>Flow_0y8rsb3</bpmn:incoming>
+      </bpmn:endEvent>
+      <bpmn:scriptTask id="Activity_1150yu6" name="Handle Unexpected Error" scriptFormat="groovy">
+        <bpmn:incoming>Flow_128o22z</bpmn:incoming>
+        <bpmn:outgoing>Flow_0y8rsb3</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_0sqggtb" name="Prepare Resource Operation Status Update" scriptFormat="groovy">
+        <bpmn:incoming>Flow_0nauwik</bpmn:incoming>
+        <bpmn:outgoing>Flow_0kadgoq</bpmn:outgoing>
+        <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def allocateNssi = new DoAllocateCoreSharedSlice()
+allocateNssi.prepareFailedOperationStatusUpdate(execution)</bpmn:script>
+      </bpmn:scriptTask>
+      <bpmn:serviceTask id="Activity_1btidug" 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_0kadgoq</bpmn:incoming>
+        <bpmn:outgoing>Flow_128o22z</bpmn:outgoing>
+      </bpmn:serviceTask>
+      <bpmn:sequenceFlow id="Flow_0y8rsb3" sourceRef="Activity_1150yu6" targetRef="Event_02arrfq" />
+      <bpmn:sequenceFlow id="Flow_0nauwik" sourceRef="Event_07tr56z" targetRef="Activity_0sqggtb" />
+      <bpmn:sequenceFlow id="Flow_0kadgoq" sourceRef="Activity_0sqggtb" targetRef="Activity_1btidug" />
+      <bpmn:sequenceFlow id="Flow_128o22z" sourceRef="Activity_1btidug" targetRef="Activity_1150yu6" />
+    </bpmn:subProcess>
+  </bpmn:process>
+  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoAllocateCoreSharedSlice">
+      <bpmndi:BPMNEdge id="Flow_1nn15tq_di" bpmnElement="Flow_1nn15tq">
+        <di:waypoint x="420" y="306" />
+        <di:waypoint x="420" y="360" />
+        <di:waypoint x="967" y="360" />
+        <di:waypoint x="967" y="321" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="687" y="342" width="14" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0x7shtq_di" bpmnElement="Flow_0x7shtq">
+        <di:waypoint x="445" y="281" />
+        <di:waypoint x="484" y="281" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="456" y="263" width="18" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_013bc74_di" bpmnElement="SequenceFlow_013bc74">
+        <di:waypoint x="218" y="281" />
+        <di:waypoint x="260" y="281" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="252" y="340" width="0" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1j1qqcs_di" bpmnElement="SequenceFlow_1j1qqcs">
+        <di:waypoint x="896" y="120" />
+        <di:waypoint x="949" y="120" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="862.5" y="179" width="0" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1re5jor_di" bpmnElement="SequenceFlow_1re5jor">
+        <di:waypoint x="878" y="281" />
+        <di:waypoint x="917" y="281" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="837.5" y="340" width="0" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_08q2fd9_di" bpmnElement="SequenceFlow_08q2fd9">
+        <di:waypoint x="360" y="281" />
+        <di:waypoint x="395" y="281" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="402" y="340" width="0" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_09uu75h_di" bpmnElement="Flow_09uu75h">
+        <di:waypoint x="1017" y="281" />
+        <di:waypoint x="1056" y="281" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="931.5" y="336" width="90" height="20" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0c94gye_di" bpmnElement="Flow_0c94gye">
+        <di:waypoint x="736" y="281" />
+        <di:waypoint x="778" y="281" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="652" y="336" width="90" height="20" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1c9nkx4_di" bpmnElement="Flow_1c9nkx4">
+        <di:waypoint x="584" y="281" />
+        <di:waypoint x="636" y="281" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="505" y="336" width="90" height="20" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1973d9m_di" bpmnElement="Flow_1973d9m">
+        <di:waypoint x="600" y="120" />
+        <di:waypoint x="654" y="120" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="522" y="175" width="90" height="20" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1r07vnu_di" bpmnElement="Flow_1r07vnu">
+        <di:waypoint x="440" y="120" />
+        <di:waypoint x="500" y="120" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0da7dao_di" bpmnElement="Flow_0da7dao">
+        <di:waypoint x="754" y="120" />
+        <di:waypoint x="796" y="120" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="670" y="175" width="90" height="20" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1ym7ydc_di" bpmnElement="SequenceFlow_1ym7ydc">
+        <di:waypoint x="284" y="120" />
+        <di:waypoint x="340" y="120" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="207" y="179" width="90" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
+        <dc:Bounds x="248" y="102" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="254" y="145" width="25" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="EndEvent_1av4kxa_di" bpmnElement="EndEvent_1av4kxa">
+        <dc:Bounds x="1056" y="263" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1064" y="306" width="20" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_16cbdb6_di" bpmnElement="Task_1htaioi">
+        <dc:Bounds x="500" y="80" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1wo5rx5_di" bpmnElement="Activity_1264hec">
+        <dc:Bounds x="340" y="80" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0csnjjc_di" bpmnElement="Task_16983t3">
+        <dc:Bounds x="796" y="80" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_05dh84g_di" bpmnElement="Activity_12jcmzc">
+        <dc:Bounds x="260" y="241" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0ge2y0l_di" bpmnElement="Activity_0ge2y0l">
+        <dc:Bounds x="484" y="241" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_19xwwnc_di" bpmnElement="Activity_19xwwnc">
+        <dc:Bounds x="636" y="241" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0k70k5i_di" bpmnElement="Activity_0no0sxa">
+        <dc:Bounds x="654" y="80" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0mb2ssd_di" bpmnElement="Activity_1t49t6c">
+        <dc:Bounds x="778" y="241" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0t6viuq_di" bpmnElement="Activity_0t6viuq">
+        <dc:Bounds x="917" y="241" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="IntermediateThrowEvent_06785ru_di" bpmnElement="IntermediateThrowEvent_09rhn4h">
+        <dc:Bounds x="949" y="102" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="923" y="142" width="90" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="IntermediateCatchEvent_09u3rdp_di" bpmnElement="IntermediateThrowEvent_0qh9wy2">
+        <dc:Bounds x="182" y="263" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="156" y="303" width="90" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Gateway_0sfmiku_di" bpmnElement="Gateway_0sfmiku" isMarkerVisible="true">
+        <dc:Bounds x="395" y="256" width="50" height="50" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="380" y="226" width="80" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_08h38js_di" bpmnElement="Activity_08h38js" isExpanded="true">
+        <dc:Bounds x="250" y="440" width="781" height="196" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="Flow_128o22z_di" bpmnElement="Flow_128o22z">
+        <di:waypoint x="640" y="544" />
+        <di:waypoint x="710" y="544" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0kadgoq_di" bpmnElement="Flow_0kadgoq">
+        <di:waypoint x="480" y="544" />
+        <di:waypoint x="540" y="544" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0nauwik_di" bpmnElement="Flow_0nauwik">
+        <di:waypoint x="316" y="544" />
+        <di:waypoint x="380" y="544" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0y8rsb3_di" bpmnElement="Flow_0y8rsb3">
+        <di:waypoint x="810" y="544" />
+        <di:waypoint x="918" y="544" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="Event_07tr56z_di" bpmnElement="Event_07tr56z">
+        <dc:Bounds x="280" y="526" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_02arrfq_di" bpmnElement="Event_02arrfq">
+        <dc:Bounds x="918" y="526" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1150yu6_di" bpmnElement="Activity_1150yu6">
+        <dc:Bounds x="710" y="504" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0sqggtb_di" bpmnElement="Activity_0sqggtb">
+        <dc:Bounds x="380" y="504" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1btidug_di" bpmnElement="Activity_1btidug">
+        <dc:Bounds x="540" y="504" width="100" height="80" />
+      </bpmndi:BPMNShape>
+    </bpmndi:BPMNPlane>
+  </bpmndi:BPMNDiagram>
+</bpmn:definitions>
index 9c090e0..e42f001 100644 (file)
 <?xml version="1.0" encoding="UTF-8"?>
-<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="2.2.3">
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.4.1">
   <bpmn:process id="DoAllocateNSIandNSSI" name="DoAllocateNSIandNSSI" isExecutable="true">
-    <bpmn:scriptTask id="Task_09nzhwk" name="Generate NSI and create NSI in AAI with E2ESS and NSI relationship" scriptFormat="groovy">
-      <bpmn:incoming>SequenceFlow_1e40h52</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_1uiz85h</bpmn:outgoing>
+    <bpmn:startEvent id="StartEvent_1ym3sha" name="Start">
+      <bpmn:outgoing>SequenceFlow_0xgfj7z</bpmn:outgoing>
+    </bpmn:startEvent>
+    <bpmn:sequenceFlow id="SequenceFlow_0xgfj7z" sourceRef="StartEvent_1ym3sha" targetRef="Task_027u6m6" />
+    <bpmn:scriptTask id="Task_027u6m6" name="Preprocess Request" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_0xgfj7z</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_00aukg6</bpmn:outgoing>
       <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
-def dcnsio = new DoAllocateNSIandNSSI()
-dcnsio.createNSIinAAI(execution)</bpmn:script>
+def dansi = new DoAllocateNSIandNSSI()
+dansi.preProcessRequest(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="ScriptTask_0qorxd9" name="Process NSI options" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_00aukg6</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1ggo6s5</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dansi = new DoAllocateNSIandNSSI()
+dansi.retriveSliceOption(execution)</bpmn:script>
     </bpmn:scriptTask>
-    <bpmn:exclusiveGateway id="ExclusiveGateway_0b9d9l0" name="Is nsi option available?" default="SequenceFlow_1h5bw41">
-      <bpmn:incoming>SequenceFlow_0dj0jvq</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_1h5bw41</bpmn:outgoing>
-      <bpmn:outgoing>SequenceFlow_0ueeeca</bpmn:outgoing>
+    <bpmn:sequenceFlow id="SequenceFlow_00aukg6" sourceRef="Task_027u6m6" targetRef="ScriptTask_0qorxd9" />
+    <bpmn:exclusiveGateway id="ExclusiveGateway_00pt1ek" name="Is nsi option available?" default="SequenceFlow_0c986i9">
+      <bpmn:incoming>SequenceFlow_1ggo6s5</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0c986i9</bpmn:outgoing>
+      <bpmn:outgoing>SequenceFlow_03ye8m4</bpmn:outgoing>
     </bpmn:exclusiveGateway>
-    <bpmn:scriptTask id="ScriptTask_1ehyrsg" name="Update AAI relationship for E2ESS and NSI" scriptFormat="groovy">
-      <bpmn:incoming>SequenceFlow_0ueeeca</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_0xfhbqw</bpmn:outgoing>
+    <bpmn:sequenceFlow id="SequenceFlow_1ggo6s5" sourceRef="ScriptTask_0qorxd9" targetRef="ExclusiveGateway_00pt1ek" />
+    <bpmn:sequenceFlow id="SequenceFlow_0c986i9" sourceRef="ExclusiveGateway_00pt1ek" targetRef="ScriptTask_1tizl6b" />
+    <bpmn:scriptTask id="ScriptTask_1tizl6b" name="create NSI in AAI and Update relationship" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_0c986i9</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1k3cspv</bpmn:outgoing>
       <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
-def dcsi = new DoAllocateNSIandNSSI()
-dcsi.updateRelationship(execution)</bpmn:script>
+def dcnsio = new DoAllocateNSIandNSSI()
+dcnsio.createNSIinAAI(execution)</bpmn:script>
     </bpmn:scriptTask>
-    <bpmn:callActivity id="CallActivity_1s23hty" name="Call Decompose Service" calledElement="DecomposeService">
+    <bpmn:sequenceFlow id="SequenceFlow_1k3cspv" sourceRef="ScriptTask_1tizl6b" targetRef="ScriptTask_1r6kuwy" />
+    <bpmn:sequenceFlow id="SequenceFlow_03ye8m4" sourceRef="ExclusiveGateway_00pt1ek" targetRef="ScriptTask_07sgklo">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isNSIOptionAvailable" )  == true)}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:intermediateThrowEvent id="IntermediateThrowEvent_0fx1nyj" name="GoTo Create Slice Profile">
+      <bpmn:incoming>SequenceFlow_0t0wddg</bpmn:incoming>
+      <bpmn:incoming>SequenceFlow_05ovikm</bpmn:incoming>
+      <bpmn:linkEventDefinition name="CreateSliceProfile" />
+    </bpmn:intermediateThrowEvent>
+    <bpmn:intermediateCatchEvent id="IntermediateThrowEvent_0k54pph" name="Create Slice Profile">
+      <bpmn:outgoing>SequenceFlow_0ct8yh4</bpmn:outgoing>
+      <bpmn:linkEventDefinition name="CreateSliceProfile" />
+    </bpmn:intermediateCatchEvent>
+    <bpmn:sequenceFlow id="SequenceFlow_0ct8yh4" sourceRef="IntermediateThrowEvent_0k54pph" targetRef="ExclusiveGateway_00ufetn" />
+    <bpmn:parallelGateway id="ExclusiveGateway_00ufetn">
+      <bpmn:incoming>SequenceFlow_0ct8yh4</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1m68yca</bpmn:outgoing>
+      <bpmn:outgoing>SequenceFlow_0k5iu2n</bpmn:outgoing>
+    </bpmn:parallelGateway>
+    <bpmn:sequenceFlow id="SequenceFlow_1m68yca" sourceRef="ExclusiveGateway_00ufetn" targetRef="Task_1tv7jy5" />
+    <bpmn:sequenceFlow id="SequenceFlow_0k5iu2n" sourceRef="ExclusiveGateway_00ufetn" targetRef="Task_1en3luv" />
+    <bpmn:callActivity id="CallActivity_1yh9tiq" name="Call DoAllocateNSSI(RAN)" calledElement="DoAllocateNSSI">
       <bpmn:extensionElements>
         <camunda:in source="msoRequestId" target="msoRequestId" />
-        <camunda:in source="serviceInstanceId" target="serviceInstanceId" />
-        <camunda:in source="serviceModelInfo" target="serviceModelInfo" />
-        <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" />
         <camunda:out source="serviceDecomposition" target="serviceDecomposition" />
         <camunda:out source="WorkflowException" target="WorkflowException" />
+        <camunda:in source="nsstInput" target="nsstInput" />
+        <camunda:in source="serviceProfile" target="serviceProfile" />
+        <camunda:in source="sliceProfileTn" target="sliceProfileTn" />
+        <camunda:in source="sliceProfileCn" target="sliceProfileCn" />
+        <camunda:in source="sliceProfileAn" target="sliceProfileAn" />
+        <camunda:in source="globalSubscriberId" target="globalSubscriberId" />
+        <camunda:in source="subscriptionServiceType" target="subscriptionServiceType" />
+        <camunda:in source="uuiRequest" target="uuiRequest" />
+        <camunda:in source="nsiServiceInstanceId" target="nsiServiceInstanceId" />
+        <camunda:in source="nsiServiceInstanceName" target="nsiServiceInstanceName" />
+        <camunda:in source="nssiserviceModelInfo" target="nssiserviceModelInfo" />
+        <camunda:in source="sliceTaskParams" target="sliceTaskParams" />
+        <camunda:in source="taskId" target="CSSOT_taskId" />
+        <camunda:in source="taskName" target="CSSOT_name" />
+        <camunda:in source="taskStatus" target="CSSOT_status" />
+        <camunda:in source="isManual" target="CSSOT_isManual" />
+        <camunda:in source="isNSIOptionAvailable" target="isNSIOptionAvailable" />
+        <camunda:in source="anSliceTaskInfo" target="sliceTaskInfo" />
+        <camunda:out source="nssiAllocateResult" target="anNssiAllocateResult" />
+        <camunda:in source="AnAllocateNssiNbiRequest" target="nbiRequest" />
       </bpmn:extensionElements>
-      <bpmn:incoming>SequenceFlow_1h5bw41</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_1e40h52</bpmn:outgoing>
+      <bpmn:incoming>SequenceFlow_0npsyye</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1xb5nx1</bpmn:outgoing>
     </bpmn:callActivity>
-    <bpmn:scriptTask id="ScriptTask_1q3ftu4" name="Prepare NSSI model info and instance id" scriptFormat="groovy">
-      <bpmn:incoming>SequenceFlow_0xfhbqw</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_0uhaps2</bpmn:outgoing>
-      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
-def dcsi = new DoAllocateNSIandNSSI()
-dcsi.prepareNssiModelInfo(execution)</bpmn:script>
-    </bpmn:scriptTask>
-    <bpmn:startEvent id="allocateslice_StartEvent" name="allocatensi_StartEvent">
-      <bpmn:outgoing>SequenceFlow_1qo2pln</bpmn:outgoing>
-    </bpmn:startEvent>
-    <bpmn:scriptTask id="PreprocessIncomingRequest_task" name="Preprocess Request" scriptFormat="groovy">
-      <bpmn:incoming>SequenceFlow_1qo2pln</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_0khtova</bpmn:outgoing>
-      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
-def dcso = new DoAllocateNSIandNSSI()
-dcso.preProcessRequest(execution)</bpmn:script>
-    </bpmn:scriptTask>
-    <bpmn:scriptTask id="ScriptTask_0o93dvp" name="read NSI options from request DB" scriptFormat="groovy">
-      <bpmn:incoming>SequenceFlow_0khtova</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_0dj0jvq</bpmn:outgoing>
-      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
-def dansi = new DoAllocateNSIandNSSI()
-dansi.retriveSliceOption(execution)</bpmn:script>
-    </bpmn:scriptTask>
-    <bpmn:callActivity id="CallActivity_1k1oonn" name="Call Decompose Service" calledElement="DecomposeService">
+    <bpmn:sequenceFlow id="SequenceFlow_1hfjn79" sourceRef="Task_1tv7jy5" targetRef="ScriptTask_1r2li91" />
+    <bpmn:callActivity id="CallActivity_1ixah3o" name="Call DoAllocateNSSI(Core)" calledElement="DoAllocateNSSI">
       <bpmn:extensionElements>
         <camunda:in source="msoRequestId" target="msoRequestId" />
-        <camunda:in source="serviceInstanceId" target="serviceInstanceId" />
-        <camunda:in source="serviceModelInfo" target="serviceModelInfo" />
-        <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" />
         <camunda:out source="serviceDecomposition" target="serviceDecomposition" />
         <camunda:out source="WorkflowException" target="WorkflowException" />
+        <camunda:in source="nsstInput" target="nsstInput" />
+        <camunda:in source="serviceProfile" target="serviceProfile" />
+        <camunda:in source="sliceProfileTn" target="sliceProfileTn" />
+        <camunda:in source="sliceProfileCn" target="sliceProfileCn" />
+        <camunda:in source="sliceProfileAn" target="sliceProfileAn" />
+        <camunda:in source="globalSubscriberId" target="globalSubscriberId" />
+        <camunda:in source="subscriptionServiceType" target="subscriptionServiceType" />
+        <camunda:in source="uuiRequest" target="uuiRequest" />
+        <camunda:in source="nsiServiceInstanceId" target="nsiServiceInstanceId" />
+        <camunda:in source="nsiServiceInstanceName" target="nsiServiceInstanceName" />
+        <camunda:in source="nssiserviceModelInfo" target="nssiserviceModelInfo" />
+        <camunda:in source="sliceTaskParams" target="sliceTaskParams" />
+        <camunda:in source="taskId" target="CSSOT_taskId" />
+        <camunda:in source="taskName" target="CSSOT_name" />
+        <camunda:in source="taskStatus" target="CSSOT_status" />
+        <camunda:in source="isManual" target="CSSOT_isManual" />
+        <camunda:in source="isNSIOptionAvailable" target="isNSIOptionAvailable" />
+        <camunda:in source="cnSliceTaskInfo" target="sliceTaskInfo" />
+        <camunda:in source="domainType" target="domainType" />
+        <camunda:out source="nssiAllocateResult" target="cnNssiAllocateResult" />
+        <camunda:in source="CnAllocateNssiNbiRequest" target="nbiRequest" />
       </bpmn:extensionElements>
-      <bpmn:incoming>SequenceFlow_1dhpkhd</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_0hxky5e</bpmn:outgoing>
+      <bpmn:incoming>SequenceFlow_0cwbtmr</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1l74seh</bpmn:outgoing>
     </bpmn:callActivity>
-    <bpmn:scriptTask id="ScriptTask_0gunols" name="Get one NSST Info" scriptFormat="groovy">
-      <bpmn:incoming>SequenceFlow_1uiz85h</bpmn:incoming>
-      <bpmn:incoming>SequenceFlow_1ui528w</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_1dhpkhd</bpmn:outgoing>
+    <bpmn:sequenceFlow id="SequenceFlow_0f36cu2" sourceRef="Task_1en3luv" targetRef="Task_1g8n8iz" />
+    <bpmn:sequenceFlow id="SequenceFlow_1xb5nx1" sourceRef="CallActivity_1yh9tiq" targetRef="ScriptTask_0mls87v" />
+    <bpmn:parallelGateway id="ExclusiveGateway_19ru3hp">
+      <bpmn:incoming>SequenceFlow_0xx5bwa</bpmn:incoming>
+      <bpmn:incoming>SequenceFlow_0jqxxjq</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0ax2c4p</bpmn:outgoing>
+    </bpmn:parallelGateway>
+    <bpmn:scriptTask id="ScriptTask_07sgklo" name="Update relationship between NSI and Service Profile" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_03ye8m4</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0t0wddg</bpmn:outgoing>
       <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
 def dcnsio = new DoAllocateNSIandNSSI()
-dcnsio.getOneNsstInfo(execution)</bpmn:script>
+dcnsio.updateRelationship(execution)</bpmn:script>
     </bpmn:scriptTask>
-    <bpmn:scriptTask id="ScriptTask_1lpgn98" name="prepare NSST Info" scriptFormat="groovy">
-      <bpmn:incoming>SequenceFlow_0hxky5e</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_19jztxv</bpmn:outgoing>
+    <bpmn:sequenceFlow id="SequenceFlow_0t0wddg" sourceRef="ScriptTask_07sgklo" targetRef="IntermediateThrowEvent_0fx1nyj" />
+    <bpmn:scriptTask id="ScriptTask_1r6kuwy" name="create relationship between nsi and SP" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_1k3cspv</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_05ovikm</bpmn:outgoing>
       <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
 def dcnsio = new DoAllocateNSIandNSSI()
-dcnsio.createNSSTMap(execution)</bpmn:script>
+dcnsio.createRelationship(execution)</bpmn:script>
     </bpmn:scriptTask>
-    <bpmn:endEvent id="EndEvent_1x6k78c">
-      <bpmn:incoming>SequenceFlow_0u8fycy</bpmn:incoming>
-    </bpmn:endEvent>
-    <bpmn:scriptTask id="finishNSCreate_Task" name="Get a NSSI to process" scriptFormat="groovy">
-      <bpmn:incoming>SequenceFlow_16nvnxi</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_0cq2q6g</bpmn:outgoing>
+    <bpmn:sequenceFlow id="SequenceFlow_05ovikm" sourceRef="ScriptTask_1r6kuwy" targetRef="IntermediateThrowEvent_0fx1nyj" />
+    <bpmn:scriptTask id="Task_1tv7jy5" name="Create RAN Slice Profile Instance" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_1m68yca</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1hfjn79</bpmn:outgoing>
       <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
-def dcsi = new DoAllocateNSIandNSSI()
-dcsi.getOneNSSIInfo(execution)</bpmn:script>
+def dcnsio = new DoAllocateNSIandNSSI()
+dcnsio.createAnSliceProfileInstance(execution)</bpmn:script>
     </bpmn:scriptTask>
-    <bpmn:exclusiveGateway id="ExclusiveGateway_07qkrrb" name="Is there more NSSI to process?" default="SequenceFlow_0u8fycy">
-      <bpmn:incoming>SequenceFlow_0g5bwvl</bpmn:incoming>
-      <bpmn:incoming>SequenceFlow_1jaxstd</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_16nvnxi</bpmn:outgoing>
-      <bpmn:outgoing>SequenceFlow_0u8fycy</bpmn:outgoing>
-    </bpmn:exclusiveGateway>
-    <bpmn:callActivity id="CallActivity_130tuxn" name="Call DoAllocateNSSI" calledElement="DoAllocateNSSI">
+    <bpmn:scriptTask id="ScriptTask_1r2li91" name="Create RAN Slice Profile" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_1hfjn79</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0zbd2tq</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcnsio = new DoAllocateNSIandNSSI()
+dcnsio.createAnSliceProfile(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="SequenceFlow_0zbd2tq" sourceRef="ScriptTask_1r2li91" targetRef="ScriptTask_0s8vhha" />
+    <bpmn:scriptTask id="Task_1en3luv" name="Create Core Slice Profile Instance" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_0k5iu2n</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0f36cu2</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcnsio = new DoAllocateNSIandNSSI()
+dcnsio.createCnSliceProfileInstance(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Task_1g8n8iz" name="Create Core Slice Profile" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_0f36cu2</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1wffel4</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcnsio = new DoAllocateNSIandNSSI()
+dcnsio.createCnSliceProfile(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="SequenceFlow_0ax2c4p" sourceRef="ExclusiveGateway_19ru3hp" targetRef="EndEvent_02c8wsp" />
+    <bpmn:scriptTask id="ScriptTask_0stnvp3" name="Create TN (BH) Slice Profile" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_0paqrtx</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1d48cil</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcnsio = new DoAllocateNSIandNSSI()
+dcnsio.createTnBHSliceProfileInstance(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="ScriptTask_1f4o46q" name="Create TN(BH) Slice Profile" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_1d48cil</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_00dexhy</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcnsio = new DoAllocateNSIandNSSI()
+dcnsio.createTnBHSliceProfile(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:callActivity id="CallActivity_0b28wlb" name="Call DoAllocateNSSI(TN)" calledElement="DoAllocateNSSI">
       <bpmn:extensionElements>
         <camunda:in source="msoRequestId" target="msoRequestId" />
         <camunda:out source="serviceDecomposition" target="serviceDecomposition" />
@@ -121,241 +204,305 @@ dcsi.getOneNSSIInfo(execution)</bpmn:script>
         <camunda:in source="taskStatus" target="CSSOT_status" />
         <camunda:in source="isManual" target="CSSOT_isManual" />
         <camunda:in source="isNSIOptionAvailable" target="isNSIOptionAvailable" />
+        <camunda:in source="tnBHSliceTaskInfo" target="sliceTaskInfo" />
+        <camunda:out source="nssiAllocateResult" target="tnBHNssiAllocateResult" />
+        <camunda:in source="TnBHAllocateNssiNbiRequest" target="nbiRequest" />
       </bpmn:extensionElements>
-      <bpmn:incoming>SequenceFlow_0cq2q6g</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_00b8ryw</bpmn:outgoing>
+      <bpmn:incoming>SequenceFlow_01isn2q</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1omynpt</bpmn:outgoing>
     </bpmn:callActivity>
-    <bpmn:scriptTask id="ScriptTask_0anyn7v" name="Update current Index" scriptFormat="groovy">
-      <bpmn:incoming>SequenceFlow_00b8ryw</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_1jaxstd</bpmn:outgoing>
+    <bpmn:sequenceFlow id="SequenceFlow_1d48cil" sourceRef="ScriptTask_0stnvp3" targetRef="ScriptTask_1f4o46q" />
+    <bpmn:sequenceFlow id="SequenceFlow_00dexhy" sourceRef="ScriptTask_1f4o46q" targetRef="ScriptTask_0ci5g6y" />
+    <bpmn:intermediateCatchEvent id="IntermediateCatchEvent_08wpvhs" name="Create Tn SliceProfile">
+      <bpmn:outgoing>SequenceFlow_0paqrtx</bpmn:outgoing>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_1beugxy" name="CreateTnSliceProfile" />
+    </bpmn:intermediateCatchEvent>
+    <bpmn:sequenceFlow id="SequenceFlow_0paqrtx" sourceRef="IntermediateCatchEvent_08wpvhs" targetRef="ScriptTask_0stnvp3" />
+    <bpmn:scriptTask id="ScriptTask_0sssiii" name="Update relationship between NSI and NSSI" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_1omynpt</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_150xio1</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcnsio = new DoAllocateNSIandNSSI()
+dcnsio.updateTnBHRelationship(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="SequenceFlow_150xio1" sourceRef="ScriptTask_0sssiii" targetRef="EndEvent_0elqlhv" />
+    <bpmn:scriptTask id="ScriptTask_0mls87v" name="Update relationship between NSI and NSSI" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_1xb5nx1</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0xx5bwa</bpmn:outgoing>
       <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
-def dcsi = new DoAllocateNSIandNSSI()
-dcsi.updateCurrentIndex(execution)</bpmn:script>
+def dcnsio = new DoAllocateNSIandNSSI()
+dcnsio.updateAnRelationship(execution)</bpmn:script>
     </bpmn:scriptTask>
-    <bpmn:scriptTask id="instantiate_NSTask" name="Prepare NSSI list (with and without shared NSSI)" scriptFormat="groovy">
-      <bpmn:incoming>SequenceFlow_0uhaps2</bpmn:incoming>
-      <bpmn:incoming>SequenceFlow_04yx9ii</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_0g5bwvl</bpmn:outgoing>
+    <bpmn:sequenceFlow id="SequenceFlow_0xx5bwa" sourceRef="ScriptTask_0mls87v" targetRef="ExclusiveGateway_19ru3hp" />
+    <bpmn:scriptTask id="ScriptTask_0z9x5uh" name="Update relationship between NSI and NSSI" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_1l74seh</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0jqxxjq</bpmn:outgoing>
       <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
-def dcso = new DoAllocateNSIandNSSI()
-dcso.prepareNSSIList(execution)</bpmn:script>
+def dcnsio = new DoAllocateNSIandNSSI()
+dcnsio.updateCnRelationship(execution)</bpmn:script>
     </bpmn:scriptTask>
-    <bpmn:exclusiveGateway id="ExclusiveGateway_1jg3el3" name="Is NSST available?" default="SequenceFlow_04yx9ii">
-      <bpmn:incoming>SequenceFlow_19jztxv</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_04yx9ii</bpmn:outgoing>
-      <bpmn:outgoing>SequenceFlow_1ui528w</bpmn:outgoing>
-    </bpmn:exclusiveGateway>
-    <bpmn:sequenceFlow id="SequenceFlow_0uhaps2" sourceRef="ScriptTask_1q3ftu4" targetRef="instantiate_NSTask" />
-    <bpmn:sequenceFlow id="SequenceFlow_1e40h52" sourceRef="CallActivity_1s23hty" targetRef="Task_09nzhwk" />
-    <bpmn:sequenceFlow id="SequenceFlow_0xfhbqw" sourceRef="ScriptTask_1ehyrsg" targetRef="ScriptTask_1q3ftu4" />
-    <bpmn:sequenceFlow id="SequenceFlow_0dj0jvq" sourceRef="ScriptTask_0o93dvp" targetRef="ExclusiveGateway_0b9d9l0" />
-    <bpmn:sequenceFlow id="SequenceFlow_0ueeeca" name="Yes" sourceRef="ExclusiveGateway_0b9d9l0" targetRef="ScriptTask_1ehyrsg">
-      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isNSIOptionAvailable" )  == true)}</bpmn:conditionExpression>
-    </bpmn:sequenceFlow>
-    <bpmn:sequenceFlow id="SequenceFlow_1h5bw41" name="No" sourceRef="ExclusiveGateway_0b9d9l0" targetRef="CallActivity_1s23hty" />
-    <bpmn:sequenceFlow id="SequenceFlow_1uiz85h" sourceRef="Task_09nzhwk" targetRef="ScriptTask_0gunols" />
-    <bpmn:sequenceFlow id="SequenceFlow_1qo2pln" sourceRef="allocateslice_StartEvent" targetRef="PreprocessIncomingRequest_task" />
-    <bpmn:sequenceFlow id="SequenceFlow_0khtova" sourceRef="PreprocessIncomingRequest_task" targetRef="ScriptTask_0o93dvp" />
-    <bpmn:sequenceFlow id="SequenceFlow_0g5bwvl" sourceRef="instantiate_NSTask" targetRef="ExclusiveGateway_07qkrrb" />
-    <bpmn:sequenceFlow id="SequenceFlow_0hxky5e" sourceRef="CallActivity_1k1oonn" targetRef="ScriptTask_1lpgn98" />
-    <bpmn:sequenceFlow id="SequenceFlow_1dhpkhd" sourceRef="ScriptTask_0gunols" targetRef="CallActivity_1k1oonn" />
-    <bpmn:sequenceFlow id="SequenceFlow_19jztxv" sourceRef="ScriptTask_1lpgn98" targetRef="ExclusiveGateway_1jg3el3" />
-    <bpmn:sequenceFlow id="SequenceFlow_0u8fycy" name="No" sourceRef="ExclusiveGateway_07qkrrb" targetRef="EndEvent_1x6k78c" />
-    <bpmn:sequenceFlow id="SequenceFlow_16nvnxi" name="Yes" sourceRef="ExclusiveGateway_07qkrrb" targetRef="finishNSCreate_Task">
-      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isMoreNSSI" )  == true)}</bpmn:conditionExpression>
-    </bpmn:sequenceFlow>
-    <bpmn:sequenceFlow id="SequenceFlow_0cq2q6g" sourceRef="finishNSCreate_Task" targetRef="CallActivity_130tuxn" />
-    <bpmn:sequenceFlow id="SequenceFlow_1jaxstd" sourceRef="ScriptTask_0anyn7v" targetRef="ExclusiveGateway_07qkrrb" />
-    <bpmn:sequenceFlow id="SequenceFlow_00b8ryw" sourceRef="CallActivity_130tuxn" targetRef="ScriptTask_0anyn7v" />
-    <bpmn:sequenceFlow id="SequenceFlow_04yx9ii" name="No" sourceRef="ExclusiveGateway_1jg3el3" targetRef="instantiate_NSTask" />
-    <bpmn:sequenceFlow id="SequenceFlow_1ui528w" sourceRef="ExclusiveGateway_1jg3el3" targetRef="ScriptTask_0gunols">
-      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isMoreNSSTtoProcess" )  == true)}</bpmn:conditionExpression>
-    </bpmn:sequenceFlow>
+    <bpmn:sequenceFlow id="SequenceFlow_1l74seh" sourceRef="CallActivity_1ixah3o" targetRef="ScriptTask_0z9x5uh" />
+    <bpmn:sequenceFlow id="SequenceFlow_0jqxxjq" sourceRef="ScriptTask_0z9x5uh" targetRef="ExclusiveGateway_19ru3hp" />
+    <bpmn:sequenceFlow id="SequenceFlow_1omynpt" sourceRef="CallActivity_0b28wlb" targetRef="ScriptTask_0sssiii" />
+    <bpmn:endEvent id="EndEvent_0elqlhv">
+      <bpmn:incoming>SequenceFlow_150xio1</bpmn:incoming>
+    </bpmn:endEvent>
+    <bpmn:intermediateThrowEvent id="EndEvent_02c8wsp" name="GoTo Create Tn SliceProfile">
+      <bpmn:incoming>SequenceFlow_0ax2c4p</bpmn:incoming>
+      <bpmn:linkEventDefinition name="CreateTnSliceProfile" />
+    </bpmn:intermediateThrowEvent>
+    <bpmn:scriptTask id="ScriptTask_0s8vhha" name="prepare Allocate An Nssi" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_0zbd2tq</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0npsyye</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcnsio = new DoAllocateNSIandNSSI()
+dcnsio.prepareAllocateAnNssi(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="SequenceFlow_0npsyye" sourceRef="ScriptTask_0s8vhha" targetRef="CallActivity_1yh9tiq" />
+    <bpmn:scriptTask id="ScriptTask_0z0ec5b" name="prepare Allocate Cn Nssi" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_1wffel4</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0cwbtmr</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcnsio = new DoAllocateNSIandNSSI()
+dcnsio.prepareAllocateCnNssi(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="SequenceFlow_0cwbtmr" sourceRef="ScriptTask_0z0ec5b" targetRef="CallActivity_1ixah3o" />
+    <bpmn:sequenceFlow id="SequenceFlow_1wffel4" sourceRef="Task_1g8n8iz" targetRef="ScriptTask_0z0ec5b" />
+    <bpmn:scriptTask id="ScriptTask_0ci5g6y" name="prepare Allocate Tn-BH Nssi" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_00dexhy</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_01isn2q</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcnsio = new DoAllocateNSIandNSSI()
+dcnsio.prepareAllocateTnBHNssi(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="SequenceFlow_01isn2q" sourceRef="ScriptTask_0ci5g6y" targetRef="CallActivity_0b28wlb" />
   </bpmn:process>
+  <bpmn:message id="Message_1i10pf1" name="Message_2mc69tg" />
   <bpmndi:BPMNDiagram id="BPMNDiagram_1">
-    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoAllocateNSIandNSSI">
-      <bpmndi:BPMNEdge id="SequenceFlow_0uhaps2_di" bpmnElement="SequenceFlow_0uhaps2">
-        <di:waypoint x="978" y="350" />
-        <di:waypoint x="1736" y="350" />
-        <di:waypoint x="1736" y="487" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_1e40h52_di" bpmnElement="SequenceFlow_1e40h52">
-        <di:waypoint x="799" y="527" />
-        <di:waypoint x="878" y="527" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_0xfhbqw_di" bpmnElement="SequenceFlow_0xfhbqw">
-        <di:waypoint x="799" y="350" />
-        <di:waypoint x="878" y="350" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_0dj0jvq_di" bpmnElement="SequenceFlow_0dj0jvq">
-        <di:waypoint x="520" y="527" />
-        <di:waypoint x="583" y="527" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_0ueeeca_di" bpmnElement="SequenceFlow_0ueeeca">
-        <di:waypoint x="608" y="502" />
-        <di:waypoint x="608" y="350" />
-        <di:waypoint x="699" y="350" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="584" y="422" width="19" height="14" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_1h5bw41_di" bpmnElement="SequenceFlow_1h5bw41">
-        <di:waypoint x="633" y="527" />
-        <di:waypoint x="699" y="527" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="630" y="509" width="14" height="14" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_1uiz85h_di" bpmnElement="SequenceFlow_1uiz85h">
-        <di:waypoint x="978" y="527" />
-        <di:waypoint x="1036" y="527" />
+    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoAllocateNSIandNSSIV2">
+      <bpmndi:BPMNShape id="StartEvent_1ym3sha_di" bpmnElement="StartEvent_1ym3sha">
+        <dc:Bounds x="138" y="122" width="36" height="36" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="631" y="108" width="0" height="12" />
+          <dc:Bounds x="144" y="165" width="25" height="14" />
         </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_0xgfj7z_di" bpmnElement="SequenceFlow_0xgfj7z">
+        <di:waypoint x="174" y="140" />
+        <di:waypoint x="224" y="140" />
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_1qo2pln_di" bpmnElement="SequenceFlow_1qo2pln">
-        <di:waypoint x="210" y="527" />
-        <di:waypoint x="268" y="527" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="266" y="123" width="0" height="12" />
-        </bpmndi:BPMNLabel>
+      <bpmndi:BPMNShape id="ScriptTask_0q0td74_di" bpmnElement="Task_027u6m6">
+        <dc:Bounds x="224" y="100" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_0qorxd9_di" bpmnElement="ScriptTask_0qorxd9">
+        <dc:Bounds x="404" y="100" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_00aukg6_di" bpmnElement="SequenceFlow_00aukg6">
+        <di:waypoint x="324" y="140" />
+        <di:waypoint x="404" y="140" />
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_0khtova_di" bpmnElement="SequenceFlow_0khtova">
-        <di:waypoint x="368" y="527" />
-        <di:waypoint x="420" y="527" />
+      <bpmndi:BPMNShape id="ExclusiveGateway_00pt1ek_di" bpmnElement="ExclusiveGateway_00pt1ek" isMarkerVisible="true">
+        <dc:Bounds x="609" y="115" width="50" height="50" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="436" y="108" width="0" height="12" />
+          <dc:Bounds x="604" y="78" width="59" height="27" />
         </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_1ggo6s5_di" bpmnElement="SequenceFlow_1ggo6s5">
+        <di:waypoint x="504" y="140" />
+        <di:waypoint x="609" y="140" />
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_0g5bwvl_di" bpmnElement="SequenceFlow_0g5bwvl">
-        <di:waypoint x="1786" y="527" />
-        <di:waypoint x="1871" y="527" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_0hxky5e_di" bpmnElement="SequenceFlow_0hxky5e">
-        <di:waypoint x="1300" y="527" />
-        <di:waypoint x="1388" y="527" />
+      <bpmndi:BPMNEdge id="SequenceFlow_0c986i9_di" bpmnElement="SequenceFlow_0c986i9">
+        <di:waypoint x="659" y="140" />
+        <di:waypoint x="800" y="140" />
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_1dhpkhd_di" bpmnElement="SequenceFlow_1dhpkhd">
-        <di:waypoint x="1136" y="527" />
-        <di:waypoint x="1200" y="527" />
+      <bpmndi:BPMNShape id="ScriptTask_1tizl6b_di" bpmnElement="ScriptTask_1tizl6b">
+        <dc:Bounds x="800" y="100" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_1k3cspv_di" bpmnElement="SequenceFlow_1k3cspv">
+        <di:waypoint x="900" y="140" />
+        <di:waypoint x="970" y="140" />
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_19jztxv_di" bpmnElement="SequenceFlow_19jztxv">
-        <di:waypoint x="1488" y="527" />
-        <di:waypoint x="1564" y="527" />
+      <bpmndi:BPMNEdge id="SequenceFlow_03ye8m4_di" bpmnElement="SequenceFlow_03ye8m4">
+        <di:waypoint x="634" y="165" />
+        <di:waypoint x="634" y="260" />
+        <di:waypoint x="930" y="260" />
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_0u8fycy_di" bpmnElement="SequenceFlow_0u8fycy">
-        <di:waypoint x="1896" y="502" />
-        <di:waypoint x="1896" y="409" />
+      <bpmndi:BPMNShape id="IntermediateThrowEvent_0zuxkap_di" bpmnElement="IntermediateThrowEvent_0fx1nyj">
+        <dc:Bounds x="1412" y="122" width="36" height="36" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="1904" y="453" width="14" height="14" />
+          <dc:Bounds x="1388" y="92" width="90" height="27" />
         </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_16nvnxi_di" bpmnElement="SequenceFlow_16nvnxi">
-        <di:waypoint x="1921" y="527" />
-        <di:waypoint x="1991" y="527" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="IntermediateCatchEvent_1u7g80x_di" bpmnElement="IntermediateThrowEvent_0k54pph">
+        <dc:Bounds x="138" y="502" width="36" height="36" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="1942" y="500" width="19" height="14" />
+          <dc:Bounds x="126" y="545" width="60" height="27" />
         </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_0ct8yh4_di" bpmnElement="SequenceFlow_0ct8yh4">
+        <di:waypoint x="174" y="520" />
+        <di:waypoint x="239" y="520" />
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_0cq2q6g_di" bpmnElement="SequenceFlow_0cq2q6g">
-        <di:waypoint x="2091" y="527" />
-        <di:waypoint x="2197" y="527" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="556.5" y="574" width="90" height="12" />
-        </bpmndi:BPMNLabel>
+      <bpmndi:BPMNShape id="ParallelGateway_0q9h79n_di" bpmnElement="ExclusiveGateway_00ufetn">
+        <dc:Bounds x="239" y="495" width="50" height="50" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_1m68yca_di" bpmnElement="SequenceFlow_1m68yca">
+        <di:waypoint x="264" y="495" />
+        <di:waypoint x="264" y="440" />
+        <di:waypoint x="310" y="440" />
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_1jaxstd_di" bpmnElement="SequenceFlow_1jaxstd">
-        <di:waypoint x="1991" y="665" />
-        <di:waypoint x="1896" y="665" />
-        <di:waypoint x="1896" y="552" />
+      <bpmndi:BPMNEdge id="SequenceFlow_0k5iu2n_di" bpmnElement="SequenceFlow_0k5iu2n">
+        <di:waypoint x="264" y="545" />
+        <di:waypoint x="264" y="630" />
+        <di:waypoint x="310" y="630" />
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_00b8ryw_di" bpmnElement="SequenceFlow_00b8ryw">
-        <di:waypoint x="2247" y="567" />
-        <di:waypoint x="2247" y="665" />
-        <di:waypoint x="2091" y="665" />
+      <bpmndi:BPMNShape id="CallActivity_1yh9tiq_di" bpmnElement="CallActivity_1yh9tiq">
+        <dc:Bounds x="930" y="400" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_1hfjn79_di" bpmnElement="SequenceFlow_1hfjn79">
+        <di:waypoint x="410" y="440" />
+        <di:waypoint x="530" y="440" />
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_04yx9ii_di" bpmnElement="SequenceFlow_04yx9ii">
-        <di:waypoint x="1614" y="527" />
-        <di:waypoint x="1686" y="527" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="1643" y="509" width="14" height="14" />
-        </bpmndi:BPMNLabel>
+      <bpmndi:BPMNShape id="CallActivity_1ixah3o_di" bpmnElement="CallActivity_1ixah3o">
+        <dc:Bounds x="930" y="590" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_0f36cu2_di" bpmnElement="SequenceFlow_0f36cu2">
+        <di:waypoint x="410" y="630" />
+        <di:waypoint x="530" y="630" />
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_1ui528w_di" bpmnElement="SequenceFlow_1ui528w">
-        <di:waypoint x="1589" y="552" />
-        <di:waypoint x="1589" y="671" />
-        <di:waypoint x="1086" y="671" />
-        <di:waypoint x="1086" y="567" />
+      <bpmndi:BPMNEdge id="SequenceFlow_1xb5nx1_di" bpmnElement="SequenceFlow_1xb5nx1">
+        <di:waypoint x="1030" y="440" />
+        <di:waypoint x="1140" y="440" />
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNShape id="ScriptTask_1dw39hg_di" bpmnElement="Task_09nzhwk">
-        <dc:Bounds x="878" y="487" width="100" height="80" />
+      <bpmndi:BPMNShape id="ParallelGateway_15vgf7c_di" bpmnElement="ExclusiveGateway_19ru3hp">
+        <dc:Bounds x="1325" y="505" width="50" height="50" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="ExclusiveGateway_0b9d9l0_di" bpmnElement="ExclusiveGateway_0b9d9l0" isMarkerVisible="true">
-        <dc:Bounds x="583" y="502" width="50" height="50" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="578" y="559" width="60" height="27" />
-        </bpmndi:BPMNLabel>
+      <bpmndi:BPMNShape id="ScriptTask_07sgklo_di" bpmnElement="ScriptTask_07sgklo">
+        <dc:Bounds x="930" y="220" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="ScriptTask_1ehyrsg_di" bpmnElement="ScriptTask_1ehyrsg">
-        <dc:Bounds x="699" y="310" width="100" height="80" />
+      <bpmndi:BPMNEdge id="SequenceFlow_0t0wddg_di" bpmnElement="SequenceFlow_0t0wddg">
+        <di:waypoint x="1030" y="260" />
+        <di:waypoint x="1430" y="260" />
+        <di:waypoint x="1430" y="158" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="ScriptTask_1r6kuwy_di" bpmnElement="ScriptTask_1r6kuwy">
+        <dc:Bounds x="970" y="100" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="CallActivity_1s23hty_di" bpmnElement="CallActivity_1s23hty">
-        <dc:Bounds x="699" y="487" width="100" height="80" />
+      <bpmndi:BPMNEdge id="SequenceFlow_05ovikm_di" bpmnElement="SequenceFlow_05ovikm">
+        <di:waypoint x="1070" y="140" />
+        <di:waypoint x="1412" y="140" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="ScriptTask_17cq3xj_di" bpmnElement="Task_1tv7jy5">
+        <dc:Bounds x="310" y="400" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="ScriptTask_1q3ftu4_di" bpmnElement="ScriptTask_1q3ftu4">
-        <dc:Bounds x="878" y="310" width="100" height="80" />
+      <bpmndi:BPMNShape id="ScriptTask_1r2li91_di" bpmnElement="ScriptTask_1r2li91">
+        <dc:Bounds x="530" y="400" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="allocateslice_StartEvent">
-        <dc:Bounds x="174" y="509" width="36" height="36" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="152" y="545" width="82" height="27" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="ScriptTask_03j6ogo_di" bpmnElement="PreprocessIncomingRequest_task">
-        <dc:Bounds x="268" y="487" width="100" height="80" />
+      <bpmndi:BPMNEdge id="SequenceFlow_0zbd2tq_di" bpmnElement="SequenceFlow_0zbd2tq">
+        <di:waypoint x="630" y="440" />
+        <di:waypoint x="730" y="440" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="ScriptTask_01n5nmt_di" bpmnElement="Task_1en3luv">
+        <dc:Bounds x="310" y="590" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="ScriptTask_0o93dvp_di" bpmnElement="ScriptTask_0o93dvp">
-        <dc:Bounds x="420" y="487" width="100" height="80" />
+      <bpmndi:BPMNShape id="ScriptTask_0juh1xy_di" bpmnElement="Task_1g8n8iz">
+        <dc:Bounds x="530" y="590" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="CallActivity_1k1oonn_di" bpmnElement="CallActivity_1k1oonn">
-        <dc:Bounds x="1200" y="487" width="100" height="80" />
+      <bpmndi:BPMNEdge id="SequenceFlow_0ax2c4p_di" bpmnElement="SequenceFlow_0ax2c4p">
+        <di:waypoint x="1375" y="530" />
+        <di:waypoint x="1412" y="530" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="ScriptTask_0stnvp3_di" bpmnElement="ScriptTask_0stnvp3">
+        <dc:Bounds x="310" y="840" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="ScriptTask_0gunols_di" bpmnElement="ScriptTask_0gunols">
-        <dc:Bounds x="1036" y="487" width="100" height="80" />
+      <bpmndi:BPMNShape id="ScriptTask_1f4o46q_di" bpmnElement="ScriptTask_1f4o46q">
+        <dc:Bounds x="530" y="840" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="ScriptTask_1lpgn98_di" bpmnElement="ScriptTask_1lpgn98">
-        <dc:Bounds x="1388" y="487" width="100" height="80" />
+      <bpmndi:BPMNShape id="CallActivity_0b28wlb_di" bpmnElement="CallActivity_0b28wlb">
+        <dc:Bounds x="930" y="840" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="EndEvent_15pcuuc_di" bpmnElement="EndEvent_1x6k78c">
-        <dc:Bounds x="1878" y="373" width="36" height="36" />
+      <bpmndi:BPMNEdge id="SequenceFlow_1d48cil_di" bpmnElement="SequenceFlow_1d48cil">
+        <di:waypoint x="410" y="880" />
+        <di:waypoint x="530" y="880" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_00dexhy_di" bpmnElement="SequenceFlow_00dexhy">
+        <di:waypoint x="630" y="880" />
+        <di:waypoint x="730" y="880" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="IntermediateCatchEvent_08wpvhs_di" bpmnElement="IntermediateCatchEvent_08wpvhs">
+        <dc:Bounds x="138" y="862" width="36" height="36" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="412" y="617" width="90" height="12" />
+          <dc:Bounds x="129" y="905" width="56" height="27" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="ScriptTask_0xxyfku_di" bpmnElement="finishNSCreate_Task">
-        <dc:Bounds x="1991" y="487" width="100" height="80" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="ExclusiveGateway_07qkrrb_di" bpmnElement="ExclusiveGateway_07qkrrb" isMarkerVisible="true">
-        <dc:Bounds x="1871" y="502" width="50" height="50" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="1853" y="575" width="86" height="27" />
-        </bpmndi:BPMNLabel>
+      <bpmndi:BPMNEdge id="SequenceFlow_0paqrtx_di" bpmnElement="SequenceFlow_0paqrtx">
+        <di:waypoint x="174" y="880" />
+        <di:waypoint x="310" y="880" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="ScriptTask_0sssiii_di" bpmnElement="ScriptTask_0sssiii">
+        <dc:Bounds x="1140" y="840" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="CallActivity_130tuxn_di" bpmnElement="CallActivity_130tuxn">
-        <dc:Bounds x="2197" y="487" width="100" height="80" />
+      <bpmndi:BPMNEdge id="SequenceFlow_150xio1_di" bpmnElement="SequenceFlow_150xio1">
+        <di:waypoint x="1240" y="880" />
+        <di:waypoint x="1412" y="880" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="ScriptTask_0mls87v_di" bpmnElement="ScriptTask_0mls87v">
+        <dc:Bounds x="1140" y="400" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="ScriptTask_0anyn7v_di" bpmnElement="ScriptTask_0anyn7v">
-        <dc:Bounds x="1991" y="625" width="100" height="80" />
+      <bpmndi:BPMNEdge id="SequenceFlow_0xx5bwa_di" bpmnElement="SequenceFlow_0xx5bwa">
+        <di:waypoint x="1240" y="440" />
+        <di:waypoint x="1350" y="440" />
+        <di:waypoint x="1350" y="505" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="ScriptTask_0z9x5uh_di" bpmnElement="ScriptTask_0z9x5uh">
+        <dc:Bounds x="1140" y="590" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="ScriptTask_1qmmew8_di" bpmnElement="instantiate_NSTask">
-        <dc:Bounds x="1686" y="487" width="100" height="80" />
+      <bpmndi:BPMNEdge id="SequenceFlow_1l74seh_di" bpmnElement="SequenceFlow_1l74seh">
+        <di:waypoint x="1030" y="630" />
+        <di:waypoint x="1140" y="630" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0jqxxjq_di" bpmnElement="SequenceFlow_0jqxxjq">
+        <di:waypoint x="1240" y="630" />
+        <di:waypoint x="1350" y="630" />
+        <di:waypoint x="1350" y="555" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1omynpt_di" bpmnElement="SequenceFlow_1omynpt">
+        <di:waypoint x="1030" y="880" />
+        <di:waypoint x="1140" y="880" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="EndEvent_0elqlhv_di" bpmnElement="EndEvent_0elqlhv">
+        <dc:Bounds x="1412" y="862" width="36" height="36" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="ExclusiveGateway_1jg3el3_di" bpmnElement="ExclusiveGateway_1jg3el3" isMarkerVisible="true">
-        <dc:Bounds x="1564" y="502" width="50" height="50" />
+      <bpmndi:BPMNShape id="IntermediateThrowEvent_0gz4vi6_di" bpmnElement="EndEvent_02c8wsp">
+        <dc:Bounds x="1412" y="512" width="36" height="36" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="1564" y="465" width="50" height="27" />
+          <dc:Bounds x="1392" y="555" width="79" height="27" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_0s8vhha_di" bpmnElement="ScriptTask_0s8vhha">
+        <dc:Bounds x="730" y="400" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_0npsyye_di" bpmnElement="SequenceFlow_0npsyye">
+        <di:waypoint x="830" y="440" />
+        <di:waypoint x="930" y="440" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="ScriptTask_0z0ec5b_di" bpmnElement="ScriptTask_0z0ec5b">
+        <dc:Bounds x="730" y="590" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_0cwbtmr_di" bpmnElement="SequenceFlow_0cwbtmr">
+        <di:waypoint x="830" y="630" />
+        <di:waypoint x="930" y="630" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1wffel4_di" bpmnElement="SequenceFlow_1wffel4">
+        <di:waypoint x="630" y="630" />
+        <di:waypoint x="730" y="630" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="ScriptTask_0ci5g6y_di" bpmnElement="ScriptTask_0ci5g6y">
+        <dc:Bounds x="730" y="840" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_01isn2q_di" bpmnElement="SequenceFlow_01isn2q">
+        <di:waypoint x="830" y="880" />
+        <di:waypoint x="930" y="880" />
+      </bpmndi:BPMNEdge>
     </bpmndi:BPMNPlane>
   </bpmndi:BPMNDiagram>
 </bpmn:definitions>
index 445c937..6e94538 100644 (file)
 <?xml version="1.0" encoding="UTF-8"?>
-<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="2.2.3">
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.4.1">
   <bpmn:process id="DoAllocateNSSI" name="DoAllocateNSSI" isExecutable="true">
-    <bpmn:startEvent id="allocatenssi_StartEvent" name="allocatenssi_StartEvent">
-      <bpmn:outgoing>SequenceFlow_1qo2pln</bpmn:outgoing>
+    <bpmn:startEvent id="StartEvent_0zs8ezi" name="Start">
+      <bpmn:outgoing>SequenceFlow_07xkshs</bpmn:outgoing>
     </bpmn:startEvent>
-    <bpmn:sequenceFlow id="SequenceFlow_1qo2pln" sourceRef="allocatenssi_StartEvent" targetRef="PreprocessIncomingRequest_task" />
-    <bpmn:sequenceFlow id="SequenceFlow_0khtova" sourceRef="PreprocessIncomingRequest_task" targetRef="CallActivity_09l7bhc" />
-    <bpmn:scriptTask id="Task_09nzhwk" name="send create request to NSSMF adapter" scriptFormat="groovy">
-      <bpmn:incoming>SequenceFlow_1h5bw41</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_1uiz85h</bpmn:outgoing>
-      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
-def dcnssi = new DoAllocateNSSI()
-dcnssi.sendCreateRequestNSSMF(execution)</bpmn:script>
-    </bpmn:scriptTask>
-    <bpmn:scriptTask id="PreprocessIncomingRequest_task" name="Preprocess Request" scriptFormat="groovy">
-      <bpmn:incoming>SequenceFlow_1qo2pln</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_0khtova</bpmn:outgoing>
+    <bpmn:scriptTask id="ScriptTask_0n2z0z7" name="Preprocess Request" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_07xkshs</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0h6mn7j</bpmn:outgoing>
       <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
 def dcnssi = new DoAllocateNSSI()
 dcnssi.preProcessRequest(execution)</bpmn:script>
     </bpmn:scriptTask>
-    <bpmn:scriptTask id="instantiate_NSTask" name="create slice profile" scriptFormat="groovy">
-      <bpmn:incoming>SequenceFlow_0yie00u</bpmn:incoming>
-      <bpmn:incoming>SequenceFlow_0kzlbeh</bpmn:incoming>
-      <bpmn:incoming>SequenceFlow_1r8qkgf</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_09pv5lu</bpmn:outgoing>
+    <bpmn:sequenceFlow id="SequenceFlow_07xkshs" sourceRef="StartEvent_0zs8ezi" targetRef="ScriptTask_0n2z0z7" />
+    <bpmn:scriptTask id="ScriptTask_15a7mua" name="send request to NSSMF adapter" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_0h6mn7j</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1wclf50</bpmn:outgoing>
       <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
 def dcnssi = new DoAllocateNSSI()
-dcnssi.createSliceProfile(execution)</bpmn:script>
-    </bpmn:scriptTask>
-    <bpmn:endEvent id="EndEvent_1x6k78c">
-      <bpmn:incoming>SequenceFlow_09pv5lu</bpmn:incoming>
-    </bpmn:endEvent>
-    <bpmn:scriptTask id="finishNSCreate_Task" name="Get NSSI progress" scriptFormat="groovy">
-      <bpmn:incoming>SequenceFlow_1smrx3b</bpmn:incoming>
-      <bpmn:incoming>SequenceFlow_08xcz0v</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_1lpxjvi</bpmn:outgoing>
-      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
-def dcnssi = new DoAllocateNSSI()
-dcnssi.getNSSMFProgresss(execution)</bpmn:script>
-    </bpmn:scriptTask>
-    <bpmn:sequenceFlow id="SequenceFlow_1uiz85h" sourceRef="Task_09nzhwk" targetRef="ExclusiveGateway_0xz0xx2" />
-    <bpmn:exclusiveGateway id="ExclusiveGateway_0b9d9l0" name="Is NSSI sharable?" default="SequenceFlow_0ueeeca">
-      <bpmn:incoming>SequenceFlow_0dj0jvq</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_1h5bw41</bpmn:outgoing>
-      <bpmn:outgoing>SequenceFlow_0ueeeca</bpmn:outgoing>
-    </bpmn:exclusiveGateway>
-    <bpmn:sequenceFlow id="SequenceFlow_1h5bw41" name="No" sourceRef="ExclusiveGateway_0b9d9l0" targetRef="Task_09nzhwk">
-      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("nssmfOperation" )  == "create")}</bpmn:conditionExpression>
-    </bpmn:sequenceFlow>
-    <bpmn:scriptTask id="ScriptTask_1ehyrsg" name="send update request to NSSMF adapter" scriptFormat="groovy">
-      <bpmn:incoming>SequenceFlow_0ueeeca</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_0xfhbqw</bpmn:outgoing>
-      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
-def dcnssi = new DoAllocateNSSI()
-dcnssi.sendUpdateRequestNSSMF(execution)</bpmn:script>
-    </bpmn:scriptTask>
-    <bpmn:sequenceFlow id="SequenceFlow_0ueeeca" name="Yes" sourceRef="ExclusiveGateway_0b9d9l0" targetRef="ScriptTask_1ehyrsg" />
-    <bpmn:scriptTask id="ScriptTask_0o93dvp" name="Get NSST from Catalog DB" scriptFormat="groovy">
-      <bpmn:incoming>SequenceFlow_03bz6dh</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_0dj0jvq</bpmn:outgoing>
-      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
-def dcnssi = new DoAllocateNSSI()
-dcnssi.getNSSTInfo(execution)</bpmn:script>
-    </bpmn:scriptTask>
-    <bpmn:sequenceFlow id="SequenceFlow_0dj0jvq" sourceRef="ScriptTask_0o93dvp" targetRef="ExclusiveGateway_0b9d9l0" />
-    <bpmn:sequenceFlow id="SequenceFlow_0xfhbqw" sourceRef="ScriptTask_1ehyrsg" targetRef="ExclusiveGateway_0xz0xx2" />
-    <bpmn:scriptTask id="ScriptTask_1mv1npn" name="create NSSI and update relationship" scriptFormat="groovy">
-      <bpmn:incoming>SequenceFlow_07azk0i</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_0yie00u</bpmn:outgoing>
-      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
-def dcnssi = new DoAllocateNSSI()
-dcnssi.instantiateNSSIService(execution)</bpmn:script>
-    </bpmn:scriptTask>
-    <bpmn:sequenceFlow id="SequenceFlow_1lpxjvi" sourceRef="finishNSCreate_Task" targetRef="ScriptTask_1fvkcir" />
-    <bpmn:callActivity id="CallActivity_09l7bhc" name="Call Decompose Service" calledElement="DecomposeService">
-      <bpmn:extensionElements>
-        <camunda:in source="msoRequestId" target="msoRequestId" />
-        <camunda:in source="serviceInstanceId" target="serviceInstanceId" />
-        <camunda:in source="serviceModelInfo" target="serviceModelInfo" />
-        <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" />
-        <camunda:out source="serviceDecomposition" target="serviceDecomposition" />
-        <camunda:out source="WorkflowException" target="WorkflowException" />
-      </bpmn:extensionElements>
-      <bpmn:incoming>SequenceFlow_0khtova</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_03bz6dh</bpmn:outgoing>
-    </bpmn:callActivity>
-    <bpmn:sequenceFlow id="SequenceFlow_03bz6dh" sourceRef="CallActivity_09l7bhc" targetRef="ScriptTask_0o93dvp" />
-    <bpmn:exclusiveGateway id="ExclusiveGateway_1cgffe3" name="Completed">
-      <bpmn:incoming>SequenceFlow_1xzq95u</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_1kxwt7k</bpmn:outgoing>
-      <bpmn:outgoing>SequenceFlow_0stj4cv</bpmn:outgoing>
-    </bpmn:exclusiveGateway>
-    <bpmn:scriptTask id="ScriptTask_1escji6" name="Time delay" scriptFormat="groovy">
-      <bpmn:incoming>SequenceFlow_0stj4cv</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_08xcz0v</bpmn:outgoing>
-      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
-def dcnssi = new DoAllocateNSSI()
-dcnssi.timeDelay(execution)</bpmn:script>
+dcnssi.sendCreateRequestNSSMF(execution)</bpmn:script>
     </bpmn:scriptTask>
-    <bpmn:sequenceFlow id="SequenceFlow_08xcz0v" sourceRef="ScriptTask_1escji6" targetRef="finishNSCreate_Task" />
-    <bpmn:exclusiveGateway id="ExclusiveGateway_0xz0xx2">
-      <bpmn:incoming>SequenceFlow_0xfhbqw</bpmn:incoming>
-      <bpmn:incoming>SequenceFlow_1uiz85h</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_1smrx3b</bpmn:outgoing>
-    </bpmn:exclusiveGateway>
-    <bpmn:sequenceFlow id="SequenceFlow_1kxwt7k" name="true" sourceRef="ExclusiveGateway_1cgffe3" targetRef="ExclusiveGateway_09hoejm">
-      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isNSSICreated" )  == true)}</bpmn:conditionExpression>
-    </bpmn:sequenceFlow>
-    <bpmn:sequenceFlow id="SequenceFlow_0stj4cv" name="false" sourceRef="ExclusiveGateway_1cgffe3" targetRef="ScriptTask_1escji6">
-      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isNSSICreated" )  == false)}</bpmn:conditionExpression>
-    </bpmn:sequenceFlow>
-    <bpmn:sequenceFlow id="SequenceFlow_1smrx3b" sourceRef="ExclusiveGateway_0xz0xx2" targetRef="finishNSCreate_Task" />
-    <bpmn:sequenceFlow id="SequenceFlow_0yie00u" sourceRef="ScriptTask_1mv1npn" targetRef="instantiate_NSTask" />
-    <bpmn:sequenceFlow id="SequenceFlow_09pv5lu" sourceRef="instantiate_NSTask" targetRef="EndEvent_1x6k78c" />
-    <bpmn:exclusiveGateway id="ExclusiveGateway_09hoejm" name="Is NSSI sharable?" default="SequenceFlow_0c2o5zl2">
-      <bpmn:incoming>SequenceFlow_1kxwt7k</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_07azk0i</bpmn:outgoing>
-      <bpmn:outgoing>SequenceFlow_0c2o5zl2</bpmn:outgoing>
-    </bpmn:exclusiveGateway>
-    <bpmn:sequenceFlow id="SequenceFlow_07azk0i" sourceRef="ExclusiveGateway_09hoejm" targetRef="ScriptTask_1mv1npn">
-      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("nssmfOperation" )  == "create")}</bpmn:conditionExpression>
-    </bpmn:sequenceFlow>
-    <bpmn:scriptTask id="ScriptTask_0y2xmwi" name="Update relationship" scriptFormat="groovy">
-      <bpmn:incoming>SequenceFlow_14lzy4o</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_0kzlbeh</bpmn:outgoing>
+    <bpmn:sequenceFlow id="SequenceFlow_1wclf50" sourceRef="ScriptTask_15a7mua" targetRef="Task_1ym947s" />
+    <bpmn:sequenceFlow id="SequenceFlow_0h6mn7j" sourceRef="ScriptTask_0n2z0z7" targetRef="ScriptTask_15a7mua" />
+    <bpmn:scriptTask id="Task_1ym947s" name="Query NSSI progress from adapter" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_0gpgxw4</bpmn:incoming>
+      <bpmn:incoming>SequenceFlow_1wclf50</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0p9gd2n</bpmn:outgoing>
       <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
 def dcnssi = new DoAllocateNSSI()
-dcnssi.updateRelationship(execution)</bpmn:script>
+dcnssi.queryNSSIStatus(execution)</bpmn:script>
     </bpmn:scriptTask>
-    <bpmn:sequenceFlow id="SequenceFlow_0c2o5zl2" sourceRef="ExclusiveGateway_09hoejm" targetRef="ScriptTask_0y2xmwi" />
-    <bpmn:sequenceFlow id="SequenceFlow_0kzlbeh" sourceRef="ScriptTask_0y2xmwi" targetRef="instantiate_NSTask" />
-    <bpmn:scriptTask id="ScriptTask_1fvkcir" name="Prepare Update Orchestration Task" scriptFormat="groovy">
-      <bpmn:incoming>SequenceFlow_1lpxjvi</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_0jjbci8</bpmn:outgoing>
+    <bpmn:scriptTask id="ScriptTask_0ki1c4k" name="Prepare Update Orchestration Task" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_0p9gd2n</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1ozi7ed</bpmn:outgoing>
       <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
 def dcnssi = new DoAllocateNSSI()
 dcnssi.prepareUpdateOrchestrationTask(execution)</bpmn:script>
     </bpmn:scriptTask>
-    <bpmn:callActivity id="CallActivity_11d0poc" name="Call HandleOrchestrationTask" calledElement="HandleOrchestrationTask">
+    <bpmn:callActivity id="CallActivity_0knipxf" name="Call HandleOrchestrationTask" calledElement="HandleOrchestrationTask">
       <bpmn:extensionElements>
         <camunda:out source="statusCode" target="CSSOT_dbResponseCode" />
         <camunda:out source="response" target="CSSOT_dbResponse" />
@@ -150,215 +48,111 @@ dcnssi.prepareUpdateOrchestrationTask(execution)</bpmn:script>
         <camunda:in source="CSSOT_paramJson" target="paramJson" />
         <camunda:in source="CSSOT_requestMethod" target="method" />
       </bpmn:extensionElements>
-      <bpmn:incoming>SequenceFlow_0jjbci8</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_1xzq95u</bpmn:outgoing>
+      <bpmn:incoming>SequenceFlow_1ozi7ed</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0hgv9c5</bpmn:outgoing>
     </bpmn:callActivity>
-    <bpmn:sequenceFlow id="SequenceFlow_0jjbci8" sourceRef="ScriptTask_1fvkcir" targetRef="CallActivity_11d0poc" />
-    <bpmn:sequenceFlow id="SequenceFlow_1xzq95u" sourceRef="CallActivity_11d0poc" targetRef="ExclusiveGateway_1cgffe3" />
-    <bpmn:exclusiveGateway id="ExclusiveGateway_19tascw" name="Is NSI option available?" default="SequenceFlow_14lzy4o">
-      <bpmn:incoming>SequenceFlow_0c2o5zl2</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_14lzy4o</bpmn:outgoing>
-      <bpmn:outgoing>SequenceFlow_1r8qkgf</bpmn:outgoing>
+    <bpmn:sequenceFlow id="SequenceFlow_1ozi7ed" sourceRef="ScriptTask_0ki1c4k" targetRef="CallActivity_0knipxf" />
+    <bpmn:sequenceFlow id="SequenceFlow_0p9gd2n" sourceRef="Task_1ym947s" targetRef="ScriptTask_0ki1c4k" />
+    <bpmn:exclusiveGateway id="ExclusiveGateway_11gv703" name="Completed" default="SequenceFlow_0y5jr25">
+      <bpmn:incoming>SequenceFlow_0hgv9c5</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0y5jr25</bpmn:outgoing>
+      <bpmn:outgoing>SequenceFlow_170frn3</bpmn:outgoing>
     </bpmn:exclusiveGateway>
-    <bpmn:sequenceFlow id="SequenceFlow_14lzy4o" sourceRef="ExclusiveGateway_19tascw" targetRef="ScriptTask_0y2xmwi" />
-    <bpmn:sequenceFlow id="SequenceFlow_1r8qkgf" sourceRef="ExclusiveGateway_19tascw" targetRef="instantiate_NSTask">
-      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isNSIOptionAvailable" )  == true)}</bpmn:conditionExpression>
+    <bpmn:sequenceFlow id="SequenceFlow_0hgv9c5" sourceRef="CallActivity_0knipxf" targetRef="ExclusiveGateway_11gv703" />
+    <bpmn:scriptTask id="ScriptTask_1s7bt3s" name="Time delay" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_0y5jr25</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0gpgxw4</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcnssi = new DoAllocateNSSI()
+dcnssi.timeDelay(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="SequenceFlow_0y5jr25" name="false" sourceRef="ExclusiveGateway_11gv703" targetRef="ScriptTask_1s7bt3s" />
+    <bpmn:sequenceFlow id="SequenceFlow_0gpgxw4" sourceRef="ScriptTask_1s7bt3s" targetRef="Task_1ym947s" />
+    <bpmn:sequenceFlow id="SequenceFlow_170frn3" name="yes" sourceRef="ExclusiveGateway_11gv703" targetRef="IntermediateThrowEvent_10xe1qh">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("jobFinished" )  == true)}</bpmn:conditionExpression>
     </bpmn:sequenceFlow>
+    <bpmn:endEvent id="IntermediateThrowEvent_10xe1qh">
+      <bpmn:incoming>SequenceFlow_170frn3</bpmn:incoming>
+    </bpmn:endEvent>
   </bpmn:process>
   <bpmndi:BPMNDiagram id="BPMNDiagram_1">
-    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoAllocateNSSI">
-      <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="allocatenssi_StartEvent">
-        <dc:Bounds x="175" y="509" width="36" height="36" />
+    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoAllocateNSSIV2">
+      <bpmndi:BPMNShape id="StartEvent_0zs8ezi_di" bpmnElement="StartEvent_0zs8ezi">
+        <dc:Bounds x="147" y="112" width="36" height="36" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="152" y="545" width="85" height="27" />
+          <dc:Bounds x="152" y="153" width="25" height="14" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_1qo2pln_di" bpmnElement="SequenceFlow_1qo2pln">
-        <di:waypoint x="211" y="527" />
-        <di:waypoint x="269" y="527" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="266" y="123" width="0" height="12" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_0khtova_di" bpmnElement="SequenceFlow_0khtova">
-        <di:waypoint x="369" y="527" />
-        <di:waypoint x="444" y="527" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="436" y="108" width="0" height="12" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNShape id="ScriptTask_1dw39hg_di" bpmnElement="Task_09nzhwk">
-        <dc:Bounds x="887" y="659" width="100" height="80" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="ScriptTask_03j6ogo_di" bpmnElement="PreprocessIncomingRequest_task">
-        <dc:Bounds x="269" y="487" width="100" height="80" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="ScriptTask_1qmmew8_di" bpmnElement="instantiate_NSTask">
-        <dc:Bounds x="2286" y="467" width="100" height="80" />
+      <bpmndi:BPMNShape id="ScriptTask_0n2z0z7_di" bpmnElement="ScriptTask_0n2z0z7">
+        <dc:Bounds x="270" y="90" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="EndEvent_15pcuuc_di" bpmnElement="EndEvent_1x6k78c">
-        <dc:Bounds x="2482" y="489" width="36" height="36" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="412" y="617" width="90" height="12" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="ScriptTask_0xxyfku_di" bpmnElement="finishNSCreate_Task">
-        <dc:Bounds x="1238" y="467" width="100" height="80" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_1uiz85h_di" bpmnElement="SequenceFlow_1uiz85h">
-        <di:waypoint x="987" y="699" />
-        <di:waypoint x="1103" y="699" />
-        <di:waypoint x="1103" y="532" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="631" y="108" width="0" height="12" />
-        </bpmndi:BPMNLabel>
+      <bpmndi:BPMNEdge id="SequenceFlow_07xkshs_di" bpmnElement="SequenceFlow_07xkshs">
+        <di:waypoint x="183" y="130" />
+        <di:waypoint x="270" y="130" />
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNShape id="ExclusiveGateway_0b9d9l0_di" bpmnElement="ExclusiveGateway_0b9d9l0" isMarkerVisible="true">
-        <dc:Bounds x="778" y="502" width="50" height="50" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="838" y="520" width="90" height="14" />
-        </bpmndi:BPMNLabel>
+      <bpmndi:BPMNShape id="ScriptTask_15a7mua_di" bpmnElement="ScriptTask_15a7mua">
+        <dc:Bounds x="460" y="90" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_1h5bw41_di" bpmnElement="SequenceFlow_1h5bw41">
-        <di:waypoint x="803" y="552" />
-        <di:waypoint x="803" y="699" />
-        <di:waypoint x="883" y="699" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="836" y="681" width="14" height="14" />
-        </bpmndi:BPMNLabel>
+      <bpmndi:BPMNEdge id="SequenceFlow_1wclf50_di" bpmnElement="SequenceFlow_1wclf50">
+        <di:waypoint x="560" y="130" />
+        <di:waypoint x="670" y="130" />
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNShape id="ScriptTask_1ehyrsg_di" bpmnElement="ScriptTask_1ehyrsg">
-        <dc:Bounds x="894" y="310" width="100" height="80" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_0ueeeca_di" bpmnElement="SequenceFlow_0ueeeca">
-        <di:waypoint x="803" y="502" />
-        <di:waypoint x="803" y="350" />
-        <di:waypoint x="894" y="350" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="831" y="358" width="19" height="14" />
-        </bpmndi:BPMNLabel>
+      <bpmndi:BPMNEdge id="SequenceFlow_0h6mn7j_di" bpmnElement="SequenceFlow_0h6mn7j">
+        <di:waypoint x="370" y="130" />
+        <di:waypoint x="460" y="130" />
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNShape id="ScriptTask_0o93dvp_di" bpmnElement="ScriptTask_0o93dvp">
-        <dc:Bounds x="618" y="487" width="100" height="80" />
+      <bpmndi:BPMNShape id="ScriptTask_0bt5d96_di" bpmnElement="Task_1ym947s">
+        <dc:Bounds x="670" y="90" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_0dj0jvq_di" bpmnElement="SequenceFlow_0dj0jvq">
-        <di:waypoint x="718" y="527" />
-        <di:waypoint x="778" y="527" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_0xfhbqw_di" bpmnElement="SequenceFlow_0xfhbqw">
-        <di:waypoint x="994" y="350" />
-        <di:waypoint x="1103" y="350" />
-        <di:waypoint x="1103" y="482" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNShape id="ScriptTask_1mv1npn_di" bpmnElement="ScriptTask_1mv1npn">
-        <dc:Bounds x="2089" y="467" width="100" height="80" />
+      <bpmndi:BPMNShape id="ScriptTask_0ki1c4k_di" bpmnElement="ScriptTask_0ki1c4k">
+        <dc:Bounds x="840" y="90" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_1lpxjvi_di" bpmnElement="SequenceFlow_1lpxjvi">
-        <di:waypoint x="1338" y="507" />
-        <di:waypoint x="1411" y="507" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNShape id="CallActivity_09l7bhc_di" bpmnElement="CallActivity_09l7bhc">
-        <dc:Bounds x="444" y="487" width="100" height="80" />
+      <bpmndi:BPMNShape id="CallActivity_0knipxf_di" bpmnElement="CallActivity_0knipxf">
+        <dc:Bounds x="1040" y="90" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_03bz6dh_di" bpmnElement="SequenceFlow_03bz6dh">
-        <di:waypoint x="544" y="527" />
-        <di:waypoint x="618" y="527" />
+      <bpmndi:BPMNEdge id="SequenceFlow_1ozi7ed_di" bpmnElement="SequenceFlow_1ozi7ed">
+        <di:waypoint x="940" y="130" />
+        <di:waypoint x="1040" y="130" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0p9gd2n_di" bpmnElement="SequenceFlow_0p9gd2n">
+        <di:waypoint x="770" y="130" />
+        <di:waypoint x="840" y="130" />
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNShape id="ExclusiveGateway_1cgffe3_di" bpmnElement="ExclusiveGateway_1cgffe3" isMarkerVisible="true">
-        <dc:Bounds x="1773" y="482" width="50" height="50" />
+      <bpmndi:BPMNShape id="ExclusiveGateway_11gv703_di" bpmnElement="ExclusiveGateway_11gv703" isMarkerVisible="true">
+        <dc:Bounds x="1245" y="105" width="50" height="50" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="1771" y="458" width="54" height="14" />
+          <dc:Bounds x="1243" y="81" width="54" height="14" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="ScriptTask_1escji6_di" bpmnElement="ScriptTask_1escji6">
-        <dc:Bounds x="1748" y="624" width="100" height="80" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_08xcz0v_di" bpmnElement="SequenceFlow_08xcz0v">
-        <di:waypoint x="1748" y="664" />
-        <di:waypoint x="1288" y="664" />
-        <di:waypoint x="1288" y="547" />
+      <bpmndi:BPMNEdge id="SequenceFlow_0hgv9c5_di" bpmnElement="SequenceFlow_0hgv9c5">
+        <di:waypoint x="1140" y="130" />
+        <di:waypoint x="1245" y="130" />
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNShape id="ExclusiveGateway_0xz0xx2_di" bpmnElement="ExclusiveGateway_0xz0xx2" isMarkerVisible="true">
-        <dc:Bounds x="1078" y="482" width="50" height="50" />
+      <bpmndi:BPMNShape id="ScriptTask_1s7bt3s_di" bpmnElement="ScriptTask_1s7bt3s">
+        <dc:Bounds x="1220" y="230" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_1kxwt7k_di" bpmnElement="SequenceFlow_1kxwt7k">
-        <di:waypoint x="1823" y="507" />
-        <di:waypoint x="1928" y="507" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="1866" y="489" width="19" height="14" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_0stj4cv_di" bpmnElement="SequenceFlow_0stj4cv">
-        <di:waypoint x="1798" y="532" />
-        <di:waypoint x="1798" y="624" />
+      <bpmndi:BPMNEdge id="SequenceFlow_0y5jr25_di" bpmnElement="SequenceFlow_0y5jr25">
+        <di:waypoint x="1270" y="155" />
+        <di:waypoint x="1270" y="230" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="1801" y="575" width="24" height="14" />
+          <dc:Bounds x="1251" y="195" width="23" height="14" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_1smrx3b_di" bpmnElement="SequenceFlow_1smrx3b">
-        <di:waypoint x="1128" y="507" />
-        <di:waypoint x="1238" y="507" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_0yie00u_di" bpmnElement="SequenceFlow_0yie00u">
-        <di:waypoint x="2189" y="507" />
-        <di:waypoint x="2286" y="507" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_09pv5lu_di" bpmnElement="SequenceFlow_09pv5lu">
-        <di:waypoint x="2386" y="507" />
-        <di:waypoint x="2482" y="507" />
+      <bpmndi:BPMNEdge id="SequenceFlow_0gpgxw4_di" bpmnElement="SequenceFlow_0gpgxw4">
+        <di:waypoint x="1220" y="270" />
+        <di:waypoint x="720" y="270" />
+        <di:waypoint x="720" y="170" />
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNShape id="ExclusiveGateway_09hoejm_di" bpmnElement="ExclusiveGateway_09hoejm" isMarkerVisible="true">
-        <dc:Bounds x="1928" y="482" width="50" height="50" />
+      <bpmndi:BPMNEdge id="SequenceFlow_170frn3_di" bpmnElement="SequenceFlow_170frn3">
+        <di:waypoint x="1295" y="130" />
+        <di:waypoint x="1372" y="130" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="1908" y="542" width="90" height="14" />
+          <dc:Bounds x="1325" y="112" width="17" height="14" />
         </bpmndi:BPMNLabel>
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_07azk0i_di" bpmnElement="SequenceFlow_07azk0i">
-        <di:waypoint x="1978" y="507" />
-        <di:waypoint x="2089" y="507" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNShape id="ScriptTask_0y2xmwi_di" bpmnElement="ScriptTask_0y2xmwi">
-        <dc:Bounds x="2089" y="310" width="100" height="80" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_0kzlbeh_di" bpmnElement="SequenceFlow_0kzlbeh">
-        <di:waypoint x="2189" y="350" />
-        <di:waypoint x="2336" y="350" />
-        <di:waypoint x="2336" y="467" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNShape id="ScriptTask_1fvkcir_di" bpmnElement="ScriptTask_1fvkcir">
-        <dc:Bounds x="1411" y="467" width="100" height="80" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="CallActivity_11d0poc_di" bpmnElement="CallActivity_11d0poc">
-        <dc:Bounds x="1587" y="467" width="100" height="80" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_0jjbci8_di" bpmnElement="SequenceFlow_0jjbci8">
-        <di:waypoint x="1511" y="507" />
-        <di:waypoint x="1587" y="507" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_1xzq95u_di" bpmnElement="SequenceFlow_1xzq95u">
-        <di:waypoint x="1687" y="507" />
-        <di:waypoint x="1773" y="507" />
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNShape id="ExclusiveGateway_19tascw_di" bpmnElement="ExclusiveGateway_19tascw" isMarkerVisible="true">
-        <dc:Bounds x="1928" y="325" width="50" height="50" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="1854" y="337" width="64" height="27" />
-        </bpmndi:BPMNLabel>
+      <bpmndi:BPMNShape id="EndEvent_1q1vntz_di" bpmnElement="IntermediateThrowEvent_10xe1qh">
+        <dc:Bounds x="1372" y="112" width="36" height="36" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_0c2o5zl_di" bpmnElement="SequenceFlow_0c2o5zl2">
-        <di:waypoint x="1953" y="482" />
-        <di:waypoint x="1953" y="375" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_14lzy4o_di" bpmnElement="SequenceFlow_14lzy4o">
-        <di:waypoint x="1978" y="350" />
-        <di:waypoint x="2089" y="350" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_1r8qkgf_di" bpmnElement="SequenceFlow_1r8qkgf">
-        <di:waypoint x="1953" y="325" />
-        <di:waypoint x="1953" y="205" />
-        <di:waypoint x="2336" y="205" />
-        <di:waypoint x="2336" y="465" />
-      </bpmndi:BPMNEdge>
     </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
new file mode 100644 (file)
index 0000000..f488632
--- /dev/null
@@ -0,0 +1,493 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_1wio50w" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.1.1">
+  <bpmn:process id="DoAllocateTransportNSSI" name="DoAllocateTransportNSSI" isExecutable="true">
+    <bpmn:startEvent id="StartEvent_1nbljfd" name="Create Allocate TN NSSMF Work Flow">
+      <bpmn:outgoing>SequenceFlow_03s744c</bpmn:outgoing>
+    </bpmn:startEvent>
+    <bpmn:intermediateCatchEvent id="IntermediateCatchEvent_0vilb24" name="OOF TN NSSI Selection">
+      <bpmn:outgoing>SequenceFlow_1fk37v7</bpmn:outgoing>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_197u5pe" name="OofTnNssiSelect" />
+    </bpmn:intermediateCatchEvent>
+    <bpmn:scriptTask id="ScriptTask_1tc44ge" name="PreProcess Incoming Request" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_03s744c</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_07e12rt</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def css= new TnAllocateNssi()
+css.preProcessRequest(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="ScriptTask_1jgtb0y" name="Process OOF Selection" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_1cv0wop</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_197cm2e</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def css = new TnAllocateNssi()
+css.processOofSelection(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:exclusiveGateway id="ExclusiveGateway_0elbczl" name="Use Existing TN NSSI?" default="SequenceFlow_038lb9m">
+      <bpmn:incoming>SequenceFlow_197cm2e</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_12t5exy</bpmn:outgoing>
+      <bpmn:outgoing>SequenceFlow_038lb9m</bpmn:outgoing>
+    </bpmn:exclusiveGateway>
+    <bpmn:scriptTask id="ScriptTask_0l3d1ai" name="Process Decomposition" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_1t19ips</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0jrclmc</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def runScript = new TnAllocateNssi()
+runScript.processDecomposition(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:exclusiveGateway id="ExclusiveGateway_18eld2o" name="Is Allocation Successful?" default="SequenceFlow_1c6ka9h">
+      <bpmn:incoming>SequenceFlow_0mlrlbv</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1c6ka9h</bpmn:outgoing>
+      <bpmn:outgoing>SequenceFlow_0n4xku8</bpmn:outgoing>
+    </bpmn:exclusiveGateway>
+    <bpmn:endEvent id="EndEvent_0x406rw">
+      <bpmn:incoming>SequenceFlow_1c6ka9h</bpmn:incoming>
+      <bpmn:errorEventDefinition id="ErrorEventDefinition_0mlneuw" errorRef="Error_03akl5v" />
+    </bpmn:endEvent>
+    <bpmn:subProcess id="SubProcess_1yv9i68" name="Sub-process for FalloutHandler and Rollback" triggeredByEvent="true">
+      <bpmn:startEvent id="StartEvent_1omdx56">
+        <bpmn:outgoing>SequenceFlow_1w67v6s</bpmn:outgoing>
+        <bpmn:errorEventDefinition id="ErrorEventDefinition_06xcioh" />
+      </bpmn:startEvent>
+      <bpmn:endEvent id="EndEvent_1jx3026">
+        <bpmn:incoming>SequenceFlow_08mlzwz</bpmn:incoming>
+      </bpmn:endEvent>
+      <bpmn:scriptTask id="ScriptTask_1swzdpw" name="Handle Unexpected Error" scriptFormat="groovy">
+        <bpmn:incoming>SequenceFlow_1w67v6s</bpmn:incoming>
+        <bpmn:outgoing>SequenceFlow_08mlzwz</bpmn:outgoing>
+        <bpmn:script>import org.onap.so.bpmn.common.scripts.*
+ExceptionUtil ex = new ExceptionUtil()
+ex.processJavaException(execution)</bpmn:script>
+      </bpmn:scriptTask>
+      <bpmn:sequenceFlow id="SequenceFlow_1w67v6s" sourceRef="StartEvent_1omdx56" targetRef="ScriptTask_1swzdpw" />
+      <bpmn:sequenceFlow id="SequenceFlow_08mlzwz" sourceRef="ScriptTask_1swzdpw" targetRef="EndEvent_1jx3026" />
+    </bpmn:subProcess>
+    <bpmn:endEvent id="EndEvent_05h01gx" name="End">
+      <bpmn:incoming>Flow_06rrcwf</bpmn:incoming>
+    </bpmn:endEvent>
+    <bpmn:scriptTask id="ScriptTask_1xxag1o" name="Prepare Init Service Operation Status" scriptFormat="groovy">
+      <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()
+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:intermediateThrowEvent>
+    <bpmn:scriptTask id="ScriptTask_1ssh2l9" name="Prepare Update Resource Oper Status((finish)" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_0kixzdj</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1qv8qw1</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def runScript = new TnAllocateNssi()
+runScript.prepareUpdateJobStatus(execution,"finished","100","Allocated TN NSSI successfully")</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:callActivity id="CallActivity_1bnkmaz" name="Call Decompose Service" calledElement="DecomposeService">
+      <bpmn:extensionElements>
+        <camunda:in source="msoRequestId" target="msoRequestId" />
+        <camunda:in source="sliceServiceInstanceId" target="serviceInstanceId" />
+        <camunda:in source="serviceModelInfo" target="serviceModelInfo" />
+        <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" />
+        <camunda:out source="serviceDecomposition" target="tnNsstServiceDecomposition" />
+        <camunda:out source="WorkflowException" target="WorkflowException" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>SequenceFlow_0q7yc2c</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1t19ips</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:scriptTask id="ScriptTask_0o2r07o" name="Prepare&#10;Decompose&#10;Service&#10;" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1k88aak</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0q7yc2c</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def runScript = new TnAllocateNssi()
+runScript.prepareDecomposeService(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="ScriptTask_08wim95" name="Prepare OOF TN NSSI Selection" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_1fk37v7</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0h2oree</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def css = new TnAllocateNssi()
+css.prepareOofSelection(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:intermediateCatchEvent id="IntermediateCatchEvent_0pkvfun" name="Allocate TN NSSI">
+      <bpmn:outgoing>SequenceFlow_1bevt3a</bpmn:outgoing>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_1vlfclx" name="TnAllocateNssi" />
+    </bpmn:intermediateCatchEvent>
+    <bpmn:intermediateThrowEvent id="IntermediateThrowEvent_0ktwpki" name="Goto Allocate TN NSSI">
+      <bpmn:incoming>SequenceFlow_12t5exy</bpmn:incoming>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_16f2ri9" name="TnAllocateNssi" />
+    </bpmn:intermediateThrowEvent>
+    <bpmn:endEvent id="EndEvent_1oouvuh" name="End">
+      <bpmn:incoming>Flow_0pbq5q0</bpmn:incoming>
+    </bpmn:endEvent>
+    <bpmn:callActivity id="CallActivity_0cxst1i" name="Call DoCreateTnNssiInstance&#10;" calledElement="DoCreateTnNssiInstance">
+      <bpmn:extensionElements>
+        <camunda:in source="msoRequestId" target="msoRequestId" />
+        <camunda:in source="sliceServiceInstanceId" target="sliceServiceInstanceId" />
+        <camunda:in source="modelInvariantUuid" target="modelInvariantUuid" />
+        <camunda:in source="modelUuid" target="modelUuid" />
+        <camunda:in source="sliceServiceInstanceName" target="sliceServiceInstanceName" />
+        <camunda:in source="globalSubscriberId" target="globalSubscriberId" />
+        <camunda:in source="subscriptionServiceType" target="subscriptionServiceType" />
+        <camunda:in source="operationId" target="operationId" />
+        <camunda:in source="sliceProfile" target="sliceProfile" />
+        <camunda:in source="transportSliceNetworks" target="transportSliceNetworks" />
+        <camunda:in source="nsiInfo" target="nsiInfo" />
+        <camunda:out source="WorkflowException" target="WorkflowException" />
+        <camunda:out source="rollbackData" target="rollbackData" />
+        <camunda:out source="rolledBack" target="rolledBack" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>SequenceFlow_1bevt3a</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0mlrlbv</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:sequenceFlow id="SequenceFlow_03s744c" sourceRef="StartEvent_1nbljfd" targetRef="ScriptTask_1tc44ge" />
+    <bpmn:sequenceFlow id="SequenceFlow_07e12rt" sourceRef="ScriptTask_1tc44ge" targetRef="ScriptTask_1xxag1o" />
+    <bpmn:sequenceFlow id="SequenceFlow_1cv0wop" sourceRef="Activity_187hs2t" targetRef="ScriptTask_1jgtb0y" />
+    <bpmn:sequenceFlow id="SequenceFlow_197cm2e" sourceRef="ScriptTask_1jgtb0y" targetRef="ExclusiveGateway_0elbczl" />
+    <bpmn:sequenceFlow id="SequenceFlow_12t5exy" name="No" sourceRef="ExclusiveGateway_0elbczl" targetRef="IntermediateThrowEvent_0ktwpki">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isOofTnNssiSelected")  == false)}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:sequenceFlow id="SequenceFlow_038lb9m" name="Yes" sourceRef="ExclusiveGateway_0elbczl" targetRef="Activity_1mh10j4" />
+    <bpmn:sequenceFlow id="SequenceFlow_1t19ips" sourceRef="CallActivity_1bnkmaz" targetRef="ScriptTask_0l3d1ai" />
+    <bpmn:sequenceFlow id="SequenceFlow_0mlrlbv" sourceRef="CallActivity_0cxst1i" targetRef="ExclusiveGateway_18eld2o" />
+    <bpmn:sequenceFlow id="SequenceFlow_1c6ka9h" name="No" sourceRef="ExclusiveGateway_18eld2o" targetRef="EndEvent_0x406rw" />
+    <bpmn:sequenceFlow id="SequenceFlow_0n4xku8" name="Yes" sourceRef="ExclusiveGateway_18eld2o" targetRef="ScriptTask_19uxoi8">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("WorkflowException") == null}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:sequenceFlow id="SequenceFlow_0t094g7" sourceRef="ScriptTask_1xxag1o" targetRef="Activity_14an583" />
+    <bpmn:sequenceFlow id="SequenceFlow_1qv8qw1" sourceRef="ScriptTask_1ssh2l9" targetRef="Activity_1xko5pk" />
+    <bpmn:sequenceFlow id="SequenceFlow_0q7yc2c" sourceRef="ScriptTask_0o2r07o" targetRef="CallActivity_1bnkmaz" />
+    <bpmn:sequenceFlow id="SequenceFlow_0h2oree" sourceRef="ScriptTask_08wim95" targetRef="Activity_187hs2t" />
+    <bpmn:sequenceFlow id="SequenceFlow_1bevt3a" sourceRef="IntermediateCatchEvent_0pkvfun" targetRef="CallActivity_0cxst1i" />
+    <bpmn:sequenceFlow id="SequenceFlow_1fk37v7" sourceRef="IntermediateCatchEvent_0vilb24" targetRef="ScriptTask_08wim95" />
+    <bpmn:sequenceFlow id="SequenceFlow_0jrclmc" sourceRef="ScriptTask_0l3d1ai" targetRef="IntermediateThrowEvent_1ex8ke9" />
+    <bpmn:scriptTask id="ScriptTask_19uxoi8" name="Update AAI Status" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_0n4xku8</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0kixzdj</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+execution.setVariable("orchestrationStatus", "allocated")
+def runScript = new TnAllocateNssi()
+runScript.updateAAIOrchStatus(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="SequenceFlow_0kixzdj" sourceRef="ScriptTask_19uxoi8" targetRef="ScriptTask_1ssh2l9" />
+    <bpmn:scriptTask id="Activity_1mh10j4" name="Prepare Update Resource Oper Status(finish)" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_038lb9m</bpmn:incoming>
+      <bpmn:outgoing>Flow_1853sgs</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def runScript = new TnAllocateNssi()
+runScript.prepareUpdateJobStatus(execution,"finished","100","Allocated TN NSSI successfully")</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_1853sgs" sourceRef="Activity_1mh10j4" targetRef="Activity_124z7q2" />
+    <bpmn:callActivity id="Activity_187hs2t" name="Handle TN NSSI Selection OOF request" calledElement="DoHandleOofRequest">
+      <bpmn:extensionElements>
+        <camunda:in source="nssiSelection_Url" target="apiPath" />
+        <camunda:in source="nssiSelection_correlator" target="correlator" />
+        <camunda:in source="nssiSelection_messageType" target="messageType" />
+        <camunda:in source="nssiSelection_timeout" target="timeout" />
+        <camunda:in source="nssiSelection_oofRequest" target="oofRequest" />
+        <camunda:out source="WorkflowException" target="WorkflowException" />
+        <camunda:out source="asyncCallbackResponse" target="nssiSelection_asyncCallbackResponse" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>SequenceFlow_0h2oree</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1cv0wop</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:serviceTask id="Activity_124z7q2" 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_1853sgs</bpmn:incoming>
+      <bpmn:outgoing>Flow_0pbq5q0</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:sequenceFlow id="Flow_0pbq5q0" sourceRef="Activity_124z7q2" targetRef="EndEvent_1oouvuh" />
+    <bpmn:serviceTask id="Activity_14an583" 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>SequenceFlow_0t094g7</bpmn:incoming>
+      <bpmn:outgoing>Flow_1k88aak</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:sequenceFlow id="Flow_1k88aak" sourceRef="Activity_14an583" targetRef="ScriptTask_0o2r07o" />
+    <bpmn:serviceTask id="Activity_1xko5pk" 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>SequenceFlow_1qv8qw1</bpmn:incoming>
+      <bpmn:outgoing>Flow_06rrcwf</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:sequenceFlow id="Flow_06rrcwf" sourceRef="Activity_1xko5pk" targetRef="EndEvent_05h01gx" />
+  </bpmn:process>
+  <bpmn:message id="Message_0c4b2r5" name="SliceServiceTask" />
+  <bpmn:error id="Error_03akl5v" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
+  <bpmn:error id="Error_0p2naox" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
+  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoAllocateTransportNSSI">
+      <bpmndi:BPMNEdge id="Flow_06rrcwf_di" bpmnElement="Flow_06rrcwf">
+        <di:waypoint x="1140" y="680" />
+        <di:waypoint x="1252" y="680" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1k88aak_di" bpmnElement="Flow_1k88aak">
+        <di:waypoint x="750" y="121" />
+        <di:waypoint x="850" y="121" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0pbq5q0_di" bpmnElement="Flow_0pbq5q0">
+        <di:waypoint x="1460" y="500" />
+        <di:waypoint x="1562" y="500" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1853sgs_di" bpmnElement="Flow_1853sgs">
+        <di:waypoint x="1270" y="500" />
+        <di:waypoint x="1360" y="500" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0kixzdj_di" bpmnElement="SequenceFlow_0kixzdj">
+        <di:waypoint x="770" y="680" />
+        <di:waypoint x="860" y="680" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0jrclmc_di" bpmnElement="SequenceFlow_0jrclmc">
+        <di:waypoint x="1420" y="121" />
+        <di:waypoint x="1532" y="121" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1fk37v7_di" bpmnElement="SequenceFlow_1fk37v7">
+        <di:waypoint x="214" y="330" />
+        <di:waypoint x="320" y="330" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1bevt3a_di" bpmnElement="SequenceFlow_1bevt3a">
+        <di:waypoint x="228" y="680" />
+        <di:waypoint x="320" y="680" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0h2oree_di" bpmnElement="SequenceFlow_0h2oree">
+        <di:waypoint x="420" y="330" />
+        <di:waypoint x="540" y="330" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0q7yc2c_di" bpmnElement="SequenceFlow_0q7yc2c">
+        <di:waypoint x="950" y="121" />
+        <di:waypoint x="1090" y="121" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1qv8qw1_di" bpmnElement="SequenceFlow_1qv8qw1">
+        <di:waypoint x="960" y="680" />
+        <di:waypoint x="1040" y="680" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0t094g7_di" bpmnElement="SequenceFlow_0t094g7">
+        <di:waypoint x="568" y="121" />
+        <di:waypoint x="650" y="121" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0n4xku8_di" bpmnElement="SequenceFlow_0n4xku8">
+        <di:waypoint x="538" y="680" />
+        <di:waypoint x="670" y="680" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="585" y="662" width="19" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1c6ka9h_di" bpmnElement="SequenceFlow_1c6ka9h">
+        <di:waypoint x="513" y="705" />
+        <di:waypoint x="513" y="762" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="522" y="705" width="14" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0mlrlbv_di" bpmnElement="SequenceFlow_0mlrlbv">
+        <di:waypoint x="420" y="680" />
+        <di:waypoint x="488" y="680" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1t19ips_di" bpmnElement="SequenceFlow_1t19ips">
+        <di:waypoint x="1190" y="121" />
+        <di:waypoint x="1320" y="121" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_038lb9m_di" bpmnElement="SequenceFlow_038lb9m">
+        <di:waypoint x="1090" y="355" />
+        <di:waypoint x="1090" y="500" />
+        <di:waypoint x="1170" y="500" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1100" y="413" width="19" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_12t5exy_di" bpmnElement="SequenceFlow_12t5exy">
+        <di:waypoint x="1115" y="330" />
+        <di:waypoint x="1292" y="330" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1183" y="313" width="14" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_197cm2e_di" bpmnElement="SequenceFlow_197cm2e">
+        <di:waypoint x="890" y="330" />
+        <di:waypoint x="1065" y="330" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1cv0wop_di" bpmnElement="SequenceFlow_1cv0wop">
+        <di:waypoint x="640" y="330" />
+        <di:waypoint x="790" y="330" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_07e12rt_di" bpmnElement="SequenceFlow_07e12rt">
+        <di:waypoint x="385" y="121" />
+        <di:waypoint x="468" y="121" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_03s744c_di" bpmnElement="SequenceFlow_03s744c">
+        <di:waypoint x="214" y="121" />
+        <di:waypoint x="285" y="121" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="StartEvent_1nbljfd_di" bpmnElement="StartEvent_1nbljfd">
+        <dc:Bounds x="178" y="103" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="158" y="146" width="86" height="40" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="IntermediateCatchEvent_0vilb24_di" bpmnElement="IntermediateCatchEvent_0vilb24">
+        <dc:Bounds x="178" y="312" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="162" y="355" width="71" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_1tc44ge_di" bpmnElement="ScriptTask_1tc44ge">
+        <dc:Bounds x="285" y="81" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_1jgtb0y_di" bpmnElement="ScriptTask_1jgtb0y">
+        <dc:Bounds x="790" y="290" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ExclusiveGateway_0elbczl_di" bpmnElement="ExclusiveGateway_0elbczl" isMarkerVisible="true">
+        <dc:Bounds x="1065" y="305" width="50" height="50" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1050" y="276" width="79" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_0l3d1ai_di" bpmnElement="ScriptTask_0l3d1ai">
+        <dc:Bounds x="1320" y="81" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ExclusiveGateway_18eld2o_di" bpmnElement="ExclusiveGateway_18eld2o" isMarkerVisible="true">
+        <dc:Bounds x="488" y="655" width="50" height="50" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="482.5" y="617.5" width="61" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="EndEvent_0x406rw_di" bpmnElement="EndEvent_0x406rw">
+        <dc:Bounds x="495" y="762" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="SubProcess_1yv9i68_di" bpmnElement="SubProcess_1yv9i68" isExpanded="true">
+        <dc:Bounds x="685" y="1080" width="781" height="196" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_08mlzwz_di" bpmnElement="SequenceFlow_08mlzwz">
+        <di:waypoint x="1079" y="1184" />
+        <di:waypoint x="1353" y="1184" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1w67v6s_di" bpmnElement="SequenceFlow_1w67v6s">
+        <di:waypoint x="751" y="1184" />
+        <di:waypoint x="979" y="1184" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="StartEvent_1omdx56_di" bpmnElement="StartEvent_1omdx56">
+        <dc:Bounds x="715" y="1166" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="EndEvent_1jx3026_di" bpmnElement="EndEvent_1jx3026">
+        <dc:Bounds x="1353" y="1166" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_1swzdpw_di" bpmnElement="ScriptTask_1swzdpw">
+        <dc:Bounds x="979" y="1144" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="EndEvent_05h01gx_di" bpmnElement="EndEvent_05h01gx">
+        <dc:Bounds x="1252" y="662" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1260" y="705" width="20" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_1xxag1o_di" bpmnElement="ScriptTask_1xxag1o">
+        <dc:Bounds x="468" y="81" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="IntermediateThrowEvent_1ex8ke9_di" bpmnElement="IntermediateThrowEvent_1ex8ke9">
+        <dc:Bounds x="1532" y="103" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1522" y="144" width="74" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_1ssh2l9_di" bpmnElement="ScriptTask_1ssh2l9">
+        <dc:Bounds x="860" y="640" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="CallActivity_1bnkmaz_di" bpmnElement="CallActivity_1bnkmaz">
+        <dc:Bounds x="1090" y="81" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_0o2r07o_di" bpmnElement="ScriptTask_0o2r07o">
+        <dc:Bounds x="850" y="81" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_08wim95_di" bpmnElement="ScriptTask_08wim95">
+        <dc:Bounds x="320" y="290" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="IntermediateCatchEvent_0pkvfun_di" bpmnElement="IntermediateCatchEvent_0pkvfun">
+        <dc:Bounds x="192" y="662" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="173" y="705" width="86" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="IntermediateThrowEvent_0ktwpki_di" bpmnElement="IntermediateThrowEvent_0ktwpki">
+        <dc:Bounds x="1292" y="312" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1280" y="353" width="84" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="EndEvent_1oouvuh_di" bpmnElement="EndEvent_1oouvuh">
+        <dc:Bounds x="1562" y="482" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1570" y="525" width="20" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="CallActivity_0cxst1i_di" bpmnElement="CallActivity_0cxst1i">
+        <dc:Bounds x="320" y="640" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_19uxoi8_di" bpmnElement="ScriptTask_19uxoi8">
+        <dc:Bounds x="670" y="640" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1mh10j4_di" bpmnElement="Activity_1mh10j4">
+        <dc:Bounds x="1170" y="460" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_187hs2t_di" bpmnElement="Activity_187hs2t">
+        <dc:Bounds x="540" y="290" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_124z7q2_di" bpmnElement="Activity_124z7q2">
+        <dc:Bounds x="1360" y="460" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_14an583_di" bpmnElement="Activity_14an583">
+        <dc:Bounds x="650" y="81" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1xko5pk_di" bpmnElement="Activity_1xko5pk">
+        <dc:Bounds x="1040" y="640" width="100" height="80" />
+      </bpmndi:BPMNShape>
+    </bpmndi:BPMNPlane>
+  </bpmndi:BPMNDiagram>
+</bpmn:definitions>
index 894f7d3..0345ea7 100644 (file)
@@ -1,11 +1,11 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="2.2.3">
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.4.1">
   <bpmn:process id="DoCreateSliceServiceInstance" name="DoCreateSliceServiceInstance" isExecutable="true">
     <bpmn:startEvent id="createNS_StartEvent" name="createNS_StartEvent">
       <bpmn:outgoing>SequenceFlow_1qo2pln</bpmn:outgoing>
     </bpmn:startEvent>
     <bpmn:sequenceFlow id="SequenceFlow_1qo2pln" sourceRef="createNS_StartEvent" targetRef="PreprocessIncomingRequest_task" />
-    <bpmn:sequenceFlow id="SequenceFlow_0khtova" sourceRef="PreprocessIncomingRequest_task" targetRef="instantiate_NSTask" />
+    <bpmn:sequenceFlow id="SequenceFlow_0khtova" sourceRef="PreprocessIncomingRequest_task" targetRef="ScriptTask_1g378se" />
     <bpmn:scriptTask id="Task_09nzhwk" name="Create service profile" scriptFormat="groovy">
       <bpmn:incoming>SequenceFlow_17u69c4</bpmn:incoming>
       <bpmn:outgoing>SequenceFlow_1uiz85h</bpmn:outgoing>
@@ -21,7 +21,7 @@ def dcsi = new DoCreateSliceServiceInstance()
 dcsi.preProcessRequest(execution)</bpmn:script>
     </bpmn:scriptTask>
     <bpmn:scriptTask id="instantiate_NSTask" name="create Slice Service in AAI" scriptFormat="groovy">
-      <bpmn:incoming>SequenceFlow_0khtova</bpmn:incoming>
+      <bpmn:incoming>SequenceFlow_11gmz7e</bpmn:incoming>
       <bpmn:outgoing>SequenceFlow_0g5bwvl</bpmn:outgoing>
       <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
 def dcsi = new DoCreateSliceServiceInstance()
@@ -40,6 +40,27 @@ def dcsi = new DoCreateSliceServiceInstance()
 dcsi.createAllottedResource(execution)</bpmn:script>
     </bpmn:scriptTask>
     <bpmn:sequenceFlow id="SequenceFlow_17u69c4" sourceRef="ScriptTask_18rzwzb" targetRef="Task_09nzhwk" />
+    <bpmn:scriptTask id="ScriptTask_1g378se" name="Prepare ServiceProfile&#10;Decompose Service&#10;" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_0khtova</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1wafqwa</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcsi= new CreateSliceService()
+dcsi.prepareDecomposeService(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:callActivity id="CallActivity_0svmkxh" name="Call Decompose Service" calledElement="DecomposeService">
+      <bpmn:extensionElements>
+        <camunda:in source="msoRequestId" target="msoRequestId" />
+        <camunda:in source="serviceInstanceId" target="serviceInstanceId" />
+        <camunda:in source="serviceModelInfo" target="serviceModelInfo" />
+        <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" />
+        <camunda:out source="serviceDecomposition" target="serviceProfileDecomposition" />
+        <camunda:out source="WorkflowException" target="WorkflowException" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>SequenceFlow_1wafqwa</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_11gmz7e</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:sequenceFlow id="SequenceFlow_1wafqwa" sourceRef="ScriptTask_1g378se" targetRef="CallActivity_0svmkxh" />
+    <bpmn:sequenceFlow id="SequenceFlow_11gmz7e" sourceRef="CallActivity_0svmkxh" targetRef="instantiate_NSTask" />
   </bpmn:process>
   <bpmndi:BPMNDiagram id="BPMNDiagram_1">
     <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoCreateSliceServiceInstance">
@@ -60,43 +81,57 @@ dcsi.createAllottedResource(execution)</bpmn:script>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_0khtova_di" bpmnElement="SequenceFlow_0khtova">
         <di:waypoint x="393" y="129" />
-        <di:waypoint x="474" y="129" />
+        <di:waypoint x="440" y="129" />
         <bpmndi:BPMNLabel>
           <dc:Bounds x="436" y="108" width="0" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="ScriptTask_1dw39hg_di" bpmnElement="Task_09nzhwk">
-        <dc:Bounds x="851" y="89" width="100" height="80" />
+        <dc:Bounds x="1120" y="89" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="ScriptTask_03j6ogo_di" bpmnElement="PreprocessIncomingRequest_task">
         <dc:Bounds x="293" y="89" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="ScriptTask_1qmmew8_di" bpmnElement="instantiate_NSTask">
-        <dc:Bounds x="474" y="89" width="100" height="80" />
+        <dc:Bounds x="790" y="89" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="EndEvent_15pcuuc_di" bpmnElement="EndEvent_1x6k78c">
-        <dc:Bounds x="1049" y="111" width="36" height="36" />
+        <dc:Bounds x="1292" y="111" width="36" height="36" />
         <bpmndi:BPMNLabel>
           <dc:Bounds x="412" y="617" width="90" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="SequenceFlow_1uiz85h_di" bpmnElement="SequenceFlow_1uiz85h">
-        <di:waypoint x="951" y="129" />
-        <di:waypoint x="1049" y="129" />
+        <di:waypoint x="1220" y="129" />
+        <di:waypoint x="1292" y="129" />
         <bpmndi:BPMNLabel>
           <dc:Bounds x="631" y="108" width="0" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_0g5bwvl_di" bpmnElement="SequenceFlow_0g5bwvl">
-        <di:waypoint x="574" y="129" />
-        <di:waypoint x="658" y="129" />
+        <di:waypoint x="890" y="129" />
+        <di:waypoint x="960" y="129" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="ScriptTask_18rzwzb_di" bpmnElement="ScriptTask_18rzwzb">
-        <dc:Bounds x="658" y="89" width="100" height="80" />
+        <dc:Bounds x="960" y="89" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="SequenceFlow_17u69c4_di" bpmnElement="SequenceFlow_17u69c4">
-        <di:waypoint x="758" y="129" />
-        <di:waypoint x="851" y="129" />
+        <di:waypoint x="1060" y="129" />
+        <di:waypoint x="1120" y="129" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="ScriptTask_1g378se_di" bpmnElement="ScriptTask_1g378se">
+        <dc:Bounds x="440" y="89" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="CallActivity_0svmkxh_di" bpmnElement="CallActivity_0svmkxh">
+        <dc:Bounds x="610" y="89" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_1wafqwa_di" bpmnElement="SequenceFlow_1wafqwa">
+        <di:waypoint x="540" y="129" />
+        <di:waypoint x="610" y="129" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_11gmz7e_di" bpmnElement="SequenceFlow_11gmz7e">
+        <di:waypoint x="710" y="129" />
+        <di:waypoint x="790" y="129" />
       </bpmndi:BPMNEdge>
     </bpmndi:BPMNPlane>
   </bpmndi:BPMNDiagram>
index 3ed1999..045d88d 100644 (file)
 <?xml version="1.0" encoding="UTF-8"?>
-<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="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:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.4.1">
   <bpmn:process id="DoCreateSliceServiceOption" name="DoCreateSliceServiceOption" isExecutable="true">
-    <bpmn:startEvent id="createNS_StartEvent" name="createOption_StartEvent">
-      <bpmn:outgoing>SequenceFlow_1qo2pln</bpmn:outgoing>
-    </bpmn:startEvent>
-    <bpmn:sequenceFlow id="SequenceFlow_1qo2pln" sourceRef="createNS_StartEvent" targetRef="PreprocessIncomingRequest_task" />
-    <bpmn:sequenceFlow id="SequenceFlow_0khtova" sourceRef="PreprocessIncomingRequest_task" targetRef="Task_09nzhwk" />
-    <bpmn:scriptTask id="Task_09nzhwk" name="Prepare OOF Select NSI options request" scriptFormat="groovy">
-      <bpmn:incoming>SequenceFlow_0khtova</bpmn:incoming>
-      <bpmn:outgoing>Flow_15c2jcx</bpmn:outgoing>
+    <bpmn:scriptTask id="ScriptTask_11rb2ju" name="prepare NST decomposition" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_067xdx1</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1kzy63m</bpmn:outgoing>
       <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
 def dcso = new DoCreateSliceServiceOption()
-dcso.prepareSelectNSIRequest(execution)</bpmn:script>
+dcso.prepareDecomposeNST(execution)</bpmn:script>
     </bpmn:scriptTask>
-    <bpmn:scriptTask id="PreprocessIncomingRequest_task" name="Preprocess Request" scriptFormat="groovy">
-      <bpmn:incoming>SequenceFlow_1qo2pln</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_0khtova</bpmn:outgoing>
+    <bpmn:callActivity id="CallActivity_0c567r4" name="Call Decompose Service" calledElement="DecomposeService">
+      <bpmn:extensionElements>
+        <camunda:in source="msoRequestId" target="msoRequestId" />
+        <camunda:in source="serviceInstanceId" target="serviceInstanceId" />
+        <camunda:in source="nstServiceModelInfo" target="serviceModelInfo" />
+        <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" />
+        <camunda:out source="serviceDecomposition" target="nstServiceDecomposition" />
+        <camunda:out source="WorkflowException" target="WorkflowException" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>SequenceFlow_1kzy63m</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1t317y2</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:scriptTask id="ScriptTask_0z0dwk2" name="Process Decomposition NST" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_1t317y2</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0t4gmix</bpmn:outgoing>
       <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
 def dcso = new DoCreateSliceServiceOption()
-dcso.preProcessRequest(execution)</bpmn:script>
+dcso.processDecompositionNST(execution)</bpmn:script>
     </bpmn:scriptTask>
-    <bpmn:endEvent id="EndEvent_1x6k78c">
-      <bpmn:incoming>SequenceFlow_1ap8kar</bpmn:incoming>
-      <bpmn:incoming>SequenceFlow_0hnsycl</bpmn:incoming>
+    <bpmn:sequenceFlow id="SequenceFlow_1kzy63m" sourceRef="ScriptTask_11rb2ju" targetRef="CallActivity_0c567r4" />
+    <bpmn:sequenceFlow id="SequenceFlow_1t317y2" sourceRef="CallActivity_0c567r4" targetRef="ScriptTask_0z0dwk2" />
+    <bpmn:parallelGateway id="ParallelGateway_05zg916">
+      <bpmn:incoming>SequenceFlow_1h3kdce</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_05250mp</bpmn:outgoing>
+      <bpmn:outgoing>SequenceFlow_0euwvgf</bpmn:outgoing>
+      <bpmn:outgoing>SequenceFlow_0il5j01</bpmn:outgoing>
+    </bpmn:parallelGateway>
+    <bpmn:parallelGateway id="ParallelGateway_06a2n9u">
+      <bpmn:incoming>SequenceFlow_14rhmx9</bpmn:incoming>
+      <bpmn:incoming>SequenceFlow_103oxyw</bpmn:incoming>
+      <bpmn:incoming>SequenceFlow_0aasemn</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1tr3i9d</bpmn:outgoing>
+    </bpmn:parallelGateway>
+    <bpmn:callActivity id="CallActivity_0tzazs0" name="Handle NSST Selection OOF request" calledElement="DoHandleOofRequest">
+      <bpmn:extensionElements>
+        <camunda:in source="nstSelectionUrl" target="apiPath" />
+        <camunda:in source="nstSelection_correlator" target="correlator" />
+        <camunda:in source="nstSelection_messageType" target="messageType" />
+        <camunda:in source="nstSelection_timeout" target="timeout" />
+        <camunda:out source="WorkflowException" target="WorkflowException" />
+        <camunda:out source="asyncCallbackResponse" target="nstSelection_oofResponse" />
+        <camunda:in source="nstSelection_oofRequest" target="oofRequest" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>SequenceFlow_0abqxa1</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1tqg26p</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:sequenceFlow id="SequenceFlow_05250mp" sourceRef="ParallelGateway_05zg916" targetRef="CallActivity_1vzxvna" />
+    <bpmn:sequenceFlow id="SequenceFlow_14rhmx9" sourceRef="CallActivity_1vzxvna" targetRef="ParallelGateway_06a2n9u" />
+    <bpmn:sequenceFlow id="SequenceFlow_0euwvgf" sourceRef="ParallelGateway_05zg916" targetRef="CallActivity_0melx8d" />
+    <bpmn:sequenceFlow id="SequenceFlow_103oxyw" sourceRef="CallActivity_0melx8d" targetRef="ParallelGateway_06a2n9u" />
+    <bpmn:sequenceFlow id="SequenceFlow_0il5j01" sourceRef="ParallelGateway_05zg916" targetRef="CallActivity_0otry7e" />
+    <bpmn:sequenceFlow id="SequenceFlow_0aasemn" sourceRef="CallActivity_0otry7e" targetRef="ParallelGateway_06a2n9u" />
+    <bpmn:sequenceFlow id="SequenceFlow_1tr3i9d" sourceRef="ParallelGateway_06a2n9u" targetRef="Task_1jyj2vs" />
+    <bpmn:sequenceFlow id="SequenceFlow_0abqxa1" sourceRef="Task_1m9qoo3" targetRef="CallActivity_0tzazs0" />
+    <bpmn:sequenceFlow id="SequenceFlow_1tqg26p" sourceRef="CallActivity_0tzazs0" targetRef="Task_00nfg5x" />
+    <bpmn:endEvent id="EndEvent_0p0cjhl">
+      <bpmn:incoming>SequenceFlow_1nrfy6i</bpmn:incoming>
     </bpmn:endEvent>
-    <bpmn:scriptTask id="ScriptTask_0kecvrc" name="prepare list of NSST associated with NST" scriptFormat="groovy">
-      <bpmn:incoming>SequenceFlow_0wy6oag</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_0lt2cdo</bpmn:outgoing>
+    <bpmn:startEvent id="StartEvent_0mwlirs" name="Start">
+      <bpmn:outgoing>SequenceFlow_1fuwy35</bpmn:outgoing>
+    </bpmn:startEvent>
+    <bpmn:scriptTask id="ScriptTask_0w34e57" name="Preprocess Request" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_1fuwy35</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_067xdx1</bpmn:outgoing>
       <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
 def dcso = new DoCreateSliceServiceOption()
-dcso.prepareNSSTlistfromNST(execution)</bpmn:script>
+dcso.preProcessRequest(execution)</bpmn:script>
     </bpmn:scriptTask>
-    <bpmn:scriptTask id="ScriptTask_1mlytov" name="send request to OOF for NSSI options" scriptFormat="groovy">
-      <bpmn:incoming>SequenceFlow_0a5f5y6</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_1r9n9ef</bpmn:outgoing>
+    <bpmn:sequenceFlow id="SequenceFlow_1fuwy35" sourceRef="StartEvent_0mwlirs" targetRef="ScriptTask_0w34e57" />
+    <bpmn:scriptTask id="CallActivity_1vzxvna" name="TN NSSMF supports NSSI" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_05250mp</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_14rhmx9</bpmn:outgoing>
       <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
 def dcso = new DoCreateSliceServiceOption()
-dcso.getNSSTOption(execution)</bpmn:script>
+dcso.getNSSISelectionCap4TN(execution)</bpmn:script>
     </bpmn:scriptTask>
-    <bpmn:exclusiveGateway id="ExclusiveGateway_1y1wzs9">
-      <bpmn:incoming>SequenceFlow_0lt2cdo</bpmn:incoming>
-      <bpmn:incoming>SequenceFlow_1r9n9ef</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_1ap8kar</bpmn:outgoing>
-      <bpmn:outgoing>SequenceFlow_0m2mr0o</bpmn:outgoing>
-    </bpmn:exclusiveGateway>
-    <bpmn:sequenceFlow id="SequenceFlow_1ap8kar" sourceRef="ExclusiveGateway_1y1wzs9" targetRef="EndEvent_1x6k78c">
-      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isMoreNSSTtoProcess" )  == false)}</bpmn:conditionExpression>
-    </bpmn:sequenceFlow>
-    <bpmn:sequenceFlow id="SequenceFlow_0lt2cdo" sourceRef="ScriptTask_0kecvrc" targetRef="ExclusiveGateway_1y1wzs9" />
-    <bpmn:sequenceFlow id="SequenceFlow_0m2mr0o" sourceRef="ExclusiveGateway_1y1wzs9" targetRef="ScriptTask_1e5ysya">
-      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isMoreNSSTtoProcess" )  == true)}</bpmn:conditionExpression>
-    </bpmn:sequenceFlow>
-    <bpmn:sequenceFlow id="SequenceFlow_1r9n9ef" sourceRef="ScriptTask_1mlytov" targetRef="ExclusiveGateway_1y1wzs9" />
-    <bpmn:scriptTask id="ScriptTask_1e5ysya" name="prepare NSST decomposition" scriptFormat="groovy">
-      <bpmn:incoming>SequenceFlow_0m2mr0o</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_016vi3s</bpmn:outgoing>
+    <bpmn:scriptTask id="CallActivity_0melx8d" name="CN NSSMF supports NSSI" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_0euwvgf</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_103oxyw</bpmn:outgoing>
       <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
 def dcso = new DoCreateSliceServiceOption()
-dcso.prepareNSSTDecompose(execution)</bpmn:script>
+dcso.getNSSISelectionCap4CN(execution)</bpmn:script>
     </bpmn:scriptTask>
-    <bpmn:sequenceFlow id="SequenceFlow_016vi3s" sourceRef="ScriptTask_1e5ysya" targetRef="CallActivity_1rfnoe2" />
-    <bpmn:callActivity id="CallActivity_1rfnoe2" name="Call Decompose Service" calledElement="DecomposeService">
-      <bpmn:extensionElements>
-        <camunda:in source="msoRequestId" target="msoRequestId" />
-        <camunda:in source="serviceInstanceId" target="serviceInstanceId" />
-        <camunda:in source="serviceModelInfo" target="serviceModelInfo" />
-        <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" />
-        <camunda:out source="serviceDecomposition" target="serviceDecomposition" />
-        <camunda:out source="WorkflowException" target="WorkflowException" />
-      </bpmn:extensionElements>
-      <bpmn:incoming>SequenceFlow_016vi3s</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_0a5f5y6</bpmn:outgoing>
-    </bpmn:callActivity>
-    <bpmn:sequenceFlow id="SequenceFlow_0a5f5y6" sourceRef="CallActivity_1rfnoe2" targetRef="ScriptTask_1mlytov" />
-    <bpmn:exclusiveGateway id="ExclusiveGateway_1skfk7w" default="SequenceFlow_0wy6oag">
-      <bpmn:incoming>SequenceFlow_0d774n5</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_0wy6oag</bpmn:outgoing>
-      <bpmn:outgoing>SequenceFlow_0hnsycl</bpmn:outgoing>
+    <bpmn:scriptTask id="CallActivity_0otry7e" name="AN NSSMF supports NSSI" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_0il5j01</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0aasemn</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcso = new DoCreateSliceServiceOption()
+dcso.getNSSISelectionCap4AN(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Task_1m9qoo3" name="Prepare NSSI Selection" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_126j77n</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0abqxa1</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcso = new DoCreateSliceServiceOption()
+dcso.preNSSIRequest(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Task_00nfg5x" name="Process NSST Solutions" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_1tqg26p</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1i3j8c3</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcso = new DoCreateSliceServiceOption()
+dcso.processNSSIResp(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:exclusiveGateway id="ExclusiveGateway_0b52m39" name="need select nssi?" default="SequenceFlow_1nrfy6i">
+      <bpmn:incoming>SequenceFlow_1tey3hz</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_126j77n</bpmn:outgoing>
+      <bpmn:outgoing>SequenceFlow_1nrfy6i</bpmn:outgoing>
     </bpmn:exclusiveGateway>
-    <bpmn:sequenceFlow id="SequenceFlow_0wy6oag" sourceRef="ExclusiveGateway_1skfk7w" targetRef="ScriptTask_0kecvrc" />
-    <bpmn:sequenceFlow id="SequenceFlow_0hnsycl" sourceRef="ExclusiveGateway_1skfk7w" targetRef="EndEvent_1x6k78c">
-      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isNSISuggested" )  == true)}</bpmn:conditionExpression>
+    <bpmn:sequenceFlow id="SequenceFlow_126j77n" name="yes" sourceRef="ExclusiveGateway_0b52m39" targetRef="Task_1m9qoo3">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("nssmfOperation" )  == "update")}</bpmn:conditionExpression>
     </bpmn:sequenceFlow>
-    <bpmn:scriptTask id="ScriptTask_1umbyel" name="prepare NST decomposition" scriptFormat="groovy">
-      <bpmn:incoming>Flow_07ustqm</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_0piifl1</bpmn:outgoing>
+    <bpmn:sequenceFlow id="SequenceFlow_1nrfy6i" sourceRef="ExclusiveGateway_0b52m39" targetRef="EndEvent_0p0cjhl" />
+    <bpmn:sequenceFlow id="SequenceFlow_1i3j8c3" sourceRef="Task_00nfg5x" targetRef="Task_1jyj2vs" />
+    <bpmn:sequenceFlow id="SequenceFlow_1tey3hz" sourceRef="Task_1jyj2vs" targetRef="ExclusiveGateway_0b52m39" />
+    <bpmn:scriptTask id="Task_1jyj2vs" name="handle Nssi select " scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_1tr3i9d</bpmn:incoming>
+      <bpmn:incoming>SequenceFlow_1i3j8c3</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1tey3hz</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcso = new DoCreateSliceServiceOption()
+dcso.handleNssiSelect(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="ScriptTask_12sydez" name="prepare NSST decomposition" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_0zglfyw</bpmn:incoming>
+      <bpmn:incoming>SequenceFlow_0t4gmix</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_12pvazb</bpmn:outgoing>
       <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
 def dcso = new DoCreateSliceServiceOption()
-dcso.prepareNSTDecompose(execution)</bpmn:script>
+dcso.prepareDecomposeNSST(execution)</bpmn:script>
     </bpmn:scriptTask>
-    <bpmn:sequenceFlow id="SequenceFlow_0piifl1" sourceRef="ScriptTask_1umbyel" targetRef="CallActivity_0ly8xiw" />
-    <bpmn:callActivity id="CallActivity_0ly8xiw" name="Call Decompose Service" calledElement="DecomposeService">
+    <bpmn:callActivity id="CallActivity_0hfiogq" name="Call Decompose Service" calledElement="DecomposeService">
       <bpmn:extensionElements>
         <camunda:in source="msoRequestId" target="msoRequestId" />
         <camunda:in source="serviceInstanceId" target="serviceInstanceId" />
-        <camunda:in source="serviceModelInfo" target="serviceModelInfo" />
+        <camunda:in source="nsstServiceModelInfo" target="serviceModelInfo" />
         <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" />
-        <camunda:out source="serviceDecomposition" target="serviceDecomposition" />
+        <camunda:out source="serviceDecomposition" target="nsstServiceDecomposition" />
         <camunda:out source="WorkflowException" target="WorkflowException" />
       </bpmn:extensionElements>
-      <bpmn:incoming>SequenceFlow_0piifl1</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_086yszq</bpmn:outgoing>
+      <bpmn:incoming>SequenceFlow_12pvazb</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1inonqp</bpmn:outgoing>
     </bpmn:callActivity>
-    <bpmn:sequenceFlow id="SequenceFlow_086yszq" sourceRef="CallActivity_0ly8xiw" targetRef="Task_1k2ypj0" />
-    <bpmn:sequenceFlow id="SequenceFlow_0d774n5" sourceRef="Task_1k2ypj0" targetRef="ExclusiveGateway_1skfk7w" />
-    <bpmn:scriptTask id="Task_1k2ypj0" name="Process Decomposition" scriptFormat="groovy">
-      <bpmn:incoming>SequenceFlow_086yszq</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_0d774n5</bpmn:outgoing>
+    <bpmn:scriptTask id="ScriptTask_14j28c2" name="Process NSST Decomposition" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_1inonqp</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_049glzl</bpmn:outgoing>
+      <bpmn:outgoing>SequenceFlow_0zglfyw</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcso = new DoCreateSliceServiceOption()
+dcso.processDecompositionNSST(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="SequenceFlow_12pvazb" sourceRef="ScriptTask_12sydez" targetRef="CallActivity_0hfiogq" />
+    <bpmn:sequenceFlow id="SequenceFlow_1inonqp" sourceRef="CallActivity_0hfiogq" targetRef="ScriptTask_14j28c2" />
+    <bpmn:intermediateThrowEvent id="IntermediateThrowEvent_1bxdugq" name="Goto Select NSSI ">
+      <bpmn:incoming>SequenceFlow_16akt81</bpmn:incoming>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_1id21k7" name="SelectNSSI" />
+    </bpmn:intermediateThrowEvent>
+    <bpmn:sequenceFlow id="SequenceFlow_067xdx1" sourceRef="ScriptTask_0w34e57" targetRef="ScriptTask_11rb2ju" />
+    <bpmn:sequenceFlow id="SequenceFlow_049glzl" sourceRef="ScriptTask_14j28c2" targetRef="Task_1xqjkqx">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("nsstHandleContinue" ) == "false")}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:sequenceFlow id="SequenceFlow_0zglfyw" sourceRef="ScriptTask_14j28c2" targetRef="ScriptTask_12sydez">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("nsstHandleContinue" ) == "true")}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:sequenceFlow id="SequenceFlow_0t4gmix" sourceRef="ScriptTask_0z0dwk2" targetRef="ScriptTask_12sydez" />
+    <bpmn:scriptTask id="Task_1xqjkqx" name="handle Nsst By Type&#10;" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_049glzl</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_16akt81</bpmn:outgoing>
       <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
 def dcso = new DoCreateSliceServiceOption()
-dcso.processDecomposition(execution)</bpmn:script>
+dcso.handleNsstByType(execution)</bpmn:script>
     </bpmn:scriptTask>
-    <bpmn:callActivity id="Activity_0dlr4ra" name="Handle NSI Selection OOF request" calledElement="DoHandleOofRequest">
+    <bpmn:sequenceFlow id="SequenceFlow_16akt81" sourceRef="Task_1xqjkqx" targetRef="IntermediateThrowEvent_1bxdugq" />
+    <bpmn:callActivity id="CallActivity_0vs5jgq" name="Handle NSI Selection OOF request" calledElement="DoHandleOofRequest">
       <bpmn:extensionElements>
         <camunda:in source="nsiSelectionUrl" target="apiPath" />
         <camunda:in source="nsiSelection_correlator" target="correlator" />
@@ -121,149 +191,239 @@ dcso.processDecomposition(execution)</bpmn:script>
         <camunda:out source="asyncCallbackResponse" target="nsiSelection_oofResponse" />
         <camunda:in source="nsiSelection_oofRequest" target="oofRequest" />
       </bpmn:extensionElements>
-      <bpmn:incoming>Flow_15c2jcx</bpmn:incoming>
-      <bpmn:outgoing>Flow_1mcx2ja</bpmn:outgoing>
+      <bpmn:incoming>SequenceFlow_14o0fxe</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0nwt0ci</bpmn:outgoing>
     </bpmn:callActivity>
-    <bpmn:scriptTask id="Activity_049mjag" name="Process OOF response " scriptFormat="groovy">
-      <bpmn:incoming>Flow_1mcx2ja</bpmn:incoming>
-      <bpmn:outgoing>Flow_07ustqm</bpmn:outgoing>
+    <bpmn:scriptTask id="ScriptTask_12t6v71" name="Process OOF response " scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_0nwt0ci</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1h3kdce</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcso = new DoCreateSliceServiceOption()
+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:outgoing>SequenceFlow_14o0fxe</bpmn:outgoing>
       <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
 def dcso = new DoCreateSliceServiceOption()
-dcso.processOOFResponse(execution)</bpmn:script>
+dcso.preNSIRequest(execution)</bpmn:script>
     </bpmn:scriptTask>
-    <bpmn:sequenceFlow id="Flow_1mcx2ja" sourceRef="Activity_0dlr4ra" targetRef="Activity_049mjag" />
-    <bpmn:sequenceFlow id="Flow_15c2jcx" sourceRef="Task_09nzhwk" targetRef="Activity_0dlr4ra" />
-    <bpmn:sequenceFlow id="Flow_07ustqm" sourceRef="Activity_049mjag" targetRef="ScriptTask_1umbyel" />
+    <bpmn:intermediateCatchEvent id="IntermediateCatchEvent_00uke3g" name=" Select NSSI ">
+      <bpmn:outgoing>SequenceFlow_1iawj3m</bpmn:outgoing>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_0czx4vp" name="SelectNSSI" />
+    </bpmn:intermediateCatchEvent>
+    <bpmn:sequenceFlow id="SequenceFlow_14o0fxe" sourceRef="ScriptTask_0bgvphs" targetRef="CallActivity_0vs5jgq" />
+    <bpmn:sequenceFlow id="SequenceFlow_0nwt0ci" sourceRef="CallActivity_0vs5jgq" targetRef="ScriptTask_12t6v71" />
+    <bpmn:sequenceFlow id="SequenceFlow_1iawj3m" sourceRef="IntermediateCatchEvent_00uke3g" targetRef="ScriptTask_0bgvphs" />
+    <bpmn:sequenceFlow id="SequenceFlow_1h3kdce" sourceRef="ScriptTask_12t6v71" targetRef="ParallelGateway_05zg916" />
   </bpmn:process>
   <bpmndi:BPMNDiagram id="BPMNDiagram_1">
-    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoCreateSliceServiceOption">
-      <bpmndi:BPMNEdge id="SequenceFlow_0d774n5_di" bpmnElement="SequenceFlow_0d774n5">
-        <di:waypoint x="1220" y="125" />
-        <di:waypoint x="1275" y="125" />
+    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoCreateSliceServiceOptionV2">
+      <bpmndi:BPMNShape id="ScriptTask_11rb2ju_di" bpmnElement="ScriptTask_11rb2ju">
+        <dc:Bounds x="400" 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" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_0z0dwk2_di" bpmnElement="ScriptTask_0z0dwk2">
+        <dc:Bounds x="710" 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" />
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_086yszq_di" bpmnElement="SequenceFlow_086yszq">
-        <di:waypoint x="1060" y="125" />
-        <di:waypoint x="1120" y="125" />
+      <bpmndi:BPMNEdge id="SequenceFlow_1t317y2_di" bpmnElement="SequenceFlow_1t317y2">
+        <di:waypoint x="660" y="180" />
+        <di:waypoint x="710" y="180" />
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_0piifl1_di" bpmnElement="SequenceFlow_0piifl1">
-        <di:waypoint x="920" y="125" />
-        <di:waypoint x="960" y="125" />
+      <bpmndi:BPMNShape id="ParallelGateway_05zg916_di" bpmnElement="ParallelGateway_05zg916">
+        <dc:Bounds x="635" y="475" width="50" height="50" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ParallelGateway_06a2n9u_di" bpmnElement="ParallelGateway_06a2n9u">
+        <dc:Bounds x="905" y="475" width="50" height="50" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="CallActivity_0tzazs0_di" bpmnElement="CallActivity_0tzazs0">
+        <dc:Bounds x="1410" y="320" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <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" />
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_0hnsycl_di" bpmnElement="SequenceFlow_0hnsycl">
-        <di:waypoint x="1325" y="125" />
-        <di:waypoint x="1993" y="125" />
+      <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" />
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_0wy6oag_di" bpmnElement="SequenceFlow_0wy6oag">
-        <di:waypoint x="1300" y="150" />
-        <di:waypoint x="1300" y="351" />
-        <di:waypoint x="1430" y="351" />
+      <bpmndi:BPMNEdge id="SequenceFlow_0euwvgf_di" bpmnElement="SequenceFlow_0euwvgf">
+        <di:waypoint x="685" y="500" />
+        <di:waypoint x="740" y="500" />
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_0a5f5y6_di" bpmnElement="SequenceFlow_0a5f5y6">
-        <di:waypoint x="2061" y="351" />
-        <di:waypoint x="2148" y="351" />
-        <di:waypoint x="2148" y="493" />
-        <di:waypoint x="1960" y="493" />
+      <bpmndi:BPMNEdge id="SequenceFlow_103oxyw_di" bpmnElement="SequenceFlow_103oxyw">
+        <di:waypoint x="840" y="500" />
+        <di:waypoint x="905" y="500" />
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_016vi3s_di" bpmnElement="SequenceFlow_016vi3s">
-        <di:waypoint x="1872" y="351" />
-        <di:waypoint x="1961" y="351" />
+      <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" />
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_1r9n9ef_di" bpmnElement="SequenceFlow_1r9n9ef">
-        <di:waypoint x="1860" y="493" />
-        <di:waypoint x="1666" y="493" />
-        <di:waypoint x="1666" y="376" />
+      <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" />
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_0m2mr0o_di" bpmnElement="SequenceFlow_0m2mr0o">
-        <di:waypoint x="1691" y="351" />
-        <di:waypoint x="1772" y="351" />
+      <bpmndi:BPMNEdge id="SequenceFlow_1tr3i9d_di" bpmnElement="SequenceFlow_1tr3i9d">
+        <di:waypoint x="955" y="500" />
+        <di:waypoint x="1010" y="500" />
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_0lt2cdo_di" bpmnElement="SequenceFlow_0lt2cdo">
-        <di:waypoint x="1530" y="351" />
-        <di:waypoint x="1641" y="351" />
+      <bpmndi:BPMNEdge id="SequenceFlow_0abqxa1_di" bpmnElement="SequenceFlow_0abqxa1">
+        <di:waypoint x="1460" y="460" />
+        <di:waypoint x="1460" y="400" />
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_1ap8kar_di" bpmnElement="SequenceFlow_1ap8kar">
-        <di:waypoint x="1666" y="326" />
-        <di:waypoint x="1666" y="235" />
-        <di:waypoint x="2011" y="235" />
-        <di:waypoint x="2011" y="143" />
+      <bpmndi:BPMNEdge id="SequenceFlow_1tqg26p_di" bpmnElement="SequenceFlow_1tqg26p">
+        <di:waypoint x="1410" y="360" />
+        <di:waypoint x="1110" y="360" />
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_0khtova_di" bpmnElement="SequenceFlow_0khtova">
-        <di:waypoint x="350" y="125" />
-        <di:waypoint x="390" y="125" />
+      <bpmndi:BPMNShape id="EndEvent_0p0cjhl_di" bpmnElement="EndEvent_0p0cjhl">
+        <dc:Bounds x="1442" y="602" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="StartEvent_0mwlirs_di" bpmnElement="StartEvent_0mwlirs">
+        <dc:Bounds x="162" y="162" width="36" height="36" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="436" y="108" width="0" height="12" />
+          <dc:Bounds x="169" 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" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_1fuwy35_di" bpmnElement="SequenceFlow_1fuwy35">
+        <di:waypoint x="198" y="180" />
+        <di:waypoint x="230" y="180" />
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_1qo2pln_di" bpmnElement="SequenceFlow_1qo2pln">
-        <di:waypoint x="218" y="125" />
-        <di:waypoint x="250" y="125" />
+      <bpmndi:BPMNShape id="ScriptTask_1anc3ln_di" bpmnElement="CallActivity_1vzxvna">
+        <dc:Bounds x="740" y="320" 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" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_11y7ba5_di" bpmnElement="CallActivity_0otry7e">
+        <dc:Bounds x="740" 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" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_0aqbm7t_di" bpmnElement="Task_00nfg5x">
+        <dc:Bounds x="1010" y="320" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ExclusiveGateway_0b52m39_di" bpmnElement="ExclusiveGateway_0b52m39" isMarkerVisible="true">
+        <dc:Bounds x="1235" y="475" width="50" height="50" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1218" y="463" width="85" 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" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="266" y="123" width="0" height="12" />
+          <dc:Bounds x="1339" y="482" width="17" height="14" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="Flow_1mcx2ja_di" bpmnElement="Flow_1mcx2ja">
-        <di:waypoint x="640" y="125" />
-        <di:waypoint x="680" y="125" />
+      <bpmndi:BPMNEdge id="SequenceFlow_1nrfy6i_di" bpmnElement="SequenceFlow_1nrfy6i">
+        <di:waypoint x="1260" y="525" />
+        <di:waypoint x="1260" y="620" />
+        <di:waypoint x="1442" y="620" />
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="Flow_15c2jcx_di" bpmnElement="Flow_15c2jcx">
-        <di:waypoint x="490" y="122" />
-        <di:waypoint x="540" y="120" />
+      <bpmndi:BPMNEdge id="SequenceFlow_1i3j8c3_di" bpmnElement="SequenceFlow_1i3j8c3">
+        <di:waypoint x="1060" y="400" />
+        <di:waypoint x="1060" y="460" />
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="Flow_07ustqm_di" bpmnElement="Flow_07ustqm">
-        <di:waypoint x="780" y="125" />
-        <di:waypoint x="820" y="125" />
+      <bpmndi:BPMNEdge id="SequenceFlow_1tey3hz_di" bpmnElement="SequenceFlow_1tey3hz">
+        <di:waypoint x="1110" y="500" />
+        <di:waypoint x="1235" y="500" />
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNShape id="EndEvent_15pcuuc_di" bpmnElement="EndEvent_1x6k78c">
-        <dc:Bounds x="1993" y="107" width="36" height="36" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="412" y="617" width="90" height="12" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="ScriptTask_0kecvrc_di" bpmnElement="ScriptTask_0kecvrc">
-        <dc:Bounds x="1430" y="311" width="100" height="80" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="ScriptTask_1mlytov_di" bpmnElement="ScriptTask_1mlytov">
-        <dc:Bounds x="1860" y="453" width="100" height="80" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="ExclusiveGateway_1y1wzs9_di" bpmnElement="ExclusiveGateway_1y1wzs9" isMarkerVisible="true">
-        <dc:Bounds x="1641" y="326" width="50" height="50" />
+      <bpmndi:BPMNShape id="ScriptTask_0h3fsja_di" bpmnElement="Task_1jyj2vs">
+        <dc:Bounds x="1010" y="460" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="ScriptTask_1e5ysya_di" bpmnElement="ScriptTask_1e5ysya">
-        <dc:Bounds x="1772" y="311" width="100" height="80" />
+      <bpmndi:BPMNShape id="ScriptTask_12sydez_di" bpmnElement="ScriptTask_12sydez">
+        <dc:Bounds x="860" y="140" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="CallActivity_1rfnoe2_di" bpmnElement="CallActivity_1rfnoe2">
-        <dc:Bounds x="1961" y="311" width="100" height="80" />
+      <bpmndi:BPMNShape id="CallActivity_0hfiogq_di" bpmnElement="CallActivity_0hfiogq">
+        <dc:Bounds x="1010" y="140" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="ExclusiveGateway_1skfk7w_di" bpmnElement="ExclusiveGateway_1skfk7w" isMarkerVisible="true">
-        <dc:Bounds x="1275" y="100" width="50" height="50" />
+      <bpmndi:BPMNShape id="ScriptTask_14j28c2_di" bpmnElement="ScriptTask_14j28c2">
+        <dc:Bounds x="1170" y="140" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="CallActivity_0ly8xiw_di" bpmnElement="CallActivity_0ly8xiw">
-        <dc:Bounds x="960" y="85" width="100" height="80" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="ScriptTask_1895p18_di" bpmnElement="Task_1k2ypj0">
-        <dc:Bounds x="1120" y="85" width="100" height="80" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="createNS_StartEvent">
-        <dc:Bounds x="182" y="107" width="36" height="36" />
+      <bpmndi:BPMNEdge id="SequenceFlow_12pvazb_di" bpmnElement="SequenceFlow_12pvazb">
+        <di:waypoint x="960" y="180" />
+        <di:waypoint x="1010" 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" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="IntermediateThrowEvent_1bxdugq_di" bpmnElement="IntermediateThrowEvent_1bxdugq">
+        <dc:Bounds x="1482" y="162" width="36" height="36" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="158" y="143" width="86" height="27" />
+          <dc:Bounds x="1459" y="205" width="87" height="14" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="ScriptTask_03j6ogo_di" bpmnElement="PreprocessIncomingRequest_task">
-        <dc:Bounds x="250" y="85" width="100" height="80" />
+      <bpmndi:BPMNEdge id="SequenceFlow_067xdx1_di" bpmnElement="SequenceFlow_067xdx1">
+        <di:waypoint x="330" y="180" />
+        <di:waypoint x="400" 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" />
+      </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" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0t4gmix_di" bpmnElement="SequenceFlow_0t4gmix">
+        <di:waypoint x="810" y="180" />
+        <di:waypoint x="860" y="180" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="ScriptTask_1tx9eou_di" bpmnElement="Task_1xqjkqx">
+        <dc:Bounds x="1320" y="140" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="ScriptTask_1dw39hg_di" bpmnElement="Task_09nzhwk">
-        <dc:Bounds x="390" y="85" width="100" height="80" />
+      <bpmndi:BPMNEdge id="SequenceFlow_16akt81_di" bpmnElement="SequenceFlow_16akt81">
+        <di:waypoint x="1420" y="180" />
+        <di:waypoint x="1482" y="180" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="CallActivity_0vs5jgq_di" bpmnElement="CallActivity_0vs5jgq">
+        <dc:Bounds x="360" y="460" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Activity_049mjag_di" bpmnElement="Activity_049mjag">
-        <dc:Bounds x="680" y="85" width="100" height="80" />
+      <bpmndi:BPMNShape id="ScriptTask_12t6v71_di" bpmnElement="ScriptTask_12t6v71">
+        <dc:Bounds x="490" y="460" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Activity_0dlr4ra_di" bpmnElement="Activity_0dlr4ra">
-        <dc:Bounds x="540" y="85" width="100" height="80" />
+      <bpmndi:BPMNShape id="ScriptTask_0bgvphs_di" bpmnElement="ScriptTask_0bgvphs">
+        <dc:Bounds x="210" y="460" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="ScriptTask_1umbyel_di" bpmnElement="ScriptTask_1umbyel">
-        <dc:Bounds x="820" y="85" width="100" height="80" />
+      <bpmndi:BPMNShape id="IntermediateCatchEvent_00uke3g_di" bpmnElement="IntermediateCatchEvent_00uke3g">
+        <dc:Bounds x="142" y="482" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="135" 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" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0nwt0ci_di" bpmnElement="SequenceFlow_0nwt0ci">
+        <di:waypoint x="460" y="500" />
+        <di:waypoint x="490" 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" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1h3kdce_di" bpmnElement="SequenceFlow_1h3kdce">
+        <di:waypoint x="590" y="500" />
+        <di:waypoint x="635" y="500" />
+      </bpmndi:BPMNEdge>
     </bpmndi:BPMNPlane>
   </bpmndi:BPMNDiagram>
 </bpmn:definitions>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateTnNssiInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateTnNssiInstance.bpmn
new file mode 100644 (file)
index 0000000..e9cbbb7
--- /dev/null
@@ -0,0 +1,179 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.1.1">
+  <bpmn:process id="DoCreateTnNssiInstance" name="DoCreateTnNssiInstance" isExecutable="true">
+    <bpmn:startEvent id="allocateTnNssi_StartEvent" name="allocateTnNssi_StartEvent">
+      <bpmn:outgoing>SequenceFlow_1qo2pln</bpmn:outgoing>
+    </bpmn:startEvent>
+    <bpmn:sequenceFlow id="SequenceFlow_1qo2pln" sourceRef="allocateTnNssi_StartEvent" targetRef="PreprocessIncomingRequest_task" />
+    <bpmn:sequenceFlow id="SequenceFlow_0khtova" sourceRef="PreprocessIncomingRequest_task" targetRef="instantiate_NSTask" />
+    <bpmn:scriptTask id="PreprocessIncomingRequest_task" name="Preprocess Incoming Request" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_1qo2pln</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0khtova</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcsi = new DoCreateTnNssiInstance()
+dcsi.preProcessRequest(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="instantiate_NSTask" name="create Service Instance in AAI" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_0khtova</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0g5bwvl</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcsi = new DoCreateTnNssiInstance()
+dcsi.createServiceInstance(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="SequenceFlow_1uiz85h" sourceRef="Activity_16luyg1" targetRef="Event_1rsf7yb" />
+    <bpmn:sequenceFlow id="SequenceFlow_0g5bwvl" sourceRef="instantiate_NSTask" targetRef="Activity_08tw2di" />
+    <bpmn:scriptTask id="ScriptTask_18rzwzb" name="Create Allottedsource in AAI" scriptFormat="groovy">
+      <bpmn:incoming>Flow_106ei42</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_17u69c4</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcsi = new DoCreateTnNssiInstance()
+dcsi.createAllottedResource(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="SequenceFlow_17u69c4" sourceRef="ScriptTask_18rzwzb" targetRef="Event_1a9swwa" />
+    <bpmn:intermediateCatchEvent id="Event_0l9vk9p" name="Start SDNC Operation">
+      <bpmn:outgoing>Flow_1c8zr59</bpmn:outgoing>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_0uwmpn2" name="SdncOperation" />
+    </bpmn:intermediateCatchEvent>
+    <bpmn:scriptTask id="Activity_0eh82ds" name="PreProcess SDNC Allocate TN NSSI Request" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1c8zr59</bpmn:incoming>
+      <bpmn:outgoing>Flow_0pko5tm</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcsi = new DoCreateTnNssiInstance()
+dcsi.preprocessSdncAllocateTnNssiRequest(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:callActivity id="Activity_1fs2182" name="Call SDNC Adapter: Allocate TN NSSI" calledElement="sdncAdapter">
+      <bpmn:extensionElements>
+        <camunda:in source="TNNSSMF_SDNCRequest" target="sdncAdapterWorkflowRequest" />
+        <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" />
+        <camunda:in source="mso-request-id" target="mso-request-id" />
+        <camunda:in source="mso-service-instance-id" target="mso-service-instance-id" />
+        <camunda:out source="WorkflowException" target="WorkflowException" />
+        <camunda:out source="sdncAdapterResponse" target="TNNSSMF_SDNCAdapterResponse" />
+        <camunda:out source="SDNCA_SuccessIndicator" target="SDNCA_SuccessIndicator" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_0pko5tm</bpmn:incoming>
+      <bpmn:outgoing>Flow_11kadz7</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:scriptTask id="Activity_16luyg1" name="Postprocess SDNC Allocate TN NSSI  Request" scriptFormat="groovy">
+      <bpmn:incoming>Flow_11kadz7</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1uiz85h</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+
+String response = execution.getVariable("TNNSSMF_SDNCAdapterResponse")
+
+def dcsi = new DoCreateTnNssiInstance()
+dcsi.validateSDNCResponse(execution, response, "allocate")</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_1c8zr59" name="" sourceRef="Event_0l9vk9p" targetRef="Activity_0eh82ds" />
+    <bpmn:sequenceFlow id="Flow_0pko5tm" name="" sourceRef="Activity_0eh82ds" targetRef="Activity_1fs2182" />
+    <bpmn:sequenceFlow id="Flow_11kadz7" name="" sourceRef="Activity_1fs2182" targetRef="Activity_16luyg1" />
+    <bpmn:endEvent id="Event_1rsf7yb">
+      <bpmn:incoming>SequenceFlow_1uiz85h</bpmn:incoming>
+    </bpmn:endEvent>
+    <bpmn:intermediateThrowEvent id="Event_1a9swwa" name="Goto SDNC operation">
+      <bpmn:incoming>SequenceFlow_17u69c4</bpmn:incoming>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_1skl6p7" name="SdncOperation" />
+    </bpmn:intermediateThrowEvent>
+    <bpmn:scriptTask id="Activity_08tw2di" name="create Slice Profile in AAI" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_0g5bwvl</bpmn:incoming>
+      <bpmn:outgoing>Flow_106ei42</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcsi = new DoCreateTnNssiInstance()
+dcsi.createSliceProfile(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_106ei42" sourceRef="Activity_08tw2di" targetRef="ScriptTask_18rzwzb" />
+  </bpmn:process>
+  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoCreateTnNssiInstance">
+      <bpmndi:BPMNEdge id="Flow_11kadz7_di" bpmnElement="Flow_11kadz7">
+        <di:waypoint x="610" y="375" />
+        <di:waypoint x="719" y="375" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0pko5tm_di" bpmnElement="Flow_0pko5tm">
+        <di:waypoint x="420" y="375" />
+        <di:waypoint x="489" y="375" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1c8zr59_di" bpmnElement="Flow_1c8zr59">
+        <di:waypoint x="211" y="375" />
+        <di:waypoint x="299" y="375" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_17u69c4_di" bpmnElement="SequenceFlow_17u69c4">
+        <di:waypoint x="930" y="129" />
+        <di:waypoint x="1102" y="129" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0g5bwvl_di" bpmnElement="SequenceFlow_0g5bwvl">
+        <di:waypoint x="574" y="129" />
+        <di:waypoint x="650" y="129" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1uiz85h_di" bpmnElement="SequenceFlow_1uiz85h">
+        <di:waypoint x="840" y="375" />
+        <di:waypoint x="972" y="375" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="631" y="108" width="0" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0khtova_di" bpmnElement="SequenceFlow_0khtova">
+        <di:waypoint x="393" y="129" />
+        <di:waypoint x="474" y="129" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="436" y="108" width="0" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1qo2pln_di" bpmnElement="SequenceFlow_1qo2pln">
+        <di:waypoint x="211" y="129" />
+        <di:waypoint x="251" y="129" />
+        <di:waypoint x="251" y="129" />
+        <di:waypoint x="293" y="129" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="266" y="123" width="0" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_106ei42_di" bpmnElement="Flow_106ei42">
+        <di:waypoint x="750" y="129" />
+        <di:waypoint x="830" y="129" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="allocateTnNssi_StartEvent">
+        <dc:Bounds x="175" y="111" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="153" y="147" width="86" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_03j6ogo_di" bpmnElement="PreprocessIncomingRequest_task">
+        <dc:Bounds x="293" y="89" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_1qmmew8_di" bpmnElement="instantiate_NSTask">
+        <dc:Bounds x="474" y="89" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_0l9vk9p_di" bpmnElement="Event_0l9vk9p">
+        <dc:Bounds x="175" y="357" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="165" y="400" width="58" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0eh82ds_di" bpmnElement="Activity_0eh82ds">
+        <dc:Bounds x="299" y="328" width="121" height="94" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1fs2182_di" bpmnElement="Activity_1fs2182">
+        <dc:Bounds x="489" y="328" width="121" height="94" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_16luyg1_di" bpmnElement="Activity_16luyg1">
+        <dc:Bounds x="719" y="328" width="121" height="94" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_1rsf7yb_di" bpmnElement="Event_1rsf7yb">
+        <dc:Bounds x="972" y="357" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_1a9swwa_di" bpmnElement="Event_1a9swwa">
+        <dc:Bounds x="1102" y="111" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1093" y="154" width="59" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_18rzwzb_di" bpmnElement="ScriptTask_18rzwzb">
+        <dc:Bounds x="830" y="89" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_08tw2di_di" bpmnElement="Activity_08tw2di">
+        <dc:Bounds x="650" y="89" width="100" height="80" />
+      </bpmndi:BPMNShape>
+    </bpmndi:BPMNPlane>
+  </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateAccessNSSI.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateAccessNSSI.bpmn
new file mode 100644 (file)
index 0000000..5e4b730
--- /dev/null
@@ -0,0 +1,1226 @@
+<?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" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_17amn3o" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.1.1">
+  <bpmn:process id="DoDeallocateAccessNSSI" name="DoDeallocateAccessNSSI" isExecutable="true">
+    <bpmn:startEvent id="Event_0seox25" name="Start">
+      <bpmn:outgoing>Flow_14g5p2j</bpmn:outgoing>
+    </bpmn:startEvent>
+    <bpmn:sequenceFlow id="Flow_14g5p2j" sourceRef="Event_0seox25" targetRef="Activity_00sen5i" />
+    <bpmn:scriptTask id="Activity_00sen5i" name="Preprocess Request" scriptFormat="groovy">
+      <bpmn:incoming>Flow_14g5p2j</bpmn:incoming>
+      <bpmn:outgoing>Flow_1hm17vz</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def deallocator = new DoDeAllocateAccessNSSI()
+deallocator.preProcessRequest(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_1hm17vz" sourceRef="Activity_00sen5i" targetRef="Activity_1i58rru" />
+    <bpmn:sequenceFlow id="Flow_0kt6k2i" sourceRef="Activity_1i58rru" targetRef="Activity_0kpwy97" />
+    <bpmn:sequenceFlow id="Flow_08ncj77" sourceRef="Activity_0kpwy97" targetRef="Activity_1v9avqp" />
+    <bpmn:exclusiveGateway id="Gateway_05fdvbz" name="Terminate AN NSSi ?" default="Flow_0m12xsi">
+      <bpmn:incoming>Flow_150eq0z</bpmn:incoming>
+      <bpmn:outgoing>Flow_12fyi2n</bpmn:outgoing>
+      <bpmn:outgoing>Flow_0m12xsi</bpmn:outgoing>
+    </bpmn:exclusiveGateway>
+    <bpmn:sequenceFlow id="Flow_150eq0z" sourceRef="Activity_1v9avqp" targetRef="Gateway_05fdvbz" />
+    <bpmn:sequenceFlow id="Flow_12fyi2n" name="Yes" sourceRef="Gateway_05fdvbz" targetRef="Activity_0hpe14n">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("terminateAnNSSI") == true}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:sequenceFlow id="Flow_0m3x1ra" sourceRef="Activity_0hpe14n" targetRef="Activity_0gzrekf" />
+    <bpmn:sequenceFlow id="Flow_1o2mo3u" sourceRef="Activity_0gzrekf" targetRef="Gateway_1ypyzn3" />
+    <bpmn:exclusiveGateway id="Gateway_1ypyzn3" default="Flow_16hk034">
+      <bpmn:incoming>Flow_1o2mo3u</bpmn:incoming>
+      <bpmn:outgoing>Flow_02jtaed</bpmn:outgoing>
+      <bpmn:outgoing>Flow_16hk034</bpmn:outgoing>
+    </bpmn:exclusiveGateway>
+    <bpmn:sequenceFlow id="Flow_02jtaed" name="Yes" sourceRef="Gateway_1ypyzn3" targetRef="Activity_0szls0v">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("terminateAnNfNSSI") == true}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:sequenceFlow id="Flow_16hk034" name="No" sourceRef="Gateway_1ypyzn3" targetRef="Activity_0umktii" />
+    <bpmn:sequenceFlow id="Flow_1she7i5" sourceRef="Activity_0szls0v" targetRef="Activity_0tbndh6" />
+    <bpmn:intermediateThrowEvent id="Event_0vthuwp" name="Goto Terminate TN FH/MH NSSI">
+      <bpmn:incoming>Flow_1lfvp5s</bpmn:incoming>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_0dpa9td" name="TerminateTnNSSI" />
+    </bpmn:intermediateThrowEvent>
+    <bpmn:intermediateCatchEvent id="Event_0opsm2p" name="TN FH/MH Termination">
+      <bpmn:outgoing>Flow_0cj22bs</bpmn:outgoing>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_1gactc9" name="TerminateTnNSSI" />
+    </bpmn:intermediateCatchEvent>
+    <bpmn:sequenceFlow id="Flow_0cj22bs" sourceRef="Event_0opsm2p" targetRef="Activity_0uul9fb" />
+    <bpmn:sequenceFlow id="Flow_0412ven" sourceRef="Activity_0qho4pw" targetRef="Activity_03zg1pp" />
+    <bpmn:sequenceFlow id="Flow_0tlog6y" sourceRef="Activity_03zg1pp" targetRef="Activity_1ri9jrn" />
+    <bpmn:sequenceFlow id="Flow_1lfvp5s" sourceRef="Activity_1v1ra2k" targetRef="Event_0vthuwp" />
+    <bpmn:scriptTask id="Activity_1i58rru" name="Fetch Related NSSI and Slice profile details" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1hm17vz</bpmn:incoming>
+      <bpmn:outgoing>Flow_0kt6k2i</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def deallocator = new DoDeAllocateAccessNSSI()
+deallocator.getRelatedInstances(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_0kpwy97" name="Prepare AN NSSI Termination request" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0kt6k2i</bpmn:incoming>
+      <bpmn:outgoing>Flow_08ncj77</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def deallocator = new DoDeAllocateAccessNSSI()
+deallocator.prepareOOFAnNssiTerminationRequest(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_1v9avqp" name="Call OOF for AN NSSI Termination" scriptFormat="groovy">
+      <bpmn:incoming>Flow_08ncj77</bpmn:incoming>
+      <bpmn:outgoing>Flow_150eq0z</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def deallocator = new DoDeAllocateAccessNSSI()
+deallocator.performOofAnNSSITerminationCall(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_0hpe14n" name="Prepare OOF Terminate RAN NF NSSI" scriptFormat="groovy">
+      <bpmn:incoming>Flow_12fyi2n</bpmn:incoming>
+      <bpmn:outgoing>Flow_0m3x1ra</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def deallocator = new DoDeAllocateAccessNSSI()
+deallocator.prepareOOFAnNfNssiTerminationRequest(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_0gzrekf" name="Call OOF flow for AN NF termination" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0m3x1ra</bpmn:incoming>
+      <bpmn:outgoing>Flow_1o2mo3u</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def deallocator = new DoDeAllocateAccessNSSI()
+deallocator.performOofAnNfNSSITerminationCall(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:intermediateThrowEvent id="Event_18fpd51" name="Goto Terminate TN FH/MH NSSI">
+      <bpmn:incoming>Flow_1x4e0k3</bpmn:incoming>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_07j10pb" name="TerminateTnNSSI" />
+    </bpmn:intermediateThrowEvent>
+    <bpmn:scriptTask id="Activity_1v1ra2k" name="Delete RAN NF NSSI" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0hdpgak</bpmn:incoming>
+      <bpmn:outgoing>Flow_1lfvp5s</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def deallocator = new DoDeAllocateAccessNSSI()
+deallocator.deallocateAnNfNssi(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:serviceTask id="Activity_05frw6w" 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_1bgguw0</bpmn:incoming>
+      <bpmn:outgoing>Flow_1x4e0k3</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:sequenceFlow id="Flow_1bgguw0" sourceRef="Activity_17w3onz" targetRef="Activity_05frw6w" />
+    <bpmn:sequenceFlow id="Flow_1x4e0k3" sourceRef="Activity_05frw6w" targetRef="Event_18fpd51" />
+    <bpmn:scriptTask id="Activity_17w3onz" name="Update Job status" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0vcn5tl</bpmn:incoming>
+      <bpmn:outgoing>Flow_1bgguw0</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def deallocator = new DoDeAllocateAccessNSSI()
+deallocator.prepareUpdateJobStatus(execution,"processing","40","AN NF NSSI deallocated")</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_1irtrgt" name="Update Job status" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0hlt6jq</bpmn:incoming>
+      <bpmn:outgoing>Flow_1pm77xu</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def deallocator = new DoDeAllocateAccessNSSI()
+deallocator.prepareUpdateJobStatus(execution,"processing","40","AN NF NSSI deleted")</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:serviceTask id="Activity_1vyon97" 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_1pm77xu</bpmn:incoming>
+      <bpmn:outgoing>Flow_0hdpgak</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:sequenceFlow id="Flow_1pm77xu" sourceRef="Activity_1irtrgt" targetRef="Activity_1vyon97" />
+    <bpmn:sequenceFlow id="Flow_0hdpgak" sourceRef="Activity_1vyon97" targetRef="Activity_1v1ra2k" />
+    <bpmn:scriptTask id="Activity_1w9w7a5" name="Validate jobstatus" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0azlxam</bpmn:incoming>
+      <bpmn:outgoing>Flow_1njlj9z</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def deallocator = new DoDeAllocateAccessNSSI()
+String responseDescriptor = execution.getVariable("an_responseDescriptor")
+
+deallocator.validateJobStatus(execution, responseDescriptor)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_1dyluu0" name="Update Job status" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1nh3x4j</bpmn:incoming>
+      <bpmn:outgoing>Flow_1g9lfjr</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def deallocator = new DoDeAllocateAccessNSSI()
+deallocator.prepareUpdateJobStatus(execution,"finished","100","Deallocated successfully")</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:serviceTask id="Activity_1x2fc4q" 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_1g9lfjr</bpmn:incoming>
+      <bpmn:outgoing>Flow_04bem88</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:sequenceFlow id="Flow_1g9lfjr" sourceRef="Activity_1dyluu0" targetRef="Activity_1x2fc4q" />
+    <bpmn:scriptTask id="Activity_0wlygp0" name="Update Job status" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0m12xsi</bpmn:incoming>
+      <bpmn:outgoing>Flow_1xqtf63</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def deallocator = new DoDeAllocateAccessNSSI()
+deallocator.prepareUpdateJobStatus(execution,"processing","20","callingmodifyNSSI modifyAction-deallocate")</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:serviceTask id="Activity_1e1s439" 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_1xqtf63</bpmn:incoming>
+      <bpmn:outgoing>Flow_1s5fdmz</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:sequenceFlow id="Flow_1xqtf63" sourceRef="Activity_0wlygp0" targetRef="Activity_1e1s439" />
+    <bpmn:sequenceFlow id="Flow_0m12xsi" sourceRef="Gateway_05fdvbz" targetRef="Activity_0wlygp0" />
+    <bpmn:scriptTask id="Activity_1ih5cjh" name="Update Job status" scriptFormat="groovy">
+      <bpmn:incoming>Flow_07m650f</bpmn:incoming>
+      <bpmn:outgoing>Flow_1ib3uzg</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def deallocator = new DoDeAllocateAccessNSSI()
+deallocator.prepareUpdateJobStatus(execution,"processing","60","TN-FH terminated")</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:serviceTask id="Activity_1clwk2x" 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_1ib3uzg</bpmn:incoming>
+      <bpmn:outgoing>Flow_15bkzm7</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:sequenceFlow id="Flow_1ib3uzg" sourceRef="Activity_1ih5cjh" targetRef="Activity_1clwk2x" />
+    <bpmn:sequenceFlow id="Flow_15bkzm7" sourceRef="Activity_1clwk2x" targetRef="Activity_114fx71" />
+    <bpmn:sequenceFlow id="Flow_1nh3x4j" sourceRef="Activity_1ri9jrn" targetRef="Activity_1dyluu0" />
+    <bpmn:endEvent id="Event_19tcky7">
+      <bpmn:incoming>Flow_04bem88</bpmn:incoming>
+    </bpmn:endEvent>
+    <bpmn:sequenceFlow id="Flow_04bem88" sourceRef="Activity_1x2fc4q" targetRef="Event_19tcky7" />
+    <bpmn:scriptTask id="Activity_0uul9fb" name="Call NSSMF adapter for TN_FH NSSI Termination" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0cj22bs</bpmn:incoming>
+      <bpmn:outgoing>Flow_0x1wi2t</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def deallocator = new DoDeAllocateAccessNSSI()
+deallocator.terminateTNFHNssi(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_114fx71" name="Do TN_MH NSSI Termination" scriptFormat="groovy">
+      <bpmn:incoming>Flow_15bkzm7</bpmn:incoming>
+      <bpmn:outgoing>Flow_04coe09</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def deallocator = new DoDeAllocateAccessNSSI()
+deallocator.terminateTNMHNssi(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:subProcess id="Activity_0qbd3cz" name="Sub-process for FalloutHandler and Rollback" triggeredByEvent="true">
+      <bpmn:startEvent id="Event_13wl9ag">
+        <bpmn:outgoing>Flow_1q1450g</bpmn:outgoing>
+        <bpmn:errorEventDefinition id="ErrorEventDefinition_1z0jo5h" errorRef="Error_0i5gql0" />
+      </bpmn:startEvent>
+      <bpmn:endEvent id="Event_0ugnt78">
+        <bpmn:incoming>Flow_035ivcv</bpmn:incoming>
+      </bpmn:endEvent>
+      <bpmn:scriptTask id="Activity_1mzoss1" name="Handle Unexpected Error" scriptFormat="groovy">
+        <bpmn:incoming>Flow_0nsc2oc</bpmn:incoming>
+        <bpmn:outgoing>Flow_035ivcv</bpmn:outgoing>
+        <bpmn:script>import org.onap.so.bpmn.common.scripts.*
+ExceptionUtil ex = new ExceptionUtil()
+ex.processJavaException(execution)</bpmn:script>
+      </bpmn:scriptTask>
+      <bpmn:sequenceFlow id="Flow_035ivcv" sourceRef="Activity_1mzoss1" targetRef="Event_0ugnt78" />
+      <bpmn:serviceTask id="Activity_055w5hr" 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_0alqcat</bpmn:incoming>
+        <bpmn:outgoing>Flow_0nsc2oc</bpmn:outgoing>
+      </bpmn:serviceTask>
+      <bpmn:scriptTask id="Activity_1nr7xyr" name="Update Job status" scriptFormat="groovy">
+        <bpmn:incoming>Flow_1q1450g</bpmn:incoming>
+        <bpmn:outgoing>Flow_0alqcat</bpmn:outgoing>
+        <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def deallocator = new DoDeAllocateAccessNSSI()
+deallocator.prepareUpdateJobStatus(execution,"failed","0","Job Failed")</bpmn:script>
+      </bpmn:scriptTask>
+      <bpmn:sequenceFlow id="Flow_0alqcat" sourceRef="Activity_1nr7xyr" targetRef="Activity_055w5hr" />
+      <bpmn:sequenceFlow id="Flow_1q1450g" sourceRef="Event_13wl9ag" targetRef="Activity_1nr7xyr" />
+      <bpmn:sequenceFlow id="Flow_0nsc2oc" sourceRef="Activity_055w5hr" targetRef="Activity_1mzoss1" />
+    </bpmn:subProcess>
+    <bpmn:callActivity id="Activity_0jtob0z" name="QueryJobStatus" calledElement="QueryJobStatus">
+      <bpmn:extensionElements>
+        <camunda:in source="an_esrInfo" target="esrInfo" />
+        <camunda:in source="an_responseId" target="responseId" />
+        <camunda:in source="modificationJobId" target="jobId" />
+        <camunda:in source="an_serviceInfo" target="serviceInfo" />
+        <camunda:out source="responseDescriptor" target="an_responseDescriptor" />
+        <camunda:out source="WorkflowException" target="WorkflowException" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_12cm0xq</bpmn:incoming>
+      <bpmn:outgoing>Flow_0azlxam</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:sequenceFlow id="Flow_0azlxam" sourceRef="Activity_0jtob0z" targetRef="Activity_1w9w7a5" />
+    <bpmn:scriptTask id="Activity_1l3vkx0" name="Update Job status" scriptFormat="groovy">
+      <bpmn:incoming>Flow_01xixn8</bpmn:incoming>
+      <bpmn:outgoing>Flow_1ai7sri</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def deallocator = new DoDeAllocateAccessNSSI()
+deallocator.prepareUpdateJobStatus(execution,"finished","100","Deallocated successfully")</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:serviceTask id="Activity_0tuhk79" 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_1ai7sri</bpmn:incoming>
+      <bpmn:outgoing>Flow_17mns9c</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:sequenceFlow id="Flow_1ai7sri" sourceRef="Activity_1l3vkx0" targetRef="Activity_0tuhk79" />
+    <bpmn:scriptTask id="Activity_0szls0v" name="Prepare SDNR request" scriptFormat="groovy">
+      <bpmn:incoming>Flow_02jtaed</bpmn:incoming>
+      <bpmn:outgoing>Flow_1she7i5</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def deallocator = new DoDeAllocateAccessNSSI()
+deallocator.prepareSdnrRequest(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:callActivity id="Activity_0tbndh6" name="Call SDNR subprocess" calledElement="DoHandleSdnrDmaapRequest">
+      <bpmn:extensionElements>
+        <camunda:in source="sdnrRequest" target="sdnrRequest" />
+        <camunda:in source="SDNR_messageType" target="messageType" />
+        <camunda:in source="SDNR_timeout" target="timeout" />
+        <camunda:in source="msoRequestId" target="correlator" />
+        <camunda:out source="asyncCallbackResponse" target="SDNR_Response" />
+        <camunda:out source="WorkflowException" target="WorkflowException" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_1she7i5</bpmn:incoming>
+      <bpmn:outgoing>Flow_02pdd51</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:exclusiveGateway id="Gateway_1p35k2g" name="Is Success response" default="Flow_1uz3kjn">
+      <bpmn:incoming>Flow_1bpg97k</bpmn:incoming>
+      <bpmn:outgoing>Flow_0hlt6jq</bpmn:outgoing>
+      <bpmn:outgoing>Flow_1uz3kjn</bpmn:outgoing>
+    </bpmn:exclusiveGateway>
+    <bpmn:sequenceFlow id="Flow_0hlt6jq" name="Yes" sourceRef="Gateway_1p35k2g" targetRef="Activity_1irtrgt">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("isAnNfTerminated") == true}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:sequenceFlow id="Flow_1uz3kjn" name="No" sourceRef="Gateway_1p35k2g" targetRef="Event_1icw8fg" />
+    <bpmn:endEvent id="Event_1icw8fg" name="DeallocateWorkflowError">
+      <bpmn:incoming>Flow_1uz3kjn</bpmn:incoming>
+      <bpmn:errorEventDefinition id="ErrorEventDefinition_0kdeuox" errorRef="Error_0i5gql0" />
+    </bpmn:endEvent>
+    <bpmn:sequenceFlow id="Flow_02pdd51" sourceRef="Activity_0tbndh6" targetRef="Activity_0lszayp" />
+    <bpmn:sequenceFlow id="Flow_1bpg97k" sourceRef="Activity_0lszayp" targetRef="Gateway_1p35k2g" />
+    <bpmn:scriptTask id="Activity_0lszayp" name="Process sdnr response" scriptFormat="groovy">
+      <bpmn:incoming>Flow_02pdd51</bpmn:incoming>
+      <bpmn:outgoing>Flow_1bpg97k</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def deallocator = new DoDeAllocateAccessNSSI()
+deallocator.processSdnrResponse(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:subProcess id="Activity_0c0vkj6" name="Sub-process for FalloutHandler and Rollback" triggeredByEvent="true">
+      <bpmn:startEvent id="Event_1bqq1on">
+        <bpmn:outgoing>Flow_0bkcs42</bpmn:outgoing>
+        <bpmn:errorEventDefinition id="ErrorEventDefinition_0tgpoyd" />
+      </bpmn:startEvent>
+      <bpmn:endEvent id="Event_0qb738v">
+        <bpmn:incoming>Flow_1b5mtc4</bpmn:incoming>
+      </bpmn:endEvent>
+      <bpmn:scriptTask id="Activity_0187ysa" name="Handle Unexpected Error" scriptFormat="groovy">
+        <bpmn:incoming>Flow_0bkcs42</bpmn:incoming>
+        <bpmn:outgoing>Flow_1b5mtc4</bpmn:outgoing>
+        <bpmn:script>import org.onap.so.bpmn.common.scripts.*
+ExceptionUtil ex = new ExceptionUtil()
+ex.processJavaException(execution)</bpmn:script>
+      </bpmn:scriptTask>
+      <bpmn:sequenceFlow id="Flow_1b5mtc4" sourceRef="Activity_0187ysa" targetRef="Event_0qb738v" />
+      <bpmn:sequenceFlow id="Flow_0bkcs42" sourceRef="Event_1bqq1on" targetRef="Activity_0187ysa" />
+    </bpmn:subProcess>
+    <bpmn:callActivity id="Activity_115teb9" name="Call ANModifyNSSI" calledElement="DoModifyAccessNSSI">
+      <bpmn:extensionElements>
+        <camunda:in source="msoRequestId" target="msoRequestId" />
+        <camunda:in source="globalSubscriberId" target="globalSubscriberId" />
+        <camunda:in source="serviceInstanceID" target="serviceInstanceID" />
+        <camunda:in source="nsiId" target="nsiId" />
+        <camunda:in source="networkType" target="networkType" />
+        <camunda:in source="subscriptionServiceType" target="subscriptionServiceType" />
+        <camunda:in source="modificationJobId" target="jobId" />
+        <camunda:in source="modificationsliceParams" target="sliceParams" />
+        <camunda:out source="WorkflowException" target="WorkflowException" />
+        <camunda:in source="servicename" target="servicename" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_1ywvasn</bpmn:incoming>
+      <bpmn:outgoing>Flow_1udlwb4</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:sequenceFlow id="Flow_1s5fdmz" sourceRef="Activity_1e1s439" targetRef="Activity_1wu2d9y" />
+    <bpmn:scriptTask id="Activity_1wu2d9y" name="Prepare NSSI modification job" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1s5fdmz</bpmn:incoming>
+      <bpmn:outgoing>Flow_0x71rer</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def deallocator = new DoDeAllocateAccessNSSI()
+deallocator.preparejobForANNSSIModification(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:serviceTask id="Activity_0drkoau" name="UpdateModify 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">${initResourceOperationStatus}</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_0x71rer</bpmn:incoming>
+      <bpmn:outgoing>Flow_1ywvasn</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:sequenceFlow id="Flow_1ywvasn" sourceRef="Activity_0drkoau" targetRef="Activity_115teb9" />
+    <bpmn:endEvent id="Event_14cxrjq">
+      <bpmn:incoming>Flow_17mns9c</bpmn:incoming>
+    </bpmn:endEvent>
+    <bpmn:sequenceFlow id="Flow_17mns9c" sourceRef="Activity_0tuhk79" targetRef="Event_14cxrjq" />
+    <bpmn:sequenceFlow id="Flow_1udlwb4" sourceRef="Activity_115teb9" targetRef="Activity_1x1p1fc" />
+    <bpmn:sequenceFlow id="Flow_12cm0xq" sourceRef="Activity_1x1p1fc" targetRef="Activity_0jtob0z" />
+    <bpmn:scriptTask id="Activity_1x1p1fc" name="Prepare job status query" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1udlwb4</bpmn:incoming>
+      <bpmn:outgoing>Flow_12cm0xq</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+
+String jobId = execution.getVariable("modificationJobId")
+String networkType="an"
+String nssiid=execution.getVariable("serviceInstanceID")
+
+def deallocator = new DoDeAllocateAccessNSSI()
+deallocator.prepareQueryJobStatus(execution, jobId,networkType, nssiid)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:exclusiveGateway id="Gateway_1nm5kq2" name="Is Job complete?" default="Flow_0klaefp">
+      <bpmn:incoming>Flow_1njlj9z</bpmn:incoming>
+      <bpmn:outgoing>Flow_01xixn8</bpmn:outgoing>
+      <bpmn:outgoing>Flow_0klaefp</bpmn:outgoing>
+    </bpmn:exclusiveGateway>
+    <bpmn:sequenceFlow id="Flow_1njlj9z" sourceRef="Activity_1w9w7a5" targetRef="Gateway_1nm5kq2" />
+    <bpmn:sequenceFlow id="Flow_01xixn8" name="Yes" sourceRef="Gateway_1nm5kq2" targetRef="Activity_1l3vkx0">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("isSuccess") == true}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:endEvent id="Event_0ayhmk4" name="DeallocateWorkflowError">
+      <bpmn:incoming>Flow_0klaefp</bpmn:incoming>
+      <bpmn:errorEventDefinition id="ErrorEventDefinition_1y9usob" errorRef="Error_0i5gql0" />
+    </bpmn:endEvent>
+    <bpmn:sequenceFlow id="Flow_0klaefp" name="No" sourceRef="Gateway_1nm5kq2" targetRef="Event_0ayhmk4" />
+    <bpmn:callActivity id="Activity_0mda4y4" name="QueryJobStatus" calledElement="QueryJobStatus">
+      <bpmn:extensionElements>
+        <camunda:in source="tn_esrInfo" target="esrInfo" />
+        <camunda:in source="tn_responseId" target="responseId" />
+        <camunda:in source="TN_FH_jobId" target="jobId" />
+        <camunda:in source="tn_serviceInfo" target="serviceInfo" />
+        <camunda:out source="responseDescriptor" target="tnFh_responseDescriptor" />
+        <camunda:out source="WorkflowException" target="WorkflowException" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_11vezy6</bpmn:incoming>
+      <bpmn:outgoing>Flow_0sg1a2h</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:scriptTask id="Activity_1e7m0zn" name="Validate jobstatus" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0sg1a2h</bpmn:incoming>
+      <bpmn:outgoing>Flow_1yidpp1</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def deallocator = new DoDeAllocateAccessNSSI()
+String responseDescriptor = execution.getVariable("tnFh_responseDescriptor")
+
+deallocator.validateJobStatus(execution, responseDescriptor)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:exclusiveGateway id="Gateway_18ykcln" name="Is Job complete?" default="Flow_1gr7m1w">
+      <bpmn:incoming>Flow_1yidpp1</bpmn:incoming>
+      <bpmn:outgoing>Flow_1gr7m1w</bpmn:outgoing>
+      <bpmn:outgoing>Flow_07m650f</bpmn:outgoing>
+    </bpmn:exclusiveGateway>
+    <bpmn:endEvent id="Event_0r83tv9" name="DeallocateWorkflowError">
+      <bpmn:incoming>Flow_1gr7m1w</bpmn:incoming>
+      <bpmn:errorEventDefinition id="ErrorEventDefinition_118q048" errorRef="Error_0i5gql0" />
+    </bpmn:endEvent>
+    <bpmn:sequenceFlow id="Flow_0sg1a2h" sourceRef="Activity_0mda4y4" targetRef="Activity_1e7m0zn" />
+    <bpmn:sequenceFlow id="Flow_1yidpp1" sourceRef="Activity_1e7m0zn" targetRef="Gateway_18ykcln" />
+    <bpmn:sequenceFlow id="Flow_1gr7m1w" name="No" sourceRef="Gateway_18ykcln" targetRef="Event_0r83tv9" />
+    <bpmn:callActivity id="Activity_0zlr24k" name="QueryJobStatus" calledElement="QueryJobStatus">
+      <bpmn:extensionElements>
+        <camunda:in source="tn_esrInfo" target="esrInfo" />
+        <camunda:in source="tn_responseId" target="responseId" />
+        <camunda:in source="TN_MH_jobId" target="jobId" />
+        <camunda:in source="tn_serviceInfo" target="serviceInfo" />
+        <camunda:out source="responseDescriptor" target="tnMh_responseDescriptor" />
+        <camunda:out source="WorkflowException" target="WorkflowException" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_16qo8iw</bpmn:incoming>
+      <bpmn:outgoing>Flow_0cmkk7f</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:scriptTask id="Activity_0q7ghdf" name="Validate jobstatus" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0cmkk7f</bpmn:incoming>
+      <bpmn:outgoing>Flow_17caqnb</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def deallocator = new DoDeAllocateAccessNSSI()
+String responseDescriptor = execution.getVariable("tnMh_responseDescriptor")
+
+deallocator.validateJobStatus(execution, responseDescriptor)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:exclusiveGateway id="Gateway_1dylwav" name="Is Job complete?" default="Flow_0jz37j1">
+      <bpmn:incoming>Flow_17caqnb</bpmn:incoming>
+      <bpmn:outgoing>Flow_0jz37j1</bpmn:outgoing>
+      <bpmn:outgoing>Flow_03fig6p</bpmn:outgoing>
+    </bpmn:exclusiveGateway>
+    <bpmn:endEvent id="Event_0wlpcd6" name="DeallocateWorkflowError">
+      <bpmn:incoming>Flow_0jz37j1</bpmn:incoming>
+      <bpmn:errorEventDefinition id="ErrorEventDefinition_1w46vnr" errorRef="Error_0i5gql0" />
+    </bpmn:endEvent>
+    <bpmn:sequenceFlow id="Flow_0cmkk7f" sourceRef="Activity_0zlr24k" targetRef="Activity_0q7ghdf" />
+    <bpmn:sequenceFlow id="Flow_17caqnb" sourceRef="Activity_0q7ghdf" targetRef="Gateway_1dylwav" />
+    <bpmn:sequenceFlow id="Flow_0jz37j1" name="No" sourceRef="Gateway_1dylwav" targetRef="Event_0wlpcd6" />
+    <bpmn:scriptTask id="Activity_0506p7p" name="Prepare job status query" scriptFormat="groovy">
+      <bpmn:incoming>Flow_04coe09</bpmn:incoming>
+      <bpmn:outgoing>Flow_16qo8iw</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+
+String jobId = execution.getVariable("TN_MH_jobId")
+String networkType="tn"
+String nssiid=execution.getVariable("tnMHNSSIId")
+
+def deallocator = new DoDeAllocateAccessNSSI()
+deallocator.prepareQueryJobStatus(execution, jobId,networkType, nssiid)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_04coe09" sourceRef="Activity_114fx71" targetRef="Activity_0506p7p" />
+    <bpmn:sequenceFlow id="Flow_16qo8iw" sourceRef="Activity_0506p7p" targetRef="Activity_0zlr24k" />
+    <bpmn:sequenceFlow id="Flow_07m650f" name="Yes" sourceRef="Gateway_18ykcln" targetRef="Activity_1ih5cjh">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("isSuccess") == true}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:scriptTask id="Activity_11w4jgm" name="Prepare job status query" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0x1wi2t</bpmn:incoming>
+      <bpmn:outgoing>Flow_11vezy6</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+
+String jobId = execution.getVariable("TN_FH_jobId")
+String networkType="tn"
+String nssiid=execution.getVariable("tnFHNSSIId")
+
+def deallocator = new DoDeAllocateAccessNSSI()
+deallocator.prepareQueryJobStatus(execution, jobId,networkType, nssiid)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_11vezy6" sourceRef="Activity_11w4jgm" targetRef="Activity_0mda4y4" />
+    <bpmn:sequenceFlow id="Flow_0x1wi2t" sourceRef="Activity_0uul9fb" targetRef="Activity_11w4jgm" />
+    <bpmn:sequenceFlow id="Flow_03fig6p" name="Yes" sourceRef="Gateway_1dylwav" targetRef="Event_1mf8gxd">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("isSuccess") == true}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:intermediateThrowEvent id="Event_1mf8gxd" name="Goto AAI Updates">
+      <bpmn:incoming>Flow_03fig6p</bpmn:incoming>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_0ocsblp" name="UpdateAAI" />
+    </bpmn:intermediateThrowEvent>
+    <bpmn:intermediateCatchEvent id="Event_0dewj8o" name="AAI Updates">
+      <bpmn:outgoing>Flow_0omhxaj</bpmn:outgoing>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_06yz8px" name="UpdateAAI" />
+    </bpmn:intermediateCatchEvent>
+    <bpmn:sequenceFlow id="Flow_0omhxaj" sourceRef="Event_0dewj8o" targetRef="Activity_0qho4pw" />
+    <bpmn:scriptTask id="Activity_0qho4pw" name="Delete RAN NF Slice profile in AAI" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0omhxaj</bpmn:incoming>
+      <bpmn:outgoing>Flow_0412ven</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def deallocator = new DoDeAllocateAccessNSSI()
+deallocator.deleteRanNfSliceProfileInAAI(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_03zg1pp" name="Delete TN Slice profiles" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0412ven</bpmn:incoming>
+      <bpmn:outgoing>Flow_0tlog6y</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def deallocator = new DoDeAllocateAccessNSSI()
+deallocator.deleteTNSliceProfileInAAI(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_1ri9jrn" name="Delete RAN NSSI" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0tlog6y</bpmn:incoming>
+      <bpmn:outgoing>Flow_1nh3x4j</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def deallocator = new DoDeAllocateAccessNSSI()
+deallocator.deleteANNSSI(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:callActivity id="Activity_0umktii" name="Modify RAN NF NSSI" calledElement="DoModifyRanNfNssi">
+      <bpmn:extensionElements>
+        <camunda:in source="anNfNssiId" target="serviceInstanceID" />
+        <camunda:in source="anNfSliceProfileId" target="SliceProfileId" />
+        <camunda:in source="msoRequestId" target="msoRequestId" />
+        <camunda:in source="globalSubscriberId" target="globalSubscriberId" />
+        <camunda:in source="subscriptionServiceType" target="subscriptionServiceType" />
+        <camunda:in source="sNssaiList" target="snssaiList" />
+        <camunda:in source="modifyAction" target="modifyAction" />
+        <camunda:out source="ranNfStatus" target="ranNfStatus" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_16hk034</bpmn:incoming>
+      <bpmn:outgoing>Flow_18y4ab2</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:exclusiveGateway id="Gateway_0g02vzi" name="Is RAN NF deallocated?" default="Flow_0k55zuy">
+      <bpmn:incoming>Flow_18y4ab2</bpmn:incoming>
+      <bpmn:outgoing>Flow_0vcn5tl</bpmn:outgoing>
+      <bpmn:outgoing>Flow_0k55zuy</bpmn:outgoing>
+    </bpmn:exclusiveGateway>
+    <bpmn:sequenceFlow id="Flow_18y4ab2" sourceRef="Activity_0umktii" targetRef="Gateway_0g02vzi" />
+    <bpmn:sequenceFlow id="Flow_0vcn5tl" name="Yes" sourceRef="Gateway_0g02vzi" targetRef="Activity_17w3onz">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("ranNfStatus") == "success"}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:sequenceFlow id="Flow_0k55zuy" name="No" sourceRef="Gateway_0g02vzi" targetRef="Event_161u9s2" />
+    <bpmn:endEvent id="Event_161u9s2">
+      <bpmn:incoming>Flow_0k55zuy</bpmn:incoming>
+      <bpmn:errorEventDefinition id="ErrorEventDefinition_031y5kl" errorRef="Error_0i5gql0" />
+    </bpmn:endEvent>
+    <bpmn:sequenceFlow id="Flow_0x71rer" sourceRef="Activity_1wu2d9y" targetRef="Activity_0drkoau" />
+  </bpmn:process>
+  <bpmn:error id="Error_0i5gql0" name="DeallocateWorkflowError" errorCode="2500" />
+  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoDeallocateAccessNSSI">
+      <bpmndi:BPMNEdge id="Flow_0omhxaj_di" bpmnElement="Flow_0omhxaj">
+        <di:waypoint x="238" y="1110" />
+        <di:waypoint x="360" y="1110" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_03fig6p_di" bpmnElement="Flow_03fig6p">
+        <di:waypoint x="2085" y="880" />
+        <di:waypoint x="2182" y="880" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="2125" y="862" width="18" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0x1wi2t_di" bpmnElement="Flow_0x1wi2t">
+        <di:waypoint x="380" y="880" />
+        <di:waypoint x="420" y="880" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_11vezy6_di" bpmnElement="Flow_11vezy6">
+        <di:waypoint x="520" y="880" />
+        <di:waypoint x="570" y="880" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_07m650f_di" bpmnElement="Flow_07m650f">
+        <di:waypoint x="965" y="880" />
+        <di:waypoint x="1030" y="880" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="989" y="862" width="18" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_16qo8iw_di" bpmnElement="Flow_16qo8iw">
+        <di:waypoint x="1590" y="880" />
+        <di:waypoint x="1660" y="880" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_04coe09_di" bpmnElement="Flow_04coe09">
+        <di:waypoint x="1430" y="880" />
+        <di:waypoint x="1490" y="880" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0jz37j1_di" bpmnElement="Flow_0jz37j1">
+        <di:waypoint x="2060" y="905" />
+        <di:waypoint x="2060" y="962" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="2068" y="931" width="15" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_17caqnb_di" bpmnElement="Flow_17caqnb">
+        <di:waypoint x="1940" y="880" />
+        <di:waypoint x="2035" y="880" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0cmkk7f_di" bpmnElement="Flow_0cmkk7f">
+        <di:waypoint x="1760" y="880" />
+        <di:waypoint x="1840" y="880" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1gr7m1w_di" bpmnElement="Flow_1gr7m1w">
+        <di:waypoint x="940" y="905" />
+        <di:waypoint x="940" y="962" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="948" y="931" width="15" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1yidpp1_di" bpmnElement="Flow_1yidpp1">
+        <di:waypoint x="830" y="880" />
+        <di:waypoint x="915" y="880" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0sg1a2h_di" bpmnElement="Flow_0sg1a2h">
+        <di:waypoint x="670" y="880" />
+        <di:waypoint x="730" y="880" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0klaefp_di" bpmnElement="Flow_0klaefp">
+        <di:waypoint x="2140" y="675" />
+        <di:waypoint x="2140" y="732" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="2148" y="701" width="15" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_01xixn8_di" bpmnElement="Flow_01xixn8">
+        <di:waypoint x="2165" y="650" />
+        <di:waypoint x="2220" y="650" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="2184" y="632" width="18" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1njlj9z_di" bpmnElement="Flow_1njlj9z">
+        <di:waypoint x="2050" y="650" />
+        <di:waypoint x="2115" y="650" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_12cm0xq_di" bpmnElement="Flow_12cm0xq">
+        <di:waypoint x="1720" y="650" />
+        <di:waypoint x="1780" y="650" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1udlwb4_di" bpmnElement="Flow_1udlwb4">
+        <di:waypoint x="1560" y="650" />
+        <di:waypoint x="1620" y="650" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_17mns9c_di" bpmnElement="Flow_17mns9c">
+        <di:waypoint x="2490" y="650" />
+        <di:waypoint x="2552" y="650" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1ywvasn_di" bpmnElement="Flow_1ywvasn">
+        <di:waypoint x="1420" y="650" />
+        <di:waypoint x="1460" y="650" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0x71rer_di" bpmnElement="Flow_0x71rer">
+        <di:waypoint x="1275" y="650" />
+        <di:waypoint x="1320" y="650" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1s5fdmz_di" bpmnElement="Flow_1s5fdmz">
+        <di:waypoint x="1130" y="650" />
+        <di:waypoint x="1175" y="650" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1bpg97k_di" bpmnElement="Flow_1bpg97k">
+        <di:waypoint x="1820" y="410" />
+        <di:waypoint x="1875" y="410" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_02pdd51_di" bpmnElement="Flow_02pdd51">
+        <di:waypoint x="1680" y="410" />
+        <di:waypoint x="1720" y="410" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1uz3kjn_di" bpmnElement="Flow_1uz3kjn">
+        <di:waypoint x="1900" y="435" />
+        <di:waypoint x="1900" y="482" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1908" y="456" width="15" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0hlt6jq_di" bpmnElement="Flow_0hlt6jq">
+        <di:waypoint x="1925" y="410" />
+        <di:waypoint x="1970" y="410" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1939" y="392" width="18" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1ai7sri_di" bpmnElement="Flow_1ai7sri">
+        <di:waypoint x="2320" y="650" />
+        <di:waypoint x="2390" y="650" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0azlxam_di" bpmnElement="Flow_0azlxam">
+        <di:waypoint x="1880" y="650" />
+        <di:waypoint x="1950" y="650" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_04bem88_di" bpmnElement="Flow_04bem88">
+        <di:waypoint x="1130" y="1110" />
+        <di:waypoint x="1207" y="1110" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1nh3x4j_di" bpmnElement="Flow_1nh3x4j">
+        <di:waypoint x="810" y="1110" />
+        <di:waypoint x="880" y="1110" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_15bkzm7_di" bpmnElement="Flow_15bkzm7">
+        <di:waypoint x="1280" y="880" />
+        <di:waypoint x="1330" y="880" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1ib3uzg_di" bpmnElement="Flow_1ib3uzg">
+        <di:waypoint x="1130" y="880" />
+        <di:waypoint x="1180" y="880" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0m12xsi_di" bpmnElement="Flow_0m12xsi">
+        <di:waypoint x="880" y="435" />
+        <di:waypoint x="880" y="650" />
+        <di:waypoint x="900" y="650" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1xqtf63_di" bpmnElement="Flow_1xqtf63">
+        <di:waypoint x="1000" y="650" />
+        <di:waypoint x="1030" y="650" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1g9lfjr_di" bpmnElement="Flow_1g9lfjr">
+        <di:waypoint x="980" y="1110" />
+        <di:waypoint x="1030" y="1110" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0hdpgak_di" bpmnElement="Flow_0hdpgak">
+        <di:waypoint x="2220" y="410" />
+        <di:waypoint x="2280" y="410" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1pm77xu_di" bpmnElement="Flow_1pm77xu">
+        <di:waypoint x="2070" y="410" />
+        <di:waypoint x="2120" y="410" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1x4e0k3_di" bpmnElement="Flow_1x4e0k3">
+        <di:waypoint x="2130" y="240" />
+        <di:waypoint x="2232" y="240" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1bgguw0_di" bpmnElement="Flow_1bgguw0">
+        <di:waypoint x="1920" y="240" />
+        <di:waypoint x="2030" y="240" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1lfvp5s_di" bpmnElement="Flow_1lfvp5s">
+        <di:waypoint x="2380" y="410" />
+        <di:waypoint x="2422" y="410" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0tlog6y_di" bpmnElement="Flow_0tlog6y">
+        <di:waypoint x="630" y="1110" />
+        <di:waypoint x="710" y="1110" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0412ven_di" bpmnElement="Flow_0412ven">
+        <di:waypoint x="460" y="1110" />
+        <di:waypoint x="530" y="1110" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0cj22bs_di" bpmnElement="Flow_0cj22bs">
+        <di:waypoint x="238" y="880" />
+        <di:waypoint x="280" y="880" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1she7i5_di" bpmnElement="Flow_1she7i5">
+        <di:waypoint x="1500" y="410" />
+        <di:waypoint x="1580" y="410" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_16hk034_di" bpmnElement="Flow_16hk034">
+        <di:waypoint x="1290" y="385" />
+        <di:waypoint x="1290" y="240" />
+        <di:waypoint x="1400" y="240" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1298" y="312" width="15" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_02jtaed_di" bpmnElement="Flow_02jtaed">
+        <di:waypoint x="1315" y="410" />
+        <di:waypoint x="1400" y="410" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1349" y="392" width="18" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1o2mo3u_di" bpmnElement="Flow_1o2mo3u">
+        <di:waypoint x="1200" y="410" />
+        <di:waypoint x="1265" y="410" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0m3x1ra_di" bpmnElement="Flow_0m3x1ra">
+        <di:waypoint x="1050" y="410" />
+        <di:waypoint x="1100" y="410" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_12fyi2n_di" bpmnElement="Flow_12fyi2n">
+        <di:waypoint x="905" y="410" />
+        <di:waypoint x="950" y="410" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="919" y="392" width="18" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_150eq0z_di" bpmnElement="Flow_150eq0z">
+        <di:waypoint x="810" y="410" />
+        <di:waypoint x="855" y="410" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_08ncj77_di" bpmnElement="Flow_08ncj77">
+        <di:waypoint x="670" y="410" />
+        <di:waypoint x="710" y="410" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0kt6k2i_di" bpmnElement="Flow_0kt6k2i">
+        <di:waypoint x="530" y="410" />
+        <di:waypoint x="570" y="410" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1hm17vz_di" bpmnElement="Flow_1hm17vz">
+        <di:waypoint x="390" y="410" />
+        <di:waypoint x="430" y="410" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_14g5p2j_di" bpmnElement="Flow_14g5p2j">
+        <di:waypoint x="238" y="410" />
+        <di:waypoint x="290" y="410" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_18y4ab2_di" bpmnElement="Flow_18y4ab2">
+        <di:waypoint x="1500" y="240" />
+        <di:waypoint x="1625" y="240" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0vcn5tl_di" bpmnElement="Flow_0vcn5tl">
+        <di:waypoint x="1675" y="240" />
+        <di:waypoint x="1820" y="240" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1739" y="222" width="18" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0k55zuy_di" bpmnElement="Flow_0k55zuy">
+        <di:waypoint x="1650" y="215" />
+        <di:waypoint x="1650" y="100" />
+        <di:waypoint x="1822" y="100" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1658" y="155" width="15" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="Event_0seox25_di" bpmnElement="Event_0seox25">
+        <dc:Bounds x="202" y="392" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="208" y="435" width="24" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0ahytqr_di" bpmnElement="Activity_00sen5i">
+        <dc:Bounds x="290" y="370" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Gateway_05fdvbz_di" bpmnElement="Gateway_05fdvbz" isMarkerVisible="true">
+        <dc:Bounds x="855" y="385" width="50" height="50" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="847" y="355" width="67" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Gateway_1ypyzn3_di" bpmnElement="Gateway_1ypyzn3" isMarkerVisible="true">
+        <dc:Bounds x="1265" y="385" width="50" height="50" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_1dvx4n9_di" bpmnElement="Event_0vthuwp">
+        <dc:Bounds x="2422" y="392" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="2399" y="438" width="82" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_1ekryu8_di" bpmnElement="Event_0opsm2p">
+        <dc:Bounds x="202" y="862" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="192" y="905" width="57" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_18i5si0_di" bpmnElement="Activity_1i58rru">
+        <dc:Bounds x="430" y="370" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0u528ge_di" bpmnElement="Activity_0kpwy97">
+        <dc:Bounds x="570" y="370" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0tgprdn_di" bpmnElement="Activity_1v9avqp">
+        <dc:Bounds x="710" y="370" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_11wbmk9_di" bpmnElement="Activity_0hpe14n">
+        <dc:Bounds x="950" y="370" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1h4jup8_di" bpmnElement="Activity_0gzrekf">
+        <dc:Bounds x="1100" y="370" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_18fpd51_di" bpmnElement="Event_18fpd51">
+        <dc:Bounds x="2232" y="222" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="2209" y="268" width="82" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0m43umg_di" bpmnElement="Activity_1v1ra2k">
+        <dc:Bounds x="2280" y="370" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1i1fknn_di" bpmnElement="Activity_1irtrgt">
+        <dc:Bounds x="1970" y="370" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1vyon97_di" bpmnElement="Activity_1vyon97">
+        <dc:Bounds x="2120" y="370" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1w9w7a5_di" bpmnElement="Activity_1w9w7a5">
+        <dc:Bounds x="1950" y="610" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1dyluu0_di" bpmnElement="Activity_1dyluu0">
+        <dc:Bounds x="880" y="1070" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1x2fc4q_di" bpmnElement="Activity_1x2fc4q">
+        <dc:Bounds x="1030" y="1070" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0wlygp0_di" bpmnElement="Activity_0wlygp0">
+        <dc:Bounds x="900" y="610" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1e1s439_di" bpmnElement="Activity_1e1s439">
+        <dc:Bounds x="1030" y="610" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1ih5cjh_di" bpmnElement="Activity_1ih5cjh">
+        <dc:Bounds x="1030" y="840" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1clwk2x_di" bpmnElement="Activity_1clwk2x">
+        <dc:Bounds x="1180" y="840" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_19tcky7_di" bpmnElement="Event_19tcky7">
+        <dc:Bounds x="1207" y="1092" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0pm19vk_di" bpmnElement="Activity_0uul9fb">
+        <dc:Bounds x="280" y="840" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1i9b3oi_di" bpmnElement="Activity_114fx71">
+        <dc:Bounds x="1330" y="840" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_01s2lve_di" bpmnElement="Activity_0umktii">
+        <dc:Bounds x="1400" y="200" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_05frw6w_di" bpmnElement="Activity_05frw6w">
+        <dc:Bounds x="2030" y="200" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0njdei2_di" bpmnElement="Activity_17w3onz">
+        <dc:Bounds x="1820" y="200" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Gateway_0g02vzi_di" bpmnElement="Gateway_0g02vzi" isMarkerVisible="true">
+        <dc:Bounds x="1625" y="215" width="50" height="50" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1619" y="272" width="63" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0jtob0z_di" bpmnElement="Activity_0jtob0z">
+        <dc:Bounds x="1780" y="610" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1l3vkx0_di" bpmnElement="Activity_1l3vkx0">
+        <dc:Bounds x="2220" y="610" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0tuhk79_di" bpmnElement="Activity_0tuhk79">
+        <dc:Bounds x="2390" y="610" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0mddd28_di" bpmnElement="Activity_0szls0v">
+        <dc:Bounds x="1400" y="370" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0zhag3x_di" bpmnElement="Activity_0tbndh6">
+        <dc:Bounds x="1580" y="370" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Gateway_1p35k2g_di" bpmnElement="Gateway_1p35k2g" isMarkerVisible="true">
+        <dc:Bounds x="1875" y="385" width="50" height="50" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1874" y="355" width="54" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_1us3hum_di" bpmnElement="Event_1icw8fg">
+        <dc:Bounds x="1882" y="482" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1918" y="466" width="83" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_10vgzv9_di" bpmnElement="Activity_0lszayp">
+        <dc:Bounds x="1720" y="370" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_115teb9_di" bpmnElement="Activity_115teb9">
+        <dc:Bounds x="1460" y="610" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1kzmrir_di" bpmnElement="Activity_1wu2d9y">
+        <dc:Bounds x="1175" y="610" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0drkoau_di" bpmnElement="Activity_0drkoau">
+        <dc:Bounds x="1320" y="610" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_14cxrjq_di" bpmnElement="Event_14cxrjq">
+        <dc:Bounds x="2552" y="632" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1i80irm_di" bpmnElement="Activity_1x1p1fc">
+        <dc:Bounds x="1620" y="610" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Gateway_1nm5kq2_di" bpmnElement="Gateway_1nm5kq2" isMarkerVisible="true">
+        <dc:Bounds x="2115" y="625" width="50" height="50" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="2099" y="595" width="84" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_0ayhmk4_di" bpmnElement="Event_0ayhmk4">
+        <dc:Bounds x="2122" y="732" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="2158" y="716" width="83" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0mda4y4_di" bpmnElement="Activity_0mda4y4">
+        <dc:Bounds x="570" y="840" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1e7m0zn_di" bpmnElement="Activity_1e7m0zn">
+        <dc:Bounds x="730" y="840" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Gateway_18ykcln_di" bpmnElement="Gateway_18ykcln" isMarkerVisible="true">
+        <dc:Bounds x="915" y="855" width="50" height="50" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="899" y="825" width="84" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_0r83tv9_di" bpmnElement="Event_0r83tv9">
+        <dc:Bounds x="922" y="962" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="998" y="948" width="83" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0zlr24k_di" bpmnElement="Activity_0zlr24k">
+        <dc:Bounds x="1660" y="840" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0q7ghdf_di" bpmnElement="Activity_0q7ghdf">
+        <dc:Bounds x="1840" y="840" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Gateway_1dylwav_di" bpmnElement="Gateway_1dylwav" isMarkerVisible="true">
+        <dc:Bounds x="2035" y="855" width="50" height="50" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="2019" y="825" width="84" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_0wlpcd6_di" bpmnElement="Event_0wlpcd6">
+        <dc:Bounds x="2042" y="962" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="2078" y="946" width="83" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0506p7p_di" bpmnElement="Activity_0506p7p">
+        <dc:Bounds x="1490" y="840" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_11w4jgm_di" bpmnElement="Activity_11w4jgm">
+        <dc:Bounds x="420" y="840" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_0y0f7aq_di" bpmnElement="Event_1mf8gxd">
+        <dc:Bounds x="2182" y="862" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="2156" y="905" width="89" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_066h3ef_di" bpmnElement="Event_0dewj8o">
+        <dc:Bounds x="202" y="1092" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="189" y="1135" width="62" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0r4899a_di" bpmnElement="Activity_0qho4pw">
+        <dc:Bounds x="360" y="1070" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0b0pl0x_di" bpmnElement="Activity_03zg1pp">
+        <dc:Bounds x="530" y="1070" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0dreslj_di" bpmnElement="Activity_1ri9jrn">
+        <dc:Bounds x="710" y="1070" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_1m6hsxq_di" bpmnElement="Event_161u9s2">
+        <dc:Bounds x="1822" y="82" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0qbd3cz_di" bpmnElement="Activity_0qbd3cz" isExpanded="true">
+        <dc:Bounds x="820" y="1310" width="770" height="170" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="Flow_0nsc2oc_di" bpmnElement="Flow_0nsc2oc">
+        <di:waypoint x="1240" y="1414" />
+        <di:waypoint x="1320" y="1414" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1q1450g_di" bpmnElement="Flow_1q1450g">
+        <di:waypoint x="888" y="1414" />
+        <di:waypoint x="990" y="1414" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0alqcat_di" bpmnElement="Flow_0alqcat">
+        <di:waypoint x="1090" y="1414" />
+        <di:waypoint x="1140" y="1414" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_035ivcv_di" bpmnElement="Flow_035ivcv">
+        <di:waypoint x="1420" y="1414" />
+        <di:waypoint x="1502" y="1414" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="Event_13wl9ag_di" bpmnElement="Event_13wl9ag">
+        <dc:Bounds x="852" y="1396" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_0ugnt78_di" bpmnElement="Event_0ugnt78">
+        <dc:Bounds x="1502" y="1396" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1mzoss1_di" bpmnElement="Activity_1mzoss1">
+        <dc:Bounds x="1320" y="1374" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_055w5hr_di" bpmnElement="Activity_055w5hr">
+        <dc:Bounds x="1140" y="1374" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1nr7xyr_di" bpmnElement="Activity_1nr7xyr">
+        <dc:Bounds x="990" y="1374" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0c0vkj6_di" bpmnElement="Activity_0c0vkj6" isExpanded="true">
+        <dc:Bounds x="930" y="1600" width="440" height="140" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="Flow_0bkcs42_di" bpmnElement="Flow_0bkcs42">
+        <di:waypoint x="1018" y="1661" />
+        <di:waypoint x="1083" y="1661" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1b5mtc4_di" bpmnElement="Flow_1b5mtc4">
+        <di:waypoint x="1183" y="1661" />
+        <di:waypoint x="1282" y="1661" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="Event_1bqq1on_di" bpmnElement="Event_1bqq1on">
+        <dc:Bounds x="982" y="1643" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_0qb738v_di" bpmnElement="Event_0qb738v">
+        <dc:Bounds x="1282" y="1643" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0187ysa_di" bpmnElement="Activity_0187ysa">
+        <dc:Bounds x="1083" y="1621" width="100" height="80" />
+      </bpmndi:BPMNShape>
+    </bpmndi:BPMNPlane>
+  </bpmndi:BPMNDiagram>
+</bpmn:definitions>
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
new file mode 100644 (file)
index 0000000..81ed921
--- /dev/null
@@ -0,0 +1,340 @@
+<?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:process id="Process_02hqnsq" isExecutable="true">
+    <bpmn:startEvent id="StartEvent_1" name="Deallocate Core NSSI Flow">
+      <bpmn:outgoing>Flow_0xxq2h8</bpmn:outgoing>
+    </bpmn:startEvent>
+    <bpmn:scriptTask id="Activity_0u06qij" name="PreProcess Incoming Request" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0xxq2h8</bpmn:incoming>
+      <bpmn:outgoing>Flow_0g84uy5</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+        def dcnssi= new DoDeallocateCoreNSSI()
+        dcnssi.preProcessRequest(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_0xxq2h8" sourceRef="StartEvent_1" targetRef="Activity_0u06qij" />
+    <bpmn:scriptTask id="Activity_0wswwhj" name="Get Network Service Instance" scriptFormat="groovy">
+      <bpmn:incoming>Flow_189j30m</bpmn:incoming>
+      <bpmn:outgoing>Flow_16192dm</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcnssi= new DoDeallocateCoreNSSI()
+        dcnssi.getNetworkServiceInstance(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:exclusiveGateway id="Gateway_1dqw1bg" name="Is terminateNSSI=true?" default="Flow_0e3yvck">
+      <bpmn:incoming>Flow_16192dm</bpmn:incoming>
+      <bpmn:outgoing>Flow_15ew9rs</bpmn:outgoing>
+      <bpmn:outgoing>Flow_0e3yvck</bpmn:outgoing>
+    </bpmn:exclusiveGateway>
+    <bpmn:sequenceFlow id="Flow_16192dm" sourceRef="Activity_0wswwhj" targetRef="Gateway_1dqw1bg" />
+    <bpmn:scriptTask id="Activity_1kne6ot" name="Invoke DeleteServiceOrder API" scriptFormat="groovy">
+      <bpmn:incoming>Flow_15ew9rs</bpmn:incoming>
+      <bpmn:outgoing>Flow_1b14can</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcnssi= new DoDeallocateCoreNSSI()
+        dcnssi.deleteServiceOrder(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_1anr9ry" name="Get constitute VNF from Network Service Instance" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1v68jns</bpmn:incoming>
+      <bpmn:outgoing>Flow_1eev81t</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcnssi= new DoDeallocateCoreNSSI()
+        dcnssi.getConstituteVNFFromNetworkServiceInst(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_16wfqhu" name="Get NSSI associated profiles" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1eev81t</bpmn:incoming>
+      <bpmn:outgoing>Flow_0xrq94a</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcnssi= new DoDeallocateCoreNSSI()
+        dcnssi.getNSSIAssociatedProfiles(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_0es9or8" name="Calculate remaining S-NSSAI" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0xrq94a</bpmn:incoming>
+      <bpmn:outgoing>Flow_1qwi2ka</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcnssi= new DoDeallocateCoreNSSI()
+        dcnssi.calculateSNSSAI(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_0mnkgd6" name="Invoke PUT Service Instance API" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1qwi2ka</bpmn:incoming>
+      <bpmn:outgoing>Flow_178myd8</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcnssi= new DoDeallocateCoreNSSI()
+        dcnssi.invokePUTServiceInstance(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_19z90sm" name="Remove the NSSI association with NSI" scriptFormat="groovy">
+      <bpmn:incoming>Flow_16j7pjk</bpmn:incoming>
+      <bpmn:outgoing>Flow_0nvtepd</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcnssi= new DoDeallocateCoreNSSI()
+        dcnssi.removeNSSIAssociationWithNSI(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_1mbtpe6" name="Remove association of slice profile instance with the NSSI&#10;" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0nvtepd</bpmn:incoming>
+      <bpmn:outgoing>Flow_0j8gu83</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcnssi= new DoDeallocateCoreNSSI()
+        dcnssi.removeSPAssociationWithNSSI(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_0tanqh5" name="Delete the slice profile instance\r" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0j8gu83</bpmn:incoming>
+      <bpmn:outgoing>Flow_009x8vn</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcnssi= new DoDeallocateCoreNSSI()
+        dcnssi.deleteSliceProfileInstance(execution)</bpmn:script>
+    </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:exclusiveGateway>
+    <bpmn:endEvent id="Event_1vgebg2" name="End">
+      <bpmn:incoming>Flow_15rk73d</bpmn:incoming>
+    </bpmn:endEvent>
+    <bpmn:scriptTask id="Activity_1gcmlps" name=" Delete the NSSI service instance\r" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1r39237</bpmn:incoming>
+      <bpmn:outgoing>Flow_04hswb4</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+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:incoming>Flow_04hswb4</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>
+    </bpmn:scriptTask>
+    <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>
+    <bpmn:intermediateCatchEvent id="Event_1mk9pgp" name="No terminate NSSI Subflow">
+      <bpmn:outgoing>Flow_1v68jns</bpmn:outgoing>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_1ynsson" name="NoTerminateNSSISubflow" />
+    </bpmn:intermediateCatchEvent>
+    <bpmn:sequenceFlow id="Flow_0nvtepd" sourceRef="Activity_19z90sm" targetRef="Activity_1mbtpe6" />
+    <bpmn:sequenceFlow id="Flow_15ew9rs" name="yes" sourceRef="Gateway_1dqw1bg" targetRef="Activity_1kne6ot">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isTerminateNSSI" )  == true)}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:sequenceFlow id="Flow_1v68jns" sourceRef="Event_1mk9pgp" targetRef="Activity_1anr9ry" />
+    <bpmn:sequenceFlow id="Flow_1eev81t" sourceRef="Activity_1anr9ry" targetRef="Activity_16wfqhu" />
+    <bpmn:sequenceFlow id="Flow_0xrq94a" sourceRef="Activity_16wfqhu" targetRef="Activity_0es9or8" />
+    <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: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:intermediateCatchEvent id="Event_027jirg" name="Common Subflow">
+      <bpmn:outgoing>Flow_16j7pjk</bpmn:outgoing>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_1fn4t8h" name="CommonSubflow" />
+    </bpmn:intermediateCatchEvent>
+    <bpmn:sequenceFlow id="Flow_16j7pjk" sourceRef="Event_027jirg" targetRef="Activity_19z90sm" />
+    <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:scriptTask id="Activity_13qnpcn" name="Execute terminate NSSI query" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0g84uy5</bpmn:incoming>
+      <bpmn:outgoing>Flow_189j30m</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcnssi= new DoDeallocateCoreNSSI()
+        dcnssi.executeTerminateNSSIQuery(execution)</bpmn:script>
+    </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:process>
+  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_02hqnsq">
+      <bpmndi:BPMNEdge id="Flow_15rk73d_di" bpmnElement="Flow_15rk73d">
+        <di:waypoint x="1220" y="600" />
+        <di:waypoint x="1282" y="600" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_04hswb4_di" bpmnElement="Flow_04hswb4">
+        <di:waypoint x="980" y="600" />
+        <di:waypoint x="1120" y="600" />
+      </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" />
+        <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" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0j8gu83_di" bpmnElement="Flow_0j8gu83">
+        <di:waypoint x="510" y="600" />
+        <di:waypoint x="580" y="600" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_16j7pjk_di" bpmnElement="Flow_16j7pjk">
+        <di:waypoint x="208" y="600" />
+        <di:waypoint x="260" y="600" />
+      </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" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_178myd8_di" bpmnElement="Flow_178myd8">
+        <di:waypoint x="840" y="400" />
+        <di:waypoint x="957" y="400" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0e3yvck_di" bpmnElement="Flow_0e3yvck">
+        <di:waypoint x="775" y="117" />
+        <di:waypoint x="832" y="117" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="787" y="95" width="13" height="14" />
+        </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" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0xrq94a_di" bpmnElement="Flow_0xrq94a">
+        <di:waypoint x="510" y="400" />
+        <di:waypoint x="580" y="400" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1eev81t_di" bpmnElement="Flow_1eev81t">
+        <di:waypoint x="360" y="400" />
+        <di:waypoint x="410" y="400" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1v68jns_di" bpmnElement="Flow_1v68jns">
+        <di:waypoint x="208" y="400" />
+        <di:waypoint x="260" y="400" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_15ew9rs_di" bpmnElement="Flow_15ew9rs">
+        <di:waypoint x="750" y="142" />
+        <di:waypoint x="750" y="200" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="731" y="150" width="17" height="14" />
+        </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" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1r39237_di" bpmnElement="Flow_1r39237">
+        <di:waypoint x="815" y="600" />
+        <di:waypoint x="880" y="600" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="823" y="582" width="17" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_16192dm_di" bpmnElement="Flow_16192dm">
+        <di:waypoint x="680" y="117" />
+        <di:waypoint x="725" y="117" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0xxq2h8_di" bpmnElement="Flow_0xxq2h8">
+        <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>
+      <bpmndi:BPMNEdge id="Flow_189j30m_di" bpmnElement="Flow_189j30m">
+        <di:waypoint x="510" y="117" />
+        <di:waypoint x="580" y="117" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
+        <dc:Bounds x="179" y="99" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="160" y="142" width="79" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <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_1kne6ot_di" bpmnElement="Activity_1kne6ot">
+        <dc:Bounds x="700" y="200" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1anr9ry_di" bpmnElement="Activity_1anr9ry">
+        <dc:Bounds x="260" y="360" 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" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0es9or8_di" bpmnElement="Activity_0es9or8">
+        <dc:Bounds x="580" y="360" 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" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_19z90sm_di" bpmnElement="Activity_19z90sm">
+        <dc:Bounds x="260" y="560" 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" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0tanqh5_di" bpmnElement="Activity_0tanqh5">
+        <dc:Bounds x="580" y="560" 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" />
+        <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" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1gcmlps_di" bpmnElement="Activity_1gcmlps">
+        <dc:Bounds x="880" y="560" 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" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_1mk9pgp_di" bpmnElement="Event_1mk9pgp">
+        <dc:Bounds x="172" y="382" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="162" y="425" width="69" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_062ulql_di" bpmnElement="Event_062ulql">
+        <dc:Bounds x="957" y="382" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="947" y="423" 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:BPMNLabel>
+          <dc:Bounds x="153" y="625" width="88" height="14" />
+        </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:BPMNLabel>
+          <dc:Bounds x="708" y="53" width="85" height="40" />
+        </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>
+    </bpmndi:BPMNPlane>
+  </bpmndi:BPMNDiagram>
+</bpmn:definitions>
index db805ec..c107cfb 100644 (file)
@@ -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" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_0884541" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.4.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_0884541" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.7.2">
   <bpmn:process id="DoDeallocateNSSIV1" name="DoDeallocateNSSIV1" isExecutable="true">
     <bpmn:startEvent id="StartEvent_1" name="start">
       <bpmn:outgoing>SequenceFlow_05jfhy6</bpmn:outgoing>
@@ -35,25 +35,15 @@ dnssi.processDecomposition(execution)</bpmn:script>
     <bpmn:sequenceFlow id="SequenceFlow_1e7o57n" sourceRef="Task_15ut397" targetRef="Task_0vi4ijv" />
     <bpmn:scriptTask id="Task_0vi4ijv" name="Send deallocate request to NSSMF" scriptFormat="groovy">
       <bpmn:incoming>SequenceFlow_1e7o57n</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_03b0822</bpmn:outgoing>
+      <bpmn:outgoing>SequenceFlow_1wj89r5</bpmn:outgoing>
       <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
 def dnssi= new DoDeallocateNSSI()
 dnssi.sendRequestToNSSMF(execution)</bpmn:script>
     </bpmn:scriptTask>
-    <bpmn:sequenceFlow id="SequenceFlow_03b0822" sourceRef="Task_0vi4ijv" targetRef="Task_0kl6lcq" />
-    <bpmn:scriptTask id="Task_0kl6lcq" name="Query Job Status" scriptFormat="groovy">
-      <bpmn:incoming>SequenceFlow_03b0822</bpmn:incoming>
-      <bpmn:incoming>SequenceFlow_1anlirk</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_1jj0p5q</bpmn:outgoing>
-      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
-def dnssi= new DoDeallocateNSSI()
-dnssi.getJobStatus(execution)</bpmn:script>
-    </bpmn:scriptTask>
-    <bpmn:sequenceFlow id="SequenceFlow_1jj0p5q" sourceRef="Task_0kl6lcq" targetRef="ExclusiveGateway_0nhfsui" />
-    <bpmn:exclusiveGateway id="ExclusiveGateway_0nhfsui" name="Is deallocate finish?" default="SequenceFlow_0sfh52b">
-      <bpmn:incoming>SequenceFlow_1jj0p5q</bpmn:incoming>
+    <bpmn:exclusiveGateway id="ExclusiveGateway_0nhfsui" name="Is deallocate finish?">
+      <bpmn:incoming>SequenceFlow_02327ff</bpmn:incoming>
       <bpmn:outgoing>SequenceFlow_0xq380j</bpmn:outgoing>
-      <bpmn:outgoing>SequenceFlow_0sfh52b</bpmn:outgoing>
+      <bpmn:outgoing>SequenceFlow_1wpbkt9</bpmn:outgoing>
     </bpmn:exclusiveGateway>
     <bpmn:scriptTask id="Task_13vaezk" name="Delete Slice Profile From AAI" scriptFormat="groovy">
       <bpmn:incoming>SequenceFlow_0xq380j</bpmn:incoming>
@@ -76,15 +66,6 @@ dnssi.delSliceProfileFromAAI(execution)</bpmn:script>
       <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
 def dnssi= new DoDeallocateNSSI()
 dnssi.preProcessRequest(execution)</bpmn:script>
-    </bpmn:scriptTask>
-    <bpmn:sequenceFlow id="SequenceFlow_1anlirk" sourceRef="Task_0fxuz4i" targetRef="Task_0kl6lcq" />
-    <bpmn:scriptTask id="Task_0fxuz4i" name="TimeDelay" scriptFormat="groovy">
-      <bpmn:incoming>SequenceFlow_1ugva41</bpmn:incoming>
-      <bpmn:incoming>SequenceFlow_1u66wjs</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_1anlirk</bpmn:outgoing>
-      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
-def dnssi= new DoDeallocateNSSI()
-dnssi.timeDelay(execution)</bpmn:script>
     </bpmn:scriptTask>
     <bpmn:serviceTask id="Task_0amt4hu" name="Update Service Operation Status">
       <bpmn:extensionElements>
@@ -105,149 +86,171 @@ dnssi.timeDelay(execution)</bpmn:script>
           <camunda:connectorId>http-connector</camunda:connectorId>
         </camunda:connector>
       </bpmn:extensionElements>
-      <bpmn:incoming>SequenceFlow_04vg0c2</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_1ugva41</bpmn:outgoing>
+      <bpmn:incoming>SequenceFlow_19cdxhv</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_02327ff</bpmn:outgoing>
     </bpmn:serviceTask>
-    <bpmn:exclusiveGateway id="ExclusiveGateway_0y0w592" name="IsNeedUpdateDB?" default="SequenceFlow_1u66wjs">
-      <bpmn:incoming>SequenceFlow_0sfh52b</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_0r95j9m</bpmn:outgoing>
-      <bpmn:outgoing>SequenceFlow_1u66wjs</bpmn:outgoing>
-    </bpmn:exclusiveGateway>
-    <bpmn:sequenceFlow id="SequenceFlow_0sfh52b" sourceRef="ExclusiveGateway_0nhfsui" targetRef="ExclusiveGateway_0y0w592" />
-    <bpmn:sequenceFlow id="SequenceFlow_0r95j9m" sourceRef="ExclusiveGateway_0y0w592" targetRef="Task_1renmzf">
-      <bpmn:documentation>#{(execution.getVariable("isNeedUpdateDB" )  == true)}</bpmn:documentation>
-      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isNeedUpdateDB" )  == true)}</bpmn:conditionExpression>
-    </bpmn:sequenceFlow>
-    <bpmn:sequenceFlow id="SequenceFlow_04vg0c2" sourceRef="Task_1renmzf" targetRef="Task_0amt4hu" />
-    <bpmn:sequenceFlow id="SequenceFlow_1ugva41" sourceRef="Task_0amt4hu" targetRef="Task_0fxuz4i" />
-    <bpmn:sequenceFlow id="SequenceFlow_1u66wjs" sourceRef="ExclusiveGateway_0y0w592" targetRef="Task_0fxuz4i" />
     <bpmn:scriptTask id="Task_1renmzf" name="Prepare Update Operation Status" scriptFormat="groovy">
-      <bpmn:incoming>SequenceFlow_0r95j9m</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_04vg0c2</bpmn:outgoing>
+      <bpmn:incoming>SequenceFlow_0o7qjoo</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_19cdxhv</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dnssi= new DoDeallocateNSSI()
+dnssi.prepareUpdateOperationStatus(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <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" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>SequenceFlow_0w01l14</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_10nogqz</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:sequenceFlow id="SequenceFlow_10nogqz" sourceRef="Task_1x3et9h" targetRef="Task_1v3sdzq" />
+    <bpmn:sequenceFlow id="SequenceFlow_1wj89r5" sourceRef="Task_0vi4ijv" targetRef="Task_1vt5xaa" />
+    <bpmn:scriptTask id="Task_1v3sdzq" name="Handle Job Status" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_10nogqz</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0o7qjoo</bpmn:outgoing>
       <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
 def dnssi= new DoDeallocateNSSI()
 dnssi.handleJobStatus(execution)</bpmn:script>
     </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="SequenceFlow_0o7qjoo" sourceRef="Task_1v3sdzq" targetRef="Task_1renmzf" />
+    <bpmn:scriptTask id="Task_1vt5xaa" name="prepare QueryJobStatus Request" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_1wj89r5</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0w01l14</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dnssi= new DoDeallocateNSSI()
+dnssi.prepareJobStatusRequest(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="SequenceFlow_0w01l14" sourceRef="Task_1vt5xaa" targetRef="Task_1x3et9h" />
+    <bpmn:sequenceFlow id="SequenceFlow_19cdxhv" sourceRef="Task_1renmzf" targetRef="Task_0amt4hu" />
+    <bpmn:sequenceFlow id="SequenceFlow_02327ff" sourceRef="Task_0amt4hu" targetRef="ExclusiveGateway_0nhfsui" />
+    <bpmn:endEvent id="Event_11u9vp2">
+      <bpmn:incoming>SequenceFlow_1wpbkt9</bpmn:incoming>
+      <bpmn:errorEventDefinition id="ErrorEventDefinition_11pdh1q" errorRef="Error_1o5kb95" />
+    </bpmn:endEvent>
+    <bpmn:sequenceFlow id="SequenceFlow_1wpbkt9" name="no" sourceRef="ExclusiveGateway_0nhfsui" targetRef="Event_11u9vp2" />
   </bpmn:process>
+  <bpmn:error id="Error_1o5kb95" name="MSO Workflow Exception" errorCode="MSOWorkflowException" />
   <bpmndi:BPMNDiagram id="BPMNDiagram_1">
     <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoDeallocateNSSIV1">
-      <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
-        <dc:Bounds x="192" y="112" width="36" height="36" />
+      <bpmndi:BPMNEdge id="Flow_1wpbkt9_di" bpmnElement="SequenceFlow_1wpbkt9">
+        <di:waypoint x="1860" y="155" />
+        <di:waypoint x="1860" y="212" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="199" y="155" width="22" height="14" />
+          <dc:Bounds x="1869" y="165" width="13" height="14" />
         </bpmndi:BPMNLabel>
-      </bpmndi:BPMNShape>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_02327ff_di" bpmnElement="SequenceFlow_02327ff">
+        <di:waypoint x="1770" y="130" />
+        <di:waypoint x="1835" y="130" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_19cdxhv_di" bpmnElement="SequenceFlow_19cdxhv">
+        <di:waypoint x="1610" y="130" />
+        <di:waypoint x="1670" y="130" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0w01l14_di" bpmnElement="SequenceFlow_0w01l14">
+        <di:waypoint x="1120" y="130" />
+        <di:waypoint x="1190" y="130" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0o7qjoo_di" bpmnElement="SequenceFlow_0o7qjoo">
+        <di:waypoint x="1450" y="130" />
+        <di:waypoint x="1510" y="130" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1wj89r5_di" bpmnElement="SequenceFlow_1wj89r5">
+        <di:waypoint x="970" y="130" />
+        <di:waypoint x="1020" y="130" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_10nogqz_di" bpmnElement="SequenceFlow_10nogqz">
+        <di:waypoint x="1290" y="130" />
+        <di:waypoint x="1350" y="130" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0eug5nv_di" bpmnElement="SequenceFlow_0eug5nv">
+        <di:waypoint x="340" y="130" />
+        <di:waypoint x="390" y="130" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0xq380j_di" bpmnElement="SequenceFlow_0xq380j">
+        <di:waypoint x="1885" y="130" />
+        <di:waypoint x="1940" y="130" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1904" y="112" width="17" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1ii5002_di" bpmnElement="SequenceFlow_1ii5002">
+        <di:waypoint x="2040" y="130" />
+        <di:waypoint x="2102" y="130" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1e7o57n_di" bpmnElement="SequenceFlow_1e7o57n">
+        <di:waypoint x="800" y="130" />
+        <di:waypoint x="870" y="130" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1e451y9_di" bpmnElement="SequenceFlow_1e451y9">
+        <di:waypoint x="650" y="130" />
+        <di:waypoint x="700" y="130" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0wlyy5i_di" bpmnElement="SequenceFlow_0wlyy5i">
+        <di:waypoint x="490" y="130" />
+        <di:waypoint x="550" y="130" />
+      </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_05jfhy6_di" bpmnElement="SequenceFlow_05jfhy6">
-        <di:waypoint x="228" y="130" />
-        <di:waypoint x="310" y="130" />
+        <di:waypoint x="188" y="130" />
+        <di:waypoint x="240" y="130" />
       </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
+        <dc:Bounds x="152" y="112" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="159" y="155" width="23" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="ScriptTask_159g5ey_di" bpmnElement="Task_1m8upus">
-        <dc:Bounds x="490" y="90" width="100" height="80" />
+        <dc:Bounds x="390" y="90" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_0wlyy5i_di" bpmnElement="SequenceFlow_0wlyy5i">
-        <di:waypoint x="590" y="130" />
-        <di:waypoint x="660" y="130" />
-      </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="CallActivity_1ep4ama_di" bpmnElement="Task_1giechg">
-        <dc:Bounds x="660" y="90" width="100" height="80" />
+        <dc:Bounds x="550" y="90" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_1e451y9_di" bpmnElement="SequenceFlow_1e451y9">
-        <di:waypoint x="760" y="130" />
-        <di:waypoint x="820" y="130" />
-      </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="ScriptTask_1yt5s46_di" bpmnElement="Task_15ut397">
-        <dc:Bounds x="820" y="90" width="100" height="80" />
+        <dc:Bounds x="700" y="90" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_1e7o57n_di" bpmnElement="SequenceFlow_1e7o57n">
-        <di:waypoint x="920" y="130" />
-        <di:waypoint x="970" y="130" />
-      </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="ScriptTask_16dxpvz_di" bpmnElement="Task_0vi4ijv">
-        <dc:Bounds x="970" y="90" width="100" height="80" />
+        <dc:Bounds x="870" y="90" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_03b0822_di" bpmnElement="SequenceFlow_03b0822">
-        <di:waypoint x="1070" y="130" />
-        <di:waypoint x="1120" y="130" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNShape id="ScriptTask_0arl3j9_di" bpmnElement="Task_0kl6lcq">
-        <dc:Bounds x="1120" y="90" width="100" height="80" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_1jj0p5q_di" bpmnElement="SequenceFlow_1jj0p5q">
-        <di:waypoint x="1220" y="130" />
-        <di:waypoint x="1505" y="130" />
-      </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="ExclusiveGateway_0nhfsui_di" bpmnElement="ExclusiveGateway_0nhfsui" isMarkerVisible="true">
-        <dc:Bounds x="1505" y="105" width="50" height="50" />
+        <dc:Bounds x="1835" y="105" width="50" height="50" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="1501" y="75" width="63" height="27" />
+          <dc:Bounds x="1831" y="75" width="63" height="27" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="ScriptTask_1rfdrw3_di" bpmnElement="Task_13vaezk">
-        <dc:Bounds x="1690" y="90" width="100" height="80" />
+        <dc:Bounds x="1940" y="90" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="EndEvent_1f579t4_di" bpmnElement="EndEvent_1f579t4">
-        <dc:Bounds x="1862" y="112" width="36" height="36" />
+        <dc:Bounds x="2102" y="112" width="36" height="36" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="1871" y="155" width="19" height="14" />
+          <dc:Bounds x="2111" y="155" width="19" height="14" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_1ii5002_di" bpmnElement="SequenceFlow_1ii5002">
-        <di:waypoint x="1790" y="130" />
-        <di:waypoint x="1862" y="130" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_0xq380j_di" bpmnElement="SequenceFlow_0xq380j">
-        <di:waypoint x="1555" y="130" />
-        <di:waypoint x="1690" y="130" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="1614" y="112" width="17" height="14" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_0eug5nv_di" bpmnElement="SequenceFlow_0eug5nv">
-        <di:waypoint x="410" y="130" />
-        <di:waypoint x="490" y="130" />
-      </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="ScriptTask_1dytya8_di" bpmnElement="Task_1vste9s">
-        <dc:Bounds x="310" y="90" width="100" height="80" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_1anlirk_di" bpmnElement="SequenceFlow_1anlirk">
-        <di:waypoint x="1170" y="190" />
-        <di:waypoint x="1170" y="170" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNShape id="ScriptTask_0a4zalz_di" bpmnElement="Task_0fxuz4i">
-        <dc:Bounds x="1120" y="190" width="100" height="80" />
+        <dc:Bounds x="240" y="90" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="ServiceTask_0vegqix_di" bpmnElement="Task_0amt4hu">
-        <dc:Bounds x="1280" y="300" width="100" height="80" />
+        <dc:Bounds x="1670" y="90" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="ExclusiveGateway_0y0w592_di" bpmnElement="ExclusiveGateway_0y0w592" isMarkerVisible="true">
-        <dc:Bounds x="1505" y="205" width="50" height="50" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="1567" y="216" width="86" height="27" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_0sfh52b_di" bpmnElement="SequenceFlow_0sfh52b">
-        <di:waypoint x="1530" y="155" />
-        <di:waypoint x="1530" y="205" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_0r95j9m_di" bpmnElement="SequenceFlow_0r95j9m">
-        <di:waypoint x="1530" y="255" />
-        <di:waypoint x="1530" y="300" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_04vg0c2_di" bpmnElement="SequenceFlow_04vg0c2">
-        <di:waypoint x="1480" y="340" />
-        <di:waypoint x="1380" y="340" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_1ugva41_di" bpmnElement="SequenceFlow_1ugva41">
-        <di:waypoint x="1280" y="340" />
-        <di:waypoint x="1170" y="340" />
-        <di:waypoint x="1170" y="270" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_1u66wjs_di" bpmnElement="SequenceFlow_1u66wjs">
-        <di:waypoint x="1505" y="230" />
-        <di:waypoint x="1220" y="230" />
-      </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="ScriptTask_10pw6ot_di" bpmnElement="Task_1renmzf">
-        <dc:Bounds x="1480" y="300" width="100" height="80" />
+        <dc:Bounds x="1510" y="90" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1x3et9h_di" bpmnElement="Task_1x3et9h">
+        <dc:Bounds x="1190" y="90" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1v3sdzq_di" bpmnElement="Task_1v3sdzq">
+        <dc:Bounds x="1350" y="90" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1vt5xaa_di" bpmnElement="Task_1vt5xaa">
+        <dc:Bounds x="1020" y="90" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_11u9vp2_di" bpmnElement="Event_11u9vp2">
+        <dc:Bounds x="1842" y="212" width="36" height="36" />
       </bpmndi:BPMNShape>
     </bpmndi:BPMNPlane>
   </bpmndi:BPMNDiagram>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateTransportNSSI.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateTransportNSSI.bpmn
new file mode 100644 (file)
index 0000000..a800289
--- /dev/null
@@ -0,0 +1,221 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_1wio50w" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.1.1">
+  <bpmn:process id="DoDeallocateTransportNSSI" name="DoDeallocateTransportNSSI" isExecutable="true">
+    <bpmn:startEvent id="StartEvent_1nbljfd" name="Create Deallocate TN NSSMF Work Flow">
+      <bpmn:outgoing>SequenceFlow_03s744c</bpmn:outgoing>
+    </bpmn:startEvent>
+    <bpmn:subProcess id="SubProcess_1yv9i68" name="Sub-process for FalloutHandler and Rollback" triggeredByEvent="true">
+      <bpmn:startEvent id="StartEvent_1omdx56">
+        <bpmn:outgoing>SequenceFlow_1w67v6s</bpmn:outgoing>
+        <bpmn:errorEventDefinition id="ErrorEventDefinition_06xcioh" />
+      </bpmn:startEvent>
+      <bpmn:endEvent id="EndEvent_1jx3026">
+        <bpmn:incoming>SequenceFlow_08mlzwz</bpmn:incoming>
+      </bpmn:endEvent>
+      <bpmn:scriptTask id="ScriptTask_1swzdpw" name="Handle Unexpected Error" scriptFormat="groovy">
+        <bpmn:incoming>SequenceFlow_1w67v6s</bpmn:incoming>
+        <bpmn:outgoing>SequenceFlow_08mlzwz</bpmn:outgoing>
+        <bpmn:script>import org.onap.so.bpmn.common.scripts.*
+ExceptionUtil ex = new ExceptionUtil()
+ex.processJavaException(execution)</bpmn:script>
+      </bpmn:scriptTask>
+      <bpmn:sequenceFlow id="SequenceFlow_1w67v6s" sourceRef="StartEvent_1omdx56" targetRef="ScriptTask_1swzdpw" />
+      <bpmn:sequenceFlow id="SequenceFlow_08mlzwz" sourceRef="ScriptTask_1swzdpw" targetRef="EndEvent_1jx3026" />
+    </bpmn:subProcess>
+    <bpmn:endEvent id="EndEvent_05h01gx" name="End">
+      <bpmn:incoming>Flow_0ca4l8d</bpmn:incoming>
+    </bpmn:endEvent>
+    <bpmn:scriptTask id="ScriptTask_1ssh2l9" name="Prepare Update Resource Oper Status((finish)" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_0kixzdj</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1qv8qw1</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def runScript = new TnAllocateNssi()
+runScript.prepareUpdateJobStatus(execution,"finished","100","Deallocated TN NSSI successfully")</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="SequenceFlow_03s744c" sourceRef="StartEvent_1nbljfd" targetRef="ScriptTask_1tc44ge" />
+    <bpmn:sequenceFlow id="SequenceFlow_1qv8qw1" sourceRef="ScriptTask_1ssh2l9" targetRef="Activity_0rgeefb" />
+    <bpmn:scriptTask id="ScriptTask_19uxoi8" name="Update AAI Status" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_1jygjln</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0kixzdj</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+execution.setVariable("orchestrationStatus", "deallocated")
+def runScript = new DoDeallocateTnNssi()
+runScript.updateAAIOrchStatus(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="SequenceFlow_0kixzdj" sourceRef="ScriptTask_19uxoi8" targetRef="ScriptTask_1ssh2l9" />
+    <bpmn:scriptTask id="Activity_1tw8eyy" name="PreProcess SDNC Deallocate TN NSSI Request" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_07e12rt</bpmn:incoming>
+      <bpmn:outgoing>Flow_0cpctye</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def runScript = new DoDeallocateTnNssi()
+runScript.preprocessSdncDeallocateTnNssiRequest(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_0cpctye" sourceRef="Activity_1tw8eyy" targetRef="Activity_0p20esb" />
+    <bpmn:callActivity id="Activity_0p20esb" name="Call SDNC Adapter: Deallocate TN NSSI" calledElement="sdncAdapter">
+      <bpmn:extensionElements>
+        <camunda:in source="TNNSSMF_SDNCRequest" target="sdncAdapterWorkflowRequest" />
+        <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" />
+        <camunda:in source="mso-request-id" target="mso-request-id" />
+        <camunda:in source="mso-service-instance-id" target="mso-service-instance-id" />
+        <camunda:out source="WorkflowException" target="WorkflowException" />
+        <camunda:out source="sdncAdapterResponse" target="TNNSSMF_SDNCAdapterResponse" />
+        <camunda:out source="SDNCA_SuccessIndicator" target="SDNCA_SuccessIndicator" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_0cpctye</bpmn:incoming>
+      <bpmn:outgoing>Flow_0fuabjs</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:sequenceFlow id="Flow_0fuabjs" sourceRef="Activity_0p20esb" targetRef="Activity_0phv8e5" />
+    <bpmn:scriptTask id="Activity_0phv8e5" name="Postprocess SDNC Deallocate TN NSSI  Request" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0fuabjs</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1jdb2oq</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+
+String response = execution.getVariable("TNNSSMF_SDNCAdapterResponse")
+
+def runScript = new DoDeallocateTnNssi()
+runScript.validateSDNCResponse(execution, response, "deallocate")</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_013rjwc" name="Delete Service Instance (TN NSSI) in AAI" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_1jdb2oq</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1jygjln</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def runScript = new DoDeallocateTnNssi()
+runScript.deleteServiceInstance(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="SequenceFlow_1jdb2oq" sourceRef="Activity_0phv8e5" targetRef="Activity_013rjwc" />
+    <bpmn:scriptTask id="ScriptTask_1tc44ge" name="PreProcess Incoming Request" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_03s744c</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_07e12rt</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def runScript = new DoDeallocateTnNssi()
+runScript.preProcessRequest(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="SequenceFlow_07e12rt" sourceRef="ScriptTask_1tc44ge" targetRef="Activity_1tw8eyy" />
+    <bpmn:sequenceFlow id="SequenceFlow_1jygjln" sourceRef="Activity_013rjwc" targetRef="ScriptTask_19uxoi8" />
+    <bpmn:serviceTask id="Activity_0rgeefb" 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>SequenceFlow_1qv8qw1</bpmn:incoming>
+      <bpmn:outgoing>Flow_0ca4l8d</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:sequenceFlow id="Flow_0ca4l8d" sourceRef="Activity_0rgeefb" targetRef="EndEvent_05h01gx" />
+  </bpmn:process>
+  <bpmn:message id="Message_0c4b2r5" name="SliceServiceTask" />
+  <bpmn:error id="Error_03akl5v" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
+  <bpmn:error id="Error_0p2naox" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
+  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoDeallocateTransportNSSI">
+      <bpmndi:BPMNEdge id="Flow_1jygjln_di" bpmnElement="SequenceFlow_1jygjln">
+        <di:waypoint x="360" y="350" />
+        <di:waypoint x="520" y="350" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_07e12rt_di" bpmnElement="SequenceFlow_07e12rt">
+        <di:waypoint x="385" y="121" />
+        <di:waypoint x="509" y="121" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1jdb2oq_di" bpmnElement="SequenceFlow_1jdb2oq">
+        <di:waypoint x="1080" y="121" />
+        <di:waypoint x="1220" y="121" />
+        <di:waypoint x="1220" y="210" />
+        <di:waypoint x="310" y="210" />
+        <di:waypoint x="310" y="310" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0fuabjs_di" bpmnElement="Flow_0fuabjs">
+        <di:waypoint x="850" y="121" />
+        <di:waypoint x="959" y="121" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0cpctye_di" bpmnElement="Flow_0cpctye">
+        <di:waypoint x="630" y="121" />
+        <di:waypoint x="729" y="121" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0kixzdj_di" bpmnElement="SequenceFlow_0kixzdj">
+        <di:waypoint x="620" y="350" />
+        <di:waypoint x="740" y="350" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1qv8qw1_di" bpmnElement="SequenceFlow_1qv8qw1">
+        <di:waypoint x="840" y="350" />
+        <di:waypoint x="990" y="350" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_03s744c_di" bpmnElement="SequenceFlow_03s744c">
+        <di:waypoint x="214" y="121" />
+        <di:waypoint x="285" y="121" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0ca4l8d_di" bpmnElement="Flow_0ca4l8d">
+        <di:waypoint x="1090" y="350" />
+        <di:waypoint x="1202" y="350" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="StartEvent_1nbljfd_di" bpmnElement="StartEvent_1nbljfd">
+        <dc:Bounds x="178" y="103" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="166" y="146" width="70" height="53" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0rgeefb_di" bpmnElement="Activity_0rgeefb">
+        <dc:Bounds x="990" y="310" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="SubProcess_1yv9i68_di" bpmnElement="SubProcess_1yv9i68" isExpanded="true">
+        <dc:Bounds x="685" y="1080" width="781" height="196" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_08mlzwz_di" bpmnElement="SequenceFlow_08mlzwz">
+        <di:waypoint x="1079" y="1184" />
+        <di:waypoint x="1353" y="1184" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1w67v6s_di" bpmnElement="SequenceFlow_1w67v6s">
+        <di:waypoint x="751" y="1184" />
+        <di:waypoint x="979" y="1184" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="StartEvent_1omdx56_di" bpmnElement="StartEvent_1omdx56">
+        <dc:Bounds x="715" y="1166" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="EndEvent_1jx3026_di" bpmnElement="EndEvent_1jx3026">
+        <dc:Bounds x="1353" y="1166" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_1swzdpw_di" bpmnElement="ScriptTask_1swzdpw">
+        <dc:Bounds x="979" y="1144" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="EndEvent_05h01gx_di" bpmnElement="EndEvent_05h01gx">
+        <dc:Bounds x="1202" y="332" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1210" y="375" width="20" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_1ssh2l9_di" bpmnElement="ScriptTask_1ssh2l9">
+        <dc:Bounds x="740" y="310" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_19uxoi8_di" bpmnElement="ScriptTask_19uxoi8">
+        <dc:Bounds x="520" y="310" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1tw8eyy_di" bpmnElement="Activity_1tw8eyy">
+        <dc:Bounds x="509" y="74" width="121" height="94" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0p20esb_di" bpmnElement="Activity_0p20esb">
+        <dc:Bounds x="729" y="74" width="121" height="94" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0phv8e5_di" bpmnElement="Activity_0phv8e5">
+        <dc:Bounds x="959" y="74" width="121" height="94" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_013rjwc_di" bpmnElement="Activity_013rjwc">
+        <dc:Bounds x="260" y="310" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_1tc44ge_di" bpmnElement="ScriptTask_1tc44ge">
+        <dc:Bounds x="285" y="81" width="100" height="80" />
+      </bpmndi:BPMNShape>
+    </bpmndi:BPMNPlane>
+  </bpmndi:BPMNDiagram>
+</bpmn:definitions>
index 5f4816e..5510dcd 100644 (file)
@@ -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" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1p1suc9" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.4.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_1p1suc9" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.7.2">
   <bpmn:process id="DoDeleteSliceServiceV1" name="DoDeleteSliceServiceV1" isExecutable="true">
     <bpmn:startEvent id="StartEvent_1" name="start">
       <bpmn:outgoing>SequenceFlow_0ep5het</bpmn:outgoing>
@@ -23,12 +23,11 @@ ddss.getNSIFromAAI(execution)</bpmn:script>
     </bpmn:scriptTask>
     <bpmn:scriptTask id="Task_1u755sr" name="Query NSSI List From AAI" scriptFormat="groovy">
       <bpmn:incoming>SequenceFlow_1rgfzzy</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_05si1me</bpmn:outgoing>
+      <bpmn:outgoing>SequenceFlow_1aa2ek0</bpmn:outgoing>
       <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
 def ddss= new DoDeleteSliceService()
 ddss.getNSSIListFromAAI(execution)</bpmn:script>
     </bpmn:scriptTask>
-    <bpmn:sequenceFlow id="SequenceFlow_05si1me" sourceRef="Task_1u755sr" targetRef="Task_1iomfas" />
     <bpmn:exclusiveGateway id="ExclusiveGateway_1ogbunu" name="Is all NSSI finished?">
       <bpmn:incoming>SequenceFlow_15z9iio</bpmn:incoming>
       <bpmn:outgoing>SequenceFlow_1c4fjbv</bpmn:outgoing>
@@ -40,7 +39,6 @@ ddss.getNSSIListFromAAI(execution)</bpmn:script>
     <bpmn:sequenceFlow id="SequenceFlow_1c4fjbv" name="yes" sourceRef="ExclusiveGateway_1ogbunu" targetRef="EndEvent_0jaitqv">
       <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isAllNSSIFinished" )  == true)}</bpmn:conditionExpression>
     </bpmn:sequenceFlow>
-    <bpmn:sequenceFlow id="SequenceFlow_01o2qpv" sourceRef="Task_1iomfas" targetRef="Task_1qqljvu" />
     <bpmn:sequenceFlow id="SequenceFlow_0c58sw3" sourceRef="Task_1rc7mcw" targetRef="ScriptTask_159855t" />
     <bpmn:sequenceFlow id="SequenceFlow_0926ghe" name="no" sourceRef="ExclusiveGateway_1ogbunu" targetRef="Task_1iomfas">
       <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isAllNSSIFinished" )  == false)}</bpmn:conditionExpression>
@@ -55,8 +53,8 @@ ddss.preProcessRequest(execution)</bpmn:script>
     <bpmn:sequenceFlow id="SequenceFlow_0npmman" sourceRef="Task_0etki1p" targetRef="Task_13k9usx" />
     <bpmn:scriptTask id="Task_1iomfas" name="Get Current NSSI" scriptFormat="groovy">
       <bpmn:incoming>SequenceFlow_0926ghe</bpmn:incoming>
-      <bpmn:incoming>SequenceFlow_05si1me</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_01o2qpv</bpmn:outgoing>
+      <bpmn:incoming>SequenceFlow_1252rbf</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_17tvomo</bpmn:outgoing>
       <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
 def ddss= new DoDeleteSliceService()
 ddss.getCurrentNSSI(execution)</bpmn:script>
@@ -69,14 +67,6 @@ def ddss= new DoDeleteSliceService()
 ddss.parseNextNSSI(execution)</bpmn:script>
     </bpmn:scriptTask>
     <bpmn:sequenceFlow id="SequenceFlow_15z9iio" sourceRef="ScriptTask_159855t" targetRef="ExclusiveGateway_1ogbunu" />
-    <bpmn:sequenceFlow id="SequenceFlow_0q83qg3" sourceRef="Task_1qqljvu" targetRef="Task_1rc7mcw" />
-    <bpmn:scriptTask id="Task_1qqljvu" name="Query Slice Profile From AAI" scriptFormat="groovy">
-      <bpmn:incoming>SequenceFlow_01o2qpv</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_0q83qg3</bpmn:outgoing>
-      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
-def ddss= new DoDeleteSliceService()
-ddss.querySliceProfileFromAAI(execution)</bpmn:script>
-    </bpmn:scriptTask>
     <bpmn:sequenceFlow id="SequenceFlow_029u1wr" sourceRef="Task_13k9usx" targetRef="Task_1ujnqtj" />
     <bpmn:scriptTask id="Task_13k9usx" name="Query E2ESlice Serive From AAI" scriptFormat="groovy">
       <bpmn:incoming>SequenceFlow_0npmman</bpmn:incoming>
@@ -93,30 +83,84 @@ ddss.queryE2ESliceSeriveFromAAI(execution)</bpmn:script>
         <camunda:in source="serviceInstanceId" target="serviceInstanceId" />
         <camunda:out source="WorkflowException" target="WorkflowException" />
       </bpmn:extensionElements>
-      <bpmn:incoming>SequenceFlow_0q83qg3</bpmn:incoming>
+      <bpmn:incoming>SequenceFlow_17tvomo</bpmn:incoming>
       <bpmn:outgoing>SequenceFlow_0c58sw3</bpmn:outgoing>
     </bpmn:callActivity>
+    <bpmn:scriptTask id="Task_1iuls9p" name="Terminate NSI Query" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_1aa2ek0</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1252rbf</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dss= new DeleteSliceService()
+dss.terminateNSIQuery(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="SequenceFlow_17tvomo" sourceRef="Task_1iomfas" targetRef="Task_1rc7mcw" />
+    <bpmn:sequenceFlow id="SequenceFlow_1aa2ek0" sourceRef="Task_1u755sr" targetRef="Task_1iuls9p" />
+    <bpmn:sequenceFlow id="SequenceFlow_1252rbf" sourceRef="Task_1iuls9p" targetRef="Task_1iomfas" />
   </bpmn:process>
   <bpmndi:BPMNDiagram id="BPMNDiagram_1">
     <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoDeleteSliceServiceV1">
-      <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
-        <dc:Bounds x="152" y="122" width="36" height="36" />
+      <bpmndi:BPMNEdge id="Flow_1252rbf_di" bpmnElement="SequenceFlow_1252rbf">
+        <di:waypoint x="1150" y="140" />
+        <di:waypoint x="1200" y="140" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1aa2ek0_di" bpmnElement="SequenceFlow_1aa2ek0">
+        <di:waypoint x="1000" y="140" />
+        <di:waypoint x="1050" y="140" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_17tvomo_di" bpmnElement="SequenceFlow_17tvomo">
+        <di:waypoint x="1300" y="140" />
+        <di:waypoint x="1370" y="140" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_029u1wr_di" bpmnElement="SequenceFlow_029u1wr">
+        <di:waypoint x="530" y="140" />
+        <di:waypoint x="600" y="140" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_15z9iio_di" bpmnElement="SequenceFlow_15z9iio">
+        <di:waypoint x="1640" y="140" />
+        <di:waypoint x="1715" y="140" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0npmman_di" bpmnElement="SequenceFlow_0npmman">
+        <di:waypoint x="370" y="140" />
+        <di:waypoint x="430" y="140" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0926ghe_di" bpmnElement="SequenceFlow_0926ghe">
+        <di:waypoint x="1740" y="165" />
+        <di:waypoint x="1740" y="260" />
+        <di:waypoint x="1250" y="260" />
+        <di:waypoint x="1250" y="180" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="159" y="165" width="22" height="14" />
+          <dc:Bounds x="1489" y="242" width="13" height="14" />
         </bpmndi:BPMNLabel>
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_0ep5het_di" bpmnElement="SequenceFlow_0ep5het">
-        <di:waypoint x="188" y="140" />
-        <di:waypoint x="270" y="140" />
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_1qkgvvu_di" bpmnElement="SequenceFlow_1qkgvvu">
-        <di:waypoint x="700" y="140" />
-        <di:waypoint x="750" y="140" />
+      <bpmndi:BPMNEdge id="SequenceFlow_0c58sw3_di" bpmnElement="SequenceFlow_0c58sw3">
+        <di:waypoint x="1470" y="140" />
+        <di:waypoint x="1540" y="140" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1c4fjbv_di" bpmnElement="SequenceFlow_1c4fjbv">
+        <di:waypoint x="1765" y="140" />
+        <di:waypoint x="1802" y="140" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1771" y="118" width="17" height="14" />
+        </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_1rgfzzy_di" bpmnElement="SequenceFlow_1rgfzzy">
         <di:waypoint x="850" y="140" />
         <di:waypoint x="900" y="140" />
       </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1qkgvvu_di" bpmnElement="SequenceFlow_1qkgvvu">
+        <di:waypoint x="700" y="140" />
+        <di:waypoint x="750" y="140" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0ep5het_di" bpmnElement="SequenceFlow_0ep5het">
+        <di:waypoint x="188" y="140" />
+        <di:waypoint x="270" y="140" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
+        <dc:Bounds x="152" y="122" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="159" y="165" width="22" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="ScriptTask_1bj6tw4_di" bpmnElement="Task_1ujnqtj">
         <dc:Bounds x="600" y="100" width="100" height="80" />
       </bpmndi:BPMNShape>
@@ -126,79 +170,35 @@ ddss.queryE2ESliceSeriveFromAAI(execution)</bpmn:script>
       <bpmndi:BPMNShape id="ScriptTask_01fp1vt_di" bpmnElement="Task_1u755sr">
         <dc:Bounds x="900" y="100" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_05si1me_di" bpmnElement="SequenceFlow_05si1me">
-        <di:waypoint x="1000" y="140" />
-        <di:waypoint x="1040" y="140" />
-      </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="ExclusiveGateway_1ogbunu_di" bpmnElement="ExclusiveGateway_1ogbunu" isMarkerVisible="true">
-        <dc:Bounds x="1555" y="115" width="50" height="50" />
+        <dc:Bounds x="1715" y="115" width="50" height="50" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="1560" y="85" width="52" height="27" />
+          <dc:Bounds x="1720" y="85" width="52" height="27" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="EndEvent_0jaitqv_di" bpmnElement="EndEvent_0jaitqv">
-        <dc:Bounds x="1692" y="122" width="36" height="36" />
+        <dc:Bounds x="1802" y="122" width="36" height="36" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="1700" y="168" width="20" height="14" />
+          <dc:Bounds x="1810" y="168" width="20" height="14" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_1c4fjbv_di" bpmnElement="SequenceFlow_1c4fjbv">
-        <di:waypoint x="1605" y="140" />
-        <di:waypoint x="1692" y="140" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="1630" y="118" width="17" height="14" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_01o2qpv_di" bpmnElement="SequenceFlow_01o2qpv">
-        <di:waypoint x="1140" y="140" />
-        <di:waypoint x="1170" y="140" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_0c58sw3_di" bpmnElement="SequenceFlow_0c58sw3">
-        <di:waypoint x="1400" y="140" />
-        <di:waypoint x="1420" y="140" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_0926ghe_di" bpmnElement="SequenceFlow_0926ghe">
-        <di:waypoint x="1580" y="165" />
-        <di:waypoint x="1580" y="260" />
-        <di:waypoint x="1090" y="260" />
-        <di:waypoint x="1090" y="180" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="1329" y="242" width="13" height="14" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="ScriptTask_0icszw6_di" bpmnElement="Task_0etki1p">
         <dc:Bounds x="270" y="100" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_0npmman_di" bpmnElement="SequenceFlow_0npmman">
-        <di:waypoint x="370" y="140" />
-        <di:waypoint x="430" y="140" />
-      </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="ScriptTask_1obnwrr_di" bpmnElement="Task_1iomfas">
-        <dc:Bounds x="1040" y="100" width="100" height="80" />
+        <dc:Bounds x="1200" y="100" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="ScriptTask_159855t_di" bpmnElement="ScriptTask_159855t">
-        <dc:Bounds x="1420" y="100" width="100" height="80" />
+        <dc:Bounds x="1540" y="100" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_15z9iio_di" bpmnElement="SequenceFlow_15z9iio">
-        <di:waypoint x="1520" y="140" />
-        <di:waypoint x="1555" y="140" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_0q83qg3_di" bpmnElement="SequenceFlow_0q83qg3">
-        <di:waypoint x="1270" y="140" />
-        <di:waypoint x="1300" y="140" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNShape id="ScriptTask_0y9ppnc_di" bpmnElement="Task_1qqljvu">
-        <dc:Bounds x="1170" y="100" width="100" height="80" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_029u1wr_di" bpmnElement="SequenceFlow_029u1wr">
-        <di:waypoint x="530" y="140" />
-        <di:waypoint x="600" y="140" />
-      </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="ScriptTask_0f9rjq4_di" bpmnElement="Task_13k9usx">
         <dc:Bounds x="430" y="100" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="CallActivity_18qkiat_di" bpmnElement="Task_1rc7mcw">
-        <dc:Bounds x="1300" y="100" width="100" height="80" />
+        <dc:Bounds x="1370" y="100" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1iuls9p_di" bpmnElement="Task_1iuls9p">
+        <dc:Bounds x="1050" y="100" width="100" height="80" />
       </bpmndi:BPMNShape>
     </bpmndi:BPMNPlane>
   </bpmndi:BPMNDiagram>
index 7ca1a62..ed4561c 100644 (file)
@@ -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" id="Definitions_0nlt5gi" 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:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_0nlt5gi" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.4.1">
   <bpmn:process id="DoHandleOofRequest" name="DoHandleOofRequest" isExecutable="true">
     <bpmn:startEvent id="StartEvent_1">
       <bpmn:outgoing>Flow_1jorico</bpmn:outgoing>
@@ -10,8 +10,7 @@
       <bpmn:outgoing>Flow_013jfci</bpmn:outgoing>
       <bpmn:script>import org.onap.so.bpmn.common.scripts.*
 def oofHandler = new DoHandleOofRequest()
-oofHandler .callOofAdapter(execution)
-</bpmn:script>
+oofHandler.callOofAdapter(execution)</bpmn:script>
     </bpmn:scriptTask>
     <bpmn:sequenceFlow id="Flow_1jorico" sourceRef="StartEvent_1" targetRef="Activity_0tki17o" />
     <bpmn:scriptTask id="Activity_0tki17o" name="Preprocess Request" scriptFormat="groovy">
@@ -19,8 +18,7 @@ oofHandler .callOofAdapter(execution)
       <bpmn:outgoing>Flow_1fbzzqg</bpmn:outgoing>
       <bpmn:script>import org.onap.so.bpmn.common.scripts.*
 def oofHandler = new DoHandleOofRequest()
-oofHandler .preProcessRequest(execution)
-</bpmn:script>
+oofHandler.preProcessRequest(execution)</bpmn:script>
     </bpmn:scriptTask>
     <bpmn:subProcess id="Activity_02ru8n9" name="Sub-process for FalloutHandler and Rollback" triggeredByEvent="true">
       <bpmn:startEvent id="Event_1r00tca">
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoHandleSdnrDmaapRequest.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoHandleSdnrDmaapRequest.bpmn
new file mode 100644 (file)
index 0000000..d4e50c4
--- /dev/null
@@ -0,0 +1,98 @@
+<?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" id="Definitions_1347ugu" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.7.1">
+  <bpmn:process id="DoHandleSdnrDmaapRequest" name="CallSdnrForSliceSubnetActions" isExecutable="true">
+    <bpmn:startEvent id="StartEvent_1">
+      <bpmn:outgoing>Flow_05aj74g</bpmn:outgoing>
+    </bpmn:startEvent>
+    <bpmn:callActivity id="Activity_1930vdf" name="Receive Async Callback" camunda:modelerTemplate="receiveWorkflowMessage" calledElement="ReceiveWorkflowMessage">
+      <bpmn:extensionElements>
+        <camunda:in source="true" target="isDebugLogEnabled" />
+        <camunda:out source="WorkflowException" target="WorkflowException" />
+        <camunda:in source="messageType" target="RCVWFMSG_messageType" />
+        <camunda:in source="correlator" target="RCVWFMSG_correlator" />
+        <camunda:in source="timeout" target="RCVWFMSG_timeout" />
+        <camunda:out source="WorkflowResponse" target="asyncCallbackResponse" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_1ujhb0b</bpmn:incoming>
+      <bpmn:outgoing>Flow_0ygvrm7</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:sequenceFlow id="Flow_0ygvrm7" sourceRef="Activity_1930vdf" targetRef="Event_0axmcg1" />
+    <bpmn:endEvent id="Event_0axmcg1">
+      <bpmn:incoming>Flow_0ygvrm7</bpmn:incoming>
+    </bpmn:endEvent>
+    <bpmn:sequenceFlow id="Flow_05aj74g" sourceRef="StartEvent_1" targetRef="Activity_0se24pv" />
+    <bpmn:subProcess id="Activity_1br4yea" name="Sub-process for FalloutHandler and Rollback" triggeredByEvent="true">
+      <bpmn:startEvent id="Event_06b1eun">
+        <bpmn:outgoing>Flow_1if0x9d</bpmn:outgoing>
+        <bpmn:errorEventDefinition id="ErrorEventDefinition_0y90o3x" />
+      </bpmn:startEvent>
+      <bpmn:endEvent id="Event_1q3xxjf">
+        <bpmn:incoming>Flow_04gv65b</bpmn:incoming>
+      </bpmn:endEvent>
+      <bpmn:scriptTask id="Activity_0k6o70p" name="Handle Unexpected Error" scriptFormat="groovy">
+        <bpmn:incoming>Flow_1if0x9d</bpmn:incoming>
+        <bpmn:outgoing>Flow_04gv65b</bpmn:outgoing>
+        <bpmn:script>import org.onap.so.bpmn.common.scripts.*
+ExceptionUtil ex = new ExceptionUtil()
+ex.processJavaException(execution)</bpmn:script>
+      </bpmn:scriptTask>
+      <bpmn:sequenceFlow id="Flow_1if0x9d" sourceRef="Event_06b1eun" targetRef="Activity_0k6o70p" />
+      <bpmn:sequenceFlow id="Flow_04gv65b" sourceRef="Activity_0k6o70p" targetRef="Event_1q3xxjf" />
+    </bpmn:subProcess>
+    <bpmn:sequenceFlow id="Flow_1ujhb0b" sourceRef="Activity_0se24pv" targetRef="Activity_1930vdf" />
+    <bpmn:serviceTask id="Activity_0se24pv" name="send request to SDNR" camunda:class="org.onap.so.client.sdnc.common.SendRequestToSdnr">
+      <bpmn:incoming>Flow_05aj74g</bpmn:incoming>
+      <bpmn:outgoing>Flow_1ujhb0b</bpmn:outgoing>
+    </bpmn:serviceTask>
+  </bpmn:process>
+  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoHandleSdnrDmaapRequest">
+      <bpmndi:BPMNEdge id="Flow_05aj74g_di" bpmnElement="Flow_05aj74g">
+        <di:waypoint x="308" y="120" />
+        <di:waypoint x="350" y="120" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0ygvrm7_di" bpmnElement="Flow_0ygvrm7">
+        <di:waypoint x="581" y="118" />
+        <di:waypoint x="622" y="118" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1ujhb0b_di" bpmnElement="Flow_1ujhb0b">
+        <di:waypoint x="450" y="120" />
+        <di:waypoint x="481" y="120" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
+        <dc:Bounds x="272" y="102" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1930vdf_di" bpmnElement="Activity_1930vdf">
+        <dc:Bounds x="481" y="78" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_0axmcg1_di" bpmnElement="Event_0axmcg1">
+        <dc:Bounds x="622" y="100" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1f7ncbf_di" bpmnElement="Activity_0se24pv">
+        <dc:Bounds x="350" y="80" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1br4yea_di" bpmnElement="Activity_1br4yea" isExpanded="true">
+        <dc:Bounds x="140" y="310" width="781" height="196" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="Flow_04gv65b_di" bpmnElement="Flow_04gv65b">
+        <di:waypoint x="534" y="414" />
+        <di:waypoint x="808" y="414" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1if0x9d_di" bpmnElement="Flow_1if0x9d">
+        <di:waypoint x="206" y="414" />
+        <di:waypoint x="434" y="414" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="Event_06b1eun_di" bpmnElement="Event_06b1eun">
+        <dc:Bounds x="170" y="396" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_1q3xxjf_di" bpmnElement="Event_1q3xxjf">
+        <dc:Bounds x="808" y="396" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0k6o70p_di" bpmnElement="Activity_0k6o70p">
+        <dc:Bounds x="434" y="374" width="100" height="80" />
+      </bpmndi:BPMNShape>
+    </bpmndi:BPMNPlane>
+  </bpmndi:BPMNDiagram>
+</bpmn:definitions>
+
+
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoModifyAccessNSSI.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoModifyAccessNSSI.bpmn
new file mode 100644 (file)
index 0000000..c62b143
--- /dev/null
@@ -0,0 +1,886 @@
+<?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:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1igy8ns" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.7.1">
+  <bpmn:process id="DoModifyAccessNSSI" name="DoModifyAccessNSSI" isExecutable="true">
+    <bpmn:startEvent id="Event_1sy6p6u" name="Start">
+      <bpmn:outgoing>Flow_1yfvjui</bpmn:outgoing>
+    </bpmn:startEvent>
+    <bpmn:scriptTask id="Activity_1eiktpg" name="preprocess request" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1yfvjui</bpmn:incoming>
+      <bpmn:outgoing>Flow_09sxq6k</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoModifyAccessNSSI()
+nss.preProcessRequest(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_00u5sgf" name="prepare OOF request for RAN NSS slice profiles" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0hzibw4</bpmn:incoming>
+      <bpmn:outgoing>Flow_0714cfa</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoModifyAccessNSSI()
+nss.prepareOofRequestForRanNSS(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:callActivity id="Activity_1qswyrk" name="Call DoCreateSubnetOption" calledElement="DoHandleOofRequest">
+      <bpmn:extensionElements>
+        <camunda:in source="nssiSelection_Url" target="apiPath" />
+        <camunda:in source="nssiSelection_correlator" target="correlator" />
+        <camunda:in source="nssiSelection_messageType" target="messageType" />
+        <camunda:in source="nssiSelection_timeout" target="timeout" />
+        <camunda:in source="nssiSelection_oofRequest" target="oofRequest" />
+        <camunda:out source="WorkflowException" target="WorkflowException" />
+        <camunda:out source="asyncCallbackResponse" target="nssiSelection_asyncCallbackResponse" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_0714cfa</bpmn:incoming>
+      <bpmn:outgoing>Flow_0ei9866</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:scriptTask id="Activity_1w537ie" name="Process OOF response" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0ei9866</bpmn:incoming>
+      <bpmn:outgoing>Flow_14xj79h</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoModifyAccessNSSI()
+nss.processOofResponseForRanNSS(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_1yfvjui" sourceRef="Event_1sy6p6u" targetRef="Activity_1eiktpg" />
+    <bpmn:sequenceFlow id="Flow_0714cfa" sourceRef="Activity_00u5sgf" targetRef="Activity_1qswyrk" />
+    <bpmn:sequenceFlow id="Flow_0ei9866" sourceRef="Activity_1qswyrk" targetRef="Activity_1w537ie" />
+    <bpmn:exclusiveGateway id="Gateway_0gi40v8" name="check modify action">
+      <bpmn:incoming>Flow_09sxq6k</bpmn:incoming>
+      <bpmn:outgoing>Flow_1ycw1zo</bpmn:outgoing>
+      <bpmn:outgoing>Flow_1orjrjp</bpmn:outgoing>
+      <bpmn:outgoing>Flow_1p5ruyv</bpmn:outgoing>
+    </bpmn:exclusiveGateway>
+    <bpmn:sequenceFlow id="Flow_1ycw1zo" name="allocate" sourceRef="Gateway_0gi40v8" targetRef="Activity_0vki9dw">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isModifyallocate" )  == true)}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:sequenceFlow id="Flow_1orjrjp" name="deallocate" sourceRef="Gateway_0gi40v8" targetRef="Activity_10zcvcv">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isModifydeallocate" )  == true)}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:scriptTask id="Activity_0vki9dw" name="query AAI for slice profile" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1ycw1zo</bpmn:incoming>
+      <bpmn:outgoing>Flow_1ym755g</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoModifyAccessNSSI()
+nss.getSliceProfile(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_14xj79h" sourceRef="Activity_1w537ie" targetRef="Activity_0c8tzf1" />
+    <bpmn:sequenceFlow id="Flow_1p5ruyv" name="reconfigure" sourceRef="Gateway_0gi40v8" targetRef="Activity_0kcrid0">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isModifyreconfigure" )  == true)}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:scriptTask id="Activity_0c8tzf1" name="get NSSIs from AAI" scriptFormat="groovy">
+      <bpmn:incoming>Flow_14xj79h</bpmn:incoming>
+      <bpmn:outgoing>Flow_1fpw4gf</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoModifyAccessNSSI()
+nss.getNssisFromAai(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_1fpw4gf" sourceRef="Activity_0c8tzf1" targetRef="Activity_1so8vif" />
+    <bpmn:sequenceFlow id="Flow_05cl21h" sourceRef="Activity_1so8vif" targetRef="Activity_0uxxkp1" />
+    <bpmn:scriptTask id="Activity_0uxxkp1" name="update AAI relationships">
+      <bpmn:incoming>Flow_05cl21h</bpmn:incoming>
+      <bpmn:outgoing>Flow_1jwk3jy</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoModifyAccessNSSI()
+nss.updateRelationshipInAai(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_1so8vif" name="create slice profiles in AAI" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1fpw4gf</bpmn:incoming>
+      <bpmn:outgoing>Flow_05cl21h</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoModifyAccessNSSI()
+nss.createSliceProfiles(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_1jwk3jy" sourceRef="Activity_0uxxkp1" targetRef="Event_1wm97cy" />
+    <bpmn:intermediateThrowEvent id="Event_1wm97cy" name="Go to modify allocate">
+      <bpmn:incoming>Flow_1jwk3jy</bpmn:incoming>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_02uw07i" name="modifyAllocate" />
+    </bpmn:intermediateThrowEvent>
+    <bpmn:intermediateCatchEvent id="Event_058xrlc" name="Modify allocate">
+      <bpmn:outgoing>Flow_06hymr5</bpmn:outgoing>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_0j8kv6s" name="modifyAllocate" />
+    </bpmn:intermediateCatchEvent>
+    <bpmn:callActivity id="Activity_1nexxhu" name="DoModifyRanNfNssi" calledElement="DoModifyRanNfNssi">
+      <bpmn:extensionElements>
+        <camunda:in source="msoRequestId" target="msoRequestId" />
+        <camunda:in source="globalSubscriberId" target="globalSubscriberId" />
+        <camunda:in source="ANNF_NSSI" target="serviceInstanceID" />
+        <camunda:in source="subscriptionServiceType" target="subscriptionServiceType" />
+        <camunda:in source="ANNF_sliceProfileInstanceId" target="sliceProfileId" />
+        <camunda:in source="snssaiList" target="snssaiList" />
+        <camunda:out source="ranNfStatus" target="ranNfStatus" />
+        <camunda:in source="modifyAction" target="modifyAction" />
+        <camunda:in source="ranNfSliceProfile" target="additionalProperties" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_06hymr5</bpmn:incoming>
+      <bpmn:outgoing>Flow_19p3d5t</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:scriptTask id="Activity_1rweifb" name="post process RAN NF NSSI modify" scriptFormat="groovy">
+      <bpmn:incoming>Flow_19p3d5t</bpmn:incoming>
+      <bpmn:outgoing>Flow_0t8y3x5</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoModifyAccessNSSI()
+nss.processRanNfModifyRsp(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_19p3d5t" sourceRef="Activity_1nexxhu" targetRef="Activity_1rweifb" />
+    <bpmn:sequenceFlow id="Flow_06hymr5" sourceRef="Event_058xrlc" targetRef="Activity_1nexxhu" />
+    <bpmn:scriptTask id="Activity_0dr4umy" name="send modify allocate FH NSSI request" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0t8y3x5</bpmn:incoming>
+      <bpmn:outgoing>Flow_0cd38vb</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoModifyAccessNSSI()
+nss.prepareTnFhRequest(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_0e0ldfk" name="prepare query job status" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0cd38vb</bpmn:incoming>
+      <bpmn:outgoing>Flow_1yfkps3</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoModifyAccessNSSI()
+nss.createFhAllocateNssiJobQuery(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:callActivity id="Activity_07kzsym" name="Query Job status" calledElement="QueryJobStatus ">
+      <bpmn:extensionElements>
+        <camunda:in source="esrInfo" target="esrInfo" />
+        <camunda:in source="serviceInfo" target="serviceInfo" />
+        <camunda:in source="TNFH_jobId" target="jobId" />
+        <camunda:out source="jobResponse" target="TNFH_jobResponse" />
+        <camunda:in source="responseId" target="responseId" />
+        <camunda:in source="job_timeout" target="timeout" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_1yfkps3</bpmn:incoming>
+      <bpmn:outgoing>Flow_0tkrh8z</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:scriptTask id="Activity_06pgtv8" name="process Job status response" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0tkrh8z</bpmn:incoming>
+      <bpmn:outgoing>Flow_0ygfojp</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoModifyAccessNSSI()
+nss.processFhAllocateNssiJobStatusRsp(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_0cd38vb" sourceRef="Activity_0dr4umy" targetRef="Activity_0e0ldfk" />
+    <bpmn:sequenceFlow id="Flow_1yfkps3" sourceRef="Activity_0e0ldfk" targetRef="Activity_07kzsym" />
+    <bpmn:sequenceFlow id="Flow_0tkrh8z" sourceRef="Activity_07kzsym" targetRef="Activity_06pgtv8" />
+    <bpmn:sequenceFlow id="Flow_0t8y3x5" sourceRef="Activity_1rweifb" targetRef="Activity_0dr4umy" />
+    <bpmn:scriptTask id="Activity_11ohmvk" name="send modify allocate MH NSSI request" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0ygfojp</bpmn:incoming>
+      <bpmn:outgoing>Flow_1702ljm</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoModifyAccessNSSI()
+nss.prepareTnMhRequest(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_11kv5jk" name="prepare query job status" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1702ljm</bpmn:incoming>
+      <bpmn:outgoing>Flow_1hzswil</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoModifyAccessNSSI()
+nss.createMhAllocateNssiJobQuery(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:callActivity id="Activity_031x96n" name="Query Job status" calledElement="QueryJobStatus ">
+      <bpmn:extensionElements>
+        <camunda:in source="esrInfo" target="esrInfo" />
+        <camunda:in source="serviceInfo" target="serviceInfo" />
+        <camunda:in source="TNMH_jobId" target="jobId" />
+        <camunda:out source="jobResponse" target="TNMH_jobResponse" />
+        <camunda:in source="responseId" target="responseId" />
+        <camunda:in source="job_timeout" target="timeout" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_1hzswil</bpmn:incoming>
+      <bpmn:outgoing>Flow_0zh5p33</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:scriptTask id="Activity_1x48i50" name="process Job status response" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0zh5p33</bpmn:incoming>
+      <bpmn:outgoing>Flow_0wgumc4</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoModifyAccessNSSI()
+nss.processMhAllocateNssiJobStatusRsp(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_1702ljm" sourceRef="Activity_11ohmvk" targetRef="Activity_11kv5jk" />
+    <bpmn:sequenceFlow id="Flow_1hzswil" sourceRef="Activity_11kv5jk" targetRef="Activity_031x96n" />
+    <bpmn:sequenceFlow id="Flow_0zh5p33" sourceRef="Activity_031x96n" targetRef="Activity_1x48i50" />
+    <bpmn:sequenceFlow id="Flow_0ygfojp" sourceRef="Activity_06pgtv8" targetRef="Activity_11ohmvk" />
+    <bpmn:callActivity id="Activity_1pqb2g0" name="DoModifyRanNfNssi" calledElement="DoModifyRanNfNssi">
+      <bpmn:extensionElements>
+        <camunda:in source="msoRequestId" target="msoRequestId" />
+        <camunda:in source="globalSubscriberId" target="globalSubscriberId" />
+        <camunda:in source="ANNF_NSSI" target="serviceInstanceID" />
+        <camunda:in source="subscriptionServiceType" target="subscriptionServiceType" />
+        <camunda:in source="ANNF_sliceProfileInstanceId" target="sliceProfileId" />
+        <camunda:in source="snssaiList" target="snssaiList" />
+        <camunda:out source="ranNfStatus" target="ranNfStatus" />
+        <camunda:in source="modifyAction" target="modifyAction" />
+        <camunda:in source="additionalProperties" target="additionalProperties" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_09p79e6</bpmn:incoming>
+      <bpmn:outgoing>Flow_0ks2ut4</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:scriptTask id="Activity_0mleulg" name="post process RAN NF NSSI modify" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0ks2ut4</bpmn:incoming>
+      <bpmn:outgoing>Flow_1mu3zgb</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoModifyAccessNSSI()
+nss.processRanNfModifyRsp(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_0ks2ut4" sourceRef="Activity_1pqb2g0" targetRef="Activity_0mleulg" />
+    <bpmn:scriptTask id="Activity_1xdke18" name="send modify deallocate FH NSSI request" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1mu3zgb</bpmn:incoming>
+      <bpmn:outgoing>Flow_01vilkh</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoModifyAccessNSSI()
+nss.prepareTnFhDeallocateRequest(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_06meubi" name="prepare query job status" scriptFormat="groovy">
+      <bpmn:incoming>Flow_01vilkh</bpmn:incoming>
+      <bpmn:outgoing>Flow_0r7bejs</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoModifyAccessNSSI()
+nss.createFhAllocateNssiJobQuery(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:callActivity id="Activity_0sjyngn" name="Query Job status" calledElement="QueryJobStatus ">
+      <bpmn:extensionElements>
+        <camunda:in source="esrInfo" target="esrInfo" />
+        <camunda:in source="serviceInfo" target="serviceInfo" />
+        <camunda:in source="TN_FH_jobId" target="jobId" />
+        <camunda:out source="jobResponse" target="TNFH_jobResponse" />
+        <camunda:in source="responseId" target="responseId" />
+        <camunda:in source="job_timeout" target="timeout" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_0r7bejs</bpmn:incoming>
+      <bpmn:outgoing>Flow_06lgxk9</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:scriptTask id="Activity_0j3bxt8" name="process Job status response" scriptFormat="groovy">
+      <bpmn:incoming>Flow_06lgxk9</bpmn:incoming>
+      <bpmn:outgoing>Flow_120fe2z</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoModifyAccessNSSI()
+nss.processFhAllocateNssiJobStatusRsp(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_01vilkh" sourceRef="Activity_1xdke18" targetRef="Activity_06meubi" />
+    <bpmn:sequenceFlow id="Flow_0r7bejs" sourceRef="Activity_06meubi" targetRef="Activity_0sjyngn" />
+    <bpmn:sequenceFlow id="Flow_06lgxk9" sourceRef="Activity_0sjyngn" targetRef="Activity_0j3bxt8" />
+    <bpmn:sequenceFlow id="Flow_1mu3zgb" sourceRef="Activity_0mleulg" targetRef="Activity_1xdke18" />
+    <bpmn:scriptTask id="Activity_10zcvcv" name="get NSSIs from AAI" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1orjrjp</bpmn:incoming>
+      <bpmn:outgoing>Flow_1atfnov</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoModifyAccessNSSI()
+nss.getNssisFromAai(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_0m97fsi" name="send modify deallocate MH NSSI request" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1489mpe</bpmn:incoming>
+      <bpmn:outgoing>Flow_1ueq9wo</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoModifyAccessNSSI()
+nss.prepareTnMhDeallocateRequest(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_1wwt0yj" name="prepare query job status" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1ueq9wo</bpmn:incoming>
+      <bpmn:outgoing>Flow_05junp8</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoModifyAccessNSSI()
+nss.createMhAllocateNssiJobQuery(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:callActivity id="Activity_18gqpmg" name="Query Job status" calledElement="QueryJobStatus ">
+      <bpmn:extensionElements>
+        <camunda:in source="esrInfo" target="esrInfo" />
+        <camunda:in source="serviceInfo" target="serviceInfo" />
+        <camunda:in source="TN_MH_jobId" target="jobId" />
+        <camunda:out source="jobResponse" target="TNMH_jobResponse" />
+        <camunda:in source="responseId" target="responseId" />
+        <camunda:in source="job_timeout" target="timeout" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_05junp8</bpmn:incoming>
+      <bpmn:outgoing>Flow_1xchogr</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:scriptTask id="Activity_1j4c00v" name="process Job status response" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1xchogr</bpmn:incoming>
+      <bpmn:outgoing>Flow_11aacst</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoModifyAccessNSSI()
+nss.processMhAllocateNssiJobStatusRsp(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_1ueq9wo" sourceRef="Activity_0m97fsi" targetRef="Activity_1wwt0yj" />
+    <bpmn:sequenceFlow id="Flow_05junp8" sourceRef="Activity_1wwt0yj" targetRef="Activity_18gqpmg" />
+    <bpmn:sequenceFlow id="Flow_1xchogr" sourceRef="Activity_18gqpmg" targetRef="Activity_1j4c00v" />
+    <bpmn:sequenceFlow id="Flow_120fe2z" sourceRef="Activity_0j3bxt8" targetRef="Event_1x3sb7x" />
+    <bpmn:intermediateThrowEvent id="Event_1x3sb7x" name="Go to modify deallocate">
+      <bpmn:incoming>Flow_120fe2z</bpmn:incoming>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_1wixp6w" name="modifydeAllocate" />
+    </bpmn:intermediateThrowEvent>
+    <bpmn:sequenceFlow id="Flow_16lc641" sourceRef="Event_1vdrrdl" targetRef="Activity_0w9oree" />
+    <bpmn:intermediateCatchEvent id="Event_1vdrrdl" name="Modify deallocate">
+      <bpmn:outgoing>Flow_16lc641</bpmn:outgoing>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_1aw5yul" name="modifydeAllocate" />
+    </bpmn:intermediateCatchEvent>
+    <bpmn:scriptTask id="Activity_09ku290" name="remove TN MH slice profile" scriptFormat="groovy">
+      <bpmn:incoming>Flow_11aacst</bpmn:incoming>
+      <bpmn:outgoing>Flow_05gp3p7</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoModifyAccessNSSI()
+nss.deleteMhSliceProfile(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_1489mpe" sourceRef="Activity_0w9oree" targetRef="Activity_0m97fsi" />
+    <bpmn:scriptTask id="Activity_0w9oree" name="remove TN FH slice profile" scriptFormat="groovy">
+      <bpmn:incoming>Flow_16lc641</bpmn:incoming>
+      <bpmn:outgoing>Flow_1489mpe</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoModifyAccessNSSI()
+nss.deleteFhSliceProfile(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_11aacst" sourceRef="Activity_1j4c00v" targetRef="Activity_09ku290" />
+    <bpmn:scriptTask id="Activity_121aiqf" name="remove RAN slice profile" scriptFormat="groovy">
+      <bpmn:incoming>Flow_05gp3p7</bpmn:incoming>
+      <bpmn:outgoing>Flow_1nyp1l1</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoModifyAccessNSSI()
+nss.deleteAnSliceProfile(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_05gp3p7" sourceRef="Activity_09ku290" targetRef="Activity_121aiqf" />
+    <bpmn:subProcess id="Activity_0sp6bx7" name="Sub-process for FalloutHandler and Rollback" triggeredByEvent="true">
+      <bpmn:startEvent id="Event_0gr296x">
+        <bpmn:outgoing>Flow_0yj2tlu</bpmn:outgoing>
+        <bpmn:errorEventDefinition id="ErrorEventDefinition_1do1xse" />
+      </bpmn:startEvent>
+      <bpmn:endEvent id="Event_1hq0k3q">
+        <bpmn:incoming>Flow_07c6g27</bpmn:incoming>
+      </bpmn:endEvent>
+      <bpmn:scriptTask id="Activity_1awhkox" name="Handle Unexpected Error" scriptFormat="groovy">
+        <bpmn:incoming>Flow_0dafrg8</bpmn:incoming>
+        <bpmn:outgoing>Flow_07c6g27</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_16up0r1" name="Prepare Resource Operation Status Update" scriptFormat="groovy">
+        <bpmn:incoming>Flow_0yj2tlu</bpmn:incoming>
+        <bpmn:outgoing>Flow_0jar916</bpmn:outgoing>
+        <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoModifyAccessNSSI()
+nss.prepareFailedOperationStatusUpdate(execution)</bpmn:script>
+      </bpmn:scriptTask>
+      <bpmn:serviceTask id="Activity_1h1crsr" 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_0jar916</bpmn:incoming>
+        <bpmn:outgoing>Flow_0dafrg8</bpmn:outgoing>
+      </bpmn:serviceTask>
+      <bpmn:sequenceFlow id="Flow_07c6g27" sourceRef="Activity_1awhkox" targetRef="Event_1hq0k3q" />
+      <bpmn:sequenceFlow id="Flow_0yj2tlu" sourceRef="Event_0gr296x" targetRef="Activity_16up0r1" />
+      <bpmn:sequenceFlow id="Flow_0jar916" sourceRef="Activity_16up0r1" targetRef="Activity_1h1crsr" />
+      <bpmn:sequenceFlow id="Flow_0dafrg8" sourceRef="Activity_1h1crsr" targetRef="Activity_1awhkox" />
+    </bpmn:subProcess>
+    <bpmn:callActivity id="Activity_0kcrid0" name="DoModifyRanNfNssi" calledElement="DoModifyRanNfNssi">
+      <bpmn:extensionElements>
+        <camunda:in source="msoRequestId" target="msoRequestId" />
+        <camunda:in source="globalSubscriberId" target="globalSubscriberId" />
+        <camunda:in source="serviceInstanceID" target="serviceInstanceID" />
+        <camunda:in source="subscriptionServiceType" target="subscriptionServiceType" />
+        <camunda:in source="sliceProfileId" target="sliceProfileId" />
+        <camunda:in source="snssaiList" target="snssaiList" />
+        <camunda:out source="ranNfStatus" target="ranNfStatus" />
+        <camunda:in source="modifyAction" target="modifyAction" />
+        <camunda:in source="additionalProperties" target="additionalProperties" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_1p5ruyv</bpmn:incoming>
+      <bpmn:outgoing>Flow_0fkl1gv</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:scriptTask id="Activity_05m354s" name="post process RAN NF NSSI modify" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0fkl1gv</bpmn:incoming>
+      <bpmn:outgoing>Flow_17dxvu5</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoModifyAccessNSSI()
+nss.processRanNfModifyRsp(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_0fkl1gv" sourceRef="Activity_0kcrid0" targetRef="Activity_05m354s" />
+    <bpmn:sequenceFlow id="Flow_09sxq6k" sourceRef="Activity_1eiktpg" targetRef="Gateway_0gi40v8" />
+    <bpmn:scriptTask id="Activity_1w8iqt0" name="Get Subnet capabilities" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1ym755g</bpmn:incoming>
+      <bpmn:outgoing>Flow_0hzibw4</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoModifyAccessNSSI()
+nss.getSubnetCapabilities(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_1ym755g" sourceRef="Activity_0vki9dw" targetRef="Activity_1w8iqt0" />
+    <bpmn:sequenceFlow id="Flow_0hzibw4" sourceRef="Activity_1w8iqt0" targetRef="Activity_00u5sgf" />
+    <bpmn:scriptTask id="Activity_137i4pg" name="get sice profiles from AAI" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1atfnov</bpmn:incoming>
+      <bpmn:outgoing>Flow_09p79e6</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoModifyAccessNSSI()
+nss.getSliceProfilesFromAai(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_1atfnov" sourceRef="Activity_10zcvcv" targetRef="Activity_137i4pg" />
+    <bpmn:sequenceFlow id="Flow_09p79e6" sourceRef="Activity_137i4pg" targetRef="Activity_1pqb2g0" />
+    <bpmn:intermediateCatchEvent id="Event_00zdcuh" name="Start operation status update">
+      <bpmn:outgoing>Flow_0ei2q6r</bpmn:outgoing>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_1ohe6f7" name="OperationStatusUpdate" />
+    </bpmn:intermediateCatchEvent>
+    <bpmn:scriptTask id="Activity_0mr7bh2" name="Prepare Resource Operation Status Update" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0ei2q6r</bpmn:incoming>
+      <bpmn:outgoing>Flow_1giua78</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoModifyAccessNSSI()
+nss.prepareOperationStatusUpdate(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:serviceTask id="Activity_125mjhq" 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_1giua78</bpmn:incoming>
+      <bpmn:outgoing>Flow_1oubjfe</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:endEvent id="Event_159m6y8">
+      <bpmn:incoming>Flow_1oubjfe</bpmn:incoming>
+    </bpmn:endEvent>
+    <bpmn:sequenceFlow id="Flow_1giua78" sourceRef="Activity_0mr7bh2" targetRef="Activity_125mjhq" />
+    <bpmn:sequenceFlow id="Flow_1oubjfe" sourceRef="Activity_125mjhq" targetRef="Event_159m6y8" />
+    <bpmn:intermediateThrowEvent id="Event_1gy8um0" name="Go to start   operation status update">
+      <bpmn:incoming>Flow_0wgumc4</bpmn:incoming>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_0kburcf" name="OperationStatusUpdate" />
+    </bpmn:intermediateThrowEvent>
+    <bpmn:sequenceFlow id="Flow_0wgumc4" sourceRef="Activity_1x48i50" targetRef="Event_1gy8um0" />
+    <bpmn:sequenceFlow id="Flow_0ei2q6r" sourceRef="Event_00zdcuh" targetRef="Activity_0mr7bh2" />
+    <bpmn:intermediateThrowEvent id="Event_1304mrw" name="Go to start   operation status update">
+      <bpmn:incoming>Flow_1nyp1l1</bpmn:incoming>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_1rrc1x9" name="OperationStatusUpdate" />
+    </bpmn:intermediateThrowEvent>
+    <bpmn:sequenceFlow id="Flow_1nyp1l1" sourceRef="Activity_121aiqf" targetRef="Event_1304mrw" />
+    <bpmn:intermediateThrowEvent id="Event_00vqmnl" name="Go to start   operation status update">
+      <bpmn:incoming>Flow_17dxvu5</bpmn:incoming>
+      <bpmn:linkEventDefinition id="LinkEventDefinition_158e1rq" name="OperationStatusUpdate" />
+    </bpmn:intermediateThrowEvent>
+    <bpmn:sequenceFlow id="Flow_17dxvu5" sourceRef="Activity_05m354s" targetRef="Event_00vqmnl" />
+  </bpmn:process>
+  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoModifyAccessNSSI">
+      <bpmndi:BPMNEdge id="Flow_09sxq6k_di" bpmnElement="Flow_09sxq6k">
+        <di:waypoint x="330" y="240" />
+        <di:waypoint x="395" y="240" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0fkl1gv_di" bpmnElement="Flow_0fkl1gv">
+        <di:waypoint x="620" y="120" />
+        <di:waypoint x="680" y="120" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_05gp3p7_di" bpmnElement="Flow_05gp3p7">
+        <di:waypoint x="1080" y="760" />
+        <di:waypoint x="1130" y="760" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_11aacst_di" bpmnElement="Flow_11aacst">
+        <di:waypoint x="940" y="760" />
+        <di:waypoint x="980" y="760" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1489mpe_di" bpmnElement="Flow_1489mpe">
+        <di:waypoint x="360" y="760" />
+        <di:waypoint x="400" y="760" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_16lc641_di" bpmnElement="Flow_16lc641">
+        <di:waypoint x="188" y="760" />
+        <di:waypoint x="260" y="760" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_120fe2z_di" bpmnElement="Flow_120fe2z">
+        <di:waypoint x="1610" y="380" />
+        <di:waypoint x="1652" y="380" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1xchogr_di" bpmnElement="Flow_1xchogr">
+        <di:waypoint x="780" y="760" />
+        <di:waypoint x="840" y="760" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_05junp8_di" bpmnElement="Flow_05junp8">
+        <di:waypoint x="640" y="760" />
+        <di:waypoint x="680" y="760" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1ueq9wo_di" bpmnElement="Flow_1ueq9wo">
+        <di:waypoint x="500" y="760" />
+        <di:waypoint x="540" y="760" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1mu3zgb_di" bpmnElement="Flow_1mu3zgb">
+        <di:waypoint x="1060" y="380" />
+        <di:waypoint x="1100" y="380" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_06lgxk9_di" bpmnElement="Flow_06lgxk9">
+        <di:waypoint x="1470" y="380" />
+        <di:waypoint x="1510" y="380" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0r7bejs_di" bpmnElement="Flow_0r7bejs">
+        <di:waypoint x="1330" y="380" />
+        <di:waypoint x="1370" y="380" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_01vilkh_di" bpmnElement="Flow_01vilkh">
+        <di:waypoint x="1200" y="380" />
+        <di:waypoint x="1230" y="380" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0ks2ut4_di" bpmnElement="Flow_0ks2ut4">
+        <di:waypoint x="920" y="380" />
+        <di:waypoint x="960" y="380" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0ygfojp_di" bpmnElement="Flow_0ygfojp">
+        <di:waypoint x="940" y="570" />
+        <di:waypoint x="960" y="570" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0zh5p33_di" bpmnElement="Flow_0zh5p33">
+        <di:waypoint x="1300" y="570" />
+        <di:waypoint x="1330" y="570" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1hzswil_di" bpmnElement="Flow_1hzswil">
+        <di:waypoint x="1180" y="570" />
+        <di:waypoint x="1200" y="570" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1702ljm_di" bpmnElement="Flow_1702ljm">
+        <di:waypoint x="1060" y="570" />
+        <di:waypoint x="1080" y="570" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0t8y3x5_di" bpmnElement="Flow_0t8y3x5">
+        <di:waypoint x="450" y="570" />
+        <di:waypoint x="480" y="570" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0tkrh8z_di" bpmnElement="Flow_0tkrh8z">
+        <di:waypoint x="820" y="570" />
+        <di:waypoint x="840" y="570" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1yfkps3_di" bpmnElement="Flow_1yfkps3">
+        <di:waypoint x="700" y="570" />
+        <di:waypoint x="720" y="570" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0cd38vb_di" bpmnElement="Flow_0cd38vb">
+        <di:waypoint x="580" y="570" />
+        <di:waypoint x="600" y="570" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_06hymr5_di" bpmnElement="Flow_06hymr5">
+        <di:waypoint x="188" y="570" />
+        <di:waypoint x="220" y="570" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_19p3d5t_di" bpmnElement="Flow_19p3d5t">
+        <di:waypoint x="320" y="570" />
+        <di:waypoint x="350" y="570" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1jwk3jy_di" bpmnElement="Flow_1jwk3jy">
+        <di:waypoint x="1620" y="240" />
+        <di:waypoint x="1652" y="240" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_05cl21h_di" bpmnElement="Flow_05cl21h">
+        <di:waypoint x="1480" y="240" />
+        <di:waypoint x="1520" y="240" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1fpw4gf_di" bpmnElement="Flow_1fpw4gf">
+        <di:waypoint x="1340" y="240" />
+        <di:waypoint x="1380" y="240" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1p5ruyv_di" bpmnElement="Flow_1p5ruyv">
+        <di:waypoint x="420" y="215" />
+        <di:waypoint x="420" y="120" />
+        <di:waypoint x="520" y="120" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="409" y="103" width="56" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_14xj79h_di" bpmnElement="Flow_14xj79h">
+        <di:waypoint x="1200" y="240" />
+        <di:waypoint x="1240" y="240" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1orjrjp_di" bpmnElement="Flow_1orjrjp">
+        <di:waypoint x="420" y="265" />
+        <di:waypoint x="420" y="380" />
+        <di:waypoint x="520" y="380" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="437" y="363" width="51" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1ycw1zo_di" bpmnElement="Flow_1ycw1zo">
+        <di:waypoint x="445" y="240" />
+        <di:waypoint x="520" y="240" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="463" y="222" width="39" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0ei9866_di" bpmnElement="Flow_0ei9866">
+        <di:waypoint x="1050" y="240" />
+        <di:waypoint x="1100" y="240" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0714cfa_di" bpmnElement="Flow_0714cfa">
+        <di:waypoint x="890" y="240" />
+        <di:waypoint x="950" y="240" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1yfvjui_di" bpmnElement="Flow_1yfvjui">
+        <di:waypoint x="188" y="240" />
+        <di:waypoint x="230" y="240" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1ym755g_di" bpmnElement="Flow_1ym755g">
+        <di:waypoint x="620" y="240" />
+        <di:waypoint x="660" y="240" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0hzibw4_di" bpmnElement="Flow_0hzibw4">
+        <di:waypoint x="760" y="240" />
+        <di:waypoint x="790" y="240" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1atfnov_di" bpmnElement="Flow_1atfnov">
+        <di:waypoint x="620" y="380" />
+        <di:waypoint x="670" y="380" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_09p79e6_di" bpmnElement="Flow_09p79e6">
+        <di:waypoint x="770" y="380" />
+        <di:waypoint x="820" y="380" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1giua78_di" bpmnElement="Flow_1giua78">
+        <di:waypoint x="340" y="920" />
+        <di:waypoint x="380" y="920" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1oubjfe_di" bpmnElement="Flow_1oubjfe">
+        <di:waypoint x="480" y="920" />
+        <di:waypoint x="512" y="920" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0wgumc4_di" bpmnElement="Flow_0wgumc4">
+        <di:waypoint x="1430" y="570" />
+        <di:waypoint x="1482" y="570" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0ei2q6r_di" bpmnElement="Flow_0ei2q6r">
+        <di:waypoint x="198" y="920" />
+        <di:waypoint x="240" y="920" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1nyp1l1_di" bpmnElement="Flow_1nyp1l1">
+        <di:waypoint x="1230" y="760" />
+        <di:waypoint x="1282" y="760" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_17dxvu5_di" bpmnElement="Flow_17dxvu5">
+        <di:waypoint x="780" y="120" />
+        <di:waypoint x="832" y="120" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="Event_1sy6p6u_di" bpmnElement="Event_1sy6p6u">
+        <dc:Bounds x="152" y="222" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="158" y="265" width="25" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_01kasfm_di" bpmnElement="Activity_1eiktpg">
+        <dc:Bounds x="230" y="200" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Gateway_0gi40v8_di" bpmnElement="Gateway_0gi40v8" isMarkerVisible="true">
+        <dc:Bounds x="395" y="215" width="50" height="50" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="347" y="265.5" width="65" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1djbf1x_di" bpmnElement="Activity_0vki9dw">
+        <dc:Bounds x="520" y="200" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_09vilc7_di" bpmnElement="Event_058xrlc">
+        <dc:Bounds x="152" y="552" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="133" y="595" width="74" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1nexxhu_di" bpmnElement="Activity_1nexxhu">
+        <dc:Bounds x="220" y="530" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1rweifb_di" bpmnElement="Activity_1rweifb">
+        <dc:Bounds x="350" y="530" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0dr4umy_di" bpmnElement="Activity_0dr4umy">
+        <dc:Bounds x="480" y="530" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0e0ldfk_di" bpmnElement="Activity_0e0ldfk">
+        <dc:Bounds x="600" y="530" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_07kzsym_di" bpmnElement="Activity_07kzsym">
+        <dc:Bounds x="720" y="530" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_06pgtv8_di" bpmnElement="Activity_06pgtv8">
+        <dc:Bounds x="840" y="530" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_11ohmvk_di" bpmnElement="Activity_11ohmvk">
+        <dc:Bounds x="960" y="530" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_11kv5jk_di" bpmnElement="Activity_11kv5jk">
+        <dc:Bounds x="1080" y="530" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_031x96n_di" bpmnElement="Activity_031x96n">
+        <dc:Bounds x="1200" y="530" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1x48i50_di" bpmnElement="Activity_1x48i50">
+        <dc:Bounds x="1330" y="530" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_10zcvcv_di" bpmnElement="Activity_10zcvcv">
+        <dc:Bounds x="520" y="340" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0m97fsi_di" bpmnElement="Activity_0m97fsi">
+        <dc:Bounds x="400" y="720" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1wwt0yj_di" bpmnElement="Activity_1wwt0yj">
+        <dc:Bounds x="540" y="720" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_18gqpmg_di" bpmnElement="Activity_18gqpmg">
+        <dc:Bounds x="680" y="720" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1j4c00v_di" bpmnElement="Activity_1j4c00v">
+        <dc:Bounds x="840" y="720" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_1uqka61_di" bpmnElement="Event_1vdrrdl">
+        <dc:Bounds x="152" y="742" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="127" y="785" width="86" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_09ku290_di" bpmnElement="Activity_09ku290">
+        <dc:Bounds x="980" y="720" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1de2pwc_di" bpmnElement="Activity_0w9oree">
+        <dc:Bounds x="260" y="720" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_06x7003_di" bpmnElement="Activity_121aiqf">
+        <dc:Bounds x="1130" y="720" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1w8iqt0_di" bpmnElement="Activity_1w8iqt0">
+        <dc:Bounds x="660" y="200" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_00u5sgf_di" bpmnElement="Activity_00u5sgf">
+        <dc:Bounds x="790" y="200" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1qswyrk_di" bpmnElement="Activity_1qswyrk">
+        <dc:Bounds x="950" y="200" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1w537ie_di" bpmnElement="Activity_1w537ie">
+        <dc:Bounds x="1100" y="200" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1yl3g1d_di" bpmnElement="Activity_0c8tzf1">
+        <dc:Bounds x="1240" y="200" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_12zdzs0_di" bpmnElement="Activity_1so8vif">
+        <dc:Bounds x="1380" y="200" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_1j6uaol_di" bpmnElement="Event_1wm97cy">
+        <dc:Bounds x="1652" y="222" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1639" y="265" width="63" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_07pdl82_di" bpmnElement="Activity_0uxxkp1">
+        <dc:Bounds x="1520" y="200" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_0p57tcv_di" bpmnElement="Event_1x3sb7x">
+        <dc:Bounds x="1652" y="362" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1642" y="405" width="63" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0j3bxt8_di" bpmnElement="Activity_0j3bxt8">
+        <dc:Bounds x="1510" y="340" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0sjyngn_di" bpmnElement="Activity_0sjyngn">
+        <dc:Bounds x="1370" y="340" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_06meubi_di" bpmnElement="Activity_06meubi">
+        <dc:Bounds x="1230" y="340" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1xdke18_di" bpmnElement="Activity_1xdke18">
+        <dc:Bounds x="1100" y="340" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0mleulg_di" bpmnElement="Activity_0mleulg">
+        <dc:Bounds x="960" y="340" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1pqb2g0_di" bpmnElement="Activity_1pqb2g0">
+        <dc:Bounds x="820" y="340" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_171ya99_di" bpmnElement="Activity_137i4pg">
+        <dc:Bounds x="670" y="340" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_00zdcuh_di" bpmnElement="Event_00zdcuh">
+        <dc:Bounds x="162" y="902" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="144" y="945" width="73" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0mr7bh2_di" bpmnElement="Activity_0mr7bh2">
+        <dc:Bounds x="240" y="880" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_125mjhq_di" bpmnElement="Activity_125mjhq">
+        <dc:Bounds x="380" y="880" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_159m6y8_di" bpmnElement="Event_159m6y8">
+        <dc:Bounds x="512" y="902" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_1gy8um0_di" bpmnElement="Event_1gy8um0">
+        <dc:Bounds x="1482" y="552" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1460" y="587" width="79" height="40" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_1304mrw_di" bpmnElement="Event_1304mrw">
+        <dc:Bounds x="1282" y="742" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1260" y="777" width="79" height="40" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0kcrid0_di" bpmnElement="Activity_0kcrid0">
+        <dc:Bounds x="520" y="80" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_05m354s_di" bpmnElement="Activity_05m354s">
+        <dc:Bounds x="680" y="80" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_00vqmnl_di" bpmnElement="Event_00vqmnl">
+        <dc:Bounds x="832" y="102" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="810" y="137" width="79" height="40" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0sp6bx7_di" bpmnElement="Activity_0sp6bx7" isExpanded="true">
+        <dc:Bounds x="430" y="1070" width="781" height="196" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="Flow_0dafrg8_di" bpmnElement="Flow_0dafrg8">
+        <di:waypoint x="820" y="1174" />
+        <di:waypoint x="890" y="1174" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0jar916_di" bpmnElement="Flow_0jar916">
+        <di:waypoint x="660" y="1174" />
+        <di:waypoint x="720" y="1174" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0yj2tlu_di" bpmnElement="Flow_0yj2tlu">
+        <di:waypoint x="496" y="1174" />
+        <di:waypoint x="560" y="1174" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_07c6g27_di" bpmnElement="Flow_07c6g27">
+        <di:waypoint x="990" y="1174" />
+        <di:waypoint x="1098" y="1174" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="Event_0gr296x_di" bpmnElement="Event_0gr296x">
+        <dc:Bounds x="460" y="1156" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_1hq0k3q_di" bpmnElement="Event_1hq0k3q">
+        <dc:Bounds x="1098" y="1156" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1awhkox_di" bpmnElement="Activity_1awhkox">
+        <dc:Bounds x="890" y="1134" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_16up0r1_di" bpmnElement="Activity_16up0r1">
+        <dc:Bounds x="560" y="1134" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1h1crsr_di" bpmnElement="Activity_1h1crsr">
+        <dc:Bounds x="720" y="1134" width="100" height="80" />
+      </bpmndi:BPMNShape>
+    </bpmndi:BPMNPlane>
+  </bpmndi:BPMNDiagram>
+</bpmn:definitions>
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
new file mode 100644 (file)
index 0000000..1f1fe4e
--- /dev/null
@@ -0,0 +1,311 @@
+<?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:process id="Process_1nmtzzp" isExecutable="true">
+    <bpmn:startEvent id="Event_0fbqt56" name="Modify Core NSSI Flow">
+      <bpmn:outgoing>Flow_0e007rx</bpmn:outgoing>
+    </bpmn:startEvent>
+    <bpmn:scriptTask id="Activity_0tf735w" name="Get Network Service Instance" scriptFormat="groovy">
+      <bpmn:incoming>Flow_06j2avj</bpmn:incoming>
+      <bpmn:outgoing>Flow_1mqjtfk</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def mcnssi= new DoModifyCoreNSSI()
+        mcnssi.getNetworkServiceInstance(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:scriptTask id="Activity_1ce41n6" name="Get constitute VNF from Network Service Instance" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1mqjtfk</bpmn:incoming>
+      <bpmn:outgoing>Flow_184tfp7</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def mcnssi= new DoModifyCoreNSSI()
+        mcnssi.getConstituteVNFFromNetworkServiceInst(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_1mqjtfk" sourceRef="Activity_0tf735w" targetRef="Activity_1ce41n6" />
+    <bpmn:scriptTask id="Activity_02skgkj" name="Get NSSI associated profiles" scriptFormat="groovy">
+      <bpmn:incoming>Flow_184tfp7</bpmn:incoming>
+      <bpmn:outgoing>Flow_0s31teg</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def mcnssi= new DoModifyCoreNSSI()
+        mcnssi.getNSSIAssociatedProfiles(execution)</bpmn:script>
+    </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: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: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" />
+    </bpmn:intermediateThrowEvent>
+    <bpmn:sequenceFlow id="Flow_1pls2hu" name="yes" sourceRef="Gateway_1hadnun" targetRef="Event_1243wg1">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isCreateSliceProfileInstance" )  == true)}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:intermediateThrowEvent id="Event_1gjhrcq" name="Goto Slice profile instance has to be deleted">
+      <bpmn:incoming>Flow_03gf14v</bpmn:incoming>
+      <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: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>
+    </bpmn:scriptTask>
+    <bpmn:endEvent id="Event_1p0mogo" name="End">
+      <bpmn:incoming>Flow_0yq24um</bpmn:incoming>
+    </bpmn:endEvent>
+    <bpmn:sequenceFlow id="Flow_0yq24um" sourceRef="Activity_0oph5am" targetRef="Event_1p0mogo" />
+    <bpmn:intermediateCatchEvent id="Event_0z9mer1" name="Slice Profile Instance has to be created">
+      <bpmn:outgoing>Flow_1xysykm</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\r" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0ccqmju</bpmn:incoming>
+      <bpmn:outgoing>Flow_1fdpbsx</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def mcnssi= new ModifyCoreNSSI()
+        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\r" 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()
+        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:scriptTask id="Activity_1iegufd" name="Remove the NSSI to slice instance association\r" scriptFormat="groovy">
+      <bpmn:incoming>Flow_15fi92t</bpmn:incoming>
+      <bpmn:outgoing>Flow_1wtv1zj</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def mcnssi= new ModifyCoreNSSI()
+        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\r" 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()
+        mcnssi.deleteSliceProfileInstance(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_1wtv1zj" sourceRef="Activity_1iegufd" targetRef="Activity_010nkjp" />
+    <bpmn:sequenceFlow id="Flow_0l7hcnf" sourceRef="Activity_1josmor" targetRef="Activity_0oph5am" />
+    <bpmn:sequenceFlow id="Flow_0lrenyo" sourceRef="Activity_010nkjp" targetRef="Activity_0oph5am" />
+    <bpmn:scriptTask id="Activity_0klj7y1" name="PreProcess Incoming Request" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0e007rx</bpmn:incoming>
+      <bpmn:outgoing>Flow_06j2avj</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+        def mcnssi= new DoModifyCoreNSSI()
+        mcnssi.preProcessRequest(execution)</bpmn:script>
+    </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: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" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0e007rx_di" bpmnElement="Flow_0e007rx">
+        <di:waypoint x="218" y="150" />
+        <di:waypoint x="280" 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" />
+      </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" />
+      </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" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_11vf6ik_di" bpmnElement="Flow_11vf6ik">
+        <di:waypoint x="218" y="600" />
+        <di:waypoint x="280" y="600" />
+      </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" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0yq24um_di" bpmnElement="Flow_0yq24um">
+        <di:waypoint x="1070" y="520" />
+        <di:waypoint x="1132" y="520" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_03gf14v_di" bpmnElement="Flow_03gf14v">
+        <di:waypoint x="1010" y="175" />
+        <di:waypoint x="1010" y="252" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1019" y="190" 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" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1049" y="132" 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" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_184tfp7_di" bpmnElement="Flow_184tfp7">
+        <di:waypoint x="720" y="150" />
+        <di:waypoint x="810" y="150" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1mqjtfk_di" bpmnElement="Flow_1mqjtfk">
+        <di:waypoint x="540" y="150" />
+        <di:waypoint x="620" y="150" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="Event_0fbqt56_di" bpmnElement="Event_0fbqt56">
+        <dc:Bounds x="182" y="132" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="158" y="175" width="89" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0tf735w_di" bpmnElement="Activity_0tf735w">
+        <dc:Bounds x="440" 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" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_02skgkj_di" bpmnElement="Activity_02skgkj">
+        <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:BPMNLabel>
+          <dc:Bounds x="974" y="86" width="75" height="40" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_1243wg1_di" bpmnElement="Event_1243wg1">
+        <dc:Bounds x="1132" y="132" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1113" y="173" 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:BPMNLabel>
+          <dc:Bounds x="973" y="293" 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:BPMNLabel>
+          <dc:Bounds x="1140" y="478" width="20" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_0z9mer1_di" bpmnElement="Event_0z9mer1">
+        <dc:Bounds x="182" y="412" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="162" y="455" width="90" height="40" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_0m2jn7c_di" bpmnElement="Event_0m2jn7c">
+        <dc:Bounds x="182" y="582" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="155" y="625" 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>
+      <bpmndi:BPMNShape id="Activity_00t4mmi_di" bpmnElement="Activity_00t4mmi">
+        <dc:Bounds x="460" 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>
+      <bpmndi:BPMNShape id="Activity_1josmor_di" bpmnElement="Activity_1josmor">
+        <dc:Bounds x="790" y="390" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0j4c22q_di" bpmnElement="Activity_0j4c22q">
+        <dc:Bounds x="280" y="560" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0c4wmiz_di" bpmnElement="Activity_0c4wmiz">
+        <dc:Bounds x="460" y="560" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1iegufd_di" bpmnElement="Activity_1iegufd">
+        <dc:Bounds x="630" y="560" 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>
+      <bpmndi:BPMNShape id="Activity_0klj7y1_di" bpmnElement="Activity_0klj7y1">
+        <dc:Bounds x="280" y="110" width="100" height="80" />
+      </bpmndi:BPMNShape>
+    </bpmndi:BPMNPlane>
+  </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoModifyRanNfNssi.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoModifyRanNfNssi.bpmn
new file mode 100644 (file)
index 0000000..1af4ff9
--- /dev/null
@@ -0,0 +1,91 @@
+<?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" id="Definitions_0misy4e" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.7.1">
+  <bpmn:process id="DoModifyRanNfNssi" isExecutable="true">
+    <bpmn:startEvent id="StartEvent_1">
+      <bpmn:outgoing>Flow_0f9s9j7</bpmn:outgoing>
+    </bpmn:startEvent>
+    <bpmn:scriptTask id="Activity_0bbh5uy" name="preprocess request" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0f9s9j7</bpmn:incoming>
+      <bpmn:outgoing>Flow_1kdh0gl</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoModifyRanNfNssi()
+nss.preProcessRequest(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_0f9s9j7" sourceRef="StartEvent_1" targetRef="Activity_0bbh5uy" />
+    <bpmn:sequenceFlow id="Flow_1kdh0gl" sourceRef="Activity_0bbh5uy" targetRef="Activity_1rs1l5c" />
+    <bpmn:scriptTask id="Activity_1rs1l5c" name="prepare SDNR request" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1kdh0gl</bpmn:incoming>
+      <bpmn:outgoing>Flow_0n0zzp4</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoModifyRanNfNssi()
+nss.createSdnrRequest(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:callActivity id="Activity_1jpoqws" name="call sdnr for RAN NF NSSI creation" calledElement="DoHandleSdnrDmaapRequest">
+      <bpmn:extensionElements>
+        <camunda:in source="createNSSI_sdnrRequest" target="sdnrRequest" />
+        <camunda:out source="asyncCallbackResponse" target="SDNR_asyncCallbackResponse" />
+        <camunda:out source="WorkflowException" target="WorkflowException" />
+        <camunda:in source="createNSSI_correlator" target="correlator" />
+        <camunda:in source="createNSSI_messageType" target="messageType" />
+        <camunda:in source="createNSSI_timeout" target="timeout" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_0n0zzp4</bpmn:incoming>
+      <bpmn:outgoing>Flow_1b0cez1</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:scriptTask id="Activity_03xcmka" name="process SDNR response" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1b0cez1</bpmn:incoming>
+      <bpmn:outgoing>Flow_1ngijid</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DoModifyRanNfNssi()
+nss.processSdnrResponse(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_0n0zzp4" sourceRef="Activity_1rs1l5c" targetRef="Activity_1jpoqws" />
+    <bpmn:sequenceFlow id="Flow_1b0cez1" sourceRef="Activity_1jpoqws" targetRef="Activity_03xcmka" />
+    <bpmn:sequenceFlow id="Flow_1ngijid" sourceRef="Activity_03xcmka" targetRef="Event_086qr2t" />
+    <bpmn:endEvent id="Event_086qr2t">
+      <bpmn:incoming>Flow_1ngijid</bpmn:incoming>
+    </bpmn:endEvent>
+  </bpmn:process>
+  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoModifyRanNfNssi">
+      <bpmndi:BPMNEdge id="Flow_1ngijid_di" bpmnElement="Flow_1ngijid">
+        <di:waypoint x="730" y="100" />
+        <di:waypoint x="772" y="100" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1b0cez1_di" bpmnElement="Flow_1b0cez1">
+        <di:waypoint x="590" y="100" />
+        <di:waypoint x="630" y="100" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0n0zzp4_di" bpmnElement="Flow_0n0zzp4">
+        <di:waypoint x="460" y="100" />
+        <di:waypoint x="490" y="100" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1kdh0gl_di" bpmnElement="Flow_1kdh0gl">
+        <di:waypoint x="320" y="100" />
+        <di:waypoint x="360" y="100" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0f9s9j7_di" bpmnElement="Flow_0f9s9j7">
+        <di:waypoint x="188" y="100" />
+        <di:waypoint x="220" y="100" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
+        <dc:Bounds x="152" y="82" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0bbh5uy_di" bpmnElement="Activity_0bbh5uy">
+        <dc:Bounds x="220" y="60" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1rs1l5c_di" bpmnElement="Activity_1rs1l5c">
+        <dc:Bounds x="360" y="60" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1jpoqws_di" bpmnElement="Activity_1jpoqws">
+        <dc:Bounds x="490" y="60" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_03xcmka_di" bpmnElement="Activity_03xcmka">
+        <dc:Bounds x="630" y="60" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_086qr2t_di" bpmnElement="Event_086qr2t">
+        <dc:Bounds x="772" y="82" width="36" height="36" />
+      </bpmndi:BPMNShape>
+    </bpmndi:BPMNPlane>
+  </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoModifyTransportNSSI.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoModifyTransportNSSI.bpmn
new file mode 100644 (file)
index 0000000..d70bed6
--- /dev/null
@@ -0,0 +1,222 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_1wio50w" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.1.1">
+  <bpmn:process id="DoModifyTransportNSSI" name="DoModifyTransportNSSI" isExecutable="true">
+    <bpmn:startEvent id="StartEvent_1nbljfd" name="Create Modify TN NSSMF Work Flow">
+      <bpmn:outgoing>SequenceFlow_03s744c</bpmn:outgoing>
+    </bpmn:startEvent>
+    <bpmn:subProcess id="SubProcess_1yv9i68" name="Sub-process for FalloutHandler and Rollback" triggeredByEvent="true">
+      <bpmn:startEvent id="StartEvent_1omdx56">
+        <bpmn:outgoing>SequenceFlow_1w67v6s</bpmn:outgoing>
+        <bpmn:errorEventDefinition id="ErrorEventDefinition_06xcioh" />
+      </bpmn:startEvent>
+      <bpmn:endEvent id="EndEvent_1jx3026">
+        <bpmn:incoming>SequenceFlow_08mlzwz</bpmn:incoming>
+      </bpmn:endEvent>
+      <bpmn:scriptTask id="ScriptTask_1swzdpw" name="Handle Unexpected Error" scriptFormat="groovy">
+        <bpmn:incoming>SequenceFlow_1w67v6s</bpmn:incoming>
+        <bpmn:outgoing>SequenceFlow_08mlzwz</bpmn:outgoing>
+        <bpmn:script>import org.onap.so.bpmn.common.scripts.*
+ExceptionUtil ex = new ExceptionUtil()
+ex.processJavaException(execution)</bpmn:script>
+      </bpmn:scriptTask>
+      <bpmn:sequenceFlow id="SequenceFlow_1w67v6s" sourceRef="StartEvent_1omdx56" targetRef="ScriptTask_1swzdpw" />
+      <bpmn:sequenceFlow id="SequenceFlow_08mlzwz" sourceRef="ScriptTask_1swzdpw" targetRef="EndEvent_1jx3026" />
+    </bpmn:subProcess>
+    <bpmn:endEvent id="EndEvent_05h01gx" name="End">
+      <bpmn:incoming>Flow_1akxvak</bpmn:incoming>
+    </bpmn:endEvent>
+    <bpmn:scriptTask id="ScriptTask_1ssh2l9" name="Prepare Update Resource Oper Status((finish)" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_0kixzdj</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1qv8qw1</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def runScript = new DoActivateTnNssi()
+runScript.prepareUpdateJobStatus(execution,"finished","100","Modified TN NSSI successfully")</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="SequenceFlow_03s744c" sourceRef="StartEvent_1nbljfd" targetRef="ScriptTask_1tc44ge" />
+    <bpmn:sequenceFlow id="SequenceFlow_1qv8qw1" sourceRef="ScriptTask_1ssh2l9" targetRef="Activity_0ziz3ti" />
+    <bpmn:scriptTask id="ScriptTask_19uxoi8" name="Update AAI Status" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0h5rwlh</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0kixzdj</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+execution.setVariable("orchestrationStatus", "modified")
+def runScript = new DoModifyTnNssi()
+runScript.updateAAIOrchStatus(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="SequenceFlow_0kixzdj" sourceRef="ScriptTask_19uxoi8" targetRef="ScriptTask_1ssh2l9" />
+    <bpmn:scriptTask id="Activity_0phv8e5" name="Modify TN NSSI in AAI" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_07e12rt</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1jdb2oq</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+
+def runScript = new DoModifyTnNssi()
+runScript.updateTnNssiInAAI(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="SequenceFlow_1jdb2oq" sourceRef="Activity_0phv8e5" targetRef="Activity_0h1vr2l" />
+    <bpmn:scriptTask id="ScriptTask_1tc44ge" name="PreProcess Incoming Request" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_03s744c</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_07e12rt</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def runScript = new DoModifyTnNssi()
+runScript.preProcessRequest(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="SequenceFlow_07e12rt" sourceRef="ScriptTask_1tc44ge" targetRef="Activity_0phv8e5" />
+    <bpmn:scriptTask id="Activity_0h1vr2l" name="PreProcess SDNC Modify  TN NSSI Request" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_1jdb2oq</bpmn:incoming>
+      <bpmn:outgoing>Flow_1dvo5ih</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def runScript = new DoModifyTnNssi()
+runScript.preprocessSdncModifyTnNssiRequest(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_1dvo5ih" sourceRef="Activity_0h1vr2l" targetRef="Activity_14ab476" />
+    <bpmn:callActivity id="Activity_14ab476" name="Call SDNC Adapter: Modify TN NSSI" calledElement="sdncAdapter">
+      <bpmn:extensionElements>
+        <camunda:in source="TNNSSMF_SDNCRequest" target="sdncAdapterWorkflowRequest" />
+        <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" />
+        <camunda:in source="mso-request-id" target="mso-request-id" />
+        <camunda:in source="mso-service-instance-id" target="mso-service-instance-id" />
+        <camunda:out source="WorkflowException" target="WorkflowException" />
+        <camunda:out source="sdncAdapterResponse" target="TNNSSMF_SDNCAdapterResponse" />
+        <camunda:out source="SDNCA_SuccessIndicator" target="SDNCA_SuccessIndicator" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_1dvo5ih</bpmn:incoming>
+      <bpmn:outgoing>Flow_139j3yd</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:sequenceFlow id="Flow_139j3yd" sourceRef="Activity_14ab476" targetRef="Activity_1vtz33q" />
+    <bpmn:scriptTask id="Activity_1vtz33q" name="Postprocess SDNC Modify TN NSSI  Request" scriptFormat="groovy">
+      <bpmn:incoming>Flow_139j3yd</bpmn:incoming>
+      <bpmn:outgoing>Flow_0h5rwlh</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+
+String response = execution.getVariable("TNNSSMF_SDNCAdapterResponse")
+
+def runScript = new DoModifyTnNssi()
+runScript.validateSDNCResponse(execution, response, "modify")</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_0h5rwlh" sourceRef="Activity_1vtz33q" targetRef="ScriptTask_19uxoi8" />
+    <bpmn:serviceTask id="Activity_0ziz3ti" 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>SequenceFlow_1qv8qw1</bpmn:incoming>
+      <bpmn:outgoing>Flow_1akxvak</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:sequenceFlow id="Flow_1akxvak" sourceRef="Activity_0ziz3ti" targetRef="EndEvent_05h01gx" />
+  </bpmn:process>
+  <bpmn:message id="Message_0c4b2r5" name="SliceServiceTask" />
+  <bpmn:error id="Error_03akl5v" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
+  <bpmn:error id="Error_0p2naox" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
+  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoModifyTransportNSSI">
+      <bpmndi:BPMNEdge id="Flow_0h5rwlh_di" bpmnElement="Flow_0h5rwlh">
+        <di:waypoint x="1240" y="121" />
+        <di:waypoint x="1380" y="121" />
+        <di:waypoint x="1380" y="210" />
+        <di:waypoint x="335" y="210" />
+        <di:waypoint x="335" y="310" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_139j3yd_di" bpmnElement="Flow_139j3yd">
+        <di:waypoint x="1010" y="121" />
+        <di:waypoint x="1119" y="121" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1dvo5ih_di" bpmnElement="Flow_1dvo5ih">
+        <di:waypoint x="806" y="121" />
+        <di:waypoint x="889" y="121" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_07e12rt_di" bpmnElement="SequenceFlow_07e12rt">
+        <di:waypoint x="385" y="121" />
+        <di:waypoint x="479" y="121" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1jdb2oq_di" bpmnElement="SequenceFlow_1jdb2oq">
+        <di:waypoint x="600" y="121" />
+        <di:waypoint x="685" y="121" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0kixzdj_di" bpmnElement="SequenceFlow_0kixzdj">
+        <di:waypoint x="385" y="350" />
+        <di:waypoint x="530" y="350" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1qv8qw1_di" bpmnElement="SequenceFlow_1qv8qw1">
+        <di:waypoint x="630" y="350" />
+        <di:waypoint x="740" y="350" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_03s744c_di" bpmnElement="SequenceFlow_03s744c">
+        <di:waypoint x="214" y="121" />
+        <di:waypoint x="285" y="121" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1akxvak_di" bpmnElement="Flow_1akxvak">
+        <di:waypoint x="840" y="350" />
+        <di:waypoint x="1002" y="350" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="StartEvent_1nbljfd_di" bpmnElement="StartEvent_1nbljfd">
+        <dc:Bounds x="178" y="103" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="161" y="146" width="86" height="40" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0ziz3ti_di" bpmnElement="Activity_0ziz3ti">
+        <dc:Bounds x="740" y="310" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="SubProcess_1yv9i68_di" bpmnElement="SubProcess_1yv9i68" isExpanded="true">
+        <dc:Bounds x="685" y="1080" width="781" height="196" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_08mlzwz_di" bpmnElement="SequenceFlow_08mlzwz">
+        <di:waypoint x="1079" y="1184" />
+        <di:waypoint x="1353" y="1184" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1w67v6s_di" bpmnElement="SequenceFlow_1w67v6s">
+        <di:waypoint x="751" y="1184" />
+        <di:waypoint x="979" y="1184" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="StartEvent_1omdx56_di" bpmnElement="StartEvent_1omdx56">
+        <dc:Bounds x="715" y="1166" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="EndEvent_1jx3026_di" bpmnElement="EndEvent_1jx3026">
+        <dc:Bounds x="1353" y="1166" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_1swzdpw_di" bpmnElement="ScriptTask_1swzdpw">
+        <dc:Bounds x="979" y="1144" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="EndEvent_05h01gx_di" bpmnElement="EndEvent_05h01gx">
+        <dc:Bounds x="1002" y="332" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1010" y="375" width="20" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_1ssh2l9_di" bpmnElement="ScriptTask_1ssh2l9">
+        <dc:Bounds x="530" y="310" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_19uxoi8_di" bpmnElement="ScriptTask_19uxoi8">
+        <dc:Bounds x="285" y="310" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0phv8e5_di" bpmnElement="Activity_0phv8e5">
+        <dc:Bounds x="479" y="74" width="121" height="94" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_1tc44ge_di" bpmnElement="ScriptTask_1tc44ge">
+        <dc:Bounds x="285" y="81" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0h1vr2l_di" bpmnElement="Activity_0h1vr2l">
+        <dc:Bounds x="685" y="74" width="121" height="94" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_14ab476_di" bpmnElement="Activity_14ab476">
+        <dc:Bounds x="889" y="74" width="121" height="94" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1vtz33q_di" bpmnElement="Activity_1vtz33q">
+        <dc:Bounds x="1119" y="74" width="121" height="94" />
+      </bpmndi:BPMNShape>
+    </bpmndi:BPMNPlane>
+  </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/QueryJobStatus.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/QueryJobStatus.bpmn
new file mode 100644 (file)
index 0000000..b2b6c03
--- /dev/null
@@ -0,0 +1,141 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_0le3oyh" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.7.2">
+  <bpmn:process id="QueryJobStatus" name="QueryJobStatus" isExecutable="true">
+    <bpmn:startEvent id="StartEvent_1" name="Start">
+      <bpmn:outgoing>Flow_16nxw2f</bpmn:outgoing>
+    </bpmn:startEvent>
+    <bpmn:scriptTask id="Activity_0cd23fy" name="Preprocess Request" scriptFormat="groovy">
+      <bpmn:incoming>Flow_16nxw2f</bpmn:incoming>
+      <bpmn:outgoing>Flow_0qhl0m8</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def qjs= new QueryJobStatus()
+qjs.preProcessRequest(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:serviceTask id="Activity_1aivult" name="Query Job Status">
+      <bpmn:extensionElements>
+        <camunda:connector>
+          <camunda:inputOutput>
+            <camunda:inputParameter name="url">${NSSMF_AdapterEndpoint}</camunda:inputParameter>
+            <camunda:inputParameter name="headers">
+              <camunda:map>
+                <camunda:entry key="content-type">application/json</camunda:entry>
+                <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry>
+              </camunda:map>
+            </camunda:inputParameter>
+            <camunda:inputParameter name="payload">${NSSMF_AdapterRequest}</camunda:inputParameter>
+            <camunda:inputParameter name="method">POST</camunda:inputParameter>
+            <camunda:outputParameter name="NSSMF_ResponseCode">${statusCode}</camunda:outputParameter>
+            <camunda:outputParameter name="NSSMF_Response">${response}</camunda:outputParameter>
+          </camunda:inputOutput>
+          <camunda:connectorId>http-connector</camunda:connectorId>
+        </camunda:connector>
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_0qhl0m8</bpmn:incoming>
+      <bpmn:incoming>Flow_1qqqckj</bpmn:incoming>
+      <bpmn:outgoing>Flow_18di8yy</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:sequenceFlow id="Flow_16nxw2f" sourceRef="StartEvent_1" targetRef="Activity_0cd23fy" />
+    <bpmn:sequenceFlow id="Flow_0qhl0m8" sourceRef="Activity_0cd23fy" targetRef="Activity_1aivult" />
+    <bpmn:scriptTask id="Activity_16hyg49" name="Check Job Status" scriptFormat="groovy">
+      <bpmn:incoming>Flow_18di8yy</bpmn:incoming>
+      <bpmn:outgoing>Flow_0ct1kfw</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def qjs= new QueryJobStatus()
+qjs.checkJobStatus(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:exclusiveGateway id="Gateway_1ruy0j9" name="Is Completed?">
+      <bpmn:incoming>Flow_0ct1kfw</bpmn:incoming>
+      <bpmn:outgoing>Flow_1x9fug6</bpmn:outgoing>
+      <bpmn:outgoing>Flow_1qqqckj</bpmn:outgoing>
+    </bpmn:exclusiveGateway>
+    <bpmn:sequenceFlow id="Flow_18di8yy" sourceRef="Activity_1aivult" targetRef="Activity_16hyg49" />
+    <bpmn:sequenceFlow id="Flow_0ct1kfw" sourceRef="Activity_16hyg49" targetRef="Gateway_1ruy0j9" />
+    <bpmn:scriptTask id="Activity_0rtwx97" name="Update JobStatus details" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1x9fug6</bpmn:incoming>
+      <bpmn:outgoing>Flow_0qqltc9</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def qjs= new QueryJobStatus()
+qjs.updateJobStatusDetails(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_1x9fug6" name="yes" sourceRef="Gateway_1ruy0j9" targetRef="Activity_0rtwx97">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("JobStatusCompleted") == "TRUE"}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:endEvent id="Event_0p00z2s" name="End">
+      <bpmn:incoming>Flow_0qqltc9</bpmn:incoming>
+    </bpmn:endEvent>
+    <bpmn:sequenceFlow id="Flow_0qqltc9" sourceRef="Activity_0rtwx97" targetRef="Event_0p00z2s" />
+    <bpmn:sequenceFlow id="Flow_1qqqckj" name="No" sourceRef="Gateway_1ruy0j9" targetRef="Activity_1aivult">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("JobStatusCompleted") == "FALSE"}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+  </bpmn:process>
+  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="QueryJobStatus">
+      <bpmndi:BPMNEdge id="Flow_1qqqckj_di" bpmnElement="Flow_1qqqckj">
+        <di:waypoint x="880" y="152" />
+        <di:waypoint x="880" y="280" />
+        <di:waypoint x="550" y="280" />
+        <di:waypoint x="550" y="167" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="892" y="163" width="15" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0qqltc9_di" bpmnElement="Flow_0qqltc9">
+        <di:waypoint x="1100" y="127" />
+        <di:waypoint x="1152" y="127" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1x9fug6_di" bpmnElement="Flow_1x9fug6">
+        <di:waypoint x="905" y="127" />
+        <di:waypoint x="1000" y="127" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="944" y="109" width="17" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0ct1kfw_di" bpmnElement="Flow_0ct1kfw">
+        <di:waypoint x="780" y="127" />
+        <di:waypoint x="855" y="127" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_18di8yy_di" bpmnElement="Flow_18di8yy">
+        <di:waypoint x="600" y="127" />
+        <di:waypoint x="680" y="127" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0qhl0m8_di" bpmnElement="Flow_0qhl0m8">
+        <di:waypoint x="410" y="127" />
+        <di:waypoint x="500" y="127" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_16nxw2f_di" bpmnElement="Flow_16nxw2f">
+        <di:waypoint x="215" y="127" />
+        <di:waypoint x="310" y="127" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
+        <dc:Bounds x="179" y="109" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="186" y="152" width="25" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0cd23fy_di" bpmnElement="Activity_0cd23fy">
+        <dc:Bounds x="310" y="87" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1aivult_di" bpmnElement="Activity_1aivult">
+        <dc:Bounds x="500" y="87" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_16hyg49_di" bpmnElement="Activity_16hyg49">
+        <dc:Bounds x="680" y="87" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Gateway_1ruy0j9_di" bpmnElement="Gateway_1ruy0j9" isMarkerVisible="true">
+        <dc:Bounds x="855" y="102" width="50" height="50" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="844" y="83" width="72" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0rtwx97_di" bpmnElement="Activity_0rtwx97">
+        <dc:Bounds x="1000" y="87" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_0p00z2s_di" bpmnElement="Event_0p00z2s">
+        <dc:Bounds x="1152" y="109" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1160" y="152" width="20" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+    </bpmndi:BPMNPlane>
+  </bpmndi:BPMNDiagram>
+</bpmn:definitions>
index bdad46f..4322ff5 100644 (file)
@@ -62,7 +62,8 @@ public class ServiceLevelUpgradeTest extends BaseBPMNTest {
     private static final Map<String, Object> executionVariables = new HashMap();
     private static final String REQUEST_ID = "50ae41ad-049c-4fe2-9950-539f111120f5";
     private static final String SERVICE_INSTANCE_ID = "5df8b6de-2083-11e7-93ae-92361f002676";
-    private final String[] actionNames = new String[5];
+    private final String[] actionNames = new String[10];
+    private final String[] pnfNames = new String[10];
     private final String CLASSNAME = getClass().getSimpleName();
     private String requestObject;
     private String responseObject;
@@ -73,10 +74,26 @@ public class ServiceLevelUpgradeTest extends BaseBPMNTest {
     @Before
     public void setUp() throws IOException {
         actionNames[0] = "healthCheck";
-        actionNames[1] = "preCheck";
-        actionNames[2] = "downloadNESw";
-        actionNames[3] = "activateNESw";
-        actionNames[4] = "postCheck";
+        actionNames[1] = "healthCheck";
+        actionNames[2] = "preCheck";
+        actionNames[3] = "downloadNESw";
+        actionNames[4] = "activateNESw";
+        actionNames[5] = "postCheck";
+        actionNames[6] = "preCheck";
+        actionNames[7] = "downloadNESw";
+        actionNames[8] = "activateNESw";
+        actionNames[9] = "postCheck";
+
+        pnfNames[0] = "PNFDemo";
+        pnfNames[1] = "PNFDemo1";
+        pnfNames[2] = "PNFDemo";
+        pnfNames[3] = "PNFDemo";
+        pnfNames[4] = "PNFDemo";
+        pnfNames[5] = "PNFDemo";
+        pnfNames[6] = "PNFDemo1";
+        pnfNames[7] = "PNFDemo1";
+        pnfNames[8] = "PNFDemo1";
+        pnfNames[9] = "PNFDemo1";
 
         executionVariables.clear();
 
@@ -125,22 +142,22 @@ public class ServiceLevelUpgradeTest extends BaseBPMNTest {
         }
 
         // Layout is to reflect the bpmn visual layout
-        assertThat(pi).isEnded().hasPassedInOrder("Event_02mc8tr", "Activity_18vue7u", "Activity_0qgmx7a",
-                "Activity_09bqns0", "Activity_0n17xou", "Gateway_1nr51kr", "Activity_0snmatn", "Activity_1q4o9fx",
-                "Gateway_02fectw", "Activity_1hp67qz", "Gateway_18ch73t", "Activity_0ft7fa2", "Gateway_1vq11i7",
-                "Activity_1n4rk7m", "Activity_1lz38px", "Event_12983th");
+        assertThat(pi).isEnded().hasPassedInOrder("Event_02mc8tr", "Activity_18vue7u", "Activity_09bqns0",
+                "Activity_02vp5np", "Activity_0n17xou", "Gateway_1nr51kr", "Activity_0snmatn", "Activity_0e6w886",
+                "Activity_1q4o9fx", "Gateway_02fectw", "Activity_1hp67qz", "Gateway_18ch73t", "Activity_0ft7fa2",
+                "Gateway_1vq11i7", "Activity_1n4rk7m", "Activity_1lz38px", "Event_12983th");
 
         List<ExecutionServiceInput> detailedMessages = grpcNettyServer.getDetailedMessages();
         assertThat(detailedMessages.size() == 5);
         int count = 0;
+        String action = "";
         try {
             for (ExecutionServiceInput eSI : detailedMessages) {
-                for (String action : actionNames) {
-                    if (action.equals(eSI.getActionIdentifiers().getActionName())
-                            && eSI.getCommonHeader().getRequestId().equals(msoRequestId)) {
-                        checkWithActionName(eSI, action);
-                        count++;
-                    }
+                action = actionNames[count];
+                if (action.equals(eSI.getActionIdentifiers().getActionName())
+                        && eSI.getCommonHeader().getRequestId().equals(msoRequestId)) {
+                    checkWithActionName(eSI, action, pnfNames[count]);
+                    count++;
                 }
             }
         } catch (Exception e) {
@@ -155,7 +172,8 @@ public class ServiceLevelUpgradeTest extends BaseBPMNTest {
                 .singleResult() == null;
     }
 
-    private void checkWithActionName(ExecutionServiceInput executionServiceInput, String action) {
+    private void checkWithActionName(final ExecutionServiceInput executionServiceInput, final String action,
+            final String pnfName) {
 
         logger.info("Checking the " + action + " request");
         ActionIdentifiers actionIdentifiers = executionServiceInput.getActionIdentifiers();
@@ -174,10 +192,10 @@ public class ServiceLevelUpgradeTest extends BaseBPMNTest {
         Struct payload = executionServiceInput.getPayload();
         Struct requeststruct = payload.getFieldsOrThrow(action + "-request").getStructValue();
 
-        assertThat(requeststruct.getFieldsOrThrow("resolution-key").getStringValue()).isEqualTo("PNFDemo");
+        assertThat(requeststruct.getFieldsOrThrow("resolution-key").getStringValue()).isEqualTo(pnfName);
         Struct propertiesStruct = requeststruct.getFieldsOrThrow(action + "-properties").getStructValue();
 
-        assertThat(propertiesStruct.getFieldsOrThrow("pnf-name").getStringValue()).isEqualTo("PNFDemo");
+        assertThat(propertiesStruct.getFieldsOrThrow("pnf-name").getStringValue()).isEqualTo(pnfName);
         assertThat(propertiesStruct.getFieldsOrThrow("service-model-uuid").getStringValue())
                 .isEqualTo("d88da85c-d9e8-4f73-b837-3a72a431622b");
         assertThat(propertiesStruct.getFieldsOrThrow("pnf-customization-uuid").getStringValue())
@@ -188,25 +206,42 @@ public class ServiceLevelUpgradeTest extends BaseBPMNTest {
 
         final String sIUrl =
                 "/business/customers/customer/5df8b6de-2083-11e7-93ae-92361f002676/service-subscriptions/service-subscription/pNF/service-instances/service-instance/ETE_Customer_807c7a02-249c-4db8-9fa9-bee973fe08ce";
-        final String aaiPnfEntry = FileUtil.readResourceFile("response/Pnf_aai.json");
+        final String aaiPnfDemoEntry = FileUtil.readResourceFile("response/PnfDemo_aai.json");
+        final String aaiPnfDemo1Entry = FileUtil.readResourceFile("response/PnfDemo1_aai.json");
         final String aaiServiceInstanceEntry = FileUtil.readResourceFile("response/Service_instance_aai.json");
 
         /**
-         * PUT the PNF correlation ID to AAI.
+         * PUT the PNF correlation ID PnfDemo to AAI.
          */
         wireMockServer.stubFor(put(urlEqualTo("/aai/" + VERSION + "/network/pnfs/pnf/PNFDemo")));
 
         /**
-         * Get the PNF entry from AAI.
+         * PUT the PNF correlation ID PnfDemo1 to AAI.
+         */
+        wireMockServer.stubFor(put(urlEqualTo("/aai/" + VERSION + "/network/pnfs/pnf/PNFDemo1")));
+
+        /**
+         * Get the PNF entry PnfDemo from AAI.
+         */
+        wireMockServer.stubFor(
+                get(urlEqualTo("/aai/" + VERSION + "/network/pnfs/pnf/PNFDemo")).willReturn(okJson(aaiPnfDemoEntry)));
+
+        /**
+         * Get the PNF entry PnfDemo1 from AAI.
          */
         wireMockServer.stubFor(
-                get(urlEqualTo("/aai/" + VERSION + "/network/pnfs/pnf/PNFDemo")).willReturn(okJson(aaiPnfEntry)));
+                get(urlEqualTo("/aai/" + VERSION + "/network/pnfs/pnf/PNFDemo1")).willReturn(okJson(aaiPnfDemo1Entry)));
 
         /**
-         * Post the pnf to AAI
+         * Post the pnf PnfDemo to AAI
          */
         wireMockServer.stubFor(post(urlEqualTo("/aai/" + VERSION + "/network/pnfs/pnf/PNFDemo")));
 
+        /**
+         * Post the pnf PnfDemo1 to AAI
+         */
+        wireMockServer.stubFor(post(urlEqualTo("/aai/" + VERSION + "/network/pnfs/pnf/PNFDemo1")));
+
         /**
          * Get the Service Instance to AAI.
          */
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/response/PnfDemo1_aai.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/response/PnfDemo1_aai.json
new file mode 100644 (file)
index 0000000..189d2c5
--- /dev/null
@@ -0,0 +1,42 @@
+{
+  "pnf-name": "PNFDemo1",
+  "pnf-id": "37c6e19d-6d9f-4085-98a9-d3fcbaf3a616",
+  "equip-type": "val8",
+  "equip-vendor": "Ericsson",
+  "equip-model": "val6",
+  "ipaddress-v4-oam": "10.10.10.44",
+  "sw-version": "5gDUv18.05.201",
+  "in-maint": false,
+  "serial-number": "7061ZW3",
+  "ipaddress-v6-oam": "2001:0db8:0:0:0:0:1428:57ab",
+  "resource-version": "1595010038094",
+  "nf-role": "gNB",
+  "relationship-list": {
+    "relationship": [
+      {
+        "related-to": "service-instance",
+        "related-link": "/aai/v11/business/customers/customer/ETE_Customer_807c7a02-249c-4db8-9fa9-bee973fe08ce/service-subscriptions/service-subscription/pNF/service-instances/service-instance/5df8b6de-2083-11e7-93ae-92361f002676",
+        "relationship-data": [
+          {
+            "relationship-key": "customer.global-customer-id",
+            "relationship-value": "ETE_Customer_807c7a02-249c-4db8-9fa9-bee973fe08ce"
+          },
+          {
+            "relationship-key": "service-subscription.service-type",
+            "relationship-value": "pNF"
+          },
+          {
+            "relationship-key": "service-instance.service-instance-id",
+            "relationship-value": "5df8b6de-2083-11e7-93ae-92361f002676"
+          }
+        ],
+        "related-to-property": [
+          {
+            "property-key": "service-instance.service-instance-name",
+            "property-value": "Service_Ete_Name123452c4-3d7f-42ce-8188-818fab951269"
+          }
+        ]
+      }
+    ]
+  }
+},
\ No newline at end of file
index 53fb210..8ea4263 100644 (file)
             "relationship-value": "PNFDemo"
           }
         ]
+      },
+      {
+        "related-to": "pnf",
+        "related-link": "/aai/v11/network/pnfs/pnf/PNFDemo1",
+        "relationship-data": [
+          {
+            "relationship-key": "pnf.pnf-name",
+            "relationship-value": "PNFDemo1"
+          }
+        ]
       }
     ]
   }
index 55edf0b..b554994 100644 (file)
@@ -32,6 +32,10 @@ import java.util.UUID;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 import org.camunda.bpm.engine.delegate.BpmnError;
+import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
+import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
+import org.onap.logging.filter.base.ErrorCode;
 import org.onap.so.bpmn.common.BuildingBlockExecution;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection;
@@ -52,9 +56,6 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
 import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
 import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
 import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
-import org.onap.aaiclient.client.aai.AAIObjectPlurals;
-import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
-import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
 import org.onap.so.client.exception.BBObjectNotFoundException;
 import org.onap.so.client.exception.ExceptionBuilder;
 import org.onap.so.client.orchestration.AAIConfigurationResources;
@@ -66,7 +67,6 @@ import org.onap.so.client.orchestration.AAIVfModuleResources;
 import org.onap.so.client.orchestration.AAIVnfResources;
 import org.onap.so.client.orchestration.AAIVolumeGroupResources;
 import org.onap.so.client.orchestration.AAIVpnBindingResources;
-import org.onap.logging.filter.base.ErrorCode;
 import org.onap.so.logger.LoggingAnchor;
 import org.onap.so.logger.MessageEnum;
 import org.slf4j.Logger;
@@ -691,7 +691,8 @@ public class AAICreateTasks {
                 if (fqdnCount > 0) {
                     for (int i = 0; i < fqdnCount; i++) {
                         String fqdn = fqdnList[i];
-                        AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY);
+                        AAIPluralResourceUri uri =
+                                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().networkPolicies());
                         uri.queryParam(NETWORK_POLICY_FQDN_PARAM, fqdn);
                         Optional<org.onap.aai.domain.yang.NetworkPolicy> oNetPolicy =
                                 aaiNetworkResources.getNetworkPolicy(uri);
index 42fb719..d62fc6f 100644 (file)
@@ -27,6 +27,9 @@ import java.util.List;
 import java.util.Optional;
 import org.onap.aai.domain.yang.NetworkPolicies;
 import org.onap.aai.domain.yang.NetworkPolicy;
+import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
+import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
 import org.onap.so.bpmn.common.BuildingBlockExecution;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
@@ -38,9 +41,6 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
 import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
 import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
-import org.onap.aaiclient.client.aai.AAIObjectPlurals;
-import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
-import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
 import org.onap.so.client.exception.ExceptionBuilder;
 import org.onap.so.client.orchestration.AAIConfigurationResources;
 import org.onap.so.client.orchestration.AAIInstanceGroupResources;
@@ -279,7 +279,8 @@ public class AAIDeleteTasks {
                 if (fqdnCount > 0) {
                     for (int i = 0; i < fqdnCount; i++) {
                         String fqdn = fqdnList[i];
-                        AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY);
+                        AAIPluralResourceUri uri =
+                                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().networkPolicies());
                         uri.queryParam(networkPolicyFqdnParam, fqdn);
                         Optional<NetworkPolicies> oNetPolicies = aaiNetworkResources.getNetworkPolicies(uri);
                         if (oNetPolicies.isPresent()) {
index 0912cba..9df9dd3 100644 (file)
@@ -32,15 +32,15 @@ import org.onap.aai.domain.yang.RouteTableReference;
 import org.onap.aai.domain.yang.RouteTargets;
 import org.onap.aai.domain.yang.Subnet;
 import org.onap.aai.domain.yang.VpnBinding;
+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.generated.fluentbuilders.AAIFluentTypeBuilder.Types;
 import org.onap.so.adapters.nwrest.CreateNetworkRequest;
 import org.onap.so.bpmn.common.BuildingBlockExecution;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
 import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
 import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
-import org.onap.aaiclient.client.aai.AAIObjectType;
-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.so.client.exception.ExceptionBuilder;
 import org.onap.so.client.orchestration.AAINetworkResources;
 import org.slf4j.Logger;
@@ -76,8 +76,7 @@ public class AAIQueryTasks {
             if (!networkRelationships.isPresent()) {
                 throw (new Exception(ERROR_MSG));
             }
-            List<AAIResourceUri> netBindingsUriList =
-                    networkRelationships.get().getRelatedAAIUris(AAIObjectType.VPN_BINDING);
+            List<AAIResourceUri> netBindingsUriList = networkRelationships.get().getRelatedUris(Types.VPN_BINDING);
 
             List<org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding> mappedVpnBindings = new ArrayList<>();
             if (netBindingsUriList != null && !netBindingsUriList.isEmpty()) {
@@ -115,8 +114,7 @@ public class AAIQueryTasks {
             if (!networkRelationships.isPresent()) {
                 throw (new Exception(ERROR_MSG));
             }
-            List<AAIResourceUri> netBindingsUriList =
-                    networkRelationships.get().getRelatedAAIUris(AAIObjectType.VPN_BINDING);
+            List<AAIResourceUri> netBindingsUriList = networkRelationships.get().getRelatedUris(Types.VPN_BINDING);
             List<org.onap.so.openstack.beans.RouteTarget> routeTargets = new ArrayList<>();
             for (AAIResourceUri netBindingUri : netBindingsUriList) {
                 logger.info("Get Route Targests");
@@ -168,8 +166,7 @@ public class AAIQueryTasks {
             if (!networkRelationships.isPresent()) {
                 throw (new Exception(ERROR_MSG));
             }
-            List<AAIResourceUri> netPoliciesUriList =
-                    networkRelationships.get().getRelatedAAIUris(AAIObjectType.NETWORK_POLICY);
+            List<AAIResourceUri> netPoliciesUriList = networkRelationships.get().getRelatedUris(Types.NETWORK_POLICY);
 
             if (!netPoliciesUriList.isEmpty()) {
                 for (AAIResourceUri netPolicyUri : netPoliciesUriList) {
@@ -201,7 +198,7 @@ public class AAIQueryTasks {
                 throw (new Exception(ERROR_MSG));
             }
             List<AAIResourceUri> routeTableUriList =
-                    networkRelationships.get().getRelatedAAIUris(AAIObjectType.ROUTE_TABLE_REFERENCE);
+                    networkRelationships.get().getRelatedUris(Types.ROUTE_TABLE_REFERENCE);
 
             if (!routeTableUriList.isEmpty()) {
                 for (AAIResourceUri routeTableUri : routeTableUriList) {
@@ -241,7 +238,7 @@ public class AAIQueryTasks {
             if (!networkRelationships.isPresent()) {
                 throw (new Exception(ERROR_MSG));
             }
-            List<AAIResourceUri> subnetsUriList = networkRelationships.get().getRelatedAAIUris(AAIObjectType.SUBNET);
+            List<AAIResourceUri> subnetsUriList = networkRelationships.get().getRelatedUris(Types.SUBNET);
 
             if (!subnetsUriList.isEmpty()) {
                 for (AAIResourceUri subnetUri : subnetsUriList) {
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnf/tasks/CnfAdapter.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnf/tasks/CnfAdapter.java
new file mode 100644 (file)
index 0000000..c21b467
--- /dev/null
@@ -0,0 +1,36 @@
+package org.onap.so.bpmn.infrastructure.adapter.cnf.tasks;
+
+import java.io.IOException;
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowAction;
+import org.onap.so.client.adapter.cnf.CnfAdapterClient;
+import org.onap.so.client.adapter.cnf.CnfAdapterClientException;
+import org.onap.so.client.adapter.cnf.entities.InstanceRequest;
+import org.onap.so.client.adapter.cnf.entities.InstanceResponse;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+@Component
+public class CnfAdapter {
+
+    @Autowired
+    private CnfAdapterClient cnfAdapterClient;
+
+    private static final Logger logger = LoggerFactory.getLogger(CnfAdapter.class);
+
+    public void callCnfAdapter(DelegateExecution execution) throws Exception {
+        try {
+            final String instanceRequest = (String) execution.getVariable("instanceRequest");
+            InstanceRequest request = new ObjectMapper().readValue(instanceRequest, InstanceRequest.class);
+            InstanceResponse response = cnfAdapterClient.createVfModule(request);
+        } catch (Exception ex) {
+            logger.error("Exception in callCnfAdapter", ex);
+            throw ex;
+        }
+    }
+}
index 1f05522..2644ae1 100644 (file)
@@ -6,11 +6,11 @@ import java.util.List;
 import java.util.Map;
 import java.util.Optional;
 import org.onap.aai.domain.yang.Vserver;
-import org.onap.aaiclient.client.aai.AAIObjectType;
 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.generated.fluentbuilders.AAIFluentTypeBuilder;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types;
 import org.onap.appc.client.lcm.model.Action;
 import org.onap.so.appc.orchestrator.service.beans.ApplicationControllerTaskRequest;
 import org.onap.so.appc.orchestrator.service.beans.ApplicationControllerVm;
@@ -186,7 +186,7 @@ public class AppcOrchestratorPreProcessor {
         if (aaiRW != null && aaiRW.getRelationships().isPresent()) {
             Relationships relationships = aaiRW.getRelationships().get();
             if (relationships != null) {
-                List<AAIResourceUri> vserverUris = relationships.getRelatedAAIUris(AAIObjectType.VSERVER);
+                List<AAIResourceUri> vserverUris = relationships.getRelatedUris(Types.VSERVER);
                 ArrayList<String> vserverIds = new ArrayList<String>();
                 ArrayList<String> vserverSelfLinks = new ArrayList<String>();
                 for (AAIResourceUri j : vserverUris) {
index 70edc37..de2976f 100644 (file)
@@ -30,11 +30,11 @@ import java.util.Map;
 import java.util.Optional;
 import org.json.JSONArray;
 import org.json.JSONObject;
-import org.onap.aaiclient.client.aai.AAIObjectType;
 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.generated.fluentbuilders.AAIFluentTypeBuilder;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types;
 import org.onap.appc.client.lcm.model.Action;
 import org.onap.logging.filter.base.ErrorCode;
 import org.onap.so.bpmn.common.BuildingBlockExecution;
@@ -251,7 +251,7 @@ public class AppcRunTasks {
             return;
         }
         Relationships relationships = aaiRW.getRelationships().get();
-        List<AAIResourceUri> vserverUris = relationships.getRelatedAAIUris(AAIObjectType.VSERVER);
+        List<AAIResourceUri> vserverUris = relationships.getRelatedUris(Types.VSERVER);
         JSONArray vserverIds = new JSONArray();
         JSONArray vserverSelfLinks = new JSONArray();
         if (vserverUris != null) {
@@ -23,6 +23,7 @@ package org.onap.so.bpmn.infrastructure.service.level;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Optional;
+import jline.internal.Log;
 import org.camunda.bpm.engine.delegate.DelegateExecution;
 import org.onap.so.bpmn.infrastructure.service.level.impl.ServiceLevelConstants;
 import org.onap.so.client.exception.ExceptionBuilder;
@@ -35,9 +36,9 @@ import org.springframework.beans.factory.annotation.Autowired;
 /**
  * Parent class for Service level upgrade Execution, it should be extended for service level upgrade tasks.
  */
-public class ServiceLevelPreparable {
+public class ServiceLevel {
 
-    protected static final Logger LOG = LoggerFactory.getLogger(ServiceLevelPreparable.class);
+    protected static final Logger LOG = LoggerFactory.getLogger(ServiceLevel.class);
 
     @Autowired
     protected ExceptionBuilder exceptionBuilder;
@@ -45,6 +46,10 @@ public class ServiceLevelPreparable {
     @Autowired
     protected CatalogDbClient catalogDbClient;
 
+    private static final String PNF_NAME_LIST = "pnfNameList";
+
+    private static final String PNF_COUNTER = "pnfCounter";
+
     /**
      * Fetches workflow names based on the controller scope and operation name.
      *
@@ -95,4 +100,20 @@ public class ServiceLevelPreparable {
 
     }
 
+    /**
+     * This method set correct value of pnf name for health check and software upgrade workflow.
+     *
+     * @param delegateExecution Delegate execution obj
+     */
+    public void pnfCounterExecution(DelegateExecution delegateExecution) {
+        LOG.debug("Running execute block for activity id: {}, name: {}", delegateExecution.getCurrentActivityId(),
+                delegateExecution.getCurrentActivityName());
+
+        final List<String> pnfNameList = (List<String>) delegateExecution.getVariable(PNF_NAME_LIST);
+        final int pnfCounter = (int) delegateExecution.getVariable(PNF_COUNTER);
+
+        delegateExecution.setVariable(ServiceLevelConstants.PNF_NAME, pnfNameList.get(pnfCounter));
+        delegateExecution.setVariable(PNF_COUNTER, pnfCounter + 1);
+    }
+
 }
index 7b73fff..b0b12b5 100644 (file)
@@ -38,6 +38,10 @@ public class ServiceLevelConstants {
     public static final String SW_UP_OPERATION = "ResourceSoftwareUpgrade";
     public static final String CONTROLLER_STATUS = "ControllerStatus";
     public static final int ERROR_CODE = 601;
+    public static final String PNF_COUNTER = "pnfCounter";
+    public static final int COUNT_ZERO = 0;
+    public static final String PNF_NAME_LIST = "pnfNameList";
+    public static final String PNF_SIZE = "pnfSize";
 
     // TODO GenericVNFHealthCheck and GenericVnfSoftwareUpgrade workflow names should be updated once the workflow is
     // implemented.
index fad28e3..8e720c3 100644 (file)
@@ -8,6 +8,6 @@ import org.springframework.stereotype.Component;
 public class ServiceLevelPostcheck implements JavaDelegate {
     @Override
     public void execute(DelegateExecution delegateExecution) throws Exception {
-        // TODO : Set serviceInstance to aai
+        // Write your postcheck operations here, if any
     }
 }
index 59884ec..6cb3461 100644 (file)
@@ -26,7 +26,7 @@ import java.util.List;
 import java.util.Map;
 import org.camunda.bpm.engine.delegate.DelegateExecution;
 import org.camunda.bpm.engine.delegate.JavaDelegate;
-import org.onap.so.bpmn.infrastructure.service.level.ServiceLevelPreparable;
+import org.onap.so.bpmn.infrastructure.service.level.ServiceLevel;
 import org.springframework.stereotype.Component;
 
 
@@ -35,10 +35,10 @@ import org.springframework.stereotype.Component;
  * validation.
  */
 @Component("ServiceLevelPreparation")
-public class ServiceLevelPreparation extends ServiceLevelPreparable implements JavaDelegate {
+public class ServiceLevelPreparation extends ServiceLevel implements JavaDelegate {
 
     private static final List<String> PNF_HEALTH_CHECK_PARAMS = Arrays.asList(ServiceLevelConstants.SERVICE_INSTANCE_ID,
-            ServiceLevelConstants.RESOURCE_TYPE, ServiceLevelConstants.BPMN_REQUEST, ServiceLevelConstants.PNF_NAME);
+            ServiceLevelConstants.RESOURCE_TYPE, ServiceLevelConstants.BPMN_REQUEST);
 
     // TODO Update the list with vnf health check parameters if any validation needed
     private static final List<String> VNF_HEALTH_CHECK_PARAMS = Collections.emptyList();
@@ -48,6 +48,9 @@ public class ServiceLevelPreparation extends ServiceLevelPreparable implements J
 
     @Override
     public void execute(DelegateExecution execution) throws Exception {
+        LOG.debug("Running execute block for activity id: {}, name: {}", execution.getCurrentActivityId(),
+                execution.getCurrentActivityName());
+
         if (execution.hasVariable(ServiceLevelConstants.RESOURCE_TYPE)
                 && execution.getVariable(ServiceLevelConstants.RESOURCE_TYPE) != null) {
             final String controllerScope = (String) execution.getVariable(ServiceLevelConstants.RESOURCE_TYPE);
@@ -60,6 +63,7 @@ public class ServiceLevelPreparation extends ServiceLevelPreparable implements J
                 LOG.info("Parameters validated successfully for {}", wflName);
                 execution.setVariable(ServiceLevelConstants.HEALTH_CHECK_WORKFLOW_TO_INVOKE, wflName);
                 execution.setVariable(ServiceLevelConstants.CONTROLLER_STATUS, ServiceLevelConstants.EMPTY_STRING);
+                execution.setVariable(ServiceLevelConstants.PNF_COUNTER, ServiceLevelConstants.COUNT_ZERO);
             } else {
                 exceptionBuilder.buildAndThrowWorkflowException(execution, ServiceLevelConstants.ERROR_CODE,
                         "Invalid Controller scope to prepare resource level health check");
index 5b20a86..5d9295d 100644 (file)
@@ -23,6 +23,7 @@ package org.onap.so.bpmn.infrastructure.service.level.impl;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import org.camunda.bpm.engine.delegate.DelegateExecution;
 import org.camunda.bpm.engine.delegate.JavaDelegate;
+import org.onap.aai.domain.yang.Relationship;
 import org.onap.aai.domain.yang.ServiceInstance;
 import org.onap.aaiclient.client.aai.AAIRestClientI;
 import org.onap.aaiclient.client.aai.AAIRestClientImpl;
@@ -34,7 +35,11 @@ import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
 import java.util.Optional;
+import java.util.stream.Collector;
+import java.util.stream.Collectors;
 import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.*;
 
 /**
@@ -83,21 +88,18 @@ public class ServiceLevelRequestDispatcher implements JavaDelegate {
         Optional<ServiceInstance> optionalSi =
                 restClient.getServiceInstanceById(serviceInstanceId, serviceType, globalSubscriberId);
 
-        if (!optionalSi.isPresent()) {
-
-        }
-
         optionalSi.ifPresentOrElse(serviceInstance -> {
-            final String pnfName = serviceInstance.getRelationshipList().getRelationship().stream()
-                    .filter(x -> x.getRelatedTo().contains("pnf")).findFirst().get().getRelationshipData().stream()
-                    .filter(data -> data.getRelationshipKey().contains("pnf.pnf-name")).findFirst().get()
-                    .getRelationshipValue();
-            if (pnfName == null || pnfName.isEmpty()) {
+            final List<String> pnfNameList = serviceInstance.getRelationshipList().getRelationship().stream()
+                    .filter(x -> x.getRelatedTo().contains("pnf")).flatMap(x -> x.getRelationshipData().stream())
+                    .filter(data -> data.getRelationshipKey().contains("pnf.pnf-name"))
+                    .map(x -> x.getRelationshipValue()).collect(Collectors.toList());
+            if (pnfNameList == null || pnfNameList.size() == 0) {
                 logger.warn(
                         "Unable to find the PNF for service instance id: " + serviceInstance.getServiceInstanceId());
                 return;
             }
-            delegateExecution.setVariable(ServiceLevelConstants.PNF_NAME, pnfName);
+            delegateExecution.setVariable(ServiceLevelConstants.PNF_NAME_LIST, pnfNameList);
+            delegateExecution.setVariable(ServiceLevelConstants.PNF_SIZE, pnfNameList.size());
             delegateExecution.setVariable(ServiceLevelConstants.RESOURCE_TYPE, ServiceLevelConstants.PNF);
         }, () -> {
             throwExceptionWithWarn(delegateExecution, "Unable to find the service instance: " + serviceInstanceId);
index 9d7d8ef..a3a8f6e 100644 (file)
@@ -26,14 +26,14 @@ import java.util.List;
 import java.util.Map;
 import org.camunda.bpm.engine.delegate.DelegateExecution;
 import org.camunda.bpm.engine.delegate.JavaDelegate;
-import org.onap.so.bpmn.infrastructure.service.level.ServiceLevelPreparable;
+import org.onap.so.bpmn.infrastructure.service.level.ServiceLevel;
 import org.springframework.stereotype.Component;
 
 @Component
-public class ServiceLevelUpgrade extends ServiceLevelPreparable implements JavaDelegate {
+public class ServiceLevelUpgrade extends ServiceLevel implements JavaDelegate {
 
     private static final List<String> PNF_SOFTWARE_UP_PARAMS = Arrays.asList(ServiceLevelConstants.SERVICE_INSTANCE_ID,
-            ServiceLevelConstants.RESOURCE_TYPE, ServiceLevelConstants.BPMN_REQUEST, ServiceLevelConstants.PNF_NAME);
+            ServiceLevelConstants.RESOURCE_TYPE, ServiceLevelConstants.BPMN_REQUEST);
 
     // TODO Update the list with vnf software upgrade parameters if any validation needed
     private static final List<String> VNF_SOFTWARE_UP_PARAMS = Collections.emptyList();
@@ -44,6 +44,9 @@ public class ServiceLevelUpgrade extends ServiceLevelPreparable implements JavaD
 
     @Override
     public void execute(DelegateExecution execution) throws Exception {
+        LOG.debug("Running execute block for activity id: {}, name: {}", execution.getCurrentActivityId(),
+                execution.getCurrentActivityName());
+
         if (execution.hasVariable(ServiceLevelConstants.RESOURCE_TYPE)
                 && execution.getVariable(ServiceLevelConstants.RESOURCE_TYPE) != null) {
             final String controllerScope = (String) execution.getVariable(ServiceLevelConstants.RESOURCE_TYPE);
@@ -54,7 +57,8 @@ public class ServiceLevelUpgrade extends ServiceLevelPreparable implements JavaD
                 validateParamsWithScope(execution, controllerScope, SOFTWARE_UP_PARAMS_MAP.get(controllerScope));
                 LOG.info("Parameters validated successfully for {}", wflName);
                 execution.setVariable(ServiceLevelConstants.SOFTWARE_WORKFLOW_TO_INVOKE, wflName);
-                execution.setVariable(ServiceLevelConstants.CONTROLLER_STATUS, "");
+                execution.setVariable(ServiceLevelConstants.CONTROLLER_STATUS, ServiceLevelConstants.EMPTY_STRING);
+                execution.setVariable(ServiceLevelConstants.PNF_COUNTER, ServiceLevelConstants.COUNT_ZERO);
             } else {
                 exceptionBuilder.buildAndThrowWorkflowException(execution, ServiceLevelConstants.ERROR_CODE,
                         "Invalid Controller scope for resource level software upgrade");
index 751e91d..f7c42b9 100644 (file)
@@ -1,6 +1,14 @@
 package org.onap.so.bpmn.infrastructure.vfmodule;
 
 import java.util.Optional;
+import org.onap.aaiclient.client.aai.AAIResourcesClient;
+import org.onap.aaiclient.client.aai.entities.AAIResultWrapper;
+import org.onap.aaiclient.client.aai.entities.Relationships;
+import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
+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.BuildingBlockExecution;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
@@ -8,14 +16,6 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
 import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
 import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
 import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
-import org.onap.aaiclient.client.aai.AAIObjectPlurals;
-import org.onap.aaiclient.client.aai.AAIObjectType;
-import org.onap.aaiclient.client.aai.AAIResourcesClient;
-import org.onap.aaiclient.client.aai.entities.AAIResultWrapper;
-import org.onap.aaiclient.client.aai.entities.Relationships;
-import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
-import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
-import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
 import org.onap.so.client.exception.ExceptionBuilder;
 import org.onap.so.cloud.resource.beans.CloudInformation;
 import org.onap.so.cloud.resource.beans.NodeType;
@@ -60,15 +60,15 @@ public class CreateVFModule {
     }
 
     protected NodeType getNodeType(CloudRegion cloudRegion) {
-        AAIResourceUri cloudRegionUri = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION,
-                cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId());
+        AAIResourceUri cloudRegionUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+                .cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId()));
         AAIResourcesClient client = getAAIClient();
         Optional<Relationships> relationships = client.get(cloudRegionUri).getRelationships();
         if (relationships.isPresent()) {
             AAIPluralResourceUri networkTechsGreenfieldUri = AAIUriFactory
-                    .createResourceUri(AAIObjectType.CLOUD_REGION, cloudRegion.getCloudOwner(),
-                            cloudRegion.getLcpCloudRegionId())
-                    .relatedTo(AAIObjectPlurals.NETWORK_TECHNOLOGY)
+                    .createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+                            .cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId()))
+                    .relatedTo(Types.NETWORK_TECHNOLOGIES.getFragment())
                     .queryParam("network-technology-name", NodeType.GREENFIELD.getNetworkTechnologyName());
 
             AAIResultWrapper networkTechsGreenfield = client.get(networkTechsGreenfieldUri);
index 9058628..304cb9f 100644 (file)
@@ -23,10 +23,10 @@ package org.onap.so.bpmn.infrastructure.workflow.tasks;
 import java.util.List;
 import java.util.Optional;
 import org.onap.aai.domain.yang.L3Network;
-import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils;
-import org.onap.aaiclient.client.aai.AAIObjectType;
 import org.onap.aaiclient.client.aai.entities.AAIResultWrapper;
 import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types;
+import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils;
 import org.onap.so.db.catalog.beans.ConfigurationResourceCustomization;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
@@ -143,7 +143,7 @@ public class VrfValidation {
         AAIResultWrapper networkWrapper = new AAIResultWrapper(aaiLocalNetwork);
         if (networkWrapper.getRelationships().isPresent()) {
             List<AAIResourceUri> vpnBindingUris =
-                    networkWrapper.getRelationships().get().getRelatedUris(AAIObjectType.VPN_BINDING);
+                    networkWrapper.getRelationships().get().getRelatedUris(Types.VPN_BINDING);
             if (!vpnBindingUris.isEmpty()) {
                 Optional<org.onap.aai.domain.yang.VpnBinding> vpnBindingOp =
                         bbInputSetupUtils.getAAIResourceDepthOne(vpnBindingUris.get(0))
index 9b9433a..0f955e2 100644 (file)
@@ -50,12 +50,13 @@ import org.onap.aai.domain.yang.Vnfc;
 import org.onap.aai.domain.yang.VolumeGroup;
 import org.onap.aai.domain.yang.VpnBinding;
 import org.onap.aaiclient.client.aai.AAICommonObjectMapperProvider;
-import org.onap.aaiclient.client.aai.AAIObjectType;
+import org.onap.aaiclient.client.aai.AAIObjectName;
 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.so.bpmn.common.BBConstants;
 import org.onap.so.bpmn.infrastructure.workflow.tasks.utils.WorkflowResourceIdsUtils;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
@@ -485,16 +486,17 @@ public class WorkflowAction {
     }
 
     protected <T> List<T> getRelatedResourcesInVfModule(String vnfId, String vfModuleId, Class<T> resultClass,
-            AAIObjectType type) {
+            AAIObjectName name) {
         List<T> vnfcs = new ArrayList<>();
-        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId);
+        AAIResourceUri uri =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId).vfModule(vfModuleId));
         AAIResultWrapper vfModuleResultsWrapper = bbInputSetupUtils.getAAIResourceDepthOne(uri);
         Optional<Relationships> relationshipsOp = vfModuleResultsWrapper.getRelationships();
         if (!relationshipsOp.isPresent()) {
             logger.debug("No relationships were found for vfModule in AAI");
         } else {
             Relationships relationships = relationshipsOp.get();
-            List<AAIResultWrapper> vnfcResultWrappers = relationships.getByType(type);
+            List<AAIResultWrapper> vnfcResultWrappers = relationships.getByType(name);
             for (AAIResultWrapper vnfcResultWrapper : vnfcResultWrappers) {
                 Optional<T> vnfcOp = vnfcResultWrapper.asBean(resultClass);
                 vnfcOp.ifPresent(vnfcs::add);
@@ -503,9 +505,9 @@ public class WorkflowAction {
         return vnfcs;
     }
 
-    protected <T> T getRelatedResourcesInVnfc(Vnfc vnfc, Class<T> resultClass, AAIObjectType type) throws Exception {
+    protected <T> T getRelatedResourcesInVnfc(Vnfc vnfc, Class<T> resultClass, AAIObjectName name) throws Exception {
         T configuration = null;
-        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VNFC, vnfc.getVnfcName());
+        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().vnfc(vnfc.getVnfcName()));
         AAIResultWrapper vnfcResultsWrapper = bbInputSetupUtils.getAAIResourceDepthOne(uri);
         Optional<Relationships> relationshipsOp = vnfcResultsWrapper.getRelationships();
         if (!relationshipsOp.isPresent()) {
@@ -513,7 +515,7 @@ public class WorkflowAction {
         } else {
             Relationships relationships = relationshipsOp.get();
             List<AAIResultWrapper> configurationResultWrappers =
-                    this.getResultWrappersFromRelationships(relationships, type);
+                    this.getResultWrappersFromRelationships(relationships, name);
             if (configurationResultWrappers.size() > 1) {
                 String multipleRelationshipsError =
                         "Multiple relationships exist from VNFC " + vnfc.getVnfcName() + " to Configurations";
@@ -530,8 +532,8 @@ public class WorkflowAction {
     }
 
     protected List<AAIResultWrapper> getResultWrappersFromRelationships(Relationships relationships,
-            AAIObjectType type) {
-        return relationships.getByType(type);
+            AAIObjectName name) {
+        return relationships.getByType(name);
     }
 
     protected boolean isConfiguration(List<OrchestrationFlow> orchFlows) {
@@ -565,12 +567,12 @@ public class WorkflowAction {
             vfModuleCustomizationUUID = aaiVfModule.getModelCustomizationId();
         }
 
-        List<org.onap.aai.domain.yang.Vnfc> vnfcs = getRelatedResourcesInVfModule(vnfId, vfModuleId,
-                org.onap.aai.domain.yang.Vnfc.class, AAIObjectType.VNFC);
+        List<org.onap.aai.domain.yang.Vnfc> vnfcs =
+                getRelatedResourcesInVfModule(vnfId, vfModuleId, org.onap.aai.domain.yang.Vnfc.class, Types.VNFC);
         for (org.onap.aai.domain.yang.Vnfc vnfc : vnfcs) {
             WorkflowResourceIds workflowIdsCopy = SerializationUtils.clone(dataObj.getWorkflowResourceIds());
-            org.onap.aai.domain.yang.Configuration configuration = getRelatedResourcesInVnfc(vnfc,
-                    org.onap.aai.domain.yang.Configuration.class, AAIObjectType.CONFIGURATION);
+            org.onap.aai.domain.yang.Configuration configuration =
+                    getRelatedResourcesInVnfc(vnfc, org.onap.aai.domain.yang.Configuration.class, Types.CONFIGURATION);
             if (configuration == null) {
                 logger.warn(String.format("No configuration found for VNFC %s in AAI", vnfc.getVnfcName()));
                 continue;
@@ -813,7 +815,7 @@ public class WorkflowAction {
                 new AAICommonObjectMapperProvider().getMapper().writeValueAsString(aaiLocalNetwork)).getRelationships();
         if (relationshipsOp.isPresent()) {
             List<AAIResultWrapper> configurationsRelatedToLocalNetwork =
-                    relationshipsOp.get().getByType(AAIObjectType.CONFIGURATION);
+                    relationshipsOp.get().getByType(Types.CONFIGURATION);
             if (configurationsRelatedToLocalNetwork.size() > 1) {
                 throw new VrfBondingServiceException(
                         "Network: " + aaiLocalNetwork.getNetworkId() + " has more than 1 configuration related to it");
index 7420df1..5425b2a 100644 (file)
 
 package org.onap.so.bpmn.infrastructure.workflow.tasks;
 
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.ObjectMapper;
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Optional;
+import java.util.UUID;
+import java.util.stream.Collectors;
+import javax.persistence.EntityNotFoundException;
 import org.camunda.bpm.engine.delegate.DelegateExecution;
-import org.onap.aai.domain.yang.*;
-import org.onap.aaiclient.client.aai.AAIObjectType;
+import org.onap.aai.domain.yang.GenericVnf;
+import org.onap.aai.domain.yang.InstanceGroup;
+import org.onap.aai.domain.yang.L3Network;
+import org.onap.aai.domain.yang.ServiceInstance;
+import org.onap.aai.domain.yang.VfModule;
+import org.onap.aai.domain.yang.Vnfc;
+import org.onap.aai.domain.yang.VolumeGroup;
 import org.onap.aaiclient.client.aai.entities.Configuration;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types;
 import org.onap.so.bpmn.common.DelegateExecutionImpl;
 import org.onap.so.bpmn.common.listener.db.RequestsDbListenerRunner;
 import org.onap.so.bpmn.common.listener.flowmanipulator.FlowManipulatorListenerRunner;
@@ -48,13 +59,8 @@ import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.core.env.Environment;
 import org.springframework.stereotype.Component;
-import javax.persistence.EntityNotFoundException;
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Optional;
-import java.util.UUID;
-import java.util.stream.Collectors;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
 
 @Component
 public class WorkflowActionBBTasks {
@@ -421,8 +427,7 @@ public class WorkflowActionBBTasks {
             String vnfCustomizationUUID = bbInputSetupUtils.getAAIGenericVnf(vnfId).getModelCustomizationId();
             String vfModuleCustomizationUUID =
                     bbInputSetupUtils.getAAIVfModule(vnfId, vfModuleId).getModelCustomizationId();
-            List<Vnfc> vnfcs =
-                    workflowAction.getRelatedResourcesInVfModule(vnfId, vfModuleId, Vnfc.class, AAIObjectType.VNFC);
+            List<Vnfc> vnfcs = workflowAction.getRelatedResourcesInVfModule(vnfId, vfModuleId, Vnfc.class, Types.VNFC);
             logger.debug("Vnfc Size: {}", vnfcs.size());
             for (Vnfc vnfc : vnfcs) {
                 String modelCustomizationId = vnfc.getModelCustomizationId();
@@ -461,7 +466,7 @@ public class WorkflowActionBBTasks {
 
     protected String getConfigurationId(Vnfc vnfc) throws Exception {
         Configuration configuration =
-                workflowAction.getRelatedResourcesInVnfc(vnfc, Configuration.class, AAIObjectType.CONFIGURATION);
+                workflowAction.getRelatedResourcesInVnfc(vnfc, Configuration.class, Types.CONFIGURATION);
         if (configuration != null) {
             return configuration.getConfigurationId();
         } else {
index de674da..4140692 100644 (file)
@@ -23,12 +23,12 @@ package org.onap.so.bpmn.infrastructure.workflow.tasks;
 import java.util.List;
 import java.util.Optional;
 import org.onap.aai.domain.yang.VpnBinding;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
-import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils;
-import org.onap.aaiclient.client.aai.AAIObjectType;
 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.generated.fluentbuilders.AAIFluentTypeBuilder.Types;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
+import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -42,7 +42,7 @@ public class WorkflowActionExtractResourcesAAI {
     protected BBInputSetupUtils bbInputSetupUtils;
 
     public Optional<Configuration> extractRelationshipsConfiguration(Relationships relationships) {
-        List<AAIResultWrapper> configurations = relationships.getByType(AAIObjectType.CONFIGURATION);
+        List<AAIResultWrapper> configurations = relationships.getByType(Types.CONFIGURATION);
         for (AAIResultWrapper configWrapper : configurations) {
             Optional<Configuration> config = configWrapper.asBean(Configuration.class);
             if (config.isPresent()) {
@@ -53,7 +53,7 @@ public class WorkflowActionExtractResourcesAAI {
     }
 
     public Optional<VpnBinding> extractRelationshipsVpnBinding(Relationships relationships) {
-        List<AAIResourceUri> configurations = relationships.getRelatedUris(AAIObjectType.VPN_BINDING);
+        List<AAIResourceUri> configurations = relationships.getRelatedUris(Types.VPN_BINDING);
         for (AAIResourceUri vpnBindingUri : configurations) {
             AAIResultWrapper vpnBindingWrapper = bbInputSetupUtils.getAAIResourceDepthOne(vpnBindingUri);
             Optional<VpnBinding> vpnBinding = vpnBindingWrapper.asBean(VpnBinding.class);
@@ -65,7 +65,7 @@ public class WorkflowActionExtractResourcesAAI {
     }
 
     public Optional<Relationships> extractRelationshipsVnfc(Relationships relationships) {
-        List<AAIResultWrapper> vnfcs = relationships.getByType(AAIObjectType.VNFC);
+        List<AAIResultWrapper> vnfcs = relationships.getByType(Types.VNFC);
         for (AAIResultWrapper vnfcWrapper : vnfcs) {
             if (vnfcWrapper.getRelationships().isPresent()) {
                 return vnfcWrapper.getRelationships();
index 7386740..78c8cfb 100644 (file)
 
 package org.onap.so.client.orchestration;
 
-import org.onap.so.bpmn.common.InjectionHelper;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection;
-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;
+import org.onap.so.bpmn.common.InjectionHelper;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection;
 import org.onap.so.client.aai.mapper.AAIObjectMapper;
 import org.onap.so.db.catalog.beans.OrchestrationStatus;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -40,7 +40,7 @@ public class AAICollectionResources {
 
     public void createCollection(Collection collection) {
         AAIResourceUri networkCollectionURI =
-                AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, collection.getId());
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().collection(collection.getId()));
         collection.setOrchestrationStatus(OrchestrationStatus.INVENTORIED);
         org.onap.aai.domain.yang.Collection aaiCollection = aaiObjectMapper.mapCollection(collection);
         injectionHelper.getAaiClient().create(networkCollectionURI, aaiCollection);
@@ -48,13 +48,14 @@ public class AAICollectionResources {
 
     public void updateCollection(Collection collection) {
         AAIResourceUri networkCollectionURI =
-                AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, collection.getId());
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().collection(collection.getId()));
         org.onap.aai.domain.yang.Collection aaiCollection = aaiObjectMapper.mapCollection(collection);
         injectionHelper.getAaiClient().update(networkCollectionURI, aaiCollection);
     }
 
     public void deleteCollection(Collection collection) {
-        AAIResourceUri instanceGroupUri = AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, collection.getId());
+        AAIResourceUri instanceGroupUri =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().collection(collection.getId()));
         injectionHelper.getAaiClient().delete(instanceGroupUri);
     }
 }
index a832930..1373c2c 100644 (file)
@@ -22,12 +22,13 @@ package org.onap.so.client.orchestration;
 
 import java.util.Optional;
 import javax.ws.rs.core.UriBuilder;
-import org.onap.so.bpmn.common.InjectionHelper;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
-import org.onap.aaiclient.client.aai.AAIObjectType;
 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;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types;
+import org.onap.so.bpmn.common.InjectionHelper;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
 import org.onap.so.client.aai.mapper.AAIObjectMapper;
 import org.onap.so.db.catalog.beans.OrchestrationStatus;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -47,8 +48,8 @@ public class AAIConfigurationResources {
      * @param configuration
      */
     public void createConfiguration(Configuration configuration) {
-        AAIResourceUri configurationURI =
-                AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configuration.getConfigurationId());
+        AAIResourceUri configurationURI = AAIUriFactory
+                .createResourceUri(AAIFluentTypeBuilder.network().configuration(configuration.getConfigurationId()));
         configuration.setOrchestrationStatus(OrchestrationStatus.INVENTORIED);
         org.onap.aai.domain.yang.Configuration aaiConfiguration = aaiObjectMapper.mapConfiguration(configuration);
         injectionHelper.getAaiClient().createIfNotExists(configurationURI, Optional.of(aaiConfiguration));
@@ -61,7 +62,8 @@ public class AAIConfigurationResources {
      * @return
      */
     public Optional<org.onap.aai.domain.yang.Configuration> getConfiguration(String configurationId) {
-        AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId);
+        AAIResourceUri aaiResourceUri =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().configuration(configurationId));
         return injectionHelper.getAaiClient().get(org.onap.aai.domain.yang.Configuration.class, aaiResourceUri);
     }
 
@@ -71,8 +73,8 @@ public class AAIConfigurationResources {
      * @param configuration
      */
     public void updateConfiguration(Configuration configuration) {
-        AAIResourceUri configurationURI =
-                AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configuration.getConfigurationId());
+        AAIResourceUri configurationURI = AAIUriFactory
+                .createResourceUri(AAIFluentTypeBuilder.network().configuration(configuration.getConfigurationId()));
         org.onap.aai.domain.yang.Configuration aaiConfiguration = aaiObjectMapper.mapConfiguration(configuration);
         injectionHelper.getAaiClient().update(configurationURI, aaiConfiguration);
     }
@@ -85,9 +87,10 @@ public class AAIConfigurationResources {
      */
 
     public void disconnectConfigurationToServiceInstance(String configurationId, String serviceInstanceId) {
-        AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId);
+        AAIResourceUri configurationURI =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().configuration(configurationId));
         AAIResourceUri serviceInstanceURI =
-                AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId);
+                AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId));
         injectionHelper.getAaiClient().disconnect(configurationURI, serviceInstanceURI);
     }
 
@@ -99,9 +102,9 @@ public class AAIConfigurationResources {
      */
     public void connectVrfConfigurationToVnrConfiguration(String vrfConfigurationId, String vnrConfigurationId) {
         AAIResourceUri vnrConfigurationUri =
-                AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, vnrConfigurationId);
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().configuration(vnrConfigurationId));
         AAIResourceUri vrfConfigurationUri =
-                AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, vrfConfigurationId);
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().configuration(vrfConfigurationId));
         injectionHelper.getAaiClient().connect(vrfConfigurationUri, vnrConfigurationUri);
     }
 
@@ -112,8 +115,9 @@ public class AAIConfigurationResources {
      * @param configurationId
      */
     public void connectConfigurationToPnfObject(String pnfId, String configurationId) {
-        AAIResourceUri pnfUri = AAIUriFactory.createResourceUri(AAIObjectType.PNF, pnfId);
-        AAIResourceUri configurationUri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId);
+        AAIResourceUri pnfUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().pnf(pnfId));
+        AAIResourceUri configurationUri =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().configuration(configurationId));
         injectionHelper.getAaiClient().connect(configurationUri, pnfUri);
     }
 
@@ -124,9 +128,10 @@ public class AAIConfigurationResources {
      * @param serviceInstanceId
      */
     public void connectConfigurationToServiceInstance(String configurationId, String serviceInstanceId) {
-        AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId);
+        AAIResourceUri configurationURI =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().configuration(configurationId));
         AAIResourceUri serviceInstanceURI =
-                AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId);
+                AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId));
         injectionHelper.getAaiClient().connect(configurationURI, serviceInstanceURI);
     }
 
@@ -139,9 +144,10 @@ public class AAIConfigurationResources {
      */
     public void connectConfigurationToServiceInstance(String configurationId, String serviceInstanceId,
             AAIEdgeLabel aaiLabel) {
-        AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId);
+        AAIResourceUri configurationURI =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().configuration(configurationId));
         AAIResourceUri serviceInstanceURI =
-                AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId);
+                AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId));
         injectionHelper.getAaiClient().connect(configurationURI, serviceInstanceURI, aaiLabel);
     }
 
@@ -152,8 +158,10 @@ public class AAIConfigurationResources {
      * @param genericVnfId
      */
     public void connectConfigurationToGenericVnf(String configurationId, String genericVnfId) {
-        AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId);
-        AAIResourceUri genericVnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, genericVnfId);
+        AAIResourceUri configurationURI =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().configuration(configurationId));
+        AAIResourceUri genericVnfURI =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(genericVnfId));
         injectionHelper.getAaiClient().connect(configurationURI, genericVnfURI);
     }
 
@@ -165,26 +173,33 @@ public class AAIConfigurationResources {
      *
      */
     public void connectConfigurationToVpnBinding(String configurationId, String vpnId) {
-        AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId);
-        AAIResourceUri vpnBindingURI = AAIUriFactory.createResourceUri(AAIObjectType.VPN_BINDING, vpnId);
+        AAIResourceUri configurationURI =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().configuration(configurationId));
+        AAIResourceUri vpnBindingURI =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().vpnBinding(vpnId));
         injectionHelper.getAaiClient().connect(configurationURI, vpnBindingURI);
     }
 
     public void connectConfigurationToVfModule(String configurationId, String vnfId, String vfModuleId) {
-        AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId);
-        AAIResourceUri vfModuleURI = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId);
+        AAIResourceUri configurationURI =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().configuration(configurationId));
+        AAIResourceUri vfModuleURI =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId).vfModule(vfModuleId));
         injectionHelper.getAaiClient().connect(configurationURI, vfModuleURI);
     }
 
     public void connectConfigurationToVnfc(String configurationId, String vnfcName) {
-        AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId);
-        AAIResourceUri vnfcURI = AAIUriFactory.createResourceUri(AAIObjectType.VNFC, vnfcName);
+        AAIResourceUri configurationURI =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().configuration(configurationId));
+        AAIResourceUri vnfcURI = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().vnfc(vnfcName));
         injectionHelper.getAaiClient().connect(configurationURI, vnfcURI);
     }
 
     public void connectConfigurationToL3Network(String configurationId, String networkId) {
-        AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId);
-        AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, networkId);
+        AAIResourceUri configurationURI =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().configuration(configurationId));
+        AAIResourceUri networkURI =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(networkId));
         injectionHelper.getAaiClient().connect(configurationURI, networkURI);
     }
 
@@ -194,7 +209,8 @@ public class AAIConfigurationResources {
      * @param configurationId
      */
     public void deleteConfiguration(String configurationId) {
-        AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId);
+        AAIResourceUri aaiResourceUri =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().configuration(configurationId));
         injectionHelper.getAaiClient().delete(aaiResourceUri);
     }
 
@@ -204,8 +220,8 @@ public class AAIConfigurationResources {
      * @param configuration
      */
     public void deleteConfiguration(Configuration configuration) {
-        AAIResourceUri aaiResourceUri =
-                AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configuration.getConfigurationId());
+        AAIResourceUri aaiResourceUri = AAIUriFactory
+                .createResourceUri(AAIFluentTypeBuilder.network().configuration(configuration.getConfigurationId()));
         injectionHelper.getAaiClient().delete(aaiResourceUri);
     }
 
@@ -217,13 +233,13 @@ public class AAIConfigurationResources {
      */
     public Optional<org.onap.aai.domain.yang.Configuration> getConfigurationFromRelatedLink(String relatedLink) {
         return injectionHelper.getAaiClient().get(org.onap.aai.domain.yang.Configuration.class, AAIUriFactory
-                .createResourceFromExistingURI(AAIObjectType.CONFIGURATION, UriBuilder.fromPath(relatedLink).build()));
+                .createResourceFromExistingURI(Types.CONFIGURATION, UriBuilder.fromPath(relatedLink).build()));
     }
 
     public void updateOrchestrationStatusConfiguration(Configuration configuration,
             OrchestrationStatus orchestrationStatus) {
-        AAIResourceUri aaiResourceUri =
-                AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configuration.getConfigurationId());
+        AAIResourceUri aaiResourceUri = AAIUriFactory
+                .createResourceUri(AAIFluentTypeBuilder.network().configuration(configuration.getConfigurationId()));
         configuration.setOrchestrationStatus(orchestrationStatus);
         org.onap.aai.domain.yang.Configuration aaiConfiguration = aaiObjectMapper.mapConfiguration(configuration);
         injectionHelper.getAaiClient().update(aaiResourceUri, aaiConfiguration);
@@ -231,8 +247,8 @@ public class AAIConfigurationResources {
 
     public void updateConfigurationOrchestrationStatus(Configuration configuration,
             OrchestrationStatus orchestrationStatus) {
-        AAIResourceUri aaiResourceUri =
-                AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configuration.getConfigurationId());
+        AAIResourceUri aaiResourceUri = AAIUriFactory
+                .createResourceUri(AAIFluentTypeBuilder.network().configuration(configuration.getConfigurationId()));
         org.onap.aai.domain.yang.Configuration aaiConfiguration = new org.onap.aai.domain.yang.Configuration();
         aaiConfiguration.setOrchestrationStatus(orchestrationStatus.name());
         injectionHelper.getAaiClient().update(aaiResourceUri, aaiConfiguration);
index 05c8f7d..27fa430 100644 (file)
 package org.onap.so.client.orchestration;
 
 import java.util.Optional;
-import org.onap.so.bpmn.common.InjectionHelper;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
-import org.onap.aaiclient.client.aai.AAIObjectPlurals;
-import org.onap.aaiclient.client.aai.AAIObjectType;
 import org.onap.aaiclient.client.aai.entities.AAIEdgeLabel;
 import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
 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.InjectionHelper;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
 import org.onap.so.client.aai.mapper.AAIObjectMapper;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
@@ -45,50 +45,52 @@ public class AAIInstanceGroupResources {
 
     public void createInstanceGroup(InstanceGroup instanceGroup) {
         AAIResourceUri instanceGroupUri =
-                AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId());
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroup.getId()));
         org.onap.aai.domain.yang.InstanceGroup aaiInstanceGroup = aaiObjectMapper.mapInstanceGroup(instanceGroup);
         injectionHelper.getAaiClient().createIfNotExists(instanceGroupUri, Optional.of(aaiInstanceGroup));
     }
 
     public void deleteInstanceGroup(InstanceGroup instanceGroup) {
         AAIResourceUri instanceGroupUri =
-                AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId());
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroup.getId()));
         injectionHelper.getAaiClient().delete(instanceGroupUri);
     }
 
     public void connectInstanceGroupToVnf(InstanceGroup instanceGroup, GenericVnf vnf) {
         AAIResourceUri instanceGroupUri =
-                AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId());
-        AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId());
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroup.getId()));
+        AAIResourceUri vnfURI =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId()));
         injectionHelper.getAaiClient().connect(instanceGroupUri, vnfURI);
     }
 
     public void connectInstanceGroupToVnf(InstanceGroup instanceGroup, GenericVnf vnf, AAIEdgeLabel aaiLabel) {
         AAIResourceUri instanceGroupUri =
-                AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId());
-        AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId());
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroup.getId()));
+        AAIResourceUri vnfURI =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId()));
         injectionHelper.getAaiClient().connect(instanceGroupUri, vnfURI, aaiLabel);
     }
 
     public boolean exists(InstanceGroup instanceGroup) {
         AAIResourceUri instanceGroupUri =
-                AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId());
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroup.getId()));
         return injectionHelper.getAaiClient().exists(instanceGroupUri);
     }
 
     public void createInstanceGroupandConnectServiceInstance(InstanceGroup instanceGroup,
             ServiceInstance serviceInstance) {
         AAIResourceUri instanceGroupUri =
-                AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId());
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroup.getId()));
         org.onap.aai.domain.yang.InstanceGroup aaiInstanceGroup = aaiObjectMapper.mapInstanceGroup(instanceGroup);
-        AAIResourceUri serviceInstanceURI =
-                AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance.getServiceInstanceId());
+        AAIResourceUri serviceInstanceURI = AAIUriFactory
+                .createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstance.getServiceInstanceId()));
         injectionHelper.getAaiClient().createIfNotExists(instanceGroupUri, Optional.of(aaiInstanceGroup))
                 .connect(instanceGroupUri, serviceInstanceURI);
     }
 
     public boolean checkInstanceGroupNameInUse(String instanceGroupName) {
-        AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.INSTANCE_GROUP)
+        AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().instanceGroups())
                 .queryParam("instance-group-name", instanceGroupName);
         return injectionHelper.getAaiClient().exists(uri);
     }
index 611d715..2e8e50a 100644 (file)
@@ -25,6 +25,15 @@ import org.onap.aai.domain.yang.NetworkPolicies;
 import org.onap.aai.domain.yang.NetworkPolicy;
 import org.onap.aai.domain.yang.RouteTableReference;
 import org.onap.aai.domain.yang.VpnBinding;
+import org.onap.aaiclient.client.aai.entities.AAIEdgeLabel;
+import org.onap.aaiclient.client.aai.entities.AAIResultWrapper;
+import org.onap.aaiclient.client.aai.entities.uri.AAIBaseResourceUri;
+import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
+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.aaiclient.client.graphinventory.entities.uri.Depth;
 import org.onap.so.bpmn.common.InjectionHelper;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection;
@@ -34,16 +43,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet;
-import org.onap.aaiclient.client.aai.AAIObjectPlurals;
-import org.onap.aaiclient.client.aai.AAIObjectType;
-import org.onap.aaiclient.client.aai.entities.AAIEdgeLabel;
-import org.onap.aaiclient.client.aai.entities.AAIResultWrapper;
-import org.onap.aaiclient.client.aai.entities.uri.AAIBaseResourceUri;
-import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
-import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
-import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
 import org.onap.so.client.aai.mapper.AAIObjectMapper;
-import org.onap.aaiclient.client.graphinventory.entities.uri.Depth;
 import org.onap.so.db.catalog.beans.OrchestrationStatus;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
@@ -58,46 +58,51 @@ public class AAINetworkResources {
     private AAIObjectMapper aaiObjectMapper;
 
     public void updateNetwork(L3Network network) {
-        AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, network.getNetworkId());
+        AAIResourceUri networkURI =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(network.getNetworkId()));
         org.onap.aai.domain.yang.L3Network aaiL3Network = aaiObjectMapper.mapNetwork(network);
         injectionHelper.getAaiClient().update(networkURI, aaiL3Network);
     }
 
     public void updateSubnet(L3Network network, Subnet subnet) {
-        AAIResourceUri subnetURI =
-                AAIUriFactory.createResourceUri(AAIObjectType.SUBNET, network.getNetworkId(), subnet.getSubnetId());
+        AAIResourceUri subnetURI = AAIUriFactory.createResourceUri(
+                AAIFluentTypeBuilder.network().l3Network(network.getNetworkId()).subnet(subnet.getSubnetId()));
         org.onap.aai.domain.yang.Subnet aaiSubnet = aaiObjectMapper.mapSubnet(subnet);
         injectionHelper.getAaiClient().update(subnetURI, aaiSubnet);
     }
 
     public void createNetworkConnectToServiceInstance(L3Network network, ServiceInstance serviceInstance) {
-        AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, network.getNetworkId());
+        AAIResourceUri networkURI =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(network.getNetworkId()));
         network.setOrchestrationStatus(OrchestrationStatus.INVENTORIED);
-        AAIResourceUri serviceInstanceURI =
-                AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance.getServiceInstanceId());
+        AAIResourceUri serviceInstanceURI = AAIUriFactory
+                .createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstance.getServiceInstanceId()));
         org.onap.aai.domain.yang.L3Network aaiL3Network = aaiObjectMapper.mapNetwork(network);
         injectionHelper.getAaiClient().createIfNotExists(networkURI, Optional.of(aaiL3Network)).connect(networkURI,
                 serviceInstanceURI);
     }
 
     public void createLineOfBusinessAndConnectNetwork(LineOfBusiness lineOfBusiness, L3Network network) {
-        AAIResourceUri lineOfBusinessURI =
-                AAIUriFactory.createResourceUri(AAIObjectType.LINE_OF_BUSINESS, lineOfBusiness.getLineOfBusinessName());
-        AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, network.getNetworkId());
+        AAIResourceUri lineOfBusinessURI = AAIUriFactory.createResourceUri(
+                AAIFluentTypeBuilder.business().lineOfBusiness(lineOfBusiness.getLineOfBusinessName()));
+        AAIResourceUri networkURI =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(network.getNetworkId()));
         injectionHelper.getAaiClient().createIfNotExists(lineOfBusinessURI, Optional.of(lineOfBusiness))
                 .connect(networkURI, lineOfBusinessURI);
     }
 
     public void createPlatformAndConnectNetwork(Platform platform, L3Network network) {
         AAIResourceUri platformURI =
-                AAIUriFactory.createResourceUri(AAIObjectType.PLATFORM, platform.getPlatformName());
-        AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, network.getNetworkId());
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().platform(platform.getPlatformName()));
+        AAIResourceUri networkURI =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(network.getNetworkId()));
         injectionHelper.getAaiClient().createIfNotExists(platformURI, Optional.of(platform)).connect(networkURI,
                 platformURI);
     }
 
     public void deleteNetwork(L3Network network) {
-        AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, network.getNetworkId());
+        AAIResourceUri networkURI =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(network.getNetworkId()));
         injectionHelper.getAaiClient().delete(networkURI);
     }
 
@@ -122,115 +127,122 @@ public class AAINetworkResources {
     }
 
     public Optional<org.onap.aai.domain.yang.L3Network> queryNetworkById(L3Network l3network) {
-        AAIResourceUri uri =
-                AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, l3network.getNetworkId()).depth(Depth.ALL);
+        AAIResourceUri uri = AAIUriFactory
+                .createResourceUri(AAIFluentTypeBuilder.network().l3Network(l3network.getNetworkId())).depth(Depth.ALL);
         AAIResultWrapper aaiWrapper = injectionHelper.getAaiClient().get(uri);
         return aaiWrapper.asBean(org.onap.aai.domain.yang.L3Network.class);
     }
 
     public AAIResultWrapper queryNetworkWrapperById(L3Network l3network) {
-        AAIResourceUri uri =
-                AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, l3network.getNetworkId()).depth(Depth.ALL);
+        AAIResourceUri uri = AAIUriFactory
+                .createResourceUri(AAIFluentTypeBuilder.network().l3Network(l3network.getNetworkId())).depth(Depth.ALL);
         return injectionHelper.getAaiClient().get(uri);
     }
 
     public void createNetworkInstanceGroup(InstanceGroup instanceGroup) {
         AAIResourceUri instanceGroupURI =
-                AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId());
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroup.getId()));
         org.onap.aai.domain.yang.InstanceGroup aaiInstanceGroup = aaiObjectMapper.mapInstanceGroup(instanceGroup);
         injectionHelper.getAaiClient().create(instanceGroupURI, aaiInstanceGroup);
     }
 
     public void createNetworkCollection(Collection networkCollection) {
         AAIResourceUri networkCollectionURI =
-                AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, networkCollection.getId());
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().collection(networkCollection.getId()));
         networkCollection.setOrchestrationStatus(OrchestrationStatus.INVENTORIED);
         org.onap.aai.domain.yang.Collection aaiCollection = aaiObjectMapper.mapCollection(networkCollection);
         injectionHelper.getAaiClient().create(networkCollectionURI, aaiCollection);
     }
 
     public void connectNetworkToTenant(L3Network l3network, CloudRegion cloudRegion) {
-        AAIResourceUri tenantURI = AAIUriFactory.createResourceUri(AAIObjectType.TENANT, cloudRegion.getCloudOwner(),
-                cloudRegion.getLcpCloudRegionId(), cloudRegion.getTenantId());
-        AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, l3network.getNetworkId());
+        AAIResourceUri tenantURI = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+                .cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId())
+                .tenant(cloudRegion.getTenantId()));
+        AAIResourceUri networkURI =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(l3network.getNetworkId()));
         injectionHelper.getAaiClient().connect(tenantURI, networkURI);
     }
 
     public void connectNetworkToCloudRegion(L3Network l3network, CloudRegion cloudRegion) {
-        AAIResourceUri cloudRegionURI = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION,
-                cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId());
-        AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, l3network.getNetworkId());
+        AAIResourceUri cloudRegionURI = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+                .cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId()));
+        AAIResourceUri networkURI =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(l3network.getNetworkId()));
         injectionHelper.getAaiClient().connect(networkURI, cloudRegionURI);
     }
 
     public void connectNetworkToNetworkCollectionInstanceGroup(L3Network l3network, InstanceGroup instanceGroup) {
         AAIResourceUri netwrokCollectionInstanceGroupURI =
-                AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId());
-        AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, l3network.getNetworkId());
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroup.getId()));
+        AAIResourceUri networkURI =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(l3network.getNetworkId()));
         injectionHelper.getAaiClient().connect(netwrokCollectionInstanceGroupURI, networkURI);
     }
 
     public void connectNetworkToNetworkCollectionServiceInstance(L3Network l3network,
             ServiceInstance networkCollectionServiceInstance) {
         AAIResourceUri networkCollectionServiceInstanceUri = AAIUriFactory.createResourceUri(
-                AAIObjectType.SERVICE_INSTANCE, networkCollectionServiceInstance.getServiceInstanceId());
-        AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, l3network.getNetworkId());
+                Types.SERVICE_INSTANCE.getFragment(networkCollectionServiceInstance.getServiceInstanceId()));
+        AAIResourceUri networkURI =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(l3network.getNetworkId()));
         injectionHelper.getAaiClient().connect(networkCollectionServiceInstanceUri, networkURI);
     }
 
     public void connectNetworkCollectionInstanceGroupToNetworkCollection(InstanceGroup instanceGroup,
             Collection networkCollection) {
         AAIResourceUri networkCollectionUri =
-                AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, networkCollection.getId());
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().collection(networkCollection.getId()));
         AAIResourceUri netwrokCollectionInstanceGroupURI =
-                AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId());
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroup.getId()));
         injectionHelper.getAaiClient().connect(networkCollectionUri, netwrokCollectionInstanceGroupURI);
     }
 
     public void connectInstanceGroupToCloudRegion(InstanceGroup instanceGroup, CloudRegion cloudRegion) {
-        AAIResourceUri cloudRegionURI = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION,
-                cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId());
+        AAIResourceUri cloudRegionURI = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+                .cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId()));
         AAIResourceUri instanceGroupURI =
-                AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId());
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroup.getId()));
         injectionHelper.getAaiClient().connect(instanceGroupURI, cloudRegionURI, AAIEdgeLabel.USES);
     }
 
     public void connectNetworkCollectionToServiceInstance(Collection networkCollection,
             ServiceInstance networkCollectionServiceInstance) {
         AAIResourceUri networkCollectionUri =
-                AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, networkCollection.getId());
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().collection(networkCollection.getId()));
         AAIResourceUri networkCollectionServiceInstanceUri = AAIUriFactory.createResourceUri(
-                AAIObjectType.SERVICE_INSTANCE, networkCollectionServiceInstance.getServiceInstanceId());
+                Types.SERVICE_INSTANCE.getFragment(networkCollectionServiceInstance.getServiceInstanceId()));
         injectionHelper.getAaiClient().connect(networkCollectionUri, networkCollectionServiceInstanceUri);
     }
 
     public void deleteCollection(Collection collection) {
-        AAIResourceUri collectionURI = AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, collection.getId());
+        AAIResourceUri collectionURI =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().collection(collection.getId()));
         injectionHelper.getAaiClient().delete(collectionURI);
     }
 
     public void deleteNetworkInstanceGroup(InstanceGroup instanceGroup) {
         AAIResourceUri instanceGroupURI =
-                AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId());
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroup.getId()));
         injectionHelper.getAaiClient().delete(instanceGroupURI);
     }
 
     public void createNetworkPolicy(org.onap.so.bpmn.servicedecomposition.bbobjects.NetworkPolicy networkPolicy) {
         NetworkPolicy aaiNetworkPolicy = aaiObjectMapper.mapNetworkPolicy(networkPolicy);
         String networkPolicyId = networkPolicy.getNetworkPolicyId();
-        AAIResourceUri netUri = AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, networkPolicyId);
+        AAIResourceUri netUri =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().networkPolicy(networkPolicyId));
         injectionHelper.getAaiClient().create(netUri, aaiNetworkPolicy);
     }
 
     public void deleteNetworkPolicy(String networkPolicyId) {
         AAIResourceUri networkPolicyURI =
-                AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, networkPolicyId);
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().networkPolicy(networkPolicyId));
         injectionHelper.getAaiClient().delete(networkPolicyURI);
     }
 
     public boolean checkNetworkNameInUse(String networkName) {
-        AAIPluralResourceUri uri =
-                AAIUriFactory.createResourceUri(AAIObjectPlurals.L3_NETWORK).queryParam("network-name", networkName);
+        AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Networks())
+                .queryParam("network-name", networkName);
         return injectionHelper.getAaiClient().exists(uri);
     }
 
index 3da1719..a426c39 100644 (file)
 
 package org.onap.so.client.orchestration;
 
-import com.google.common.base.Strings;
 import java.util.Optional;
 import org.apache.commons.lang3.StringUtils;
 import org.onap.aai.domain.yang.RelatedToProperty;
 import org.onap.aai.domain.yang.Relationship;
 import org.onap.aai.domain.yang.RelationshipData;
+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.InjectionHelper;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.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.so.client.aai.mapper.AAIObjectMapper;
 import org.onap.so.db.catalog.beans.OrchestrationStatus;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
+import com.google.common.base.Strings;
 
 @Component
 public class AAIPnfResources {
@@ -51,16 +52,16 @@ public class AAIPnfResources {
     private AAIObjectMapper aaiObjectMapper;
 
     public void createPnfAndConnectServiceInstance(Pnf pnf, ServiceInstance serviceInstance) {
-        AAIResourceUri pnfURI = AAIUriFactory.createResourceUri(AAIObjectType.PNF, pnf.getPnfName());
+        AAIResourceUri pnfURI = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().pnf(pnf.getPnfName()));
         pnf.setOrchestrationStatus(OrchestrationStatus.INVENTORIED);
-        AAIResourceUri serviceInstanceURI =
-                AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance.getServiceInstanceId());
+        AAIResourceUri serviceInstanceURI = AAIUriFactory
+                .createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstance.getServiceInstanceId()));
         injectionHelper.getAaiClient().createIfNotExists(pnfURI, Optional.of(aaiObjectMapper.mapPnf(pnf)))
                 .connect(pnfURI, serviceInstanceURI);
     }
 
     public void updateOrchestrationStatusPnf(Pnf pnf, OrchestrationStatus orchestrationStatus) {
-        AAIResourceUri pnfURI = AAIUriFactory.createResourceUri(AAIObjectType.PNF, pnf.getPnfName());
+        AAIResourceUri pnfURI = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().pnf(pnf.getPnfName()));
 
         Pnf pnfCopy = pnf.shallowCopyId();
 
@@ -72,7 +73,7 @@ public class AAIPnfResources {
     public void checkIfPnfExistsInAaiAndCanBeUsed(Pnf pnf) throws Exception {
         Optional<org.onap.aai.domain.yang.Pnf> pnfFromAai =
                 injectionHelper.getAaiClient().get(org.onap.aai.domain.yang.Pnf.class,
-                        AAIUriFactory.createResourceUri(AAIObjectType.PNF, pnf.getPnfName()));
+                        AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().pnf(pnf.getPnfName())));
         if (pnfFromAai.isPresent()) {
             checkIfPnfCanBeUsed(pnfFromAai.get());
             updatePnfInAAI(pnf, pnfFromAai.get());
@@ -81,8 +82,8 @@ public class AAIPnfResources {
 
     private void updatePnfInAAI(Pnf pnf, org.onap.aai.domain.yang.Pnf pnfFromAai) {
         updatePnfFields(pnf, pnfFromAai);
-        injectionHelper.getAaiClient().update(AAIUriFactory.createResourceUri(AAIObjectType.PNF, pnf.getPnfName()),
-                pnfFromAai);
+        injectionHelper.getAaiClient().update(
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().pnf(pnf.getPnfName())), pnfFromAai);
         logger.debug("updatePnfInAAI: {}", pnfFromAai);
     }
 
index 424b3ec..cc99f17 100644 (file)
@@ -27,17 +27,17 @@ package org.onap.so.client.orchestration;
 import java.util.List;
 import java.util.Optional;
 import org.onap.aai.domain.yang.OwningEntities;
+import org.onap.aaiclient.client.aai.AAIResourcesClient;
+import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
+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.InjectionHelper;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.OwningEntity;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.Project;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
-import org.onap.aaiclient.client.aai.AAIObjectPlurals;
-import org.onap.aaiclient.client.aai.AAIObjectType;
-import org.onap.aaiclient.client.aai.AAIResourcesClient;
-import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
-import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
-import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
 import org.onap.so.client.aai.mapper.AAIObjectMapper;
 import org.onap.so.db.catalog.beans.OrchestrationStatus;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -53,15 +53,16 @@ public class AAIServiceInstanceResources {
     private AAIObjectMapper aaiObjectMapper;
 
     public boolean existsServiceInstance(ServiceInstance serviceInstance) {
-        AAIResourceUri serviceInstanceURI =
-                AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance.getServiceInstanceId());
+        AAIResourceUri serviceInstanceURI = AAIUriFactory
+                .createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstance.getServiceInstanceId()));
         return injectionHelper.getAaiClient().exists(serviceInstanceURI);
     }
 
     public void createServiceInstance(ServiceInstance serviceInstance, Customer customer) {
         AAIResourceUri serviceInstanceURI =
-                AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, customer.getGlobalCustomerId(),
-                        customer.getServiceSubscription().getServiceType(), serviceInstance.getServiceInstanceId());
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(customer.getGlobalCustomerId())
+                        .serviceSubscription(customer.getServiceSubscription().getServiceType())
+                        .serviceInstance(serviceInstance.getServiceInstanceId()));
         serviceInstance.setOrchestrationStatus(OrchestrationStatus.INVENTORIED);
         org.onap.aai.domain.yang.ServiceInstance aaiServiceInstance =
                 aaiObjectMapper.mapServiceInstance(serviceInstance);
@@ -74,58 +75,63 @@ public class AAIServiceInstanceResources {
      * @param customer
      */
     public void createServiceSubscription(Customer customer) {
-        AAIResourceUri serviceSubscriptionURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_SUBSCRIPTION,
-                customer.getGlobalCustomerId(), customer.getServiceSubscription().getServiceType());
+        AAIResourceUri serviceSubscriptionURI =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(customer.getGlobalCustomerId())
+                        .serviceSubscription(customer.getServiceSubscription().getServiceType()));
         org.onap.aai.domain.yang.ServiceSubscription serviceSubscription =
                 aaiObjectMapper.mapServiceSubscription(customer.getServiceSubscription());
         injectionHelper.getAaiClient().createIfNotExists(serviceSubscriptionURI, Optional.of(serviceSubscription));
     }
 
     public void deleteServiceInstance(ServiceInstance serviceInstance) {
-        AAIResourceUri serviceInstanceURI =
-                AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance.getServiceInstanceId());
+        AAIResourceUri serviceInstanceURI = AAIUriFactory
+                .createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstance.getServiceInstanceId()));
         injectionHelper.getAaiClient().delete(serviceInstanceURI);
     }
 
     public void createProject(Project project) {
-        AAIResourceUri projectURI = AAIUriFactory.createResourceUri(AAIObjectType.PROJECT, project.getProjectName());
+        AAIResourceUri projectURI =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().project(project.getProjectName()));
         org.onap.aai.domain.yang.Project aaiProject = aaiObjectMapper.mapProject(project);
         injectionHelper.getAaiClient().createIfNotExists(projectURI, Optional.of(aaiProject));
     }
 
     public void createProjectandConnectServiceInstance(Project project, ServiceInstance serviceInstance) {
-        AAIResourceUri projectURI = AAIUriFactory.createResourceUri(AAIObjectType.PROJECT, project.getProjectName());
-        AAIResourceUri serviceInstanceURI =
-                AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance.getServiceInstanceId());
+        AAIResourceUri projectURI =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().project(project.getProjectName()));
+        AAIResourceUri serviceInstanceURI = AAIUriFactory
+                .createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstance.getServiceInstanceId()));
         org.onap.aai.domain.yang.Project aaiProject = aaiObjectMapper.mapProject(project);
         injectionHelper.getAaiClient().createIfNotExists(projectURI, Optional.of(aaiProject)).connect(projectURI,
                 serviceInstanceURI);
     }
 
     public void createOwningEntity(OwningEntity owningEntity) {
-        AAIResourceUri owningEntityURI =
-                AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntity.getOwningEntityId());
+        AAIResourceUri owningEntityURI = AAIUriFactory
+                .createResourceUri(AAIFluentTypeBuilder.business().owningEntity(owningEntity.getOwningEntityId()));
         org.onap.aai.domain.yang.OwningEntity aaiOwningEntity = aaiObjectMapper.mapOwningEntity(owningEntity);
         injectionHelper.getAaiClient().createIfNotExists(owningEntityURI, Optional.of(aaiOwningEntity));
     }
 
     public boolean existsOwningEntity(OwningEntity owningEntity) {
-        AAIResourceUri owningEntityUri =
-                AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntity.getOwningEntityId());
+        AAIResourceUri owningEntityUri = AAIUriFactory
+                .createResourceUri(AAIFluentTypeBuilder.business().owningEntity(owningEntity.getOwningEntityId()));
         return injectionHelper.getAaiClient().exists(owningEntityUri);
     }
 
     public boolean existsOwningEntityName(String owningEntityName) {
-        AAIPluralResourceUri owningEntityUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.OWNING_ENTITY)
-                .queryParam("owning-entity-name", owningEntityName);
+        AAIPluralResourceUri owningEntityUri =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().owningEntities())
+                        .queryParam("owning-entity-name", owningEntityName);
         AAIResourcesClient aaiRC = injectionHelper.getAaiClient();
         return aaiRC.exists(owningEntityUri);
     }
 
     public org.onap.aai.domain.yang.OwningEntity getOwningEntityByName(String owningEntityName)
             throws AAIEntityNotFoundException {
-        AAIPluralResourceUri owningEntityUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.OWNING_ENTITY)
-                .queryParam("owning-entity-name", owningEntityName);
+        AAIPluralResourceUri owningEntityUri =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().owningEntities())
+                        .queryParam("owning-entity-name", owningEntityName);
         AAIResourcesClient aaiRC = injectionHelper.getAaiClient();
         Optional<OwningEntities> owningEntities = aaiRC.get(OwningEntities.class, owningEntityUri);
         if (owningEntities.isPresent()) {
@@ -142,19 +148,19 @@ public class AAIServiceInstanceResources {
     }
 
     public void connectOwningEntityandServiceInstance(OwningEntity owningEntity, ServiceInstance serviceInstance) {
-        AAIResourceUri owningEntityURI =
-                AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntity.getOwningEntityId());
-        AAIResourceUri serviceInstanceURI =
-                AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance.getServiceInstanceId());
+        AAIResourceUri owningEntityURI = AAIUriFactory
+                .createResourceUri(AAIFluentTypeBuilder.business().owningEntity(owningEntity.getOwningEntityId()));
+        AAIResourceUri serviceInstanceURI = AAIUriFactory
+                .createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstance.getServiceInstanceId()));
         injectionHelper.getAaiClient().connect(owningEntityURI, serviceInstanceURI);
     }
 
     public void createOwningEntityandConnectServiceInstance(OwningEntity owningEntity,
             ServiceInstance serviceInstance) {
-        AAIResourceUri owningEntityURI =
-                AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntity.getOwningEntityId());
-        AAIResourceUri serviceInstanceURI =
-                AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance.getServiceInstanceId());
+        AAIResourceUri owningEntityURI = AAIUriFactory
+                .createResourceUri(AAIFluentTypeBuilder.business().owningEntity(owningEntity.getOwningEntityId()));
+        AAIResourceUri serviceInstanceURI = AAIUriFactory
+                .createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstance.getServiceInstanceId()));
         org.onap.aai.domain.yang.OwningEntity aaiOwningEntity = aaiObjectMapper.mapOwningEntity(owningEntity);
         injectionHelper.getAaiClient().createIfNotExists(owningEntityURI, Optional.of(aaiOwningEntity))
                 .connect(owningEntityURI, serviceInstanceURI);
@@ -171,15 +177,15 @@ public class AAIServiceInstanceResources {
     }
 
     public void updateServiceInstance(ServiceInstance serviceInstance) {
-        AAIResourceUri serviceInstanceURI =
-                AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance.getServiceInstanceId());
+        AAIResourceUri serviceInstanceURI = AAIUriFactory
+                .createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstance.getServiceInstanceId()));
         org.onap.aai.domain.yang.ServiceInstance aaiServiceInstance =
                 aaiObjectMapper.mapServiceInstance(serviceInstance);
         injectionHelper.getAaiClient().update(serviceInstanceURI, aaiServiceInstance);
     }
 
     public boolean checkInstanceServiceNameInUse(ServiceInstance serviceInstance) {
-        AAIPluralResourceUri uriSI = AAIUriFactory.createNodesUri(AAIObjectPlurals.SERVICE_INSTANCE)
+        AAIPluralResourceUri uriSI = AAIUriFactory.createNodesUri(Types.SERVICE_INSTANCES.getFragment())
                 .queryParam("service-instance-name", serviceInstance.getServiceInstanceName());
         return injectionHelper.getAaiClient().exists(uriSI);
     }
index d5d0b08..72c9b7c 100644 (file)
 package org.onap.so.client.orchestration;
 
 import java.util.Optional;
+import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
+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.InjectionHelper;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
-import org.onap.aaiclient.client.aai.AAIObjectPlurals;
-import org.onap.aaiclient.client.aai.AAIObjectType;
-import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
-import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
-import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
 import org.onap.so.client.aai.mapper.AAIObjectMapper;
 import org.onap.so.db.catalog.beans.OrchestrationStatus;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -48,23 +48,23 @@ public class AAIVfModuleResources {
     private AAIObjectMapper aaiObjectMapper;
 
     public void createVfModule(VfModule vfModule, GenericVnf vnf) {
-        AAIResourceUri vfModuleURI =
-                AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnf.getVnfId(), vfModule.getVfModuleId());
+        AAIResourceUri vfModuleURI = AAIUriFactory.createResourceUri(
+                AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId()).vfModule(vfModule.getVfModuleId()));
         vfModule.setOrchestrationStatus(OrchestrationStatus.INVENTORIED);
         injectionHelper.getAaiClient().createIfNotExists(vfModuleURI,
                 Optional.of(aaiObjectMapper.mapVfModule(vfModule)));
     }
 
     public void deleteVfModule(VfModule vfModule, GenericVnf vnf) {
-        AAIResourceUri vfModuleURI =
-                AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnf.getVnfId(), vfModule.getVfModuleId());
+        AAIResourceUri vfModuleURI = AAIUriFactory.createResourceUri(
+                AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId()).vfModule(vfModule.getVfModuleId()));
         injectionHelper.getAaiClient().delete(vfModuleURI);
     }
 
     public void updateOrchestrationStatusVfModule(VfModule vfModule, GenericVnf vnf,
             OrchestrationStatus orchestrationStatus) {
-        AAIResourceUri vfModuleURI =
-                AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnf.getVnfId(), vfModule.getVfModuleId());
+        AAIResourceUri vfModuleURI = AAIUriFactory.createResourceUri(
+                AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId()).vfModule(vfModule.getVfModuleId()));
         VfModule copiedVfModule = vfModule.shallowCopyId();
 
         vfModule.setOrchestrationStatus(orchestrationStatus);
@@ -74,8 +74,8 @@ public class AAIVfModuleResources {
     }
 
     public void updateHeatStackIdVfModule(VfModule vfModule, GenericVnf vnf) {
-        AAIResourceUri vfModuleURI =
-                AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnf.getVnfId(), vfModule.getVfModuleId());
+        AAIResourceUri vfModuleURI = AAIUriFactory.createResourceUri(
+                AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId()).vfModule(vfModule.getVfModuleId()));
         VfModule copiedVfModule = vfModule.shallowCopyId();
 
         copiedVfModule.setHeatStackId(vfModule.getHeatStackId());
@@ -84,8 +84,8 @@ public class AAIVfModuleResources {
     }
 
     public void updateContrailServiceInstanceFqdnVfModule(VfModule vfModule, GenericVnf vnf) {
-        AAIResourceUri vfModuleURI =
-                AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnf.getVnfId(), vfModule.getVfModuleId());
+        AAIResourceUri vfModuleURI = AAIUriFactory.createResourceUri(
+                AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId()).vfModule(vfModule.getVfModuleId()));
         VfModule copiedVfModule = vfModule.shallowCopyId();
 
         copiedVfModule.setContrailServiceInstanceFqdn(vfModule.getContrailServiceInstanceFqdn());
@@ -94,24 +94,25 @@ public class AAIVfModuleResources {
     }
 
     public void changeAssignVfModule(VfModule vfModule, GenericVnf vnf) {
-        AAIResourceUri vfModuleURI =
-                AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnf.getVnfId(), vfModule.getVfModuleId());
+        AAIResourceUri vfModuleURI = AAIUriFactory.createResourceUri(
+                AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId()).vfModule(vfModule.getVfModuleId()));
         org.onap.aai.domain.yang.VfModule aaiVfModule = aaiObjectMapper.mapVfModule(vfModule);
         injectionHelper.getAaiClient().update(vfModuleURI, aaiVfModule);
     }
 
     public void connectVfModuleToVolumeGroup(GenericVnf vnf, VfModule vfModule, VolumeGroup volumeGroup,
             CloudRegion cloudRegion) {
-        AAIResourceUri vfModuleURI =
-                AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnf.getVnfId(), vfModule.getVfModuleId());
-        AAIResourceUri volumeGroupURI = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP,
-                cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId());
+        AAIResourceUri vfModuleURI = AAIUriFactory.createResourceUri(
+                AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId()).vfModule(vfModule.getVfModuleId()));
+        AAIResourceUri volumeGroupURI = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+                .cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId())
+                .volumeGroup(volumeGroup.getVolumeGroupId()));
         injectionHelper.getAaiClient().connect(vfModuleURI, volumeGroupURI);
     }
 
     public boolean checkNameInUse(VfModule vfModule) {
         boolean nameInUse = false;
-        AAIPluralResourceUri vfModuleUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VF_MODULE)
+        AAIPluralResourceUri vfModuleUri = AAIUriFactory.createNodesUri(Types.VF_MODULES.getFragment())
                 .queryParam("vf-module-name", vfModule.getVfModuleName());
         AAIPluralResourceUri vfModuleUriWithCustomization = vfModuleUri.clone().queryParam("model-customization-id",
                 vfModule.getModelInfoVfModule().getModelCustomizationUUID());
index c2e84f6..2f48b1f 100644 (file)
@@ -25,22 +25,22 @@ package org.onap.so.client.orchestration;
 import java.io.IOException;
 import java.util.Optional;
 import org.onap.aai.domain.yang.Vserver;
-import org.onap.so.bpmn.common.InjectionHelper;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
-import org.onap.aaiclient.client.aai.AAIObjectPlurals;
-import org.onap.aaiclient.client.aai.AAIObjectType;
 import org.onap.aaiclient.client.aai.AAIRestClientImpl;
 import org.onap.aaiclient.client.aai.AAIValidatorImpl;
 import org.onap.aaiclient.client.aai.entities.AAIResultWrapper;
 import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
 import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
 import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
-import org.onap.so.client.aai.mapper.AAIObjectMapper;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types;
 import org.onap.aaiclient.client.graphinventory.entities.uri.Depth;
+import org.onap.so.bpmn.common.InjectionHelper;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.client.aai.mapper.AAIObjectMapper;
 import org.onap.so.db.catalog.beans.OrchestrationStatus;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
@@ -57,37 +57,42 @@ public class AAIVnfResources {
     private AAIValidatorImpl aaiValidatorImpl = new AAIValidatorImpl();
 
     public void createVnfandConnectServiceInstance(GenericVnf vnf, ServiceInstance serviceInstance) {
-        AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId());
+        AAIResourceUri vnfURI =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId()));
         vnf.setOrchestrationStatus(OrchestrationStatus.INVENTORIED);
-        AAIResourceUri serviceInstanceURI =
-                AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance.getServiceInstanceId());
+        AAIResourceUri serviceInstanceURI = AAIUriFactory
+                .createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstance.getServiceInstanceId()));
         injectionHelper.getAaiClient().createIfNotExists(vnfURI, Optional.of(aaiObjectMapper.mapVnf(vnf)))
                 .connect(vnfURI, serviceInstanceURI);
     }
 
     public void createPlatformandConnectVnf(Platform platform, GenericVnf vnf) {
         AAIResourceUri platformURI =
-                AAIUriFactory.createResourceUri(AAIObjectType.PLATFORM, platform.getPlatformName());
-        AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId());
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().platform(platform.getPlatformName()));
+        AAIResourceUri vnfURI =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId()));
         injectionHelper.getAaiClient().createIfNotExists(platformURI, Optional.of(platform)).connect(vnfURI,
                 platformURI);
     }
 
     public void createLineOfBusinessandConnectVnf(LineOfBusiness lineOfBusiness, GenericVnf vnf) {
-        AAIResourceUri lineOfBusinessURI =
-                AAIUriFactory.createResourceUri(AAIObjectType.LINE_OF_BUSINESS, lineOfBusiness.getLineOfBusinessName());
-        AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId());
+        AAIResourceUri lineOfBusinessURI = AAIUriFactory.createResourceUri(
+                AAIFluentTypeBuilder.business().lineOfBusiness(lineOfBusiness.getLineOfBusinessName()));
+        AAIResourceUri vnfURI =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId()));
         injectionHelper.getAaiClient().createIfNotExists(lineOfBusinessURI, Optional.of(lineOfBusiness)).connect(vnfURI,
                 lineOfBusinessURI);
     }
 
     public void deleteVnf(GenericVnf vnf) {
-        AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId());
+        AAIResourceUri vnfURI =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId()));
         injectionHelper.getAaiClient().delete(vnfURI);
     }
 
     public void updateOrchestrationStatusVnf(GenericVnf vnf, OrchestrationStatus orchestrationStatus) {
-        AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId());
+        AAIResourceUri vnfURI =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId()));
 
         GenericVnf copiedVnf = vnf.shallowCopyId();
 
@@ -97,7 +102,8 @@ public class AAIVnfResources {
     }
 
     public void updateObjectVnf(GenericVnf vnf) {
-        AAIResourceUri vnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId());
+        AAIResourceUri vnfUri =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId()));
         injectionHelper.getAaiClient().update(vnfUri, aaiObjectMapper.mapVnf(vnf));
     }
 
@@ -109,7 +115,7 @@ public class AAIVnfResources {
      */
     public Optional<org.onap.aai.domain.yang.GenericVnf> getGenericVnf(String vnfId) {
         return injectionHelper.getAaiClient().get(org.onap.aai.domain.yang.GenericVnf.class,
-                AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId));
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)));
     }
 
     /**
@@ -121,29 +127,32 @@ public class AAIVnfResources {
     public boolean checkInMaintFlag(String vnfId) {
         org.onap.aai.domain.yang.GenericVnf vnf = injectionHelper.getAaiClient()
                 .get(org.onap.aai.domain.yang.GenericVnf.class,
-                        AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId))
+                        AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)))
                 .orElse(new org.onap.aai.domain.yang.GenericVnf());
         return vnf.isInMaint();
     }
 
     public void connectVnfToCloudRegion(GenericVnf vnf, CloudRegion cloudRegion) {
-        AAIResourceUri cloudRegionURI = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION,
-                cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId());
-        AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId());
+        AAIResourceUri cloudRegionURI = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+                .cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId()));
+        AAIResourceUri vnfURI =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId()));
         injectionHelper.getAaiClient().connect(vnfURI, cloudRegionURI);
     }
 
     public void connectVnfToTenant(GenericVnf vnf, CloudRegion cloudRegion) {
-        AAIResourceUri tenantURI = AAIUriFactory.createResourceUri(AAIObjectType.TENANT, cloudRegion.getCloudOwner(),
-                cloudRegion.getLcpCloudRegionId(), cloudRegion.getTenantId());
-        AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId());
+        AAIResourceUri tenantURI = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+                .cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId())
+                .tenant(cloudRegion.getTenantId()));
+        AAIResourceUri vnfURI =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId()));
         injectionHelper.getAaiClient().connect(tenantURI, vnfURI);
     }
 
     public boolean checkVnfClosedLoopDisabledFlag(String vnfId) {
         org.onap.aai.domain.yang.GenericVnf vnf = injectionHelper.getAaiClient()
                 .get(org.onap.aai.domain.yang.GenericVnf.class,
-                        AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId))
+                        AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)))
                 .orElse(new org.onap.aai.domain.yang.GenericVnf());
         return vnf.isIsClosedLoopDisabled();
     }
@@ -151,7 +160,7 @@ public class AAIVnfResources {
     public boolean checkVnfPserversLockedFlag(String vnfId) throws IOException {
         org.onap.aai.domain.yang.GenericVnf vnf = injectionHelper.getAaiClient()
                 .get(org.onap.aai.domain.yang.GenericVnf.class,
-                        AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId))
+                        AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)))
                 .orElse(new org.onap.aai.domain.yang.GenericVnf());
         AAIRestClientImpl client = new AAIRestClientImpl();
         aaiValidatorImpl.setClient(client);
@@ -160,14 +169,14 @@ public class AAIVnfResources {
     }
 
     public boolean checkNameInUse(String vnfName) {
-        AAIPluralResourceUri vnfUri =
-                AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", vnfName);
+        AAIPluralResourceUri vnfUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnfs())
+                .queryParam("vnf-name", vnfName);
         return injectionHelper.getAaiClient().exists(vnfUri);
     }
 
     public AAIResultWrapper queryVnfWrapperById(GenericVnf vnf) {
-        AAIResourceUri uri =
-                AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId()).depth(Depth.ALL);
+        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId()))
+                .depth(Depth.ALL);
         return injectionHelper.getAaiClient().get(uri);
     }
 
index 886dafe..1fbfe8c 100644 (file)
 
 package org.onap.so.client.orchestration;
 
+import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
+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.InjectionHelper;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
-import org.onap.aaiclient.client.aai.AAIObjectPlurals;
-import org.onap.aaiclient.client.aai.AAIObjectType;
-import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
-import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
-import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
 import org.onap.so.client.aai.mapper.AAIObjectMapper;
 import org.onap.so.db.catalog.beans.OrchestrationStatus;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -46,16 +46,18 @@ public class AAIVolumeGroupResources {
     private AAIObjectMapper aaiObjectMapper;
 
     public void createVolumeGroup(VolumeGroup volumeGroup, CloudRegion cloudRegion) {
-        AAIResourceUri uriVolumeGroup = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP,
-                cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId());
+        AAIResourceUri uriVolumeGroup = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+                .cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId())
+                .volumeGroup(volumeGroup.getVolumeGroupId()));
         volumeGroup.setOrchestrationStatus(OrchestrationStatus.ASSIGNED);
         injectionHelper.getAaiClient().create(uriVolumeGroup, aaiObjectMapper.mapVolumeGroup(volumeGroup));
     }
 
     public void updateOrchestrationStatusVolumeGroup(VolumeGroup volumeGroup, CloudRegion cloudRegion,
             OrchestrationStatus orchestrationStatus) {
-        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, cloudRegion.getCloudOwner(),
-                cloudRegion.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId());
+        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+                .cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId())
+                .volumeGroup(volumeGroup.getVolumeGroupId()));
         VolumeGroup copiedVolumeGroup = volumeGroup.shallowCopyId();
 
         volumeGroup.setOrchestrationStatus(orchestrationStatus);
@@ -65,29 +67,34 @@ public class AAIVolumeGroupResources {
 
     public void connectVolumeGroupToVnf(GenericVnf genericVnf, VolumeGroup volumeGroup, CloudRegion cloudRegion) {
         AAIResourceUri uriGenericVnf =
-                AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, genericVnf.getVnfId());
-        AAIResourceUri uriVolumeGroup = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP,
-                cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId());
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(genericVnf.getVnfId()));
+        AAIResourceUri uriVolumeGroup = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+                .cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId())
+                .volumeGroup(volumeGroup.getVolumeGroupId()));
         injectionHelper.getAaiClient().connect(uriGenericVnf, uriVolumeGroup);
     }
 
     public void connectVolumeGroupToTenant(VolumeGroup volumeGroup, CloudRegion cloudRegion) {
-        AAIResourceUri uriTenant = AAIUriFactory.createResourceUri(AAIObjectType.TENANT, cloudRegion.getCloudOwner(),
-                cloudRegion.getLcpCloudRegionId(), cloudRegion.getTenantId());
-        AAIResourceUri uriVolumeGroup = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP,
-                cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId());
+        AAIResourceUri uriTenant = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+                .cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId())
+                .tenant(cloudRegion.getTenantId()));
+        AAIResourceUri uriVolumeGroup = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+                .cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId())
+                .volumeGroup(volumeGroup.getVolumeGroupId()));
         injectionHelper.getAaiClient().connect(uriTenant, uriVolumeGroup);
     }
 
     public void deleteVolumeGroup(VolumeGroup volumeGroup, CloudRegion cloudRegion) {
-        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, cloudRegion.getCloudOwner(),
-                cloudRegion.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId());
+        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+                .cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId())
+                .volumeGroup(volumeGroup.getVolumeGroupId()));
         injectionHelper.getAaiClient().delete(uri);
     }
 
     public void updateHeatStackIdVolumeGroup(VolumeGroup volumeGroup, CloudRegion cloudRegion) {
-        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, cloudRegion.getCloudOwner(),
-                cloudRegion.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId());
+        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+                .cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId())
+                .volumeGroup(volumeGroup.getVolumeGroupId()));
         VolumeGroup copiedVolumeGroup = volumeGroup.shallowCopyId();
 
         copiedVolumeGroup.setHeatStackId(volumeGroup.getHeatStackId());
@@ -95,7 +102,7 @@ public class AAIVolumeGroupResources {
     }
 
     public boolean checkNameInUse(VolumeGroup volumeGroup) {
-        AAIPluralResourceUri volumeGroupUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VOLUME_GROUP)
+        AAIPluralResourceUri volumeGroupUri = AAIUriFactory.createNodesUri(Types.VOLUME_GROUPS.getFragment())
                 .queryParam("volume-group-name", volumeGroup.getVolumeGroupName());
         return injectionHelper.getAaiClient().exists(volumeGroupUri);
     }
index 5ce8268..5200be9 100644 (file)
@@ -22,14 +22,13 @@ package org.onap.so.client.orchestration;
 
 import java.util.Optional;
 import org.onap.aai.domain.yang.VpnBindings;
-import org.onap.so.bpmn.common.InjectionHelper;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding;
-import org.onap.aaiclient.client.aai.AAIObjectPlurals;
-import org.onap.aaiclient.client.aai.AAIObjectType;
 import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
 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.so.bpmn.common.InjectionHelper;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding;
 import org.onap.so.client.aai.mapper.AAIObjectMapper;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
@@ -46,8 +45,8 @@ public class AAIVpnBindingResources {
      * @param customer
      */
     public boolean existsCustomer(Customer customer) {
-        AAIResourceUri uriCustomer =
-                AAIUriFactory.createResourceUri(AAIObjectType.CUSTOMER, customer.getGlobalCustomerId());
+        AAIResourceUri uriCustomer = AAIUriFactory
+                .createResourceUri(AAIFluentTypeBuilder.business().customer(customer.getGlobalCustomerId()));
         return injectionHelper.getAaiClient().exists(uriCustomer);
     }
 
@@ -56,8 +55,9 @@ public class AAIVpnBindingResources {
      * @return
      */
     public Optional<VpnBindings> getVpnBindingByCustomerVpnId(String customerVpnId) {
-        AAIPluralResourceUri aaiVpnBindingsResourceUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VPN_BINDING)
-                .queryParam("customer-vpn-id", customerVpnId);
+        AAIPluralResourceUri aaiVpnBindingsResourceUri =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().vpnBindings())
+                        .queryParam("customer-vpn-id", customerVpnId);
         return injectionHelper.getAaiClient().get(VpnBindings.class, aaiVpnBindingsResourceUri);
 
     }
@@ -67,7 +67,7 @@ public class AAIVpnBindingResources {
      */
     public void createVpnBinding(VpnBinding vpnBinding) {
         AAIResourceUri aaiVpnBindingResourceUri =
-                AAIUriFactory.createResourceUri(AAIObjectType.VPN_BINDING, vpnBinding.getVpnId());
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().vpnBinding(vpnBinding.getVpnId()));
         injectionHelper.getAaiClient().create(aaiVpnBindingResourceUri, aaiObjectMapper.mapVpnBinding(vpnBinding));
     }
 
@@ -75,8 +75,8 @@ public class AAIVpnBindingResources {
      * @param customer
      */
     public void createCustomer(Customer customer) {
-        AAIResourceUri uriCustomer =
-                AAIUriFactory.createResourceUri(AAIObjectType.CUSTOMER, customer.getGlobalCustomerId());
+        AAIResourceUri uriCustomer = AAIUriFactory
+                .createResourceUri(AAIFluentTypeBuilder.business().customer(customer.getGlobalCustomerId()));
         injectionHelper.getAaiClient().create(uriCustomer, aaiObjectMapper.mapCustomer(customer));
     }
 
@@ -88,7 +88,7 @@ public class AAIVpnBindingResources {
      */
     public Optional<org.onap.aai.domain.yang.VpnBinding> getVpnBinding(String vpnId) {
         return injectionHelper.getAaiClient().get(org.onap.aai.domain.yang.VpnBinding.class,
-                AAIUriFactory.createResourceUri(AAIObjectType.VPN_BINDING, vpnId));
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().vpnBinding(vpnId)));
     }
 
 
@@ -97,8 +97,10 @@ public class AAIVpnBindingResources {
      * @param vpnId
      */
     public void connectCustomerToVpnBinding(String globalSubscriberId, String vpnId) {
-        AAIResourceUri customerURI = AAIUriFactory.createResourceUri(AAIObjectType.CUSTOMER, globalSubscriberId);
-        AAIResourceUri vpnBindingURI = AAIUriFactory.createResourceUri(AAIObjectType.VPN_BINDING, vpnId);
+        AAIResourceUri customerURI =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId));
+        AAIResourceUri vpnBindingURI =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().vpnBinding(vpnId));
         injectionHelper.getAaiClient().connect(customerURI, vpnBindingURI);
     }
 }
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/service/level/impl/ServiceLevelUpgradeTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/service/level/impl/ServiceLevelUpgradeTest.java
new file mode 100644 (file)
index 0000000..67f08f7
--- /dev/null
@@ -0,0 +1,66 @@
+/*-
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2020 Nokia
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.service.level.impl;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake;
+import org.junit.Test;
+
+public class ServiceLevelUpgradeTest {
+
+    @Test
+    public void ServiceLevelUpgradeWithPnf() throws Exception {
+        // given
+        ServiceLevelUpgrade testedObject = new ServiceLevelUpgrade();
+        DelegateExecution execution = prepareExecution();
+        execution.setVariable(ServiceLevelConstants.RESOURCE_TYPE, "pnf");
+        // when
+        testedObject.execute(execution);
+        // then
+        assertThat(execution.getVariable(ServiceLevelConstants.SOFTWARE_WORKFLOW_TO_INVOKE))
+                .isEqualTo("GenericPnfSoftwareUpgrade");
+        assertThat(execution.getVariable(ServiceLevelConstants.CONTROLLER_STATUS)).isEqualTo("");
+    }
+
+    @Test
+    public void ServiceLevelUpgradeWithVnf() throws Exception {
+        // given
+        ServiceLevelUpgrade testedObject = new ServiceLevelUpgrade();
+        DelegateExecution execution = prepareExecution();
+        execution.setVariable(ServiceLevelConstants.RESOURCE_TYPE, "vnf");
+        // when
+        testedObject.execute(execution);
+        // then
+        assertThat(execution.getVariable(ServiceLevelConstants.SOFTWARE_WORKFLOW_TO_INVOKE))
+                .isEqualTo("GenericVnfSoftwareUpgrade");
+        assertThat(execution.getVariable(ServiceLevelConstants.CONTROLLER_STATUS)).isEqualTo("");
+    }
+
+    private DelegateExecution prepareExecution() {
+        DelegateExecution execution = new DelegateExecutionFake();
+        execution.setVariable(ServiceLevelConstants.SERVICE_INSTANCE_ID, "serviceTest");
+        execution.setVariable(ServiceLevelConstants.BPMN_REQUEST, "bpmnRequestTest");
+        execution.setVariable(ServiceLevelConstants.PNF_NAME, "pnfNameTest");
+        return execution;
+    }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/vfmodule/DeleteVfModuleTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/vfmodule/DeleteVfModuleTest.java
new file mode 100644 (file)
index 0000000..60a0bf1
--- /dev/null
@@ -0,0 +1,125 @@
+/*-
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2020 Nokia
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.vfmodule;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.when;
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.common.DelegateExecutionImpl;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Tenant;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
+import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.exception.BBObjectNotFoundException;
+import org.onap.so.cloud.resource.beans.CloudInformation;
+
+@RunWith(MockitoJUnitRunner.class)
+public class DeleteVfModuleTest {
+
+    private static final String VF_MODULE_ID = "vfModuleIdTest";
+    private static final String HEAT_STACK_ID = "hsId";
+    private static final String VNF_ID = "vnfId";
+    private static final String VNF_NAME = "vnfName";
+
+    private static final String CLOUD_OWNER = "cloudOwTest";
+    private static final String LCP_CLOUD_REGION_ID = "lcpClRegTest";
+    private static final String TENANT_ID = "tenantIdTest";
+    private static final String TENANT_NAME = "tenantNameTest";
+    private static final String TENANT_CONTEXT = "tenantContext";
+
+    @Mock
+    private ExtractPojosForBB extractPojosForBB;
+
+    @InjectMocks
+    private DeleteVFModule testedObject;
+
+    @Test
+    public void createInventoryVariable_Success() throws BBObjectNotFoundException {
+        // given
+        BuildingBlockExecution buildingBlockExecution = prepareBuildingBlockExecution();
+        when(extractPojosForBB.extractByKey(buildingBlockExecution, ResourceKey.VF_MODULE_ID))
+                .thenReturn(prepareVmModule());
+        when(extractPojosForBB.extractByKey(buildingBlockExecution, ResourceKey.GENERIC_VNF_ID))
+                .thenReturn(prepareGenericVnf());
+        // when
+        testedObject.createInventoryVariable(buildingBlockExecution);
+        // then
+        verifyExecution(buildingBlockExecution);
+    }
+
+    private void verifyExecution(BuildingBlockExecution buildingBlockExecution) {
+        CloudInformation cloudInformation = buildingBlockExecution.getVariable("cloudInformation");
+        assertThat(cloudInformation.getOwner()).isEqualTo(CLOUD_OWNER);
+        assertThat(cloudInformation.getRegionId()).isEqualTo(LCP_CLOUD_REGION_ID);
+        assertThat(cloudInformation.getTenantId()).isEqualTo(TENANT_ID);
+        assertThat(cloudInformation.getTenantName()).isEqualTo(TENANT_NAME);
+        assertThat(cloudInformation.getTenantContext()).isEqualTo(TENANT_CONTEXT);
+        assertThat(cloudInformation.getTemplateInstanceId()).isEqualTo(HEAT_STACK_ID);
+
+        assertThat(cloudInformation.getVnfId()).isEqualTo(VNF_ID);
+        assertThat(cloudInformation.getVnfName()).isEqualTo(VNF_NAME);
+        assertThat(cloudInformation.getVfModuleId()).isEqualTo(VF_MODULE_ID);
+    }
+
+    private BuildingBlockExecution prepareBuildingBlockExecution() {
+        DelegateExecution execution = new DelegateExecutionFake();
+        execution.setVariable("gBBInput", prepareGeneralBuildingBlock());
+        return new DelegateExecutionImpl(execution);
+    }
+
+    private GeneralBuildingBlock prepareGeneralBuildingBlock() {
+        GeneralBuildingBlock generalBuildingBlock = new GeneralBuildingBlock();
+        CloudRegion cloudRegion = new CloudRegion();
+        cloudRegion.setCloudOwner(CLOUD_OWNER);
+        cloudRegion.setLcpCloudRegionId(LCP_CLOUD_REGION_ID);
+        generalBuildingBlock.setCloudRegion(cloudRegion);
+        Tenant tenant = new Tenant();
+        tenant.setTenantId(TENANT_ID);
+        tenant.setTenantName(TENANT_NAME);
+        tenant.setTenantContext(TENANT_CONTEXT);
+        generalBuildingBlock.setTenant(tenant);
+        return generalBuildingBlock;
+    }
+
+    private VfModule prepareVmModule() {
+        VfModule vfModule = new VfModule();
+        vfModule.setVfModuleId(VF_MODULE_ID);
+        vfModule.setHeatStackId(HEAT_STACK_ID);
+        return vfModule;
+    }
+
+    private GenericVnf prepareGenericVnf() {
+        GenericVnf genericVnf = new GenericVnf();
+        genericVnf.setVnfId(VNF_ID);
+        genericVnf.setVnfName(VNF_NAME);
+        return genericVnf;
+    }
+}
index d9fb7f6..7f9f041 100644 (file)
@@ -41,10 +41,10 @@ import org.onap.aai.domain.yang.RouteTargets;
 import org.onap.aai.domain.yang.Subnet;
 import org.onap.aai.domain.yang.Subnets;
 import org.onap.aai.domain.yang.VpnBinding;
-import org.onap.so.bpmn.BaseTaskTest;
-import org.onap.aaiclient.client.aai.AAIObjectType;
 import org.onap.aaiclient.client.aai.entities.AAIResultWrapper;
 import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types;
+import org.onap.so.bpmn.BaseTaskTest;
 import org.onap.so.db.catalog.beans.ConfigurationResourceCustomization;
 import org.onap.so.db.catalog.beans.Service;
 import org.onap.so.db.catalog.beans.ServiceProxyResourceCustomization;
@@ -205,7 +205,7 @@ public class VrfValidationTest extends BaseTaskTest {
         AAIResultWrapper networkWrapper = new AAIResultWrapper(l3Network);
         if (networkWrapper.getRelationships().isPresent()) {
             List<AAIResourceUri> vpnBindingUris =
-                    networkWrapper.getRelationships().get().getRelatedUris(AAIObjectType.VPN_BINDING);
+                    networkWrapper.getRelationships().get().getRelatedUris(Types.VPN_BINDING);
             VpnBinding vpnBinding = new VpnBinding();
             vpnBinding.setRouteTargets(new RouteTargets());
             vpnBinding.getRouteTargets().getRouteTarget().add(new RouteTarget());
index c1970ec..53d1bea 100644 (file)
@@ -39,7 +39,6 @@ import static org.mockito.ArgumentMatchers.anyObject;
 import static org.mockito.ArgumentMatchers.anyString;
 import static org.mockito.ArgumentMatchers.eq;
 import static org.mockito.ArgumentMatchers.isA;
-import static org.mockito.Mockito.doAnswer;
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.doThrow;
 import static org.mockito.Mockito.when;
@@ -78,12 +77,12 @@ import org.onap.aai.domain.yang.ServiceInstances;
 import org.onap.aai.domain.yang.VfModule;
 import org.onap.aai.domain.yang.VfModules;
 import org.onap.aai.domain.yang.VolumeGroup;
-import org.onap.aaiclient.client.aai.AAIObjectType;
 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.so.bpmn.BaseTaskTest;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
@@ -1584,11 +1583,11 @@ public class WorkflowActionTest extends BaseTaskTest {
 
         when(bbSetupUtils.getAAIVfModule(any(), any())).thenReturn(vfModule);
         doReturn(vnfcs).when(SPY_workflowAction).getRelatedResourcesInVfModule(any(), any(),
-                eq(org.onap.aai.domain.yang.Vnfc.class), eq(AAIObjectType.VNFC));
+                eq(org.onap.aai.domain.yang.Vnfc.class), eq(Types.VNFC));
         doReturn(config1).when(SPY_workflowAction).getRelatedResourcesInVnfc(eq(vnfc1),
-                eq(org.onap.aai.domain.yang.Configuration.class), eq(AAIObjectType.CONFIGURATION));
+                eq(org.onap.aai.domain.yang.Configuration.class), eq(Types.CONFIGURATION));
         doReturn(config2).when(SPY_workflowAction).getRelatedResourcesInVnfc(eq(vnfc2),
-                eq(org.onap.aai.domain.yang.Configuration.class), eq(AAIObjectType.CONFIGURATION));
+                eq(org.onap.aai.domain.yang.Configuration.class), eq(Types.CONFIGURATION));
 
         List<ExecuteBuildingBlock> results = SPY_workflowAction.getConfigBuildingBlocks(dataObj);
 
@@ -1659,11 +1658,11 @@ public class WorkflowActionTest extends BaseTaskTest {
 
         when(bbSetupUtils.getAAIVfModule(any(), any())).thenReturn(vfModule);
         doReturn(vnfcs).when(SPY_workflowAction).getRelatedResourcesInVfModule(any(), any(),
-                eq(org.onap.aai.domain.yang.Vnfc.class), eq(AAIObjectType.VNFC));
+                eq(org.onap.aai.domain.yang.Vnfc.class), eq(Types.VNFC));
         doReturn(config1).when(SPY_workflowAction).getRelatedResourcesInVnfc(eq(vnfc1),
-                eq(org.onap.aai.domain.yang.Configuration.class), eq(AAIObjectType.CONFIGURATION));
+                eq(org.onap.aai.domain.yang.Configuration.class), eq(Types.CONFIGURATION));
         doReturn(config2).when(SPY_workflowAction).getRelatedResourcesInVnfc(eq(vnfc2),
-                eq(org.onap.aai.domain.yang.Configuration.class), eq(AAIObjectType.CONFIGURATION));
+                eq(org.onap.aai.domain.yang.Configuration.class), eq(Types.CONFIGURATION));
 
         List<ExecuteBuildingBlock> results = SPY_workflowAction.getConfigBuildingBlocks(dataObj);
 
@@ -1763,13 +1762,13 @@ public class WorkflowActionTest extends BaseTaskTest {
         List<AAIResultWrapper> configurationResultWrappers = new ArrayList<AAIResultWrapper>();
         configurationResultWrappers.add(configurationWrapper);
 
-        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VNFC, vnfc.getVnfcName());
+        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().vnfc(vnfc.getVnfcName()));
         when(bbSetupUtils.getAAIResourceDepthOne(uri)).thenReturn(vfncWrapper);
 
         doReturn(configurationResultWrappers).when(SPY_workflowAction).getResultWrappersFromRelationships(anyObject(),
                 anyObject());
         org.onap.aai.domain.yang.Configuration configuration = SPY_workflowAction.getRelatedResourcesInVnfc(vnfc,
-                org.onap.aai.domain.yang.Configuration.class, AAIObjectType.CONFIGURATION);
+                org.onap.aai.domain.yang.Configuration.class, Types.CONFIGURATION);
         assertEquals("testConfigurationId", configuration.getConfigurationId());
     }
 
index 2c7ab92..fcd44e1 100644 (file)
@@ -28,18 +28,11 @@ import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
 import org.junit.Before;
 import org.junit.Test;
-import org.junit.runner.RunWith;
 import org.mockito.InjectMocks;
-import org.mockito.Mock;
-import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
 import org.onap.so.bpmn.BaseTaskTest;
-import org.onap.so.bpmn.common.InjectionHelper;
-import org.onap.so.bpmn.common.data.TestDataSetup;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection;
-import org.onap.aaiclient.client.aai.AAIObjectType;
-import org.onap.aaiclient.client.aai.AAIResourcesClient;
-import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
-import org.onap.so.client.aai.mapper.AAIObjectMapper;
 import org.onap.so.db.catalog.beans.OrchestrationStatus;
 
 public class AAICollectionResourcesTest extends BaseTaskTest {
@@ -65,7 +58,8 @@ public class AAICollectionResourcesTest extends BaseTaskTest {
 
         assertEquals(OrchestrationStatus.INVENTORIED, networkCollection.getOrchestrationStatus());
         verify(MOCK_aaiResourcesClient, times(1)).create(
-                eq(AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, networkCollection.getId())),
+                eq(AAIUriFactory
+                        .createResourceUri(AAIFluentTypeBuilder.network().collection(networkCollection.getId()))),
                 isA(org.onap.aai.domain.yang.Collection.class));
     }
 
@@ -74,15 +68,16 @@ public class AAICollectionResourcesTest extends BaseTaskTest {
         doReturn(new org.onap.aai.domain.yang.Collection()).when(MOCK_aaiObjectMapper).mapCollection(networkCollection);
         aaiCollectionResources.updateCollection(networkCollection);
         verify(MOCK_aaiResourcesClient, times(1)).update(
-                eq(AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, networkCollection.getId())),
+                eq(AAIUriFactory
+                        .createResourceUri(AAIFluentTypeBuilder.network().collection(networkCollection.getId()))),
                 isA(org.onap.aai.domain.yang.Collection.class));
     }
 
     @Test
     public void deleteCollectionTest() throws Exception {
         aaiCollectionResources.deleteCollection(networkCollection);
-        verify(MOCK_aaiResourcesClient, times(1))
-                .delete(eq(AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, networkCollection.getId())));
+        verify(MOCK_aaiResourcesClient, times(1)).delete(eq(
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().collection(networkCollection.getId()))));
     }
 
 }
index 2bf177e..11694ff 100644 (file)
@@ -35,6 +35,11 @@ import org.mockito.ArgumentMatchers;
 import org.mockito.InjectMocks;
 import org.mockito.Mock;
 import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.aaiclient.client.aai.AAIResourcesClient;
+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;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
 import org.onap.so.bpmn.common.InjectionHelper;
 import org.onap.so.bpmn.common.data.TestDataSetup;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
@@ -44,11 +49,6 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceProxy;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding;
-import org.onap.aaiclient.client.aai.AAIObjectType;
-import org.onap.aaiclient.client.aai.AAIResourcesClient;
-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;
 import org.onap.so.client.aai.mapper.AAIObjectMapper;
 import org.onap.so.db.catalog.beans.OrchestrationStatus;
 
@@ -204,7 +204,8 @@ public class AAIConfigurationResourcesTest extends TestDataSetup {
 
     @Test
     public void getConfigurationTest() {
-        AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, "configurationId");
+        AAIResourceUri aaiResourceUri =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().configuration("configurationId"));
         doReturn(Optional.of(new org.onap.aai.domain.yang.Configuration())).when(MOCK_aaiResourcesClient)
                 .get(org.onap.aai.domain.yang.Configuration.class, aaiResourceUri);
         aaiConfigurationResources.getConfiguration("configurationId");
@@ -213,7 +214,8 @@ public class AAIConfigurationResourcesTest extends TestDataSetup {
 
     @Test
     public void deleteConfigurationTest() {
-        AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, "configurationId");
+        AAIResourceUri aaiResourceUri =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().configuration("configurationId"));
         doNothing().when(MOCK_aaiResourcesClient).delete(aaiResourceUri);
         aaiConfigurationResources.deleteConfiguration("configurationId");
         verify(MOCK_aaiResourcesClient, times(1)).delete(aaiResourceUri);
index a73cf81..b2978e6 100644 (file)
@@ -36,18 +36,17 @@ import org.junit.runner.RunWith;
 import org.mockito.InjectMocks;
 import org.mockito.Mock;
 import org.mockito.junit.MockitoJUnitRunner;
-import org.onap.so.bpmn.common.InjectionHelper;
-import org.onap.so.bpmn.common.data.TestDataSetup;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
-import org.onap.aaiclient.client.aai.AAIObjectPlurals;
-import org.onap.aaiclient.client.aai.AAIObjectType;
 import org.onap.aaiclient.client.aai.AAIResourcesClient;
 import org.onap.aaiclient.client.aai.entities.AAIEdgeLabel;
 import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
 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.so.bpmn.common.InjectionHelper;
+import org.onap.so.bpmn.common.data.TestDataSetup;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
 import org.onap.so.client.aai.mapper.AAIObjectMapper;
 
 @RunWith(MockitoJUnitRunner.Silent.class)
@@ -83,39 +82,42 @@ public class AAIInstanceGroupResourcesTest extends TestDataSetup {
                 .mapInstanceGroup(instanceGroup);
         aaiInstanceGroupResources.createInstanceGroup(instanceGroup);
         verify(MOCK_aaiResourcesClient, times(1)).createIfNotExists(
-                eq(AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId())),
+                eq(AAIUriFactory
+                        .createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroup.getId()))),
                 isA(Optional.class));
     }
 
     @Test
     public void deleteInstanceGroupTest() throws Exception {
         aaiInstanceGroupResources.deleteInstanceGroup(instanceGroup);
-        verify(MOCK_aaiResourcesClient, times(1))
-                .delete(eq(AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId())));
+        verify(MOCK_aaiResourcesClient, times(1)).delete(eq(
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroup.getId()))));
     }
 
     @Test
     public void connectInstanceGroupTest() throws Exception {
         aaiInstanceGroupResources.connectInstanceGroupToVnf(instanceGroup, vnf);
         verify(MOCK_aaiResourcesClient, times(1)).connect(
-                eq(AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId())),
-                eq(AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId())));
+                eq(AAIUriFactory
+                        .createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroup.getId()))),
+                eq(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId()))));
     }
 
     @Test
     public void connectInstanceGroupWithEdgeTest() throws Exception {
         aaiInstanceGroupResources.connectInstanceGroupToVnf(instanceGroup, vnf, AAIEdgeLabel.BELONGS_TO);
         verify(MOCK_aaiResourcesClient, times(1)).connect(
-                eq(AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId())),
-                eq(AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId())),
+                eq(AAIUriFactory
+                        .createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroup.getId()))),
+                eq(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnf.getVnfId()))),
                 eq(AAIEdgeLabel.BELONGS_TO));
     }
 
     @Test
     public void existsTest() throws Exception {
         aaiInstanceGroupResources.exists(instanceGroup);
-        verify(MOCK_aaiResourcesClient, times(1))
-                .exists(eq(AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId())));
+        verify(MOCK_aaiResourcesClient, times(1)).exists(eq(
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroup.getId()))));
     }
 
     @Test
@@ -135,7 +137,7 @@ public class AAIInstanceGroupResourcesTest extends TestDataSetup {
 
     @Test
     public void checkInstanceGroupNameInUseTrueTest() throws Exception {
-        AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.INSTANCE_GROUP)
+        AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().instanceGroups())
                 .queryParam("instance-group-name", "instanceGroupName");
         doReturn(true).when(MOCK_aaiResourcesClient).exists(eq(uri));
         boolean nameInUse = aaiInstanceGroupResources.checkInstanceGroupNameInUse("instanceGroupName");
@@ -144,7 +146,7 @@ public class AAIInstanceGroupResourcesTest extends TestDataSetup {
 
     @Test
     public void checkInstanceGroupNameInUseFalseTest() throws Exception {
-        AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.INSTANCE_GROUP)
+        AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().instanceGroups())
                 .queryParam("instance-group-name", "instanceGroupName");
         doReturn(false).when(MOCK_aaiResourcesClient).exists(eq(uri));
         boolean nameInUse = aaiInstanceGroupResources.checkInstanceGroupNameInUse("instanceGroupName");
index 3bc4fc0..535a159 100644 (file)
@@ -46,6 +46,14 @@ import org.mockito.Mock;
 import org.mockito.junit.MockitoJUnitRunner;
 import org.onap.aai.domain.yang.RouteTableReference;
 import org.onap.aai.domain.yang.VpnBinding;
+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.AAIPluralResourceUri;
+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.so.bpmn.common.InjectionHelper;
 import org.onap.so.bpmn.common.data.TestDataSetup;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
@@ -55,15 +63,6 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.NetworkPolicy;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet;
-import org.onap.aaiclient.client.aai.AAIObjectPlurals;
-import org.onap.aaiclient.client.aai.AAIObjectType;
-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.AAIPluralResourceUri;
-import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
-import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
 import org.onap.so.client.aai.mapper.AAIObjectMapper;
 import org.onap.so.db.catalog.beans.OrchestrationStatus;
 
@@ -167,7 +166,8 @@ public class AAINetworkResourcesTest extends TestDataSetup {
                 new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "queryAaiVpnBinding.json")));
         AAIResultWrapper aaiResultWrapper = new AAIResultWrapper(content);
         Optional<VpnBinding> oVpnBinding = Optional.empty();
-        AAIResourceUri aaiUri = AAIUriFactory.createResourceUri(AAIObjectType.VPN_BINDING, "ModelInvariantUUID");
+        AAIResourceUri aaiUri =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().vpnBinding("ModelInvariantUUID"));
 
         doReturn(aaiResultWrapper).when(MOCK_aaiResourcesClient).get(isA(AAIResourceUri.class));
         oVpnBinding = aaiNetworkResources.getVpnBinding(aaiUri);
@@ -186,7 +186,7 @@ public class AAINetworkResourcesTest extends TestDataSetup {
         AAIResultWrapper aaiResultWrapper = new AAIResultWrapper(content);
         Optional<org.onap.aai.domain.yang.NetworkPolicy> oNetPolicy = Optional.empty();
         AAIResourceUri netPolicyUri =
-                AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, "ModelInvariantUUID");
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().networkPolicy("ModelInvariantUUID"));
 
         doReturn(aaiResultWrapper).when(MOCK_aaiResourcesClient).get(isA(AAIResourceUri.class));
         oNetPolicy = aaiNetworkResources.getNetworkPolicy(netPolicyUri);
@@ -204,7 +204,8 @@ public class AAINetworkResourcesTest extends TestDataSetup {
                 new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "queryAaiNetworkPolicies.json")));
         AAIResultWrapper aaiResultWrapper = new AAIResultWrapper(content);
         Optional<org.onap.aai.domain.yang.NetworkPolicies> oNetPolicies = Optional.empty();
-        AAIPluralResourceUri netPoliciesUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY);
+        AAIPluralResourceUri netPoliciesUri =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().networkPolicies());
 
         doReturn(aaiResultWrapper).when(MOCK_aaiResourcesClient).get(isA(AAIPluralResourceUri.class));
         oNetPolicies = aaiNetworkResources.getNetworkPolicies(netPoliciesUri);
@@ -222,8 +223,8 @@ public class AAINetworkResourcesTest extends TestDataSetup {
                 new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "queryAaiNetworkTableRefs.json")));
         AAIResultWrapper aaiResultWrapper = new AAIResultWrapper(content);
         Optional<RouteTableReference> oRtref = Optional.empty();
-        AAIResourceUri rTRefUri =
-                AAIUriFactory.createResourceUri(AAIObjectType.ROUTE_TABLE_REFERENCE, "ModelInvariantUUID");
+        AAIResourceUri rTRefUri = AAIUriFactory
+                .createResourceUri(AAIFluentTypeBuilder.network().routeTableReference("ModelInvariantUUID"));
 
         doReturn(aaiResultWrapper).when(MOCK_aaiResourcesClient).get(isA(AAIResourceUri.class));
         oRtref = aaiNetworkResources.getRouteTable(rTRefUri);
@@ -310,41 +311,45 @@ public class AAINetworkResourcesTest extends TestDataSetup {
     public void connectNetworkToNetworkCollectionInstanceGroupTest() throws Exception {
         aaiNetworkResources.connectNetworkToNetworkCollectionInstanceGroup(network, instanceGroup);
         verify(MOCK_aaiResourcesClient, times(1)).connect(
-                eq(AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId())),
-                eq(AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, network.getNetworkId())));
+                eq(AAIUriFactory
+                        .createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroup.getId()))),
+                eq(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(network.getNetworkId()))));
     }
 
     @Test
     public void connectNetworkToNetworkCollectionServiceInstanceTest() throws Exception {
         aaiNetworkResources.connectNetworkToNetworkCollectionServiceInstance(network, serviceInstance);
         verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class),
-                eq(AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, network.getNetworkId())));
+                eq(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(network.getNetworkId()))));
     }
 
     @Test
     public void connectNetworkToCloudRegionTest() throws Exception {
         aaiNetworkResources.connectNetworkToCloudRegion(network, cloudRegion);
         verify(MOCK_aaiResourcesClient, times(1)).connect(
-                eq(AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, network.getNetworkId())),
-                eq(AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, cloudRegion.getCloudOwner(),
-                        cloudRegion.getLcpCloudRegionId())));
+                eq(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(network.getNetworkId()))),
+                eq(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+                        .cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId()))));
     }
 
     @Test
     public void connectNetworkToTenantTest() throws Exception {
         aaiNetworkResources.connectNetworkToTenant(network, cloudRegion);
         verify(MOCK_aaiResourcesClient, times(1)).connect(
-                eq(AAIUriFactory.createResourceUri(AAIObjectType.TENANT, cloudRegion.getCloudOwner(),
-                        cloudRegion.getLcpCloudRegionId(), cloudRegion.getTenantId())),
-                eq(AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, network.getNetworkId())));
+                eq(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+                        .cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId())
+                        .tenant(cloudRegion.getTenantId()))),
+                (eq(AAIUriFactory
+                        .createResourceUri(AAIFluentTypeBuilder.network().l3Network(network.getNetworkId())))));
     }
 
     @Test
     public void connectNetworkCollectionInstanceGroupToNetworkCollectionTest() throws Exception {
         aaiNetworkResources.connectNetworkCollectionInstanceGroupToNetworkCollection(instanceGroup, collection);
         verify(MOCK_aaiResourcesClient, times(1)).connect(
-                eq(AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, collection.getId())),
-                eq(AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId())));
+                eq(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().collection(collection.getId()))),
+                eq(AAIUriFactory
+                        .createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroup.getId()))));
     }
 
     @Test
@@ -384,9 +389,10 @@ public class AAINetworkResourcesTest extends TestDataSetup {
     public void connectInstanceGroupToCloudRegionTest() throws Exception {
         aaiNetworkResources.connectInstanceGroupToCloudRegion(instanceGroup, cloudRegion);
         verify(MOCK_aaiResourcesClient, times(1)).connect(
-                eq(AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId())),
-                eq(AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, cloudRegion.getCloudOwner(),
-                        cloudRegion.getLcpCloudRegionId())),
+                eq(AAIUriFactory
+                        .createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroup.getId()))),
+                eq(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+                        .cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId()))),
                 eq(AAIEdgeLabel.USES));
     }
 
@@ -396,8 +402,8 @@ public class AAINetworkResourcesTest extends TestDataSetup {
                 new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "aaiSubnetsMapped_to_aai.json")));
         AAIResultWrapper aaiResultWrapper = new AAIResultWrapper(content);
         Optional<org.onap.aai.domain.yang.Subnet> oSubnet = Optional.empty();
-        AAIResourceUri subnetUri =
-                AAIUriFactory.createResourceUri(AAIObjectType.SUBNET, "ModelInvariantUUID", "serviceModelVersionId");
+        AAIResourceUri subnetUri = AAIUriFactory.createResourceUri(
+                AAIFluentTypeBuilder.network().l3Network("ModelInvariantUUID").subnet("serviceModelVersionId"));
 
         doReturn(aaiResultWrapper).when(MOCK_aaiResourcesClient).get(isA(AAIResourceUri.class));
         oSubnet = aaiNetworkResources.getSubnet(subnetUri);
@@ -429,8 +435,8 @@ public class AAINetworkResourcesTest extends TestDataSetup {
 
     @Test
     public void checkInstanceGroupNameInUseTrueTest() throws Exception {
-        AAIPluralResourceUri uri =
-                AAIUriFactory.createResourceUri(AAIObjectPlurals.L3_NETWORK).queryParam("network-name", "networkName");
+        AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Networks())
+                .queryParam("network-name", "networkName");
         doReturn(true).when(MOCK_aaiResourcesClient).exists(eq(uri));
         boolean nameInUse = aaiNetworkResources.checkNetworkNameInUse("networkName");
         assertTrue(nameInUse);
@@ -438,8 +444,8 @@ public class AAINetworkResourcesTest extends TestDataSetup {
 
     @Test
     public void checkInstanceGroupNameInUseFalseTest() throws Exception {
-        AAIPluralResourceUri uri =
-                AAIUriFactory.createResourceUri(AAIObjectPlurals.L3_NETWORK).queryParam("network-name", "networkName");
+        AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Networks())
+                .queryParam("network-name", "networkName");
         doReturn(false).when(MOCK_aaiResourcesClient).exists(eq(uri));
         boolean nameInUse = aaiNetworkResources.checkNetworkNameInUse("networkName");
         assertFalse(nameInUse);
index b8be045..8547ea5 100644 (file)
@@ -32,25 +32,25 @@ import static org.mockito.Mockito.when;
 import java.io.File;
 import java.io.IOException;
 import java.util.Optional;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import joptsimple.internal.Strings;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.InjectMocks;
 import org.mockito.Mock;
 import org.mockito.junit.MockitoJUnitRunner;
-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.so.bpmn.common.InjectionHelper;
 import org.onap.so.bpmn.common.data.TestDataSetup;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
-import org.onap.aaiclient.client.aai.AAIResourcesClient;
-import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
 import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoPnf;
 import org.onap.so.client.aai.mapper.AAIObjectMapper;
 import org.onap.so.db.catalog.beans.OrchestrationStatus;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import joptsimple.internal.Strings;
 
 @RunWith(MockitoJUnitRunner.Silent.class)
 public class AAIPnfResourcesTest extends TestDataSetup {
@@ -118,7 +118,8 @@ public class AAIPnfResourcesTest extends TestDataSetup {
         Pnf pnfTest = createPnfWithDefaultName();
         org.onap.aai.domain.yang.Pnf pnfFromAai = createPnf(OrchestrationStatus.INVENTORIED.toString());
         when(injectionHelperMock.getAaiClient().get(org.onap.aai.domain.yang.Pnf.class,
-                AAIUriFactory.createResourceUri(AAIObjectType.PNF, PNF_NAME))).thenReturn(Optional.of(pnfFromAai));
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().pnf(PNF_NAME))))
+                        .thenReturn(Optional.of(pnfFromAai));
         // when
         testedObject.checkIfPnfExistsInAaiAndCanBeUsed(pnfTest);
         verify(aaiResourcesClientMock, times(1)).update(any(), any());
@@ -131,7 +132,8 @@ public class AAIPnfResourcesTest extends TestDataSetup {
         org.onap.aai.domain.yang.Pnf pnfFromAai = createPnf(null);
         pnfTest.setRole("test");
         when(injectionHelperMock.getAaiClient().get(org.onap.aai.domain.yang.Pnf.class,
-                AAIUriFactory.createResourceUri(AAIObjectType.PNF, PNF_NAME))).thenReturn(Optional.of(pnfFromAai));
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().pnf(PNF_NAME))))
+                        .thenReturn(Optional.of(pnfFromAai));
         // when
         testedObject.checkIfPnfExistsInAaiAndCanBeUsed(pnfTest);
         verify(aaiResourcesClientMock, times(1)).update(any(), eq(pnfFromAai));
@@ -143,7 +145,8 @@ public class AAIPnfResourcesTest extends TestDataSetup {
         org.onap.aai.domain.yang.Pnf pnfFromAai = createPnf(null);
         Pnf pnfTest = getPnfWithTestValues();
         when(injectionHelperMock.getAaiClient().get(org.onap.aai.domain.yang.Pnf.class,
-                AAIUriFactory.createResourceUri(AAIObjectType.PNF, PNF_NAME))).thenReturn(Optional.of(pnfFromAai));
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().pnf(PNF_NAME))))
+                        .thenReturn(Optional.of(pnfFromAai));
         // when
         testedObject.checkIfPnfExistsInAaiAndCanBeUsed(pnfTest);
         verify(aaiResourcesClientMock, times(1)).update(any(), eq(pnfFromAai));
@@ -181,7 +184,8 @@ public class AAIPnfResourcesTest extends TestDataSetup {
         Pnf pnfTest = createPnfWithDefaultName();
         org.onap.aai.domain.yang.Pnf pnfFromAai = createPnf(Strings.EMPTY);
         when(injectionHelperMock.getAaiClient().get(org.onap.aai.domain.yang.Pnf.class,
-                AAIUriFactory.createResourceUri(AAIObjectType.PNF, PNF_NAME))).thenReturn(Optional.of(pnfFromAai));
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().pnf(PNF_NAME))))
+                        .thenReturn(Optional.of(pnfFromAai));
         // when
         testedObject.checkIfPnfExistsInAaiAndCanBeUsed(pnfTest);
     }
@@ -192,7 +196,8 @@ public class AAIPnfResourcesTest extends TestDataSetup {
         Pnf pnfTest = createPnfWithDefaultName();
         org.onap.aai.domain.yang.Pnf pnfFromAai = createPnf(OrchestrationStatus.ACTIVE.toString());
         when(injectionHelperMock.getAaiClient().get(org.onap.aai.domain.yang.Pnf.class,
-                AAIUriFactory.createResourceUri(AAIObjectType.PNF, PNF_NAME))).thenReturn(Optional.of(pnfFromAai));
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().pnf(PNF_NAME))))
+                        .thenReturn(Optional.of(pnfFromAai));
         // when
         try {
             testedObject.checkIfPnfExistsInAaiAndCanBeUsed(pnfTest);
@@ -216,7 +221,8 @@ public class AAIPnfResourcesTest extends TestDataSetup {
         org.onap.aai.domain.yang.Pnf pnfFromAai =
                 new ObjectMapper().readValue(new File(path), org.onap.aai.domain.yang.Pnf.class);
         when(injectionHelperMock.getAaiClient().get(org.onap.aai.domain.yang.Pnf.class,
-                AAIUriFactory.createResourceUri(AAIObjectType.PNF, PNF_NAME))).thenReturn(Optional.of(pnfFromAai));
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().pnf(PNF_NAME))))
+                        .thenReturn(Optional.of(pnfFromAai));
         // when
         try {
             testedObject.checkIfPnfExistsInAaiAndCanBeUsed(pnfTest);
index 9f9ac88..8ccb462 100644 (file)
@@ -39,6 +39,11 @@ import org.junit.runner.RunWith;
 import org.mockito.InjectMocks;
 import org.mockito.Mock;
 import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.aaiclient.client.aai.AAIResourcesClient;
+import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
+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.Types;
 import org.onap.so.bpmn.common.InjectionHelper;
 import org.onap.so.bpmn.common.data.TestDataSetup;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
@@ -46,11 +51,6 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.OwningEntity;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.Project;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription;
-import org.onap.aaiclient.client.aai.AAIObjectPlurals;
-import org.onap.aaiclient.client.aai.AAIResourcesClient;
-import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
-import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
-import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
 import org.onap.so.client.aai.mapper.AAIObjectMapper;
 import org.onap.so.db.catalog.beans.OrchestrationStatus;
 
@@ -195,7 +195,7 @@ public class AAIServiceInstanceResourcesTest extends TestDataSetup {
 
     @Test
     public void checkInstanceServiceNameInUseTrueTest() throws Exception {
-        AAIPluralResourceUri uri = AAIUriFactory.createNodesUri(AAIObjectPlurals.SERVICE_INSTANCE)
+        AAIPluralResourceUri uri = AAIUriFactory.createNodesUri(Types.SERVICE_INSTANCES.getFragment())
                 .queryParam("service-instance-name", serviceInstance.getServiceInstanceName());
         doReturn(true).when(MOCK_aaiResourcesClient).exists(eq(uri));
         boolean nameInUse = aaiServiceInstanceResources.checkInstanceServiceNameInUse(serviceInstance);
@@ -204,7 +204,7 @@ public class AAIServiceInstanceResourcesTest extends TestDataSetup {
 
     @Test
     public void checkInstanceServiceNameInUseFalseTest() throws Exception {
-        AAIPluralResourceUri uri = AAIUriFactory.createNodesUri(AAIObjectPlurals.SERVICE_INSTANCE)
+        AAIPluralResourceUri uri = AAIUriFactory.createNodesUri(Types.SERVICE_INSTANCES.getFragment())
                 .queryParam("service-instance-name", serviceInstance.getServiceInstanceName());
         doReturn(false).when(MOCK_aaiResourcesClient).exists(eq(uri));
         boolean nameInUse = aaiServiceInstanceResources.checkInstanceServiceNameInUse(serviceInstance);
index 3dbacd2..7cc6282 100644 (file)
@@ -38,17 +38,17 @@ import org.mockito.ArgumentMatchers;
 import org.mockito.InjectMocks;
 import org.mockito.Mock;
 import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.aaiclient.client.aai.AAIResourcesClient;
+import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
+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.Types;
 import org.onap.so.bpmn.common.InjectionHelper;
 import org.onap.so.bpmn.common.data.TestDataSetup;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
-import org.onap.aaiclient.client.aai.AAIObjectPlurals;
-import org.onap.aaiclient.client.aai.AAIResourcesClient;
-import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
-import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
-import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
 import org.onap.so.client.aai.mapper.AAIObjectMapper;
 import org.onap.so.db.catalog.beans.OrchestrationStatus;
 
@@ -163,7 +163,7 @@ public class AAIVfModuleResourcesTest extends TestDataSetup {
 
     @Test
     public void checkNameInUseTrueTest() throws Exception {
-        AAIPluralResourceUri vfModuleUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VF_MODULE)
+        AAIPluralResourceUri vfModuleUri = AAIUriFactory.createNodesUri(Types.VF_MODULES.getFragment())
                 .queryParam("vf-module-name", vfModule.getVfModuleName());
         AAIPluralResourceUri vfModuleUriWithCustomization = vfModuleUri.clone().queryParam("model-customization-id",
                 vfModule.getModelInfoVfModule().getModelCustomizationUUID());
@@ -175,7 +175,7 @@ public class AAIVfModuleResourcesTest extends TestDataSetup {
 
     @Test
     public void checkNameInUseFalseIsResumeTest() throws Exception {
-        AAIPluralResourceUri vfModuleUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VF_MODULE)
+        AAIPluralResourceUri vfModuleUri = AAIUriFactory.createNodesUri(Types.VF_MODULES.getFragment())
                 .queryParam("vf-module-name", vfModule.getVfModuleName());
         AAIPluralResourceUri vfModuleUriWithCustomization = vfModuleUri.clone().queryParam("model-customization-id",
                 vfModule.getModelInfoVfModule().getModelCustomizationUUID());
@@ -186,7 +186,7 @@ public class AAIVfModuleResourcesTest extends TestDataSetup {
 
     @Test
     public void checkNameInUseFalseTest() throws Exception {
-        AAIPluralResourceUri vfModuleUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VF_MODULE)
+        AAIPluralResourceUri vfModuleUri = AAIUriFactory.createNodesUri(Types.VF_MODULES.getFragment())
                 .queryParam("vf-module-name", vfModule.getVfModuleName());
         AAIPluralResourceUri vfModuleUriWithCustomization = vfModuleUri.clone().queryParam("model-customization-id",
                 vfModule.getModelInfoVfModule().getModelCustomizationUUID());
index 7750c8a..bdde1a1 100644 (file)
@@ -43,15 +43,6 @@ import org.mockito.ArgumentMatchers;
 import org.mockito.InjectMocks;
 import org.mockito.Mock;
 import org.mockito.junit.MockitoJUnitRunner;
-import org.onap.so.bpmn.common.InjectionHelper;
-import org.onap.so.bpmn.common.data.TestDataSetup;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
-import org.onap.aaiclient.client.aai.AAIObjectPlurals;
-import org.onap.aaiclient.client.aai.AAIObjectType;
 import org.onap.aaiclient.client.aai.AAIResourcesClient;
 import org.onap.aaiclient.client.aai.AAIRestClientImpl;
 import org.onap.aaiclient.client.aai.AAIValidatorImpl;
@@ -59,8 +50,16 @@ import org.onap.aaiclient.client.aai.entities.AAIResultWrapper;
 import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
 import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
 import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
-import org.onap.so.client.aai.mapper.AAIObjectMapper;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
 import org.onap.aaiclient.client.graphinventory.entities.uri.Depth;
+import org.onap.so.bpmn.common.InjectionHelper;
+import org.onap.so.bpmn.common.data.TestDataSetup;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.client.aai.mapper.AAIObjectMapper;
 import org.onap.so.db.catalog.beans.OrchestrationStatus;
 
 @RunWith(MockitoJUnitRunner.Silent.class)
@@ -197,18 +196,19 @@ public class AAIVnfResourcesTest extends TestDataSetup {
     public void connectVnfToTenantTest() throws Exception {
         aaiVnfResources.connectVnfToTenant(genericVnf, cloudRegion);
         verify(MOCK_aaiResourcesClient, times(1)).connect(
-                eq(AAIUriFactory.createResourceUri(AAIObjectType.TENANT, cloudRegion.getCloudOwner(),
-                        cloudRegion.getLcpCloudRegionId(), cloudRegion.getTenantId())),
-                eq(AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, genericVnf.getVnfId())));
+                eq(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+                        .cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId())
+                        .tenant(cloudRegion.getTenantId()))),
+                eq(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(genericVnf.getVnfId()))));
     }
 
     @Test
     public void connectVnfToCloudRegionTest() throws Exception {
         aaiVnfResources.connectVnfToCloudRegion(genericVnf, cloudRegion);
         verify(MOCK_aaiResourcesClient, times(1)).connect(
-                eq(AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, genericVnf.getVnfId())),
-                eq(AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, cloudRegion.getCloudOwner(),
-                        cloudRegion.getLcpCloudRegionId())));
+                eq(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(genericVnf.getVnfId()))),
+                eq(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+                        .cloudRegion(cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId()))));
     }
 
 
@@ -244,8 +244,8 @@ public class AAIVnfResourcesTest extends TestDataSetup {
 
     @Test
     public void checkNameInUseTrueTest() {
-        AAIPluralResourceUri vnfUri =
-                AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", "vnfName");
+        AAIPluralResourceUri vnfUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnfs())
+                .queryParam("vnf-name", "vnfName");
         doReturn(true).when(MOCK_aaiResourcesClient).exists(eq(vnfUri));
         boolean nameInUse = aaiVnfResources.checkNameInUse("vnfName");
         assertTrue(nameInUse);
@@ -253,8 +253,8 @@ public class AAIVnfResourcesTest extends TestDataSetup {
 
     @Test
     public void checkNameInUseFalseTest() {
-        AAIPluralResourceUri vnfUri =
-                AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", "vnfName");
+        AAIPluralResourceUri vnfUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnfs())
+                .queryParam("vnf-name", "vnfName");
         doReturn(false).when(MOCK_aaiResourcesClient).exists(eq(vnfUri));
         boolean nameInUse = aaiVnfResources.checkNameInUse("vnfName");
         assertFalse(nameInUse);
@@ -262,7 +262,8 @@ public class AAIVnfResourcesTest extends TestDataSetup {
 
     @Test
     public void queryVnfWrapperByIdTest() throws Exception {
-        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "vnfId").depth(Depth.ALL);
+        AAIResourceUri uri =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("vnfId")).depth(Depth.ALL);
         final String aaiResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "aaiGenericVnf.json")));
         GenericVnf genericVnf = new GenericVnf();
         genericVnf.setVnfId("vnfId");
@@ -279,8 +280,8 @@ public class AAIVnfResourcesTest extends TestDataSetup {
                 new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "aaiVserverQueryResponse.json")));
         AAIResultWrapper aaiResultWrapper = new AAIResultWrapper(content);
         Optional<org.onap.aai.domain.yang.Vserver> oVserver = Optional.empty();
-        AAIResourceUri vserverUri = AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, "ModelInvariantUUID",
-                "serviceModelVersionId", "abc", "abc");
+        AAIResourceUri vserverUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+                .cloudRegion("ModelInvariantUUID", "serviceModelVersionId").tenant("abc").vserver("abc"));
 
         doReturn(aaiResultWrapper).when(MOCK_aaiResourcesClient).get(isA(AAIResourceUri.class));
         oVserver = aaiVnfResources.getVserver(vserverUri);
index 0eae6a3..ada5972 100644 (file)
@@ -37,16 +37,16 @@ import org.mockito.ArgumentMatchers;
 import org.mockito.InjectMocks;
 import org.mockito.Mock;
 import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.aaiclient.client.aai.AAIResourcesClient;
+import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
+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.Types;
 import org.onap.so.bpmn.common.InjectionHelper;
 import org.onap.so.bpmn.common.data.TestDataSetup;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
-import org.onap.aaiclient.client.aai.AAIObjectPlurals;
-import org.onap.aaiclient.client.aai.AAIResourcesClient;
-import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
-import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
-import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
 import org.onap.so.client.aai.mapper.AAIObjectMapper;
 import org.onap.so.db.catalog.beans.OrchestrationStatus;
 
@@ -155,7 +155,7 @@ public class AAIVolumeGroupResourcesTest extends TestDataSetup {
 
     @Test
     public void checkNameInUseTrueTest() {
-        AAIPluralResourceUri volumeGroupUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VOLUME_GROUP)
+        AAIPluralResourceUri volumeGroupUri = AAIUriFactory.createNodesUri(Types.VOLUME_GROUPS.getFragment())
                 .queryParam("volume-group-name", "testVolumeGroupName1");
         doReturn(true).when(MOCK_aaiResourcesClient).exists(eq(volumeGroupUri));
         boolean nameInUse = aaiVolumeGroupResources.checkNameInUse(volumeGroup);
@@ -164,7 +164,7 @@ public class AAIVolumeGroupResourcesTest extends TestDataSetup {
 
     @Test
     public void checkNameInUseFalseTest() {
-        AAIPluralResourceUri volumeGroupUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VOLUME_GROUP)
+        AAIPluralResourceUri volumeGroupUri = AAIUriFactory.createNodesUri(Types.VOLUME_GROUPS.getFragment())
                 .queryParam("volume-group-name", "testVolumeGroupName1");
         doReturn(false).when(MOCK_aaiResourcesClient).exists(eq(volumeGroupUri));
         boolean nameInUse = aaiVolumeGroupResources.checkNameInUse(volumeGroup);
index 8d45048..ed82500 100644 (file)
@@ -20,6 +20,7 @@
 
 package org.onap.so.beans.nsmf;
 
+import java.util.List;
 import com.fasterxml.jackson.annotation.JsonInclude;
 
 @JsonInclude(JsonInclude.Include.NON_NULL)
@@ -33,6 +34,10 @@ public class ActDeActNssi {
 
     private String nssiId;
 
+    private String sliceProfileId;
+
+    private List<String> snssaiList;
+
     public String getNsiId() {
         return nsiId;
     }
@@ -48,4 +53,20 @@ public class ActDeActNssi {
     public void setNssiId(String nssiId) {
         this.nssiId = nssiId;
     }
+
+    public String getSliceProfileId() {
+        return sliceProfileId;
+    }
+
+    public void setSliceProfileId(String sliceProfileId) {
+        this.sliceProfileId = sliceProfileId;
+    }
+
+    public List<String> getSnssaiList() {
+        return snssaiList;
+    }
+
+    public void setSnssaiList(List<String> snssaiList) {
+        this.snssaiList = snssaiList;
+    }
 }
index 156f999..27c5cf8 100644 (file)
 package org.onap.so.beans.nsmf;
 
 import com.fasterxml.jackson.annotation.JsonInclude;
+import lombok.Data;
+import java.util.Map;
 
 @JsonInclude(JsonInclude.Include.NON_NULL)
+@Data
 public class AllocateAnNssi {
 
     @Deprecated
@@ -42,59 +45,5 @@ public class AllocateAnNssi {
 
     private NsiInfo nsiInfo;
 
-    public String getNsstId() {
-        return nsstId;
-    }
-
-    public void setNsstId(String nsstId) {
-        this.nsstId = nsstId;
-    }
-
-    public String getNssiId() {
-        return nssiId;
-    }
-
-    public void setNssiId(String nssiId) {
-        this.nssiId = nssiId;
-    }
-
-    public String getNssiName() {
-        return nssiName;
-    }
-
-    public void setNssiName(String nssiName) {
-        this.nssiName = nssiName;
-    }
-
-    public AnSliceProfile getSliceProfile() {
-        return sliceProfile;
-    }
-
-    public void setSliceProfile(AnSliceProfile sliceProfile) {
-        this.sliceProfile = sliceProfile;
-    }
-
-    public String getScriptName() {
-        return scriptName;
-    }
-
-    public void setScriptName(String scriptName) {
-        this.scriptName = scriptName;
-    }
-
-    public Object getExtension() {
-        return extension;
-    }
-
-    public void setExtension(Object extension) {
-        this.extension = extension;
-    }
-
-    public NsiInfo getNsiInfo() {
-        return nsiInfo;
-    }
-
-    public void setNsiInfo(NsiInfo nsiInfo) {
-        this.nsiInfo = nsiInfo;
-    }
+    private Map<String, Object> endPoint;
 }
index bdc2c60..f5b926f 100644 (file)
 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 AllocateCnNssi implements Serializable {
 
     @Deprecated
@@ -46,67 +49,5 @@ public class AllocateCnNssi implements Serializable {
 
     private NsiInfo nsiInfo;
 
-    public NsiInfo getNsiInfo() {
-        return nsiInfo;
-    }
-
-    public void setNsiInfo(NsiInfo nsiInfo) {
-        this.nsiInfo = nsiInfo;
-    }
-
-    public String getNsstId() {
-        return nsstId;
-    }
-
-    public void setNsstId(String nsstId) {
-        this.nsstId = nsstId;
-    }
-
-    public String getScriptName() {
-        return scriptName;
-    }
-
-    public void setScriptName(String scriptName) {
-        this.scriptName = scriptName;
-    }
-
-    public CnSliceProfile getSliceProfile() {
-        return sliceProfile;
-    }
-
-    public void setSliceProfile(CnSliceProfile sliceProfile) {
-        this.sliceProfile = sliceProfile;
-    }
-
-    public String getFlavorId() {
-        return flavorId;
-    }
-
-    public void setFlavorId(String flavorId) {
-        this.flavorId = flavorId;
-    }
-
-    public String getNssiId() {
-        return nssiId;
-    }
-
-    public void setNssiId(String nssiId) {
-        this.nssiId = nssiId;
-    }
-
-    public String getNssiName() {
-        return nssiName;
-    }
-
-    public void setNssiName(String nssiName) {
-        this.nssiName = nssiName;
-    }
-
-    public void setExtension(Object extension) {
-        this.extension = extension;
-    }
-
-    public Object getExtension() {
-        return extension;
-    }
+    private Map<String, Object> endPoint;
 }
index 1ee83c7..399d51e 100644 (file)
@@ -25,7 +25,6 @@ import java.util.List;
 
 @JsonInclude(JsonInclude.Include.NON_NULL)
 public class DeAllocateNssi {
-
     @Deprecated
     public final static String URL = "/api/rest/provMns/v1/NSS" + "/SliceProfiles/%s";
 
@@ -42,6 +41,16 @@ public class DeAllocateNssi {
 
     private String extension;
 
+    private String sliceProfileId;
+
+    public String getSliceProfileId() {
+        return sliceProfileId;
+    }
+
+    public void setSliceProfileId(String sliceProfileId) {
+        this.sliceProfileId = sliceProfileId;
+    }
+
     public String getNsiId() {
         return nsiId;
     }
index 469d212..146032c 100644 (file)
 package org.onap.so.beans.nsmf;
 
 import com.fasterxml.jackson.annotation.JsonInclude;
+import lombok.Data;
 import java.util.List;
 
 @JsonInclude(JsonInclude.Include.NON_NULL)
+@Data
 public class ResponseDescriptor {
 
     @JsonInclude(JsonInclude.Include.NON_DEFAULT)
@@ -43,43 +45,7 @@ public class ResponseDescriptor {
 
     private List<ResponseHistory> responseHistoryList;
 
-    public int getProgress() {
-        return progress;
-    }
+    private String nssiId;
 
-    public void setProgress(int progress) {
-        this.progress = progress;
-    }
-
-    public String getStatus() {
-        return status;
-    }
-
-    public void setStatus(String status) {
-        this.status = status;
-    }
-
-    public String getStatusDescription() {
-        return statusDescription;
-    }
-
-    public void setStatusDescription(String statusDescription) {
-        this.statusDescription = statusDescription;
-    }
-
-    public String getResponseId() {
-        return responseId;
-    }
-
-    public void setResponseId(String responseId) {
-        this.responseId = responseId;
-    }
-
-    public List<ResponseHistory> getResponseHistoryList() {
-        return responseHistoryList;
-    }
-
-    public void setResponseHistoryList(List<ResponseHistory> responseHistoryList) {
-        this.responseHistoryList = responseHistoryList;
-    }
+    private String endPointId;
 }
index 7a52cc8..19e8b46 100644 (file)
@@ -47,4 +47,6 @@ public class ServiceInfo implements Serializable {
     private String nssiName;
 
     private String pLMNIdList;
+
+    private String actionType;
 }
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/SliceTaskInfo.java b/common/src/main/java/org/onap/so/beans/nsmf/SliceTaskInfo.java
new file mode 100644 (file)
index 0000000..71c50c1
--- /dev/null
@@ -0,0 +1,55 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ # Copyright (c) 2020, CMCC Technologies Co., Ltd.
+ #
+ # Licensed under the Apache License, Version 2.0 (the "License")
+ # you may not use this file except in compliance with the License.
+ # You may obtain a copy of the License at
+ #
+ #       http://www.apache.org/licenses/LICENSE-2.0
+ #
+ # Unless required by applicable law or agreed to in writing, software
+ # distributed under the License is distributed on an "AS IS" BASIS,
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ # See the License for the specific language governing permissions and
+ # limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.beans.nsmf;
+
+import lombok.Data;
+import org.onap.so.beans.nsmf.oof.SubnetType;
+import org.onap.so.beans.nsmf.oof.TemplateInfo;
+import java.io.Serializable;
+
+@Data
+public class SliceTaskInfo<T> implements Serializable {
+    private static final long serialVersionUID = 7580056468353975320L;
+
+    private String suggestNssiId;
+
+    private String suggestNssiName;
+
+    private String progress;
+
+    private String status;
+
+    private String statusDescription;
+
+    private T sliceProfile;
+
+    private TemplateInfo NSSTInfo;
+
+    private String sliceInstanceId;
+
+    private String scriptName;
+
+    private String vendor;
+
+    private NetworkType networkType;
+
+    private SubnetType subnetType;
+
+}
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
new file mode 100644 (file)
index 0000000..87de04a
--- /dev/null
@@ -0,0 +1,56 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ # Copyright (c) 2020, CMCC Technologies Co., Ltd.
+ #
+ # Licensed under the Apache License, Version 2.0 (the "License")
+ # you may not use this file except in compliance with the License.
+ # You may obtain a copy of the License at
+ #
+ #       http://www.apache.org/licenses/LICENSE-2.0
+ #
+ # Unless required by applicable law or agreed to in writing, software
+ # distributed under the License is distributed on an "AS IS" BASIS,
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ # See the License for the specific language governing permissions and
+ # limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.beans.nsmf;
+
+import lombok.Data;
+import org.onap.so.beans.nsmf.oof.TemplateInfo;
+import java.util.Map;
+
+
+@Data
+public class SliceTaskParamsAdapter {
+    private static final long serialVersionUID = -7785578865170503301L;
+
+    private String serviceId;
+
+    private String serviceName;
+
+    private String nstId;
+
+    private String nstName;
+
+    private Map<String, Object> serviceProfile;
+
+    private String suggestNsiId;
+
+    private String suggestNsiName;
+
+    private TemplateInfo NSTInfo;
+
+    private SliceTaskInfo<TnSliceProfile> tnBHSliceTaskInfo;
+
+    private SliceTaskInfo<TnSliceProfile> tnMHSliceTaskInfo;
+
+    private SliceTaskInfo<TnSliceProfile> tnFHSliceTaskInfo;
+
+    private SliceTaskInfo<CnSliceProfile> cnSliceTaskInfo;
+
+    private SliceTaskInfo<AnSliceProfile> anSliceTaskInfo;
+}
index c3548f1..ccd6001 100644 (file)
 package org.onap.so.beans.nsmf;
 
 import com.fasterxml.jackson.annotation.JsonInclude;
+import lombok.Data;
 
 @JsonInclude(JsonInclude.Include.NON_NULL)
+@Data
 public class TnSliceProfile {
 
+    private String sliceProfileId;
+
     private String bandwidth;
 
     @JsonInclude(JsonInclude.Include.NON_DEFAULT)
     private int latency;
-
-    public String getBandwidth() {
-        return bandwidth;
-    }
-
-    public void setBandwidth(String bandwidth) {
-        this.bandwidth = bandwidth;
-    }
-
-    public int getLatency() {
-        return latency;
-    }
-
-    public void setLatency(int latency) {
-        this.latency = latency;
-    }
 }
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/oof/NsiReqBody.java b/common/src/main/java/org/onap/so/beans/nsmf/oof/NsiReqBody.java
new file mode 100644 (file)
index 0000000..d228d37
--- /dev/null
@@ -0,0 +1,43 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ # Copyright (c) 2020, CMCC Technologies Co., Ltd.
+ #
+ # Licensed under the Apache License, Version 2.0 (the "License")
+ # you may not use this file except in compliance with the License.
+ # You may obtain a copy of the License at
+ #
+ #       http://www.apache.org/licenses/LICENSE-2.0
+ #
+ # Unless required by applicable law or agreed to in writing, software
+ # distributed under the License is distributed on an "AS IS" BASIS,
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ # See the License for the specific language governing permissions and
+ # limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.beans.nsmf.oof;
+
+import lombok.Data;
+import org.onap.so.beans.nsmf.ServiceProfile;
+import java.io.Serializable;
+import java.util.List;
+import java.util.Map;
+
+@Data
+public class NsiReqBody implements Serializable {
+    private static final long serialVersionUID = -1383112063216226985L;
+
+    private Map<String, Object> serviceProfile;
+
+    private RequestInfo requestInfo;
+
+    private TemplateInfo NSTInfo;
+
+    private List<TemplateInfo> NSSTInfo;
+
+    private Boolean preferReuse;
+
+    private List<SubnetCapability> subnetCapabilities;
+}
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/oof/NssiReqBody.java b/common/src/main/java/org/onap/so/beans/nsmf/oof/NssiReqBody.java
new file mode 100644 (file)
index 0000000..7cfb60c
--- /dev/null
@@ -0,0 +1,37 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ # Copyright (c) 2020, CMCC Technologies Co., Ltd.
+ #
+ # Licensed under the Apache License, Version 2.0 (the "License")
+ # you may not use this file except in compliance with the License.
+ # You may obtain a copy of the License at
+ #
+ #       http://www.apache.org/licenses/LICENSE-2.0
+ #
+ # Unless required by applicable law or agreed to in writing, software
+ # distributed under the License is distributed on an "AS IS" BASIS,
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ # See the License for the specific language governing permissions and
+ # limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.beans.nsmf.oof;
+
+import lombok.Data;
+import org.onap.so.beans.nsmf.ServiceProfile;
+import java.io.Serializable;
+import java.util.Map;
+
+@Data
+public class NssiReqBody implements Serializable {
+
+    private static final long serialVersionUID = -76327522074333341L;
+
+    private Map<String, Object> serviceProfile;
+
+    private RequestInfo requestInfo;
+
+    private TemplateInfo NSSTInfo;
+}
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/oof/RequestInfo.java b/common/src/main/java/org/onap/so/beans/nsmf/oof/RequestInfo.java
new file mode 100644 (file)
index 0000000..292a0d5
--- /dev/null
@@ -0,0 +1,46 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ # Copyright (c) 2020, CMCC Technologies Co., Ltd.
+ #
+ # Licensed under the Apache License, Version 2.0 (the "License")
+ # you may not use this file except in compliance with the License.
+ # You may obtain a copy of the License at
+ #
+ #       http://www.apache.org/licenses/LICENSE-2.0
+ #
+ # Unless required by applicable law or agreed to in writing, software
+ # distributed under the License is distributed on an "AS IS" BASIS,
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ # See the License for the specific language governing permissions and
+ # limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.beans.nsmf.oof;
+
+import lombok.Data;
+import java.io.Serializable;
+import java.util.Map;
+
+@Data
+public class RequestInfo implements Serializable {
+
+    private static final long serialVersionUID = -875589918188540922L;
+
+    private String transactionId;
+
+    private String requestId;
+
+    private String callbackUrl;
+
+    private Map<?, ?> callbackHeader;
+
+    private String sourceId;
+
+    private Integer numSolutions;
+
+    private Integer timeout;
+
+    private Map<?, ?> addtnlArgs;
+}
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/oof/SubnetCapability.java b/common/src/main/java/org/onap/so/beans/nsmf/oof/SubnetCapability.java
new file mode 100644 (file)
index 0000000..bc52d4e
--- /dev/null
@@ -0,0 +1,33 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ # Copyright (c) 2020, CMCC Technologies Co., Ltd.
+ #
+ # Licensed under the Apache License, Version 2.0 (the "License")
+ # you may not use this file except in compliance with the License.
+ # You may obtain a copy of the License at
+ #
+ #       http://www.apache.org/licenses/LICENSE-2.0
+ #
+ # Unless required by applicable law or agreed to in writing, software
+ # distributed under the License is distributed on an "AS IS" BASIS,
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ # See the License for the specific language governing permissions and
+ # limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.beans.nsmf.oof;
+
+import lombok.Data;
+import java.io.Serializable;
+
+@Data
+public class SubnetCapability implements Serializable {
+
+    private static final long serialVersionUID = -7671021271451538821L;
+
+    private String domainType;
+
+    private Object capabilityDetails;
+}
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/oof/SubnetType.java b/common/src/main/java/org/onap/so/beans/nsmf/oof/SubnetType.java
new file mode 100644 (file)
index 0000000..4b0136a
--- /dev/null
@@ -0,0 +1,56 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ # Copyright (c) 2020, CMCC Technologies Co., Ltd.
+ #
+ # Licensed under the Apache License, Version 2.0 (the "License")
+ # you may not use this file except in compliance with the License.
+ # You may obtain a copy of the License at
+ #
+ #       http://www.apache.org/licenses/LICENSE-2.0
+ #
+ # Unless required by applicable law or agreed to in writing, software
+ # distributed under the License is distributed on an "AS IS" BASIS,
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ # See the License for the specific language governing permissions and
+ # limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.beans.nsmf.oof;
+
+import lombok.Getter;
+import org.onap.so.beans.nsmf.NetworkType;
+
+@Getter
+public enum SubnetType {
+    AN("AN", NetworkType.ACCESS),
+
+    AN_NF("AN-NF", NetworkType.ACCESS),
+
+    CN("CN", NetworkType.CORE),
+
+    TN_FH("TN-FH", NetworkType.TRANSPORT),
+
+    TN_MH("TN-MH", NetworkType.TRANSPORT),
+
+    TN_BH("TN-BH", NetworkType.TRANSPORT),;
+
+    private NetworkType networkType;
+
+    private String subnetType;
+
+    SubnetType(String subnetType, NetworkType networkType) {
+        this.subnetType = subnetType;
+        this.networkType = networkType;
+    }
+
+    public static NetworkType getNetworkType(String subnetType) {
+        for (SubnetType type : SubnetType.values()) {
+            if (type.subnetType.equalsIgnoreCase(subnetType)) {
+                return type.networkType;
+            }
+        }
+        return null;
+    }
+}
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/oof/TemplateInfo.java b/common/src/main/java/org/onap/so/beans/nsmf/oof/TemplateInfo.java
new file mode 100644 (file)
index 0000000..3d1ec9c
--- /dev/null
@@ -0,0 +1,36 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ # Copyright (c) 2020, CMCC Technologies Co., Ltd.
+ #
+ # Licensed under the Apache License, Version 2.0 (the "License")
+ # you may not use this file except in compliance with the License.
+ # You may obtain a copy of the License at
+ #
+ #       http://www.apache.org/licenses/LICENSE-2.0
+ #
+ # Unless required by applicable law or agreed to in writing, software
+ # distributed under the License is distributed on an "AS IS" BASIS,
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ # See the License for the specific language governing permissions and
+ # limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.beans.nsmf.oof;
+
+import lombok.Data;
+import java.io.Serializable;
+
+
+@Data
+public class TemplateInfo implements Serializable {
+
+    private static final long serialVersionUID = 4237411651259839093L;
+
+    private String UUID;
+
+    private String invariantUUID;
+
+    private String name;
+}
index 33958a7..c601b88 100644 (file)
@@ -78,13 +78,9 @@ public class ExternalTaskServiceUtils {
     @Scheduled(fixedDelay = 30000)
     public void checkAllClientsActive() {
         try {
-            logger.debug("Executing scheduled task to check and restart external task clients"); // TODO remove
-                                                                                                 // eventually
             List<ExternalTaskClient> inactiveClients =
                     getClients().stream().filter(client -> !client.isActive()).collect(Collectors.toList());
-
             inactiveClients.forEach(c -> {
-                logger.debug("External Task Client found to be inactive. Restarting Client.");
                 c.start();
             });
         } catch (Exception e) {
index 2aa7097..6e96e5d 100644 (file)
@@ -5,3 +5,443 @@
 Building Block Understanding\r
 ============================\r
 \r
+UNDERSTANDING BUILDING BLOCKS USING MACRO FLOW\r
+----------------------------------------------\r
+\r
+\r
+\r
+There are basically 2 flows - macro , a la carte.\r
+\r
+In a la carte we manually will initiate each step for a process.\r
+\r
+In macro , the whole flow happens at a single click - like if we want to create a service, the flow will itself look whether there are vnfs, pnfs or networks in the service and it will be created and activated in the flow also.\r
+\r
+Thus these independent tasks like if vnf is present, then assign create and activate vnf are all taken up as individual building blocks and are only called on need basis.\r
+\r
+\r
+Each and every request will reach to the api handler first.\r
+\r
+API HANDLER( ServiceInstances.java )\r
+------------------------------------\r
+\r
+\r
+\r
+# 1. Rest call reaching SO Api handler with the input json - According to the below path it is mapped to the createServiceInstance function in ServiceInstances file.\r
+\r
+curl -v -H "Content-Type: application/json" -X POST --data @serviceinstance.json -u mso_admin:password1$ http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances.\r
+\r
+# 2. Herein a unique requestid is generated corresponding to every request, and is checked whether that particular requestid exists in request db (Happens in createServiceInstance in ServiceInstances).\r
+\r
+ a. http://request-db-adapter:8083/infraActiveRequests/requestid (GET), which will return a 404 if not exists.\r
+\r
+ b. CreateInstance is set to the action variable. Here the request scope is set to service from the inputjson - modelType.\r
+\r
+# 3. Running local validations on input json.\r
+\r
+# 4. create InfraActiveRequests, to store request details in request db adapter and as a payload to bpmn.\r
+\r
+ a. A new InfraActiveRequests object is created. And all the necessary information from the input is set to it.\r
+\r
+ b. Retrieving productFamilyName from the input json to put into requests db. http://aai/servicedesigncreation/services/service/{productfamilyid} (GET), which will return a 404 if not exists in aai. If service exists, then that service's serviceDescritiption is set as productfamilyName.\r
+\r
+ c. http://aai/cloudinfrastructure/cloudregions/cloudregion/cloudowner/{lcpCloudRegionId}/tenants/tenant/{tenantId} (GET), checks for whether the particular cloud configuration exists in aai, if not exists returns 404.  If we are able to get, then the tenant's name derived from aai is set as tenantName.\r
+\r
+ d. serviceInstanceNamee is derived from requestInfo.instanceName and is set.\r
+\r
+ e. Request json is also set as RequestBody of InfraActiveRequests.\r
+\r
+# 5. Checks fro whether duplicate name exists.\r
+\r
+ a. version v[integer] is converted to the particular integer and stored.\r
+\r
+ b. Checks whether instance name already exists in with a POST request in http://request-db-adapter:8083/infraActiveRequests/checkInstanceNameDuplicate, with the data { instanceIdmap = null, instanceName = {instanceName} , instanceservice = service } . It checks for the current progress and if in progress it throws the particular status.\r
+\r
+# 6. Gets the orchestration url from the recipe table.\r
+\r
+ a. Checks whether the service already exists in catalogdb http://catalog-db-adapter:8082/service/{modelNameVersionId} (GET).\r
+\r
+ b. Checks the service recipe table with the modelNameVersionId and the action to be performed http://catalog-db-adapter:8082/serviceRecipe/search/findFirstByServiceModelUUIDAndAction?serviceModelUUID={modelNameVersionId}&action=createInstance . Returns a 404 if no recipe exists with the corresponding id.\r
+\r
+ c. As recipe corresponding to this doesn't exist, we try to get with a default value. This flow comes under generic resource flow so the default value is GR-API-DEFAULT. First we get service with this value http://catalog-db-adapter:8082/service/search/findFirstByModelNameOrderByModelVersionDesc?modelName=GR-API-DEFAULT (GET). It returns a service with modelUUID as d88da85c-d9e8-4f73-b837-3a72a431622b, and further can be used to get the recipe.\r
\r
+ d. http://catalog-db-adapter:8082/serviceRecipe/search/findFirstByServiceModelUUIDAndAction?serviceModelUUID=d88da85c-d9e8-4f73-b837-3a72a431622b&action=createInstance (GET), gives a recipe which has a parameter "orchestrationUri" as "/mso/async/services/WorkflowActionBB". \r
+\r
+# 7. Updates the infraActiveRequests with the current request.\r
+ a. http://request-db-adapter:8083/infraActiveRequests/ (POST) with the data formed. And a 201 created response is received.\r
+\r
+# 8. Call the bpmn with a post call on orchestrationUri. The data to bpmn is prepared having parameters like \r
+ a. bpmnRequest - formed from input request.\r
+\r
+ b. vfModuleId, pnfCorrelationId, networkId, configurationId, vfModuleType, serviceInstanceId , serviceType are updated if present in the input json or else set to empty string.\r
+\r
+ c. apiVersion , requestId, aLaCarte = false (def), recipeTimeout = 180(def), requestAction= createInstance are all updated accordingly.\r
+\r
+ d. requestUri - v7/serviceInstances ,which is formed from the request url.\r
+\r
+\r
+# 9. A sync response is obtained on reaching bpmn like {"requestReferences":{"requestId":"c45702f7-3f08-4081-bc98-2f9f18b81607","instanceId":"cadca18f-9bff-44be-8910-ad29d342e91f","requestSelfLink":"http://159.138.57.166:30277/orchestrationRequests/v7/c45702f7-3f08-4081-bc98-2f9f18b81607"}}.\r
+\r
+\r
+\r
+\r
+\r
+\r
+BPMN\r
+-----\r
+\r
+\r
+Hits WorkflowActionBB.bpmn\r
+--------------------------\r
+\r
+.. image:: ../images/workflow.png\r
+\r
+\r
+# 1. RetrieveBBExecutionList - implemented in selectExecutionList in WorkflowAction.java\r
+\r
+a. resourcetype, resourceid are formed from matching the requestUri to a regex pattern matcher [pattern=[vV]\d+.*?(?:(?:/(?<type>vnfs|vfModules|networks|networkCollections|volumeGroups|serviceInstances|instanceGroups)(?:/(?<id>[^/]+))?)(?:/(?<action>[^/]+))?(?:/resume)?)] .\r
+\r
+b. Checks whether there is a service subscription with service instance name as {instanceName} correspoding to the customer in aai https://aai.onap:8443/aai/v19/business/customers/customer/slice1/service-subscriptions/service-subscription/service/service-instances?depth=2&resultIndex=0&resultSize=1&service-instance-name={instanceName}. Returns 404 not found, if it doesnt exists then the id of that particular instance is taken and given as both the resourceid and serviceinstance id. If not present then a random value is generated, and is assigned same to both.\r
+\r
+c. Checks whether there is a service of the particular serviceInstanceId exists in aai. https://aai.onap:8443/aai/v19/nodes/service-instances/service-instance/{serviceInstanceId} , returns not found if it doesnt exist. If service with corresponding instance name already exists , then flowsToExecute is got by quering the requestdbadapter with the earlier request id.  If not present, then only orchestrationflows are got, and later from that the flowsToExecute are found out.\r
+\r
+d. Get the particular service from catalogdb . http://so-catalog-db-adapter.onap:8082/service/{modelNameVersionId}  (GET). Be sure that the service with this particular modelNameVersionId exists in catalogdb, because based on the services (like whether pnf, or vnf, or networkcollection) present in that particular service, which all bbs to execute are decided.\r
+\r
+e. This being a service, "service" is added to the resource list. And is checked upon for other resources like vnf and   network, eg:\r
+\r
+ http://so-catalog-db-adapter.onap:8082/service/{modelNameVersionId}/vnfCustomizations (GET)\r
+ http://so-catalog-db-adapter.onap:8082/service/{modelNameVersionId}/collectionResourceCustomizations (GET)\r
+ http://so-catalog-db-adapter.onap:8082/service/{modelNameVersionId}/networkCustomizations (GET)\r
+ And depending on the reources in the service, the resources found is updated like\r
+ Found :Service - 1    Vnf - 0    Pnf - 0    VfModule - 0    VolumeGroup - 0    Network - 0    VirtualLink - 0    NetworkCollection - 0    Configuration - 0    InstanceGroup - 0 \r
+\r
+f. Then the orchestration flows are get from the orchestration_flow_table depending on the cloudowner and request scope: http://so-catalog-db-adapter.onap:8082/northbound_request_ref_lookup/search/findOneByActionAndRequestScopeAndIsAlacarteAndCloudOwnerAndServiceType action=createInstance&requestScope=Service&isALaCarte=false&cloudOwner={CloudOwner}&serviceType=%2A (GET) Here if present, then the orchestration flows are returned or else with default cloud owner, we try again\r
+\r
+http://so-catalog-db-adapter.onap:8082/northbound_request_ref_lookup/search/findOneByActionAndRequestScopeAndIsAlacarteAndCloudOwnerAndServiceType?action=createInstance&requestScope=Service&isALaCarte=false&cloudOwner=DEFAULT&serviceType=%2A (GET)\r
+Here in northBoundRequest is returned which has the parameter orchestrationFlowList, that contains the link that will return the orchestration flows.\r
+\r
+"orchestrationFlowList" : { "href" : "http://so-catalog-db-adapter.onap:8082/northbound_request_ref_lookup/101/orchestrationFlowList"} \r
+\r
+Now we do a get on the orchestration flow link to get the set of orchestartion flows required\r
+http://so-catalog-db-adapter.onap:8082/northbound_request_ref_lookup/101/orchestrationFlowList.\r
+Here a set of 20 orchestration flows are returned under the action of Service-Macro-Create, each with a sequence no assigned sequentially in the given order\r
+AssignServiceInstanceBB, \r
+\r
+CreateNetworkCollectionBB,\r
+\r
+AssignNetworkBB,\r
+\r
+AssignVnfBB, \r
+\r
+AssignVolumeGroupBB,\r
+\r
+AssignVfModuleBB,\r
+\r
+ConfigAssignVnfBB,\r
+\r
+AssignPnfBB, \r
+\r
+WaitForPnfReadyBB,\r
+\r
+ActivatePnfBB,\r
+\r
+CreateNetworkBB,\r
+\r
+ActivateNetworkBB,\r
+\r
+CreateVolumeGroupBB, \r
+\r
+ActivateVolumeGroupBB, \r
+\r
+CreateVfModuleBB,\r
+\r
+ActivateVfModuleBB, \r
+\r
+ConfigDeployVnfBB,\r
+\r
+ActivateVnfBB, \r
+\r
+ActivateNetworkCollectionBB,\r
+\r
+ActivateServiceInstanceBB.\r
+\r
+\r
+.. image:: ../images/flowchart.png\r
+\r
+\r
+g. Flows to execute is determined by iterating through all the orchestartion flows and matching it with the found resources. It is merely a contains matching. In this particular as service was the only resource : List of BuildingBlocks to execute:AssignServiceInstanceBB, ActivateServiceInstanceBB.\r
+\r
+h. processing data is added to the requestdbadapter. Here the data is post to the requestdb as two different building blocks http://so-request-db-adapter.onap:8083/requestProcessingData.\r
+\r
+i. The already stored request details in request db is ammended like "lastModifiedBy" : "CamundaBPMN" , and status to in_progress with a put request.\r
+\r
+\r
+# 2. sendSyncAck -  This was used to give an acknowledgement , with status code as 200, and requestId and resourceId is sent as content.\r
+\r
+\r
+# 3. Prevalidate the workflow\r
+\r
+\r
+# 4. SelectBB - implemented in selectBBin WorkflowActionBBTasks\r
+This is used to select the building block from the flows to execute depending on the sequence order.\r
+\r
+ a. Depending on the current sequence , the building block is selected from the flows to execute.\r
\r
+ b. Execution variable, that is passed between the different building blocks as the payload is ammended as:\r
+\r
+  execution.setVariable("buildingBlock", buildingblockselected).\r
+\r
+ c. current sequence is incremented by 1, and updated in execution variable.\r
+\r
+ d. Depending on whether currentSequence is greater than flowsToExecute.size(), COMPLETED variable is either set to true or false.\r
+\r
+\r
+# 5. updateFlowStatistics - implemented in updateFlowStatistics in WorkflowActionBBTasks\r
+a. Depending on the current sequence no, the completed bb and next bb is got from the flows to execute. And these are mentioned in a statusMessage.\r
+b. Percentage progress is got from the total no of bbs\r
+c. These are ammended to the already present request in the request db\r
+\r
+# 6. Execute BB - calls the ExecuteBuildingBlock.bpmn\r
+\r
+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\r
+\r
+Hits ExecuteBuildingBlock.bpmn\r
+------------------------------\r
+\r
+.. image:: ../images/ExecuteBuildingBlock.png\r
+\r
+# 1. BBInputSetup - implemented in execute in BBInputSetup\r
+Here a generalbuildingblock is formed from executingbuildingblock after certain updations and validations.\r
+\r
+ a. lookupKeyMap is formed from the input , and a map is formed with serviceInstanceId, networkID, vnfID, pnfID, vfmoduleID, volumegroupID, configurationID, instancegroupID as the keys.\r
+\r
+ b. Depending on whether a la carte or macro , different flows are called. getGBBMacro is called in here.\r
+\r
+ c. In getGBBMacro , a valid customer is got with service subscription.(getCustomerAndServiceSubscription)\r
+\r
+  First a customer is got by get request on https://aai.onap:8443/aai/v19/business/customers/customer/{globalSubscriberId}\r
+\r
+  After that ServiceSubscription is got by doing a get request\r
+  https://aai.onap:8443/aai/v19/business/customers/customer/{globalSubscriberId}/service-subscriptions/service-subscription/service\r
+\r
+  If, the above request doesnt give any , then ServiceSubscription is fetched by first creating uri keys\r
+  https://aai.onap:8443/aai/v19/nodes/service-instances/service-instance/{resourceId}?format=pathed.\r
+  Then ServiceSubscription is got from the globalSubscriberId and the uri keys\r
+\r
+'Note': a valid customer and a corresponding ServiceSubscription must be present in the aai, for setting up the customer to gbuildingblock\r
+\r
+ d. project and owningEntity is updated from the input\r
+\r
+ e. service is got from the catalog db either by ModelVersionId or by ModelVersion and ModelInvariantId.\r
+\r
+ f. ServiceInstance is created from the above parameters, and this ServiceInstance is used in the preparation of general building block.\r
+\r
+ g. Depending on whether the current executing block name contains either of the network, or configuration, or network collection. A new instance of the corresponding type is created and is updated to the general building block (Happens in getGBBMacroNoUserParamsCreate)\r
+\r
+ h. This general building block is set to the gBuildingBlockExecution and gBBInput parameter of execution.\r
+\r
+\r
+# 2. StatusPolicy - implemented in validateOrchestrationStatus in OrchestrationStatusValidator. Input being gBuildingBlockExecution\r
+ a. orchestrationStatus is obtained after checking the resource type. We had updated the orchestrationStatus in the above step when a new service instance was created.\r
+ b. OrchestrationStatusStateTransitionDirective is got by doing a get call to the catlog db with the url as findOneByResourceTypeAndOrchestrationStatusAndTargetAction\r
+http://so-catalog-db-adapter.onap:8082/orchestrationStatusStateTransitionDirective/search/findOneByResourceTypeAndOrchestrationStatusAndTargetAction?resourceType=SERVICE&orchestrationStatus=PRECREATED&targetAction=ASSIGN\r
+ c. orchestrationStatusValidationResult parameter is set to execution variable from the OrchestrationStatusStateTransitionDirective.getFlowDirective() "flowDirective" : "CONTINUE"\r
+\r
+# 3. Prevalidate the gBuildingBlockExecution\r
+\r
+# 4. BB To Execute: Depending on which building block is to be executed, that particular bpmn is called .In this case, AssignServiceInstanceBB is called\r
+\r
+-------------------------------------------------------------------------------------------------------------------------\r
+\r
+Hits AssignServiceInstanceBB.bpmn\r
+---------------------------------\r
+\r
+.. image:: ../images/AssignServiceInstanceBB.png\r
+\r
+# 1. AAI create service subscription - implemented in createServiceSubscription of createAAITasks\r
+This method is used for creating and subscribing the service in A&AI\r
+\r
+ a. Customer is got from the general building block that was updated above\r
+\r
+ b. Here a serviceSubscriptionURI is formed by taking in the globalSubscriberId and the serviceType\r
+\r
+ c. If a service subscription for the particular customer doesnt exist in AAI, then a new subscription is created by taking in the serviceSubscriptionURI\r
+\r
+GET performed on uri:https://aai.onap:8443/aai/v19/business/customers/customer/slice1/service-subscriptions/service-subscription/service?\r
+{"results":[{"service-subscription":1}]}\r
+\r
+# 2. AAI create service instance - implemented in createServiceInstance of createAAITasks\r
+This method is used for creating the service instance in A&AI\r
+\r
+ a. Customer is got from the general building block that was updated above\r
+\r
+ b. A serviceInstanceURI is formed by taking in the globalSubscriberId, the serviceType and the service instance id\r
+\r
+ c. If the service instance in the particular path doesnt exist in AAI , then a new service instance is created by using the serviceInstanceURI\r
+\r
+GET to:https://aai.onap:8443/aai/v19/business/customers/customer/slice1/service-subscriptions/service-subscription/service/service-instances/service-instance/2b955def-e536-40ee-84cb-3f06e3cc6d84?\r
+response: {"requestError":{"serviceException":{"messageId":"SVC3001","text":"Resource not found for %1 using id %2 (msg=%3) (ec=%4)","variables":["GET","business/customers/customer/slice1/service-subscriptions/service-subscription/service/service-instances/service-instance/2b955def-e536-40ee-84cb-3f06e3cc6d84","Node Not Found:No Node of type service-instance found at: business/customers/customer/slice1/service-subscriptions/service-subscription/service/service-instances/service-instance/2b955def-e536-40ee-84cb-3f06e3cc6d84","ERR.5.4.6114"]}}}\r
+\r
+Sending HTTP PUT to:https://aai.onap:8443/aai/v19/business/customers/customer/slice1/service-subscriptions/service-subscription/service/service-instances/service-instance/2b955def-e536-40ee-84cb-3f06e3cc6d84 \r
+with req body : {"service-instance-id":"2b955def-e536-40ee-84cb-3f06e3cc6d84","service-instance-name":"DEMO_123456","model-invariant-id":"944862ae-bb65-4429-8330-a6c9170d6672","model-version-id":"d88da85c-d9e8-4f73-b837-3a72a431622b","orchestration-status":"Inventoried"}\r
+\r
+# 3. AAI create project - implemented in createProject of createAAITasks\r
+This method is used for creation of the project A&AI. Here too it checks whether a project with a  {projectName} exist in AAI . If not it creates one, and connects it to the service instance identified by the serviceInstanceId\r
+Sending HTTP PUT to:https://aai.onap:8443/aai/v19/business/projects/project/name%20of%20proj/relationship-list/relationship\r
+with req body: {"related-link":"/business/customers/customer/slice1/service-subscriptions/service-subscription/service/service-instances/service-instance/2b955def-e536-40ee-84cb-3f06e3cc6d84"}\r
+\r
+# 4. AAI create owning entity -  implemented in createOwningEntity of createAAITasks\r
+\r
+ a. OwningEntityId and OwningEntityName is extracted from the OwningEntity given in the input json\r
+\r
+ b. If both of them are null, then an exception is raised.\r
+\r
+ c. If only OwningEntityId is null, then whether the OwningEntityName is present in AAI is checked. If present then OwningEntityId is set by quering the OwningEntity from AAI. And then connect it to the service instance. If not present in the aai then a random id is generated and assigned to  OwningEntityId. Then Owning entity is first created and then connected to the service instance\r
+\r
+ d. Depending on whether the owning entity is already present or not, either createOwningEntityandConnectServiceInstance is called, or connectOwningEntityandServiceInstanceis called.\r
+\r
+Sending HTTP PUT to:https://aai.onap:8443/aai/v19/business/owning-entities/owning-entity/owningEntityIdof%20owningEntity/relationship-list/relationship\r
+req body: {"related-link":"/business/customers/customer/slice1/service-subscriptions/service-subscription/service/service-instances/service-instance/2b955def-e536-40ee-84cb-3f06e3cc6d84"}\r
+\r
+# 5. SDNC Create Assign Request - implemented in assignServiceInstance of SDNCAssignTasks\r
+\r
+ a. Here first the requestContext, serviceInstance, customer are obtained from the general building block\r
+\r
+ b. Then a payload for the assignServiceInstance of the sdnc is formed by passing in the above parameters to the assignServiceInstance in sdncSIResources.\r
+\r
+ c. A new sdnc request is formed with the above thing as payload\r
+\r
+ d. This sdnc request is assigned to the SDNCRequest parameter of the execution variable\r
+\r
+.. code-block:: bash\r
+\r
+ {"input":{\r
+  "request-information" : {\r
+    "request-action" : "CreateServiceInstance",\r
+    "source" : "MSO",\r
+    "request-id" : "139636cd-4b69-4c3a-9e67-fed2c283baee"\r
+\r
+  },\r
+  "sdnc-request-header" : {\r
+\r
+    "svc-request-id" : "9bfe8cb0-bb8b-4dca-949d-2f2b51011b54",\r
+    "svc-action" : "assign"\r
+\r
+  },\r
+  "service-information" : {\r
+\r
+    "onap-model-information" : {\r
+      "model-name" : "GR-API-DEFAULT",\r
+      "model-version" : "1.0",\r
+      "model-uuid" : "d88da85c-d9e8-4f73-b837-3a72a431622b",\r
+      "model-invariant-uuid" : "944862ae-bb65-4429-8330-a6c9170d6672"\r
+\r
+    },\r
+    "subscription-service-type" : "service",\r
+    "service-id" : "2b955def-e536-40ee-84cb-3f06e3cc6d84",\r
+    "global-customer-id" : {global_customerid},\r
+    "service-instance-id" : "2b955def-e536-40ee-84cb-3f06e3cc6d84"\r
+\r
+  },\r
+  "service-request-input" : {\r
+\r
+    "service-input-parameters" : {\r
+      "param" : [ {\r
+        "name" : "some name",\r
+        "value" : "some value"\r
+\r
+      } ]\r
+\r
+    },\r
+    "service-instance-name" : {instance_name}\r
+  }\r
+ }}\r
+\r
+# 6. It calls another bpmn file - SDNCHandler.bpmn\r
+\r
+ a. Setup callback variables -  Here mainly the correlator variable and the sdnc timeout variable is set\r
+\r
+ b. callSDNC -  Here post call to sdnc client is done with the above prepared payload. And then isSDNCCompleted is set to the execution variable\r
+\r
+Both the above tasks are implemented in SDNCRequestTasks.\r
+http://sdnc-oam.onap:8282/restconf/operations/GENERIC-RESOURCE-API:service-topology-operation/\r
+\r
+# 7. AAI Update (svc instance)- implemented in th updateOrchestrationStatusAssignedService in AAIUpdateTasks\r
+ BPMN access method to update the status of Service to Assigned in AAI.\r
+ Here serviceInstance is obtained , then its orchestration status is changed to assigned  and is updated in the AAI\r
+\r
+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\r
+\r
+Reaches back to ExecuteBuildingBlock.bpmn\r
+\r
+# 5. Post validate the generic building block\r
+\r
+# 6. Set Handling Code To Success - implemented in setHandlingStatusSuccess in ExecuteBuildingBlockRainyDay\r
+handling code is set to success for the execution variable\r
+\r
+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\r
+\r
+Reaches back to WorkflowActionBB.bpmn\r
+\r
+# 7. postProcessingExecuteBB \r
+If the building block excuted is ActivateVfModuleBB, then a postProcessingExecuteBBActivateVfModule needs to be executed\r
+\r
+Then again it is looped back to selectBB through a checkRetryStatus block.\r
+This block comes into play only if the handlingCode is retry, and the retry count is lesser than the maximum allowed no of retries, then the current sequence is again reduced by 1 , so that the same block is executed again.Request in the requestdb is updated with a setRetryStatusMessage, keeping an eye on the no of retries executed.\r
+\r
+\r
+And in this particular example ActivateServiceInstanceBB.bpmn is called next in the sequence.\r
+Here updateOrchestrationStatusActiveService is called, which is BPMN access method to update status of Service to Active in AAI. Here orchestrationStatus is set to active for the particular service instance and is updated in the AAI .\r
+\r
+# 8. updateRequestStatusToComplete is called if the "complete" flag is true\r
+ a. Here first the request is got from the requestDbclient http://request-db-adapter:8083/infraActiveRequests/requestid \r
+\r
+ b. Then a status message is formed as "Macro-" + resourceName + "-" + action + " request was executed correctly."\r
+\r
+   This status message is updated in the request as well as is set to finalStatusMessage of the execution variable\r
+\r
+ c. Other request parameters are updated\r
+\r
+  request.setEndTime(endTime);\r
+\r
+  request.setFlowStatus("Successfully completed all Building Blocks");\r
+\r
+  request.setProgress(Long.valueOf(100));\r
+\r
+  request.setRequestStatus("COMPLETE");\r
+\r
+  request.setLastModifiedBy("CamundaBPMN");\r
+\r
+ d. This new request parameters are updated by a put request to the requestDbclient\r
+\r
+\r
+\r
+\r
+Flow ends\r
+----------\r
+\r
+If there are other resources present along with the service : Eg :- Volumegroup.( These BBs wil be specifically called ) \r
+\r
+1) AssignVolumeGroupBB :\r
\r
+ a. genericvnfid and volumegroupid is obtained from the execution block.\r
+ b. volumegroup orchestrationstatus is set to assigned\r
+ c. a volume group of the above details is created in aai\r
+ d. connect volumegroup to this genericvnf\r
+ e. cloud configuration is got, and then the volumegroup is linked to tenant\r
+\r
+\r
+\r
+2) createVolumeGroupBB :\r
+\r
+ a. get the vf details according to Vf module id from sdnc.\r
+ b. vfmodulequeriedfromsdnc is set to the executionvariable.\r
+ c. createVolumeGroupRequest is formed with getCloudRegion, serviceinstance, genericVnf, volumegroup, sdncVfModuleQueryResponse.\r
+ d. calls vnfadapter, which in turn calls openstackadaptertask.\r
+ e. update heattask in the volumegroup and which is ammended in the aai.\r
+ f. orchestrationstatus for the volume group is set to created.\r
+\r
+\r
+3) ActivateVolumeGroupBB :\r
+\r
+ orchestrationstatus for the volume group is ammended to active.\r
+\r
diff --git a/docs/developer_info/Cxf_Logging.rst b/docs/developer_info/Cxf_Logging.rst
new file mode 100644 (file)
index 0000000..ea2bbf5
--- /dev/null
@@ -0,0 +1,210 @@
+.. This work is licensed under a Creative Commons Attribution 4.0 International License.
+.. http://creativecommons.org/licenses/by/4.0
+.. Copyright 2020 Huawei Technologies Co., Ltd.
+
+CXF-logging:
+=============
+It is a logging framework from SO. Here basically we are having 2 interceptors which extends AbstractSoapInterceptor.
+
+SOAPLoggingInInterceptor:
++++++++++++++++++++++++++++
+
+* This interceptor is responsible for Capturing requestId , client ip address , invocation id, service name, instance id, entry timestamp , log timestamp, Elapsed time for each request and update the MDC logger with staus In-progress.
+
+SOAPLoggingOutInterceptor:
+++++++++++++++++++++++++++++
+* This interceptor is responsible for log timestamp , elapsed time for each request and checks for if there is any exception update the MDC loggers with 500 response code otherwise update the status as completed.
+
+
+cxf-logging Used By below components of SO:
+++++++++++++++++++++++++++++++++++++++++++++
+The cxf-logging framework is used by below components of so.
+
+mso-openstack-adapter.
+mso-requests-db-adapter.
+mso-sdnc-adapter.
+mso-infrastructure-bpmn.
+
+cxf-logging dependency for using in other components:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++
+  
+  <dependency>
+      <groupId>org.onap.so</groupId>
+      <artifactId>cxf-logging</artifactId>
+      <version>${project.version}</version>
+
+    </dependency>
+
+pom.xml:
++++++++++
+<?xml version="1.0"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 
+
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+
+    <groupId>org.onap.so</groupId>
+    <artifactId>so</artifactId>
+    <version>1.6.0-SNAPSHOT</version>
+
+  </parent>
+  <name>CXFLogging</name>
+  <description>Common CXF Logging Classes</description>
+  <dependencies>
+
+    <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>
+      <artifactId>javax.servlet-api</artifactId>
+
+    </dependency>
+
+    <dependency>
+
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-ext</artifactId>
+
+    </dependency>
+
+    <dependency>
+
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
+
+    </dependency>
+
+  </dependencies>
+
+  <build>
+    <resources>
+      <resource>
+        <directory>src/main/resources</directory>
+        <filtering>true</filtering>
+
+      </resource>
+
+      <resource>
+
+        <directory>src/main/java</directory>
+
+        <includes>
+
+          <include>*.java</include>
+
+        </includes>
+
+      </resource>
+
+    </resources>
+
+  </build>
+
+  <artifactId>cxf-logging</artifactId>
+
+</project>
+
+Configuration file:
+++++++++++++++++++++
+Here we can do configure the logger properties for the cxf-logging.
+
+<configuration>
+
+       <property name="p_tim" value="%d{&quot;yyyy-MM-dd'T'HH:mm:ss.SSSXXX&quot;, UTC}"/>
+
+    <property name="p_lvl" value="%level"/>
+
+    <property name="p_log" value="%logger"/>
+
+    <property name="p_mdc" value="%replace(%replace(%mdc){'\t','\\\\t'}){'\n', '\\\\n'}"/>
+
+    <property name="p_msg" value="%replace(%replace(%msg){'\t', '\\\\t'}){'\n','\\\\n'}"/>
+
+    <property name="p_exc" value="%replace(%replace(%rootException){'\t', '\\\\t'}){'\n','\\\\n'}"/>
+
+    <property name="p_mak" value="%replace(%replace(%marker){'\t', '\\\\t'}){'\n','\\\\n'}"/>
+
+    <property name="p_thr" value="%thread"/>
+
+    <property name="pattern" value="%nopexception${p_tim}\t${p_thr}\t${p_lvl}\t${p_log}\t${p_mdc}\t${p_msg}\t${p_exc}\t${p_mak}\t%n"/>
+
+       <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+
+               <encoder>
+
+                       <pattern>${pattern}</pattern>
+
+               </encoder>
+
+       </appender>
+
+       <appender name="test"
+               class="org.onap.so.utils.TestAppender" />
+
+       <logger name="com.att.ecomp.audit" level="info" additivity="false">
+
+               <appender-ref ref="STDOUT" />
+
+       </logger>
+
+       <logger name="com.att.eelf.metrics" level="info" additivity="false">
+
+               <appender-ref ref="STDOUT" />
+
+       </logger>
+
+       <logger name="com.att.eelf.error" level="WARN" additivity="false">
+
+               <appender-ref ref="STDOUT" />
+
+       </logger>
+
+       <logger name="org.onap" level="${so.log.level:-DEBUG}" additivity="false">
+               <appender-ref ref="STDOUT" />
+
+               <appender-ref ref="test" />
+
+       </logger>
+       
+       <logger name="org.flywaydb" level="DEBUG" additivity="false">
+        <appender-ref ref="STDOUT" />
+
+    </logger>
+
+       <logger name="ch.vorburger" level="WARN" additivity="false">
+               <appender-ref ref="STDOUT" />
+
+       </logger>
+
+       <root level="WARN">
+               <appender-ref ref="STDOUT" />
+               <appender-ref ref="test" />
+
+       </root>
+
+</configuration>
+
index 1b9e83b..a060da6 100644 (file)
@@ -21,5 +21,6 @@ SO Developer Information
    BPMN_Project_Deployment_Strategy.rst
    BPMN-INFRA_Workflow_Understanding.rst
    Mso_Openstack_Adapter.rst
+   Cxf_Logging.rst
    instantiate/index.rst
    FAQs.rst
diff --git a/docs/developer_info/mso_adapter_restinterface.rst b/docs/developer_info/mso_adapter_restinterface.rst
new file mode 100644 (file)
index 0000000..49a9cad
--- /dev/null
@@ -0,0 +1,288 @@
+Mso-adapters-rest-interface
+---------------------------
+.. image:: ../images/module_structure.png
+
+It mainly contains the payload that is provided to different rest calls in SO
+
+Network
+--------
+# 1. Network contain beans( classes with multiple attributes and thier setters and getters) and their corresponding mappers which will be used by the network adapter of  SO. Contrail networking is used for cloud network automation
+
+Beans
+-----
+ # a. ContrailPolicyRef : this class has following attribute   
+       private ContrailPolicyRefSeq seq;
+
+       Usage: adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java- while creating network in openstack,  network stack is created depending on stackParams. So if pFqdns(FQDN address object is used in order to use DNS names in firewall policies) are there in the inputrequest to createNetwork, then mergePolicyRefs method is called, where for each input pFqdns, a new ContrailPolicyRef is created and appended to a list. Then this is added as value to stackParams with policy_refsdata as key.
+
+ # b. ContrailPolicyRefSeq : Attributes are
+   private String major;
+
+   private String minor ;
+
+   Usage: adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java- As this is an attribute to the ContrailPolicyRef explained above. So when a new ContrailPolicyRef() is created in mergePolicyRefs method, correspondingly a new ContrailPolicyRefSeq should be created.
+
+ # c. ContrailSubnet – Its a subnetwork having attributes 
+    private ContrailSubnetIp subnet = new ContrailSubnetIp();
+
+    private String defaultGateway;
+
+    private String subnetName;
+
+    private Boolean enableDhcp(dynamic host config);
+
+    private Boolean addrFromStart = true;
+
+    private List<ContrailSubnetPool> allocationPools = new ArrayList<>();
+
+    private ContrailSubnetHostRoutes hostRoutes = new ContrailSubnetHostRoutes();
+
+    Usage : adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java- While creating network mergeSubnetsAIC3 is called if a list of subnets are present. The subnets are mapped to ContrailSubnet using ContrailSubnetMapper, and then are added to the heat template and stackparams which are used for network creation in openstack.
+
+ # d. ContrailSubnetHostRoute : This is an attribute defined in contrailsubnet and has following attributes
+    private String prefix;
+
+    private String nextHop; 
+
+    Usage : This is an attribute of ContrailSubnetHostRoutes , which is used within the contrailSubnet and thus is used in network creation and updation.
+
+ # e. ContrailSubnetHostRoutes : This class is used to store an list of ContrailSubnetHostRoute 
+
+    private List<ContrailSubnetHostRoute> hostRoutes = new ArrayList<>();
+
+    Usage : attribute of contrailSubnet
+
+ # f. ContrailSubnetIp : attributes are
+     private String ipPrefix;
+
+     private String ipPrefixLen; 
+     This class is used to store the cidr value , which is used as a interrouting table, taking as ipaddress/total no . Eg : 10.0.0.0/24 means starting ip is 10.0.0.0, and total no of ip address possible here is 256 (2^(32-24)), the last address being 10.0.0.255.
+
+     Usage : important attribute of contrailSubnet
+
+ # g. ContrailSubnetPool : attributes are starting and ending ip address of the subnet
+    private String start;
+
+    private String end;
+
+    Usage: a list of ContrailSubnetPool forms an important attribute of contrailSubnet
+
+Mappers
+-------
+
+ # a. ContrailSubnetMapper : It is used to map the inputsubnet to a contrailSubnet
+   public ContrailSubnetMapper(Subnet inputSubnet) {
+        this.inputSubnet = inputSubnet;
+
+    }
+
+   The map method within is used for the mapping. Here first a contrailSubnet is created, and depending on whether the subnet has name or id, the contrailSubnet’s name is initialized, then if it has cidr , then a contrailSubnetIp is created, and is added into it, which is then added to contrailSubnet created before. Depending on whether input has allocationpool or hostroutes, these are casted into ContrailSubnetPool and ContrailSubnetHostRoute using ContrailSubnetPoolMapper and ContrailSubnetPoolMapper respectively.
+
+   Usage: adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java :The subnets are mapped to ContrailSubnet using ContrailSubnetMapper, and then are added to the heat template and stackparams which are used for network creation
+
+ # b. ContrailSubnetPoolMapper : It is used to map the pool within the subnets to contrailSubnetPool. Used within contrailSubnetMapper. Here, the particular pool is added only if it has both the start and end ip address. 
+
+ # c. ContrailSubnetHostRoute : It is used to map the host routes within the subnets to contrailSubnetHostRoute. Used within contrailSubnetMapper. Here, the particular host route is added if either of the next hop or ip prefix is defined.
+
+Network request
+---------------
+
+#2. Network request : It contains the payloads for different types of network requests
+
+ # a. ContrailNetwork :
+    private String shared = "false";
+
+    private String external = "false";
+
+    private List<RouteTarget> routeTargets;
+
+    private List<String> policyFqdns;
+
+    private List<String> routeTableFqdns;
+
+    Usage: contrailNetwork is an important attribute of CreateNetworkRequest, So is to be used where all the request to createNetwork is required.
+
+  # 1. adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/StackService.java : Here the input to createNetwork requires contrailNetwork parameter, so here it checks whether  contrailNetwork is already present, if not a new is created.
+
+  # 2.bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java : Here in createNetworkRequestMapper, createNetworkRequest is formed where in buildContrailNetwork, a new contrailNetwork is created and initialized. This request is used to create a network and set the corresponding execution variable   
+
+ # b. CreateNetworkError: It extends NetworkExceptionResponse. And is used when an error occurs during network creation
+
+ # c. NetworkExceptionResponse : it extends NetworkResponseCommon. Attributes are 
+    private String message;
+
+    private MsoExceptionCategory category;
+
+    private Boolean rolledBack; 
+
+ # d. NetworkResponseCommon: Attribute is 
+    private String messageId; 
+
+ # e. CreateNetworkRequest: extends NetworkRequestCommon
+    private String cloudSiteId;
+
+    private String tenantId;
+
+    private String networkId;
+
+    private String networkName;
+
+    private String networkType;
+
+    private String networkTypeVersion;
+
+    private String modelCustomizationUuid;
+
+    private String networkTechnology = "NEUTRON";
+
+    private List<Subnet> subnets;
+
+    private ProviderVlanNetwork providerVlanNetwork;
+
+    private ContrailNetwork contrailNetwork;
+
+    private Boolean failIfExists = false;
+
+    private Boolean backout = true;
+
+    private Map<String, String> networkParams = new HashMap<>();
+
+    private MsoRequest msoRequest = new MsoRequest();
+
+    private boolean contrailRequest;
+
+    Usage :
+    #1) bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIQueryTasks.java:  Here in getNetworkVpnBinding, where VPN Binding data from AAI result is extracted. There in routeTargets is got, and is updated in the execution variable(“createNetworkRequest”).
+
+    #2)bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterCreateTasks.java – Here in createnetwork returns a CreateNetworkRequest which is updated in execution variable(“networkAdapterRequest”)
+
+    #3)bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetwork.java - 
+    Here in createnetwork returns a CreateNetworkRequest which is updated in execution variable(“createNetworkRequest”)
+
+    #4) bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/NetworkAdapterClientImpl.java -Here createNetwork request is processed as a restclient post process with CreateNetworkRequest as input.
+
+ # f. CreateNetworkResponse : extends NetworkResponseCommon
+    private String networkId;
+
+    private String neutronNetworkId;
+
+    private String networkStackId;
+
+    private String networkFqdn;
+
+    private Boolean networkCreated;
+
+    private Map<String, String> subnetMap;
+
+    private NetworkRollback rollback = new NetworkRollback();
+
+    Usage:
+    #1)bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java :here after the network is created, the l3 network is updated with those parameters which come from execution variable("createNetworkResponse")
+
+    #2)bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterCreateTasks.java – depending on variable networkCreated of response, networkAdapterCreateRollback is set to true. 
+
+    #3)bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/NetworkAdapterClientImpl.java -Here createNetwork request is processed as a restclient post process with CreateNetworkRequest as input and CreateNetworkResponse as output 
+
+ # g.DeleteNetworkError : extends NetworkExceptionResponse
+
+ # h. DeleteNetworkRequest:extends NetworkRequestCommon
+    private String cloudSiteId;
+
+    private String tenantId;
+
+    private String networkId;
+
+    private String networkStackId;
+
+    private String networkType;
+
+    private String modelCustomizationUuid;
+
+    private MsoRequest msoRequest = new MsoRequest();
+
+    Usage: 
+    #1)bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterDeleteTasks.java – deleteNetworkRequestMapper returns a DeleteNetworkRequest, which is set to the execution variable(“networkAdapterRequest”)
+
+    #2)bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/NetworkAdapterClientImpl.java - Here deleteNetwork request is processed as a restclient delete process with DeleteNetworkRequest as input.
+
+    #3)bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java – Here the deleteNetworkRequestMapper forms DeleteNetworkRequest object 
+
+  Similarly others are also implemented and used
+.. image:: ../images/nwrest.png
+
+Sdnc request
+------------
+
+#3. Sdnc request -These are required by the mso-sdnc-adapter
+
+ # a. RequestInformation – This is an important parameter of SDNCServiceRequest. Thud is used during the conversion of SDNCServiceRequest to XMLstring.
+
+ # b. ServiceInformation – This stores the important information like serviceId, servicetype and SubscriberName. Its parameter of SDNCServiceRequest.
+
+ # c. SDNCErrorCommon – it extends SDNCResponseCommon . 
+  Usage : adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestConnector.java – catching exception if any happens during request creation and a new SDNCErrorCommon is created.
+
+ # d. SDNCRequestCommon – SDNCServiceRequest extends SDNCRequestCommon. It has some attributes like bpNotificationUrl(Endpoint on which BPMN can receive notifications from the SDNC adapter), bpTimeout ans sdncrequestId.
+
+ # e. SDNCServiceRequest
+  Usage: adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java – Here the runRequest is happening, where we are posting this request using a restclient call with SDNCServiceRequest as input.
+
+ # f. SDNCServiceResponse and SDNCServiceError 
+  Usage:adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java – Here if the above runRequest returns a 2xx response code then a corresponding SDNCServiceResponse is created and returned or else SDNCServiceError is created and returned
+
+Tenant request
+---------------
+
+#4. These provide classes to be used by the so-adapters.tenant.
+
+The operator of a cloud can present unchangeable networks to the users, or give users the option to create, delete, connect and generally manipulate networks. The latter type of networks is called “tenant networks”.
+
+Used in adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/TenantAdapterRest.java
+
+The implementation and usage is similiar to the above classes
+
+.. image:: ../images/tenantrest.png
+
+VDU
+---
+
+#5. Vdu – these are used for the deployment and management of (cloud-agnostic) VDU . The abstract classes for instantiation of vdu, query vdu, delete vdu, update vdu are defined in here.
+
+These are implemented in adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java and adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java
+
+Vnfrest
+-------
+
+#6. Vnfrest – These are used to manage vnfs and vgs.
+These are used in the project similiar to networkrest
+Foreg : Usage of DeleteVfModuleRequest: 
+
+1)bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasks.java – Here in deleteVfModuleRequestMapper creates a new DeleteVfModuleRequest, and is set to the execution variable(“VNFREST_REQUEST” ) and “deleteVfModuleRequest” execution variable is set true
+
+2)bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfAdapterClientImpl.java -  Here a delete rest request is send
+
+.. image:: ../images/vnfrest.png
+
+
+OPENSTACK
+---------
+Openstack is classified into beans, exceptions, and mappers
+
+MAPPERS
+-------
+ # 1) JAXBContext: It is used to convert a object to xml(marshalling) and to convert xml to object (unmarshalling) . These marshalling and unmarshalling are overriden in the map adapters in mappers.
+
+ # 2)NetworkInfoMapper – used to Capture the data from a Neutron Network object and cast it into a networkInfo( present in beans of openstack). Here in vlan information is located depending on network.getProviderNetworkType() , and if not then the segments within the network is iterated and is checked for the same.
+  Usage: It is used in adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoNeutronUtils.java , where on createNetwork, queryNetwork and updateNetwork , the network is mapped by  NetworkInfoMapper into networkInfo and returned.
+
+ # 3) StackInfoMapper – used to Capture the data from a Stack object and cast it into a stackInfo( present in beans of openstack). 
+  Usage: It is used in adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils , where all createStack, queryStack, updateStack, deleteStack is done, a new instance of stackInfo is returned
+
+Exceptions
+----------
+These are set of msoexceptions provided, and would be used depending on what exception needs to be handled
+
+.. image:: ../images/msoexception.png
diff --git a/docs/images/AssignServiceInstanceBB.png b/docs/images/AssignServiceInstanceBB.png
new file mode 100644 (file)
index 0000000..d1dbb03
Binary files /dev/null and b/docs/images/AssignServiceInstanceBB.png differ
diff --git a/docs/images/ExecuteBuildingBlock.png b/docs/images/ExecuteBuildingBlock.png
new file mode 100644 (file)
index 0000000..7c8256c
Binary files /dev/null and b/docs/images/ExecuteBuildingBlock.png differ
diff --git a/docs/images/flowchart.png b/docs/images/flowchart.png
new file mode 100644 (file)
index 0000000..cbb9aef
Binary files /dev/null and b/docs/images/flowchart.png differ
diff --git a/docs/images/module_structure.png b/docs/images/module_structure.png
new file mode 100644 (file)
index 0000000..c25441b
Binary files /dev/null and b/docs/images/module_structure.png differ
diff --git a/docs/images/msoexception.png b/docs/images/msoexception.png
new file mode 100644 (file)
index 0000000..b9d2dfd
Binary files /dev/null and b/docs/images/msoexception.png differ
diff --git a/docs/images/nwrest.png b/docs/images/nwrest.png
new file mode 100644 (file)
index 0000000..58b66d5
Binary files /dev/null and b/docs/images/nwrest.png differ
diff --git a/docs/images/tenantrest.png b/docs/images/tenantrest.png
new file mode 100644 (file)
index 0000000..ec1c77e
Binary files /dev/null and b/docs/images/tenantrest.png differ
diff --git a/docs/images/vnfrest.png b/docs/images/vnfrest.png
new file mode 100644 (file)
index 0000000..f617207
Binary files /dev/null and b/docs/images/vnfrest.png differ
diff --git a/docs/images/workflow.png b/docs/images/workflow.png
new file mode 100644 (file)
index 0000000..a62a4e6
Binary files /dev/null and b/docs/images/workflow.png differ
index dc9bf47..d95ef8d 100644 (file)
               <singularClass>org.onap.aaiclient.client.aai.AAIObjectType</singularClass>
               <pluralClass>org.onap.aaiclient.client.aai.AAIObjectPlurals</pluralClass>
               <nameClass>org.onap.aaiclient.client.aai.AAIObjectName</nameClass>
+              <singleFragmentClass>org.onap.aaiclient.client.aai.entities.uri.AAISingleFragment</singleFragmentClass>
+              <pluralFragmentClass>org.onap.aaiclient.client.aai.entities.uri.AAIPluralFragment</pluralFragmentClass>
             </configuration>
           </execution>
         </executions>
index 78f8350..ee06fa4 100644 (file)
@@ -22,61 +22,12 @@ package org.onap.aaiclient.client.aai;
 
 import java.io.Serializable;
 import org.onap.aaiclient.client.graphinventory.GraphInventoryObjectPlurals;
-import org.onap.so.constants.Defaults;
 import com.google.common.base.CaseFormat;
 
 public class AAIObjectPlurals implements AAIObjectBase, GraphInventoryObjectPlurals, Serializable {
 
     private static final long serialVersionUID = 5312713297525740746L;
 
-    public static final AAIObjectPlurals CUSTOMER =
-            new AAIObjectPlurals(AAIObjectType.CUSTOMER, AAINamespaceConstants.BUSINESS, "/customers");
-    public static final AAIObjectPlurals GENERIC_VNF =
-            new AAIObjectPlurals(AAIObjectType.GENERIC_VNF, AAINamespaceConstants.NETWORK, "/generic-vnfs");
-    public static final AAIObjectPlurals PORT_GROUP =
-            new AAIObjectPlurals(AAIObjectType.PORT_GROUP, AAIObjectType.VCE.uriTemplate(), "/port-groups");
-    public static final AAIObjectPlurals PSERVER =
-            new AAIObjectPlurals(AAIObjectType.PSERVER, AAINamespaceConstants.CLOUD_INFRASTRUCTURE, "/pservers");
-    public static final AAIObjectPlurals P_INTERFACE =
-            new AAIObjectPlurals(AAIObjectType.P_INTERFACE, AAIObjectType.PSERVER.uriTemplate(), "/p-interfaces");
-    public static final AAIObjectPlurals L3_NETWORK =
-            new AAIObjectPlurals(AAIObjectType.L3_NETWORK, AAINamespaceConstants.NETWORK, "/l3-networks");
-    public static final AAIObjectPlurals NETWORK_POLICY =
-            new AAIObjectPlurals(AAIObjectType.NETWORK_POLICY, AAINamespaceConstants.NETWORK, "/network-policies");
-    public static final AAIObjectPlurals VPN_BINDING =
-            new AAIObjectPlurals(AAIObjectType.VPN_BINDING, AAINamespaceConstants.NETWORK, "/vpn-bindings");
-    public static final AAIObjectPlurals SERVICE_SUBSCRIPTION = new AAIObjectPlurals(AAIObjectType.SERVICE_SUBSCRIPTION,
-            AAIObjectType.CUSTOMER.uriTemplate(), "/service-subscriptions");
-    public static final AAIObjectPlurals SERVICE_INSTANCE = new AAIObjectPlurals(AAIObjectType.SERVICE_INSTANCE,
-            AAIObjectType.SERVICE_SUBSCRIPTION.uriTemplate(), "/service-instances");
-    public static final AAIObjectPlurals OWNING_ENTITY =
-            new AAIObjectPlurals(AAIObjectType.OWNING_ENTITY, AAINamespaceConstants.BUSINESS, "/owning-entities");
-    public static final AAIObjectPlurals VOLUME_GROUP = new AAIObjectPlurals(AAIObjectType.VOLUME_GROUP,
-            AAIObjectType.CLOUD_REGION.uriTemplate(), "/volume-groups");
-    public static final AAIObjectPlurals AVAILIBILITY_ZONE = new AAIObjectPlurals(AAIObjectType.AVAILIBILITY_ZONE,
-            AAIObjectType.CLOUD_REGION.uriTemplate(), "/availability-zones");
-    public static final AAIObjectPlurals VF_MODULE =
-            new AAIObjectPlurals(AAIObjectType.VF_MODULE, AAIObjectType.GENERIC_VNF.uriTemplate(), "/vf-modules");
-    public static final AAIObjectPlurals CONFIGURATION =
-            new AAIObjectPlurals(AAIObjectType.CONFIGURATION, AAINamespaceConstants.NETWORK, "/configurations");
-    public static final AAIObjectPlurals DEFAULT_TENANT =
-            new AAIObjectPlurals(AAIObjectType.DEFAULT_TENANT, AAINamespaceConstants.CLOUD_INFRASTRUCTURE
-                    + "/cloud-regions/cloud-region/" + Defaults.CLOUD_OWNER + "/AAIAIC25", "/tenants");
-    public static final AAIObjectPlurals NETWORK_TECHNOLOGY = new AAIObjectPlurals(AAIObjectType.NETWORK_TECHNOLOGY,
-            AAINamespaceConstants.CLOUD_INFRASTRUCTURE, "/network-technologies");
-    public static final AAIObjectPlurals LOGICAL_LINK =
-            new AAIObjectPlurals(AAIObjectType.LOGICAL_LINK, AAINamespaceConstants.NETWORK, "/logical-links");
-    public static final AAIObjectPlurals L_INTERFACE =
-            new AAIObjectPlurals(AAIObjectType.L_INTERFACE, AAIObjectType.VSERVER.uriTemplate(), "/l-interfaces");
-    public static final AAIObjectPlurals SUB_L_INTERFACE =
-            new AAIObjectPlurals(AAIObjectType.L_INTERFACE, AAIObjectType.L_INTERFACE.uriTemplate(), "/l-interfaces");
-    public static final AAIObjectPlurals INSTANCE_GROUP =
-            new AAIObjectPlurals(AAIObjectType.INSTANCE_GROUP, AAINamespaceConstants.NETWORK, "/instance-groups");
-    public static final AAIObjectPlurals PNF =
-            new AAIObjectPlurals(AAIObjectType.PNF, AAINamespaceConstants.NETWORK, "/pnfs");
-    public static final AAIObjectPlurals PROJECT =
-            new AAIObjectPlurals(AAIObjectType.PROJECT, AAINamespaceConstants.BUSINESS, "/projects");
-
     private final String uriTemplate;
     private final String partialUri;
     private final String name;
index 2335a48..55a487d 100644 (file)
 
 package org.onap.aaiclient.client.aai;
 
-import com.google.common.base.CaseFormat;
+import java.io.Serializable;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+import java.util.regex.Pattern;
 import org.onap.aai.annotations.Metadata;
-import org.onap.aai.domain.yang.AggregateRoute;
-import org.onap.aai.domain.yang.AllottedResource;
-import org.onap.aai.domain.yang.AvailabilityZone;
-import org.onap.aai.domain.yang.CloudRegion;
-import org.onap.aai.domain.yang.Collection;
-import org.onap.aai.domain.yang.CommunicationServiceProfile;
-import org.onap.aai.domain.yang.Complex;
-import org.onap.aai.domain.yang.Configuration;
-import org.onap.aai.domain.yang.Connector;
-import org.onap.aai.domain.yang.Customer;
-import org.onap.aai.domain.yang.Device;
-import org.onap.aai.domain.yang.EsrVnfm;
-import org.onap.aai.domain.yang.ExtAaiNetwork;
-import org.onap.aai.domain.yang.Flavor;
-import org.onap.aai.domain.yang.GenericVnf;
-import org.onap.aai.domain.yang.Image;
-import org.onap.aai.domain.yang.InstanceGroup;
-import org.onap.aai.domain.yang.L3Network;
-import org.onap.aai.domain.yang.LInterface;
-import org.onap.aai.domain.yang.LineOfBusiness;
-import org.onap.aai.domain.yang.LogicalLink;
-import org.onap.aai.domain.yang.ModelVer;
-import org.onap.aai.domain.yang.NetworkPolicy;
-import org.onap.aai.domain.yang.NetworkTechnology;
-import org.onap.aai.domain.yang.OperationalEnvironment;
-import org.onap.aai.domain.yang.OwningEntity;
-import org.onap.aai.domain.yang.PInterface;
-import org.onap.aai.domain.yang.PhysicalLink;
-import org.onap.aai.domain.yang.Platform;
-import org.onap.aai.domain.yang.Pnf;
-import org.onap.aai.domain.yang.PortGroup;
-import org.onap.aai.domain.yang.Project;
-import org.onap.aai.domain.yang.Pserver;
-import org.onap.aai.domain.yang.RouteTableReference;
-import org.onap.aai.domain.yang.Service;
-import org.onap.aai.domain.yang.ServiceInstance;
-import org.onap.aai.domain.yang.ServiceProfile;
-import org.onap.aai.domain.yang.ServiceSubscription;
-import org.onap.aai.domain.yang.SliceProfile;
-import org.onap.aai.domain.yang.SpPartner;
-import org.onap.aai.domain.yang.SriovPf;
-import org.onap.aai.domain.yang.SriovVf;
-import org.onap.aai.domain.yang.Subnet;
-import org.onap.aai.domain.yang.Tenant;
-import org.onap.aai.domain.yang.TunnelXconnect;
-import org.onap.aai.domain.yang.Vce;
-import org.onap.aai.domain.yang.VfModule;
-import org.onap.aai.domain.yang.VlanTag;
-import org.onap.aai.domain.yang.Vnfc;
-import org.onap.aai.domain.yang.VolumeGroup;
-import org.onap.aai.domain.yang.VpnBinding;
-import org.onap.aai.domain.yang.Vserver;
-import org.onap.aai.domain.yang.Zone;
 import org.onap.aaiclient.client.aai.entities.uri.AAIFluentTypeReverseLookup;
+import org.onap.aaiclient.client.graphinventory.GraphInventoryObjectName;
 import org.onap.aaiclient.client.graphinventory.GraphInventoryObjectType;
-import org.onap.so.constants.Defaults;
 import org.reflections.Reflections;
 import org.reflections.scanners.SubTypesScanner;
 import org.reflections.util.ClasspathHelper;
 import org.reflections.util.ConfigurationBuilder;
-import java.io.Serializable;
-import java.net.URL;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-import java.util.regex.Pattern;
+import com.google.common.base.CaseFormat;
 
-public class AAIObjectType implements AAIObjectBase, GraphInventoryObjectType, Serializable {
+/**
+ * Types are accessed through AAIFluentTypeBuilder and should no longer be added as static members
+ *
+ */
+public class AAIObjectType implements AAIObjectBase, AAIObjectName, GraphInventoryObjectType, Serializable {
 
     private static final long serialVersionUID = -2877184776691514600L;
     private static Map<String, AAIObjectType> map = new HashMap<>();
 
-    public static final AAIObjectType DEFAULT_CLOUD_REGION = new AAIObjectType(
-            AAINamespaceConstants.CLOUD_INFRASTRUCTURE,
-            "/cloud-regions/cloud-region/" + Defaults.CLOUD_OWNER + "/{cloud-region-id}", "default-cloud-region");
-    public static final AAIObjectType CUSTOMER = new AAIObjectType(AAINamespaceConstants.BUSINESS, Customer.class);
     public static final AAIObjectType GENERIC_QUERY = new AAIObjectType("/search", "/generic-query", "generic-query");
     public static final AAIObjectType BULK_PROCESS = new AAIObjectType("/bulkprocess", "", "bulkprocess");
     public static final AAIObjectType SINGLE_TRANSACTION =
             new AAIObjectType("/bulk/single-transaction", "", "single-transaction");
-    public static final AAIObjectType GENERIC_VNF = new AAIObjectType(AAINamespaceConstants.NETWORK, GenericVnf.class);
-    public static final AAIObjectType GENERIC_VNFS =
-            new AAIObjectType(AAINamespaceConstants.NETWORK, "/generic-vnfs", "generic-vnfs");
-    public static final AAIObjectType VF_MODULE =
-            new AAIObjectType(AAIObjectType.GENERIC_VNF.uriTemplate(), VfModule.class);
-    public static final AAIObjectType L3_NETWORK = new AAIObjectType(AAINamespaceConstants.NETWORK, L3Network.class);
-    public static final AAIObjectType NETWORK_POLICY =
-            new AAIObjectType(AAINamespaceConstants.NETWORK, NetworkPolicy.class);
     public static final AAIObjectType NODES_QUERY = new AAIObjectType("/search", "/nodes-query", "nodes-query");
     public static final AAIObjectType CUSTOM_QUERY = new AAIObjectType("/query", "", "query");
-    public static final AAIObjectType ROUTE_TABLE_REFERENCE =
-            new AAIObjectType(AAINamespaceConstants.NETWORK, RouteTableReference.class);
-    public static final AAIObjectType DEFAULT_TENANT =
-            new AAIObjectType(AAINamespaceConstants.CLOUD_INFRASTRUCTURE + "/cloud-regions/cloud-region/"
-                    + Defaults.CLOUD_OWNER + "/AAIAIC25", "/tenants/tenant/{tenant-id}", "default-tenant");
-    public static final AAIObjectType VCE = new AAIObjectType(AAINamespaceConstants.NETWORK, Vce.class);
-    public static final AAIObjectType PORT_GROUP = new AAIObjectType(AAIObjectType.VCE.uriTemplate(), PortGroup.class);
-    public static final AAIObjectType VPN_BINDING = new AAIObjectType(AAINamespaceConstants.NETWORK, VpnBinding.class);
-    public static final AAIObjectType CONFIGURATION =
-            new AAIObjectType(AAINamespaceConstants.NETWORK, Configuration.class);
-    public static final AAIObjectType PSERVER =
-            new AAIObjectType(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, Pserver.class);
-    public static final AAIObjectType SERVICE_SUBSCRIPTION =
-            new AAIObjectType(AAIObjectType.CUSTOMER.uriTemplate(), ServiceSubscription.class);
-
-    public static final AAIObjectType SERVICE_INSTANCE_METADATA = new AAIObjectType(
-            AAIObjectType.SERVICE_INSTANCE + "/metadata", org.onap.aai.domain.yang.v13.Metadata.class);
-
-    public static final AAIObjectType SERVICE = new AAIObjectType(
-            AAINamespaceConstants.SERVICE_DESIGN_AND_CREATION + "/services/service/{service-id}", Service.class);
-    public static final AAIObjectType SERVICE_INSTANCE =
-            new AAIObjectType(AAIObjectType.SERVICE_SUBSCRIPTION.uriTemplate(), ServiceInstance.class);
-    public static final AAIObjectType PROJECT = new AAIObjectType(AAINamespaceConstants.BUSINESS, Project.class);
-    public static final AAIObjectType LINE_OF_BUSINESS =
-            new AAIObjectType(AAINamespaceConstants.BUSINESS, LineOfBusiness.class);
-    public static final AAIObjectType PLATFORM = new AAIObjectType(AAINamespaceConstants.BUSINESS, Platform.class);
-    public static final AAIObjectType OWNING_ENTITY =
-            new AAIObjectType(AAINamespaceConstants.BUSINESS, OwningEntity.class);
-    public static final AAIObjectType ALLOTTED_RESOURCE =
-            new AAIObjectType(AAIObjectType.SERVICE_INSTANCE.uriTemplate(), AllottedResource.class);
-    public static final AAIObjectType ALLOTTED_RESOURCE_ALL =
-            new AAIObjectType(AAIObjectType.SERVICE_INSTANCE.uriTemplate(), "/allotted-resources", "allottedResources");
-    public static final AAIObjectType PNF = new AAIObjectType(AAINamespaceConstants.NETWORK, Pnf.class);
-    public static final AAIObjectType OPERATIONAL_ENVIRONMENT =
-            new AAIObjectType(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, OperationalEnvironment.class);
-    public static final AAIObjectType CLOUD_REGION =
-            new AAIObjectType(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, CloudRegion.class);
-    public static final AAIObjectType TENANT =
-            new AAIObjectType(AAIObjectType.CLOUD_REGION.uriTemplate(), Tenant.class);
-    public static final AAIObjectType VOLUME_GROUP =
-            new AAIObjectType(AAIObjectType.CLOUD_REGION.uriTemplate(), VolumeGroup.class);
-    public static final AAIObjectType VSERVER = new AAIObjectType(AAIObjectType.TENANT.uriTemplate(), Vserver.class);
-    public static final AAIObjectType MODEL_VER = new AAIObjectType(
-            AAINamespaceConstants.SERVICE_DESIGN_AND_CREATION + "/models/model/{model-invariant-id}", ModelVer.class);
-    public static final AAIObjectType TUNNEL_XCONNECT =
-            new AAIObjectType(AAIObjectType.ALLOTTED_RESOURCE.uriTemplate(), TunnelXconnect.class);
-    public static final AAIObjectType P_INTERFACE =
-            new AAIObjectType(AAIObjectType.PSERVER.uriTemplate(), PInterface.class);
-    public static final AAIObjectType SRIOV_PF =
-            new AAIObjectType(AAIObjectType.P_INTERFACE.uriTemplate(), SriovPf.class);
-    public static final AAIObjectType LOGICAL_LINK =
-            new AAIObjectType(AAINamespaceConstants.NETWORK, LogicalLink.class);
-    public static final AAIObjectType PHYSICAL_LINK =
-            new AAIObjectType(AAINamespaceConstants.NETWORK, PhysicalLink.class);
-    public static final AAIObjectType INSTANCE_GROUP =
-            new AAIObjectType(AAINamespaceConstants.NETWORK, InstanceGroup.class);
-    public static final AAIObjectType COLLECTION = new AAIObjectType(AAINamespaceConstants.NETWORK, Collection.class);
-    public static final AAIObjectType VNFC = new AAIObjectType(AAINamespaceConstants.NETWORK, Vnfc.class);
-    public static final AAIObjectType VLAN_TAG = new AAIObjectType(AAINamespaceConstants.NETWORK, VlanTag.class);
-    public static final AAIObjectType COMPLEX =
-            new AAIObjectType(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, Complex.class);
-    public static final AAIObjectType CONNECTOR = new AAIObjectType(AAINamespaceConstants.BUSINESS, Connector.class);
-    public static final AAIObjectType NETWORK_TECHNOLOGY =
-            new AAIObjectType(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, NetworkTechnology.class);
-    public static final AAIObjectType SUBNET = new AAIObjectType(AAIObjectType.L3_NETWORK.uriTemplate(), Subnet.class);
-    public static final AAIObjectType SP_PARTNER = new AAIObjectType(AAINamespaceConstants.BUSINESS, SpPartner.class);
-    public static final AAIObjectType DEVICE = new AAIObjectType(AAINamespaceConstants.NETWORK, Device.class);
-    public static final AAIObjectType EXT_AAI_NETWORK =
-            new AAIObjectType(AAINamespaceConstants.NETWORK, ExtAaiNetwork.class);
-    public static final AAIObjectType AGGREGATE_ROUTE =
-            new AAIObjectType(AAINamespaceConstants.NETWORK, AggregateRoute.class);
-    public static final AAIObjectType L_INTERFACE =
-            new AAIObjectType(AAIObjectType.VSERVER.uriTemplate(), LInterface.class);
-    public static final AAIObjectType SRIOV_VF =
-            new AAIObjectType(AAIObjectType.L_INTERFACE.uriTemplate(), SriovVf.class);
-    public static final AAIObjectType SUB_L_INTERFACE = new AAIObjectType(AAIObjectType.L_INTERFACE.uriTemplate(),
-            "/l-interfaces/l-interface/{sub-interface-name}", "sub-l-interface");
-    public static final AAIObjectType IMAGE = new AAIObjectType(AAIObjectType.CLOUD_REGION.uriTemplate(), Image.class);
-    public static final AAIObjectType FLAVOR =
-            new AAIObjectType(AAIObjectType.CLOUD_REGION.uriTemplate(), Flavor.class);
     public static final AAIObjectType UNKNOWN = new AAIObjectType("", "", "unknown") {
 
         private static final long serialVersionUID = 9208984071038447607L;
@@ -202,37 +61,9 @@ public class AAIObjectType implements AAIObjectBase, GraphInventoryObjectType, S
         }
     };
     public static final AAIObjectType DSL = new AAIObjectType("/dsl", "", "dsl");
-    public static final AAIObjectType VNFM = new AAIObjectType(
-            AAINamespaceConstants.EXTERNAL_SYSTEM + "/esr-vnfm-list/esr-vnfm/{vnfm-id}", EsrVnfm.class);
-    public static final AAIObjectType VNFM_LIST =
-            new AAIObjectType(AAINamespaceConstants.EXTERNAL_SYSTEM, "/esr-vnfm-list", "vnfm-list");
-    public static final AAIObjectType VNFM_ESR_SYSTEM_INFO_LIST =
-            new AAIObjectType(AAINamespaceConstants.EXTERNAL_SYSTEM + "/esr-vnfm-list",
-                    "/esr-vnfm/{vnfm-id}/esr-system-info-list", "vnfm-esr-system-info-list");
-    public static final AAIObjectType CLOUD_ESR_SYSTEM_INFO_LIST = new AAIObjectType(
-            AAIObjectType.CLOUD_REGION.uriTemplate(), "/esr-system-info-list", "cloud-esr-system-info-list");
-    public static final AAIObjectType ZONE = new AAIObjectType(AAINamespaceConstants.NETWORK, Zone.class);
-    public static final AAIObjectType AVAILIBILITY_ZONE =
-            new AAIObjectType(AAIObjectType.CLOUD_REGION.uriTemplate(), AvailabilityZone.class);
-    public static final AAIObjectType THIRDPARTY_SDNC_LIST = new AAIObjectType(AAINamespaceConstants.EXTERNAL_SYSTEM,
-            "/esr-thirdparty-sdnc-list", "thirdparty-sdnc-list");
-    public static final AAIObjectType THIRDPARTY_SDNC_SYSTEM_INFO_LIST =
-            new AAIObjectType(AAINamespaceConstants.EXTERNAL_SYSTEM + "/esr-thirdparty-sdnc-list",
-                    "/esr-thirdparty-sdnc/{sdnc-id}/esr-system-info-list", "thirdparty-sdnc-system-info-list");
-    public static final AAIObjectType COMMUNICATION_SERVICE_PROFILE =
-            new AAIObjectType(AAIObjectType.SERVICE_SUBSCRIPTION.uriTemplate(), CommunicationServiceProfile.class);
-    public static final AAIObjectType SERVICE_PROFILE =
-            new AAIObjectType(AAIObjectType.SERVICE_SUBSCRIPTION.uriTemplate(), ServiceProfile.class);
-    public static final AAIObjectType SERVICE_PROFILE_ALL =
-            new AAIObjectType(AAIObjectType.SERVICE_INSTANCE.uriTemplate(), "/service-profiles", "serviceProfiles");
-    public static final AAIObjectType SLICE_PROFILE =
-            new AAIObjectType(AAIObjectType.SERVICE_SUBSCRIPTION.uriTemplate(), SliceProfile.class);
-    public static final AAIObjectType SLICE_PROFILE_ALL =
-            new AAIObjectType(AAIObjectType.SERVICE_INSTANCE.uriTemplate(), "/slice-profiles", "sliceProfiles");
-    public static final AAIObjectType COMMUNICATION_PROFILE_ALL = new AAIObjectType(
-            AAIObjectType.SERVICE_INSTANCE.uriTemplate(), "/communication-service-profiles", "communicationProfiles");
-    public static final AAIObjectType QUERY_ALLOTTED_RESOURCE =
-            new AAIObjectType(AAIObjectType.SERVICE_INSTANCE.uriTemplate(), "?depth=2", "service-Instance");
+    public static final AAIObjectType SUB_L_INTERFACE = new AAIObjectType(
+            "/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}/tenants/tenant/{tenant-id}/vservers/vserver/{vserver-id}/l-interfaces/l-interface/{interface-name}",
+            "/l-interfaces/l-interface/{sub-interface-name}", "sub-l-interface");
 
     private final String uriTemplate;
     private final String parentUri;
@@ -337,8 +168,8 @@ public class AAIObjectType implements AAIObjectBase, GraphInventoryObjectType, S
     @Override
     public boolean equals(Object o) {
 
-        if (o instanceof AAIObjectBase) {
-            return this.typeName().equals(((AAIObjectBase) o).typeName());
+        if (o instanceof GraphInventoryObjectName) {
+            return this.typeName().equals(((GraphInventoryObjectName) o).typeName());
         }
 
         return false;
index 0aff965..c31d393 100644 (file)
@@ -20,8 +20,6 @@
 
 package org.onap.aaiclient.client.aai;
 
-import com.fasterxml.jackson.core.type.TypeReference;
-import com.fasterxml.jackson.databind.ObjectMapper;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
@@ -36,9 +34,12 @@ import org.onap.aaiclient.client.aai.entities.CustomQuery;
 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.Format;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
 
 public class AAIRestClientImpl implements AAIRestClientI {
 
@@ -48,7 +49,7 @@ public class AAIRestClientImpl implements AAIRestClientI {
     @Override
     public List<Pserver> getPhysicalServerByVnfId(String vnfId) throws IOException {
         List<AAIResourceUri> startNodes = new ArrayList<>();
-        startNodes.add(AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId));
+        startNodes.add(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)));
         String jsonInput = new AAIQueryClient().query(Format.RESOURCE, new CustomQuery(startNodes, PSERVER_VNF_QUERY));
 
         return this.getListOfPservers(jsonInput);
@@ -70,20 +71,21 @@ public class AAIRestClientImpl implements AAIRestClientI {
     public void updateMaintenceFlagVnfId(String vnfId, boolean inMaint) {
         GenericVnf genericVnf = new GenericVnf();
         genericVnf.setInMaint(inMaint);
-        new AAIResourcesClient().update(AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId), genericVnf);
+        new AAIResourcesClient()
+                .update(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)), genericVnf);
 
     }
 
     @Override
     public GenericVnf getVnfByName(String vnfId) {
-        return new AAIResourcesClient()
-                .get(GenericVnf.class, AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)).orElse(null);
+        return new AAIResourcesClient().get(GenericVnf.class,
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId))).orElse(null);
     }
 
     @Override
     public Optional<Pnf> getPnfByName(String pnfId) {
-        Response response =
-                new AAIResourcesClient().getFullResponse(AAIUriFactory.createResourceUri(AAIObjectType.PNF, pnfId));
+        Response response = new AAIResourcesClient()
+                .getFullResponse(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().pnf(pnfId)));
         if (response.getStatus() != 200) {
             return Optional.empty();
         } else {
@@ -93,20 +95,22 @@ public class AAIRestClientImpl implements AAIRestClientI {
 
     @Override
     public void createPnf(String pnfId, Pnf pnf) {
-        new AAIResourcesClient().createIfNotExists(AAIUriFactory.createResourceUri(AAIObjectType.PNF, pnfId),
-                Optional.of(pnf));
+        new AAIResourcesClient().createIfNotExists(
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().pnf(pnfId)), Optional.of(pnf));
     }
 
     @Override
     public void updatePnf(String pnfId, Pnf pnf) {
-        new AAIResourcesClient().update(AAIUriFactory.createResourceUri(AAIObjectType.PNF, pnfId), pnf);
+        new AAIResourcesClient().update(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().pnf(pnfId)),
+                pnf);
     }
 
     @Override
     public Optional<ServiceInstance> getServiceInstanceById(String globalSubscriberId, String serviceType,
             String serviceInstanceId) {
-        Response response = new AAIResourcesClient().getFullResponse(AAIUriFactory
-                .createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId, serviceType, serviceInstanceId));
+        Response response = new AAIResourcesClient().getFullResponse(
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId)
+                        .serviceSubscription(serviceType).serviceInstance(serviceInstanceId)));
         return Optional.ofNullable(response.readEntity(ServiceInstance.class));
     }
 
@@ -114,8 +118,9 @@ public class AAIRestClientImpl implements AAIRestClientI {
     public void updateServiceInstance(String globalSubscriberId, String serviceType, String serviceInstanceId,
             ServiceInstance serviceInstance) {
         try {
-            new AAIResourcesClient().update(AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
-                    globalSubscriberId, serviceType, serviceInstanceId), serviceInstance);
+            new AAIResourcesClient().update(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business()
+                    .customer(globalSubscriberId).serviceSubscription(serviceType).serviceInstance(serviceInstanceId)),
+                    serviceInstance);
         } catch (Throwable ex) {
             log.error("Exception happened while updating ServiceInstance, Exception: {}", ex.getLocalizedMessage());
             throw new RuntimeException(ex);
index ef43717..4cdf521 100644 (file)
@@ -33,7 +33,9 @@ public enum AAIVersion implements GraphInventoryVersion {
     V17("v17"),
     V18("v18"),
     V19("v19"),
-    V20("v20");
+    V20("v20"),
+    V21("v21"),
+    V22("v22");
 
     public static final AAIVersion LATEST = AAIVersion.values()[AAIVersion.values().length - 1];
     private final String value;
index bd9f4c7..95cb1fe 100644 (file)
@@ -1,5 +1,6 @@
 package org.onap.aaiclient.client.aai.entities.uri;
 
+import java.lang.reflect.InvocationTargetException;
 import java.util.List;
 import java.util.Optional;
 import java.util.stream.Collectors;
@@ -20,7 +21,7 @@ public class AAIFluentTypeReverseLookup {
                     (Class<? extends GraphInventoryFluentType.Info>) Class
                             .forName("org.onap.aaiclient.client.generated.fluentbuilders." + className + "$Info");
 
-            GraphInventoryFluentType.Info type = clazz.newInstance();
+            GraphInventoryFluentType.Info type = clazz.getConstructor().newInstance();
 
             Optional<String> parentTemplate = findParentPath(type, uri);
             if (parentTemplate.isPresent()) {
@@ -29,7 +30,8 @@ public class AAIFluentTypeReverseLookup {
                 // fallback to enum lookup
                 return AAIObjectType.fromTypeName(name);
             }
-        } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) {
+        } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | IllegalArgumentException
+                | InvocationTargetException | NoSuchMethodException | SecurityException e) {
         }
         return AAIObjectType.UNKNOWN;
     }
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAIPluralFragment.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAIPluralFragment.java
new file mode 100644 (file)
index 0000000..4733c55
--- /dev/null
@@ -0,0 +1,20 @@
+package org.onap.aaiclient.client.aai.entities.uri;
+
+import java.io.Serializable;
+import org.onap.aaiclient.client.graphinventory.GraphInventoryPluralFragment;
+
+public class AAIPluralFragment implements Serializable, GraphInventoryPluralFragment<AAIFluentPluralType> {
+
+    private static final long serialVersionUID = 1L;
+
+    private final AAIFluentPluralType type;
+
+    public AAIPluralFragment(AAIFluentPluralType type) {
+        this.type = type;
+    }
+
+    public AAIFluentPluralType get() {
+        return type;
+    }
+
+}
index 3d01258..3d7fc0e 100644 (file)
@@ -5,6 +5,6 @@ import org.onap.aaiclient.client.aai.AAIObjectType;
 import org.onap.aaiclient.client.graphinventory.entities.uri.GraphInventorySingleResourceUri;
 
 public interface AAIResourceUri extends AAIBaseResourceUri<AAIResourceUri, AAIObjectType>,
-        GraphInventorySingleResourceUri<AAIResourceUri, AAIPluralResourceUri, AAIObjectType, AAIObjectPlurals> {
+        GraphInventorySingleResourceUri<AAIResourceUri, AAIPluralResourceUri, AAIObjectType, AAIObjectPlurals, AAISingleFragment, AAIPluralFragment> {
 
 }
index 40184b0..041c02f 100644 (file)
@@ -26,7 +26,8 @@ import org.onap.aaiclient.client.aai.AAIObjectPlurals;
 import org.onap.aaiclient.client.aai.AAIObjectType;
 import org.onap.aaiclient.client.graphinventory.entities.uri.SimpleUri;
 
-public class AAISimpleUri extends SimpleUri<AAIResourceUri, AAIPluralResourceUri, AAIObjectType, AAIObjectPlurals>
+public class AAISimpleUri extends
+        SimpleUri<AAIResourceUri, AAIPluralResourceUri, AAIObjectType, AAIObjectPlurals, AAISingleFragment, AAIPluralFragment>
         implements AAIResourceUri {
 
     private static final long serialVersionUID = -6397024057188453229L;
@@ -70,4 +71,16 @@ public class AAISimpleUri extends SimpleUri<AAIResourceUri, AAIPluralResourceUri
         return new AAISimplePluralUri(this, plural);
     }
 
+    @Override
+    public AAISimpleUri relatedTo(AAISingleFragment fragment) {
+        this.internalURI.path(relatedTo);
+        return new AAISimpleUri(this, fragment.get().build(), fragment.get().values());
+    }
+
+    @Override
+    public AAISimplePluralUri relatedTo(AAIPluralFragment fragment) {
+        this.internalURI.path(relatedTo);
+        return new AAISimplePluralUri(this, fragment.get().build());
+    }
+
 }
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAISingleFragment.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAISingleFragment.java
new file mode 100644 (file)
index 0000000..a988899
--- /dev/null
@@ -0,0 +1,19 @@
+package org.onap.aaiclient.client.aai.entities.uri;
+
+import java.io.Serializable;
+import org.onap.aaiclient.client.graphinventory.GraphInventorySingleFragment;
+
+public class AAISingleFragment implements Serializable, GraphInventorySingleFragment<AAIFluentSingleType> {
+
+    private static final long serialVersionUID = 1L;
+
+    private final AAIFluentSingleType type;
+
+    public AAISingleFragment(AAIFluentSingleType type) {
+        this.type = type;
+    }
+
+    public AAIFluentSingleType get() {
+        return type;
+    }
+}
index 6bb2cbd..be49535 100644 (file)
 package org.onap.aaiclient.client.aai.entities.uri;
 
 import java.net.URI;
+import org.onap.aaiclient.client.aai.AAIObjectName;
 import org.onap.aaiclient.client.aai.AAIObjectPlurals;
 import org.onap.aaiclient.client.aai.AAIObjectType;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types;
 
 
 public class AAIUriFactory {
 
+
+    public static final AAIFluentTypeReverseLookup reverseLookup = new AAIFluentTypeReverseLookup();
+
     /**
      * values are filled into the URI template specified in {@link AAIObjectType} in order <br>
-     * There are two special lookups performed on certain types when a single value is specified: <br>
-     * Service Instance and AllottedResources <br>
-     * These can be retrieved without all their required keys but an HTTP call is required to do so
-     * 
+     *
      * @param type
      * @param values
      * @return
      */
     public static AAIResourceUri createResourceUri(AAIObjectType type, Object... values) {
-        if (AAIObjectType.SERVICE_INSTANCE.equals(type)) {
-            return new ServiceInstanceUri(values);
-        } else if (AAIObjectType.ALLOTTED_RESOURCE.equals(type)) {
-            return new AllottedResourceLookupUri(values);
+        return new AAISimpleUri(type, values);
+    }
+
+    /**
+     * These can be retrieved without all their required keys but an HTTP call is required to do so
+     *
+     * @param type
+     * @param values
+     * @return
+     */
+    public static AAIResourceUri createResourceUri(AAISingleFragment fragment) {
+
+        if (Types.SERVICE_INSTANCE.typeName().equals(fragment.get().build().typeName())) {
+            return new ServiceInstanceUri(fragment);
+        } else if (Types.ALLOTTED_RESOURCE.typeName().equals(fragment.get().build().typeName())) {
+            return new AllottedResourceLookupUri(fragment);
         } else {
-            return new AAISimpleUri(type, values);
+            return null;
         }
     }
 
@@ -51,13 +65,16 @@ public class AAIUriFactory {
         return new AAISimpleUri(uri.build(), uri.values());
     }
 
-    public static NodesSingleUri createNodesUri(AAIObjectType type, Object... values) {
+    protected static NodesSingleUri createNodesUri(AAIObjectType type, Object... values) {
         return new NodesSingleUri(type, values);
+    }
 
+    public static NodesSingleUri createNodesUri(AAISingleFragment fragment) {
+        return new NodesSingleUri(fragment.get().build(), fragment.get().values());
     }
 
-    public static NodesPluralUri createNodesUri(AAIObjectPlurals type) {
-        return new NodesPluralUri(type);
+    public static NodesPluralUri createNodesUri(AAIPluralFragment fragment) {
+        return new NodesPluralUri(fragment.get().build());
 
     }
 
@@ -68,7 +85,8 @@ public class AAIUriFactory {
      * @param uri
      * @return
      */
-    public static AAISimpleUri createResourceFromExistingURI(AAIObjectType type, URI uri) {
+    public static AAISimpleUri createResourceFromExistingURI(AAIObjectName name, URI uri) {
+        AAIObjectType type = reverseLookup.fromName(name.typeName(), uri.toString());
         return new AAISimpleUri(type, uri);
     }
 
@@ -81,20 +99,19 @@ public class AAIUriFactory {
      * @param childValues
      * @return
      */
-    public static AAISimpleUri createResourceFromParentURI(AAIResourceUri parentUri, AAIObjectType childType,
-            Object... childValues) {
+    public static AAISimpleUri createResourceFromParentURI(AAIResourceUri parentUri, AAISingleFragment fragment) {
 
-        return new AAISimpleUri(parentUri, childType, childValues);
+        return new AAISimpleUri(parentUri, fragment.get().build(), fragment.get().values());
     }
 
-    public static AAISimplePluralUri createResourceFromParentURI(AAIResourceUri parentUri, AAIObjectPlurals childType) {
+    public static AAISimplePluralUri createResourceFromParentURI(AAIResourceUri parentUri, AAIPluralFragment fragment) {
 
-        return new AAISimplePluralUri(parentUri, childType);
+        return new AAISimplePluralUri(parentUri, fragment.get().build());
     }
 
     public static AAISimplePluralUri createResourceUri(AAIFluentPluralType uri) {
 
-        return new AAISimplePluralUri(uri.build());
+        return new AAISimplePluralUri(uri.build(), uri.values());
 
     }
 
index 7f51835..099f717 100644 (file)
@@ -25,22 +25,25 @@ import java.util.Optional;
 import javax.ws.rs.core.UriBuilder;
 import org.onap.aaiclient.client.aai.AAIObjectType;
 import org.onap.aaiclient.client.aai.AAIResourcesClient;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
 
 public class AllottedResourceLookupUri extends HttpLookupUri {
 
     private static final long serialVersionUID = -9212594383876793188L;
 
-    protected AllottedResourceLookupUri(Object... values) {
-        super(AAIObjectType.ALLOTTED_RESOURCE, values);
+    protected AllottedResourceLookupUri(AAIObjectType type, UriBuilder builder, Optional<String> cachedValue,
+            Object... values) {
+        super(type, builder, cachedValue, values);
     }
 
-    protected AllottedResourceLookupUri(UriBuilder builder, Optional<String> cachedValue, Object... values) {
-        super(AAIObjectType.ALLOTTED_RESOURCE, builder, cachedValue, values);
+    protected AllottedResourceLookupUri(AAISingleFragment fragment) {
+        super(AAIFluentTypeBuilder.business().customer("").serviceSubscription("").serviceInstance("")
+                .allottedResource("").build(), fragment.get().values());
     }
 
     @Override
     public AllottedResourceLookupUri clone() {
-        return new AllottedResourceLookupUri(this.internalURI.clone(), this.getCachedValue(), values);
+        return new AllottedResourceLookupUri(this.aaiType, this.internalURI.clone(), this.getCachedValue(), values);
     }
 
     public AAIResourcesClient getResourcesClient() {
index c39eb50..42f5256 100644 (file)
@@ -45,7 +45,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
 public abstract class HttpLookupUri extends AAISimpleUri implements HttpAwareUri {
 
     private transient Optional<String> cachedValue = Optional.empty();
-    private final AAIObjectType aaiType;
+    protected final AAIObjectType aaiType;
 
     protected HttpLookupUri(AAIObjectType type, Object... values) {
         super(type, values);
index 96eaac5..366a011 100644 (file)
@@ -25,22 +25,25 @@ import java.util.Optional;
 import javax.ws.rs.core.UriBuilder;
 import org.onap.aaiclient.client.aai.AAIObjectType;
 import org.onap.aaiclient.client.aai.AAIResourcesClient;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
 
 public class ServiceInstanceUri extends HttpLookupUri {
 
     private static final long serialVersionUID = 2248914170527514548L;
 
-    protected ServiceInstanceUri(Object... values) {
-        super(AAIObjectType.SERVICE_INSTANCE, values);
+    protected ServiceInstanceUri(AAIObjectType type, UriBuilder builder, Optional<String> cachedValue,
+            Object... values) {
+        super(type, builder, cachedValue, values);
     }
 
-    protected ServiceInstanceUri(UriBuilder builder, Optional<String> cachedValue, Object... values) {
-        super(AAIObjectType.SERVICE_INSTANCE, builder, cachedValue, values);
+    protected ServiceInstanceUri(AAISingleFragment fragment) {
+        super(AAIFluentTypeBuilder.business().customer("").serviceSubscription("").serviceInstance("").build(),
+                fragment.get().values());
     }
 
     @Override
     public ServiceInstanceUri clone() {
-        return new ServiceInstanceUri(this.internalURI.clone(), this.getCachedValue(), values);
+        return new ServiceInstanceUri(this.aaiType, this.internalURI.clone(), this.getCachedValue(), values);
     }
 
     public AAIResourcesClient getResourcesClient() {
index 1a258fc..3970a36 100644 (file)
@@ -1,16 +1,25 @@
 package org.onap.aaiclient.client.graphinventory;
 
+import java.util.Collections;
 import java.util.List;
 
 public interface GraphInventoryFluentTypeBase {
 
     public interface Info {
-        String getPartialUri();
+        default String getPartialUri() {
+            return "";
+        }
 
-        List<String> getPaths();
+        default List<String> getPaths() {
+            return Collections.emptyList();
+        }
     }
 
-    Object[] values();
+    default Object[] values() {
+        return new Object[] {};
+    }
 
-    String uriTemplate();
+    default String uriTemplate() {
+        return "";
+    }
 }
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryFragmentBase.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryFragmentBase.java
new file mode 100644 (file)
index 0000000..b8cb64d
--- /dev/null
@@ -0,0 +1,6 @@
+package org.onap.aaiclient.client.graphinventory;
+
+public interface GraphInventoryFragmentBase<T> {
+
+    T get();
+}
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryPluralFragment.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryPluralFragment.java
new file mode 100644 (file)
index 0000000..9fe3cda
--- /dev/null
@@ -0,0 +1,9 @@
+package org.onap.aaiclient.client.graphinventory;
+
+
+
+public interface GraphInventoryPluralFragment<T extends GraphInventoryFluentType<? extends GraphInventoryObjectPlurals>>
+        extends GraphInventoryFragmentBase<T> {
+
+
+}
index c564c5d..343e888 100644 (file)
@@ -33,8 +33,6 @@ import javax.ws.rs.core.GenericType;
 import javax.ws.rs.core.Response;
 import javax.ws.rs.core.Response.Status;
 import org.onap.aai.domain.yang.Relationship;
-import org.onap.so.client.RestClient;
-import org.onap.so.client.RestProperties;
 import org.onap.aaiclient.client.graphinventory.entities.GraphInventoryEdgeLabel;
 import org.onap.aaiclient.client.graphinventory.entities.GraphInventoryResultWrapper;
 import org.onap.aaiclient.client.graphinventory.entities.uri.GraphInventoryPluralResourceUri;
@@ -42,8 +40,10 @@ import org.onap.aaiclient.client.graphinventory.entities.uri.GraphInventoryResou
 import org.onap.aaiclient.client.graphinventory.entities.uri.GraphInventorySingleResourceUri;
 import org.onap.aaiclient.client.graphinventory.entities.uri.HttpAwareUri;
 import org.onap.aaiclient.client.graphinventory.exceptions.GraphInventoryMultipleItemsException;
+import org.onap.so.client.RestClient;
+import org.onap.so.client.RestProperties;
 
-public abstract class GraphInventoryResourcesClient<Self, Uri extends GraphInventoryResourceUri<?, ?>, SingleUri extends GraphInventorySingleResourceUri<?, ?, ?, ?>, PluralUri extends GraphInventoryPluralResourceUri<?, ?>, EdgeLabel extends GraphInventoryEdgeLabel, Wrapper extends GraphInventoryResultWrapper, TransactionalClient, SingleTransactionClient> {
+public abstract class GraphInventoryResourcesClient<Self, Uri extends GraphInventoryResourceUri<?, ?>, SingleUri extends GraphInventorySingleResourceUri<?, ?, ?, ?, ?, ?>, PluralUri extends GraphInventoryPluralResourceUri<?, ?>, EdgeLabel extends GraphInventoryEdgeLabel, Wrapper extends GraphInventoryResultWrapper, TransactionalClient, SingleTransactionClient> {
 
     protected GraphInventoryClient client;
 
@@ -101,7 +101,7 @@ public abstract class GraphInventoryResourcesClient<Self, Uri extends GraphInven
      * @return
      */
     public void connect(SingleUri uriA, SingleUri uriB) {
-        GraphInventorySingleResourceUri<?, ?, ?, ?> uriAClone = (SingleUri) uriA.clone();
+        GraphInventorySingleResourceUri<?, ?, ?, ?, ?, ?> uriAClone = (SingleUri) uriA.clone();
         RestClient giRC = client.createClient(uriAClone.relationshipAPI());
         giRC.put(this.buildRelationship(uriB));
     }
@@ -115,7 +115,7 @@ public abstract class GraphInventoryResourcesClient<Self, Uri extends GraphInven
      * @return
      */
     public void connect(SingleUri uriA, SingleUri uriB, EdgeLabel label) {
-        GraphInventorySingleResourceUri<?, ?, ?, ?> uriAClone = (SingleUri) uriA.clone();
+        GraphInventorySingleResourceUri<?, ?, ?, ?, ?, ?> uriAClone = (SingleUri) uriA.clone();
         RestClient giRC = client.createClient(uriAClone.relationshipAPI());
         giRC.put(this.buildRelationship(uriB, label));
     }
@@ -128,7 +128,7 @@ public abstract class GraphInventoryResourcesClient<Self, Uri extends GraphInven
      * @return
      */
     public void disconnect(SingleUri uriA, SingleUri uriB) {
-        GraphInventorySingleResourceUri<?, ?, ?, ?> uriAClone = (SingleUri) uriA.clone();
+        GraphInventorySingleResourceUri<?, ?, ?, ?, ?, ?> uriAClone = (SingleUri) uriA.clone();
         RestClient giRC = client.createClient(uriAClone.relationshipAPI());
         giRC.delete(this.buildRelationship(uriB));
     }
@@ -140,7 +140,7 @@ public abstract class GraphInventoryResourcesClient<Self, Uri extends GraphInven
      * @return
      */
     public void delete(SingleUri uri) {
-        GraphInventorySingleResourceUri<?, ?, ?, ?> clone = (SingleUri) uri.clone();
+        GraphInventorySingleResourceUri<?, ?, ?, ?, ?, ?> clone = (SingleUri) uri.clone();
         RestClient giRC = client.createClient(clone);
         Map<String, Object> result = giRC.get(new GenericType<Map<String, Object>>() {}).orElseThrow(
                 () -> new NotFoundException(clone.build() + " does not exist in " + client.getGraphDBName()));
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventorySingleFragment.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventorySingleFragment.java
new file mode 100644 (file)
index 0000000..711b93d
--- /dev/null
@@ -0,0 +1,7 @@
+package org.onap.aaiclient.client.graphinventory;
+
+public interface GraphInventorySingleFragment<T extends GraphInventoryFluentType<? extends GraphInventoryObjectType>>
+        extends GraphInventoryFragmentBase<T> {
+
+
+}
index 7f7822b..4390e7e 100644 (file)
@@ -34,7 +34,7 @@ import org.onap.aaiclient.client.graphinventory.exceptions.BulkProcessFailed;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public abstract class GraphInventoryTransactionClient<Self, Uri extends GraphInventoryResourceUri<?, ?>, SingleUri extends GraphInventorySingleResourceUri<?, ?, ?, ?>, EdgeLabel extends GraphInventoryEdgeLabel> {
+public abstract class GraphInventoryTransactionClient<Self, Uri extends GraphInventoryResourceUri<?, ?>, SingleUri extends GraphInventorySingleResourceUri<?, ?, ?, ?, ?, ?>, EdgeLabel extends GraphInventoryEdgeLabel> {
 
     protected static Logger logger = LoggerFactory.getLogger(GraphInventoryTransactionClient.class);
 
index 881b7e9..cc286a6 100644 (file)
@@ -36,7 +36,7 @@ import org.onap.so.jsonpath.JsonPathUtil;
 import com.fasterxml.jackson.core.type.TypeReference;
 import com.fasterxml.jackson.databind.ObjectMapper;
 
-public abstract class GraphInventoryRelationships<Wrapper extends GraphInventoryResultWrapper<?>, Uri extends GraphInventorySingleResourceUri<?, ?, ?, ?>, Type extends GraphInventoryObjectType> {
+public abstract class GraphInventoryRelationships<Wrapper extends GraphInventoryResultWrapper<?>, Uri extends GraphInventorySingleResourceUri<?, ?, ?, ?, ?, ?>, Type extends GraphInventoryObjectType> {
 
     protected final ObjectMapper mapper;
     protected Map<String, Object> map;
index ac0e4a0..fbd4130 100644 (file)
@@ -2,8 +2,10 @@ package org.onap.aaiclient.client.graphinventory.entities.uri;
 
 import org.onap.aaiclient.client.graphinventory.GraphInventoryObjectPlurals;
 import org.onap.aaiclient.client.graphinventory.GraphInventoryObjectType;
+import org.onap.aaiclient.client.graphinventory.GraphInventoryPluralFragment;
+import org.onap.aaiclient.client.graphinventory.GraphInventorySingleFragment;
 
-public interface GraphInventorySingleResourceUri<T extends GraphInventorySingleResourceUri<?, ?, ?, ?>, P extends GraphInventoryPluralResourceUri<?, ?>, SingleObject extends GraphInventoryObjectType, PluralObject extends GraphInventoryObjectPlurals>
+public interface GraphInventorySingleResourceUri<T extends GraphInventorySingleResourceUri<?, ?, ?, ?, ?, ?>, P extends GraphInventoryPluralResourceUri<?, ?>, SingleObject extends GraphInventoryObjectType, PluralObject extends GraphInventoryObjectPlurals, SingleFragment extends GraphInventorySingleFragment, PluralFragment extends GraphInventoryPluralFragment>
         extends GraphInventoryResourceUri<T, SingleObject> {
 
     public T resourceVersion(String version);
@@ -13,4 +15,8 @@ public interface GraphInventorySingleResourceUri<T extends GraphInventorySingleR
     public P relatedTo(PluralObject plural);
 
     public T relatedTo(SingleObject type, String... values);
+
+    public P relatedTo(PluralFragment fragment);
+
+    public T relatedTo(SingleFragment fragment);
 }
index b668f46..d1e9e91 100644 (file)
@@ -22,7 +22,7 @@ import org.onap.aaiclient.client.graphinventory.entities.uri.parsers.UriParserSp
 import org.onap.aaiclient.client.graphinventory.exceptions.IncorrectNumberOfUriKeys;
 import org.springframework.web.util.UriUtils;
 
-public abstract class SimpleBaseUri<T extends GraphInventoryResourceUri<?, ?>, Parent extends GraphInventorySingleResourceUri<?, ?, ?, ?>, S extends GraphInventoryObjectBase>
+public abstract class SimpleBaseUri<T extends GraphInventoryResourceUri<?, ?>, Parent extends GraphInventorySingleResourceUri<?, ?, ?, ?, ?, ?>, S extends GraphInventoryObjectBase>
         implements GraphInventoryResourceUri<T, S> {
 
     private static final long serialVersionUID = -1011069933894179423L;
index d766615..1a3b38a 100644 (file)
@@ -28,7 +28,7 @@ import javax.ws.rs.core.UriBuilder;
 import org.onap.aaiclient.client.graphinventory.GraphInventoryObjectPlurals;
 import org.onap.aaiclient.client.graphinventory.GraphInventoryObjectType;
 
-public abstract class SimplePluralUri<T extends GraphInventoryPluralResourceUri<?, ?>, Parent extends GraphInventorySingleResourceUri<?, ?, ?, ?>, PT extends GraphInventoryObjectPlurals, OT extends GraphInventoryObjectType>
+public abstract class SimplePluralUri<T extends GraphInventoryPluralResourceUri<?, ?>, Parent extends GraphInventorySingleResourceUri<?, ?, ?, ?, ?, ?>, PT extends GraphInventoryObjectPlurals, OT extends GraphInventoryObjectType>
         extends SimpleBaseUri<T, Parent, PT> implements GraphInventoryPluralResourceUri<T, PT>, Serializable {
 
     private static final long serialVersionUID = -337701171277616439L;
index e6a162b..570856d 100644 (file)
@@ -27,9 +27,11 @@ import java.net.URI;
 import javax.ws.rs.core.UriBuilder;
 import org.onap.aaiclient.client.graphinventory.GraphInventoryObjectPlurals;
 import org.onap.aaiclient.client.graphinventory.GraphInventoryObjectType;
+import org.onap.aaiclient.client.graphinventory.GraphInventoryPluralFragment;
+import org.onap.aaiclient.client.graphinventory.GraphInventorySingleFragment;
 
-public abstract class SimpleUri<T extends GraphInventorySingleResourceUri<?, ?, ?, ?>, PT extends GraphInventoryPluralResourceUri<?, ?>, S extends GraphInventoryObjectType, P extends GraphInventoryObjectPlurals>
-        extends SimpleBaseUri<T, T, S> implements GraphInventorySingleResourceUri<T, PT, S, P> {
+public abstract class SimpleUri<T extends GraphInventorySingleResourceUri<?, ?, ?, ?, ?, ?>, PT extends GraphInventoryPluralResourceUri<?, ?>, S extends GraphInventoryObjectType, P extends GraphInventoryObjectPlurals, SF extends GraphInventorySingleFragment<?>, PF extends GraphInventoryPluralFragment<?>>
+        extends SimpleBaseUri<T, T, S> implements GraphInventorySingleResourceUri<T, PT, S, P, SF, PF> {
 
     private static final long serialVersionUID = -337701171277616439L;
     protected static final String relationshipAPI = "/relationship-list/relationship";
index 000521b..12051fb 100644 (file)
@@ -22,16 +22,15 @@ package org.onap.aaiclient.client.aai;
 
 import static org.junit.Assert.assertEquals;
 import org.junit.Test;
-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;
 
 public class AAIObjectTypeTest {
 
     @Test
     public void fromTypeNameTest() throws IllegalArgumentException, IllegalAccessException, InstantiationException {
-        AAIObjectType type = AAIObjectType.fromTypeName("allotted-resource");
-        assertEquals("allotted-resource", type.typeName());
+        AAIObjectType type = AAIObjectType.fromTypeName("generic-query");
+        assertEquals("generic-query", type.typeName());
 
     }
 
@@ -42,59 +41,15 @@ public class AAIObjectTypeTest {
 
     }
 
-    @Test
-    public void verifyDefaultCase() {
-        assertEquals("default removed for tenant", "tenant", AAIObjectType.DEFAULT_TENANT.typeName());
-        assertEquals("default removed for cloud-region", "cloud-region", AAIObjectType.DEFAULT_CLOUD_REGION.typeName());
-    }
-
-    @Test
-    public void verifyRegularCase() {
-        assertEquals("default removed for tenant", "allotted-resource", AAIObjectType.ALLOTTED_RESOURCE.typeName());
-    }
-
-    @Test
-    public void instanceGroupObjectTypeTest() {
-        final String id = "test1";
-        AAIResourceUri aaiUri = AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, id);
-        assertEquals("/network/instance-groups/instance-group/test1", aaiUri.build().toString());
-    }
-
-    @Test
-    public void collectionObjectTypeTest() {
-        final String id = "test1";
-        AAIResourceUri aaiUri = AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, id);
-        assertEquals("/network/collections/collection/test1", aaiUri.build().toString());
-    }
-
-    @Test
-    public void genericVnfTest() {
-        AAIObjectType type = AAIObjectType.GENERIC_VNF;
-        assertEquals("/network/generic-vnfs/generic-vnf/{vnf-id}", type.uriTemplate());
-        assertEquals("/generic-vnfs/generic-vnf/{vnf-id}", type.partialUri());
-    }
-
-    @Test
-    public void pInterfaceTest() {
-        AAIObjectType type = AAIObjectType.P_INTERFACE;
-        assertEquals("/cloud-infrastructure/pservers/pserver/{hostname}/p-interfaces/p-interface/{interface-name}",
-                type.uriTemplate());
-        assertEquals("/p-interfaces/p-interface/{interface-name}", type.partialUri());
-    }
-
-    @Test
-    public void networkPolicyObjectTypeTest() {
-        final String id = "test1";
-        AAIResourceUri aaiUri = AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, id);
-        assertEquals("/network/network-policies/network-policy/test1", aaiUri.build().toString());
-    }
-
     @Test
     public void equalityTest() {
 
         AAIObjectType genericVnf = AAIFluentTypeBuilder.network().genericVnf("test").build();
+        AAIObjectType genericVnf2 = AAIFluentTypeBuilder.network().genericVnf("test2").build();
+
+        assertEquals(genericVnf2, genericVnf);
 
-        assertEquals(AAIObjectType.GENERIC_VNF, genericVnf);
+        assertEquals(genericVnf, Types.GENERIC_VNF);
 
     }
 
index 15fe03e..29d8624 100644 (file)
@@ -43,17 +43,18 @@ import org.mockito.Mock;
 import org.mockito.Spy;
 import org.mockito.junit.MockitoJUnitRunner;
 import org.onap.aai.domain.yang.Complex;
-import org.onap.so.client.RestClient;
 import org.onap.aaiclient.client.aai.entities.AAIResultWrapper;
 import org.onap.aaiclient.client.aai.entities.CustomQuery;
 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.Types;
 import org.onap.aaiclient.client.graphinventory.Format;
 import org.onap.aaiclient.client.graphinventory.GraphInventoryClient;
 import org.onap.aaiclient.client.graphinventory.GraphInventorySubgraphType;
 import org.onap.aaiclient.client.graphinventory.entities.Pathed;
 import org.onap.aaiclient.client.graphinventory.entities.ResourceAndUrl;
+import org.onap.so.client.RestClient;
 import com.fasterxml.jackson.core.type.TypeReference;
 import com.fasterxml.jackson.databind.ObjectMapper;
 
@@ -112,7 +113,7 @@ public class AAIQueryClientTest {
         doReturn(getJson("single-query-result.json")).when(aaiQueryClient).query(eq(Format.RESOURCE_AND_URL),
                 any(CustomQuery.class));
         List<Complex> result = aaiQueryClient.querySingleResource(
-                new CustomQuery(Arrays.asList(AAIUriFactory.createNodesUri(AAIObjectType.COMPLEX, "test"))),
+                new CustomQuery(Arrays.asList(AAIUriFactory.createNodesUri(Types.COMPLEX.getFragment("test")))),
                 Complex.class);
         assertEquals(2, result.size());
         assertEquals("complex-id-15100-jc689q2", result.get(1).getPhysicalLocationId());
@@ -123,11 +124,10 @@ public class AAIQueryClientTest {
         doReturn(getJson("single-query-result.json")).when(aaiQueryClient).query(eq(Format.RESOURCE_AND_URL),
                 any(CustomQuery.class));
         List<ResourceAndUrl<AAIResultWrapper>> result = aaiQueryClient.getResourceAndUrl(
-                new CustomQuery(Arrays.asList(AAIUriFactory.createNodesUri(AAIObjectType.COMPLEX, "test"))));
+                new CustomQuery(Arrays.asList(AAIUriFactory.createNodesUri(Types.COMPLEX.getFragment("test")))));
         assertEquals(2, result.size());
 
-        assertEquals(1,
-                result.get(1).getWrapper().getRelationships().get().getRelatedUris(AAIObjectType.PSERVER).size());
+        assertEquals(1, result.get(1).getWrapper().getRelationships().get().getRelatedUris(Types.PSERVER).size());
     }
 
     @Test
@@ -138,7 +138,7 @@ public class AAIQueryClientTest {
 
 
         List<Pathed> results = aaiQueryClient.queryPathed(
-                new CustomQuery(Arrays.asList(AAIUriFactory.createNodesUri(AAIObjectType.COMPLEX, "test"))));
+                new CustomQuery(Arrays.asList(AAIUriFactory.createNodesUri(Types.COMPLEX.getFragment("test")))));
 
         assertEquals(2, results.size());
         assertEquals("service-instance", results.get(1).getResourceType());
index ca361f4..36ba1f3 100644 (file)
@@ -55,6 +55,7 @@ import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
 import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
 import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
 import org.onap.aaiclient.client.defaultproperties.DefaultAAIPropertiesImpl;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
 import org.onap.aaiclient.client.graphinventory.exceptions.GraphInventoryMultipleItemsException;
 import org.onap.so.client.RestClient;
 import com.github.tomakehurst.wiremock.admin.NotFoundException;
@@ -86,7 +87,7 @@ public class AAIResourcesClientTest {
 
     @Test
     public void verifyNotExists() {
-        AAIResourceUri path = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test");
+        AAIResourceUri path = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("test"));
         wireMockRule.stubFor(get(urlPathEqualTo("/aai/" + AAIVersion.LATEST + path.build()))
                 .willReturn(aResponse().withHeader("Content-Type", "text/plain").withBody("hello").withStatus(404)));
         AAIResourcesClient client = aaiClient;
@@ -96,7 +97,7 @@ public class AAIResourcesClientTest {
 
     @Test
     public void verifyDelete() {
-        AAIResourceUri path = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test2");
+        AAIResourceUri path = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("test2"));
         wireMockRule.stubFor(get(urlPathEqualTo("/aai/" + AAIVersion.LATEST + path.build()))
                 .willReturn(aResponse().withHeader("Content-Type", "application/json")
                         .withBodyFile("aai/resources/mockObject.json").withStatus(200)));
@@ -108,7 +109,7 @@ public class AAIResourcesClientTest {
 
     @Test
     public void verifyBasicAuth() {
-        AAIResourceUri path = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test3");
+        AAIResourceUri path = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("test3"));
         wireMockRule.stubFor(get(urlPathEqualTo("/aai/" + AAIVersion.LATEST + path.build().toString()))
                 .withHeader("Authorization", equalTo("Basic dGVzdDp0ZXN0"))
                 .willReturn(aResponse().withHeader("Content-Type", "application/json")
@@ -119,8 +120,8 @@ public class AAIResourcesClientTest {
 
     @Test
     public void verifyConnect() {
-        AAIResourceUri path = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test2");
-        AAIResourceUri path2 = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test3");
+        AAIResourceUri path = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("test2"));
+        AAIResourceUri path2 = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("test3"));
         wireMockRule.stubFor(
                 put(urlPathEqualTo("/aai/" + AAIVersion.LATEST + path.build() + "/relationship-list/relationship"))
                         .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(200)));
@@ -133,8 +134,8 @@ public class AAIResourcesClientTest {
 
     @Test
     public void verifyDisconnect() {
-        AAIResourceUri path = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test2");
-        AAIResourceUri path2 = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test3");
+        AAIResourceUri path = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("test2"));
+        AAIResourceUri path2 = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("test3"));
 
         wireMockRule.stubFor(
                 delete(urlPathEqualTo("/aai/" + AAIVersion.LATEST + path.build() + "/relationship-list/relationship"))
@@ -148,7 +149,7 @@ public class AAIResourcesClientTest {
 
     @Test
     public void verifyPatch() {
-        AAIResourceUri path = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test2");
+        AAIResourceUri path = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("test2"));
 
         wireMockRule.stubFor(post(urlPathEqualTo("/aai/" + AAIVersion.LATEST + path.build()))
                 .willReturn(aResponse().withStatus(200)));
@@ -160,7 +161,7 @@ public class AAIResourcesClientTest {
 
     @Test
     public void verifyNotExistsGet() {
-        AAIResourceUri path = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test");
+        AAIResourceUri path = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("test"));
         wireMockRule.stubFor(get(urlPathEqualTo("/aai/" + AAIVersion.LATEST + path.build()))
                 .willReturn(aResponse().withHeader("Content-Type", "text/plain").withBody("hello").withStatus(404)));
         AAIResourcesClient client = aaiClient;
@@ -170,7 +171,7 @@ public class AAIResourcesClientTest {
 
     @Test
     public void verifyNotExistsGetException() {
-        AAIResourceUri path = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test");
+        AAIResourceUri path = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("test"));
         wireMockRule.stubFor(get(urlPathEqualTo("/aai/" + AAIVersion.LATEST + path.build()))
                 .willReturn(aResponse().withHeader("Content-Type", "text/plain").withBody("hello").withStatus(404)));
         AAIResourcesClient client = aaiClient;
@@ -181,7 +182,7 @@ public class AAIResourcesClientTest {
 
     @Test
     public void verifyFailedCallException() {
-        AAIResourceUri path = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test");
+        AAIResourceUri path = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("test"));
         wireMockRule.stubFor(get(urlPathEqualTo("/aai/" + AAIVersion.LATEST + path.build())).willReturn(aResponse()
                 .withHeader("Content-Type", "text/plain").withBodyFile("aai/error-message.json").withStatus(400)));
         AAIResourcesClient client = aaiClient;
@@ -195,7 +196,7 @@ public class AAIResourcesClientTest {
     @Test
     public void buildRelationshipTest() {
         AAIResourcesClient client = aaiClient;
-        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test");
+        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("test"));
         Relationship relationship = new Relationship();
         relationship.setRelatedLink(uri.build().toString());
         Relationship actual = client.buildRelationship(uri);
@@ -213,7 +214,7 @@ public class AAIResourcesClientTest {
         vnf.setVnfId("my-vnf-id");
         GenericVnfs vnfs = new GenericVnfs();
         vnfs.getGenericVnf().add(vnf);
-        AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF);
+        AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnfs());
         RestClient restClientMock = mock(RestClient.class);
         doReturn(restClientMock).when(client).createClient(uri);
         when(restClientMock.get(GenericVnfs.class)).thenReturn(Optional.of(vnfs));
@@ -232,7 +233,7 @@ public class AAIResourcesClientTest {
         GenericVnfs vnfs = new GenericVnfs();
         vnfs.getGenericVnf().add(vnf);
         vnfs.getGenericVnf().add(vnf2);
-        AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF);
+        AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnfs());
         RestClient restClientMock = mock(RestClient.class);
         doReturn(restClientMock).when(client).createClient(uri);
         when(restClientMock.get(GenericVnfs.class)).thenReturn(Optional.of(vnfs));
@@ -250,7 +251,7 @@ public class AAIResourcesClientTest {
         GenericVnfs vnfs = new GenericVnfs();
         vnfs.getGenericVnf().add(vnf);
         vnfs.getGenericVnf().add(vnf2);
-        AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF);
+        AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnfs());
         RestClient restClientMock = mock(RestClient.class);
         doReturn(restClientMock).when(client).createClient(uri);
         when(restClientMock.get(GenericVnfs.class)).thenReturn(Optional.of(vnfs));
@@ -266,7 +267,7 @@ public class AAIResourcesClientTest {
         vnf.setVnfId("my-vnf-id");
         GenericVnfs vnfs = new GenericVnfs();
         vnfs.getGenericVnf().add(vnf);
-        AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF);
+        AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnfs());
         RestClient restClientMock = mock(RestClient.class);
         doReturn(restClientMock).when(client).createClient(uri);
         when(restClientMock.get(GenericVnfs.class)).thenReturn(Optional.empty());
@@ -282,7 +283,7 @@ public class AAIResourcesClientTest {
         vnf.setVnfId("my-vnf-id");
         GenericVnfs vnfs = new GenericVnfs();
         vnfs.getGenericVnf().add(vnf);
-        AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF);
+        AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnfs());
         RestClient restClientMock = mock(RestClient.class);
         doReturn(restClientMock).when(client).createClient(uri);
         when(restClientMock.get(GenericVnfs.class)).thenReturn(Optional.empty());
@@ -295,7 +296,7 @@ public class AAIResourcesClientTest {
     @Test
     public void testGetFirstWrongPluralClass() {
         GenericVnf vnf = new GenericVnf();
-        AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF);
+        AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnfs());
         RestClient restClientMock = mock(RestClient.class);
         doReturn(restClientMock).when(client).createClient(uri);
         when(restClientMock.get(GenericVnf.class)).thenReturn(Optional.of(vnf));
index 9e0825b..23c06a6 100644 (file)
@@ -45,6 +45,7 @@ import org.onap.aaiclient.client.aai.entities.AAIResultWrapper;
 import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
 import org.onap.aaiclient.client.aai.entities.uri.ServiceInstanceUri;
 import org.onap.aaiclient.client.defaultproperties.DefaultAAIPropertiesImpl;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types;
 import com.github.tomakehurst.wiremock.junit.WireMockRule;
 
 @RunWith(MockitoJUnitRunner.class)
@@ -70,7 +71,7 @@ public class AAIResourcesClientWithServiceInstanceUriTest {
         wireMockRule.stubFor(get(urlMatching("/aai/v[0-9]+/nodes.*")).willReturn(
                 aResponse().withStatus(404).withHeader("Content-Type", "application/json").withHeader("Mock", "true")));
 
-        uri = spy((ServiceInstanceUri) AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, "id"));
+        uri = spy((ServiceInstanceUri) AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment("id")));
         doReturn(aaiClient).when(uri).getResourcesClient();
     }
 
index 0820397..7035999 100644 (file)
@@ -49,6 +49,7 @@ import org.onap.aaiclient.client.aai.entities.singletransaction.SingleTransactio
 import org.onap.aaiclient.client.aai.entities.singletransaction.SingleTransactionResponse;
 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.GraphInventoryPatchConverter;
 import org.skyscreamer.jsonassert.JSONAssert;
 import com.fasterxml.jackson.core.JsonParseException;
@@ -60,9 +61,12 @@ import com.fasterxml.jackson.databind.SerializationFeature;
 public class AAISingleTransactionClientTest {
 
     private final static String AAI_JSON_FILE_LOCATION = "src/test/resources/__files/aai/singletransaction/";
-    AAIResourceUri uriA = AAIUriFactory.createResourceUri(AAIObjectType.PSERVER, "pserver-hostname");
-    AAIResourceUri uriB = AAIUriFactory.createResourceUri(AAIObjectType.COMPLEX, "my-complex");
-    AAIResourceUri uriC = AAIUriFactory.createResourceUri(AAIObjectType.COMPLEX, "my-complex2");
+    AAIResourceUri uriA =
+            AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().pserver("pserver-hostname"));
+    AAIResourceUri uriB =
+            AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().complex("my-complex"));
+    AAIResourceUri uriC =
+            AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().complex("my-complex2"));
 
     ObjectMapper mapper;
 
index bf24171..cda119e 100644 (file)
@@ -45,6 +45,7 @@ import org.mockito.junit.MockitoJUnitRunner;
 import org.onap.aai.domain.yang.Relationship;
 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.GraphInventoryPatchConverter;
 import com.fasterxml.jackson.core.JsonParseException;
 import com.fasterxml.jackson.core.type.TypeReference;
@@ -56,13 +57,13 @@ import com.fasterxml.jackson.databind.SerializationFeature;
 public class AAITransactionalClientTest {
 
     private final static String AAI_JSON_FILE_LOCATION = "src/test/resources/__files/aai/bulkprocess/";
-    AAIResourceUri uriA = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test1");
-    AAIResourceUri uriB = AAIUriFactory.createResourceUri(AAIObjectType.PSERVER, "test2");
-    AAIResourceUri uriC = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test3");
-    AAIResourceUri uriD = AAIUriFactory.createResourceUri(AAIObjectType.PSERVER, "test4");
-    AAIResourceUri uriE = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test5");
-    AAIResourceUri uriF = AAIUriFactory.createResourceUri(AAIObjectType.PSERVER, "test6");
-    AAIResourceUri uriG = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test7");
+    AAIResourceUri uriA = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("test1"));
+    AAIResourceUri uriB = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().pserver("test2"));
+    AAIResourceUri uriC = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("test3"));
+    AAIResourceUri uriD = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().pserver("test4"));
+    AAIResourceUri uriE = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("test5"));
+    AAIResourceUri uriF = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().pserver("test6"));
+    AAIResourceUri uriG = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("test7"));
 
     ObjectMapper mapper;
 
index f2bd188..7fad6f5 100644 (file)
@@ -25,6 +25,7 @@ import javax.ws.rs.core.UriBuilder;
 import org.junit.Test;
 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;
 
 public class AAIURITest {
 
@@ -33,8 +34,9 @@ public class AAIURITest {
     @Test
     public void verifyTemplateReplacement() {
         final String id = "test1";
-        AAIResourceUri aaiUri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, id);
-        String manualReplace = AAIObjectType.CONFIGURATION.toString().replaceAll("\\{configuration-id\\}", id);
+        AAIResourceUri aaiUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().configuration(id));
+        String manualReplace =
+                AAIFluentTypeBuilder.network().configuration(id).uriTemplate().replaceAll("\\{configuration-id\\}", id);
         assertEquals("uri template replaced", aaiUri.build(), UriBuilder.fromPath(manualReplace).build());
 
     }
index b0b0c6a..4b5085e 100644 (file)
@@ -23,6 +23,7 @@ package org.onap.aaiclient.client.aai;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 import org.junit.Test;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types;
 import org.onap.aaiclient.client.graphinventory.entities.DSLNodeKey;
 import org.onap.aaiclient.client.graphinventory.entities.DSLQueryBuilder;
 import org.onap.aaiclient.client.graphinventory.entities.DSLStartNode;
@@ -36,12 +37,11 @@ public class DSLQueryBuilderTest {
 
     @Test
     public void whereTest() {
-        DSLQueryBuilder<Start, Start> builder = TraversalBuilder.fragment(new DSLStartNode(AAIObjectType.CLOUD_REGION,
+        DSLQueryBuilder<Start, Start> builder = TraversalBuilder.fragment(new DSLStartNode(Types.CLOUD_REGION,
                 __.key("cloud-owner", "att-nc"), __.key("cloud-region-id", "test")));
 
-        builder.to(__.node(AAIObjectType.VLAN_TAG))
-                .where(__.node(AAIObjectType.OWNING_ENTITY, __.key("owning-entity-name", "name")))
-                .to(__.node(AAIObjectType.VLAN_TAG, __.key("vlan-id-outer", "108")).output());
+        builder.to(__.node(Types.VLAN_TAG)).where(__.node(Types.OWNING_ENTITY, __.key("owning-entity-name", "name")))
+                .to(__.node(Types.VLAN_TAG, __.key("vlan-id-outer", "108")).output());
 
         assertEquals("cloud-region('cloud-owner', 'att-nc')('cloud-region-id', 'test') > "
                 + "vlan-tag (> owning-entity('owning-entity-name', 'name')) > " + "vlan-tag*('vlan-id-outer', '108')",
@@ -50,12 +50,11 @@ public class DSLQueryBuilderTest {
 
     @Test
     public void unionTest() {
-        DSLQueryBuilder<Output, Output> builder = TraversalBuilder
-                .traversal(new DSLStartNode(AAIObjectType.GENERIC_VNF, __.key("vnf-id", "vnfId")).output());
+        DSLQueryBuilder<Output, Output> builder =
+                TraversalBuilder.traversal(new DSLStartNode(Types.GENERIC_VNF, __.key("vnf-id", "vnfId")).output());
 
-        builder.union(__.node(AAIObjectType.PSERVER).output().to(__.node(AAIObjectType.COMPLEX).output()),
-                __.node(AAIObjectType.VSERVER)
-                        .to(__.node(AAIObjectType.PSERVER).output().to(__.node(AAIObjectType.COMPLEX).output())));
+        builder.union(__.node(Types.PSERVER).output().to(__.node(Types.COMPLEX).output()),
+                __.node(Types.VSERVER).to(__.node(Types.PSERVER).output().to(__.node(Types.COMPLEX).output())));
 
         assertEquals(
                 "generic-vnf*('vnf-id', 'vnfId') > " + "[ pserver* > complex*, " + "vserver > pserver* > complex* ]",
@@ -64,11 +63,11 @@ public class DSLQueryBuilderTest {
 
     @Test
     public void whereUnionTest() {
-        DSLQueryBuilder<Output, Output> builder = TraversalBuilder
-                .traversal(new DSLStartNode(AAIObjectType.GENERIC_VNF, __.key("vnf-id", "vnfId")).output());
+        DSLQueryBuilder<Output, Output> builder =
+                TraversalBuilder.traversal(new DSLStartNode(Types.GENERIC_VNF, __.key("vnf-id", "vnfId")).output());
 
-        builder.where(__.union(__.node(AAIObjectType.PSERVER, __.key("hostname", "hostname1")),
-                __.node(AAIObjectType.VSERVER).to(__.node(AAIObjectType.PSERVER, __.key("hostname", "hostname1")))));
+        builder.where(__.union(__.node(Types.PSERVER, __.key("hostname", "hostname1")),
+                __.node(Types.VSERVER).to(__.node(Types.PSERVER, __.key("hostname", "hostname1")))));
 
         assertEquals("generic-vnf*('vnf-id', 'vnfId') (> [ pserver('hostname', 'hostname1'), "
                 + "vserver > pserver('hostname', 'hostname1') ])", builder.build().get());
@@ -76,38 +75,38 @@ public class DSLQueryBuilderTest {
 
     @Test
     public void notNullTest() {
-        DSLQueryBuilder<Output, Output> builder = TraversalBuilder.traversal(
-                new DSLStartNode(AAIObjectType.CLOUD_REGION, __.key("cloud-owner", "", "null").not()).output());
+        DSLQueryBuilder<Output, Output> builder = TraversalBuilder
+                .traversal(new DSLStartNode(Types.CLOUD_REGION, __.key("cloud-owner", "", "null").not()).output());
 
         assertEquals("cloud-region* !('cloud-owner', ' ', ' null ')", builder.build().get());
     }
 
     @Test
     public void shortCutToTest() {
-        DSLQueryBuilder<Output, Output> builder = TraversalBuilder
-                .traversal(new DSLStartNode(AAIObjectType.PSERVER, __.key("hostname", "my-hostname")).output());
+        DSLQueryBuilder<Output, Output> builder =
+                TraversalBuilder.traversal(new DSLStartNode(Types.PSERVER, __.key("hostname", "my-hostname")).output());
 
-        builder.to(AAIObjectType.P_INTERFACE).to(AAIObjectType.SRIOV_PF, __.key("pf-pci-id", "my-id"));
+        builder.to(Types.P_INTERFACE).to(Types.SRIOV_PF, __.key("pf-pci-id", "my-id"));
         assertEquals("pserver*('hostname', 'my-hostname') > p-interface > sriov-pf('pf-pci-id', 'my-id')",
                 builder.build().get());
     }
 
     @Test
     public void limitTest() {
-        DSLQueryBuilder<Output, Output> builder = TraversalBuilder
-                .traversal(new DSLStartNode(AAIObjectType.PSERVER, __.key("hostname", "my-hostname")).output());
+        DSLQueryBuilder<Output, Output> builder =
+                TraversalBuilder.traversal(new DSLStartNode(Types.PSERVER, __.key("hostname", "my-hostname")).output());
 
-        builder.to(AAIObjectType.P_INTERFACE).limit(2).to(AAIObjectType.SRIOV_PF, __.key("pf-pci-id", "my-id"));
+        builder.to(Types.P_INTERFACE).limit(2).to(Types.SRIOV_PF, __.key("pf-pci-id", "my-id"));
         assertEquals("pserver*('hostname', 'my-hostname') > p-interface > sriov-pf('pf-pci-id', 'my-id') LIMIT 2",
                 builder.build().get());
     }
 
     @Test
     public void equalsTest() {
-        DSLQueryBuilder<Output, Output> builder = TraversalBuilder
-                .traversal(new DSLStartNode(AAIObjectType.PSERVER, __.key("hostname", "my-hostname")).output());
+        DSLQueryBuilder<Output, Output> builder =
+                TraversalBuilder.traversal(new DSLStartNode(Types.PSERVER, __.key("hostname", "my-hostname")).output());
 
-        builder.to(AAIObjectType.P_INTERFACE).to(AAIObjectType.SRIOV_PF, __.key("pf-pci-id", "my-id"));
+        builder.to(Types.P_INTERFACE).to(Types.SRIOV_PF, __.key("pf-pci-id", "my-id"));
         assertTrue(
                 builder.equals("pserver*('hostname', 'my-hostname') > p-interface > sriov-pf('pf-pci-id', 'my-id')"));
         assertTrue(builder.equals(builder));
@@ -115,32 +114,30 @@ public class DSLQueryBuilderTest {
 
     @Test
     public void mixedTypeTest() {
-        DSLQueryBuilder<Start, Start> builder = TraversalBuilder.fragment(new DSLStartNode(AAIObjectType.CLOUD_REGION,
-                __.key("cloud-owner", "owner"), __.key("cloud-region-id", "id")));
-        builder.to(__.node(AAIObjectType.VLAN_TAG, __.key("vlan-id-outer", 167), __.key("my-boolean", true)).output());
+        DSLQueryBuilder<Start, Start> builder = TraversalBuilder.fragment(
+                new DSLStartNode(Types.CLOUD_REGION, __.key("cloud-owner", "owner"), __.key("cloud-region-id", "id")));
+        builder.to(__.node(Types.VLAN_TAG, __.key("vlan-id-outer", 167), __.key("my-boolean", true)).output());
         assertTrue(builder.equals(
                 "cloud-region('cloud-owner', 'owner')('cloud-region-id', 'id') > vlan-tag*('vlan-id-outer', 167)('my-boolean', true)"));
     }
 
     @Test
     public void outputOnNodeLambdasTest() {
-        DSLQueryBuilder<Start, Start> builder = TraversalBuilder
-                .fragment(new DSLStartNode(AAIObjectType.L_INTERFACE, new DSLNodeKey("interface-id", "myId")));
+        DSLQueryBuilder<Start, Start> builder =
+                TraversalBuilder.fragment(new DSLStartNode(Types.L_INTERFACE, new DSLNodeKey("interface-id", "myId")));
 
-        builder.to(AAIObjectType.VSERVER, __.key("vserver-name", "myName")).output().to(AAIObjectType.P_INTERFACE)
-                .output();
+        builder.to(Types.VSERVER, __.key("vserver-name", "myName")).output().to(Types.P_INTERFACE).output();
         assertEquals("l-interface('interface-id', 'myId') > vserver*('vserver-name', 'myName') > p-interface*",
                 builder.build().get());
     }
 
     @Test
     public void skipOutputOnUnionTest() {
-        DSLQueryBuilder<Output, Output> builder = TraversalBuilder
-                .traversal(new DSLStartNode(AAIObjectType.GENERIC_VNF, __.key("vnf-id", "vnfId")).output());
+        DSLQueryBuilder<Output, Output> builder =
+                TraversalBuilder.traversal(new DSLStartNode(Types.GENERIC_VNF, __.key("vnf-id", "vnfId")).output());
 
-        builder.union(__.node(AAIObjectType.PSERVER).output().to(__.node(AAIObjectType.COMPLEX).output()),
-                __.node(AAIObjectType.VSERVER)
-                        .to(__.node(AAIObjectType.PSERVER).output().to(__.node(AAIObjectType.COMPLEX).output())))
+        builder.union(__.node(Types.PSERVER).output().to(__.node(Types.COMPLEX).output()),
+                __.node(Types.VSERVER).to(__.node(Types.PSERVER).output().to(__.node(Types.COMPLEX).output())))
                 .output();
 
         assertEquals(
@@ -150,10 +147,10 @@ public class DSLQueryBuilderTest {
 
     @Test
     public void selectOutputFilterTest() {
-        DSLQueryBuilder<Output, Output> builder = TraversalBuilder
-                .traversal(new DSLStartNode(AAIObjectType.CLOUD_REGION, __.key("cloud-owner", "CloudOwner"))
+        DSLQueryBuilder<Output, Output> builder =
+                TraversalBuilder.traversal(new DSLStartNode(Types.CLOUD_REGION, __.key("cloud-owner", "CloudOwner"))
                         .output("cloud-region-id", "a", "b"));
-        builder.to(__.node(AAIObjectType.PSERVER)).output("x", "y", "z");
+        builder.to(__.node(Types.PSERVER)).output("x", "y", "z");
 
         assertEquals("cloud-region{'cloud-region-id', 'a', 'b'}('cloud-owner', 'CloudOwner') > pserver{'x', 'y', 'z'}",
                 builder.build().toString());
@@ -161,7 +158,7 @@ public class DSLQueryBuilderTest {
 
     @Test
     public void selectOutputFilterOnNodeTest() {
-        DSLStartNode node = new DSLStartNode(AAIObjectType.CLOUD_REGION, __.key("cloud-owner", "CloudOwner"));
+        DSLStartNode node = new DSLStartNode(Types.CLOUD_REGION, __.key("cloud-owner", "CloudOwner"));
         DSLQueryBuilder<Start, Node> builder = TraversalBuilder.fragment(node).output("cloud-region-id");
 
         assertEquals("cloud-region{'cloud-region-id'}('cloud-owner', 'CloudOwner')", builder.build().toString());
index 9e106fa..75dbd4a 100644 (file)
@@ -30,9 +30,10 @@ import java.util.List;
 import org.junit.Test;
 import org.mockito.ArgumentCaptor;
 import org.mockito.Mockito;
-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;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types;
 
 public class RelationshipsTest {
 
@@ -45,12 +46,16 @@ public class RelationshipsTest {
         AAIResultWrapper wrapper = new AAIResultWrapper(content);
         Relationships relationships = wrapper.getRelationships().get();
 
-        List<AAIResourceUri> test = relationships.getRelatedUris(AAIObjectType.VCE);
+        List<AAIResourceUri> test = relationships.getRelatedUris(Types.VCE);
         List<AAIResourceUri> uris = Arrays.asList(
-                AAIUriFactory.createResourceUri(AAIObjectType.VCE, "a9fec18e-1ea3-40e4-a6c0-a89b3de07053"),
-                AAIUriFactory.createResourceUri(AAIObjectType.VCE, "8ae1e5f8-61f1-4c71-913a-b40cc4593cb9"),
-                AAIUriFactory.createResourceUri(AAIObjectType.VCE, "a2935fa9-b743-49f4-9813-a127f13c4e93"),
-                AAIUriFactory.createResourceUri(AAIObjectType.VCE, "c7fe7698-8063-4e26-8bd3-ca3edde0b0d4"));
+                AAIUriFactory
+                        .createResourceUri(AAIFluentTypeBuilder.network().vce("a9fec18e-1ea3-40e4-a6c0-a89b3de07053")),
+                AAIUriFactory
+                        .createResourceUri(AAIFluentTypeBuilder.network().vce("8ae1e5f8-61f1-4c71-913a-b40cc4593cb9")),
+                AAIUriFactory
+                        .createResourceUri(AAIFluentTypeBuilder.network().vce("a2935fa9-b743-49f4-9813-a127f13c4e93")),
+                AAIUriFactory
+                        .createResourceUri(AAIFluentTypeBuilder.network().vce("c7fe7698-8063-4e26-8bd3-ca3edde0b0d4")));
 
         assertTrue(uris.containsAll(test) && test.containsAll(uris));
 
@@ -67,14 +72,14 @@ public class RelationshipsTest {
         ArgumentCaptor<AAIResourceUri> argument = ArgumentCaptor.forClass(AAIResourceUri.class);
         doReturn(new AAIResultWrapper("{}")).when(spy).get(argument.capture());
 
-        spy.getByType(AAIObjectType.VCE, uri -> uri.nodesOnly(true));
+        spy.getByType(Types.VCE, uri -> uri.nodesOnly(true));
 
         assertTrue(argument.getAllValues().stream().allMatch(item -> item.build().toString().contains("nodes-only")));
 
         argument = ArgumentCaptor.forClass(AAIResourceUri.class);
 
         doReturn(new AAIResultWrapper("{}")).when(spy).get(argument.capture());
-        spy.getByType(AAIObjectType.VCE);
+        spy.getByType(Types.VCE);
 
         assertTrue(argument.getAllValues().stream().allMatch(item -> !item.build().toString().contains("?")));
 
index 3823392..e8c84c0 100644 (file)
@@ -22,7 +22,8 @@ package org.onap.aaiclient.client.aai.entities.uri;
 
 import static org.junit.Assert.assertEquals;
 import org.junit.Test;
-import org.onap.aaiclient.client.aai.AAIObjectType;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types;
 
 public class AAISimpleUriFromParentUriTest {
 
@@ -30,10 +31,10 @@ public class AAISimpleUriFromParentUriTest {
     @Test
     public void appendChildren() {
 
-        AAIResourceUri parentUri =
-                AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, "key1", "key2", "key3");
+        AAIResourceUri parentUri = AAIUriFactory.createResourceUri(
+                AAIFluentTypeBuilder.business().customer("key1").serviceSubscription("key2").serviceInstance("key3"));
 
-        AAIResourceUri uri = new AAISimpleUri(parentUri, AAIObjectType.ALLOTTED_RESOURCE, "key4");
+        AAIResourceUri uri = new AAISimpleUri(parentUri, Types.ALLOTTED_RESOURCE.getFragment("").get().build(), "key4");
 
         assertEquals("path appended",
                 "/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3/allotted-resources/allotted-resource/key4",
index 9030789..3c8b2e8 100644 (file)
@@ -24,6 +24,7 @@ import static org.junit.Assert.assertEquals;
 import javax.ws.rs.core.UriBuilder;
 import org.junit.Test;
 import org.onap.aaiclient.client.aai.AAIObjectType;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
 
 public class AAISimpleUriFromUriTest {
 
@@ -66,10 +67,11 @@ public class AAISimpleUriFromUriTest {
     @Test
     public void beforeBuildEquality() {
 
-        AAIResourceUri uri = new AAISimpleUri(AAIObjectType.VCE,
+        AAIResourceUri uri = new AAISimpleUri(AAIFluentTypeBuilder.network().vce("").build(),
                 UriBuilder.fromUri("/network/vces/vce/a9f%20%20ec18e-1ea3-40e4-a6c0-a89b3de07053").build());
 
-        AAIResourceUri uri2 = new AAISimpleUri(AAIObjectType.VCE, "a9f  ec18e-1ea3-40e4-a6c0-a89b3de07053");
+        AAIResourceUri uri2 = new AAISimpleUri(AAIFluentTypeBuilder.network().vce("").build(),
+                "a9f  ec18e-1ea3-40e4-a6c0-a89b3de07053");
         assertEquals("are equal", uri2, uri);
 
     }
index f8dd172..6382be4 100644 (file)
@@ -29,9 +29,8 @@ import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
 import java.util.Map;
 import org.junit.Test;
-import org.onap.aaiclient.client.aai.AAIObjectPlurals;
-import org.onap.aaiclient.client.aai.AAIObjectType;
 import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types;
 import org.onap.aaiclient.client.graphinventory.entities.uri.Depth;
 
 public class AAISimpleUriTest {
@@ -40,23 +39,40 @@ public class AAISimpleUriTest {
 
     @Test
     public void relatedToTestPlural() {
-        AAIPluralResourceUri uri =
-                AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test1").relatedTo(AAIObjectPlurals.PSERVER);
+        AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("test1"))
+                .relatedTo(Types.PSERVERS.getFragment());
         String uriOutput = uri.build().toString();
-        assertEquals("/network/generic-vnfs/generic-vnf/test1/related-to/pservers", uriOutput);
+
+        String expected = "/network/generic-vnfs/generic-vnf/test1/related-to/pservers";
+        assertEquals(expected, uriOutput);
+
+        uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("test1"))
+                .relatedTo(Types.PSERVERS.getFragment());
+        uriOutput = uri.build().toString();
+        assertEquals(expected, uriOutput);
     }
 
     @Test
     public void relatedToTestSingular() {
-        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test1")
-                .relatedTo(AAIObjectType.PSERVER, "test2");
+        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("test1"))
+                .relatedTo(Types.PSERVER.getFragment("test2"));
         String uriOutput = uri.build().toString();
-        assertEquals("/network/generic-vnfs/generic-vnf/test1/related-to/pservers/pserver/test2", uriOutput);
+
+        String expected = "/network/generic-vnfs/generic-vnf/test1/related-to/pservers/pserver/test2";
+        assertEquals(expected, uriOutput);
+
+        uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("test1"))
+                .relatedTo(Types.PSERVER.getFragment("test2"));
+
+        uriOutput = uri.build().toString();
+
+        assertEquals(expected, uriOutput);
+
     }
 
     @Test
     public void cloneTestSingular() {
-        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test1");
+        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("test1"));
         AAIResourceUri cloned = uri.clone();
         assertEquals("/network/generic-vnfs/generic-vnf/test1", cloned.build().toString());
 
@@ -67,31 +83,31 @@ public class AAISimpleUriTest {
 
     @Test
     public void cloneTestPlural() {
-        AAISimplePluralUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF);
+        AAISimplePluralUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnfs());
         AAISimplePluralUri cloned = uri.clone();
         assertEquals("/network/generic-vnfs", cloned.build().toString());
     }
 
     @Test
     public void cloneTestWithRelatedTo() {
-        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test1")
-                .relatedTo(AAIObjectType.PSERVER, "test2");
+        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("test1"))
+                .relatedTo(Types.PSERVER.getFragment("test2"));
         String uriOutput = uri.clone().build().toString();
         assertEquals("/network/generic-vnfs/generic-vnf/test1/related-to/pservers/pserver/test2", uriOutput);
     }
 
     @Test
     public void cloneTestPluralWithRelatedTo() {
-        AAIPluralResourceUri uri =
-                AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test1").relatedTo(AAIObjectPlurals.PSERVER);
+        AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("test1"))
+                .relatedTo(Types.PSERVERS.getFragment());
         String uriOutput = uri.clone().build().toString();
         assertEquals("/network/generic-vnfs/generic-vnf/test1/related-to/pservers", uriOutput);
     }
 
     @Test
     public void getKeysTest() {
-        AAIResourceUri uri =
-                AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, "cloud1", "cloud2", "tenant1", "vserver1");
+        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+                .cloudRegion("cloud1", "cloud2").tenant("tenant1").vserver("vserver1"));
         Map<String, String> keys = uri.getURIKeys();
         System.out.println(keys);
         System.out.println(uri.build());
@@ -100,8 +116,8 @@ public class AAISimpleUriTest {
 
     @Test
     public void getEncodedKeyTest() {
-        AAIResourceUri uri =
-                AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, "test1", "my value", "test3");
+        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer("test1")
+                .serviceSubscription("my value").serviceInstance("test3"));
         Map<String, String> keys = uri.getURIKeys();
 
         assertEquals("my value", keys.get("service-type"));
@@ -109,7 +125,7 @@ public class AAISimpleUriTest {
 
     @Test
     public void serializeTest() throws IOException, ClassNotFoundException {
-        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test1");
+        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("test1"));
 
         uri.depth(Depth.ONE);
         uri.limit(1);
index ec40b1b..8751736 100644 (file)
@@ -22,15 +22,16 @@ package org.onap.aaiclient.client.aai.entities.uri;
 
 import static org.junit.Assert.assertEquals;
 import org.junit.Test;
-import org.onap.aaiclient.client.aai.AAIObjectPlurals;
-import org.onap.aaiclient.client.aai.AAIObjectType;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types;
 
 public class AAIUriFactoryTest {
 
     @Test
     public void testCreateResourceUri() {
 
-        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "VIP(VelocitytoIP)");
+        AAIResourceUri uri =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("VIP(VelocitytoIP)"));
 
         String expected = "/network/generic-vnfs/generic-vnf/VIP%28VelocitytoIP%29";
         assertEquals(expected, uri.build().toString());
@@ -39,7 +40,7 @@ public class AAIUriFactoryTest {
     @Test
     public void testCreateNodesUri() {
 
-        AAIResourceUri uri = AAIUriFactory.createNodesUri(AAIObjectType.GENERIC_VNF, "VIP(VelocitytoIP)");
+        AAIResourceUri uri = AAIUriFactory.createNodesUri(Types.GENERIC_VNF.getFragment("VIP(VelocitytoIP)"));
 
         String expected = "/nodes/generic-vnfs/generic-vnf/VIP%28VelocitytoIP%29";
         assertEquals(expected, uri.build().toString());
@@ -48,8 +49,9 @@ public class AAIUriFactoryTest {
     @Test
     public void testCreateResourceFromExistingURI() {
 
-        AAIResourceUri uri = new AAISimpleUri(AAIObjectType.GENERIC_VNF, "VIP(VelocitytoIP)");
-        AAIResourceUri uri2 = AAIUriFactory.createResourceFromExistingURI(AAIObjectType.GENERIC_VNF, uri.build());
+        AAIResourceUri uri =
+                new AAISimpleUri(AAIFluentTypeBuilder.network().genericVnf("").build(), "VIP(VelocitytoIP)");
+        AAIResourceUri uri2 = AAIUriFactory.createResourceFromExistingURI(Types.GENERIC_VNF, uri.build());
 
         String expected = "/network/generic-vnfs/generic-vnf/VIP%28VelocitytoIP%29";
         assertEquals(expected, uri2.build().toString());
@@ -58,11 +60,20 @@ public class AAIUriFactoryTest {
     @Test
     public void testCreateResourceURIForPluralsWithValues() {
 
-        AAIPluralResourceUri uri =
-                AAIUriFactory.createResourceUri(AAIObjectPlurals.SERVICE_INSTANCE, "customerId", "serviceType");
+        AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business()
+                .customer("customerId").serviceSubscription("serviceType").serviceInstances());
 
         String expected =
                 "/business/customers/customer/customerId/service-subscriptions/service-subscription/serviceType/service-instances";
         assertEquals(expected, uri.build().toString());
     }
+
+    @Test
+    public void testCreateResourceURIForPluralsWithNoValues() {
+
+        AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customers());
+
+        String expected = "/business/customers";
+        assertEquals(expected, uri.build().toString());
+    }
 }
index e6add8c..eb59173 100644 (file)
@@ -29,6 +29,7 @@ import java.net.URI;
 import java.net.URISyntaxException;
 import javax.ws.rs.core.UriBuilder;
 import org.junit.Test;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types;
 import org.onap.aaiclient.client.graphinventory.exceptions.GraphInventoryPayloadException;
 import org.onap.aaiclient.client.graphinventory.exceptions.GraphInventoryUriNotFoundException;
 
@@ -38,7 +39,7 @@ public class AllottedResourceLookupUriTest {
     public void oneKey()
             throws IOException, URISyntaxException, GraphInventoryUriNotFoundException, GraphInventoryPayloadException {
 
-        AllottedResourceLookupUri instance = new AllottedResourceLookupUri("key1");
+        AllottedResourceLookupUri instance = new AllottedResourceLookupUri(Types.ALLOTTED_RESOURCE.getFragment("key1"));
         AllottedResourceLookupUri spy = spy(instance);
         doReturn(
                 "/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3/allotted-resources/allotted-resource/key4")
diff --git a/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/entities/uri/IncorrectNumberOfUriKeysTest.java b/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/entities/uri/IncorrectNumberOfUriKeysTest.java
deleted file mode 100644 (file)
index 2cbf5bb..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.aaiclient.client.aai.entities.uri;
-
-import static org.hamcrest.CoreMatchers.equalTo;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.onap.aaiclient.client.aai.AAIObjectPlurals;
-import org.onap.aaiclient.client.aai.AAIObjectType;
-import org.onap.aaiclient.client.graphinventory.exceptions.IncorrectNumberOfUriKeys;
-
-public class IncorrectNumberOfUriKeysTest {
-
-    @Rule
-    public ExpectedException thrown = ExpectedException.none();
-
-    @Test
-    public void verifyIncorrectNumberOfKeysSingle() {
-
-        thrown.expect(IncorrectNumberOfUriKeys.class);
-        thrown.expectMessage(equalTo("Expected 3 variables: [cloud-owner, cloud-region-id, volume-group-id]"));
-        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, "volume-group-id");
-
-    }
-
-    @Test
-    public void verifyIncorrectNumberOfKeysPlural() {
-
-        thrown.expect(IncorrectNumberOfUriKeys.class);
-        AAISimplePluralUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VOLUME_GROUP, "my-cloud-owner");
-
-    }
-
-    @Test
-    public void verifyIncorrectNumberOfKeysFromParent() {
-
-        thrown.expect(IncorrectNumberOfUriKeys.class);
-        AAIResourceUri parentUri =
-                AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, "my-cloud-owner", "my-cloud-region-id");
-        AAIResourceUri uri = AAIUriFactory.createResourceFromParentURI(parentUri, AAIObjectType.VOLUME_GROUP);
-    }
-
-    @Test
-    public void verifyIncorrectNumberOfKeysHttpAware() {
-
-        thrown.expect(IncorrectNumberOfUriKeys.class);
-        AAIResourceUri uri =
-                AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, "customer-id", "subscription-id");
-    }
-}
index 514a349..6a1b459 100644 (file)
@@ -56,10 +56,10 @@ import org.mockito.InjectMocks;
 import org.mockito.Spy;
 import org.mockito.junit.MockitoJUnitRunner;
 import org.onap.aaiclient.client.aai.AAIClient;
-import org.onap.aaiclient.client.aai.AAIObjectPlurals;
 import org.onap.aaiclient.client.aai.AAIResourcesClient;
 import org.onap.aaiclient.client.aai.entities.AAIResultWrapper;
 import org.onap.aaiclient.client.defaultproperties.DefaultAAIPropertiesImpl;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types;
 import org.onap.aaiclient.client.graphinventory.entities.uri.HttpAwareUri;
 import org.onap.aaiclient.client.graphinventory.exceptions.GraphInventoryPayloadException;
 import org.onap.aaiclient.client.graphinventory.exceptions.GraphInventoryUriComputationException;
@@ -93,7 +93,7 @@ public class ServiceInstanceUriTest {
         final String content = new String(
                 Files.readAllBytes(Paths.get(AAI_JSON_FILE_LOCATION + "service-instance-pathed-query.json")));
 
-        ServiceInstanceUri instance = new ServiceInstanceUri("key3");
+        ServiceInstanceUri instance = new ServiceInstanceUri(Types.SERVICE_INSTANCE.getFragment("key3"));
         final Optional<String> result = instance.extractRelatedLink(content);
         final String expected =
                 "/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3";
@@ -105,7 +105,7 @@ public class ServiceInstanceUriTest {
     public void oneKey()
             throws IOException, URISyntaxException, GraphInventoryUriNotFoundException, GraphInventoryPayloadException {
 
-        ServiceInstanceUri instance = new ServiceInstanceUri("key1");
+        ServiceInstanceUri instance = new ServiceInstanceUri(Types.SERVICE_INSTANCE.getFragment("key1"));
         ServiceInstanceUri spy = spy(instance);
         doReturn(
                 "/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3")
@@ -123,7 +123,7 @@ public class ServiceInstanceUriTest {
     public void oneKeyQueryParams()
             throws IOException, URISyntaxException, GraphInventoryUriNotFoundException, GraphInventoryPayloadException {
 
-        ServiceInstanceUri instance = new ServiceInstanceUri("key1");
+        ServiceInstanceUri instance = new ServiceInstanceUri(Types.SERVICE_INSTANCE.getFragment("key1"));
         ServiceInstanceUri spy = spy(instance);
         doReturn(
                 "/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3")
@@ -141,7 +141,7 @@ public class ServiceInstanceUriTest {
     public void oneKeyEncoded()
             throws IOException, URISyntaxException, GraphInventoryUriNotFoundException, GraphInventoryPayloadException {
 
-        ServiceInstanceUri instance = new ServiceInstanceUri("key1");
+        ServiceInstanceUri instance = new ServiceInstanceUri(Types.SERVICE_INSTANCE.getFragment("key1"));
         ServiceInstanceUri spy = spy(instance);
         doReturn(
                 "/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3%20space")
@@ -159,7 +159,7 @@ public class ServiceInstanceUriTest {
     public void oneKeyGetKeys()
             throws IOException, URISyntaxException, GraphInventoryUriNotFoundException, GraphInventoryPayloadException {
 
-        ServiceInstanceUri instance = new ServiceInstanceUri("key1");
+        ServiceInstanceUri instance = new ServiceInstanceUri(Types.SERVICE_INSTANCE.getFragment("key1"));
         ServiceInstanceUri spy = spy(instance);
         doReturn(
                 "/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3%28space")
@@ -171,7 +171,7 @@ public class ServiceInstanceUriTest {
 
     @Test
     public void oneKeyClone() throws GraphInventoryUriNotFoundException, GraphInventoryPayloadException {
-        ServiceInstanceUri instance = new ServiceInstanceUri("key1");
+        ServiceInstanceUri instance = new ServiceInstanceUri(Types.SERVICE_INSTANCE.getFragment("key1"));
         ServiceInstanceUri spy = spy(instance);
         String uri =
                 "/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3";
@@ -183,24 +183,12 @@ public class ServiceInstanceUriTest {
         assertEquals("result is equal", expected, result);
     }
 
-    @Test
-    public void threeKey() throws IOException {
-
-        ServiceInstanceUri instance = new ServiceInstanceUri("key1", "key2", "key3");
-        final URI result = instance.build();
-        final URI expected = UriBuilder.fromPath(
-                "/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3")
-                .build();
-        assertEquals("result is equal", expected, result);
-
-    }
-
     @Test
     public void notfound() throws IOException, GraphInventoryUriNotFoundException, GraphInventoryPayloadException {
         final String content =
                 new String(Files.readAllBytes(Paths.get(AAI_JSON_FILE_LOCATION + "empty-query-result.json")));
 
-        ServiceInstanceUri instance = new ServiceInstanceUri("key3");
+        ServiceInstanceUri instance = new ServiceInstanceUri(Types.SERVICE_INSTANCE.getFragment("key3"));
         ServiceInstanceUri spy = spy(instance);
         AAIResourcesClient mockResourcesClient = mock(AAIResourcesClient.class);
         AAIResultWrapper wrapper = mock(AAIResultWrapper.class);
@@ -213,18 +201,9 @@ public class ServiceInstanceUriTest {
 
     }
 
-    @Test
-    public void cloneTest() {
-        ServiceInstanceUri instance = new ServiceInstanceUri("key1", "key2", "key3");
-        final URI result = instance.build();
-        final URI result2 = instance.clone().queryParam("something", "new").build();
-        assertEquals("uris are not equal", false, result.toString().equals(result2.toString()));
-
-    }
-
     @Test
     public void noVertexFound() throws GraphInventoryUriNotFoundException, GraphInventoryPayloadException {
-        ServiceInstanceUri instance = new ServiceInstanceUri("key3");
+        ServiceInstanceUri instance = new ServiceInstanceUri(Types.SERVICE_INSTANCE.getFragment("key3"));
         ServiceInstanceUri spy = spy(instance);
         AAIResourcesClient client = aaiClient;
         doReturn(client).when(spy).getResourcesClient();
@@ -238,7 +217,7 @@ public class ServiceInstanceUriTest {
     @Test
     public void serializeTest() throws IOException, ClassNotFoundException, GraphInventoryUriNotFoundException,
             GraphInventoryPayloadException {
-        ServiceInstanceUri instance = new ServiceInstanceUri("key3");
+        ServiceInstanceUri instance = new ServiceInstanceUri(Types.SERVICE_INSTANCE.getFragment("key3"));
         final String content = new String(
                 Files.readAllBytes(Paths.get(AAI_JSON_FILE_LOCATION + "service-instance-pathed-query.json")));
 
@@ -274,13 +253,14 @@ public class ServiceInstanceUriTest {
 
     @Test
     public void relatedToTest() throws GraphInventoryUriNotFoundException, GraphInventoryPayloadException {
-        ServiceInstanceUri instance = new ServiceInstanceUri("key1");
+        ServiceInstanceUri instance = new ServiceInstanceUri(Types.SERVICE_INSTANCE.getFragment("key1"));
         ServiceInstanceUri spy = spy(instance);
         doReturn(
                 "/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3")
                         .when(spy).getObjectById(any(Object.class));
 
-        final URI result = spy.relatedTo(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", "my-vnf-name").build();
+        final URI result =
+                spy.relatedTo(Types.GENERIC_VNFS.getFragment()).queryParam("vnf-name", "my-vnf-name").build();
         final URI expected = UriBuilder.fromUri(
                 "/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3/related-to/generic-vnfs?vnf-name=my-vnf-name")
                 .build();
@@ -290,11 +270,11 @@ public class ServiceInstanceUriTest {
     @Test
     public void relatedToEqualityTestBeforeBuildTest()
             throws GraphInventoryUriNotFoundException, GraphInventoryPayloadException {
-        ServiceInstanceUri instance = new ServiceInstanceUri("key1");
+        ServiceInstanceUri instance = new ServiceInstanceUri(Types.SERVICE_INSTANCE.getFragment("key1"));
         ServiceInstanceUri spy = spy(instance);
 
         final AAIPluralResourceUri result =
-                spy.relatedTo(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", "my-vnf-name");
+                spy.relatedTo(Types.GENERIC_VNFS.getFragment()).queryParam("vnf-name", "my-vnf-name");
 
         assertEquals("result is equal", result, result);
     }
index 270aca0..7b3e80f 100644 (file)
@@ -23,9 +23,7 @@ package org.onap.aaiclient.client.graphinventory.entities.uri.parsers;
 import static org.junit.Assert.assertEquals;
 import java.util.Map;
 import org.junit.Test;
-import org.onap.aaiclient.client.aai.AAIObjectType;
-import org.onap.aaiclient.client.graphinventory.entities.uri.parsers.UriParser;
-import org.onap.aaiclient.client.graphinventory.entities.uri.parsers.UriParserSpringImpl;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
 
 public class UriParserSpringImplTest {
 
@@ -33,7 +31,8 @@ public class UriParserSpringImplTest {
 
     @Test
     public void reverseTemplate() {
-        final UriParser parser = new UriParserSpringImpl(AAIObjectType.SERVICE_INSTANCE.toString());
+        final UriParser parser = new UriParserSpringImpl(
+                AAIFluentTypeBuilder.business().customer("").serviceSubscription("").serviceInstance("").uriTemplate());
         final String uri =
                 "/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3";
 
index f088475..87f5138 100644 (file)
@@ -8,10 +8,6 @@
   </parent>
   <artifactId>fluent-builder-maven-plugin</artifactId>
   <packaging>maven-plugin</packaging>
-  <properties>
-    <maven.compiler.source>1.8</maven.compiler.source>
-    <maven.compiler.target>1.8</maven.compiler.target>
-  </properties>
   <build>
     <plugins>
       <plugin>
index 4a8b7d9..efbeba2 100644 (file)
@@ -39,11 +39,13 @@ public class FluentGenerator {
     private final String pluralClass;
     private final String builderName;
     private final String nameClass;
+    private final String singleFragmentClass;
+    private final String pluralFragmentClass;
 
     public FluentGenerator(Log log, String location, String destinationClasspath, String swaggerLocation,
             String builderName, String singularBuilderClass, String pluralBuilderClass, String topLevelBuilderClass,
-            String baseBuilderClass, String singularClass, String pluralClass, String nameClass)
-            throws JsonProcessingException {
+            String baseBuilderClass, String singularClass, String pluralClass, String nameClass,
+            String singleFragmentClass, String pluralFragmentClass) throws JsonProcessingException {
 
         this.location = location;
         this.CLASSPATH = destinationClasspath;
@@ -55,6 +57,8 @@ public class FluentGenerator {
         this.singularClass = singularClass;
         this.pluralClass = pluralClass;
         this.nameClass = nameClass;
+        this.singleFragmentClass = singleFragmentClass;
+        this.pluralFragmentClass = pluralFragmentClass;
         doc = new SwaggerConverter(log).getDoc(swaggerLocation);
     }
 
@@ -241,7 +245,8 @@ public class FluentGenerator {
     }
 
     protected TypeSpec createTypes() {
-        List<FieldSpec> params = doc.values().stream().filter(item -> item.getType().equals("singular"))
+        List<FieldSpec> params = doc.values().stream()
+                .filter(item -> item.getType().equals("singular") || item.getType().equals("plural"))
                 .sorted(Comparator.comparing(item -> item.getName())).map(item -> {
                     ClassName nameType =
                             ClassName.get(CLASSPATH, CaseFormat.LOWER_HYPHEN.to(CaseFormat.UPPER_CAMEL, item.getName()))
@@ -274,6 +279,18 @@ public class FluentGenerator {
                         "\"" + oType.getPaths().stream().collect(Collectors.joining("\", \"")) + "\"")
                 .build());
 
+        if (oType.getType().equals("plural")) {
+            Pair<String, String> path = splitClasspath(this.pluralFragmentClass);
+            ClassName fragmentClass = ClassName.get(path.getLeft(), path.getRight());
+            path = splitClasspath(this.baseBuilderClass);
+            ClassName baseClass = ClassName.get(path.getLeft(), path.getRight());
+
+            classFields.add(FieldSpec.builder(fragmentClass, "fragment")
+                    .addModifiers(Modifier.PRIVATE, Modifier.FINAL, Modifier.STATIC)
+                    .initializer("new $T(new $L(new $T(){}))", fragmentClass, upperCamel(oType.getName()), baseClass)
+                    .build());
+        }
+
         ClassName superInterface;
         String name;
         if (oType.getType().equals("plural")) {
@@ -294,6 +311,34 @@ public class FluentGenerator {
                 .addModifiers(Modifier.PUBLIC).addAnnotation(Override.class).addStatement("return Info.paths").build());
         methods.add(MethodSpec.methodBuilder("getPartialUri").returns(String.class).addModifiers(Modifier.PUBLIC)
                 .addAnnotation(Override.class).addStatement("return Info.partialUri").build());
+
+        if (oType.getType().equals("plural")) {
+            Pair<String, String> path = splitClasspath(this.pluralFragmentClass);
+            ClassName fragmentClass = ClassName.get(path.getLeft(), path.getRight());
+            methods.add(MethodSpec.methodBuilder("getFragment").returns(fragmentClass).addModifiers(Modifier.PUBLIC)
+                    .addStatement("return fragment").build());
+        } else if (oType.getType().equals("singular")) {
+            Pair<String, String> path = splitClasspath(this.singleFragmentClass);
+            ClassName fragmentClass = ClassName.get(path.getLeft(), path.getRight());
+            path = splitClasspath(this.baseBuilderClass);
+            ClassName baseClass = ClassName.get(path.getLeft(), path.getRight());
+            List<ParameterSpec> typeParams = new ArrayList<>();
+
+            for (ObjectField oF : oType.getFields()) {
+                if (oF.getType().equals("string")) {
+                    typeParams.add(ParameterSpec.builder(String.class, lowerCamel(makeValidJavaVariable(oF.getName())))
+                            .build());
+                } else if (oF.getType().equals("integer")) {
+                    typeParams.add(
+                            ParameterSpec.builder(int.class, lowerCamel(makeValidJavaVariable(oF.getName()))).build());
+                }
+            }
+            methods.add(MethodSpec.methodBuilder("getFragment").returns(fragmentClass).addParameters(typeParams)
+                    .addModifiers(Modifier.PUBLIC)
+                    .addStatement("return new $T(new $L(new $T(){}, $L))", fragmentClass, upperCamel(oType.getName()),
+                            baseClass, typeParams.stream().map(item -> item.name).collect(Collectors.joining(", ")))
+                    .build());
+        }
         if (!oType.getType().equals("top level")) {
             classFields.add(FieldSpec.builder(String.class, "name")
                     .addModifiers(Modifier.PRIVATE, Modifier.FINAL, Modifier.STATIC).initializer("$S", name).build());
index 9de249f..8c672e3 100644 (file)
@@ -34,13 +34,17 @@ public class FluentGeneratorMojo extends AbstractMojo {
     private String pluralClass;
     @Parameter
     private String nameClass;
+    @Parameter
+    private String singleFragmentClass;
+    @Parameter
+    private String pluralFragmentClass;
 
     public void execute() throws MojoExecutionException, MojoFailureException {
 
         try {
             new FluentGenerator(getLog(), destination, destinationClasspath, swaggerLocation, builderName,
                     singularBuilderClass, pluralBuilderClass, topLevelBuilderClass, baseBuilderClass, singularClass,
-                    pluralClass, nameClass).run();
+                    pluralClass, nameClass, singleFragmentClass, pluralFragmentClass).run();
         } catch (JsonProcessingException e) {
             // TODO Auto-generated catch block
             e.printStackTrace();
index c7692cb..b09d676 100644 (file)
 package org.onap.so.apihandlerinfra;
 
 import java.io.IOException;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.UUID;
 import javax.ws.rs.Consumes;
 import javax.ws.rs.DELETE;
 import javax.ws.rs.GET;
@@ -34,14 +39,13 @@ import javax.ws.rs.PathParam;
 import javax.ws.rs.Produces;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
-import org.onap.so.apihandlerinfra.e2eserviceinstancebeans.*;
+import org.apache.http.HttpStatus;
+import org.json.JSONObject;
 import org.onap.aai.domain.yang.v16.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.apache.http.HttpStatus;
-import org.json.JSONObject;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
 import org.onap.logging.filter.base.ErrorCode;
 import org.onap.so.apihandler.camundabeans.CamundaResponse;
 import org.onap.so.apihandler.common.CamundaClient;
@@ -53,6 +57,7 @@ import org.onap.so.apihandlerinfra.e2eserviceinstancebeans.CompareModelsRequest;
 import org.onap.so.apihandlerinfra.e2eserviceinstancebeans.E2EServiceInstanceDeleteRequest;
 import org.onap.so.apihandlerinfra.e2eserviceinstancebeans.E2EServiceInstanceRequest;
 import org.onap.so.apihandlerinfra.e2eserviceinstancebeans.E2EServiceInstanceScaleRequest;
+import org.onap.so.apihandlerinfra.e2eserviceinstancebeans.E2ESliceServiceActivateRequest;
 import org.onap.so.apihandlerinfra.e2eserviceinstancebeans.GetE2EServiceInstanceResponse;
 import org.onap.so.apihandlerinfra.exceptions.ApiException;
 import org.onap.so.apihandlerinfra.exceptions.BPMNFailureException;
@@ -380,8 +385,9 @@ public class E2EServiceInstances {
             // TODO Get the service template model version uuid from AAI.
             String modelVersionId = null;
             AAIResourcesClient client = new AAIResourcesClient();
-            AAIResourceUri url = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
-                    e2eActReq.getGlobalSubscriberId(), e2eActReq.getServiceType(), instanceIdMap.get(SERVICE_ID));
+            AAIResourceUri url = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business()
+                    .customer(e2eActReq.getGlobalSubscriberId()).serviceSubscription(e2eActReq.getServiceType())
+                    .serviceInstance(instanceIdMap.get(SERVICE_ID)));
             Optional<ServiceInstance> serviceInstanceOpt = client.get(ServiceInstance.class, url);
             if (serviceInstanceOpt.isPresent()) {
                 modelVersionId = serviceInstanceOpt.get().getModelVersionId();
@@ -469,8 +475,9 @@ public class E2EServiceInstances {
             // TODO Get the service template model version uuid from AAI.
             String modelVersionId = null;
             AAIResourcesClient client = new AAIResourcesClient();
-            AAIResourceUri url = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
-                    e2eDelReq.getGlobalSubscriberId(), e2eDelReq.getServiceType(), instanceIdMap.get(SERVICE_ID));
+            AAIResourceUri url = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business()
+                    .customer(e2eDelReq.getGlobalSubscriberId()).serviceSubscription(e2eDelReq.getServiceType())
+                    .serviceInstance(instanceIdMap.get(SERVICE_ID)));
             Optional<ServiceInstance> serviceInstanceOpt = client.get(ServiceInstance.class, url);
             if (serviceInstanceOpt.isPresent()) {
                 modelVersionId = serviceInstanceOpt.get().getModelVersionId();
index e7b96b1..3f05c79 100644 (file)
@@ -23,6 +23,11 @@ package org.onap.so.apihandlerinfra;
 import java.sql.Timestamp;
 import java.util.HashMap;
 import java.util.UUID;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 import java.util.function.Function;
 import javax.ws.rs.Consumes;
 import javax.ws.rs.DELETE;
@@ -54,6 +59,7 @@ import org.onap.so.apihandlerinfra.onap3gppserviceinstancebeans.Allocate3gppServ
 import org.onap.so.apihandlerinfra.onap3gppserviceinstancebeans.DeAllocate3gppService;
 import org.onap.so.apihandlerinfra.onap3gppserviceinstancebeans.Modify3gppService;
 import org.onap.so.apihandlerinfra.onap3gppserviceinstancebeans.QuerySubnetCapability;
+import org.onap.so.apihandlerinfra.onap3gppserviceinstancebeans.SubnetTypes;
 import org.onap.so.constants.Status;
 import org.onap.so.db.catalog.beans.Service;
 import org.onap.so.db.catalog.beans.ServiceRecipe;
@@ -70,6 +76,7 @@ import org.springframework.http.ResponseEntity;
 import org.springframework.stereotype.Component;
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.core.type.TypeReference;
 import io.swagger.v3.oas.annotations.OpenAPIDefinition;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.info.Info;
@@ -238,8 +245,8 @@ public class Onap3gppServiceInstances {
     public Response getSliceSubnetCapabilities(QuerySubnetCapability request, @PathParam("version") String version)
             throws ApiException {
         logger.debug("Request received {}", request);
-        String subnetType = null;
-        return getSubnetCapabilities(subnetType, version);
+        List<SubnetTypes> subnetTypes = request.getSubnetTypes();
+        return getSubnetCapabilities(subnetTypes, version);
     }
 
     /**
@@ -577,8 +584,28 @@ public class Onap3gppServiceInstances {
     }
 
     // To be implemented for fetching Subnet capabilities
-    private Response getSubnetCapabilities(String subnetType, String version) throws ApiException {
-        return null;
+    private Response getSubnetCapabilities(List<SubnetTypes> subnetTypes, String version) throws ApiException {
+        ObjectMapper oMapper = new ObjectMapper();
+        InputStream inputStream = TypeReference.class.getResourceAsStream("/subnetCapability.json");
+        Map<String, Object> subnetCapability = new HashMap<>();
+        try {
+            subnetCapability = oMapper.readValue(inputStream, Map.class);
+        } catch (Exception e) {
+            logger.debug("Exception while reading subnet capability value from json", e);
+        }
+        Map<String, Object> responseMap = new HashMap<>();
+        for (SubnetTypes value : subnetTypes) {
+            if (subnetCapability.containsKey(value.toString())) {
+                responseMap.put(value.toString(), subnetCapability.get(value.toString()));
+            }
+        }
+        String response = null;
+        try {
+            response = oMapper.writeValueAsString(responseMap);
+        } catch (JsonProcessingException e) {
+            logger.debug("Exception while converting subnet capability object to String {}", e);
+        }
+        return builder.buildResponse(HttpStatus.SC_OK, null, response, version);
     }
 
     /**
index 87e5a2f..60e9c3b 100644 (file)
@@ -518,20 +518,16 @@ public class RequestHandlerUtils extends AbstractRestHandler {
     }
 
     protected String setServiceInstanceId(String requestScope, ServiceInstancesRequest sir) {
+        String serviceInstanceId = null;
         if (sir.getServiceInstanceId() != null) {
-            return sir.getServiceInstanceId();
-        } else if (requestScope.equalsIgnoreCase(ModelType.instanceGroup.toString())) {
-            RelatedInstanceList[] relatedInstances = sir.getRequestDetails().getRelatedInstanceList();
-            if (relatedInstances != null) {
-                for (RelatedInstanceList relatedInstanceList : relatedInstances) {
-                    RelatedInstance relatedInstance = relatedInstanceList.getRelatedInstance();
-                    if (relatedInstance.getModelInfo().getModelType() == ModelType.service) {
-                        return relatedInstance.getInstanceId();
-                    }
-                }
+            serviceInstanceId = sir.getServiceInstanceId();
+        } else {
+            Optional<String> serviceInstanceIdForInstance = getServiceInstanceIdForInstanceGroup(requestScope, sir);
+            if (serviceInstanceIdForInstance.isPresent()) {
+                serviceInstanceId = serviceInstanceIdForInstance.get();
             }
         }
-        return null;
+        return serviceInstanceId;
     }
 
     private String requestScopeFromUri(String requestUri) {
@@ -916,6 +912,30 @@ public class RequestHandlerUtils extends AbstractRestHandler {
         return null;
     }
 
+    protected Optional<String> getServiceInstanceIdForValidationError(ServiceInstancesRequest sir,
+            HashMap<String, String> instanceIdMap, String requestScope) {
+        if (instanceIdMap != null && !instanceIdMap.isEmpty() && instanceIdMap.get("serviceInstanceId") != null) {
+            return Optional.of(instanceIdMap.get("serviceInstanceId"));
+        } else {
+            return getServiceInstanceIdForInstanceGroup(requestScope, sir);
+        }
+    }
+
+    protected Optional<String> getServiceInstanceIdForInstanceGroup(String requestScope, ServiceInstancesRequest sir) {
+        if (requestScope.equalsIgnoreCase(ModelType.instanceGroup.toString())) {
+            RelatedInstanceList[] relatedInstances = sir.getRequestDetails().getRelatedInstanceList();
+            if (relatedInstances != null) {
+                for (RelatedInstanceList relatedInstanceList : relatedInstances) {
+                    RelatedInstance relatedInstance = relatedInstanceList.getRelatedInstance();
+                    if (relatedInstance.getModelInfo().getModelType() == ModelType.service) {
+                        return Optional.ofNullable(relatedInstance.getInstanceId());
+                    }
+                }
+            }
+        }
+        return Optional.empty();
+    }
+
     private RecipeLookupResult getDefaultVnfUri(ServiceInstancesRequest sir, Actions action) {
         String defaultSource = getDefaultModel(sir);
         VnfRecipe vnfRecipe = catalogDbClient.getFirstVnfRecipeByNfRoleAndAction(defaultSource, action.toString());
index 107aa57..2c8e926 100644 (file)
@@ -829,7 +829,8 @@ public class ServiceInstances extends AbstractRestHandler {
             requestValidatorListenerRunner.runValidations(requestUri, instanceIdMap, sir, queryParams, action);
         } catch (ApiException e) {
             msoRequest.createErrorRequestRecord(Status.FAILED, requestId, e.getMessage(), action, requestScope,
-                    requestJSON, sir.getServiceInstanceId());
+                    requestJSON, requestHandlerUtils
+                            .getServiceInstanceIdForValidationError(sir, instanceIdMap, requestScope).orElse(null));
             throw e;
         }
 
index 70de94a..d8ad82c 100644 (file)
@@ -1,7 +1,6 @@
 package org.onap.so.apihandlerinfra.infra.rest;
 
 import java.util.ArrayList;
-import java.util.Collection;
 import java.util.List;
 import java.util.Optional;
 import java.util.stream.Collectors;
@@ -15,14 +14,13 @@ import org.onap.aai.domain.yang.VfModule;
 import org.onap.aai.domain.yang.VfModules;
 import org.onap.aai.domain.yang.VolumeGroup;
 import org.onap.aai.domain.yang.VolumeGroups;
-import org.onap.so.apihandlerinfra.infra.rest.exception.AAIEntityNotFound;
 import org.onap.aaiclient.client.aai.AAIDSLQueryClient;
-import org.onap.aaiclient.client.aai.AAIObjectPlurals;
-import org.onap.aaiclient.client.aai.AAIObjectType;
 import org.onap.aaiclient.client.aai.AAIResourcesClient;
 import org.onap.aaiclient.client.aai.entities.AAIResultWrapper;
 import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
 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.aaiclient.client.graphinventory.entities.DSLQuery;
 import org.onap.aaiclient.client.graphinventory.entities.DSLQueryBuilder;
 import org.onap.aaiclient.client.graphinventory.entities.DSLStartNode;
@@ -30,6 +28,8 @@ import org.onap.aaiclient.client.graphinventory.entities.Node;
 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.so.apihandlerinfra.infra.rest.exception.AAIEntityNotFound;
+import org.onap.so.serviceinstancebeans.CloudConfiguration;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Component;
@@ -48,7 +48,7 @@ public class AAIDataRetrieval {
     public ServiceInstance getServiceInstance(String serviceInstanceId) {
         return this.getAaiResourcesClient()
                 .get(ServiceInstance.class,
-                        AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId))
+                        AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId)))
                 .orElseGet(() -> {
                     logger.debug("No Service Instance found in A&AI ServiceInstanceId: {}", serviceInstanceId);
                     return null;
@@ -57,7 +57,9 @@ public class AAIDataRetrieval {
 
     public VfModule getAAIVfModule(String vnfId, String vfModuleId) {
         return this.getAaiResourcesClient()
-                .get(VfModule.class, AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId))
+                .get(VfModule.class,
+                        AAIUriFactory.createResourceUri(
+                                AAIFluentTypeBuilder.network().genericVnf(vnfId).vfModule(vfModuleId)))
                 .orElseGet(() -> {
                     logger.debug("No Vf Module found in A&AI VnfId: {}" + ", VfModuleId: {}", vnfId, vfModuleId);
                     return null;
@@ -66,7 +68,8 @@ public class AAIDataRetrieval {
 
     public GenericVnf getGenericVnf(String vnfId) {
         return this.getAaiResourcesClient()
-                .get(GenericVnf.class, AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId))
+                .get(GenericVnf.class,
+                        AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)))
                 .orElseGet(() -> {
                     logger.debug("No Generic VNF found in A&AI VnfId: {}", vnfId);
                     return null;
@@ -74,9 +77,9 @@ public class AAIDataRetrieval {
     }
 
     public VolumeGroup getVolumeGroup(String vnfId, String volumeGroupId) throws AAIEntityNotFound {
-        AAIResultWrapper wrapper =
-                this.getAaiResourcesClient().get(AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
-                        .relatedTo(AAIObjectType.VOLUME_GROUP, volumeGroupId));
+        AAIResultWrapper wrapper = this.getAaiResourcesClient()
+                .get(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId))
+                        .relatedTo(Types.VOLUME_GROUP.getFragment(volumeGroupId)));
         Optional<VolumeGroup> volume = wrapper.asBean(VolumeGroup.class);
         if (volume.isPresent()) {
             return volume.get();
@@ -88,7 +91,8 @@ public class AAIDataRetrieval {
 
     public L3Network getNetwork(String networkId) {
         return this.getAaiResourcesClient()
-                .get(L3Network.class, AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, networkId))
+                .get(L3Network.class,
+                        AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(networkId)))
                 .orElseGet(() -> {
                     logger.debug("No Network found in A&AI NetworkId: {}", networkId);
                     return null;
@@ -96,51 +100,57 @@ public class AAIDataRetrieval {
     }
 
 
-    public boolean isVolumeGroupRelatedToVFModule(String volumeGroupId) {
-        return this.getAaiResourcesClient().exists(AAIUriFactory
-                .createResourceUri(AAIObjectType.VOLUME_GROUP, volumeGroupId).relatedTo(AAIObjectPlurals.VF_MODULE));
+    public boolean isVolumeGroupRelatedToVFModule(CloudConfiguration cloudConfig, String volumeGroupId) {
+        return this.getAaiResourcesClient()
+                .exists(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+                        .cloudRegion(cloudConfig.getCloudOwner(), cloudConfig.getLcpCloudRegionId())
+                        .volumeGroup(volumeGroupId)).relatedTo(Types.VF_MODULES.getFragment()));
     }
 
     public boolean isVnfRelatedToVolumes(String vnfId) {
-        return this.getAaiResourcesClient().exists(AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
-                .relatedTo(AAIObjectPlurals.VOLUME_GROUP));
+        return this.getAaiResourcesClient()
+                .exists(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId))
+                        .relatedTo(Types.VOLUME_GROUPS.getFragment()));
     }
 
     public boolean isNetworkRelatedToModules(String networkId) {
-        return this.getAaiResourcesClient().exists(AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, networkId)
-                .relatedTo(AAIObjectPlurals.VF_MODULE));
+        return this.getAaiResourcesClient()
+                .exists(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(networkId))
+                        .relatedTo(Types.VF_MODULES.getFragment()));
     }
 
     public boolean isServiceRelatedToNetworks(String serviceInstanceId) {
         return this.getAaiResourcesClient()
-                .exists(AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId)
-                        .relatedTo(AAIObjectPlurals.L3_NETWORK));
+                .exists(AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId))
+                        .relatedTo(Types.L3_NETWORKS.getFragment()));
     }
 
     public boolean isServiceRelatedToGenericVnf(String serviceInstanceId) {
         return this.getAaiResourcesClient()
-                .exists(AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId)
-                        .relatedTo(AAIObjectPlurals.GENERIC_VNF));
+                .exists(AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId))
+                        .relatedTo(Types.GENERIC_VNFS.getFragment()));
     }
 
     public boolean isServiceRelatedToConfiguration(String serviceInstanceId) {
         return this.getAaiResourcesClient()
-                .exists(AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId)
-                        .relatedTo(AAIObjectPlurals.CONFIGURATION));
+                .exists(AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId))
+                        .relatedTo(Types.CONFIGURATIONS.getFragment()));
     }
 
     public Service getService(String serviceId) {
         return this.getAaiResourcesClient()
-                .get(Service.class, AAIUriFactory.createResourceUri(AAIObjectType.SERVICE, serviceId)).orElseGet(() -> {
+                .get(Service.class,
+                        AAIUriFactory
+                                .createResourceUri(AAIFluentTypeBuilder.serviceDesignAndCreation().service(serviceId)))
+                .orElseGet(() -> {
                     logger.debug("No Service found in A&AI ServiceId: {}", serviceId);
                     return null;
                 });
     }
 
     public Tenant getTenant(String cloudOwner, String cloudRegion, String tenantId) {
-        return this.getAaiResourcesClient()
-                .get(Tenant.class,
-                        AAIUriFactory.createResourceUri(AAIObjectType.TENANT, cloudOwner, cloudRegion, tenantId))
+        return this.getAaiResourcesClient().get(Tenant.class, AAIUriFactory.createResourceUri(
+                AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(cloudOwner, cloudRegion).tenant(tenantId)))
                 .orElseGet(() -> {
                     logger.debug("No Tenant found in A&AI TenantId: {}", tenantId);
                     return null;
@@ -148,9 +158,9 @@ public class AAIDataRetrieval {
     }
 
     public List<LInterface> getLinterfacesOfVnf(String vnfId) {
-        DSLStartNode startNode = new DSLStartNode(AAIObjectType.GENERIC_VNF, __.key("vnf-id", vnfId));
-        DSLQueryBuilder<Start, Node> builder = TraversalBuilder.fragment(startNode)
-                .to(__.node(AAIObjectType.VSERVER).to(__.node(AAIObjectType.L_INTERFACE).output()));
+        DSLStartNode startNode = new DSLStartNode(Types.GENERIC_VNF, __.key("vnf-id", vnfId));
+        DSLQueryBuilder<Start, Node> builder =
+                TraversalBuilder.fragment(startNode).to(__.node(Types.VSERVER).to(__.node(Types.L_INTERFACE).output()));
         List<LInterface> linterfaces =
                 getAAIDSLQueryClient().querySingleResource(new DSLQuery(builder.build()), LInterface.class);
         return linterfaces;
@@ -176,7 +186,8 @@ public class AAIDataRetrieval {
 
     public List<VfModule> getVfModulesOfVnf(String vnfId) {
         List<VfModule> vfModuleList = new ArrayList<VfModule>();
-        AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VF_MODULE, vnfId);
+        AAIPluralResourceUri uri =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId).vfModules());
         Optional<VfModules> vfModules = getAaiResourcesClient().get(VfModules.class, uri);
         if (!vfModules.isPresent() || vfModules.get().getVfModule().isEmpty()) {
             logger.debug("No VfModules attached to Vnf in AAI : {}", vnfId);
@@ -198,8 +209,8 @@ public class AAIDataRetrieval {
 
     public List<VolumeGroup> getVolumeGroupsOfVnf(String vnfId) {
         List<VolumeGroup> volumeGroupList = new ArrayList<VolumeGroup>();
-        AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
-                .relatedTo(AAIObjectPlurals.VOLUME_GROUP);
+        AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId))
+                .relatedTo(Types.VOLUME_GROUPS.getFragment());
         Optional<VolumeGroups> volumeGroups = getAaiResourcesClient().get(VolumeGroups.class, uri);
         if (!volumeGroups.isPresent() || volumeGroups.get().getVolumeGroup().isEmpty()) {
             logger.debug("No VolumeGroups attached to Vnf in AAI : {}", vnfId);
index 6e7947b..edf17f3 100644 (file)
@@ -29,9 +29,9 @@ import org.onap.aai.domain.yang.L3Network;
 import org.onap.aai.domain.yang.ServiceInstance;
 import org.onap.aai.domain.yang.VfModule;
 import org.onap.aai.domain.yang.VolumeGroup;
-import org.onap.aaiclient.client.aai.AAIObjectType;
 import org.onap.aaiclient.client.aai.entities.AAIResultWrapper;
 import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types;
 import org.onap.logging.ref.slf4j.ONAPLogConstants;
 import org.onap.so.apihandlerinfra.infra.rest.exception.AAIEntityNotFound;
 import org.onap.so.apihandlerinfra.infra.rest.exception.CloudConfigurationNotFoundException;
@@ -278,13 +278,13 @@ public class BpmnRequestBuilder {
         String cloudOwner = null;
         String lcpRegionId = null;
         if (relationshipsOpt.isPresent()) {
-            tenantId = relationshipsOpt.get().getRelatedUris(AAIObjectType.TENANT).stream().findFirst()
+            tenantId = relationshipsOpt.get().getRelatedUris(Types.TENANT).stream().findFirst()
                     .map(item -> item.getURIKeys().get(AAIFluentTypeBuilder.Types.TENANT.getUriParams().tenantId))
                     .orElse(null);
-            cloudOwner = relationshipsOpt.get().getRelatedUris(AAIObjectType.TENANT).stream().findFirst().map(
+            cloudOwner = relationshipsOpt.get().getRelatedUris(Types.TENANT).stream().findFirst().map(
                     item -> item.getURIKeys().get(AAIFluentTypeBuilder.Types.CLOUD_REGION.getUriParams().cloudOwner))
                     .orElse(null);
-            lcpRegionId = relationshipsOpt.get().getRelatedUris(AAIObjectType.TENANT).stream().findFirst().map(
+            lcpRegionId = relationshipsOpt.get().getRelatedUris(Types.TENANT).stream().findFirst().map(
                     item -> item.getURIKeys().get(AAIFluentTypeBuilder.Types.CLOUD_REGION.getUriParams().cloudRegionId))
                     .orElse(null);
         }
@@ -323,13 +323,13 @@ public class BpmnRequestBuilder {
         String cloudOwner = null;
         String lcpRegionId = null;
         if (relationshipsOpt.isPresent()) {
-            tenantId = relationshipsOpt.get().getRelatedUris(AAIObjectType.TENANT).stream().findFirst()
+            tenantId = relationshipsOpt.get().getRelatedUris(Types.TENANT).stream().findFirst()
                     .map(item -> item.getURIKeys().get(AAIFluentTypeBuilder.Types.TENANT.getUriParams().tenantId))
                     .orElse(null);
-            cloudOwner = relationshipsOpt.get().getRelatedUris(AAIObjectType.TENANT).stream().findFirst().map(
+            cloudOwner = relationshipsOpt.get().getRelatedUris(Types.TENANT).stream().findFirst().map(
                     item -> item.getURIKeys().get(AAIFluentTypeBuilder.Types.CLOUD_REGION.getUriParams().cloudOwner))
                     .orElse(null);
-            lcpRegionId = relationshipsOpt.get().getRelatedUris(AAIObjectType.TENANT).stream().findFirst().map(
+            lcpRegionId = relationshipsOpt.get().getRelatedUris(Types.TENANT).stream().findFirst().map(
                     item -> item.getURIKeys().get(AAIFluentTypeBuilder.Types.CLOUD_REGION.getUriParams().cloudRegionId))
                     .orElse(null);
         }
index 550db19..3640baa 100644 (file)
@@ -25,7 +25,8 @@ public class VolumeGroupDeleteValidator implements RequestValidator {
     @Override
     public Optional<String> validate(Map<String, String> instanceIdMap, ServiceInstancesRequest request,
             Map<String, String> queryParams, Actions action) {
-        if (aaiDataRetrieval.isVolumeGroupRelatedToVFModule(instanceIdMap.get("volumeGroupInstanceId"))) {
+        if (aaiDataRetrieval.isVolumeGroupRelatedToVFModule(request.getRequestDetails().getCloudConfiguration(),
+                instanceIdMap.get("volumeGroupInstanceId"))) {
             return Optional.of("Cannot delete volume group it is related to existing vf-modules");
         } else {
             return Optional.empty();
index 2e479e1..c66b053 100644 (file)
@@ -22,26 +22,26 @@ package org.onap.so.apihandlerinfra.onap3gppserviceinstancebeans;
 
 
 import java.util.List;
+import com.fasterxml.jackson.annotation.JsonProperty;
 
 /**
  * Model class for slice subnet capability query
  */
 public class QuerySubnetCapability {
 
-    private SubnetTypes subnetType;
+    @JsonProperty("subnetTypes")
+    private List<SubnetTypes> subnetTypes;
 
-    public SubnetTypes getSubnetType() {
-        return subnetType;
+    public List<SubnetTypes> getSubnetTypes() {
+        return subnetTypes;
     }
 
-    public void setSubnetType(SubnetTypes subnetType) {
-        this.subnetType = subnetType;
+    public void setSubnetTypes(List<SubnetTypes> subnetTypes) {
+        this.subnetTypes = subnetTypes;
     }
 
     @Override
     public String toString() {
-        return "QuerySubnetCapability [subnetType=" + subnetType + "]";
+        return "QuerySubnetCapability [subnetType=" + subnetTypes + "]";
     }
-
 }
-
index a28298f..33fe9d8 100644 (file)
@@ -27,13 +27,13 @@ import java.io.StringWriter;
 import java.util.Map;
 import javax.ws.rs.NotFoundException;
 import org.onap.aai.domain.yang.OperationalEnvironment;
-import org.onap.so.apihandlerinfra.tenantisolation.exceptions.AAIClientCallFailed;
-import org.onap.aaiclient.client.aai.AAIObjectType;
 import org.onap.aaiclient.client.aai.AAIResourcesClient;
 import org.onap.aaiclient.client.aai.entities.AAIResultWrapper;
 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.uri.Depth;
+import org.onap.so.apihandlerinfra.tenantisolation.exceptions.AAIClientCallFailed;
 import org.springframework.stereotype.Component;
 
 
@@ -50,7 +50,8 @@ public class AAIClientHelper {
      */
     public AAIResultWrapper getAaiOperationalEnvironment(String id) {
 
-        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.OPERATIONAL_ENVIRONMENT, id);
+        AAIResourceUri uri =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().operationalEnvironment(id));
         uri.depth(Depth.ZERO);
         AAIResourcesClient client = this.getClient();
         return client.get(uri, NotFoundException.class);
@@ -65,7 +66,8 @@ public class AAIClientHelper {
      */
     public void updateAaiOperationalEnvironment(String id, OperationalEnvironment aaiRequest) {
 
-        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.OPERATIONAL_ENVIRONMENT, id);
+        AAIResourceUri uri =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().operationalEnvironment(id));
         AAIResourcesClient client = this.getClient();
         client.update(uri, aaiRequest);
 
@@ -75,8 +77,8 @@ public class AAIClientHelper {
     public void updateAaiOperationalEnvironment(String operationalEnvironmentId, Map<String, String> payload)
             throws AAIClientCallFailed {
         try {
-            AAIResourceUri uri =
-                    AAIUriFactory.createResourceUri(AAIObjectType.OPERATIONAL_ENVIRONMENT, operationalEnvironmentId);
+            AAIResourceUri uri = AAIUriFactory.createResourceUri(
+                    AAIFluentTypeBuilder.cloudInfrastructure().operationalEnvironment(operationalEnvironmentId));
             AAIResourcesClient aaiClient = this.getClient();
             aaiClient.update(uri, payload);
         } catch (Exception ex) {
@@ -92,8 +94,8 @@ public class AAIClientHelper {
      */
     public void createOperationalEnvironment(OperationalEnvironment operationalEnvironment) {
 
-        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.OPERATIONAL_ENVIRONMENT,
-                operationalEnvironment.getOperationalEnvironmentId());
+        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+                .operationalEnvironment(operationalEnvironment.getOperationalEnvironmentId()));
         AAIResourcesClient client = this.getClient();
         client.create(uri, operationalEnvironment);
     }
@@ -107,10 +109,10 @@ public class AAIClientHelper {
      */
     public void createRelationship(String managingEcompOperationalEnvironmentId, String vnfOperationalEnvironmentId) {
 
-        AAIResourceUri ecompEnvUri = AAIUriFactory.createResourceUri(AAIObjectType.OPERATIONAL_ENVIRONMENT,
-                managingEcompOperationalEnvironmentId);
-        AAIResourceUri vnfEnvUri =
-                AAIUriFactory.createResourceUri(AAIObjectType.OPERATIONAL_ENVIRONMENT, vnfOperationalEnvironmentId);
+        AAIResourceUri ecompEnvUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+                .operationalEnvironment(managingEcompOperationalEnvironmentId));
+        AAIResourceUri vnfEnvUri = AAIUriFactory.createResourceUri(
+                AAIFluentTypeBuilder.cloudInfrastructure().operationalEnvironment(vnfOperationalEnvironmentId));
         AAIResourcesClient client = this.getClient();
         client.connect(vnfEnvUri, ecompEnvUri);
 
index d4c66f6..42d5af7 100644 (file)
@@ -26,11 +26,11 @@ import javax.ws.rs.core.Response;
 import org.apache.http.HttpStatus;
 import org.json.JSONObject;
 import org.onap.aai.domain.yang.OperationalEnvironment;
-import org.onap.aaiclient.client.aai.AAIObjectType;
 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.generated.fluentbuilders.AAIFluentTypeBuilder;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types;
 import org.onap.logging.filter.base.ErrorCode;
 import org.onap.so.apihandler.common.ErrorNumbers;
 import org.onap.so.apihandlerinfra.exceptions.ApiException;
@@ -94,8 +94,7 @@ public class ActivateVnfOperationalEnvironment {
         Optional<Relationships> optRelationships = wrapper.getRelationships();
         if (optRelationships.isPresent()) {
             Relationships relationships = optRelationships.get();
-            List<AAIResourceUri> operationalEnvironments =
-                    relationships.getRelatedAAIUris(AAIObjectType.OPERATIONAL_ENVIRONMENT);
+            List<AAIResourceUri> operationalEnvironments = relationships.getRelatedUris(Types.OPERATIONAL_ENVIRONMENT);
             if (!operationalEnvironments.isEmpty()) {
                 ecompOperationalEnvironmentId = operationalEnvironments.get(0).getURIKeys().get(
                         AAIFluentTypeBuilder.Types.OPERATIONAL_ENVIRONMENT.getUriParams().operationalEnvironmentId);
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/resources/subnetCapability.json b/mso-api-handlers/mso-api-handler-infra/src/main/resources/subnetCapability.json
new file mode 100644 (file)
index 0000000..0d5acef
--- /dev/null
@@ -0,0 +1,25 @@
+{
+  "AN": {
+    "latency": "5",
+    "maxNumberofUEs": "100",
+    "maxThroughput": "150",
+    "terminalDensity": "50"
+  },
+  "CN": {
+    "latency": "10",
+    "maxThroughput": "50",
+    "maxNumberofConns": "100"
+  },
+  "TN_FH": {
+    "latency": "10",
+    "maxThroughput": "100"
+  },
+  "TN_MH": {
+    "latency": "5",
+    "maxThroughput": "50"
+  },
+  "TN_BH": {
+    "latency": "10",
+    "maxThroughput": "100"
+  }
+}
index 503af1b..c3c92be 100644 (file)
@@ -49,6 +49,9 @@ import org.springframework.http.ResponseEntity;
 import org.springframework.web.util.UriComponentsBuilder;
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.databind.ObjectMapper;
+import org.onap.so.apihandlerinfra.exceptions.ApiException;
+import org.onap.so.apihandlerinfra.onap3gppserviceinstancebeans.QuerySubnetCapability;
+import org.springframework.beans.factory.annotation.Autowired;
 
 public class Onap3gppServiceInstancesTest extends BaseTest {
 
@@ -56,6 +59,9 @@ public class Onap3gppServiceInstancesTest extends BaseTest {
 
     private final ObjectMapper mapper = new ObjectMapper();
 
+    @Autowired
+    private Onap3gppServiceInstances objUnderTest;
+
     @Before
     public void init() throws JsonProcessingException {
 
@@ -176,6 +182,17 @@ public class Onap3gppServiceInstancesTest extends BaseTest {
         assertEquals(expectedResponse, actualResponse);
     }
 
+    @Test
+    public void getSliceSubnetCapabilitiesTest() throws IOException, ApiException {
+        String request = "{\"subnetTypes\":[\"AN\"]}";
+        QuerySubnetCapability subnetCapabilityRequest = mapper.readValue(request, QuerySubnetCapability.class);
+        String expectedResponse =
+                "{\"AN\":{\"latency\":\"5\",\"maxNumberofUEs\":\"100\",\"maxThroughput\":\"150\",\"terminalDensity\":\"50\"}}";
+        Response response = objUnderTest.getSliceSubnetCapabilities(subnetCapabilityRequest, "v1");
+        String actualResponse = (String) response.getEntity();
+        assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
+        assertEquals(expectedResponse, actualResponse);
+    }
 }
 
 
index 7f9ff98..2ba646f 100644 (file)
@@ -39,6 +39,7 @@ import java.net.MalformedURLException;
 import java.net.URL;
 import java.nio.file.Files;
 import java.nio.file.Paths;
+import java.util.HashMap;
 import java.util.List;
 import javax.ws.rs.core.MediaType;
 import org.apache.http.HttpStatus;
@@ -338,4 +339,34 @@ public class RequestHandlerUtilsTest extends BaseTest {
         assertEquals(expectedBasicAuth, basicAuth);
     }
 
+    @Test
+    public void getServiceInstanceIdForValidationErrorTest() {
+        ServiceInstancesRequest sir = new ServiceInstancesRequest();
+        String requestScope = "vnf";
+        HashMap<String, String> instanceIdMap = new HashMap<String, String>();
+        instanceIdMap.put("serviceInstanceId", "testServiceInstanceId");
+        String serviceInstanceId =
+                requestHandlerUtils.getServiceInstanceIdForValidationError(sir, instanceIdMap, requestScope).get();
+        assertEquals("testServiceInstanceId", serviceInstanceId);
+    }
+
+    @Test
+    public void getServiceInstanceIdForValidationErrorInstanceGroupTest() throws Exception {
+        ServiceInstancesRequest sir =
+                mapper.readValue(inputStream("/CreateInstanceGroup.json"), ServiceInstancesRequest.class);
+        String requestScope = "instanceGroup";
+        String serviceInstanceId =
+                requestHandlerUtils.getServiceInstanceIdForValidationError(sir, null, requestScope).get();
+        assertEquals("ddcbbf3d-f2c1-4ca0-8852-76a807285efc", serviceInstanceId);
+    }
+
+    @Test
+    public void getServiceInstanceIdForInstanceGroupTest() throws Exception {
+        ServiceInstancesRequest sir =
+                mapper.readValue(inputStream("/CreateInstanceGroup.json"), ServiceInstancesRequest.class);
+        String requestScope = "instanceGroup";
+        String serviceInstanceId = requestHandlerUtils.getServiceInstanceIdForInstanceGroup(requestScope, sir).get();
+        assertEquals("ddcbbf3d-f2c1-4ca0-8852-76a807285efc", serviceInstanceId);
+    }
+
 }
index 9d5d805..61ac542 100644 (file)
@@ -24,22 +24,20 @@ import static org.junit.Assert.assertEquals;
 import static org.mockito.Mockito.doReturn;
 import java.util.List;
 import java.util.Optional;
-import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.InjectMocks;
 import org.mockito.Mock;
 import org.mockito.junit.MockitoJUnitRunner;
-import org.onap.aai.domain.yang.GenericVnf;
 import org.onap.aai.domain.yang.VfModule;
 import org.onap.aai.domain.yang.VfModules;
 import org.onap.aai.domain.yang.VolumeGroup;
 import org.onap.aai.domain.yang.VolumeGroups;
-import org.onap.aaiclient.client.aai.AAIObjectPlurals;
-import org.onap.aaiclient.client.aai.AAIObjectType;
 import org.onap.aaiclient.client.aai.AAIResourcesClient;
 import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
 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;
 
 @RunWith(MockitoJUnitRunner.class)
 public class AAIDataRetrievalTest {
@@ -52,7 +50,8 @@ public class AAIDataRetrievalTest {
     @Test
     public void getVfModulesOfVnfTest() {
         VfModules vfModules = getVfModules();
-        AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VF_MODULE, "vnfId");
+        AAIPluralResourceUri uri =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("vnfId").vfModules());
         doReturn(Optional.of(vfModules)).when(aaiResourcesClient).get(VfModules.class, uri);
         List<VfModule> vfModulesList = aaiDataRetrieval.getVfModulesOfVnf("vnfId");
         assertEquals("vfm1", vfModulesList.get(0).getVfModuleId());
@@ -64,7 +63,8 @@ public class AAIDataRetrievalTest {
     @Test
     public void getVfModulesOfVnfWhenNoneTest() {
         VfModules vfModules = new VfModules();
-        AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VF_MODULE, "vnfId");
+        AAIPluralResourceUri uri =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("vnfId").vfModules());
         doReturn(Optional.of(vfModules)).when(aaiResourcesClient).get(VfModules.class, uri);
         List<VfModule> vfModulesList = aaiDataRetrieval.getVfModulesOfVnf("vnfId");
         assertEquals(true, vfModulesList.isEmpty());
@@ -76,8 +76,8 @@ public class AAIDataRetrievalTest {
     @Test
     public void getVolumeGroupsOfVnfTest() throws Exception {
         VolumeGroups volumeGroups = getVolumeGroups();
-        AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "vnfId")
-                .relatedTo(AAIObjectPlurals.VOLUME_GROUP);
+        AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("vnfId"))
+                .relatedTo(Types.VOLUME_GROUPS.getFragment());
         doReturn(Optional.of(volumeGroups)).when(aaiResourcesClient).get(VolumeGroups.class, uri);
         List<VolumeGroup> volumeGroupList = aaiDataRetrieval.getVolumeGroupsOfVnf("vnfId");
         assertEquals("vg1", volumeGroupList.get(0).getVolumeGroupId());
@@ -88,8 +88,8 @@ public class AAIDataRetrievalTest {
     @Test
     public void getVolumeGroupsOfVnfWhenNoneTest() throws Exception {
         VolumeGroups volumeGroups = new VolumeGroups();
-        AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "vnfId")
-                .relatedTo(AAIObjectPlurals.VOLUME_GROUP);
+        AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("vnfId"))
+                .relatedTo(Types.VOLUME_GROUPS.getFragment());
         doReturn(Optional.of(volumeGroups)).when(aaiResourcesClient).get(VolumeGroups.class, uri);
         List<VolumeGroup> volumeGroupList = aaiDataRetrieval.getVolumeGroupsOfVnf("vnfId");
         assertEquals(true, volumeGroupList.isEmpty());
index 389ff28..912c026 100644 (file)
@@ -41,10 +41,11 @@ import org.onap.aai.domain.yang.GenericVnf;
 import org.onap.aai.domain.yang.ServiceInstance;
 import org.onap.aai.domain.yang.VfModule;
 import org.onap.aai.domain.yang.VolumeGroup;
-import org.onap.aaiclient.client.aai.AAIObjectType;
 import org.onap.aaiclient.client.aai.AAIResourcesClient;
 import org.onap.aaiclient.client.aai.entities.AAIResultWrapper;
 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.aaiclient.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
 import org.onap.so.constants.Status;
 import org.onap.so.db.request.client.RequestsDbClient;
@@ -104,7 +105,7 @@ public class BpmnRequestBuilderTest {
         GenericVnf vnf = provider.getMapper().readValue(new File(RESOURCE_PATH + "Vnf.json"), GenericVnf.class);
 
         doReturn(Optional.of(vnf)).when(aaiResourcesClient).get(GenericVnf.class,
-                AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "vnfId"));
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("vnfId")));
 
         ServiceInstancesRequest expectedRequest =
                 mapper.readValue(new File(RESOURCE_PATH + "ExpectedVnfRequest.json"), ServiceInstancesRequest.class);
@@ -117,11 +118,11 @@ public class BpmnRequestBuilderTest {
         GenericVnf vnf = provider.getMapper().readValue(new File(RESOURCE_PATH + "Vnf.json"), GenericVnf.class);
 
         doReturn(Optional.of(vnf)).when(aaiResourcesClient).get(GenericVnf.class,
-                AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "vnfId"));
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("vnfId")));
         VfModule vfModule = provider.getMapper().readValue(new File(RESOURCE_PATH + "VfModule.json"), VfModule.class);
 
-        doReturn(Optional.of(vfModule)).when(aaiResourcesClient).get(VfModule.class,
-                AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, "vnfId", "vfModuleId"));
+        doReturn(Optional.of(vfModule)).when(aaiResourcesClient).get(VfModule.class, AAIUriFactory
+                .createResourceUri(AAIFluentTypeBuilder.network().genericVnf("vnfId").vfModule("vfModuleId")));
 
         ServiceInstancesRequest expectedRequest = mapper
                 .readValue(new File(RESOURCE_PATH + "ExpectedVfModuleRequest.json"), ServiceInstancesRequest.class);
@@ -135,13 +136,13 @@ public class BpmnRequestBuilderTest {
         GenericVnf vnf = provider.getMapper().readValue(new File(RESOURCE_PATH + "Vnf.json"), GenericVnf.class);
 
         doReturn(Optional.of(vnf)).when(aaiResourcesClient).get(GenericVnf.class,
-                AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "vnfId"));
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("vnfId")));
         VolumeGroup volumeGroup =
                 provider.getMapper().readValue(new File(RESOURCE_PATH + "VolumeGroup.json"), VolumeGroup.class);
         AAIResultWrapper wrapper = new AAIResultWrapper(volumeGroup);
         doReturn(wrapper).when(aaiResourcesClient)
-                .get(AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "vnfId")
-                        .relatedTo(AAIObjectType.VOLUME_GROUP, "volumeGroupId"));
+                .get(AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("vnfId"))
+                        .relatedTo(Types.VOLUME_GROUP.getFragment("volumeGroupId")));
 
         ServiceInstancesRequest expectedRequest = mapper
                 .readValue(new File(RESOURCE_PATH + "ExpectedVolumeGroupRequest.json"), ServiceInstancesRequest.class);
@@ -157,7 +158,7 @@ public class BpmnRequestBuilderTest {
         GenericVnf vnf = provider.getMapper().readValue(new File(RESOURCE_PATH + "Vnf.json"), GenericVnf.class);
 
         doReturn(Optional.of(vnf)).when(aaiResourcesClient).get(GenericVnf.class,
-                AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId));
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)));
 
         CloudConfiguration result = reqBuilder.getCloudConfigurationVfModuleReplace(vnfId, vfModuleId);
         assertEquals("0422ffb57ba042c0800a29dc85ca70f8", result.getTenantId());
index 7aa12a6..1023408 100644 (file)
@@ -1,6 +1,8 @@
 package org.onap.so.apihandlerinfra.infra.rest.validator;
 
 import static org.junit.Assert.assertEquals;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.eq;
 import static org.mockito.Mockito.when;
 import java.util.HashMap;
 import java.util.Map;
@@ -14,6 +16,8 @@ import org.mockito.junit.MockitoJUnitRunner;
 import org.onap.so.apihandlerinfra.Action;
 import org.onap.so.apihandlerinfra.infra.rest.AAIDataRetrieval;
 import org.onap.so.apihandlerinfra.infra.rest.validators.VolumeGroupDeleteValidator;
+import org.onap.so.serviceinstancebeans.CloudConfiguration;
+import org.onap.so.serviceinstancebeans.RequestDetails;
 import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
 
 
@@ -53,16 +57,24 @@ public class VolumeGroupDeleteValidatorTest {
     @Test
     public void validateSuccessTest() {
         instanceIdMap.put("volumeGroupInstanceId", "1");
-        when(aaiDataRetrieval.isVolumeGroupRelatedToVFModule("1")).thenReturn(false);
-        Optional<String> result = volumeGroupDeleteValidator.validate(instanceIdMap, null, null, null);
+        ServiceInstancesRequest request = new ServiceInstancesRequest();
+        RequestDetails details = new RequestDetails();
+        details.setCloudConfiguration(new CloudConfiguration());
+        request.setRequestDetails(details);
+        when(aaiDataRetrieval.isVolumeGroupRelatedToVFModule(any(CloudConfiguration.class), eq("1"))).thenReturn(false);
+        Optional<String> result = volumeGroupDeleteValidator.validate(instanceIdMap, request, null, null);
         assertEquals(false, result.isPresent());
     }
 
     @Test
     public void validateFailureVnfTest() {
         instanceIdMap.put("volumeGroupInstanceId", "1");
-        when(aaiDataRetrieval.isVolumeGroupRelatedToVFModule("1")).thenReturn(true);
-        Optional<String> result = volumeGroupDeleteValidator.validate(instanceIdMap, null, null, null);
+        ServiceInstancesRequest request = new ServiceInstancesRequest();
+        RequestDetails details = new RequestDetails();
+        details.setCloudConfiguration(new CloudConfiguration());
+        request.setRequestDetails(details);
+        when(aaiDataRetrieval.isVolumeGroupRelatedToVFModule(any(CloudConfiguration.class), eq("1"))).thenReturn(true);
+        Optional<String> result = volumeGroupDeleteValidator.validate(instanceIdMap, request, null, null);
         assertEquals(true, result.isPresent());
     }
 
index 19e875f..3827c0e 100644 (file)
@@ -38,6 +38,8 @@ import org.apache.commons.lang3.builder.EqualsBuilder;
 import org.apache.commons.lang3.builder.HashCodeBuilder;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import com.openpojo.business.annotation.BusinessKey;
+import org.hibernate.annotations.NotFound;
+import org.hibernate.annotations.NotFoundAction;
 import uk.co.blackpepper.bowman.annotation.LinkedResource;
 import uk.co.blackpepper.bowman.annotation.RemoteResource;
 
@@ -76,6 +78,7 @@ public class AllottedResource implements Serializable {
     private Date created;
 
     @OneToMany(cascade = CascadeType.ALL, mappedBy = "allottedResource")
+    @NotFound(action = NotFoundAction.IGNORE)
     private Set<AllottedResourceCustomization> allotedResourceCustomization;
 
     @Override
index dd14091..e4be709 100644 (file)
                 \t%thread
                 \t%n" />
 
+    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+        <encoder>
+            <pattern>${errorPattern}</pattern>
+        </encoder>
+    </appender>
+
     <appender name="Audit" class="ch.qos.logback.core.rolling.RollingFileAppender">
         <filter class="ch.qos.logback.core.filter.EvaluatorFilter">
             <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator">
         <appender-ref ref="asyncMetric" />
     </logger>
 
-    <root level="WARN">
+    <root level="INFO">
         <appender-ref ref="asyncDebug" />
         <appender-ref ref="asyncError" />
         <appender-ref ref="asyncAudit" />
         <appender-ref ref="asyncMetric" />
+        <appender-ref ref="STDOUT" />
     </root>
 
 </configuration>
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index e8abf26..7151bb7 100644 (file)
--- a/pom.xml
+++ b/pom.xml
       <dependency>
         <groupId>org.onap.aai.schema-service</groupId>
         <artifactId>aai-schema</artifactId>
-        <version>1.7.2</version>
+        <version>1.7.10-SNAPSHOT</version>
       </dependency>
     </dependencies>
   </dependencyManagement>
index 0b87b25..fa85460 100644 (file)
@@ -27,6 +27,7 @@
     <okio-version>1.13.0</okio-version>
     <jaxb-api>2.3.0</jaxb-api>
     <snakeyaml-version>0.11</snakeyaml-version>
+    <hamcrest-version>2.2</hamcrest-version>
   </properties>
 
   <build>
index 6dfe635..7f0fd93 100644 (file)
@@ -65,5 +65,5 @@ so:
 etsi-catalog-manager:
    base:
       endpoint: http://modeling-etsicatalog.onap:8806/api
-etsi-so-ns-lcm-manager:
-   endpoint: http://so-etsi-nfvo-ns-lcm:9095
\ No newline at end of file
+so-etsi-nfvo-ns-lcm:
+   endpoint: http://so-etsi-nfvo-ns-lcm.onap:9095
\ No newline at end of file
index 39acdd8..1c13eca 100644 (file)
       <artifactId>h2</artifactId>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.hamcrest</groupId>
+      <artifactId>hamcrest</artifactId>
+      <version>${hamcrest-version}</version>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
 </project>
\ No newline at end of file
index 946bd38..c803808 100644 (file)
@@ -27,8 +27,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.context.properties.ConfigurationProperties;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Primary;
-import org.springframework.context.annotation.Profile;
+import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
 import org.springframework.jmx.export.MBeanExporter;
 import org.springframework.transaction.annotation.EnableTransactionManagement;
 import com.zaxxer.hikari.HikariConfig;
@@ -40,9 +39,11 @@ import com.zaxxer.hikari.HikariDataSource;
  */
 @Configuration
 @EnableTransactionManagement
-@Profile({"!test"})
+@EnableJpaRepositories(entityManagerFactoryRef = "entityManagerFactory", transactionManagerRef = "transactionManager")
 public class CamundaDatabaseConfiguration {
 
+    private static final String CAMUNDA_DATA_SOURCE_BEAN_NAME = "camundaBpmDataSource";
+
     private static final Logger logger = getLogger(CamundaDatabaseConfiguration.class);
 
     @Autowired(required = false)
@@ -51,17 +52,16 @@ public class CamundaDatabaseConfiguration {
     @Bean
     @ConfigurationProperties(prefix = "spring.datasource.hikari.camunda")
     public HikariConfig camundaDbConfig() {
-        logger.debug("Creating HikariConfig bean ... ");
+        logger.debug("Creating Camunda HikariConfig bean ... ");
         return new HikariConfig();
     }
 
-    @Primary
-    @Bean(name = "dataSource")
-    public DataSource dataSource() {
+    @Bean(name = CAMUNDA_DATA_SOURCE_BEAN_NAME)
+    public DataSource camundaDataSource() {
         if (mBeanExporter != null) {
-            mBeanExporter.addExcludedBean("dataSource");
+            mBeanExporter.addExcludedBean(CAMUNDA_DATA_SOURCE_BEAN_NAME);
         }
-        logger.debug("Creating HikariDataSource bean ... ");
+        logger.debug("Creating Camunda HikariDataSource bean ... ");
         final HikariConfig hikariConfig = this.camundaDbConfig();
         return new HikariDataSource(hikariConfig);
     }
index 049746c..c48d10b 100644 (file)
@@ -22,9 +22,10 @@ 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;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -47,8 +48,9 @@ public class AaiServiceProviderImpl implements AaiServiceProvider {
     public void createServiceInstance(final String globalCustomerId, final String serviceType,
             final ServiceInstance aaiServiceInstance) {
         logger.info("Creating service instance in AAI: {}", aaiServiceInstance);
-        final AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
-                globalCustomerId, serviceType, aaiServiceInstance.getServiceInstanceId());
+        final AAIResourceUri serviceInstanceURI =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalCustomerId)
+                        .serviceSubscription(serviceType).serviceInstance(aaiServiceInstance.getServiceInstanceId()));
         aaiClientProvider.getAaiClient().createIfNotExists(serviceInstanceURI, Optional.of(aaiServiceInstance));
 
     }
@@ -57,9 +59,10 @@ public class AaiServiceProviderImpl implements AaiServiceProvider {
     public void createGenericVnfAndConnectServiceInstance(final String serviceInstanceId, final String vnfId,
             final GenericVnf genericVnf) {
         logger.info("Creating GenericVnf in AAI: {}", genericVnf);
-        final AAIResourceUri genericVnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId);
+        final AAIResourceUri genericVnfURI =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId));
         final AAIResourceUri serviceInstanceURI =
-                AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId);
+                AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId));
         aaiClientProvider.getAaiClient().createIfNotExists(genericVnfURI, Optional.of(genericVnf))
                 .connect(genericVnfURI, serviceInstanceURI);
 
@@ -69,15 +72,16 @@ public class AaiServiceProviderImpl implements AaiServiceProvider {
     public void connectGenericVnfToTenant(final String vnfId, final String cloudOwner, final String cloudRegion,
             final String tenantId) {
         logger.info("Connecting GenericVnf {} to {}/{}/{} in AAI", vnfId, cloudOwner, cloudRegion, tenantId);
-        final AAIResourceUri tenantURI =
-                AAIUriFactory.createResourceUri(AAIObjectType.TENANT, cloudOwner, cloudRegion, tenantId);
-        final AAIResourceUri genericVnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId);
+        final AAIResourceUri tenantURI = AAIUriFactory.createResourceUri(
+                AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(cloudOwner, cloudRegion).tenant(tenantId));
+        final AAIResourceUri genericVnfURI =
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId));
         aaiClientProvider.getAaiClient().connect(tenantURI, genericVnfURI);
     }
 
     @Override
     public Optional<GenericVnf> getGenericVnf(final String vnfId) {
         return aaiClientProvider.getAaiClient().get(GenericVnf.class,
-                AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId));
+                AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId)));
     }
 }
index a373df4..65d982c 100644 (file)
@@ -22,6 +22,7 @@ package org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.extclients.etsicatalog;
 import java.util.Optional;
 import org.onap.so.adapters.etsisol003adapter.pkgm.extclients.etsicatalog.model.NsdInfo;
 import org.onap.so.adapters.etsisol003adapter.pkgm.extclients.etsicatalog.model.VnfPkgInfo;
+import org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.nsd.NetworkServiceDescriptor;
 
 /**
  * @author Waqas Ikram (waqas.ikram@est.tech)
@@ -33,4 +34,6 @@ public interface EtsiCatalogPackageManagementServiceProvider {
 
     Optional<VnfPkgInfo> getVnfPkgInfo(final String vnfPkgId);
 
+    Optional<NetworkServiceDescriptor> getNetworkServiceDescriptor(final String nsdId);
+
 }
index 32f7cc1..75dd710 100644 (file)
@@ -24,6 +24,8 @@ import java.util.Optional;
 import org.onap.so.adapters.etsisol003adapter.pkgm.extclients.etsicatalog.model.NsdInfo;
 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.rest.service.HttpRestServiceProvider;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -43,12 +45,15 @@ public class EtsiCatalogPackageManagementServiceProviderImpl implements EtsiCata
 
     private final HttpRestServiceProvider httpServiceProvider;
     private final EtsiCatalogUrlProvider etsiCatalogUrlProvider;
+    private final NetworkServiceDescriptorParser networkServiceDescriptorParser;
 
     @Autowired
     public EtsiCatalogPackageManagementServiceProviderImpl(final EtsiCatalogUrlProvider etsiCatalogUrlProvider,
-            @Qualifier(ETSI_CATALOG_SERVICE_PROVIDER_BEAN) final HttpRestServiceProvider httpServiceProvider) {
+            @Qualifier(ETSI_CATALOG_SERVICE_PROVIDER_BEAN) final HttpRestServiceProvider httpServiceProvider,
+            final NetworkServiceDescriptorParser networkServiceDescriptorParser) {
         this.etsiCatalogUrlProvider = etsiCatalogUrlProvider;
         this.httpServiceProvider = httpServiceProvider;
+        this.networkServiceDescriptorParser = networkServiceDescriptorParser;
     }
 
     @Override
@@ -83,4 +88,23 @@ public class EtsiCatalogPackageManagementServiceProviderImpl implements EtsiCata
         }
     }
 
+    @Override
+    public Optional<NetworkServiceDescriptor> getNetworkServiceDescriptor(final String nsdId) {
+        try {
+            final ResponseEntity<byte[]> response = httpServiceProvider
+                    .getHttpResponse(etsiCatalogUrlProvider.getNsPackageContentUrl(nsdId), byte[].class);
+            if (response.getStatusCode().is2xxSuccessful()) {
+                if (response.hasBody()) {
+                    return networkServiceDescriptorParser.parse(response.getBody());
+                }
+                logger.error("Received response without body ...");
+            }
+            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);
+        }
+    }
+
 }
index 692aff6..13cdc60 100644 (file)
@@ -21,12 +21,19 @@ 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_REQUEST_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.INSTANTIATE_NS_REQUEST_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;
 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.Constants.CREATE_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.database.beans.JobAction.INSTANTIATE;
 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.FINISHED_WITH_ERROR;
+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.STARTING;
 import static org.slf4j.LoggerFactory.getLogger;
 import java.time.Instant;
 import java.time.LocalDateTime;
@@ -35,19 +42,25 @@ import java.util.Map;
 import java.util.Optional;
 import java.util.concurrent.TimeUnit;
 import org.apache.commons.lang3.tuple.ImmutablePair;
+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.database.beans.JobAction;
 import org.onap.so.etsi.nfvo.ns.lcm.database.beans.JobStatusEnum;
 import org.onap.so.etsi.nfvo.ns.lcm.database.beans.NfvoJob;
+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.service.DatabaseServiceProvider;
 import org.onap.so.etsi.nfvo.ns.lcm.model.CreateNsRequest;
 import org.onap.so.etsi.nfvo.ns.lcm.model.InlineResponse400;
+import org.onap.so.etsi.nfvo.ns.lcm.model.InstantiateNsRequest;
 import org.onap.so.etsi.nfvo.ns.lcm.model.NsInstancesNsInstance;
 import org.slf4j.Logger;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import com.google.common.collect.ImmutableSet;
+import com.google.gson.Gson;
 
 /**
  * @author Waqas Ikram (waqas.ikram@est.tech)
@@ -69,13 +82,16 @@ public class JobExecutorService {
     private final DatabaseServiceProvider databaseServiceProvider;
     private final WorkflowExecutorService workflowExecutorService;
     private final WorkflowQueryService workflowQueryService;
+    private Gson gson;
 
     @Autowired
     public JobExecutorService(final DatabaseServiceProvider databaseServiceProvider,
-            final WorkflowExecutorService workflowExecutorService, final WorkflowQueryService workflowQueryService) {
+            final WorkflowExecutorService workflowExecutorService, final WorkflowQueryService workflowQueryService,
+            final GsonProvider gsonProvider) {
         this.databaseServiceProvider = databaseServiceProvider;
         this.workflowExecutorService = workflowExecutorService;
         this.workflowQueryService = workflowQueryService;
+        gson = gsonProvider.getGson();
     }
 
     public NsInstancesNsInstance runCreateNsJob(final CreateNsRequest createNsRequest, final String globalCustomerId,
@@ -130,6 +146,50 @@ public class JobExecutorService {
         return optional.get();
     }
 
+    public String runInstantiateNsJob(final String nsInstanceId, final InstantiateNsRequest instantiateNsRequest) {
+
+        final NfvoJob newJob = new NfvoJob().startTime(LocalDateTime.now()).jobType("NS").jobAction(INSTANTIATE)
+                .resourceId(nsInstanceId).status(STARTING).progress(0);
+        databaseServiceProvider.addJob(newJob);
+        logger.info("New job created in database :\n{}", newJob);
+
+        final LocalDateTime currentDateTime = LocalDateTime.now();
+        final NsLcmOpOcc newNsLcmOpOcc = new NsLcmOpOcc().id(nsInstanceId).operation(NsLcmOpType.INSTANTIATE)
+                .operationState(OperationStateEnum.PROCESSING).stateEnteredTime(currentDateTime)
+                .startTime(currentDateTime).isAutoInnovation(false).isCancelPending(false)
+                .operationParams(gson.toJson(instantiateNsRequest));
+        databaseServiceProvider.addNSLcmOpOcc(newNsLcmOpOcc);
+        logger.info("New NSLcmOpOcc created in database :\n{}", newNsLcmOpOcc);
+
+        workflowExecutorService.executeWorkflow(newJob.getJobId(), INSTANTIATE_NS_WORKFLOW_NAME,
+                getVariables(nsInstanceId, newJob.getJobId(), newNsLcmOpOcc.getId(), instantiateNsRequest));
+
+        final ImmutableSet<JobStatusEnum> jobFinishedStates =
+                ImmutableSet.of(FINISHED, ERROR, FINISHED_WITH_ERROR, IN_PROGRESS);
+        final ImmutablePair<String, JobStatusEnum> immutablePair =
+                waitForJobToFinish(newJob.getJobId(), jobFinishedStates);
+
+        if (immutablePair.getRight() == null) {
+            final String message = "Failed to Instantiate NS for request: \n" + instantiateNsRequest;
+            logger.error(message);
+            throw new NsRequestProcessingException(message);
+        }
+
+        final JobStatusEnum finalJobStatus = immutablePair.getRight();
+
+        if (IN_PROGRESS.equals(finalJobStatus) || FINISHED.equals(finalJobStatus)) {
+            logger.info("Instantiation Job status: {}", finalJobStatus);
+
+
+            return newNsLcmOpOcc.getId();
+        }
+
+        final String message = "Received unexpected Job Status: " + finalJobStatus
+                + " Failed to instantiate NS for request: \n" + instantiateNsRequest;
+        logger.error(message);
+        throw new NsRequestProcessingException(message);
+    }
+
     private ImmutablePair<String, JobStatusEnum> waitForJobToFinish(final String jobId,
             final ImmutableSet<JobStatusEnum> jobFinishedStates) {
         try {
@@ -149,13 +209,13 @@ public class JobExecutorService {
 
                 final NfvoJob nfvoJob = optional.get();
                 currentJobStatus = nfvoJob.getStatus();
-                logger.debug("Received job status response: \n ", nfvoJob);
+                logger.info("Received job status response: \n ", nfvoJob);
                 if (jobFinishedStates.contains(nfvoJob.getStatus())) {
                     logger.info("Job finished \n {}", currentJobStatus);
                     return ImmutablePair.of(nfvoJob.getProcessInstanceId(), currentJobStatus);
                 }
 
-                logger.debug("Haven't received one of finish state {} yet, will try again in {} seconds",
+                logger.info("Haven't received one of finish state {} yet, will try again in {} seconds",
                         jobFinishedStates, SLEEP_TIME_IN_SECONDS);
                 TimeUnit.SECONDS.sleep(SLEEP_TIME_IN_SECONDS);
 
@@ -179,4 +239,14 @@ public class JobExecutorService {
         return variables;
     }
 
+    private Map<String, Object> getVariables(final String nsInstanceId, final String jobId, final String occId,
+            final InstantiateNsRequest instantiateNsRequest) {
+        final Map<String, Object> variables = new HashMap<>();
+        variables.put(NS_INSTANCE_ID_PARAM_NAME, nsInstanceId);
+        variables.put(JOB_ID_PARAM_NAME, jobId);
+        variables.put(OCC_ID_PARAM_NAME, occId);
+        variables.put(INSTANTIATE_NS_REQUEST_PARAM_NAME, instantiateNsRequest);
+        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/tasks/CreateInstantiateRequest.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/CreateInstantiateRequest.java
new file mode 100644 (file)
index 0000000..569d9b3
--- /dev/null
@@ -0,0 +1,167 @@
+/*-
+ * ============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 static org.onap.so.etsi.nfvo.ns.lcm.database.beans.utils.Utils.toIndentedString;
+import java.io.Serializable;
+import java.util.Map;
+import java.util.Objects;
+import org.onap.so.adapters.etsisol003adapter.lcm.v1.model.Tenant;
+
+/**
+ * @author Waqas Ikram (waqas.ikram@est.tech)
+ *
+ */
+public class CreateInstantiateRequest implements Serializable {
+    private static final long serialVersionUID = -4371264952509580468L;
+    private String nsInstId;
+    private String vnfdId;
+    private String vnfName;
+    private String vnfPkgId;
+    private String nfType;
+    private Tenant tenant;
+    private Map<String, String> additionalParams;
+
+    public String getNsInstId() {
+        return nsInstId;
+    }
+
+    public void setNsInstId(final String nsInstId) {
+        this.nsInstId = nsInstId;
+    }
+
+    public CreateInstantiateRequest nsInstId(final String nsInstId) {
+        this.nsInstId = nsInstId;
+        return this;
+    }
+
+    public final String getVnfdId() {
+        return vnfdId;
+    }
+
+    public final void setVnfdId(final String vnfdId) {
+        this.vnfdId = vnfdId;
+    }
+
+    public CreateInstantiateRequest vnfdId(final String vnfdId) {
+        this.vnfdId = vnfdId;
+        return this;
+    }
+
+    public final String getVnfName() {
+        return vnfName;
+    }
+
+    public final void setVnfName(final String vnfName) {
+        this.vnfName = vnfName;
+    }
+
+    public CreateInstantiateRequest vnfName(final String vnfName) {
+        this.vnfName = vnfName;
+        return this;
+    }
+
+    public final String getVnfPkgId() {
+        return vnfPkgId;
+    }
+
+    public final void setVnfPkgId(final String vnfPkgId) {
+        this.vnfPkgId = vnfPkgId;
+    }
+
+    public CreateInstantiateRequest vnfPkgId(final String vnfPkgId) {
+        this.vnfPkgId = vnfPkgId;
+        return this;
+    }
+
+    public final String getNfType() {
+        return nfType;
+    }
+
+    public final void setNfType(final String nfType) {
+        this.nfType = nfType;
+    }
+
+    public CreateInstantiateRequest nfType(final String nfType) {
+        this.nfType = nfType;
+        return this;
+    }
+
+    public final Tenant getTenant() {
+        return tenant;
+    }
+
+    public final void setTenant(final Tenant tenant) {
+        this.tenant = tenant;
+    }
+
+    public CreateInstantiateRequest tenant(final Tenant tenant) {
+        this.tenant = tenant;
+        return this;
+    }
+
+    public final Map<String, String> getAdditionalParams() {
+        return additionalParams;
+    }
+
+    public final void setAdditionalParams(final Map<String, String> additionalParams) {
+        this.additionalParams = additionalParams;
+    }
+
+    public CreateInstantiateRequest additionalParams(final Map<String, String> additionalParams) {
+        this.additionalParams = additionalParams;
+        return this;
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(nsInstId, vnfdId, vnfName, vnfPkgId, nfType, tenant, additionalParams);
+    }
+
+    @Override
+    public boolean equals(final Object obj) {
+        if (obj instanceof CreateInstantiateRequest) {
+            final CreateInstantiateRequest other = (CreateInstantiateRequest) obj;
+            return Objects.equals(nsInstId, other.nsInstId) && Objects.equals(vnfdId, other.vnfdId)
+                    && Objects.equals(vnfName, other.vnfName) && Objects.equals(vnfPkgId, other.vnfPkgId)
+                    && Objects.equals(nfType, other.nfType) && Objects.equals(tenant, other.tenant)
+                    && Objects.equals(additionalParams, other.additionalParams);
+        }
+        return false;
+    }
+
+    @Override
+    public String toString() {
+        final StringBuilder sb = new StringBuilder();
+        sb.append("class CreateInstantiateRequest {\n");
+        sb.append("    nsInstId: ").append(toIndentedString(nsInstId)).append("\n");
+        sb.append("    vnfdId: ").append(toIndentedString(vnfdId)).append("\n");
+        sb.append("    vnfName: ").append(toIndentedString(vnfName)).append("\n");
+        sb.append("    vnfPkgId: ").append(toIndentedString(vnfPkgId)).append("\n");
+        sb.append("    nfType: ").append(toIndentedString(nfType)).append("\n");
+        sb.append("    tenant: ").append(toIndentedString(tenant)).append("\n");
+        sb.append("    additionalParams: ").append(toIndentedString(additionalParams)).append("\n");
+
+        sb.append("}");
+        return sb.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/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
new file mode 100644 (file)
index 0000000..c33c67e
--- /dev/null
@@ -0,0 +1,234 @@
+/*-
+ * ============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 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.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.time.LocalDateTime;
+import java.util.Optional;
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.onap.aai.domain.yang.GenericVnf;
+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.Tenant;
+import org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.extclients.aai.AaiServiceProvider;
+import org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.extclients.vnfm.Sol003AdapterServiceProvider;
+import org.onap.so.etsi.nfvo.ns.lcm.database.beans.JobStatusEnum;
+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;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ * @author Waqas Ikram (waqas.ikram@est.tech)
+ */
+@Component
+public class CreateInstantiateVnfTask extends AbstractNetworkServiceTask {
+    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";
+    private final AaiServiceProvider aaiServiceProvider;
+    private final Sol003AdapterServiceProvider sol003AdapterServiceProvider;
+
+    @Autowired
+    public CreateInstantiateVnfTask(final DatabaseServiceProvider databaseServiceProvider,
+            final AaiServiceProvider aaiServiceProvider,
+            final Sol003AdapterServiceProvider sol003AdapterServiceProvider) {
+        super(databaseServiceProvider);
+        this.aaiServiceProvider = aaiServiceProvider;
+        this.sol003AdapterServiceProvider = sol003AdapterServiceProvider;
+    }
+
+    public void checkIfNfInstanceExistsInDb(final DelegateExecution execution) {
+        logger.info("Executing checkIfNfInstanceInDb");
+        final CreateInstantiateRequest request = (CreateInstantiateRequest) execution.getVariable("request");
+        logger.info("request: {}", request);
+
+        setJobStatus(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,
+                    request.getNsInstId() + " " + request.getVnfName() + " VNF instance already exists");
+        }
+        logger.info("Finished executing checkIfNfInstanceInDb  ...");
+
+    }
+
+    public void createNfInstanceInDb(final DelegateExecution execution) {
+        logger.info("Executing createNfInstanceInDb");
+        final CreateInstantiateRequest request = (CreateInstantiateRequest) execution.getVariable("request");
+        logger.info("request: {}", request);
+
+        setJobStatus(execution, IN_PROGRESS, "Creating NF Instance record in database for " + request.getVnfName());
+
+        final Optional<NfvoNsInst> optional = databaseServiceProvider.getNfvoNsInst(request.getNsInstId());
+
+        if (optional.isEmpty()) {
+            abortOperation(execution, "NfvoNsInst: " + request.getNsInstId() + "not founda");
+        }
+
+        final NfvoNsInst nfvoNsInst = optional.get();
+        final LocalDateTime now = LocalDateTime.now();
+        final NfvoNfInst nfvoNfInst = new NfvoNfInst().status(State.NOT_INSTANTIATED).createTime(now)
+                .lastUpdateTime(now).name(request.getVnfName()).vnfdId(request.getVnfdId())
+                .packageId(request.getVnfPkgId()).nfvoNsInst(nfvoNsInst);
+        databaseServiceProvider.saveNfvoNfInst(nfvoNfInst);
+        execution.setVariable(NF_INST_ID_PARAM_NAME, nfvoNfInst.getNfInstId());
+        logger.info("Finished executing createNfInstanceInDb  ...");
+
+    }
+
+    public void createGenericVnfInAai(final DelegateExecution execution) {
+        logger.info("Executing createGenericVnfInAai");
+        try {
+            final CreateInstantiateRequest request = (CreateInstantiateRequest) execution.getVariable("request");
+
+            setJobStatus(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);
+            final NfvoNsInst nfvoNsInst = getNfvoNsInst(execution, nsInstId);
+
+            final GenericVnf genericVnf = new GenericVnf();
+            genericVnf.setVnfId(nfInstId);
+            genericVnf.setVnfName(request.getVnfName());
+            genericVnf.setVnfType(nfvoNsInst.getName() + "/" + request.getVnfName());
+            genericVnf.setServiceId(request.getNsInstId());
+            genericVnf.setNfType(request.getNfType());
+            genericVnf.setOperationalStatus("Created");
+            genericVnf.setIsClosedLoopDisabled(false);
+
+            aaiServiceProvider.createGenericVnfAndConnectServiceInstance(nsInstId, nfInstId, genericVnf);
+
+            final Tenant tenant = request.getTenant();
+            aaiServiceProvider.connectGenericVnfToTenant(nfInstId, tenant.getCloudOwner(), tenant.getRegionName(),
+                    tenant.getTenantId());
+
+        } catch (final Exception exception) {
+            final String message = "Unable to Create GenericVnf in AAI";
+            logger.error(message, exception);
+            abortOperation(execution, message);
+        }
+
+        logger.info("Finished executing createGenericVnfInAai  ...");
+    }
+
+    public void invokeCreateInstantiationRequest(final DelegateExecution execution) {
+        logger.info("Executing invokeCreateInstantiationRequest");
+
+        try {
+            final CreateInstantiateRequest request = (CreateInstantiateRequest) execution.getVariable("request");
+            logger.info("request: {}", request);
+
+            setJobStatus(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.setPkgId(request.getVnfPkgId());
+            vnfRequest.setAdditionalParams(request.getAdditionalParams());
+            final String vnfId = (String) execution.getVariable(NF_INST_ID_PARAM_NAME);
+            final Optional<CreateVnfResponse> optional =
+                    sol003AdapterServiceProvider.invokeCreateInstantiationRequest(vnfId, vnfRequest);
+
+            if (!optional.isPresent()) {
+                final String errorMessage = "Unexpected error while processing create and instantiation request";
+                logger.error(errorMessage);
+                abortOperation(execution, errorMessage);
+            }
+
+            final CreateVnfResponse vnfResponse = optional.get();
+
+            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: "
+                    + request.getVnfName() + " CreaetVnfResponse Job Id: " + vnfResponse.getJobId());
+            logger.debug("Finished executing invokeCreateInstantiationRequest ...");
+        } catch (final Exception exception) {
+            final String message = "Unable to invoke create and instantiation request";
+            logger.error(message, exception);
+            abortOperation(execution, message);
+        }
+
+    }
+
+    public void updateNfInstanceStatusToInstantiated(final DelegateExecution execution) {
+        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()
+                + " will set status to " + State.INSTANTIATED);
+
+        logger.info("Finished executing updateNfInstanceStatusToInstantiated  ...");
+
+    }
+
+    public void updateNfInstanceStatusToFailed(final DelegateExecution execution) {
+        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()
+                + " will set status to " + State.FAILED);
+
+        logger.info("Finished executing updateNfInstanceStatusToInstantiated  ...");
+
+    }
+
+    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()) {
+            final String message = "Unable to find NfvoNfInst record in database using nfInstId: " + nfInstId;
+            logger.error(message);
+
+            abortOperation(execution, message);
+
+        }
+
+        final NfvoNfInst nfvoNfInst = optional.get();
+        nfvoNfInst.setStatus(vnfStatus);
+        databaseServiceProvider.saveNfvoNfInst(nfvoNfInst);
+    }
+
+    private NfvoNsInst getNfvoNsInst(final DelegateExecution execution, final String nsInstId) {
+        logger.info("Getting NfvoNsInst to update with nsInstId: {}", nsInstId);
+        final Optional<NfvoNsInst> optionalNfvoNsInst = databaseServiceProvider.getNfvoNsInst(nsInstId);
+
+        if (!optionalNfvoNsInst.isPresent()) {
+            final String message = "Unable to find NS Instance in datababse using id: " + nsInstId;
+            abortOperation(execution, message);
+        }
+
+        return optionalNfvoNsInst.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/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
new file mode 100644 (file)
index 0000000..8d21204
--- /dev/null
@@ -0,0 +1,416 @@
+/*-
+ * ============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 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.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;
+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.extclients.etsicatalog.EtsiCatalogPackageManagementServiceProvider;
+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;
+import org.onap.so.etsi.nfvo.ns.lcm.model.NsInstancesnsInstanceIdinstantiateAdditionalParamsForVnf;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ * @author Andrew Lamb (andrew.a.lamb@est.tech)
+ *
+ */
+@Component
+public class InstantiateNsTask extends AbstractNetworkServiceTask {
+
+    private static final String IS_NS_INSTANTIATION_SUCCESSFUL_PARAM_NAME = "isNsInstantiationSuccessful";
+    private static final String VNFD_ID_TO_VNF_PKG_ID_MAPPING_PARAM_NAME = "vnfdIdToVnfPkgIdMapping";
+    private static final Logger logger = LoggerFactory.getLogger(InstantiateNsTask.class);
+    private final EtsiCatalogPackageManagementServiceProvider etsiCatalogPackageManagementServiceProvider;
+
+    @Autowired
+    public InstantiateNsTask(final DatabaseServiceProvider databaseServiceProvider,
+            final EtsiCatalogPackageManagementServiceProvider etsiCatalogPackageManagementServiceProvider) {
+        super(databaseServiceProvider);
+        this.etsiCatalogPackageManagementServiceProvider = etsiCatalogPackageManagementServiceProvider;
+
+    }
+
+    public void setJobStatusToStarted(final DelegateExecution execution) {
+        setJobStatus(execution, STARTED, "Instantiate NS workflow process started");
+    }
+
+    public void setJobStatusToFinished(final DelegateExecution execution) {
+        setJobStatus(execution, FINISHED, "Instantiate NS workflow process finished");
+    }
+
+    public void updateNsInstanceStatusToInstantiating(final DelegateExecution execution) {
+        logger.info("Executing updateNsInstanceStatusToInstantiating");
+        setJobStatus(execution, IN_PROGRESS, "Updating NfvoNsInst Status to " + State.INSTANTIATING);
+        updateNsInstanceStatus(execution, State.INSTANTIATING);
+
+        logger.info("Finished executing updateNsInstanceStatusToInstantiating  ...");
+    }
+
+
+    public void checkIfVnfInstantiationWasSuccessful(final DelegateExecution execution) {
+        logger.info("Executing checkIfVnfInstantiationWasSuccessful");
+
+        @SuppressWarnings("unchecked")
+        final List<CreateInstantiateRequest> requests =
+                (List<CreateInstantiateRequest>) execution.getVariable(VNF_CREATE_INSTANTIATE_REQUESTS);
+
+        final String nsInstId = (String) execution.getVariable(NS_INSTANCE_ID_PARAM_NAME);
+        final List<NfvoNfInst> nfInstances = databaseServiceProvider.getNfvoNfInstByNsInstId(nsInstId);
+
+        if (nfInstances == null || nfInstances.isEmpty()) {
+            final String message = "Found empty nf instances";
+            abortOperation(execution, message);
+        }
+
+        if (requests.size() != nfInstances.size()) {
+            final String message = "Missing nf Instance. Request triggered: " + requests.size()
+                    + " Nf Instace reqeust found in database " + nfInstances.size();
+            abortOperation(execution, message);
+        }
+
+        execution.setVariable(IS_NS_INSTANTIATION_SUCCESSFUL_PARAM_NAME, true);
+
+        nfInstances.stream().forEach(instance -> {
+            if (!State.INSTANTIATED.equals(instance.getStatus())) {
+                logger.error("VNF : {} {} instantiation failed", instance.getNfInstId(), instance.getName());
+                execution.setVariable(IS_NS_INSTANTIATION_SUCCESSFUL_PARAM_NAME, false);
+            }
+        });
+
+        logger.info("Finished executing checkIfVnfInstantiationWasSuccessful  ...");
+    }
+
+    public void updateNsInstanceStatusToInstantiated(final DelegateExecution execution) {
+        logger.info("Executing updateNsInstanceStatusToInstantiated");
+        final String nsInstId = (String) execution.getVariable(NS_INSTANCE_ID_PARAM_NAME);
+        setJobStatus(execution, FINISHED, "Successfully " + State.INSTANTIATED + " NS: " + nsInstId);
+
+        updateNsInstanceStatus(execution, State.INSTANTIATED);
+        logger.info("Finished executing updateNsInstanceStatusToInstantiated  ...");
+    }
+
+    public void getAndParseNsdFromEtsiCatalog(final DelegateExecution execution) {
+        logger.info("Executing getAndParseNsdFromEtsiCatalog");
+        setJobStatus(execution, IN_PROGRESS, "Retrieving and parsing NSD from ETSI Catalog Manager");
+        final NfvoNsInst nfvoNsInst = getNfvoNsInst(execution);
+        final String nsPackageId = nfvoNsInst.getNsPackageId();
+
+        try {
+            final Optional<NetworkServiceDescriptor> optional =
+                    etsiCatalogPackageManagementServiceProvider.getNetworkServiceDescriptor(nsPackageId);
+
+            if (!optional.isPresent()) {
+                final String message = "Unable to parse NSD " + nsPackageId;
+                logger.error(message);
+                abortOperation(execution, message);
+            }
+
+            final NetworkServiceDescriptor networkServiceDescriptor = optional.get();
+            logger.info("Found {}", networkServiceDescriptor);
+            execution.setVariable(NETWORK_SERVICE_DESCRIPTOR_PARAM_NAME, networkServiceDescriptor);
+
+        } catch (final EtsiCatalogManagerRequestFailureException failureException) {
+            final String message =
+                    "Unexpected exception occured while getting nsd content using nsPackageId: " + nsPackageId;
+            logger.error(message, failureException);
+
+            abortOperation(execution, message);
+        }
+
+        logger.info("Finished executing getAndParseNsdFromEtsiCatalog  ...");
+
+    }
+
+    public void prepareCreateInstantiateRequests(final DelegateExecution execution) {
+        logger.info("Executing prepareCreateInstantiateRequests ...");
+        setJobStatus(execution, IN_PROGRESS, "Preparing VNF CreateInstantiate requests");
+        final NetworkServiceDescriptor networkServiceDescriptor =
+                (NetworkServiceDescriptor) execution.getVariable(NETWORK_SERVICE_DESCRIPTOR_PARAM_NAME);
+        final String nsInstId = (String) execution.getVariable(NS_INSTANCE_ID_PARAM_NAME);
+
+        final InstantiateNsRequest instantiateNsRequest =
+                (InstantiateNsRequest) execution.getVariable(INSTANTIATE_NS_REQUEST_PARAM_NAME);
+
+        final List<NsInstancesnsInstanceIdinstantiateAdditionalParamsForVnf> additionalParamsForVnfList =
+                instantiateNsRequest.getAdditionalParamsForVnf();
+
+        @SuppressWarnings("unchecked")
+        final Map<String, String> vnfdIdToVnfPkgIdMapping =
+                (Map<String, String>) execution.getVariable(VNFD_ID_TO_VNF_PKG_ID_MAPPING_PARAM_NAME);
+
+        final List<CreateInstantiateRequest> requests = new ArrayList<>();
+
+        for (final VirtualNetworkFunction vnf : networkServiceDescriptor.getVnfs()) {
+            final List<String> vnfmInfoList = vnf.getVnfmInfoList();
+
+            final String vnfdId = vnf.getVnfdId();
+            final String vnfPkgId = vnfdIdToVnfPkgIdMapping.get(vnfdId);
+            if (vnfdId == null || vnfmInfoList.isEmpty() || vnfPkgId == null) {
+                final String message = "Unable to find VnfdId/vnfmInfo/VnfPkgId for vnf: " + vnf;
+                abortOperation(execution, message);
+            }
+
+            final Optional<Tenant> optional = getTenant(vnfPkgId, additionalParamsForVnfList);
+            if (!optional.isPresent()) {
+                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));
+
+            logger.info("Adding request to list: {}", createInstantiateRequest);
+            requests.add(createInstantiateRequest);
+
+        }
+        execution.setVariable(VNF_CREATE_INSTANTIATE_REQUESTS, requests);
+
+        logger.info("Finished executing prepareCreateInstantiateRequests  ...");
+    }
+
+    public void getVnfPkgIdForEachVnfdId(final DelegateExecution execution) {
+        logger.info("Executing getVnfPkgIdForEachVnfdId ...");
+
+        setJobStatus(execution, IN_PROGRESS, "Getting VnfPkgId for each VnfdId");
+
+        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 {
+            for (final String vnfPkgId : nsdInfo.getVnfPkgIds()) {
+                final Optional<VnfPkgInfo> optional =
+                        etsiCatalogPackageManagementServiceProvider.getVnfPkgInfo(vnfPkgId);
+
+                if (!optional.isPresent()) {
+                    final String message = "Unable to find VNF package using NS vnfPkgId: " + vnfPkgId;
+                    logger.error(message);
+                    abortOperation(execution, message);
+                }
+                final VnfPkgInfo vnfPkgInfo = optional.get();
+                vnfdIdToVnfPkgIdMapping.put(vnfPkgInfo.getVnfdId(), vnfPkgId);
+
+            }
+            logger.info("vnfdIdToVnfPkgIdMapping: {}", vnfdIdToVnfPkgIdMapping);
+            execution.setVariable(VNFD_ID_TO_VNF_PKG_ID_MAPPING_PARAM_NAME, vnfdIdToVnfPkgIdMapping);
+
+        } catch (final EtsiCatalogManagerRequestFailureException failureException) {
+            final String message =
+                    "Unexpected exception occured while getting VNF package using nsPackageId: " + nsPackageId;
+            logger.error(message, failureException);
+
+            abortOperation(execution, message);
+        }
+
+        logger.info("Finished executing getVnfPkgIdForEachVnfdId ...");
+
+    }
+
+    public void logTimeOut(final DelegateExecution execution) {
+        logger.error("Vnf instantiation timedOut ...");
+        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());
+            });
+        }
+    }
+
+    public void setJobStatusToError(final DelegateExecution execution) {
+        updateNsInstanceStatus(execution, State.FAILED);
+        setJobStatusToError(execution, "Instantiate NS workflow process failed");
+    }
+
+
+    public void updateNsLcmOpOccStatusToCompleted(final DelegateExecution execution) {
+        logger.info("Executing updateNsLcmOpOccStatusToCompleted ...");
+        final String occId = (String) execution.getVariable(OCC_ID_PARAM_NAME);
+
+        final Optional<NsLcmOpOcc> optional = databaseServiceProvider.getNsLcmOpOcc(occId);
+
+        if (!optional.isPresent()) {
+            final String message = "Unable to find record for NSLcmOpOcc in database using id: " + occId;
+            logger.error(message);
+            abortOperation(execution, message);
+        }
+
+        final NsLcmOpOcc nsLcmOpOcc = optional.get();
+        final OperationStateEnum operationStateCompleted = OperationStateEnum.COMPLETED;
+        logger.info("Setting operation state to {} for id: {}", operationStateCompleted, occId);
+        nsLcmOpOcc.setOperationState(operationStateCompleted);
+        databaseServiceProvider.addNSLcmOpOcc(nsLcmOpOcc);
+
+        logger.info("Finished executing updateNsLcmOpOccStatusToCompleted ...");
+
+    }
+
+    public void updateNsLcmOpOccStatusToFailed(final DelegateExecution execution) {
+        logger.info("Executing updateNsLcmOpOccStatusToFailed ...");
+        final String occId = (String) execution.getVariable(OCC_ID_PARAM_NAME);
+
+        final Optional<NsLcmOpOcc> optional = databaseServiceProvider.getNsLcmOpOcc(occId);
+
+        if (optional.isPresent()) {
+            final NsLcmOpOcc nsLcmOpOcc = optional.get();
+            final OperationStateEnum operationStateFailed = OperationStateEnum.FAILED;
+            logger.info("Setting operation state to {} for id: {}", operationStateFailed, occId);
+            nsLcmOpOcc.setOperationState(operationStateFailed);
+
+            databaseServiceProvider.addNSLcmOpOcc(nsLcmOpOcc);
+        } else {
+            logger.error("Unable to find record for NSLcmOpOcc in database using id: {}", occId);
+        }
+
+        logger.info("Finished executing updateNsLcmOpOccStatusToFailed ...");
+
+    }
+
+    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;
+            }
+
+        } 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);
+        return Optional.empty();
+    }
+
+    @SuppressWarnings("unchecked")
+    private Map<String, String> getAdditionalParams(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();
+            if (additionalParamsForVnf instanceof Map) {
+                logger.info("Found AdditionalParams in instantiateNsRequest using vnfPkgId: {}", vnfPkgId);
+                return (Map<String, String>) additionalParamsForVnf.getAdditionalParams();
+            }
+        }
+
+        return Collections.emptyMap();
+
+    }
+
+    private NfvoNsInst getNfvoNsInst(final DelegateExecution execution) {
+        final String nsInstId = (String) execution.getVariable(NS_INSTANCE_ID_PARAM_NAME);
+        return getNfvoNsInst(execution, nsInstId);
+    }
+
+    private NfvoNsInst getNfvoNsInst(final DelegateExecution execution, final String nsInstId) {
+        logger.info("Getting NfvoNsInst to update with nsInstId: {}", nsInstId);
+        final Optional<NfvoNsInst> optionalNfvoNsInst = databaseServiceProvider.getNfvoNsInst(nsInstId);
+
+        if (!optionalNfvoNsInst.isPresent()) {
+            final String message = "Unable to find NS Instance in database using id: " + nsInstId;
+            abortOperation(execution, message);
+        }
+
+        return optionalNfvoNsInst.get();
+    }
+
+
+}
diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/resources/CreateInstantiateVnf.bpmn b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/resources/CreateInstantiateVnf.bpmn
new file mode 100644 (file)
index 0000000..025faa4
--- /dev/null
@@ -0,0 +1,159 @@
+<?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" id="Definitions_1uf6nd9" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.0.0">
+  <bpmn:process id="CreateInstantiateVnf" name="CreateInstantiateVnf" isExecutable="true">
+    <bpmn:startEvent id="StartEvent_1">
+      <bpmn:outgoing>Flow_02bjz2v</bpmn:outgoing>
+    </bpmn:startEvent>
+    <bpmn:serviceTask id="Activity_19rmtjr" name="Create NF Instance (VNF) record in DB" camunda:expression="${CreateInstantiateVnfTask.createNfInstanceInDb(execution)}">
+      <bpmn:incoming>Flow_123uagz</bpmn:incoming>
+      <bpmn:outgoing>Flow_03p6ifi</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:sequenceFlow id="Flow_02bjz2v" sourceRef="StartEvent_1" targetRef="Activity_1cluqgp" />
+    <bpmn:endEvent id="Event_14qdixj">
+      <bpmn:incoming>Flow_0srinh7</bpmn:incoming>
+    </bpmn:endEvent>
+    <bpmn:sequenceFlow id="Flow_03p6ifi" sourceRef="Activity_19rmtjr" targetRef="Activity_0rto3n3" />
+    <bpmn:serviceTask id="Activity_0rto3n3" name="Create Generic VNF and Connect to Service Instance in AAI" camunda:expression="${CreateInstantiateVnfTask.createGenericVnfInAai(execution)}">
+      <bpmn:incoming>Flow_03p6ifi</bpmn:incoming>
+      <bpmn:outgoing>Flow_1c3kc4e</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:sequenceFlow id="Flow_1c3kc4e" sourceRef="Activity_0rto3n3" targetRef="ServiceTask_0iry5yw" />
+    <bpmn:serviceTask id="Activity_1cluqgp" name="Check If NF Instance (VNF) exists in DB" camunda:expression="${CreateInstantiateVnfTask.checkIfNfInstanceExistsInDb(execution)}">
+      <bpmn:incoming>Flow_02bjz2v</bpmn:incoming>
+      <bpmn:outgoing>Flow_123uagz</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:sequenceFlow id="Flow_123uagz" sourceRef="Activity_1cluqgp" targetRef="Activity_19rmtjr" />
+    <bpmn:serviceTask id="ServiceTask_0iry5yw" name="&#10;Invoke VNFM Adaptor&#10;" camunda:asyncAfter="true" camunda:expression="${CreateInstantiateVnfTask.invokeCreateInstantiationRequest(execution)}">
+      <bpmn:incoming>Flow_1c3kc4e</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0xzptc2</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:callActivity id="CallActivity_1yilxx3" name="Monitor Sol003 adapter  Instantiation Job" calledElement="MonitorSol003AdapterCreateJob">
+      <bpmn:extensionElements>
+        <camunda:in source="createVnfResponse" target="createVnfResponse" />
+        <camunda:in source="jobId" target="jobId" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>SequenceFlow_0xzptc2</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_053tvct</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:callActivity id="CallActivity_0p84lpt" name="Monitor Sol003 adapter Create Node Status" calledElement="MonitorSol003AdapterCreateNodeStatus">
+      <bpmn:extensionElements>
+        <camunda:in source="NF_INST_ID" target="NF_INST_ID" />
+        <camunda:in source="createVnfResponse" target="createVnfResponse" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>SequenceFlow_053tvct</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0h7yluk</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:sequenceFlow id="SequenceFlow_0xzptc2" sourceRef="ServiceTask_0iry5yw" targetRef="CallActivity_1yilxx3" />
+    <bpmn:sequenceFlow id="SequenceFlow_053tvct" sourceRef="CallActivity_1yilxx3" targetRef="CallActivity_0p84lpt" />
+    <bpmn:sequenceFlow id="SequenceFlow_0h7yluk" sourceRef="CallActivity_0p84lpt" targetRef="Activity_0g3dip7" />
+    <bpmn:serviceTask id="Activity_0g3dip7" name="Update NF Instance (VNF) Status to INSTANTIATED" camunda:expression="${CreateInstantiateVnfTask.updateNfInstanceStatusToInstantiated(execution)}">
+      <bpmn:incoming>SequenceFlow_0h7yluk</bpmn:incoming>
+      <bpmn:outgoing>Flow_0srinh7</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:sequenceFlow id="Flow_0srinh7" sourceRef="Activity_0g3dip7" targetRef="Event_14qdixj" />
+    <bpmn:subProcess id="Activity_0qtgdm9" name="Error Handling" triggeredByEvent="true">
+      <bpmn:startEvent id="Event_08zcwc2" name="error">
+        <bpmn:outgoing>Flow_06q1m6i</bpmn:outgoing>
+        <bpmn:errorEventDefinition id="ErrorEventDefinition_1ppvn77" />
+      </bpmn:startEvent>
+      <bpmn:endEvent id="Event_1wkm29u" name="end">
+        <bpmn:incoming>Flow_0anjylz</bpmn:incoming>
+      </bpmn:endEvent>
+      <bpmn:serviceTask id="Activity_0ltxcii" name="Update NF Instance (VNF) Status to FAILED" camunda:asyncBefore="true" camunda:expression="${CreateInstantiateVnfTask.updateNfInstanceStatusToFailed(execution)}">
+        <bpmn:incoming>Flow_06q1m6i</bpmn:incoming>
+        <bpmn:outgoing>Flow_0anjylz</bpmn:outgoing>
+      </bpmn:serviceTask>
+      <bpmn:sequenceFlow id="Flow_06q1m6i" sourceRef="Event_08zcwc2" targetRef="Activity_0ltxcii" />
+      <bpmn:sequenceFlow id="Flow_0anjylz" sourceRef="Activity_0ltxcii" targetRef="Event_1wkm29u" />
+    </bpmn:subProcess>
+  </bpmn:process>
+  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="CreateInstantiateVnf">
+      <bpmndi:BPMNEdge id="SequenceFlow_0h7yluk_di" bpmnElement="SequenceFlow_0h7yluk">
+        <di:waypoint x="1030" y="117" />
+        <di:waypoint x="1080" y="117" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_053tvct_di" bpmnElement="SequenceFlow_053tvct">
+        <di:waypoint x="880" y="117" />
+        <di:waypoint x="930" y="117" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0xzptc2_di" bpmnElement="SequenceFlow_0xzptc2">
+        <di:waypoint x="740" y="117" />
+        <di:waypoint x="780" y="117" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_123uagz_di" bpmnElement="Flow_123uagz">
+        <di:waypoint x="350" y="117" />
+        <di:waypoint x="380" y="117" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1c3kc4e_di" bpmnElement="Flow_1c3kc4e">
+        <di:waypoint x="610" y="117" />
+        <di:waypoint x="640" y="117" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_03p6ifi_di" bpmnElement="Flow_03p6ifi">
+        <di:waypoint x="480" y="117" />
+        <di:waypoint x="510" y="117" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_02bjz2v_di" bpmnElement="Flow_02bjz2v">
+        <di:waypoint x="215" y="117" />
+        <di:waypoint x="250" y="117" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0srinh7_di" bpmnElement="Flow_0srinh7">
+        <di:waypoint x="1180" y="117" />
+        <di:waypoint x="1232" y="117" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
+        <dc:Bounds x="179" y="99" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_19rmtjr_di" bpmnElement="Activity_19rmtjr">
+        <dc:Bounds x="380" y="77" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0rto3n3_di" bpmnElement="Activity_0rto3n3">
+        <dc:Bounds x="510" y="77" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1cluqgp_di" bpmnElement="Activity_1cluqgp">
+        <dc:Bounds x="250" y="77" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ServiceTask_0iry5yw_di" bpmnElement="ServiceTask_0iry5yw">
+        <dc:Bounds x="640" y="77" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="CallActivity_1yilxx3_di" bpmnElement="CallActivity_1yilxx3">
+        <dc:Bounds x="780" y="77" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="CallActivity_0p84lpt_di" bpmnElement="CallActivity_0p84lpt">
+        <dc:Bounds x="930" y="77" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_14qdixj_di" bpmnElement="Event_14qdixj">
+        <dc:Bounds x="1232" y="99" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0g3dip7_di" bpmnElement="Activity_0g3dip7">
+        <dc:Bounds x="1080" y="77" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0qtgdm9_di" bpmnElement="Activity_0qtgdm9" isExpanded="true">
+        <dc:Bounds x="430" y="270" width="438" height="130" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="Flow_06q1m6i_di" bpmnElement="Flow_06q1m6i">
+        <di:waypoint x="488" y="333" />
+        <di:waypoint x="580" y="333" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0anjylz_di" bpmnElement="Flow_0anjylz">
+        <di:waypoint x="680" y="333" />
+        <di:waypoint x="812" y="333" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="Event_08zcwc2_di" bpmnElement="Event_08zcwc2">
+        <dc:Bounds x="452" y="315" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="458" y="358" width="24" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_1wkm29u_di" bpmnElement="Event_1wkm29u">
+        <dc:Bounds x="812" y="315" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="822" y="357" width="19" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0ltxcii_di" bpmnElement="Activity_0ltxcii">
+        <dc:Bounds x="580" y="293" width="100" height="80" />
+      </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
new file mode 100644 (file)
index 0000000..ba9e641
--- /dev/null
@@ -0,0 +1,331 @@
+<?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_0mdda96" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.0.0">
+  <bpmn:process id="InstantiateNs" name="InstantiateNs" isExecutable="true">
+    <bpmn:startEvent id="StartEvent_1" name="Start Process">
+      <bpmn:outgoing>SequenceFlow_16k0f61</bpmn:outgoing>
+    </bpmn:startEvent>
+    <bpmn:sequenceFlow id="SequenceFlow_16k0f61" sourceRef="StartEvent_1" targetRef="Activity_194tqy0" />
+    <bpmn:serviceTask id="Task_0opnwx0" name="Update NS Instance status to INSTANTIATING" camunda:expression="${InstantiateNsTask.updateNsInstanceStatusToInstantiating(execution)}">
+      <bpmn:incoming>Flow_04pxtdd</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0bdznyp</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:endEvent id="EndEvent_0szswbo" name="End Process">
+      <bpmn:incoming>Flow_1pcu8aa</bpmn:incoming>
+    </bpmn:endEvent>
+    <bpmn:sequenceFlow id="SequenceFlow_0bdznyp" sourceRef="Task_0opnwx0" targetRef="Activity_1jrym1e" />
+    <bpmn:serviceTask id="Activity_194tqy0" name="Set Job Status to STARTED" camunda:asyncBefore="true" camunda:expression="${InstantiateNsTask.setJobStatusToStarted(execution)}">
+      <bpmn:incoming>SequenceFlow_16k0f61</bpmn:incoming>
+      <bpmn:outgoing>Flow_04pxtdd</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:sequenceFlow id="Flow_04pxtdd" sourceRef="Activity_194tqy0" targetRef="Task_0opnwx0" />
+    <bpmn:subProcess id="Activity_0pjxszh" name="Error Handling" triggeredByEvent="true">
+      <bpmn:startEvent id="Event_1rpzcl3" name="error">
+        <bpmn:outgoing>Flow_07bh7l7</bpmn:outgoing>
+        <bpmn:errorEventDefinition id="ErrorEventDefinition_0m2e0oa" />
+      </bpmn:startEvent>
+      <bpmn:endEvent id="Event_1fcw3ei" name="end">
+        <bpmn:incoming>Flow_1wa1jpl</bpmn:incoming>
+      </bpmn:endEvent>
+      <bpmn:serviceTask id="Activity_0ddja9m" name="Set Job Status to ERROR" camunda:asyncBefore="true" camunda:expression="${InstantiateNsTask.setJobStatusToError(execution)}">
+        <bpmn:incoming>Flow_0n3dai5</bpmn:incoming>
+        <bpmn:outgoing>Flow_1wa1jpl</bpmn:outgoing>
+      </bpmn:serviceTask>
+      <bpmn:sequenceFlow id="Flow_1wa1jpl" sourceRef="Activity_0ddja9m" targetRef="Event_1fcw3ei" />
+      <bpmn:sequenceFlow id="Flow_07bh7l7" sourceRef="Event_1rpzcl3" targetRef="Activity_1miy3hw" />
+      <bpmn:serviceTask id="Activity_1miy3hw" name="Update NSLcmOpOcc operation status to FAILED" camunda:asyncBefore="true" camunda:expression="${InstantiateNsTask.updateNsLcmOpOccStatusToFailed(execution)}">
+        <bpmn:incoming>Flow_07bh7l7</bpmn:incoming>
+        <bpmn:outgoing>Flow_0n3dai5</bpmn:outgoing>
+      </bpmn:serviceTask>
+      <bpmn:sequenceFlow id="Flow_0n3dai5" sourceRef="Activity_1miy3hw" targetRef="Activity_0ddja9m" />
+    </bpmn:subProcess>
+    <bpmn:subProcess id="Activity_0mtscwq" name="Java Exception Handling" triggeredByEvent="true">
+      <bpmn:startEvent id="Event_0lqr6al" name="error">
+        <bpmn:outgoing>Flow_05lo00r</bpmn:outgoing>
+        <bpmn:errorEventDefinition id="ErrorEventDefinition_02lwl19" errorRef="Error_0jsct8p" camunda:errorCodeVariable="BPMN_javaExpCode" camunda:errorMessageVariable="BPMN_javaExpMsg" />
+      </bpmn:startEvent>
+      <bpmn:endEvent id="Event_05ty7c4">
+        <bpmn:incoming>Flow_16aryg5</bpmn:incoming>
+      </bpmn:endEvent>
+      <bpmn:serviceTask id="Activity_1ezu7d4" name="Set Job Status to ERROR" camunda:asyncBefore="true" camunda:expression="${InstantiateNsTask.setJobStatusToError(execution)}">
+        <bpmn:incoming>Flow_09zcw2a</bpmn:incoming>
+        <bpmn:outgoing>Flow_16aryg5</bpmn:outgoing>
+      </bpmn:serviceTask>
+      <bpmn:sequenceFlow id="Flow_16aryg5" sourceRef="Activity_1ezu7d4" targetRef="Event_05ty7c4" />
+      <bpmn:sequenceFlow id="Flow_05lo00r" sourceRef="Event_0lqr6al" targetRef="Activity_17leldb" />
+      <bpmn:serviceTask id="Activity_17leldb" name="Update NSLcmOpOcc operation status to FAILED" camunda:asyncBefore="true" camunda:expression="${InstantiateNsTask.updateNsLcmOpOccStatusToFailed(execution)}">
+        <bpmn:incoming>Flow_05lo00r</bpmn:incoming>
+        <bpmn:outgoing>Flow_09zcw2a</bpmn:outgoing>
+      </bpmn:serviceTask>
+      <bpmn:sequenceFlow id="Flow_09zcw2a" sourceRef="Activity_17leldb" targetRef="Activity_1ezu7d4" />
+    </bpmn:subProcess>
+    <bpmn:serviceTask id="Activity_1w09i1k" name="Set Job Status to FINISHED" camunda:expression="${InstantiateNsTask.setJobStatusToFinished(execution)}">
+      <bpmn:incoming>Flow_1i36dw4</bpmn:incoming>
+      <bpmn:outgoing>Flow_1pcu8aa</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:sequenceFlow id="Flow_1pcu8aa" sourceRef="Activity_1w09i1k" targetRef="EndEvent_0szswbo" />
+    <bpmn:serviceTask id="Activity_1jrym1e" name="Get and parse NSD from ETSI Catalog" camunda:expression="${InstantiateNsTask.getAndParseNsdFromEtsiCatalog(execution)}">
+      <bpmn:incoming>SequenceFlow_0bdznyp</bpmn:incoming>
+      <bpmn:outgoing>Flow_10zjw0w</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:sequenceFlow id="Flow_10zjw0w" sourceRef="Activity_1jrym1e" targetRef="Activity_1kikjaf" />
+    <bpmn:callActivity id="Activity_1b2s2wr" name="Create and Instantiate each Vnf" calledElement="CreateInstantiateVnf">
+      <bpmn:extensionElements>
+        <camunda:in source="request" target="request" />
+        <camunda:in source="jobId" target="jobId" />
+        <camunda:in source="NsInstanceId" target="NsInstanceId" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_1irbp9b</bpmn:incoming>
+      <bpmn:outgoing>Flow_0mi4nqa</bpmn:outgoing>
+      <bpmn:multiInstanceLoopCharacteristics camunda:asyncAfter="true" camunda:collection="${vnfCreateInstantiateRequests}" camunda:elementVariable="request" />
+    </bpmn:callActivity>
+    <bpmn:boundaryEvent id="Event_0rbb817" name="Overall Wait" attachedToRef="Activity_1b2s2wr">
+      <bpmn:outgoing>Flow_17zn7we</bpmn:outgoing>
+      <bpmn:timerEventDefinition id="TimerEventDefinition_13ud1f4">
+        <bpmn:timeDuration xsi:type="bpmn:tFormalExpression">PT3H</bpmn:timeDuration>
+      </bpmn:timerEventDefinition>
+    </bpmn:boundaryEvent>
+    <bpmn:sequenceFlow id="Flow_17zn7we" sourceRef="Event_0rbb817" targetRef="Activity_16z66xm" />
+    <bpmn:serviceTask id="Activity_0eou3y4" name="Prepare Create Instantiate requests" camunda:expression="${InstantiateNsTask.prepareCreateInstantiateRequests(execution)}">
+      <bpmn:incoming>Flow_01ju1mj</bpmn:incoming>
+      <bpmn:outgoing>Flow_1irbp9b</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:sequenceFlow id="Flow_1irbp9b" sourceRef="Activity_0eou3y4" targetRef="Activity_1b2s2wr" />
+    <bpmn:serviceTask id="Activity_1kikjaf" name="Get Vnf Pkg ID for each VNFD ID" camunda:expression="${InstantiateNsTask.getVnfPkgIdForEachVnfdId(execution)}">
+      <bpmn:incoming>Flow_10zjw0w</bpmn:incoming>
+      <bpmn:outgoing>Flow_01ju1mj</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:sequenceFlow id="Flow_01ju1mj" sourceRef="Activity_1kikjaf" targetRef="Activity_0eou3y4" />
+    <bpmn:serviceTask id="Activity_16cvdbw" name="Update NS Instance status to INSTANTIATED" camunda:expression="${InstantiateNsTask.updateNsInstanceStatusToInstantiated(execution)}">
+      <bpmn:incoming>Flow_1nieng0</bpmn:incoming>
+      <bpmn:outgoing>Flow_0xptc0r</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:sequenceFlow id="Flow_0xptc0r" sourceRef="Activity_16cvdbw" targetRef="Activity_0gkpdft" />
+    <bpmn:endEvent id="Event_1e4bwip">
+      <bpmn:incoming>Flow_10oprxr</bpmn:incoming>
+      <bpmn:incoming>Flow_1p21p1m</bpmn:incoming>
+      <bpmn:errorEventDefinition id="ErrorEventDefinition_0vg6v5r" errorRef="Error_0jsct8p" />
+    </bpmn:endEvent>
+    <bpmn:exclusiveGateway id="Gateway_0nxf0rv" name="is Successful?">
+      <bpmn:incoming>Flow_15m4nm1</bpmn:incoming>
+      <bpmn:outgoing>Flow_1nieng0</bpmn:outgoing>
+      <bpmn:outgoing>Flow_10oprxr</bpmn:outgoing>
+    </bpmn:exclusiveGateway>
+    <bpmn:sequenceFlow id="Flow_1nieng0" name="Yes" sourceRef="Gateway_0nxf0rv" targetRef="Activity_16cvdbw">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{isNsInstantiationSuccessful}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:serviceTask id="Activity_14iwa8x" name="Check if VNF Instantiation was Successful" camunda:expression="${InstantiateNsTask.checkIfVnfInstantiationWasSuccessful(execution)}">
+      <bpmn:incoming>Flow_0mi4nqa</bpmn:incoming>
+      <bpmn:outgoing>Flow_15m4nm1</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:sequenceFlow id="Flow_0mi4nqa" sourceRef="Activity_1b2s2wr" targetRef="Activity_14iwa8x" />
+    <bpmn:sequenceFlow id="Flow_15m4nm1" sourceRef="Activity_14iwa8x" targetRef="Gateway_0nxf0rv" />
+    <bpmn:serviceTask id="Activity_16z66xm" name="Log TimeOut" camunda:expression="${InstantiateNsTask.logTimeOut(execution)}">
+      <bpmn:incoming>Flow_17zn7we</bpmn:incoming>
+      <bpmn:outgoing>Flow_1p21p1m</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:sequenceFlow id="Flow_10oprxr" name="No" sourceRef="Gateway_0nxf0rv" targetRef="Event_1e4bwip">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{not isNsInstantiationSuccessful}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:sequenceFlow id="Flow_1p21p1m" sourceRef="Activity_16z66xm" targetRef="Event_1e4bwip" />
+    <bpmn:serviceTask id="Activity_0gkpdft" name="Update NSLcmOpOcc operation status to COMPLETED" camunda:expression="${InstantiateNsTask.updateNsLcmOpOccStatusToCompleted(execution)}">
+      <bpmn:incoming>Flow_0xptc0r</bpmn:incoming>
+      <bpmn:outgoing>Flow_1i36dw4</bpmn:outgoing>
+    </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" />
+  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="InstantiateNs">
+      <bpmndi:BPMNEdge id="Flow_1p21p1m_di" bpmnElement="Flow_1p21p1m">
+        <di:waypoint x="1250" y="270" />
+        <di:waypoint x="1332" y="270" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_10oprxr_di" bpmnElement="Flow_10oprxr">
+        <di:waypoint x="1350" y="146" />
+        <di:waypoint x="1350" y="252" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1358" y="196" width="14" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_15m4nm1_di" bpmnElement="Flow_15m4nm1">
+        <di:waypoint x="1250" y="121" />
+        <di:waypoint x="1325" y="121" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0mi4nqa_di" bpmnElement="Flow_0mi4nqa">
+        <di:waypoint x="1090" y="121" />
+        <di:waypoint x="1150" y="121" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1nieng0_di" bpmnElement="Flow_1nieng0">
+        <di:waypoint x="1375" y="121" />
+        <di:waypoint x="1430" y="121" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1393" y="103" width="19" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0xptc0r_di" bpmnElement="Flow_0xptc0r">
+        <di:waypoint x="1530" y="121" />
+        <di:waypoint x="1580" y="121" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_01ju1mj_di" bpmnElement="Flow_01ju1mj">
+        <di:waypoint x="800" y="121" />
+        <di:waypoint x="850" y="121" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1irbp9b_di" bpmnElement="Flow_1irbp9b">
+        <di:waypoint x="950" y="121" />
+        <di:waypoint x="990" y="121" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_17zn7we_di" bpmnElement="Flow_17zn7we">
+        <di:waypoint x="1070" y="179" />
+        <di:waypoint x="1070" y="270" />
+        <di:waypoint x="1150" y="270" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_10zjw0w_di" bpmnElement="Flow_10zjw0w">
+        <di:waypoint x="649" y="121" />
+        <di:waypoint x="700" y="121" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1pcu8aa_di" bpmnElement="Flow_1pcu8aa">
+        <di:waypoint x="1820" y="121" />
+        <di:waypoint x="1862" y="121" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_04pxtdd_di" bpmnElement="Flow_04pxtdd">
+        <di:waypoint x="360" y="121" />
+        <di:waypoint x="400" y="121" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0bdznyp_di" bpmnElement="SequenceFlow_0bdznyp">
+        <di:waypoint x="500" y="121" />
+        <di:waypoint x="549" y="121" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_16k0f61_di" bpmnElement="SequenceFlow_16k0f61">
+        <di:waypoint x="208" y="121" />
+        <di:waypoint x="260" y="121" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1i36dw4_di" bpmnElement="Flow_1i36dw4">
+        <di:waypoint x="1680" y="121" />
+        <di:waypoint x="1720" y="121" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
+        <dc:Bounds x="172" y="103" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="157" y="146" width="67" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ServiceTask_1y7xfqt_di" bpmnElement="Task_0opnwx0">
+        <dc:Bounds x="400" y="81" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_194tqy0_di" bpmnElement="Activity_194tqy0">
+        <dc:Bounds x="260" y="81" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="EndEvent_0szswbo_di" bpmnElement="EndEvent_0szswbo">
+        <dc:Bounds x="1862" y="103" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1848" y="79" width="63" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1w09i1k_di" bpmnElement="Activity_1w09i1k">
+        <dc:Bounds x="1720" y="81" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0gkpdft_di" bpmnElement="Activity_0gkpdft">
+        <dc:Bounds x="1580" y="81" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0pjxszh_di" bpmnElement="Activity_0pjxszh" isExpanded="true">
+        <dc:Bounds x="380" y="270" width="510" height="130" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="Flow_07bh7l7_di" bpmnElement="Flow_07bh7l7">
+        <di:waypoint x="438" y="333" />
+        <di:waypoint x="500" y="333" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1wa1jpl_di" bpmnElement="Flow_1wa1jpl">
+        <di:waypoint x="760" y="333" />
+        <di:waypoint x="822" y="333" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0n3dai5_di" bpmnElement="Flow_0n3dai5">
+        <di:waypoint x="600" y="333" />
+        <di:waypoint x="660" y="333" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="Event_1rpzcl3_di" bpmnElement="Event_1rpzcl3">
+        <dc:Bounds x="402" y="315" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="408" y="358" width="24" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1miy3hw_di" bpmnElement="Activity_1miy3hw">
+        <dc:Bounds x="500" y="293" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0ddja9m_di" bpmnElement="Activity_0ddja9m">
+        <dc:Bounds x="660" y="293" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_1fcw3ei_di" bpmnElement="Event_1fcw3ei">
+        <dc:Bounds x="822" y="315" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="832" y="357" width="19" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0mtscwq_di" bpmnElement="Activity_0mtscwq" isExpanded="true">
+        <dc:Bounds x="380" y="430" width="510" height="130" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="Flow_05lo00r_di" bpmnElement="Flow_05lo00r">
+        <di:waypoint x="438" y="493" />
+        <di:waypoint x="500" y="493" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_16aryg5_di" bpmnElement="Flow_16aryg5">
+        <di:waypoint x="760" y="493" />
+        <di:waypoint x="822" y="493" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_09zcw2a_di" bpmnElement="Flow_09zcw2a">
+        <di:waypoint x="600" y="493" />
+        <di:waypoint x="660" y="493" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="Event_0lqr6al_di" bpmnElement="Event_0lqr6al">
+        <dc:Bounds x="402" y="475" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="409" y="518" width="24" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_17leldb_di" bpmnElement="Activity_17leldb">
+        <dc:Bounds x="500" y="453" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1ezu7d4_di" bpmnElement="Activity_1ezu7d4">
+        <dc:Bounds x="660" y="453" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_05ty7c4_di" bpmnElement="Event_05ty7c4">
+        <dc:Bounds x="822" y="475" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1jrym1e_di" bpmnElement="Activity_1jrym1e">
+        <dc:Bounds x="549" y="81" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1xjmizv_di" bpmnElement="Activity_1b2s2wr">
+        <dc:Bounds x="990" y="81" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0eou3y4_di" bpmnElement="Activity_0eou3y4">
+        <dc:Bounds x="850" y="81" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1kikjaf_di" bpmnElement="Activity_1kikjaf">
+        <dc:Bounds x="700" y="81" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_16cvdbw_di" bpmnElement="Activity_16cvdbw">
+        <dc:Bounds x="1430" y="81" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_16umj30_di" bpmnElement="Event_1e4bwip">
+        <dc:Bounds x="1332" y="252" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Gateway_0nxf0rv_di" bpmnElement="Gateway_0nxf0rv" isMarkerVisible="true">
+        <dc:Bounds x="1325" y="96" width="50" height="50" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1320" y="66" width="71" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_14iwa8x_di" bpmnElement="Activity_14iwa8x">
+        <dc:Bounds x="1150" y="81" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_16z66xm_di" bpmnElement="Activity_16z66xm">
+        <dc:Bounds x="1150" y="230" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_0rbb817_di" bpmnElement="Event_0rbb817">
+        <dc:Bounds x="1052" y="143" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1000" y="183" width="60" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+    </bpmndi:BPMNPlane>
+  </bpmndi:BPMNDiagram>
+</bpmn:definitions>
index fc9f2a2..86f2879 100644 (file)
@@ -19,6 +19,7 @@
  */
 package org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows;
 
+import static org.camunda.bpm.engine.history.HistoricProcessInstance.STATE_ACTIVE;
 import static org.slf4j.LoggerFactory.getLogger;
 import java.time.LocalDateTime;
 import java.util.List;
@@ -134,9 +135,16 @@ public abstract class BaseTest {
 
 
     public boolean isProcessEndedByProcessInstanceId(final String processInstanceId) {
+        return !isProcessInstanceActive(processInstanceId) && isProcessInstanceEnded(processInstanceId);
+    }
+
+    private boolean isProcessInstanceActive(final String processInstanceId) {
         final HistoricProcessInstance processInstance = getHistoricProcessInstance(processInstanceId);
-        return processInstance != null
-                && !HistoricProcessInstance.STATE_ACTIVE.equalsIgnoreCase(processInstance.getState());
+        return processInstance != null && STATE_ACTIVE.equalsIgnoreCase(processInstance.getState());
+    }
+
+    private boolean isProcessInstanceEnded(final String processInstanceId) {
+        return runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult() == null;
     }
 
 }
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
new file mode 100644 (file)
index 0000000..00e9433
--- /dev/null
@@ -0,0 +1,327 @@
+/*-
+ * ============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 static com.github.tomakehurst.wiremock.client.WireMock.get;
+import static com.github.tomakehurst.wiremock.client.WireMock.notFound;
+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.put;
+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;
+import static org.onap.aaiclient.client.aai.AAIVersion.V19;
+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.extclients.etsicatalog.EtsiCatalogServiceProviderConfiguration.ETSI_CATALOG_REST_TEMPLATE_BEAN;
+import static org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.extclients.vnfm.Sol003AdapterConfiguration.SOL003_ADAPTER_REST_TEMPLATE_BEAN;
+import static org.springframework.test.web.client.ExpectedCount.times;
+import static org.springframework.test.web.client.match.MockRestRequestMatchers.method;
+import static org.springframework.test.web.client.match.MockRestRequestMatchers.requestTo;
+import static org.springframework.test.web.client.response.MockRestResponseCreators.withSuccess;
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.time.LocalDateTime;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Optional;
+import java.util.UUID;
+import java.util.stream.Collectors;
+import org.camunda.bpm.engine.history.HistoricProcessInstance;
+import org.camunda.bpm.engine.history.HistoricVariableInstance;
+import org.hamcrest.text.MatchesPattern;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.aaiclient.client.aai.entities.Results;
+import org.onap.aaiclient.client.graphinventory.entities.Resource;
+import org.onap.so.adapters.etsisol003adapter.lcm.v1.model.CreateVnfResponse;
+import org.onap.so.adapters.etsisol003adapter.lcm.v1.model.OperationStatusRetrievalStatusEnum;
+import org.onap.so.adapters.etsisol003adapter.pkgm.extclients.etsicatalog.model.NsdInfo;
+import org.onap.so.adapters.etsisol003adapter.pkgm.extclients.etsicatalog.model.VnfPkgInfo;
+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.nsd.NetworkServiceDescriptor;
+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.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;
+import org.onap.so.etsi.nfvo.ns.lcm.model.NsInstancesnsInstanceIdinstantiateAdditionalParamsForVnf;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.MediaType;
+import org.springframework.http.converter.json.GsonHttpMessageConverter;
+import org.springframework.test.web.client.MockRestServiceServer;
+import org.springframework.web.client.RestTemplate;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.google.gson.Gson;
+
+/**
+ * @author Andrew Lamb (andrew.a.lamb@est.tech)
+ * @author Waqas Ikram (waqas.ikram@est.tech)
+ *
+ */
+public class InstantiateNsTaskTest extends BaseTest {
+
+    private static final String TENANT_ID = "6ca8680feba04dad9254f423c6e28e1c";
+    private static final String CLOUD_REGION = "regionOne";
+    private static final String CLOUD_OWNER = "CloudOwner";
+    private static final String UUID_REGEX =
+            "[0-9a-zA-Z]{8}\\-[0-9a-zA-Z]{4}\\-[0-9a-zA-Z]{4}\\-[0-9a-zA-Z]{4}\\-[0-9a-zA-Z]{12}";
+    private static final String VCPE_VBRGEMU_VNFD_ID = "b1bb0ce7-2222-4fa7-95ed-4840d70a1102";
+    private static final String VCPE_VBNG = "b1bb0ce7-2222-4fa7-95ed-4840d70a1101";
+    private static final String VCPE_INFRA_VNFD_ID = "b1bb0ce7-2222-4fa7-95ed-4840d70a1100";
+    private static final String VGMUX_VNFD_ID = "0408f076-e6c0-4c82-9940-272fddbb82de";
+    private static final String VGW_VNFD_ID = "3fca3543-07f5-492f-812c-ed462e4f94f4";
+    private static final String[] VCPE_VNFDS =
+            new String[] {VGW_VNFD_ID, VGMUX_VNFD_ID, VCPE_INFRA_VNFD_ID, VCPE_VBNG, VCPE_VBRGEMU_VNFD_ID};
+    private static final String SAMPLE_NSD_FILE = "src/test/resources/ns.csar";
+    private static final String NS_NAME = "InstantiateNetworkService";
+
+    @Autowired
+    private DatabaseServiceProvider databaseServiceProvider;
+
+    @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
+    private JobExecutorService objUnderTest;
+
+    @Autowired
+    private GsonProvider gsonProvider;
+
+    private Gson gson;
+
+    private static final Map<String, String> VNFD_ID_TO_VNFPKG_ID_MAPPING = new HashMap<>();
+    static {
+        for (final String vnfd : VCPE_VNFDS) {
+            VNFD_ID_TO_VNFPKG_ID_MAPPING.put(vnfd, UUID.randomUUID().toString());
+        }
+    }
+
+    @Before
+    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
+    public void testInstantiateNsWorkflow_JustUpdateStatus_SuccessfullCase() throws InterruptedException, IOException {
+        final String nsdId = UUID.randomUUID().toString();
+        final String nsdName = NS_NAME + "-" + System.currentTimeMillis();
+
+        final NfvoNsInst newNfvoNsInst = new NfvoNsInst().nsInstId(nsdId).name(nsdName)
+                .nsPackageId(UUID.randomUUID().toString()).nsPackageId(nsdId).nsdId(nsdId).nsdInvariantId(nsdId)
+                .status(State.NOT_INSTANTIATED).statusUpdatedTime(LocalDateTime.now());
+
+        databaseServiceProvider.saveNfvoNsInst(newNfvoNsInst);
+
+        mockSol003AdapterEndpoints();
+        mockAAIEndpoints(nsdId);
+        mockEtsiCatalogEndpoints(nsdId);
+
+        final String nsLcmOpOccId =
+                objUnderTest.runInstantiateNsJob(newNfvoNsInst.getNsInstId(), getInstantiateNsRequest());
+
+        final Optional<NfvoJob> optional = getJobByResourceId(newNfvoNsInst.getNsInstId());
+        assertTrue(optional.isPresent());
+        final NfvoJob nfvoJob = optional.get();
+
+        assertTrue(waitForProcessInstanceToFinish(nfvoJob.getProcessInstanceId()));
+
+        final HistoricProcessInstance historicProcessInstance =
+                getHistoricProcessInstance(nfvoJob.getProcessInstanceId());
+        assertNotNull(historicProcessInstance);
+
+        assertEquals(HistoricProcessInstance.STATE_COMPLETED, historicProcessInstance.getState());
+
+        // check if value in database has updated
+        final Optional<NfvoNsInst> optionalNfvoNsInst = databaseServiceProvider.getNfvoNsInst(nsdId);
+        final NfvoNsInst nfvoNsInst = optionalNfvoNsInst.get();
+        assertEquals(State.INSTANTIATED, nfvoNsInst.getStatus());
+
+        final HistoricVariableInstance historicVariableInstance =
+                getVariable(nfvoJob.getProcessInstanceId(), NETWORK_SERVICE_DESCRIPTOR_PARAM_NAME);
+        assertNotNull(historicVariableInstance);
+        final NetworkServiceDescriptor nsd = (NetworkServiceDescriptor) historicVariableInstance.getValue();
+        assertNotNull(nsd);
+
+        assertEquals(VNFD_ID_TO_VNFPKG_ID_MAPPING.size(), nsd.getVnfs().size());
+
+        final List<NfvoNfInst> nfvoNfInsts = databaseServiceProvider.getNfvoNfInstByNsInstId(nsdId);
+        assertNotNull(nsd);
+        assertEquals(VNFD_ID_TO_VNFPKG_ID_MAPPING.size(), nfvoNfInsts.size());
+
+        final Optional<NsLcmOpOcc> optionalNsLcmOpOcc = databaseServiceProvider.getNsLcmOpOcc(nsLcmOpOccId);
+        assertTrue(optionalNsLcmOpOcc.isPresent());
+
+        assertEquals(OperationStateEnum.COMPLETED, optionalNsLcmOpOcc.get().getOperationState());
+
+        final Map<String, NfvoNfInst> nfvoNfInstsMap =
+                nfvoNfInsts.stream().collect(Collectors.toMap(NfvoNfInst::getVnfdId, nfvoNfInst -> nfvoNfInst));
+
+        for (final Entry<String, String> entry : VNFD_ID_TO_VNFPKG_ID_MAPPING.entrySet()) {
+            assertTrue(nfvoNfInstsMap.containsKey(entry.getKey()));
+            assertEquals(State.INSTANTIATED, nfvoNfInstsMap.get(entry.getKey()).getStatus());
+
+        }
+
+    }
+
+    private void mockSol003AdapterEndpoints() {
+        mockSol003AdapterRestServiceServer
+                .expect(times(VNFD_ID_TO_VNFPKG_ID_MAPPING.size()),
+                        requestTo(MatchesPattern.matchesPattern(SOL003_ADAPTER_ENDPOINT_URL + "/vnfs/.*")))
+                .andExpect(method(HttpMethod.POST))
+                .andRespond(withSuccess(gson.toJson(new CreateVnfResponse().jobId(UUID.randomUUID().toString())),
+                        MediaType.APPLICATION_JSON));
+
+        mockSol003AdapterRestServiceServer
+                .expect(times(VNFD_ID_TO_VNFPKG_ID_MAPPING.size()),
+                        requestTo(MatchesPattern.matchesPattern(SOL003_ADAPTER_ENDPOINT_URL + "/jobs/.*")))
+                .andExpect(method(HttpMethod.GET))
+                .andRespond(withSuccess(gson.toJson(
+                        new org.onap.so.adapters.etsisol003adapter.lcm.v1.model.QueryJobResponse().operationState(
+                                org.onap.so.adapters.etsisol003adapter.lcm.v1.model.OperationStateEnum.COMPLETED)
+                                .operationStatusRetrievalStatus(OperationStatusRetrievalStatusEnum.STATUS_FOUND)),
+                        MediaType.APPLICATION_JSON));
+    }
+
+    private void mockEtsiCatalogEndpoints(final String nsdId) throws IOException {
+        mockEtsiCatalogRestServiceServer.expect(requestTo(ETSI_CATALOG_URL + "/nsd/v1/ns_descriptors/" + nsdId))
+                .andExpect(method(HttpMethod.GET))
+                .andRespond(withSuccess(gson.toJson(getNSPackageModel(nsdId)), MediaType.APPLICATION_JSON));
+        mockEtsiCatalogRestServiceServer
+                .expect(requestTo(ETSI_CATALOG_URL + "/nsd/v1/ns_descriptors/" + nsdId + "/nsd_content"))
+                .andExpect(method(HttpMethod.GET)).andRespond(withSuccess(
+                        getFileContent(getAbsolutePath(SAMPLE_NSD_FILE)), MediaType.APPLICATION_OCTET_STREAM));
+
+        for (final Entry<String, String> entry : VNFD_ID_TO_VNFPKG_ID_MAPPING.entrySet()) {
+            mockEtsiCatalogRestServiceServer
+                    .expect(requestTo(ETSI_CATALOG_URL + "/vnfpkgm/v1/vnf_packages/" + entry.getValue()))
+                    .andExpect(method(HttpMethod.GET)).andRespond(withSuccess(
+                            gson.toJson(getVnfPkgInfo(entry.getKey(), entry.getValue())), MediaType.APPLICATION_JSON));
+        }
+
+    }
+
+    private VnfPkgInfo getVnfPkgInfo(final String vnfdId, final String vnfPkgId) {
+        return new VnfPkgInfo().id(vnfPkgId).vnfdId(vnfdId);
+    }
+
+    private InstantiateNsRequest getInstantiateNsRequest() {
+        final Map<String, Object> additionalParams = new HashMap<>();
+        additionalParams.put("vim_id", CLOUD_OWNER + "_" + CLOUD_REGION + "_" + TENANT_ID);
+
+        final InstantiateNsRequest instantiateNsRequest = new InstantiateNsRequest().nsFlavourId("default");
+
+        for (final Entry<String, String> entry : VNFD_ID_TO_VNFPKG_ID_MAPPING.entrySet()) {
+            instantiateNsRequest
+                    .addAdditionalParamsForVnfItem(new NsInstancesnsInstanceIdinstantiateAdditionalParamsForVnf()
+                            .vnfProfileId(entry.getValue()).additionalParams(additionalParams));
+        }
+
+        return instantiateNsRequest;
+    }
+
+    private NsdInfo getNSPackageModel(final String nsdId) {
+        return new NsdInfo().id(nsdId).nsdId(nsdId).nsdInvariantId(NSD_INVARIANT_ID).nsdName("vcpe").nsdDesigner("ONAP")
+                .vnfPkgIds(new ArrayList<>(VNFD_ID_TO_VNFPKG_ID_MAPPING.values()));
+    }
+
+    private byte[] getFileContent(final String path) throws IOException {
+        return Files.readAllBytes(Paths.get(path));
+    }
+
+
+    private String getAbsolutePath(final String path) {
+        return new File(path).getAbsolutePath();
+    }
+
+    private void mockAAIEndpoints(final String nsdId) throws JsonProcessingException {
+        final String modelEndpoint = "/aai/" + V19 + "/network/generic-vnfs/generic-vnf/" + UUID_REGEX;
+
+        wireMockServer.stubFor(
+                get(urlMatching(modelEndpoint + "\\?resultIndex=0&resultSize=1&format=count")).willReturn(notFound()));
+
+        wireMockServer.stubFor(put(urlMatching(modelEndpoint)).willReturn(ok()));
+        wireMockServer.stubFor(put(urlMatching(modelEndpoint + "/relationship-list/relationship")).willReturn(ok()));
+
+        wireMockServer.stubFor(get(urlMatching(modelEndpoint)).willReturn(ok())
+                .willReturn(okJson("{\"orchestration-status\": \"Created\"}")));
+
+        wireMockServer.stubFor(get(urlMatching("/aai/" + V19 + "/nodes/service-instances/service-instance/.*"))
+                .willReturn(okJson(getResourceResultsResponseAsJson(nsdId))));
+
+        wireMockServer.stubFor(
+                put(urlMatching("/aai/" + V19 + "/cloud-infrastructure/cloud-regions/cloud-region/" + CLOUD_OWNER + "/"
+                        + CLOUD_REGION + "/tenants/tenant/" + TENANT_ID + "/relationship-list/relationship"))
+                                .willReturn(ok()));
+
+    }
+
+    private String getResourceResultsResponseAsJson(final String nsdId) throws JsonProcessingException {
+        final Resource resource = new Resource();
+        resource.setResourceType("service-instance");
+        resource.setResourceLink("/aai/" + V19 + "/business/customers/customer/" + GLOBAL_CUSTOMER_ID
+                + "/service-subscriptions/service-subscription/NetworkService/service-instances/service-instance/"
+                + nsdId);
+        final Results<Resource> results = new Results<>();
+        results.getResult().add(resource);
+        return new ObjectMapper().writeValueAsString(results);
+    }
+
+}
index b17a5f2..1fabfba 100644 (file)
@@ -42,7 +42,7 @@ etsi-catalog-manager:
       endpoint: http://modeling-etsicatalog.onap:8806/api
 so-etsi-ns-lcm-workflow-engine:
    requesttimeout:
-      timeoutInSeconds: 10
+      timeoutInSeconds: 60
 
 logging:
    level:
index 7549b49..cb8f920 100644 (file)
@@ -65,7 +65,7 @@ public class NsLcmOpOcc {
     @Column(name = "IS_AUTO_INNOVATION")
     private boolean isAutoInnovation;
 
-    @Column(name = "OPERATION_PARAMS")
+    @Column(name = "OPERATION_PARAMS", columnDefinition = "LONGTEXT")
     private String operationParams;
 
     @Column(name = "IS_CANCEL_PENDING")
index 8f146e5..1b4e409 100644 (file)
  */
 package org.onap.so.etsi.nfvo.ns.lcm.database.config;
 
+import static org.slf4j.LoggerFactory.getLogger;
 import javax.persistence.EntityManagerFactory;
 import javax.sql.DataSource;
 import org.onap.so.etsi.nfvo.ns.lcm.database.beans.NfvoJob;
+import org.slf4j.Logger;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.boot.autoconfigure.flyway.FlywayDataSource;
 import org.springframework.boot.context.properties.ConfigurationProperties;
 import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder;
 import org.springframework.context.annotation.Bean;
@@ -47,6 +50,7 @@ import com.zaxxer.hikari.HikariDataSource;
 @EnableJpaRepositories(entityManagerFactoryRef = "entityManagerFactory",
         basePackages = {"org.onap.so.etsi.nfvo.ns.lcm.database.repository"})
 public class NfvoDatabaseConfiguration {
+    private static final Logger logger = getLogger(NfvoDatabaseConfiguration.class);
 
     private static final String PERSISTENCE_UNIT = "nfvo";
     private static final String NFVO_DATA_SOURCE_QUALIFIER = "nfvoDataSource";
@@ -57,14 +61,18 @@ public class NfvoDatabaseConfiguration {
     @Bean
     @ConfigurationProperties(prefix = "spring.datasource.hikari.nfvo")
     public HikariConfig nfvoDbConfig() {
+        logger.debug("Creating NFVO HikariConfig bean ... ");
         return new HikariConfig();
     }
 
+    @Primary
+    @FlywayDataSource
     @Bean(name = NFVO_DATA_SOURCE_QUALIFIER)
     public DataSource dataSource() {
         if (mBeanExporter != null) {
             mBeanExporter.addExcludedBean(NFVO_DATA_SOURCE_QUALIFIER);
         }
+        logger.debug("Creating NFVO HikariDataSource bean ... ");
         final HikariConfig hikariConfig = this.nfvoDbConfig();
         return new HikariDataSource(hikariConfig);
     }
index 254a369..3682425 100644 (file)
@@ -81,6 +81,12 @@ public class DatabaseServiceProvider {
         return nfvoNsInstRepository.existsNfvoNsInstByName(name);
     }
 
+    public boolean isNsInstExists(final String nsInstId, final String nfName) {
+        logger.info("Checking if NfvoNfInst entry exists in database using nsInstId: {} and nfName: {}", nsInstId,
+                nfName);
+        return nfvoNfInstRepository.findByNsInstNsInstIdAndName(nsInstId, nfName).isEmpty();
+    }
+
     public boolean saveNfvoNsInst(final NfvoNsInst nfvoNsInst) {
         logger.info("Saving NfvoNsInst: {} to database", nfvoNsInst);
         return nfvoNsInstRepository.save(nfvoNsInst) != null;
@@ -116,6 +122,11 @@ public class DatabaseServiceProvider {
         return nfvoNfInstRepository.findByNsInstNsInstIdAndName(nsInstId, name);
     }
 
+    public Optional<NfvoNfInst> getNfvoNfInst(final String nfInstId) {
+        logger.info("Querying database for NfvoNfInst using nfInstId: {}", nfInstId);
+        return nfvoNfInstRepository.findByNfInstId(nfInstId);
+    }
+
     public boolean addNSLcmOpOcc(final NsLcmOpOcc nsLcmOpOcc) {
         logger.info("Adding NSLcmOpOcc: {} to database", nsLcmOpOcc);
         return nsLcmOpOccRepository.save(nsLcmOpOcc) != null;
@@ -127,5 +138,4 @@ public class DatabaseServiceProvider {
     }
 
 
-
 }
index baf1119..da1649d 100644 (file)
@@ -36,7 +36,7 @@ public class EtsiSoNsLcmManagerUrlProvider {
 
     @Autowired
     public EtsiSoNsLcmManagerUrlProvider(
-            @Value("${etsi-so-ns-lcm-manager.endpoint}") final String etsiNsLcmManagerEndpoint) {
+            @Value("${so-etsi-nfvo-ns-lcm.endpoint:http://so-etsi-nfvo-ns-lcm.onap:9095}") final String etsiNsLcmManagerEndpoint) {
         this.etsiNsLcmManagerEndpoint = etsiNsLcmManagerEndpoint;
     }
 
index f295731..792ffdd 100644 (file)
@@ -25,6 +25,7 @@ import org.apache.commons.lang3.tuple.ImmutablePair;
 import org.onap.so.etsi.nfvo.ns.lcm.EtsiSoNsLcmManagerUrlProvider;
 import org.onap.so.etsi.nfvo.ns.lcm.bpmn.flows.service.JobExecutorService;
 import org.onap.so.etsi.nfvo.ns.lcm.model.CreateNsRequest;
+import org.onap.so.etsi.nfvo.ns.lcm.model.InstantiateNsRequest;
 import org.onap.so.etsi.nfvo.ns.lcm.model.NsInstancesNsInstance;
 import org.slf4j.Logger;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -64,4 +65,13 @@ public class NsLifeCycleManager {
                 nsInstanceResponse);
     }
 
+    public URI instantiateNs(final String nsInstanceId, final InstantiateNsRequest instantiateNsRequest) {
+        logger.info("Will execute Instantiate Ns for InstantiateNsRequest: {} and nsInstanceId: {}",
+                instantiateNsRequest, nsInstanceId);
+        final String nsLcmOpOccId = jobExecutorService.runInstantiateNsJob(nsInstanceId, instantiateNsRequest);
+
+        return etsiSoNsLcmManagerUrlProvider.getInstantiatedOccUri(nsLcmOpOccId);
+
+    }
+
 }
index fb0a250..87ec842 100644 (file)
@@ -125,7 +125,10 @@ public class NsLifecycleManagementController {
     public ResponseEntity<?> instantiateNs(@PathVariable("nsInstanceId") final String nsInstanceId,
             @RequestBody final InstantiateNsRequest instantiateNsRequest) {
         logger.debug("Received instantiate NS request: {}\n with nsInstanceId: {}", instantiateNsRequest, nsInstanceId);
-        return ResponseEntity.status(HttpStatus.NOT_IMPLEMENTED).body("Operation is not supported yet");
+        final URI resourceUri = nsLifeCycleManager.instantiateNs(nsInstanceId, instantiateNsRequest);
+        logger.info("{} Ns Instantiation started successfully. Resource Operation Occurrence uri: {}", nsInstanceId,
+                resourceUri);
+        return ResponseEntity.accepted().location(resourceUri).build();
     }
 
     /**
index 8d9fdbe..3db04fc 100644 (file)
@@ -41,21 +41,18 @@ public class NsLcmControllerExceptionHandler {
                 .body(getInlineResponse400(nsRequestProcessingException));
     }
 
-    private InlineResponse400 getInlineResponse400(final NsRequestProcessingException nsRequestProcessingException) {
+    @ExceptionHandler(Exception.class)
+    public ResponseEntity<InlineResponse400> handleNsRequestProcessingException(final Exception exception) {
+        return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(new InlineResponse400()
+                .status(HttpStatus.INTERNAL_SERVER_ERROR.value()).detail(exception.getMessage()));
+    }
 
+    private InlineResponse400 getInlineResponse400(final NsRequestProcessingException nsRequestProcessingException) {
         if (nsRequestProcessingException.getProblemDetails() != null) {
             return nsRequestProcessingException.getProblemDetails();
         }
-
         return new InlineResponse400().status(HttpStatus.INTERNAL_SERVER_ERROR.value())
                 .detail(nsRequestProcessingException.getMessage());
-
-    }
-
-    @ExceptionHandler(Exception.class)
-    public ResponseEntity<InlineResponse400> handleNsRequestProcessingException(final Exception exception) {
-        return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(new InlineResponse400()
-                .status(HttpStatus.INTERNAL_SERVER_ERROR.value()).detail(exception.getMessage()));
     }
 
 }
index 4ff74ea..81c4e8f 100644 (file)
@@ -69,11 +69,16 @@ import com.google.gson.Gson;
 @SpringBootTest(classes = TestApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
 @ActiveProfiles("test")
 public class NsLifecycleManagementControllerTest {
+    private static final String EXPECTED_BASE_URL =
+            "http://so-etsi-nfvo-ns-lcm.onap:9095/so/so-etsi-nfvo-ns-lcm/v1/api/nslcm/v1";
+    private static final String RANDOM_NS_LCM_OP_OCC_ID = UUID.randomUUID().toString();
     private static final String RANDOM_NS_INST_ID = UUID.randomUUID().toString();
     private static final String SERVICE_TYPE = "NetworkService";
     private static final String GLOBAL_CUSTOMER_ID = UUID.randomUUID().toString();
-    private static final String EXPECTED_LOCATION_URL = "http://etsi-so-ns-lcm-manager-service:9095"
-            + "/so/so-etsi-nfvo-ns-lcm/v1/" + "api/nslcm/v1/ns_instances/" + RANDOM_NS_INST_ID;
+    private static final String EXPECTED_CREATE_REQ_LOCATION_URL =
+            EXPECTED_BASE_URL + "/ns_instances/" + RANDOM_NS_INST_ID;
+    private static final String EXPECTED_INSTANTIATE_REQ_LOCATION_URL =
+            EXPECTED_BASE_URL + "/ns_lcm_op_occs/" + RANDOM_NS_LCM_OP_OCC_ID;
 
     @LocalServerPort
     private int port;
@@ -115,7 +120,7 @@ public class NsLifecycleManagementControllerTest {
         assertTrue(httpHeaders.containsKey(HttpHeaders.LOCATION));
         final List<String> actual = httpHeaders.get(HttpHeaders.LOCATION);
         assertEquals(1, actual.size());
-        assertEquals(EXPECTED_LOCATION_URL, actual.get(0));
+        assertEquals(EXPECTED_CREATE_REQ_LOCATION_URL, actual.get(0));
     }
 
     @Test
@@ -177,11 +182,39 @@ public class NsLifecycleManagementControllerTest {
 
     @Test
     public void testInstantiateNs_ValidInstantiateNsRequest() {
-        final String baseUrl = getNsLcmBaseUrl() + "/ns_instances/" + UUID.randomUUID().toString() + "/instantiate";
-        final HttpEntity<?> request = new HttpEntity<>(getInstantiateNsRequest());
+
+        final InstantiateNsRequest instantiateNsRequest = getInstantiateNsRequest();
+        when(mockedJobExecutorService.runInstantiateNsJob(eq(RANDOM_NS_INST_ID), eq(instantiateNsRequest)))
+                .thenReturn(RANDOM_NS_LCM_OP_OCC_ID);
+
+        final String baseUrl = getNsLcmBaseUrl() + "/ns_instances/" + RANDOM_NS_INST_ID + "/instantiate";
+        final HttpEntity<?> request = new HttpEntity<>(instantiateNsRequest);
         final ResponseEntity<Void> responseEntity =
                 testRestTemplate.exchange(baseUrl, HttpMethod.POST, request, Void.class);
-        assertEquals(HttpStatus.NOT_IMPLEMENTED, responseEntity.getStatusCode());
+        assertEquals(HttpStatus.ACCEPTED, responseEntity.getStatusCode());
+
+        final HttpHeaders httpHeaders = responseEntity.getHeaders();
+        assertTrue(httpHeaders.containsKey(HttpHeaders.LOCATION));
+        final List<String> actual = httpHeaders.get(HttpHeaders.LOCATION);
+        assertEquals(1, actual.size());
+        assertEquals(EXPECTED_INSTANTIATE_REQ_LOCATION_URL, actual.get(0));
+    }
+
+    @Test
+    public void testInstantiateNs_instantiateNsRequest_nsRequestProcessingExceptionThrown_returnInlineResponse400() {
+        final String message = "Unable to process request";
+        final InstantiateNsRequest instantiateNsRequest = getInstantiateNsRequest();
+        when(mockedJobExecutorService.runInstantiateNsJob(eq(RANDOM_NS_INST_ID), eq(instantiateNsRequest)))
+                .thenThrow(new NsRequestProcessingException(message, new InlineResponse400().detail(message)));
+
+        final String baseUrl = getNsLcmBaseUrl() + "/ns_instances/" + RANDOM_NS_INST_ID + "/instantiate";
+        final HttpEntity<?> request = new HttpEntity<>(instantiateNsRequest);
+        final ResponseEntity<InlineResponse400> responseEntity =
+                testRestTemplate.exchange(baseUrl, HttpMethod.POST, request, InlineResponse400.class);
+
+        assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, responseEntity.getStatusCode());
+        assertTrue(responseEntity.hasBody());
+        assertNotNull(responseEntity.getBody());
     }
 
     @Test
index 6c8a799..44acda2 100644 (file)
@@ -26,7 +26,7 @@ spring:
          nfvo:
             jdbcUrl: jdbc:h2:mem:NFVO;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE;INIT=CREATE SCHEMA IF NOT EXISTS NFVO;
             driver-class-name: org.h2.Driver
-            pool-name: ns-lcm-bpmn-pool
+            pool-name: ns-lcm-nfvo-pool
             registerMbeans: true
    jpa:
       hibernate:
@@ -36,6 +36,4 @@ logging:
       org.reflections.Reflections: ERROR
 etsi-catalog-manager:
    base:
-      endpoint: http://modeling-etsicatalog.onap:8806/api
-etsi-so-ns-lcm-manager:
-   endpoint: http://etsi-so-ns-lcm-manager-service:9095
\ No newline at end of file
+      endpoint: http://modeling-etsicatalog.onap:8806/api
\ No newline at end of file
index d2a87db..efc8c45 100644 (file)
@@ -26,10 +26,10 @@ import java.util.Optional;
 import java.util.UUID;
 import javax.ws.rs.NotFoundException;
 import org.onap.aai.domain.yang.GenericVnf;
-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.so.client.dmaap.DmaapConsumer;
 import org.onap.so.client.dmaap.DmaapPublisher;
 import org.onap.so.client.sdno.beans.Body;
@@ -48,7 +48,7 @@ public class SDNOValidatorImpl implements SDNOValidator {
     @Override
     public boolean healthDiagnostic(String vnfId, UUID uuid, String requestingUserId) throws IOException, Exception {
 
-        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId);
+        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId));
         AAIResourcesClient client = new AAIResourcesClient();
         GenericVnf vnf = client.get(GenericVnf.class, uri)
                 .orElseThrow(() -> new NotFoundException(vnfId + " not found in A&AI"));
index 27d4ce7..56b27a1 100644 (file)
@@ -1,9 +1,9 @@
 package org.onap.so.simulator.actions.aai;
 
-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.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import com.consol.citrus.actions.AbstractTestAction;
@@ -23,8 +23,8 @@ public class DeleteVServers extends AbstractTestAction {
             String cloudRegion = context.getVariable("cloudRegion");
             String cloudOwner = context.getVariable("cloudOwner");
             String tenantId = context.getVariable("tenantId");
-            AAIResourceUri vserverURI = AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, cloudOwner, cloudRegion,
-                    tenantId, vserverId);
+            AAIResourceUri vserverURI = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+                    .cloudRegion(cloudOwner, cloudRegion).tenant(tenantId).vserver(vserverId));
             aaiResourceClient.delete(vserverURI);
             logger.error("Delete Vservers in AAI: {}", vserverURI);
         } catch (Exception e) {
index 21f9528..b42441b 100644 (file)
@@ -1,10 +1,10 @@
 package org.onap.so.simulator.actions.aai;
 
 import org.onap.aai.domain.yang.L3Network;
-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.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import com.consol.citrus.actions.AbstractTestAction;
@@ -23,7 +23,8 @@ public class ProcessNetwork extends AbstractTestAction {
 
             if (context.getVariable("action").equals("assign")) {
                 String networkId = context.getVariable("generatedNetworkId");
-                AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, networkId);
+                AAIResourceUri networkURI =
+                        AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(networkId));
                 L3Network network = new L3Network();
                 network.setNetworkId(networkId);
                 network.setNetworkName(context.getVariable("networkName"));
@@ -33,7 +34,8 @@ public class ProcessNetwork extends AbstractTestAction {
                 aaiResourceClient.create(networkURI, network);
             } else if (context.getVariable("action").equals("delete")) {
                 String networkId = context.getVariable("networkId");
-                AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, networkId);
+                AAIResourceUri networkURI =
+                        AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().l3Network(networkId));
                 aaiResourceClient.delete(networkURI);
             }
         } catch (Exception e) {
index 954ebdd..edf2124 100644 (file)
@@ -1,18 +1,12 @@
 package org.onap.so.simulator.actions.aai;
 
-import java.io.InputStream;
-import java.util.List;
 import org.onap.aai.domain.yang.Vnfc;
-import org.onap.aai.domain.yang.Vserver;
-import org.onap.aaiclient.client.aai.AAICommonObjectMapperProvider;
-import org.onap.aaiclient.client.aai.AAIObjectType;
 import org.onap.aaiclient.client.aai.AAIResourcesClient;
-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.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.springframework.core.io.ClassPathResource;
 import com.consol.citrus.actions.AbstractTestAction;
 import com.consol.citrus.context.TestContext;
 
@@ -35,11 +29,13 @@ public class ProcessVnfc extends AbstractTestAction {
             AAIResourcesClient aaiResourceClient = new AAIResourcesClient();
 
             if (context.getVariable("requestAction").equals("CreateVfModuleInstance")
-                    && context.getVariable("serviceAction").equals("assign")) {
+                    && context.getVariable("serviceAction").equals("assign")
+                    && context.getVariable("vfModuleName").equals("nc_dummy_id")) {
 
-                AAIResourceUri vnfcURI = AAIUriFactory.createResourceUri(AAIObjectType.VNFC, "zauk51bfrwl09oam001");
+                AAIResourceUri vnfcURI =
+                        AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().vnfc("ssc_server_1"));
                 Vnfc vnfc = new Vnfc();
-                vnfc.setVnfcName("zauk51bfrwl09oam001");
+                vnfc.setVnfcName("ssc_server_1");
                 vnfc.setNfcNamingCode("oamfw");
                 vnfc.setNfcFunction("EPC-OAM-FIREWALL");
                 vnfc.setProvStatus("PREPROV");
@@ -51,38 +47,20 @@ public class ProcessVnfc extends AbstractTestAction {
                 vnfc.setModelVersionId("9e314c37-2258-4572-a399-c0dd7d5f1aec");
                 vnfc.setModelCustomizationId("2bd95cd4-d7ff-4af0-985d-2adea0339921");
 
-                if (!aaiResourceClient.exists(vnfcURI))
+                if (!aaiResourceClient.exists(vnfcURI)) {
+                    logger.debug("creating VNFC");
                     aaiResourceClient.create(vnfcURI, vnfc);
-                AAIResourceUri vfModuleURI = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE,
-                        context.getVariable("vnfId"), context.getVariable("vfModuleId"));
-                AAIResourceUri pserverURI = AAIUriFactory.createResourceUri(AAIObjectType.PSERVER, "test");
-                AAIResourceUri vserverURI = AAIUriFactory.createResourceUri(AAIObjectType.VSERVER,
-                        context.getVariable("cloudOwner"), context.getVariable("cloudRegion"),
-                        context.getVariable("tenant"), "d29f3151-592d-4011-9356-ad047794e236");
-                aaiResourceClient.connect(vnfcURI, vserverURI);
-                aaiResourceClient.connect(vserverURI, pserverURI);
-                aaiResourceClient.connect(vfModuleURI, vnfcURI);
-            } else if (context.getVariable("requestAction").equals("CreateVfModuleInstance")
-                    && context.getVariable("serviceAction").equals("activate")) {
-                // For recreate after soft delete
-                AAIResourceUri vnfcURI = AAIUriFactory.createResourceUri(AAIObjectType.VNFC, "zauk51bfrwl09oam001");
-                AAIResourceUri vserverURI = AAIUriFactory.createResourceUri(AAIObjectType.VSERVER,
-                        context.getVariable("cloudOwner"), context.getVariable("cloudRegion"),
-                        context.getVariable("tenant"), "d29f3151-592d-4011-9356-ad047794e236");
 
-                Relationships relationships = aaiResourceClient.get(vnfcURI).getRelationships().get();
-                List<AAIResourceUri> uris = relationships.getRelatedUris(AAIObjectType.VSERVER);
-                if (uris.isEmpty() || uris.size() == 0) {
-                    if (!aaiResourceClient.exists(vserverURI)) {
-                        AAICommonObjectMapperProvider aaiMapper = new AAICommonObjectMapperProvider();
-                        InputStream vserverFile =
-                                new ClassPathResource("openstack/gr_api/CreateVserver.json").getInputStream();
-                        Vserver vserver = aaiMapper.getMapper().readValue(vserverFile, Vserver.class);
-                        aaiResourceClient.create(vserverURI, vserver);
-                    }
-                    aaiResourceClient.connect(vnfcURI, vserverURI);
+
+                } else {
+                    aaiResourceClient.get(vnfcURI);
                 }
+                AAIResourceUri vfModuleURI = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network()
+                        .genericVnf(context.getVariable("vnfId")).vfModule(context.getVariable("vfModuleId")));
+                logger.debug("creating VNFC edge to vf module");
+                aaiResourceClient.connect(vfModuleURI, vnfcURI);
             }
+
         } catch (Exception e) {
             logger.debug("Exception in ProcessVnfc.doExecute", e);
         }
index 371c72d..aa54a7a 100644 (file)
@@ -3,10 +3,10 @@ package org.onap.so.simulator.scenarios.openstack;
 import java.io.InputStream;
 import org.onap.aai.domain.yang.Vserver;
 import org.onap.aaiclient.client.aai.AAICommonObjectMapperProvider;
-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.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.core.io.ClassPathResource;
@@ -29,8 +29,9 @@ public class CreateAAInventory extends AbstractTestAction {
                 InputStream vserverFile =
                         new ClassPathResource("openstack/gr_api/CreateAAIInventory.json").getInputStream();
                 Vserver vserver = aaiMapper.getMapper().readValue(vserverFile, Vserver.class);
-                AAIResourceUri vserverURI = AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, "cloudOwner",
-                        "regionOne", "0422ffb57ba042c0800a29dc85ca70f8", vServerId);
+                AAIResourceUri vserverURI = AAIUriFactory.createResourceUri(
+                        AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion("cloudOwner", "regionOne")
+                                .tenant("0422ffb57ba042c0800a29dc85ca70f8").vserver(vServerId));
                 aaiResourceClient.create(vserverURI, vserver);
             }
         } catch (Exception e) {
index 725c896..773400e 100644 (file)
@@ -24,7 +24,8 @@
             ],
             "physical_network": "sriovnet1",
             "pci_slot": "0000:5e:05.6",
-            "pci_vendor_info": "8086:154c"
+            "pci_vendor_info": "8086:154c",
+            "host_id": "50197c55fc934e7b3947e17db762f0839320f94983df774d84991ad2"
         },
         "fixed_ips": [
             {