summaryrefslogtreecommitdiffstats
path: root/nokiav2
diff options
context:
space:
mode:
Diffstat (limited to 'nokiav2')
-rw-r--r--nokiav2/docs/onboarding.rst20
-rw-r--r--nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/onap/vfc/VfcGrantManager.java4
-rw-r--r--nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/onap/vfc/VfcRestApiProvider.java5
-rw-r--r--nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/CatalogManager.java21
-rw-r--r--nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/LifecycleManager.java22
-rw-r--r--nokiav2/driver/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/onap/vfc/TestVfcGrantManager.java1
-rw-r--r--nokiav2/driver/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/TestCbamCatalogManager.java33
-rw-r--r--nokiav2/driver/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/TestLifecycleManager.java93
-rw-r--r--nokiav2/driver/src/test/resources/unittests/TestCbamCatalogManager.sample.csarbin2321 -> 2549 bytes
-rw-r--r--nokiav2/driver/src/test/resources/unittests/vnfd.full.yaml5
-rw-r--r--nokiav2/driver/src/test/resources/unittests/vnfd.instantiation.yaml3
11 files changed, 177 insertions, 30 deletions
diff --git a/nokiav2/docs/onboarding.rst b/nokiav2/docs/onboarding.rst
index 3380e438..80aff0b2 100644
--- a/nokiav2/docs/onboarding.rst
+++ b/nokiav2/docs/onboarding.rst
@@ -161,9 +161,27 @@ The following section requires the CSAR and the ETSI configuration of the VNF to
- Specify NokiaSVNFM for the nf_type property
+ - Click on Save on the middle
+
+ - Click on Inputs
+
- Specify the ETSI configuration JSON for the etsi_config property
- - Click on Save on the middle
+ - If the ETSI configuration is larger than the maximal allowed value for a field
+
+ - Instead of specifying it using a property click on Deployment Artifact at left
+
+ - Click on Add other artifact at bottom middle
+
+ - Specify etsiConfig as Artifact Label
+
+ - Choose OTHER for type
+
+ - Specify anything for Description
+
+ - Select the ETSI configuration file using Browse
+
+ - Click on Done
- Click on Check in
diff --git a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/onap/vfc/VfcGrantManager.java b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/onap/vfc/VfcGrantManager.java
index c2ba4642..cf090630 100644
--- a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/onap/vfc/VfcGrantManager.java
+++ b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/onap/vfc/VfcGrantManager.java
@@ -166,12 +166,14 @@ public class VfcGrantManager implements IGrantManager {
}
private Set<ResourceChange> calculateResourceChangeDuringInstantiate(String cbamVnfdContent, String instantiationLevelId) {
+ logger.info("Calculating resource changed {} {}", instantiationLevelId, cbamVnfdContent);
JsonObject root = new Gson().toJsonTree(new Yaml().load(cbamVnfdContent)).getAsJsonObject();
JsonObject capabilities = child(child(child(root, "topology_template"), "substitution_mappings"), "capabilities");
JsonObject deploymentFlavorProperties = child(child(capabilities, "deployment_flavour"), "properties");
JsonObject instantiationLevels = child(deploymentFlavorProperties, "instantiation_levels");
Set<ResourceChange> resourceChanges = new HashSet<>();
- for (Map.Entry<String, JsonElement> vdu_level : child(child(instantiationLevels, instantiationLevelId), ("vdu_levels")).entrySet()) {
+ JsonObject instantiationLevel = child(instantiationLevels, instantiationLevelId);
+ for (Map.Entry<String, JsonElement> vdu_level : child(instantiationLevel, "vdu_levels").entrySet()) {
JsonElement numberOfInstances = vdu_level.getValue().getAsJsonObject().get("number_of_instances");
for (int i = 0; i < numberOfInstances.getAsLong(); i++) {
ResourceChange resourceChange = new ResourceChange();
diff --git a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/onap/vfc/VfcRestApiProvider.java b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/onap/vfc/VfcRestApiProvider.java
index 5c9dc543..6b19dd55 100644
--- a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/onap/vfc/VfcRestApiProvider.java
+++ b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/onap/vfc/VfcRestApiProvider.java
@@ -16,6 +16,7 @@
package org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.onap.vfc;
import com.google.common.annotations.VisibleForTesting;
+import java.util.concurrent.TimeUnit;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.onap.core.MsbApiProvider;
import org.onap.vfccatalog.api.VnfpackageApi;
import org.onap.vnfmdriver.ApiClient;
@@ -49,6 +50,10 @@ public class VfcRestApiProvider {
@VisibleForTesting
ApiClient buildNslcmApiClient() {
ApiClient apiClient = new ApiClient();
+ //LCN processing in VF-C is very slow
+ apiClient.getOkBuilder().connectTimeout(3, TimeUnit.MINUTES);
+ apiClient.getOkBuilder().readTimeout(3, TimeUnit.MINUTES);
+ apiClient.getOkBuilder().writeTimeout(3, TimeUnit.MINUTES);
String correctedUrl = fixIncorrectUrl();
if (!correctedUrl.endsWith("/")) {
correctedUrl = correctedUrl + "/";
diff --git a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/CatalogManager.java b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/CatalogManager.java
index aeeae423..0993c6ee 100644
--- a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/CatalogManager.java
+++ b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/CatalogManager.java
@@ -16,6 +16,7 @@
package org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.vnfm;
+import com.google.common.base.Charsets;
import com.google.common.io.ByteStreams;
import com.nokia.cbam.catalog.v1.api.DefaultApi;
import com.nokia.cbam.catalog.v1.model.CatalogAdapterVnfpackage;
@@ -36,6 +37,7 @@ import static com.google.common.collect.Iterables.filter;
import static okhttp3.MediaType.parse;
import static okhttp3.RequestBody.create;
import static org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.util.CbamUtils.buildFatalFailure;
+import static org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.vnfm.LifecycleManager.ETSI_CONFIG;
import static org.slf4j.LoggerFactory.getLogger;
import static org.springframework.http.MediaType.APPLICATION_OCTET_STREAM;
@@ -50,6 +52,8 @@ public class CatalogManager {
* The location of the CBAM package within the ONAP package
*/
public static final String CBAM_PACKAGE_NAME_IN_ZIP = "Artifacts/Deployment/OTHER/cbam.package.zip";
+ public static final String ETSI_CONFIG_NAME_IN_ZIP = "Artifacts/Deployment/OTHER/" + ETSI_CONFIG +".json";
+
private static final String TOSCA_META_PATH = "TOSCA-Metadata/TOSCA.meta";
private static final String TOSCA_VNFD_KEY = "Entry-Definitions";
private static Logger logger = getLogger(CatalogManager.class);
@@ -108,7 +112,7 @@ public class CatalogManager {
public CatalogAdapterVnfpackage preparePackageInCbam(String vnfmId, String csarId) {
String cbamVnfdId = packageProvider.getCbamVnfdId(csarId);
DefaultApi cbamCatalogApi = cbamRestApiProvider.getCbamCatalogApi(vnfmId);
- if (!isPackageReplicated(cbamVnfdId, cbamCatalogApi)) {
+ if (!isPackageReplicated(cbamVnfdId, cbamCatalogApi)) {
try {
ByteArrayOutputStream cbamPackage = getFileInZip(new ByteArrayInputStream(packageProvider.getPackage(csarId)), CBAM_PACKAGE_NAME_IN_ZIP);
return cbamCatalogApi.create(create(parse(APPLICATION_OCTET_STREAM.toString()), cbamPackage.toByteArray())).blockingFirst();
@@ -128,6 +132,21 @@ public class CatalogManager {
}
/**
+ * Download the ETSI configuration of the VNF
+ * @param csarId the CSAR identifier of the package in ONAP catalog
+ * @return the content of the ETSI configuration
+ */
+ public String getEtsiConfiguration(String csarId){
+ try {
+ ByteArrayOutputStream etsiConfig = getFileInZip(new ByteArrayInputStream(packageProvider.getPackage(csarId)), ETSI_CONFIG_NAME_IN_ZIP);
+ return new String(etsiConfig.toByteArray(), Charsets.UTF_8);
+ }
+ catch (Exception e){
+ throw buildFatalFailure(logger, "Unable to download the ETSI configuration file");
+ }
+ }
+
+ /**
* Gets the content of the VNFD from the CBAM package uploaded to CBAM
*
* @param vnfmId the identifier of the VNFM
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 5d65050c..e36ede4e 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
@@ -18,6 +18,8 @@ package org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.vnfm;
import com.google.common.base.Joiner;
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Sets;
import com.google.gson.Gson;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
@@ -28,6 +30,8 @@ import com.nokia.cbam.lcm.v32.model.ScaleDirection;
import java.util.*;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
import javax.servlet.http.HttpServletResponse;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.api.IGrantManager;
import org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.api.VimInfoProvider;
@@ -313,7 +317,7 @@ public class LifecycleManager {
}
JsonObject inputs = child(root, "inputs");
if (!inputs.has(csarId)) {
- throw buildFatalFailure(logger, "The additional parameter section does not contain settings for VNF with " + csarId + " CSAR id");
+ return new Gson().fromJson(catalogManager.getEtsiConfiguration(csarId), AdditionalParameters.class);
}
JsonElement additionalParamsForVnf = new JsonParser().parse(inputs.get(csarId).getAsString());
return new Gson().fromJson(additionalParamsForVnf, AdditionalParameters.class);
@@ -326,11 +330,19 @@ public class LifecycleManager {
return childElement(deploymentFlavorProperties, "flavour_id").getAsString();
}
- private Set<Map.Entry<String, JsonElement>> getAcceptableOperationParameters(String vnfdContent, String categoryOfOperation, String operationName) {
+ private Set<Map.Entry<String, JsonElement>> getAcceptableOperationParameters(String vnfdContent, String operationName) {
JsonObject root = new Gson().toJsonTree(new Yaml().load(vnfdContent)).getAsJsonObject();
JsonObject interfaces = child(child(child(root, "topology_template"), "substitution_mappings"), "interfaces");
- JsonObject additionalParameters = child(child(child(child(interfaces, categoryOfOperation), operationName), "inputs"), "additional_parameters");
- return additionalParameters.entrySet();
+ for (Map.Entry<String, JsonElement> categoryOfOperation : interfaces.entrySet()) {
+ for (Map.Entry<String, JsonElement> operation : categoryOfOperation.getValue().getAsJsonObject().entrySet()) {
+ if(operation.getKey().equals(operationName)){
+ JsonObject additionalParameters = child(child(operation.getValue().getAsJsonObject(), "inputs"), "additional_parameters");
+ return additionalParameters.entrySet();
+ }
+ }
+ logger.debug("The {} operation was not found in {} interface", operationName, categoryOfOperation.getKey());
+ }
+ throw buildFatalFailure(logger, "Unable to find operation named " + operationName);
}
private void addExternalLinksToRequest(List<ExtVirtualLinkInfo> extVirtualLinks, AdditionalParameters additionalParameters, InstantiateVnfRequest instantiationRequest, String vimId) {
@@ -596,7 +608,7 @@ public class LifecycleManager {
JsonObject root = new Gson().toJsonTree(jobInfo).getAsJsonObject();
com.nokia.cbam.lcm.v32.model.VnfInfo cbamVnfInfo = cbamRestApiProvider.getCbamLcmApi(vnfmId).vnfsVnfInstanceIdGet(vnfId, NOKIA_LCM_API_VERSION).blockingFirst();
String vnfdContent = catalogManager.getCbamVnfdContent(vnfmId, cbamVnfInfo.getVnfdId());
- Set<Map.Entry<String, JsonElement>> acceptableOperationParameters = getAcceptableOperationParameters(vnfdContent, "Basic", SCALE_OPERATION_NAME);
+ Set<Map.Entry<String, JsonElement>> acceptableOperationParameters = getAcceptableOperationParameters(vnfdContent, SCALE_OPERATION_NAME);
buildAdditionalParameters(request, root, acceptableOperationParameters);
cbamRequest.setAdditionalParams(root);
grantManager.requestGrantForScale(vnfmId, vnfId, getVimIdFromInstantiationRequest(vnfmId, vnf), getVnfdIdFromModifyableAttributes(vnf), request, jobInfo.getJobId());
diff --git a/nokiav2/driver/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/onap/vfc/TestVfcGrantManager.java b/nokiav2/driver/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/onap/vfc/TestVfcGrantManager.java
index f1ed1e16..a5a3c6cb 100644
--- a/nokiav2/driver/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/onap/vfc/TestVfcGrantManager.java
+++ b/nokiav2/driver/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/onap/vfc/TestVfcGrantManager.java
@@ -77,6 +77,7 @@ public class TestVfcGrantManager extends TestBase {
assertBasicGrantAttributes(request, org.onap.vnfmdriver.model.OperationType.INSTANTIATE);
}
+
/**
* test failure logging & propagation during grant request for instantiation
*/
diff --git a/nokiav2/driver/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/TestCbamCatalogManager.java b/nokiav2/driver/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/TestCbamCatalogManager.java
index 439325ec..28e4709a 100644
--- a/nokiav2/driver/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/TestCbamCatalogManager.java
+++ b/nokiav2/driver/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/TestCbamCatalogManager.java
@@ -251,6 +251,39 @@ public class TestCbamCatalogManager extends TestBase {
}
}
+ /**
+ * ETSI configuration extraction from the package
+ */
+ @Test
+ public void testEtsiConfigurationDownload() throws Exception{
+ //given
+ byte[] onapPackageContent = TestUtil.loadFile("unittests/TestCbamCatalogManager.sample.csar");
+ when(packageProvider.getPackage(CSAR_ID)).thenReturn(onapPackageContent);
+ //when
+ String etsiConfiguration = cbamCatalogManager.getEtsiConfiguration(CSAR_ID);
+
+ assertEquals("{ \"a\" : \"b\" }\n", etsiConfiguration);
+ }
+
+ /**
+ * ETSI configuration extraction from the package
+ */
+ @Test
+ public void testEtsiConfigurationMissing() throws Exception{
+ //given
+ byte[] onapPackageContent = TestUtil.loadFile("unittests/missing.vnfd.zip");
+ when(packageProvider.getPackage(CSAR_ID)).thenReturn(onapPackageContent);
+ //when
+ try {
+ cbamCatalogManager.getEtsiConfiguration(CSAR_ID);
+ fail();
+ }
+ catch (Exception e){
+ assertEquals("Unable to download the ETSI configuration file", e.getMessage());
+ verify(logger).error("Unable to download the ETSI configuration file");
+ }
+ }
+
private ResponseBody buildResponse(byte[] content) throws IOException {
Headers headers = new Headers.Builder().build();
Buffer buffer = new Buffer();
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 d91c8477..02be5a8d 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
@@ -1198,26 +1198,7 @@ public class TestLifecycleManager extends TestBase {
notificationIsProcessedBeforeDeletingTheVnf.verify(notificationManager).waitForTerminationToBeProcessed("terminationId");
notificationIsProcessedBeforeDeletingTheVnf.verify(vnfApi).vnfsVnfInstanceIdDelete(VNF_ID, NOKIA_LCM_API_VERSION);
}
-
- /**
- * instantiation with missing ONAP csarId to instantiation extra param result in failure
- */
- @Test
- public void testMissingVnfParameters() throws Exception {
- //given
- VnfInstantiateRequest instantiationRequest = prepareInstantiationRequest(VimInfo.VimInfoTypeEnum.OPENSTACK_V2_INFO, false);
- String src = "{ \"inputs\" : { \"vnfs\" : { \"" + ONAP_CSAR_ID + "invalid" + "\" : {}}}, \"vimId\" : \"" + VIM_ID + "\"}";
- instantiationRequest.setAdditionalParam(new JsonParser().parse(src));
- //when
- try {
- VnfInstantiateResponse response = lifecycleManager.createAndInstantiate(VNFM_ID, instantiationRequest, restResponse);
- fail();
- } catch (Exception e) {
- 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");
- }
- }
-
+
/**
* test explicit forceful termination
*/
@@ -1421,20 +1402,49 @@ public class TestLifecycleManager extends TestBase {
assertTrue("{\"jobId\":\"myJobId\",\"a\":\"b\"}".equals(new Gson().toJson(sRequest.getAdditionalParams())) || "{\"a\":\"b\",\"jobId\":\"myJobId\"}".equals(new Gson().toJson(sRequest.getAdditionalParams())));
verify(jobManager).spawnJob(VNF_ID, restResponse);
verify(logger).info(eq("Starting {} operation on VNF with {} identifier with {} parameter"), eq("scale"), eq(VNF_ID), anyString());
+ }
+ /**
+ * test scale a non scalable VNF
+ */
+ @Test
+ public void testScaleNonScalableVnf() throws Exception {
+ cbamVnfdContent = new String(readAllBytes(Paths.get(TestVfcGrantManager.class.getResource("/unittests/vnfd.instantiation.yaml").toURI())));
+ when(catalogManager.getCbamVnfdContent(VNFM_ID, CBAM_VNFD_ID)).thenReturn(cbamVnfdContent);
+ VnfScaleRequest scaleRequest = new VnfScaleRequest();
+ scaleRequest.setNumberOfSteps("2");
+ scaleRequest.setAspectId("myAspect");
+ scaleRequest.setType(ScaleDirection.IN);
+ scaleRequest.setAdditionalParam(new JsonParser().parse("{ \"a\" : \"b\", \"c\" : \"d\" }"));
+ scaleOperationExecution.setStatus(OperationStatus.FINISHED);
+ when(vnfApi.vnfsVnfInstanceIdGet(VNF_ID, NOKIA_LCM_API_VERSION)).thenReturn(buildObservable(vnfInfo));
+ VnfProperty prop = new VnfProperty();
+ prop.setValue(ONAP_CSAR_ID);
+ prop.setName(LifecycleManager.ONAP_CSAR_ID);
+ vnfInfo.getExtensions().add(prop);
+ vnfInfo.getOperationExecutions().add(instantiationOperationExecution);
+ String instantiationParams = "{ \"vims\" : [ { \"id\" : \"" + VIM_ID + "\" } ] }";
+ when(operationExecutionApi.operationExecutionsOperationExecutionIdOperationParamsGet(instantiationOperationExecution.getId(), NOKIA_LCM_API_VERSION)).thenReturn(buildObservable(new JsonParser().parse(instantiationParams)));
+ //when
+ JobInfo job = lifecycleManager.scaleVnf(VNFM_ID, VNF_ID, scaleRequest, restResponse);
+ //verify
+ waitForJobToFinishInJobManager(finished);
+ assertEquals(0, actualScaleRequest.getAllValues().size());
+ verify(logger).error("Unable to find operation named scale");
}
/**
* the VNFM should tolerate that no additional params were supplied
*/
@Test
- public void testScaleWithoutAddtionalParams() throws Exception {
+ public void testScaleWithoutAdditionalParams() throws Exception {
VnfScaleRequest scaleRequest = new VnfScaleRequest();
scaleRequest.setNumberOfSteps("2");
scaleRequest.setAspectId("myAspect");
scaleRequest.setType(ScaleDirection.IN);
scaleRequest.setAdditionalParam(null);
scaleOperationExecution.setStatus(OperationStatus.FINISHED);
+
when(vnfApi.vnfsVnfInstanceIdGet(VNF_ID, NOKIA_LCM_API_VERSION)).thenReturn(buildObservable(vnfInfo));
VnfProperty prop = new VnfProperty();
prop.setValue(ONAP_CSAR_ID);
@@ -1834,6 +1844,47 @@ public class TestLifecycleManager extends TestBase {
assertTrue(actualVim.getInterfaceInfo().isSkipCertificateHostnameCheck());
}
+
+ /**
+ * additional params of instantiation may be passed as directly attached artifact
+ */
+ @Test
+ public void testVnfConfigurationBasedOnArtifactParameters() throws Exception {
+ VnfInstantiateRequest instantiationRequest = prepareInstantiationRequest(VimInfo.VimInfoTypeEnum.OPENSTACK_V3_INFO, false);
+ 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));
+ when(catalogManager.getEtsiConfiguration(ONAP_CSAR_ID)).thenReturn(new Gson().toJson(additionalParam));
+ X x = new X();
+ 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
*/
diff --git a/nokiav2/driver/src/test/resources/unittests/TestCbamCatalogManager.sample.csar b/nokiav2/driver/src/test/resources/unittests/TestCbamCatalogManager.sample.csar
index 1a179166..de27687e 100644
--- a/nokiav2/driver/src/test/resources/unittests/TestCbamCatalogManager.sample.csar
+++ b/nokiav2/driver/src/test/resources/unittests/TestCbamCatalogManager.sample.csar
Binary files differ
diff --git a/nokiav2/driver/src/test/resources/unittests/vnfd.full.yaml b/nokiav2/driver/src/test/resources/unittests/vnfd.full.yaml
index 460f7f10..94905506 100644
--- a/nokiav2/driver/src/test/resources/unittests/vnfd.full.yaml
+++ b/nokiav2/driver/src/test/resources/unittests/vnfd.full.yaml
@@ -17,8 +17,11 @@ topology_template:
number_of_instances: 2
interfaces:
Basic:
+ unknown:
+ Scl:
scale:
inputs:
additional_parameters:
jobId: kuku
- a: valueInVnfd \ No newline at end of file
+ a: valueInVnfd
+ unknown2: \ No newline at end of file
diff --git a/nokiav2/driver/src/test/resources/unittests/vnfd.instantiation.yaml b/nokiav2/driver/src/test/resources/unittests/vnfd.instantiation.yaml
index ef858dbc..50a407d9 100644
--- a/nokiav2/driver/src/test/resources/unittests/vnfd.instantiation.yaml
+++ b/nokiav2/driver/src/test/resources/unittests/vnfd.instantiation.yaml
@@ -14,3 +14,6 @@ topology_template:
vdu_levels:
vdu1:
number_of_instances: 2
+ interfaces:
+ Basic:
+ unknown: \ No newline at end of file