summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenes Nemeth <denes.nemeth@nokia.com>2018-05-22 16:21:32 +0200
committerDenes Nemeth <denes.nemeth@nokia.com>2018-05-23 02:25:48 +0200
commit89ad26af6134b817ac2a04eb861d7c5a68f9885d (patch)
treeff272f63482e4bc245180ba017e2bcbdfb56aa71
parent258261c6c44ccfc7130080cd2cc651ec9a3537e2 (diff)
Process VNF property passed instantiation input
Change-Id: Ia4f6eeacb8bf346b5e1f56d8a953ce7691f3c2c7 Signed-off-by: Denes Nemeth <denes.nemeth@nokia.com> Issue-ID: VFC-728
-rw-r--r--nokiav2/docs/.gitignore1
-rw-r--r--nokiav2/docs/sample/vnfm.instantiation.request.json14
-rw-r--r--nokiav2/docs/sampleVnfs/simple/cbam.instantiation.request.json14
-rw-r--r--nokiav2/docs/sampleVnfs/simple/sdc.json1
-rw-r--r--nokiav2/docs/sampleVnfs/simple/simple.csarbin12047 -> 12123 bytes
-rw-r--r--nokiav2/docs/sampleVnfs/simple/vfc.ns.instantiation.request.direct.json6
-rw-r--r--nokiav2/docs/sampleVnfs/simpleDual/cbam.instantiation.request.json8
-rw-r--r--nokiav2/docs/sampleVnfs/simpleDual/simpleDual.csarbin11371 -> 12325 bytes
-rw-r--r--nokiav2/docs/sampleVnfs/simpleDual/vfc.ns.instantiation.request.direct.json6
-rw-r--r--nokiav2/docs/sampleVnfs/simple_cmcc/sdc.json1
-rw-r--r--nokiav2/docs/sampleVnfs/simple_cmcc/vfc.ns.instantiation.request.direct.json6
-rw-r--r--nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/packagetransformer/OnapVnfdBuilder.java4
-rw-r--r--nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/LifecycleManager.java19
-rw-r--r--nokiav2/driver/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/TestLifecycleManager.java124
-rw-r--r--nokiav2/driver/src/test/resources/unittests/packageconverter/empty.vnfd.onap.yaml4
-rw-r--r--nokiav2/driver/src/test/resources/unittests/packageconverter/nodes.vnfd.onap.yaml4
16 files changed, 184 insertions, 28 deletions
diff --git a/nokiav2/docs/.gitignore b/nokiav2/docs/.gitignore
index a96ddfc2..bd19fff5 100644
--- a/nokiav2/docs/.gitignore
+++ b/nokiav2/docs/.gitignore
@@ -1,3 +1,4 @@
_build
.DS_Store
internal.rst
+ims
diff --git a/nokiav2/docs/sample/vnfm.instantiation.request.json b/nokiav2/docs/sample/vnfm.instantiation.request.json
new file mode 100644
index 00000000..8b111b2b
--- /dev/null
+++ b/nokiav2/docs/sample/vnfm.instantiation.request.json
@@ -0,0 +1,14 @@
+{
+ "vnfInstanceName": "vnfc3bc829b-6057-4001-ad04-7c6",
+ "extVirtualLink": [],
+ "vnfPackageId": "c3bc829b-6057-4001-ad04-7c6bfdf30138",
+ "additionalParam": {
+ "inputs": {
+ "location": "Nokia_RegionOne"
+ },
+ "extVirtualLinks": [],
+ "properties": "{\"etsi_config\": \"{'zones': [{'resourceId': 'compute-a', 'id': 'zoneInfoId'}], 'extVirtualLinks': [{'resourceId': 'pub_net', 'extCps': [{'cpdId': 'universal_ecp'}]}], 'vimType': 'OPENSTACK_V3_INFO', 'instantiationLevel': 'default', 'softwareImages': [{'vnfdSoftwareImageId': 'server_image', 'resourceId': 'ubuntu.16.04'}], 'computeResourceFlavours': [{'resourceId': 'm1.small', 'vnfdVirtualComputeDescId': 'server_compute'}], 'flavourId': 'scalable'}\", \"id\": \"c3bc829b-6057-4001-ad04-7c6bfdf30138\", \"availability_zone_max_count\": \"1\"}",
+ "vimId": "Nokia_RegionOne"
+ },
+ "vnfDescriptorId": "c3bc829b-6057-4001-ad04-7c6bfdf30138"
+} \ No newline at end of file
diff --git a/nokiav2/docs/sampleVnfs/simple/cbam.instantiation.request.json b/nokiav2/docs/sampleVnfs/simple/cbam.instantiation.request.json
index 5ec6acbc..a85ca0ae 100644
--- a/nokiav2/docs/sampleVnfs/simple/cbam.instantiation.request.json
+++ b/nokiav2/docs/sampleVnfs/simple/cbam.instantiation.request.json
@@ -41,20 +41,20 @@
"vims": [
{
"accessInfo": {
- "username": "develadm",
- "tenant": "devel",
- "password": "develpass",
+ "username": "<username>",
+ "tenant": "<tenantName>",
+ "password": "<password>",
"region": "RegionOne"
- },
+ },
"interfaceInfo": {
- "endpoint": "https://10.41.49.107:5000/v2.0/",
+ "endpoint": "https://<keyStoneIp>:5000/v2.0/",
"trustedCertificates": [],
"skipCertificateVerification": true,
- "skipCertificateHostnameCheck": true
+ "skipCertificateHostnameCheck": true
},
"vimInfoType": "OPENSTACK_V2_INFO",
"id": "vim_id"
}
- ],
+ ],
"instantiationLevelId": "default"
}
diff --git a/nokiav2/docs/sampleVnfs/simple/sdc.json b/nokiav2/docs/sampleVnfs/simple/sdc.json
new file mode 100644
index 00000000..e6da9e17
--- /dev/null
+++ b/nokiav2/docs/sampleVnfs/simple/sdc.json
@@ -0,0 +1 @@
+{ "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" } ] }
diff --git a/nokiav2/docs/sampleVnfs/simple/simple.csar b/nokiav2/docs/sampleVnfs/simple/simple.csar
index da3637fe..fc03b56a 100644
--- a/nokiav2/docs/sampleVnfs/simple/simple.csar
+++ b/nokiav2/docs/sampleVnfs/simple/simple.csar
Binary files differ
diff --git a/nokiav2/docs/sampleVnfs/simple/vfc.ns.instantiation.request.direct.json b/nokiav2/docs/sampleVnfs/simple/vfc.ns.instantiation.request.direct.json
new file mode 100644
index 00000000..811f13a0
--- /dev/null
+++ b/nokiav2/docs/sampleVnfs/simple/vfc.ns.instantiation.request.direct.json
@@ -0,0 +1,6 @@
+{
+ "nsInstanceId": "23fd3ae5-c261-4662-9fcd-35107d33954f",
+ "additionalParamForNs": {
+ "location": "Nokia_RegionOne"
+ }
+} \ No newline at end of file
diff --git a/nokiav2/docs/sampleVnfs/simpleDual/cbam.instantiation.request.json b/nokiav2/docs/sampleVnfs/simpleDual/cbam.instantiation.request.json
index 5ec6acbc..16fc4d14 100644
--- a/nokiav2/docs/sampleVnfs/simpleDual/cbam.instantiation.request.json
+++ b/nokiav2/docs/sampleVnfs/simpleDual/cbam.instantiation.request.json
@@ -41,13 +41,13 @@
"vims": [
{
"accessInfo": {
- "username": "develadm",
- "tenant": "devel",
- "password": "develpass",
+ "username": "<username>",
+ "tenant": "<tenantName>",
+ "password": "<password>",
"region": "RegionOne"
},
"interfaceInfo": {
- "endpoint": "https://10.41.49.107:5000/v2.0/",
+ "endpoint": "https://<keyStoneIp>:5000/v2.0/",
"trustedCertificates": [],
"skipCertificateVerification": true,
"skipCertificateHostnameCheck": true
diff --git a/nokiav2/docs/sampleVnfs/simpleDual/simpleDual.csar b/nokiav2/docs/sampleVnfs/simpleDual/simpleDual.csar
index 7b0b57f0..3a43b788 100644
--- a/nokiav2/docs/sampleVnfs/simpleDual/simpleDual.csar
+++ b/nokiav2/docs/sampleVnfs/simpleDual/simpleDual.csar
Binary files differ
diff --git a/nokiav2/docs/sampleVnfs/simpleDual/vfc.ns.instantiation.request.direct.json b/nokiav2/docs/sampleVnfs/simpleDual/vfc.ns.instantiation.request.direct.json
new file mode 100644
index 00000000..452b10bb
--- /dev/null
+++ b/nokiav2/docs/sampleVnfs/simpleDual/vfc.ns.instantiation.request.direct.json
@@ -0,0 +1,6 @@
+{
+ "nsInstanceId": "b65572a1-4f2e-4787-950d-bb489e970623",
+ "additionalParamForNs": {
+ "location": "Nokia_RegionOne"
+ }
+} \ No newline at end of file
diff --git a/nokiav2/docs/sampleVnfs/simple_cmcc/sdc.json b/nokiav2/docs/sampleVnfs/simple_cmcc/sdc.json
new file mode 100644
index 00000000..16563884
--- /dev/null
+++ b/nokiav2/docs/sampleVnfs/simple_cmcc/sdc.json
@@ -0,0 +1 @@
+{ "computeResourceFlavours": [ { "vnfdVirtualComputeDescId": "server_compute", "resourceId": "m1.small" } ], "extVirtualLinks": [ { "extCps": [ { "cpdId": "universal_ecp" } ], "resourceId": "oam-nokia" } ], "zones": [ { "resourceId": "nova", "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/simple_cmcc/vfc.ns.instantiation.request.direct.json b/nokiav2/docs/sampleVnfs/simple_cmcc/vfc.ns.instantiation.request.direct.json
new file mode 100644
index 00000000..41820092
--- /dev/null
+++ b/nokiav2/docs/sampleVnfs/simple_cmcc/vfc.ns.instantiation.request.direct.json
@@ -0,0 +1,6 @@
+{
+ "nsInstanceId": "601f68d2-b1cd-4c47-8af9-1a781eb5fa2a",
+ "additionalParamForNs": {
+ "location": "NokiaNonAdmin_RegionOne"
+ }
+} \ No newline at end of file
diff --git a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/packagetransformer/OnapVnfdBuilder.java b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/packagetransformer/OnapVnfdBuilder.java
index 6a20bc20..406f0033 100644
--- a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/packagetransformer/OnapVnfdBuilder.java
+++ b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/packagetransformer/OnapVnfdBuilder.java
@@ -102,6 +102,10 @@ public class OnapVnfdBuilder {
" name: " + properties.get("product_name").getAsString() + "\n" +
" vnfdVersion: " + descriptorVersion + "\n\n" +
"topology_template:\n" +
+ " inputs:\n" +
+ " etsi_config:\n" +
+ " type: string\n"+
+ " description: The ETSI configuration\n"+
" node_templates:\n";
}
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 b826931e..0adba680 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
@@ -67,6 +67,7 @@ public class LifecycleManager {
*/
public static final String EXTERNAL_VNFM_ID = "externalVnfmId";
public static final String SCALE_OPERATION_NAME = "scale";
+ public static final String ETSI_CONFIG = "etsi_config";
private static Logger logger = getLogger(LifecycleManager.class);
private final CatalogManager catalogManager;
private final IGrantManager grantManager;
@@ -291,9 +292,23 @@ public class LifecycleManager {
}
private AdditionalParameters convertInstantiationAdditionalParams(String csarId, Object additionalParams) {
- JsonObject inputs = child(new Gson().toJsonTree(additionalParams).getAsJsonObject(), "inputs");
+ JsonObject root = new Gson().toJsonTree(additionalParams).getAsJsonObject();
+ if(root.has("properties")){
+ JsonObject properties = new JsonParser().parse(root.get("properties").getAsString()).getAsJsonObject();
+ if(properties.has(ETSI_CONFIG)){
+ JsonElement etsi_config = properties.get(ETSI_CONFIG);
+ return new Gson().fromJson(etsi_config.getAsString(), AdditionalParameters.class);
+ }
+ else{
+ logger.info("The instantiation input for VNF with {} CSAR id does not have an " + ETSI_CONFIG +" section", csarId);
+ }
+ }
+ else{
+ logger.info("The instantiation input for VNF with {} CSAR id does not have a properties section", csarId);
+ }
+ JsonObject inputs = child(root, "inputs");
if (!inputs.has(csarId)) {
- throw buildFatalFailure(logger, "The additional parameter section does not contain setting for VNF with " + csarId + " CSAR id");
+ throw buildFatalFailure(logger, "The additional parameter section does not contain settings for VNF with " + csarId + " CSAR id");
}
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 026e65d0..7760011d 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
@@ -264,6 +264,7 @@ public class TestLifecycleManager extends TestBase {
verify(jobManager).spawnJob(VNF_ID, restResponse);
verify(logger).info(eq("Starting {} operation on VNF with {} identifier with {} parameter"), eq("creation"), eq("not yet specified"), anyString());
verify(logger).info(eq("Starting {} operation on VNF with {} identifier with {} parameter"), eq("instantiation"), eq(VNF_ID), anyString());
+ verify(logger).info("The instantiation input for VNF with {} CSAR id does not have a properties section", ONAP_CSAR_ID);
}
/**
@@ -1192,8 +1193,8 @@ public class TestLifecycleManager extends TestBase {
VnfInstantiateResponse response = lifecycleManager.createAndInstantiate(VNFM_ID, instantiationRequest, restResponse);
fail();
} catch (Exception e) {
- assertEquals("The additional parameter section does not contain setting for VNF with myOnapCsarId CSAR id", e.getMessage());
- verify(logger).error("The additional parameter section does not contain setting for VNF with myOnapCsarId CSAR id");
+ assertEquals("The additional parameter section does not contain settings for VNF with myOnapCsarId CSAR id", e.getMessage());
+ verify(logger).error("The additional parameter section does not contain settings for VNF with myOnapCsarId CSAR id");
}
}
@@ -1665,6 +1666,8 @@ public class TestLifecycleManager extends TestBase {
public Map<String,String> inputs = new HashMap<String,String>();
public String vimId;
+
+ public String properties;
}
private VnfInstantiateRequest prepareInstantiationRequest(VimInfo.VimInfoTypeEnum cloudType) {
@@ -1673,6 +1676,23 @@ public class TestLifecycleManager extends TestBase {
instantiationRequest.setVnfDescriptorId(ONAP_CSAR_ID);
instantiationRequest.setVnfInstanceDescription("myDescription");
instantiationRequest.setVnfInstanceName("vnfName");
+ externalVirtualLink.setCpdId("myCpdId");
+ externalVirtualLink.setResourceId("myNetworkProviderId");
+ externalVirtualLink.setVlInstanceId("myEVlId");
+ externalVirtualLink.setResourceSubnetId("notUsedSubnetId");
+ instantiationRequest.setExtVirtualLink(new ArrayList<>());
+ instantiationRequest.getExtVirtualLink().add(externalVirtualLink);
+ buildAdditionalParams(cloudType);
+ String params = new Gson().toJson(additionalParam);
+ 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;
+ }
+
+ private void buildAdditionalParams(VimInfo.VimInfoTypeEnum cloudType) {
additionalParam.setInstantiationLevel("level1");
switch (cloudType) {
case OPENSTACK_V2_INFO:
@@ -1713,12 +1733,6 @@ public class TestLifecycleManager extends TestBase {
ecp2.setNumDynamicAddresses(2);
evl.getExtCps().add(ecp2);
additionalParam.getExtVirtualLinks().add(evl);
- externalVirtualLink.setCpdId("myCpdId");
- externalVirtualLink.setResourceId("myNetworkProviderId");
- externalVirtualLink.setVlInstanceId("myEVlId");
- externalVirtualLink.setResourceSubnetId("notUsedSubnetId");
- instantiationRequest.setExtVirtualLink(new ArrayList<>());
- instantiationRequest.getExtVirtualLink().add(externalVirtualLink);
additionalParam.getExtManagedVirtualLinks().add(extManVl);
ZoneInfo zone = new ZoneInfo();
zone.setId("zoneId");
@@ -1731,13 +1745,6 @@ public class TestLifecycleManager extends TestBase {
image.setVnfdSoftwareImageId("imageId");
additionalParam.getSoftwareImages().add(image);
additionalParam.setAdditionalParams(new JsonParser().parse("{ \"a\" : \"b\" }"));
- String params = new Gson().toJson(additionalParam);
- 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;
}
/**
@@ -1748,4 +1755,91 @@ public class TestLifecycleManager extends TestBase {
assertEquals("regionId", LifecycleManager.getRegionName("cloudOwner_regionId"));
assertEquals("cloudOwner", LifecycleManager.getCloudOwner("cloudOwner_regionId"));
}
+
+ /**
+ * additional params of instantiation may be passed as VNF property
+ */
+ @Test
+ public void testVnfConfigurationBasedOnPackageParameters() throws Exception {
+ VnfInstantiateRequest instantiationRequest = prepareInstantiationRequest(VimInfo.VimInfoTypeEnum.OPENSTACK_V3_INFO);
+ when(vnfApi.vnfsPost(createRequest.capture(), eq(NOKIA_LCM_API_VERSION))).thenReturn(buildObservable(vnfInfo));
+ additionalParam.setInstantiationLevel(INSTANTIATION_LEVEL);
+ when(vfcGrantManager.requestGrantForInstantiate(VNFM_ID, VNF_ID, VIM_ID, ONAP_CSAR_ID, INSTANTIATION_LEVEL, cbamVnfdContent, JOB_ID)).thenReturn(grantResponse);
+ grantResponse.setVimId(VIM_ID);
+ GrantVNFResponseVimAccessInfo accessInfo = new GrantVNFResponseVimAccessInfo();
+ accessInfo.setTenant(TENANT);
+ grantResponse.setAccessInfo(accessInfo);
+ ArgumentCaptor<InstantiateVnfRequest> actualInstantiationRequest = ArgumentCaptor.forClass(InstantiateVnfRequest.class);
+ when(vnfApi.vnfsVnfInstanceIdInstantiatePost(eq(VNF_ID), actualInstantiationRequest.capture(), eq(NOKIA_LCM_API_VERSION))).thenReturn(buildObservable(instantiationOperationExecution));
+ X x = new X();
+ JsonObject root = new JsonObject();
+ root.addProperty(LifecycleManager.ETSI_CONFIG, new Gson().toJson(additionalParam));
+ x.properties = new Gson().toJson(root);
+ x.vimId = VIM_ID;
+ JsonElement additionalParam = new Gson().toJsonTree(x);
+ instantiationRequest.setAdditionalParam(additionalParam);
+ //when
+ VnfInstantiateResponse response = lifecycleManager.createAndInstantiate(VNFM_ID, instantiationRequest, restResponse);
+ waitForJobToFinishInJobManager(finished);
+ assertEquals(1, actualInstantiationRequest.getValue().getVims().size());
+ //verify
+ OPENSTACKV3INFO actualVim = (OPENSTACKV3INFO) actualInstantiationRequest.getValue().getVims().get(0);
+ assertEquals(VIM_ID, actualVim.getId());
+ assertEquals(VimInfo.VimInfoTypeEnum.OPENSTACK_V3_INFO, actualVim.getVimInfoType());
+ assertEquals(Boolean.valueOf(parseBoolean(vimInfo.getSslInsecure())), actualVim.getInterfaceInfo().isSkipCertificateVerification());
+ assertEquals("cloudUrl", actualVim.getInterfaceInfo().getEndpoint());
+ //FIXME assertEquals();actualVim.getInterfaceInfo().getTrustedCertificates());
+ assertEquals("vimPassword", actualVim.getAccessInfo().getPassword());
+ assertEquals("regionId", actualVim.getAccessInfo().getRegion());
+ assertEquals("myTenant", actualVim.getAccessInfo().getProject());
+ assertEquals("myDomain", actualVim.getAccessInfo().getDomain());
+ assertEquals("vimUsername", actualVim.getAccessInfo().getUsername());
+ assertTrue(actualVim.getInterfaceInfo().isSkipCertificateVerification());
+ assertTrue(actualVim.getInterfaceInfo().isSkipCertificateHostnameCheck());
+ }
+
+ /**
+ * additional params of instantiation may be passed as VNF property
+ */
+ @Test
+ public void testVnfConfigurationBasedOnPackageParametersMissingPropertiesEtsiConfig() throws Exception {
+ VnfInstantiateRequest instantiationRequest = prepareInstantiationRequest(VimInfo.VimInfoTypeEnum.OPENSTACK_V3_INFO);
+ when(vnfApi.vnfsPost(createRequest.capture(), eq(NOKIA_LCM_API_VERSION))).thenReturn(buildObservable(vnfInfo));
+ additionalParam.setInstantiationLevel(INSTANTIATION_LEVEL);
+ when(vfcGrantManager.requestGrantForInstantiate(VNFM_ID, VNF_ID, VIM_ID, ONAP_CSAR_ID, INSTANTIATION_LEVEL, cbamVnfdContent, JOB_ID)).thenReturn(grantResponse);
+ grantResponse.setVimId(VIM_ID);
+ GrantVNFResponseVimAccessInfo accessInfo = new GrantVNFResponseVimAccessInfo();
+ accessInfo.setTenant(TENANT);
+ grantResponse.setAccessInfo(accessInfo);
+ ArgumentCaptor<InstantiateVnfRequest> actualInstantiationRequest = ArgumentCaptor.forClass(InstantiateVnfRequest.class);
+ when(vnfApi.vnfsVnfInstanceIdInstantiatePost(eq(VNF_ID), actualInstantiationRequest.capture(), eq(NOKIA_LCM_API_VERSION))).thenReturn(buildObservable(instantiationOperationExecution));
+ X x = new X();
+ JsonObject root = new JsonObject();
+ root.addProperty(LifecycleManager.ETSI_CONFIG, new Gson().toJson(additionalParam));
+ x.properties = "{ }";
+ new Gson().toJson(root);
+ x.inputs.put(ONAP_CSAR_ID, new Gson().toJson(additionalParam));
+ x.vimId = VIM_ID;
+ JsonElement additionalParam = new Gson().toJsonTree(x);
+ instantiationRequest.setAdditionalParam(additionalParam);
+ //when
+ VnfInstantiateResponse response = lifecycleManager.createAndInstantiate(VNFM_ID, instantiationRequest, restResponse);
+ waitForJobToFinishInJobManager(finished);
+ assertEquals(1, actualInstantiationRequest.getValue().getVims().size());
+ //verify
+ OPENSTACKV3INFO actualVim = (OPENSTACKV3INFO) actualInstantiationRequest.getValue().getVims().get(0);
+ assertEquals(VIM_ID, actualVim.getId());
+ assertEquals(VimInfo.VimInfoTypeEnum.OPENSTACK_V3_INFO, actualVim.getVimInfoType());
+ assertEquals(Boolean.valueOf(parseBoolean(vimInfo.getSslInsecure())), actualVim.getInterfaceInfo().isSkipCertificateVerification());
+ assertEquals("cloudUrl", actualVim.getInterfaceInfo().getEndpoint());
+ //FIXME assertEquals();actualVim.getInterfaceInfo().getTrustedCertificates());
+ assertEquals("vimPassword", actualVim.getAccessInfo().getPassword());
+ assertEquals("regionId", actualVim.getAccessInfo().getRegion());
+ assertEquals("myTenant", actualVim.getAccessInfo().getProject());
+ assertEquals("myDomain", actualVim.getAccessInfo().getDomain());
+ assertEquals("vimUsername", actualVim.getAccessInfo().getUsername());
+ assertTrue(actualVim.getInterfaceInfo().isSkipCertificateVerification());
+ assertTrue(actualVim.getInterfaceInfo().isSkipCertificateHostnameCheck());
+ verify(logger).info("The instantiation input for VNF with {} CSAR id does not have an " + LifecycleManager.ETSI_CONFIG + " section", ONAP_CSAR_ID);
+ }
}
diff --git a/nokiav2/driver/src/test/resources/unittests/packageconverter/empty.vnfd.onap.yaml b/nokiav2/driver/src/test/resources/unittests/packageconverter/empty.vnfd.onap.yaml
index 1cbc8ef7..6650bd91 100644
--- a/nokiav2/driver/src/test/resources/unittests/packageconverter/empty.vnfd.onap.yaml
+++ b/nokiav2/driver/src/test/resources/unittests/packageconverter/empty.vnfd.onap.yaml
@@ -11,4 +11,8 @@ metadata:
vnfdVersion: 1.0
topology_template:
+ inputs:
+ etsi_config:
+ type: string
+ description: The ETSI configuration
node_templates:
diff --git a/nokiav2/driver/src/test/resources/unittests/packageconverter/nodes.vnfd.onap.yaml b/nokiav2/driver/src/test/resources/unittests/packageconverter/nodes.vnfd.onap.yaml
index 49446544..5a3871af 100644
--- a/nokiav2/driver/src/test/resources/unittests/packageconverter/nodes.vnfd.onap.yaml
+++ b/nokiav2/driver/src/test/resources/unittests/packageconverter/nodes.vnfd.onap.yaml
@@ -11,6 +11,10 @@ metadata:
vnfdVersion: 1.0
topology_template:
+ inputs:
+ etsi_config:
+ type: string
+ description: The ETSI configuration
node_templates:
vduNode:
type: tosca.nodes.nfv.VDU.Compute