From eea8c1d2c9a830b20aacbacf9bbd0e36f664ee0f Mon Sep 17 00:00:00 2001 From: Eric Multanen Date: Thu, 21 Mar 2019 20:32:55 -0700 Subject: Multicloud VNF adapter use updated multicloud API Update the Multicloud plugin adapter to use the the enhanced multicloud infra_workload API. Mainly involves adding the user_directives and the vf-module model IDs to the call. Change-Id: I7ab78a8a304dbd61a5743ec67bb839037861ef9d Issue-ID: SO-1446 Signed-off-by: Eric Multanen --- .../org/onap/so/openstack/utils/MsoHeatUtils.java | 7 +++ .../so/openstack/utils/MsoMulticloudUtils.java | 13 ++++- .../onap/so/openstack/utils/MulticloudRequest.java | 65 +++++++++++++++++++++- 3 files changed, 82 insertions(+), 3 deletions(-) (limited to 'adapters/mso-adapter-utils/src/main/java') 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 b6c98ad996..e8ef86a3b4 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 @@ -147,6 +147,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ cloudOwner, tenantId, stackName, + null, heatTemplate, stackInputs, pollForCompletion, @@ -172,6 +173,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ cloudOwner, tenantId, stackName, + null, heatTemplate, stackInputs, pollForCompletion, @@ -197,6 +199,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ cloudOwner, tenantId, stackName, + null, heatTemplate, stackInputs, pollForCompletion, @@ -223,6 +226,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ cloudOwner, tenantId, stackName, + null, heatTemplate, stackInputs, pollForCompletion, @@ -262,6 +266,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ * @param cloudOwner the cloud owner of the cloud site in which to create the stack * @param tenantId The Openstack ID of the tenant in which to create the Stack * @param stackName The name of the stack to create + * @param vduModelInfo contains information about the vdu model (added for plugin adapter) * @param heatTemplate The Heat template * @param stackInputs A map of key/value inputs * @param pollForCompletion Indicator that polling should be handled in Java vs. in the client @@ -279,6 +284,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ String cloudOwner, String tenantId, String stackName, + VduModelInfo vduModel, String heatTemplate, Map stackInputs, boolean pollForCompletion, @@ -1551,6 +1557,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ cloudOwner, tenantId, instanceName, + vduModel, heatTemplate, inputs, true, // poll for completion 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 01120d51a3..fec4a1d16c 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 @@ -67,11 +67,12 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{ public static final String OOF_DIRECTIVES = "oof_directives"; public static final String SDNC_DIRECTIVES = "sdnc_directives"; + public static final String USER_DIRECTIVES = "user_directives"; public static final String VNF_ID = "vnf_id"; public static final String VF_MODULE_ID = "vf_module_id"; public static final String TEMPLATE_TYPE = "template_type"; public static final List MULTICLOUD_INPUTS = - Arrays.asList(OOF_DIRECTIVES, SDNC_DIRECTIVES, TEMPLATE_TYPE); + Arrays.asList(OOF_DIRECTIVES, SDNC_DIRECTIVES, USER_DIRECTIVES, TEMPLATE_TYPE); private static final Logger logger = LoggerFactory.getLogger(MsoMulticloudUtils.class); @@ -134,6 +135,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{ String cloudOwner, String tenantId, String stackName, + VduModelInfo vduModel, String heatTemplate, Map stackInputs, boolean pollForCompletion, @@ -148,6 +150,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{ // Get the directives, if present. String oofDirectives = "{}"; String sdncDirectives = "{}"; + String userDirectives = "{}"; String genericVnfId = ""; String vfModuleId = ""; String templateType = ""; @@ -160,6 +163,9 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{ if (key == SDNC_DIRECTIVES) { sdncDirectives = (String) stackInputs.get(key); } + if (key == USER_DIRECTIVES) { + sdncDirectives = (String) stackInputs.get(key); + } if (key == TEMPLATE_TYPE) { templateType = (String) stackInputs.get(key); } @@ -184,10 +190,14 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{ multicloudRequest.setGenericVnfId(genericVnfId); multicloudRequest.setVfModuleId(vfModuleId); + multicloudRequest.setVfModuleModelInvariantId(vduModel.getModelInvariantUUID()); + multicloudRequest.setVfModuleModelVersionId(vduModel.getModelUUID()); + multicloudRequest.setVfModuleModelCustomizationId(vduModel.getModelCustomizationUUID()); multicloudRequest.setTemplateType(templateType); multicloudRequest.setTemplateData(stack); multicloudRequest.setOofDirectives(getDirectiveNode(oofDirectives)); multicloudRequest.setSdncDirectives(getDirectiveNode(sdncDirectives)); + multicloudRequest.setUserDirectives(getDirectiveNode(userDirectives)); if (logger.isDebugEnabled()) { logger.debug(String.format("Multicloud Request is: %s", multicloudRequest.toString())); } @@ -677,6 +687,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{ cloudOwner, tenantId, instanceName, + vduModel, heatTemplate, inputs, true, // poll for completion 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 4204813cec..3689d34204 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 @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP - SO * ================================================================================ - * Copyright (C) 2018 Intel Corp. All rights reserved. + * Copyright (C) 2019 Intel Corp. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,8 +33,12 @@ import org.apache.commons.lang.builder.ToStringBuilder; @JsonPropertyOrder({ "generic-vnf-id", "vf-module-id", + "vf-module-model-invariant-id", + "vf-module-model-version-id", + "vf-module-model-customization-id", "oof_directives", "sdnc_directives", + "user_directives", "template_type", "template_data" }) @@ -45,10 +49,18 @@ public class MulticloudRequest implements Serializable { private String genericVnfId; @JsonProperty("vf-module-id") private String vfModuleId; + @JsonProperty("vf-module-model-invariant-id") + private String vfModuleModelInvariantId; + @JsonProperty("vf-module-model-version-id") + private String vfModuleModelVersionId; + @JsonProperty("vf-module-model-customization-id") + private String vfModuleModelCustomizationId; @JsonProperty("oof_directives") private JsonNode oofDirectives; @JsonProperty("sdnc_directives") private JsonNode sdncDirectives; + @JsonProperty("user_directives") + private JsonNode userDirectives; @JsonProperty("template_type") private String templateType; @JsonProperty("template_data") @@ -75,6 +87,36 @@ public class MulticloudRequest implements Serializable { this.vfModuleId = vfModuleId; } + @JsonProperty("vf-module-model-invariant-id") + public String getVfModuleModelInvariantId() { + return vfModuleModelInvariantId; + } + + @JsonProperty("vf-module-model-invariant-id") + public void setVfModuleModelInvariantId(String vfModuleModelInvariantId) { + this.vfModuleModelInvariantId = vfModuleModelInvariantId; + } + + @JsonProperty("vf-module-model-version-id") + public String getVfModuleModelVersionId() { + return vfModuleModelVersionId; + } + + @JsonProperty("vf-module-model-version-id") + public void setVfModuleModelVersionId(String vfModuleModelVersionId) { + this.vfModuleModelVersionId = vfModuleModelVersionId; + } + + @JsonProperty("vf-module-model-customization-id") + public String getVfModuleModelCustomizationId() { + return vfModuleModelCustomizationId; + } + + @JsonProperty("vf-module-model-customization-id") + public void setVfModuleModelCustomizationId(String vfModuleModelCustomizationId) { + this.vfModuleModelCustomizationId = vfModuleModelCustomizationId; + } + @JsonProperty("oof_directives") public JsonNode getOofDirectives() { return oofDirectives; @@ -95,6 +137,16 @@ public class MulticloudRequest implements Serializable { this.sdncDirectives = sdncDirectives; } + @JsonProperty("user_directives") + public JsonNode getUserDirectives() { + return userDirectives; + } + + @JsonProperty("user_directives") + public void setUserDirectives(JsonNode userDirectives) { + this.userDirectives = userDirectives; + } + @JsonProperty("template_type") public String getTemplateType() { return templateType; @@ -117,7 +169,16 @@ public class MulticloudRequest implements Serializable { @Override public String toString() { - return new ToStringBuilder(this).append("genericVnfId", genericVnfId).append("vfModuleId", vfModuleId).append("oofDirectives", oofDirectives).append("sdncDirectives", sdncDirectives).append("templateType", templateType).append("templateData", templateData).toString(); + return new ToStringBuilder(this).append("genericVnfId", genericVnfId) + .append("vfModuleId", vfModuleId) + .append("vfModuleModelInvariantId", vfModuleModelInvariantId) + .append("vfModuleModelVersionId", vfModuleModelVersionId) + .append("vfModuleModelCustomizationId", vfModuleModelCustomizationId) + .append("oofDirectives", oofDirectives) + .append("sdncDirectives", sdncDirectives) + .append("userDirectives", userDirectives) + .append("templateType", templateType) + .append("templateData", templateData).toString(); } } -- cgit 1.2.3-korg