diff --git a/docs/images/VID_errorReportButton.png b/docs/images/VID_errorReportButton.png
index 3d3e24e..c7d330c 100644
--- a/docs/images/VID_errorReportButton.png
+++ b/docs/images/VID_errorReportButton.png
Binary files differ
diff --git a/vid-app-common/src/main/java/org/onap/vid/controller/MsoController.java b/vid-app-common/src/main/java/org/onap/vid/controller/MsoController.java
index 00f9db2..db3a219 100644
--- a/vid-app-common/src/main/java/org/onap/vid/controller/MsoController.java
+++ b/vid-app-common/src/main/java/org/onap/vid/controller/MsoController.java
@@ -7,9 +7,9 @@
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,8 +20,14 @@
 
 package org.onap.vid.controller;
 
+import static org.onap.vid.utils.Logging.getMethodName;
 
 import com.fasterxml.jackson.databind.ObjectMapper;
+import java.io.IOException;
+import java.util.LinkedHashMap;
+import java.util.List;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
 import org.onap.portalsdk.core.controller.RestrictedBaseController;
 import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
 import org.onap.vid.model.ExceptionResponse;
@@ -37,15 +43,13 @@
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.util.LinkedHashMap;
-import java.util.List;
-
-import static org.onap.vid.utils.Logging.getMethodName;
+import org.springframework.web.bind.annotation.ExceptionHandler;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
 
 /**
  * The Class MsoController.
@@ -94,7 +98,8 @@
      * @throws Exception the exception
      */
     @RequestMapping(value = "/mso_create_svc_instance", method = RequestMethod.POST)
