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 org.onap.so.logger.LoggingAnchor
26 import org.camunda.bpm.engine.delegate.BpmnError
27 import org.camunda.bpm.engine.delegate.DelegateExecution
28 import org.onap.aai.domain.yang.AllottedResource
29 import org.onap.so.bpmn.common.scripts.*
30 import org.onap.so.bpmn.core.RollbackData
31 import org.onap.so.bpmn.core.UrnPropertiesReader
32 import org.onap.so.bpmn.core.WorkflowException
33 import org.onap.so.bpmn.core.json.JsonUtils
34 import org.onap.so.client.aai.AAIObjectType
35 import org.onap.so.client.aai.AAIResourcesClient
36 import org.onap.so.client.aai.entities.uri.AAIResourceUri
37 import org.onap.so.client.aai.entities.uri.AAIUriFactory
38 import org.onap.logging.filter.base.ErrorCode
39 import org.onap.so.logger.MessageEnum
40 import org.slf4j.Logger
41 import org.slf4j.LoggerFactory
43 import javax.ws.rs.NotFoundException
44 import javax.ws.rs.core.UriBuilder
46 import static org.apache.commons.lang3.StringUtils.isBlank
49 * This groovy class supports the <class>DoCreateAllottedResourceBRG.bpmn</class> process.
54 * @param - msoRequestId
55 * @param - isDEbugLogEnabled
56 * @param - disableRollback
57 * @param - failExists - O
58 * @param - serviceInstanceId
59 * @param - globalCustomerId - O
60 * @param - subscriptionServiceType - O
61 * @param - parentServiceInstanceId
62 * @param - allottedReourceId - O
63 * @param - allottedResourceModelInfo
64 * @param - allottedResourceRole
65 * @param - allottedResourceType
66 * @param - brgWanMacAddress
68 * @param - vgmuxBearerIP
71 * @param - rollbackData (localRB->null)
72 * @param - rolledBack (no localRB->null, localRB F->false, localRB S->true)
73 * @param - WorkflowException - O
74 * @param - allottedResourceId
75 * @param - allottedResourceName
78 public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{
79 private static final Logger logger = LoggerFactory.getLogger(DoCreateAllottedResourceBRG.class);
81 String Prefix="DCARBRG_"
82 ExceptionUtil exceptionUtil = new ExceptionUtil()
83 JsonUtils jsonUtil = new JsonUtils()
85 public void preProcessRequest (DelegateExecution execution) {
89 logger.trace("start preProcessRequest")
92 execution.setVariable("prefix", Prefix)
95 String sdncCallbackUrl = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution)
96 if (isBlank(sdncCallbackUrl)) {
97 msg = "mso.workflow.sdncadapter.callback is null"
99 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
101 execution.setVariable("sdncCallbackUrl", sdncCallbackUrl)
102 logger.debug("SDNC Callback URL: " + sdncCallbackUrl)
104 String sdncReplDelay = UrnPropertiesReader.getVariable("mso.workflow.sdnc.replication.delay",execution)
105 if (isBlank(sdncReplDelay)) {
106 msg = "mso.workflow.sdnc.replication.delay is null"
108 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
110 execution.setVariable("sdncReplDelay", sdncReplDelay)
111 logger.debug("SDNC replication delay: " + sdncReplDelay)
114 if (isBlank(execution.getVariable("serviceInstanceId"))){
115 msg = "Input serviceInstanceId is null"
117 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
119 if (isBlank(execution.getVariable("parentServiceInstanceId"))) {
120 msg = "Input parentServiceInstanceId is null"
122 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
124 if (isBlank(execution.getVariable("allottedResourceModelInfo"))) {
125 msg = "Input allottedResourceModelInfo is null"
127 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
129 if (isBlank(execution.getVariable("vni"))) {
130 msg = "Input vni is null"
132 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
134 if (isBlank(execution.getVariable("vgmuxBearerIP"))) {
135 msg = "Input vgmuxBearerIP is null"
137 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
139 if (isBlank(execution.getVariable("brgWanMacAddress"))) {
140 msg = "Input brgWanMacAddress is null"
142 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
144 if (isBlank(execution.getVariable("allottedResourceRole"))) {
145 msg = "Input allottedResourceRole is null"
147 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
149 if (isBlank(execution.getVariable("allottedResourceType"))) {
150 msg = "Input allottedResourceType is null"
152 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
155 logger.debug("Rethrowing MSOWorkflowException")
157 } catch (Exception ex){
158 msg = "Exception in preProcessRequest " + ex.getMessage()
160 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
162 logger.trace("end preProcessRequest")
166 * Gets the service instance uri from aai
168 public void getServiceInstance(DelegateExecution execution) {
169 logger.trace("getServiceInstance ")
171 String serviceInstanceId = execution.getVariable('serviceInstanceId')
173 AAIResourcesClient resourceClient = new AAIResourcesClient()
174 AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId)
176 if(resourceClient.exists(uri)){
177 execution.setVariable("CSI_resourceLink", uri.build().toString())
179 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service instance was not found in aai")
182 }catch(BpmnError e) {
184 }catch (Exception ex){
185 String msg = "Exception in getServiceInstance. " + ex.getMessage()
187 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
189 logger.trace("Exit getServiceInstance ")
192 public void getAaiAR (DelegateExecution execution) {
195 logger.trace("start getAaiAR")
197 String arType = execution.getVariable("allottedResourceType")
198 String arRole = execution.getVariable("allottedResourceRole")
200 AllottedResourceUtils arUtils = new AllottedResourceUtils(this)
201 String orchStatus = arUtils.getAROrchStatus(execution)
205 if (orchStatus != null) // AR was found
207 if ("true".equals(execution.getVariable("failExists")))
209 errorMsg = "Allotted resource " + arType + " with Role " + arRole + " already exists"
213 if ("Active".equals(orchStatus))
215 execution.setVariable("foundActiveAR", true)
217 else // blanks included
219 errorMsg = "Allotted Resource " + arType + " with Role " + arRole + " already exists in an incomplete state -" + orchStatus
223 if (!isBlank(errorMsg)) {
224 logger.debug(errorMsg)
225 exceptionUtil.buildAndThrowWorkflowException(execution, 500, errorMsg)
227 logger.trace("end getAaiAR")
230 public void getParentServiceInstance(DelegateExecution execution) {
231 logger.trace("getParentServiceInstance ")
233 String serviceInstanceId = execution.getVariable('parentServiceInstanceId')
235 AAIResourcesClient resourceClient = new AAIResourcesClient()
236 AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId)
239 //just to make sure the serviceInstance exists
241 execution.setVariable("PSI_resourceLink", uri)
242 } catch (NotFoundException e) {
243 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service instance was not found in aai")
246 }catch(BpmnError e) {
248 }catch (Exception ex){
249 String msg = "Exception in getParentServiceInstance. " + ex.getMessage()
251 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
253 logger.trace("Exit getParentServiceInstance ")
257 public void createAaiAR(DelegateExecution execution) {
260 logger.trace("start createAaiAR")
262 String allottedResourceId = execution.getVariable("allottedResourceId")
263 if (isBlank(allottedResourceId))
265 allottedResourceId = UUID.randomUUID().toString()
266 execution.setVariable("allottedResourceId", allottedResourceId)
270 AAIResourceUri siResourceLink= execution.getVariable("PSI_resourceLink")
272 AAIResourceUri allottedResourceUri = AAIUriFactory.createResourceFromParentURI(siResourceLink, AAIObjectType.ALLOTTED_RESOURCE, allottedResourceId)
274 execution.setVariable("aaiARPath", allottedResourceUri.build().toString());
275 String arType = execution.getVariable("allottedResourceType")
276 String arRole = execution.getVariable("allottedResourceRole")
277 String CSI_resourceLink = execution.getVariable("CSI_resourceLink")
279 String arModelInfo = execution.getVariable("allottedResourceModelInfo")
280 String modelInvariantId = jsonUtil.getJsonValue(arModelInfo, "modelInvariantUuid")
281 String modelVersionId = jsonUtil.getJsonValue(arModelInfo, "modelUuid")
283 AllottedResource resource = new AllottedResource()
284 resource.setId(allottedResourceId)
285 resource.setType(arType)
286 resource.setRole(arRole)
287 resource.setModelInvariantId(modelInvariantId)
288 resource.setModelVersionId(modelVersionId)
289 getAAIClient().create(allottedResourceUri, resource)
290 AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceFromExistingURI(AAIObjectType.SERVICE_INSTANCE, UriBuilder.fromPath(CSI_resourceLink).build())
291 getAAIClient().connect(allottedResourceUri,serviceInstanceUri)
292 }catch (Exception ex) {
293 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Exception in createAaiAR " + ex.getMessage())
296 //start rollback set up
297 RollbackData rollbackData = new RollbackData()
298 def disableRollback = execution.getVariable("disableRollback")
299 rollbackData.put(Prefix, "disableRollback", disableRollback.toString())
300 rollbackData.put(Prefix, "rollbackAAI", "true")
301 rollbackData.put(Prefix, "allottedResourceId", allottedResourceId)
302 rollbackData.put(Prefix, "serviceInstanceId", execution.getVariable("serviceInstanceId"))
303 rollbackData.put(Prefix, "parentServiceInstanceId", execution.getVariable("parentServiceInstanceId"))
304 execution.setVariable("rollbackData", rollbackData)
305 logger.trace("end createAaiAR")
308 public String buildSDNCRequest(DelegateExecution execution, String action, String sdncRequestId) {
312 logger.trace("start buildSDNCRequest")
313 String sdncReq = null
317 String allottedResourceId = execution.getVariable("allottedResourceId")
318 String serviceInstanceId = execution.getVariable("serviceInstanceId")
319 String globalCustomerId = execution.getVariable("globalCustomerId")
320 String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
321 String parentServiceInstanceId = execution.getVariable("parentServiceInstanceId")
322 String callbackUrl = execution.getVariable("sdncCallbackUrl")
323 String requestId = execution.getVariable("msoRequestId")
325 String brgWanMacAddress = execution.getVariable("brgWanMacAddress")
326 String vni = execution.getVariable("vni")
327 String vgmuxBearerIP = execution.getVariable("vgmuxBearerIP")
329 String arModelInfo = execution.getVariable("allottedResourceModelInfo")
330 String modelInvariantId = jsonUtil.getJsonValue(arModelInfo, "modelInvariantUuid")
331 String modelVersion = jsonUtil.getJsonValue(arModelInfo, "modelVersion")
332 String modelUUId = jsonUtil.getJsonValue(arModelInfo, "modelUuid")
333 String modelCustomizationId = jsonUtil.getJsonValue(arModelInfo, "modelCustomizationUuid")
334 String modelName = jsonUtil.getJsonValue(arModelInfo, "modelName")
336 if (modelInvariantId == null) {
337 modelInvariantId = ""
339 if (modelVersion == null) {
342 if (modelUUId == null) {
345 if (modelName == null) {
348 if (modelCustomizationId == null) {
349 modelCustomizationId = ""
353 """<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.onap/so/request/types/v1"
354 xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"
355 xmlns:sdncadapter="http://org.onap/workflow/sdnc/adapter/schema/v1">
356 <sdncadapter:RequestHeader>
357 <sdncadapter:RequestId>${MsoUtils.xmlEscape(sdncRequestId)}</sdncadapter:RequestId>
358 <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId>
359 <sdncadapter:SvcAction>${MsoUtils.xmlEscape(action)}</sdncadapter:SvcAction>
360 <sdncadapter:SvcOperation>brg-topology-operation</sdncadapter:SvcOperation>
361 <sdncadapter:CallbackUrl>${MsoUtils.xmlEscape(callbackUrl)}</sdncadapter:CallbackUrl>
362 </sdncadapter:RequestHeader>
363 <sdncadapterworkflow:SDNCRequestData>
364 <request-information>
365 <request-id>${MsoUtils.xmlEscape(requestId)}</request-id>
366 <request-action>CreateBRGInstance</request-action>
371 </request-information>
372 <service-information>
373 <service-id></service-id>
374 <subscription-service-type>${MsoUtils.xmlEscape(subscriptionServiceType)}</subscription-service-type>
375 <onap-model-information></onap-model-information>
376 <service-instance-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-instance-id>
378 <global-customer-id>${MsoUtils.xmlEscape(globalCustomerId)}</global-customer-id>
379 </service-information>
380 <allotted-resource-information>
381 <allotted-resource-id>${MsoUtils.xmlEscape(allottedResourceId)}</allotted-resource-id>
382 <allotted-resource-type>brg</allotted-resource-type>
383 <parent-service-instance-id>${MsoUtils.xmlEscape(parentServiceInstanceId)}</parent-service-instance-id>
384 <onap-model-information>
385 <model-invariant-uuid>${MsoUtils.xmlEscape(modelInvariantId)}</model-invariant-uuid>
386 <model-uuid>${MsoUtils.xmlEscape(modelUUId)}</model-uuid>
387 <model-customization-uuid>${MsoUtils.xmlEscape(modelCustomizationId)}</model-customization-uuid>
388 <model-version>${MsoUtils.xmlEscape(modelVersion)}</model-version>
389 <model-name>${MsoUtils.xmlEscape(modelName)}</model-name>
390 </onap-model-information>
391 </allotted-resource-information>
393 <brg-wan-mac-address>${MsoUtils.xmlEscape(brgWanMacAddress)}</brg-wan-mac-address>
394 <vni>${MsoUtils.xmlEscape(vni)}</vni>
395 <vgmux-bearer-ip>${MsoUtils.xmlEscape(vgmuxBearerIP)}</vgmux-bearer-ip>
397 </sdncadapterworkflow:SDNCRequestData>
398 </sdncadapterworkflow:SDNCAdapterWorkflowRequest>"""
400 logger.debug("sdncRequest:\n" + sdncReq)
401 sdncReq = utils.formatXml(sdncReq)
403 } catch(Exception ex) {
404 msg = "Exception in buildSDNCRequest. " + ex.getMessage()
406 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
408 logger.trace("end buildSDNCRequest")
412 public void preProcessSDNCAssign(DelegateExecution execution) {
416 logger.trace("start preProcessSDNCAssign")
419 String sdncRequestId = UUID.randomUUID().toString()
420 String sdncAssignReq = buildSDNCRequest(execution, "assign", sdncRequestId)
421 execution.setVariable("sdncAssignRequest", sdncAssignReq)
422 logger.debug("sdncAssignRequest: " + sdncAssignReq)
423 def sdncRequestId2 = UUID.randomUUID().toString()
424 String sdncAssignRollbackReq = sdncAssignReq.replace(">assign<", ">unassign<").replace(">CreateBRGInstance<", ">DeleteBRGInstance<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<")
425 def rollbackData = execution.getVariable("rollbackData")
426 rollbackData.put(Prefix, "sdncAssignRollbackReq", sdncAssignRollbackReq)
427 execution.setVariable("rollbackData", rollbackData)
429 logger.debug("sdncAssignRollbackReq:\n" + sdncAssignRollbackReq)
430 logger.debug("rollbackData:\n" + rollbackData.toString())
432 } catch (BpmnError e) {
434 } catch(Exception ex) {
435 msg = "Exception in preProcessSDNCAssign. " + ex.getMessage()
437 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
439 logger.trace("end preProcessSDNCAssign")
442 public void preProcessSDNCCreate(DelegateExecution execution) {
446 logger.trace("start preProcessSDNCCreate")
449 String sdncRequestId = UUID.randomUUID().toString()
450 String sdncCreateReq = buildSDNCRequest(execution, "create", sdncRequestId)
451 execution.setVariable("sdncCreateRequest", sdncCreateReq)
452 logger.debug("sdncCreateReq: " + sdncCreateReq)
453 def sdncRequestId2 = UUID.randomUUID().toString()
454 String sdncCreateRollbackReq = sdncCreateReq.replace(">create<", ">delete<").replace(">CreateBRGInstance<", ">DeleteBRGInstance<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<")
455 def rollbackData = execution.getVariable("rollbackData")
456 rollbackData.put(Prefix, "sdncCreateRollbackReq", sdncCreateRollbackReq)
457 execution.setVariable("rollbackData", rollbackData)
459 logger.debug("sdncCreateRollbackReq:\n" + sdncCreateRollbackReq)
460 logger.debug("rollbackData:\n" + rollbackData.toString())
462 } catch (BpmnError e) {
464 } catch(Exception ex) {
465 msg = "Exception in preProcessSDNCCreate. " + ex.getMessage()
467 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
469 logger.trace("end preProcessSDNCCreate")
472 public void preProcessSDNCActivate(DelegateExecution execution) {
476 logger.trace("start preProcessSDNCActivate")
479 String sdncRequestId = UUID.randomUUID().toString()
480 String sdncActivateReq = buildSDNCRequest(execution, "activate", sdncRequestId)
481 execution.setVariable("sdncActivateRequest", sdncActivateReq)
482 logger.debug("sdncActivateReq: " + sdncActivateReq)
483 def sdncRequestId2 = UUID.randomUUID().toString()
484 String sdncActivateRollbackReq = sdncActivateReq.replace(">activate<", ">deactivate<").replace(">CreateBRGInstance<", ">DeleteBRGInstance<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<")
485 def rollbackData = execution.getVariable("rollbackData")
486 rollbackData.put(Prefix, "sdncActivateRollbackReq", sdncActivateRollbackReq)
487 execution.setVariable("rollbackData", rollbackData)
489 logger.debug("sdncActivateRollbackReq:\n" + sdncActivateRollbackReq)
490 logger.debug("rollbackData:\n" + rollbackData.toString())
492 } catch (BpmnError e) {
494 } catch(Exception ex) {
495 msg = "Exception in preProcessSDNCActivate. " + ex.getMessage()
497 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
499 logger.trace("end preProcessSDNCActivate")
502 public void validateSDNCResp(DelegateExecution execution, String response, String method){
505 logger.trace("ValidateSDNCResponse Process")
509 WorkflowException workflowException = execution.getVariable("WorkflowException")
510 logger.debug("workflowException: " + workflowException)
512 boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator")
513 logger.debug("SDNCResponse: " + response)
515 SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils()
516 sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator)
518 if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){
519 logger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + response)
521 if (!"get".equals(method))
523 def rollbackData = execution.getVariable("rollbackData")
524 rollbackData.put(Prefix, "rollback" + "SDNC" + method, "true")
525 execution.setVariable("rollbackData", rollbackData)
529 logger.debug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.")
530 throw new BpmnError("MSOWorkflowException")
532 } catch (BpmnError e) {
534 } catch(Exception ex) {
535 msg = "Exception in validateSDNCResp. " + ex.getMessage()
537 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
539 logger.trace("End ValidateSDNCResp Process")
542 public void preProcessSDNCGet(DelegateExecution execution){
544 logger.trace("start preProcessSDNCGet")
547 def callbackUrl = execution.getVariable("sdncCallbackUrl")
548 // serviceOperation (URI for topology GET) will be retrieved from "selflink" from AAI if active AR exists in AAI
549 // or from "object-path" in SDNC response for assign when AR does not exist in AA
551 String serviceOperation = ""
553 if (execution.getVariable("foundActiveAR")) {
554 def aaiQueryResponse = execution.getVariable("aaiARGetResponse")
555 serviceOperation = utils.getNodeText(aaiQueryResponse, "selflink")
556 logger.debug("AR service operation/aaiARSelfLink: " + serviceOperation)
560 String response = execution.getVariable("sdncAssignResponse")
561 String data = utils.getNodeXml(response, "response-data")
562 logger.debug("Assign responseData: " + data)
563 serviceOperation = utils.getNodeText(data, "object-path")
564 logger.debug("AR service operation:" + serviceOperation)
567 String serviceInstanceId = execution.getVariable("serviceInstanceId")
568 String sdncRequestId = UUID.randomUUID().toString()
570 //neeed the same url as used by vfmodules
571 String SDNCGetRequest =
572 """<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.onap/so/request/types/v1"
573 xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"
574 xmlns:sdncadapter="http://org.onap/workflow/sdnc/adapter/schema/v1">
575 <sdncadapter:RequestHeader>
576 <sdncadapter:RequestId>${MsoUtils.xmlEscape(sdncRequestId)}</sdncadapter:RequestId>
577 <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId>
578 <sdncadapter:SvcAction>query</sdncadapter:SvcAction>
579 <sdncadapter:SvcOperation>${MsoUtils.xmlEscape(serviceOperation)}</sdncadapter:SvcOperation>
580 <sdncadapter:CallbackUrl>${MsoUtils.xmlEscape(callbackUrl)}</sdncadapter:CallbackUrl>
581 <sdncadapter:MsoAction>vfmodule</sdncadapter:MsoAction>
582 </sdncadapter:RequestHeader>
583 <sdncadapterworkflow:SDNCRequestData></sdncadapterworkflow:SDNCRequestData>
584 </sdncadapterworkflow:SDNCAdapterWorkflowRequest>"""
586 execution.setVariable("sdncGetRequest", SDNCGetRequest)
589 logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
590 "Exception Occurred Processing preProcessSDNCGetRequest.", "BPMN",
591 ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
592 exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during SDNC GET Method:\n" + e.getMessage())
594 logger.trace("end preProcessSDNCGet")
597 public void updateAaiAROrchStatus(DelegateExecution execution, String status){
599 logger.trace("start updateAaiAROrchStatus")
600 String aaiARPath = execution.getVariable("aaiARPath") //set during query (existing AR) or create
601 AllottedResourceUtils arUtils = new AllottedResourceUtils(this)
602 String orchStatus = arUtils.updateAROrchStatus(execution, status, aaiARPath)
603 logger.trace("end updateAaiAROrchStatus")
606 public void generateOutputs(DelegateExecution execution)
609 logger.trace("start generateOutputs")
611 String sdncGetResponse = execution.getVariable("enhancedCallbackRequestData") //unescaped
612 logger.debug("resp:" + sdncGetResponse)
613 String arData = utils.getNodeXml(sdncGetResponse, "brg-topology")
614 arData = utils.removeXmlNamespaces(arData)
616 String brga = utils.getNodeXml(arData, "brg-assignments")
617 String ari = utils.getNodeXml(arData, "allotted-resource-identifiers")
618 execution.setVariable("allotedResourceName", utils.getNodeText(ari, "allotted-resource-name"))
619 } catch (BpmnError e) {
620 logger.debug("BPMN Error in generateOutputs ")
621 } catch(Exception ex) {
622 String msg = "Exception in generateOutputs " + ex.getMessage()
625 logger.trace("end generateOutputs")
629 public void preProcessRollback (DelegateExecution execution) {
631 logger.trace("start preProcessRollback")
634 Object workflowException = execution.getVariable("WorkflowException");
636 if (workflowException instanceof WorkflowException) {
637 logger.debug("Prev workflowException: " + workflowException.getErrorMessage())
638 execution.setVariable("prevWorkflowException", workflowException);
639 //execution.setVariable("WorkflowException", null);
641 } catch (BpmnError e) {
642 logger.debug("BPMN Error during preProcessRollback")
643 } catch(Exception ex) {
644 String msg = "Exception in preProcessRollback. " + ex.getMessage()
647 logger.trace("end preProcessRollback")
650 public void postProcessRollback (DelegateExecution execution) {
652 logger.trace("start postProcessRollback")
655 Object workflowException = execution.getVariable("prevWorkflowException");
656 if (workflowException instanceof WorkflowException) {
657 logger.debug("Setting prevException to WorkflowException: ")
658 execution.setVariable("WorkflowException", workflowException);
660 execution.setVariable("rollbackData", null)
661 } catch (BpmnError b) {
662 logger.debug("BPMN Error during postProcessRollback")
664 } catch(Exception ex) {
665 msg = "Exception in postProcessRollback. " + ex.getMessage()
668 logger.trace("end postProcessRollback")