2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.onap.so.bpmn.vcpe.scripts;
23 import org.onap.so.bpmn.common.scripts.*;
24 import org.onap.so.bpmn.common.scripts.AaiUtil
25 import org.onap.so.bpmn.core.RollbackData
26 import org.onap.so.bpmn.core.WorkflowException
27 import org.onap.so.bpmn.core.UrnPropertiesReader
28 import org.onap.so.bpmn.core.json.JsonUtils
29 import org.onap.so.rest.APIResponse
31 import java.util.UUID;
32 import org.camunda.bpm.engine.delegate.BpmnError
33 import org.camunda.bpm.engine.delegate.DelegateExecution
34 import org.apache.commons.lang3.*
35 import org.springframework.web.util.UriUtils;
36 import static org.apache.commons.lang3.StringUtils.*
38 import org.onap.so.logger.MessageEnum
39 import org.onap.so.logger.MsoLogger
42 * This groovy class supports the <class>DoCreateAllottedResourceBRG.bpmn</class> process.
47 * @param - msoRequestId
48 * @param - isDEbugLogEnabled
49 * @param - disableRollback
50 * @param - failExists - O
51 * @param - serviceInstanceId
52 * @param - globalCustomerId - O
53 * @param - subscriptionServiceType - O
54 * @param - parentServiceInstanceId
55 * @param - allottedReourceId - O
56 * @param - allottedResourceModelInfo
57 * @param - allottedResourceRole
58 * @param - allottedResourceType
59 * @param - brgWanMacAddress
61 * @param - vgmuxBearerIP
64 * @param - rollbackData (localRB->null)
65 * @param - rolledBack (no localRB->null, localRB F->false, localRB S->true)
66 * @param - WorkflowException - O
67 * @param - allottedResourceId
68 * @param - allottedResourceName
71 public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{
72 private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCreateAllottedResourceBRG.class);
74 String Prefix="DCARBRG_"
75 ExceptionUtil exceptionUtil = new ExceptionUtil()
76 JsonUtils jsonUtil = new JsonUtils()
78 public void preProcessRequest (DelegateExecution execution) {
82 msoLogger.trace("start preProcessRequest")
85 execution.setVariable("prefix", Prefix)
88 String sdncCallbackUrl = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution)
89 if (isBlank(sdncCallbackUrl)) {
90 msg = "mso.workflow.sdncadapter.callback is null"
92 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
94 execution.setVariable("sdncCallbackUrl", sdncCallbackUrl)
95 msoLogger.debug("SDNC Callback URL: " + sdncCallbackUrl)
97 String sdncReplDelay = UrnPropertiesReader.getVariable("mso.workflow.sdnc.replication.delay",execution)
98 if (isBlank(sdncReplDelay)) {
99 msg = "mso.workflow.sdnc.replication.delay is null"
101 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
103 execution.setVariable("sdncReplDelay", sdncReplDelay)
104 msoLogger.debug("SDNC replication delay: " + sdncReplDelay)
107 if (isBlank(execution.getVariable("serviceInstanceId"))){
108 msg = "Input serviceInstanceId is null"
110 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
112 if (isBlank(execution.getVariable("parentServiceInstanceId"))) {
113 msg = "Input parentServiceInstanceId is null"
115 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
117 if (isBlank(execution.getVariable("allottedResourceModelInfo"))) {
118 msg = "Input allottedResourceModelInfo is null"
120 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
122 if (isBlank(execution.getVariable("vni"))) {
123 msg = "Input vni is null"
125 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
127 if (isBlank(execution.getVariable("vgmuxBearerIP"))) {
128 msg = "Input vgmuxBearerIP is null"
130 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
132 if (isBlank(execution.getVariable("brgWanMacAddress"))) {
133 msg = "Input brgWanMacAddress is null"
135 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
137 if (isBlank(execution.getVariable("allottedResourceRole"))) {
138 msg = "Input allottedResourceRole is null"
140 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
142 if (isBlank(execution.getVariable("allottedResourceType"))) {
143 msg = "Input allottedResourceType is null"
145 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
148 msoLogger.debug("Rethrowing MSOWorkflowException")
150 } catch (Exception ex){
151 msg = "Exception in preProcessRequest " + ex.getMessage()
153 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
155 msoLogger.trace("end preProcessRequest")
158 public void getAaiAR (DelegateExecution execution) {
161 msoLogger.trace("start getAaiAR")
163 String arType = execution.getVariable("allottedResourceType")
164 String arRole = execution.getVariable("allottedResourceRole")
166 AllottedResourceUtils arUtils = new AllottedResourceUtils(this)
167 String orchStatus = arUtils.getAROrchStatus(execution)
171 if (orchStatus != null) // AR was found
173 if ("true".equals(execution.getVariable("failExists")))
175 errorMsg = "Allotted resource " + arType + " with Role " + arRole + " already exists"
179 if ("Active".equals(orchStatus))
181 execution.setVariable("foundActiveAR", true)
183 else // blanks included
185 errorMsg = "Allotted Resource " + arType + " with Role " + arRole + " already exists in an incomplete state -" + orchStatus
189 if (!isBlank(errorMsg)) {
190 msoLogger.debug(errorMsg)
191 exceptionUtil.buildAndThrowWorkflowException(execution, 500, errorMsg)
193 msoLogger.trace("end getAaiAR")
196 public void createAaiAR(DelegateExecution execution) {
199 msoLogger.trace("start createAaiAR")
202 String allottedResourceId = execution.getVariable("allottedResourceId")
203 if (isBlank(allottedResourceId))
205 allottedResourceId = UUID.randomUUID().toString()
206 execution.setVariable("allottedResourceId", allottedResourceId)
212 AaiUtil aaiUriUtil = new AaiUtil(this)
213 String aaiEndpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution)
214 String siResourceLink= execution.getVariable("PSI_resourceLink")
217 msoLogger.debug("PSI_resourceLink:" + siResourceLink)
219 if(!isBlank(siResourceLink)) {
220 msoLogger.debug("Incoming PSI Resource Link is: " + siResourceLink)
221 String[] split = siResourceLink.split("/aai/")
222 siUri = "/aai/" + split[1]
226 msg = "Parent Service Link in AAI is null"
228 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
231 arUrl = "${aaiEndpoint}${siUri}" + "/allotted-resources/allotted-resource/" + UriUtils.encode(allottedResourceId,"UTF-8")
232 execution.setVariable("aaiARPath", arUrl)
233 msoLogger.debug("GET AllottedResource AAI URL is:\n" + arUrl)
235 String namespace = aaiUriUtil.getNamespaceFromUri(execution, arUrl)
237 String arType = execution.getVariable("allottedResourceType")
238 String arRole = execution.getVariable("allottedResourceRole")
239 String CSI_resourceLink = execution.getVariable("CSI_resourceLink")
240 String arModelInfo = execution.getVariable("allottedResourceModelInfo")
241 String modelInvariantId = jsonUtil.getJsonValue(arModelInfo, "modelInvariantUuid")
242 String modelVersionId = jsonUtil.getJsonValue(arModelInfo, "modelUuid")
243 String modelCustomizationId = jsonUtil.getJsonValue(arModelInfo, "modelCustomizationUuid")
245 if (modelInvariantId == null) {
246 modelInvariantId = ""
248 if (modelVersionId == null) {
251 if (modelCustomizationId == null) {
252 modelCustomizationId = ""
256 """<allotted-resource xmlns="${namespace}">
257 <id>${MsoUtils.xmlEscape(allottedResourceId)}</id>
258 <description></description>
259 <type>${MsoUtils.xmlEscape(arType)}</type>
260 <role>${MsoUtils.xmlEscape(arRole)}</role>
261 <selflink></selflink>
262 <model-invariant-id>${MsoUtils.xmlEscape(modelInvariantId)}</model-invariant-id>
263 <model-version-id>${MsoUtils.xmlEscape(modelVersionId)}</model-version-id>
264 <model-customization-id>${MsoUtils.xmlEscape(modelCustomizationId)}</model-customization-id>
265 <orchestration-status>PendingCreate</orchestration-status>
266 <operation-status></operation-status>
269 <related-to>service-instance</related-to>
270 <related-link>${MsoUtils.xmlEscape(CSI_resourceLink)}</related-link>
273 </allotted-resource>""".trim()
275 execution.setVariable("AaiARPayload", payload)
276 msoLogger.debug(" payload to create AllottedResource in AAI:" + "\n" + payload)
278 APIResponse response = aaiUriUtil.executeAAIPutCall(execution, arUrl, payload)
279 int responseCode = response.getStatusCode()
280 msoLogger.debug("AllottedResource AAI PUT responseCode:" + responseCode)
282 String aaiResponse = response.getResponseBodyAsString()
283 msoLogger.debug("AllottedResource AAI PUT responseStr:" + aaiResponse)
285 //200 OK 201 CREATED 202 ACCEPTED
286 if(responseCode == 200 || responseCode == 201 || responseCode == 202 )
288 msoLogger.debug("AAI PUT AllottedResource received a Good Response")
291 msoLogger.debug("AAI Put AllottedResouce received a Bad Response Code: " + responseCode)
292 exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode)
293 throw new BpmnError("MSOWorkflowException")
296 msoLogger.debug("Rethrowing MSOWorkflowException")
298 } catch (Exception ex) {
299 msg = "Exception in createAaiAR " + ex.getMessage()
301 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
304 //start rollback set up
305 RollbackData rollbackData = new RollbackData()
306 def disableRollback = execution.getVariable("disableRollback")
307 rollbackData.put(Prefix, "disableRollback", disableRollback.toString())
308 rollbackData.put(Prefix, "rollbackAAI", "true")
309 rollbackData.put(Prefix, "allottedResourceId", allottedResourceId)
310 rollbackData.put(Prefix, "serviceInstanceId", execution.getVariable("serviceInstanceId"))
311 rollbackData.put(Prefix, "parentServiceInstanceId", execution.getVariable("parentServiceInstanceId"))
312 rollbackData.put(Prefix, "aaiARPath", arUrl)
313 execution.setVariable("rollbackData", rollbackData)
314 msoLogger.trace("end createAaiAR")
317 public String buildSDNCRequest(DelegateExecution execution, String action, String sdncRequestId) {
321 msoLogger.trace("start buildSDNCRequest")
322 String sdncReq = null
326 String allottedResourceId = execution.getVariable("allottedResourceId")
327 String serviceInstanceId = execution.getVariable("serviceInstanceId")
328 String globalCustomerId = execution.getVariable("globalCustomerId")
329 String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
330 String parentServiceInstanceId = execution.getVariable("parentServiceInstanceId")
331 String callbackUrl = execution.getVariable("sdncCallbackUrl")
332 String requestId = execution.getVariable("msoRequestId")
334 String brgWanMacAddress = execution.getVariable("brgWanMacAddress")
335 String vni = execution.getVariable("vni")
336 String vgmuxBearerIP = execution.getVariable("vgmuxBearerIP")
338 String arModelInfo = execution.getVariable("allottedResourceModelInfo")
339 String modelInvariantId = jsonUtil.getJsonValue(arModelInfo, "modelInvariantUuid")
340 String modelVersion = jsonUtil.getJsonValue(arModelInfo, "modelVersion")
341 String modelUUId = jsonUtil.getJsonValue(arModelInfo, "modelUuid")
342 String modelCustomizationId = jsonUtil.getJsonValue(arModelInfo, "modelCustomizationUuid")
343 String modelName = jsonUtil.getJsonValue(arModelInfo, "modelName")
345 if (modelInvariantId == null) {
346 modelInvariantId = ""
348 if (modelVersion == null) {
351 if (modelUUId == null) {
354 if (modelName == null) {
357 if (modelCustomizationId == null) {
358 modelCustomizationId = ""
362 """<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.onap/so/request/types/v1"
363 xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"
364 xmlns:sdncadapter="http://org.onap/workflow/sdnc/adapter/schema/v1">
365 <sdncadapter:RequestHeader>
366 <sdncadapter:RequestId>${MsoUtils.xmlEscape(sdncRequestId)}</sdncadapter:RequestId>
367 <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId>
368 <sdncadapter:SvcAction>${MsoUtils.xmlEscape(action)}</sdncadapter:SvcAction>
369 <sdncadapter:SvcOperation>brg-topology-operation</sdncadapter:SvcOperation>
370 <sdncadapter:CallbackUrl>${MsoUtils.xmlEscape(callbackUrl)}</sdncadapter:CallbackUrl>
371 </sdncadapter:RequestHeader>
372 <sdncadapterworkflow:SDNCRequestData>
373 <request-information>
374 <request-id>${MsoUtils.xmlEscape(requestId)}</request-id>
375 <request-action>CreateBRGInstance</request-action>
380 </request-information>
381 <service-information>
382 <service-id></service-id>
383 <subscription-service-type>${MsoUtils.xmlEscape(subscriptionServiceType)}</subscription-service-type>
384 <onap-model-information></onap-model-information>
385 <service-instance-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-instance-id>
387 <global-customer-id>${MsoUtils.xmlEscape(globalCustomerId)}</global-customer-id>
388 </service-information>
389 <allotted-resource-information>
390 <allotted-resource-id>${MsoUtils.xmlEscape(allottedResourceId)}</allotted-resource-id>
391 <allotted-resource-type>brg</allotted-resource-type>
392 <parent-service-instance-id>${MsoUtils.xmlEscape(parentServiceInstanceId)}</parent-service-instance-id>
393 <onap-model-information>
394 <model-invariant-uuid>${MsoUtils.xmlEscape(modelInvariantId)}</model-invariant-uuid>
395 <model-uuid>${MsoUtils.xmlEscape(modelUUId)}</model-uuid>
396 <model-customization-uuid>${MsoUtils.xmlEscape(modelCustomizationId)}</model-customization-uuid>
397 <model-version>${MsoUtils.xmlEscape(modelVersion)}</model-version>
398 <model-name>${MsoUtils.xmlEscape(modelName)}</model-name>
399 </onap-model-information>
400 </allotted-resource-information>
402 <brg-wan-mac-address>${MsoUtils.xmlEscape(brgWanMacAddress)}</brg-wan-mac-address>
403 <vni>${MsoUtils.xmlEscape(vni)}</vni>
404 <vgmux-bearer-ip>${MsoUtils.xmlEscape(vgmuxBearerIP)}</vgmux-bearer-ip>
406 </sdncadapterworkflow:SDNCRequestData>
407 </sdncadapterworkflow:SDNCAdapterWorkflowRequest>"""
409 msoLogger.debug("sdncRequest:\n" + sdncReq)
410 sdncReq = utils.formatXml(sdncReq)
412 } catch(Exception ex) {
413 msg = "Exception in buildSDNCRequest. " + ex.getMessage()
415 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
417 msoLogger.trace("end buildSDNCRequest")
421 public void preProcessSDNCAssign(DelegateExecution execution) {
425 msoLogger.trace("start preProcessSDNCAssign")
428 String sdncRequestId = UUID.randomUUID().toString()
429 String sdncAssignReq = buildSDNCRequest(execution, "assign", sdncRequestId)
430 execution.setVariable("sdncAssignRequest", sdncAssignReq)
431 msoLogger.debug("sdncAssignRequest: " + sdncAssignReq)
432 def sdncRequestId2 = UUID.randomUUID().toString()
433 String sdncAssignRollbackReq = sdncAssignReq.replace(">assign<", ">unassign<").replace(">CreateBRGInstance<", ">DeleteBRGInstance<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<")
434 def rollbackData = execution.getVariable("rollbackData")
435 rollbackData.put(Prefix, "sdncAssignRollbackReq", sdncAssignRollbackReq)
436 execution.setVariable("rollbackData", rollbackData)
438 msoLogger.debug("sdncAssignRollbackReq:\n" + sdncAssignRollbackReq)
439 msoLogger.debug("rollbackData:\n" + rollbackData.toString())
441 } catch (BpmnError e) {
443 } catch(Exception ex) {
444 msg = "Exception in preProcessSDNCAssign. " + ex.getMessage()
446 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
448 msoLogger.trace("end preProcessSDNCAssign")
451 public void preProcessSDNCCreate(DelegateExecution execution) {
455 msoLogger.trace("start preProcessSDNCCreate")
458 String sdncRequestId = UUID.randomUUID().toString()
459 String sdncCreateReq = buildSDNCRequest(execution, "create", sdncRequestId)
460 execution.setVariable("sdncCreateRequest", sdncCreateReq)
461 msoLogger.debug("sdncCreateReq: " + sdncCreateReq)
462 def sdncRequestId2 = UUID.randomUUID().toString()
463 String sdncCreateRollbackReq = sdncCreateReq.replace(">create<", ">delete<").replace(">CreateBRGInstance<", ">DeleteBRGInstance<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<")
464 def rollbackData = execution.getVariable("rollbackData")
465 rollbackData.put(Prefix, "sdncCreateRollbackReq", sdncCreateRollbackReq)
466 execution.setVariable("rollbackData", rollbackData)
468 msoLogger.debug("sdncCreateRollbackReq:\n" + sdncCreateRollbackReq)
469 msoLogger.debug("rollbackData:\n" + rollbackData.toString())
471 } catch (BpmnError e) {
473 } catch(Exception ex) {
474 msg = "Exception in preProcessSDNCCreate. " + ex.getMessage()
476 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
478 msoLogger.trace("end preProcessSDNCCreate")
481 public void preProcessSDNCActivate(DelegateExecution execution) {
485 msoLogger.trace("start preProcessSDNCActivate")
488 String sdncRequestId = UUID.randomUUID().toString()
489 String sdncActivateReq = buildSDNCRequest(execution, "activate", sdncRequestId)
490 execution.setVariable("sdncActivateRequest", sdncActivateReq)
491 msoLogger.debug("sdncActivateReq: " + sdncActivateReq)
492 def sdncRequestId2 = UUID.randomUUID().toString()
493 String sdncActivateRollbackReq = sdncActivateReq.replace(">activate<", ">deactivate<").replace(">CreateBRGInstance<", ">DeleteBRGInstance<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<")
494 def rollbackData = execution.getVariable("rollbackData")
495 rollbackData.put(Prefix, "sdncActivateRollbackReq", sdncActivateRollbackReq)
496 execution.setVariable("rollbackData", rollbackData)
498 msoLogger.debug("sdncActivateRollbackReq:\n" + sdncActivateRollbackReq)
499 msoLogger.debug("rollbackData:\n" + rollbackData.toString())
501 } catch (BpmnError e) {
503 } catch(Exception ex) {
504 msg = "Exception in preProcessSDNCActivate. " + ex.getMessage()
506 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
508 msoLogger.trace("end preProcessSDNCActivate")
511 public void validateSDNCResp(DelegateExecution execution, String response, String method){
514 msoLogger.trace("ValidateSDNCResponse Process")
518 WorkflowException workflowException = execution.getVariable("WorkflowException")
519 msoLogger.debug("workflowException: " + workflowException)
521 boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator")
522 msoLogger.debug("SDNCResponse: " + response)
524 SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this)
525 sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator)
527 if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){
528 msoLogger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + response)
530 if (!"get".equals(method))
532 def rollbackData = execution.getVariable("rollbackData")
533 rollbackData.put(Prefix, "rollback" + "SDNC" + method, "true")
534 execution.setVariable("rollbackData", rollbackData)
538 msoLogger.debug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.")
539 throw new BpmnError("MSOWorkflowException")
541 } catch (BpmnError e) {
543 } catch(Exception ex) {
544 msg = "Exception in validateSDNCResp. " + ex.getMessage()
546 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
548 msoLogger.trace("End ValidateSDNCResp Process")
551 public void preProcessSDNCGet(DelegateExecution execution){
553 msoLogger.trace("start preProcessSDNCGet")
556 def callbackUrl = execution.getVariable("sdncCallbackUrl")
557 // serviceOperation (URI for topology GET) will be retrieved from "selflink" from AAI if active AR exists in AAI
558 // or from "object-path" in SDNC response for assign when AR does not exist in AA
560 String serviceOperation = ""
562 if (execution.getVariable("foundActiveAR")) {
563 def aaiQueryResponse = execution.getVariable("aaiARGetResponse")
564 serviceOperation = utils.getNodeText(aaiQueryResponse, "selflink")
565 msoLogger.debug("AR service operation/aaiARSelfLink: " + serviceOperation)
569 String response = execution.getVariable("sdncAssignResponse")
570 String data = utils.getNodeXml(response, "response-data")
571 msoLogger.debug("Assign responseData: " + data)
572 serviceOperation = utils.getNodeText(data, "object-path")
573 msoLogger.debug("AR service operation:" + serviceOperation)
576 String serviceInstanceId = execution.getVariable("serviceInstanceId")
577 String sdncRequestId = UUID.randomUUID().toString()
579 //neeed the same url as used by vfmodules
580 String SDNCGetRequest =
581 """<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.onap/so/request/types/v1"
582 xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"
583 xmlns:sdncadapter="http://org.onap/workflow/sdnc/adapter/schema/v1">
584 <sdncadapter:RequestHeader>
585 <sdncadapter:RequestId>${MsoUtils.xmlEscape(sdncRequestId)}</sdncadapter:RequestId>
586 <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId>
587 <sdncadapter:SvcAction>query</sdncadapter:SvcAction>
588 <sdncadapter:SvcOperation>${MsoUtils.xmlEscape(serviceOperation)}</sdncadapter:SvcOperation>
589 <sdncadapter:CallbackUrl>${MsoUtils.xmlEscape(callbackUrl)}</sdncadapter:CallbackUrl>
590 <sdncadapter:MsoAction>vfmodule</sdncadapter:MsoAction>
591 </sdncadapter:RequestHeader>
592 <sdncadapterworkflow:SDNCRequestData></sdncadapterworkflow:SDNCRequestData>
593 </sdncadapterworkflow:SDNCAdapterWorkflowRequest>"""
595 execution.setVariable("sdncGetRequest", SDNCGetRequest)
598 msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occurred Processing preProcessSDNCGetRequest.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
599 exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during SDNC GET Method:\n" + e.getMessage())
601 msoLogger.trace("end preProcessSDNCGet")
604 public void updateAaiAROrchStatus(DelegateExecution execution, String status){
606 msoLogger.trace("start updateAaiAROrchStatus")
607 String aaiARPath = execution.getVariable("aaiARPath") //set during query (existing AR) or create
608 AllottedResourceUtils arUtils = new AllottedResourceUtils(this)
609 String orchStatus = arUtils.updateAROrchStatus(execution, status, aaiARPath)
610 msoLogger.trace("end updateAaiAROrchStatus")
613 public void generateOutputs(DelegateExecution execution)
616 msoLogger.trace("start generateOutputs")
618 String sdncGetResponse = execution.getVariable("enhancedCallbackRequestData") //unescaped
619 msoLogger.debug("resp:" + sdncGetResponse)
620 String arData = utils.getNodeXml(sdncGetResponse, "brg-topology")
621 arData = utils.removeXmlNamespaces(arData)
623 String brga = utils.getNodeXml(arData, "brg-assignments")
624 String ari = utils.getNodeXml(arData, "allotted-resource-identifiers")
625 execution.setVariable("allotedResourceName", utils.getNodeText(ari, "allotted-resource-name"))
626 } catch (BpmnError e) {
627 msoLogger.debug("BPMN Error in generateOutputs ")
628 } catch(Exception ex) {
629 String msg = "Exception in generateOutputs " + ex.getMessage()
632 msoLogger.trace("end generateOutputs")
636 public void preProcessRollback (DelegateExecution execution) {
638 msoLogger.trace("start preProcessRollback")
641 Object workflowException = execution.getVariable("WorkflowException");
643 if (workflowException instanceof WorkflowException) {
644 msoLogger.debug("Prev workflowException: " + workflowException.getErrorMessage())
645 execution.setVariable("prevWorkflowException", workflowException);
646 //execution.setVariable("WorkflowException", null);
648 } catch (BpmnError e) {
649 msoLogger.debug("BPMN Error during preProcessRollback")
650 } catch(Exception ex) {
651 String msg = "Exception in preProcessRollback. " + ex.getMessage()
654 msoLogger.trace("end preProcessRollback")
657 public void postProcessRollback (DelegateExecution execution) {
659 msoLogger.trace("start postProcessRollback")
662 Object workflowException = execution.getVariable("prevWorkflowException");
663 if (workflowException instanceof WorkflowException) {
664 msoLogger.debug("Setting prevException to WorkflowException: ")
665 execution.setVariable("WorkflowException", workflowException);
667 execution.setVariable("rollbackData", null)
668 } catch (BpmnError b) {
669 msoLogger.debug("BPMN Error during postProcessRollback")
671 } catch(Exception ex) {
672 msg = "Exception in postProcessRollback. " + ex.getMessage()
675 msoLogger.trace("end postProcessRollback")