Fix sonar issues 91/39091/1
authorDenes Nemeth <denes.nemeth@nokia.com>
Tue, 27 Mar 2018 13:24:18 +0000 (15:24 +0200)
committerDenes Nemeth <denes.nemeth@nokia.com>
Tue, 27 Mar 2018 13:24:18 +0000 (15:24 +0200)
Change-Id: Ia0faaf3b84267ed88dc452a7885d2f33c4d6411b
Issue-ID: VFC-728
Signed-off-by: Denes Nemeth <denes.nemeth@nokia.com>
nokiav2/NOTES.txt [new file with mode: 0644]
nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/onap/direct/AaiSecurityProvider.java
nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/onap/direct/notification/LInterfaceManager.java
nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/restapi/LcmApi.java
nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/LifecycleManager.java
nokiav2/driver/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/onap/direct/TestAAIRestApiProvider.java
nokiav2/driver/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/onap/direct/notification/TestLInterfaceManager.java
nokiav2/driver/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/onap/direct/notification/TestVnfcManager.java
nokiav2/driver/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/restapi/TestLcmApi.java
nokiav2/driver/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/TestBase.java
nokiav2/driver/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/TestLifecycleManager.java

diff --git a/nokiav2/NOTES.txt b/nokiav2/NOTES.txt
new file mode 100644 (file)
index 0000000..dc0957d
--- /dev/null
@@ -0,0 +1,5 @@
+Scatchpad
+
+mvn jacoco:report -Djacoco.dataFile='${project.build.directory}/code-coverage/jacoco-ut.exec'
+mvn sonar:sonar -Dsonar.host.url=http://sonar.onap.org
+
index 688a82f..1cd3346 100644 (file)
@@ -25,24 +25,24 @@ import org.springframework.stereotype.Component;
 @Component
 public class AaiSecurityProvider extends GenericSecurityProvider {
     @Value("${trustedCertificatesForAai}")
-    private String trustedCertificates;
+    private String trustedCertificatesForAai;
     @Value("${skipCertificateVerificationForAai}")
-    private boolean skipCertificateVerification;
+    private boolean skipCertificateVerificationForAai;
     @Value("${skipHostnameVerificationForAai}")
-    private boolean skipHostnameVerification;
+    private boolean skipHostnameVerificationForAai;
 
     @Override
     protected boolean skipHostnameVerification() {
-        return skipHostnameVerification;
+        return skipHostnameVerificationForAai;
     }
 
     @Override
     protected boolean skipCertificateVerification() {
-        return skipCertificateVerification;
+        return skipCertificateVerificationForAai;
     }
 
     @Override
     protected String trustedCertificates() {
-        return trustedCertificates;
+        return trustedCertificatesForAai;
     }
 }
