summaryrefslogtreecommitdiffstats
path: root/bpmn
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn')
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateCoreNSSI.groovy685
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNSSI.groovy157
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNonSharedSlice.groovy432
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreSharedSlice.groovy658
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateCoreNSSITest.groovy631
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNSSITest.groovy103
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNonSharedSliceTest.groovy118
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreSharedSliceTest.groovy646
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoActivateCoreNSSI.bpmn420
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateCoreNSSI.bpmn309
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateCoreNonSharedSlice.bpmn368
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateCoreSharedSlice.bpmn367
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoHandleOofRequest.bpmn2
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/service/level/impl/ServiceLevelUpgradeTest.java65
14 files changed, 4960 insertions, 1 deletions
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
index 0000000000..306c53a73c
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateCoreNSSI.groovy
@@ -0,0 +1,685 @@
+/*-
+ * ============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.delegate.BpmnError
+import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.json.JSONObject
+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.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.bpmn.core.json.JsonUtils
+import org.onap.so.bpmn.core.UrnPropertiesReader
+import org.onap.so.rest.catalog.beans.Vnf
+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.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.RelationshipList
+import org.onap.aai.domain.yang.ServiceInstance
+import org.onap.aai.domain.yang.v19.SliceProfile
+import org.onap.aai.domain.yang.v19.SliceProfiles
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+import org.onap.so.client.HttpClient
+import org.onap.so.client.HttpClientFactory
+import org.onap.so.db.request.beans.OperationStatus
+import org.onap.so.db.request.beans.ResourceOperationStatus
+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 com.fasterxml.jackson.databind.ObjectMapper
+
+import javax.ws.rs.NotFoundException
+import javax.ws.rs.core.Response
+
+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, AAIObjectType.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, AAIObjectType.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, AAIObjectType.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(AAIObjectType.GENERIC_VNF, 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, AAIObjectType aaiObjectType, String instanceId, String errorMsg) {
+ logger.debug(Prefix +" **** Enter DoActivateCoreNSSI ::: queryAAI ****")
+
+ String globalSubscriberId = execution.getVariable("globalSubscriberId")
+ String serviceType = execution.getVariable("serviceType")
+
+ AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(aaiObjectType, globalSubscriberId, serviceType, 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(AAIObjectType.SERVICE_INSTANCE,
+ globalCustId, serviceType, 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/DoAllocateCoreNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNSSI.groovy
new file mode 100644
index 0000000000..64c36e7026
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNSSI.groovy
@@ -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
index 0000000000..2a31997cd5
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNonSharedSlice.groovy
@@ -0,0 +1,432 @@
+/*-
+ * ============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.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(AAIObjectType.SERVICE_INSTANCE, execution.getVariable("globalSubscriberId"), serviceType, 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(AAIObjectType.SERVICE_INSTANCE,
+ globalCustId, serviceType, 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(AAIObjectType.SERVICE_INSTANCE, nssiId);
+
+ //URI for Network Service Instance
+ AAIResourceUri networkServiceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, 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
index 0000000000..6367341228
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreSharedSlice.groovy
@@ -0,0 +1,658 @@
+/*-
+ * ============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.delegate.BpmnError
+import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.json.JSONObject
+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.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.bpmn.core.json.JsonUtils
+import org.onap.so.bpmn.core.UrnPropertiesReader
+import org.onap.so.rest.catalog.beans.Vnf
+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.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.RelationshipList
+import org.onap.aai.domain.yang.ServiceInstance
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+import org.onap.so.client.HttpClient
+import org.onap.so.client.HttpClientFactory
+import org.onap.so.db.request.beans.OperationStatus
+import org.onap.so.db.request.beans.ResourceOperationStatus
+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 com.fasterxml.jackson.databind.ObjectMapper
+
+import static org.apache.commons.lang3.StringUtils.isBlank
+
+import javax.ws.rs.NotFoundException
+import javax.ws.rs.core.Response
+
+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, AAIObjectType.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, AAIObjectType.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, AAIObjectType.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(AAIObjectType.GENERIC_VNF, 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 aaiObjectType
+ * @param instanceId
+ * @return AAIResultWrapper
+ */
+ private AAIResultWrapper queryAAI(DelegateExecution execution, AAIObjectType aaiObjectType, String instanceId, String errorMsg) {
+ logger.debug(Prefix+" **** Enter DoAllocateCoreSharedSlice ::: queryAAI ****")
+ String globalSubscriberId = execution.getVariable("globalSubscriberId")
+ String serviceType = execution.getVariable("serviceType")
+ AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(aaiObjectType, globalSubscriberId, serviceType, 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
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
index 0000000000..a39ca04d71
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateCoreNSSITest.groovy
@@ -0,0 +1,631 @@
+/*-
+ * ============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 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(AAIObjectType.SERVICE_INSTANCE, "5GCustomer", "5G", "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(AAIObjectType.SERVICE_INSTANCE, "5GCustomer", "5G", "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(AAIObjectType.GENERIC_VNF, "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(AAIObjectType.SERVICE_INSTANCE, "5GCustomer", "5G", "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(AAIObjectType.SERVICE_INSTANCE, "5GCustomer", "5G", "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/DoAllocateCoreNSSITest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNSSITest.groovy
new file mode 100644
index 0000000000..dc7a429c2c
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNSSITest.groovy
@@ -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
index 0000000000..1eddf66b86
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNonSharedSliceTest.groovy
@@ -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
index 0000000000..e5799eca66
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreSharedSliceTest.groovy
@@ -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 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.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 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(AAIObjectType.SERVICE_INSTANCE, "5GCustomer", "5G", "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(AAIObjectType.SERVICE_INSTANCE, "5GCustomer", "5G", "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(AAIObjectType.GENERIC_VNF, "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(AAIObjectType.SERVICE_INSTANCE, "5GCustomer", "5G", "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(AAIObjectType.SERVICE_INSTANCE, "5GCustomer", "5G", "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-flows/src/main/resources/subprocess/DoActivateCoreNSSI.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoActivateCoreNSSI.bpmn
new file mode 100644
index 0000000000..b422545e84
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoActivateCoreNSSI.bpmn
@@ -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/DoAllocateCoreNSSI.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateCoreNSSI.bpmn
new file mode 100644
index 0000000000..92407e9b2a
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateCoreNSSI.bpmn
@@ -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
index 0000000000..22eeceea51
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateCoreNonSharedSlice.bpmn
@@ -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
index 0000000000..0a482beca0
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateCoreSharedSlice.bpmn
@@ -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>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoHandleOofRequest.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoHandleOofRequest.bpmn
index d6b251649f..ed4561c757 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoHandleOofRequest.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoHandleOofRequest.bpmn
@@ -18,7 +18,7 @@ oofHandler.callOofAdapter(execution)</bpmn:script>
<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-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
index 0000000000..90d5b94875
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/service/level/impl/ServiceLevelUpgradeTest.java
@@ -0,0 +1,65 @@
+/*-
+ * ============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));
+ 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;
+ }
+
+}