2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.onap.so.bpmn.vcpe.scripts;
23 import org.onap.so.bpmn.common.scripts.*;
24 import org.onap.so.bpmn.common.scripts.AaiUtil
25 import org.onap.so.bpmn.core.RollbackData
26 import org.onap.so.bpmn.core.WorkflowException
27 import org.onap.so.bpmn.core.UrnPropertiesReader
28 import org.onap.so.bpmn.core.json.JsonUtils
29 import org.onap.so.rest.APIResponse
31 import java.util.UUID;
32 import org.camunda.bpm.engine.delegate.BpmnError
33 import org.camunda.bpm.engine.delegate.DelegateExecution
34 import org.apache.commons.lang3.*
35 import org.springframework.web.util.UriUtils;
36 import static org.apache.commons.lang3.StringUtils.*
38 import org.onap.so.logger.MessageEnum
39 import org.onap.so.logger.MsoLogger
42 * This groovy class supports the <class>DoCreateAllottedResourceTXC.bpmn</class> process.
47 * @param - msoRequestId
48 * @param - isDEbugLogEnabled
49 * @param - disableRollback
50 * @param - failExists - O
51 * @param - serviceInstanceId
52 * @param - globalCustomerId - O
53 * @param - subscriptionServiceType - O
54 * @param - parentServiceInstanceId
55 * @param - allottedReourceId - O
56 * @param - allottedResourceModelInfo
57 * @param - allottedResourceRole
58 * @param - allottedResourceType
59 * @param - brgWanMacAddress
62 * @param - rollbackData (localRB->null)
63 * @param - rolledBack (no localRB->null, localRB F->false, localRB S->true)
64 * @param - WorkflowException - O
65 * @param - allottedResourceId
66 * @param - allottedResourceName
68 * @param - vgmuxBearerIP
72 public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{
73 private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCreateAllottedResourceTXC.class);
75 String Prefix="DCARTXC_"
76 ExceptionUtil exceptionUtil = new ExceptionUtil()
77 JsonUtils jsonUtil = new JsonUtils()
79 public void preProcessRequest (DelegateExecution execution) {
83 msoLogger.trace("start preProcessRequest")
86 String msoRequestId = execution.getVariable("msoRequestId")
87 msoLogger.debug(" msoRequestId = " + msoRequestId)
89 execution.setVariable("prefix", Prefix)
92 String sdncCallbackUrl = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution)
93 if (isBlank(sdncCallbackUrl)) {
94 msg = "mso.workflow.sdncadapter.callback is null"
96 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
98 execution.setVariable("sdncCallbackUrl", sdncCallbackUrl)
99 msoLogger.debug("SDNC Callback URL: " + sdncCallbackUrl)
101 String sdncReplDelay = UrnPropertiesReader.getVariable("mso.workflow.sdnc.replication.delay",execution)
102 if (isBlank(sdncReplDelay)) {
103 msg = "mso.workflow.sdnc.replication.delay is null"
105 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
107 execution.setVariable("sdncReplDelay", sdncReplDelay)
108 msoLogger.debug("SDNC replication delay: " + sdncReplDelay)
111 if (isBlank(execution.getVariable("serviceInstanceId"))){
112 msg = "Input serviceInstanceId is null"
114 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
116 if (isBlank(execution.getVariable("parentServiceInstanceId"))) {
117 msg = "Input parentServiceInstanceId is null"
119 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
121 if (isBlank(execution.getVariable("allottedResourceModelInfo"))) {
122 msg = "Input allottedResourceModelInfo is null"
124 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
126 if (isBlank(execution.getVariable("brgWanMacAddress"))) {
127 msg = "Input brgWanMacAddress is null"
129 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
131 if (isBlank(execution.getVariable("allottedResourceRole"))) {
132 msg = "Input allottedResourceRole is null"
134 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
136 if (isBlank(execution.getVariable("allottedResourceType"))) {
137 msg = "Input allottedResourceType is null"
139 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
142 msoLogger.debug("Rethrowing MSOWorkflowException")
144 } catch (Exception ex){
145 msg = "Exception in preProcessRequest " + ex.getMessage()
147 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
149 msoLogger.trace("end preProcessRequest")
152 public void getAaiAR (DelegateExecution execution) {
155 msoLogger.trace("start getAaiAR")
157 String arType = execution.getVariable("allottedResourceType")
158 String arRole = execution.getVariable("allottedResourceRole")
160 AllottedResourceUtils arUtils = new AllottedResourceUtils(this)
161 String orchStatus = arUtils.getAROrchStatus(execution)
165 if (orchStatus != null) // AR was found
167 if ("true".equals(execution.getVariable("failExists")))
169 errorMsg = "Allotted resource " + arType + " with Role " + arRole + " already exists"
173 if ("Active".equals(orchStatus))
175 execution.setVariable("foundActiveAR", true)
177 else // blanks included
179 errorMsg = "Allotted Resource " + arType + " with Role " + arRole + " already exists in an incomplete state -" + orchStatus
183 if (!isBlank(errorMsg)) {
184 msoLogger.debug(errorMsg)
185 exceptionUtil.buildAndThrowWorkflowException(execution, 500, errorMsg)
187 msoLogger.trace("end getAaiAR")
190 public void createAaiAR(DelegateExecution execution) {
193 msoLogger.trace("start createAaiAR")
196 String allottedResourceId = execution.getVariable("allottedResourceId")
197 if (isBlank(allottedResourceId))
199 allottedResourceId = UUID.randomUUID().toString()
200 execution.setVariable("allottedResourceId", allottedResourceId)
206 AaiUtil aaiUriUtil = new AaiUtil(this)
207 String aaiEndpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution)
208 String siResourceLink= execution.getVariable("PSI_resourceLink")
211 msoLogger.debug("PSI_resourceLink:" + siResourceLink)
213 if(!isBlank(siResourceLink)) {
214 msoLogger.debug("Incoming PSI Resource Link is: " + siResourceLink)
215 String[] split = siResourceLink.split("/aai/")
216 siUri = "/aai/" + split[1]
220 msg = "Parent Service Link in AAI is null"
222 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
225 arUrl = "${aaiEndpoint}${siUri}" + "/allotted-resources/allotted-resource/" + UriUtils.encode(allottedResourceId,"UTF-8")
226 execution.setVariable("aaiARPath", arUrl)
227 msoLogger.debug("GET AllottedResource AAI URL is:\n" + arUrl)
229 String namespace = aaiUriUtil.getNamespaceFromUri(execution, arUrl)
231 String arType = execution.getVariable("allottedResourceType")
232 String arRole = execution.getVariable("allottedResourceRole")
233 String CSI_resourceLink = execution.getVariable("CSI_resourceLink")
234 String arModelInfo = execution.getVariable("allottedResourceModelInfo")
235 msoLogger.debug("arModelInfo is:\n" + arModelInfo)
236 String modelInvariantId = jsonUtil.getJsonValue(arModelInfo, "modelInvariantUuid")
237 String modelVersionId = jsonUtil.getJsonValue(arModelInfo, "modelUuid")
238 String modelCustomizationId = jsonUtil.getJsonValue(arModelInfo, "modelCustomizationUuid")
240 if (modelInvariantId == null) {
241 modelInvariantId = ""
243 if (modelVersionId == null) {
246 if (modelCustomizationId == null) {
247 modelCustomizationId = ""
251 """<allotted-resource xmlns="${namespace}">
252 <id>${MsoUtils.xmlEscape(allottedResourceId)}</id>
253 <description></description>
254 <type>${MsoUtils.xmlEscape(arType)}</type>
255 <role>${MsoUtils.xmlEscape(arRole)}</role>
256 <selflink></selflink>
257 <model-invariant-id>${MsoUtils.xmlEscape(modelInvariantId)}</model-invariant-id>
258 <model-version-id>${MsoUtils.xmlEscape(modelVersionId)}</model-version-id>
259 <model-customization-id>${MsoUtils.xmlEscape(modelCustomizationId)}</model-customization-id>
260 <orchestration-status>PendingCreate</orchestration-status>
261 <operation-status></operation-status>
264 <related-to>service-instance</related-to>
265 <related-link>${MsoUtils.xmlEscape(CSI_resourceLink)}</related-link>
268 </allotted-resource>""".trim()
270 execution.setVariable("AaiARPayload", payload)
271 msoLogger.debug(" payload to create AllottedResource in AAI:" + "\n" + payload)
273 APIResponse response = aaiUriUtil.executeAAIPutCall(execution, arUrl, payload)
274 int responseCode = response.getStatusCode()
275 msoLogger.debug("AllottedResource AAI PUT responseCode:" + responseCode)
277 String aaiResponse = response.getResponseBodyAsString()
278 msoLogger.debug("AllottedResource AAI PUT responseStr:" + aaiResponse)
280 //200 OK 201 CREATED 202 ACCEPTED
281 if(responseCode == 200 || responseCode == 201 || responseCode == 202 )
283 msoLogger.debug("AAI PUT AllottedResource received a Good Response")
286 msoLogger.debug("AAI Put AllottedResouce received a Bad Response Code: " + responseCode)
287 exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode)
288 throw new BpmnError("MSOWorkflowException")
291 msoLogger.debug("Rethrowing MSOWorkflowException")
293 } catch (Exception ex) {
294 msg = "Exception in createAaiAR " + ex.getMessage()
296 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
299 //start rollback set up
300 RollbackData rollbackData = new RollbackData()
301 def disableRollback = execution.getVariable("disableRollback")
302 rollbackData.put(Prefix, "disableRollback", disableRollback.toString())
303 rollbackData.put(Prefix, "rollbackAAI", "true")
304 rollbackData.put(Prefix, "allottedResourceId", allottedResourceId)
305 rollbackData.put(Prefix, "serviceInstanceId", execution.getVariable("serviceInstanceId"))
306 rollbackData.put(Prefix, "parentServiceInstanceId", execution.getVariable("parentServiceInstanceId"))
307 rollbackData.put(Prefix, "aaiARPath", arUrl)
308 execution.setVariable("rollbackData", rollbackData)
309 msoLogger.trace("end createAaiAR")
312 public String buildSDNCRequest(DelegateExecution execution, String action, String sdncRequestId) {
316 msoLogger.trace("start buildSDNCRequest")
317 String sdncReq = null
321 String allottedResourceId = execution.getVariable("allottedResourceId")
322 String serviceInstanceId = execution.getVariable("serviceInstanceId")
323 String globalCustomerId = execution.getVariable("globalCustomerId")
324 String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
325 String parentServiceInstanceId = execution.getVariable("parentServiceInstanceId")
326 String serviceChainServiceInstanceId = execution.getVariable("serviceChainServiceInstanceId")
327 String callbackUrl = execution.getVariable("sdncCallbackUrl")
328 String requestId = execution.getVariable("msoRequestId")
330 String brgWanMacAddress = execution.getVariable("brgWanMacAddress")
332 String arModelInfo = execution.getVariable("allottedResourceModelInfo")
333 String modelInvariantId = jsonUtil.getJsonValue(arModelInfo, "modelInvariantUuid")
334 String modelVersion = jsonUtil.getJsonValue(arModelInfo, "modelVersion")
335 String modelUUId = jsonUtil.getJsonValue(arModelInfo, "modelUuid")
336 String modelCustomizationId = jsonUtil.getJsonValue(arModelInfo, "modelCustomizationUuid")
337 String modelName = jsonUtil.getJsonValue(arModelInfo, "modelName")
339 if (modelInvariantId == null) {
340 modelInvariantId = ""
342 if (modelVersion == null) {
345 if (modelUUId == null) {
348 if (modelName == null) {
351 if (modelCustomizationId == null) {
352 modelCustomizationId = ""
356 """<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.onap/so/request/types/v1"
357 xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"
358 xmlns:sdncadapter="http://org.onap/workflow/sdnc/adapter/schema/v1">
359 <sdncadapter:RequestHeader>
360 <sdncadapter:RequestId>${MsoUtils.xmlEscape(sdncRequestId)}</sdncadapter:RequestId>
361 <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId>
362 <sdncadapter:SvcAction>${MsoUtils.xmlEscape(action)}</sdncadapter:SvcAction>
363 <sdncadapter:SvcOperation>tunnelxconn-topology-operation</sdncadapter:SvcOperation>
364 <sdncadapter:CallbackUrl>${MsoUtils.xmlEscape(callbackUrl)}</sdncadapter:CallbackUrl>
365 </sdncadapter:RequestHeader>
366 <sdncadapterworkflow:SDNCRequestData>
367 <request-information>
368 <request-id>${MsoUtils.xmlEscape(requestId)}</request-id>
369 <request-action>CreateTunnelXConnInstance</request-action>
374 </request-information>
375 <service-information>
376 <service-id></service-id>
377 <subscription-service-type>${MsoUtils.xmlEscape(subscriptionServiceType)}</subscription-service-type>
378 <onap-model-information></onap-model-information>
379 <service-instance-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-instance-id>
381 <global-customer-id>${MsoUtils.xmlEscape(globalCustomerId)}</global-customer-id>
382 </service-information>
383 <allotted-resource-information>
384 <allotted-resource-id>${MsoUtils.xmlEscape(allottedResourceId)}</allotted-resource-id>
385 <allotted-resource-type>tunnelxconn</allotted-resource-type>
386 <parent-service-instance-id>${MsoUtils.xmlEscape(parentServiceInstanceId)}</parent-service-instance-id>
387 <onap-model-information>
388 <model-invariant-uuid>${MsoUtils.xmlEscape(modelInvariantId)}</model-invariant-uuid>
389 <model-uuid>${MsoUtils.xmlEscape(modelUUId)}</model-uuid>
390 <model-customization-uuid>${MsoUtils.xmlEscape(modelCustomizationId)}</model-customization-uuid>
391 <model-version>${MsoUtils.xmlEscape(modelVersion)}</model-version>
392 <model-name>${MsoUtils.xmlEscape(modelName)}</model-name>
393 </onap-model-information>
394 </allotted-resource-information>
395 <tunnelxconn-request-input>
396 <brg-wan-mac-address>${MsoUtils.xmlEscape(brgWanMacAddress)}</brg-wan-mac-address>
397 </tunnelxconn-request-input>
398 </sdncadapterworkflow:SDNCRequestData>
399 </sdncadapterworkflow:SDNCAdapterWorkflowRequest>"""
401 msoLogger.debug("sdncRequest:\n" + sdncReq)
402 sdncReq = utils.formatXml(sdncReq)
404 } catch(Exception ex) {
405 msg = "Exception in buildSDNCRequest. " + ex.getMessage()
407 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
409 msoLogger.trace("end buildSDNCRequest")
413 public void preProcessSDNCAssign(DelegateExecution execution) {
417 msoLogger.trace("start preProcessSDNCAssign")
420 String sdncRequestId = UUID.randomUUID().toString()
421 String sdncAssignReq = buildSDNCRequest(execution, "assign", sdncRequestId)
422 execution.setVariable("sdncAssignRequest", sdncAssignReq)
423 msoLogger.debug("sdncAssignRequest: " + sdncAssignReq)
424 def sdncRequestId2 = UUID.randomUUID().toString()
425 String sdncAssignRollbackReq = sdncAssignReq.replace(">assign<", ">unassign<").replace(">CreateTunnelXConnInstance<", ">DeleteTunnelXConnInstance<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<")
426 def rollbackData = execution.getVariable("rollbackData")
427 rollbackData.put(Prefix, "sdncAssignRollbackReq", sdncAssignRollbackReq)
428 execution.setVariable("rollbackData", rollbackData)
430 msoLogger.debug("sdncAssignRollbackReq:\n" + sdncAssignRollbackReq)
431 msoLogger.debug("rollbackData:\n" + rollbackData.toString())
433 } catch (BpmnError e) {
435 } catch(Exception ex) {
436 msg = "Exception in preProcessSDNCAssign. " + ex.getMessage()
438 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
440 msoLogger.debug("end preProcessSDNCAssign")
443 public void preProcessSDNCCreate(DelegateExecution execution) {
447 msoLogger.trace("start preProcessSDNCCreate")
450 String sdncRequestId = UUID.randomUUID().toString()
451 String sdncCreateReq = buildSDNCRequest(execution, "create", sdncRequestId)
452 execution.setVariable("sdncCreateRequest", sdncCreateReq)
453 msoLogger.debug("sdncCreateReq: " + sdncCreateReq)
454 def sdncRequestId2 = UUID.randomUUID().toString()
455 String sdncCreateRollbackReq = sdncCreateReq.replace(">create<", ">delete<").replace(">CreateTunnelXConnInstance<", ">DeleteTunnelXConnInstance<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<")
456 def rollbackData = execution.getVariable("rollbackData")
457 rollbackData.put(Prefix, "sdncCreateRollbackReq", sdncCreateRollbackReq)
458 execution.setVariable("rollbackData", rollbackData)
460 msoLogger.debug("sdncCreateRollbackReq:\n" + sdncCreateRollbackReq)
461 msoLogger.debug("rollbackData:\n" + rollbackData.toString())
463 } catch (BpmnError e) {
465 } catch(Exception ex) {
466 msg = "Exception in preProcessSDNCCreate. " + ex.getMessage()
468 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
470 msoLogger.trace("end preProcessSDNCCreate")
473 public void preProcessSDNCActivate(DelegateExecution execution) {
477 msoLogger.trace("start preProcessSDNCActivate")
480 String sdncRequestId = UUID.randomUUID().toString()
481 String sdncActivateReq = buildSDNCRequest(execution, "activate", sdncRequestId)
482 execution.setVariable("sdncActivateRequest", sdncActivateReq)
483 msoLogger.debug("sdncActivateReq: " + sdncActivateReq)
484 def sdncRequestId2 = UUID.randomUUID().toString()
485 String sdncActivateRollbackReq = sdncActivateReq.replace(">activate<", ">deactivate<").replace(">CreateTunnelXConnInstance<", ">DeleteTunnelXConnInstance<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<")
486 def rollbackData = execution.getVariable("rollbackData")
487 rollbackData.put(Prefix, "sdncActivateRollbackReq", sdncActivateRollbackReq)
488 execution.setVariable("rollbackData", rollbackData)
490 msoLogger.debug("sdncActivateRollbackReq:\n" + sdncActivateRollbackReq)
491 msoLogger.debug("rollbackData:\n" + rollbackData.toString())
493 } catch (BpmnError e) {
495 } catch(Exception ex) {
496 msg = "Exception in preProcessSDNCActivate. " + ex.getMessage()
498 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
500 msoLogger.trace("end preProcessSDNCActivate")
503 public void validateSDNCResp(DelegateExecution execution, String response, String method){
506 msoLogger.trace("start ValidateSDNCResponse Process")
510 WorkflowException workflowException = execution.getVariable("WorkflowException")
511 msoLogger.debug("workflowException: " + workflowException)
513 boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator")
514 msoLogger.debug("SDNCResponse: " + response)
516 SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this)
517 sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator)
519 if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){
520 msoLogger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + response)
522 if (!"get".equals(method))
524 def rollbackData = execution.getVariable("rollbackData")
525 rollbackData.put(Prefix, "rollback" + "SDNC" + method, "true")
526 execution.setVariable("rollbackData", rollbackData)
530 msoLogger.debug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.")
531 throw new BpmnError("MSOWorkflowException")
533 } catch (BpmnError e) {
535 } catch(Exception ex) {
536 msg = "Exception in validateSDNCResp. " + ex.getMessage()
538 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
540 msoLogger.trace("end ValidateSDNCResp Process")
543 public void preProcessSDNCGet(DelegateExecution execution){
545 msoLogger.trace("start preProcessSDNCGet")
548 def callbackUrl = execution.getVariable("sdncCallbackUrl")
549 // serviceOperation (URI for topology GET) will be retrieved from "selflink" from AAI if active AR exists in AAI
550 // or from "object-path" in SDNC response for assign when AR does not exist in AA
552 String serviceOperation = ""
554 if (execution.getVariable("foundActiveAR")) {
555 def aaiQueryResponse = execution.getVariable("aaiARGetResponse")
556 serviceOperation = utils.getNodeText(aaiQueryResponse, "selflink")
557 msoLogger.debug("AR service operation/aaiARSelfLink: " + serviceOperation)
561 String response = execution.getVariable("sdncAssignResponse")
562 String data = utils.getNodeXml(response, "response-data")
563 msoLogger.debug("Assign responseData: " + data)
564 serviceOperation = utils.getNodeText(data, "object-path")
565 msoLogger.debug("AR service operation:" + serviceOperation)
568 String serviceInstanceId = execution.getVariable("serviceInstanceId")
569 String sdncRequestId = UUID.randomUUID().toString()
571 //neeed the same url as used by vfmodules
572 String SDNCGetRequest =
573 """<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.onap/so/request/types/v1"
574 xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"
575 xmlns:sdncadapter="http://org.onap/workflow/sdnc/adapter/schema/v1">
576 <sdncadapter:RequestHeader>
577 <sdncadapter:RequestId>${MsoUtils.xmlEscape(sdncRequestId)}</sdncadapter:RequestId>
578 <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId>
579 <sdncadapter:SvcAction>query</sdncadapter:SvcAction>
580 <sdncadapter:SvcOperation>${MsoUtils.xmlEscape(serviceOperation)}</sdncadapter:SvcOperation>
581 <sdncadapter:CallbackUrl>${MsoUtils.xmlEscape(callbackUrl)}</sdncadapter:CallbackUrl>
582 <sdncadapter:MsoAction>vfmodule</sdncadapter:MsoAction>
583 </sdncadapter:RequestHeader>
584 <sdncadapterworkflow:SDNCRequestData></sdncadapterworkflow:SDNCRequestData>
585 </sdncadapterworkflow:SDNCAdapterWorkflowRequest>"""
587 execution.setVariable("sdncGetRequest", SDNCGetRequest)
590 msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occurred Processing preProcessSDNCGetRequest.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
591 exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during SDNC GET Method:\n" + e.getMessage())
593 msoLogger.trace("end preProcessSDNCGet")
596 public void updateAaiAROrchStatus(DelegateExecution execution, String status){
598 msoLogger.trace("start updateAaiAROrchStatus")
599 String aaiARPath = execution.getVariable("aaiARPath") //set during query (existing AR) or create
600 AllottedResourceUtils arUtils = new AllottedResourceUtils(this)
601 String orchStatus = arUtils.updateAROrchStatus(execution, status, aaiARPath)
602 msoLogger.trace("end updateAaiAROrchStatus")
605 public void generateOutputs(DelegateExecution execution)
608 msoLogger.trace("start generateOutputs")
610 String sdncGetResponse = execution.getVariable("enhancedCallbackRequestData") //unescaped
611 msoLogger.debug("resp:" + sdncGetResponse)
612 String arData = utils.getNodeXml(sdncGetResponse, "tunnelxconn-topology")
613 arData = utils.removeXmlNamespaces(arData)
615 String txca = utils.getNodeXml(arData, "tunnelxconn-assignments")
616 execution.setVariable("vni", utils.getNodeText(txca, "vni"))
617 execution.setVariable("vgmuxBearerIP", utils.getNodeText(txca, "vgmux-bearer-ip"))
618 execution.setVariable("vgmuxLanIP", utils.getNodeText(txca, "vgmux-lan-ip"))
620 String ari = utils.getNodeXml(arData, "allotted-resource-identifiers")
621 execution.setVariable("allotedResourceName", utils.getNodeText(ari, "allotted-resource-name"))
622 } catch (BpmnError e) {
623 msoLogger.debug("BPMN Error in generateOutputs ")
624 } catch(Exception ex) {
625 String msg = "Exception in generateOutputs " + ex.getMessage()
628 msoLogger.trace("end generateOutputs")
632 public void preProcessRollback (DelegateExecution execution) {
634 msoLogger.trace("start preProcessRollback")
637 Object workflowException = execution.getVariable("WorkflowException");
639 if (workflowException instanceof WorkflowException) {
640 msoLogger.debug("Prev workflowException: " + workflowException.getErrorMessage())
641 execution.setVariable("prevWorkflowException", workflowException);
642 //execution.setVariable("WorkflowException", null);
644 } catch (BpmnError e) {
645 msoLogger.debug("BPMN Error during preProcessRollback")
646 } catch(Exception ex) {
647 String msg = "Exception in preProcessRollback. " + ex.getMessage()
650 msoLogger.trace("end preProcessRollback")
653 public void postProcessRollback (DelegateExecution execution) {
655 msoLogger.trace("start postProcessRollback")
658 Object workflowException = execution.getVariable("prevWorkflowException");
659 if (workflowException instanceof WorkflowException) {
660 msoLogger.debug("Setting prevException to WorkflowException: ")
661 execution.setVariable("WorkflowException", workflowException);
663 execution.setVariable("rollbackData", null)
664 } catch (BpmnError b) {
665 msoLogger.debug("BPMN Error during postProcessRollback")
667 } catch(Exception ex) {
668 msg = "Exception in postProcessRollback. " + ex.getMessage()
671 msoLogger.trace("end postProcessRollback")