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 javax.ws.rs.NotFoundException
26 import org.camunda.bpm.engine.delegate.BpmnError
27 import org.camunda.bpm.engine.delegate.DelegateExecution
28 import org.onap.aai.domain.yang.GenericVnf
29 import org.onap.aai.domain.yang.VolumeGroup
30 import org.onap.aai.domain.yang.VolumeGroups
31 import org.onap.aaiclient.client.aai.AAIObjectType
32 import org.onap.aaiclient.client.aai.AAIResourcesClient
33 import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
34 import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
35 import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder
36 import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types
37 import org.onap.so.bpmn.common.scripts.AaiUtil
38 import org.onap.so.bpmn.common.scripts.ExceptionUtil
39 import org.onap.so.bpmn.common.scripts.MsoUtils
40 import org.onap.so.bpmn.common.scripts.VfModuleBase
41 import org.onap.so.bpmn.core.RollbackData
42 import org.onap.so.bpmn.core.UrnPropertiesReader
43 import org.onap.so.bpmn.core.WorkflowException
44 import org.onap.so.bpmn.core.json.JsonUtils
45 import org.onap.so.constants.Defaults
46 import org.onap.so.db.catalog.beans.OrchestrationStatus
47 import org.slf4j.Logger
48 import org.slf4j.LoggerFactory
50 class DoCreateVfModuleVolumeV2 extends VfModuleBase {
52 private static final Logger logger = LoggerFactory.getLogger( DoCreateVfModuleVolumeV2.class);
53 String prefix='DCVFMODVOLV2_'
54 JsonUtils jsonUtil = new JsonUtils()
55 private ExceptionUtil exceptionUtil = new ExceptionUtil()
59 * Perform initial processing, such as request validation, initialization of variables, etc.
62 public void preProcessRequest(DelegateExecution execution) {
63 def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
64 preProcessRequest(execution, isDebugEnabled)
67 public void preProcessRequest(DelegateExecution execution, isDebugLogEnabled) {
69 execution.setVariable("prefix",prefix)
70 execution.setVariable(prefix+'SuccessIndicator', false)
71 execution.setVariable(prefix+'isPONR', false)
73 displayInput(execution, isDebugLogEnabled)
74 setRollbackData(execution, isDebugLogEnabled)
75 setRollbackEnabled(execution, isDebugLogEnabled)
78 def tenantId = execution.getVariable("tenantId")
79 if (tenantId == null) {
80 String cloudConfiguration = execution.getVariable("cloudConfiguration")
81 tenantId = jsonUtil.getJsonValue(cloudConfiguration, "cloudConfiguration.tenantId")
82 execution.setVariable("tenantId", tenantId)
85 def cloudSiteId = execution.getVariable("lcpCloudRegionId")
86 if (cloudSiteId == null) {
87 String cloudConfiguration = execution.getVariable("cloudConfiguration")
88 cloudSiteId = jsonUtil.getJsonValue(cloudConfiguration, "cloudConfiguration.lcpCloudRegionId")
89 def cloudOwner = jsonUtil.getJsonValue(cloudConfiguration, "cloudConfiguration.cloudOwner")
90 execution.setVariable("lcpCloudRegionId", cloudSiteId)
91 execution.setVariable("cloudOwner", cloudOwner)
94 // Extract attributes from modelInfo
95 String vfModuleModelInfo = execution.getVariable("vfModuleModelInfo")
97 //modelCustomizationUuid
98 def modelCustomizationUuid = jsonUtil.getJsonValue(vfModuleModelInfo, "modelCustomizationUuid")
99 execution.setVariable("modelCustomizationId", modelCustomizationUuid)
100 logger.debug("modelCustomizationId: " + modelCustomizationUuid)
103 def modelName = jsonUtil.getJsonValue(vfModuleModelInfo, "modelName")
104 execution.setVariable("modelName", modelName)
105 logger.debug("modelName: " + modelName)
107 // The following is used on the get Generic Service Instance call
108 execution.setVariable('GENGS_type', 'service-instance')
113 * Display input variables
115 * @param isDebugLogEnabled
117 public void displayInput(DelegateExecution execution, isDebugLogEnabled) {
118 def input = ['mso-request-id', 'msoRequestId', 'isDebugLogEnabled', 'disableRollback', 'failIfExists', 'serviceInstanceId', 'vnfId', 'vnfName', 'tenantId', 'volumeGroupId', 'volumeGroupName', 'lcpCloudRegionId', 'vnfType', 'vfModuleModelInfo', 'asdcServiceModelVersion', 'test-volume-group-name', 'test-volume-group-id', 'vfModuleInputParams']
120 logger.debug('Begin input: ')
122 logger.debug(it + ': ' + execution.getVariable(it))
124 logger.debug('End input.')
129 * Define and set rollbackdata object
131 * @param isDebugEnabled
133 public void setRollbackData(DelegateExecution execution, isDebugEnabled) {
134 def rollbackData = execution.getVariable("rollbackData")
135 if (rollbackData == null) {
136 rollbackData = new RollbackData()
138 def volumeGroupName = execution.getVariable('volumeGroupName')
139 rollbackData.put("DCVFMODULEVOL", "volumeGroupName", volumeGroupName)
140 execution.setVariable("rollbackData", rollbackData)
145 * Gets the service instance uri from aai
147 public void getServiceInstance(DelegateExecution execution) {
149 String serviceInstanceId = execution.getVariable('serviceInstanceId')
151 AAIResourcesClient resourceClient = new AAIResourcesClient()
152 AAIResourceUri uri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId))
154 if(!resourceClient.exists(uri)){
155 (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 2500, "Service instance was not found in aai")
157 }catch(BpmnError e) {
159 }catch (Exception ex){
160 String msg = "Exception in getServiceInstance. " + ex.getMessage()
162 (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 2500, msg)
169 * @param isDebugEnabled
171 public void callRESTQueryAAICloudRegion (DelegateExecution execution, isDebugEnabled) {
173 def cloudRegion = execution.getVariable("lcpCloudRegionId")
174 logger.debug('Request cloud region is: ' + cloudRegion)
176 AaiUtil aaiUtil = new AaiUtil(this)
178 AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(Defaults.CLOUD_OWNER.toString(), cloudRegion))
179 def queryCloudRegionRequest = aaiUtil.createAaiUri(uri)
181 cloudRegion = aaiUtil.getAAICloudReqion(execution, queryCloudRegionRequest, "PO", cloudRegion)
183 def aaiCloudRegion = aaiUtil.getAAICloudReqion(execution, queryCloudRegionRequest, "AAI", cloudRegion)
184 if ((aaiCloudRegion != "ERROR")) {
185 execution.setVariable("lcpCloudRegionId", aaiCloudRegion)
186 logger.debug("AIC Cloud Region for AAI: " + aaiCloudRegion)
188 String errorMessage = "AAI Query Cloud Region Unsuccessful. Return Code: " + execution.getVariable(prefix+"queryCloudRegionReturnCode")
189 logger.debug(errorMessage)
190 (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 2500, errorMessage)
193 def poCloudRegion = aaiUtil.getAAICloudReqion(execution, queryCloudRegionRequest, "PO", cloudRegion)
194 if ((poCloudRegion != "ERROR")) {
195 execution.setVariable("poLcpCloudRegionId", poCloudRegion)
196 logger.debug("AIC Cloud Region for PO: " + poCloudRegion)
198 String errorMessage = "AAI Query Cloud Region Unsuccessful. Return Code: " + execution.getVariable(prefix+"queryCloudRegionReturnCode")
199 logger.debug(errorMessage)
200 (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 2500, errorMessage)
203 def rollbackData = execution.getVariable("rollbackData")
204 rollbackData.put("DCVFMODULEVOL", "aiccloudregion", cloudRegion)
209 * Query AAI volume group by name
211 * @param isDebugEnabled
213 public void callRESTQueryAAIVolGrpName(DelegateExecution execution, isDebugEnabled) {
215 def volumeGroupName = execution.getVariable('volumeGroupName')
216 def cloudRegion = execution.getVariable('lcpCloudRegionId')
219 AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(Defaults.CLOUD_OWNER.toString(), cloudRegion).volumeGroups()).queryParam("volume-group-name", volumeGroupName)
220 Optional<VolumeGroups> volumeGroups = getAAIClient().get(VolumeGroups.class,uri)
221 if(volumeGroups.isPresent()){
222 VolumeGroup volumeGroup = volumeGroups.get().getVolumeGroup().get(0);
223 execution.setVariable(prefix+'AaiReturnCode', 200)
224 execution.setVariable("queriedVolumeGroupId",volumeGroup.getVolumeGroupId())
225 logger.debug("Volume Group Name $volumeGroupName exists in AAI.")
227 execution.setVariable(prefix+'AaiReturnCode', 404)
228 exceptionUtil.buildAndThrowWorkflowException(execution,25000, "Volume Group Name $volumeGroupName does not exist in AAI.")
230 }catch(BpmnError error){
233 execution.setVariable(prefix+'AaiReturnCode', 500)
234 exceptionUtil.buildAndThrowWorkflowException(execution,25000, "Exception in get volume group by name: " + e.getMessage())
240 * Create a WorkflowException
242 * @param isDebugEnabled
244 public void buildWorkflowException(DelegateExecution execution, int errorCode, errorMessage) {
245 logger.debug(errorMessage)
246 (new ExceptionUtil()).buildWorkflowException(execution, 2500, errorMessage)
251 * Create a WorkflowException
253 * @param isDebugEnabled
255 public void handleError(DelegateExecution execution, isDebugEnabled) {
256 WorkflowException we = execution.getVariable('WorkflowException')
258 (new ExceptionUtil()).buildWorkflowException(execution, 2500, "Enexpected error encountered!")
260 throw new BpmnError("MSOWorkflowException")
265 * Create volume group in AAI
267 * @param isDebugEnabled
269 public void callRESTCreateAAIVolGrpName(DelegateExecution execution, isDebugEnabled) {
271 def vnfId = execution.getVariable('vnfId')
272 def volumeGroupId = execution.getVariable('volumeGroupId')
273 def volumeName = execution.getVariable("volumeGroupName")
274 def modelCustomizationId = execution.getVariable("modelCustomizationId")
275 def vnfType = execution.getVariable("vnfType")
276 def tenantId = execution.getVariable("tenantId")
277 def cloudRegion = execution.getVariable('lcpCloudRegionId')
278 def cloudOwner = execution.getVariable('cloudOwner')
280 def testGroupId = execution.getVariable('test-volume-group-id')
281 if (testGroupId != null && testGroupId.trim() != '') {
282 logger.debug("test volumeGroupId is present: " + testGroupId)
283 volumeGroupId = testGroupId
284 execution.setVariable("test-volume-group-name", "MSOTESTVOL101a-vSAMP12_base_vol_module-0")
287 VolumeGroup volumeGroup = new VolumeGroup()
288 volumeGroup.setVolumeGroupId(volumeGroupId)
289 volumeGroup.setVolumeGroupName(volumeName)
290 volumeGroup.setVnfType(vnfType)
291 volumeGroup.setOrchestrationStatus(OrchestrationStatus.PENDING.toString())
292 volumeGroup.setModelCustomizationId(modelCustomizationId)
294 logger.debug("volumeGroupId to be used: " + volumeGroupId)
296 AAIResourceUri volumeGroupUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(cloudOwner, cloudRegion).volumeGroup(volumeGroupId))
297 AAIResourceUri tenantUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(cloudOwner, cloudRegion).tenant(tenantId))
298 AAIResourceUri vnfUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId))
300 getAAIClient().create(volumeGroupUri, volumeGroup)
301 getAAIClient().connect(volumeGroupUri, vnfUri)
302 getAAIClient().connect(volumeGroupUri, tenantUri)
303 execution.setVariable("queriedVolumeGroupId", volumeGroupId)
304 RollbackData rollbackData = execution.getVariable("rollbackData")
305 rollbackData.put("DCVFMODULEVOL", "isAAIRollbackNeeded", "true")
306 } catch (NotFoundException ignored) {
307 execution.setVariable(prefix + "isErrorMessageException", true)
308 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Unable to create volume group in AAI. Response code: 404")
309 } catch (Exception ex) {
310 execution.setVariable(prefix + "isErrorMessageException", true)
311 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, ex.getMessage())
316 * Prepare VNF adapter create request XML
319 public void prepareVnfAdapterCreateRequest(DelegateExecution execution, isDebugEnabled) {
321 GenericVnf aaiGenericVnfResponse = execution.getVariable(prefix+'AAIQueryGenericVfnResponse')
322 def vnfId = aaiGenericVnfResponse.getVnfId()
323 def vnfName = aaiGenericVnfResponse.getVnfName()
324 def vnfType = aaiGenericVnfResponse.getVnfType()
326 def requestId = execution.getVariable('msoRequestId')
327 def serviceId = execution.getVariable('serviceInstanceId')
328 def cloudSiteId = execution.getVariable('poLcpCloudRegionId')
329 def tenantId = execution.getVariable('tenantId')
330 def volumeGroupId = execution.getVariable('volumeGroupId')
331 def volumeGroupnName = execution.getVariable('volumeGroupName')
333 def vnfVersion = execution.getVariable("asdcServiceModelVersion")
334 def vnfModuleType = execution.getVariable("modelName")
336 def modelCustomizationId = execution.getVariable("modelCustomizationId")
339 logger.debug("volumeGroupId: " + volumeGroupId)
340 def testGroupId = execution.getVariable('test-volume-group-id')
341 if (testGroupId != null && testGroupId.trim() != '') {
342 logger.debug("test volumeGroupId is present: " + testGroupId)
343 volumeGroupId = testGroupId
344 execution.setVariable("test-volume-group-name", "MSOTESTVOL101a-vSAMP12_base_vol_module-0")
346 logger.debug("volumeGroupId to be used: " + volumeGroupId)
348 // volume group parameters
350 String volumeGroupParams = ''
351 StringBuilder sbParams = new StringBuilder()
352 Map<String, String> paramsMap = execution.getVariable("vfModuleInputParams")
353 for (Map.Entry<String, String> entry : paramsMap.entrySet()) {
355 String paramName = entry.getKey()
356 String paramValue = entry.getValue()
359 <key>${MsoUtils.xmlEscape(paramName)}</key>
360 <value>${MsoUtils.xmlEscape(paramValue)}</value>
363 sbParams.append(paramsXml)
366 volumeGroupParams = sbParams.toString()
367 logger.debug("volumeGroupParams: "+ volumeGroupParams)
369 def backoutOnFailure = execution.getVariable(prefix+"backoutOnFailure")
370 logger.debug("backoutOnFailure: "+ backoutOnFailure)
372 def failIfExists = execution.getVariable("failIfExists")
373 if(failIfExists == null) {
374 failIfExists = 'true'
377 String messageId = UUID.randomUUID()
378 logger.debug("messageId to be used is generated: " + messageId)
380 def notificationUrl = createCallbackURL(execution, "VNFAResponse", messageId)
381 def useQualifiedHostName = UrnPropertiesReader.getVariable("mso.use.qualified.host",execution)
382 if ('true'.equals(useQualifiedHostName)) {
383 notificationUrl = utils.getQualifiedHostNameForCallback(notificationUrl)
385 logger.debug("CreateVfModuleVolume - notificationUrl: "+ notificationUrl)
388 String vnfSubCreateWorkflowRequest =
390 <createVolumeGroupRequest>
391 <cloudSiteId>${MsoUtils.xmlEscape(cloudSiteId)}</cloudSiteId>
392 <tenantId>${MsoUtils.xmlEscape(tenantId)}</tenantId>
393 <vnfId>${MsoUtils.xmlEscape(vnfId)}</vnfId>
394 <vnfName>${MsoUtils.xmlEscape(vnfName)}</vnfName>
395 <volumeGroupId>${MsoUtils.xmlEscape(volumeGroupId)}</volumeGroupId>
396 <volumeGroupName>${MsoUtils.xmlEscape(volumeGroupnName)}</volumeGroupName>
397 <vnfType>${MsoUtils.xmlEscape(vnfType)}</vnfType>
398 <vnfVersion>${MsoUtils.xmlEscape(vnfVersion)}</vnfVersion>
399 <vfModuleType>${MsoUtils.xmlEscape(vnfModuleType)}</vfModuleType>
400 <modelCustomizationUuid>${MsoUtils.xmlEscape(modelCustomizationId)}</modelCustomizationUuid>
404 <value>${MsoUtils.xmlEscape(vnfId)}</value>
408 <value>${MsoUtils.xmlEscape(vnfName)}</value>
411 <key>vf_module_id</key>
412 <value>${MsoUtils.xmlEscape(volumeGroupId)}</value>
415 <key>vf_module_name</key>
416 <value>${MsoUtils.xmlEscape(volumeGroupnName)}</value>
420 <skipAAI>true</skipAAI>
421 <backout>${MsoUtils.xmlEscape(backoutOnFailure)}</backout>
422 <failIfExists>${MsoUtils.xmlEscape(failIfExists)}</failIfExists>
424 <requestId>${MsoUtils.xmlEscape(requestId)}</requestId>
425 <serviceInstanceId>${MsoUtils.xmlEscape(serviceId)}</serviceInstanceId>
427 <messageId>${MsoUtils.xmlEscape(messageId)}</messageId>
428 <notificationUrl>${MsoUtils.xmlEscape(notificationUrl)}</notificationUrl>
429 </createVolumeGroupRequest>
432 String vnfSubCreateWorkflowRequestAsString = utils.formatXml(vnfSubCreateWorkflowRequest)
433 logger.debug(vnfSubCreateWorkflowRequestAsString)
434 logger.debug(vnfSubCreateWorkflowRequestAsString)
435 execution.setVariable(prefix+"createVnfARequest", vnfSubCreateWorkflowRequestAsString)
437 // build rollback request for use later if needed
438 String vnfSubRollbackWorkflowRequest = buildRollbackVolumeGroupRequestXml(volumeGroupId, cloudSiteId, tenantId, requestId, serviceId, messageId, notificationUrl)
440 logger.debug("Sub Vnf flow rollback request: vnfSubRollbackWorkflowRequest " + "\n" + vnfSubRollbackWorkflowRequest)
442 String vnfSubRollbackWorkflowRequestAsString = utils.formatXml(vnfSubRollbackWorkflowRequest)
443 execution.setVariable(prefix+"rollbackVnfARequest", vnfSubRollbackWorkflowRequestAsString)
446 public String buildRollbackVolumeGroupRequestXml(volumeGroupId, cloudSiteId, tenantId, requestId, serviceId, messageId, notificationUrl) {
449 <rollbackVolumeGroupRequest>
450 <volumeGroupRollback>
451 <volumeGroupId>${MsoUtils.xmlEscape(volumeGroupId)}</volumeGroupId>
452 <volumeGroupStackId>{{VOLUMEGROUPSTACKID}}</volumeGroupStackId>
453 <tenantId>${MsoUtils.xmlEscape(tenantId)}</tenantId>
454 <cloudSiteId>${MsoUtils.xmlEscape(cloudSiteId)}</cloudSiteId>
455 <volumeGroupCreated>true</volumeGroupCreated>
457 <requestId>${MsoUtils.xmlEscape(requestId)}</requestId>
458 <serviceInstanceId>${MsoUtils.xmlEscape(serviceId)}</serviceInstanceId>
460 <messageId>${MsoUtils.xmlEscape(messageId)}</messageId>
461 </volumeGroupRollback>
462 <skipAAI>true</skipAAI>
463 <notificationUrl>${MsoUtils.xmlEscape(notificationUrl)}</notificationUrl>
464 </rollbackVolumeGroupRequest>
470 public String updateRollbackVolumeGroupRequestXml(String rollabackRequest, String heatStackId) {
471 String newRequest = rollabackRequest.replace("{{VOLUMEGROUPSTACKID}}", heatStackId)
476 * Validate VNF adapter response
479 public void validateVnfResponse(DelegateExecution execution, isDebugEnabled) {
480 def vnfSuccess = execution.getVariable('VNFREST_SuccessIndicator')
481 logger.debug("vnfAdapterSuccessIndicator: "+ vnfSuccess)
482 if(vnfSuccess==true) {
483 String createVnfAResponse = execution.getVariable(prefix+"createVnfAResponse")
484 String heatStackID = utils.getNodeText(createVnfAResponse, "volumeGroupStackId")
485 String vnfRollbackRequest = execution.getVariable(prefix+"rollbackVnfARequest")
486 String updatedVnfRollbackRequest = updateRollbackVolumeGroupRequestXml(vnfRollbackRequest, heatStackID)
487 logger.debug("vnfAdapter rollback request: "+ updatedVnfRollbackRequest)
488 RollbackData rollbackData = execution.getVariable("rollbackData")
489 rollbackData.put("DCVFMODULEVOL", "rollbackVnfARequest", updatedVnfRollbackRequest)
490 rollbackData.put("DCVFMODULEVOL", "isCreateVnfRollbackNeeded", "true")
496 * Update voulume group in AAI
497 * @TODO: Can we re-use the create method??
499 * @param isDebugEnabled
501 public void callRESTUpdateCreatedVolGrpName(DelegateExecution execution, isDebugEnabled) {
502 String volumeGroupId = execution.getVariable("queriedVolumeGroupId")
503 String modelCustomizationId = execution.getVariable("modelCustomizationId")
504 String cloudRegion = execution.getVariable("lcpCloudRegionId")
505 String cloudOwner = execution.getVariable('cloudOwner')
506 String createVnfAResponse = execution.getVariable(prefix+"createVnfAResponse")
507 def heatStackID = utils.getNodeText(createVnfAResponse, "volumeGroupStackId")
508 AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(cloudOwner, cloudRegion).volumeGroup(volumeGroupId))
510 execution.setVariable(prefix+"heatStackId", heatStackID)
512 VolumeGroup volumeGroup = new VolumeGroup()
513 volumeGroup.setHeatStackId(heatStackID)
514 volumeGroup.setModelCustomizationId(modelCustomizationId)
516 getAAIClient().update(uri, volumeGroup)
517 execution.setVariable(prefix+"isPONR", true)
518 }catch(NotFoundException ignored){
519 execution.setVariable(prefix+"isErrorMessageException", true)
520 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Unable to update volume group in AAI. Response code: 404")
521 }catch(BpmnError error){
524 execution.setVariable(prefix+"isErrorMessageException", true)
525 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "AAI Adapter Query Failed. "+ e.getMessage())
531 * Query AAI Generic VNF
533 * @param isDebugEnabled
535 public void callRESTQueryAAIGenericVnf(DelegateExecution execution, isDebugEnabled) {
537 def vnfId = execution.getVariable('vnfId')
538 AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId))
540 Optional<GenericVnf> genericVnf = getAAIClient().get(GenericVnf.class, uri)
541 if (genericVnf.isPresent()) {
542 execution.setVariable(prefix + 'AAIQueryGenericVfnResponse', genericVnf.get())
544 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, 'Generic vnf ' + vnfId + ' was not found in AAI. Return code: 404.')
547 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Exception in get generic VNF: " + e.getMessage())