-    public ResponseEntity<String> createSvcInstance(HttpServletRequest request, @RequestBody RequestDetails msoRequest) {
+    public ResponseEntity<String> createSvcInstance(HttpServletRequest request,
+        @RequestBody RequestDetails msoRequest) {
         String methodName = "createSvcInstance";
 
         LOGGER.debug(EELFLoggerDelegate.debugLogger, "<== " + methodName + START_LOG);
@@ -104,8 +109,7 @@
         cloudOwnerService.enrichRequestWithCloudOwner(msoRequest);
         MsoResponseWrapper w = msoBusinessLogic.createSvcInstance(msoRequest);
 
-        return (new ResponseEntity<>(w.getResponse(), HttpStatus.OK));
-
+        return new ResponseEntity<>(w.getResponse(), HttpStatus.OK);
     }
 
     /**
@@ -116,7 +120,8 @@
      * @throws Exception the exception
      */
     @RequestMapping(value = "/mso_create_e2e_svc_instance", method = RequestMethod.POST)
-    public ResponseEntity<String> createE2eSvcInstance(HttpServletRequest request, @RequestBody LinkedHashMap<String, Object> msoRequest) {
+    public ResponseEntity<String> createE2eSvcInstance(HttpServletRequest request,
+        @RequestBody LinkedHashMap<String, Object> msoRequest) {
         String methodName = "createE2eSvcInstance";
 
         LOGGER.debug(EELFLoggerDelegate.debugLogger, "<== " + methodName + START_LOG);
@@ -126,62 +131,63 @@
         //cloudOwnerService.enrichRequestWithCloudOwner(msoRequest);
         MsoResponseWrapper w = msoBusinessLogic.createE2eSvcInstance(msoRequest.get("requestDetails"));
 
-        return (new ResponseEntity<>(w.getResponse(), HttpStatus.OK));
-
+        return new ResponseEntity<>(w.getResponse(), HttpStatus.OK);
     }
 
     /**
      * Creates the vnf.
      *
      * @param serviceInstanceId the service instance id
-     * @param request           the request
+     * @param request the request
      * @return the response entity
      * @throws Exception the exception
      */
     @RequestMapping(value = "/mso_create_vnf_instance/{serviceInstanceId}", method = RequestMethod.POST)
-    public ResponseEntity<String> createVnf(@PathVariable("serviceInstanceId") String serviceInstanceId, HttpServletRequest request, @RequestBody RequestDetails msoRequest) {
+    public ResponseEntity<String> createVnf(@PathVariable("serviceInstanceId") String serviceInstanceId,
+        HttpServletRequest request, @RequestBody RequestDetails msoRequest) {
 
         cloudOwnerService.enrichRequestWithCloudOwner(msoRequest);
         MsoResponseWrapper w = msoBusinessLogic.createVnf(msoRequest, serviceInstanceId);
 
         // always return OK, the MSO status code is embedded in the body
 
-        return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
-
+        return new ResponseEntity<>(w.getResponse(), HttpStatus.OK);
     }
 
     /**
      * Creates the nw instance.
      *
      * @param serviceInstanceId the service instance id
-     * @param request           the request
+     * @param request the request
      * @return the response entity
      * @throws Exception the exception
      */
     @RequestMapping(value = "/mso_create_nw_instance/{serviceInstanceId}", method = RequestMethod.POST)
-    public ResponseEntity<String> createNwInstance(@PathVariable("serviceInstanceId") String serviceInstanceId, HttpServletRequest request, @RequestBody RequestDetails msoRequest) {
+    public ResponseEntity<String> createNwInstance(@PathVariable("serviceInstanceId") String serviceInstanceId,
+        HttpServletRequest request, @RequestBody RequestDetails msoRequest) {
         String methodName = "createNwInstance";
-        LOGGER.debug(EELFLoggerDelegate.debugLogger, "<== " + methodName + " start, serviceInstanceId = " + serviceInstanceId);
+        LOGGER.debug(EELFLoggerDelegate.debugLogger,
+            "<== " + methodName + " start, serviceInstanceId = " + serviceInstanceId);
 
         cloudOwnerService.enrichRequestWithCloudOwner(msoRequest);
         MsoResponseWrapper w = msoBusinessLogic.createNwInstance(msoRequest, serviceInstanceId);
 
-        return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
-
+        return new ResponseEntity<>(w.getResponse(), HttpStatus.OK);
     }
 
     /**
      * Creates the volume group instance.
      *
      * @param serviceInstanceId the service instance id
-     * @param vnfInstanceId     the vnf instance id
-     * @param request           the request
+     * @param vnfInstanceId the vnf instance id
+     * @param request the request
      * @return the response entity
      * @throws Exception the exception
      */
     @RequestMapping(value = "/mso_create_volumegroup_instance/{serviceInstanceId}/vnfs/{vnfInstanceId}", method = RequestMethod.POST)
-    public ResponseEntity<String> createVolumeGroupInstance(@PathVariable("serviceInstanceId") String serviceInstanceId, @PathVariable("vnfInstanceId") String vnfInstanceId,
-                                                            HttpServletRequest request, @RequestBody RequestDetails msoRequest) {
+    public ResponseEntity<String> createVolumeGroupInstance(@PathVariable("serviceInstanceId") String serviceInstanceId,
+        @PathVariable("vnfInstanceId") String vnfInstanceId,
+        HttpServletRequest request, @RequestBody RequestDetails msoRequest) {
         String methodName = "createVolumeGroupInstance";
         LOGGER.debug(EELFLoggerDelegate.debugLogger, "<== " + methodName + START_LOG);
 
@@ -189,21 +195,22 @@
         MsoResponseWrapper w = msoBusinessLogic.createVolumeGroupInstance(msoRequest, serviceInstanceId, vnfInstanceId);
 
         // always return OK, the MSO status code is embedded in the body
-        return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
+        return new ResponseEntity<>(w.getResponse(), HttpStatus.OK);
     }
 
     /**
      * Creates the vf module instance.
      *
      * @param serviceInstanceId the service instance id
-     * @param vnfInstanceId     the vnf instance id
-     * @param request           the request
+     * @param vnfInstanceId the vnf instance id
+     * @param request the request
      * @return the response entity
      * @throws Exception the exception
      */
     @RequestMapping(value = "/mso_create_vfmodule_instance/{serviceInstanceId}/vnfs/{vnfInstanceId}", method = RequestMethod.POST)
     public ResponseEntity<String> createVfModuleInstance(@PathVariable("serviceInstanceId") String serviceInstanceId,
-                                                         @PathVariable("vnfInstanceId") String vnfInstanceId, HttpServletRequest request, @RequestBody RequestDetails msoRequest) {
+        @PathVariable("vnfInstanceId") String vnfInstanceId, HttpServletRequest request,
+        @RequestBody RequestDetails msoRequest) {
         String methodName = "createVfModuleInstance";
 
         LOGGER.debug(EELFLoggerDelegate.debugLogger, "<== " + methodName + START_LOG);
@@ -213,20 +220,21 @@
 
         // always return OK, the MSO status code is embedded in the body
 
-        return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
+        return new ResponseEntity<>(w.getResponse(), HttpStatus.OK);
     }
 
     /**
      * Creates a configuration instance.
      *
      * @param serviceInstanceId the service instance id
-     * @param request           the request
+     * @param request the request
      * @return the response entity
      * @throws Exception the exception
      */
     @RequestMapping(value = "/mso_create_configuration_instance/{serviceInstanceId}/configurations/", method = RequestMethod.POST)
-    public ResponseEntity<String> createConfigurationInstance(@PathVariable("serviceInstanceId") String serviceInstanceId,
-                                                              HttpServletRequest request, @RequestBody RequestDetailsWrapper msoRequest) {
+    public ResponseEntity<String> createConfigurationInstance(
+        @PathVariable("serviceInstanceId") String serviceInstanceId,
+        HttpServletRequest request, @RequestBody RequestDetailsWrapper msoRequest) {
         String methodName = "createConfigurationInstance";
         LOGGER.debug(EELFLoggerDelegate.debugLogger, "<== " + methodName + START_LOG);
 
@@ -235,42 +243,41 @@
 
         // always return OK, the MSO status code is embedded in the body
 
-        return (new ResponseEntity<>(w.getResponse(), HttpStatus.OK));
+        return new ResponseEntity<>(w.getResponse(), HttpStatus.OK);
     }
 
     /**
      * Delete E2e svc instance.
      *
      * @param serviceInstanceId the service instance id
-     * @param request           the request
+     * @param request the request
      * @return the response entity
      * @throws Exception the exception
      */
     @RequestMapping(value = "/mso_delete_e2e_svc_instance/{serviceInstanceId}", method = RequestMethod.POST)
     public ResponseEntity<String> deleteE2eSvcInstance(@PathVariable("serviceInstanceId") String serviceInstanceId,
-                                                       HttpServletRequest request, @RequestBody LinkedHashMap<String, Object> msoRequest) {
+        HttpServletRequest request, @RequestBody LinkedHashMap<String, Object> msoRequest) {
 
         LOGGER.debug(EELFLoggerDelegate.debugLogger, "start {}({})", getMethodName(), msoRequest);
-        MsoResponseWrapper w = msoBusinessLogic.deleteE2eSvcInstance(msoRequest.get("requestDetails"), serviceInstanceId);
+        MsoResponseWrapper w = msoBusinessLogic
+            .deleteE2eSvcInstance(msoRequest.get("requestDetails"), serviceInstanceId);
         // always return OK, the MSO status code is embedded in the body
 
-        return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
-
+        return new ResponseEntity<>(w.getResponse(), HttpStatus.OK);
     }
 
     /**
      * Delete svc instance.
      *
      * @param serviceInstanceId the service instance id
-     * @param request           the request
+     * @param request the request
      * @return the response entity
      * @throws Exception the exception
      */
-
     @RequestMapping(value = "/mso_delete_svc_instance/{serviceInstanceId}", method = RequestMethod.POST)
     public String deleteSvcInstance(@PathVariable("serviceInstanceId") String serviceInstanceId,
-                                    HttpServletRequest request, @RequestBody RequestDetails msoRequest,
-                                    @RequestParam(value = "serviceStatus") String serviceStatus) {
+        HttpServletRequest request, @RequestBody RequestDetails msoRequest,
+        @RequestParam(value = "serviceStatus") String serviceStatus) {
 
         LOGGER.debug(EELFLoggerDelegate.debugLogger, "start {}({})", getMethodName(), msoRequest);
         MsoResponseWrapper w = msoBusinessLogic.deleteSvcInstance(msoRequest, serviceInstanceId, serviceStatus);
@@ -283,15 +290,16 @@
      * Delete vnf.
      *
      * @param serviceInstanceId the service instance id
-     * @param vnfInstanceId     the vnf instance id
-     * @param request           the request
+     * @param vnfInstanceId the vnf instance id
+     * @param request the request
      * @return the response entity
      * @throws Exception the exception
      */
     @RequestMapping(value = "/mso_delete_vnf_instance/{serviceInstanceId}/vnfs/{vnfInstanceId}", method = RequestMethod.POST)
 
-    public ResponseEntity<String> deleteVnf(@PathVariable("serviceInstanceId") String serviceInstanceId, @PathVariable("vnfInstanceId") String vnfInstanceId,
-                                            HttpServletRequest request, @RequestBody RequestDetails msoRequest) {
+    public ResponseEntity<String> deleteVnf(@PathVariable("serviceInstanceId") String serviceInstanceId,
+        @PathVariable("vnfInstanceId") String vnfInstanceId,
+        HttpServletRequest request, @RequestBody RequestDetails msoRequest) {
         String methodName = "deleteVnf";
 
         LOGGER.debug(EELFLoggerDelegate.debugLogger, "<== " + methodName + START_LOG);
@@ -299,12 +307,12 @@
         MsoResponseWrapper w = msoBusinessLogic.deleteVnf(msoRequest, serviceInstanceId, vnfInstanceId);
 
         // always return OK, the MSO status code is embedded in the body
-        return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
-
+        return new ResponseEntity<>(w.getResponse(), HttpStatus.OK);
     }
 
     /**
      * Delete configuration instance
+     *
      * @param serviceInstanceId the service instance id
      * @param configurationId the configuration id
      * @param msoRequest the request
@@ -312,25 +320,26 @@
      * @throws Exception the exception
      */
     @RequestMapping(value = "mso_delete_configuration/{serviceInstanceId}/configurations/{configurationId}",
-            method = RequestMethod.POST)
+        method = RequestMethod.POST)
     public ResponseEntity<String> deleteConfiguration(
-            @PathVariable("serviceInstanceId") String serviceInstanceId,
-            @PathVariable ("configurationId") String configurationId,
-            @RequestBody RequestDetailsWrapper msoRequest) {
+        @PathVariable("serviceInstanceId") String serviceInstanceId,
+        @PathVariable("configurationId") String configurationId,
+        @RequestBody RequestDetailsWrapper msoRequest) {
 
         String methodName = "deleteConfiguration";
         LOGGER.debug(EELFLoggerDelegate.debugLogger,
-                "<== " + methodName + START_LOG);
+            "<== " + methodName + START_LOG);
 
         cloudOwnerService.enrichRequestWithCloudOwner(msoRequest.getRequestDetails());
         MsoResponseWrapper w = msoBusinessLogic.deleteConfiguration(msoRequest, serviceInstanceId, configurationId);
 
         // always return OK, the MSO status code is embedded in the body
-        return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
+        return new ResponseEntity<>(w.getResponse(), HttpStatus.OK);
     }
 
     /**
      * Activate configuration instance
+     *
      * @param serviceInstanceId the service instace id
      * @param configurationId the configuration id
      * @param msoRequest the request
@@ -338,21 +347,23 @@
      * @throws Exception the exception
      */
     @RequestMapping(value = "mso_activate_configuration/{serviceInstanceId}/configurations/{configurationId}",
-            method = RequestMethod.POST)
+        method = RequestMethod.POST)
     public ResponseEntity<String> activateConfiguration(
-            @PathVariable("serviceInstanceId") String serviceInstanceId,
-            @PathVariable("configurationId") String configurationId,
-            @RequestBody RequestDetails msoRequest) {
+        @PathVariable("serviceInstanceId") String serviceInstanceId,
+        @PathVariable("configurationId") String configurationId,
+        @RequestBody RequestDetails msoRequest) {
 
         cloudOwnerService.enrichRequestWithCloudOwner(msoRequest);
-        MsoResponseWrapper w = msoBusinessLogic.setConfigurationActiveStatus(msoRequest, serviceInstanceId, configurationId, true);
+        MsoResponseWrapper w = msoBusinessLogic
+            .setConfigurationActiveStatus(msoRequest, serviceInstanceId, configurationId, true);
 
         // always return OK, the MSO status code is embedded in the body
-        return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
+        return new ResponseEntity<>(w.getResponse(), HttpStatus.OK);
     }
 
     /**
      * Deactivate configuration instance
+     *
      * @param serviceInstanceId the service instace id
      * @param configurationId the configuration id
      * @param msoRequest the request
@@ -360,21 +371,23 @@
      * @throws Exception the exception
      */
     @RequestMapping(value = "mso_deactivate_configuration/{serviceInstanceId}/configurations/{configurationId}",
-            method = RequestMethod.POST)
+        method = RequestMethod.POST)
     public ResponseEntity<String> deactivateConfiguration(
-            @PathVariable("serviceInstanceId") String serviceInstanceId,
-            @PathVariable("configurationId") String configurationId,
-            @RequestBody RequestDetails msoRequest) {
+        @PathVariable("serviceInstanceId") String serviceInstanceId,
+        @PathVariable("configurationId") String configurationId,
+        @RequestBody RequestDetails msoRequest) {
 
         cloudOwnerService.enrichRequestWithCloudOwner(msoRequest);
-        MsoResponseWrapper w = msoBusinessLogic.setConfigurationActiveStatus(msoRequest, serviceInstanceId, configurationId, false);
+        MsoResponseWrapper w = msoBusinessLogic
+            .setConfigurationActiveStatus(msoRequest, serviceInstanceId, configurationId, false);
 
         // always return OK, the MSO status code is embedded in the body
-        return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
+        return new ResponseEntity<>(w.getResponse(), HttpStatus.OK);
     }
 
     /**
      * Disable port on configuration instance
+     *
      * @param serviceInstanceId the service instance id
      * @param configurationId the configuration instance id
      * @param msoRequest the request
@@ -382,21 +395,23 @@
      * @throws Exception the exception
      */
     @RequestMapping(value = "mso_disable_port_configuration/{serviceInstanceId}/configurations/{configurationId}",
-            method = RequestMethod.POST)
+        method = RequestMethod.POST)
     public ResponseEntity<String> disablePortOnConfiguration(
-            @PathVariable("serviceInstanceId") String serviceInstanceId,
-            @PathVariable("configurationId") String configurationId,
-            @RequestBody RequestDetails msoRequest) {
+        @PathVariable("serviceInstanceId") String serviceInstanceId,
+        @PathVariable("configurationId") String configurationId,
+        @RequestBody RequestDetails msoRequest) {
 
         cloudOwnerService.enrichRequestWithCloudOwner(msoRequest);
-        MsoResponseWrapper w = msoBusinessLogic.setPortOnConfigurationStatus(msoRequest, serviceInstanceId, configurationId, false);
+        MsoResponseWrapper w = msoBusinessLogic
+            .setPortOnConfigurationStatus(msoRequest, serviceInstanceId, configurationId, false);
 
         // always return OK, the MSO status code is embedded in the body
-        return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
+        return new ResponseEntity<>(w.getResponse(), HttpStatus.OK);
     }
 
     /**
      * Enable port on configuration instance
+     *
      * @param serviceInstanceId the service instance id
      * @param configurationId the configuration instance id
      * @param msoRequest the request
@@ -404,67 +419,73 @@
      * @throws Exception the exception
      */
     @RequestMapping(value = "mso_enable_port_configuration/{serviceInstanceId}/configurations/{configurationId}",
-            method = RequestMethod.POST)
+        method = RequestMethod.POST)
     public ResponseEntity<String> enablePortOnConfiguration(
-            @PathVariable("serviceInstanceId") String serviceInstanceId,
-            @PathVariable("configurationId") String configurationId,
-            @RequestBody RequestDetails msoRequest) {
+        @PathVariable("serviceInstanceId") String serviceInstanceId,
+        @PathVariable("configurationId") String configurationId,
+        @RequestBody RequestDetails msoRequest) {
 
         cloudOwnerService.enrichRequestWithCloudOwner(msoRequest);
-        MsoResponseWrapper w = msoBusinessLogic.setPortOnConfigurationStatus(msoRequest, serviceInstanceId, configurationId, true);
+        MsoResponseWrapper w = msoBusinessLogic
+            .setPortOnConfigurationStatus(msoRequest, serviceInstanceId, configurationId, true);
 
         // always return OK, the MSO status code is embedded in the body
-        return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
+        return new ResponseEntity<>(w.getResponse(), HttpStatus.OK);
     }
 
     /**
      * Delete vf module.
      *
      * @param serviceInstanceId the service instance id
-     * @param vnfInstanceId     the vnf instance id
-     * @param vfModuleId        the vf module id
-     * @param request           the request
+     * @param vnfInstanceId the vnf instance id
+     * @param vfModuleId the vf module id
+     * @param request the request
      * @return the response entity
      * @throws Exception the exception
      */
     //mso_delete_vf_module/bc305d54-75b4-431b-adb2-eb6b9e546014/vnfs/fe9000-0009-9999/vfmodules/abeeee-abeeee-abeeee
     @RequestMapping(value = "/mso_delete_vfmodule_instance/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/{vfModuleId}", method = RequestMethod.POST)
     public ResponseEntity<String> deleteVfModule(
-            @PathVariable("serviceInstanceId") String serviceInstanceId, @PathVariable("vnfInstanceId") String vnfInstanceId,
-            @PathVariable("vfModuleId") String vfModuleId, HttpServletRequest request, @RequestBody RequestDetails msoRequest) {
+        @PathVariable("serviceInstanceId") String serviceInstanceId,
+        @PathVariable("vnfInstanceId") String vnfInstanceId,
+        @PathVariable("vfModuleId") String vfModuleId, HttpServletRequest request,
+        @RequestBody RequestDetails msoRequest) {
 
         String methodName = "deleteVfModule";
         LOGGER.debug(EELFLoggerDelegate.debugLogger, "<== " + methodName + START_LOG);
 
         cloudOwnerService.enrichRequestWithCloudOwner(msoRequest);
-        MsoResponseWrapper w = msoBusinessLogic.deleteVfModule(msoRequest, serviceInstanceId, vnfInstanceId, vfModuleId);
+        MsoResponseWrapper w = msoBusinessLogic
+            .deleteVfModule(msoRequest, serviceInstanceId, vnfInstanceId, vfModuleId);
 
         // always return OK, the MSO status code is embedded in the body
-        return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
+        return new ResponseEntity<>(w.getResponse(), HttpStatus.OK);
     }
 
     /**
      * Delete volume group instance.
      *
      * @param serviceInstanceId the service instance id
-     * @param vnfInstanceId     the vnf instance id
-     * @param volumeGroupId     the volume group id
-     * @param request           the request
+     * @param vnfInstanceId the vnf instance id
+     * @param volumeGroupId the volume group id
+     * @param request the request
      * @return the response entity
      * @throws Exception the exception
      */
     @RequestMapping(value = "/mso_delete_volumegroup_instance/{serviceInstanceId}/vnfs/{vnfInstanceId}/volumeGroups/{volumeGroupId}", method = RequestMethod.POST)
     public ResponseEntity<String> deleteVolumeGroupInstance(
-            @PathVariable("serviceInstanceId") String serviceInstanceId, @PathVariable("vnfInstanceId") String vnfInstanceId, @PathVariable("volumeGroupId") String volumeGroupId,
-            HttpServletRequest request, @RequestBody RequestDetails msoRequest) {
+        @PathVariable("serviceInstanceId") String serviceInstanceId,
+        @PathVariable("vnfInstanceId") String vnfInstanceId, @PathVariable("volumeGroupId") String volumeGroupId,
+        HttpServletRequest request, @RequestBody RequestDetails msoRequest) {
         String methodName = "deleteVolumeGroupInstance";
         LOGGER.debug(EELFLoggerDelegate.debugLogger, "<== " + methodName + START_LOG);
 
         cloudOwnerService.enrichRequestWithCloudOwner(msoRequest);
-        MsoResponseWrapper w = msoBusinessLogic.deleteVolumeGroupInstance(msoRequest, serviceInstanceId, vnfInstanceId, volumeGroupId);
+        MsoResponseWrapper w = msoBusinessLogic
+            .deleteVolumeGroupInstance(msoRequest, serviceInstanceId, vnfInstanceId, volumeGroupId);
 
         // always return OK, the MSO status code is embedded in the body
-        return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
+        return new ResponseEntity<>(w.getResponse(), HttpStatus.OK);
     }
 
     /**
@@ -472,13 +493,14 @@
      *
      * @param serviceInstanceId the service instance id
      * @param networkInstanceId the network instance id
-     * @param request           the request
+     * @param request the request
      * @return the response entity
      * @throws Exception the exception
      */
     @RequestMapping(value = "/mso_delete_nw_instance/{serviceInstanceId}/networks/{networkInstanceId}", method = RequestMethod.POST)
     public ResponseEntity<String> deleteNwInstance(@PathVariable("serviceInstanceId") String serviceInstanceId,
-                                                   @PathVariable("networkInstanceId") String networkInstanceId, HttpServletRequest request, @RequestBody RequestDetails msoRequest) {
+        @PathVariable("networkInstanceId") String networkInstanceId, HttpServletRequest request,
+        @RequestBody RequestDetails msoRequest) {
         String methodName = "deleteNwInstance";
         LOGGER.debug(EELFLoggerDelegate.debugLogger, "<== " + methodName + START_LOG);
 
@@ -486,51 +508,49 @@
         MsoResponseWrapper w = msoBusinessLogic.deleteNwInstance(msoRequest, serviceInstanceId, networkInstanceId);
 
         // always return OK, the MSO status code is embedded in the body
-        return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
+        return new ResponseEntity<>(w.getResponse(), HttpStatus.OK);
     }
 
     /**
      * Gets the orchestration request.
      *
      * @param requestId the request id
-     * @param request   the request
+     * @param request the request
      * @return the orchestration request
      * @throws Exception the exception
      */
     @RequestMapping(value = "/mso_get_orch_req/{requestId}", method = RequestMethod.GET)
     public ResponseEntity<String> getOrchestrationRequest(@PathVariable("requestId") String requestId,
-                                                          HttpServletRequest request) {
+        HttpServletRequest request) {
 
         String methodName = "getOrchestrationRequest";
         LOGGER.debug(EELFLoggerDelegate.debugLogger, "<== " + methodName + START_LOG);
 
-
         MsoResponseWrapper w = msoBusinessLogic.getOrchestrationRequest(requestId);
 
         // always return OK, the MSO status code is embedded in the body
-        return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
+        return new ResponseEntity<>(w.getResponse(), HttpStatus.OK);
     }
 
     /**
      * Gets the orchestration requests.
      *
      * @param filterString the filter string
-     * @param request      the request
+     * @param request the request
      * @return the orchestration requests
      * @throws Exception the exception
      */
     @RequestMapping(value = "/mso_get_orch_reqs/{filterString}", method = RequestMethod.GET)
     public ResponseEntity<String> getOrchestrationRequests(@PathVariable("filterString") String filterString,
-                                                           HttpServletRequest request) {
+        HttpServletRequest request) {
 
         String methodName = "getOrchestrationRequests";
         LOGGER.debug(EELFLoggerDelegate.debugLogger, "<== " + methodName + START_LOG);
 
-
         MsoResponseWrapper w = msoBusinessLogic.getOrchestrationRequests(filterString);
 
         // always return OK, the MSO status code is embedded in the body
-        return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));
+        return new ResponseEntity<>(w.getResponse(), HttpStatus.OK);
     }
 
     /**
@@ -542,7 +562,8 @@
      * @throws Exception the exception
      */
     @RequestMapping(value = "/mso_activate_service_instance/{serviceInstanceId}", method = RequestMethod.POST)
