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.onap.so.bpmn.infrastructure.scripts
23 import static org.apache.commons.lang3.StringUtils.*;
25 import org.camunda.bpm.engine.delegate.BpmnError
26 import org.camunda.bpm.engine.delegate.DelegateExecution;
27 import org.json.JSONArray;
28 import org.json.JSONObject;
29 import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor;
30 import org.onap.so.bpmn.common.scripts.CatalogDbUtils;
31 import org.onap.so.bpmn.common.scripts.ExceptionUtil;
32 import org.onap.so.bpmn.common.scripts.MsoUtils
33 import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils;
34 import org.onap.so.bpmn.common.scripts.VidUtils;
35 import org.onap.so.bpmn.core.UrnPropertiesReader
36 import org.onap.so.bpmn.core.WorkflowException
37 import org.onap.so.bpmn.core.domain.VnfResource
38 import org.onap.so.bpmn.core.json.JsonUtils;
39 import org.onap.so.bpmn.infrastructure.aai.groovyflows.AAICreateResources;
40 import org.onap.so.logger.MessageEnum
41 import org.onap.so.logger.MsoLogger
45 * This class supports the CreateVnfInfra Flow
46 * with the creation of a generic vnf for
49 class CreateVnfInfra extends AbstractServiceTaskProcessor {
51 private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CreateVnfInfra.class);
54 String Prefix="CREVI_"
55 ExceptionUtil exceptionUtil = new ExceptionUtil()
56 JsonUtils jsonUtil = new JsonUtils()
57 VidUtils vidUtils = new VidUtils(this)
58 CatalogDbUtils cutils = new CatalogDbUtils()
59 AAICreateResources aaiCR = new AAICreateResources()
62 * This method gets and validates the incoming
68 public void preProcessRequest(DelegateExecution execution) {
69 def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
70 execution.setVariable("prefix",Prefix)
71 msoLogger.trace("STARTED CreateVnfInfra PreProcessRequest Process")
73 setBasicDBAuthHeader(execution, isDebugEnabled)
74 execution.setVariable("CREVI_sentSyncResponse", false)
78 String createVnfRequest = execution.getVariable("bpmnRequest")
79 execution.setVariable("CREVI_createVnfRequest", createVnfRequest)
80 msoLogger.debug("Incoming CreateVnfInfra Request is: \n" + createVnfRequest)
82 if(createVnfRequest != null){
84 String requestId = execution.getVariable("mso-request-id")
85 execution.setVariable("CREVI_requestId", requestId)
86 msoLogger.debug("Incoming Request Id is: " + requestId)
88 String serviceInstanceId = execution.getVariable("serviceInstanceId")
89 execution.setVariable("CREVI_serviceInstanceId", serviceInstanceId)
90 msoLogger.debug("Incoming Service Instance Id is: " + serviceInstanceId)
92 String vnfType = execution.getVariable("vnfType")
93 execution.setVariable("CREVI_vnfType", vnfType)
94 msoLogger.debug("Incoming Vnf Type is: " + vnfType)
96 String vnfName = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.requestInfo.instanceName")
97 execution.setVariable("CREVI_vnfName", vnfName)
98 msoLogger.debug("Incoming Vnf Name is: " + vnfName)
100 String serviceId = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.requestInfo.productFamilyId")
101 execution.setVariable("CREVI_serviceId", serviceId)
102 msoLogger.debug("Incoming Service Id is: " + serviceId)
104 String source = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.requestInfo.source")
105 execution.setVariable("CREVI_source", source)
106 msoLogger.debug("Incoming Source is: " + source)
108 String suppressRollback = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.requestInfo.suppressRollback")
109 execution.setVariable("CREVI_suppressRollback", suppressRollback)
110 msoLogger.debug("Incoming Suppress Rollback is: " + suppressRollback)
112 def vnfModelInfo = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.modelInfo")
113 execution.setVariable("CREVI_vnfModelInfo", vnfModelInfo)
115 String modelInvariantId = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.modelInfo.modelInvariantUuid")
116 execution.setVariable("CREVI_modelInvariantId", modelInvariantId)
117 msoLogger.debug("Incoming Invariant Id is: " + modelInvariantId)
119 String modelVersion = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.modelInfo.modelVersion")
120 execution.setVariable("CREVI_modelVersion", modelVersion)
121 msoLogger.debug("Incoming Model Version is: " + modelVersion)
123 def cloudConfiguration = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.cloudConfiguration")
124 execution.setVariable("CREVI_cloudConfiguration", cloudConfiguration)
126 String cloudSiteId = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.cloudConfiguration.lcpCloudRegionId")
127 execution.setVariable("CREVI_cloudSiteId", cloudSiteId)
128 msoLogger.debug("Incoming Cloud Site Id is: " + cloudSiteId)
130 String tenantId = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.cloudConfiguration.tenantId")
131 execution.setVariable("CREVI_tenantId", tenantId)
132 msoLogger.debug("Incoming Tenant Id is: " + tenantId)
134 //For Completion Handler & Fallout Handler
136 """<request-info xmlns="http://org.onap/so/infra/vnf-request/v1">
137 <request-id>${MsoUtils.xmlEscape(requestId)}</request-id>
138 <action>CREATE</action>
139 <source>${MsoUtils.xmlEscape(source)}</source>
142 execution.setVariable("CREVI_requestInfo", requestInfo)
144 //TODO: Orch Status - TBD, will come from SDN-C Response in 1702
145 String orchStatus = "Created"
146 execution.setVariable("CREVI_orchStatus", orchStatus)
148 //TODO: Equipment Role - Should come from SDN-C Response in 1702
149 String equipmentRole = " "
150 execution.setVariable("CREVI_equipmentRole", equipmentRole)
152 String vnfId = execution.getVariable("testVnfId") // for junits
154 vnfId = UUID.randomUUID().toString()
155 msoLogger.debug("Generated Vnf Id is: " + vnfId)
157 execution.setVariable("CREVI_vnfId", vnfId)
159 // Setting for Sub Flow Calls
160 execution.setVariable("CREVI_type", "generic-vnf")
161 execution.setVariable("GENGS_type", "service-instance")
163 String sdncCallbackUrl = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution)
164 if (sdncCallbackUrl == null || sdncCallbackUrl.trim().isEmpty()) {
165 def msg = 'Required variable \'mso.workflow.sdncadapter.callback\' is missing'
166 msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError);
168 exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
170 execution.setVariable("CREVI_sdncCallbackUrl", sdncCallbackUrl)
172 def vnfInputParameters = null
174 vnfInputParameters = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.requestParameters.userParams")
176 catch (Exception e) {
177 msoLogger.debug("userParams are not present in the request")
179 execution.setVariable("CREVI_vnfInputParameters", vnfInputParameters)
182 msoLogger.debug("SDNC Callback URL: " + sdncCallbackUrl)
184 exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Bpmn Request is Null.")
188 msoLogger.debug("Rethrowing MSOWorkflowException")
191 msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Error Occurred in CreateVnfInfra PreProcessRequest method", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e)
192 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occurred in CreateVnfInfra PreProcessRequest")
195 msoLogger.trace("COMPLETED CreateVnfInfra PreProcessRequest Process")
198 public void sendSyncResponse (DelegateExecution execution) {
199 execution.setVariable("prefix",Prefix)
201 msoLogger.trace("STARTED CreateVnfInfra SendSyncResponse Process")
204 String requestId = execution.getVariable("CREVI_requestId")
205 String vnfId = execution.getVariable("CREVI_vnfId")
207 String createVnfResponse = """{"requestReferences":{"instanceId":"${vnfId}","requestId":"${requestId}"}}""".trim()
209 msoLogger.debug("CreateVnfInfra Sync Response is: \n" + createVnfResponse)
211 sendWorkflowResponse(execution, 202, createVnfResponse)
213 execution.setVariable("CREVI_sentSyncResponse", true)
215 } catch (Exception ex) {
216 msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Error Occurred in CreateVnfInfra SendSyncResponse Process", "BPMN", MsoLogger.getServiceName(),
217 MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e)
218 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in CreateVnfInfra SendSyncResponse Process")
221 msoLogger.trace("COMPLETED CreateVnfInfra SendSyncResponse Process")
225 public void preProcessSDNCAssignRequest(DelegateExecution execution){
226 execution.setVariable("prefix", Prefix)
227 msoLogger.trace("STARTED preProcessSDNCAssignRequest")
228 def vnfId = execution.getVariable("CREVI_vnfId")
229 def serviceInstanceId = execution.getVariable("CREVI_serviceInstanceId")
230 msoLogger.debug("NEW VNF ID: " + vnfId)
235 String assignSDNCRequest = buildSDNCRequest(execution, serviceInstanceId, "assign")
237 assignSDNCRequest = utils.formatXml(assignSDNCRequest)
238 execution.setVariable("CREVI_assignSDNCRequest", assignSDNCRequest)
239 msoLogger.debug("Outgoing AssignSDNCRequest is: \n" + assignSDNCRequest)
242 msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occurred Processing preProcessSDNCAssignRequest", "BPMN", MsoLogger.getServiceName(),
243 MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e)
244 exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during prepareProvision Method:\n" + e.getMessage())
246 msoLogger.trace("COMPLETED preProcessSDNCAssignRequest")
249 public void preProcessSDNCActivateRequest(DelegateExecution execution) {
250 def method = getClass().getSimpleName() + '.preProcessSDNCActivateRequest(' +
251 'execution=' + execution.getId() +
253 msoLogger.trace('Entered ' + method)
254 execution.setVariable("prefix", Prefix)
255 msoLogger.trace("STARTED preProcessSDNCActivateRequest Process")
257 String vnfId = execution.getVariable("CREVI_vnfId")
258 String serviceInstanceId = execution.getVariable("CREVI_serviceInstanceId")
260 String activateSDNCRequest = buildSDNCRequest(execution, serviceInstanceId, "activate")
262 execution.setVariable("CREVI_activateSDNCRequest", activateSDNCRequest)
263 msoLogger.debug("Outgoing CommitSDNCRequest is: \n" + activateSDNCRequest)
266 msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing preProcessSDNCActivateRequest", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e)
267 exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessSDNCActivateRequest Method:\n" + e.getMessage())
269 msoLogger.trace("COMPLETED preProcessSDNCActivateRequest Process")
272 public String buildSDNCRequest(DelegateExecution execution, String svcInstId, String action){
274 String uuid = execution.getVariable('testReqId') // for junits
276 uuid = execution.getVariable("mso-request-id") + "-" + System.currentTimeMillis()
278 def callbackURL = execution.getVariable("CREVI_sdncCallbackUrl")
279 def requestId = execution.getVariable("CREVI_requestId")
280 def serviceId = execution.getVariable("CREVI_serviceId")
281 def vnfType = execution.getVariable("CREVI_vnfType")
282 def vnfName = execution.getVariable("CREVI_vnfName")
283 def tenantId = execution.getVariable("CREVI_tenantId")
284 def source = execution.getVariable("CREVI_source")
285 def vnfId = execution.getVariable("CREVI_vnfId")
286 def cloudSiteId = execution.getVariable("CREVI_cloudSiteId")
288 String sdncVNFParamsXml = ""
290 if(execution.getVariable("CREVI_vnfParamsExistFlag") == true){
291 sdncVNFParamsXml = buildSDNCParamsXml(execution)
293 sdncVNFParamsXml = ""
297 """<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.onap/so/request/types/v1"
298 xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"
299 xmlns:sdncadapter="http://org.onap/workflow/sdnc/adapter/schema/v1">
300 <sdncadapter:RequestHeader>
301 <sdncadapter:RequestId>${MsoUtils.xmlEscape(requestId)}</sdncadapter:RequestId>
302 <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(svcInstId)}</sdncadapter:SvcInstanceId>
303 <sdncadapter:SvcAction>${MsoUtils.xmlEscape(action)}</sdncadapter:SvcAction>
304 <sdncadapter:SvcOperation>vnf-topology-operation</sdncadapter:SvcOperation>
305 <sdncadapter:CallbackUrl>${MsoUtils.xmlEscape(callbackURL)}</sdncadapter:CallbackUrl>
306 </sdncadapter:RequestHeader>
307 <sdncadapterworkflow:SDNCRequestData>
308 <request-information>
309 <request-id>${MsoUtils.xmlEscape(requestId)}</request-id>
310 <request-action>VNFActivateRequest</request-action>
311 <source>${MsoUtils.xmlEscape(source)}</source>
313 </request-information>
314 <service-information>
315 <service-id>${MsoUtils.xmlEscape(serviceId)}</service-id>
316 <service-type>${MsoUtils.xmlEscape(serviceId)}</service-type>
317 <service-instance-id>${MsoUtils.xmlEscape(svcInstId)}</service-instance-id>
318 <subscriber-name>notsurewecare</subscriber-name>
319 </service-information>
320 <vnf-request-information>
321 <vnf-id>${MsoUtils.xmlEscape(vnfId)}</vnf-id>
322 <vnf-name>${MsoUtils.xmlEscape(vnfName)}</vnf-name>
323 <vnf-type>${MsoUtils.xmlEscape(vnfType)}</vnf-type>
324 <aic-cloud-region>${MsoUtils.xmlEscape(cloudSiteId)}</aic-cloud-region>
325 <tenant>${MsoUtils.xmlEscape(tenantId)}</tenant>
327 </vnf-request-information>
328 </sdncadapterworkflow:SDNCRequestData>
329 </sdncadapterworkflow:SDNCAdapterWorkflowRequest>"""
331 msoLogger.debug("sdncRequest: " + sdncRequest)
335 public void validateSDNCResponse(DelegateExecution execution, String response, String method){
336 execution.setVariable("prefix",Prefix)
337 msoLogger.debug("STARTED ValidateSDNCResponse Process")
339 WorkflowException workflowException = execution.getVariable("WorkflowException")
340 boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator")
342 msoLogger.debug("workflowException: " + workflowException)
344 SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this)
345 sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator)
347 msoLogger.debug("SDNCResponse: " + response)
349 String sdncResponse = response
350 if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){
351 msoLogger.trace("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + sdncResponse)
354 msoLogger.debug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.")
355 throw new BpmnError("MSOWorkflowException")
357 msoLogger.trace("COMPLETED ValidateSDNCResponse Process")
360 public void prepareCompletionHandlerRequest(DelegateExecution execution){
361 execution.setVariable("prefix",Prefix)
363 msoLogger.trace("STARTED CreateVnfInfra PrepareCompletionHandlerRequest Process")
366 String requestInfo = execution.getVariable("CREVI_requestInfo")
367 String vnfId = execution.getVariable("CREVI_vnfId")
368 requestInfo = utils.removeXmlPreamble(requestInfo)
371 """<aetgt:MsoCompletionRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
372 xmlns:ns="http://org.onap/so/request/types/v1">
374 <status-message>Vnf has been created successfully.</status-message>
375 <vnfId>${MsoUtils.xmlEscape(vnfId)}</vnfId>
376 <mso-bpel-name>CreateVnfInfra</mso-bpel-name>
377 </aetgt:MsoCompletionRequest>"""
379 execution.setVariable("CREVI_completionHandlerRequest", request)
380 msoLogger.debug("Completion Handler Request is: " + request)
382 execution.setVariable("WorkflowResponse", "Success") // for junits
384 } catch (Exception ex) {
385 msoLogger.debug("Error Occured in CreateVnfInfra PrepareCompletionHandlerRequest Process " + ex.getMessage())
386 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in CreateVnfInfra PrepareCompletionHandlerRequest Process")
389 msoLogger.trace("COMPLETED CreateVnfInfra PrepareCompletionHandlerRequest Process")
392 public void sendErrorResponse(DelegateExecution execution){
393 execution.setVariable("prefix",Prefix)
395 msoLogger.trace("STARTED CreateVnfInfra sendErrorResponse Process")
397 def sentSyncResponse = execution.getVariable("CREVI_sentSyncResponse")
398 if(sentSyncResponse == false){
399 WorkflowException wfex = execution.getVariable("WorkflowException")
400 String response = exceptionUtil.buildErrorResponseXml(wfex)
402 msoLogger.debug(response)
403 sendWorkflowResponse(execution, 500, response)
405 msoLogger.debug("Not Sending Error Response. Sync Response Already Sent")
408 } catch (Exception ex) {
409 msoLogger.debug("Error Occured in CreateVnfInfra sendErrorResponse Process " + ex.getMessage())
410 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in CreateVnfInfra sendErrorResponse Process")
413 msoLogger.trace("COMPLETED CreateVnfInfra sendErrorResponse Process")
416 public void prepareFalloutRequest(DelegateExecution execution){
417 execution.setVariable("prefix",Prefix)
419 msoLogger.trace("STARTED CreateVnfInfra prepareFalloutRequest Process")
422 WorkflowException wfex = execution.getVariable("WorkflowException")
423 msoLogger.debug(" Incoming Workflow Exception: " + wfex.toString())
424 String requestInfo = execution.getVariable("CREVI_requestInfo")
425 msoLogger.debug(" Incoming Request Info: " + requestInfo)
427 String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo)
429 execution.setVariable("CREVI_falloutRequest", falloutRequest)
432 } catch (Exception ex) {
433 msoLogger.debug("Error Occured in CreateVnfInfra prepareFalloutRequest Process " + ex.getMessage())
434 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in CreateVnfInfra prepareFalloutRequest Process")
437 msoLogger.trace("COMPLETED CreateVnfInfra prepareFalloutRequest Process")
441 public void queryCatalogDB (DelegateExecution execution) {
442 execution.setVariable("prefix",Prefix)
444 msoLogger.trace("STARTED CreateVnfInfra QueryCatalogDB Process")
447 String vnfModelInfo = execution.getVariable("CREVI_vnfModelInfo")
448 String vnfModelCustomizationUuid = jsonUtil.getJsonValueForKey(vnfModelInfo, "modelCustomizationUuid")
449 msoLogger.debug("querying Catalog DB by vnfModelCustomizationUuid: " + vnfModelCustomizationUuid)
451 JSONArray vnfs = cutils.getAllVnfsByVnfModelCustomizationUuid(execution,
452 vnfModelCustomizationUuid, "v2")
453 msoLogger.debug("obtained VNF list: " + vnfs)
456 msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "No matching VNFs in Catalog DB for vnfModelCustomizationUuid=" + vnfModelCustomizationUuid, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
457 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "No matching VNFs in Catalog DB for vnfModelCustomizationUuid=" + vnfModelCustomizationUuid)
460 // Only one match here
461 JSONObject vnf = vnfs.get(0)
464 msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "No matching VNF in Catalog DB for vnfModelCustomizationUuid=" + vnfModelCustomizationUuid, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
465 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "No matching VNF in Catalog DB for vnfModelCustomizationUuid=" + vnfModelCustomizationUuid)
468 VnfResource vnfResource = new VnfResource()
469 String nfType = jsonUtil.getJsonValueForKey(vnf, "nfType")
470 vnfResource.setNfType(nfType)
471 String nfRole = jsonUtil.getJsonValueForKey(vnf, "nfRole")
472 vnfResource.setNfRole(nfRole)
473 String nfFunction = jsonUtil.getJsonValueForKey(vnf, "nfFunction")
474 vnfResource.setNfFunction(nfFunction)
475 String nfNamingCode = jsonUtil.getJsonValueForKey(vnf, "nfNamingCode")
476 vnfResource.setNfNamingCode(nfNamingCode)
478 execution.setVariable("CREVI_vnfResourceDecomposition", vnfResource)
480 }catch(BpmnError e) {
482 }catch(Exception ex) {
483 msoLogger.debug("Error Occurred in CreateVnfInfra QueryCatalogDB Process " + ex.getMessage())
484 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occurred in CreateVnfInfra QueryCatalogDB Process")
488 msoLogger.trace("COMPLETED CreateVnfInfra QueryCatalogDb Process")
490 public void createPlatform (DelegateExecution execution) {
491 msoLogger.trace("START createPlatform")
493 String request = execution.getVariable("bpmnRequest")
494 String platformName = jsonUtil.getJsonValue(request, "requestDetails.platform.platformName")
495 String vnfId = execution.getVariable("CREVI_vnfId")
497 msoLogger.debug("Platform NAME: " + platformName)
498 msoLogger.debug("VnfID: " + vnfId)
500 if(platformName == null||platformName.equals("")){
501 String msg = "Exception in createPlatform. platformName was not found in the request.";
503 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
505 msoLogger.debug("platformName was found.")
507 AAICreateResources aaiCR = new AAICreateResources()
508 aaiCR.createAAIPlatform(platformName, vnfId)
509 }catch(Exception ex){
510 String msg = "Exception in createPlatform. " + ex.getMessage();
512 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
515 msoLogger.trace("Exit createPlatform")
517 public void createLineOfBusiness (DelegateExecution execution) {
518 msoLogger.trace("START createLineOfBusiness")
520 String request = execution.getVariable("bpmnRequest")
521 String lineOfBusiness = jsonUtil.getJsonValue(request, "requestDetails.lineOfBusiness.lineOfBusinessName")
522 String vnfId = execution.getVariable("CREVI_vnfId")
524 msoLogger.debug("LineOfBusiness NAME: " + lineOfBusiness)
525 msoLogger.debug("VnfID: " + vnfId)
527 if(lineOfBusiness == null || lineOfBusiness.equals("")){
528 msoLogger.debug("LineOfBusiness was not found. Continuing on with flow...")
530 msoLogger.debug("LineOfBusiness was found.")
532 AAICreateResources aaiCR = new AAICreateResources()
533 aaiCR.createAAILineOfBusiness(lineOfBusiness, vnfId)
534 }catch(Exception ex){
535 String msg = "Exception in LineOfBusiness. " + ex.getMessage();
536 msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + ex)
537 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
540 msoLogger.trace("Exit createLineOfBusiness")