2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Modifications Copyright (c) 2019 Samsung
8 * ================================================================================
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
20 * ============LICENSE_END=========================================================
23 package org.onap.so.bpmn.vcpe.scripts
25 import static org.apache.commons.lang3.StringUtils.isBlank
26 import javax.ws.rs.core.UriBuilder
27 import org.camunda.bpm.engine.delegate.BpmnError
28 import org.camunda.bpm.engine.delegate.DelegateExecution
29 import org.onap.aai.domain.yang.AllottedResource
30 import org.onap.aaiclient.client.aai.AAIResourcesClient
31 import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
32 import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
33 import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder
34 import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types
35 import org.onap.logging.filter.base.ErrorCode
36 import org.onap.so.bpmn.common.scripts.*
37 import org.onap.so.bpmn.core.RollbackData
38 import org.onap.so.bpmn.core.UrnPropertiesReader
39 import org.onap.so.bpmn.core.WorkflowException
40 import org.onap.so.bpmn.core.json.JsonUtils
41 import org.onap.so.logger.LoggingAnchor
42 import org.onap.so.logger.MessageEnum
43 import org.slf4j.Logger
44 import org.slf4j.LoggerFactory
47 * This groovy class supports the <class>DoCreateAllottedResourceBRG.bpmn</class> process.
52 * @param - msoRequestId
53 * @param - isDEbugLogEnabled
54 * @param - disableRollback
55 * @param - failExists - O
56 * @param - serviceInstanceId
57 * @param - globalCustomerId - O
58 * @param - subscriptionServiceType - O
59 * @param - parentServiceInstanceId
60 * @param - allottedReourceId - O
61 * @param - allottedResourceModelInfo
62 * @param - allottedResourceRole
63 * @param - allottedResourceType
64 * @param - brgWanMacAddress
66 * @param - vgmuxBearerIP
69 * @param - rollbackData (localRB->null)
70 * @param - rolledBack (no localRB->null, localRB F->false, localRB S->true)
71 * @param - WorkflowException - O
72 * @param - allottedResourceId
73 * @param - allottedResourceName
76 public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{
77 private static final Logger logger = LoggerFactory.getLogger(DoCreateAllottedResourceBRG.class);
79 String Prefix="DCARBRG_"
80 ExceptionUtil exceptionUtil = new ExceptionUtil()
81 JsonUtils jsonUtil = new JsonUtils()
83 public void preProcessRequest (DelegateExecution execution) {
87 logger.trace("start preProcessRequest")
90 execution.setVariable("prefix", Prefix)
93 String sdncCallbackUrl = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution)
94 if (isBlank(sdncCallbackUrl)) {
95 msg = "mso.workflow.sdncadapter.callback is null"
97 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
99 execution.setVariable("sdncCallbackUrl", sdncCallbackUrl)
100 logger.debug("SDNC Callback URL: " + sdncCallbackUrl)
102 String sdncReplDelay = UrnPropertiesReader.getVariable("mso.workflow.sdnc.replication.delay",execution)
103 if (isBlank(sdncReplDelay)) {
104 msg = "mso.workflow.sdnc.replication.delay is null"
106 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
108 execution.setVariable("sdncReplDelay", sdncReplDelay)
109 logger.debug("SDNC replication delay: " + sdncReplDelay)
112 if (isBlank(execution.getVariable("serviceInstanceId"))){
113 msg = "Input serviceInstanceId is null"
115 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
117 if (isBlank(execution.getVariable("parentServiceInstanceId"))) {
118 msg = "Input parentServiceInstanceId is null"
120 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
122 if (isBlank(execution.getVariable("allottedResourceModelInfo"))) {
123 msg = "Input allottedResourceModelInfo is null"
125 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
127 if (isBlank(execution.getVariable("vni"))) {
128 msg = "Input vni is null"
130 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
132 if (isBlank(execution.getVariable("vgmuxBearerIP"))) {
133 msg = "Input vgmuxBearerIP is null"
135 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
137 if (isBlank(execution.getVariable("brgWanMacAddress"))) {
138 msg = "Input brgWanMacAddress is null"
140 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
142 if (isBlank(execution.getVariable("allottedResourceRole"))) {
143 msg = "Input allottedResourceRole is null"
145 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
147 if (isBlank(execution.getVariable("allottedResourceType"))) {
148 msg = "Input allottedResourceType is null"
150 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
153 logger.debug("Rethrowing MSOWorkflowException")
155 } catch (Exception ex){
156 msg = "Exception in preProcessRequest " + ex.getMessage()
158 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
160 logger.trace("end preProcessRequest")
164 * Gets the service instance uri from aai
166 public void getServiceInstance(DelegateExecution execution) {
167 logger.trace("getServiceInstance ")
169 String serviceInstanceId = execution.getVariable('serviceInstanceId')
171 AAIResourcesClient resourceClient = new AAIResourcesClient()
172 AAIResourceUri uri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId))
174 if(resourceClient.exists(uri)){
175 execution.setVariable("CSI_resourceLink", uri.build().toString())
177 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service instance was not found in aai")
180 }catch(BpmnError e) {
182 }catch (Exception ex){
183 String msg = "Exception in getServiceInstance. " + ex.getMessage()
185 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
187 logger.trace("Exit getServiceInstance ")
190 public void getAaiAR (DelegateExecution execution) {
193 logger.trace("start getAaiAR")
195 String arType = execution.getVariable("allottedResourceType")
196 String arRole = execution.getVariable("allottedResourceRole")
198 AllottedResourceUtils arUtils = new AllottedResourceUtils(this)
199 String orchStatus = arUtils.getAROrchStatus(execution)
203 if (orchStatus != null) // AR was found
205 if ("true".equals(execution.getVariable("failExists")))
207 errorMsg = "Allotted resource " + arType + " with Role " + arRole + " already exists"
211 if ("Active".equals(orchStatus))
213 execution.setVariable("foundActiveAR", true)
215 else // blanks included
217 errorMsg = "Allotted Resource " + arType + " with Role " + arRole + " already exists in an incomplete state -" + orchStatus
221 if (!isBlank(errorMsg)) {
222 logger.debug(errorMsg)
223 exceptionUtil.buildAndThrowWorkflowException(execution, 500, errorMsg)
225 logger.trace("end getAaiAR")
228 public void getParentServiceInstance(DelegateExecution execution) {
229 logger.trace("getParentServiceInstance ")
231 String serviceInstanceId = execution.getVariable('parentServiceInstanceId')
233 AAIResourcesClient resourceClient = new AAIResourcesClient()
234 AAIResourceUri uri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId))
236 //just to make sure the serviceInstance exists
237 if (resourceClient.exists(uri)) {
238 execution.setVariable("PSI_resourceLink", uri)
240 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service instance was not found in aai")
243 }catch(BpmnError e) {
245 }catch (Exception ex){
246 String msg = "Exception in getParentServiceInstance. " + ex.getMessage()
248 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
250 logger.trace("Exit getParentServiceInstance ")
254 public void createAaiAR(DelegateExecution execution) {
257 logger.trace("start createAaiAR")
259 String allottedResourceId = execution.getVariable("allottedResourceId")
260 if (isBlank(allottedResourceId))
262 allottedResourceId = UUID.randomUUID().toString()
263 execution.setVariable("allottedResourceId", allottedResourceId)
267 AAIResourceUri siResourceLink= execution.getVariable("PSI_resourceLink")
269 AAIResourceUri allottedResourceUri = AAIUriFactory.createResourceFromParentURI(siResourceLink, Types.ALLOTTED_RESOURCE.getFragment(allottedResourceId))
271 execution.setVariable("aaiARPath", allottedResourceUri.build().toString());
272 String arType = execution.getVariable("allottedResourceType")
273 String arRole = execution.getVariable("allottedResourceRole")
274 String CSI_resourceLink = execution.getVariable("CSI_resourceLink")
276 String arModelInfo = execution.getVariable("allottedResourceModelInfo")
277 String modelInvariantId = jsonUtil.getJsonValue(arModelInfo, "modelInvariantUuid")
278 String modelVersionId = jsonUtil.getJsonValue(arModelInfo, "modelUuid")
280 AllottedResource resource = new AllottedResource()
281 resource.setId(allottedResourceId)
282 resource.setType(arType)
283 resource.setRole(arRole)
284 resource.setModelInvariantId(modelInvariantId)
285 resource.setModelVersionId(modelVersionId)
286 getAAIClient().create(allottedResourceUri, resource)
287 AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceFromExistingURI(Types.SERVICE_INSTANCE, UriBuilder.fromPath(CSI_resourceLink).build())
288 getAAIClient().connect(allottedResourceUri,serviceInstanceUri)
289 }catch (Exception ex) {
290 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Exception in createAaiAR " + ex.getMessage())
293 //start rollback set up
294 RollbackData rollbackData = new RollbackData()
295 def disableRollback = execution.getVariable("disableRollback")
296 rollbackData.put(Prefix, "disableRollback", disableRollback.toString())
297 rollbackData.put(Prefix, "rollbackAAI", "true")
298 rollbackData.put(Prefix, "allottedResourceId", allottedResourceId)
299 rollbackData.put(Prefix, "serviceInstanceId", execution.getVariable("serviceInstanceId"))
300 rollbackData.put(Prefix, "parentServiceInstanceId", execution.getVariable("parentServiceInstanceId"))
301 execution.setVariable("rollbackData", rollbackData)
302 logger.trace("end createAaiAR")
305 public String buildSDNCRequest(DelegateExecution execution, String action, String sdncRequestId) {
309 logger.trace("start buildSDNCRequest")
310 String sdncReq = null
314 String allottedResourceId = execution.getVariable("allottedResourceId")
315 String serviceInstanceId = execution.getVariable("serviceInstanceId")
316 String globalCustomerId = execution.getVariable("globalCustomerId")
317 String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
318 String parentServiceInstanceId = execution.getVariable("parentServiceInstanceId")
319 String callbackUrl = execution.getVariable("sdncCallbackUrl")
320 String requestId = execution.getVariable("msoRequestId")
322 String brgWanMacAddress = execution.getVariable("brgWanMacAddress")
323 String vni = execution.getVariable("vni")
324 String vgmuxBearerIP = execution.getVariable("vgmuxBearerIP")
326 String arModelInfo = execution.getVariable("allottedResourceModelInfo")
327 String modelInvariantId = jsonUtil.getJsonValue(arModelInfo, "modelInvariantUuid")
328 String modelVersion = jsonUtil.getJsonValue(arModelInfo, "modelVersion")
329 String modelUUId = jsonUtil.getJsonValue(arModelInfo, "modelUuid")
330 String modelCustomizationId = jsonUtil.getJsonValue(arModelInfo, "modelCustomizationUuid")
331 String modelName = jsonUtil.getJsonValue(arModelInfo, "modelName")
333 if (modelInvariantId == null) {
334 modelInvariantId = ""
336 if (modelVersion == null) {
339 if (modelUUId == null) {
342 if (modelName == null) {
345 if (modelCustomizationId == null) {
346 modelCustomizationId = ""
350 """<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.onap/so/request/types/v1"
351 xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"
352 xmlns:sdncadapter="http://org.onap/workflow/sdnc/adapter/schema/v1">
353 <sdncadapter:RequestHeader>
354 <sdncadapter:RequestId>${MsoUtils.xmlEscape(sdncRequestId)}</sdncadapter:RequestId>
355 <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId>
356 <sdncadapter:SvcAction>${MsoUtils.xmlEscape(action)}</sdncadapter:SvcAction>
357 <sdncadapter:SvcOperation>brg-topology-operation</sdncadapter:SvcOperation>
358 <sdncadapter:CallbackUrl>${MsoUtils.xmlEscape(callbackUrl)}</sdncadapter:CallbackUrl>
359 </sdncadapter:RequestHeader>
360 <sdncadapterworkflow:SDNCRequestData>
361 <request-information>
362 <request-id>${MsoUtils.xmlEscape(requestId)}</request-id>
363 <request-action>CreateBRGInstance</request-action>
368 </request-information>
369 <service-information>
370 <service-id></service-id>
371 <subscription-service-type>${MsoUtils.xmlEscape(subscriptionServiceType)}</subscription-service-type>
372 <onap-model-information></onap-model-information>
373 <service-instance-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-instance-id>
375 <global-customer-id>${MsoUtils.xmlEscape(globalCustomerId)}</global-customer-id>
376 </service-information>
377 <allotted-resource-information>
378 <allotted-resource-id>${MsoUtils.xmlEscape(allottedResourceId)}</allotted-resource-id>
379 <allotted-resource-type>brg</allotted-resource-type>
380 <parent-service-instance-id>${MsoUtils.xmlEscape(parentServiceInstanceId)}</parent-service-instance-id>
381 <onap-model-information>
382 <model-invariant-uuid>${MsoUtils.xmlEscape(modelInvariantId)}</model-invariant-uuid>
383 <model-uuid>${MsoUtils.xmlEscape(modelUUId)}</model-uuid>
384 <model-customization-uuid>${MsoUtils.xmlEscape(modelCustomizationId)}</model-customization-uuid>
385 <model-version>${MsoUtils.xmlEscape(modelVersion)}</model-version>
386 <model-name>${MsoUtils.xmlEscape(modelName)}</model-name>
387 </onap-model-information>
388 </allotted-resource-information>
390 <brg-wan-mac-address>${MsoUtils.xmlEscape(brgWanMacAddress)}</brg-wan-mac-address>
391 <vni>${MsoUtils.xmlEscape(vni)}</vni>
392 <vgmux-bearer-ip>${MsoUtils.xmlEscape(vgmuxBearerIP)}</vgmux-bearer-ip>
394 </sdncadapterworkflow:SDNCRequestData>
395 </sdncadapterworkflow:SDNCAdapterWorkflowRequest>"""
397 logger.debug("sdncRequest:\n" + sdncReq)
398 sdncReq = utils.formatXml(sdncReq)
400 } catch(Exception ex) {
401 msg = "Exception in buildSDNCRequest. " + ex.getMessage()
403 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
405 logger.trace("end buildSDNCRequest")
409 public void preProcessSDNCAssign(DelegateExecution execution) {
413 logger.trace("start preProcessSDNCAssign")
416 String sdncRequestId = UUID.randomUUID().toString()
417 String sdncAssignReq = buildSDNCRequest(execution, "assign", sdncRequestId)
418 execution.setVariable("sdncAssignRequest", sdncAssignReq)
419 logger.debug("sdncAssignRequest: " + sdncAssignReq)
420 def sdncRequestId2 = UUID.randomUUID().toString()
421 String sdncAssignRollbackReq = sdncAssignReq.replace(">assign<", ">unassign<").replace(">CreateBRGInstance<", ">DeleteBRGInstance<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<")
422 def rollbackData = execution.getVariable("rollbackData")
423 rollbackData.put(Prefix, "sdncAssignRollbackReq", sdncAssignRollbackReq)
424 execution.setVariable("rollbackData", rollbackData)
426 logger.debug("sdncAssignRollbackReq:\n" + sdncAssignRollbackReq)
427 logger.debug("rollbackData:\n" + rollbackData.toString())
429 } catch (BpmnError e) {
431 } catch(Exception ex) {
432 msg = "Exception in preProcessSDNCAssign. " + ex.getMessage()
434 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
436 logger.trace("end preProcessSDNCAssign")
439 public void preProcessSDNCCreate(DelegateExecution execution) {
443 logger.trace("start preProcessSDNCCreate")
446 String sdncRequestId = UUID.randomUUID().toString()
447 String sdncCreateReq = buildSDNCRequest(execution, "create", sdncRequestId)
448 execution.setVariable("sdncCreateRequest", sdncCreateReq)
449 logger.debug("sdncCreateReq: " + sdncCreateReq)
450 def sdncRequestId2 = UUID.randomUUID().toString()
451 String sdncCreateRollbackReq = sdncCreateReq.replace(">create<", ">delete<").replace(">CreateBRGInstance<", ">DeleteBRGInstance<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<")
452 def rollbackData = execution.getVariable("rollbackData")
453 rollbackData.put(Prefix, "sdncCreateRollbackReq", sdncCreateRollbackReq)
454 execution.setVariable("rollbackData", rollbackData)
456 logger.debug("sdncCreateRollbackReq:\n" + sdncCreateRollbackReq)
457 logger.debug("rollbackData:\n" + rollbackData.toString())
459 } catch (BpmnError e) {
461 } catch(Exception ex) {
462 msg = "Exception in preProcessSDNCCreate. " + ex.getMessage()
464 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
466 logger.trace("end preProcessSDNCCreate")
469 public void preProcessSDNCActivate(DelegateExecution execution) {
473 logger.trace("start preProcessSDNCActivate")
476 String sdncRequestId = UUID.randomUUID().toString()
477 String sdncActivateReq = buildSDNCRequest(execution, "activate", sdncRequestId)
478 execution.setVariable("sdncActivateRequest", sdncActivateReq)
479 logger.debug("sdncActivateReq: " + sdncActivateReq)
480 def sdncRequestId2 = UUID.randomUUID().toString()
481 String sdncActivateRollbackReq = sdncActivateReq.replace(">activate<", ">deactivate<").replace(">CreateBRGInstance<", ">DeleteBRGInstance<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<")
482 def rollbackData = execution.getVariable("rollbackData")
483 rollbackData.put(Prefix, "sdncActivateRollbackReq", sdncActivateRollbackReq)
484 execution.setVariable("rollbackData", rollbackData)
486 logger.debug("sdncActivateRollbackReq:\n" + sdncActivateRollbackReq)
487 logger.debug("rollbackData:\n" + rollbackData.toString())
489 } catch (BpmnError e) {
491 } catch(Exception ex) {
492 msg = "Exception in preProcessSDNCActivate. " + ex.getMessage()
494 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
496 logger.trace("end preProcessSDNCActivate")
499 public void validateSDNCResp(DelegateExecution execution, String response, String method){
502 logger.trace("ValidateSDNCResponse Process")
506 WorkflowException workflowException = execution.getVariable("WorkflowException")
507 logger.debug("workflowException: " + workflowException)
509 boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator")
510 logger.debug("SDNCResponse: " + response)
512 SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils()
513 sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator)
515 if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){
516 logger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + response)
518 if (!"get".equals(method))
520 def rollbackData = execution.getVariable("rollbackData")
521 rollbackData.put(Prefix, "rollback" + "SDNC" + method, "true")
522 execution.setVariable("rollbackData", rollbackData)
526 logger.debug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.")
527 throw new BpmnError("MSOWorkflowException")
529 } catch (BpmnError e) {
531 } catch(Exception ex) {
532 msg = "Exception in validateSDNCResp. " + ex.getMessage()
534 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
536 logger.trace("End ValidateSDNCResp Process")
539 public void preProcessSDNCGet(DelegateExecution execution){
541 logger.trace("start preProcessSDNCGet")
544 def callbackUrl = execution.getVariable("sdncCallbackUrl")
545 // serviceOperation (URI for topology GET) will be retrieved from "selflink" from AAI if active AR exists in AAI
546 // or from "object-path" in SDNC response for assign when AR does not exist in AA
548 String serviceOperation = ""
550 if (execution.getVariable("foundActiveAR")) {
551 def aaiQueryResponse = execution.getVariable("aaiARGetResponse")
552 serviceOperation = utils.getNodeText(aaiQueryResponse, "selflink")
553 logger.debug("AR service operation/aaiARSelfLink: " + serviceOperation)
557 String response = execution.getVariable("sdncAssignResponse")
558 String data = utils.getNodeXml(response, "response-data")
559 logger.debug("Assign responseData: " + data)
560 serviceOperation = utils.getNodeText(data, "object-path")
561 logger.debug("AR service operation:" + serviceOperation)
564 String serviceInstanceId = execution.getVariable("serviceInstanceId")
565 String sdncRequestId = UUID.randomUUID().toString()
567 //neeed the same url as used by vfmodules
568 String SDNCGetRequest =
569 """<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.onap/so/request/types/v1"
570 xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"
571 xmlns:sdncadapter="http://org.onap/workflow/sdnc/adapter/schema/v1">
572 <sdncadapter:RequestHeader>
573 <sdncadapter:RequestId>${MsoUtils.xmlEscape(sdncRequestId)}</sdncadapter:RequestId>
574 <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId>
575 <sdncadapter:SvcAction>query</sdncadapter:SvcAction>
576 <sdncadapter:SvcOperation>${MsoUtils.xmlEscape(serviceOperation)}</sdncadapter:SvcOperation>
577 <sdncadapter:CallbackUrl>${MsoUtils.xmlEscape(callbackUrl)}</sdncadapter:CallbackUrl>
578 <sdncadapter:MsoAction>vfmodule</sdncadapter:MsoAction>
579 </sdncadapter:RequestHeader>
580 <sdncadapterworkflow:SDNCRequestData></sdncadapterworkflow:SDNCRequestData>
581 </sdncadapterworkflow:SDNCAdapterWorkflowRequest>"""
583 execution.setVariable("sdncGetRequest", SDNCGetRequest)
586 logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
587 "Exception Occurred Processing preProcessSDNCGetRequest.", "BPMN",
588 ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
589 exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during SDNC GET Method:\n" + e.getMessage())
591 logger.trace("end preProcessSDNCGet")
594 public void updateAaiAROrchStatus(DelegateExecution execution, String status){
596 logger.trace("start updateAaiAROrchStatus")
597 String aaiARPath = execution.getVariable("aaiARPath") //set during query (existing AR) or create
598 AllottedResourceUtils arUtils = new AllottedResourceUtils(this)
599 String orchStatus = arUtils.updateAROrchStatus(execution, status, aaiARPath)
600 logger.trace("end updateAaiAROrchStatus")
603 public void generateOutputs(DelegateExecution execution)
606 logger.trace("start generateOutputs")
608 String sdncGetResponse = execution.getVariable("enhancedCallbackRequestData") //unescaped
609 logger.debug("resp:" + sdncGetResponse)
610 String arData = utils.getNodeXml(sdncGetResponse, "brg-topology")
611 arData = utils.removeXmlNamespaces(arData)
613 String brga = utils.getNodeXml(arData, "brg-assignments")
614 String ari = utils.getNodeXml(arData, "allotted-resource-identifiers")
615 execution.setVariable("allotedResourceName", utils.getNodeText(ari, "allotted-resource-name"))
616 } catch (BpmnError e) {
617 logger.debug("BPMN Error in generateOutputs ")
618 } catch(Exception ex) {
619 String msg = "Exception in generateOutputs " + ex.getMessage()
622 logger.trace("end generateOutputs")
626 public void preProcessRollback (DelegateExecution execution) {
628 logger.trace("start preProcessRollback")
631 Object workflowException = execution.getVariable("WorkflowException");
633 if (workflowException instanceof WorkflowException) {
634 logger.debug("Prev workflowException: " + workflowException.getErrorMessage())
635 execution.setVariable("prevWorkflowException", workflowException);
636 //execution.setVariable("WorkflowException", null);
638 } catch (BpmnError e) {
639 logger.debug("BPMN Error during preProcessRollback")
640 } catch(Exception ex) {
641 String msg = "Exception in preProcessRollback. " + ex.getMessage()
644 logger.trace("end preProcessRollback")
647 public void postProcessRollback (DelegateExecution execution) {
649 logger.trace("start postProcessRollback")
652 Object workflowException = execution.getVariable("prevWorkflowException");
653 if (workflowException instanceof WorkflowException) {
654 logger.debug("Setting prevException to WorkflowException: ")
655 execution.setVariable("WorkflowException", workflowException);
657 execution.setVariable("rollbackData", null)
658 } catch (BpmnError b) {
659 logger.debug("BPMN Error during postProcessRollback")
661 } catch(Exception ex) {
662 msg = "Exception in postProcessRollback. " + ex.getMessage()
665 logger.trace("end postProcessRollback")