diff --git a/generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/GenericResourceApiProvider.java b/generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/GenericResourceApiProvider.java
index 9673515..ba3f1b5 100644
--- a/generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/GenericResourceApiProvider.java
+++ b/generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/GenericResourceApiProvider.java
@@ -134,14 +134,14 @@
 
 public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURCEAPIService {
 
-    private static final String APP_NAME = "generic-resource-api";
+    protected static final String APP_NAME = "generic-resource-api";
     private static final String CALLED_STR = "{} called.";
     private static final String NULL_OR_EMPTY_ERROR_MESSAGE = "exiting {} because of null or empty service-instance-id";
-    private static final String NULL_OR_EMPTY_ERROR_PARAM = "invalid input, null or empty service-instance-id";
+    protected static final String NULL_OR_EMPTY_ERROR_PARAM = "invalid input, null or empty service-instance-id";
     private static final String ADDING_INPUT_DATA_LOG = "Adding INPUT data for {} [{}] input: {}";
     private static final String ADDING_OPERATIONAL_DATA_LOG = "Adding OPERATIONAL data for {} [{}] operational-data: {}";
     private static final String OPERATIONAL_DATA_PARAM = "operational-data";
-    private static final String NO_SERVICE_LOGIC_ACTIVE = "No service logic active for ";
+    protected static final String NO_SERVICE_LOGIC_ACTIVE = "No service logic active for ";
     private static final String SERVICE_LOGIC_SEARCH_ERROR_MESSAGE = "Caught exception looking for service logic";
     private static final String ERROR_CODE_PARAM = "error-code";
     private static final String ERROR_MESSAGE_PARAM = "error-message";
@@ -502,7 +502,7 @@
         // create a new response object
         ServiceTopologyOperationOutputBuilder responseBuilder = new ServiceTopologyOperationOutputBuilder();
 
-        if (hasValidService(input)) {
+        if (hasInvalidService(input)) {
             log.debug(NULL_OR_EMPTY_ERROR_MESSAGE, svcOperation);
             responseBuilder.setResponseCode("404");
             responseBuilder.setResponseMessage(NULL_OR_EMPTY_ERROR_PARAM);
@@ -548,25 +548,25 @@
         // Call SLI sync method
         // Get SvcLogicService reference
 
-        ErrorObject error = new ErrorObject("200", "");
+        ResponseObject responseObject = new ResponseObject("200", "");
         String ackFinal = "Y";
         String serviceObjectPath = null;
-        Properties respProps = tryGetProperties(svcOperation, parms, serviceDataBuilder, error);
+        Properties respProps = tryGetProperties(svcOperation, parms, serviceDataBuilder, responseObject);
 
         if (respProps != null) {
-            error.setStatusCode(respProps.getProperty(ERROR_CODE_PARAM));
-            error.setMessage(respProps.getProperty(ERROR_MESSAGE_PARAM));
+            responseObject.setStatusCode(respProps.getProperty(ERROR_CODE_PARAM));
+            responseObject.setMessage(respProps.getProperty(ERROR_MESSAGE_PARAM));
             ackFinal = respProps.getProperty(ACK_FINAL_PARAM, "Y");
             serviceObjectPath = respProps.getProperty(SERVICE_OBJECT_PATH_PARAM);
         }
 
-        setServiceStatus(serviceStatusBuilder, error.getStatusCode(), error.getMessage(), ackFinal);
+        setServiceStatus(serviceStatusBuilder, responseObject.getStatusCode(), responseObject.getMessage(), ackFinal);
         serviceStatusBuilder.setRequestStatus(RequestStatus.Synccomplete);
         serviceStatusBuilder.setRpcName(svcOperation);
 
-        if (isValidErrorObject(error)) {
-            responseBuilder.setResponseCode(error.getStatusCode());
-            responseBuilder.setResponseMessage(error.getMessage());
+        if (failed(responseObject)) {
+            responseBuilder.setResponseCode(responseObject.getStatusCode());
+            responseBuilder.setResponseMessage(responseObject.getMessage());
             responseBuilder.setAckFinalIndicator(ackFinal);
 
             ServiceBuilder serviceBuilder = new ServiceBuilder();
@@ -609,7 +609,7 @@
         } catch (Exception e) {
             log.error(UPDATING_MDSAL_ERROR_MESSAGE, svcOperation, siid, e);
             responseBuilder.setResponseCode("500");
-            responseBuilder.setResponseMessage(e.toString());
+            responseBuilder.setResponseMessage(e.getMessage());
             responseBuilder.setAckFinalIndicator("Y");
             log.error(RETURNED_FAILED_MESSAGE, svcOperation, siid, responseBuilder.build());
 
@@ -622,9 +622,9 @@
         }
 
         // Update succeeded
-        responseBuilder.setResponseCode(error.getStatusCode());
+        responseBuilder.setResponseCode(responseObject.getStatusCode());
         responseBuilder.setAckFinalIndicator(ackFinal);
-        trySetResponseMessage(responseBuilder, error);
+        trySetResponseMessage(responseBuilder, responseObject);
         log.info(UPDATED_MDSAL_INFO_MESSAGE, svcOperation, siid);
         log.info(RETURNED_SUCCESS_MESSAGE, svcOperation, siid, responseBuilder.build());
 
@@ -636,13 +636,13 @@
         return Futures.immediateFuture(rpcResult);
     }
 
-    private void trySetResponseMessage(ServiceTopologyOperationOutputBuilder responseBuilder, ErrorObject error) {
+    private void trySetResponseMessage(ServiceTopologyOperationOutputBuilder responseBuilder, ResponseObject error) {
         if (!error.getMessage().isEmpty()) {
             responseBuilder.setResponseMessage(error.getMessage());
         }
     }
 
-    private boolean hasValidService(ServiceTopologyOperationInput input) {
+    private boolean hasInvalidService(ServiceTopologyOperationInput input) {
         return input == null || input.getServiceInformation() == null
             || input.getServiceInformation().getServiceInstanceId() == null
             || input.getServiceInformation().getServiceInstanceId().length() == 0;
@@ -665,30 +665,30 @@
     }
 
     private Properties tryGetProperties(String svcOperation, Properties parms, ServiceDataBuilder serviceDataBuilder,
-        ErrorObject error) {
+        ResponseObject responseObject) {
         try {
             if (svcLogicClient.hasGraph(APP_NAME, svcOperation, null, "sync")) {
                 try {
                     return svcLogicClient.execute(APP_NAME, svcOperation, null, "sync", serviceDataBuilder, parms);
                 } catch (Exception e) {
                     log.error(SERVICE_LOGIC_EXECUTION_ERROR_MESSAGE, svcOperation, e);
-                    error.setMessage(e.getMessage());
-                    error.setStatusCode("500");
+                    responseObject.setMessage(e.getMessage());
+                    responseObject.setStatusCode("500");
                 }
             } else {
-                error.setMessage(NO_SERVICE_LOGIC_ACTIVE + APP_NAME + ": '" + svcOperation + "'");
-                error.setStatusCode("503");
+                responseObject.setMessage(NO_SERVICE_LOGIC_ACTIVE + APP_NAME + ": '" + svcOperation + "'");
+                responseObject.setStatusCode("503");
             }
         } catch (Exception e) {
-            error.setMessage(e.getMessage());
-            error.setStatusCode("500");
+            responseObject.setMessage(e.getMessage());
+            responseObject.setStatusCode("500");
             log.error(SERVICE_LOGIC_SEARCH_ERROR_MESSAGE, e);
         }
 
         return null;
     }
 
-    private boolean isValidErrorObject(ErrorObject error) {
+    private boolean failed(ResponseObject error) {
         return
             !error.getStatusCode().isEmpty() && !("0".equals(error.getStatusCode()) || "200"
                 .equals(error.getStatusCode()));
@@ -779,7 +779,7 @@
         // Call SLI sync method
         // Get SvcLogicService reference
 
-        ErrorObject error = new ErrorObject("200", "");
+        ResponseObject error = new ResponseObject("200", "");
         String ackFinal = "Y";
         String serviceObjectPath = null;
         Properties respProps = tryGetProperties(svcOperation, parms, serviceDataBuilder, error);
@@ -795,7 +795,7 @@
         serviceStatusBuilder.setRequestStatus(RequestStatus.Synccomplete);
         serviceStatusBuilder.setRpcName(svcOperation);
 
-        if (isValidErrorObject(error)) {
+        if (failed(error)) {
             responseBuilder.setResponseCode(error.getStatusCode());
             responseBuilder.setResponseMessage(error.getMessage());
             responseBuilder.setAckFinalIndicator(ackFinal);
@@ -875,7 +875,7 @@
         return Futures.immediateFuture(rpcResult);
     }
 
-    private void trySetResponseMessage(VnfTopologyOperationOutputBuilder responseBuilder, ErrorObject error) {
+    private void trySetResponseMessage(VnfTopologyOperationOutputBuilder responseBuilder, ResponseObject error) {
         if (!error.getMessage().isEmpty()) {
             responseBuilder.setResponseMessage(error.getMessage());
         }
@@ -1009,7 +1009,7 @@
         // Call SLI sync method
         // Get SvcLogicService reference
 
-        ErrorObject error = new ErrorObject("200", "");
+        ResponseObject error = new ResponseObject("200", "");
         String ackFinal = "Y";
         String serviceObjectPath = null;
         Properties respProps = tryGetProperties(svcOperation, parms, serviceDataBuilder, error);
@@ -1025,7 +1025,7 @@
         serviceStatusBuilder.setRequestStatus(RequestStatus.Synccomplete);
         serviceStatusBuilder.setRpcName(svcOperation);
 
-        if (isValidErrorObject(error)) {
+        if (failed(error)) {
             responseBuilder.setResponseCode(error.getStatusCode());
             responseBuilder.setResponseMessage(error.getStatusCode());
             responseBuilder.setAckFinalIndicator(ackFinal);
@@ -1099,7 +1099,7 @@
         return Futures.immediateFuture(rpcResult);
     }
 
-    private void trySetResponseMessage(VfModuleTopologyOperationOutputBuilder responseBuilder, ErrorObject error) {
+    private void trySetResponseMessage(VfModuleTopologyOperationOutputBuilder responseBuilder, ResponseObject error) {
         if (!error.getMessage().isEmpty()) {
             responseBuilder.setResponseMessage(error.getMessage());
         }
@@ -1182,7 +1182,7 @@
         // Call SLI sync method
         // Get SvcLogicService reference
 
-        ErrorObject error = new ErrorObject("200", "");
+        ResponseObject error = new ResponseObject("200", "");
         String ackFinal = "Y";
         String networkId = ERROR_NETWORK_ID;
         String serviceObjectPath = null;
@@ -1198,7 +1198,7 @@
             networkObjectPath = respProps.getProperty("network-object-path");
         }
 
-        if (isValidErrorObject(error)) {
+        if (failed(error)) {
             responseBuilder.setResponseCode(error.getStatusCode());
             responseBuilder.setResponseMessage(error.getMessage());
             responseBuilder.setAckFinalIndicator(ackFinal);
@@ -1268,7 +1268,7 @@
         return Futures.immediateFuture(rpcResult);
     }
 
-    private void trySetResponseMessage(NetworkTopologyOperationOutputBuilder responseBuilder, ErrorObject error) {
+    private void trySetResponseMessage(NetworkTopologyOperationOutputBuilder responseBuilder, ResponseObject error) {
         if (!error.getMessage().isEmpty()) {
             responseBuilder.setResponseMessage(error.getMessage());
         }
@@ -1355,7 +1355,7 @@
 
         // Call SLI sync method
         // Get SvcLogicService reference
-        ErrorObject error = new ErrorObject("200", "");
+        ResponseObject error = new ResponseObject("200", "");
         String ackFinal = "Y";
         String allottedResourceId = ERROR_NETWORK_ID;
         String serviceObjectPath = null;
@@ -1371,7 +1371,7 @@
             contrailRouteObjectPath = respProps.getProperty("contrail-route-object-path");
         }
 
-        if (isValidErrorObject(error)) {
+        if (failed(error)) {
             responseBuilder.setResponseCode(error.getStatusCode());
             responseBuilder.setResponseMessage(error.getMessage());
             responseBuilder.setAckFinalIndicator(ackFinal);
@@ -1439,7 +1439,7 @@
         return Futures.immediateFuture(rpcResult);
     }
 
-    private void trySetResponseMessage(ContrailRouteTopologyOperationOutputBuilder responseBuilder, ErrorObject error) {
+    private void trySetResponseMessage(ContrailRouteTopologyOperationOutputBuilder responseBuilder, ResponseObject error) {
         if (!error.getMessage().isEmpty()) {
             responseBuilder.setResponseMessage(error.getMessage());
         }
@@ -1527,7 +1527,7 @@
 
         Properties respProps = null;
 
-        ErrorObject error = new ErrorObject("200", "");
+        ResponseObject error = new ResponseObject("200", "");
         String ackFinal = "Y";
         String allottedResourceId = ERROR_NETWORK_ID;
         String serviceObjectPath = null;
@@ -1562,7 +1562,7 @@
             securityZoneObjectPath = respProps.getProperty("security-zone-object-path");
         }
 
-        if (isValidErrorObject(error)) {
+        if (failed(error)) {
             responseBuilder.setResponseCode(error.getStatusCode());
             responseBuilder.setResponseMessage(error.getMessage());
             responseBuilder.setAckFinalIndicator(ackFinal);
@@ -1631,7 +1631,7 @@
         return Futures.immediateFuture(rpcResult);
     }
 
-    private void trySetResponseMessage(SecurityZoneTopologyOperationOutputBuilder responseBuilder, ErrorObject error) {
+    private void trySetResponseMessage(SecurityZoneTopologyOperationOutputBuilder responseBuilder, ResponseObject error) {
         if (!error.getMessage().isEmpty()) {
             responseBuilder.setResponseMessage(error.getMessage());
         }
@@ -1713,7 +1713,7 @@
 
         // Call SLI sync method
         // Get SvcLogicService reference
-        ErrorObject error = new ErrorObject("200", "");
+        ResponseObject error = new ResponseObject("200", "");
         String ackFinal = "Y";
         String allottedResourceId = ERROR_NETWORK_ID;
         String serviceObjectPath = null;
@@ -1729,7 +1729,7 @@
             tunnelxconnObjectPath = respProps.getProperty("tunnelxconn-object-path");
         }
 
-        if (isValidErrorObject(error)) {
+        if (failed(error)) {
             responseBuilder.setResponseCode(error.getStatusCode());
             responseBuilder.setResponseMessage(error.getMessage());
             responseBuilder.setAckFinalIndicator(ackFinal);
@@ -1786,7 +1786,7 @@
         return Futures.immediateFuture(rpcResult);
     }
 
-    private void trySetResponseMessage(TunnelxconnTopologyOperationOutputBuilder responseBuilder, ErrorObject error) {
+    private void trySetResponseMessage(TunnelxconnTopologyOperationOutputBuilder responseBuilder, ResponseObject error) {
         if (!error.getMessage().isEmpty()) {
             responseBuilder.setResponseMessage(error.getMessage());
         }
@@ -1798,7 +1798,7 @@
             || input.getServiceInformation().getServiceInstanceId().length() == 0;
     }
 
-    private Properties tryGetProperties(String svcOperation, Properties parms, ErrorObject error) {
+    private Properties tryGetProperties(String svcOperation, Properties parms, ResponseObject error) {
         try {
             if (svcLogicClient.hasGraph(APP_NAME, svcOperation, null, "sync")) {
 
@@ -1853,7 +1853,7 @@
 
         // Call SLI sync method
         // Get SvcLogicService reference
-        ErrorObject error = new ErrorObject("200", "");
+        ResponseObject error = new ResponseObject("200", "");
         String ackFinal = "Y";
         String allottedResourceId = ERROR_NETWORK_ID;
         String serviceObjectPath = null;
@@ -1869,7 +1869,7 @@
             brgObjectPath = respProps.getProperty("brg-object-path");
         }
 
-        if (isValidErrorObject(error)) {
+        if (failed(error)) {
             responseBuilder.setResponseCode(error.getStatusCode());
             responseBuilder.setResponseMessage(error.getMessage());
             responseBuilder.setAckFinalIndicator(ackFinal);
@@ -1926,7 +1926,7 @@
         return Futures.immediateFuture(rpcResult);
     }
 
-    private void trySetResponseMessage(BrgTopologyOperationOutputBuilder responseBuilder, ErrorObject error) {
+    private void trySetResponseMessage(BrgTopologyOperationOutputBuilder responseBuilder, ResponseObject error) {
         if (!error.getMessage().isEmpty()) {
             responseBuilder.setResponseMessage(error.getMessage());
         }
@@ -2014,11 +2014,11 @@
 
         // Call SLI sync method
         // Get SvcLogicService reference
-        ErrorObject error = new ErrorObject("200", "");
+        ResponseObject error = new ResponseObject("200", "");
         Properties respProps = tryGetProperties(svcOperation, parms, error);
         String ackFinal = resolveAckFinal(error, respProps);
 
-        if (isValidErrorObject(error)) {
+        if (failed(error)) {
 
             responseBuilder.setResponseCode(error.getStatusCode());
             responseBuilder.setResponseMessage(error.getMessage());
@@ -2083,7 +2083,7 @@
         return Futures.immediateFuture(rpcResult);
     }
 
-    private String resolveAckFinal(ErrorObject error, Properties respProps) {
+    private String resolveAckFinal(ResponseObject error, Properties respProps) {
         if (respProps != null) {
             error.setStatusCode(respProps.getProperty(ERROR_CODE_PARAM));
             error.setMessage(respProps.getProperty(ERROR_MESSAGE_PARAM));
@@ -2092,7 +2092,7 @@
         return "Y";
     }
 
-    private void trySetResponseMessage(PreloadVnfTopologyOperationOutputBuilder responseBuilder, ErrorObject error) {
+    private void trySetResponseMessage(PreloadVnfTopologyOperationOutputBuilder responseBuilder, ResponseObject error) {
         if (!error.getMessage().isEmpty()) {
             responseBuilder.setResponseMessage(error.getMessage());
         }
@@ -2206,12 +2206,12 @@
 
         // Call SLI sync method
         // Get SvcLogicService reference
-        ErrorObject error = new ErrorObject("200", "");
+        ResponseObject error = new ResponseObject("200", "");
         Properties respProps = tryGetProperties(svcOperation, parms, error);
 
         String ackFinal = resolveAckFinal(error, respProps);
 
-        if (isValidErrorObject(error)) {
+        if (failed(error)) {
 
             responseBuilder.setResponseCode(error.getStatusCode());
             responseBuilder.setResponseMessage(error.getMessage());
@@ -2277,7 +2277,7 @@
     }
 
     private void trySetResponseMessage(PreloadNetworkTopologyOperationOutputBuilder responseBuilder,
-        ErrorObject error) {
+        ResponseObject error) {
         if (!error.getMessage().isEmpty()) {
             responseBuilder.setResponseMessage(error.getMessage());
         }
diff --git a/generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/ErrorObject.java b/generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/ResponseObject.java
similarity index 86%
rename from generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/ErrorObject.java
rename to generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/ResponseObject.java
index 5fe72cb..a3ff2e2 100644
--- a/generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/ErrorObject.java
+++ b/generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/ResponseObject.java
@@ -1,13 +1,13 @@
 package org.onap.sdnc.northbound;
 
-public class ErrorObject {
+public class ResponseObject {
 
     private static final String EMPTY_STRING = "";
 
     private String statusCode;
     private String message;
 
-    public ErrorObject(String statusCode, String message) {
+    public ResponseObject(String statusCode, String message) {
         this.statusCode = statusCode == null ? EMPTY_STRING : statusCode;
         this.message = message == null ? EMPTY_STRING : message;
     }
diff --git a/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/GenericResourceApiProviderTest.java b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/GenericResourceApiProviderTest.java
index a656800..6bf6959 100644
--- a/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/GenericResourceApiProviderTest.java
+++ b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/GenericResourceApiProviderTest.java
@@ -22,6 +22,7 @@
 package org.onap.sdnc.northbound;
 
 import org.junit.Before;
+import org.junit.Test;
 import org.mockito.Mock;
 import org.onap.sdnc.northbound.util.DataBrokerUtil;
 import org.onap.sdnc.northbound.util.GenericResourceApiSvcLogicServiceClientMockUtil;
@@ -36,12 +37,13 @@
 
 public class GenericResourceApiProviderTest extends AbstractConcurrentDataBrokerTest {
 
+    protected static final Logger LOG = LoggerFactory.getLogger(GenericResourceApiProvider.class);
     protected GenericResourceApiProvider genericResourceApiProvider;
     protected DataBroker dataBroker;
     protected @Mock NotificationPublishService mockNotificationPublishService;
     protected @Mock RpcProviderRegistry mockRpcProviderRegistry;
     protected @Mock GenericResourceApiSvcLogicServiceClient mockGenericResourceApiSvcLogicServiceClient;
-    protected static final Logger LOG = LoggerFactory.getLogger(GenericResourceApiProvider.class);
+
 
 
     protected DataBrokerUtil db;
@@ -70,6 +72,4 @@
     public static PropBuilder prop(){
         return (new PropBuilder());
     }
-
-
 }
diff --git a/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/ServiceTopologyOperationRPCTest.java b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/ServiceTopologyOperationRPCTest.java
index 9a34c25..b4ce214 100644
--- a/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/ServiceTopologyOperationRPCTest.java
+++ b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/ServiceTopologyOperationRPCTest.java
@@ -21,24 +21,13 @@
 
 package org.onap.sdnc.northbound;
 
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.runners.MockitoJUnitRunner;
-import org.onap.sdnc.northbound.util.PropBuilder;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.ServiceTopologyOperationInput;
-import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.ServiceTopologyOperationOutput;
-import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.request.information.RequestInformation;
-import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.sdnc.request.header.SdncRequestHeader;
-import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.sdnc.request.header.SdncRequestHeader.SvcAction;
-import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.information.ServiceInformation;
-import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.model.infrastructure.Service;
-import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.status.ServiceStatus;
-import org.opendaylight.yangtools.yang.common.RpcResult;
-
 import static org.junit.Assert.assertEquals;
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+import static org.onap.sdnc.northbound.GenericResourceApiProvider.APP_NAME;
+import static org.onap.sdnc.northbound.GenericResourceApiProvider.NO_SERVICE_LOGIC_ACTIVE;
+import static org.onap.sdnc.northbound.GenericResourceApiProvider.NULL_OR_EMPTY_ERROR_PARAM;
 import static org.onap.sdnc.northbound.util.MDSALUtil.build;
 import static org.onap.sdnc.northbound.util.MDSALUtil.exec;
 import static org.onap.sdnc.northbound.util.MDSALUtil.requestInformation;
@@ -51,6 +40,30 @@
 import static org.onap.sdnc.northbound.util.MDSALUtil.serviceTopologyOperationInput;
 import static org.onap.sdnc.northbound.util.MDSALUtil.serviceTopologyOperationOutput;
 
+import javax.xml.crypto.Data;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mockito;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.onap.sdnc.northbound.util.PropBuilder;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.controller.md.sal.common.api.data.TransactionChainClosedException;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.ServiceTopologyOperationInput;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.ServiceTopologyOperationOutput;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.request.information.RequestInformation;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.sdnc.request.header.SdncRequestHeader;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.sdnc.request.header.SdncRequestHeader.SvcAction;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.information.ServiceInformation;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.model.infrastructure.Service;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.status.ServiceStatus;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+
 
 /**
  * This class test the ServiceTopologyOperation mdsal RPC.
@@ -70,13 +83,12 @@
 
 
     /**
-     * Verify  ServiceTopologyOperation RPC executes a DG then produces the expected
-     * {@link ServiceTopologyOperationOutput} and persisted the expected {@link Service} in the {@link DataBroker}
+     * Verify  ServiceTopologyOperation RPC executes a DG then produces the expected {@link
+     * ServiceTopologyOperationOutput} and persisted the expected {@link Service} in the {@link DataBroker}
      */
     @Test
     public void testServiceTopologyOperationRPC_ExecuteDG_Success() throws Exception {
 
-
         //mock svcClient to perform a successful execution with the expected parameters
         svcClient.mockHasGraph(true);
         PropBuilder svcResultProp = svcClient.createExecuteOKResult();
@@ -87,103 +99,192 @@
 
         //execute the mdsal exec
         ServiceTopologyOperationOutput actualServiceTopologyOperationOutput = exec(
-                genericResourceApiProvider::serviceTopologyOperation
-                , serviceTopologyOperationInput
-                , RpcResult::getResult
+            genericResourceApiProvider::serviceTopologyOperation
+            , serviceTopologyOperationInput
+            , RpcResult::getResult
         );
 
-
         //verify the returned ServiceTopologyOperationOutput
-        ServiceTopologyOperationOutput expectedServiceTopologyOperationOutput = createExpectedSTOO(svcResultProp,serviceTopologyOperationInput);
-        assertEquals(expectedServiceTopologyOperationOutput,actualServiceTopologyOperationOutput);
-
+        ServiceTopologyOperationOutput expectedServiceTopologyOperationOutput = createExpectedSTOO(svcResultProp,
+            serviceTopologyOperationInput);
+        assertEquals(expectedServiceTopologyOperationOutput, actualServiceTopologyOperationOutput);
 
         //verify the persisted Service
-        Service actualService = db.read(serviceTopologyOperationInput.getServiceInformation().getServiceInstanceId(), LogicalDatastoreType.CONFIGURATION);
+        Service actualService = db.read(serviceTopologyOperationInput.getServiceInformation().getServiceInstanceId(),
+            LogicalDatastoreType.CONFIGURATION);
         Service expectedService = createExpectedService(
-                expectedServiceTopologyOperationOutput,
-                serviceTopologyOperationInput,
-                actualService);
-        assertEquals(expectedService,actualService);
+            expectedServiceTopologyOperationOutput,
+            serviceTopologyOperationInput,
+            actualService);
+        assertEquals(expectedService, actualService);
 
         LOG.debug("done");
     }
 
+    @Test
+    public void serviceTopologyOperation_should_fail_when_service_info_not_present() throws Exception {
+        // create the ServiceTopologyOperationInput from the template
+        ServiceTopologyOperationInput input = build(
+            serviceTopologyOperationInput()
+                .setSdncRequestHeader(build(sdncRequestHeader()
+                .setSvcRequestId("svc-request-id: xyz")
+                .setSvcAction(SvcAction.Assign)
+            ))
+            .setRequestInformation(build(requestInformation()
+                .setRequestId("request-id: xyz")
+                .setRequestAction(RequestInformation.RequestAction.CreateServiceInstance)
+            )));
+
+        //execute the mdsal exec
+        ServiceTopologyOperationOutput output = exec(
+            genericResourceApiProvider::serviceTopologyOperation
+            , input
+            , RpcResult::getResult
+        );
+
+        assertEquals("404", output.getResponseCode());
+        assertEquals(NULL_OR_EMPTY_ERROR_PARAM, output.getResponseMessage());
+        assertEquals("Y", output.getAckFinalIndicator());
+    }
 
 
-    private ServiceTopologyOperationInput createSTOI()
-    {
+    @Test
+    public void serviceTopologyOperation_should_fail_when_client_execution_failed() throws Exception {
+        svcClient.mockHasGraph(true);
+        svcClient.mockExecute(new RuntimeException("test exception"));
+
+        ServiceTopologyOperationInput input = createSTOI();
+
+        //execute the mdsal exec
+        ServiceTopologyOperationOutput output = exec(
+            genericResourceApiProvider::serviceTopologyOperation
+            , input
+            , RpcResult::getResult
+        );
+
+        assertEquals("500", output.getResponseCode());
+        assertEquals("test exception", output.getResponseMessage());
+        assertEquals("Y", output.getAckFinalIndicator());
+    }
+
+    @Test
+    public void serviceTopologyOperation_should_fail_when_client_has_no_graph() throws Exception {
+        svcClient.mockHasGraph(false);
+
+        ServiceTopologyOperationInput input = createSTOI();
+
+        //execute the mdsal exec
+        ServiceTopologyOperationOutput output = exec(
+            genericResourceApiProvider::serviceTopologyOperation
+            , input
+            , RpcResult::getResult
+        );
+
+        assertEquals("503", output.getResponseCode());
+        assertEquals(NO_SERVICE_LOGIC_ACTIVE + APP_NAME + ": '" + SVC_OPERATION + "'", output.getResponseMessage());
+        assertEquals("Y", output.getAckFinalIndicator());
+    }
+
+
+    @Test
+    public void serviceTopologyOperation_should_fail_when_failed_to_update_mdsal() throws Exception {
+
+        svcClient.mockHasGraph(true);
+        WriteTransaction mockWriteTransaction = mock(WriteTransaction.class);
+        when(mockWriteTransaction.submit()).thenThrow(new TransactionChainClosedException("test exception"));
+
+        DataBroker spyDataBroker = Mockito.spy(dataBroker);
+        when(spyDataBroker.newWriteOnlyTransaction()).thenReturn(mockWriteTransaction);
+        genericResourceApiProvider.setDataBroker(spyDataBroker);
+
+        ServiceTopologyOperationInput input = createSTOI();
+
+        //execute the mdsal exec
+        ServiceTopologyOperationOutput output = exec(
+            genericResourceApiProvider::serviceTopologyOperation
+            , input
+            , RpcResult::getResult
+        );
+
+        assertEquals("500", output.getResponseCode());
+        assertEquals("test exception", output.getResponseMessage());
+        assertEquals("Y", output.getAckFinalIndicator());
+    }
+
+
+
+    private ServiceTopologyOperationInput createSTOI() {
 
         return build(
-                serviceTopologyOperationInput()
-                        .setSdncRequestHeader(build(sdncRequestHeader()
-                                .setSvcRequestId("svc-request-id: xyz")
-                                .setSvcAction(SvcAction.Assign)
-                        ))
-                        .setRequestInformation(build(requestInformation()
-                                .setRequestId("request-id: xyz")
-                                .setRequestAction(RequestInformation.RequestAction.CreateServiceInstance)
-                        ))
-                        .setServiceInformation(build(serviceInformationBuilder()
-                                .setServiceInstanceId("service-instance-id: xyz")
-                        ))
+            serviceTopologyOperationInput()
+                .setSdncRequestHeader(build(sdncRequestHeader()
+                    .setSvcRequestId("svc-request-id: xyz")
+                    .setSvcAction(SvcAction.Assign)
+                ))
+                .setRequestInformation(build(requestInformation()
+                    .setRequestId("request-id: xyz")
+                    .setRequestAction(RequestInformation.RequestAction.CreateServiceInstance)
+                ))
+                .setServiceInformation(build(serviceInformationBuilder()
+                    .setServiceInstanceId("service-instance-id: xyz")
+                ))
         );
     }
 
 
-    private ServiceTopologyOperationOutput createExpectedSTOO(PropBuilder expectedSvcResultProp,ServiceTopologyOperationInput expectedServiceTopologyOperationInput){
+    private ServiceTopologyOperationOutput createExpectedSTOO(PropBuilder expectedSvcResultProp,
+        ServiceTopologyOperationInput expectedServiceTopologyOperationInput) {
         return build(
-                serviceTopologyOperationOutput()
-                        .setSvcRequestId(expectedServiceTopologyOperationInput.getSdncRequestHeader().getSvcRequestId())
-                        .setResponseCode(expectedSvcResultProp.get(svcClient.errorCode))
-                        .setAckFinalIndicator(expectedSvcResultProp.get(svcClient.ackFinal))
-                        .setResponseMessage(expectedSvcResultProp.get(svcClient.errorMessage))
-                        .setServiceResponseInformation(build(serviceResponseInformation()
-                                .setInstanceId(expectedServiceTopologyOperationInput.getServiceInformation().getServiceInstanceId())
-                                .setObjectPath(expectedSvcResultProp.get(svcClient.serviceObjectPath))
-                        ))
+            serviceTopologyOperationOutput()
+                .setSvcRequestId(expectedServiceTopologyOperationInput.getSdncRequestHeader().getSvcRequestId())
+                .setResponseCode(expectedSvcResultProp.get(svcClient.errorCode))
+                .setAckFinalIndicator(expectedSvcResultProp.get(svcClient.ackFinal))
+                .setResponseMessage(expectedSvcResultProp.get(svcClient.errorMessage))
+                .setServiceResponseInformation(build(serviceResponseInformation()
+                    .setInstanceId(expectedServiceTopologyOperationInput.getServiceInformation().getServiceInstanceId())
+                    .setObjectPath(expectedSvcResultProp.get(svcClient.serviceObjectPath))
+                ))
         );
     }
 
     private Service createExpectedService(
-            ServiceTopologyOperationOutput expectedServiceTopologyOperationOutput,
-            ServiceTopologyOperationInput expectedServiceTopologyOperationInput,
-            Service actualService
-    ){
-
+        ServiceTopologyOperationOutput expectedServiceTopologyOperationOutput,
+        ServiceTopologyOperationInput expectedServiceTopologyOperationInput,
+        Service actualService
+    ) {
 
         //We cannot predict the timeStamp value so just steal it from the actual
         //we need this to prevent the equals method from returning false as a result of the timestamp
-        String responseTimeStamp = actualService == null || actualService.getServiceStatus() == null?
-                null : actualService.getServiceStatus().getResponseTimestamp();
+        String responseTimeStamp = actualService == null || actualService.getServiceStatus() == null ?
+            null : actualService.getServiceStatus().getResponseTimestamp();
 
         SdncRequestHeader expectedSdncRequestHeader = expectedServiceTopologyOperationInput.getSdncRequestHeader();
         ServiceInformation expectedServiceInformation = expectedServiceTopologyOperationInput.getServiceInformation();
         RequestInformation expectedRequestInformation = expectedServiceTopologyOperationInput.getRequestInformation();
 
         return build(
-               service()
+            service()
                 .setServiceInstanceId(expectedServiceInformation.getServiceInstanceId())
                 .setServiceData(build(serviceData()))
                 .setServiceStatus(
-                        build(
-                             serviceStatus()
-                                .setAction(expectedRequestInformation.getRequestAction().name())
-                                .setFinalIndicator(expectedServiceTopologyOperationOutput.getAckFinalIndicator())
-                                .setResponseCode(expectedServiceTopologyOperationOutput.getResponseCode())
-                                .setResponseMessage(expectedServiceTopologyOperationOutput.getResponseMessage())
-                                .setRpcAction(toRpcAction(expectedSdncRequestHeader.getSvcAction()))
-                                .setRpcName(SVC_OPERATION)
-                                .setRequestStatus(ServiceStatus.RequestStatus.Synccomplete)
-                                .setResponseTimestamp(responseTimeStamp)
-                        )
+                    build(
+                        serviceStatus()
+                            .setAction(expectedRequestInformation.getRequestAction().name())
+                            .setFinalIndicator(expectedServiceTopologyOperationOutput.getAckFinalIndicator())
+                            .setResponseCode(expectedServiceTopologyOperationOutput.getResponseCode())
+                            .setResponseMessage(expectedServiceTopologyOperationOutput.getResponseMessage())
+                            .setRpcAction(toRpcAction(expectedSdncRequestHeader.getSvcAction()))
+                            .setRpcName(SVC_OPERATION)
+                            .setRequestStatus(ServiceStatus.RequestStatus.Synccomplete)
+                            .setResponseTimestamp(responseTimeStamp)
+                    )
                 )
         );
 
     }
 
-    public ServiceStatus.RpcAction toRpcAction(SvcAction fromEnum){
-        return fromEnum == null? null : ServiceStatus.RpcAction.valueOf(fromEnum.name());
+    public ServiceStatus.RpcAction toRpcAction(SvcAction fromEnum) {
+        return fromEnum == null ? null : ServiceStatus.RpcAction.valueOf(fromEnum.name());
     }
 
 
diff --git a/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/util/GenericResourceApiSvcLogicServiceClientMockUtil.java b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/util/GenericResourceApiSvcLogicServiceClientMockUtil.java
index 2e73cce..650147f 100644
--- a/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/util/GenericResourceApiSvcLogicServiceClientMockUtil.java
+++ b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/util/GenericResourceApiSvcLogicServiceClientMockUtil.java
@@ -21,17 +21,16 @@
 
 package org.onap.sdnc.northbound.util;
 
-import org.onap.sdnc.northbound.GenericResourceApiSvcLogicServiceClient;
-import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.data.ServiceDataBuilder;
-
-import java.util.Properties;
-
 import static org.mockito.Mockito.eq;
 import static org.mockito.Mockito.isA;
 import static org.mockito.Mockito.when;
 import static org.onap.sdnc.northbound.util.MDSALUtil.build;
 import static org.onap.sdnc.northbound.util.PropBuilder.propBuilder;
 
+import java.util.Properties;
+import org.onap.sdnc.northbound.GenericResourceApiSvcLogicServiceClient;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.data.ServiceDataBuilder;
+
 
 /**
  * GenericResourceApiSvcLogicServiceClientMockUtil provides a set of util methods for quickly configuring method
@@ -75,15 +74,13 @@
      */
     public void mockHasGraph(Boolean isHasGraph) throws Exception {
         when(
-                mockGenericResourceApiSvcLogicServiceClient
-                        .hasGraph(
-                                eq(MODULE),
-                                eq(scvOperation),
-                                eq(VERSION),
-                                eq(MODE)
-                        )
-        )
-                .thenReturn(isHasGraph);
+            mockGenericResourceApiSvcLogicServiceClient
+                .hasGraph(
+                    eq(MODULE),
+                    eq(scvOperation),
+                    eq(VERSION),
+                    eq(MODE))
+        ).thenReturn(isHasGraph);
     }
 
 
@@ -112,19 +109,29 @@
      */
     public void mockExecute(PropBuilder svcResultProp) throws Exception{
         when(
-                mockGenericResourceApiSvcLogicServiceClient
-                        .execute(
-                                eq(MODULE),
-                                eq(scvOperation),
-                                eq(VERSION),
-                                eq(MODE),
-                                isA(ServiceDataBuilder.class),
-                                isA(Properties.class)
-                        )
-        )
-                .thenReturn(build(
-                        svcResultProp
-                ));
+            mockGenericResourceApiSvcLogicServiceClient
+                .execute(
+                    eq(MODULE),
+                    eq(scvOperation),
+                    eq(VERSION),
+                    eq(MODE),
+                    isA(ServiceDataBuilder.class),
+                    isA(Properties.class))
+        ).thenReturn(build(svcResultProp));
+    }
+
+    public void mockExecute(RuntimeException exception) throws Exception{
+        when(
+            mockGenericResourceApiSvcLogicServiceClient
+                .execute(
+                    eq(MODULE),
+                    eq(scvOperation),
+                    eq(VERSION),
+                    eq(MODE),
+                    isA(ServiceDataBuilder.class),
+                    isA(Properties.class)
+                )
+        ).thenThrow(exception);
     }
 
 }
