diff options
author | Boslet, Cory <cory.boslet@att.com> | 2020-03-27 11:08:33 -0400 |
---|---|---|
committer | Benjamin, Max (mb388a) <mb388a@att.com> | 2020-03-31 11:58:39 -0400 |
commit | 96fc80b0e919ff6ad81840bad1ecf7f91f4f9a9d (patch) | |
tree | f23fc2263efc5cf3dc9829f961acc0829e66058a | |
parent | bbbc6d3ff6d0126bec9cb86b0d12b401f734c839 (diff) |
Added support for volume group request to
Added support for volume group request to indicate whether the volume
group existed, etc.
Issue-ID: SO-2770
Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com>
Change-Id: I614926ad33220734133afd84bd8d0fedc8f6e6d6
-rw-r--r-- | adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java index 5951fda16e..4617299f48 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java @@ -107,12 +107,15 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { private static final String USER_ERROR = "USER ERROR"; private static final String VERSION_MIN = "VersionMin"; private static final String VERSION_MAX = "VersionMax"; - private static final String VF_EXIST_STATUS_MESSAGE = - "The vf module was found to already exist, thus no new vf module was created in the cloud via this request"; - private static final String VF_CREATED_STATUS_MESSAGE = "The new vf module was successfully created in the cloud"; - private static final String VF_NOT_EXIST_STATUS_MESSAGE = - "The vf module was not found, thus no vf module was deleted in the cloud via this request"; - private static final String VF_DELETED_STATUS_MESSAGE = "The vf module was successfully deleted in the cloud"; + private static final String RESOURCE_EXIST_STATUS_MESSAGE = + "The %s was found to already exist, thus no new %s was created in the cloud via this request"; + private static final String RESOURCE_CREATED_STATUS_MESSAGE = "The new %s was successfully created in the cloud"; + private static final String RESOURCE_NOT_EXIST_STATUS_MESSAGE = + "The %s was not found, thus no %s was deleted in the cloud via this request"; + private static final String RESOURCE_DELETED_STATUS_MESSAGE = "The %s was successfully deleted in the cloud"; + private static final String VF_MODULE = "vf module"; + private static final String VOLUME_GROUP = "volume group"; + @Autowired private VFModuleCustomizationRepository vfModuleCustomRepo; @@ -303,7 +306,11 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { logger.debug("Deleting VNF {} in {}", vnfName, cloudSiteId + "/" + tenantId); try { - msoHeatUtils.deleteStack(tenantId, cloudOwner, cloudSiteId, vnfName, true, 118); + StackInfo stackInfo = msoHeatUtils.deleteStack(tenantId, cloudOwner, cloudSiteId, vnfName, true, 118); + + msoHeatUtils.updateResourceStatus(msoRequest.getRequestId(), + stackInfo.isOperationPerformed() ? String.format(RESOURCE_DELETED_STATUS_MESSAGE, VOLUME_GROUP) + : String.format(RESOURCE_NOT_EXIST_STATUS_MESSAGE, VOLUME_GROUP, VOLUME_GROUP)); } catch (MsoException me) { me.addContext(DELETE_VNF); // Failed to query the Stack due to an openstack exception. @@ -1088,9 +1095,15 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { template, goldenInputs, pollForCompletion, heatTemplate.getTimeoutMinutes(), newEnvironmentString, nestedTemplatesChecked, heatFilesObjects, backout.booleanValue(), failIfExists); + String resource = VF_MODULE; + if (isVolumeRequest) { + resource = VOLUME_GROUP; + } if (msoRequest.getRequestId() != null) { msoHeatUtils.updateResourceStatus(msoRequest.getRequestId(), - heatStack.isOperationPerformed() ? VF_CREATED_STATUS_MESSAGE : VF_EXIST_STATUS_MESSAGE); + heatStack.isOperationPerformed() + ? String.format(RESOURCE_CREATED_STATUS_MESSAGE, resource) + : String.format(RESOURCE_EXIST_STATUS_MESSAGE, resource, resource)); } } else { throw new MsoHeatNotFoundException(); @@ -1178,8 +1191,8 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { outputs.value.put("canonicalStackId", currentStack.getCanonicalName()); } msoHeatUtils.updateResourceStatus(msoRequest.getRequestId(), - currentStack.isOperationPerformed() ? VF_DELETED_STATUS_MESSAGE : VF_NOT_EXIST_STATUS_MESSAGE); - + currentStack.isOperationPerformed() ? String.format(RESOURCE_DELETED_STATUS_MESSAGE, VF_MODULE) + : String.format(RESOURCE_NOT_EXIST_STATUS_MESSAGE, VF_MODULE, VF_MODULE)); } catch (MsoException me) { me.addContext(DELETE_VNF); // Failed to query the Stack due to an openstack exception. |