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.camunda.bpm.engine.delegate.BpmnError
26 import org.camunda.bpm.engine.delegate.DelegateExecution
27 import org.onap.aai.domain.yang.AllottedResource
28 import org.onap.so.bpmn.common.scripts.*
29 import org.onap.so.bpmn.core.RollbackData
30 import org.onap.so.bpmn.core.UrnPropertiesReader
31 import org.onap.so.bpmn.core.WorkflowException
32 import org.onap.so.bpmn.core.json.JsonUtils
33 import org.onap.so.client.aai.AAIObjectType
34 import org.onap.so.client.aai.AAIResourcesClient
35 import org.onap.so.client.aai.entities.uri.AAIResourceUri
36 import org.onap.so.client.aai.entities.uri.AAIUriFactory
37 import org.onap.so.logger.MessageEnum
38 import org.onap.so.logger.MsoLogger
39 import org.slf4j.Logger
40 import org.slf4j.LoggerFactory
42 import javax.ws.rs.NotFoundException
43 import javax.ws.rs.core.UriBuilder
45 import static org.apache.commons.lang3.StringUtils.isBlank
48 * This groovy class supports the <class>DoCreateAllottedResourceBRG.bpmn</class> process.
53 * @param - msoRequestId
54 * @param - isDEbugLogEnabled
55 * @param - disableRollback
56 * @param - failExists - O
57 * @param - serviceInstanceId
58 * @param - globalCustomerId - O
59 * @param - subscriptionServiceType - O
60 * @param - parentServiceInstanceId
61 * @param - allottedReourceId - O
62 * @param - allottedResourceModelInfo
63 * @param - allottedResourceRole
64 * @param - allottedResourceType
65 * @param - brgWanMacAddress
67 * @param - vgmuxBearerIP
70 * @param - rollbackData (localRB->null)
71 * @param - rolledBack (no localRB->null, localRB F->false, localRB S->true)
72 * @param - WorkflowException - O
73 * @param - allottedResourceId
74 * @param - allottedResourceName
77 public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{
78 private static final Logger logger = LoggerFactory.getLogger(DoCreateAllottedResourceBRG.class);
80 String Prefix="DCARBRG_"
81 ExceptionUtil exceptionUtil = new ExceptionUtil()
82 JsonUtils jsonUtil = new JsonUtils()
84 public void preProcessRequest (DelegateExecution execution) {
88 logger.trace("start preProcessRequest")
91 execution.setVariable("prefix", Prefix)
94 String sdncCallbackUrl = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution)
95 if (isBlank(sdncCallbackUrl)) {
96 msg = "mso.workflow.sdncadapter.callback is null"
98 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
100 execution.setVariable("sdncCallbackUrl", sdncCallbackUrl)
101 logger.debug("SDNC Callback URL: " + sdncCallbackUrl)
103 String sdncReplDelay = UrnPropertiesReader.getVariable("mso.workflow.sdnc.replication.delay",execution)
104 if (isBlank(sdncReplDelay)) {
105 msg = "mso.workflow.sdnc.replication.delay is null"
107 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
109 execution.setVariable("sdncReplDelay", sdncReplDelay)
110 logger.debug("SDNC replication delay: " + sdncReplDelay)
113 if (isBlank(execution.getVariable("serviceInstanceId"))){
114 msg = "Input serviceInstanceId is null"
116 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
118 if (isBlank(execution.getVariable("parentServiceInstanceId"))) {
119 msg = "Input parentServiceInstanceId is null"
121 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
123 if (isBlank(execution.getVariable("allottedResourceModelInfo"))) {
124 msg = "Input allottedResourceModelInfo is null"
126 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
128 if (isBlank(execution.getVariable("vni"))) {
129 msg = "Input vni is null"
131 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
133 if (isBlank(execution.getVariable("vgmuxBearerIP"))) {
134 msg = "Input vgmuxBearerIP is null"
136 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
138 if (isBlank(execution.getVariable("brgWanMacAddress"))) {
139 msg = "Input brgWanMacAddress is null"
141 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
143 if (isBlank(execution.getVariable("allottedResourceRole"))) {
144 msg = "Input allottedResourceRole is null"
146 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
148 if (isBlank(execution.getVariable("allottedResourceType"))) {
149 msg = "Input allottedResourceType is null"
151 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
154 logger.debug("Rethrowing MSOWorkflowException")
156 } catch (Exception ex){
157 msg = "Exception in preProcessRequest " + ex.getMessage()
159 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
161 logger.trace("end preProcessRequest")
165 * Gets the service instance uri from aai
167 public void getServiceInstance(DelegateExecution execution) {
168 logger.trace("getServiceInstance ")
170 String serviceInstanceId = execution.getVariable('serviceInstanceId')
172 AAIResourcesClient resourceClient = new AAIResourcesClient()
173 AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId)
175 if(resourceClient.exists(uri)){
176 execution.setVariable("CSI_resourceLink", uri.build().toString())
178 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service instance was not found in aai")
181 }catch(BpmnError e) {
183 }catch (Exception ex){
184 String msg = "Exception in getServiceInstance. " + ex.getMessage()
186 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
188 logger.trace("Exit getServiceInstance ")
191 public void getAaiAR (DelegateExecution execution) {
194 logger.trace("start getAaiAR")
196 String arType = execution.getVariable("allottedResourceType")
197 String arRole = execution.getVariable("allottedResourceRole")
199 AllottedResourceUtils arUtils = new AllottedResourceUtils(this)
200 String orchStatus = arUtils.getAROrchStatus(execution)
204 if (orchStatus != null) // AR was found
206 if ("true".equals(execution.getVariable("failExists")))
208 errorMsg = "Allotted resource " + arType + " with Role " + arRole + " already exists"
212 if ("Active".equals(orchStatus))
214 execution.setVariable("foundActiveAR", true)
216 else // blanks included
218 errorMsg = "Allotted Resource " + arType + " with Role " + arRole + " already exists in an incomplete state -" + orchStatus
222 if (!isBlank(errorMsg)) {
223 logger.debug(errorMsg)
224 exceptionUtil.buildAndThrowWorkflowException(execution, 500, errorMsg)
226 logger.trace("end getAaiAR")
229 public void getParentServiceInstance(DelegateExecution execution) {
230 logger.trace("getParentServiceInstance ")
232 String serviceInstanceId = execution.getVariable('parentServiceInstanceId')
234 AAIResourcesClient resourceClient = new AAIResourcesClient()
235 AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId)
238 //just to make sure the serviceInstance exists
240 execution.setVariable("PSI_resourceLink", uri)
241 } catch (NotFoundException e) {
242 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service instance was not found in aai")
245 }catch(BpmnError e) {
247 }catch (Exception ex){
248 String msg = "Exception in getParentServiceInstance. " + ex.getMessage()
250 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
252 logger.trace("Exit getParentServiceInstance ")
256 public void createAaiAR(DelegateExecution execution) {
259 logger.trace("start createAaiAR")
261 String allottedResourceId = execution.getVariable("allottedResourceId")
262 if (isBlank(allottedResourceId))
264 allottedResourceId = UUID.randomUUID().toString()
265 execution.setVariable("allottedResourceId", allottedResourceId)
269 AAIResourceUri siResourceLink= execution.getVariable("PSI_resourceLink")
271 AAIResourceUri allottedResourceUri = AAIUriFactory.createResourceFromParentURI(siResourceLink, AAIObjectType.ALLOTTED_RESOURCE, allottedResourceId)
273 execution.setVariable("aaiARPath", allottedResourceUri.build().toString());
274 String arType = execution.getVariable("allottedResourceType")
275 String arRole = execution.getVariable("allottedResourceRole")
276 String CSI_resourceLink = execution.getVariable("CSI_resourceLink")
278 String arModelInfo = execution.getVariable("allottedResourceModelInfo")
279 String modelInvariantId = jsonUtil.getJsonValue(arModelInfo, "modelInvariantUuid")
280 String modelVersionId = jsonUtil.getJsonValue(arModelInfo, "modelUuid")
282 AllottedResource resource = new AllottedResource()
283 resource.setId(allottedResourceId)
284 resource.setType(arType)
285 resource.setRole(arRole)
286 resource.setModelInvariantId(modelInvariantId)
287 resource.setModelVersionId(modelVersionId)
288 getAAIClient().create(allottedResourceUri, resource)
289 AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceFromExistingURI(AAIObjectType.SERVICE_INSTANCE, UriBuilder.fromPath(CSI_resourceLink).build())
290 getAAIClient().connect(allottedResourceUri,serviceInstanceUri)
291 }catch (Exception ex) {
292 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Exception in createAaiAR " + ex.getMessage())
295 //start rollback set up
296 RollbackData rollbackData = new RollbackData()
297 def disableRollback = execution.getVariable("disableRollback")
298 rollbackData.put(Prefix, "disableRollback", disableRollback.toString())
299 rollbackData.put(Prefix, "rollbackAAI", "true")
300 rollbackData.put(Prefix, "allottedResourceId", allottedResourceId)
301 rollbackData.put(Prefix, "serviceInstanceId", execution.getVariable("serviceInstanceId"))
302 rollbackData.put(Prefix, "parentServiceInstanceId", execution.getVariable("parentServiceInstanceId"))
303 execution.setVariable("rollbackData", rollbackData)
304 logger.trace("end createAaiAR")
307 public String buildSDNCRequest(DelegateExecution execution, String action, String sdncRequestId) {
311 logger.trace("start buildSDNCRequest")
312 String sdncReq = null
316 String allottedResourceId = execution.getVariable("allottedResourceId")
317 String serviceInstanceId = execution.getVariable("serviceInstanceId")
318 String globalCustomerId = execution.getVariable("globalCustomerId")
319 String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
320 String parentServiceInstanceId = execution.getVariable("parentServiceInstanceId")
321 String callbackUrl = execution.getVariable("sdncCallbackUrl")
322 String requestId = execution.getVariable("msoRequestId")
324 String brgWanMacAddress = execution.getVariable("brgWanMacAddress")
325 String vni = execution.getVariable("vni")
326 String vgmuxBearerIP = execution.getVariable("vgmuxBearerIP")
328 String arModelInfo = execution.getVariable("allottedResourceModelInfo")
329 String modelInvariantId = jsonUtil.getJsonValue(arModelInfo, "modelInvariantUuid")
330 String modelVersion = jsonUtil.getJsonValue(arModelInfo, "modelVersion")
331 String modelUUId = jsonUtil.getJsonValue(arModelInfo, "modelUuid")
332 String modelCustomizationId = jsonUtil.getJsonValue(arModelInfo, "modelCustomizationUuid")
333 String modelName = jsonUtil.getJsonValue(arModelInfo, "modelName")
335 if (modelInvariantId == null) {
336 modelInvariantId = ""
338 if (modelVersion == null) {
341 if (modelUUId == null) {
344 if (modelName == null) {
347 if (modelCustomizationId == null) {
348 modelCustomizationId = ""
352 """<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.onap/so/request/types/v1"
353 xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"
354 xmlns:sdncadapter="http://org.onap/workflow/sdnc/adapter/schema/v1">
355 <sdncadapter:RequestHeader>
356 <sdncadapter:RequestId>${MsoUtils.xmlEscape(sdncRequestId)}</sdncadapter:RequestId>
357 <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId>
358 <sdncadapter:SvcAction>${MsoUtils.xmlEscape(action)}</sdncadapter:SvcAction>
359 <sdncadapter:SvcOperation>brg-topology-operation</sdncadapter:SvcOperation>
360 <sdncadapter:CallbackUrl>${MsoUtils.xmlEscape(callbackUrl)}</sdncadapter:CallbackUrl>
361 </sdncadapter:RequestHeader>
362 <sdncadapterworkflow:SDNCRequestData>
363 <request-information>
364 <request-id>${MsoUtils.xmlEscape(requestId)}</request-id>
365 <request-action>CreateBRGInstance</request-action>
370 </request-information>
371 <service-information>
372 <service-id></service-id>
373 <subscription-service-type>${MsoUtils.xmlEscape(subscriptionServiceType)}</subscription-service-type>
374 <onap-model-information></onap-model-information>
375 <service-instance-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-instance-id>
377 <global-customer-id>${MsoUtils.xmlEscape(globalCustomerId)}</global-customer-id>
378 </service-information>
379 <allotted-resource-information>
380 <allotted-resource-id>${MsoUtils.xmlEscape(allottedResourceId)}</allotted-resource-id>
381 <allotted-resource-type>brg</allotted-resource-type>
382 <parent-service-instance-id>${MsoUtils.xmlEscape(parentServiceInstanceId)}</parent-service-instance-id>
383 <onap-model-information>
384 <model-invariant-uuid>${MsoUtils.xmlEscape(modelInvariantId)}</model-invariant-uuid>
385 <model-uuid>${MsoUtils.xmlEscape(modelUUId)}</model-uuid>
386 <model-customization-uuid>${MsoUtils.xmlEscape(modelCustomizationId)}</model-customization-uuid>
387 <model-version>${MsoUtils.xmlEscape(modelVersion)}</model-version>
388 <model-name>${MsoUtils.xmlEscape(modelName)}</model-name>
389 </onap-model-information>
390 </allotted-resource-information>
392 <brg-wan-mac-address>${MsoUtils.xmlEscape(brgWanMacAddress)}</brg-wan-mac-address>
393 <vni>${MsoUtils.xmlEscape(vni)}</vni>
394 <vgmux-bearer-ip>${MsoUtils.xmlEscape(vgmuxBearerIP)}</vgmux-bearer-ip>
396 </sdncadapterworkflow:SDNCRequestData>
397 </sdncadapterworkflow:SDNCAdapterWorkflowRequest>"""
399 logger.debug("sdncRequest:\n" + sdncReq)
400 sdncReq = utils.formatXml(sdncReq)
402 } catch(Exception ex) {
403 msg = "Exception in buildSDNCRequest. " + ex.getMessage()
405 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
407 logger.trace("end buildSDNCRequest")
411 public void preProcessSDNCAssign(DelegateExecution execution) {
415 logger.trace("start preProcessSDNCAssign")
418 String sdncRequestId = UUID.randomUUID().toString()
419 String sdncAssignReq = buildSDNCRequest(execution, "assign", sdncRequestId)
420 execution.setVariable("sdncAssignRequest", sdncAssignReq)
421 logger.debug("sdncAssignRequest: " + sdncAssignReq)
422 def sdncRequestId2 = UUID.randomUUID().toString()
423 String sdncAssignRollbackReq = sdncAssignReq.replace(">assign<", ">unassign<").replace(">CreateBRGInstance<", ">DeleteBRGInstance<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<")
424 def rollbackData = execution.getVariable("rollbackData")
425 rollbackData.put(Prefix, "sdncAssignRollbackReq", sdncAssignRollbackReq)
426 execution.setVariable("rollbackData", rollbackData)
428 logger.debug("sdncAssignRollbackReq:\n" + sdncAssignRollbackReq)
429 logger.debug("rollbackData:\n" + rollbackData.toString())
431 } catch (BpmnError e) {
433 } catch(Exception ex) {
434 msg = "Exception in preProcessSDNCAssign. " + ex.getMessage()
436 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
438 logger.trace("end preProcessSDNCAssign")
441 public void preProcessSDNCCreate(DelegateExecution execution) {
445 logger.trace("start preProcessSDNCCreate")
448 String sdncRequestId = UUID.randomUUID().toString()
449 String sdncCreateReq = buildSDNCRequest(execution, "create", sdncRequestId)
450 execution.setVariable("sdncCreateRequest", sdncCreateReq)
451 logger.debug("sdncCreateReq: " + sdncCreateReq)
452 def sdncRequestId2 = UUID.randomUUID().toString()
453 String sdncCreateRollbackReq = sdncCreateReq.replace(">create<", ">delete<").replace(">CreateBRGInstance<", ">DeleteBRGInstance<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<")
454 def rollbackData = execution.getVariable("rollbackData")
455 rollbackData.put(Prefix, "sdncCreateRollbackReq", sdncCreateRollbackReq)
456 execution.setVariable("rollbackData", rollbackData)
458 logger.debug("sdncCreateRollbackReq:\n" + sdncCreateRollbackReq)
459 logger.debug("rollbackData:\n" + rollbackData.toString())
461 } catch (BpmnError e) {
463 } catch(Exception ex) {
464 msg = "Exception in preProcessSDNCCreate. " + ex.getMessage()
466 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
468 logger.trace("end preProcessSDNCCreate")
471 public void preProcessSDNCActivate(DelegateExecution execution) {
475 logger.trace("start preProcessSDNCActivate")
478 String sdncRequestId = UUID.randomUUID().toString()
479 String sdncActivateReq = buildSDNCRequest(execution, "activate", sdncRequestId)
480 execution.setVariable("sdncActivateRequest", sdncActivateReq)
481 logger.debug("sdncActivateReq: " + sdncActivateReq)
482 def sdncRequestId2 = UUID.randomUUID().toString()
483 String sdncActivateRollbackReq = sdncActivateReq.replace(">activate<", ">deactivate<").replace(">CreateBRGInstance<", ">DeleteBRGInstance<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<")
484 def rollbackData = execution.getVariable("rollbackData")
485 rollbackData.put(Prefix, "sdncActivateRollbackReq", sdncActivateRollbackReq)
486 execution.setVariable("rollbackData", rollbackData)
488 logger.debug("sdncActivateRollbackReq:\n" + sdncActivateRollbackReq)
489 logger.debug("rollbackData:\n" + rollbackData.toString())
491 } catch (BpmnError e) {
493 } catch(Exception ex) {
494 msg = "Exception in preProcessSDNCActivate. " + ex.getMessage()
496 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
498 logger.trace("end preProcessSDNCActivate")
501 public void validateSDNCResp(DelegateExecution execution, String response, String method){
504 logger.trace("ValidateSDNCResponse Process")
508 WorkflowException workflowException = execution.getVariable("WorkflowException")
509 logger.debug("workflowException: " + workflowException)
511 boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator")
512 logger.debug("SDNCResponse: " + response)
514 SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this)
515 sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator)
517 if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){
518 logger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + response)
520 if (!"get".equals(method))
522 def rollbackData = execution.getVariable("rollbackData")
523 rollbackData.put(Prefix, "rollback" + "SDNC" + method, "true")
524 execution.setVariable("rollbackData", rollbackData)
528 logger.debug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.")
529 throw new BpmnError("MSOWorkflowException")
531 } catch (BpmnError e) {
533 } catch(Exception ex) {
534 msg = "Exception in validateSDNCResp. " + ex.getMessage()
536 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
538 logger.trace("End ValidateSDNCResp Process")
541 public void preProcessSDNCGet(DelegateExecution execution){
543 logger.trace("start preProcessSDNCGet")
546 def callbackUrl = execution.getVariable("sdncCallbackUrl")
547 // serviceOperation (URI for topology GET) will be retrieved from "selflink" from AAI if active AR exists in AAI
548 // or from "object-path" in SDNC response for assign when AR does not exist in AA
550 String serviceOperation = ""
552 if (execution.getVariable("foundActiveAR")) {
553 def aaiQueryResponse = execution.getVariable("aaiARGetResponse")
554 serviceOperation = utils.getNodeText(aaiQueryResponse, "selflink")
555 logger.debug("AR service operation/aaiARSelfLink: " + serviceOperation)
559 String response = execution.getVariable("sdncAssignResponse")
560 String data = utils.getNodeXml(response, "response-data")
561 logger.debug("Assign responseData: " + data)
562 serviceOperation = utils.getNodeText(data, "object-path")
563 logger.debug("AR service operation:" + serviceOperation)
566 String serviceInstanceId = execution.getVariable("serviceInstanceId")
567 String sdncRequestId = UUID.randomUUID().toString()
569 //neeed the same url as used by vfmodules
570 String SDNCGetRequest =
571 """<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.onap/so/request/types/v1"
572 xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"
573 xmlns:sdncadapter="http://org.onap/workflow/sdnc/adapter/schema/v1">
574 <sdncadapter:RequestHeader>
575 <sdncadapter:RequestId>${MsoUtils.xmlEscape(sdncRequestId)}</sdncadapter:RequestId>
576 <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId>
577 <sdncadapter:SvcAction>query</sdncadapter:SvcAction>
578 <sdncadapter:SvcOperation>${MsoUtils.xmlEscape(serviceOperation)}</sdncadapter:SvcOperation>
579 <sdncadapter:CallbackUrl>${MsoUtils.xmlEscape(callbackUrl)}</sdncadapter:CallbackUrl>
580 <sdncadapter:MsoAction>vfmodule</sdncadapter:MsoAction>
581 </sdncadapter:RequestHeader>
582 <sdncadapterworkflow:SDNCRequestData></sdncadapterworkflow:SDNCRequestData>
583 </sdncadapterworkflow:SDNCAdapterWorkflowRequest>"""
585 execution.setVariable("sdncGetRequest", SDNCGetRequest)
588 logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
589 "Exception Occurred Processing preProcessSDNCGetRequest.", "BPMN", MsoLogger.getServiceName(),
590 MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
591 exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during SDNC GET Method:\n" + e.getMessage())
593 logger.trace("end preProcessSDNCGet")
596 public void updateAaiAROrchStatus(DelegateExecution execution, String status){
598 logger.trace("start updateAaiAROrchStatus")
599 String aaiARPath = execution.getVariable("aaiARPath") //set during query (existing AR) or create
600 AllottedResourceUtils arUtils = new AllottedResourceUtils(this)
601 String orchStatus = arUtils.updateAROrchStatus(execution, status, aaiARPath)
602 logger.trace("end updateAaiAROrchStatus")
605 public void generateOutputs(DelegateExecution execution)
608 logger.trace("start generateOutputs")
610 String sdncGetResponse = execution.getVariable("enhancedCallbackRequestData") //unescaped
611 logger.debug("resp:" + sdncGetResponse)
612 String arData = utils.getNodeXml(sdncGetResponse, "brg-topology")
613 arData = utils.removeXmlNamespaces(arData)
615 String brga = utils.getNodeXml(arData, "brg-assignments")
616 String ari = utils.getNodeXml(arData, "allotted-resource-identifiers")
617 execution.setVariable("allotedResourceName", utils.getNodeText(ari, "allotted-resource-name"))
618 } catch (BpmnError e) {
619 logger.debug("BPMN Error in generateOutputs ")
620 } catch(Exception ex) {
621 String msg = "Exception in generateOutputs " + ex.getMessage()
624 logger.trace("end generateOutputs")
628 public void preProcessRollback (DelegateExecution execution) {
630 logger.trace("start preProcessRollback")
633 Object workflowException = execution.getVariable("WorkflowException");
635 if (workflowException instanceof WorkflowException) {
636 logger.debug("Prev workflowException: " + workflowException.getErrorMessage())
637 execution.setVariable("prevWorkflowException", workflowException);
638 //execution.setVariable("WorkflowException", null);
640 } catch (BpmnError e) {
641 logger.debug("BPMN Error during preProcessRollback")
642 } catch(Exception ex) {
643 String msg = "Exception in preProcessRollback. " + ex.getMessage()
646 logger.trace("end preProcessRollback")
649 public void postProcessRollback (DelegateExecution execution) {
651 logger.trace("start postProcessRollback")
654 Object workflowException = execution.getVariable("prevWorkflowException");
655 if (workflowException instanceof WorkflowException) {
656 logger.debug("Setting prevException to WorkflowException: ")
657 execution.setVariable("WorkflowException", workflowException);
659 execution.setVariable("rollbackData", null)
660 } catch (BpmnError b) {
661 logger.debug("BPMN Error during postProcessRollback")
663 } catch(Exception ex) {
664 msg = "Exception in postProcessRollback. " + ex.getMessage()
667 logger.trace("end postProcessRollback")