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