2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.openecomp.mso.bpmn.infrastructure.scripts
23 import java.util.UUID;
25 import org.camunda.bpm.engine.delegate.BpmnError
26 import org.camunda.bpm.engine.delegate.DelegateExecution;
28 import static org.apache.commons.lang3.StringUtils.*;
29 import org.openecomp.mso.bpmn.common.scripts.CatalogDbUtils;
30 import org.json.JSONObject;
31 import org.json.JSONArray;
33 import org.openecomp.mso.bpmn.common.scripts.AaiUtil;
34 import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor;
35 import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil;
36 import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils;
37 import org.openecomp.mso.bpmn.common.scripts.VidUtils;
38 import org.openecomp.mso.bpmn.core.WorkflowException
39 import org.openecomp.mso.bpmn.core.domain.VnfResource
40 import org.openecomp.mso.bpmn.core.json.JsonUtils;
41 import org.openecomp.mso.bpmn.infrastructure.aai.AAICreateResources;
45 * This class supports the CreateVnfInfra Flow
46 * with the creation of a generic vnf for
49 class CreateVnfInfra extends AbstractServiceTaskProcessor {
51 String Prefix="CREVI_"
52 ExceptionUtil exceptionUtil = new ExceptionUtil()
53 JsonUtils jsonUtil = new JsonUtils()
54 VidUtils vidUtils = new VidUtils(this)
55 CatalogDbUtils cutils = new CatalogDbUtils()
56 AAICreateResources aaiCR = new AAICreateResources()
59 * This method gets and validates the incoming
65 public void preProcessRequest(DelegateExecution execution) {
66 def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
67 execution.setVariable("prefix",Prefix)
68 utils.log("DEBUG", " *** STARTED CreateVnfInfra PreProcessRequest Process*** ", isDebugEnabled)
70 setBasicDBAuthHeader(execution, isDebugEnabled)
71 execution.setVariable("CREVI_sentSyncResponse", false)
75 String createVnfRequest = execution.getVariable("bpmnRequest")
76 execution.setVariable("CREVI_createVnfRequest", createVnfRequest)
77 utils.logAudit("Incoming CreateVnfInfra Request is: \n" + createVnfRequest)
79 if(createVnfRequest != null){
81 String requestId = execution.getVariable("mso-request-id")
82 execution.setVariable("CREVI_requestId", requestId)
83 utils.log("DEBUG", "Incoming Request Id is: " + requestId, isDebugEnabled)
85 String serviceInstanceId = execution.getVariable("serviceInstanceId")
86 execution.setVariable("CREVI_serviceInstanceId", serviceInstanceId)
87 utils.log("DEBUG", "Incoming Service Instance Id is: " + serviceInstanceId, isDebugEnabled)
89 String vnfType = execution.getVariable("vnfType")
90 execution.setVariable("CREVI_vnfType", vnfType)
91 utils.log("DEBUG", "Incoming Vnf Type is: " + vnfType, isDebugEnabled)
93 String vnfName = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.requestInfo.instanceName")
94 execution.setVariable("CREVI_vnfName", vnfName)
95 utils.log("DEBUG", "Incoming Vnf Name is: " + vnfName, isDebugEnabled)
97 String serviceId = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.requestInfo.productFamilyId")
98 execution.setVariable("CREVI_serviceId", serviceId)
99 utils.log("DEBUG", "Incoming Service Id is: " + serviceId, isDebugEnabled)
101 String source = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.requestInfo.source")
102 execution.setVariable("CREVI_source", source)
103 utils.log("DEBUG", "Incoming Source is: " + source, isDebugEnabled)
105 String suppressRollback = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.requestInfo.suppressRollback")
106 execution.setVariable("CREVI_suppressRollback", suppressRollback)
107 utils.log("DEBUG", "Incoming Suppress Rollback is: " + suppressRollback, isDebugEnabled)
109 def vnfModelInfo = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.modelInfo")
110 execution.setVariable("CREVI_vnfModelInfo", vnfModelInfo)
112 String modelInvariantId = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.modelInfo.modelInvariantUuid")
113 execution.setVariable("CREVI_modelInvariantId", modelInvariantId)
114 utils.log("DEBUG", "Incoming Invariant Id is: " + modelInvariantId, isDebugEnabled)
116 String modelVersion = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.modelInfo.modelVersion")
117 execution.setVariable("CREVI_modelVersion", modelVersion)
118 utils.log("DEBUG", "Incoming Model Version is: " + modelVersion, isDebugEnabled)
120 def cloudConfiguration = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.cloudConfiguration")
121 execution.setVariable("CREVI_cloudConfiguration", cloudConfiguration)
123 String cloudSiteId = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.cloudConfiguration.lcpCloudRegionId")
124 execution.setVariable("CREVI_cloudSiteId", cloudSiteId)
125 utils.log("DEBUG", "Incoming Cloud Site Id is: " + cloudSiteId, isDebugEnabled)
127 String tenantId = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.cloudConfiguration.tenantId")
128 execution.setVariable("CREVI_tenantId", tenantId)
129 utils.log("DEBUG", "Incoming Tenant Id is: " + tenantId, isDebugEnabled)
131 //For Completion Handler & Fallout Handler
133 """<request-info xmlns="http://org.openecomp/mso/infra/vnf-request/v1">
134 <request-id>${requestId}</request-id>
135 <action>CREATE</action>
136 <source>${source}</source>
139 execution.setVariable("CREVI_requestInfo", requestInfo)
141 //TODO: Orch Status - TBD, will come from SDN-C Response in 1702
142 String orchStatus = "Created"
143 execution.setVariable("CREVI_orchStatus", orchStatus)
145 //TODO: Equipment Role - Should come from SDN-C Response in 1702
146 String equipmentRole = " "
147 execution.setVariable("CREVI_equipmentRole", equipmentRole)
149 String vnfId = execution.getVariable("testVnfId") // for junits
151 vnfId = UUID.randomUUID().toString()
152 utils.log("DEBUG", "Generated Vnf Id is: " + vnfId, isDebugEnabled)
154 execution.setVariable("CREVI_vnfId", vnfId)
156 // Setting for Sub Flow Calls
157 execution.setVariable("CREVI_type", "generic-vnf")
158 execution.setVariable("GENGS_type", "service-instance")
160 String sdncCallbackUrl = (String) execution.getVariable('URN_mso_workflow_sdncadapter_callback')
161 if (sdncCallbackUrl == null || sdncCallbackUrl.trim().isEmpty()) {
162 def msg = 'Required variable \'URN_mso_workflow_sdncadapter_callback\' is missing'
164 exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
166 execution.setVariable("CREVI_sdncCallbackUrl", sdncCallbackUrl)
168 def vnfInputParameters = null
170 vnfInputParameters = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.requestParameters.userParams")
172 catch (Exception e) {
173 utils.log("DEBUG", "userParams are not present in the request", isDebugEnabled)
175 execution.setVariable("CREVI_vnfInputParameters", vnfInputParameters)
178 utils.logAudit("SDNC Callback URL: " + sdncCallbackUrl)
179 logDebug("SDNC Callback URL is: " + sdncCallbackUrl, isDebugEnabled)
182 exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Bpmn Request is Null.")
186 utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled)
189 utils.log("DEBUG", " Error Occured in CreateVnfInfra PreProcessRequest method!" + e.getMessage(), isDebugEnabled)
190 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in CreateVnfInfra PreProcessRequest")
193 utils.log("DEBUG", "*** COMPLETED CreateVnfInfra PreProcessRequest Process ***", isDebugEnabled)
196 public void sendSyncResponse (DelegateExecution execution) {
197 def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
198 execution.setVariable("prefix",Prefix)
200 utils.log("DEBUG", " *** STARTED CreateVnfInfra SendSyncResponse Process *** ", isDebugEnabled)
203 String requestId = execution.getVariable("CREVI_requestId")
204 String vnfId = execution.getVariable("CREVI_vnfId")
206 String createVnfResponse = """{"requestReferences":{"instanceId":"${vnfId}","requestId":"${requestId}"}}""".trim()
208 utils.log("DEBUG", " CreateVnfInfra Sync Response is: \n" + createVnfResponse, isDebugEnabled)
210 sendWorkflowResponse(execution, 202, createVnfResponse)
212 execution.setVariable("CREVI_sentSyncResponse", true)
214 } catch (Exception ex) {
215 utils.log("DEBUG", "Error Occured in CreateVnfInfra SendSyncResponse Process " + ex.getMessage(), isDebugEnabled)
216 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in CreateVnfInfra SendSyncResponse Process")
219 utils.log("DEBUG", "*** COMPLETED CreateVnfInfra SendSyncResponse Process ***", isDebugEnabled)
223 public void preProcessSDNCAssignRequest(DelegateExecution execution){
224 def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled")
225 execution.setVariable("prefix", Prefix)
226 logDebug(" ======== STARTED preProcessSDNCAssignRequest ======== ", isDebugLogEnabled)
227 def vnfId = execution.getVariable("CREVI_vnfId")
228 def serviceInstanceId = execution.getVariable("CREVI_serviceInstanceId")
229 logDebug("NEW VNF ID: " + vnfId, isDebugLogEnabled)
230 utils.logAudit("NEW VNF ID: " + vnfId)
235 String assignSDNCRequest = buildSDNCRequest(execution, serviceInstanceId, "assign")
237 assignSDNCRequest = utils.formatXml(assignSDNCRequest)
238 execution.setVariable("CREVI_assignSDNCRequest", assignSDNCRequest)
239 logDebug("Outgoing AssignSDNCRequest is: \n" + assignSDNCRequest, isDebugLogEnabled)
240 utils.logAudit("Outgoing AssignSDNCRequest is: \n" + assignSDNCRequest)
243 utils.log("ERROR", "Exception Occured Processing preProcessSDNCAssignRequest. Exception is:\n" + e, isDebugLogEnabled)
244 exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during prepareProvision Method:\n" + e.getMessage())
246 logDebug("======== COMPLETED preProcessSDNCAssignRequest ======== ", isDebugLogEnabled)
249 public void preProcessSDNCActivateRequest(DelegateExecution execution) {
250 def method = getClass().getSimpleName() + '.preProcessSDNCActivateRequest(' +
251 'execution=' + execution.getId() +
253 def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
254 logDebug('Entered ' + method, isDebugLogEnabled)
255 execution.setVariable("prefix", Prefix)
256 logDebug(" ======== STARTED preProcessSDNCActivateRequest Process ======== ", isDebugLogEnabled)
258 String vnfId = execution.getVariable("CREVI_vnfId")
259 String serviceInstanceId = execution.getVariable("CREVI_serviceInstanceId")
261 String activateSDNCRequest = buildSDNCRequest(execution, serviceInstanceId, "activate")
263 execution.setVariable("CREVI_activateSDNCRequest", activateSDNCRequest)
264 logDebug("Outgoing CommitSDNCRequest is: \n" + activateSDNCRequest, isDebugLogEnabled)
265 utils.logAudit("Outgoing CommitSDNCRequest is: \n" + activateSDNCRequest)
268 log.debug("Exception Occured Processing preProcessSDNCActivateRequest. Exception is:\n" + e, isDebugLogEnabled)
269 exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessSDNCActivateRequest Method:\n" + e.getMessage())
271 logDebug("======== COMPLETED preProcessSDNCActivateRequest Process ======== ", isDebugLogEnabled)
274 public String buildSDNCRequest(DelegateExecution execution, String svcInstId, String action){
276 String uuid = execution.getVariable('testReqId') // for junits
278 uuid = execution.getVariable("mso-request-id") + "-" + System.currentTimeMillis()
280 def callbackURL = execution.getVariable("CREVI_sdncCallbackUrl")
281 def requestId = execution.getVariable("CREVI_requestId")
282 def serviceId = execution.getVariable("CREVI_serviceId")
283 def vnfType = execution.getVariable("CREVI_vnfType")
284 def vnfName = execution.getVariable("CREVI_vnfName")
285 def tenantId = execution.getVariable("CREVI_tenantId")
286 def source = execution.getVariable("CREVI_source")
287 def vnfId = execution.getVariable("CREVI_vnfId")
288 def cloudSiteId = execution.getVariable("CREVI_cloudSiteId")
290 String sdncVNFParamsXml = ""
292 if(execution.getVariable("CREVI_vnfParamsExistFlag") == true){
293 sdncVNFParamsXml = buildSDNCParamsXml(execution)
295 sdncVNFParamsXml = ""
299 """<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.openecomp/mso/request/types/v1"
300 xmlns:sdncadapterworkflow="http://org.openecomp/mso/workflow/schema/v1"
301 xmlns:sdncadapter="http://org.openecomp/workflow/sdnc/adapter/schema/v1">
302 <sdncadapter:RequestHeader>
303 <sdncadapter:RequestId>${requestId}</sdncadapter:RequestId>
304 <sdncadapter:SvcInstanceId>${svcInstId}</sdncadapter:SvcInstanceId>
305 <sdncadapter:SvcAction>${action}</sdncadapter:SvcAction>
306 <sdncadapter:SvcOperation>vnf-topology-operation</sdncadapter:SvcOperation>
307 <sdncadapter:CallbackUrl>${callbackURL}</sdncadapter:CallbackUrl>
308 </sdncadapter:RequestHeader>
309 <sdncadapterworkflow:SDNCRequestData>
310 <request-information>
311 <request-id>${requestId}</request-id>
312 <request-action>VNFActivateRequest</request-action>
313 <source>${source}</source>
315 </request-information>
316 <service-information>
317 <service-id>${serviceId}</service-id>
318 <service-type>${serviceId}</service-type>
319 <service-instance-id>${svcInstId}</service-instance-id>
320 <subscriber-name>notsurewecare</subscriber-name>
321 </service-information>
322 <vnf-request-information>
323 <vnf-id>${vnfId}</vnf-id>
324 <vnf-name>${vnfName}</vnf-name>
325 <vnf-type>${vnfType}</vnf-type>
326 <aic-cloud-region>${cloudSiteId}</aic-cloud-region>
327 <tenant>${tenantId}</tenant>
329 </vnf-request-information>
330 </sdncadapterworkflow:SDNCRequestData>
331 </sdncadapterworkflow:SDNCAdapterWorkflowRequest>"""
333 utils.logAudit("sdncRequest: " + sdncRequest)
337 public void validateSDNCResponse(DelegateExecution execution, String response, String method){
338 def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled")
339 execution.setVariable("prefix",Prefix)
340 logDebug(" *** STARTED ValidateSDNCResponse Process*** ", isDebugLogEnabled)
342 WorkflowException workflowException = execution.getVariable("WorkflowException")
343 boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator")
345 utils.logAudit("workflowException: " + workflowException)
347 SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this)
348 sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator)
350 utils.logAudit("SDNCResponse: " + response)
352 String sdncResponse = response
353 if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){
354 logDebug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + sdncResponse, isDebugLogEnabled)
357 logDebug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.", isDebugLogEnabled)
358 throw new BpmnError("MSOWorkflowException")
360 logDebug(" *** COMPLETED ValidateSDNCResponse Process*** ", isDebugLogEnabled)
363 public void prepareCompletionHandlerRequest(DelegateExecution execution){
364 def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
365 execution.setVariable("prefix",Prefix)
367 utils.log("DEBUG", " *** STARTED CreateVnfInfra PrepareCompletionHandlerRequest Process *** ", isDebugEnabled)
370 String requestInfo = execution.getVariable("CREVI_requestInfo")
371 String vnfId = execution.getVariable("CREVI_vnfId")
372 requestInfo = utils.removeXmlPreamble(requestInfo)
375 """<aetgt:MsoCompletionRequest xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1"
376 xmlns:ns="http://org.openecomp/mso/request/types/v1">
378 <status-message>Vnf has been created successfully.</status-message>
379 <vnfId>${vnfId}</vnfId>
380 <mso-bpel-name>CreateVnfInfra</mso-bpel-name>
381 </aetgt:MsoCompletionRequest>"""
383 execution.setVariable("CREVI_completionHandlerRequest", request)
384 utils.log("DEBUG", "Completion Handler Request is: " + request, isDebugEnabled)
386 execution.setVariable("WorkflowResponse", "Success") // for junits
388 } catch (Exception ex) {
389 utils.log("DEBUG", "Error Occured in CreateVnfInfra PrepareCompletionHandlerRequest Process " + ex.getMessage(), isDebugEnabled)
390 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in CreateVnfInfra PrepareCompletionHandlerRequest Process")
393 utils.log("DEBUG", "*** COMPLETED CreateVnfInfra PrepareCompletionHandlerRequest Process ***", isDebugEnabled)
396 public void sendErrorResponse(DelegateExecution execution){
397 def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
398 execution.setVariable("prefix",Prefix)
400 utils.log("DEBUG", " *** STARTED CreateVnfInfra sendErrorResponse Process *** ", isDebugEnabled)
402 def sentSyncResponse = execution.getVariable("CREVI_sentSyncResponse")
403 if(sentSyncResponse == false){
404 WorkflowException wfex = execution.getVariable("WorkflowException")
405 String response = exceptionUtil.buildErrorResponseXml(wfex)
407 utils.logAudit(response)
408 sendWorkflowResponse(execution, 500, response)
410 utils.log("DEBUG", "Not Sending Error Response. Sync Response Already Sent", isDebugEnabled)
413 } catch (Exception ex) {
414 utils.log("DEBUG", "Error Occured in CreateVnfInfra sendErrorResponse Process " + ex.getMessage(), isDebugEnabled)
415 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in CreateVnfInfra sendErrorResponse Process")
418 utils.log("DEBUG", "*** COMPLETED CreateVnfInfra sendErrorResponse Process ***", isDebugEnabled)
421 public void prepareFalloutRequest(DelegateExecution execution){
422 def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
423 execution.setVariable("prefix",Prefix)
425 utils.log("DEBUG", " *** STARTED CreateVnfInfra prepareFalloutRequest Process *** ", isDebugEnabled)
428 WorkflowException wfex = execution.getVariable("WorkflowException")
429 utils.log("DEBUG", " Incoming Workflow Exception: " + wfex.toString(), isDebugEnabled)
430 String requestInfo = execution.getVariable("CREVI_requestInfo")
431 utils.log("DEBUG", " Incoming Request Info: " + requestInfo, isDebugEnabled)
433 String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo)
435 execution.setVariable("CREVI_falloutRequest", falloutRequest)
438 } catch (Exception ex) {
439 utils.log("DEBUG", "Error Occured in CreateVnfInfra prepareFalloutRequest Process " + ex.getMessage(), isDebugEnabled)
440 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in CreateVnfInfra prepareFalloutRequest Process")
443 utils.log("DEBUG", "*** COMPLETED CreateVnfInfra prepareFalloutRequest Process ***", isDebugEnabled)
447 public void queryCatalogDB (DelegateExecution execution) {
448 def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
449 execution.setVariable("prefix",Prefix)
451 utils.log("DEBUG", " *** STARTED CreateVnfInfra QueryCatalogDB Process *** ", isDebugEnabled)
454 String vnfModelInfo = execution.getVariable("CREVI_vnfModelInfo")
455 String vnfModelCustomizationUuid = jsonUtil.getJsonValueForKey(vnfModelInfo, "modelCustomizationUuid")
456 utils.log("DEBUG", "querying Catalog DB by vnfModelCustomizationUuid: " + vnfModelCustomizationUuid, isDebugEnabled)
458 JSONArray vnfs = cutils.getAllVnfsByVnfModelCustomizationUuid(execution,
459 vnfModelCustomizationUuid, "v2")
460 utils.log("DEBUG", "obtained VNF list: " + vnfs, isDebugEnabled)
463 utils.log("ERROR", "No matching VNFs in Catalog DB for vnfModelCustomizationUuid=" + vnfModelCustomizationUuid, isDebugEnabled)
464 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "No matching VNFs in Catalog DB for vnfModelCustomizationUuid=" + vnfModelCustomizationUuid)
467 // Only one match here
468 JSONObject vnf = vnfs.get(0)
471 utils.log("ERROR", "No matching VNF in Catalog DB for vnfModelCustomizationUuid=" + vnfModelCustomizationUuid, isDebugEnabled)
472 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "No matching VNF in Catalog DB for vnfModelCustomizationUuid=" + vnfModelCustomizationUuid)
475 VnfResource vnfResource = new VnfResource()
476 String nfType = jsonUtil.getJsonValueForKey(vnf, "nfType")
477 vnfResource.setNfType(nfType)
478 String nfRole = jsonUtil.getJsonValueForKey(vnf, "nfRole")
479 vnfResource.setNfRole(nfRole)
480 String nfFunction = jsonUtil.getJsonValueForKey(vnf, "nfFunction")
481 vnfResource.setNfFunction(nfFunction)
482 String nfNamingCode = jsonUtil.getJsonValueForKey(vnf, "nfNamingCode")
483 vnfResource.setNfNamingCode(nfNamingCode)
485 execution.setVariable("CREVI_vnfResourceDecomposition", vnfResource)
487 }catch(BpmnError e) {
489 }catch(Exception ex) {
490 utils.log("DEBUG", "Error Occurred in CreateVnfInfra QueryCatalogDB Process " + ex.getMessage(), isDebugEnabled)
491 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occurred in CreateVnfInfra QueryCatalogDB Process")
495 utils.log("DEBUG", "*** COMPLETED CreateVnfInfra QueryCatalogDb Process ***", isDebugEnabled)
497 public void createPlatform (DelegateExecution execution) {
498 def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
499 utils.log("DEBUG"," ***** START createPlatform *****", isDebugEnabled)
501 String request = execution.getVariable("bpmnRequest")
502 String platformName = jsonUtil.getJsonValue(request, "requestDetails.platform.platformName")
503 String vnfId = execution.getVariable("CREVI_vnfId")
505 utils.log("DEBUG","Platform NAME: " + platformName, isDebugEnabled)
506 utils.log("DEBUG","VnfID: " + vnfId, isDebugEnabled)
508 if(platformName == null||platformName.equals("")){
509 String msg = "Exception in createPlatform. platformName was not found in the request.";
510 utils.log("DEBUG", msg, isDebugEnabled)
511 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
513 utils.log("DEBUG", "platformName was found.", isDebugEnabled)
515 AAICreateResources aaiCR = new AAICreateResources()
516 aaiCR.createAAIPlatform(platformName, vnfId)
517 }catch(Exception ex){
518 String msg = "Exception in createPlatform. " + ex.getMessage();
519 utils.log("DEBUG", msg, isDebugEnabled)
520 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
523 utils.log("DEBUG"," *** Exit createPlatform *** ", isDebugEnabled)
525 public void createLineOfBusiness (DelegateExecution execution) {
526 def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
527 utils.log("DEBUG"," ***** START createLineOfBusiness *****", isDebugEnabled)
529 String request = execution.getVariable("bpmnRequest")
530 String lineOfBusiness = jsonUtil.getJsonValue(request, "requestDetails.lineOfBusiness.lineOfBusinessName")
531 String vnfId = execution.getVariable("CREVI_vnfId")
533 utils.log("DEBUG","LineOfBusiness NAME: " + lineOfBusiness, isDebugEnabled)
534 utils.log("DEBUG","VnfID: " + vnfId, isDebugEnabled)
536 if(lineOfBusiness == null || lineOfBusiness.equals("")){
537 utils.log("DEBUG", "LineOfBusiness was not found. Continuing on with flow...", isDebugEnabled)
539 utils.log("DEBUG", "LineOfBusiness was found.", isDebugEnabled)
541 AAICreateResources aaiCR = new AAICreateResources()
542 aaiCR.createAAILineOfBusiness(lineOfBusiness, vnfId)
543 }catch(Exception ex){
544 String msg = "Exception in LineOfBusiness. " + ex.getMessage();
545 utils.log("DEBUG", msg, isDebugEnabled)
546 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
549 utils.log("DEBUG"," *** Exit createLineOfBusiness *** ", isDebugEnabled)