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.camunda.bpm.engine.delegate.BpmnError
24 import org.camunda.bpm.engine.delegate.DelegateExecution
25 import org.onap.aai.domain.yang.AllottedResource
26 import org.onap.so.bpmn.common.scripts.*
27 import org.onap.so.bpmn.core.RollbackData
28 import org.onap.so.bpmn.core.UrnPropertiesReader
29 import org.onap.so.bpmn.core.WorkflowException
30 import org.onap.so.bpmn.core.json.JsonUtils
31 import org.onap.so.client.aai.AAIObjectType
32 import org.onap.so.client.aai.AAIResourcesClient
33 import org.onap.so.client.aai.entities.uri.AAIResourceUri
34 import org.onap.so.client.aai.entities.uri.AAIUriFactory
35 import org.onap.so.logger.MessageEnum
36 import org.onap.so.logger.MsoLogger
38 import javax.ws.rs.NotFoundException
39 import javax.ws.rs.core.UriBuilder
41 import static org.apache.commons.lang3.StringUtils.isBlank
44 * This groovy class supports the <class>DoCreateAllottedResourceBRG.bpmn</class> process.
49 * @param - msoRequestId
50 * @param - isDEbugLogEnabled
51 * @param - disableRollback
52 * @param - failExists - O
53 * @param - serviceInstanceId
54 * @param - globalCustomerId - O
55 * @param - subscriptionServiceType - O
56 * @param - parentServiceInstanceId
57 * @param - allottedReourceId - O
58 * @param - allottedResourceModelInfo
59 * @param - allottedResourceRole
60 * @param - allottedResourceType
61 * @param - brgWanMacAddress
63 * @param - vgmuxBearerIP
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
73 public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{
74 private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCreateAllottedResourceBRG.class);
76 String Prefix="DCARBRG_"
77 ExceptionUtil exceptionUtil = new ExceptionUtil()
78 JsonUtils jsonUtil = new JsonUtils()
80 public void preProcessRequest (DelegateExecution execution) {
84 msoLogger.trace("start preProcessRequest")
87 execution.setVariable("prefix", Prefix)
90 String sdncCallbackUrl = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution)
91 if (isBlank(sdncCallbackUrl)) {
92 msg = "mso.workflow.sdncadapter.callback is null"
94 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
96 execution.setVariable("sdncCallbackUrl", sdncCallbackUrl)
97 msoLogger.debug("SDNC Callback URL: " + sdncCallbackUrl)
99 String sdncReplDelay = UrnPropertiesReader.getVariable("mso.workflow.sdnc.replication.delay",execution)
100 if (isBlank(sdncReplDelay)) {
101 msg = "mso.workflow.sdnc.replication.delay is null"
103 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
105 execution.setVariable("sdncReplDelay", sdncReplDelay)
106 msoLogger.debug("SDNC replication delay: " + sdncReplDelay)
109 if (isBlank(execution.getVariable("serviceInstanceId"))){
110 msg = "Input serviceInstanceId is null"
112 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
114 if (isBlank(execution.getVariable("parentServiceInstanceId"))) {
115 msg = "Input parentServiceInstanceId is null"
117 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
119 if (isBlank(execution.getVariable("allottedResourceModelInfo"))) {
120 msg = "Input allottedResourceModelInfo is null"
122 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
124 if (isBlank(execution.getVariable("vni"))) {
125 msg = "Input vni is null"
127 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
129 if (isBlank(execution.getVariable("vgmuxBearerIP"))) {
130 msg = "Input vgmuxBearerIP is null"
132 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
134 if (isBlank(execution.getVariable("brgWanMacAddress"))) {
135 msg = "Input brgWanMacAddress is null"
137 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
139 if (isBlank(execution.getVariable("allottedResourceRole"))) {
140 msg = "Input allottedResourceRole is null"
142 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
144 if (isBlank(execution.getVariable("allottedResourceType"))) {
145 msg = "Input allottedResourceType is null"
147 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
150 msoLogger.debug("Rethrowing MSOWorkflowException")
152 } catch (Exception ex){
153 msg = "Exception in preProcessRequest " + ex.getMessage()
155 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
157 msoLogger.trace("end preProcessRequest")
161 * Gets the service instance uri from aai
163 public void getServiceInstance(DelegateExecution execution) {
164 msoLogger.trace("getServiceInstance ")
166 String serviceInstanceId = execution.getVariable('serviceInstanceId')
168 AAIResourcesClient resourceClient = new AAIResourcesClient()
169 AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId)
171 if(resourceClient.exists(uri)){
172 execution.setVariable("CSI_resourceLink", uri.build().toString())
174 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service instance was not found in aai")
177 }catch(BpmnError e) {
179 }catch (Exception ex){
180 String msg = "Exception in getServiceInstance. " + ex.getMessage()
182 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
184 msoLogger.trace("Exit getServiceInstance ")
187 public void getAaiAR (DelegateExecution execution) {
190 msoLogger.trace("start getAaiAR")
192 String arType = execution.getVariable("allottedResourceType")
193 String arRole = execution.getVariable("allottedResourceRole")
195 AllottedResourceUtils arUtils = new AllottedResourceUtils(this)
196 String orchStatus = arUtils.getAROrchStatus(execution)
200 if (orchStatus != null) // AR was found
202 if ("true".equals(execution.getVariable("failExists")))
204 errorMsg = "Allotted resource " + arType + " with Role " + arRole + " already exists"
208 if ("Active".equals(orchStatus))
210 execution.setVariable("foundActiveAR", true)
212 else // blanks included
214 errorMsg = "Allotted Resource " + arType + " with Role " + arRole + " already exists in an incomplete state -" + orchStatus
218 if (!isBlank(errorMsg)) {
219 msoLogger.debug(errorMsg)
220 exceptionUtil.buildAndThrowWorkflowException(execution, 500, errorMsg)
222 msoLogger.trace("end getAaiAR")
225 public void getParentServiceInstance(DelegateExecution execution) {
226 msoLogger.trace("getParentServiceInstance ")
228 String serviceInstanceId = execution.getVariable('parentServiceInstanceId')
230 AAIResourcesClient resourceClient = new AAIResourcesClient()
231 AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId)
234 //just to make sure the serviceInstance exists
236 execution.setVariable("PSI_resourceLink", uri)
237 } catch (NotFoundException e) {
238 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service instance was not found in aai")
241 }catch(BpmnError e) {
243 }catch (Exception ex){
244 String msg = "Exception in getParentServiceInstance. " + ex.getMessage()
246 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
248 msoLogger.trace("Exit getParentServiceInstance ")
252 public void createAaiAR(DelegateExecution execution) {
255 msoLogger.trace("start createAaiAR")
257 String allottedResourceId = execution.getVariable("allottedResourceId")
258 if (isBlank(allottedResourceId))
260 allottedResourceId = UUID.randomUUID().toString()
261 execution.setVariable("allottedResourceId", allottedResourceId)
265 AAIResourceUri siResourceLink= execution.getVariable("PSI_resourceLink")
267 AAIResourceUri allottedResourceUri = AAIUriFactory.createResourceFromParentURI(siResourceLink, AAIObjectType.ALLOTTED_RESOURCE, allottedResourceId)
269 execution.setVariable("aaiARPath", allottedResourceUri.build().toString());
270 String arType = execution.getVariable("allottedResourceType")
271 String arRole = execution.getVariable("allottedResourceRole")
272 String CSI_resourceLink = execution.getVariable("CSI_resourceLink")
274 String arModelInfo = execution.getVariable("allottedResourceModelInfo")
275 String modelInvariantId = jsonUtil.getJsonValue(arModelInfo, "modelInvariantUuid")
276 String modelVersionId = jsonUtil.getJsonValue(arModelInfo, "modelUuid")
278 AllottedResource resource = new AllottedResource()
279 resource.setId(allottedResourceId)
280 resource.setType(arType)
281 resource.setRole(arRole)
282 resource.setModelInvariantId(modelInvariantId)
283 resource.setModelVersionId(modelVersionId)
284 getAAIClient().create(allottedResourceUri, resource)
285 AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceFromExistingURI(AAIObjectType.SERVICE_INSTANCE, UriBuilder.fromPath(CSI_resourceLink).build())
286 getAAIClient().connect(allottedResourceUri,serviceInstanceUri)
287 }catch (Exception ex) {
288 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Exception in createAaiAR " + ex.getMessage())
291 //start rollback set up
292 RollbackData rollbackData = new RollbackData()
293 def disableRollback = execution.getVariable("disableRollback")
294 rollbackData.put(Prefix, "disableRollback", disableRollback.toString())
295 rollbackData.put(Prefix, "rollbackAAI", "true")
296 rollbackData.put(Prefix, "allottedResourceId", allottedResourceId)
297 rollbackData.put(Prefix, "serviceInstanceId", execution.getVariable("serviceInstanceId"))
298 rollbackData.put(Prefix, "parentServiceInstanceId", execution.getVariable("parentServiceInstanceId"))
299 execution.setVariable("rollbackData", rollbackData)
300 msoLogger.trace("end createAaiAR")
303 public String buildSDNCRequest(DelegateExecution execution, String action, String sdncRequestId) {
307 msoLogger.trace("start buildSDNCRequest")
308 String sdncReq = null
312 String allottedResourceId = execution.getVariable("allottedResourceId")
313 String serviceInstanceId = execution.getVariable("serviceInstanceId")
314 String globalCustomerId = execution.getVariable("globalCustomerId")
315 String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
316 String parentServiceInstanceId = execution.getVariable("parentServiceInstanceId")
317 String callbackUrl = execution.getVariable("sdncCallbackUrl")
318 String requestId = execution.getVariable("msoRequestId")
320 String brgWanMacAddress = execution.getVariable("brgWanMacAddress")
321 String vni = execution.getVariable("vni")
322 String vgmuxBearerIP = execution.getVariable("vgmuxBearerIP")
324 String arModelInfo = execution.getVariable("allottedResourceModelInfo")
325 String modelInvariantId = jsonUtil.getJsonValue(arModelInfo, "modelInvariantUuid")
326 String modelVersion = jsonUtil.getJsonValue(arModelInfo, "modelVersion")
327 String modelUUId = jsonUtil.getJsonValue(arModelInfo, "modelUuid")
328 String modelCustomizationId = jsonUtil.getJsonValue(arModelInfo, "modelCustomizationUuid")
329 String modelName = jsonUtil.getJsonValue(arModelInfo, "modelName")
331 if (modelInvariantId == null) {
332 modelInvariantId = ""
334 if (modelVersion == null) {
337 if (modelUUId == null) {
340 if (modelName == null) {
343 if (modelCustomizationId == null) {
344 modelCustomizationId = ""
348 """<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.onap/so/request/types/v1"
349 xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"
350 xmlns:sdncadapter="http://org.onap/workflow/sdnc/adapter/schema/v1">
351 <sdncadapter:RequestHeader>
352 <sdncadapter:RequestId>${MsoUtils.xmlEscape(sdncRequestId)}</sdncadapter:RequestId>
353 <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId>
354 <sdncadapter:SvcAction>${MsoUtils.xmlEscape(action)}</sdncadapter:SvcAction>
355 <sdncadapter:SvcOperation>brg-topology-operation</sdncadapter:SvcOperation>
356 <sdncadapter:CallbackUrl>${MsoUtils.xmlEscape(callbackUrl)}</sdncadapter:CallbackUrl>
357 </sdncadapter:RequestHeader>
358 <sdncadapterworkflow:SDNCRequestData>
359 <request-information>
360 <request-id>${MsoUtils.xmlEscape(requestId)}</request-id>
361 <request-action>CreateBRGInstance</request-action>
366 </request-information>
367 <service-information>
368 <service-id></service-id>
369 <subscription-service-type>${MsoUtils.xmlEscape(subscriptionServiceType)}</subscription-service-type>
370 <onap-model-information></onap-model-information>
371 <service-instance-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-instance-id>
373 <global-customer-id>${MsoUtils.xmlEscape(globalCustomerId)}</global-customer-id>
374 </service-information>
375 <allotted-resource-information>
376 <allotted-resource-id>${MsoUtils.xmlEscape(allottedResourceId)}</allotted-resource-id>
377 <allotted-resource-type>brg</allotted-resource-type>
378 <parent-service-instance-id>${MsoUtils.xmlEscape(parentServiceInstanceId)}</parent-service-instance-id>
379 <onap-model-information>
380 <model-invariant-uuid>${MsoUtils.xmlEscape(modelInvariantId)}</model-invariant-uuid>
381 <model-uuid>${MsoUtils.xmlEscape(modelUUId)}</model-uuid>
382 <model-customization-uuid>${MsoUtils.xmlEscape(modelCustomizationId)}</model-customization-uuid>
383 <model-version>${MsoUtils.xmlEscape(modelVersion)}</model-version>
384 <model-name>${MsoUtils.xmlEscape(modelName)}</model-name>
385 </onap-model-information>
386 </allotted-resource-information>
388 <brg-wan-mac-address>${MsoUtils.xmlEscape(brgWanMacAddress)}</brg-wan-mac-address>
389 <vni>${MsoUtils.xmlEscape(vni)}</vni>
390 <vgmux-bearer-ip>${MsoUtils.xmlEscape(vgmuxBearerIP)}</vgmux-bearer-ip>
392 </sdncadapterworkflow:SDNCRequestData>
393 </sdncadapterworkflow:SDNCAdapterWorkflowRequest>"""
395 msoLogger.debug("sdncRequest:\n" + sdncReq)
396 sdncReq = utils.formatXml(sdncReq)
398 } catch(Exception ex) {
399 msg = "Exception in buildSDNCRequest. " + ex.getMessage()
401 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
403 msoLogger.trace("end buildSDNCRequest")
407 public void preProcessSDNCAssign(DelegateExecution execution) {
411 msoLogger.trace("start preProcessSDNCAssign")
414 String sdncRequestId = UUID.randomUUID().toString()
415 String sdncAssignReq = buildSDNCRequest(execution, "assign", sdncRequestId)
416 execution.setVariable("sdncAssignRequest", sdncAssignReq)
417 msoLogger.debug("sdncAssignRequest: " + sdncAssignReq)
418 def sdncRequestId2 = UUID.randomUUID().toString()
419 String sdncAssignRollbackReq = sdncAssignReq.replace(">assign<", ">unassign<").replace(">CreateBRGInstance<", ">DeleteBRGInstance<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<")
420 def rollbackData = execution.getVariable("rollbackData")
421 rollbackData.put(Prefix, "sdncAssignRollbackReq", sdncAssignRollbackReq)
422 execution.setVariable("rollbackData", rollbackData)
424 msoLogger.debug("sdncAssignRollbackReq:\n" + sdncAssignRollbackReq)
425 msoLogger.debug("rollbackData:\n" + rollbackData.toString())
427 } catch (BpmnError e) {
429 } catch(Exception ex) {
430 msg = "Exception in preProcessSDNCAssign. " + ex.getMessage()
432 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
434 msoLogger.trace("end preProcessSDNCAssign")
437 public void preProcessSDNCCreate(DelegateExecution execution) {
441 msoLogger.trace("start preProcessSDNCCreate")
444 String sdncRequestId = UUID.randomUUID().toString()
445 String sdncCreateReq = buildSDNCRequest(execution, "create", sdncRequestId)
446 execution.setVariable("sdncCreateRequest", sdncCreateReq)
447 msoLogger.debug("sdncCreateReq: " + sdncCreateReq)
448 def sdncRequestId2 = UUID.randomUUID().toString()
449 String sdncCreateRollbackReq = sdncCreateReq.replace(">create<", ">delete<").replace(">CreateBRGInstance<", ">DeleteBRGInstance<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<")
450 def rollbackData = execution.getVariable("rollbackData")
451 rollbackData.put(Prefix, "sdncCreateRollbackReq", sdncCreateRollbackReq)
452 execution.setVariable("rollbackData", rollbackData)
454 msoLogger.debug("sdncCreateRollbackReq:\n" + sdncCreateRollbackReq)
455 msoLogger.debug("rollbackData:\n" + rollbackData.toString())
457 } catch (BpmnError e) {
459 } catch(Exception ex) {
460 msg = "Exception in preProcessSDNCCreate. " + ex.getMessage()
462 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
464 msoLogger.trace("end preProcessSDNCCreate")
467 public void preProcessSDNCActivate(DelegateExecution execution) {
471 msoLogger.trace("start preProcessSDNCActivate")
474 String sdncRequestId = UUID.randomUUID().toString()
475 String sdncActivateReq = buildSDNCRequest(execution, "activate", sdncRequestId)
476 execution.setVariable("sdncActivateRequest", sdncActivateReq)
477 msoLogger.debug("sdncActivateReq: " + sdncActivateReq)
478 def sdncRequestId2 = UUID.randomUUID().toString()
479 String sdncActivateRollbackReq = sdncActivateReq.replace(">activate<", ">deactivate<").replace(">CreateBRGInstance<", ">DeleteBRGInstance<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<")
480 def rollbackData = execution.getVariable("rollbackData")
481 rollbackData.put(Prefix, "sdncActivateRollbackReq", sdncActivateRollbackReq)
482 execution.setVariable("rollbackData", rollbackData)
484 msoLogger.debug("sdncActivateRollbackReq:\n" + sdncActivateRollbackReq)
485 msoLogger.debug("rollbackData:\n" + rollbackData.toString())
487 } catch (BpmnError e) {
489 } catch(Exception ex) {
490 msg = "Exception in preProcessSDNCActivate. " + ex.getMessage()
492 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
494 msoLogger.trace("end preProcessSDNCActivate")
497 public void validateSDNCResp(DelegateExecution execution, String response, String method){
500 msoLogger.trace("ValidateSDNCResponse Process")
504 WorkflowException workflowException = execution.getVariable("WorkflowException")
505 msoLogger.debug("workflowException: " + workflowException)
507 boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator")
508 msoLogger.debug("SDNCResponse: " + response)
510 SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this)
511 sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator)
513 if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){
514 msoLogger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + response)
516 if (!"get".equals(method))
518 def rollbackData = execution.getVariable("rollbackData")
519 rollbackData.put(Prefix, "rollback" + "SDNC" + method, "true")
520 execution.setVariable("rollbackData", rollbackData)
524 msoLogger.debug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.")
525 throw new BpmnError("MSOWorkflowException")
527 } catch (BpmnError e) {
529 } catch(Exception ex) {
530 msg = "Exception in validateSDNCResp. " + ex.getMessage()
532 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
534 msoLogger.trace("End ValidateSDNCResp Process")
537 public void preProcessSDNCGet(DelegateExecution execution){
539 msoLogger.trace("start preProcessSDNCGet")
542 def callbackUrl = execution.getVariable("sdncCallbackUrl")
543 // serviceOperation (URI for topology GET) will be retrieved from "selflink" from AAI if active AR exists in AAI
544 // or from "object-path" in SDNC response for assign when AR does not exist in AA
546 String serviceOperation = ""
548 if (execution.getVariable("foundActiveAR")) {
549 def aaiQueryResponse = execution.getVariable("aaiARGetResponse")
550 serviceOperation = utils.getNodeText(aaiQueryResponse, "selflink")
551 msoLogger.debug("AR service operation/aaiARSelfLink: " + serviceOperation)
555 String response = execution.getVariable("sdncAssignResponse")
556 String data = utils.getNodeXml(response, "response-data")
557 msoLogger.debug("Assign responseData: " + data)
558 serviceOperation = utils.getNodeText(data, "object-path")
559 msoLogger.debug("AR service operation:" + serviceOperation)
562 String serviceInstanceId = execution.getVariable("serviceInstanceId")
563 String sdncRequestId = UUID.randomUUID().toString()
565 //neeed the same url as used by vfmodules
566 String SDNCGetRequest =
567 """<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.onap/so/request/types/v1"
568 xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"
569 xmlns:sdncadapter="http://org.onap/workflow/sdnc/adapter/schema/v1">
570 <sdncadapter:RequestHeader>
571 <sdncadapter:RequestId>${MsoUtils.xmlEscape(sdncRequestId)}</sdncadapter:RequestId>
572 <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId>
573 <sdncadapter:SvcAction>query</sdncadapter:SvcAction>
574 <sdncadapter:SvcOperation>${MsoUtils.xmlEscape(serviceOperation)}</sdncadapter:SvcOperation>
575 <sdncadapter:CallbackUrl>${MsoUtils.xmlEscape(callbackUrl)}</sdncadapter:CallbackUrl>
576 <sdncadapter:MsoAction>vfmodule</sdncadapter:MsoAction>
577 </sdncadapter:RequestHeader>
578 <sdncadapterworkflow:SDNCRequestData></sdncadapterworkflow:SDNCRequestData>
579 </sdncadapterworkflow:SDNCAdapterWorkflowRequest>"""
581 execution.setVariable("sdncGetRequest", SDNCGetRequest)
584 msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occurred Processing preProcessSDNCGetRequest.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
585 exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during SDNC GET Method:\n" + e.getMessage())
587 msoLogger.trace("end preProcessSDNCGet")
590 public void updateAaiAROrchStatus(DelegateExecution execution, String status){
592 msoLogger.trace("start updateAaiAROrchStatus")
593 String aaiARPath = execution.getVariable("aaiARPath") //set during query (existing AR) or create
594 AllottedResourceUtils arUtils = new AllottedResourceUtils(this)
595 String orchStatus = arUtils.updateAROrchStatus(execution, status, aaiARPath)
596 msoLogger.trace("end updateAaiAROrchStatus")
599 public void generateOutputs(DelegateExecution execution)
602 msoLogger.trace("start generateOutputs")
604 String sdncGetResponse = execution.getVariable("enhancedCallbackRequestData") //unescaped
605 msoLogger.debug("resp:" + sdncGetResponse)
606 String arData = utils.getNodeXml(sdncGetResponse, "brg-topology")
607 arData = utils.removeXmlNamespaces(arData)
609 String brga = utils.getNodeXml(arData, "brg-assignments")
610 String ari = utils.getNodeXml(arData, "allotted-resource-identifiers")
611 execution.setVariable("allotedResourceName", utils.getNodeText(ari, "allotted-resource-name"))
612 } catch (BpmnError e) {
613 msoLogger.debug("BPMN Error in generateOutputs ")
614 } catch(Exception ex) {
615 String msg = "Exception in generateOutputs " + ex.getMessage()
618 msoLogger.trace("end generateOutputs")
622 public void preProcessRollback (DelegateExecution execution) {
624 msoLogger.trace("start preProcessRollback")
627 Object workflowException = execution.getVariable("WorkflowException");
629 if (workflowException instanceof WorkflowException) {
630 msoLogger.debug("Prev workflowException: " + workflowException.getErrorMessage())
631 execution.setVariable("prevWorkflowException", workflowException);
632 //execution.setVariable("WorkflowException", null);
634 } catch (BpmnError e) {
635 msoLogger.debug("BPMN Error during preProcessRollback")
636 } catch(Exception ex) {
637 String msg = "Exception in preProcessRollback. " + ex.getMessage()
640 msoLogger.trace("end preProcessRollback")
643 public void postProcessRollback (DelegateExecution execution) {
645 msoLogger.trace("start postProcessRollback")
648 Object workflowException = execution.getVariable("prevWorkflowException");
649 if (workflowException instanceof WorkflowException) {
650 msoLogger.debug("Setting prevException to WorkflowException: ")
651 execution.setVariable("WorkflowException", workflowException);
653 execution.setVariable("rollbackData", null)
654 } catch (BpmnError b) {
655 msoLogger.debug("BPMN Error during postProcessRollback")
657 } catch(Exception ex) {
658 msg = "Exception in postProcessRollback. " + ex.getMessage()
661 msoLogger.trace("end postProcessRollback")