From d7cd3bcf7a9631dc7e4bb51b2b4099b786d665ca Mon Sep 17 00:00:00 2001 From: "Gamboa, Gilbert" Date: Thu, 25 Jul 2019 11:10:05 -0400 Subject: store heat env file sent to heat Initial commit, include heat environment info in cloud-api_requests. Updated MSOHeatUtilsTest.saveStackTest unit test to assert cloudApiRequests requestBody Issue-ID: SO-2158 Signed-off-by: Benjamin, Max (mb388a) Change-Id: I333cae7746459917ba5e64feb07db4f710b8d99b --- .../so/openstack/beans/CreateStackRequest.java | 36 ++++++++++++++++++++++ .../org/onap/so/openstack/utils/MsoHeatUtils.java | 6 +++- 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/beans/CreateStackRequest.java (limited to 'adapters/mso-adapter-utils/src/main') diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/beans/CreateStackRequest.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/beans/CreateStackRequest.java new file mode 100644 index 0000000000..86be9ec3d8 --- /dev/null +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/beans/CreateStackRequest.java @@ -0,0 +1,36 @@ +package org.onap.so.openstack.beans; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +public class CreateStackRequest { + + @JsonProperty("parameters") + private Map parameters; + + @JsonProperty("environment") + private String environment; + + public Map getParameters() { + return parameters; + } + + public void setParameters(Map parameters) { + this.parameters = parameters; + } + + public String getEnvironment() { + return environment; + } + + public void setEnvironment(String environment) { + this.environment = environment; + } + + @Override + public String toString() { + return "CreateStackRequest [parameters=" + parameters + ", environment=" + environment + "]"; + } + + +} 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 28d4f3f9b4..1d75892138 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 @@ -55,6 +55,7 @@ import org.onap.so.db.request.beans.InfraActiveRequests; import org.onap.so.db.request.client.RequestsDbClient; import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; +import org.onap.so.openstack.beans.CreateStackRequest; import org.onap.so.openstack.beans.HeatStatus; import org.onap.so.openstack.beans.StackInfo; import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound; @@ -354,7 +355,10 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin { try { ObjectMapper mapper = new ObjectMapper(); InfraActiveRequests foundRequest = requestDBClient.getInfraActiveRequestbyRequestId(requestId); - String stackRequest = mapper.writeValueAsString(request.getParameters()); + CreateStackRequest createStackRequest = new CreateStackRequest(); + createStackRequest.setEnvironment(request.getEnvironment()); + createStackRequest.setParameters(request.getParameters()); + String stackRequest = mapper.writeValueAsString(createStackRequest); CloudApiRequests cloudReq = new CloudApiRequests(); cloudReq.setCloudIdentifier(stackName); cloudReq.setRequestBody(stackRequest); -- cgit 1.2.3-korg