2  * ============LICENSE_START=======================================================
 
   4  * ================================================================================
 
   5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
 
   6  * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
 
   7  * ================================================================================
 
   8  * Modifications Copyright (c) 2019 Samsung
 
   9  * ================================================================================
 
  10  * Licensed under the Apache License, Version 2.0 (the "License")
 
  11  * you may not use this file except in compliance with the License.
 
  12  * You may obtain a copy of the License at
 
  14  *      http://www.apache.org/licenses/LICENSE-2.0
 
  16  * Unless required by applicable law or agreed to in writing, software
 
  17  * distributed under the License is distributed on an "AS IS" BASIS,
 
  18  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
  19  * See the License for the specific language governing permissions and
 
  20  * limitations under the License.
 
  21  * ============LICENSE_END=========================================================
 
  23 package org.onap.so.bpmn.infrastructure.scripts
 
  25 import com.fasterxml.jackson.databind.ObjectMapper
 
  26 import com.fasterxml.jackson.databind.SerializationFeature
 
  28 import org.onap.so.logger.LoggingAnchor
 
  29 import org.onap.logging.filter.base.ErrorCode
 
  31 import static org.apache.commons.lang3.StringUtils.*
 
  33 import javax.ws.rs.NotFoundException
 
  35 import org.camunda.bpm.engine.delegate.BpmnError
 
  36 import org.camunda.bpm.engine.delegate.DelegateExecution
 
  37 import org.onap.aai.domain.yang.Relationship
 
  38 import org.onap.aai.domain.yang.ServiceInstance
 
  39 import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
 
  40 import org.onap.so.bpmn.common.scripts.ExceptionUtil
 
  41 import org.onap.so.bpmn.common.scripts.MsoUtils
 
  42 import org.onap.so.bpmn.core.RollbackData
 
  43 import org.onap.so.bpmn.core.WorkflowException
 
  44 import org.onap.so.bpmn.core.domain.Resource
 
  45 import org.onap.so.bpmn.core.domain.ServiceDecomposition
 
  46 import org.onap.so.bpmn.core.json.JsonUtils
 
  47 import org.onap.aaiclient.client.aai.AAIObjectType
 
  48 import org.onap.aaiclient.client.aai.AAIResourcesClient
 
  49 import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
 
  50 import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
 
  51 import org.onap.so.bpmn.infrastructure.workflow.service.ServicePluginFactory
 
  52 import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
 
  53 import org.onap.so.logger.MessageEnum
 
  54 import org.slf4j.Logger
 
  55 import org.slf4j.LoggerFactory
 
  57 import org.springframework.web.util.UriUtils
 
  58 import org.onap.so.bpmn.core.UrnPropertiesReader
 
  61  * This groovy class supports the <class>DoCreateServiceInstance.bpmn</class> process.
 
  64  * @param - msoRequestId
 
  65  * @param - globalSubscriberId
 
  66  * @param - subscriptionServiceType
 
  67  * @param - serviceInstanceId
 
  68  * @param - serviceInstanceName - O
 
  69  * @param - serviceModelInfo
 
  70  * @param - productFamilyId
 
  71  * @param - disableRollback
 
  72  * @param - failExists - TODO
 
  73  * @param - serviceInputParams (should contain aic_zone for serviceTypes TRANSPORT,ATM)
 
  74  * @param - sdncVersion ("1610")
 
  75  * @param - serviceDecomposition - Decomposition for R1710
 
  76  * (if macro provides serviceDecompsition then serviceModelInfo, serviceInstanceId & serviceInstanceName will be ignored)
 
  79  * @param - rollbackData (localRB->null)
 
  80  * @param - rolledBack (no localRB->null, localRB F->false, localRB S->true)
 
  81  * @param - WorkflowException
 
  82  * @param - serviceInstanceName - (GET from AAI if null in input)
 
  85 public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
 
  86     private static final Logger logger = LoggerFactory.getLogger( DoCreateE2EServiceInstance.class)
 
  89         String Prefix="DCRESI_"
 
  90         ExceptionUtil exceptionUtil = new ExceptionUtil()
 
  91         JsonUtils jsonUtil = new JsonUtils()
 
  93         public void preProcessRequest (DelegateExecution execution) {
 
  95                 logger.trace("preProcessRequest ")
 
  98                         execution.setVariable("prefix", Prefix)
 
 100                         //requestDetails.subscriberInfo. for AAI GET & PUT & SDNC assignToplology
 
 101                         String globalSubscriberId = execution.getVariable("globalSubscriberId") //globalCustomerId
 
 102                         logger.info(" ***** globalSubscriberId *****" + globalSubscriberId)
 
 103                         //requestDetails.requestParameters. for AAI PUT & SDNC assignTopology
 
 104                         String serviceType = execution.getVariable("serviceType")
 
 105                         logger.info(" ***** serviceType *****" + serviceType)
 
 106                         //requestDetails.requestParameters. for SDNC assignTopology
 
 107                         String productFamilyId = execution.getVariable("productFamilyId") //AAI productFamilyId
 
 109                         if (isBlank(globalSubscriberId)) {
 
 110                                 msg = "Input globalSubscriberId is null"
 
 112                                 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
 
 115                         if (isBlank(serviceType)) {
 
 116                                 msg = "Input serviceType is null"
 
 118                                 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
 
 121                         if (productFamilyId == null) {
 
 122                                 execution.setVariable("productFamilyId", "")
 
 125                         String sdncCallbackUrl = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback", execution)
 
 126                         if (isBlank(sdncCallbackUrl)) {
 
 127                                 msg = "URN_mso_workflow_sdncadapter_callback is null"
 
 129                                 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
 
 131                         execution.setVariable("sdncCallbackUrl", sdncCallbackUrl)
 
 132                         logger.info("SDNC Callback URL: " + sdncCallbackUrl)
 
 134                         //requestDetails.modelInfo.for AAI PUT servieInstanceData
 
 135                         //requestDetails.requestInfo. for AAI GET/PUT serviceInstanceData
 
 136                         String serviceInstanceName = execution.getVariable("serviceInstanceName")
 
 137                         String serviceInstanceId = execution.getVariable("serviceInstanceId")
 
 138                         String uuiRequest = execution.getVariable("uuiRequest")
 
 139                         String modelInvariantUuid = jsonUtil.getJsonValue(uuiRequest, "service.serviceInvariantUuid")
 
 140                         String modelUuid = jsonUtil.getJsonValue(uuiRequest, "service.serviceUuid")
 
 141                         String serviceModelName = jsonUtil.getJsonValue(uuiRequest, "service.parameters.templateName")
 
 142                         execution.setVariable("serviceModelName", serviceModelName)
 
 143                         //aai serviceType and Role can be setted as fixed value now.
 
 144                         String aaiServiceType = "E2E Service"
 
 145                         String aaiServiceRole = "E2E Service"
 
 147                         execution.setVariable("modelInvariantUuid", modelInvariantUuid)
 
 148                         execution.setVariable("modelUuid", modelUuid)
 
 151                         String oStatus = execution.getVariable("initialStatus") ?: ""
 
 152                         if ("TRANSPORT".equalsIgnoreCase(serviceType))
 
 157                         org.onap.aai.domain.yang.ServiceInstance si = new org.onap.aai.domain.yang.ServiceInstance()
 
 158                         si.setServiceInstanceName(serviceInstanceName)
 
 159                         si.setServiceType(aaiServiceType)
 
 160                         si.setServiceRole(aaiServiceRole)
 
 161                         si.setOrchestrationStatus(oStatus)
 
 162                         si.setModelInvariantId(modelInvariantUuid)
 
 163                         si.setModelVersionId(modelUuid)
 
 164                         si.setInputParameters(uuiRequest)
 
 165                         execution.setVariable("serviceInstanceData", si)
 
 167                 } catch (BpmnError e) {
 
 169                 } catch (Exception ex){
 
 170                         msg = "Exception in preProcessRequest " + ex.getMessage()
 
 172                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
 
 174                 logger.trace("Exit preProcessRequest ")
 
 177    public void prepareDecomposeService(DelegateExecution execution) {
 
 179             logger.trace("Inside prepareDecomposeService of create generic e2e service ")
 
 180             String modelInvariantUuid = execution.getVariable("modelInvariantUuid")
 
 181             String modelUuid = execution.getVariable("modelUuid")
 
 182             //here modelVersion is not set, we use modelUuid to decompose the service.
 
 183             String serviceModelInfo = """{
 
 184             "modelInvariantUuid":"${modelInvariantUuid}",
 
 185             "modelUuid":"${modelUuid}",
 
 188             execution.setVariable("serviceModelInfo", serviceModelInfo)
 
 190             logger.trace("Completed prepareDecomposeService of  create generic e2e service ")
 
 191         } catch (Exception ex) {
 
 192             // try error in method block
 
 193             String exceptionMessage = "Bpmn error encountered in  create generic e2e service flow. Unexpected Error from method prepareDecomposeService() - " + ex.getMessage()
 
 194             exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
 
 198     public void processDecomposition(DelegateExecution execution) {
 
 199         logger.trace("Inside processDecomposition() of  create generic e2e service flow ")
 
 201             ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
 
 202         } catch (Exception ex) {
 
 203             String exceptionMessage = "Bpmn error encountered in  create generic e2e service flow. processDecomposition() - " + ex.getMessage()
 
 204             logger.debug(exceptionMessage)
 
 205             exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
 
 209     public void doServicePreOperation(DelegateExecution execution){
 
 210        //we need a service plugin platform here.
 
 211         ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
 
 212         String uuiRequest = execution.getVariable("uuiRequest")
 
 213         String newUuiRequest = ServicePluginFactory.getInstance().preProcessService(serviceDecomposition, uuiRequest)
 
 214         execution.setVariable("uuiRequest", newUuiRequest)
 
 217     public void doServiceHoming(DelegateExecution execution) {
 
 218         //we need a service plugin platform here.
 
 219         ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
 
 220         String uuiRequest = execution.getVariable("uuiRequest")
 
 221         String newUuiRequest = ServicePluginFactory.getInstance().doServiceHoming(serviceDecomposition, uuiRequest)
 
 222         execution.setVariable("uuiRequest", newUuiRequest)
 
 225         public void postProcessAAIGET(DelegateExecution execution) {
 
 226                 logger.trace("postProcessAAIGET ")
 
 230                         String serviceInstanceName = execution.getVariable("serviceInstanceName")
 
 231                         boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator")
 
 233                                 logger.info("Error getting Service-instance from AAI", + serviceInstanceName)
 
 234                                 WorkflowException workflowException = execution.getVariable("WorkflowException")
 
 235                                 logger.debug("workflowException: " + workflowException)
 
 236                                 if(workflowException != null){
 
 237                                         exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage())
 
 241                                         msg = "Failure in postProcessAAIGET GENGS_SuccessIndicator:" + succInAAI
 
 243                                         exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
 
 248                                 boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator")
 
 250                                         logger.info("Found Service-instance in AAI")
 
 251                                         msg = "ServiceInstance already exists in AAI:" + serviceInstanceName
 
 253                                         exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
 
 256                 } catch (BpmnError e) {
 
 258                 } catch (Exception ex) {
 
 259                         msg = "Exception in DoCreateServiceInstance.postProcessAAIGET. " + ex.getMessage()
 
 261                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
 
 263                 logger.trace("Exit postProcessAAIGET ")
 
 266         //TODO use create if not exist
 
 267         public void createServiceInstance(DelegateExecution execution) {
 
 268                 logger.trace("createServiceInstance ")
 
 270                 String serviceInstanceId = execution.getVariable("serviceInstanceId")
 
 272                         org.onap.aai.domain.yang.ServiceInstance si = execution.getVariable("serviceInstanceData")
 
 274                         AAIResourcesClient client = new AAIResourcesClient()
 
 275                         AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, execution.getVariable("globalSubscriberId"), execution.getVariable("serviceType"), serviceInstanceId)
 
 276                         client.create(uri, si)
 
 278                 } catch (BpmnError e) {
 
 280                 } catch (Exception ex) {
 
 281                         //start rollback set up
 
 282                         RollbackData rollbackData = new RollbackData()
 
 283                         def disableRollback = execution.getVariable("disableRollback")
 
 284                         rollbackData.put("SERVICEINSTANCE", "disableRollback", disableRollback.toString())
 
 285                         rollbackData.put("SERVICEINSTANCE", "rollbackAAI", "true")
 
 286                         rollbackData.put("SERVICEINSTANCE", "serviceInstanceId", serviceInstanceId)
 
 287                         rollbackData.put("SERVICEINSTANCE", "subscriptionServiceType", execution.getVariable("subscriptionServiceType"))
 
 288                         rollbackData.put("SERVICEINSTANCE", "globalSubscriberId", execution.getVariable("globalSubscriberId"))
 
 289                         execution.setVariable("rollbackData", rollbackData)
 
 291                         msg = "Exception in DoCreateServiceInstance.createServiceInstance. " + ex.getMessage()
 
 293                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
 
 295                 logger.trace("Exit createServiceInstance ")
 
 298         public void createCustomRelationship(DelegateExecution execution) {
 
 299                 logger.trace("createCustomRelationship ")
 
 302                         String uuiRequest = execution.getVariable("uuiRequest")
 
 303                         String  vpnName =  isNeedProcessCustomRelationship(uuiRequest)
 
 306                                 logger.debug("fetching resource-link information for the given sotnVpnName:"+vpnName)
 
 307                                 // fetch the service instance to link the relationship
 
 308                                 AAIResourcesClient client = new AAIResourcesClient()
 
 309                                 AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.NODES_QUERY).queryParam("search-node-type","service-instance").queryParam("filter","service-instance-name:EQUALS:"+vpnName)
 
 310                                 AAIResultWrapper aaiResult = client.get(uri,NotFoundException.class)
 
 311                                 Map<String, Object> result = aaiResult.asMap()
 
 312                                 List<Object> resources =
 
 313                                                 (List<Object>) result.getOrDefault("result-data", Collections.emptyList())
 
 314                                 if(resources.size()>0) {
 
 315                                         String relationshipUrl = ((Map<String, Object>) resources.get(0)).get("resource-link")
 
 317                                         final Relationship body = new Relationship()
 
 318                                         body.setRelatedLink(relationshipUrl)
 
 320                                         createRelationShipInAAI(execution, body)
 
 322                                         logger.warn("No resource-link found for the given sotnVpnName:"+vpnName)
 
 326                                 logger.error("VPNName not found in request input")
 
 331                 } catch (BpmnError e) {
 
 333                 } catch (Exception ex) {
 
 335                         msg = "Exception in DoCreateE2EServiceInstance.createCustomRelationship. " + ex.getMessage()
 
 337                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
 
 339                 logger.trace("Exit createCustomRelationship ")
 
 342         private void createRelationShipInAAI(DelegateExecution execution, final Relationship relationship){
 
 343                 logger.trace("createRelationShipInAAI ")
 
 346                         String serviceInstanceId = execution.getVariable("serviceInstanceId")
 
 347                         AAIResourcesClient client = new AAIResourcesClient()
 
 348                         AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, execution.getVariable("globalSubscriberId"), execution.getVariable("serviceType"), serviceInstanceId).relationshipAPI()
 
 349                         client.create(uri, relationship)
 
 351                 } catch (BpmnError e) {
 
 353                 } catch (Exception ex) {
 
 355                         msg = "Exception in DoCreateE2EServiceInstance.createRelationShipInAAI. " + ex.getMessage()
 
 357                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
 
 359                 logger.trace("Exit createRelationShipInAAI ")
 
 363         private String isNeedProcessCustomRelationship(String uuiRequest) {
 
 364                 String requestInput = jsonUtil.getJsonValue(uuiRequest, "service.parameters.requestInputs")
 
 365                 Map<String, String> requestInputObject = getJsonObject(requestInput, Map.class)
 
 366                 if (requestInputObject == null) {
 
 370                 Optional<Map.Entry> firstKey =
 
 371                 requestInputObject.entrySet()
 
 373                                 .filter({entry -> entry.getKey().toString().contains("_sotnVpnName")})
 
 375                 if (firstKey.isPresent()) {
 
 376                         return firstKey.get().getValue()
 
 382         private static <T> T getJsonObject(String jsonstr, Class<T> type) {
 
 383                 ObjectMapper mapper = new ObjectMapper()
 
 384                 mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true)
 
 386                         return mapper.readValue(jsonstr, type)
 
 387                 } catch (IOException e) {
 
 388                         logger.error("{} {} fail to unMarshal json", MessageEnum.RA_NS_EXC.toString(),
 
 389                                         ErrorCode.BusinessProcessError.getValue(), e)
 
 396          * Gets the service instance and its relationships from aai
 
 398         public void getServiceInstance(DelegateExecution execution) {
 
 400                         String serviceInstanceId = execution.getVariable('serviceInstanceId')
 
 401                         String globalSubscriberId = execution.getVariable('globalSubscriberId')
 
 402                         String serviceType = execution.getVariable('subscriptionServiceType')
 
 404                         AAIResourcesClient resourceClient = new AAIResourcesClient()
 
 405                         AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId, serviceType, serviceInstanceId)
 
 406                         AAIResultWrapper wrapper = resourceClient.get(serviceInstanceUri, NotFoundException.class)
 
 408                         Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class)
 
 409                         execution.setVariable("serviceInstanceName", si.get().getServiceInstanceName())
 
 411                 }catch(BpmnError e) {
 
 413                 }catch(Exception ex) {
 
 414                         String msg = "Internal Error in getServiceInstance: " + ex.getMessage()
 
 415                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
 
 419         public void postProcessAAIGET2(DelegateExecution execution) {
 
 420                 logger.trace("postProcessAAIGET2 ")
 
 424                         String serviceInstanceName = execution.getVariable("serviceInstanceName")
 
 425                         boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator")
 
 427                                 logger.info("Error getting Service-instance from AAI in postProcessAAIGET2", + serviceInstanceName)
 
 428                                 WorkflowException workflowException = execution.getVariable("WorkflowException")
 
 429                                 logger.debug("workflowException: " + workflowException)
 
 430                                 if(workflowException != null){
 
 431                                         exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage())
 
 435                                         msg = "Failure in postProcessAAIGET2 GENGS_SuccessIndicator:" + succInAAI
 
 437                                         exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
 
 442                                 boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator")
 
 444                                         String aaiService = execution.getVariable("GENGS_service")
 
 445                                         if (!isBlank(aaiService) && (utils.nodeExists(aaiService, "service-instance-name"))) {
 
 446                                                 execution.setVariable("serviceInstanceName",  utils.getNodeText(aaiService, "service-instance-name"))
 
 447                                                 logger.info("Found Service-instance in AAI.serviceInstanceName:" + execution.getVariable("serviceInstanceName"))
 
 451                 } catch (BpmnError e) {
 
 453                 } catch (Exception ex) {
 
 454                         msg = "Exception in DoCreateServiceInstance.postProcessAAIGET2 " + ex.getMessage()
 
 456                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
 
 458                 logger.trace("Exit postProcessAAIGET2 ")
 
 461         public void preProcessRollback (DelegateExecution execution) {
 
 462                 logger.trace("preProcessRollback ")
 
 465                         Object workflowException = execution.getVariable("WorkflowException")
 
 467                         if (workflowException instanceof WorkflowException) {
 
 468                                 logger.info("Prev workflowException: " + workflowException.getErrorMessage())
 
 469                                 execution.setVariable("prevWorkflowException", workflowException)
 
 470                                 //execution.setVariable("WorkflowException", null)
 
 472                 } catch (BpmnError e) {
 
 473                         logger.info("BPMN Error during preProcessRollback")
 
 474                 } catch(Exception ex) {
 
 475                         String msg = "Exception in preProcessRollback. " + ex.getMessage()
 
 478                 logger.trace("Exit preProcessRollback ")
 
 481         public void postProcessRollback (DelegateExecution execution) {
 
 482                 logger.trace("postProcessRollback ")
 
 485                         Object workflowException = execution.getVariable("prevWorkflowException")
 
 486                         if (workflowException instanceof WorkflowException) {
 
 487                                 logger.info("Setting prevException to WorkflowException: ")
 
 488                                 execution.setVariable("WorkflowException", workflowException)
 
 490                         execution.setVariable("rollbackData", null)
 
 491                 } catch (BpmnError b) {
 
 492                         logger.info("BPMN Error during postProcessRollback")
 
 494                 } catch(Exception ex) {
 
 495                         msg = "Exception in postProcessRollback. " + ex.getMessage()
 
 498                 logger.trace("Exit postProcessRollback ")
 
 501         public void preInitResourcesOperStatus(DelegateExecution execution){
 
 502         logger.trace("STARTED preInitResourcesOperStatus Process ")
 
 504             String serviceId = execution.getVariable("serviceInstanceId")
 
 505             String operationId = execution.getVariable("operationId")
 
 506             String operationType = execution.getVariable("operationType")
 
 507             String resourceTemplateUUIDs = ""
 
 508             String result = "processing"
 
 509             String progress = "0"
 
 511             String operationContent = "Prepare service creation"
 
 512             logger.info("Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId + " operationType:" + operationType)
 
 513             serviceId = UriUtils.encode(serviceId,"UTF-8")
 
 514             execution.setVariable("serviceInstanceId", serviceId)
 
 515             execution.setVariable("operationId", operationId)
 
 516             execution.setVariable("operationType", operationType)
 
 517             ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
 
 518             List<Resource>  resourceList = serviceDecomposition.getServiceResources()
 
 520             for(Resource resource : resourceList){
 
 521                     resourceTemplateUUIDs  = resourceTemplateUUIDs + resource.getModelInfo().getModelCustomizationUuid() + ":"
 
 524             def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.db.endpoint")
 
 525             execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint)
 
 526             logger.info("DB Adapter Endpoint is: " + dbAdapterEndpoint)
 
 529                 """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
 
 530                         xmlns:ns="http://org.onap.so/requestsdb">
 
 533                             <ns:initResourceOperationStatus xmlns:ns="http://org.onap.so/requestsdb">
 
 534                                                                 <serviceId>${MsoUtils.xmlEscape(serviceId)}</serviceId>
 
 535                                                                 <operationId>${MsoUtils.xmlEscape(operationId)}</operationId>
 
 536                                                                 <operationType>${MsoUtils.xmlEscape(operationType)}</operationType>
 
 537                                                                 <resourceTemplateUUIDs>${MsoUtils.xmlEscape(resourceTemplateUUIDs)}</resourceTemplateUUIDs>
 
 538                             </ns:initResourceOperationStatus>
 
 540                         </soapenv:Envelope>"""
 
 542             payload = utils.formatXml(payload)
 
 543             execution.setVariable("CVFMI_initResOperStatusRequest", payload)
 
 544             logger.info("Outgoing initResourceOperationStatus: \n" + payload)
 
 545             logger.debug("CreateVfModuleInfra Outgoing initResourceOperationStatus Request: " + payload)
 
 548             logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
 
 549                                         "Exception Occured Processing preInitResourcesOperStatus.", "BPMN",
 
 550                                         ErrorCode.UnknownError.getValue(), e)
 
 551             execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preInitResourcesOperStatus Method:\n" + e.getMessage())
 
 553         logger.trace("COMPLETED preInitResourcesOperStatus Process ")
 
 556         // if site location is in local Operator, create all resources in local ONAP
 
 557         // if site location is in 3rd Operator, only process sp-partner to create all resources in 3rd ONAP
 
 558         public void doProcessSiteLocation(DelegateExecution execution){
 
 559                 logger.trace("======== Start doProcessSiteLocation Process ======== ")
 
 560                 ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
 
 561                 String uuiRequest = execution.getVariable("uuiRequest")
 
 562                 uuiRequest = ServicePluginFactory.getInstance().doProcessSiteLocation(serviceDecomposition, uuiRequest)
 
 563                 execution.setVariable("uuiRequest", uuiRequest)
 
 564                 execution.setVariable("serviceDecomposition", serviceDecomposition)
 
 566                 logger.trace("======== COMPLETED doProcessSiteLocation Process ======== ")
 
 569         // Allocate cross link TPs(terminal points) for sotn network only
 
 570         public void doTPResourcesAllocation(DelegateExecution execution){
 
 571                 logger.trace("======== Start doTPResourcesAllocation Process ======== ")
 
 572                 ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
 
 573                 String uuiRequest = execution.getVariable("uuiRequest")
 
 574                 uuiRequest = ServicePluginFactory.getInstance().doTPResourcesAllocation(execution, uuiRequest)
 
 575                 execution.setVariable("uuiRequest", uuiRequest)
 
 576                 logger.trace("======== COMPLETED doTPResourcesAllocation Process ======== ")
 
 579         // prepare input param for using DoCreateResources.bpmn
 
 580         public void preProcessForAddResource(DelegateExecution execution) {
 
 581                 logger.trace("STARTED preProcessForAddResource Process ")
 
 583                 ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
 
 584                 List<Resource> addResourceList = serviceDecomposition.getServiceResources()
 
 585                 execution.setVariable("addResourceList", addResourceList)
 
 587                 boolean isCreateResourceListValid = true
 
 588                 if (addResourceList == null || addResourceList.isEmpty()) {
 
 589                         isCreateResourceListValid = false
 
 592                 execution.setVariable("isCreateResourceListValid", isCreateResourceListValid)
 
 594                 logger.trace("COMPLETED preProcessForAddResource Process ")
 
 597         public void postProcessForAddResource(DelegateExecution execution) {