summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--nokiav2/deployment/.gitignore1
-rw-r--r--nokiav2/docs/.gitignore2
-rw-r--r--nokiav2/docs/sampleVnfs/simple/vfc.ns.instantiation.request.json38
-rw-r--r--nokiav2/docs/sampleVnfs/simpleDual/vfc.ns.instantiation.request.json36
-rw-r--r--nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/LifecycleManager.java7
-rw-r--r--nokiav2/driver/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/TestLifecycleManager.java34
6 files changed, 35 insertions, 83 deletions
diff --git a/nokiav2/deployment/.gitignore b/nokiav2/deployment/.gitignore
new file mode 100644
index 00000000..9fd62b53
--- /dev/null
+++ b/nokiav2/deployment/.gitignore
@@ -0,0 +1 @@
+driver.war
diff --git a/nokiav2/docs/.gitignore b/nokiav2/docs/.gitignore
index 589cdd01..a96ddfc2 100644
--- a/nokiav2/docs/.gitignore
+++ b/nokiav2/docs/.gitignore
@@ -1,3 +1,3 @@
_build
.DS_Store
-
+internal.rst
diff --git a/nokiav2/docs/sampleVnfs/simple/vfc.ns.instantiation.request.json b/nokiav2/docs/sampleVnfs/simple/vfc.ns.instantiation.request.json
index 30efc96e..34d16a47 100644
--- a/nokiav2/docs/sampleVnfs/simple/vfc.ns.instantiation.request.json
+++ b/nokiav2/docs/sampleVnfs/simple/vfc.ns.instantiation.request.json
@@ -1,41 +1,7 @@
{
- "nsInstanceId": "e7d79bd8-8e97-48fa-bbb8-fe2e8166b61c",
+ "nsInstanceId": "69c095e8-e24f-4e0b-821e-f6f8d342a929",
"additionalParamForNs": {
"location": "Nokia_RegionOne",
- "vnfs": {
- "669e8f94-b3a4-47ff-9245-c023c9fd5657": {
- "computeResourceFlavours": [
- {
- "vnfdVirtualComputeDescId": "server_compute",
- "resourceId": "m1.small"
- }
- ],
- "extVirtualLinks": [
- {
- "extCps": [
- {
- "cpdId": "comuniversal_ecp"
- }
- ],
- "resourceId": "external"
- }
- ],
- "zones": [
- {
- "resourceId": "nova",
- "id": "zoneInfoId"
- }
- ],
- "flavourId": "scalable",
- "vimType": "OPENSTACK_V2_INFO",
- "instantiationLevel": "default",
- "softwareImages": [
- {
- "resourceId": "ubuntu-16.04",
- "vnfdSoftwareImageId": "server_image"
- }
- ]
- }
- }
+ "61fbe643-8c92-4b95-a90a-d65f1ba359a9": "{ \"computeResourceFlavours\": [ { \"vnfdVirtualComputeDescId\": \"server_compute\", \"resourceId\": \"m1.small\" } ], \"extVirtualLinks\": [ { \"extCps\": [ { \"cpdId\": \"universal_ecp\" } ], \"resourceId\": \"pub_net\" } ], \"zones\": [ { \"resourceId\": \"compute-a\", \"id\": \"zoneInfoId\" } ], \"flavourId\": \"scalable\", \"vimType\": \"OPENSTACK_V3_INFO\", \"instantiationLevel\": \"default\", \"softwareImages\": [ { \"resourceId\": \"ubuntu.16.04\", \"vnfdSoftwareImageId\": \"server_image\" } ] }"
}
} \ No newline at end of file
diff --git a/nokiav2/docs/sampleVnfs/simpleDual/vfc.ns.instantiation.request.json b/nokiav2/docs/sampleVnfs/simpleDual/vfc.ns.instantiation.request.json
index 4b0ce8fd..2e4a3251 100644
--- a/nokiav2/docs/sampleVnfs/simpleDual/vfc.ns.instantiation.request.json
+++ b/nokiav2/docs/sampleVnfs/simpleDual/vfc.ns.instantiation.request.json
@@ -2,40 +2,6 @@
"nsInstanceId": "b65572a1-4f2e-4787-950d-bb489e970623",
"additionalParamForNs": {
"location": "Nokia_RegionOne",
- "vnfs": {
- "f85f054f-0928-4fab-ac76-b47b8fba0d6d": {
- "computeResourceFlavours": [
- {
- "vnfdVirtualComputeDescId": "server_compute",
- "resourceId": "m1.small"
- }
- ],
- "extVirtualLinks": [
- {
- "extCps": [
- {
- "cpdId": "commisioning_ecp"
- }
- ],
- "resourceId": "pub_net"
- }
- ],
- "zones": [
- {
- "resourceId": "compute-a",
- "id": "zoneInfoId"
- }
- ],
- "flavourId": "scalable",
- "vimType": "OPENSTACK_V2_INFO",
- "instantiationLevel": "default",
- "softwareImages": [
- {
- "resourceId": "ubuntu.16.04",
- "vnfdSoftwareImageId": "server_image"
- }
- ]
- }
- }
+ "f85f054f-0928-4fab-ac76-b47b8fba0d6d": "{ \"computeResourceFlavours\": [ { \"vnfdVirtualComputeDescId\": \"server_compute\", \"resourceId\": \"m1.small\" } ], \"extVirtualLinks\": [ { \"extCps\": [ { \"cpdId\": \"commisioning_ecp\" } ], \"resourceId\": \"pub_net\" } ], \"zones\": [ { \"resourceId\": \"compute-a\", \"id\": \"zoneInfoId\" } ], \"flavourId\": \"scalable\", \"vimType\": \"OPENSTACK_V2_INFO\", \"instantiationLevel\": \"default\", \"softwareImages\": [ { \"resourceId\": \"ubuntu.16.04\", \"vnfdSoftwareImageId\": \"server_image\" } ] }"
}
} \ No newline at end of file
diff --git a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/LifecycleManager.java b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/LifecycleManager.java
index 1312b9d6..b826931e 100644
--- a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/LifecycleManager.java
+++ b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/LifecycleManager.java
@@ -20,6 +20,7 @@ package org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.vnfm;
import com.google.gson.Gson;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
+import com.google.gson.JsonParser;
import com.nokia.cbam.catalog.v1.model.CatalogAdapterVnfpackage;
import com.nokia.cbam.lcm.v32.model.*;
import com.nokia.cbam.lcm.v32.model.ScaleDirection;
@@ -290,11 +291,11 @@ public class LifecycleManager {
}
private AdditionalParameters convertInstantiationAdditionalParams(String csarId, Object additionalParams) {
- JsonObject vnfParameters = child(child(new Gson().toJsonTree(additionalParams).getAsJsonObject(), "inputs"), "vnfs");
- if (!vnfParameters.has(csarId)) {
+ JsonObject inputs = child(new Gson().toJsonTree(additionalParams).getAsJsonObject(), "inputs");
+ if (!inputs.has(csarId)) {
throw buildFatalFailure(logger, "The additional parameter section does not contain setting for VNF with " + csarId + " CSAR id");
}
- JsonElement additionalParamsForVnf = vnfParameters.get(csarId);
+ JsonElement additionalParamsForVnf = new JsonParser().parse(inputs.get(csarId).getAsString());
return new Gson().fromJson(additionalParamsForVnf, AdditionalParameters.class);
}
diff --git a/nokiav2/driver/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/TestLifecycleManager.java b/nokiav2/driver/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/TestLifecycleManager.java
index ae58af91..026e65d0 100644
--- a/nokiav2/driver/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/TestLifecycleManager.java
+++ b/nokiav2/driver/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/TestLifecycleManager.java
@@ -15,10 +15,8 @@
*/
package org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.vnfm;
-import com.google.gson.Gson;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonObject;
-import com.google.gson.JsonParser;
+import com.google.gson.*;
+import com.google.gson.annotations.SerializedName;
import com.nokia.cbam.catalog.v1.model.CatalogAdapterVnfpackage;
import com.nokia.cbam.lcm.v32.model.*;
import com.nokia.cbam.lcm.v32.model.OperationType;
@@ -53,6 +51,7 @@ import static java.util.Optional.empty;
import static junit.framework.TestCase.*;
import static org.mockito.Mockito.*;
import static org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.util.CbamUtils.child;
+import static org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.util.CbamUtils.childElement;
import static org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.util.SystemFunctions.systemFunctions;
import static org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.vnfm.CbamRestApiProvider.NOKIA_LCM_API_VERSION;
import static org.springframework.test.util.ReflectionTestUtils.setField;
@@ -310,8 +309,9 @@ public class TestLifecycleManager extends TestBase {
ArgumentCaptor<InstantiateVnfRequest> actualInstantiationRequest = ArgumentCaptor.forClass(InstantiateVnfRequest.class);
when(vnfApi.vnfsVnfInstanceIdInstantiatePost(eq(VNF_ID), actualInstantiationRequest.capture(), eq(NOKIA_LCM_API_VERSION))).thenReturn(buildObservable(instantiationOperationExecution));
JsonObject inputs = child((JsonObject) instantiationRequest.getAdditionalParam(), "inputs");
- JsonObject vnfs = child(child(inputs, "vnfs"), ONAP_CSAR_ID);
- vnfs.remove("additionalParams");
+ JsonObject vnf = new JsonParser().parse(childElement(inputs, ONAP_CSAR_ID).getAsString()).getAsJsonObject();
+ vnf.remove("additionalParams");
+ inputs.add(ONAP_CSAR_ID, new JsonPrimitive(new Gson().toJson(vnf)));
//when
VnfInstantiateResponse response = lifecycleManager.createAndInstantiate(VNFM_ID, instantiationRequest, restResponse);
waitForJobToFinishInJobManager(finished);
@@ -1652,6 +1652,21 @@ public class TestLifecycleManager extends TestBase {
}
}
+ public static class X{
+ public Map<String, String> getInputs() {
+ return inputs;
+ }
+
+ public void setInputs(Map<String, String> inputs) {
+ this.inputs = inputs;
+ }
+
+ @SerializedName("inputs")
+ public Map<String,String> inputs = new HashMap<String,String>();
+
+ public String vimId;
+ }
+
private VnfInstantiateRequest prepareInstantiationRequest(VimInfo.VimInfoTypeEnum cloudType) {
VnfInstantiateRequest instantiationRequest = new VnfInstantiateRequest();
instantiationRequest.setVnfPackageId(ONAP_CSAR_ID);
@@ -1717,8 +1732,11 @@ public class TestLifecycleManager extends TestBase {
additionalParam.getSoftwareImages().add(image);
additionalParam.setAdditionalParams(new JsonParser().parse("{ \"a\" : \"b\" }"));
String params = new Gson().toJson(additionalParam);
- String src = "{ \"inputs\" : { \"vnfs\" : { \"" + ONAP_CSAR_ID + "\" : " + params + "}}, \"vimId\" : \"" + VIM_ID + "\"}";
- instantiationRequest.setAdditionalParam(new JsonParser().parse(src));
+ X x = new X();
+ x.inputs.put(ONAP_CSAR_ID, params);
+ x.vimId = VIM_ID;
+ JsonElement additionalParam = new Gson().toJsonTree(x);
+ instantiationRequest.setAdditionalParam(additionalParam);
return instantiationRequest;
}