From 7b42dee721e03ee3f0a52dda92010e09d748cf72 Mon Sep 17 00:00:00 2001 From: "Boslet, Cory" Date: Sun, 8 Mar 2020 10:43:59 -0400 Subject: false positive on network creates Added a new resourceStatusMessage field to the GET orch request API added new column to infra active request table updated openstack adapter to record the resource status added support of v8 on GET orch request API. Issue-ID: SO-2718 Signed-off-by: Benjamin, Max (mb388a) Change-Id: I73b35f1562de4df477bf7e5cef01de13440ba98a --- .../org/onap/so/openstack/utils/MsoHeatUtils.java | 30 +++++++++++++++------- 1 file changed, 21 insertions(+), 9 deletions(-) (limited to 'adapters/mso-adapter-utils') diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java index f06d2a2452..7535e04fba 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java @@ -101,8 +101,6 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin { private static final String CREATE_IN_PROGRESS = "CREATE_IN_PROGRESS"; - private static final String DELETE_STACK = "DeleteStack"; - protected static final String HEAT_ERROR = "HeatError"; protected static final String CREATE_STACK = "CreateStack"; @@ -114,15 +112,15 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin { @Autowired private Environment environment; - @Autowired - RequestsDbClient requestDBClient; - @Autowired StackStatusHandler statusHandler; @Autowired NovaClientImpl novaClient; + @Autowired + RequestsDbClient requestDBClient; + private static final Logger logger = LoggerFactory.getLogger(MsoHeatUtils.class); // Properties names and variables (with default values) @@ -182,6 +180,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin { CreateStackParam createStack = createStackParam(stackName, heatTemplate, stackInputs, timeoutMinutes, environment, nestedTemplates, heatFiles); Stack currentStack = queryHeatStack(stackName, cloudSiteId, tenantId); + boolean operationPerformed = false; if (currentStack != null) { logger.debug("Existing Stack found with Status: {} ", currentStack.getStackStatus()); if (CREATE_COMPLETE.equals(currentStack.getStackStatus())) { @@ -220,8 +219,11 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin { currentStack = queryHeatStack(currentStack.getStackName() + "/" + currentStack.getId(), cloudSiteId, tenantId); } + operationPerformed = true; } - return new StackInfoMapper(currentStack).map(); + StackInfo stackInfo = new StackInfoMapper(currentStack).map(); + stackInfo.setOperationPerformed(operationPerformed); + return stackInfo; } /** @@ -497,14 +499,17 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin { public StackInfo deleteStack(String tenantId, String cloudOwner, String cloudSiteId, String stackName, boolean pollForCompletion, int timeoutMinutes) throws MsoException { Stack currentStack = queryHeatStack(stackName, cloudSiteId, tenantId); + StackInfo stackInfo = null; if (currentStack == null || DELETE_COMPLETE.equals(currentStack.getStackStatus())) { - return new StackInfo(stackName, HeatStatus.NOTFOUND); + stackInfo = new StackInfo(stackName, HeatStatus.NOTFOUND); + stackInfo.setOperationPerformed(false); } else { currentStack = deleteStack(currentStack, timeoutMinutes, cloudSiteId, tenantId); - StackInfo stackInfo = new StackInfoMapper(currentStack).map(); + stackInfo = new StackInfoMapper(currentStack).map(); stackInfo.setName(stackName); - return stackInfo; + stackInfo.setOperationPerformed(true); } + return stackInfo; } /** @@ -1182,4 +1187,11 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin { } } + public void updateResourceStatus(String requestId, String resourceStatusMessage) { + InfraActiveRequests request = new InfraActiveRequests(); + request.setRequestId(requestId); + request.setResourceStatusMessage(resourceStatusMessage); + requestDBClient.patchInfraActiveRequests(request); + } + } -- cgit 1.2.3-korg