2  * ============LICENSE_START=======================================================
 
   4  * ================================================================================
 
   5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
 
   6  * ================================================================================
 
   7  * Modifications Copyright (c) 2019 Samsung
 
   8  * ================================================================================
 
   9  * Licensed under the Apache License, Version 2.0 (the "License");
 
  10  * you may not use this file except in compliance with the License.
 
  11  * You may obtain a copy of the License at
 
  13  *      http://www.apache.org/licenses/LICENSE-2.0
 
  15  * Unless required by applicable law or agreed to in writing, software
 
  16  * distributed under the License is distributed on an "AS IS" BASIS,
 
  17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
  18  * See the License for the specific language governing permissions and
 
  19  * limitations under the License.
 
  20  * ============LICENSE_END=========================================================
 
  23 package org.onap.so.bpmn.vcpe.scripts
 
  25 import org.onap.so.logger.LoggingAnchor
 
  26 import org.camunda.bpm.engine.delegate.BpmnError
 
  27 import org.camunda.bpm.engine.delegate.DelegateExecution
 
  28 import org.onap.aai.domain.yang.AllottedResource
 
  29 import org.onap.so.bpmn.common.scripts.*;
 
  30 import org.onap.so.bpmn.core.RollbackData
 
  31 import org.onap.so.bpmn.core.UrnPropertiesReader
 
  32 import org.onap.so.bpmn.core.WorkflowException
 
  33 import org.onap.so.bpmn.core.json.JsonUtils
 
  34 import org.onap.so.client.aai.AAIObjectType
 
  35 import org.onap.so.client.aai.entities.uri.AAIResourceUri
 
  36 import org.onap.so.client.aai.entities.uri.AAIUriFactory
 
  37 import org.onap.logging.filter.base.ErrorCode
 
  38 import org.onap.so.logger.MessageEnum
 
  39 import org.slf4j.Logger
 
  40 import org.slf4j.LoggerFactory
 
  42 import javax.ws.rs.core.UriBuilder
 
  43 import static org.apache.commons.lang3.StringUtils.isBlank
 
  46  * This groovy class supports the <class>DoCreateAllottedResourceTXC.bpmn</class> process.
 
  51  * @param - msoRequestId
 
  52  * @param - isDEbugLogEnabled
 
  53  * @param - disableRollback
 
  54  * @param - failExists  - O
 
  55  * @param - serviceInstanceId
 
  56  * @param - globalCustomerId - O
 
  57  * @param - subscriptionServiceType - O
 
  58  * @param - parentServiceInstanceId
 
  59  * @param - allottedReourceId - O
 
  60  * @param - allottedResourceModelInfo
 
  61  * @param - allottedResourceRole
 
  62  * @param - allottedResourceType
 
  63  * @param - brgWanMacAddress
 
  66  * @param - rollbackData (localRB->null)
 
  67  * @param - rolledBack (no localRB->null, localRB F->false, localRB S->true)
 
  68  * @param - WorkflowException - O
 
  69  * @param - allottedResourceId
 
  70  * @param - allottedResourceName 
 
  72  * @param - vgmuxBearerIP 
 
  76 public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{
 
  77         private static final Logger logger = LoggerFactory.getLogger(DoCreateAllottedResourceTXC.class);
 
  79         String Prefix="DCARTXC_"
 
  80         ExceptionUtil exceptionUtil = new ExceptionUtil()
 
  81         JsonUtils jsonUtil = new JsonUtils()
 
  83         public void preProcessRequest (DelegateExecution execution) {
 
  87                 logger.trace("start preProcessRequest")
 
  90                         String msoRequestId      = execution.getVariable("msoRequestId")
 
  91                         logger.debug(" msoRequestId  = " + msoRequestId)
 
  93                         execution.setVariable("prefix", Prefix)
 
  96                         String sdncCallbackUrl = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution)
 
  97                         if (isBlank(sdncCallbackUrl)) {
 
  98                                 msg = "mso.workflow.sdncadapter.callback is null"
 
 100                                 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
 
 102                         execution.setVariable("sdncCallbackUrl", sdncCallbackUrl)
 
 103                         logger.debug("SDNC Callback URL: " + sdncCallbackUrl)
 
 105                         String sdncReplDelay = UrnPropertiesReader.getVariable("mso.workflow.sdnc.replication.delay",execution)
 
 106                         if (isBlank(sdncReplDelay)) {
 
 107                                 msg = "mso.workflow.sdnc.replication.delay is null"
 
 109                                 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
 
 111                         execution.setVariable("sdncReplDelay", sdncReplDelay)
 
 112                         logger.debug("SDNC replication delay: " + sdncReplDelay)
 
 115                         if (isBlank(execution.getVariable("serviceInstanceId"))){
 
 116                                 msg = "Input serviceInstanceId is null"
 
 118                                 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
 
 120                         if (isBlank(execution.getVariable("parentServiceInstanceId"))) {
 
 121                                 msg = "Input parentServiceInstanceId is null"
 
 123                                 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
 
 125                         if (isBlank(execution.getVariable("allottedResourceModelInfo"))) {
 
 126                                 msg = "Input allottedResourceModelInfo is null"
 
 128                                 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
 
 130                         if (isBlank(execution.getVariable("brgWanMacAddress"))) {
 
 131                                 msg = "Input brgWanMacAddress is null"
 
 133                                 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
 
 135                         if (isBlank(execution.getVariable("allottedResourceRole"))) {
 
 136                                 msg = "Input allottedResourceRole is null"
 
 138                                 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
 
 140                         if (isBlank(execution.getVariable("allottedResourceType"))) {
 
 141                                 msg = "Input allottedResourceType is null"
 
 143                                 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
 
 146                         logger.debug("Rethrowing MSOWorkflowException")
 
 148                 } catch (Exception ex){
 
 149                         msg = "Exception in preProcessRequest " + ex.getMessage()
 
 151                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
 
 153                 logger.trace("end preProcessRequest")
 
 156         public void getAaiAR (DelegateExecution execution) {
 
 159                 logger.trace("start getAaiAR")
 
 161                 String arType = execution.getVariable("allottedResourceType")
 
 162                 String arRole = execution.getVariable("allottedResourceRole")
 
 164                 AllottedResourceUtils arUtils = new AllottedResourceUtils(this)
 
 165                 String orchStatus = arUtils.getAROrchStatus(execution)
 
 169                 if (orchStatus != null) // AR was found
 
 171                         if ("true".equals(execution.getVariable("failExists")))
 
 173                                 errorMsg = "Allotted resource " + arType + " with Role " + arRole + " already exists"
 
 177                                 if ("Active".equals(orchStatus))
 
 179                                         execution.setVariable("foundActiveAR", true)
 
 181                                 else // blanks included
 
 183                                         errorMsg = "Allotted Resource " + arType + " with Role " + arRole + " already exists in an incomplete state -"  +  orchStatus
 
 187                 if (!isBlank(errorMsg)) {
 
 188                         logger.debug(errorMsg)
 
 189                         exceptionUtil.buildAndThrowWorkflowException(execution, 500, errorMsg)
 
 191                 logger.trace("end getAaiAR")
 
 194         public void createAaiAR(DelegateExecution execution) {
 
 197                 logger.trace("start createAaiAR")
 
 199                 String allottedResourceId = execution.getVariable("allottedResourceId")
 
 200                 if (isBlank(allottedResourceId))
 
 202                         allottedResourceId = UUID.randomUUID().toString()
 
 203                         execution.setVariable("allottedResourceId", allottedResourceId)
 
 207                         AAIResourceUri siResourceLink= execution.getVariable("PSI_resourceLink")
 
 209                         AAIResourceUri allottedResourceUri = AAIUriFactory.createResourceFromParentURI(siResourceLink, AAIObjectType.ALLOTTED_RESOURCE, allottedResourceId)
 
 211                         execution.setVariable("aaiARPath", allottedResourceUri.build().toString());
 
 212                         String arType = execution.getVariable("allottedResourceType")
 
 213                         String arRole = execution.getVariable("allottedResourceRole")
 
 214                         String CSI_resourceLink = execution.getVariable("CSI_resourceLink")
 
 215                         String arModelInfo = execution.getVariable("allottedResourceModelInfo")
 
 216                         logger.debug("arModelInfo is:\n" + arModelInfo)
 
 217                         String modelInvariantId = jsonUtil.getJsonValue(arModelInfo, "modelInvariantUuid")
 
 218                         String modelVersionId = jsonUtil.getJsonValue(arModelInfo, "modelUuid")
 
 220                         AllottedResource resource = new AllottedResource()
 
 221                         resource.setId(allottedResourceId)
 
 222                         resource.setType(arType)
 
 223                         resource.setRole(arRole)
 
 224                         resource.setModelInvariantId(modelInvariantId)
 
 225                         resource.setModelVersionId(modelVersionId)
 
 226                         getAAIClient().create(allottedResourceUri, resource)
 
 227                         AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceFromExistingURI(AAIObjectType.SERVICE_INSTANCE, UriBuilder.fromPath(CSI_resourceLink).build())
 
 228                         getAAIClient().connect(allottedResourceUri,serviceInstanceUri)
 
 230                 }catch (Exception ex) {
 
 231                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Exception in createAaiAR " + ex.getMessage())
 
 234                 //start rollback set up
 
 235                 RollbackData rollbackData = new RollbackData()
 
 236                 def disableRollback = execution.getVariable("disableRollback")
 
 237                 rollbackData.put(Prefix, "disableRollback", disableRollback.toString())
 
 238                 rollbackData.put(Prefix, "rollbackAAI", "true")
 
 239                 rollbackData.put(Prefix, "allottedResourceId", allottedResourceId)
 
 240                 rollbackData.put(Prefix, "serviceInstanceId", execution.getVariable("serviceInstanceId"))
 
 241                 rollbackData.put(Prefix, "parentServiceInstanceId", execution.getVariable("parentServiceInstanceId"))
 
 242                 execution.setVariable("rollbackData", rollbackData)
 
 243                 logger.trace("end createAaiAR")
 
 246         public String buildSDNCRequest(DelegateExecution execution, String action, String sdncRequestId) {
 
 250                 logger.trace("start buildSDNCRequest")
 
 251                 String sdncReq = null
 
 255                         String allottedResourceId = execution.getVariable("allottedResourceId")
 
 256                         String serviceInstanceId = execution.getVariable("serviceInstanceId")
 
 257                         String globalCustomerId = execution.getVariable("globalCustomerId")
 
 258                         String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
 
 259                         String parentServiceInstanceId = execution.getVariable("parentServiceInstanceId")
 
 260                         String serviceChainServiceInstanceId = execution.getVariable("serviceChainServiceInstanceId")
 
 261                         String callbackUrl = execution.getVariable("sdncCallbackUrl")
 
 262                         String requestId = execution.getVariable("msoRequestId")
 
 264                         String brgWanMacAddress = execution.getVariable("brgWanMacAddress")
 
 266                         String arModelInfo = execution.getVariable("allottedResourceModelInfo")
 
 267                         String modelInvariantId = jsonUtil.getJsonValue(arModelInfo, "modelInvariantUuid")
 
 268                         String modelVersion = jsonUtil.getJsonValue(arModelInfo, "modelVersion")
 
 269                         String modelUUId = jsonUtil.getJsonValue(arModelInfo, "modelUuid")
 
 270                         String modelCustomizationId = jsonUtil.getJsonValue(arModelInfo, "modelCustomizationUuid")
 
 271                         String modelName = jsonUtil.getJsonValue(arModelInfo, "modelName")
 
 273                         if (modelInvariantId == null) {
 
 274                                 modelInvariantId = ""
 
 276                         if (modelVersion == null) {
 
 279                         if (modelUUId == null) {
 
 282                         if (modelName == null) {
 
 285                         if (modelCustomizationId == null) {
 
 286                                 modelCustomizationId = ""
 
 290                         """<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.onap/so/request/types/v1"
 
 291                                                                                                         xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"
 
 292                                                                                                         xmlns:sdncadapter="http://org.onap/workflow/sdnc/adapter/schema/v1">
 
 293                                    <sdncadapter:RequestHeader>
 
 294                                                         <sdncadapter:RequestId>${MsoUtils.xmlEscape(sdncRequestId)}</sdncadapter:RequestId>
 
 295                                                         <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId>
 
 296                                                         <sdncadapter:SvcAction>${MsoUtils.xmlEscape(action)}</sdncadapter:SvcAction>
 
 297                                                         <sdncadapter:SvcOperation>tunnelxconn-topology-operation</sdncadapter:SvcOperation>
 
 298                                                         <sdncadapter:CallbackUrl>${MsoUtils.xmlEscape(callbackUrl)}</sdncadapter:CallbackUrl>
 
 299                                         </sdncadapter:RequestHeader>
 
 300                                 <sdncadapterworkflow:SDNCRequestData>
 
 301                                         <request-information>
 
 302                                                 <request-id>${MsoUtils.xmlEscape(requestId)}</request-id>
 
 303                                                 <request-action>CreateTunnelXConnInstance</request-action>
 
 308                                         </request-information>
 
 309                                         <service-information>
 
 310                                                 <service-id></service-id>
 
 311                                                 <subscription-service-type>${MsoUtils.xmlEscape(subscriptionServiceType)}</subscription-service-type>
 
 312                                                 <onap-model-information></onap-model-information>
 
 313                                                 <service-instance-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-instance-id>
 
 315                                                 <global-customer-id>${MsoUtils.xmlEscape(globalCustomerId)}</global-customer-id>
 
 316                                         </service-information>
 
 317                                         <allotted-resource-information>
 
 318                                                 <allotted-resource-id>${MsoUtils.xmlEscape(allottedResourceId)}</allotted-resource-id>    
 
 319                                                 <allotted-resource-type>tunnelxconn</allotted-resource-type>
 
 320                                                 <parent-service-instance-id>${MsoUtils.xmlEscape(parentServiceInstanceId)}</parent-service-instance-id>   
 
 321                                                 <onap-model-information>
 
 322                                                         <model-invariant-uuid>${MsoUtils.xmlEscape(modelInvariantId)}</model-invariant-uuid>
 
 323                                                         <model-uuid>${MsoUtils.xmlEscape(modelUUId)}</model-uuid>
 
 324                                                         <model-customization-uuid>${MsoUtils.xmlEscape(modelCustomizationId)}</model-customization-uuid>
 
 325                                                         <model-version>${MsoUtils.xmlEscape(modelVersion)}</model-version>
 
 326                                                         <model-name>${MsoUtils.xmlEscape(modelName)}</model-name>
 
 327                                                 </onap-model-information>
 
 328                                         </allotted-resource-information>
 
 329                                         <tunnelxconn-request-input>
 
 330                                                         <brg-wan-mac-address>${MsoUtils.xmlEscape(brgWanMacAddress)}</brg-wan-mac-address>
 
 331                                         </tunnelxconn-request-input>
 
 332                                 </sdncadapterworkflow:SDNCRequestData>
 
 333                                 </sdncadapterworkflow:SDNCAdapterWorkflowRequest>"""
 
 335                         logger.debug("sdncRequest:\n" + sdncReq)
 
 336                         sdncReq = utils.formatXml(sdncReq)
 
 338                 } catch(Exception ex) {
 
 339                         msg = "Exception in buildSDNCRequest. " + ex.getMessage()
 
 341                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
 
 343                 logger.trace("end buildSDNCRequest")
 
 347         public void preProcessSDNCAssign(DelegateExecution execution) {
 
 351                 logger.trace("start preProcessSDNCAssign")
 
 354                         String sdncRequestId = UUID.randomUUID().toString()
 
 355                         String sdncAssignReq = buildSDNCRequest(execution, "assign", sdncRequestId)
 
 356                         execution.setVariable("sdncAssignRequest", sdncAssignReq)
 
 357                         logger.debug("sdncAssignRequest:  " + sdncAssignReq)
 
 358                         def sdncRequestId2 = UUID.randomUUID().toString()
 
 359                         String sdncAssignRollbackReq = sdncAssignReq.replace(">assign<", ">unassign<").replace(">CreateTunnelXConnInstance<", ">DeleteTunnelXConnInstance<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<")
 
 360                         def rollbackData = execution.getVariable("rollbackData")
 
 361                         rollbackData.put(Prefix, "sdncAssignRollbackReq", sdncAssignRollbackReq)
 
 362                         execution.setVariable("rollbackData", rollbackData)
 
 364                         logger.debug("sdncAssignRollbackReq:\n" + sdncAssignRollbackReq)
 
 365                         logger.debug("rollbackData:\n" + rollbackData.toString())
 
 367                 } catch (BpmnError e) {
 
 369                 } catch(Exception ex) {
 
 370                         msg = "Exception in preProcessSDNCAssign. " + ex.getMessage()
 
 372                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
 
 374                 logger.debug("end preProcessSDNCAssign")
 
 377         public void preProcessSDNCCreate(DelegateExecution execution) {
 
 381                 logger.trace("start preProcessSDNCCreate")
 
 384                         String sdncRequestId = UUID.randomUUID().toString()
 
 385                         String sdncCreateReq = buildSDNCRequest(execution, "create", sdncRequestId)
 
 386                         execution.setVariable("sdncCreateRequest", sdncCreateReq)
 
 387                         logger.debug("sdncCreateReq:  " + sdncCreateReq)
 
 388                         def sdncRequestId2 = UUID.randomUUID().toString()
 
 389                         String sdncCreateRollbackReq = sdncCreateReq.replace(">create<", ">delete<").replace(">CreateTunnelXConnInstance<", ">DeleteTunnelXConnInstance<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<")
 
 390                         def rollbackData = execution.getVariable("rollbackData")
 
 391                         rollbackData.put(Prefix, "sdncCreateRollbackReq", sdncCreateRollbackReq)
 
 392                         execution.setVariable("rollbackData", rollbackData)
 
 394                         logger.debug("sdncCreateRollbackReq:\n" + sdncCreateRollbackReq)
 
 395                         logger.debug("rollbackData:\n" + rollbackData.toString())
 
 397                 } catch (BpmnError e) {
 
 399                 } catch(Exception ex) {
 
 400                         msg = "Exception in preProcessSDNCCreate. " + ex.getMessage()
 
 402                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
 
 404                 logger.trace("end preProcessSDNCCreate")
 
 407         public void preProcessSDNCActivate(DelegateExecution execution) {
 
 411                 logger.trace("start preProcessSDNCActivate")
 
 414                         String sdncRequestId = UUID.randomUUID().toString()
 
 415                         String sdncActivateReq = buildSDNCRequest(execution, "activate", sdncRequestId)
 
 416                         execution.setVariable("sdncActivateRequest", sdncActivateReq)
 
 417                         logger.debug("sdncActivateReq:  " + sdncActivateReq)
 
 418                         def sdncRequestId2 = UUID.randomUUID().toString()
 
 419                         String sdncActivateRollbackReq = sdncActivateReq.replace(">activate<", ">deactivate<").replace(">CreateTunnelXConnInstance<", ">DeleteTunnelXConnInstance<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<")
 
 420                         def rollbackData = execution.getVariable("rollbackData")
 
 421                         rollbackData.put(Prefix, "sdncActivateRollbackReq", sdncActivateRollbackReq)
 
 422                         execution.setVariable("rollbackData", rollbackData)
 
 424                         logger.debug("sdncActivateRollbackReq:\n" + sdncActivateRollbackReq)
 
 425                         logger.debug("rollbackData:\n" + rollbackData.toString())
 
 427                 } catch (BpmnError e) {
 
 429                 } catch(Exception ex) {
 
 430                         msg = "Exception in preProcessSDNCActivate. " + ex.getMessage()
 
 432                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
 
 434                 logger.trace("end preProcessSDNCActivate")
 
 437         public void validateSDNCResp(DelegateExecution execution, String response, String method){
 
 440                 logger.trace("start ValidateSDNCResponse Process")
 
 444                         WorkflowException workflowException = execution.getVariable("WorkflowException")
 
 445                         logger.debug("workflowException: " + workflowException)
 
 447                         boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator")
 
 448                         logger.debug("SDNCResponse: " + response)
 
 450                         SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils()
 
 451                         sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator)
 
 453                         if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){
 
 454                                 logger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call.  Response is: \n" + response)
 
 456                                 if (!"get".equals(method))
 
 458                                         def rollbackData = execution.getVariable("rollbackData")
 
 459                                         rollbackData.put(Prefix, "rollback" +  "SDNC" + method, "true")
 
 460                                         execution.setVariable("rollbackData", rollbackData)
 
 464                                 logger.debug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.")
 
 465                                 throw new BpmnError("MSOWorkflowException")
 
 467                 } catch (BpmnError e) {
 
 469                 } catch(Exception ex) {
 
 470                         msg = "Exception in validateSDNCResp. " + ex.getMessage()
 
 472                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
 
 474                 logger.trace("end ValidateSDNCResp Process")
 
 477         public void preProcessSDNCGet(DelegateExecution execution){
 
 479                 logger.trace("start preProcessSDNCGet")
 
 482                         def callbackUrl = execution.getVariable("sdncCallbackUrl")
 
 483                         // serviceOperation (URI for topology GET) will be retrieved from "selflink" from AAI if active AR exists in AAI
 
 484                         // or from  "object-path" in SDNC response for assign when AR does not exist in AA
 
 486                         String serviceOperation = ""
 
 488                         if (execution.getVariable("foundActiveAR")) {
 
 489                                 def aaiQueryResponse = execution.getVariable("aaiARGetResponse")
 
 490                                 serviceOperation = utils.getNodeText(aaiQueryResponse, "selflink")
 
 491                                 logger.debug("AR service operation/aaiARSelfLink: " + serviceOperation)
 
 495                                 String response = execution.getVariable("sdncAssignResponse")
 
 496                                 String data = utils.getNodeXml(response, "response-data")
 
 497                                 logger.debug("Assign responseData: " + data)
 
 498                                 serviceOperation = utils.getNodeText(data, "object-path")
 
 499                                 logger.debug("AR service operation:" + serviceOperation)
 
 502                         String serviceInstanceId = execution.getVariable("serviceInstanceId")
 
 503                         String sdncRequestId = UUID.randomUUID().toString()
 
 505                         //neeed the same url as used by vfmodules
 
 506                         String SDNCGetRequest =
 
 507                         """<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.onap/so/request/types/v1"
 
 508                                                                                         xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"
 
 509                                                                                         xmlns:sdncadapter="http://org.onap/workflow/sdnc/adapter/schema/v1">
 
 510                                         <sdncadapter:RequestHeader>
 
 511                                         <sdncadapter:RequestId>${MsoUtils.xmlEscape(sdncRequestId)}</sdncadapter:RequestId>
 
 512                                         <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId>
 
 513                                         <sdncadapter:SvcAction>query</sdncadapter:SvcAction>
 
 514                                         <sdncadapter:SvcOperation>${MsoUtils.xmlEscape(serviceOperation)}</sdncadapter:SvcOperation>
 
 515                                         <sdncadapter:CallbackUrl>${MsoUtils.xmlEscape(callbackUrl)}</sdncadapter:CallbackUrl>
 
 516                                         <sdncadapter:MsoAction>vfmodule</sdncadapter:MsoAction>
 
 517                                 </sdncadapter:RequestHeader>
 
 518                                         <sdncadapterworkflow:SDNCRequestData></sdncadapterworkflow:SDNCRequestData>
 
 519                                 </sdncadapterworkflow:SDNCAdapterWorkflowRequest>"""
 
 521                         execution.setVariable("sdncGetRequest", SDNCGetRequest)
 
 524                         logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
 
 525                                         "Exception Occurred Processing preProcessSDNCGetRequest.", "BPMN",
 
 526                                         ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
 
 527                         exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during SDNC GET Method:\n" + e.getMessage())
 
 529                 logger.trace("end preProcessSDNCGet")
 
 532         public void updateAaiAROrchStatus(DelegateExecution execution, String status){
 
 534                 logger.trace("start updateAaiAROrchStatus")
 
 535                 String aaiARPath = execution.getVariable("aaiARPath") //set during query (existing AR) or create
 
 536                 AllottedResourceUtils arUtils = new AllottedResourceUtils(this)
 
 537                 String orchStatus = arUtils.updateAROrchStatus(execution, status, aaiARPath)
 
 538                 logger.trace("end updateAaiAROrchStatus")
 
 541         public void generateOutputs(DelegateExecution execution)
 
 544                 logger.trace("start generateOutputs")
 
 546                         String sdncGetResponse = execution.getVariable("enhancedCallbackRequestData") //unescaped
 
 547                         logger.debug("resp:" + sdncGetResponse)
 
 548                         String arData = utils.getNodeXml(sdncGetResponse, "tunnelxconn-topology")
 
 549                         arData = utils.removeXmlNamespaces(arData)
 
 551                         String txca = utils.getNodeXml(arData, "tunnelxconn-assignments")
 
 552                         execution.setVariable("vni", utils.getNodeText(txca, "vni"))
 
 553                         execution.setVariable("vgmuxBearerIP", utils.getNodeText(txca, "vgmux-bearer-ip"))
 
 554                         execution.setVariable("vgmuxLanIP", utils.getNodeText(txca, "vgmux-lan-ip"))
 
 556                         String ari = utils.getNodeXml(arData, "allotted-resource-identifiers")
 
 557                         execution.setVariable("allotedResourceName", utils.getNodeText(ari, "allotted-resource-name"))
 
 558                 } catch (BpmnError e) {
 
 559                         logger.debug("BPMN Error in generateOutputs ")
 
 560                 } catch(Exception ex) {
 
 561                         String msg = "Exception in generateOutputs " + ex.getMessage()
 
 564                 logger.trace("end generateOutputs")
 
 568         public void preProcessRollback (DelegateExecution execution) {
 
 570                 logger.trace("start preProcessRollback")
 
 573                         Object workflowException = execution.getVariable("WorkflowException");
 
 575                         if (workflowException instanceof WorkflowException) {
 
 576                                 logger.debug("Prev workflowException: " + workflowException.getErrorMessage())
 
 577                                 execution.setVariable("prevWorkflowException", workflowException);
 
 578                                 //execution.setVariable("WorkflowException", null);
 
 580                 } catch (BpmnError e) {
 
 581                         logger.debug("BPMN Error during preProcessRollback")
 
 582                 } catch(Exception ex) {
 
 583                         String msg = "Exception in preProcessRollback. " + ex.getMessage()
 
 586                 logger.trace("end preProcessRollback")
 
 589         public void postProcessRollback (DelegateExecution execution) {
 
 591                 logger.trace("start postProcessRollback")
 
 594                         Object workflowException = execution.getVariable("prevWorkflowException");
 
 595                         if (workflowException instanceof WorkflowException) {
 
 596                                 logger.debug("Setting prevException to WorkflowException: ")
 
 597                                 execution.setVariable("WorkflowException", workflowException);
 
 599                         execution.setVariable("rollbackData", null)
 
 600                 } catch (BpmnError b) {
 
 601                         logger.debug("BPMN Error during postProcessRollback")
 
 603                 } catch(Exception ex) {
 
 604                         msg = "Exception in postProcessRollback. " + ex.getMessage()
 
 607                 logger.trace("end postProcessRollback")