2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Modifications Copyright (c) 2019 Samsung
8 * ================================================================================
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
20 * ============LICENSE_END=========================================================
23 package org.onap.so.bpmn.infrastructure.scripts
25 import org.onap.so.bpmn.common.scripts.CatalogDbUtilsFactory
27 import static org.apache.commons.lang3.StringUtils.*;
29 import org.camunda.bpm.engine.delegate.BpmnError
30 import org.camunda.bpm.engine.delegate.DelegateExecution;
31 import org.json.JSONArray;
32 import org.json.JSONObject;
33 import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor;
34 import org.onap.so.bpmn.common.scripts.CatalogDbUtils;
35 import org.onap.so.bpmn.common.scripts.ExceptionUtil;
36 import org.onap.so.bpmn.common.scripts.MsoUtils
37 import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils;
38 import org.onap.so.bpmn.common.scripts.VidUtils;
39 import org.onap.so.bpmn.core.UrnPropertiesReader
40 import org.onap.so.bpmn.core.WorkflowException
41 import org.onap.so.bpmn.core.domain.VnfResource
42 import org.onap.so.bpmn.core.json.JsonUtils;
43 import org.onap.so.bpmn.infrastructure.aai.groovyflows.AAICreateResources;
44 import org.onap.so.logger.MessageEnum
45 import org.onap.so.logger.MsoLogger
46 import org.slf4j.Logger
47 import org.slf4j.LoggerFactory
51 * This class supports the CreateVnfInfra Flow
52 * with the creation of a generic vnf for
55 class CreateVnfInfra extends AbstractServiceTaskProcessor {
57 private static final Logger logger = LoggerFactory.getLogger( CreateVnfInfra.class);
60 String Prefix="CREVI_"
61 ExceptionUtil exceptionUtil = new ExceptionUtil()
62 JsonUtils jsonUtil = new JsonUtils()
63 VidUtils vidUtils = new VidUtils(this)
64 CatalogDbUtils catalogDbUtils = new CatalogDbUtilsFactory().create()
67 * This method gets and validates the incoming
73 public void preProcessRequest(DelegateExecution execution) {
74 def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
75 execution.setVariable("prefix",Prefix)
76 logger.trace("STARTED CreateVnfInfra PreProcessRequest Process")
78 setBasicDBAuthHeader(execution, isDebugEnabled)
79 execution.setVariable("CREVI_sentSyncResponse", false)
83 String createVnfRequest = execution.getVariable("bpmnRequest")
84 execution.setVariable("CREVI_createVnfRequest", createVnfRequest)
85 logger.debug("Incoming CreateVnfInfra Request is: \n" + createVnfRequest)
87 if(createVnfRequest != null){
89 String requestId = execution.getVariable("mso-request-id")
90 execution.setVariable("CREVI_requestId", requestId)
91 logger.debug("Incoming Request Id is: " + requestId)
93 String serviceInstanceId = execution.getVariable("serviceInstanceId")
94 execution.setVariable("CREVI_serviceInstanceId", serviceInstanceId)
95 logger.debug("Incoming Service Instance Id is: " + serviceInstanceId)
97 String vnfType = execution.getVariable("vnfType")
98 execution.setVariable("CREVI_vnfType", vnfType)
99 logger.debug("Incoming Vnf Type is: " + vnfType)
101 String vnfName = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.requestInfo.instanceName")
102 execution.setVariable("CREVI_vnfName", vnfName)
103 logger.debug("Incoming Vnf Name is: " + vnfName)
105 String serviceId = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.requestInfo.productFamilyId")
106 execution.setVariable("CREVI_serviceId", serviceId)
107 logger.debug("Incoming Service Id is: " + serviceId)
109 String source = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.requestInfo.source")
110 execution.setVariable("CREVI_source", source)
111 logger.debug("Incoming Source is: " + source)
113 String suppressRollback = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.requestInfo.suppressRollback")
114 execution.setVariable("CREVI_suppressRollback", suppressRollback)
115 logger.debug("Incoming Suppress Rollback is: " + suppressRollback)
117 def vnfModelInfo = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.modelInfo")
118 execution.setVariable("CREVI_vnfModelInfo", vnfModelInfo)
120 String modelInvariantId = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.modelInfo.modelInvariantUuid")
121 execution.setVariable("CREVI_modelInvariantId", modelInvariantId)
122 logger.debug("Incoming Invariant Id is: " + modelInvariantId)
124 String modelVersion = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.modelInfo.modelVersion")
125 execution.setVariable("CREVI_modelVersion", modelVersion)
126 logger.debug("Incoming Model Version is: " + modelVersion)
128 def cloudConfiguration = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.cloudConfiguration")
129 execution.setVariable("CREVI_cloudConfiguration", cloudConfiguration)
131 String cloudSiteId = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.cloudConfiguration.lcpCloudRegionId")
132 execution.setVariable("CREVI_cloudSiteId", cloudSiteId)
133 logger.debug("Incoming Cloud Site Id is: " + cloudSiteId)
135 String tenantId = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.cloudConfiguration.tenantId")
136 execution.setVariable("CREVI_tenantId", tenantId)
137 logger.debug("Incoming Tenant Id is: " + tenantId)
139 //For Completion Handler & Fallout Handler
141 """<request-info xmlns="http://org.onap/so/infra/vnf-request/v1">
142 <request-id>${MsoUtils.xmlEscape(requestId)}</request-id>
143 <action>CREATE</action>
144 <source>${MsoUtils.xmlEscape(source)}</source>
147 execution.setVariable("CREVI_requestInfo", requestInfo)
149 //TODO: Orch Status - TBD, will come from SDN-C Response in 1702
150 String orchStatus = "Created"
151 execution.setVariable("CREVI_orchStatus", orchStatus)
153 //TODO: Equipment Role - Should come from SDN-C Response in 1702
154 String equipmentRole = " "
155 execution.setVariable("CREVI_equipmentRole", equipmentRole)
157 String vnfId = execution.getVariable("testVnfId") // for junits
159 vnfId = UUID.randomUUID().toString()
160 logger.debug("Generated Vnf Id is: " + vnfId)
162 execution.setVariable("CREVI_vnfId", vnfId)
164 // Setting for Sub Flow Calls
165 execution.setVariable("CREVI_type", "generic-vnf")
166 execution.setVariable("GENGS_type", "service-instance")
168 String sdncCallbackUrl = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution)
169 if (sdncCallbackUrl == null || sdncCallbackUrl.trim().isEmpty()) {
170 def msg = 'Required variable \'mso.workflow.sdncadapter.callback\' is missing'
171 logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError.getValue());
173 exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
175 execution.setVariable("CREVI_sdncCallbackUrl", sdncCallbackUrl)
177 def vnfInputParameters = null
179 vnfInputParameters = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.requestParameters.userParams")
181 catch (Exception e) {
182 logger.debug("userParams are not present in the request")
184 execution.setVariable("CREVI_vnfInputParameters", vnfInputParameters)
187 logger.debug("SDNC Callback URL: " + sdncCallbackUrl)
189 exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Bpmn Request is Null.")
193 logger.debug("Rethrowing MSOWorkflowException")
196 logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), " Error Occurred in CreateVnfInfra PreProcessRequest method", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e)
197 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occurred in CreateVnfInfra PreProcessRequest")
200 logger.trace("COMPLETED CreateVnfInfra PreProcessRequest Process")
203 public void sendSyncResponse (DelegateExecution execution) {
204 execution.setVariable("prefix",Prefix)
206 logger.trace("STARTED CreateVnfInfra SendSyncResponse Process")
209 String requestId = execution.getVariable("CREVI_requestId")
210 String vnfId = execution.getVariable("CREVI_vnfId")
212 String createVnfResponse = """{"requestReferences":{"instanceId":"${vnfId}","requestId":"${requestId}"}}""".trim()
214 logger.debug("CreateVnfInfra Sync Response is: \n" + createVnfResponse)
216 sendWorkflowResponse(execution, 202, createVnfResponse)
218 execution.setVariable("CREVI_sentSyncResponse", true)
220 } catch (Exception ex) {
221 logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), " Error Occurred in CreateVnfInfra SendSyncResponse Process", "BPMN", MsoLogger.getServiceName(),
222 MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e)
223 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in CreateVnfInfra SendSyncResponse Process")
226 logger.trace("COMPLETED CreateVnfInfra SendSyncResponse Process")
230 public void preProcessSDNCAssignRequest(DelegateExecution execution){
231 execution.setVariable("prefix", Prefix)
232 logger.trace("STARTED preProcessSDNCAssignRequest")
233 def vnfId = execution.getVariable("CREVI_vnfId")
234 def serviceInstanceId = execution.getVariable("CREVI_serviceInstanceId")
235 logger.debug("NEW VNF ID: " + vnfId)
240 String assignSDNCRequest = buildSDNCRequest(execution, serviceInstanceId, "assign")
242 assignSDNCRequest = utils.formatXml(assignSDNCRequest)
243 execution.setVariable("CREVI_assignSDNCRequest", assignSDNCRequest)
244 logger.debug("Outgoing AssignSDNCRequest is: \n" + assignSDNCRequest)
247 logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occurred Processing preProcessSDNCAssignRequest", "BPMN", MsoLogger.getServiceName(),
248 MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e)
249 exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during prepareProvision Method:\n" + e.getMessage())
251 logger.trace("COMPLETED preProcessSDNCAssignRequest")
254 public void preProcessSDNCActivateRequest(DelegateExecution execution) {
255 def method = getClass().getSimpleName() + '.preProcessSDNCActivateRequest(' +
256 'execution=' + execution.getId() +
258 logger.trace('Entered ' + method)
259 execution.setVariable("prefix", Prefix)
260 logger.trace("STARTED preProcessSDNCActivateRequest Process")
262 String vnfId = execution.getVariable("CREVI_vnfId")
263 String serviceInstanceId = execution.getVariable("CREVI_serviceInstanceId")
265 String activateSDNCRequest = buildSDNCRequest(execution, serviceInstanceId, "activate")
267 execution.setVariable("CREVI_activateSDNCRequest", activateSDNCRequest)
268 logger.debug("Outgoing CommitSDNCRequest is: \n" + activateSDNCRequest)
271 logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured Processing preProcessSDNCActivateRequest", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e)
272 exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessSDNCActivateRequest Method:\n" + e.getMessage())
274 logger.trace("COMPLETED preProcessSDNCActivateRequest Process")
277 public String buildSDNCRequest(DelegateExecution execution, String svcInstId, String action){
279 String uuid = execution.getVariable('testReqId') // for junits
281 uuid = execution.getVariable("mso-request-id") + "-" + System.currentTimeMillis()
283 def callbackURL = execution.getVariable("CREVI_sdncCallbackUrl")
284 def requestId = execution.getVariable("CREVI_requestId")
285 def serviceId = execution.getVariable("CREVI_serviceId")
286 def vnfType = execution.getVariable("CREVI_vnfType")
287 def vnfName = execution.getVariable("CREVI_vnfName")
288 def tenantId = execution.getVariable("CREVI_tenantId")
289 def source = execution.getVariable("CREVI_source")
290 def vnfId = execution.getVariable("CREVI_vnfId")
291 def cloudSiteId = execution.getVariable("CREVI_cloudSiteId")
293 String sdncVNFParamsXml = ""
295 if(execution.getVariable("CREVI_vnfParamsExistFlag") == true){
296 sdncVNFParamsXml = buildSDNCParamsXml(execution)
298 sdncVNFParamsXml = ""
302 """<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.onap/so/request/types/v1"
303 xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"
304 xmlns:sdncadapter="http://org.onap/workflow/sdnc/adapter/schema/v1">
305 <sdncadapter:RequestHeader>
306 <sdncadapter:RequestId>${MsoUtils.xmlEscape(requestId)}</sdncadapter:RequestId>
307 <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(svcInstId)}</sdncadapter:SvcInstanceId>
308 <sdncadapter:SvcAction>${MsoUtils.xmlEscape(action)}</sdncadapter:SvcAction>
309 <sdncadapter:SvcOperation>vnf-topology-operation</sdncadapter:SvcOperation>
310 <sdncadapter:CallbackUrl>${MsoUtils.xmlEscape(callbackURL)}</sdncadapter:CallbackUrl>
311 </sdncadapter:RequestHeader>
312 <sdncadapterworkflow:SDNCRequestData>
313 <request-information>
314 <request-id>${MsoUtils.xmlEscape(requestId)}</request-id>
315 <request-action>VNFActivateRequest</request-action>
316 <source>${MsoUtils.xmlEscape(source)}</source>
318 </request-information>
319 <service-information>
320 <service-id>${MsoUtils.xmlEscape(serviceId)}</service-id>
321 <service-type>${MsoUtils.xmlEscape(serviceId)}</service-type>
322 <service-instance-id>${MsoUtils.xmlEscape(svcInstId)}</service-instance-id>
323 <subscriber-name>notsurewecare</subscriber-name>
324 </service-information>
325 <vnf-request-information>
326 <vnf-id>${MsoUtils.xmlEscape(vnfId)}</vnf-id>
327 <vnf-name>${MsoUtils.xmlEscape(vnfName)}</vnf-name>
328 <vnf-type>${MsoUtils.xmlEscape(vnfType)}</vnf-type>
329 <aic-cloud-region>${MsoUtils.xmlEscape(cloudSiteId)}</aic-cloud-region>
330 <tenant>${MsoUtils.xmlEscape(tenantId)}</tenant>
332 </vnf-request-information>
333 </sdncadapterworkflow:SDNCRequestData>
334 </sdncadapterworkflow:SDNCAdapterWorkflowRequest>"""
336 logger.debug("sdncRequest: " + sdncRequest)
340 public void validateSDNCResponse(DelegateExecution execution, String response, String method){
341 execution.setVariable("prefix",Prefix)
342 logger.debug("STARTED ValidateSDNCResponse Process")
344 WorkflowException workflowException = execution.getVariable("WorkflowException")
345 boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator")
347 logger.debug("workflowException: " + workflowException)
349 SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this)
350 sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator)
352 logger.debug("SDNCResponse: " + response)
354 String sdncResponse = response
355 if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){
356 logger.trace("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + sdncResponse)
359 logger.debug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.")
360 throw new BpmnError("MSOWorkflowException")
362 logger.trace("COMPLETED ValidateSDNCResponse Process")
365 public void prepareCompletionHandlerRequest(DelegateExecution execution){
366 execution.setVariable("prefix",Prefix)
368 logger.trace("STARTED CreateVnfInfra PrepareCompletionHandlerRequest Process")
371 String requestInfo = execution.getVariable("CREVI_requestInfo")
372 String vnfId = execution.getVariable("CREVI_vnfId")
373 requestInfo = utils.removeXmlPreamble(requestInfo)
376 """<aetgt:MsoCompletionRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
377 xmlns:ns="http://org.onap/so/request/types/v1">
379 <status-message>Vnf has been created successfully.</status-message>
380 <vnfId>${MsoUtils.xmlEscape(vnfId)}</vnfId>
381 <mso-bpel-name>CreateVnfInfra</mso-bpel-name>
382 </aetgt:MsoCompletionRequest>"""
384 execution.setVariable("CREVI_completionHandlerRequest", request)
385 logger.debug("Completion Handler Request is: " + request)
387 execution.setVariable("WorkflowResponse", "Success") // for junits
389 } catch (Exception ex) {
390 logger.debug("Error Occured in CreateVnfInfra PrepareCompletionHandlerRequest Process " + ex.getMessage())
391 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in CreateVnfInfra PrepareCompletionHandlerRequest Process")
394 logger.trace("COMPLETED CreateVnfInfra PrepareCompletionHandlerRequest Process")
397 public void sendErrorResponse(DelegateExecution execution){
398 execution.setVariable("prefix",Prefix)
400 logger.trace("STARTED CreateVnfInfra sendErrorResponse Process")
402 def sentSyncResponse = execution.getVariable("CREVI_sentSyncResponse")
403 if(sentSyncResponse == false){
404 WorkflowException wfex = execution.getVariable("WorkflowException")
405 String response = exceptionUtil.buildErrorResponseXml(wfex)
407 logger.debug(response)
408 sendWorkflowResponse(execution, 500, response)
410 logger.debug("Not Sending Error Response. Sync Response Already Sent")
413 } catch (Exception ex) {
414 logger.debug("Error Occured in CreateVnfInfra sendErrorResponse Process " + ex.getMessage())
415 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in CreateVnfInfra sendErrorResponse Process")
418 logger.trace("COMPLETED CreateVnfInfra sendErrorResponse Process")
421 public void prepareFalloutRequest(DelegateExecution execution){
422 execution.setVariable("prefix",Prefix)
424 logger.trace("STARTED CreateVnfInfra prepareFalloutRequest Process")
427 WorkflowException wfex = execution.getVariable("WorkflowException")
428 logger.debug(" Incoming Workflow Exception: " + wfex.toString())
429 String requestInfo = execution.getVariable("CREVI_requestInfo")
430 logger.debug(" Incoming Request Info: " + requestInfo)
432 String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo)
434 execution.setVariable("CREVI_falloutRequest", falloutRequest)
437 } catch (Exception ex) {
438 logger.debug("Error Occured in CreateVnfInfra prepareFalloutRequest Process " + ex.getMessage())
439 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in CreateVnfInfra prepareFalloutRequest Process")
442 logger.trace("COMPLETED CreateVnfInfra prepareFalloutRequest Process")
446 public void queryCatalogDB (DelegateExecution execution) {
447 execution.setVariable("prefix",Prefix)
449 logger.trace("STARTED CreateVnfInfra QueryCatalogDB Process")
452 String vnfModelInfo = execution.getVariable("CREVI_vnfModelInfo")
453 String vnfModelCustomizationUuid = jsonUtil.getJsonValueForKey(vnfModelInfo, "modelCustomizationUuid")
454 logger.debug("querying Catalog DB by vnfModelCustomizationUuid: " + vnfModelCustomizationUuid)
456 JSONArray vnfs = catalogDbUtils.getAllVnfsByVnfModelCustomizationUuid(execution,
457 vnfModelCustomizationUuid, "v2")
458 logger.debug("obtained VNF list: " + vnfs)
461 logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "No matching VNFs in Catalog DB for vnfModelCustomizationUuid=" + vnfModelCustomizationUuid, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "");
462 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "No matching VNFs in Catalog DB for vnfModelCustomizationUuid=" + vnfModelCustomizationUuid)
465 // Only one match here
466 JSONObject vnf = vnfs.get(0)
469 logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "No matching VNF in Catalog DB for vnfModelCustomizationUuid=" + vnfModelCustomizationUuid, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "");
470 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "No matching VNF in Catalog DB for vnfModelCustomizationUuid=" + vnfModelCustomizationUuid)
473 VnfResource vnfResource = new VnfResource()
474 String nfType = jsonUtil.getJsonValueForKey(vnf, "nfType")
475 vnfResource.setNfType(nfType)
476 String nfRole = jsonUtil.getJsonValueForKey(vnf, "nfRole")
477 vnfResource.setNfRole(nfRole)
478 String nfFunction = jsonUtil.getJsonValueForKey(vnf, "nfFunction")
479 vnfResource.setNfFunction(nfFunction)
480 String nfNamingCode = jsonUtil.getJsonValueForKey(vnf, "nfNamingCode")
481 vnfResource.setNfNamingCode(nfNamingCode)
483 execution.setVariable("CREVI_vnfResourceDecomposition", vnfResource)
485 }catch(BpmnError e) {
487 }catch(Exception ex) {
488 logger.debug("Error Occurred in CreateVnfInfra QueryCatalogDB Process " + ex.getMessage())
489 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occurred in CreateVnfInfra QueryCatalogDB Process")
493 logger.trace("COMPLETED CreateVnfInfra QueryCatalogDb Process")
495 public void createPlatform (DelegateExecution execution) {
496 logger.trace("START createPlatform")
498 String request = execution.getVariable("bpmnRequest")
499 String platformName = jsonUtil.getJsonValue(request, "requestDetails.platform.platformName")
500 String vnfId = execution.getVariable("CREVI_vnfId")
502 logger.debug("Platform NAME: " + platformName)
503 logger.debug("VnfID: " + vnfId)
505 if(platformName == null||platformName.equals("")){
506 String msg = "Exception in createPlatform. platformName was not found in the request.";
508 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
510 logger.debug("platformName was found.")
512 AAICreateResources aaiCR = new AAICreateResources()
513 aaiCR.createAAIPlatform(platformName, vnfId)
514 }catch(Exception ex){
515 String msg = "Exception in createPlatform. " + ex.getMessage();
517 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
520 logger.trace("Exit createPlatform")
522 public void createLineOfBusiness (DelegateExecution execution) {
523 logger.trace("START createLineOfBusiness")
525 String request = execution.getVariable("bpmnRequest")
526 String lineOfBusiness = jsonUtil.getJsonValue(request, "requestDetails.lineOfBusiness.lineOfBusinessName")
527 String vnfId = execution.getVariable("CREVI_vnfId")
529 logger.debug("LineOfBusiness NAME: " + lineOfBusiness)
530 logger.debug("VnfID: " + vnfId)
532 if(lineOfBusiness == null || lineOfBusiness.equals("")){
533 logger.debug("LineOfBusiness was not found. Continuing on with flow...")
535 logger.debug("LineOfBusiness was found.")
537 AAICreateResources aaiCR = new AAICreateResources()
538 aaiCR.createAAILineOfBusiness(lineOfBusiness, vnfId)
539 }catch(Exception ex){
540 String msg = "Exception in LineOfBusiness. " + ex.getMessage();
541 logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + ex)
542 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
545 logger.trace("Exit createLineOfBusiness")