-    public ResponseEntity<String> activateServiceInstance(@PathVariable("serviceInstanceId") String serviceInstanceId, @RequestBody RequestDetails requestDetails) {
+    public ResponseEntity<String> activateServiceInstance(@PathVariable("serviceInstanceId") String serviceInstanceId,
+        @RequestBody RequestDetails requestDetails) {
         String methodName = "activateServiceInstance";
         LOGGER.debug(EELFLoggerDelegate.debugLogger, "<== " + methodName + START_LOG);
 
@@ -559,7 +580,8 @@
      * @throws Exception the exception
      */
     @RequestMapping(value = "/mso_deactivate_service_instance/{serviceInstanceId}", method = RequestMethod.POST)
-    public ResponseEntity<String> deactivateServiceInstance(@PathVariable("serviceInstanceId") String serviceInstanceId, @RequestBody RequestDetails requestDetails) {
+    public ResponseEntity<String> deactivateServiceInstance(@PathVariable("serviceInstanceId") String serviceInstanceId,
+        @RequestBody RequestDetails requestDetails) {
         String methodName = "deactivateServiceInstance";
         LOGGER.debug(EELFLoggerDelegate.debugLogger, "<== " + methodName + START_LOG);
 
@@ -569,7 +591,8 @@
 
     /**
      * Gets the orchestration requests for the dashboard.
-     *  currently its all the orchestration requests with RequestType updateInstance or replaceInstance.
+     * currently its all the orchestration requests with RequestType updateInstance or replaceInstance.
+     *
      * @return the orchestration requests
      * @throws Exception the exception
      */
@@ -579,7 +602,6 @@
         String methodName = "getOrchestrationRequestsForDashboard";
         LOGGER.debug(EELFLoggerDelegate.debugLogger, "<== " + methodName + START_LOG);
 
-
         return msoBusinessLogic.getOrchestrationRequestsForDashboard();
     }
 
@@ -596,7 +618,7 @@
         String methodName = "getManualTasksByRequestId";
         LOGGER.debug(EELFLoggerDelegate.debugLogger, "<== " + methodName + START_LOG);
 
-        return  msoBusinessLogic.getManualTasksByRequestId(originalRequestId);
+        return msoBusinessLogic.getManualTasksByRequestId(originalRequestId);
     }
 
     /**
@@ -608,7 +630,8 @@
      * @throws Exception the exception
      */
     @RequestMapping(value = "/mso_post_man_task/{taskId}", method = RequestMethod.POST)
-    public ResponseEntity<String> manualTaskComplete(@PathVariable("taskId") String taskId , @RequestBody RequestDetails requestDetails) {
+    public ResponseEntity<String> manualTaskComplete(@PathVariable("taskId") String taskId,
+        @RequestBody RequestDetails requestDetails) {
 
         String methodName = "manualTaskComplete";
         LOGGER.debug(EELFLoggerDelegate.debugLogger, "<== " + methodName + START_LOG);
@@ -618,8 +641,9 @@
     }
 
     @RequestMapping(value = "/mso_remove_relationship/{serviceInstanceId}", method = RequestMethod.POST)
-    public ResponseEntity<String> removeRelationshipFromServiceInstance(@PathVariable("serviceInstanceId") String serviceInstanceId ,
-                                                                        @RequestBody RequestDetails requestDetails) {
+    public ResponseEntity<String> removeRelationshipFromServiceInstance(
+        @PathVariable("serviceInstanceId") String serviceInstanceId,
+        @RequestBody RequestDetails requestDetails) {
 
         String methodName = "removeRelationshipFromServiceInstance";
         LOGGER.debug(EELFLoggerDelegate.debugLogger, "<== " + methodName + START_LOG);
@@ -627,7 +651,7 @@
         MsoResponseWrapper w;
         try {
             w = msoBusinessLogic.removeRelationshipFromServiceInstance(requestDetails, serviceInstanceId);
-        } catch (Exception e){
+        } catch (Exception e) {
             LOGGER.error("Internal error when calling MSO controller logic for {}", methodName, e);
             return new ResponseEntity<>(e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);
         }
@@ -635,8 +659,9 @@
     }
 
     @RequestMapping(value = "/mso_add_relationship/{serviceInstanceId}", method = RequestMethod.POST)
-    public ResponseEntity<String> addRelationshipToServiceInstance(@PathVariable("serviceInstanceId") String serviceInstanceId ,
-                                                                   @RequestBody RequestDetails requestDetails) {
+    public ResponseEntity<String> addRelationshipToServiceInstance(
+        @PathVariable("serviceInstanceId") String serviceInstanceId,
+        @RequestBody RequestDetails requestDetails) {
 
         String methodName = "addRelationshipToServiceInstance";
         LOGGER.debug(EELFLoggerDelegate.debugLogger, "<== " + methodName + START_LOG);
@@ -644,7 +669,7 @@
         MsoResponseWrapper w;
         try {
             w = msoBusinessLogic.addRelationshipToServiceInstance(requestDetails, serviceInstanceId);
-        } catch (Exception e){
+        } catch (Exception e) {
             LOGGER.error("Internal error when calling MSO controller logic for {}", methodName, e);
             return new ResponseEntity<>(e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);
         }
@@ -653,8 +678,8 @@
 
     @RequestMapping(value = "/mso_activate_fabric_configuration/{serviceInstanceId}", method = RequestMethod.POST)
     public MsoResponseWrapper2 activateFabricConfiguration(
-            @PathVariable("serviceInstanceId") String serviceInstanceId ,
-            @RequestBody RequestDetails requestDetails) {
+        @PathVariable("serviceInstanceId") String serviceInstanceId,
+        @RequestBody RequestDetails requestDetails) {
 
         String methodName = "activateFabricConfiguration";
         LOGGER.debug(EELFLoggerDelegate.debugLogger, "<== " + methodName + START_LOG);
@@ -664,10 +689,10 @@
 
     @RequestMapping(value = "/mso_vfmodule_soft_delete/{serviceInstanceId}/{vnfInstanceId}/{vfModuleInstanceId}", method = RequestMethod.POST)
     public MsoResponseWrapper2 deactivateAndCloudDelete(
-            @PathVariable("serviceInstanceId") String serviceInstanceId,
-            @PathVariable("vnfInstanceId") String vnfInstanceId,
-            @PathVariable("vfModuleInstanceId") String vfModuleInstanceId,
-            @RequestBody SoftDeleteRequest softDeleteRequest) {
+        @PathVariable("serviceInstanceId") String serviceInstanceId,
+        @PathVariable("vnfInstanceId") String vnfInstanceId,
+        @PathVariable("vfModuleInstanceId") String vfModuleInstanceId,
+        @RequestBody SoftDeleteRequest softDeleteRequest) {
 
         String methodName = "deactivateAndCloudDelete";
         LOGGER.debug(EELFLoggerDelegate.debugLogger, "<== " + methodName + START_LOG);
@@ -675,14 +700,14 @@
         RequestDetails requestDetails = msoBusinessLogic.buildRequestDetailsForSoftDelete(softDeleteRequest);
 
         cloudOwnerService.enrichRequestWithCloudOwner(requestDetails);
-        return msoBusinessLogic.deactivateAndCloudDelete(serviceInstanceId, vnfInstanceId, vfModuleInstanceId, requestDetails);
+        return msoBusinessLogic
+            .deactivateAndCloudDelete(serviceInstanceId, vnfInstanceId, vfModuleInstanceId, requestDetails);
     }
 
-
     /**
      * Exception handler.
      *
-     * @param e        the e
+     * @param e the e
      * @param response the response
      * @throws IOException Signals that an I/O exception has occurred.
      */
@@ -701,6 +726,5 @@
         response.getWriter().write(new ObjectMapper().writeValueAsString(exceptionResponse));
 
         response.flushBuffer();
-
     }
 }
diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/MsoBusinessLogicImpl.java b/vid-app-common/src/main/java/org/onap/vid/mso/MsoBusinessLogicImpl.java
index dbeaa90..ae3c74d 100644
--- a/vid-app-common/src/main/java/org/onap/vid/mso/MsoBusinessLogicImpl.java
+++ b/vid-app-common/src/main/java/org/onap/vid/mso/MsoBusinessLogicImpl.java
@@ -480,7 +480,7 @@
             String str = "";
             restObjStr.set(str);
 
-            msoClientInterface.setServiceInstanceStatus(requestDetails, str, "", activateServicePath, restObjStr);
+            msoClientInterface.setServiceInstanceStatus(requestDetails, activateServicePath);
 
             return MsoUtil.wrapResponse(restObjStr);
 
@@ -707,15 +707,7 @@
             String isActivateState = (isActivate ? ACTIVATE : DEACTIVATE);
             endpoint = endpoint + isActivateState;
 
-
-            RestObject<String> restObjStr = new RestObject<>();
-            String str = "";
-            restObjStr.set(str);
-
-            msoClientInterface.setServiceInstanceStatus(requestDetails, str, "", endpoint, restObjStr);
-
-            return MsoUtil.wrapResponse(restObjStr);
-
+            return msoClientInterface.setServiceInstanceStatus(requestDetails, endpoint);
         } catch (Exception e) {
             logger.error(EELFLoggerDelegate.errorLogger, methodName + e.toString());
             logger.debug(EELFLoggerDelegate.debugLogger, methodName + e.toString());
diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/MsoInterface.java b/vid-app-common/src/main/java/org/onap/vid/mso/MsoInterface.java
index 9befc0f..cab75bf 100644
--- a/vid-app-common/src/main/java/org/onap/vid/mso/MsoInterface.java
+++ b/vid-app-common/src/main/java/org/onap/vid/mso/MsoInterface.java
@@ -107,7 +107,7 @@
 
     MsoResponseWrapper setPortOnConfigurationStatus(RequestDetails requestDetails, String endpoint);
 
-    void setServiceInstanceStatus(RequestDetails requestDetails, String t, String sourceId, String endpoint, RestObject<String> restObject);
+    MsoResponseWrapper setServiceInstanceStatus(RequestDetails requestDetails, String endpoint);
 
     MsoResponseWrapperInterface changeManagementUpdate(RequestDetailsWrapper requestDetails, String endpoint);
 
diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/rest/MsoRestClientNew.java b/vid-app-common/src/main/java/org/onap/vid/mso/rest/MsoRestClientNew.java
index 6a498fc..c039e00 100644
--- a/vid-app-common/src/main/java/org/onap/vid/mso/rest/MsoRestClientNew.java
+++ b/vid-app-common/src/main/java/org/onap/vid/mso/rest/MsoRestClientNew.java
@@ -397,7 +397,8 @@
 
     }
 
-    public void setServiceInstanceStatus(RequestDetails requestDetails, String t, String sourceId, String endpoint, RestObject<String> restObject) {
+    public MsoResponseWrapper setServiceInstanceStatus(RequestDetails requestDetails,
+        String endpoint) {
         String methodName = "activateServiceInstance";
         logger.debug(EELFLoggerDelegate.debugLogger, methodName + " start ");
         try {
@@ -405,6 +406,7 @@
             HttpResponse<String> response = client.post(path, commonHeaders, requestDetails, String.class);
             MsoResponseWrapper w = MsoUtil.wrapResponse(response);
             logger.debug(EELFLoggerDelegate.debugLogger, methodName + " w =" + w.getResponse());
+            return w;
 
         } catch (Exception e) {
             logger.error(EELFLoggerDelegate.errorLogger, "." + methodName + e.toString());
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/controller/aaiSubscriberController.js b/vid-app-common/src/main/webapp/app/vid/scripts/controller/aaiSubscriberController.js
index ed03e3a..072adf3 100755
--- a/vid-app-common/src/main/webapp/app/vid/scripts/controller/aaiSubscriberController.js
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/controller/aaiSubscriberController.js
@@ -25,6 +25,13 @@
     function (COMPONENT, FIELD, PARAMETER, DataService, PropertyService, $scope, $http, $timeout, $location, $log, $route, $uibModal, VIDCONFIGURATION, UtilityService, vidService, AaiService, MsoService, OwningEntityService, AsdcService, featureFlags, $q, _) {
 
         $scope.showReportWindow = function() {
+            let GuiMessage;
+
+            if ($scope.errorMsg !== undefined && $scope.errorMsg !== null) {
+                GuiMessage = $scope.errorMsg;
+            } else {
+                GuiMessage = $scope.status;
+            }
 
             const modalWindow = $uibModal.open({
                 templateUrl: 'app/vid/scripts/modals/report-modal/report-modal.html',
@@ -32,7 +39,7 @@
                 controllerAs: 'vm',
                 resolve: {
                     errorMsg: function () {
-                        return $scope.errorMsg;
+                        return GuiMessage;
                     }
                 }
             });
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/controller/msoCommitController.js b/vid-app-common/src/main/webapp/app/vid/scripts/controller/msoCommitController.js
index e4c75fb..c841f14 100755
--- a/vid-app-common/src/main/webapp/app/vid/scripts/controller/msoCommitController.js
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/controller/msoCommitController.js
@@ -74,8 +74,16 @@
 
 	$scope.showReportWindow = function() {
 		let requestInfo = {};
-		requestInfo.requestId = _this.requestId;
-		requestInfo.serviceUuid = $scope.service.model.service.uuid;
+		if(_this.requestId !== undefined) {
+			requestInfo.requestId = _this.requestId;
+		} else {
+			requestInfo.requestId = null;
+		}
+		if($scope.service !== undefined) {
+			requestInfo.serviceUuid = $scope.service.model.service.uuid;
+		} else {
+			requestInfo.serviceUuid = null;
+		}
 
 		const modalWindow = $uibModal.open({
 			templateUrl: 'app/vid/scripts/modals/report-modal/report-modal.html',
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/modals/report-modal/report-modal-request.controller.js b/vid-app-common/src/main/webapp/app/vid/scripts/modals/report-modal/report-modal-request.controller.js
index 6b69a08..48179dd 100644
--- a/vid-app-common/src/main/webapp/app/vid/scripts/modals/report-modal/report-modal-request.controller.js
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/modals/report-modal/report-modal-request.controller.js
@@ -42,10 +42,11 @@
         };
 
         vm.saveReportData = function(response) {
-            vm.report =
-                "Selected test API: \n" + DataService.getMsoRequestParametersTestApi()
-                + "\n\n Data from GUI:\n" + errorMsg
-                + "\n\n Collected data from API:\n" + JSON.stringify(response.data,  null, "\t") ;
+            vm.report = "Selected test API: \n" + DataService.getMsoRequestParametersTestApi();
+            if(errorMsg !== undefined && errorMsg !== null) {
+                vm.report += "\n\n Data from GUI:\n" + errorMsg;
+            }
+            vm.report +="\n\n Collected data from API:\n" + JSON.stringify(response.data,  null, "\t") ;
 
             const blob = new Blob([ vm.report ], { type : 'text/plain' });
             vm.download = ($window.URL || $window.webkitURL).createObjectURL( blob );
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/modals/report-modal/report-modal.controller.js b/vid-app-common/src/main/webapp/app/vid/scripts/modals/report-modal/report-modal.controller.js
index eff0291..2154396 100644
--- a/vid-app-common/src/main/webapp/app/vid/scripts/modals/report-modal/report-modal.controller.js
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/modals/report-modal/report-modal.controller.js
@@ -42,11 +42,11 @@
         };
 
         vm.saveReportData = function(response) {
-            vm.report =
-                "Selected test API: \n" + DataService.getMsoRequestParametersTestApi()
-                + "\n\n Data from GUI:\n" + errorMsg
-                + "\n\n Collected data from API:\n" + JSON.stringify(response.data,  null, "\t") ;
-
+            vm.report = "Selected test API: \n" + DataService.getMsoRequestParametersTestApi();
+            if(errorMsg !== undefined && errorMsg !== null) {
+                vm.report += "\n\n Data from GUI:\n" + errorMsg;
+            }
+            vm.report +="\n\n Collected data from API:\n" + JSON.stringify(response.data,  null, "\t") ;
 
             const blob = new Blob([ vm.report ], { type : 'text/plain' });
             vm.download = ($window.URL || $window.webkitURL).createObjectURL( blob );
diff --git a/vid-app-common/src/test/java/org/onap/vid/controller/MsoControllerTest.java b/vid-app-common/src/test/java/org/onap/vid/controller/MsoControllerTest.java
index b0378b0..02ab287 100644
--- a/vid-app-common/src/test/java/org/onap/vid/controller/MsoControllerTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/controller/MsoControllerTest.java
@@ -7,9 +7,9 @@
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,8 +20,8 @@
 
 package org.onap.vid.controller;
 
-import static org.assertj.core.api.Assertions.assertThat;
 import static org.mockito.ArgumentMatchers.argThat;
+import static org.mockito.ArgumentMatchers.eq;
 import static org.mockito.BDDMockito.given;
 import static org.mockito.BDDMockito.then;
 import static org.mockito.Mockito.mock;
@@ -34,7 +34,9 @@
 
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.databind.ObjectMapper;
+import java.util.LinkedHashMap;
 import java.util.List;
+import java.util.Map;
 import java.util.stream.Collectors;
 import org.jeasy.random.EasyRandom;
 import org.jeasy.random.EasyRandomParameters;
@@ -42,7 +44,6 @@
 import org.jeasy.random.randomizers.text.StringRandomizer;
 import org.junit.Before;
 import org.junit.Test;
-import org.mockito.ArgumentCaptor;
 import org.onap.vid.mso.MsoBusinessLogic;
 import org.onap.vid.mso.MsoResponseWrapper;
 import org.onap.vid.mso.rest.Request;
@@ -76,26 +77,23 @@
     }
 
     @Test
-    public void shouldDelegateNewInstanceCreation() throws Exception {
+    public void shouldDelegateNewServiceInstantiation() throws Exception {
         // given
-        RequestDetails given = modelGenerator.nextObject(RequestDetails.class);
-        String payload = objectMapper.writeValueAsString(given);
+        RequestDetails requestDetails = modelGenerator.nextObject(RequestDetails.class);
 
         MsoResponseWrapper expectedResponse = new MsoResponseWrapper(200, "test");
         given(msoBusinessLogic
-            .createSvcInstance(argThat(request -> asJson(request).equals(payload))))
+            .createSvcInstance(objectEqualTo(requestDetails)))
             .willReturn(expectedResponse);
 
         // when & then
         mockMvc.perform(post("/mso/mso_create_svc_instance")
-            .content(payload)
+            .content(asJson(requestDetails))
             .contentType(APPLICATION_JSON))
             .andExpect(status().isOk())
             .andExpect(content().json(asJson(expectedResponse)));
 
-        ArgumentCaptor<RequestDetails> captor = ArgumentCaptor.forClass(RequestDetails.class);
-        then(cloudService).should(only()).enrichRequestWithCloudOwner(captor.capture());
-        assertThat(captor.getValue()).matches(request -> asJson(request).equals(payload));
+        then(cloudService).should(only()).enrichRequestWithCloudOwner(objectEqualTo(requestDetails));
     }
 
     @Test
@@ -133,6 +131,106 @@
         then(cloudService).shouldHaveZeroInteractions();
     }
 
+    @Test
+    public void shouldDelegateE2EServiceInstantiation() throws Exception {
+        // given
+        String requestDetails = "some request details";
+        Map<String, Object> payload = new LinkedHashMap<>();
+        payload.put("requestDetails", requestDetails);
+
+        MsoResponseWrapper wrapper = mock(MsoResponseWrapper.class);
+        given(wrapper.getResponse()).willReturn("some response");
+        given(msoBusinessLogic.createE2eSvcInstance(requestDetails)).willReturn(wrapper);
+
+        // when & then
+        mockMvc.perform(post("/mso/mso_create_e2e_svc_instance")
+            .content(asJson(payload))
+            .contentType(APPLICATION_JSON))
+            .andExpect(status().isOk())
+            .andExpect(content().string("some response"));
+
+        then(cloudService).shouldHaveZeroInteractions();
+    }
+
+    @Test
+    public void shouldDelegateServiceInstantiation() throws Exception {
+        // given
+        RequestDetails requestDetails = modelGenerator.nextObject(RequestDetails.class);
+
+        MsoResponseWrapper wrapper = mock(MsoResponseWrapper.class);
+        given(wrapper.getResponse()).willReturn("some response");
+        given(msoBusinessLogic.createSvcInstance(objectEqualTo(requestDetails))).willReturn(wrapper);
+
+        // when & then
+        mockMvc.perform(post("/mso/mso_create_svc_instance")
+            .content(asJson(requestDetails))
+            .contentType(APPLICATION_JSON))
+            .andExpect(status().isOk())
+            .andExpect(content().string("some response"));
+
+        then(cloudService).should(only()).enrichRequestWithCloudOwner(objectEqualTo(requestDetails));
+    }
+
+    @Test
+    public void shouldDelegateVnfInstantiation() throws Exception {
+        // given
+        RequestDetails requestDetails = modelGenerator.nextObject(RequestDetails.class);
+        String serviceInstanceId = "bc305d54-75b4-431b-adb2-eb6b9e546014";
+
+        MsoResponseWrapper wrapper = mock(MsoResponseWrapper.class);
+        given(wrapper.getResponse()).willReturn("some response");
+        given(msoBusinessLogic.createVnf(objectEqualTo(requestDetails), eq(serviceInstanceId))).willReturn(wrapper);
+
+        // when & then
+        mockMvc.perform(post("/mso/mso_create_vnf_instance/" + serviceInstanceId)
+            .content(asJson(requestDetails))
+            .contentType(APPLICATION_JSON))
+            .andExpect(status().isOk())
+            .andExpect(content().string("some response"));
+
+        then(cloudService).should(only()).enrichRequestWithCloudOwner(objectEqualTo(requestDetails));
+    }
+
+    @Test
+    public void shouldDelegateNewInstanceCreation() throws Exception {
+        // given
+        RequestDetails requestDetails = modelGenerator.nextObject(RequestDetails.class);
+        String serviceInstanceId = "bc305d54-75b4-431b-adb2-eb6b9e546014";
+
+        MsoResponseWrapper wrapper = mock(MsoResponseWrapper.class);
+        given(wrapper.getResponse()).willReturn("some response");
+        given(msoBusinessLogic.createNwInstance(objectEqualTo(requestDetails), eq(serviceInstanceId))).willReturn(wrapper);
+
+        // when & then
+        mockMvc.perform(post("/mso/mso_create_nw_instance/" + serviceInstanceId)
+            .content(asJson(requestDetails))
+            .contentType(APPLICATION_JSON))
+            .andExpect(status().isOk())
+            .andExpect(content().string("some response"));
+
+        then(cloudService).should(only()).enrichRequestWithCloudOwner(objectEqualTo(requestDetails));
+    }
+
+    @Test
+    public void shouldCompleteManualTask() throws Exception {
+        // given
+        RequestDetails requestDetails = modelGenerator.nextObject(RequestDetails.class);
+        String taskId = "bc305d54-75b4-431b-adb2-eb6b9e546014";
+
+        MsoResponseWrapper wrapper = mock(MsoResponseWrapper.class);
+        given(wrapper.getResponse()).willReturn("some response");
+        given(msoBusinessLogic.completeManualTask(objectEqualTo(requestDetails), eq(taskId))).willReturn(wrapper);
+
+        // when & then
+        mockMvc.perform(post("/mso/mso_post_man_task/" + taskId)
+            .content(asJson(requestDetails))
+            .contentType(APPLICATION_JSON))
+            .andExpect(status().isOk())
+            .andExpect(content().string("some response"));
+
+        then(cloudService).shouldHaveZeroInteractions();
+    }
+
     private <T> String asJson(T value) {
         try {
             return objectMapper.writeValueAsString(value);
@@ -140,4 +238,8 @@
             throw new RuntimeException(e);
         }
     }
+
+    private <T> T objectEqualTo(T expected) {
+        return argThat(given -> asJson(given).equals(asJson(expected)));
+    }
 }
\ No newline at end of file
diff --git a/vid-app-common/src/test/java/org/onap/vid/mso/MsoBusinessLogicImplTest.java b/vid-app-common/src/test/java/org/onap/vid/mso/MsoBusinessLogicImplTest.java
index a7fa8cd..0efdb6b 100644
--- a/vid-app-common/src/test/java/org/onap/vid/mso/MsoBusinessLogicImplTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/mso/MsoBusinessLogicImplTest.java
@@ -92,7 +92,6 @@
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.doThrow;
 import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
 import static org.onap.vid.controller.MsoController.CONFIGURATION_ID;
 import static org.onap.vid.controller.MsoController.REQUEST_TYPE;
 import static org.onap.vid.controller.MsoController.SVC_INSTANCE_ID;
@@ -628,26 +627,6 @@
     }
 
     @Test(expectedExceptions = MsoTestException.class)
-    public void shouldThrowExceptionWhenActivateServiceInstanceWithWrongParameters() {
-        //given
-        RequestDetails requestDetails = new RequestDetails();
-        String taskId = "testTaskId";
-
-        RestObject<String> restObjStr = new RestObject<>();
-        restObjStr.set("");
-        MsoResponseWrapper expectedResponse = MsoUtil.wrapResponse(restObjStr);
-
-        doThrow(new MsoTestException("testException")).
-                when(msoInterface).setServiceInstanceStatus(eq(requestDetails), any(String.class), any(String.class), any(String.class), any(RestObject.class));
-
-        //when
-        MsoResponseWrapper response = msoBusinessLogic.activateServiceInstance(requestDetails, taskId);
-
-        //then
-        assertThat(response).isEqualToComparingFieldByField(expectedResponse);
-    }
-
-    @Test(expectedExceptions = MsoTestException.class)
     public void shouldThrowExceptionWhenManualTaskWithWrongParameters() {
         //given
         RequestDetails requestDetails = new RequestDetails();
@@ -1118,38 +1097,34 @@
     public void shouldProperlySetServiceInstanceStatusActiveWithProperParameters() {
         //  given
         String serviceInstanceId = "testServiceId";
+        MsoResponseWrapper okResponse = createOkResponse();
 
         org.onap.vid.changeManagement.RequestDetails requestDetails = new org.onap.vid.changeManagement.RequestDetails();
 
-        RestObject<String> restObjStr = new RestObject<>();
-        restObjStr.set("");
-        MsoResponseWrapper expectedResponse = MsoUtil.wrapResponse(restObjStr);
+        given(msoInterface.setServiceInstanceStatus(eq(requestDetails), endsWith(serviceInstanceId + "/activate"))).willReturn(okResponse);
 
         //  when
         MsoResponseWrapper response = msoBusinessLogic.setServiceInstanceStatus(requestDetails, serviceInstanceId, true);
 
         //  then
-        assertThat(response).isEqualToComparingFieldByField(expectedResponse);
-
+        assertThat(response).isEqualToComparingFieldByField(okResponse);
     }
 
     @Test
     public void shouldProperlySetServiceInstanceStatusDeactivateWithProperParameters() {
         //  given
         String serviceInstanceId = "testServiceId";
+        MsoResponseWrapper okResponse = createOkResponse();
 
         org.onap.vid.changeManagement.RequestDetails requestDetails = new org.onap.vid.changeManagement.RequestDetails();
 
-        RestObject<String> restObjStr = new RestObject<>();
-        restObjStr.set("");
-        MsoResponseWrapper expectedResponse = MsoUtil.wrapResponse(restObjStr);
+        given(msoInterface.setServiceInstanceStatus(eq(requestDetails), endsWith(serviceInstanceId + "/deactivate"))).willReturn(okResponse);
 
         //  when
         MsoResponseWrapper response = msoBusinessLogic.setServiceInstanceStatus(requestDetails, serviceInstanceId, false);
 
         //  then
-        assertThat(response).isEqualToComparingFieldByField(expectedResponse);
-
+        assertThat(response).isEqualToComparingFieldByField(okResponse);
     }
 
     @Test(expectedExceptions = MsoTestException.class)
@@ -1158,7 +1133,7 @@
         String serviceInstanceId = "testServiceId";
 
         doThrow(new MsoTestException("testException")).
-                when(msoInterface).setServiceInstanceStatus(eq(null), any(String.class), any(String.class), any(String.class), any(RestObject.class));
+                when(msoInterface).setServiceInstanceStatus(eq(null), any(String.class));
 
         //  when
         msoBusinessLogic.setServiceInstanceStatus(null, serviceInstanceId, true);
diff --git a/vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientNewTest.java b/vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientNewTest.java
index 832aa09..d4abfae 100644
--- a/vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientNewTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientNewTest.java
@@ -20,11 +20,19 @@
  */
 package org.onap.vid.mso.rest;
 
+import static org.apache.commons.io.IOUtils.toInputStream;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.mockito.ArgumentMatchers.anyMap;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
 import static org.onap.vid.controller.MsoController.SVC_INSTANCE_ID;
 import static org.onap.vid.controller.MsoController.VNF_INSTANCE_ID;
 
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.xebialabs.restito.server.StubServer;
+import io.joshworks.restclient.http.HttpResponse;
 import java.io.IOException;
 import java.io.InputStream;
 import java.nio.file.Files;
@@ -413,20 +421,29 @@
     }
 
     @Test
-    public void testSetServiceInstanceStatus() throws Exception {
-        MsoRestClientNew testSubject;
-        RequestDetails requestDetails = null;
+    public void testSetServiceInstanceStatus_givenValidResponse_responseIsPopulatedAccordingly() {
+        RequestDetails requestDetails = new RequestDetails();
         String t = "";
         String sourceId = "";
         String endpoint = "";
-        RestObject<String> restObject = null;
+        final SyncRestClient client = mock(SyncRestClient.class);
+        MsoRestClientNew testSubject = new MsoRestClientNew(client, "", null, new SystemPropertiesWrapper());
 
-        // default test
-        try {
-            testSubject = createTestSubject();
-            testSubject.setServiceInstanceStatus(requestDetails, t, sourceId, endpoint, restObject);
-        } catch (Exception e) {
-        }
+        // setup
+        final HttpResponse<String> response = mock(HttpResponse.class);
+        final int expectedStatus = 202;
+        final String expectedResponse = "expected response";
+
+        when(client.post(eq(endpoint), anyMap(), eq(requestDetails), eq(String.class))).thenReturn(response);
+        when(response.getStatus()).thenReturn(expectedStatus);
+        when(response.getBody()).thenReturn(expectedResponse);
+        when(response.getRawBody()).thenReturn(toInputStream(expectedResponse));
+
+        // test
+        MsoResponseWrapper responseWrapper = testSubject.setServiceInstanceStatus(requestDetails, endpoint);
+
+        assertThat(responseWrapper.getStatus(), is(expectedStatus));
+        assertThat(responseWrapper.getEntity(), is(expectedResponse));
     }
 
     @Test
diff --git a/vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientTest.java b/vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientTest.java
index 050fa0d..8ea4836 100644
--- a/vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientTest.java
@@ -35,11 +35,9 @@
 import org.apache.http.StatusLine;
 import org.apache.http.message.BasicHttpResponse;
 import org.apache.http.message.BasicStatusLine;
-import org.jetbrains.annotations.NotNull;
 import org.mockito.Mock;
 import org.onap.portalsdk.core.util.SystemProperties;
 import org.onap.vid.changeManagement.RequestDetailsWrapper;
-import org.onap.vid.changeManagement.RequestParameters;
 import org.onap.vid.changeManagement.WorkflowRequestDetail;
 import org.onap.vid.client.SyncRestClient;
 import org.onap.vid.controller.LocalWebConfig;
@@ -49,7 +47,6 @@
 import org.onap.vid.mso.MsoResponseWrapperInterface;
 import org.onap.vid.mso.MsoUtil;
 import org.onap.vid.mso.RestObject;
-import org.onap.vid.mso.model.CloudConfiguration;
 import org.onap.vid.mso.model.RequestReferences;
 import org.onap.vid.utils.SystemPropertiesWrapper;
 import org.springframework.test.context.ContextConfiguration;
@@ -57,9 +54,7 @@
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Test;
 
-import java.util.ArrayList;
 import java.util.HashMap;
-import java.util.List;
 import java.util.Map;
 import java.util.UUID;
 
@@ -664,7 +659,7 @@
         when(client.post(eq(baseUrl + endpoint), anyMap(), eq(requestDetails), eq(String.class))).thenReturn(httpResponse);
 
         //  when
-        restClient.setServiceInstanceStatus(requestDetails,"", "", endpoint, restObject);
+        restClient.setServiceInstanceStatus(requestDetails, endpoint);
     }
 
     @Test( expectedExceptions = MsoTestException.class)
@@ -675,7 +670,7 @@
         when(client.post(eq(baseUrl), anyMap(), eq(null), eq(String.class))).thenThrow(new MsoTestException("test-post-exception"));
 
         //  when
-        restClient.setServiceInstanceStatus(null,"", "", endpoint, null);
+        restClient.setServiceInstanceStatus(null, endpoint);
     }
 
     @Test
