55d56a6194b3d894909004267e86a5667dce4a25
[so.git] /
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  */\r
20 package org.openecomp.mso.bpmn.infrastructure.scripts
21 \r
22 import static org.apache.commons.lang3.StringUtils.*
23 import org.openecomp.mso.bpmn.core.RollbackData\r
24 import org.camunda.bpm.engine.delegate.BpmnError\r
25 import org.camunda.bpm.engine.runtime.Execution
26 import org.openecomp.mso.bpmn.common.scripts.AaiUtil
27 import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor
28 import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil
29 import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils
30 import org.openecomp.mso.bpmn.common.scripts.VidUtils
31 import org.openecomp.mso.bpmn.core.WorkflowException
32 import org.openecomp.mso.bpmn.core.json.JsonUtils
33 \r
34 \r
35 /**\r
36  * This class supports the DoCreateVnf building block subflow\r
37  * with the creation of a generic vnf for\r
38  * infrastructure.\r
39  *\r
40  */\r
41 class DoCreateVnf extends AbstractServiceTaskProcessor {\r
42 \r
43         String Prefix="DoCVNF_"\r
44         ExceptionUtil exceptionUtil = new ExceptionUtil()\r
45         JsonUtils jsonUtil = new JsonUtils()\r
46         VidUtils vidUtils = new VidUtils(this)\r
47         SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this)\r
48 \r
49         /**\r
50          * This method gets and validates the incoming\r
51          * request.\r
52          *\r
53          * @param - execution\r
54          *\r
55          */\r
56         public void preProcessRequest(Execution execution) {\r
57                 def isDebugEnabled = execution.getVariable("isDebugLogEnabled")\r
58                 execution.setVariable("prefix",Prefix)\r
59                 utils.log("DEBUG", " *** STARTED DoCreateVnf PreProcessRequest Process*** ", isDebugEnabled)\r
60         \r
61                 // DISABLE SDNC INTERACTION FOR NOW\r
62                 execution.setVariable("SDNCInteractionEnabled", false)\r
63                 \r
64                 \r
65                 /*******************/\r
66                 try{\r
67                         // Get Variables\r
68                         \r
69                         String cloudConfiguration = execution.getVariable("cloudConfiguration")\r
70                         String vnfModelInfo = execution.getVariable("vnfModelInfo")                     \r
71                         String serviceModelInfo = execution.getVariable("serviceModelInfo")\r
72                         \r
73                         String requestId = execution.getVariable("requestId")\r
74                         execution.setVariable("DoCVNF_requestId", requestId)\r
75                         execution.setVariable("mso-request-id", requestId)
76                         utils.log("DEBUG", "Incoming Request Id is: " + requestId, isDebugEnabled)\r
77 \r
78                         String serviceInstanceId = execution.getVariable("serviceInstanceId")\r
79                         execution.setVariable("DoCVNF_serviceInstanceId", serviceInstanceId)\r
80                         utils.log("DEBUG", "Incoming Service Instance Id is: " + serviceInstanceId, isDebugEnabled)\r
81 \r
82                         String vnfType = execution.getVariable("vnfType")\r
83                         execution.setVariable("DoCVNF_vnfType", vnfType)\r
84                         utils.log("DEBUG", "Incoming Vnf Type is: " + vnfType, isDebugEnabled)\r
85 \r
86                         String vnfName = execution.getVariable("vnfName")\r
87                         execution.setVariable("DoCVNF_vnfName", vnfName)\r
88                         utils.log("DEBUG", "Incoming Vnf Name is: " + vnfName, isDebugEnabled)\r
89 \r
90                         String serviceId = execution.getVariable("productFamilyId")\r
91                         execution.setVariable("DoCVNF_serviceId", serviceId)\r
92                         utils.log("DEBUG", "Incoming Service Id is: " + serviceId, isDebugEnabled)\r
93 \r
94                         String source = "VID"\r
95                         execution.setVariable("DoCVNF_source", source)\r
96                         utils.log("DEBUG", "Incoming Source is: " + source, isDebugEnabled)\r
97 \r
98                         String suppressRollback = execution.getVariable("disableRollback")\r
99                         execution.setVariable("DoCVNF_suppressRollback", suppressRollback)\r
100                         utils.log("DEBUG", "Incoming Suppress Rollback is: " + suppressRollback, isDebugEnabled)\r
101                         \r
102                         String modelInvariantId = jsonUtil.getJsonValue(vnfModelInfo, "modelInvariantId")\r
103                         execution.setVariable("DoCVNF_modelInvariantId", modelInvariantId)\r
104                         utils.log("DEBUG", "Incoming Invariant Id is: " + modelInvariantId, isDebugEnabled)\r
105                         \r
106                         String modelVersionId = jsonUtil.getJsonValue(vnfModelInfo, "modelVersionId")\r
107                         if (modelVersionId == null) {\r
108                                 modelVersionId = ""\r
109                         }\r
110                         execution.setVariable("DoCVNF_modelVersionId", modelVersionId)\r
111                         utils.log("DEBUG", "Incoming Version Id is: " + modelVersionId, isDebugEnabled)\r
112 \r
113                         String modelVersion = jsonUtil.getJsonValue(vnfModelInfo, "modelVersion")\r
114                         execution.setVariable("DoCVNF_modelVersion", modelVersion)\r
115                         utils.log("DEBUG", "Incoming Model Version is: " + modelVersion, isDebugEnabled)\r
116                         \r
117                         String modelName = jsonUtil.getJsonValue(vnfModelInfo, "modelName")\r
118                         execution.setVariable("DoCVNF_modelName", modelName)\r
119                         utils.log("DEBUG", "Incoming Model Name is: " + modelName, isDebugEnabled)\r
120                         \r
121                         String modelCustomizationId = jsonUtil.getJsonValue(vnfModelInfo, "modelCustomizationId")\r
122                         if (modelCustomizationId == null) {\r
123                                 modelCustomizationId = ""\r
124                         }\r
125                         execution.setVariable("DoCVNF_modelCustomizationId", modelCustomizationId)\r
126                         utils.log("DEBUG", "Incoming Model Customization Id is: " + modelCustomizationId, isDebugEnabled)\r
127                                 \r
128                         String cloudSiteId = jsonUtil.getJsonValue(cloudConfiguration, "lcpCloudRegionId")\r
129                         execution.setVariable("DoCVNF_cloudSiteId", cloudSiteId)\r
130                         utils.log("DEBUG", "Incoming Cloud Site Id is: " + cloudSiteId, isDebugEnabled)\r
131                                 \r
132                         String tenantId = jsonUtil.getJsonValue(cloudConfiguration, "tenantId")\r
133                         execution.setVariable("DoCVNF_tenantId", tenantId)\r
134                         utils.log("DEBUG", "Incoming Tenant Id is: " + tenantId, isDebugEnabled)                        \r
135                         \r
136                         String globalSubscriberId = execution.getVariable("globalSubscriberId")\r
137                         if (globalSubscriberId == null) {\r
138                                 globalSubscriberId = ""\r
139                         }\r
140                         execution.setVariable("DoCVNF_globalSubscriberId", globalSubscriberId)\r
141                         utils.log("DEBUG", "Incoming Global Subscriber Id is: " + globalSubscriberId, isDebugEnabled)\r
142                         \r
143                         String sdncVersion = execution.getVariable("sdncVersion")\r
144                         if (sdncVersion == null) {\r
145                                 sdncVersion = "1702"\r
146                         }\r
147                         execution.setVariable("DoCVNF_sdncVersion", sdncVersion)\r
148                         utils.log("DEBUG", "Incoming Sdnc Version is: " + sdncVersion, isDebugEnabled)\r
149 \r
150                         //For Completion Handler & Fallout Handler\r
151                         String requestInfo =\r
152                                 """<request-info xmlns="http://org.openecomp/mso/infra/vnf-request/v1">
153                                         <request-id>${requestId}</request-id>\r
154                                         <action>CREATE</action>\r
155                                         <source>${source}</source>\r
156                                    </request-info>"""\r
157 \r
158                         execution.setVariable("DoCVNF_requestInfo", requestInfo)\r
159                         //TODO: Orch Status - TBD, will come from SDN-C Response in 1702\r
160                         String orchStatus = "Created"\r
161                         execution.setVariable("DoCVNF_orchStatus", orchStatus)\r
162 \r
163                         //TODO: Equipment Role - Should come from SDN-C Response in 1702\r
164                         String equipmentRole = " "\r
165                         execution.setVariable("DoCVNF_equipmentRole", equipmentRole)\r
166                         String vnfId = execution.getVariable("testVnfId") // for junits\r
167                         if(isBlank(vnfId)){\r
168                                 vnfId = execution.getVariable("vnfId")\r
169                                 if (isBlank(vnfId)) {\r
170                                         vnfId = UUID.randomUUID().toString()\r
171                                         utils.log("DEBUG", "Generated Vnf Id is: " + vnfId, isDebugEnabled)\r
172                                 }\r
173                         }\r
174                         execution.setVariable("DoCVNF_vnfId", vnfId)\r
175 \r
176                         // Setting for Sub Flow Calls\r
177                         execution.setVariable("DoCVNF_type", "generic-vnf")\r
178                         execution.setVariable("GENGS_type", "service-instance")\r
179                                 \r
180                         String sdncCallbackUrl = (String) execution.getVariable('URN_mso_workflow_sdncadapter_callback')\r
181                         if (sdncCallbackUrl == null || sdncCallbackUrl.trim().isEmpty()) {\r
182                                 def msg = 'Required variable \'URN_mso_workflow_sdncadapter_callback\' is missing'\r
183                                 logError(msg)\r
184                                 exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)\r
185                         }\r
186                         execution.setVariable("DoCVNF_sdncCallbackUrl", sdncCallbackUrl)\r
187                         utils.logAudit("SDNC Callback URL: " + sdncCallbackUrl)\r
188                         logDebug("SDNC Callback URL is: " + sdncCallbackUrl, isDebugEnabled)\r
189                         \r
190                         def rollbackData = execution.getVariable("RollbackData")\r
191                         if (rollbackData == null) {\r
192                                 rollbackData = new RollbackData()\r
193                         }\r
194                         \r
195                         execution.setVariable("RollbackData", rollbackData)\r
196                         \r
197                 }catch(BpmnError b){\r
198                         utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled)\r
199                         throw b\r
200                 }catch(Exception e){\r
201                         utils.log("DEBUG", " Error Occured in DoCreateVnf PreProcessRequest method!" + e.getMessage(), isDebugEnabled)\r
202                         exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DoCreateVnf PreProcessRequest")\r
203 \r
204                 }\r
205                 utils.log("DEBUG", "*** COMPLETED DoCreateVnf PreProcessRequest Process ***", isDebugEnabled)\r
206         }\r
207 \r
208         \r
209         public void prepareCreateGenericVnf (Execution execution) {\r
210                 def isDebugEnabled=execution.getVariable("isDebugLogEnabled")\r
211                 execution.setVariable("prefix",Prefix)\r
212 \r
213                 utils.log("DEBUG", " *** STARTED DoCreateVnf PrepareCreateGenericVnf Process *** ", isDebugEnabled)\r
214                 try {\r
215                         //Get Vnf Info\r
216                         String vnfId = execution.getVariable("DoCVNF_vnfId")\r
217                         def vnfName = execution.getVariable("DoCVNF_vnfName")\r
218                         def vnfType = execution.getVariable("DoCVNF_vnfType")\r
219                         def serviceId = execution.getVariable("DoCVNF_serviceId")\r
220                         def orchStatus = execution.getVariable("DoCVNF_orchStatus")\r
221                         def modelInvariantId = execution.getVariable("DoCVNF_modelInvariantId")\r
222                         def modelVersion = execution.getVariable("DoCVNF_modelVersion")\r
223                         def modelCustomizationId = execution.getVariable("DoCVNF_modelCustomizationId")\r
224                         // TODO: 1702 Variable\r
225                         def equipmentRole = execution.getVariable("DoCVNF_equipmentRole")\r
226 \r
227                         //Get Service Instance Info\r
228                         def serviceInstanceId = execution.getVariable("DoCVNF_serviceInstanceId")\r
229                         String siRelatedLink = execution.getVariable("GENGS_siResourceLink")\r
230 \r
231                         int custStart = siRelatedLink.indexOf("customer/")\r
232                         int custEnd = siRelatedLink.indexOf("/service-subscriptions")\r
233                         String globalCustId = siRelatedLink.substring(custStart + 9, custEnd)\r
234                         int serviceStart = siRelatedLink.indexOf("service-subscription/")\r
235                         int serviceEnd = siRelatedLink.indexOf("/service-instances/")\r
236                         String serviceType = siRelatedLink.substring(serviceStart + 21, serviceEnd)\r
237 \r
238                         //Get Namespace\r
239                         AaiUtil aaiUtil = new AaiUtil(this)\r
240                         def aai_uri = aaiUtil.getNetworkGenericVnfUri(execution)\r
241                         String namespace = aaiUtil.getNamespaceFromUri(aai_uri)\r
242 \r
243                         String payload =\r
244                                         """<generic-vnf xmlns="${namespace}">\r
245                                 <vnf-id>${vnfId}</vnf-id>\r
246                                 <vnf-name>${vnfName}</vnf-name>\r
247                                 <service-id>${serviceId}</service-id>\r
248                                 <vnf-type>${vnfType}</vnf-type>\r
249                                 <prov-status>PREPROV</prov-status>\r
250                                 <orchestration-status>${orchStatus}</orchestration-status>\r
251                                 <persona-model-id>${modelInvariantId}</persona-model-id>\r
252                                 <persona-model-version>${modelVersion}</persona-model-version>\r
253                                 <persona-model-customization-id>${modelCustomizationId}</persona-model-customization-id>\r
254                                 <relationship-list>\r
255                                         <relationship>\r
256                         <related-to>service-instance</related-to>\r
257                         <related-link>${siRelatedLink}</related-link>\r
258                         <relationship-data>\r
259                                 <relationship-key>customer.global-customer-id</relationship-key>\r
260                                 <relationship-value>${globalCustId}</relationship-value>\r
261                         </relationship-data>\r
262                         <relationship-data>\r
263                                 <relationship-key>service-subscription.service-type</relationship-key>\r
264                                 <relationship-value>${serviceType}</relationship-value>\r
265                         </relationship-data>\r
266                                         <relationship-data>\r
267                                 <relationship-key>service-instance.service-instance-id</relationship-key>\r
268                                 <relationship-value>${serviceInstanceId}</relationship-value>\r
269                         </relationship-data>\r
270                         </relationship>\r
271                                 </relationship-list>\r
272                         </generic-vnf>"""\r
273 \r
274                         execution.setVariable("DoCVNF_genericVnfPayload", payload)\r
275 \r
276                 }catch(Exception ex) {\r
277                         utils.log("DEBUG", "Error Occured in DoCreateVnf PrepareCreateGenericVnf Process " + ex.getMessage(), isDebugEnabled)\r
278                         exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DoCreateVnf PrepareCreateGenericVnf Process")\r
279                 }\r
280                 utils.log("DEBUG", "*** COMPLETED DoCreateVnf PrepareCreateGenericVnf Process ***", isDebugEnabled)\r
281         }\r
282         \r
283         public void postProcessCreateGenericVnf (Execution execution) {\r
284                 def isDebugEnabled=execution.getVariable("isDebugLogEnabled")\r
285                 execution.setVariable("prefix",Prefix)\r
286 \r
287                 utils.log("DEBUG", " *** STARTED DoCreateVnf PostProcessCreateGenericVnf Process *** ", isDebugEnabled)\r
288                 try {\r
289                         //Get Vnf Info\r
290                         String vnfId = execution.getVariable("DoCVNF_vnfId")\r
291                         def rollbackData = execution.getVariable("RollbackData")\r
292                         rollbackData.put("VNF", "vnfId", vnfId)\r
293                         execution.setVariable("RollbackData", rollbackData)\r
294                 }catch(Exception ex) {\r
295                         utils.log("DEBUG", "Error Occured in DoCreateVnf PostProcessCreateGenericVnf Process " + ex.getMessage(), isDebugEnabled)\r
296                         exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DoCreateVnf PostProcessCreateGenericVnf Process")\r
297                 }\r
298                 utils.log("DEBUG", "*** COMPLETED DoCreateVnf PostProcessCreateGenericVnf Process ***", isDebugEnabled)\r
299         }\r
300         \r
301         \r
302         public void preProcessSDNCAssignRequest(Execution execution){\r
303                 def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled")\r
304                 execution.setVariable("prefix", Prefix)\r
305                 logDebug(" ======== STARTED preProcessSDNCAssignRequest ======== ", isDebugLogEnabled)\r
306                 def vnfId = execution.getVariable("DoCVNF_vnfId")\r
307                 def serviceInstanceId = execution.getVariable("DoCVNF_serviceInstanceId")\r
308                 logDebug("NEW VNF ID: " + vnfId, isDebugLogEnabled)\r
309                 utils.logAudit("NEW VNF ID: " + vnfId)\r
310 \r
311                 try{\r
312                         //Build SDNC Request\r
313                         \r
314                         String assignSDNCRequest = buildSDNCRequest(execution, serviceInstanceId, "assign")\r
315 \r
316                         assignSDNCRequest = utils.formatXml(assignSDNCRequest)\r
317                         execution.setVariable("DoCVNF_assignSDNCRequest", assignSDNCRequest)\r
318                         logDebug("Outgoing AssignSDNCRequest is: \n" + assignSDNCRequest, isDebugLogEnabled)\r
319                         utils.logAudit("Outgoing AssignSDNCRequest is: \n" + assignSDNCRequest)\r
320 \r
321                 }catch(Exception e){\r
322                         utils.log("ERROR", "Exception Occured Processing preProcessSDNCAssignRequest. Exception is:\n" + e, isDebugLogEnabled)\r
323                         exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessSDNCAssignRequest Method:\n" + e.getMessage())\r
324                 }\r
325                 logDebug("======== COMPLETED preProcessSDNCAssignRequest ======== ", isDebugLogEnabled)\r
326         }\r
327         \r
328         public void preProcessSDNCActivateRequest(Execution execution) {\r
329                 def method = getClass().getSimpleName() + '.preProcessSDNCActivateRequest(' +\r
330                         'execution=' + execution.getId() +\r
331                         ')'\r
332                 def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')\r
333                 logDebug('Entered ' + method, isDebugLogEnabled)\r
334                 execution.setVariable("prefix", Prefix)\r
335                 logDebug(" ======== STARTED preProcessSDNCActivateRequest Process ======== ", isDebugLogEnabled)\r
336                 try{\r
337                         String vnfId = execution.getVariable("DoCVNF_vnfId")\r
338                         String serviceInstanceId = execution.getVariable("DoCVNF_serviceInstanceId")\r
339 \r
340                         String activateSDNCRequest = buildSDNCRequest(execution, serviceInstanceId, "activate")\r
341 \r
342                         execution.setVariable("DoCVNF_activateSDNCRequest", activateSDNCRequest)\r
343                         logDebug("Outgoing CommitSDNCRequest is: \n" + activateSDNCRequest, isDebugLogEnabled)\r
344                         utils.logAudit("Outgoing CommitSDNCRequest is: \n"  + activateSDNCRequest)\r
345 \r
346                 }catch(Exception e){\r
347                         log.debug("Exception Occured Processing preProcessSDNCActivateRequest. Exception is:\n" + e, isDebugLogEnabled)\r
348                         exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during  preProcessSDNCActivateRequest Method:\n" + e.getMessage())\r
349                 }\r
350                 logDebug("======== COMPLETED  preProcessSDNCActivateRequest Process ======== ", isDebugLogEnabled)\r
351         }\r
352         \r
353         public String buildSDNCRequest(Execution execution, String svcInstId, String action){\r
354                 \r
355                                 String uuid = execution.getVariable('testReqId') // for junits\r
356                                 if(uuid==null){\r
357                                         uuid = execution.getVariable("mso-request-id") + "-" +          System.currentTimeMillis()
358                                 }\r
359                                 def callbackURL = execution.getVariable("DoCVNF_sdncCallbackUrl")\r
360                                 def requestId = execution.getVariable("DoCVNF_requestId")\r
361                                 def serviceId = execution.getVariable("DoCVNF_serviceId")\r
362                                 def vnfType = execution.getVariable("DoCVNF_vnfType")\r
363                                 def vnfName = execution.getVariable("DoCVNF_vnfName")\r
364                                 def tenantId = execution.getVariable("DoCVNF_tenantId")\r
365                                 def source = execution.getVariable("DoCVNF_source")\r
366                                 def vnfId = execution.getVariable("DoCVNF_vnfId")\r
367                                 def cloudSiteId = execution.getVariable("DoCVNF_cloudSiteId")                           \r
368                                 def modelCustomizationId = execution.getVariable("DoCVNF_modelCustomizationId")\r
369                                 def serviceModelInfo = execution.getVariable("serviceModelInfo")\r
370                                 def vnfModelInfo = execution.getVariable("vnfModelInfo")\r
371                                 String serviceEcompModelInformation = sdncAdapterUtils.modelInfoToEcompModelInformation(serviceModelInfo)\r
372                                 String vnfEcompModelInformation = sdncAdapterUtils.modelInfoToEcompModelInformation(vnfModelInfo)                               \r
373                                 def globalSubscriberId = execution.getVariable("DoCVNF_globalSubscriberId")\r
374                                 def sdncVersion = execution.getVariable("DoCVNF_sdncVersion")\r
375                                                 \r
376                                 String sdncVNFParamsXml = ""\r
377                 \r
378                                 if(execution.getVariable("DoCVNF_vnfParamsExistFlag") == true){\r
379                                         sdncVNFParamsXml = buildSDNCParamsXml(execution)\r
380                                 }else{\r
381                                         sdncVNFParamsXml = ""\r
382                                 }\r
383                 \r
384                                 String sdncRequest =\r
385                                 """<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.openecomp/mso/request/types/v1"
386                                                                                                         xmlns:sdncadapterworkflow="http://org.openecomp/mso/workflow/schema/v1"
387                                                                                                         xmlns:sdncadapter="http://org.openecomp/workflow/sdnc/adapter/schema/v1">
388            <sdncadapter:RequestHeader>\r
389                                 <sdncadapter:RequestId>${requestId}</sdncadapter:RequestId>\r
390                                 <sdncadapter:SvcInstanceId>${svcInstId}</sdncadapter:SvcInstanceId>\r
391                                 <sdncadapter:SvcAction>${action}</sdncadapter:SvcAction>\r
392                                 <sdncadapter:SvcOperation>vnf-topology-operation</sdncadapter:SvcOperation>\r
393                                 <sdncadapter:CallbackUrl>${callbackURL}</sdncadapter:CallbackUrl>\r
394                                 <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction>\r
395                 </sdncadapter:RequestHeader>\r
396         <sdncadapterworkflow:SDNCRequestData>\r
397                 <request-information>\r
398                         <request-id>${requestId}</request-id>\r
399                         <request-action>CreateVnfInstance</request-action>\r
400                         <source>${source}</source>\r
401                         <notification-url/>\r
402                         <order-number/>\r
403                         <order-version/>\r
404                 </request-information>\r
405                 <service-information>\r
406                         <service-id>${serviceId}</service-id>\r
407                         <subscription-service-type>${serviceId}</subscription-service-type>\r
408                         ${serviceEcompModelInformation}                 \r
409                         <service-instance-id>${svcInstId}</service-instance-id>\r
410                         <global-customer-id>${globalSubscriberId}</global-customer-id>                  \r
411                 </service-information>\r
412                 <vnf-information>\r
413                         <vnf-id>${vnfId}</vnf-id>\r
414                         <vnf-type>${vnfType}</vnf-type>\r
415                         ${vnfEcompModelInformation}                     \r
416                 </vnf-information>\r
417                 <vnf-request-input>\r
418                         <request-version>${sdncVersion}</request-version>\r
419                         <vnf-name></vnf-name>\r
420                         <tenant>${tenantId}</tenant>            \r
421                         <aic-cloud-region>${cloudSiteId}</aic-cloud-region>                     \r
422                         ${sdncVNFParamsXml}\r
423                 </vnf-request-input>\r
424         </sdncadapterworkflow:SDNCRequestData>\r
425         </sdncadapterworkflow:SDNCAdapterWorkflowRequest>"""\r
426                 \r
427                         utils.logAudit("sdncRequest:  " + sdncRequest)\r
428                         return sdncRequest\r
429         }\r
430                 \r
431         public void validateSDNCResponse(Execution execution, String response, String method){\r
432                 def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled")\r
433                 execution.setVariable("prefix",Prefix)\r
434                 logDebug(" *** STARTED ValidateSDNCResponse Process*** ", isDebugLogEnabled)\r
435 \r
436                 WorkflowException workflowException = execution.getVariable("WorkflowException")\r
437                 boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator")\r
438 \r
439                 utils.logAudit("workflowException: " + workflowException)\r
440 \r
441                 SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this)\r
442                 sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator)\r
443 \r
444                 utils.logAudit("SDNCResponse: " + response)\r
445 \r
446                 String sdncResponse = response\r
447                 if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){\r
448                         logDebug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call.  Response is: \n" + sdncResponse, isDebugLogEnabled)\r
449                         \r
450                 }else{\r
451                         logDebug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.", isDebugLogEnabled)\r
452                         throw new BpmnError("MSOWorkflowException")\r
453                 }\r
454                 logDebug(" *** COMPLETED ValidateSDNCResponse Process*** ", isDebugLogEnabled)\r
455         }\r
456 \r
457         \r
458 }\r