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 DoCreateServiceInstance 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>"
260 String serviceTypeLine = isBlank(serviceType) ? "" : "<service-type>${serviceType}</service-type>"
261 String serviceRoleLine = isBlank(serviceRole) ? "" : "<service-role>${serviceRole}</service-role>"
263 AaiUtil aaiUriUtil = new AaiUtil(this)
264 String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution)
265 String namespace = aaiUriUtil.getNamespaceFromUri(aai_uri)
266 String serviceInstanceData =
267 """<service-instance xmlns=\"${namespace}\">
268 <service-instance-name>${serviceInstanceName}</service-instance-name>
272 <model-invariant-id>${modelInvariantUuid}</model-invariant-id>
273 <model-version-id>${modelUuid}</model-version-id>
274 </service-instance>""".trim()
276 execution.setVariable("serviceInstanceData", serviceInstanceData)
277 utils.logAudit(serviceInstanceData)
278 utils.log("DEBUG", " 'payload' to create Service Instance in AAI - " + "\n" + serviceInstanceData, isDebugEnabled)
280 } catch (BpmnError e) {
282 } catch (Exception ex){
283 msg = "Exception in preProcessRequest " + ex.getMessage()
284 utils.log("DEBUG", msg, isDebugEnabled)
285 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
287 utils.log("DEBUG"," ***** Exit preProcessRequest *****", isDebugEnabled)
290 //TODO: Will be able to replace with call to GenericGetService
291 public void getAAICustomerById (Execution execution) {
292 // https://{aaiEP}/aai/v8/business/customers/customer/{globalCustomerId}
293 def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
297 String globalCustomerId = execution.getVariable("globalSubscriberId") //VID to AAI name map
298 utils.log("DEBUG"," ***** getAAICustomerById ***** globalCustomerId:" + globalCustomerId, isDebugEnabled)
300 String aai_endpoint = execution.getVariable("URN_aai_endpoint")
301 AaiUtil aaiUriUtil = new AaiUtil(this)
302 String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution)
303 if (isBlank(aai_endpoint) || isBlank(aai_uri))
305 msg = "AAI URL is invalid. Endpoint:" + aai_endpoint + aai_uri
306 utils.log("DEBUG", msg, isDebugEnabled)
307 exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
309 String getAAICustomerUrl = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(globalCustomerId,"UTF-8")
311 utils.logAudit(getAAICustomerUrl)
312 utils.log("DEBUG", "getAAICustomerById Url:" + getAAICustomerUrl, isDebugEnabled)
313 APIResponse response = aaiUriUtil.executeAAIGetCall(execution, getAAICustomerUrl)
314 String returnCode = response.getStatusCode()
315 String aaiResponseAsString = response.getResponseBodyAsString()
317 msg = "getAAICustomerById ResponseCode:" + returnCode + " ResponseString:" + aaiResponseAsString
318 utils.log("DEBUG",msg, isDebugEnabled)
321 if (returnCode=='200') {
322 // Customer found by ID. FLow to proceed.
323 utils.log("DEBUG",msg, isDebugEnabled)
326 //we might verify that service-subscription with matching name exists
327 //and throw error if not. If not checked, we will get exception in subsequent step on Create call
328 //in 1610 we assume both customer & service subscription were pre-created
331 if (returnCode=='404') {
332 msg = "GlobalCustomerId:" + globalCustomerId + " not found (404) in AAI"
333 utils.log("DEBUG", msg, isDebugEnabled)
334 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
337 if (aaiResponseAsString.contains("RESTFault")) {
338 utils.log("ERROR", aaiResponseAsString)
339 WorkflowException workflowException = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution)
340 execution.setVariable("WorkflowException", workflowException)
341 throw new BpmnError("MSOWorkflowException")
345 msg = "Error in getAAICustomerById ResponseCode:" + returnCode
346 utils.log("DEBUG", msg, isDebugEnabled)
347 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
352 } catch (BpmnError e) {
354 } catch (Exception ex) {
355 msg = "Exception in getAAICustomerById. " + ex.getMessage()
356 utils.log("DEBUG", msg, isDebugEnabled)
357 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
359 utils.log("DEBUG"," *****Exit getAAICustomerById *****", isDebugEnabled)
363 public void postProcessAAIGET(Execution execution) {
364 def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
365 utils.log("DEBUG"," ***** postProcessAAIGET ***** ", isDebugEnabled)
369 String serviceInstanceName = execution.getVariable("serviceInstanceName")
370 boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator")
371 if(succInAAI != true){
372 utils.log("DEBUG","Error getting Service-instance from AAI", + serviceInstanceName, isDebugEnabled)
373 WorkflowException workflowException = execution.getVariable("WorkflowException")
374 utils.logAudit("workflowException: " + workflowException)
375 if(workflowException != null){
376 exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage())
380 msg = "Failure in postProcessAAIGET GENGS_SuccessIndicator:" + succInAAI
381 utils.log("DEBUG", msg, isDebugEnabled)
382 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
387 boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator")
388 if(foundInAAI == true){
389 utils.log("DEBUG","Found Service-instance in AAI", isDebugEnabled)
390 msg = "ServiceInstance already exists in AAI:" + serviceInstanceName
391 utils.log("DEBUG", msg, isDebugEnabled)
392 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
395 } catch (BpmnError e) {
397 } catch (Exception ex) {
398 msg = "Exception in DoCreateServiceInstance.postProcessAAIGET. " + ex.getMessage()
399 utils.log("DEBUG", msg, isDebugEnabled)
400 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
402 utils.log("DEBUG"," *** Exit postProcessAAIGET *** ", isDebugEnabled)
405 public void postProcessAAIPUT(Execution execution) {
406 def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
407 utils.log("DEBUG"," ***** postProcessAAIPUT ***** ", isDebugEnabled)
410 String serviceInstanceId = execution.getVariable("serviceInstanceId")
411 boolean succInAAI = execution.getVariable("GENPS_SuccessIndicator")
412 if(succInAAI != true){
413 utils.log("DEBUG","Error putting Service-instance in AAI", + serviceInstanceId, isDebugEnabled)
414 WorkflowException workflowException = execution.getVariable("WorkflowException")
415 utils.logAudit("workflowException: " + workflowException)
416 if(workflowException != null){
417 exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage())
422 //start rollback set up
423 RollbackData rollbackData = new RollbackData()
424 def disableRollback = execution.getVariable("disableRollback")
425 rollbackData.put("SERVICEINSTANCE", "disableRollback", disableRollback.toString())
426 rollbackData.put("SERVICEINSTANCE", "rollbackAAI", "true")
427 rollbackData.put("SERVICEINSTANCE", "serviceInstanceId", serviceInstanceId)
428 rollbackData.put("SERVICEINSTANCE", "subscriptionServiceType", execution.getVariable("subscriptionServiceType"))
429 rollbackData.put("SERVICEINSTANCE", "globalSubscriberId", execution.getVariable("globalSubscriberId"))
430 execution.setVariable("rollbackData", rollbackData)
433 } catch (BpmnError e) {
435 } catch (Exception ex) {
436 msg = "Exception in DoCreateServiceInstance.postProcessAAIDEL. " + ex.getMessage()
437 utils.log("DEBUG", msg, isDebugEnabled)
438 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
440 utils.log("DEBUG"," *** Exit postProcessAAIPUT *** ", isDebugEnabled)
443 public void preProcessSDNCAssignRequest(Execution execution) {
444 def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
446 utils.log("DEBUG"," ***** preProcessSDNCAssignRequest *****", isDebugEnabled)
449 def serviceInstanceId = execution.getVariable("serviceInstanceId")
450 def serviceInstanceName = execution.getVariable("serviceInstanceName")
451 def callbackURL = execution.getVariable("sdncCallbackUrl")
452 def requestId = execution.getVariable("msoRequestId")
453 def serviceId = execution.getVariable("productFamilyId")
454 def subscriptionServiceType = execution.getVariable("subscriptionServiceType")
455 def globalSubscriberId = execution.getVariable("globalSubscriberId") //globalCustomerId
456 def serviceType = execution.getVariable("serviceType")
458 def modelInvariantUuid = execution.getVariable("modelInvariantUuid")
459 def modelVersion = execution.getVariable("modelVersion")
460 def modelUuid = execution.getVariable("modelUuid")
461 def modelName = execution.getVariable("modelName")
463 def sdncRequestId = UUID.randomUUID().toString()
465 def siParamsXml = execution.getVariable("siParamsXml")
467 String sdncAssignRequest =
468 """<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.openecomp/mso/request/types/v1"
469 xmlns:sdncadapterworkflow="http://org.openecomp/mso/workflow/schema/v1"
470 xmlns:sdncadapter="http://org.openecomp/workflow/sdnc/adapter/schema/v1">
471 <sdncadapter:RequestHeader>
472 <sdncadapter:RequestId>${sdncRequestId}</sdncadapter:RequestId>
473 <sdncadapter:SvcInstanceId>${serviceInstanceId}</sdncadapter:SvcInstanceId>
474 <sdncadapter:SvcAction>assign</sdncadapter:SvcAction>
475 <sdncadapter:SvcOperation>service-topology-operation</sdncadapter:SvcOperation>
476 <sdncadapter:CallbackUrl>${callbackURL}</sdncadapter:CallbackUrl>
477 <sdncadapter:MsoAction>${serviceType}</sdncadapter:MsoAction>
478 </sdncadapter:RequestHeader>
479 <sdncadapterworkflow:SDNCRequestData>
480 <request-information>
481 <request-id>${requestId}</request-id>
486 <request-action>CreateServiceInstance</request-action>
487 </request-information>
488 <service-information>
489 <service-id>${serviceId}</service-id>
490 <subscription-service-type>${subscriptionServiceType}</subscription-service-type>
491 <onap-model-information>
492 <model-invariant-uuid>${modelInvariantUuid}</model-invariant-uuid>
493 <model-uuid>${modelUuid}</model-uuid>
494 <model-version>${modelVersion}</model-version>
495 <model-name>${modelName}</model-name>
496 </onap-model-information>
497 <service-instance-id>${serviceInstanceId}</service-instance-id>
499 <global-customer-id>${globalSubscriberId}</global-customer-id>
500 </service-information>
501 <service-request-input>
502 <service-instance-name>${serviceInstanceName}</service-instance-name>
504 </service-request-input>
505 </sdncadapterworkflow:SDNCRequestData>
506 </sdncadapterworkflow:SDNCAdapterWorkflowRequest>"""
508 utils.log("DEBUG","sdncAssignRequest:\n" + sdncAssignRequest, isDebugEnabled)
509 sdncAssignRequest = utils.formatXml(sdncAssignRequest)
510 execution.setVariable("sdncAssignRequest", sdncAssignRequest)
511 utils.logAudit("sdncAssignRequest: " + sdncAssignRequest)
513 def sdncRequestId2 = UUID.randomUUID().toString()
514 String sdncDelete = sdncAssignRequest.replace(">assign<", ">delete<").replace(">CreateServiceInstance<", ">DeleteServiceInstance<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<")
515 def sdncRequestId3 = UUID.randomUUID().toString()
516 String sdncDeactivate = sdncDelete.replace(">delete<", ">deactivate<").replace(">${sdncRequestId2}<", ">${sdncRequestId3}<")
517 def rollbackData = execution.getVariable("rollbackData")
518 rollbackData.put("SERVICEINSTANCE", "sdncDeactivate", sdncDeactivate)
519 rollbackData.put("SERVICEINSTANCE", "sdncDelete", sdncDelete)
520 execution.setVariable("rollbackData", rollbackData)
522 utils.log("DEBUG","rollbackData:\n" + rollbackData.toString(), isDebugEnabled)
524 } catch (BpmnError e) {
526 } catch(Exception ex) {
527 msg = "Exception in preProcessSDNCAssignRequest. " + ex.getMessage()
528 utils.log("DEBUG", msg, isDebugEnabled)
529 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
531 utils.log("DEBUG"," *****Exit preProcessSDNCAssignRequest *****", isDebugEnabled)
534 public void postProcessSDNCAssign (Execution execution) {
535 def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
536 utils.log("DEBUG"," ***** postProcessSDNCAssign ***** ", isDebugEnabled)
538 WorkflowException workflowException = execution.getVariable("WorkflowException")
539 utils.logAudit("workflowException: " + workflowException)
541 boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator")
543 String response = execution.getVariable("sdncAdapterResponse")
544 utils.logAudit("SDNCResponse: " + response)
546 SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this)
547 sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator)
549 if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){
550 utils.log("DEBUG","Good response from SDNC Adapter for service-instance topology assign: \n" + response, isDebugEnabled)
552 def rollbackData = execution.getVariable("rollbackData")
553 rollbackData.put("SERVICEINSTANCE", "rollbackSDNC", "true")
554 execution.setVariable("rollbackData", rollbackData)
557 utils.log("DEBUG","Bad Response from SDNC Adapter for service-instance assign", isDebugEnabled)
558 throw new BpmnError("MSOWorkflowException")
561 } catch (BpmnError e) {
563 } catch(Exception ex) {
564 msg = "Exception in postProcessSDNCAssign. " + ex.getMessage()
565 utils.log("DEBUG", msg, isDebugEnabled)
566 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
568 utils.log("DEBUG"," *** Exit postProcessSDNCAssign *** ", isDebugEnabled)
571 public void postProcessAAIGET2(Execution execution) {
572 def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
573 utils.log("DEBUG"," ***** postProcessAAIGET2 ***** ", isDebugEnabled)
577 String serviceInstanceName = execution.getVariable("serviceInstanceName")
578 boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator")
579 if(succInAAI != true){
580 utils.log("DEBUG","Error getting Service-instance from AAI in postProcessAAIGET2", + serviceInstanceName, isDebugEnabled)
581 WorkflowException workflowException = execution.getVariable("WorkflowException")
582 utils.logAudit("workflowException: " + workflowException)
583 if(workflowException != null){
584 exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage())
588 msg = "Failure in postProcessAAIGET2 GENGS_SuccessIndicator:" + succInAAI
589 utils.log("DEBUG", msg, isDebugEnabled)
590 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
595 boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator")
596 if(foundInAAI == true){
597 String aaiService = execution.getVariable("GENGS_service")
598 if (!isBlank(aaiService) && (utils.nodeExists(aaiService, "service-instance-name"))) {
599 execution.setVariable("serviceInstanceName", utils.getNodeText1(aaiService, "service-instance-name"))
600 utils.log("DEBUG","Found Service-instance in AAI.serviceInstanceName:" + execution.getVariable("serviceInstanceName"), isDebugEnabled)
604 } catch (BpmnError e) {
606 } catch (Exception ex) {
607 msg = "Exception in DoCreateServiceInstance.postProcessAAIGET2 " + ex.getMessage()
608 utils.log("DEBUG", msg, isDebugEnabled)
609 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
611 utils.log("DEBUG"," *** Exit postProcessAAIGET2 *** ", isDebugEnabled)
614 public void preProcessRollback (Execution execution) {
615 def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
616 utils.log("DEBUG"," ***** preProcessRollback ***** ", isDebugEnabled)
619 Object workflowException = execution.getVariable("WorkflowException");
621 if (workflowException instanceof WorkflowException) {
622 utils.log("DEBUG", "Prev workflowException: " + workflowException.getErrorMessage(), isDebugEnabled)
623 execution.setVariable("prevWorkflowException", workflowException);
624 //execution.setVariable("WorkflowException", null);
626 } catch (BpmnError e) {
627 utils.log("DEBUG", "BPMN Error during preProcessRollback", isDebugEnabled)
628 } catch(Exception ex) {
629 String msg = "Exception in preProcessRollback. " + ex.getMessage()
630 utils.log("DEBUG", msg, isDebugEnabled)
632 utils.log("DEBUG"," *** Exit preProcessRollback *** ", isDebugEnabled)
635 public void postProcessRollback (Execution execution) {
636 def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
637 utils.log("DEBUG"," ***** postProcessRollback ***** ", isDebugEnabled)
640 Object workflowException = execution.getVariable("prevWorkflowException");
641 if (workflowException instanceof WorkflowException) {
642 utils.log("DEBUG", "Setting prevException to WorkflowException: ", isDebugEnabled)
643 execution.setVariable("WorkflowException", workflowException);
645 execution.setVariable("rollbackData", null)
646 } catch (BpmnError b) {
647 utils.log("DEBUG", "BPMN Error during postProcessRollback", isDebugEnabled)
649 } catch(Exception ex) {
650 msg = "Exception in postProcessRollback. " + ex.getMessage()
651 utils.log("DEBUG", msg, isDebugEnabled)
653 utils.log("DEBUG"," *** Exit postProcessRollback *** ", isDebugEnabled)