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.so.bpmn.common.scripts.AaiUtil
 
  32 import org.onap.so.bpmn.common.scripts.ExceptionUtil
 
  33 import org.onap.so.bpmn.common.scripts.MsoUtils
 
  34 import org.onap.so.bpmn.common.scripts.VfModuleBase
 
  35 import org.onap.so.bpmn.core.RollbackData
 
  36 import org.onap.so.bpmn.core.UrnPropertiesReader
 
  37 import org.onap.so.bpmn.core.WorkflowException
 
  38 import org.onap.so.bpmn.core.json.JsonUtils
 
  39 import org.onap.aaiclient.client.aai.AAIObjectPlurals
 
  40 import org.onap.aaiclient.client.aai.AAIObjectType
 
  41 import org.onap.aaiclient.client.aai.AAIResourcesClient
 
  42 import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
 
  43 import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
 
  44 import org.onap.so.constants.Defaults
 
  45 import org.onap.so.db.catalog.beans.OrchestrationStatus
 
  46 import org.slf4j.Logger
 
  47 import org.slf4j.LoggerFactory
 
  49 class DoCreateVfModuleVolumeV2 extends VfModuleBase {
 
  51     private static final Logger logger = LoggerFactory.getLogger( DoCreateVfModuleVolumeV2.class);
 
  52     String prefix='DCVFMODVOLV2_'
 
  53     JsonUtils jsonUtil = new JsonUtils()
 
  54     private ExceptionUtil exceptionUtil = new ExceptionUtil()
 
  58      * Perform initial processing, such as request validation, initialization of variables, etc.
 
  61     public void preProcessRequest(DelegateExecution execution) {
 
  62         def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
 
  63         preProcessRequest(execution, isDebugEnabled)
 
  66     public void preProcessRequest(DelegateExecution execution, isDebugLogEnabled) {
 
  68         execution.setVariable("prefix",prefix)
 
  69         execution.setVariable(prefix+'SuccessIndicator', false)
 
  70         execution.setVariable(prefix+'isPONR', false)
 
  72         displayInput(execution, isDebugLogEnabled)
 
  73         setRollbackData(execution, isDebugLogEnabled)
 
  74         setRollbackEnabled(execution, isDebugLogEnabled)
 
  77         def tenantId = execution.getVariable("tenantId")
 
  78         if (tenantId == null) {
 
  79             String cloudConfiguration = execution.getVariable("cloudConfiguration")
 
  80             tenantId = jsonUtil.getJsonValue(cloudConfiguration, "cloudConfiguration.tenantId")
 
  81             execution.setVariable("tenantId", tenantId)
 
  84         def cloudSiteId = execution.getVariable("lcpCloudRegionId")
 
  85         if (cloudSiteId == null) {
 
  86             String cloudConfiguration = execution.getVariable("cloudConfiguration")
 
  87             cloudSiteId = jsonUtil.getJsonValue(cloudConfiguration, "cloudConfiguration.lcpCloudRegionId")
 
  88             def cloudOwner = jsonUtil.getJsonValue(cloudConfiguration, "cloudConfiguration.cloudOwner")
 
  89             execution.setVariable("lcpCloudRegionId", cloudSiteId)
 
  90             execution.setVariable("cloudOwner", cloudOwner)
 
  93         // Extract attributes from modelInfo
 
  94         String vfModuleModelInfo = execution.getVariable("vfModuleModelInfo")
 
  96         //modelCustomizationUuid
 
  97         def modelCustomizationUuid = jsonUtil.getJsonValue(vfModuleModelInfo, "modelCustomizationUuid")
 
  98         execution.setVariable("modelCustomizationId", modelCustomizationUuid)
 
  99         logger.debug("modelCustomizationId: " + modelCustomizationUuid)
 
 102         def modelName = jsonUtil.getJsonValue(vfModuleModelInfo, "modelName")
 
 103         execution.setVariable("modelName", modelName)
 
 104         logger.debug("modelName: " + modelName)
 
 106         // The following is used on the get Generic Service Instance call
 
 107         execution.setVariable('GENGS_type', 'service-instance')
 
 112      * Display input variables
 
 114      * @param isDebugLogEnabled
 
 116     public void displayInput(DelegateExecution execution, isDebugLogEnabled) {
 
 117         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']
 
 119         logger.debug('Begin input: ')
 
 121             logger.debug(it + ': ' + execution.getVariable(it))
 
 123         logger.debug('End input.')
 
 128      * Define and set rollbackdata object
 
 130      * @param isDebugEnabled
 
 132     public void setRollbackData(DelegateExecution execution, isDebugEnabled) {
 
 133         def rollbackData = execution.getVariable("rollbackData")
 
 134         if (rollbackData == null) {
 
 135             rollbackData = new RollbackData()
 
 137         def volumeGroupName = execution.getVariable('volumeGroupName')
 
 138         rollbackData.put("DCVFMODULEVOL", "volumeGroupName", volumeGroupName)
 
 139         execution.setVariable("rollbackData", rollbackData)
 
 144      * Gets the service instance uri from aai
 
 146     public void getServiceInstance(DelegateExecution execution) {
 
 148             String serviceInstanceId = execution.getVariable('serviceInstanceId')
 
 150             AAIResourcesClient resourceClient = new AAIResourcesClient()
 
 151             AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId)
 
 153             if(!resourceClient.exists(uri)){
 
 154                 (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 2500, "Service instance was not found in aai")
 
 156         }catch(BpmnError e) {
 
 158         }catch (Exception ex){
 
 159             String msg = "Exception in getServiceInstance. " + ex.getMessage()
 
 161             (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 2500, msg)
 
 168      * @param isDebugEnabled
 
 170     public void callRESTQueryAAICloudRegion (DelegateExecution execution, isDebugEnabled) {
 
 172         def cloudRegion = execution.getVariable("lcpCloudRegionId")
 
 173         logger.debug('Request cloud region is: ' + cloudRegion)
 
 175         AaiUtil aaiUtil = new AaiUtil(this)
 
 177         AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, Defaults.CLOUD_OWNER.toString(), cloudRegion)
 
 178         def queryCloudRegionRequest = aaiUtil.createAaiUri(uri)
 
 180         cloudRegion = aaiUtil.getAAICloudReqion(execution,  queryCloudRegionRequest, "PO", cloudRegion)
 
 182         def aaiCloudRegion = aaiUtil.getAAICloudReqion(execution,  queryCloudRegionRequest, "AAI", cloudRegion)
 
 183         if ((aaiCloudRegion != "ERROR")) {
 
 184             execution.setVariable("lcpCloudRegionId", aaiCloudRegion)
 
 185             logger.debug("AIC Cloud Region for AAI: " + aaiCloudRegion)
 
 187             String errorMessage = "AAI Query Cloud Region Unsuccessful. Return Code: " + execution.getVariable(prefix+"queryCloudRegionReturnCode")
 
 188             logger.debug(errorMessage)
 
 189             (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 2500, errorMessage)
 
 192         def poCloudRegion = aaiUtil.getAAICloudReqion(execution,  queryCloudRegionRequest, "PO", cloudRegion)
 
 193         if ((poCloudRegion != "ERROR")) {
 
 194             execution.setVariable("poLcpCloudRegionId", poCloudRegion)
 
 195             logger.debug("AIC Cloud Region for PO: " + poCloudRegion)
 
 197             String errorMessage = "AAI Query Cloud Region Unsuccessful. Return Code: " + execution.getVariable(prefix+"queryCloudRegionReturnCode")
 
 198             logger.debug(errorMessage)
 
 199             (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 2500, errorMessage)
 
 202         def rollbackData = execution.getVariable("rollbackData")
 
 203         rollbackData.put("DCVFMODULEVOL", "aiccloudregion", cloudRegion)
 
 208      * Query AAI volume group by name
 
 210      * @param isDebugEnabled
 
 212     public void callRESTQueryAAIVolGrpName(DelegateExecution execution, isDebugEnabled) {
 
 214         def volumeGroupName = execution.getVariable('volumeGroupName')
 
 215         def cloudRegion = execution.getVariable('lcpCloudRegionId')
 
 218             AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VOLUME_GROUP, Defaults.CLOUD_OWNER.toString(), cloudRegion).queryParam("volume-group-name", volumeGroupName)
 
 219             Optional<VolumeGroups> volumeGroups = getAAIClient().get(VolumeGroups.class,uri)
 
 220             if(volumeGroups.isPresent()){
 
 221                 VolumeGroup volumeGroup = volumeGroups.get().getVolumeGroup().get(0);
 
 222                 execution.setVariable(prefix+'AaiReturnCode', 200)
 
 223                 execution.setVariable("queriedVolumeGroupId",volumeGroup.getVolumeGroupId())
 
 224                 logger.debug("Volume Group Name $volumeGroupName exists in AAI.")
 
 226                 execution.setVariable(prefix+'AaiReturnCode', 404)
 
 227                 exceptionUtil.buildAndThrowWorkflowException(execution,25000, "Volume Group Name $volumeGroupName does not exist in AAI.")
 
 229         }catch(BpmnError error){
 
 232             execution.setVariable(prefix+'AaiReturnCode', 500)
 
 233             exceptionUtil.buildAndThrowWorkflowException(execution,25000, "Exception in get volume group by name: " + e.getMessage())
 
 239      * Create a WorkflowException
 
 241      * @param isDebugEnabled
 
 243     public void buildWorkflowException(DelegateExecution execution, int errorCode, errorMessage) {
 
 244         logger.debug(errorMessage)
 
 245         (new ExceptionUtil()).buildWorkflowException(execution, 2500, errorMessage)
 
 250      * Create a WorkflowException
 
 252      * @param isDebugEnabled
 
 254     public void handleError(DelegateExecution execution, isDebugEnabled) {
 
 255         WorkflowException we = execution.getVariable('WorkflowException')
 
 257             (new ExceptionUtil()).buildWorkflowException(execution, 2500, "Enexpected error encountered!")
 
 259         throw new BpmnError("MSOWorkflowException")
 
 264      * Create volume group in AAI
 
 266      * @param isDebugEnabled
 
 268     public void callRESTCreateAAIVolGrpName(DelegateExecution execution, isDebugEnabled) {
 
 270         def vnfId = execution.getVariable('vnfId')
 
 271         def volumeGroupId = execution.getVariable('volumeGroupId')
 
 272         def volumeName = execution.getVariable("volumeGroupName")
 
 273         def modelCustomizationId = execution.getVariable("modelCustomizationId")
 
 274         def vnfType = execution.getVariable("vnfType")
 
 275         def tenantId = execution.getVariable("tenantId")
 
 276         def cloudRegion = execution.getVariable('lcpCloudRegionId')
 
 277         def cloudOwner = execution.getVariable('cloudOwner')
 
 279         def testGroupId = execution.getVariable('test-volume-group-id')
 
 280         if (testGroupId != null && testGroupId.trim() != '') {
 
 281             logger.debug("test volumeGroupId is present: " + testGroupId)
 
 282             volumeGroupId = testGroupId
 
 283             execution.setVariable("test-volume-group-name", "MSOTESTVOL101a-vSAMP12_base_vol_module-0")
 
 286         VolumeGroup volumeGroup = new VolumeGroup()
 
 287         volumeGroup.setVolumeGroupId(volumeGroupId)
 
 288         volumeGroup.setVolumeGroupName(volumeName)
 
 289         volumeGroup.setVnfType(vnfType)
 
 290         volumeGroup.setOrchestrationStatus(OrchestrationStatus.PENDING.toString())
 
 291         volumeGroup.setModelCustomizationId(modelCustomizationId)
 
 293         logger.debug("volumeGroupId to be used: " + volumeGroupId)
 
 295         AAIResourceUri volumeGroupUri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, cloudOwner, cloudRegion, volumeGroupId)
 
 296         AAIResourceUri tenantUri = AAIUriFactory.createResourceUri(AAIObjectType.TENANT, cloudOwner, cloudRegion, tenantId)
 
 297         AAIResourceUri vnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
 
 299             getAAIClient().create(volumeGroupUri, volumeGroup)
 
 300             getAAIClient().connect(volumeGroupUri, vnfUri)
 
 301             getAAIClient().connect(volumeGroupUri, tenantUri)
 
 302             execution.setVariable("queriedVolumeGroupId", volumeGroupId)
 
 303             RollbackData rollbackData = execution.getVariable("rollbackData")
 
 304             rollbackData.put("DCVFMODULEVOL", "isAAIRollbackNeeded", "true")
 
 305         } catch (NotFoundException ignored) {
 
 306             execution.setVariable(prefix + "isErrorMessageException", true)
 
 307             exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Unable to create volume group in AAI. Response code: 404")
 
 308         } catch (Exception ex) {
 
 309             execution.setVariable(prefix + "isErrorMessageException", true)
 
 310             exceptionUtil.buildAndThrowWorkflowException(execution, 2500, ex.getMessage())
 
 315      * Prepare VNF adapter create request XML
 
 318     public void prepareVnfAdapterCreateRequest(DelegateExecution execution, isDebugEnabled) {
 
 320         GenericVnf aaiGenericVnfResponse = execution.getVariable(prefix+'AAIQueryGenericVfnResponse')
 
 321         def vnfId = aaiGenericVnfResponse.getVnfId()
 
 322         def vnfName = aaiGenericVnfResponse.getVnfName()
 
 323         def vnfType = aaiGenericVnfResponse.getVnfType()
 
 325         def requestId = execution.getVariable('msoRequestId')
 
 326         def serviceId = execution.getVariable('serviceInstanceId')
 
 327         def cloudSiteId = execution.getVariable('poLcpCloudRegionId')
 
 328         def tenantId = execution.getVariable('tenantId')
 
 329         def volumeGroupId = execution.getVariable('volumeGroupId')
 
 330         def volumeGroupnName = execution.getVariable('volumeGroupName')
 
 332         def vnfVersion = execution.getVariable("asdcServiceModelVersion")
 
 333         def vnfModuleType = execution.getVariable("modelName")
 
 335         def modelCustomizationId = execution.getVariable("modelCustomizationId")
 
 338         logger.debug("volumeGroupId: " + volumeGroupId)
 
 339         def testGroupId = execution.getVariable('test-volume-group-id')
 
 340         if (testGroupId != null && testGroupId.trim() != '') {
 
 341             logger.debug("test volumeGroupId is present: " + testGroupId)
 
 342             volumeGroupId = testGroupId
 
 343             execution.setVariable("test-volume-group-name", "MSOTESTVOL101a-vSAMP12_base_vol_module-0")
 
 345         logger.debug("volumeGroupId to be used: " + volumeGroupId)
 
 347         // volume group parameters
 
 349         String volumeGroupParams = ''
 
 350         StringBuilder sbParams = new StringBuilder()
 
 351         Map<String, String> paramsMap = execution.getVariable("vfModuleInputParams")
 
 352         for (Map.Entry<String, String> entry : paramsMap.entrySet()) {
 
 354             String paramName = entry.getKey()
 
 355             String paramValue = entry.getValue()
 
 358                            <key>${MsoUtils.xmlEscape(paramName)}</key>
 
 359                            <value>${MsoUtils.xmlEscape(paramValue)}</value>
 
 362             sbParams.append(paramsXml)
 
 365         volumeGroupParams = sbParams.toString()
 
 366         logger.debug("volumeGroupParams: "+ volumeGroupParams)
 
 368         def backoutOnFailure = execution.getVariable(prefix+"backoutOnFailure")
 
 369         logger.debug("backoutOnFailure: "+ backoutOnFailure)
 
 371         def failIfExists = execution.getVariable("failIfExists")
 
 372         if(failIfExists == null) {
 
 373             failIfExists = 'true'
 
 376         String messageId = UUID.randomUUID()
 
 377         logger.debug("messageId to be used is generated: " + messageId)
 
 379         def notificationUrl = createCallbackURL(execution, "VNFAResponse", messageId)
 
 380         def useQualifiedHostName = UrnPropertiesReader.getVariable("mso.use.qualified.host",execution)
 
 381         if ('true'.equals(useQualifiedHostName)) {
 
 382             notificationUrl = utils.getQualifiedHostNameForCallback(notificationUrl)
 
 384         logger.debug("CreateVfModuleVolume - notificationUrl: "+ notificationUrl)
 
 387         String vnfSubCreateWorkflowRequest =
 
 389                         <createVolumeGroupRequest>
 
 390                                 <cloudSiteId>${MsoUtils.xmlEscape(cloudSiteId)}</cloudSiteId>
 
 391                                 <tenantId>${MsoUtils.xmlEscape(tenantId)}</tenantId>
 
 392                                 <vnfId>${MsoUtils.xmlEscape(vnfId)}</vnfId>
 
 393                                 <vnfName>${MsoUtils.xmlEscape(vnfName)}</vnfName>
 
 394                                 <volumeGroupId>${MsoUtils.xmlEscape(volumeGroupId)}</volumeGroupId>
 
 395                                 <volumeGroupName>${MsoUtils.xmlEscape(volumeGroupnName)}</volumeGroupName>
 
 396                                 <vnfType>${MsoUtils.xmlEscape(vnfType)}</vnfType>
 
 397                                 <vnfVersion>${MsoUtils.xmlEscape(vnfVersion)}</vnfVersion>
 
 398                                 <vfModuleType>${MsoUtils.xmlEscape(vnfModuleType)}</vfModuleType>
 
 399                                 <modelCustomizationUuid>${MsoUtils.xmlEscape(modelCustomizationId)}</modelCustomizationUuid>
 
 403                                                 <value>${MsoUtils.xmlEscape(vnfId)}</value>
 
 407                                                 <value>${MsoUtils.xmlEscape(vnfName)}</value>
 
 410                                                 <key>vf_module_id</key>
 
 411                                                 <value>${MsoUtils.xmlEscape(volumeGroupId)}</value>
 
 414                                                 <key>vf_module_name</key>
 
 415                                                 <value>${MsoUtils.xmlEscape(volumeGroupnName)}</value>
 
 419                                 <skipAAI>true</skipAAI>
 
 420                                 <backout>${MsoUtils.xmlEscape(backoutOnFailure)}</backout>
 
 421                                 <failIfExists>${MsoUtils.xmlEscape(failIfExists)}</failIfExists>
 
 423                                 <requestId>${MsoUtils.xmlEscape(requestId)}</requestId>
 
 424                                 <serviceInstanceId>${MsoUtils.xmlEscape(serviceId)}</serviceInstanceId>
 
 426                             <messageId>${MsoUtils.xmlEscape(messageId)}</messageId>
 
 427                             <notificationUrl>${MsoUtils.xmlEscape(notificationUrl)}</notificationUrl>
 
 428                         </createVolumeGroupRequest>
 
 431         String vnfSubCreateWorkflowRequestAsString = utils.formatXml(vnfSubCreateWorkflowRequest)
 
 432         logger.debug(vnfSubCreateWorkflowRequestAsString)
 
 433         logger.debug(vnfSubCreateWorkflowRequestAsString)
 
 434         execution.setVariable(prefix+"createVnfARequest", vnfSubCreateWorkflowRequestAsString)
 
 436         // build rollback request for use later if needed
 
 437         String vnfSubRollbackWorkflowRequest = buildRollbackVolumeGroupRequestXml(volumeGroupId, cloudSiteId, tenantId, requestId, serviceId, messageId, notificationUrl)
 
 439         logger.debug("Sub Vnf flow rollback request: vnfSubRollbackWorkflowRequest " + "\n" + vnfSubRollbackWorkflowRequest)
 
 441         String vnfSubRollbackWorkflowRequestAsString = utils.formatXml(vnfSubRollbackWorkflowRequest)
 
 442         execution.setVariable(prefix+"rollbackVnfARequest", vnfSubRollbackWorkflowRequestAsString)
 
 445     public String buildRollbackVolumeGroupRequestXml(volumeGroupId, cloudSiteId, tenantId, requestId, serviceId, messageId, notificationUrl) {
 
 448                 <rollbackVolumeGroupRequest>
 
 449                         <volumeGroupRollback>
 
 450                            <volumeGroupId>${MsoUtils.xmlEscape(volumeGroupId)}</volumeGroupId>
 
 451                            <volumeGroupStackId>{{VOLUMEGROUPSTACKID}}</volumeGroupStackId>
 
 452                            <tenantId>${MsoUtils.xmlEscape(tenantId)}</tenantId>
 
 453                            <cloudSiteId>${MsoUtils.xmlEscape(cloudSiteId)}</cloudSiteId>
 
 454                            <volumeGroupCreated>true</volumeGroupCreated>
 
 456                               <requestId>${MsoUtils.xmlEscape(requestId)}</requestId>
 
 457                               <serviceInstanceId>${MsoUtils.xmlEscape(serviceId)}</serviceInstanceId>
 
 459                            <messageId>${MsoUtils.xmlEscape(messageId)}</messageId>
 
 460                         </volumeGroupRollback>
 
 461                         <skipAAI>true</skipAAI>
 
 462                         <notificationUrl>${MsoUtils.xmlEscape(notificationUrl)}</notificationUrl>
 
 463                 </rollbackVolumeGroupRequest>
 
 469     public String updateRollbackVolumeGroupRequestXml(String rollabackRequest, String heatStackId) {
 
 470         String newRequest = rollabackRequest.replace("{{VOLUMEGROUPSTACKID}}", heatStackId)
 
 475      * Validate VNF adapter response
 
 478     public void validateVnfResponse(DelegateExecution execution, isDebugEnabled) {
 
 479         def vnfSuccess = execution.getVariable('VNFREST_SuccessIndicator')
 
 480         logger.debug("vnfAdapterSuccessIndicator: "+ vnfSuccess)
 
 481         if(vnfSuccess==true) {
 
 482             String createVnfAResponse = execution.getVariable(prefix+"createVnfAResponse")
 
 483             String heatStackID = utils.getNodeText(createVnfAResponse, "volumeGroupStackId")
 
 484             String vnfRollbackRequest = execution.getVariable(prefix+"rollbackVnfARequest")
 
 485             String updatedVnfRollbackRequest = updateRollbackVolumeGroupRequestXml(vnfRollbackRequest, heatStackID)
 
 486             logger.debug("vnfAdapter rollback request: "+ updatedVnfRollbackRequest)
 
 487             RollbackData rollbackData = execution.getVariable("rollbackData")
 
 488             rollbackData.put("DCVFMODULEVOL", "rollbackVnfARequest", updatedVnfRollbackRequest)
 
 489             rollbackData.put("DCVFMODULEVOL", "isCreateVnfRollbackNeeded", "true")
 
 495      * Update voulume group in AAI
 
 496      * @TODO: Can we re-use the create method??
 
 498      * @param isDebugEnabled
 
 500     public void callRESTUpdateCreatedVolGrpName(DelegateExecution execution, isDebugEnabled) {
 
 501         String volumeGroupId = execution.getVariable("queriedVolumeGroupId")
 
 502         String modelCustomizationId = execution.getVariable("modelCustomizationId")
 
 503         String cloudRegion = execution.getVariable("lcpCloudRegionId")
 
 504         String cloudOwner = execution.getVariable('cloudOwner')
 
 505         String createVnfAResponse = execution.getVariable(prefix+"createVnfAResponse")
 
 506         def heatStackID = utils.getNodeText(createVnfAResponse, "volumeGroupStackId")
 
 507         AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, cloudOwner, cloudRegion, volumeGroupId)
 
 509         execution.setVariable(prefix+"heatStackId", heatStackID)
 
 511         VolumeGroup volumeGroup = new VolumeGroup()
 
 512         volumeGroup.setHeatStackId(heatStackID)
 
 513         volumeGroup.setModelCustomizationId(modelCustomizationId)
 
 515             getAAIClient().update(uri, volumeGroup)
 
 516             execution.setVariable(prefix+"isPONR", true)
 
 517         }catch(NotFoundException ignored){
 
 518             execution.setVariable(prefix+"isErrorMessageException", true)
 
 519             exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Unable to update volume group in AAI. Response code: 404")
 
 520         }catch(BpmnError error){
 
 523             execution.setVariable(prefix+"isErrorMessageException", true)
 
 524             exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "AAI Adapter Query Failed. "+ e.getMessage())
 
 530      * Query AAI Generic VNF
 
 532      * @param isDebugEnabled
 
 534     public void callRESTQueryAAIGenericVnf(DelegateExecution execution, isDebugEnabled) {
 
 536         def vnfId = execution.getVariable('vnfId')
 
 537         AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
 
 539             Optional<GenericVnf> genericVnf = getAAIClient().get(GenericVnf.class, uri)
 
 540             if (genericVnf.isPresent()) {
 
 541                 execution.setVariable(prefix + 'AAIQueryGenericVfnResponse', genericVnf.get())
 
 543                 exceptionUtil.buildAndThrowWorkflowException(execution, 2500, 'Generic vnf ' + vnfId + ' was not found in AAI. Return code: 404.')
 
 546             exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Exception in get generic VNF: " + e.getMessage())