diff options
4 files changed, 21 insertions, 45 deletions
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java index 051d8134f1..64f957b157 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java @@ -31,8 +31,6 @@ import javax.ws.rs.core.UriBuilder; import javax.ws.rs.core.UriBuilderException; import javax.ws.rs.core.Response; -import org.onap.so.db.catalog.beans.CloudIdentity; -import org.onap.so.utils.CryptoUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.onap.so.adapters.vdu.CloudInfo; @@ -64,6 +62,8 @@ import org.springframework.http.HttpHeaders; import org.springframework.http.MediaType; import org.springframework.stereotype.Component; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.woorea.openstack.heat.model.CreateStackParam; @@ -173,35 +173,20 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{ CreateStackParam stack = createStackParam(stackName, heatTemplate, stackInputs, timeoutMinutes, environment, files, heatFiles); MulticloudRequest multicloudRequest= new MulticloudRequest(); - HttpEntity<MulticloudRequest> request = null; try { multicloudRequest.setGenericVnfId(genericVnfId); multicloudRequest.setVfModuleId(vfModuleId); - multicloudRequest.setOofDirectives(oofDirectives); - multicloudRequest.setSdncDirectives(sdncDirectives); + multicloudRequest.setOofDirectives(JSON_MAPPER.readTree(oofDirectives)); + multicloudRequest.setSdncDirectives(JSON_MAPPER.readTree(sdncDirectives)); multicloudRequest.setTemplateType(templateType); if (logger.isDebugEnabled()) { logger.debug(String.format("Stack Template Data is: %s", stack.toString().substring(16))); } - multicloudRequest.setTemplateData(JSON_MAPPER.writeValueAsString(stack)); + multicloudRequest.setTemplateData(stack); if (logger.isDebugEnabled()) { logger.debug(String.format("Multicloud Request is: %s", multicloudRequest.toString())); } - - CloudSite cloudSite = cloudConfig.getCloudSite(cloudSiteId).orElseThrow(() -> - new MsoCloudSiteNotFound(cloudSiteId)); - CloudIdentity cloudIdentity = cloudSite.getIdentityService(); - HttpHeaders headers = new HttpHeaders(); - headers.set ("X-Auth-User", cloudIdentity.getMsoId ()); - headers.set ("X-Auth-Key", CryptoUtils.decryptCloudConfigPassword(cloudIdentity.getMsoPass ())); - headers.set(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON.toString()); - headers.set(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON.toString()); - - if (logger.isDebugEnabled()) { - logger.debug(String.format("Multicloud Request Headers: %s", headers.toString())); - } - request = new HttpEntity<>(multicloudRequest, headers); } catch (Exception e) { logger.debug("ERROR making multicloud JSON body ", e); } @@ -211,7 +196,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{ } RestClient multicloudClient = getMulticloudClient(multicloudEndpoint); - Response response = multicloudClient.post(request); + Response response = multicloudClient.post(multicloudRequest); StackInfo createInfo = new StackInfo(); createInfo.setName(stackName); @@ -609,7 +594,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{ private RestClient getMulticloudClient(String endpoint) { RestClient client = null; try { - client= new HttpClient(UriBuilder.fromUri(endpoint).build().toURL(), + client = new HttpClient(UriBuilder.fromUri(endpoint).build().toURL(), MediaType.APPLICATION_JSON.toString(), TargetEntity.MULTICLOUD); } catch (MalformedURLException e) { logger.debug(String.format("Encountered malformed URL error getting multicloud rest client %s", e.getMessage())); @@ -715,7 +700,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{ try { // Delete the Multicloud stack - StackInfo stackInfo = deleteStack (tenantId, cloudSiteId, instanceId); + StackInfo stackInfo = deleteStack (cloudSiteId, tenantId, instanceId); // Populate a VduInstance based on the deleted Cloudify Deployment object VduInstance vduInstance = stackInfoToVduInstance(stackInfo); diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudRequest.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudRequest.java index fefc0951f6..4204813cec 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudRequest.java +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudRequest.java @@ -24,6 +24,9 @@ import java.io.Serializable; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.databind.JsonNode; +import com.woorea.openstack.heat.model.CreateStackParam; + import org.apache.commons.lang.builder.ToStringBuilder; @JsonInclude(JsonInclude.Include.NON_NULL) @@ -43,13 +46,13 @@ public class MulticloudRequest implements Serializable { @JsonProperty("vf-module-id") private String vfModuleId; @JsonProperty("oof_directives") - private String oofDirectives; + private JsonNode oofDirectives; @JsonProperty("sdnc_directives") - private String sdncDirectives; + private JsonNode sdncDirectives; @JsonProperty("template_type") private String templateType; @JsonProperty("template_data") - private String templateData; + private CreateStackParam templateData; @JsonProperty("generic-vnf-id") @@ -73,22 +76,22 @@ public class MulticloudRequest implements Serializable { } @JsonProperty("oof_directives") - public String getOofDirectives() { + public JsonNode getOofDirectives() { return oofDirectives; } @JsonProperty("oof_directives") - public void setOofDirectives(String oofDirectives) { + public void setOofDirectives(JsonNode oofDirectives) { this.oofDirectives = oofDirectives; } @JsonProperty("sdnc_directives") - public String getSdncDirectives() { + public JsonNode getSdncDirectives() { return sdncDirectives; } @JsonProperty("sdnc_directives") - public void setSdncDirectives(String sdncDirectives) { + public void setSdncDirectives(JsonNode sdncDirectives) { this.sdncDirectives = sdncDirectives; } @@ -103,12 +106,12 @@ public class MulticloudRequest implements Serializable { } @JsonProperty("template_data") - public String getTemplateData() { + public CreateStackParam getTemplateData() { return templateData; } @JsonProperty("template_data") - public void setTemplateData(String templateData) { + public void setTemplateData(CreateStackParam templateData) { this.templateData = templateData; } diff --git a/bpmn/so-bpmn-infrastructure-common/pom.xml b/bpmn/so-bpmn-infrastructure-common/pom.xml index 3523703ee8..55d5d9244e 100644 --- a/bpmn/so-bpmn-infrastructure-common/pom.xml +++ b/bpmn/so-bpmn-infrastructure-common/pom.xml @@ -269,7 +269,7 @@ <dependency> <groupId>org.onap.msb.java-sdk</groupId> <artifactId>msb-java-sdk</artifactId> - <version>1.0.0</version> + <version>1.1.1</version> <exclusions> <exclusion> <groupId>com.eclipsesource.jaxrs</groupId> diff --git a/bpmn/so-bpmn-infrastructure-flows/pom.xml b/bpmn/so-bpmn-infrastructure-flows/pom.xml index 63b66cafe5..7d7b89c8fb 100644 --- a/bpmn/so-bpmn-infrastructure-flows/pom.xml +++ b/bpmn/so-bpmn-infrastructure-flows/pom.xml @@ -244,18 +244,6 @@ <version>1.3</version> </dependency> <dependency> - <groupId>org.onap.msb.java-sdk</groupId> - <artifactId>msb-java-sdk</artifactId> - <version>1.0.0</version> - <exclusions> - <exclusion> - <groupId>com.eclipsesource.jaxrs</groupId> - <artifactId>jersey-all</artifactId> - </exclusion> - </exclusions> - </dependency> - - <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-configuration-processor</artifactId> <optional>true</optional> |