aboutsummaryrefslogtreecommitdiffstats
path: root/adapters/mso-openstack-adapters/src/main/java/org
diff options
context:
space:
mode:
authorBoslet, Cory <cory.boslet@att.com>2020-11-19 18:10:56 -0500
committerBenjamin, Max (mb388a) <mb388a@att.com>2021-01-05 10:38:41 -0500
commit8bc7057f9b23555ba78c9f656743c57fa3d62a64 (patch)
treec0ee0e9e8043c22d4a7d9778645b621b43603a4b /adapters/mso-openstack-adapters/src/main/java/org
parente036ebd43a0b58eda96b2546290bba2189bb3824 (diff)
Use the timeout from the heat templates for
Use the timeout from the heat templates for polling Removed unused imports and code from base Added to get timeout from the rest client Fixed unit test for polling to account for changes Issue-ID: SO-3397 Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com> Change-Id: If633f4f49d88eb797020b7d72c6edd0fbee0926c
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.java26
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/PollService.java37
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java27
3 files changed, 26 insertions, 64 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 489585c04b..9123ac9f36 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
@@ -962,31 +962,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
pollForCompletion = true;
}
- // Retrieve the Network Resource definition
- NetworkResource networkResource = null;
- if (commonUtils.isNullOrEmpty(modelCustomizationUuid)) {
- if (!commonUtils.isNullOrEmpty(networkType)) {
- networkResource = networkResourceRepo.findFirstByModelNameOrderByModelVersionDesc(networkType);
- }
- } else {
- NetworkResourceCustomization nrc =
- networkCustomRepo.findOneByModelCustomizationUUID(modelCustomizationUuid);
- if (nrc != null) {
- networkResource = nrc.getNetworkResource();
- }
- }
-
- int timeoutMinutes = 118;
- if (networkResource != null) {
- logger.debug(LOG_DEBUG_MSG, networkResource.toString());
- networkResource.getHeatTemplate().getTimeoutMinutes();
- HeatTemplate heat = networkResource.getHeatTemplate();
- if (heat != null && heat.getTimeoutMinutes() != null) {
- if (heat.getTimeoutMinutes() < 118) {
- timeoutMinutes = heat.getTimeoutMinutes();
- }
- }
- }
+ int timeoutMinutes = heat.getNetworkHeatTimeoutValue(modelCustomizationUuid, networkType);
try {
StackInfo stack =
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/PollService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/PollService.java
index c319fdc23c..ddbda5da62 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/PollService.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/PollService.java
@@ -90,7 +90,9 @@ public class PollService extends ExternalTaskUtils {
JAXB.unmarshal(new StringReader(xmlRequest), DeleteVfModuleRequest.class);
boolean isMulticloud = vnfAdapterUtils.isMulticloudMode(null, req.getCloudSiteId());
if (!isMulticloud) {
- pollDeleteResource(req.getCloudSiteId(), req.getTenantId(), externalTask, success);
+ int timeoutMinutes = msoHeatUtils.getVfHeatTimeoutValue(req.getModelCustomizationUuid(), false);
+ pollDeleteResource(timeoutMinutes, req.getCloudSiteId(), req.getTenantId(), externalTask,
+ success);
} else {
success.setTrue();
}
@@ -100,7 +102,7 @@ public class PollService extends ExternalTaskUtils {
JAXB.unmarshal(new StringReader(xmlRequest), DeleteVolumeGroupRequest.class);
boolean isMulticloud = vnfAdapterUtils.isMulticloudMode(null, req.getCloudSiteId());
if (!isMulticloud) {
- pollDeleteResource(req.getCloudSiteId(), req.getTenantId(), externalTask, success);
+ pollDeleteResource(118, req.getCloudSiteId(), req.getTenantId(), externalTask, success);
} else {
success.setTrue();
}
@@ -109,7 +111,7 @@ public class PollService extends ExternalTaskUtils {
} else if ("deleteNetworkRequest".equals(requestType.get())) {
logger.debug("Executing External Task Poll Service for Delete Network");
DeleteNetworkRequest req = JAXB.unmarshal(new StringReader(xmlRequest), DeleteNetworkRequest.class);
- pollDeleteResource(req.getCloudSiteId(), req.getTenantId(), externalTask, success);
+ pollDeleteResource(118, req.getCloudSiteId(), req.getTenantId(), externalTask, success);
} else if ("updateNetworkRequest".equals(requestType.get())) {
UpdateNetworkRequest req = JAXB.unmarshal(new StringReader(xmlRequest), UpdateNetworkRequest.class);
pollUpdateResource(req.getCloudSiteId(), req.getTenantId(), externalTask, success);
@@ -152,9 +154,10 @@ public class PollService extends ExternalTaskUtils {
boolean pollRollbackStatus = externalTask.getVariable("PollRollbackStatus");
if (pollRollbackStatus) {
logger.debug("Executing External Task Poll Service for Rollback Create Volume Group");
- pollDeleteResource(req.getCloudSiteId(), req.getTenantId(), externalTask, success);
+ pollDeleteResource(118, req.getCloudSiteId(), req.getTenantId(), externalTask, success);
} else {
- pollCreateResource(req.getCloudSiteId(), req.getTenantId(), externalTask, success);
+ int timeoutMinutes = msoHeatUtils.getVfHeatTimeoutValue(req.getModelCustomizationUuid(), true);
+ pollCreateResource(timeoutMinutes, req.getCloudSiteId(), req.getTenantId(), externalTask, success);
}
} else {
success.setTrue();
@@ -167,12 +170,13 @@ public class PollService extends ExternalTaskUtils {
boolean isMulticloud = vnfAdapterUtils.isMulticloudMode(null, req.getCloudSiteId());
if (!isMulticloud) {
boolean pollRollbackStatus = externalTask.getVariable("PollRollbackStatus");
+ int timeoutMinutes = msoHeatUtils.getVfHeatTimeoutValue(req.getModelCustomizationUuid(), false);
if (pollRollbackStatus) {
logger.debug("Executing External Task Poll Service for Rollback Create Vf Module");
- pollDeleteResource(req.getCloudSiteId(), req.getTenantId(), externalTask, success);
+ pollDeleteResource(timeoutMinutes, req.getCloudSiteId(), req.getTenantId(), externalTask, success);
} else {
logger.debug("Executing External Task Poll Service for Create Vf Module");
- pollCreateResource(req.getCloudSiteId(), req.getTenantId(), externalTask, success);
+ pollCreateResource(timeoutMinutes, req.getCloudSiteId(), req.getTenantId(), externalTask, success);
}
} else {
success.setTrue();
@@ -183,29 +187,31 @@ public class PollService extends ExternalTaskUtils {
throws MsoException {
CreateNetworkRequest req = JAXB.unmarshal(new StringReader(xmlRequest), CreateNetworkRequest.class);
boolean pollRollbackStatus = externalTask.getVariable("PollRollbackStatus");
+ int timeoutMinutes =
+ msoHeatUtils.getNetworkHeatTimeoutValue(req.getModelCustomizationUuid(), req.getNetworkType());
if (pollRollbackStatus) {
logger.debug("Executing External Task Poll Service for Rollback Create Network");
- pollDeleteResource(req.getCloudSiteId(), req.getTenantId(), externalTask, success);
+ pollDeleteResource(timeoutMinutes, req.getCloudSiteId(), req.getTenantId(), externalTask, success);
} else {
logger.debug("Executing External Task Poll Service for Create Network");
- pollCreateResource(req.getCloudSiteId(), req.getTenantId(), externalTask, success);
+ pollCreateResource(timeoutMinutes, req.getCloudSiteId(), req.getTenantId(), externalTask, success);
}
}
- private void pollCreateResource(String cloudSiteId, String tenantId, ExternalTask externalTask,
+ private void pollCreateResource(int pollingTimeout, String cloudSiteId, String tenantId, ExternalTask externalTask,
MutableBoolean success) throws MsoException {
Stack currentStack = createCurrentStack(externalTask.getVariable("stackId"));
- Stack stack =
- msoHeatUtils.pollStackForStatus(1, currentStack, "CREATE_IN_PROGRESS", cloudSiteId, tenantId, false);
+ Stack stack = msoHeatUtils.pollStackForStatus(pollingTimeout, currentStack, "CREATE_IN_PROGRESS", cloudSiteId,
+ tenantId, false);
msoHeatUtils.postProcessStackCreate(stack, false, 0, false, cloudSiteId, tenantId, null);
success.setTrue();
}
- private void pollDeleteResource(String cloudSiteId, String tenantId, ExternalTask externalTask,
+ private void pollDeleteResource(int pollingTimeout, String cloudSiteId, String tenantId, ExternalTask externalTask,
MutableBoolean success) throws MsoException {
Stack currentStack = createCurrentStack(externalTask.getVariable("stackId"));
- Stack stack =
- msoHeatUtils.pollStackForStatus(1, currentStack, "DELETE_IN_PROGRESS", cloudSiteId, tenantId, true);
+ Stack stack = msoHeatUtils.pollStackForStatus(pollingTimeout, currentStack, "DELETE_IN_PROGRESS", cloudSiteId,
+ tenantId, true);
if (stack != null) { // if stack is null it was not found and no need to do post process
msoHeatUtils.postProcessStackDelete(stack);
}
@@ -245,5 +251,4 @@ public class PollService extends ExternalTaskUtils {
currentStack.setStackName(stackName);
return currentStack;
}
-
}
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 26bce5f362..7acf953282 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
@@ -158,6 +158,7 @@ public class MsoVnfAdapterImpl {
* @param outputs Holder for Map of VNF outputs from heat (assigned IPs, etc)
* @param rollback Holder for returning VnfRollback object
*/
+ @Deprecated
public void createVnf(String cloudSiteId, String cloudOwner, String tenantId, String vnfType, String vnfVersion,
String vnfName, String requestType, String volumeGroupHeatStackId, Map<String, Object> inputs,
Boolean failIfExists, Boolean backout, Boolean enableBridge, MsoRequest msoRequest, Holder<String> vnfId,
@@ -212,6 +213,7 @@ public class MsoVnfAdapterImpl {
* @param vnfName VNF Name or Openstack ID
* @param msoRequest Request tracking information for logs
*/
+ @Deprecated
public void deleteVnf(String cloudSiteId, String cloudOwner, String tenantId, String vnfName, MsoRequest msoRequest)
throws VnfException {
@@ -251,6 +253,7 @@ public class MsoVnfAdapterImpl {
* @param vnfName VNF Name or Openstack ID
* @param msoRequest Request tracking information for logs
*/
+ @Deprecated
public void deleteVnf(String cloudSiteId, String cloudOwner, String tenantId, String vnfName, MsoRequest msoRequest,
boolean pollStackStatus) throws VnfException {
@@ -988,29 +991,7 @@ public class MsoVnfAdapterImpl {
// call method which handles the conversion from Map<String,Object> to Map<String,String> for our expected
// Object types
outputs.value = this.convertMapStringObjectToStringString(stackOutputs);
- int timeoutMinutes = 118;
- VfModule vf = null;
- VfModuleCustomization vfmc = null;
- if (modelCustomizationUuid != null) {
- vfmc = vfModuleCustomRepo.findFirstByModelCustomizationUUIDOrderByCreatedDesc(modelCustomizationUuid);
- if (vfmc != null) {
- vf = vfmc.getVfModule();
- }
- if (vf != null) {
- logger.trace("Found vfModuleCust entry {}", vfmc.toString());
- HeatTemplate heat = vf.getModuleHeatTemplate();
- if (heat != null && heat.getTimeoutMinutes() != null) {
- if (heat.getTimeoutMinutes() < 118) {
- timeoutMinutes = heat.getTimeoutMinutes();
- }
- }
-
- } else {
- logger.debug(
- "Unable to find vfModuleCust with modelCustomizationUuid={} . Using default timeout for polling",
- modelCustomizationUuid);
- }
- }
+ int timeoutMinutes = msoHeatUtils.getVfHeatTimeoutValue(modelCustomizationUuid, false);
try {
StackInfo currentStack =