aboutsummaryrefslogtreecommitdiffstats
path: root/adapters/mso-openstack-adapters/src/main/java/org
diff options
context:
space:
mode:
Diffstat (limited to 'adapters/mso-openstack-adapters/src/main/java/org')
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java27
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java14
2 files changed, 36 insertions, 5 deletions
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java
index 5530fad298..257374fdb2 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java
@@ -92,6 +92,13 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
private static final String NEUTRON_MODE = "NEUTRON";
private static final String CLOUD_OWNER = "CloudOwner";
private static final String LOG_DEBUG_MSG = "Got Network definition from Catalog: {}";
+ private static final String NETWORK_EXIST_STATUS_MESSAGE =
+ "The network was found to already exist, thus no new network was created in the cloud via this request";
+ private static final String NETWORK_CREATED_STATUS_MESSAGE =
+ "The new network was successfully created in the cloud";
+ private static final String NETWORK_NOT_EXIST_STATUS_MESSAGE =
+ "The network as not found, thus no network was deleted in the cloud via this request";
+ private static final String NETWORK_DELETED_STATUS_MESSAGE = "The network was successfully deleted in the cloud";
private static final Logger logger = LoggerFactory.getLogger(MsoNetworkAdapterImpl.class);
@@ -225,7 +232,6 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
// See if the Network already exists (by name)
NetworkInfo netInfo = null;
- long queryNetworkStarttime = System.currentTimeMillis();
try {
netInfo = neutron.queryNetwork(networkName, tenantId, cloudSiteId);
} catch (MsoException me) {
@@ -254,10 +260,10 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
logger.warn("{} {} Found Existing network, status={} for Neutron mode ",
MessageEnum.RA_NETWORK_ALREADY_EXIST, ErrorCode.DataError.getValue(), netInfo.getStatus());
}
+ heat.updateResourceStatus(msoRequest.getRequestId(), NETWORK_EXIST_STATUS_MESSAGE);
return;
}
- long createNetworkStarttime = System.currentTimeMillis();
try {
netInfo = neutron.createNetwork(cloudSiteId, tenantId, neutronNetworkType, networkName,
physicalNetworkName, vlans);
@@ -360,6 +366,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
MessageEnum.RA_NETWORK_ALREADY_EXIST, ErrorCode.DataError.getValue(), heatStack.getStatus(),
networkName, cloudSiteId, tenantId);
}
+ heat.updateResourceStatus(msoRequest.getRequestId(), NETWORK_EXIST_STATUS_MESSAGE);
return;
}
@@ -473,6 +480,12 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
networkRollback.setNetworkCreated(true);
networkRollback.setNetworkType(networkType);
+ try {
+ heat.updateResourceStatus(msoRequest.getRequestId(), NETWORK_CREATED_STATUS_MESSAGE);
+ } catch (Exception e) {
+ logger.warn("Exception while updating infra active request", e);
+ }
+
logger.debug("Network {} successfully created via HEAT", networkName);
}
@@ -1055,8 +1068,8 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
}
} else {
try {
- heat.deleteStack(tenantId, CLOUD_OWNER, cloudSiteId, networkId, true, timeoutMinutes);
- networkDeleted.value = true;
+ StackInfo stack = heat.deleteStack(tenantId, CLOUD_OWNER, cloudSiteId, networkId, true, timeoutMinutes);
+ networkDeleted.value = stack.isOperationPerformed();
} catch (MsoException me) {
me.addContext("DeleteNetwork");
logger.error("{} {} Delete Network (heat): {} in {}/{} ", MessageEnum.RA_DELETE_NETWORK_EXC,
@@ -1064,6 +1077,12 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
throw new NetworkException(me);
}
}
+ try {
+ heat.updateResourceStatus(msoRequest.getRequestId(),
+ networkDeleted.value ? NETWORK_DELETED_STATUS_MESSAGE : NETWORK_NOT_EXIST_STATUS_MESSAGE);
+ } catch (Exception e) {
+ logger.warn("Exception while updating infra active request", e);
+ }
}
/**
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 0dc0d1c290..32e88d8cad 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
@@ -109,6 +109,12 @@ 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, 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";
@Autowired
private VFModuleCustomizationRepository vfModuleCustomRepo;
@@ -1046,6 +1052,9 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
heatStack = msoHeatUtils.createStack(cloudSiteId, cloudOwner, tenantId, vfModuleName, null,
template, goldenInputs, true, heatTemplate.getTimeoutMinutes(), newEnvironmentString,
nestedTemplatesChecked, heatFilesObjects, backout.booleanValue(), failIfExists);
+
+ msoHeatUtils.updateResourceStatus(msoRequest.getRequestId(),
+ heatStack.isOperationPerformed() ? VF_EXIST_STATUS_MESSAGE : VF_CREATED_STATUS_MESSAGE);
} else {
throw new MsoHeatNotFoundException();
}
@@ -1125,7 +1134,10 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
}
try {
- msoHeatUtils.deleteStack(tenantId, cloudOwner, cloudSiteId, vnfName, true, timeoutMinutes);
+ StackInfo stackInfo =
+ msoHeatUtils.deleteStack(tenantId, cloudOwner, cloudSiteId, vnfName, true, timeoutMinutes);
+ msoHeatUtils.updateResourceStatus(msoRequest.getRequestId(),
+ stackInfo.isOperationPerformed() ? VF_DELETED_STATUS_MESSAGE : VF_NOT_EXIST_STATUS_MESSAGE);
} catch (MsoException me) {
me.addContext(DELETE_VNF);
// Failed to query the Stack due to an openstack exception.