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 org.onap.so.bpmn.common.scripts.CatalogDbUtilsFactory
25 import static org.apache.commons.lang3.StringUtils.*;
27 import org.camunda.bpm.engine.delegate.BpmnError
28 import org.camunda.bpm.engine.delegate.DelegateExecution;
29 import org.json.JSONArray;
30 import org.json.JSONObject;
31 import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor;
32 import org.onap.so.bpmn.common.scripts.CatalogDbUtils;
33 import org.onap.so.bpmn.common.scripts.ExceptionUtil;
34 import org.onap.so.bpmn.common.scripts.MsoUtils
35 import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils;
36 import org.onap.so.bpmn.common.scripts.VidUtils;
37 import org.onap.so.bpmn.core.UrnPropertiesReader
38 import org.onap.so.bpmn.core.WorkflowException
39 import org.onap.so.bpmn.core.domain.VnfResource
40 import org.onap.so.bpmn.core.json.JsonUtils;
41 import org.onap.so.bpmn.infrastructure.aai.groovyflows.AAICreateResources;
42 import org.onap.so.logger.MessageEnum
43 import org.onap.so.logger.MsoLogger
47 * This class supports the CreateVnfInfra Flow
48 * with the creation of a generic vnf for
51 class CreateVnfInfra extends AbstractServiceTaskProcessor {
53 private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CreateVnfInfra.class);
56 String Prefix="CREVI_"
57 ExceptionUtil exceptionUtil = new ExceptionUtil()
58 JsonUtils jsonUtil = new JsonUtils()
59 VidUtils vidUtils = new VidUtils(this)
60 CatalogDbUtils catalogDbUtils = new CatalogDbUtilsFactory().create()
63 * This method gets and validates the incoming
69 public void preProcessRequest(DelegateExecution execution) {
70 def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
71 execution.setVariable("prefix",Prefix)
72 msoLogger.trace("STARTED CreateVnfInfra PreProcessRequest Process")
74 setBasicDBAuthHeader(execution, isDebugEnabled)
75 execution.setVariable("CREVI_sentSyncResponse", false)
79 String createVnfRequest = execution.getVariable("bpmnRequest")
80 execution.setVariable("CREVI_createVnfRequest", createVnfRequest)
81 msoLogger.debug("Incoming CreateVnfInfra Request is: \n" + createVnfRequest)
83 if(createVnfRequest != null){
85 String requestId = execution.getVariable("mso-request-id")
86 execution.setVariable("CREVI_requestId", requestId)
87 msoLogger.debug("Incoming Request Id is: " + requestId)
89 String serviceInstanceId = execution.getVariable("serviceInstanceId")
90 execution.setVariable("CREVI_serviceInstanceId", serviceInstanceId)
91 msoLogger.debug("Incoming Service Instance Id is: " + serviceInstanceId)
93 String vnfType = execution.getVariable("vnfType")
94 execution.setVariable("CREVI_vnfType", vnfType)
95 msoLogger.debug("Incoming Vnf Type is: " + vnfType)
97 String vnfName = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.requestInfo.instanceName")
98 execution.setVariable("CREVI_vnfName", vnfName)
99 msoLogger.debug("Incoming Vnf Name is: " + vnfName)
101 String serviceId = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.requestInfo.productFamilyId")
102 execution.setVariable("CREVI_serviceId", serviceId)
103 msoLogger.debug("Incoming Service Id is: " + serviceId)
105 String source = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.requestInfo.source")
106 execution.setVariable("CREVI_source", source)
107 msoLogger.debug("Incoming Source is: " + source)
109 String suppressRollback = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.requestInfo.suppressRollback")
110 execution.setVariable("CREVI_suppressRollback", suppressRollback)
111 msoLogger.debug("Incoming Suppress Rollback is: " + suppressRollback)
113 def vnfModelInfo = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.modelInfo")
114 execution.setVariable("CREVI_vnfModelInfo", vnfModelInfo)
116 String modelInvariantId = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.modelInfo.modelInvariantUuid")
117 execution.setVariable("CREVI_modelInvariantId", modelInvariantId)
118 msoLogger.debug("Incoming Invariant Id is: " + modelInvariantId)
120 String modelVersion = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.modelInfo.modelVersion")
121 execution.setVariable("CREVI_modelVersion", modelVersion)
122 msoLogger.debug("Incoming Model Version is: " + modelVersion)
124 def cloudConfiguration = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.cloudConfiguration")
125 execution.setVariable("CREVI_cloudConfiguration", cloudConfiguration)
127 String cloudSiteId = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.cloudConfiguration.lcpCloudRegionId")
128 execution.setVariable("CREVI_cloudSiteId", cloudSiteId)
129 msoLogger.debug("Incoming Cloud Site Id is: " + cloudSiteId)
131 String tenantId = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.cloudConfiguration.tenantId")
132 execution.setVariable("CREVI_tenantId", tenantId)
133 msoLogger.debug("Incoming Tenant Id is: " + tenantId)
135 //For Completion Handler & Fallout Handler
137 """<request-info xmlns="http://org.onap/so/infra/vnf-request/v1">
138 <request-id>${MsoUtils.xmlEscape(requestId)}</request-id>
139 <action>CREATE</action>
140 <source>${MsoUtils.xmlEscape(source)}</source>
143 execution.setVariable("CREVI_requestInfo", requestInfo)
145 //TODO: Orch Status - TBD, will come from SDN-C Response in 1702
146 String orchStatus = "Created"
147 execution.setVariable("CREVI_orchStatus", orchStatus)
149 //TODO: Equipment Role - Should come from SDN-C Response in 1702
150 String equipmentRole = " "
151 execution.setVariable("CREVI_equipmentRole", equipmentRole)
153 String vnfId = execution.getVariable("testVnfId") // for junits
155 vnfId = UUID.randomUUID().toString()
156 msoLogger.debug("Generated Vnf Id is: " + vnfId)
158 execution.setVariable("CREVI_vnfId", vnfId)
160 // Setting for Sub Flow Calls
161 execution.setVariable("CREVI_type", "generic-vnf")
162 execution.setVariable("GENGS_type", "service-instance")
164 String sdncCallbackUrl = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution)
165 if (sdncCallbackUrl == null || sdncCallbackUrl.trim().isEmpty()) {
166 def msg = 'Required variable \'mso.workflow.sdncadapter.callback\' is missing'
167 msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError);
169 exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
171 execution.setVariable("CREVI_sdncCallbackUrl", sdncCallbackUrl)
173 def vnfInputParameters = null
175 vnfInputParameters = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.requestParameters.userParams")
177 catch (Exception e) {
178 msoLogger.debug("userParams are not present in the request")
180 execution.setVariable("CREVI_vnfInputParameters", vnfInputParameters)
183 msoLogger.debug("SDNC Callback URL: " + sdncCallbackUrl)
185 exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Bpmn Request is Null.")
189 msoLogger.debug("Rethrowing MSOWorkflowException")
192 msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Error Occurred in CreateVnfInfra PreProcessRequest method", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e)
193 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occurred in CreateVnfInfra PreProcessRequest")
196 msoLogger.trace("COMPLETED CreateVnfInfra PreProcessRequest Process")
199 public void sendSyncResponse (DelegateExecution execution) {
200 execution.setVariable("prefix",Prefix)
202 msoLogger.trace("STARTED CreateVnfInfra SendSyncResponse Process")
205 String requestId = execution.getVariable("CREVI_requestId")
206 String vnfId = execution.getVariable("CREVI_vnfId")
208 String createVnfResponse = """{"requestReferences":{"instanceId":"${vnfId}","requestId":"${requestId}"}}""".trim()
210 msoLogger.debug("CreateVnfInfra Sync Response is: \n" + createVnfResponse)
212 sendWorkflowResponse(execution, 202, createVnfResponse)
214 execution.setVariable("CREVI_sentSyncResponse", true)
216 } catch (Exception ex) {
217 msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Error Occurred in CreateVnfInfra SendSyncResponse Process", "BPMN", MsoLogger.getServiceName(),
218 MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e)
219 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in CreateVnfInfra SendSyncResponse Process")
222 msoLogger.trace("COMPLETED CreateVnfInfra SendSyncResponse Process")
226 public void preProcessSDNCAssignRequest(DelegateExecution execution){
227 execution.setVariable("prefix", Prefix)
228 msoLogger.trace("STARTED preProcessSDNCAssignRequest")
229 def vnfId = execution.getVariable("CREVI_vnfId")
230 def serviceInstanceId = execution.getVariable("CREVI_serviceInstanceId")
231 msoLogger.debug("NEW VNF ID: " + vnfId)
236 String assignSDNCRequest = buildSDNCRequest(execution, serviceInstanceId, "assign")
238 assignSDNCRequest = utils.formatXml(assignSDNCRequest)
239 execution.setVariable("CREVI_assignSDNCRequest", assignSDNCRequest)
240 msoLogger.debug("Outgoing AssignSDNCRequest is: \n" + assignSDNCRequest)
243 msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occurred Processing preProcessSDNCAssignRequest", "BPMN", MsoLogger.getServiceName(),
244 MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e)
245 exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during prepareProvision Method:\n" + e.getMessage())
247 msoLogger.trace("COMPLETED preProcessSDNCAssignRequest")
250 public void preProcessSDNCActivateRequest(DelegateExecution execution) {
251 def method = getClass().getSimpleName() + '.preProcessSDNCActivateRequest(' +
252 'execution=' + execution.getId() +
254 msoLogger.trace('Entered ' + method)
255 execution.setVariable("prefix", Prefix)
256 msoLogger.trace("STARTED preProcessSDNCActivateRequest Process")
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 msoLogger.debug("Outgoing CommitSDNCRequest is: \n" + activateSDNCRequest)
267 msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing preProcessSDNCActivateRequest", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e)
268 exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessSDNCActivateRequest Method:\n" + e.getMessage())
270 msoLogger.trace("COMPLETED preProcessSDNCActivateRequest Process")
273 public String buildSDNCRequest(DelegateExecution execution, String svcInstId, String action){
275 String uuid = execution.getVariable('testReqId') // for junits
277 uuid = execution.getVariable("mso-request-id") + "-" + System.currentTimeMillis()
279 def callbackURL = execution.getVariable("CREVI_sdncCallbackUrl")
280 def requestId = execution.getVariable("CREVI_requestId")
281 def serviceId = execution.getVariable("CREVI_serviceId")
282 def vnfType = execution.getVariable("CREVI_vnfType")
283 def vnfName = execution.getVariable("CREVI_vnfName")
284 def tenantId = execution.getVariable("CREVI_tenantId")
285 def source = execution.getVariable("CREVI_source")
286 def vnfId = execution.getVariable("CREVI_vnfId")
287 def cloudSiteId = execution.getVariable("CREVI_cloudSiteId")
289 String sdncVNFParamsXml = ""
291 if(execution.getVariable("CREVI_vnfParamsExistFlag") == true){
292 sdncVNFParamsXml = buildSDNCParamsXml(execution)
294 sdncVNFParamsXml = ""
298 """<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.onap/so/request/types/v1"
299 xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"
300 xmlns:sdncadapter="http://org.onap/workflow/sdnc/adapter/schema/v1">
301 <sdncadapter:RequestHeader>
302 <sdncadapter:RequestId>${MsoUtils.xmlEscape(requestId)}</sdncadapter:RequestId>
303 <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(svcInstId)}</sdncadapter:SvcInstanceId>
304 <sdncadapter:SvcAction>${MsoUtils.xmlEscape(action)}</sdncadapter:SvcAction>
305 <sdncadapter:SvcOperation>vnf-topology-operation</sdncadapter:SvcOperation>
306 <sdncadapter:CallbackUrl>${MsoUtils.xmlEscape(callbackURL)}</sdncadapter:CallbackUrl>
307 </sdncadapter:RequestHeader>
308 <sdncadapterworkflow:SDNCRequestData>
309 <request-information>
310 <request-id>${MsoUtils.xmlEscape(requestId)}</request-id>
311 <request-action>VNFActivateRequest</request-action>
312 <source>${MsoUtils.xmlEscape(source)}</source>
314 </request-information>
315 <service-information>
316 <service-id>${MsoUtils.xmlEscape(serviceId)}</service-id>
317 <service-type>${MsoUtils.xmlEscape(serviceId)}</service-type>
318 <service-instance-id>${MsoUtils.xmlEscape(svcInstId)}</service-instance-id>
319 <subscriber-name>notsurewecare</subscriber-name>
320 </service-information>
321 <vnf-request-information>
322 <vnf-id>${MsoUtils.xmlEscape(vnfId)}</vnf-id>
323 <vnf-name>${MsoUtils.xmlEscape(vnfName)}</vnf-name>
324 <vnf-type>${MsoUtils.xmlEscape(vnfType)}</vnf-type>
325 <aic-cloud-region>${MsoUtils.xmlEscape(cloudSiteId)}</aic-cloud-region>
326 <tenant>${MsoUtils.xmlEscape(tenantId)}</tenant>
328 </vnf-request-information>
329 </sdncadapterworkflow:SDNCRequestData>
330 </sdncadapterworkflow:SDNCAdapterWorkflowRequest>"""
332 msoLogger.debug("sdncRequest: " + sdncRequest)
336 public void validateSDNCResponse(DelegateExecution execution, String response, String method){
337 execution.setVariable("prefix",Prefix)
338 msoLogger.debug("STARTED ValidateSDNCResponse Process")
340 WorkflowException workflowException = execution.getVariable("WorkflowException")
341 boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator")
343 msoLogger.debug("workflowException: " + workflowException)
345 SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this)
346 sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator)
348 msoLogger.debug("SDNCResponse: " + response)
350 String sdncResponse = response
351 if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){
352 msoLogger.trace("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + sdncResponse)
355 msoLogger.debug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.")
356 throw new BpmnError("MSOWorkflowException")
358 msoLogger.trace("COMPLETED ValidateSDNCResponse Process")
361 public void prepareCompletionHandlerRequest(DelegateExecution execution){
362 execution.setVariable("prefix",Prefix)
364 msoLogger.trace("STARTED CreateVnfInfra PrepareCompletionHandlerRequest Process")
367 String requestInfo = execution.getVariable("CREVI_requestInfo")
368 String vnfId = execution.getVariable("CREVI_vnfId")
369 requestInfo = utils.removeXmlPreamble(requestInfo)
372 """<aetgt:MsoCompletionRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
373 xmlns:ns="http://org.onap/so/request/types/v1">
375 <status-message>Vnf has been created successfully.</status-message>
376 <vnfId>${MsoUtils.xmlEscape(vnfId)}</vnfId>
377 <mso-bpel-name>CreateVnfInfra</mso-bpel-name>
378 </aetgt:MsoCompletionRequest>"""
380 execution.setVariable("CREVI_completionHandlerRequest", request)
381 msoLogger.debug("Completion Handler Request is: " + request)
383 execution.setVariable("WorkflowResponse", "Success") // for junits
385 } catch (Exception ex) {
386 msoLogger.debug("Error Occured in CreateVnfInfra PrepareCompletionHandlerRequest Process " + ex.getMessage())
387 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in CreateVnfInfra PrepareCompletionHandlerRequest Process")
390 msoLogger.trace("COMPLETED CreateVnfInfra PrepareCompletionHandlerRequest Process")
393 public void sendErrorResponse(DelegateExecution execution){
394 execution.setVariable("prefix",Prefix)
396 msoLogger.trace("STARTED CreateVnfInfra sendErrorResponse Process")
398 def sentSyncResponse = execution.getVariable("CREVI_sentSyncResponse")
399 if(sentSyncResponse == false){
400 WorkflowException wfex = execution.getVariable("WorkflowException")
401 String response = exceptionUtil.buildErrorResponseXml(wfex)
403 msoLogger.debug(response)
404 sendWorkflowResponse(execution, 500, response)
406 msoLogger.debug("Not Sending Error Response. Sync Response Already Sent")
409 } catch (Exception ex) {
410 msoLogger.debug("Error Occured in CreateVnfInfra sendErrorResponse Process " + ex.getMessage())
411 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in CreateVnfInfra sendErrorResponse Process")
414 msoLogger.trace("COMPLETED CreateVnfInfra sendErrorResponse Process")
417 public void prepareFalloutRequest(DelegateExecution execution){
418 execution.setVariable("prefix",Prefix)
420 msoLogger.trace("STARTED CreateVnfInfra prepareFalloutRequest Process")
423 WorkflowException wfex = execution.getVariable("WorkflowException")
424 msoLogger.debug(" Incoming Workflow Exception: " + wfex.toString())
425 String requestInfo = execution.getVariable("CREVI_requestInfo")
426 msoLogger.debug(" Incoming Request Info: " + requestInfo)
428 String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo)
430 execution.setVariable("CREVI_falloutRequest", falloutRequest)
433 } catch (Exception ex) {
434 msoLogger.debug("Error Occured in CreateVnfInfra prepareFalloutRequest Process " + ex.getMessage())
435 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in CreateVnfInfra prepareFalloutRequest Process")
438 msoLogger.trace("COMPLETED CreateVnfInfra prepareFalloutRequest Process")
442 public void queryCatalogDB (DelegateExecution execution) {
443 execution.setVariable("prefix",Prefix)
445 msoLogger.trace("STARTED CreateVnfInfra QueryCatalogDB Process")
448 String vnfModelInfo = execution.getVariable("CREVI_vnfModelInfo")
449 String vnfModelCustomizationUuid = jsonUtil.getJsonValueForKey(vnfModelInfo, "modelCustomizationUuid")
450 msoLogger.debug("querying Catalog DB by vnfModelCustomizationUuid: " + vnfModelCustomizationUuid)
452 JSONArray vnfs = catalogDbUtils.getAllVnfsByVnfModelCustomizationUuid(execution,
453 vnfModelCustomizationUuid, "v2")
454 msoLogger.debug("obtained VNF list: " + vnfs)
457 msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "No matching VNFs in Catalog DB for vnfModelCustomizationUuid=" + vnfModelCustomizationUuid, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
458 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "No matching VNFs in Catalog DB for vnfModelCustomizationUuid=" + vnfModelCustomizationUuid)
461 // Only one match here
462 JSONObject vnf = vnfs.get(0)
465 msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "No matching VNF in Catalog DB for vnfModelCustomizationUuid=" + vnfModelCustomizationUuid, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
466 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "No matching VNF in Catalog DB for vnfModelCustomizationUuid=" + vnfModelCustomizationUuid)
469 VnfResource vnfResource = new VnfResource()
470 String nfType = jsonUtil.getJsonValueForKey(vnf, "nfType")
471 vnfResource.setNfType(nfType)
472 String nfRole = jsonUtil.getJsonValueForKey(vnf, "nfRole")
473 vnfResource.setNfRole(nfRole)
474 String nfFunction = jsonUtil.getJsonValueForKey(vnf, "nfFunction")
475 vnfResource.setNfFunction(nfFunction)
476 String nfNamingCode = jsonUtil.getJsonValueForKey(vnf, "nfNamingCode")
477 vnfResource.setNfNamingCode(nfNamingCode)
479 execution.setVariable("CREVI_vnfResourceDecomposition", vnfResource)
481 }catch(BpmnError e) {
483 }catch(Exception ex) {
484 msoLogger.debug("Error Occurred in CreateVnfInfra QueryCatalogDB Process " + ex.getMessage())
485 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occurred in CreateVnfInfra QueryCatalogDB Process")
489 msoLogger.trace("COMPLETED CreateVnfInfra QueryCatalogDb Process")
491 public void createPlatform (DelegateExecution execution) {
492 msoLogger.trace("START createPlatform")
494 String request = execution.getVariable("bpmnRequest")
495 String platformName = jsonUtil.getJsonValue(request, "requestDetails.platform.platformName")
496 String vnfId = execution.getVariable("CREVI_vnfId")
498 msoLogger.debug("Platform NAME: " + platformName)
499 msoLogger.debug("VnfID: " + vnfId)
501 if(platformName == null||platformName.equals("")){
502 String msg = "Exception in createPlatform. platformName was not found in the request.";
504 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
506 msoLogger.debug("platformName was found.")
508 AAICreateResources aaiCR = new AAICreateResources()
509 aaiCR.createAAIPlatform(platformName, vnfId)
510 }catch(Exception ex){
511 String msg = "Exception in createPlatform. " + ex.getMessage();
513 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
516 msoLogger.trace("Exit createPlatform")
518 public void createLineOfBusiness (DelegateExecution execution) {
519 msoLogger.trace("START createLineOfBusiness")
521 String request = execution.getVariable("bpmnRequest")
522 String lineOfBusiness = jsonUtil.getJsonValue(request, "requestDetails.lineOfBusiness.lineOfBusinessName")
523 String vnfId = execution.getVariable("CREVI_vnfId")
525 msoLogger.debug("LineOfBusiness NAME: " + lineOfBusiness)
526 msoLogger.debug("VnfID: " + vnfId)
528 if(lineOfBusiness == null || lineOfBusiness.equals("")){
529 msoLogger.debug("LineOfBusiness was not found. Continuing on with flow...")
531 msoLogger.debug("LineOfBusiness was found.")
533 AAICreateResources aaiCR = new AAICreateResources()
534 aaiCR.createAAILineOfBusiness(lineOfBusiness, vnfId)
535 }catch(Exception ex){
536 String msg = "Exception in LineOfBusiness. " + ex.getMessage();
537 msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + ex)
538 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
541 msoLogger.trace("Exit createLineOfBusiness")