summaryrefslogtreecommitdiffstats
path: root/adapters/mso-adapter-utils/src
diff options
context:
space:
mode:
Diffstat (limited to 'adapters/mso-adapter-utils/src')
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java7
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java13
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudRequest.java65
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java2
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoMulticloudUtilsTest.java17
5 files changed, 92 insertions, 12 deletions
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 <String, ?> 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<String> 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 <String, ?> 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();
}
}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java
index 888d376d37..c771a75976 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java
@@ -229,7 +229,7 @@ public class MsoHeatUtilsTest extends BaseTest{
StubOpenStack.mockOpenStackResponseAccess(wireMockPort);
StubOpenStack.mockOpenStackPostStack_200("OpenstackResponse_Stack_Created.json");
StubOpenStack.mockOpenStackGet("TEST-stack/stackId");
- StackInfo stackInfo = heatUtils.createStack(cloudSite.getId(), "CloudOwner", "tenantId", "TEST-stack",
+ StackInfo stackInfo = heatUtils.createStack(cloudSite.getId(), "CloudOwner", "tenantId", "TEST-stack", null,
"TEST-heat", new HashMap<>(), false, 1, "TEST-env",
new HashMap<>(), new HashMap<>(), false);
assertNotNull(stackInfo);
diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoMulticloudUtilsTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoMulticloudUtilsTest.java
index b999b49ab1..b2a69ded46 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoMulticloudUtilsTest.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoMulticloudUtilsTest.java
@@ -37,6 +37,7 @@ import org.junit.Test;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.onap.so.BaseTest;
+import org.onap.so.adapters.vdu.VduModelInfo;
import org.onap.so.cloud.CloudConfig;
import org.onap.so.db.catalog.beans.CloudIdentity;
import org.onap.so.db.catalog.beans.CloudSite;
@@ -64,9 +65,9 @@ public class MsoMulticloudUtilsTest extends BaseTest {
.willReturn(aResponse().withHeader("Content-Type", "application/json")
.withBody(CREATE_STACK_RESPONSE)
.withStatus(HttpStatus.SC_CREATED)));
- StackInfo result = multicloudUtils.createStack("MTN13", "CloudOwner", "TEST-tenant", "TEST-stack",
+ StackInfo result = multicloudUtils.createStack("MTN13", "CloudOwner", "TEST-tenant", "TEST-stack", new VduModelInfo(),
"TEST-heat", new HashMap<>(), false, 200, "TEST-env",
- new HashMap<>(), new HashMap<>());
+ new HashMap<>(), new HashMap<>(), false);
assertNotNull(result);
assertEquals("TEST-stack", result.getName());
}
@@ -79,9 +80,9 @@ public class MsoMulticloudUtilsTest extends BaseTest {
cloudSite.setIdentityService(new CloudIdentity());
when(cloudConfigMock.getCloudSite("MTN13")).
thenReturn(Optional.of(cloudSite));
- multicloudUtilsMock.createStack("MTN13", "CloudOwner", "TEST-tenant", "TEST-stack",
+ multicloudUtilsMock.createStack("MTN13", "CloudOwner", "TEST-tenant", "TEST-stack", new VduModelInfo(),
"TEST-heat", new HashMap<>(), false, 200, "TEST-env",
- new HashMap<>(), new HashMap<>());
+ new HashMap<>(), new HashMap<>(), false);
} catch (MsoException e) {
assertEquals("0 : Multicloud client could not be initialized", e.toString());
return;
@@ -95,9 +96,9 @@ public class MsoMulticloudUtilsTest extends BaseTest {
stubFor(post(urlPathEqualTo("/v2.0"))
.willReturn(aResponse().withHeader("Content-Type", "application/json")
.withStatus(HttpStatus.SC_BAD_REQUEST)));
- multicloudUtils.createStack("MTN13", "CloudOwner", "TEST-tenant", "TEST-stack",
+ multicloudUtils.createStack("MTN13", "CloudOwner", "TEST-tenant", "TEST-stack", new VduModelInfo(),
"TEST-heat", new HashMap<>(), false, 200, "TEST-env",
- new HashMap<>(), new HashMap<>());
+ new HashMap<>(), new HashMap<>(), false);
} catch (MsoException e) {
assertEquals("0 : Bad Request", e.toString());
return;
@@ -110,9 +111,9 @@ public class MsoMulticloudUtilsTest extends BaseTest {
stubFor(post(urlPathEqualTo("/v2.0"))
.willReturn(aResponse().withHeader("Content-Type", "application/json")
.withStatus(HttpStatus.SC_CREATED)));
- StackInfo result = multicloudUtils.createStack("MTN13", "CloudOwner", "TEST-tenant", "TEST-stack",
+ StackInfo result = multicloudUtils.createStack("MTN13", "CloudOwner", "TEST-tenant", "TEST-stack", new VduModelInfo(),
"TEST-heat", new HashMap<>(), false, 200, "TEST-env",
- new HashMap<>(), new HashMap<>());
+ new HashMap<>(), new HashMap<>(), false);
assertNotNull(result);
assertEquals("TEST-stack/", result.getName());
}