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 arUrl = arUtils.createARUrl(execution, siResourceLink, allottedResourceId)
209 execution.setVariable("aaiARPath", arUrl)
210 msoLogger.debug("PUT AllottedResource AAI URL is:\n" + arUrl)
212 String namespace = aaiUriUtil.getNamespaceFromUri(execution, arUrl)
214 String arType = execution.getVariable("allottedResourceType")
215 String arRole = execution.getVariable("allottedResourceRole")
216 String CSI_resourceLink = execution.getVariable("CSI_resourceLink")
217 String arModelInfo = execution.getVariable("allottedResourceModelInfo")
218 msoLogger.debug("arModelInfo is:\n" + arModelInfo)
219 String modelInvariantId = jsonUtil.getJsonValue(arModelInfo, "modelInvariantUuid")
220 String modelVersionId = jsonUtil.getJsonValue(arModelInfo, "modelUuid")
221 String modelCustomizationId = jsonUtil.getJsonValue(arModelInfo, "modelCustomizationUuid")
223 if (modelInvariantId == null) {
224 modelInvariantId = ""
226 if (modelVersionId == null) {
229 if (modelCustomizationId == null) {
230 modelCustomizationId = ""
234 """<allotted-resource xmlns="${namespace}">
235 <id>${MsoUtils.xmlEscape(allottedResourceId)}</id>
236 <description></description>
237 <type>${MsoUtils.xmlEscape(arType)}</type>
238 <role>${MsoUtils.xmlEscape(arRole)}</role>
239 <selflink></selflink>
240 <model-invariant-id>${MsoUtils.xmlEscape(modelInvariantId)}</model-invariant-id>
241 <model-version-id>${MsoUtils.xmlEscape(modelVersionId)}</model-version-id>
242 <model-customization-id>${MsoUtils.xmlEscape(modelCustomizationId)}</model-customization-id>
243 <orchestration-status>PendingCreate</orchestration-status>
244 <operation-status></operation-status>
247 <related-to>service-instance</related-to>
248 <related-link>${MsoUtils.xmlEscape(CSI_resourceLink)}</related-link>
251 </allotted-resource>""".trim()
253 execution.setVariable("AaiARPayload", payload)
254 msoLogger.debug(" payload to create AllottedResource in AAI:" + "\n" + payload)
256 APIResponse response = aaiUriUtil.executeAAIPutCall(execution, arUrl, payload)
257 int responseCode = response.getStatusCode()
258 msoLogger.debug("AllottedResource AAI PUT responseCode:" + responseCode)
260 String aaiResponse = response.getResponseBodyAsString()
261 msoLogger.debug("AllottedResource AAI PUT responseStr:" + aaiResponse)
263 //200 OK 201 CREATED 202 ACCEPTED
264 if(responseCode == 200 || responseCode == 201 || responseCode == 202 )
266 msoLogger.debug("AAI PUT AllottedResource received a Good Response")
269 msoLogger.debug("AAI Put AllottedResouce received a Bad Response Code: " + responseCode)
270 exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode)
271 throw new BpmnError("MSOWorkflowException")
274 msoLogger.debug("Rethrowing MSOWorkflowException")
276 } catch (Exception ex) {
277 msg = "Exception in createAaiAR " + ex.getMessage()
279 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
282 //start rollback set up
283 RollbackData rollbackData = new RollbackData()
284 def disableRollback = execution.getVariable("disableRollback")
285 rollbackData.put(Prefix, "disableRollback", disableRollback.toString())
286 rollbackData.put(Prefix, "rollbackAAI", "true")
287 rollbackData.put(Prefix, "allottedResourceId", allottedResourceId)
288 rollbackData.put(Prefix, "serviceInstanceId", execution.getVariable("serviceInstanceId"))
289 rollbackData.put(Prefix, "parentServiceInstanceId", execution.getVariable("parentServiceInstanceId"))
290 rollbackData.put(Prefix, "aaiARPath", arUrl)
291 execution.setVariable("rollbackData", rollbackData)
292 msoLogger.trace("end createAaiAR")
295 public String buildSDNCRequest(DelegateExecution execution, String action, String sdncRequestId) {
299 msoLogger.trace("start buildSDNCRequest")
300 String sdncReq = null
304 String allottedResourceId = execution.getVariable("allottedResourceId")
305 String serviceInstanceId = execution.getVariable("serviceInstanceId")
306 String globalCustomerId = execution.getVariable("globalCustomerId")
307 String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
308 String parentServiceInstanceId = execution.getVariable("parentServiceInstanceId")
309 String serviceChainServiceInstanceId = execution.getVariable("serviceChainServiceInstanceId")
310 String callbackUrl = execution.getVariable("sdncCallbackUrl")
311 String requestId = execution.getVariable("msoRequestId")
313 String brgWanMacAddress = execution.getVariable("brgWanMacAddress")
315 String arModelInfo = execution.getVariable("allottedResourceModelInfo")
316 String modelInvariantId = jsonUtil.getJsonValue(arModelInfo, "modelInvariantUuid")
317 String modelVersion = jsonUtil.getJsonValue(arModelInfo, "modelVersion")
318 String modelUUId = jsonUtil.getJsonValue(arModelInfo, "modelUuid")
319 String modelCustomizationId = jsonUtil.getJsonValue(arModelInfo, "modelCustomizationUuid")
320 String modelName = jsonUtil.getJsonValue(arModelInfo, "modelName")
322 if (modelInvariantId == null) {
323 modelInvariantId = ""
325 if (modelVersion == null) {
328 if (modelUUId == null) {
331 if (modelName == null) {
334 if (modelCustomizationId == null) {
335 modelCustomizationId = ""
339 """<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.onap/so/request/types/v1"
340 xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"
341 xmlns:sdncadapter="http://org.onap/workflow/sdnc/adapter/schema/v1">
342 <sdncadapter:RequestHeader>
343 <sdncadapter:RequestId>${MsoUtils.xmlEscape(sdncRequestId)}</sdncadapter:RequestId>
344 <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId>
345 <sdncadapter:SvcAction>${MsoUtils.xmlEscape(action)}</sdncadapter:SvcAction>
346 <sdncadapter:SvcOperation>tunnelxconn-topology-operation</sdncadapter:SvcOperation>
347 <sdncadapter:CallbackUrl>${MsoUtils.xmlEscape(callbackUrl)}</sdncadapter:CallbackUrl>
348 </sdncadapter:RequestHeader>
349 <sdncadapterworkflow:SDNCRequestData>
350 <request-information>
351 <request-id>${MsoUtils.xmlEscape(requestId)}</request-id>
352 <request-action>CreateTunnelXConnInstance</request-action>
357 </request-information>
358 <service-information>
359 <service-id></service-id>
360 <subscription-service-type>${MsoUtils.xmlEscape(subscriptionServiceType)}</subscription-service-type>
361 <onap-model-information></onap-model-information>
362 <service-instance-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-instance-id>
364 <global-customer-id>${MsoUtils.xmlEscape(globalCustomerId)}</global-customer-id>
365 </service-information>
366 <allotted-resource-information>
367 <allotted-resource-id>${MsoUtils.xmlEscape(allottedResourceId)}</allotted-resource-id>
368 <allotted-resource-type>tunnelxconn</allotted-resource-type>
369 <parent-service-instance-id>${MsoUtils.xmlEscape(parentServiceInstanceId)}</parent-service-instance-id>
370 <onap-model-information>
371 <model-invariant-uuid>${MsoUtils.xmlEscape(modelInvariantId)}</model-invariant-uuid>
372 <model-uuid>${MsoUtils.xmlEscape(modelUUId)}</model-uuid>
373 <model-customization-uuid>${MsoUtils.xmlEscape(modelCustomizationId)}</model-customization-uuid>
374 <model-version>${MsoUtils.xmlEscape(modelVersion)}</model-version>
375 <model-name>${MsoUtils.xmlEscape(modelName)}</model-name>
376 </onap-model-information>
377 </allotted-resource-information>
378 <tunnelxconn-request-input>
379 <brg-wan-mac-address>${MsoUtils.xmlEscape(brgWanMacAddress)}</brg-wan-mac-address>
380 </tunnelxconn-request-input>
381 </sdncadapterworkflow:SDNCRequestData>
382 </sdncadapterworkflow:SDNCAdapterWorkflowRequest>"""
384 msoLogger.debug("sdncRequest:\n" + sdncReq)
385 sdncReq = utils.formatXml(sdncReq)
387 } catch(Exception ex) {
388 msg = "Exception in buildSDNCRequest. " + ex.getMessage()
390 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
392 msoLogger.trace("end buildSDNCRequest")
396 public void preProcessSDNCAssign(DelegateExecution execution) {
400 msoLogger.trace("start preProcessSDNCAssign")
403 String sdncRequestId = UUID.randomUUID().toString()
404 String sdncAssignReq = buildSDNCRequest(execution, "assign", sdncRequestId)
405 execution.setVariable("sdncAssignRequest", sdncAssignReq)
406 msoLogger.debug("sdncAssignRequest: " + sdncAssignReq)
407 def sdncRequestId2 = UUID.randomUUID().toString()
408 String sdncAssignRollbackReq = sdncAssignReq.replace(">assign<", ">unassign<").replace(">CreateTunnelXConnInstance<", ">DeleteTunnelXConnInstance<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<")
409 def rollbackData = execution.getVariable("rollbackData")
410 rollbackData.put(Prefix, "sdncAssignRollbackReq", sdncAssignRollbackReq)
411 execution.setVariable("rollbackData", rollbackData)
413 msoLogger.debug("sdncAssignRollbackReq:\n" + sdncAssignRollbackReq)
414 msoLogger.debug("rollbackData:\n" + rollbackData.toString())
416 } catch (BpmnError e) {
418 } catch(Exception ex) {
419 msg = "Exception in preProcessSDNCAssign. " + ex.getMessage()
421 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
423 msoLogger.debug("end preProcessSDNCAssign")
426 public void preProcessSDNCCreate(DelegateExecution execution) {
430 msoLogger.trace("start preProcessSDNCCreate")
433 String sdncRequestId = UUID.randomUUID().toString()
434 String sdncCreateReq = buildSDNCRequest(execution, "create", sdncRequestId)
435 execution.setVariable("sdncCreateRequest", sdncCreateReq)
436 msoLogger.debug("sdncCreateReq: " + sdncCreateReq)
437 def sdncRequestId2 = UUID.randomUUID().toString()
438 String sdncCreateRollbackReq = sdncCreateReq.replace(">create<", ">delete<").replace(">CreateTunnelXConnInstance<", ">DeleteTunnelXConnInstance<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<")
439 def rollbackData = execution.getVariable("rollbackData")
440 rollbackData.put(Prefix, "sdncCreateRollbackReq", sdncCreateRollbackReq)
441 execution.setVariable("rollbackData", rollbackData)
443 msoLogger.debug("sdncCreateRollbackReq:\n" + sdncCreateRollbackReq)
444 msoLogger.debug("rollbackData:\n" + rollbackData.toString())
446 } catch (BpmnError e) {
448 } catch(Exception ex) {
449 msg = "Exception in preProcessSDNCCreate. " + ex.getMessage()
451 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
453 msoLogger.trace("end preProcessSDNCCreate")
456 public void preProcessSDNCActivate(DelegateExecution execution) {
460 msoLogger.trace("start preProcessSDNCActivate")
463 String sdncRequestId = UUID.randomUUID().toString()
464 String sdncActivateReq = buildSDNCRequest(execution, "activate", sdncRequestId)
465 execution.setVariable("sdncActivateRequest", sdncActivateReq)
466 msoLogger.debug("sdncActivateReq: " + sdncActivateReq)
467 def sdncRequestId2 = UUID.randomUUID().toString()
468 String sdncActivateRollbackReq = sdncActivateReq.replace(">activate<", ">deactivate<").replace(">CreateTunnelXConnInstance<", ">DeleteTunnelXConnInstance<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<")
469 def rollbackData = execution.getVariable("rollbackData")
470 rollbackData.put(Prefix, "sdncActivateRollbackReq", sdncActivateRollbackReq)
471 execution.setVariable("rollbackData", rollbackData)
473 msoLogger.debug("sdncActivateRollbackReq:\n" + sdncActivateRollbackReq)
474 msoLogger.debug("rollbackData:\n" + rollbackData.toString())
476 } catch (BpmnError e) {
478 } catch(Exception ex) {
479 msg = "Exception in preProcessSDNCActivate. " + ex.getMessage()
481 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
483 msoLogger.trace("end preProcessSDNCActivate")
486 public void validateSDNCResp(DelegateExecution execution, String response, String method){
489 msoLogger.trace("start ValidateSDNCResponse Process")
493 WorkflowException workflowException = execution.getVariable("WorkflowException")
494 msoLogger.debug("workflowException: " + workflowException)
496 boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator")
497 msoLogger.debug("SDNCResponse: " + response)
499 SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this)
500 sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator)
502 if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){
503 msoLogger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + response)
505 if (!"get".equals(method))
507 def rollbackData = execution.getVariable("rollbackData")
508 rollbackData.put(Prefix, "rollback" + "SDNC" + method, "true")
509 execution.setVariable("rollbackData", rollbackData)
513 msoLogger.debug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.")
514 throw new BpmnError("MSOWorkflowException")
516 } catch (BpmnError e) {
518 } catch(Exception ex) {
519 msg = "Exception in validateSDNCResp. " + ex.getMessage()
521 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
523 msoLogger.trace("end ValidateSDNCResp Process")
526 public void preProcessSDNCGet(DelegateExecution execution){
528 msoLogger.trace("start preProcessSDNCGet")
531 def callbackUrl = execution.getVariable("sdncCallbackUrl")
532 // serviceOperation (URI for topology GET) will be retrieved from "selflink" from AAI if active AR exists in AAI
533 // or from "object-path" in SDNC response for assign when AR does not exist in AA
535 String serviceOperation = ""
537 if (execution.getVariable("foundActiveAR")) {
538 def aaiQueryResponse = execution.getVariable("aaiARGetResponse")
539 serviceOperation = utils.getNodeText(aaiQueryResponse, "selflink")
540 msoLogger.debug("AR service operation/aaiARSelfLink: " + serviceOperation)
544 String response = execution.getVariable("sdncAssignResponse")
545 String data = utils.getNodeXml(response, "response-data")
546 msoLogger.debug("Assign responseData: " + data)
547 serviceOperation = utils.getNodeText(data, "object-path")
548 msoLogger.debug("AR service operation:" + serviceOperation)
551 String serviceInstanceId = execution.getVariable("serviceInstanceId")
552 String sdncRequestId = UUID.randomUUID().toString()
554 //neeed the same url as used by vfmodules
555 String SDNCGetRequest =
556 """<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.onap/so/request/types/v1"
557 xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"
558 xmlns:sdncadapter="http://org.onap/workflow/sdnc/adapter/schema/v1">
559 <sdncadapter:RequestHeader>
560 <sdncadapter:RequestId>${MsoUtils.xmlEscape(sdncRequestId)}</sdncadapter:RequestId>
561 <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId>
562 <sdncadapter:SvcAction>query</sdncadapter:SvcAction>
563 <sdncadapter:SvcOperation>${MsoUtils.xmlEscape(serviceOperation)}</sdncadapter:SvcOperation>
564 <sdncadapter:CallbackUrl>${MsoUtils.xmlEscape(callbackUrl)}</sdncadapter:CallbackUrl>
565 <sdncadapter:MsoAction>vfmodule</sdncadapter:MsoAction>
566 </sdncadapter:RequestHeader>
567 <sdncadapterworkflow:SDNCRequestData></sdncadapterworkflow:SDNCRequestData>
568 </sdncadapterworkflow:SDNCAdapterWorkflowRequest>"""
570 execution.setVariable("sdncGetRequest", SDNCGetRequest)
573 msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occurred Processing preProcessSDNCGetRequest.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
574 exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during SDNC GET Method:\n" + e.getMessage())
576 msoLogger.trace("end preProcessSDNCGet")
579 public void updateAaiAROrchStatus(DelegateExecution execution, String status){
581 msoLogger.trace("start updateAaiAROrchStatus")
582 String aaiARPath = execution.getVariable("aaiARPath") //set during query (existing AR) or create
583 AllottedResourceUtils arUtils = new AllottedResourceUtils(this)
584 String orchStatus = arUtils.updateAROrchStatus(execution, status, aaiARPath)
585 msoLogger.trace("end updateAaiAROrchStatus")
588 public void generateOutputs(DelegateExecution execution)
591 msoLogger.trace("start generateOutputs")
593 String sdncGetResponse = execution.getVariable("enhancedCallbackRequestData") //unescaped
594 msoLogger.debug("resp:" + sdncGetResponse)
595 String arData = utils.getNodeXml(sdncGetResponse, "tunnelxconn-topology")
596 arData = utils.removeXmlNamespaces(arData)
598 String txca = utils.getNodeXml(arData, "tunnelxconn-assignments")
599 execution.setVariable("vni", utils.getNodeText(txca, "vni"))
600 execution.setVariable("vgmuxBearerIP", utils.getNodeText(txca, "vgmux-bearer-ip"))
601 execution.setVariable("vgmuxLanIP", utils.getNodeText(txca, "vgmux-lan-ip"))
603 String ari = utils.getNodeXml(arData, "allotted-resource-identifiers")
604 execution.setVariable("allotedResourceName", utils.getNodeText(ari, "allotted-resource-name"))
605 } catch (BpmnError e) {
606 msoLogger.debug("BPMN Error in generateOutputs ")
607 } catch(Exception ex) {
608 String msg = "Exception in generateOutputs " + ex.getMessage()
611 msoLogger.trace("end generateOutputs")
615 public void preProcessRollback (DelegateExecution execution) {
617 msoLogger.trace("start preProcessRollback")
620 Object workflowException = execution.getVariable("WorkflowException");
622 if (workflowException instanceof WorkflowException) {
623 msoLogger.debug("Prev workflowException: " + workflowException.getErrorMessage())
624 execution.setVariable("prevWorkflowException", workflowException);
625 //execution.setVariable("WorkflowException", null);
627 } catch (BpmnError e) {
628 msoLogger.debug("BPMN Error during preProcessRollback")
629 } catch(Exception ex) {
630 String msg = "Exception in preProcessRollback. " + ex.getMessage()
633 msoLogger.trace("end preProcessRollback")
636 public void postProcessRollback (DelegateExecution execution) {
638 msoLogger.trace("start postProcessRollback")
641 Object workflowException = execution.getVariable("prevWorkflowException");
642 if (workflowException instanceof WorkflowException) {
643 msoLogger.debug("Setting prevException to WorkflowException: ")
644 execution.setVariable("WorkflowException", workflowException);
646 execution.setVariable("rollbackData", null)
647 } catch (BpmnError b) {
648 msoLogger.debug("BPMN Error during postProcessRollback")
650 } catch(Exception ex) {
651 msg = "Exception in postProcessRollback. " + ex.getMessage()
654 msoLogger.trace("end postProcessRollback")