index ab216bd..37a6993 100644 (file)
@@ -95,22 +95,18 @@ class LInterfaceManager extends AbstractManager {
         logicalInterface.setInterfaceRole(affectedCp.getCpdId());
         logicalInterface.setMacaddr(affectedCp.getMacAddress());
         logicalInterface.setProvStatus("active");
+        logicalInterface.setL3InterfaceIpv6AddressList(new ArrayList<>());
+        logicalInterface.setL3InterfaceIpv4AddressList(new ArrayList<>());
         if (affectedCp.getIpAddress() != null) {
             if (affectedCp.getIpAddress().contains(":")) {
                 L3InterfaceIpv6AddressList ipv6Address = new L3InterfaceIpv6AddressList();
                 ipv6Address.setL3InterfaceIpv6Address(affectedCp.getIpAddress());
                 ipv6Address.setNeutronNetworkId(affectedCp.getNetworkProviderId());
-                if (logicalInterface.getL3InterfaceIpv6AddressList() == null) {
-                    logicalInterface.setL3InterfaceIpv6AddressList(new ArrayList<>());
-                }
                 logicalInterface.getL3InterfaceIpv6AddressList().add(ipv6Address);
             } else {
                 L3InterfaceIpv4AddressList ipv4Address = new L3InterfaceIpv4AddressList();
                 ipv4Address.setL3InterfaceIpv4Address(affectedCp.getIpAddress());
                 ipv4Address.setNeutronNetworkId(affectedCp.getNetworkProviderId());
-                if (logicalInterface.getL3InterfaceIpv4AddressList() == null) {
-                    logicalInterface.setL3InterfaceIpv4AddressList(new ArrayList<>());
-                }
                 logicalInterface.getL3InterfaceIpv4AddressList().add(ipv4Address);
             }
         }
index c340520..f7c9ed1 100644 (file)
@@ -83,7 +83,7 @@ public class LcmApi {
     @ResponseBody
     public JobInfo terminateVnf(@RequestBody VnfTerminateRequest request, @PathVariable("vnfmId") String vnfmId, @PathVariable("vnfId") String vnfInstanceId, HttpServletResponse httpResponse) {
         logger.info("REST: Terminate VNF");
-        return lifecycleManager.terminateVnf(vnfmId, vnfInstanceId, request, httpResponse);
+        return lifecycleManager.terminateAndDelete(vnfmId, vnfInstanceId, request, httpResponse);
     }
 
     /**
index 9b69fcf..94ab240 100644 (file)
@@ -398,7 +398,7 @@ public class LifecycleManager {
      * @param httpResponse the HTTP response
      * @return the job for polling the progress of the termination
      */
-    public JobInfo terminateVnf(String vnfmId, String vnfId, VnfTerminateRequest request, HttpServletResponse httpResponse) {
+    public JobInfo terminateAndDelete(String vnfmId, String vnfId, VnfTerminateRequest request, HttpServletResponse httpResponse) {
         logOperationInput(vnfId, "termination", request);
         return scheduleExecution(vnfId, httpResponse, "terminate", jobInfo -> {
             TerminateVnfRequest cbamRequest = new TerminateVnfRequest();
@@ -415,29 +415,34 @@ public class LifecycleManager {
             cbamRequest.setAdditionalParams(new Gson().toJsonTree(jobInfo).getAsJsonObject());
             com.nokia.cbam.lcm.v32.model.VnfInfo vnf = cbamRestApiProvider.getCbamLcmApi(vnfmId).vnfsVnfInstanceIdGet(vnfId, NOKIA_LCM_API_VERSION).blockingFirst();
             if (vnf.getInstantiationState() == INSTANTIATED) {
-                terminateVnf(vnfmId, vnfId, jobInfo, cbamRequest, vnf);
+                terminateAndDelete(vnfmId, vnfId, jobInfo, cbamRequest, vnf);
             } else {
-                cbamRestApiProvider.getCbamLcmApi(vnfmId).vnfsVnfInstanceIdDelete(vnfId, NOKIA_LCM_API_VERSION).blockingFirst();
+                logger.debug("The VNF {} with identifier is not instantiated no termination required", vnf.getId());
+                deleteVnf(vnfmId, vnfId);
             }
         });
     }
 
-    private void terminateVnf(String vnfmId, String vnfId, JobInfo jobInfo, TerminateVnfRequest cbamRequest, com.nokia.cbam.lcm.v32.model.VnfInfo vnf) {
+    private void terminateAndDelete(String vnfmId, String vnfId, JobInfo jobInfo, TerminateVnfRequest cbamRequest, com.nokia.cbam.lcm.v32.model.VnfInfo vnf) {
         String vimId = getVimIdFromInstantiationRequest(vnfmId, vnf);
         grantManager.requestGrantForTerminate(vnfmId, vnfId, vimId, getVnfdIdFromModifyableAttributes(vnf), vnf, jobInfo.getJobId());
         OperationExecution terminationOperation = cbamRestApiProvider.getCbamLcmApi(vnfmId).vnfsVnfInstanceIdTerminatePost(vnfId, cbamRequest, NOKIA_LCM_API_VERSION).blockingFirst();
         OperationExecution finishedOperation = waitForOperationToFinish(vnfmId, vnfId, terminationOperation.getId());
         if (finishedOperation.getStatus() == FINISHED) {
             notificationManager.waitForTerminationToBeProcessed(finishedOperation.getId());
-            logger.info("Deleting VNF with {}", vnfId);
-            cbamRestApiProvider.getCbamLcmApi(vnfmId).vnfsVnfInstanceIdDelete(vnfId, NOKIA_LCM_API_VERSION).blockingFirst();
-            logger.info("VNF with {} has been deleted", vnfId);
+            deleteVnf(vnfmId, vnfId);
 
         } else {
             logger.error("Unable to terminate VNF the operation did not finish with success");
         }
     }
 
+    private void deleteVnf(String vnfmId, String vnfId) {
+        logger.info("Deleting VNF with {} identifier", vnfId);
+        cbamRestApiProvider.getCbamLcmApi(vnfmId).vnfsVnfInstanceIdDelete(vnfId, NOKIA_LCM_API_VERSION).blockingFirst();
+        logger.info("The VNF with {} identifier has been deleted", vnfId);
+    }
+
     private String getVimIdFromInstantiationRequest(String vnfmId, com.nokia.cbam.lcm.v32.model.VnfInfo vnf) {
         OperationExecution lastInstantiation = findLastInstantiation(vnf.getOperationExecutions());
         Object operationParameters = cbamRestApiProvider.getCbamOperationExecutionApi(vnfmId).operationExecutionsOperationExecutionIdOperationParamsGet(lastInstantiation.getId(), NOKIA_LCM_API_VERSION).blockingFirst();
@@ -571,12 +576,6 @@ public class LifecycleManager {
                 logger.error("Unable to " + operation + " VNF with " + vnfId + " identifier", e);
                 jobManager.jobFinished(jobInfo.getJobId());
                 throw e;
-            } catch (Exception e) {
-                String msg = "Unable to " + operation + " VNF with " + vnfId + " identifier";
-                logger.error(msg, e);
-                //the job can only be signaled to be finished after the error is logged
-                jobManager.jobFinished(jobInfo.getJobId());
-                throw new UserVisibleError(msg, e);
             }
             jobManager.jobFinished(jobInfo.getJobId());
         });
@@ -616,10 +615,5 @@ public class LifecycleManager {
             this.vnfInfo = vnfInfo;
             this.vnfdId = vnfdId;
         }
-
-        public com.nokia.cbam.lcm.v32.model.VnfInfo getVnfInfo() {
-            return vnfInfo;
-        }
-
     }
 }
index fafaf2c..a97b74d 100644 (file)
@@ -56,7 +56,8 @@ public class TestAAIRestApiProvider extends TestBase {
     private AAIRestApiProvider aaiRestApiProvider;
     @Mock
     private HostnameVerifier hostnameVerifier;
-    private AaiSecurityProvider aaiSecurityProvider = spy(new AaiSecurityProvider());
+    private AaiSecurityProvider aaiSecurityProviderReal = new AaiSecurityProvider();
+    private AaiSecurityProvider aaiSecurityProvider = spy(aaiSecurityProviderReal);
 
     @Before
     public void init() {
@@ -68,8 +69,8 @@ public class TestAAIRestApiProvider extends TestBase {
      */
     @Test
     public void testApiClientBuilder() throws Exception {
-        setField(aaiSecurityProvider, "skipCertificateVerification", true);
-        setField(aaiSecurityProvider, "skipHostnameVerification", true);
+        when(aaiSecurityProvider.skipCertificateVerification()).thenReturn(true);
+        when(aaiSecurityProvider.skipHostnameVerification()).thenReturn(true);
         setFieldWithPropertyAnnotation(aaiRestApiProvider, "${aaiUsername}", "username");
         setFieldWithPropertyAnnotation(aaiRestApiProvider, "${aaiPassword}", "aaiPassword");
         ResultCaptor<SSLSocketFactory> sslSocketFactoryResultCaptor = new ResultCaptor<>();
@@ -107,8 +108,8 @@ public class TestAAIRestApiProvider extends TestBase {
      */
     @Test
     public void testApiClientBuilderMissingSlash() throws Exception {
-        setField(aaiSecurityProvider, "skipCertificateVerification", true);
-        setField(aaiSecurityProvider, "skipHostnameVerification", true);
+        when(aaiSecurityProvider.skipCertificateVerification()).thenReturn(true);
+        when(aaiSecurityProvider.skipHostnameVerification()).thenReturn(true);
         setFieldWithPropertyAnnotation(aaiRestApiProvider, "${aaiUsername}", "username");
         setFieldWithPropertyAnnotation(aaiRestApiProvider, "${aaiPassword}", "aaiPassword");
         ResultCaptor<SSLSocketFactory> sslSocketFactoryResultCaptor = new ResultCaptor<>();
@@ -131,8 +132,8 @@ public class TestAAIRestApiProvider extends TestBase {
      */
     @Test
     public void testApiClientBuilderForCloud() throws Exception {
-        setField(aaiSecurityProvider, "skipCertificateVerification", true);
-        setField(aaiSecurityProvider, "skipHostnameVerification", true);
+        when(aaiSecurityProvider.skipCertificateVerification()).thenReturn(true);
+        when(aaiSecurityProvider.skipHostnameVerification()).thenReturn(true);
         setFieldWithPropertyAnnotation(aaiRestApiProvider, "${aaiUsername}", "username");
         setFieldWithPropertyAnnotation(aaiRestApiProvider, "${aaiPassword}", "aaiPassword");
         ResultCaptor<SSLSocketFactory> sslSocketFactoryResultCaptor = new ResultCaptor<>();
@@ -155,8 +156,8 @@ public class TestAAIRestApiProvider extends TestBase {
      */
     @Test
     public void testApiClientBuilderForExternalSystems() throws Exception {
-        setField(aaiSecurityProvider, "skipCertificateVerification", true);
-        setField(aaiSecurityProvider, "skipHostnameVerification", true);
+        when(aaiSecurityProvider.skipCertificateVerification()).thenReturn(true);
+        when(aaiSecurityProvider.skipHostnameVerification()).thenReturn(true);
         setFieldWithPropertyAnnotation(aaiRestApiProvider, "${aaiUsername}", "username");
         setFieldWithPropertyAnnotation(aaiRestApiProvider, "${aaiPassword}", "aaiPassword");
         ResultCaptor<SSLSocketFactory> sslSocketFactoryResultCaptor = new ResultCaptor<>();
index 0ac9333..8cef628 100644 (file)
@@ -86,7 +86,7 @@ public class TestLInterfaceManager extends TestBase {
         assertEquals("mac", actualInterface.getMacaddr());
         assertEquals("active", actualInterface.getProvStatus());
         assertEquals(1, actualInterface.getL3InterfaceIpv4AddressList().size());
-        assertEquals(null, actualInterface.getL3InterfaceIpv6AddressList());
+        assertEquals(0, actualInterface.getL3InterfaceIpv6AddressList().size());
         assertEquals("networkProviderId", actualInterface.getL3InterfaceIpv4AddressList().get(0).getNeutronNetworkId());
         assertEquals("1.2.3.4", actualInterface.getL3InterfaceIpv4AddressList().get(0).getL3InterfaceIpv4Address());
         assertRelation(actualInterface.getRelationshipList(), "generic-vnf", buildRelationshipData("generic-vnf.vnf-id", VNF_ID));
@@ -124,8 +124,8 @@ public class TestLInterfaceManager extends TestBase {
         assertEquals("cpdId", actualInterface.getInterfaceRole());
         assertEquals("mac", actualInterface.getMacaddr());
         assertEquals("active", actualInterface.getProvStatus());
-        assertEquals(null, actualInterface.getL3InterfaceIpv6AddressList());
-        assertEquals(null, actualInterface.getL3InterfaceIpv4AddressList());
+        assertEquals(0, actualInterface.getL3InterfaceIpv6AddressList().size());
+        assertEquals(0, actualInterface.getL3InterfaceIpv4AddressList().size());
         assertRelation(actualInterface.getRelationshipList(), "generic-vnf", buildRelationshipData("generic-vnf.vnf-id", VNF_ID));
         VOID_OBSERVABLE.assertCalled();
     }
@@ -165,7 +165,7 @@ public class TestLInterfaceManager extends TestBase {
         assertEquals("mac", actualInterface.getMacaddr());
         assertEquals("active", actualInterface.getProvStatus());
         assertEquals(1, actualInterface.getL3InterfaceIpv4AddressList().size());
-        assertEquals(null, actualInterface.getL3InterfaceIpv6AddressList());
+        assertEquals(0, actualInterface.getL3InterfaceIpv6AddressList().size());
         assertEquals("networkProviderId", actualInterface.getL3InterfaceIpv4AddressList().get(0).getNeutronNetworkId());
         assertEquals("1.2.3.4", actualInterface.getL3InterfaceIpv4AddressList().get(0).getL3InterfaceIpv4Address());
         assertEquals("v3", lInterface.getResourceVersion());
@@ -207,7 +207,7 @@ public class TestLInterfaceManager extends TestBase {
         assertEquals("cpdId", actualInterface.getInterfaceRole());
         assertEquals("mac", actualInterface.getMacaddr());
         assertEquals("active", actualInterface.getProvStatus());
-        assertEquals(null, actualInterface.getL3InterfaceIpv4AddressList());
+        assertEquals(0, actualInterface.getL3InterfaceIpv4AddressList().size());
         assertEquals(1, actualInterface.getL3InterfaceIpv6AddressList().size());
         assertEquals("networkProviderId", actualInterface.getL3InterfaceIpv6AddressList().get(0).getNeutronNetworkId());
         assertEquals("::", actualInterface.getL3InterfaceIpv6AddressList().get(0).getL3InterfaceIpv6Address());
index efec7b3..ece65ee 100644 (file)
@@ -17,7 +17,9 @@ package org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.onap.direct.notification;
 
 import com.nokia.cbam.lcm.v32.model.AffectedVnfc;
 import com.nokia.cbam.lcm.v32.model.ResourceHandle;
+import io.reactivex.Observable;
 import java.util.ArrayList;
+import java.util.NoSuchElementException;
 import org.junit.Before;
 import org.junit.Test;
 import org.mockito.ArgumentCaptor;
@@ -53,6 +55,36 @@ public class TestVnfcManager extends TestBase {
         when(aaiRestApiProvider.getNetworkApi()).thenReturn(networkApi);
     }
 
+
+    /**
+     * test create
+     */
+    @Test
+    public void testCreate() throws Exception {
+        AffectedVnfc affectedVnfc = new AffectedVnfc();
+        affectedVnfc.setComputeResource(new ResourceHandle());
+        affectedVnfc.getComputeResource().setResourceId("serverProviderId");
+        affectedVnfc.setId("vnfcId");
+        when(networkApi.getNetworkVnfcsVnfc("myVnfId_vnfcId", null, null, null, null, null, null, null, null, null)).thenReturn(Observable.error(new NoSuchElementException()));
+        when(networkApi.createOrUpdateNetworkVnfcsVnfc(eq("myVnfId_vnfcId"), payload.capture())).thenReturn(VOID_OBSERVABLE.value());
+        //when
+        vnfcManager.update(VIM_ID, "myTenantPrivderId", VNF_ID, affectedVnfc, true);
+        //verify
+        Vnfc vnfc = payload.getValue();
+        assertEquals("myVnfId_vnfcId", vnfc.getVnfcName());
+        assertEquals("vnfcId", vnfc.getNfcFunction());
+        assertEquals("vnfcId", vnfc.getNfcNamingCode());
+        assertRelation(payload.getValue().getRelationshipList(), "generic-vnf", buildRelationshipData("generic-vnf.vnf-id", VNF_ID));
+
+        assertRelation(vnfc.getRelationshipList(), "vserver",
+                buildRelationshipData("cloud-region.cloud-owner", getCloudOwner(VIM_ID)),
+                buildRelationshipData("cloud-region.cloud-region-id", getRegionName(VIM_ID)),
+                buildRelationshipData("tenant.tenant-id", "myTenantPrivderId"),
+                buildRelationshipData("vserver.vserver-id", "serverProviderId"));
+        assertEquals(2, vnfc.getRelationshipList().size());
+        VOID_OBSERVABLE.assertCalled();
+    }
+
     /**
      * test update
      */
index dbbad3f..8711c3f 100644 (file)
@@ -112,7 +112,7 @@ public class TestLcmApi extends TestBase {
         //when
         lcmApi.terminateVnf(req, VNFM_ID, VNF_ID, httpResponse);
         //verify
-        verify(lifecycleManager).terminateVnf(VNFM_ID, VNF_ID, req, httpResponse);
+        verify(lifecycleManager).terminateAndDelete(VNFM_ID, VNF_ID, req, httpResponse);
         verify(logger).info("REST: Terminate VNF");
 
     }
index a699ee9..e61edc3 100644 (file)
@@ -26,10 +26,7 @@ import io.reactivex.internal.operators.observable.ObservableFromCallable;
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.lang.reflect.Field;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.concurrent.Callable;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipInputStream;
@@ -209,12 +206,14 @@ public class TestBase {
                     try {
                         field.setAccessible(true);
                         field.set(obj, value);
+                        return;
                     } catch (IllegalAccessException e) {
                         throw new RuntimeException(e);
                     }
                 }
             }
         }
+        throw new NoSuchElementException("The " + obj.getClass() + " does not have a filed with " + key + " annotation");
     }
 
     protected static class VoidObservable {
index 178f0b5..16d1f02 100644 (file)
@@ -750,7 +750,7 @@ public class TestLifecycleManager extends TestBase {
         JsonElement instantiationParameters = new JsonParser().parse("{ \"vims\" : [ { \"id\" : \"" + VIM_ID + "\" } ] } ");
         when(operationExecutionApi.operationExecutionsOperationExecutionIdOperationParamsGet("operationExecutionId", NOKIA_LCM_API_VERSION)).thenReturn(buildObservable(instantiationParameters));
         //when
-        JobInfo jobInfo = lifecycleManager.terminateVnf(VNFM_ID, VNF_ID, terminationRequest, restResponse);
+        JobInfo jobInfo = lifecycleManager.terminateAndDelete(VNFM_ID, VNF_ID, terminationRequest, restResponse);
         //verify
         waitForJobToFinishInJobManager(finished);
         assertEquals(1, actualTerminationRequest.getAllValues().size());
@@ -781,21 +781,25 @@ public class TestLifecycleManager extends TestBase {
         vnfdId.setValue(ONAP_CSAR_ID);
         vnfInfo.getExtensions().add(vnfdId);
         JsonElement instantiationParameters = new JsonParser().parse("{ \"vims\" : [ { \"id\" : \"" + VIM_ID + "\" } ] } ");
+        when(vnfApi.vnfsVnfInstanceIdDelete(VNF_ID, NOKIA_LCM_API_VERSION)).thenReturn(VOID_OBSERVABLE.value());
         when(operationExecutionApi.operationExecutionsOperationExecutionIdOperationParamsGet("operationExecutionId", NOKIA_LCM_API_VERSION)).thenReturn(buildObservable(instantiationParameters));
         //when
-        JobInfo jobInfo = lifecycleManager.terminateVnf(VNFM_ID, VNF_ID, terminationRequest, restResponse);
+        lifecycleManager.terminateAndDelete(VNFM_ID, VNF_ID, terminationRequest, restResponse);
         //verify
         boolean deleted = false;
         while (!deleted) {
             try {
-                Mockito.
-                        verify(vnfApi).vnfsVnfInstanceIdDelete(VNF_ID, NOKIA_LCM_API_VERSION);
+                verify(vnfApi).vnfsVnfInstanceIdDelete(VNF_ID, NOKIA_LCM_API_VERSION);
                 deleted = true;
             } catch (Error e) {
             }
         }
         verify(vfcGrantManager, never()).requestGrantForTerminate(VNFM_ID, VNF_ID, VIM_ID, ONAP_CSAR_ID, vnfInfo, JOB_ID);
         verify(notificationManager, never()).waitForTerminationToBeProcessed("terminationId");
+        verify(logger).debug("The VNF {} with identifier is not instantiated no termination required", VNF_ID);
+        verify(logger).info("Deleting VNF with {} identifier", VNF_ID);
+        verify(logger).info("The VNF with {} identifier has been deleted", VNF_ID);
+        VOID_OBSERVABLE.assertCalled();
     }
 
     /**
@@ -831,7 +835,7 @@ public class TestLifecycleManager extends TestBase {
             return buildObservable(operationExecutions);
         });
         //when
-        JobInfo jobInfo = lifecycleManager.terminateVnf(VNFM_ID, VNF_ID, terminationRequest, restResponse);
+        JobInfo jobInfo = lifecycleManager.terminateAndDelete(VNFM_ID, VNF_ID, terminationRequest, restResponse);
         //verify
         waitForJobToFinishInJobManager(finished);
         verify(vnfApi, times(1001)).vnfsVnfInstanceIdOperationExecutionsGet(VNF_ID, NOKIA_LCM_API_VERSION);
@@ -882,7 +886,7 @@ public class TestLifecycleManager extends TestBase {
             }
         });
         //when
-        JobInfo jobInfo = lifecycleManager.terminateVnf(VNFM_ID, VNF_ID, terminationRequest, restResponse);
+        JobInfo jobInfo = lifecycleManager.terminateAndDelete(VNFM_ID, VNF_ID, terminationRequest, restResponse);
         //verify
         waitForJobToFinishInJobManager(finished);
         verify(vnfApi, times(101)).vnfsVnfInstanceIdOperationExecutionsGet(VNF_ID, NOKIA_LCM_API_VERSION);
@@ -926,7 +930,7 @@ public class TestLifecycleManager extends TestBase {
         JsonElement instantiationParameters = new JsonParser().parse("{ \"vims\" : [ { \"id\" : \"" + VIM_ID + "\" } ] } ");
         when(operationExecutionApi.operationExecutionsOperationExecutionIdOperationParamsGet("operationExecutionId", NOKIA_LCM_API_VERSION)).thenReturn(buildObservable(instantiationParameters));
         //when
-        JobInfo jobInfo = lifecycleManager.terminateVnf(VNFM_ID, VNF_ID, terminationRequest, restResponse);
+        JobInfo jobInfo = lifecycleManager.terminateAndDelete(VNFM_ID, VNF_ID, terminationRequest, restResponse);
         //verify
         waitForJobToFinishInJobManager(finished);
         assertEquals(1, actualTerminationRequest.getAllValues().size());
@@ -988,7 +992,7 @@ public class TestLifecycleManager extends TestBase {
         JsonElement instantiationParameters = new JsonParser().parse("{ \"vims\" : [ { \"id\" : \"" + VIM_ID + "\" } ] } ");
         when(operationExecutionApi.operationExecutionsOperationExecutionIdOperationParamsGet("operationExecutionId", NOKIA_LCM_API_VERSION)).thenReturn(buildObservable(instantiationParameters));
         //when
-        JobInfo jobInfo = lifecycleManager.terminateVnf(VNFM_ID, VNF_ID, terminationRequest, restResponse);
+        JobInfo jobInfo = lifecycleManager.terminateAndDelete(VNFM_ID, VNF_ID, terminationRequest, restResponse);
         //verify
         waitForJobToFinishInJobManager(finished);
         assertEquals(1, actualTerminationRequest.getAllValues().size());
@@ -1032,7 +1036,7 @@ public class TestLifecycleManager extends TestBase {
         JsonElement instantiationParameters = new JsonParser().parse("{ \"vims\" : [ { \"id\" : \"" + VIM_ID + "\" } ] } ");
         when(operationExecutionApi.operationExecutionsOperationExecutionIdOperationParamsGet("operationExecutionId", NOKIA_LCM_API_VERSION)).thenReturn(buildObservable(instantiationParameters));
         //when
-        JobInfo jobInfo = lifecycleManager.terminateVnf(VNFM_ID, VNF_ID, terminationRequest, restResponse);
+        JobInfo jobInfo = lifecycleManager.terminateAndDelete(VNFM_ID, VNF_ID, terminationRequest, restResponse);
         //verify
         waitForJobToFinishInJobManager(finished);
         assertEquals(0, actualTerminationRequest.getAllValues().size());
@@ -1067,7 +1071,7 @@ public class TestLifecycleManager extends TestBase {
         JsonElement instantiationParameters = new JsonParser().parse("{ \"vims\" : [ { \"id\" : \"" + VIM_ID + "\" } ] } ");
         when(operationExecutionApi.operationExecutionsOperationExecutionIdOperationParamsGet("operationExecutionId", NOKIA_LCM_API_VERSION)).thenReturn(buildObservable(instantiationParameters));
         //when
-        JobInfo jobInfo = lifecycleManager.terminateVnf(VNFM_ID, VNF_ID, terminationRequest, restResponse);
+        JobInfo jobInfo = lifecycleManager.terminateAndDelete(VNFM_ID, VNF_ID, terminationRequest, restResponse);
         //verify
         waitForJobToFinishInJobManager(finished);
         assertEquals(1, actualTerminationRequest.getAllValues().size());