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.so.bpmn.common.scripts.*
31 import org.onap.so.bpmn.core.RollbackData
32 import org.onap.so.bpmn.core.UrnPropertiesReader
33 import org.onap.so.bpmn.core.WorkflowException
34 import org.onap.so.bpmn.core.json.JsonUtils
35 import org.onap.aaiclient.client.aai.AAIObjectType
36 import org.onap.aaiclient.client.aai.AAIResourcesClient
37 import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
38 import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
39 import org.onap.logging.filter.base.ErrorCode
40 import org.onap.so.logger.LoggingAnchor
41 import org.onap.so.logger.MessageEnum
42 import org.slf4j.Logger
43 import org.slf4j.LoggerFactory
46 * This groovy class supports the <class>DoCreateAllottedResourceBRG.bpmn</class> process.
51 * @param - msoRequestId
52 * @param - isDEbugLogEnabled
53 * @param - disableRollback
54 * @param - failExists - O
55 * @param - serviceInstanceId
56 * @param - globalCustomerId - O
57 * @param - subscriptionServiceType - O
58 * @param - parentServiceInstanceId
59 * @param - allottedReourceId - O
60 * @param - allottedResourceModelInfo
61 * @param - allottedResourceRole
62 * @param - allottedResourceType
63 * @param - brgWanMacAddress
65 * @param - vgmuxBearerIP
68 * @param - rollbackData (localRB->null)
69 * @param - rolledBack (no localRB->null, localRB F->false, localRB S->true)
70 * @param - WorkflowException - O
71 * @param - allottedResourceId
72 * @param - allottedResourceName
75 public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{
76 private static final Logger logger = LoggerFactory.getLogger(DoCreateAllottedResourceBRG.class);
78 String Prefix="DCARBRG_"
79 ExceptionUtil exceptionUtil = new ExceptionUtil()
80 JsonUtils jsonUtil = new JsonUtils()
82 public void preProcessRequest (DelegateExecution execution) {
86 logger.trace("start preProcessRequest")
89 execution.setVariable("prefix", Prefix)
92 String sdncCallbackUrl = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution)
93 if (isBlank(sdncCallbackUrl)) {
94 msg = "mso.workflow.sdncadapter.callback is null"
96 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
98 execution.setVariable("sdncCallbackUrl", sdncCallbackUrl)
99 logger.debug("SDNC Callback URL: " + sdncCallbackUrl)
101 String sdncReplDelay = UrnPropertiesReader.getVariable("mso.workflow.sdnc.replication.delay",execution)
102 if (isBlank(sdncReplDelay)) {
103 msg = "mso.workflow.sdnc.replication.delay is null"
105 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
107 execution.setVariable("sdncReplDelay", sdncReplDelay)
108 logger.debug("SDNC replication delay: " + sdncReplDelay)
111 if (isBlank(execution.getVariable("serviceInstanceId"))){
112 msg = "Input serviceInstanceId is null"
114 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
116 if (isBlank(execution.getVariable("parentServiceInstanceId"))) {
117 msg = "Input parentServiceInstanceId is null"
119 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
121 if (isBlank(execution.getVariable("allottedResourceModelInfo"))) {
122 msg = "Input allottedResourceModelInfo is null"
124 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
126 if (isBlank(execution.getVariable("vni"))) {
127 msg = "Input vni is null"
129 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
131 if (isBlank(execution.getVariable("vgmuxBearerIP"))) {
132 msg = "Input vgmuxBearerIP is null"
134 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
136 if (isBlank(execution.getVariable("brgWanMacAddress"))) {
137 msg = "Input brgWanMacAddress is null"
139 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
141 if (isBlank(execution.getVariable("allottedResourceRole"))) {
142 msg = "Input allottedResourceRole is null"
144 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
146 if (isBlank(execution.getVariable("allottedResourceType"))) {
147 msg = "Input allottedResourceType is null"
149 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
152 logger.debug("Rethrowing MSOWorkflowException")
154 } catch (Exception ex){
155 msg = "Exception in preProcessRequest " + ex.getMessage()
157 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
159 logger.trace("end preProcessRequest")
163 * Gets the service instance uri from aai
165 public void getServiceInstance(DelegateExecution execution) {
166 logger.trace("getServiceInstance ")
168 String serviceInstanceId = execution.getVariable('serviceInstanceId')
170 AAIResourcesClient resourceClient = new AAIResourcesClient()
171 AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId)
173 if(resourceClient.exists(uri)){
174 execution.setVariable("CSI_resourceLink", uri.build().toString())
176 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service instance was not found in aai")
179 }catch(BpmnError e) {
181 }catch (Exception ex){
182 String msg = "Exception in getServiceInstance. " + ex.getMessage()
184 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
186 logger.trace("Exit getServiceInstance ")
189 public void getAaiAR (DelegateExecution execution) {
192 logger.trace("start getAaiAR")
194 String arType = execution.getVariable("allottedResourceType")
195 String arRole = execution.getVariable("allottedResourceRole")
197 AllottedResourceUtils arUtils = new AllottedResourceUtils(this)
198 String orchStatus = arUtils.getAROrchStatus(execution)
202 if (orchStatus != null) // AR was found
204 if ("true".equals(execution.getVariable("failExists")))
206 errorMsg = "Allotted resource " + arType + " with Role " + arRole + " already exists"
210 if ("Active".equals(orchStatus))
212 execution.setVariable("foundActiveAR", true)
214 else // blanks included
216 errorMsg = "Allotted Resource " + arType + " with Role " + arRole + " already exists in an incomplete state -" + orchStatus
220 if (!isBlank(errorMsg)) {
221 logger.debug(errorMsg)
222 exceptionUtil.buildAndThrowWorkflowException(execution, 500, errorMsg)
224 logger.trace("end getAaiAR")
227 public void getParentServiceInstance(DelegateExecution execution) {
228 logger.trace("getParentServiceInstance ")
230 String serviceInstanceId = execution.getVariable('parentServiceInstanceId')
232 AAIResourcesClient resourceClient = new AAIResourcesClient()
233 AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId)
235 //just to make sure the serviceInstance exists
236 if (resourceClient.exists(uri)) {
237 execution.setVariable("PSI_resourceLink", uri)
239 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service instance was not found in aai")
242 }catch(BpmnError e) {
244 }catch (Exception ex){
245 String msg = "Exception in getParentServiceInstance. " + ex.getMessage()
247 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
249 logger.trace("Exit getParentServiceInstance ")
253 public void createAaiAR(DelegateExecution execution) {
256 logger.trace("start createAaiAR")
258 String allottedResourceId = execution.getVariable("allottedResourceId")
259 if (isBlank(allottedResourceId))
261 allottedResourceId = UUID.randomUUID().toString()
262 execution.setVariable("allottedResourceId", allottedResourceId)
266 AAIResourceUri siResourceLink= execution.getVariable("PSI_resourceLink")
268 AAIResourceUri allottedResourceUri = AAIUriFactory.createResourceFromParentURI(siResourceLink, AAIObjectType.ALLOTTED_RESOURCE, allottedResourceId)
270 execution.setVariable("aaiARPath", allottedResourceUri.build().toString());
271 String arType = execution.getVariable("allottedResourceType")
272 String arRole = execution.getVariable("allottedResourceRole")
273 String CSI_resourceLink = execution.getVariable("CSI_resourceLink")
275 String arModelInfo = execution.getVariable("allottedResourceModelInfo")
276 String modelInvariantId = jsonUtil.getJsonValue(arModelInfo, "modelInvariantUuid")
277 String modelVersionId = jsonUtil.getJsonValue(arModelInfo, "modelUuid")
279 AllottedResource resource = new AllottedResource()
280 resource.setId(allottedResourceId)
281 resource.setType(arType)
282 resource.setRole(arRole)
283 resource.setModelInvariantId(modelInvariantId)
284 resource.setModelVersionId(modelVersionId)
285 getAAIClient().create(allottedResourceUri, resource)
286 AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceFromExistingURI(AAIObjectType.SERVICE_INSTANCE, UriBuilder.fromPath(CSI_resourceLink).build())
287 getAAIClient().connect(allottedResourceUri,serviceInstanceUri)
288 }catch (Exception ex) {
289 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Exception in createAaiAR " + ex.getMessage())
292 //start rollback set up
293 RollbackData rollbackData = new RollbackData()
294 def disableRollback = execution.getVariable("disableRollback")
295 rollbackData.put(Prefix, "disableRollback", disableRollback.toString())
296 rollbackData.put(Prefix, "rollbackAAI", "true")
297 rollbackData.put(Prefix, "allottedResourceId", allottedResourceId)
298 rollbackData.put(Prefix, "serviceInstanceId", execution.getVariable("serviceInstanceId"))
299 rollbackData.put(Prefix, "parentServiceInstanceId", execution.getVariable("parentServiceInstanceId"))
300 execution.setVariable("rollbackData", rollbackData)
301 logger.trace("end createAaiAR")
304 public String buildSDNCRequest(DelegateExecution execution, String action, String sdncRequestId) {
308 logger.trace("start buildSDNCRequest")
309 String sdncReq = null
313 String allottedResourceId = execution.getVariable("allottedResourceId")
314 String serviceInstanceId = execution.getVariable("serviceInstanceId")
315 String globalCustomerId = execution.getVariable("globalCustomerId")
316 String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
317 String parentServiceInstanceId = execution.getVariable("parentServiceInstanceId")
318 String callbackUrl = execution.getVariable("sdncCallbackUrl")
319 String requestId = execution.getVariable("msoRequestId")
321 String brgWanMacAddress = execution.getVariable("brgWanMacAddress")
322 String vni = execution.getVariable("vni")
323 String vgmuxBearerIP = execution.getVariable("vgmuxBearerIP")
325 String arModelInfo = execution.getVariable("allottedResourceModelInfo")
326 String modelInvariantId = jsonUtil.getJsonValue(arModelInfo, "modelInvariantUuid")
327 String modelVersion = jsonUtil.getJsonValue(arModelInfo, "modelVersion")
328 String modelUUId = jsonUtil.getJsonValue(arModelInfo, "modelUuid")
329 String modelCustomizationId = jsonUtil.getJsonValue(arModelInfo, "modelCustomizationUuid")
330 String modelName = jsonUtil.getJsonValue(arModelInfo, "modelName")
332 if (modelInvariantId == null) {
333 modelInvariantId = ""
335 if (modelVersion == null) {
338 if (modelUUId == null) {
341 if (modelName == null) {
344 if (modelCustomizationId == null) {
345 modelCustomizationId = ""
349 """<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.onap/so/request/types/v1"
350 xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"
351 xmlns:sdncadapter="http://org.onap/workflow/sdnc/adapter/schema/v1">
352 <sdncadapter:RequestHeader>
353 <sdncadapter:RequestId>${MsoUtils.xmlEscape(sdncRequestId)}</sdncadapter:RequestId>
354 <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId>
355 <sdncadapter:SvcAction>${MsoUtils.xmlEscape(action)}</sdncadapter:SvcAction>
356 <sdncadapter:SvcOperation>brg-topology-operation</sdncadapter:SvcOperation>
357 <sdncadapter:CallbackUrl>${MsoUtils.xmlEscape(callbackUrl)}</sdncadapter:CallbackUrl>
358 </sdncadapter:RequestHeader>
359 <sdncadapterworkflow:SDNCRequestData>
360 <request-information>
361 <request-id>${MsoUtils.xmlEscape(requestId)}</request-id>
362 <request-action>CreateBRGInstance</request-action>
367 </request-information>
368 <service-information>
369 <service-id></service-id>
370 <subscription-service-type>${MsoUtils.xmlEscape(subscriptionServiceType)}</subscription-service-type>
371 <onap-model-information></onap-model-information>
372 <service-instance-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-instance-id>
374 <global-customer-id>${MsoUtils.xmlEscape(globalCustomerId)}</global-customer-id>
375 </service-information>
376 <allotted-resource-information>
377 <allotted-resource-id>${MsoUtils.xmlEscape(allottedResourceId)}</allotted-resource-id>
378 <allotted-resource-type>brg</allotted-resource-type>
379 <parent-service-instance-id>${MsoUtils.xmlEscape(parentServiceInstanceId)}</parent-service-instance-id>
380 <onap-model-information>
381 <model-invariant-uuid>${MsoUtils.xmlEscape(modelInvariantId)}</model-invariant-uuid>
382 <model-uuid>${MsoUtils.xmlEscape(modelUUId)}</model-uuid>
383 <model-customization-uuid>${MsoUtils.xmlEscape(modelCustomizationId)}</model-customization-uuid>
384 <model-version>${MsoUtils.xmlEscape(modelVersion)}</model-version>
385 <model-name>${MsoUtils.xmlEscape(modelName)}</model-name>
386 </onap-model-information>
387 </allotted-resource-information>
389 <brg-wan-mac-address>${MsoUtils.xmlEscape(brgWanMacAddress)}</brg-wan-mac-address>
390 <vni>${MsoUtils.xmlEscape(vni)}</vni>
391 <vgmux-bearer-ip>${MsoUtils.xmlEscape(vgmuxBearerIP)}</vgmux-bearer-ip>
393 </sdncadapterworkflow:SDNCRequestData>
394 </sdncadapterworkflow:SDNCAdapterWorkflowRequest>"""
396 logger.debug("sdncRequest:\n" + sdncReq)
397 sdncReq = utils.formatXml(sdncReq)
399 } catch(Exception ex) {
400 msg = "Exception in buildSDNCRequest. " + ex.getMessage()
402 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
404 logger.trace("end buildSDNCRequest")
408 public void preProcessSDNCAssign(DelegateExecution execution) {
412 logger.trace("start preProcessSDNCAssign")
415 String sdncRequestId = UUID.randomUUID().toString()
416 String sdncAssignReq = buildSDNCRequest(execution, "assign", sdncRequestId)
417 execution.setVariable("sdncAssignRequest", sdncAssignReq)
418 logger.debug("sdncAssignRequest: " + sdncAssignReq)
419 def sdncRequestId2 = UUID.randomUUID().toString()
420 String sdncAssignRollbackReq = sdncAssignReq.replace(">assign<", ">unassign<").replace(">CreateBRGInstance<", ">DeleteBRGInstance<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<")
421 def rollbackData = execution.getVariable("rollbackData")
422 rollbackData.put(Prefix, "sdncAssignRollbackReq", sdncAssignRollbackReq)
423 execution.setVariable("rollbackData", rollbackData)
425 logger.debug("sdncAssignRollbackReq:\n" + sdncAssignRollbackReq)
426 logger.debug("rollbackData:\n" + rollbackData.toString())
428 } catch (BpmnError e) {
430 } catch(Exception ex) {
431 msg = "Exception in preProcessSDNCAssign. " + ex.getMessage()
433 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
435 logger.trace("end preProcessSDNCAssign")
438 public void preProcessSDNCCreate(DelegateExecution execution) {
442 logger.trace("start preProcessSDNCCreate")
445 String sdncRequestId = UUID.randomUUID().toString()
446 String sdncCreateReq = buildSDNCRequest(execution, "create", sdncRequestId)
447 execution.setVariable("sdncCreateRequest", sdncCreateReq)
448 logger.debug("sdncCreateReq: " + sdncCreateReq)
449 def sdncRequestId2 = UUID.randomUUID().toString()
450 String sdncCreateRollbackReq = sdncCreateReq.replace(">create<", ">delete<").replace(">CreateBRGInstance<", ">DeleteBRGInstance<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<")
451 def rollbackData = execution.getVariable("rollbackData")
452 rollbackData.put(Prefix, "sdncCreateRollbackReq", sdncCreateRollbackReq)
453 execution.setVariable("rollbackData", rollbackData)
455 logger.debug("sdncCreateRollbackReq:\n" + sdncCreateRollbackReq)
456 logger.debug("rollbackData:\n" + rollbackData.toString())
458 } catch (BpmnError e) {
460 } catch(Exception ex) {
461 msg = "Exception in preProcessSDNCCreate. " + ex.getMessage()
463 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
465 logger.trace("end preProcessSDNCCreate")
468 public void preProcessSDNCActivate(DelegateExecution execution) {
472 logger.trace("start preProcessSDNCActivate")
475 String sdncRequestId = UUID.randomUUID().toString()
476 String sdncActivateReq = buildSDNCRequest(execution, "activate", sdncRequestId)
477 execution.setVariable("sdncActivateRequest", sdncActivateReq)
478 logger.debug("sdncActivateReq: " + sdncActivateReq)
479 def sdncRequestId2 = UUID.randomUUID().toString()
480 String sdncActivateRollbackReq = sdncActivateReq.replace(">activate<", ">deactivate<").replace(">CreateBRGInstance<", ">DeleteBRGInstance<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<")
481 def rollbackData = execution.getVariable("rollbackData")
482 rollbackData.put(Prefix, "sdncActivateRollbackReq", sdncActivateRollbackReq)
483 execution.setVariable("rollbackData", rollbackData)
485 logger.debug("sdncActivateRollbackReq:\n" + sdncActivateRollbackReq)
486 logger.debug("rollbackData:\n" + rollbackData.toString())
488 } catch (BpmnError e) {
490 } catch(Exception ex) {
491 msg = "Exception in preProcessSDNCActivate. " + ex.getMessage()
493 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
495 logger.trace("end preProcessSDNCActivate")
498 public void validateSDNCResp(DelegateExecution execution, String response, String method){
501 logger.trace("ValidateSDNCResponse Process")
505 WorkflowException workflowException = execution.getVariable("WorkflowException")
506 logger.debug("workflowException: " + workflowException)
508 boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator")
509 logger.debug("SDNCResponse: " + response)
511 SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils()
512 sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator)
514 if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){
515 logger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + response)
517 if (!"get".equals(method))
519 def rollbackData = execution.getVariable("rollbackData")
520 rollbackData.put(Prefix, "rollback" + "SDNC" + method, "true")
521 execution.setVariable("rollbackData", rollbackData)
525 logger.debug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.")
526 throw new BpmnError("MSOWorkflowException")
528 } catch (BpmnError e) {
530 } catch(Exception ex) {
531 msg = "Exception in validateSDNCResp. " + ex.getMessage()
533 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
535 logger.trace("End ValidateSDNCResp Process")
538 public void preProcessSDNCGet(DelegateExecution execution){
540 logger.trace("start preProcessSDNCGet")
543 def callbackUrl = execution.getVariable("sdncCallbackUrl")
544 // serviceOperation (URI for topology GET) will be retrieved from "selflink" from AAI if active AR exists in AAI
545 // or from "object-path" in SDNC response for assign when AR does not exist in AA
547 String serviceOperation = ""
549 if (execution.getVariable("foundActiveAR")) {
550 def aaiQueryResponse = execution.getVariable("aaiARGetResponse")
551 serviceOperation = utils.getNodeText(aaiQueryResponse, "selflink")
552 logger.debug("AR service operation/aaiARSelfLink: " + serviceOperation)
556 String response = execution.getVariable("sdncAssignResponse")
557 String data = utils.getNodeXml(response, "response-data")
558 logger.debug("Assign responseData: " + data)
559 serviceOperation = utils.getNodeText(data, "object-path")
560 logger.debug("AR service operation:" + serviceOperation)
563 String serviceInstanceId = execution.getVariable("serviceInstanceId")
564 String sdncRequestId = UUID.randomUUID().toString()
566 //neeed the same url as used by vfmodules
567 String SDNCGetRequest =
568 """<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.onap/so/request/types/v1"
569 xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"
570 xmlns:sdncadapter="http://org.onap/workflow/sdnc/adapter/schema/v1">
571 <sdncadapter:RequestHeader>
572 <sdncadapter:RequestId>${MsoUtils.xmlEscape(sdncRequestId)}</sdncadapter:RequestId>
573 <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId>
574 <sdncadapter:SvcAction>query</sdncadapter:SvcAction>
575 <sdncadapter:SvcOperation>${MsoUtils.xmlEscape(serviceOperation)}</sdncadapter:SvcOperation>
576 <sdncadapter:CallbackUrl>${MsoUtils.xmlEscape(callbackUrl)}</sdncadapter:CallbackUrl>
577 <sdncadapter:MsoAction>vfmodule</sdncadapter:MsoAction>
578 </sdncadapter:RequestHeader>
579 <sdncadapterworkflow:SDNCRequestData></sdncadapterworkflow:SDNCRequestData>
580 </sdncadapterworkflow:SDNCAdapterWorkflowRequest>"""
582 execution.setVariable("sdncGetRequest", SDNCGetRequest)
585 logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
586 "Exception Occurred Processing preProcessSDNCGetRequest.", "BPMN",
587 ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
588 exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during SDNC GET Method:\n" + e.getMessage())
590 logger.trace("end preProcessSDNCGet")
593 public void updateAaiAROrchStatus(DelegateExecution execution, String status){
595 logger.trace("start updateAaiAROrchStatus")
596 String aaiARPath = execution.getVariable("aaiARPath") //set during query (existing AR) or create
597 AllottedResourceUtils arUtils = new AllottedResourceUtils(this)
598 String orchStatus = arUtils.updateAROrchStatus(execution, status, aaiARPath)
599 logger.trace("end updateAaiAROrchStatus")
602 public void generateOutputs(DelegateExecution execution)
605 logger.trace("start generateOutputs")
607 String sdncGetResponse = execution.getVariable("enhancedCallbackRequestData") //unescaped
608 logger.debug("resp:" + sdncGetResponse)
609 String arData = utils.getNodeXml(sdncGetResponse, "brg-topology")
610 arData = utils.removeXmlNamespaces(arData)
612 String brga = utils.getNodeXml(arData, "brg-assignments")
613 String ari = utils.getNodeXml(arData, "allotted-resource-identifiers")
614 execution.setVariable("allotedResourceName", utils.getNodeText(ari, "allotted-resource-name"))
615 } catch (BpmnError e) {
616 logger.debug("BPMN Error in generateOutputs ")
617 } catch(Exception ex) {
618 String msg = "Exception in generateOutputs " + ex.getMessage()
621 logger.trace("end generateOutputs")
625 public void preProcessRollback (DelegateExecution execution) {
627 logger.trace("start preProcessRollback")
630 Object workflowException = execution.getVariable("WorkflowException");
632 if (workflowException instanceof WorkflowException) {
633 logger.debug("Prev workflowException: " + workflowException.getErrorMessage())
634 execution.setVariable("prevWorkflowException", workflowException);
635 //execution.setVariable("WorkflowException", null);
637 } catch (BpmnError e) {
638 logger.debug("BPMN Error during preProcessRollback")
639 } catch(Exception ex) {
640 String msg = "Exception in preProcessRollback. " + ex.getMessage()
643 logger.trace("end preProcessRollback")
646 public void postProcessRollback (DelegateExecution execution) {
648 logger.trace("start postProcessRollback")
651 Object workflowException = execution.getVariable("prevWorkflowException");
652 if (workflowException instanceof WorkflowException) {
653 logger.debug("Setting prevException to WorkflowException: ")
654 execution.setVariable("WorkflowException", workflowException);
656 execution.setVariable("rollbackData", null)
657 } catch (BpmnError b) {
658 logger.debug("BPMN Error during postProcessRollback")
660 } catch(Exception ex) {
661 msg = "Exception in postProcessRollback. " + ex.getMessage()
664 logger.trace("end postProcessRollback")