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=========================================================
20 package org.openecomp.mso.bpmn.infrastructure.scripts;
22 import static org.apache.commons.lang3.StringUtils.*;
23 import groovy.xml.XmlUtil
26 import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition
27 import org.openecomp.mso.bpmn.core.domain.ServiceInstance
28 import org.openecomp.mso.bpmn.core.domain.ModelInfo
29 import org.openecomp.mso.bpmn.core.json.JsonUtils
30 import org.openecomp.mso.bpmn.common.scripts.AaiUtil
31 import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor
32 import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil
33 import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils
34 import org.openecomp.mso.bpmn.core.RollbackData
35 import org.openecomp.mso.bpmn.core.WorkflowException
36 import org.openecomp.mso.rest.APIResponse;
37 import org.openecomp.mso.rest.RESTClient
38 import org.openecomp.mso.rest.RESTConfig
40 import java.util.UUID;
42 import org.camunda.bpm.engine.delegate.BpmnError
43 import org.camunda.bpm.engine.runtime.Execution
44 import org.json.JSONObject;
45 import org.apache.commons.lang3.*
46 import org.apache.commons.codec.binary.Base64;
47 import org.springframework.web.util.UriUtils;
50 * This groovy class supports the <class>DoCreateServiceInstance.bpmn</class> process.
53 * @param - msoRequestId
54 * @param - globalSubscriberId
55 * @param - subscriptionServiceType
56 * @param - serviceInstanceId
57 * @param - serviceInstanceName - O
58 * @param - serviceModelInfo
59 * @param - productFamilyId
60 * @param - disableRollback
61 * @param - failExists - TODO
62 * @param - serviceInputParams (should contain aic_zone for serviceTypes TRANSPORT,ATM)
63 * @param - sdncVersion ("1610")
64 * @param - serviceDecomposition - Decomposition for R1710
65 * (if macro provides serviceDecompsition then serviceModelInfo, serviceInstanceId & serviceInstanceName will be ignored)
68 * @param - rollbackData (localRB->null)
69 * @param - rolledBack (no localRB->null, localRB F->false, localRB S->true)
70 * @param - WorkflowException
71 * @param - serviceInstanceName - (GET from AAI if null in input)
74 public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
76 String Prefix="DCRESI_"
77 ExceptionUtil exceptionUtil = new ExceptionUtil()
78 JsonUtils jsonUtil = new JsonUtils()
80 public void preProcessRequest (Execution execution) {
81 def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
83 utils.log("DEBUG"," ***** preProcessRequest *****", isDebugEnabled)
86 String requestId = execution.getVariable("msoRequestId")
87 execution.setVariable("prefix", Prefix)
90 //requestDetails.subscriberInfo. for AAI GET & PUT & SDNC assignToplology
91 String globalSubscriberId = execution.getVariable("globalSubscriberId") //globalCustomerId
93 //requestDetails.requestParameters. for AAI PUT & SDNC assignTopology
94 String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
96 //requestDetails.requestParameters. for SDNC assignTopology
97 String productFamilyId = execution.getVariable("productFamilyId") //AAI productFamilyId
99 if (isBlank(globalSubscriberId)) {
100 msg = "Input globalSubscriberId is null"
101 utils.log("DEBUG", msg, isDebugEnabled)
102 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
105 if (isBlank(subscriptionServiceType)) {
106 msg = "Input subscriptionServiceType is null"
107 utils.log("DEBUG", msg, isDebugEnabled)
108 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
111 if (productFamilyId == null) {
112 execution.setVariable("productFamilyId", "")
115 String sdncCallbackUrl = execution.getVariable('URN_mso_workflow_sdncadapter_callback')
116 if (isBlank(sdncCallbackUrl)) {
117 msg = "URN_mso_workflow_sdncadapter_callback is null"
118 utils.log("DEBUG", msg, isDebugEnabled)
119 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
121 execution.setVariable("sdncCallbackUrl", sdncCallbackUrl)
122 utils.log("DEBUG","SDNC Callback URL: " + sdncCallbackUrl, isDebugEnabled)
124 //requestDetails.modelInfo.for AAI PUT servieInstanceData & SDNC assignTopology
125 String modelInvariantUuid = ""
126 String modelVersion = ""
127 String modelUuid = ""
128 String modelName = ""
129 String serviceInstanceName = ""
130 //Generated in parent.for AAI PUT
131 String serviceInstanceId = ""
132 String serviceType = ""
133 String serviceRole = ""
135 ServiceDecomposition serviceDecomp = (ServiceDecomposition) execution.getVariable("serviceDecomposition")
136 if (serviceDecomp != null)
138 serviceType = serviceDecomp.getServiceType()
139 if (serviceType == null)
141 utils.log("DEBUG", "null serviceType", isDebugEnabled)
146 utils.log("DEBUG", "serviceType:" + serviceType, isDebugEnabled)
148 serviceRole = serviceDecomp.getServiceRole()
149 if (serviceRole == null)
154 ServiceInstance serviceInstance = serviceDecomp.getServiceInstance()
155 if (serviceInstance != null)
157 serviceInstanceId = serviceInstance.getInstanceId()
158 serviceInstanceName = serviceInstance.getInstanceName()
159 execution.setVariable("serviceInstanceId", serviceInstanceId)
160 execution.setVariable("serviceInstanceName", serviceInstanceName)
163 ModelInfo modelInfo = serviceDecomp.getModelInfo()
164 if (modelInfo != null)
166 modelInvariantUuid = modelInfo.getModelInvariantUuid()
167 modelVersion = modelInfo.getModelVersion()
168 modelUuid = modelInfo.getModelUuid()
169 modelName = modelInfo.getModelName()
173 msg = "Input serviceModelInfo is null"
174 utils.log("DEBUG", msg, isDebugEnabled)
175 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
180 //requestDetails.requestInfo. for AAI GET/PUT serviceInstanceData & SDNC assignToplology
181 serviceInstanceName = execution.getVariable("serviceInstanceName")
182 serviceInstanceId = execution.getVariable("serviceInstanceId")
184 String serviceModelInfo = execution.getVariable("serviceModelInfo")
185 if (isBlank(serviceModelInfo)) {
186 msg = "Input serviceModelInfo is null"
187 utils.log("DEBUG", msg, isDebugEnabled)
188 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
190 modelInvariantUuid = jsonUtil.getJsonValue(serviceModelInfo, "modelInvariantUuid")
191 modelVersion = jsonUtil.getJsonValue(serviceModelInfo, "modelVersion")
192 modelUuid = jsonUtil.getJsonValue(serviceModelInfo, "modelUuid")
193 modelName = jsonUtil.getJsonValue(serviceModelInfo, "modelName")
194 //modelCustomizationUuid NA for SI
197 execution.setVariable("serviceType", serviceType)
198 execution.setVariable("serviceRole", serviceRole)
200 if (serviceInstanceName == null) {
201 execution.setVariable("serviceInstanceName", "")
202 serviceInstanceName = ""
204 if (isBlank(serviceInstanceId)){
205 msg = "Input serviceInstanceId is null"
206 utils.log("DEBUG", msg, isDebugEnabled)
207 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
210 if (modelInvariantUuid == null) {
211 modelInvariantUuid = ""
213 if (modelUuid == null) {
216 if (modelVersion == null) {
219 if (modelName == null) {
223 execution.setVariable("modelInvariantUuid", modelInvariantUuid)
224 execution.setVariable("modelVersion", modelVersion)
225 execution.setVariable("modelUuid", modelUuid)
226 execution.setVariable("modelName", modelName)
228 StringBuilder sbParams = new StringBuilder()
229 Map<String, String> paramsMap = execution.getVariable("serviceInputParams")
230 if (paramsMap != null)
232 sbParams.append("<service-input-parameters>")
233 for (Map.Entry<String, String> entry : paramsMap.entrySet()) {
235 String paramName = entry.getKey()
236 String paramValue = entry.getValue()
239 <name>${paramName}</name>
240 <value>${paramValue}</value>
243 sbParams.append(paramsXml)
245 sbParams.append("</service-input-parameters>")
247 String siParamsXml = sbParams.toString()
248 if (siParamsXml == null)
250 execution.setVariable("siParamsXml", siParamsXml)
253 String oStatus = execution.getVariable("initialStatus") ?: ""
254 if ("TRANSPORT".equalsIgnoreCase(serviceType))
259 String statusLine = isBlank(oStatus) ? "" : "<orchestration-status>${oStatus}</orchestration-status>"
261 AaiUtil aaiUriUtil = new AaiUtil(this)
262 String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution)
263 String namespace = aaiUriUtil.getNamespaceFromUri(aai_uri)
264 String serviceInstanceData =
265 """<service-instance xmlns=\"${namespace}\">
266 <service-instance-name>${serviceInstanceName}</service-instance-name>
267 <service-type>${serviceType}</service-type>
268 <service-role>${serviceRole}</service-role>
270 <model-invariant-id>${modelInvariantUuid}</model-invariant-id>
271 <model-version-id>${modelUuid}</model-version-id>
272 </service-instance>""".trim()
274 execution.setVariable("serviceInstanceData", serviceInstanceData)
275 utils.logAudit(serviceInstanceData)
276 utils.log("DEBUG", " 'payload' to create Service Instance in AAI - " + "\n" + serviceInstanceData, isDebugEnabled)
278 } catch (BpmnError e) {
280 } catch (Exception ex){
281 msg = "Exception in preProcessRequest " + ex.getMessage()
282 utils.log("DEBUG", msg, isDebugEnabled)
283 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
285 utils.log("DEBUG"," ***** Exit preProcessRequest *****", isDebugEnabled)
288 //TODO: Will be able to replace with call to GenericGetService
289 public void getAAICustomerById (Execution execution) {
290 // https://{aaiEP}/aai/v8/business/customers/customer/{globalCustomerId}
291 def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
295 String globalCustomerId = execution.getVariable("globalSubscriberId") //VID to AAI name map
296 utils.log("DEBUG"," ***** getAAICustomerById ***** globalCustomerId:" + globalCustomerId, isDebugEnabled)
298 String aai_endpoint = execution.getVariable("URN_aai_endpoint")
299 AaiUtil aaiUriUtil = new AaiUtil(this)
300 String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution)
301 if (isBlank(aai_endpoint) || isBlank(aai_uri))
303 msg = "AAI URL is invalid. Endpoint:" + aai_endpoint + aai_uri
304 utils.log("DEBUG", msg, isDebugEnabled)
305 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
307 String getAAICustomerUrl = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(globalCustomerId,"UTF-8")
309 utils.logAudit(getAAICustomerUrl)
310 utils.log("DEBUG", "getAAICustomerById Url:" + getAAICustomerUrl, isDebugEnabled)
311 APIResponse response = aaiUriUtil.executeAAIGetCall(execution, getAAICustomerUrl)
312 String returnCode = response.getStatusCode()
313 String aaiResponseAsString = response.getResponseBodyAsString()
315 msg = "getAAICustomerById ResponseCode:" + returnCode + " ResponseString:" + aaiResponseAsString
316 utils.log("DEBUG",msg, isDebugEnabled)
319 if (returnCode=='200') {
320 // Customer found by ID. FLow to proceed.
321 utils.log("DEBUG",msg, isDebugEnabled)
324 //we might verify that service-subscription with matching name exists
325 //and throw error if not. If not checked, we will get exception in subsequent step on Create call
326 //in 1610 we assume both customer & service subscription were pre-created
329 if (returnCode=='404') {
330 msg = "GlobalCustomerId:" + globalCustomerId + " not found (404) in AAI"
331 utils.log("DEBUG", msg, isDebugEnabled)
332 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
335 if (aaiResponseAsString.contains("RESTFault")) {
336 utils.log("ERROR", aaiResponseAsString)
337 WorkflowException workflowException = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution)
338 execution.setVariable("WorkflowException", workflowException)
339 throw new BpmnError("MSOWorkflowException")
343 msg = "Error in getAAICustomerById ResponseCode:" + returnCode
344 utils.log("DEBUG", msg, isDebugEnabled)
345 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
350 } catch (BpmnError e) {
352 } catch (Exception ex) {
353 msg = "Exception in getAAICustomerById. " + ex.getMessage()
354 utils.log("DEBUG", msg, isDebugEnabled)
355 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
357 utils.log("DEBUG"," *****Exit getAAICustomerById *****", isDebugEnabled)
361 public void postProcessAAIGET(Execution execution) {
362 def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
363 utils.log("DEBUG"," ***** postProcessAAIGET ***** ", isDebugEnabled)
367 String serviceInstanceName = execution.getVariable("serviceInstanceName")
368 boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator")
369 if(succInAAI != true){
370 utils.log("DEBUG","Error getting Service-instance from AAI", + serviceInstanceName, isDebugEnabled)
371 WorkflowException workflowException = execution.getVariable("WorkflowException")
372 utils.logAudit("workflowException: " + workflowException)
373 if(workflowException != null){
374 exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage())
378 msg = "Failure in postProcessAAIGET GENGS_SuccessIndicator:" + succInAAI
379 utils.log("DEBUG", msg, isDebugEnabled)
380 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
385 boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator")
386 if(foundInAAI == true){
387 utils.log("DEBUG","Found Service-instance in AAI", isDebugEnabled)
388 msg = "ServiceInstance already exists in AAI:" + serviceInstanceName
389 utils.log("DEBUG", msg, isDebugEnabled)
390 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
393 } catch (BpmnError e) {
395 } catch (Exception ex) {
396 msg = "Exception in DoCreateServiceInstance.postProcessAAIGET. " + ex.getMessage()
397 utils.log("DEBUG", msg, isDebugEnabled)
398 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
400 utils.log("DEBUG"," *** Exit postProcessAAIGET *** ", isDebugEnabled)
403 public void postProcessAAIPUT(Execution execution) {
404 def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
405 utils.log("DEBUG"," ***** postProcessAAIPUT ***** ", isDebugEnabled)
408 String serviceInstanceId = execution.getVariable("serviceInstanceId")
409 boolean succInAAI = execution.getVariable("GENPS_SuccessIndicator")
410 if(succInAAI != true){
411 utils.log("DEBUG","Error putting Service-instance in AAI", + serviceInstanceId, isDebugEnabled)
412 WorkflowException workflowException = execution.getVariable("WorkflowException")
413 utils.logAudit("workflowException: " + workflowException)
414 if(workflowException != null){
415 exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage())
420 //start rollback set up
421 RollbackData rollbackData = new RollbackData()
422 def disableRollback = execution.getVariable("disableRollback")
423 rollbackData.put("SERVICEINSTANCE", "disableRollback", disableRollback.toString())
424 rollbackData.put("SERVICEINSTANCE", "rollbackAAI", "true")
425 rollbackData.put("SERVICEINSTANCE", "serviceInstanceId", serviceInstanceId)
426 rollbackData.put("SERVICEINSTANCE", "subscriptionServiceType", execution.getVariable("subscriptionServiceType"))
427 rollbackData.put("SERVICEINSTANCE", "globalSubscriberId", execution.getVariable("globalSubscriberId"))
428 execution.setVariable("rollbackData", rollbackData)
431 } catch (BpmnError e) {
433 } catch (Exception ex) {
434 msg = "Exception in DoCreateServiceInstance.postProcessAAIDEL. " + ex.getMessage()
435 utils.log("DEBUG", msg, isDebugEnabled)
436 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
438 utils.log("DEBUG"," *** Exit postProcessAAIPUT *** ", isDebugEnabled)
441 public void preProcessSDNCAssignRequest(Execution execution) {
442 def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
444 utils.log("DEBUG"," ***** preProcessSDNCAssignRequest *****", isDebugEnabled)
447 def serviceInstanceId = execution.getVariable("serviceInstanceId")
448 def serviceInstanceName = execution.getVariable("serviceInstanceName")
449 def callbackURL = execution.getVariable("sdncCallbackUrl")
450 def requestId = execution.getVariable("msoRequestId")
451 def serviceId = execution.getVariable("productFamilyId")
452 def subscriptionServiceType = execution.getVariable("subscriptionServiceType")
453 def globalSubscriberId = execution.getVariable("globalSubscriberId") //globalCustomerId
454 def serviceType = execution.getVariable("serviceType")
456 def modelInvariantUuid = execution.getVariable("modelInvariantUuid")
457 def modelVersion = execution.getVariable("modelVersion")
458 def modelUuid = execution.getVariable("modelUuid")
459 def modelName = execution.getVariable("modelName")
461 def sdncRequestId = UUID.randomUUID().toString()
463 def siParamsXml = execution.getVariable("siParamsXml")
465 String sdncAssignRequest =
466 """<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.openecomp/mso/request/types/v1"
467 xmlns:sdncadapterworkflow="http://org.openecomp/mso/workflow/schema/v1"
468 xmlns:sdncadapter="http://org.openecomp/workflow/sdnc/adapter/schema/v1">
469 <sdncadapter:RequestHeader>
470 <sdncadapter:RequestId>${sdncRequestId}</sdncadapter:RequestId>
471 <sdncadapter:SvcInstanceId>${serviceInstanceId}</sdncadapter:SvcInstanceId>
472 <sdncadapter:SvcAction>assign</sdncadapter:SvcAction>
473 <sdncadapter:SvcOperation>service-topology-operation</sdncadapter:SvcOperation>
474 <sdncadapter:CallbackUrl>${callbackURL}</sdncadapter:CallbackUrl>
475 <sdncadapter:MsoAction>${serviceType}</sdncadapter:MsoAction>
476 </sdncadapter:RequestHeader>
477 <sdncadapterworkflow:SDNCRequestData>
478 <request-information>
479 <request-id>${requestId}</request-id>
484 <request-action>CreateServiceInstance</request-action>
485 </request-information>
486 <service-information>
487 <service-id>${serviceId}</service-id>
488 <subscription-service-type>${subscriptionServiceType}</subscription-service-type>
489 <ecomp-model-information>
490 <model-invariant-uuid>${modelInvariantUuid}</model-invariant-uuid>
491 <model-uuid>${modelUuid}</model-uuid>
492 <model-version>${modelVersion}</model-version>
493 <model-name>${modelName}</model-name>
494 </ecomp-model-information>
495 <service-instance-id>${serviceInstanceId}</service-instance-id>
497 <global-customer-id>${globalSubscriberId}</global-customer-id>
498 </service-information>
499 <service-request-input>
500 <service-instance-name>${serviceInstanceName}</service-instance-name>
502 </service-request-input>
503 </sdncadapterworkflow:SDNCRequestData>
504 </sdncadapterworkflow:SDNCAdapterWorkflowRequest>"""
506 utils.log("DEBUG","sdncAssignRequest:\n" + sdncAssignRequest, isDebugEnabled)
507 sdncAssignRequest = utils.formatXml(sdncAssignRequest)
508 execution.setVariable("sdncAssignRequest", sdncAssignRequest)
509 utils.logAudit("sdncAssignRequest: " + sdncAssignRequest)
511 def sdncRequestId2 = UUID.randomUUID().toString()
512 String sdncDelete = sdncAssignRequest.replace(">assign<", ">delete<").replace(">CreateServiceInstance<", ">DeleteServiceInstance<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<")
513 def sdncRequestId3 = UUID.randomUUID().toString()
514 String sdncDeactivate = sdncDelete.replace(">delete<", ">deactivate<").replace(">${sdncRequestId2}<", ">${sdncRequestId3}<")
515 def rollbackData = execution.getVariable("rollbackData")
516 rollbackData.put("SERVICEINSTANCE", "sdncDeactivate", sdncDeactivate)
517 rollbackData.put("SERVICEINSTANCE", "sdncDelete", sdncDelete)
518 execution.setVariable("rollbackData", rollbackData)
520 utils.log("DEBUG","rollbackData:\n" + rollbackData.toString(), isDebugEnabled)
522 } catch (BpmnError e) {
524 } catch(Exception ex) {
525 msg = "Exception in preProcessSDNCAssignRequest. " + ex.getMessage()
526 utils.log("DEBUG", msg, isDebugEnabled)
527 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
529 utils.log("DEBUG"," *****Exit preProcessSDNCAssignRequest *****", isDebugEnabled)
532 public void postProcessSDNCAssign (Execution execution) {
533 def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
534 utils.log("DEBUG"," ***** postProcessSDNCAssign ***** ", isDebugEnabled)
536 WorkflowException workflowException = execution.getVariable("WorkflowException")
537 utils.logAudit("workflowException: " + workflowException)
539 boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator")
541 String response = execution.getVariable("sdncAdapterResponse")
542 utils.logAudit("SDNCResponse: " + response)
544 SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this)
545 sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator)
547 if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){
548 utils.log("DEBUG","Good response from SDNC Adapter for service-instance topology assign: \n" + response, isDebugEnabled)
550 def rollbackData = execution.getVariable("rollbackData")
551 rollbackData.put("SERVICEINSTANCE", "rollbackSDNC", "true")
552 execution.setVariable("rollbackData", rollbackData)
555 utils.log("DEBUG","Bad Response from SDNC Adapter for service-instance assign", isDebugEnabled)
556 throw new BpmnError("MSOWorkflowException")
559 } catch (BpmnError e) {
561 } catch(Exception ex) {
562 msg = "Exception in postProcessSDNCAssign. " + ex.getMessage()
563 utils.log("DEBUG", msg, isDebugEnabled)
564 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
566 utils.log("DEBUG"," *** Exit postProcessSDNCAssign *** ", isDebugEnabled)
569 public void postProcessAAIGET2(Execution execution) {
570 def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
571 utils.log("DEBUG"," ***** postProcessAAIGET2 ***** ", isDebugEnabled)
575 String serviceInstanceName = execution.getVariable("serviceInstanceName")
576 boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator")
577 if(succInAAI != true){
578 utils.log("DEBUG","Error getting Service-instance from AAI in postProcessAAIGET2", + serviceInstanceName, isDebugEnabled)
579 WorkflowException workflowException = execution.getVariable("WorkflowException")
580 utils.logAudit("workflowException: " + workflowException)
581 if(workflowException != null){
582 exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage())
586 msg = "Failure in postProcessAAIGET2 GENGS_SuccessIndicator:" + succInAAI
587 utils.log("DEBUG", msg, isDebugEnabled)
588 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
593 boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator")
594 if(foundInAAI == true){
595 String aaiService = execution.getVariable("GENGS_service")
596 if (!isBlank(aaiService) && (utils.nodeExists(aaiService, "service-instance-name"))) {
597 execution.setVariable("serviceInstanceName", utils.getNodeText1(aaiService, "service-instance-name"))
598 utils.log("DEBUG","Found Service-instance in AAI.serviceInstanceName:" + execution.getVariable("serviceInstanceName"), isDebugEnabled)
602 } catch (BpmnError e) {
604 } catch (Exception ex) {
605 msg = "Exception in DoCreateServiceInstance.postProcessAAIGET2 " + ex.getMessage()
606 utils.log("DEBUG", msg, isDebugEnabled)
607 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
609 utils.log("DEBUG"," *** Exit postProcessAAIGET2 *** ", isDebugEnabled)
612 public void preProcessRollback (Execution execution) {
613 def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
614 utils.log("DEBUG"," ***** preProcessRollback ***** ", isDebugEnabled)
617 Object workflowException = execution.getVariable("WorkflowException");
619 if (workflowException instanceof WorkflowException) {
620 utils.log("DEBUG", "Prev workflowException: " + workflowException.getErrorMessage(), isDebugEnabled)
621 execution.setVariable("prevWorkflowException", workflowException);
622 //execution.setVariable("WorkflowException", null);
624 } catch (BpmnError e) {
625 utils.log("DEBUG", "BPMN Error during preProcessRollback", isDebugEnabled)
626 } catch(Exception ex) {
627 String msg = "Exception in preProcessRollback. " + ex.getMessage()
628 utils.log("DEBUG", msg, isDebugEnabled)
630 utils.log("DEBUG"," *** Exit preProcessRollback *** ", isDebugEnabled)
633 public void postProcessRollback (Execution execution) {
634 def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
635 utils.log("DEBUG"," ***** postProcessRollback ***** ", isDebugEnabled)
638 Object workflowException = execution.getVariable("prevWorkflowException");
639 if (workflowException instanceof WorkflowException) {
640 utils.log("DEBUG", "Setting prevException to WorkflowException: ", isDebugEnabled)
641 execution.setVariable("WorkflowException", workflowException);
643 execution.setVariable("rollbackData", null)
644 } catch (BpmnError b) {
645 utils.log("DEBUG", "BPMN Error during postProcessRollback", isDebugEnabled)
647 } catch(Exception ex) {
648 msg = "Exception in postProcessRollback. " + ex.getMessage()
649 utils.log("DEBUG", msg, isDebugEnabled)
651 utils.log("DEBUG"," *** Exit postProcessRollback *** ", isDebugEnabled)