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 static org.apache.commons.lang3.StringUtils.*
25 import org.apache.commons.lang3.*
26 import org.camunda.bpm.engine.delegate.BpmnError
27 import org.camunda.bpm.engine.delegate.DelegateExecution
28 import org.onap.so.bpmn.common.scripts.*;
29 import org.onap.so.bpmn.core.RollbackData
30 import org.onap.so.bpmn.core.UrnPropertiesReader
31 import org.onap.so.bpmn.core.WorkflowException
32 import org.onap.so.bpmn.core.json.JsonUtils
33 import org.onap.so.client.aai.AAIObjectType
34 import org.onap.so.client.aai.entities.uri.AAIResourceUri
35 import org.onap.so.client.aai.entities.uri.AAIUriFactory
36 import org.onap.so.logger.MessageEnum
37 import org.onap.so.logger.MsoLogger
38 import org.onap.so.rest.APIResponse
41 * This groovy class supports the <class>DoCreateAllottedResourceTXC.bpmn</class> process.
46 * @param - msoRequestId
47 * @param - isDEbugLogEnabled
48 * @param - disableRollback
49 * @param - failExists - O
50 * @param - serviceInstanceId
51 * @param - globalCustomerId - O
52 * @param - subscriptionServiceType - O
53 * @param - parentServiceInstanceId
54 * @param - allottedReourceId - O
55 * @param - allottedResourceModelInfo
56 * @param - allottedResourceRole
57 * @param - allottedResourceType
58 * @param - brgWanMacAddress
61 * @param - rollbackData (localRB->null)
62 * @param - rolledBack (no localRB->null, localRB F->false, localRB S->true)
63 * @param - WorkflowException - O
64 * @param - allottedResourceId
65 * @param - allottedResourceName
67 * @param - vgmuxBearerIP
71 public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{
72 private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCreateAllottedResourceTXC.class);
74 String Prefix="DCARTXC_"
75 ExceptionUtil exceptionUtil = new ExceptionUtil()
76 JsonUtils jsonUtil = new JsonUtils()
78 public void preProcessRequest (DelegateExecution execution) {
82 msoLogger.trace("start preProcessRequest")
85 String msoRequestId = execution.getVariable("msoRequestId")
86 msoLogger.debug(" msoRequestId = " + msoRequestId)
88 execution.setVariable("prefix", Prefix)
91 String sdncCallbackUrl = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution)
92 if (isBlank(sdncCallbackUrl)) {
93 msg = "mso.workflow.sdncadapter.callback is null"
95 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
97 execution.setVariable("sdncCallbackUrl", sdncCallbackUrl)
98 msoLogger.debug("SDNC Callback URL: " + sdncCallbackUrl)
100 String sdncReplDelay = UrnPropertiesReader.getVariable("mso.workflow.sdnc.replication.delay",execution)
101 if (isBlank(sdncReplDelay)) {
102 msg = "mso.workflow.sdnc.replication.delay is null"
104 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
106 execution.setVariable("sdncReplDelay", sdncReplDelay)
107 msoLogger.debug("SDNC replication delay: " + sdncReplDelay)
110 if (isBlank(execution.getVariable("serviceInstanceId"))){
111 msg = "Input serviceInstanceId is null"
113 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
115 if (isBlank(execution.getVariable("parentServiceInstanceId"))) {
116 msg = "Input parentServiceInstanceId is null"
118 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
120 if (isBlank(execution.getVariable("allottedResourceModelInfo"))) {
121 msg = "Input allottedResourceModelInfo is null"
123 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
125 if (isBlank(execution.getVariable("brgWanMacAddress"))) {
126 msg = "Input brgWanMacAddress is null"
128 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
130 if (isBlank(execution.getVariable("allottedResourceRole"))) {
131 msg = "Input allottedResourceRole is null"
133 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
135 if (isBlank(execution.getVariable("allottedResourceType"))) {
136 msg = "Input allottedResourceType is null"
138 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
141 msoLogger.debug("Rethrowing MSOWorkflowException")
143 } catch (Exception ex){
144 msg = "Exception in preProcessRequest " + ex.getMessage()
146 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
148 msoLogger.trace("end preProcessRequest")
151 public void getAaiAR (DelegateExecution execution) {
154 msoLogger.trace("start getAaiAR")
156 String arType = execution.getVariable("allottedResourceType")
157 String arRole = execution.getVariable("allottedResourceRole")
159 AllottedResourceUtils arUtils = new AllottedResourceUtils(this)
160 String orchStatus = arUtils.getAROrchStatus(execution)
164 if (orchStatus != null) // AR was found
166 if ("true".equals(execution.getVariable("failExists")))
168 errorMsg = "Allotted resource " + arType + " with Role " + arRole + " already exists"
172 if ("Active".equals(orchStatus))
174 execution.setVariable("foundActiveAR", true)
176 else // blanks included
178 errorMsg = "Allotted Resource " + arType + " with Role " + arRole + " already exists in an incomplete state -" + orchStatus
182 if (!isBlank(errorMsg)) {
183 msoLogger.debug(errorMsg)
184 exceptionUtil.buildAndThrowWorkflowException(execution, 500, errorMsg)
186 msoLogger.trace("end getAaiAR")
189 public void createAaiAR(DelegateExecution execution) {
192 msoLogger.trace("start createAaiAR")
195 String allottedResourceId = execution.getVariable("allottedResourceId")
196 if (isBlank(allottedResourceId))
198 allottedResourceId = UUID.randomUUID().toString()
199 execution.setVariable("allottedResourceId", allottedResourceId)
205 AaiUtil aaiUriUtil = new AaiUtil(this)
206 AAIResourceUri siResourceLink= execution.getVariable("PSI_resourceLink")
207 AllottedResourceUtils arUtils = new AllottedResourceUtils(this)
208 execution.setVariable("aaiARPath", arUtils.createARUrl(execution, siResourceLink, allottedResourceId))
209 msoLogger.debug("GET AllottedResource AAI URL is:\n" + arUrl)
211 String namespace = aaiUriUtil.getNamespaceFromUri(execution, arUrl)
213 String arType = execution.getVariable("allottedResourceType")
214 String arRole = execution.getVariable("allottedResourceRole")
215 String CSI_resourceLink = execution.getVariable("CSI_resourceLink")
216 String arModelInfo = execution.getVariable("allottedResourceModelInfo")
217 msoLogger.debug("arModelInfo is:\n" + arModelInfo)
218 String modelInvariantId = jsonUtil.getJsonValue(arModelInfo, "modelInvariantUuid")
219 String modelVersionId = jsonUtil.getJsonValue(arModelInfo, "modelUuid")
220 String modelCustomizationId = jsonUtil.getJsonValue(arModelInfo, "modelCustomizationUuid")
222 if (modelInvariantId == null) {
223 modelInvariantId = ""
225 if (modelVersionId == null) {
228 if (modelCustomizationId == null) {
229 modelCustomizationId = ""
233 """<allotted-resource xmlns="${namespace}">
234 <id>${MsoUtils.xmlEscape(allottedResourceId)}</id>
235 <description></description>
236 <type>${MsoUtils.xmlEscape(arType)}</type>
237 <role>${MsoUtils.xmlEscape(arRole)}</role>
238 <selflink></selflink>
239 <model-invariant-id>${MsoUtils.xmlEscape(modelInvariantId)}</model-invariant-id>
240 <model-version-id>${MsoUtils.xmlEscape(modelVersionId)}</model-version-id>
241 <model-customization-id>${MsoUtils.xmlEscape(modelCustomizationId)}</model-customization-id>
242 <orchestration-status>PendingCreate</orchestration-status>
243 <operation-status></operation-status>
246 <related-to>service-instance</related-to>
247 <related-link>${MsoUtils.xmlEscape(CSI_resourceLink)}</related-link>
250 </allotted-resource>""".trim()
252 execution.setVariable("AaiARPayload", payload)
253 msoLogger.debug(" payload to create AllottedResource in AAI:" + "\n" + payload)
255 APIResponse response = aaiUriUtil.executeAAIPutCall(execution, arUrl, payload)
256 int responseCode = response.getStatusCode()
257 msoLogger.debug("AllottedResource AAI PUT responseCode:" + responseCode)
259 String aaiResponse = response.getResponseBodyAsString()
260 msoLogger.debug("AllottedResource AAI PUT responseStr:" + aaiResponse)
262 //200 OK 201 CREATED 202 ACCEPTED
263 if(responseCode == 200 || responseCode == 201 || responseCode == 202 )
265 msoLogger.debug("AAI PUT AllottedResource received a Good Response")
268 msoLogger.debug("AAI Put AllottedResouce received a Bad Response Code: " + responseCode)
269 exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode)
270 throw new BpmnError("MSOWorkflowException")
273 msoLogger.debug("Rethrowing MSOWorkflowException")
275 } catch (Exception ex) {
276 msg = "Exception in createAaiAR " + ex.getMessage()
278 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
281 //start rollback set up
282 RollbackData rollbackData = new RollbackData()
283 def disableRollback = execution.getVariable("disableRollback")
284 rollbackData.put(Prefix, "disableRollback", disableRollback.toString())
285 rollbackData.put(Prefix, "rollbackAAI", "true")
286 rollbackData.put(Prefix, "allottedResourceId", allottedResourceId)
287 rollbackData.put(Prefix, "serviceInstanceId", execution.getVariable("serviceInstanceId"))
288 rollbackData.put(Prefix, "parentServiceInstanceId", execution.getVariable("parentServiceInstanceId"))
289 rollbackData.put(Prefix, "aaiARPath", arUrl)
290 execution.setVariable("rollbackData", rollbackData)
291 msoLogger.trace("end createAaiAR")
294 public String buildSDNCRequest(DelegateExecution execution, String action, String sdncRequestId) {
298 msoLogger.trace("start buildSDNCRequest")
299 String sdncReq = null
303 String allottedResourceId = execution.getVariable("allottedResourceId")
304 String serviceInstanceId = execution.getVariable("serviceInstanceId")
305 String globalCustomerId = execution.getVariable("globalCustomerId")
306 String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
307 String parentServiceInstanceId = execution.getVariable("parentServiceInstanceId")
308 String serviceChainServiceInstanceId = execution.getVariable("serviceChainServiceInstanceId")
309 String callbackUrl = execution.getVariable("sdncCallbackUrl")
310 String requestId = execution.getVariable("msoRequestId")
312 String brgWanMacAddress = execution.getVariable("brgWanMacAddress")
314 String arModelInfo = execution.getVariable("allottedResourceModelInfo")
315 String modelInvariantId = jsonUtil.getJsonValue(arModelInfo, "modelInvariantUuid")
316 String modelVersion = jsonUtil.getJsonValue(arModelInfo, "modelVersion")
317 String modelUUId = jsonUtil.getJsonValue(arModelInfo, "modelUuid")
318 String modelCustomizationId = jsonUtil.getJsonValue(arModelInfo, "modelCustomizationUuid")
319 String modelName = jsonUtil.getJsonValue(arModelInfo, "modelName")
321 if (modelInvariantId == null) {
322 modelInvariantId = ""
324 if (modelVersion == null) {
327 if (modelUUId == null) {
330 if (modelName == null) {
333 if (modelCustomizationId == null) {
334 modelCustomizationId = ""
338 """<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.onap/so/request/types/v1"
339 xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"
340 xmlns:sdncadapter="http://org.onap/workflow/sdnc/adapter/schema/v1">
341 <sdncadapter:RequestHeader>
342 <sdncadapter:RequestId>${MsoUtils.xmlEscape(sdncRequestId)}</sdncadapter:RequestId>
343 <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId>
344 <sdncadapter:SvcAction>${MsoUtils.xmlEscape(action)}</sdncadapter:SvcAction>
345 <sdncadapter:SvcOperation>tunnelxconn-topology-operation</sdncadapter:SvcOperation>
346 <sdncadapter:CallbackUrl>${MsoUtils.xmlEscape(callbackUrl)}</sdncadapter:CallbackUrl>
347 </sdncadapter:RequestHeader>
348 <sdncadapterworkflow:SDNCRequestData>
349 <request-information>
350 <request-id>${MsoUtils.xmlEscape(requestId)}</request-id>
351 <request-action>CreateTunnelXConnInstance</request-action>
356 </request-information>
357 <service-information>
358 <service-id></service-id>
359 <subscription-service-type>${MsoUtils.xmlEscape(subscriptionServiceType)}</subscription-service-type>
360 <onap-model-information></onap-model-information>
361 <service-instance-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-instance-id>
363 <global-customer-id>${MsoUtils.xmlEscape(globalCustomerId)}</global-customer-id>
364 </service-information>
365 <allotted-resource-information>
366 <allotted-resource-id>${MsoUtils.xmlEscape(allottedResourceId)}</allotted-resource-id>
367 <allotted-resource-type>tunnelxconn</allotted-resource-type>
368 <parent-service-instance-id>${MsoUtils.xmlEscape(parentServiceInstanceId)}</parent-service-instance-id>
369 <onap-model-information>
370 <model-invariant-uuid>${MsoUtils.xmlEscape(modelInvariantId)}</model-invariant-uuid>
371 <model-uuid>${MsoUtils.xmlEscape(modelUUId)}</model-uuid>
372 <model-customization-uuid>${MsoUtils.xmlEscape(modelCustomizationId)}</model-customization-uuid>
373 <model-version>${MsoUtils.xmlEscape(modelVersion)}</model-version>
374 <model-name>${MsoUtils.xmlEscape(modelName)}</model-name>
375 </onap-model-information>
376 </allotted-resource-information>
377 <tunnelxconn-request-input>
378 <brg-wan-mac-address>${MsoUtils.xmlEscape(brgWanMacAddress)}</brg-wan-mac-address>
379 </tunnelxconn-request-input>
380 </sdncadapterworkflow:SDNCRequestData>
381 </sdncadapterworkflow:SDNCAdapterWorkflowRequest>"""
383 msoLogger.debug("sdncRequest:\n" + sdncReq)
384 sdncReq = utils.formatXml(sdncReq)
386 } catch(Exception ex) {
387 msg = "Exception in buildSDNCRequest. " + ex.getMessage()
389 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
391 msoLogger.trace("end buildSDNCRequest")
395 public void preProcessSDNCAssign(DelegateExecution execution) {
399 msoLogger.trace("start preProcessSDNCAssign")
402 String sdncRequestId = UUID.randomUUID().toString()
403 String sdncAssignReq = buildSDNCRequest(execution, "assign", sdncRequestId)
404 execution.setVariable("sdncAssignRequest", sdncAssignReq)
405 msoLogger.debug("sdncAssignRequest: " + sdncAssignReq)
406 def sdncRequestId2 = UUID.randomUUID().toString()
407 String sdncAssignRollbackReq = sdncAssignReq.replace(">assign<", ">unassign<").replace(">CreateTunnelXConnInstance<", ">DeleteTunnelXConnInstance<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<")
408 def rollbackData = execution.getVariable("rollbackData")
409 rollbackData.put(Prefix, "sdncAssignRollbackReq", sdncAssignRollbackReq)
410 execution.setVariable("rollbackData", rollbackData)
412 msoLogger.debug("sdncAssignRollbackReq:\n" + sdncAssignRollbackReq)
413 msoLogger.debug("rollbackData:\n" + rollbackData.toString())
415 } catch (BpmnError e) {
417 } catch(Exception ex) {
418 msg = "Exception in preProcessSDNCAssign. " + ex.getMessage()
420 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
422 msoLogger.debug("end preProcessSDNCAssign")
425 public void preProcessSDNCCreate(DelegateExecution execution) {
429 msoLogger.trace("start preProcessSDNCCreate")
432 String sdncRequestId = UUID.randomUUID().toString()
433 String sdncCreateReq = buildSDNCRequest(execution, "create", sdncRequestId)
434 execution.setVariable("sdncCreateRequest", sdncCreateReq)
435 msoLogger.debug("sdncCreateReq: " + sdncCreateReq)
436 def sdncRequestId2 = UUID.randomUUID().toString()
437 String sdncCreateRollbackReq = sdncCreateReq.replace(">create<", ">delete<").replace(">CreateTunnelXConnInstance<", ">DeleteTunnelXConnInstance<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<")
438 def rollbackData = execution.getVariable("rollbackData")
439 rollbackData.put(Prefix, "sdncCreateRollbackReq", sdncCreateRollbackReq)
440 execution.setVariable("rollbackData", rollbackData)
442 msoLogger.debug("sdncCreateRollbackReq:\n" + sdncCreateRollbackReq)
443 msoLogger.debug("rollbackData:\n" + rollbackData.toString())
445 } catch (BpmnError e) {
447 } catch(Exception ex) {
448 msg = "Exception in preProcessSDNCCreate. " + ex.getMessage()
450 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
452 msoLogger.trace("end preProcessSDNCCreate")
455 public void preProcessSDNCActivate(DelegateExecution execution) {
459 msoLogger.trace("start preProcessSDNCActivate")
462 String sdncRequestId = UUID.randomUUID().toString()
463 String sdncActivateReq = buildSDNCRequest(execution, "activate", sdncRequestId)
464 execution.setVariable("sdncActivateRequest", sdncActivateReq)
465 msoLogger.debug("sdncActivateReq: " + sdncActivateReq)
466 def sdncRequestId2 = UUID.randomUUID().toString()
467 String sdncActivateRollbackReq = sdncActivateReq.replace(">activate<", ">deactivate<").replace(">CreateTunnelXConnInstance<", ">DeleteTunnelXConnInstance<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<")
468 def rollbackData = execution.getVariable("rollbackData")
469 rollbackData.put(Prefix, "sdncActivateRollbackReq", sdncActivateRollbackReq)
470 execution.setVariable("rollbackData", rollbackData)
472 msoLogger.debug("sdncActivateRollbackReq:\n" + sdncActivateRollbackReq)
473 msoLogger.debug("rollbackData:\n" + rollbackData.toString())
475 } catch (BpmnError e) {
477 } catch(Exception ex) {
478 msg = "Exception in preProcessSDNCActivate. " + ex.getMessage()
480 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
482 msoLogger.trace("end preProcessSDNCActivate")
485 public void validateSDNCResp(DelegateExecution execution, String response, String method){
488 msoLogger.trace("start ValidateSDNCResponse Process")
492 WorkflowException workflowException = execution.getVariable("WorkflowException")
493 msoLogger.debug("workflowException: " + workflowException)
495 boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator")
496 msoLogger.debug("SDNCResponse: " + response)
498 SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this)
499 sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator)
501 if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){
502 msoLogger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + response)
504 if (!"get".equals(method))
506 def rollbackData = execution.getVariable("rollbackData")
507 rollbackData.put(Prefix, "rollback" + "SDNC" + method, "true")
508 execution.setVariable("rollbackData", rollbackData)
512 msoLogger.debug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.")
513 throw new BpmnError("MSOWorkflowException")
515 } catch (BpmnError e) {
517 } catch(Exception ex) {
518 msg = "Exception in validateSDNCResp. " + ex.getMessage()
520 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
522 msoLogger.trace("end ValidateSDNCResp Process")
525 public void preProcessSDNCGet(DelegateExecution execution){
527 msoLogger.trace("start preProcessSDNCGet")
530 def callbackUrl = execution.getVariable("sdncCallbackUrl")
531 // serviceOperation (URI for topology GET) will be retrieved from "selflink" from AAI if active AR exists in AAI
532 // or from "object-path" in SDNC response for assign when AR does not exist in AA
534 String serviceOperation = ""
536 if (execution.getVariable("foundActiveAR")) {
537 def aaiQueryResponse = execution.getVariable("aaiARGetResponse")
538 serviceOperation = utils.getNodeText(aaiQueryResponse, "selflink")
539 msoLogger.debug("AR service operation/aaiARSelfLink: " + serviceOperation)
543 String response = execution.getVariable("sdncAssignResponse")
544 String data = utils.getNodeXml(response, "response-data")
545 msoLogger.debug("Assign responseData: " + data)
546 serviceOperation = utils.getNodeText(data, "object-path")
547 msoLogger.debug("AR service operation:" + serviceOperation)
550 String serviceInstanceId = execution.getVariable("serviceInstanceId")
551 String sdncRequestId = UUID.randomUUID().toString()
553 //neeed the same url as used by vfmodules
554 String SDNCGetRequest =
555 """<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.onap/so/request/types/v1"
556 xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"
557 xmlns:sdncadapter="http://org.onap/workflow/sdnc/adapter/schema/v1">
558 <sdncadapter:RequestHeader>
559 <sdncadapter:RequestId>${MsoUtils.xmlEscape(sdncRequestId)}</sdncadapter:RequestId>
560 <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId>
561 <sdncadapter:SvcAction>query</sdncadapter:SvcAction>
562 <sdncadapter:SvcOperation>${MsoUtils.xmlEscape(serviceOperation)}</sdncadapter:SvcOperation>
563 <sdncadapter:CallbackUrl>${MsoUtils.xmlEscape(callbackUrl)}</sdncadapter:CallbackUrl>
564 <sdncadapter:MsoAction>vfmodule</sdncadapter:MsoAction>
565 </sdncadapter:RequestHeader>
566 <sdncadapterworkflow:SDNCRequestData></sdncadapterworkflow:SDNCRequestData>
567 </sdncadapterworkflow:SDNCAdapterWorkflowRequest>"""
569 execution.setVariable("sdncGetRequest", SDNCGetRequest)
572 msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occurred Processing preProcessSDNCGetRequest.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
573 exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during SDNC GET Method:\n" + e.getMessage())
575 msoLogger.trace("end preProcessSDNCGet")
578 public void updateAaiAROrchStatus(DelegateExecution execution, String status){
580 msoLogger.trace("start updateAaiAROrchStatus")
581 String aaiARPath = execution.getVariable("aaiARPath") //set during query (existing AR) or create
582 AllottedResourceUtils arUtils = new AllottedResourceUtils(this)
583 String orchStatus = arUtils.updateAROrchStatus(execution, status, aaiARPath)
584 msoLogger.trace("end updateAaiAROrchStatus")
587 public void generateOutputs(DelegateExecution execution)
590 msoLogger.trace("start generateOutputs")
592 String sdncGetResponse = execution.getVariable("enhancedCallbackRequestData") //unescaped
593 msoLogger.debug("resp:" + sdncGetResponse)
594 String arData = utils.getNodeXml(sdncGetResponse, "tunnelxconn-topology")
595 arData = utils.removeXmlNamespaces(arData)
597 String txca = utils.getNodeXml(arData, "tunnelxconn-assignments")
598 execution.setVariable("vni", utils.getNodeText(txca, "vni"))
599 execution.setVariable("vgmuxBearerIP", utils.getNodeText(txca, "vgmux-bearer-ip"))
600 execution.setVariable("vgmuxLanIP", utils.getNodeText(txca, "vgmux-lan-ip"))
602 String ari = utils.getNodeXml(arData, "allotted-resource-identifiers")
603 execution.setVariable("allotedResourceName", utils.getNodeText(ari, "allotted-resource-name"))
604 } catch (BpmnError e) {
605 msoLogger.debug("BPMN Error in generateOutputs ")
606 } catch(Exception ex) {
607 String msg = "Exception in generateOutputs " + ex.getMessage()
610 msoLogger.trace("end generateOutputs")
614 public void preProcessRollback (DelegateExecution execution) {
616 msoLogger.trace("start preProcessRollback")
619 Object workflowException = execution.getVariable("WorkflowException");
621 if (workflowException instanceof WorkflowException) {
622 msoLogger.debug("Prev workflowException: " + workflowException.getErrorMessage())
623 execution.setVariable("prevWorkflowException", workflowException);
624 //execution.setVariable("WorkflowException", null);
626 } catch (BpmnError e) {
627 msoLogger.debug("BPMN Error during preProcessRollback")
628 } catch(Exception ex) {
629 String msg = "Exception in preProcessRollback. " + ex.getMessage()
632 msoLogger.trace("end preProcessRollback")
635 public void postProcessRollback (DelegateExecution execution) {
637 msoLogger.trace("start postProcessRollback")
640 Object workflowException = execution.getVariable("prevWorkflowException");
641 if (workflowException instanceof WorkflowException) {
642 msoLogger.debug("Setting prevException to WorkflowException: ")
643 execution.setVariable("WorkflowException", workflowException);
645 execution.setVariable("rollbackData", null)
646 } catch (BpmnError b) {
647 msoLogger.debug("BPMN Error during postProcessRollback")
649 } catch(Exception ex) {
650 msg = "Exception in postProcessRollback. " + ex.getMessage()
653 msoLogger.trace("end postProcessRollback")