Groovy scripts header correction
[so.git] / bpmn / MSOInfrastructureBPMN / src / main / groovy / org / openecomp / mso / bpmn / infrastructure / scripts / DoDeleteVnfAndModules.groovy
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
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
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
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=========================================================
19  */
20 package org.openecomp.mso.bpmn.infrastructure.scripts
21
22 import java.util.UUID;
23
24 import org.json.JSONObject;
25 import org.json.JSONArray;
26 import org.camunda.bpm.engine.delegate.BpmnError
27 import org.camunda.bpm.engine.runtime.Execution;
28
29 import static org.apache.commons.lang3.StringUtils.*;
30
31 import org.openecomp.mso.bpmn.core.json.JsonUtils
32 import org.openecomp.mso.rest.APIResponse
33 import org.openecomp.mso.rest.RESTClient
34 import org.openecomp.mso.rest.RESTConfig
35 import org.openecomp.mso.bpmn.common.scripts.AaiUtil
36 import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor
37 import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil
38 import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils
39 import org.openecomp.mso.bpmn.common.scripts.VidUtils
40 import org.openecomp.mso.bpmn.core.RollbackData
41 import org.openecomp.mso.bpmn.core.WorkflowException
42 import org.springframework.web.util.UriUtils;
43
44 /**
45  * This class supports the macro VID Flow
46  * with the deletion of a generic vnf and related VF modules.
47  */
48 class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor {
49
50         String Prefix="DDVAM_"
51         ExceptionUtil exceptionUtil = new ExceptionUtil()
52         JsonUtils jsonUtil = new JsonUtils()
53         VidUtils vidUtils = new VidUtils(this)
54         SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this)
55
56         /**
57          * This method gets and validates the incoming
58          * request.
59          *
60          * @param - execution
61          *      
62          */
63         public void preProcessRequest(Execution execution) {
64                 def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
65                 execution.setVariable("prefix",Prefix)
66                 utils.log("DEBUG", " *** STARTED DoDeleteVnfAndModules PreProcessRequest Process*** ", isDebugEnabled)
67
68                 try{
69                         // Get Variables                                
70                         
71                         String cloudConfiguration = execution.getVariable("cloudConfiguration")         
72                         utils.log("DEBUG", "Cloud Configuration: " + cloudConfiguration, isDebugEnabled)        
73                         
74                         String requestId = execution.getVariable("msoRequestId")
75                         execution.setVariable("requestId", requestId)                   
76                         execution.setVariable("mso-request-id", requestId)
77                         utils.log("DEBUG", "Incoming Request Id is: " + requestId, isDebugEnabled)
78
79                         String serviceInstanceId = execution.getVariable("serviceInstanceId")                   
80                         utils.log("DEBUG", "Incoming Service Instance Id is: " + serviceInstanceId, isDebugEnabled)
81
82                         String vnfId = execution.getVariable("vnfId")                   
83                         utils.log("DEBUG", "Incoming Vnf Id is: " + vnfId, isDebugEnabled)                      
84                         
85                         String source = "VID"
86                         execution.setVariable("DDVAM_source", source)
87                         utils.log("DEBUG", "Incoming Source is: " + source, isDebugEnabled)
88                         
89                         execution.setVariable("DDVAM_isVidRequest", "true")
90                         
91                         String sdncVersion = execution.getVariable("sdncVersion")
92                         if (sdncVersion == null) {
93                                 sdncVersion = "1702"
94                         }
95                         execution.setVariable("DDVAM_sdncVersion", sdncVersion)
96                         utils.log("DEBUG", "Incoming Sdnc Version is: " + sdncVersion, isDebugEnabled)
97                         
98                         String sdncCallbackUrl = (String) execution.getVariable('URN_mso_workflow_sdncadapter_callback')
99                         if (sdncCallbackUrl == null || sdncCallbackUrl.trim().isEmpty()) {
100                                 def msg = 'Required variable \'URN_mso_workflow_sdncadapter_callback\' is missing'
101                                 logError(msg)
102                                 exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
103                         }
104                         execution.setVariable("sdncCallbackUrl", sdncCallbackUrl)
105                         utils.logAudit("SDNC Callback URL: " + sdncCallbackUrl)
106                         logDebug("SDNC Callback URL is: " + sdncCallbackUrl, isDebugEnabled)
107                         
108                         if (!sdncVersion.equals("1702")) {
109                                 //String vnfModelInfo = execution.getVariable("vnfModelInfo")
110                                 //String serviceModelInfo = execution.getVariable("serviceModelInfo")
111                                 
112                                 String serviceId = execution.getVariable("productFamilyId")
113                                 execution.setVariable("DDVAM_serviceId", serviceId)
114                                 utils.log("DEBUG", "Incoming Service Id is: " + serviceId, isDebugEnabled)
115                                 
116                                         
117                                 //String modelInvariantId = jsonUtil.getJsonValue(vnfModelInfo, "modelInvariantId")
118                                 //execution.setVariable("DDVAM_modelInvariantId", modelInvariantId)
119                                 //utils.log("DEBUG", "Incoming Invariant Id is: " + modelInvariantId, isDebugEnabled)
120                                 
121                                 //String modelVersionId = jsonUtil.getJsonValue(vnfModelInfo, "modelVersionId")
122                                 //if (modelVersionId == null) {
123                                 //      modelVersionId = ""
124                                 //}
125                                 //execution.setVariable("DDVAM_modelVersionId", modelVersionId)
126                                 //utils.log("DEBUG", "Incoming Version Id is: " + modelVersionId, isDebugEnabled)
127         
128                                 //String modelVersion = jsonUtil.getJsonValue(vnfModelInfo, "modelVersion")
129                                 //execution.setVariable("DDVAM_modelVersion", modelVersion)
130                                 //utils.log("DEBUG", "Incoming Model Version is: " + modelVersion, isDebugEnabled)
131                                 
132                                 //String modelName = jsonUtil.getJsonValue(vnfModelInfo, "modelName")
133                                 //execution.setVariable("DDVAM_modelName", modelName)
134                                 //utils.log("DEBUG", "Incoming Model Name is: " + modelName, isDebugEnabled)
135                                 
136                                 //String modelCustomizationId = jsonUtil.getJsonValue(vnfModelInfo, "modelCustomizationId")
137                                 //if (modelCustomizationId == null) {
138                                 //      modelCustomizationId = ""
139                                 //}
140                                 //execution.setVariable("DDVAM_modelCustomizationId", modelCustomizationId)
141                                 //utils.log("DEBUG", "Incoming Model Customization Id is: " + modelCustomizationId, isDebugEnabled)
142                                         
143                                 String cloudSiteId = execution.getVariable("lcpCloudRegionId")
144                                 execution.setVariable("DDVAM_cloudSiteId", cloudSiteId)
145                                 utils.log("DEBUG", "Incoming Cloud Site Id is: " + cloudSiteId, isDebugEnabled)
146                                         
147                                 String tenantId = execution.getVariable("tenantId")
148                                 execution.setVariable("DDVAM_tenantId", tenantId)
149                                 utils.log("DEBUG", "Incoming Tenant Id is: " + tenantId, isDebugEnabled)
150                                 
151                                 String globalSubscriberId = execution.getVariable("globalSubscriberId")
152                                 if (globalSubscriberId == null) {
153                                         globalSubscriberId = ""
154                                 }
155                                 execution.setVariable("DDVAM_globalSubscriberId", globalSubscriberId)
156                                 utils.log("DEBUG", "Incoming Global Subscriber Id is: " + globalSubscriberId, isDebugEnabled)
157                         }
158                         execution.setVariable("DDVAM_moduleCount", 0)
159                         execution.setVariable("DDVAM_nextModule", 0)
160                         
161                         
162                 }catch(BpmnError b){
163                         utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled)
164                         throw b
165                 }catch(Exception e){
166                         utils.log("DEBUG", " Error Occured in DoCreateVnfAndModules PreProcessRequest method!" + e.getMessage(), isDebugEnabled)
167                         exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DoCreateVnf PreProcessRequest")
168
169                 }
170                 utils.log("DEBUG", "*** COMPLETED DoDeleteVnfAndModules PreProcessRequest Process ***", isDebugEnabled)
171         }       
172
173         
174         
175         public void preProcessAddOnModule(Execution execution){
176                 def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled")
177                 execution.setVariable("prefix", Prefix)
178                 logDebug(" ======== STARTED preProcessAddOnModule ======== ", isDebugLogEnabled)
179                 
180                 try {                   
181                         JSONArray addOnModules = (JSONArray) execution.getVariable("addOnModules")
182                         int addOnIndex = (int) execution.getVariable("addOnModulesDeployed")
183                         
184                         JSONObject addOnModule = addOnModules[addOnIndex]
185                         
186                         def newVfModuleId = UUID.randomUUID().toString()
187                         execution.setVariable("addOnVfModuleId", newVfModuleId)
188                         
189                         execution.setVariable("instancesOfThisModelDeployed", 0)
190                         
191                         JSONObject addOnVfModuleModelInfoObject = jsonUtil.getJsonValueForKey(addOnModule, "modelInfo")
192                         String addOnVfModuleModelInfo = addOnVfModuleModelInfoObject.toString()
193                         execution.setVariable("addOnVfModuleModelInfo", addOnVfModuleModelInfo)
194                         String addOnVfModuleLabel = jsonUtil.getJsonValueForKey(addOnModule, "vfModuleLabel")
195                         execution.setVariable("addOnVfModuleLabel", addOnVfModuleLabel)
196                         String addOnPersonaModelId = jsonUtil.getJsonValueForKey(addOnVfModuleModelInfoObject, "modelInvariantUuid")
197                         execution.setVariable("addOnPersonaModelId", addOnPersonaModelId)
198                         String addOnInitialCount = jsonUtil.getJsonValueForKey(addOnModule, "initialCount")
199                         execution.setVariable("initialCount", addOnInitialCount)
200                                         
201                 
202                 }catch(Exception e){
203                         utils.log("ERROR", "Exception Occured Processing preProcessAddOnModule. Exception is:\n" + e, isDebugLogEnabled)
204                         exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessAddOnModule Method:\n" + e.getMessage())
205                 }
206                 logDebug("======== COMPLETED preProcessSDNCAssignRequest ======== ", isDebugLogEnabled)
207         }
208         
209         /**
210          * Using the received vnfId and vfModuleId, query AAI to get the corresponding VNF info.
211          * A 200 response is expected with the VNF info in the response body. Will find out the base module info.
212          *
213          * @param execution The flow's execution instance.
214          */
215         public void queryAAIVfModule(Execution execution) {
216                 def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled")
217                 def method = getClass().getSimpleName() + '.queryAAIVfModule(' +
218                         'execution=' + execution.getId() +
219                         ')'
220                 logDebug('Entered ' + method, isDebugLogEnabled)
221
222                 try {
223                         def vnfId = execution.getVariable('vnfId')
224                         
225                         AaiUtil aaiUriUtil = new AaiUtil(this)
226                         String  aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution)
227                         logDebug('AAI URI is: ' + aai_uri, isDebugLogEnabled)
228
229                         String endPoint = execution.getVariable("URN_aai_endpoint") + "${aai_uri}/" + UriUtils.encode(vnfId, "UTF-8") + "?depth=1"
230                         utils.logAudit("AAI endPoint: " + endPoint)
231
232                         try {
233                                 RESTConfig config = new RESTConfig(endPoint);
234                                 def responseData = ''
235                                 def aaiRequestId = UUID.randomUUID().toString()
236                                 RESTClient client = new RESTClient(config).
237                                         addHeader('X-TransactionId', aaiRequestId).
238                                         addHeader('X-FromAppId', 'MSO').
239                                         addHeader('Content-Type', 'application/xml').
240                                         addHeader('Accept','application/xml');
241                                 logDebug('sending GET to AAI endpoint \'' + endPoint + '\'', isDebugLogEnabled)
242                                 APIResponse response = client.httpGet()
243                                 utils.logAudit("createVfModule - invoking httpGet() to AAI")
244
245                                 responseData = response.getResponseBodyAsString()
246                                 if (responseData != null) {
247                                         logDebug("Received generic VNF data: " + responseData, isDebugLogEnabled)
248
249                                 }
250
251                                 utils.logAudit("createVfModule - queryAAIVfModule Response: " + responseData)
252                                 utils.logAudit("createVfModule - queryAAIVfModule ResponseCode: " + response.getStatusCode())
253
254                                 execution.setVariable('DCVFM_queryAAIVfModuleResponseCode', response.getStatusCode())
255                                 execution.setVariable('DCVFM_queryAAIVfModuleResponse', responseData)
256                                 logDebug('Response code:' + response.getStatusCode(), isDebugLogEnabled)
257                                 logDebug('Response:' + System.lineSeparator() + responseData, isDebugLogEnabled)
258                                 //Map<String, String>[] vfModules = new HashMap<String,String>[]
259                                 def vfModulesList = new ArrayList<Map<String,String>>()
260                                 def vfModules = null
261                                 def vfModuleBaseEntry = null
262                                 if (response.getStatusCode() == 200) {
263                                         // Parse the VNF record from A&AI to find base module info
264                                         logDebug('Parsing the VNF data to find base module info', isDebugLogEnabled)
265                                         if (responseData != null) {
266                                                 def vfModulesText = utils.getNodeXml(responseData, "vf-modules")
267                                                 logDebug("vModulesText: " + vfModulesText, isDebugLogEnabled)
268                                                 if (vfModulesText != null && !vfModulesText.trim().isEmpty()) {
269                                                         def xmlVfModules= new XmlSlurper().parseText(vfModulesText)
270                                                         vfModules = xmlVfModules.'**'.findAll {it.name() == "vf-module"}
271                                                         execution.setVariable("DDVAM_moduleCount", vfModules.size())
272                                                         int vfModulesSize = 0
273                                                         for (i in 0..vfModules.size()-1) {
274                                                                 def vfModuleXml = groovy.xml.XmlUtil.serialize(vfModules[i])
275                                                         
276                                                                 Map<String, String> vfModuleEntry = new HashMap<String, String>()
277                                                                 def vfModuleId = utils.getNodeText1(vfModuleXml, "vf-module-id")
278                                                                 vfModuleEntry.put("vfModuleId", vfModuleId)
279                                                                 def vfModuleName = utils.getNodeText1(vfModuleXml, "vf-module-name")
280                                                                 vfModuleEntry.put("vfModuleName", vfModuleName)
281                                                                 
282                                                                 def isBaseVfModule = utils.getNodeText(vfModuleXml, "is-base-vf-module")
283                                                                 // Save base vf module for last
284                                                                 if (isBaseVfModule == "true") {
285                                                                         vfModuleBaseEntry = vfModuleEntry
286                                                                 }
287                                                                 else {                                          
288                                                                         vfModulesList.add(vfModuleEntry)
289                                                                 }
290                                                         }
291                                                         if (vfModuleBaseEntry != null) {
292                                                                 vfModulesList.add(vfModuleBaseEntry)
293                                                         }                                       
294                                                 }
295                                                 
296                                         }                                       
297                                 }
298                                 execution.setVariable("DDVAM_vfModules", vfModulesList)
299                         } catch (Exception ex) {
300                                 ex.printStackTrace()
301                                 logDebug('Exception occurred while executing AAI GET:' + ex.getMessage(),isDebugLogEnabled)
302                                 exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'AAI GET Failed:' + ex.getMessage())
303                         }
304                         logDebug('Exited ' + method, isDebugLogEnabled)
305                 } catch (BpmnError e) {
306                         throw e;
307                 } catch (Exception e) {
308                         logError('Caught exception in ' + method, e)
309                         exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIVfModule(): ' + e.getMessage())
310                 }
311         }
312         
313         public void prepareNextModuleToDelete(Execution execution){
314                 def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled")
315                 execution.setVariable("prefix", Prefix)
316                 logDebug(" ======== STARTED prepareNextModuleToDelete ======== ", isDebugLogEnabled)
317                 
318                 try {
319                         int i = execution.getVariable("DDVAM_nextModule")
320                         def vfModules = execution.getVariable("DDVAM_vfModules")
321                         def vfModule = vfModules[i]
322                         
323                         def vfModuleId = vfModule.get("vfModuleId")
324                         execution.setVariable("DDVAM_vfModuleId", vfModuleId)
325                         
326                         def vfModuleName = vfModule.get("vfModuleName")
327                         execution.setVariable("DDVAM_vfModuleName", vfModuleName)
328                         
329                         
330                         // HARDCODED FOR NOW
331                         def vfModuleModelInfo = ""
332                         execution.setVariable("DDVAM_vfModuleModelInfo", vfModuleModelInfo)                     
333                         
334                 }catch(Exception e){
335                         utils.log("ERROR", "Exception Occured Processing preProcessAddOnModule. Exception is:\n" + e, isDebugLogEnabled)
336                         exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during prepareNextModuleToDelete Method:\n" + e.getMessage())
337                 }
338                 logDebug("======== COMPLETED prepareNextModuleToDelete ======== ", isDebugLogEnabled)
339         }
340         
341         public void preProcessSDNCDeactivateRequest(Execution execution){
342                 def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled")
343                 execution.setVariable("prefix", Prefix)
344                 logDebug(" ======== STARTED preProcessSDNCDeactivateRequest ======== ", isDebugLogEnabled)
345                 def vnfId = execution.getVariable("vnfId")
346                 def serviceInstanceId = execution.getVariable("serviceInstanceId")              
347
348                 try{
349                         //Build SDNC Request
350                         
351                         String deactivateSDNCRequest = buildSDNCRequest(execution, serviceInstanceId, "deactivate")
352
353                         deactivateSDNCRequest = utils.formatXml(deactivateSDNCRequest)
354                         execution.setVariable("DDVAM_deactivateSDNCRequest", deactivateSDNCRequest)
355                         logDebug("Outgoing DeactivateSDNCRequest is: \n" + deactivateSDNCRequest, isDebugLogEnabled)
356                         utils.logAudit("Outgoing DeactivateSDNCRequest is: \n" + deactivateSDNCRequest)
357
358                 }catch(Exception e){
359                         utils.log("ERROR", "Exception Occured Processing preProcessSDNCDeactivateRequest. Exception is:\n" + e, isDebugLogEnabled)
360                         exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessSDNCDeactivateRequest Method:\n" + e.getMessage())
361                 }
362                 logDebug("======== COMPLETED preProcessSDNCDeactivateRequest ======== ", isDebugLogEnabled)
363         }
364         
365         public void preProcessSDNCUnassignRequest(Execution execution) {
366                 def method = getClass().getSimpleName() + '.preProcessSDNCUnassignRequest(' +
367                         'execution=' + execution.getId() +
368                         ')'
369                 def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
370                 logDebug('Entered ' + method, isDebugLogEnabled)
371                 execution.setVariable("prefix", Prefix)
372                 logDebug(" ======== STARTED preProcessSDNCUnassignRequest Process ======== ", isDebugLogEnabled)
373                 try{
374                         String vnfId = execution.getVariable("vnfId")
375                         String serviceInstanceId = execution.getVariable("serviceInstanceId")
376
377                         String unassignSDNCRequest = buildSDNCRequest(execution, serviceInstanceId, "unassign")
378
379                         execution.setVariable("DDVAM_unassignSDNCRequest", unassignSDNCRequest)
380                         logDebug("Outgoing UnassignSDNCRequest is: \n" + unassignSDNCRequest, isDebugLogEnabled)
381                         utils.logAudit("Outgoing UnassignSDNCRequest is: \n"  + unassignSDNCRequest)
382
383                 }catch(Exception e){
384                         log.debug("Exception Occured Processing preProcessSDNCUnassignRequest. Exception is:\n" + e, isDebugLogEnabled)
385                         exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during  preProcessSDNCUnassignRequest Method:\n" + e.getMessage())
386                 }
387                 logDebug("======== COMPLETED  preProcessSDNCUnassignRequest Process ======== ", isDebugLogEnabled)
388         }
389         
390         public String buildSDNCRequest(Execution execution, String svcInstId, String action){
391                 
392                                 String uuid = execution.getVariable('testReqId') // for junits
393                                 if(uuid==null){
394                                         uuid = execution.getVariable("msoRequestId") + "-" +    System.currentTimeMillis()
395                                 }
396                                 def callbackURL = execution.getVariable("sdncCallbackUrl")
397                                 def requestId = execution.getVariable("msoRequestId")
398                                 def serviceId = execution.getVariable("DDVAM_serviceId")                                
399                                 def tenantId = execution.getVariable("DDVAM_tenantId")
400                                 def source = execution.getVariable("DDVAM_source")
401                                 def vnfId = execution.getVariable("vnfId")
402                                 def serviceInstanceId = execution.getVariable("serviceInstanceId")
403                                 def cloudSiteId = execution.getVariable("DDVAM_cloudSiteId")                            
404                                 def modelCustomizationId = execution.getVariable("DDVAM_modelCustomizationId")                          
405                                 //def serviceModelInfo = execution.getVariable("serviceModelInfo")
406                                 //def vnfModelInfo = execution.getVariable("vnfModelInfo")
407                                 //String serviceEcompModelInformation = sdncAdapterUtils.modelInfoToEcompModelInformation(serviceModelInfo)
408                                 //String vnfEcompModelInformation = sdncAdapterUtils.modelInfoToEcompModelInformation(vnfModelInfo)                             
409                                 def globalSubscriberId = execution.getVariable("DDVAM_globalSubscriberId")
410                                 def sdncVersion = execution.getVariable("DDVAM_sdncVersion")                                            
411                                 
412                                 String sdncRequest =
413                                 """<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.openecomp/mso/request/types/v1"
414                                                                                                         xmlns:sdncadapterworkflow="http://org.openecomp/mso/workflow/schema/v1"
415                                                                                                         xmlns:sdncadapter="http://org.openecomp/workflow/sdnc/adapter/schema/v1">
416            <sdncadapter:RequestHeader>
417                                 <sdncadapter:RequestId>${uuid}</sdncadapter:RequestId>
418                                 <sdncadapter:SvcInstanceId>${svcInstId}</sdncadapter:SvcInstanceId>
419                                 <sdncadapter:SvcAction>${action}</sdncadapter:SvcAction>
420                                 <sdncadapter:SvcOperation>vnf-topology-operation</sdncadapter:SvcOperation>
421                                 <sdncadapter:CallbackUrl>${callbackURL}</sdncadapter:CallbackUrl>
422                                 <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction>
423                 </sdncadapter:RequestHeader>
424         <sdncadapterworkflow:SDNCRequestData>
425                 <request-information>
426                         <request-id>${requestId}</request-id>
427                         <request-action>DeleteVnfInstance</request-action>
428                         <source>${source}</source>
429                         <notification-url/>
430                         <order-number/>
431                         <order-version/>
432                 </request-information>
433                 <service-information>
434                         <service-id/>
435                         <subscription-service-type/>                    
436                         <service-instance-id>${serviceInstanceId}</service-instance-id>
437                         <global-customer-id/>
438                 </service-information>
439                 <vnf-information>
440                         <vnf-id>${vnfId}</vnf-id>
441                         <vnf-type/>                     
442                 </vnf-information>
443                 <vnf-request-input>                     
444                         <vnf-name/>
445                         <tenant>${tenantId}</tenant>
446                         <aic-cloud-region>${cloudSiteId}</aic-cloud-region>                     
447                 </vnf-request-input>
448         </sdncadapterworkflow:SDNCRequestData>
449         </sdncadapterworkflow:SDNCAdapterWorkflowRequest>"""
450                 
451                         utils.logAudit("sdncRequest:  " + sdncRequest)
452                         return sdncRequest
453         }
454                 
455         public void validateSDNCResponse(Execution execution, String response, String method){
456                 def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled")
457                 execution.setVariable("prefix",Prefix)
458                 logDebug(" *** STARTED ValidateSDNCResponse Process*** ", isDebugLogEnabled)
459
460                 WorkflowException workflowException = execution.getVariable("WorkflowException")
461                 boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator")
462
463                 utils.logAudit("workflowException: " + workflowException)
464
465                 SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this)
466                 sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator)
467
468                 utils.logAudit("SDNCResponse: " + response)
469
470                 String sdncResponse = response
471                 if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){
472                         logDebug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call.  Response is: \n" + sdncResponse, isDebugLogEnabled)                 
473                 }else{
474                         logDebug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.", isDebugLogEnabled)
475                         throw new BpmnError("MSOWorkflowException")
476                 }
477                 logDebug(" *** COMPLETED ValidateSDNCResponse Process*** ", isDebugLogEnabled)
478         }
479         
480         
481         
482         
483         
484         
485         
486 }