VOL-1774 Etcd Crash Handling

Change-Id: I1eeb726654c3972fd0a4fafae134607e5a810415
diff --git a/db/model/proxy_test.go b/db/model/proxy_test.go
index 785c65b..0ed8af9 100644
--- a/db/model/proxy_test.go
+++ b/db/model/proxy_test.go
@@ -21,9 +21,11 @@
 	"encoding/json"
 	"github.com/golang/protobuf/proto"
 	"github.com/google/uuid"
+	"github.com/opencord/voltha-lib-go/v2/pkg/log"
 	"github.com/opencord/voltha-protos/v2/go/common"
 	"github.com/opencord/voltha-protos/v2/go/openflow_13"
 	"github.com/opencord/voltha-protos/v2/go/voltha"
+	"github.com/stretchr/testify/assert"
 	"math/rand"
 	"reflect"
 	"strconv"
@@ -53,10 +55,17 @@
 func init() {
 	//log.AddPackage(log.JSON, log.InfoLevel, log.Fields{"instanceId": "DB_MODEL"})
 	//log.UpdateAllLoggers(log.Fields{"instanceId": "PROXY_LOAD_TEST"})
+	var err error
 	TestProxy_Root = NewRoot(&voltha.Voltha{}, nil)
-	TestProxy_Root_LogicalDevice = TestProxy_Root.CreateProxy(context.Background(), "/", false)
-	TestProxy_Root_Device = TestProxy_Root.CreateProxy(context.Background(), "/", false)
-	TestProxy_Root_Adapter = TestProxy_Root.CreateProxy(context.Background(), "/", false)
+	if TestProxy_Root_LogicalDevice, err = TestProxy_Root.CreateProxy(context.Background(), "/", false); err != nil {
+		log.With(log.Fields{"error": err}).Fatal("Cannot create logical device proxy")
+	}
+	if TestProxy_Root_Device, err = TestProxy_Root.CreateProxy(context.Background(), "/", false); err != nil {
+		log.With(log.Fields{"error": err}).Fatal("Cannot create device proxy")
+	}
+	if TestProxy_Root_Adapter, err = TestProxy_Root.CreateProxy(context.Background(), "/", false); err != nil {
+		log.With(log.Fields{"error": err}).Fatal("Cannot create adapter proxy")
+	}
 
 	TestProxy_LogicalPorts = []*voltha.LogicalPort{
 		{
@@ -116,7 +125,10 @@
 	postAddExecuted := make(chan struct{})
 	preAddExecutedPtr, postAddExecutedPtr := preAddExecuted, postAddExecuted
 
-	devicesProxy := TestProxy_Root.node.CreateProxy(context.Background(), "/devices", false)
+	devicesProxy, err := TestProxy_Root.node.CreateProxy(context.Background(), "/devices", false)
+	if err != nil {
+		log.With(log.Fields{"error": err}).Fatal("Cannot create devices proxy")
+	}
 	devicesProxy.RegisterCallback(PRE_ADD, commonCallback2, "PRE_ADD Device container changes")
 	devicesProxy.RegisterCallback(POST_ADD, commonCallback2, "POST_ADD Device container changes")
 
@@ -124,7 +136,12 @@
 	TestProxy_Root_Device.RegisterCallback(PRE_ADD, commonChanCallback, "PRE_ADD instructions", &preAddExecutedPtr)
 	TestProxy_Root_Device.RegisterCallback(POST_ADD, commonChanCallback, "POST_ADD instructions", &postAddExecutedPtr)
 
-	if added := TestProxy_Root_Device.Add(context.Background(), "/devices", TestProxy_Device, ""); added == nil {
+	added, err := TestProxy_Root_Device.Add(context.Background(), "/devices", TestProxy_Device, "")
+	if err != nil {
+		BenchmarkProxy_Logger.Errorf("Failed to add test proxy device due to error: %v", err)
+		assert.NotNil(t, err)
+	}
+	if added == nil {
 		t.Error("Failed to add device")
 	} else {
 		t.Logf("Added device : %+v", added)
@@ -138,7 +155,12 @@
 	}
 
 	// Verify that the added device can now be retrieved
-	if d := TestProxy_Root_Device.Get(context.Background(), "/devices/"+TestProxy_DeviceId, 0, false, ""); !reflect.ValueOf(d).IsValid() {
+	d, err := TestProxy_Root_Device.Get(context.Background(), "/devices/"+TestProxy_DeviceId, 0, false, "")
+	if err != nil {
+		BenchmarkProxy_Logger.Errorf("Failed get device info from test proxy due to error: %v", err)
+		assert.NotNil(t, err)
+	}
+	if !reflect.ValueOf(d).IsValid() {
 		t.Error("Failed to find added device")
 	} else {
 		djson, _ := json.Marshal(d)
@@ -149,7 +171,11 @@
 func TestProxy_1_1_2_Add_ExistingDevice(t *testing.T) {
 	TestProxy_Device.Id = TestProxy_DeviceId
 
-	added := TestProxy_Root_Device.Add(context.Background(), "/devices", TestProxy_Device, "")
+	added, err := TestProxy_Root_Device.Add(context.Background(), "/devices", TestProxy_Device, "")
+	if err != nil {
+		BenchmarkProxy_Logger.Errorf("Failed to add device to test proxy due to error: %v", err)
+		assert.NotNil(t, err)
+	}
 	if added.(proto.Message).String() != reflect.ValueOf(TestProxy_Device).Interface().(proto.Message).String() {
 		t.Errorf("Devices don't match - existing: %+v returned: %+v", TestProxy_LogicalDevice, added)
 	}
@@ -181,7 +207,12 @@
 	TestProxy_Root_Adapter.RegisterCallback(POST_ADD, commonChanCallback, "POST_ADD instructions for adapters", &postAddExecutedPtr)
 
 	// Add the adapter
-	if added := TestProxy_Root_Adapter.Add(context.Background(), "/adapters", TestProxy_Adapter, ""); added == nil {
+	added, err := TestProxy_Root_Adapter.Add(context.Background(), "/adapters", TestProxy_Adapter, "")
+	if err != nil {
+		BenchmarkProxy_Logger.Errorf("Failed to add adapter to test proxy due to error: %v", err)
+		assert.NotNil(t, err)
+	}
+	if added == nil {
 		t.Error("Failed to add adapter")
 	} else {
 		t.Logf("Added adapter : %+v", added)
@@ -190,7 +221,12 @@
 	verifyGotResponse(postAddExecuted)
 
 	// Verify that the added device can now be retrieved
-	if d := TestProxy_Root_Adapter.Get(context.Background(), "/adapters/"+TestProxy_AdapterId, 0, false, ""); !reflect.ValueOf(d).IsValid() {
+	d, err := TestProxy_Root_Adapter.Get(context.Background(), "/adapters/"+TestProxy_AdapterId, 0, false, "")
+	if err != nil {
+		BenchmarkProxy_Logger.Errorf("Failed to retrieve device info from test proxy due to error: %v", err)
+		assert.NotNil(t, err)
+	}
+	if !reflect.ValueOf(d).IsValid() {
 		t.Error("Failed to find added adapter")
 	} else {
 		djson, _ := json.Marshal(d)
@@ -206,8 +242,11 @@
 }
 
 func TestProxy_1_2_1_Get_AllDevices(t *testing.T) {
-	devices := TestProxy_Root_Device.Get(context.Background(), "/devices", 1, false, "")
-
+	devices, err := TestProxy_Root_Device.Get(context.Background(), "/devices", 1, false, "")
+	if err != nil {
+		BenchmarkProxy_Logger.Errorf("Failed to get all devices info from test proxy due to error: %v", err)
+		assert.NotNil(t, err)
+	}
 	if len(devices.([]interface{})) == 0 {
 		t.Error("there are no available devices to retrieve")
 	} else {
@@ -218,7 +257,12 @@
 }
 
 func TestProxy_1_2_2_Get_SingleDevice(t *testing.T) {
-	if d := TestProxy_Root_Device.Get(context.Background(), "/devices/"+TestProxy_TargetDeviceId, 0, false, ""); !reflect.ValueOf(d).IsValid() {
+	d, err := TestProxy_Root_Device.Get(context.Background(), "/devices/"+TestProxy_TargetDeviceId, 0, false, "")
+	if err != nil {
+		BenchmarkProxy_Logger.Errorf("Failed to get single device info from test proxy due to error: %v", err)
+		assert.NotNil(t, err)
+	}
+	if !reflect.ValueOf(d).IsValid() {
 		t.Errorf("Failed to find device : %s", TestProxy_TargetDeviceId)
 	} else {
 		djson, _ := json.Marshal(d)
@@ -233,7 +277,12 @@
 	postUpdateExecuted := make(chan struct{})
 	preUpdateExecutedPtr, postUpdateExecutedPtr := preUpdateExecuted, postUpdateExecuted
 
-	if retrieved := TestProxy_Root_Device.Get(context.Background(), "/devices/"+TestProxy_TargetDeviceId, 1, false, ""); retrieved == nil {
+	retrieved, err := TestProxy_Root_Device.Get(context.Background(), "/devices/"+TestProxy_TargetDeviceId, 1, false, "")
+	if err != nil {
+		BenchmarkProxy_Logger.Errorf("Failed to get device info from test proxy due to error: %v", err)
+		assert.NotNil(t, err)
+	}
+	if retrieved == nil {
 		t.Error("Failed to get device")
 	} else {
 		t.Logf("Found raw device (root proxy): %+v", retrieved)
@@ -258,7 +307,12 @@
 			"POST_UPDATE instructions (root proxy)", &postUpdateExecutedPtr,
 		)
 
-		if afterUpdate := TestProxy_Root_Device.Update(context.Background(), "/devices/"+TestProxy_TargetDeviceId, retrieved, false, ""); afterUpdate == nil {
+		afterUpdate, err := TestProxy_Root_Device.Update(context.Background(), "/devices/"+TestProxy_TargetDeviceId, retrieved, false, "")
+		if err != nil {
+			BenchmarkProxy_Logger.Errorf("Failed to update device info test proxy due to error: %v", err)
+			assert.NotNil(t, err)
+		}
+		if afterUpdate == nil {
 			t.Error("Failed to update device")
 		} else {
 			t.Logf("Updated device : %+v", afterUpdate)
@@ -271,7 +325,12 @@
 			t.Error("POST_UPDATE callback was not executed")
 		}
 
-		if d := TestProxy_Root_Device.Get(context.Background(), "/devices/"+TestProxy_TargetDeviceId, 1, false, ""); !reflect.ValueOf(d).IsValid() {
+		d, err := TestProxy_Root_Device.Get(context.Background(), "/devices/"+TestProxy_TargetDeviceId, 1, false, "")
+		if err != nil {
+			BenchmarkProxy_Logger.Errorf("Failed to get device info from test proxy due to error: %v", err)
+			assert.NotNil(t, err)
+		}
+		if !reflect.ValueOf(d).IsValid() {
 			t.Error("Failed to find updated device (root proxy)")
 		} else {
 			djson, _ := json.Marshal(d)
@@ -282,8 +341,15 @@
 
 func TestProxy_1_3_2_Update_DeviceFlows(t *testing.T) {
 	// Get a device proxy and update a specific port
-	devFlowsProxy := TestProxy_Root.node.CreateProxy(context.Background(), "/devices/"+TestProxy_DeviceId+"/flows", false)
-	flows := devFlowsProxy.Get(context.Background(), "/", 0, false, "")
+	devFlowsProxy, err := TestProxy_Root.node.CreateProxy(context.Background(), "/devices/"+TestProxy_DeviceId+"/flows", false)
+	if err != nil {
+		log.With(log.Fields{"error": err}).Fatal("Cannot create device flows proxy")
+	}
+	flows, err := devFlowsProxy.Get(context.Background(), "/", 0, false, "")
+	if err != nil {
+		BenchmarkProxy_Logger.Errorf("Failed to get flows from device flows proxy due to error: %v", err)
+		assert.NotNil(t, err)
+	}
 	flows.(*openflow_13.Flows).Items[0].TableId = 2244
 
 	preUpdateExecuted := make(chan struct{})
@@ -301,13 +367,22 @@
 		"POST_UPDATE instructions (flows proxy)", &postUpdateExecutedPtr,
 	)
 
-	kvFlows := devFlowsProxy.Get(context.Background(), "/", 0, false, "")
+	kvFlows, err := devFlowsProxy.Get(context.Background(), "/", 0, false, "")
+	if err != nil {
+		BenchmarkProxy_Logger.Errorf("Failed to get flows from device flows proxy due to error: %v", err)
+		assert.NotNil(t, err)
+	}
 
 	if reflect.DeepEqual(flows, kvFlows) {
 		t.Errorf("Local changes have changed the KV store contents -  local:%+v, kv: %+v", flows, kvFlows)
 	}
 
-	if updated := devFlowsProxy.Update(context.Background(), "/", flows.(*openflow_13.Flows), false, ""); updated == nil {
+	updated, err := devFlowsProxy.Update(context.Background(), "/", flows.(*openflow_13.Flows), false, "")
+	if err != nil {
+		BenchmarkProxy_Logger.Errorf("Failed to update flows in device flows proxy due to error: %v", err)
+		assert.NotNil(t, err)
+	}
+	if updated == nil {
 		t.Error("Failed to update flow")
 	} else {
 		t.Logf("Updated flows : %+v", updated)
@@ -320,14 +395,24 @@
 		t.Error("POST_UPDATE callback was not executed")
 	}
 
-	if d := devFlowsProxy.Get(context.Background(), "/", 0, false, ""); d == nil {
+	d, err := devFlowsProxy.Get(context.Background(), "/", 0, false, "")
+	if err != nil {
+		BenchmarkProxy_Logger.Errorf("Failed to get flows in device flows proxy due to error: %v", err)
+		assert.NotNil(t, err)
+	}
+	if d == nil {
 		t.Error("Failed to find updated flows (flows proxy)")
 	} else {
 		djson, _ := json.Marshal(d)
 		t.Logf("Found flows (flows proxy): %s", string(djson))
 	}
 
-	if d := TestProxy_Root_Device.Get(context.Background(), "/devices/"+TestProxy_DeviceId+"/flows", 1, false, ""); !reflect.ValueOf(d).IsValid() {
+	d, err = TestProxy_Root_Device.Get(context.Background(), "/devices/"+TestProxy_DeviceId+"/flows", 1, false, "")
+	if err != nil {
+		BenchmarkProxy_Logger.Errorf("Failed to get flows from device flows proxy due to error: %v", err)
+		assert.NotNil(t, err)
+	}
+	if !reflect.ValueOf(d).IsValid() {
 		t.Error("Failed to find updated flows (root proxy)")
 	} else {
 		djson, _ := json.Marshal(d)
@@ -340,9 +425,16 @@
 	postUpdateExecuted := make(chan struct{})
 	preUpdateExecutedPtr, postUpdateExecutedPtr := preUpdateExecuted, postUpdateExecuted
 
-	adaptersProxy := TestProxy_Root.node.CreateProxy(context.Background(), "/adapters", false)
-
-	if retrieved := TestProxy_Root_Adapter.Get(context.Background(), "/adapters/"+TestProxy_AdapterId, 1, false, ""); retrieved == nil {
+	adaptersProxy, err := TestProxy_Root.node.CreateProxy(context.Background(), "/adapters", false)
+	if err != nil {
+		log.With(log.Fields{"error": err}).Fatal("Cannot create adapters proxy")
+	}
+	retrieved, err := TestProxy_Root_Adapter.Get(context.Background(), "/adapters/"+TestProxy_AdapterId, 1, false, "")
+	if err != nil {
+		BenchmarkProxy_Logger.Errorf("Failed to retrieve adapter info from adapters proxy due to error: %v", err)
+		assert.NotNil(t, err)
+	}
+	if retrieved == nil {
 		t.Error("Failed to get adapter")
 	} else {
 		t.Logf("Found raw adapter (root proxy): %+v", retrieved)
@@ -360,7 +452,12 @@
 			"POST_UPDATE instructions for adapters", &postUpdateExecutedPtr,
 		)
 
-		if afterUpdate := adaptersProxy.Update(context.Background(), "/"+TestProxy_AdapterId, retrieved, false, ""); afterUpdate == nil {
+		afterUpdate, err := adaptersProxy.Update(context.Background(), "/"+TestProxy_AdapterId, retrieved, false, "")
+		if err != nil {
+			BenchmarkProxy_Logger.Errorf("Failed to update adapter info in adapters proxy due to error: %v", err)
+			assert.NotNil(t, err)
+		}
+		if afterUpdate == nil {
 			t.Error("Failed to update adapter")
 		} else {
 			t.Logf("Updated adapter : %+v", afterUpdate)
@@ -373,7 +470,12 @@
 			t.Error("POST_UPDATE callback for adapter was not executed")
 		}
 
-		if d := TestProxy_Root_Adapter.Get(context.Background(), "/adapters/"+TestProxy_AdapterId, 1, false, ""); !reflect.ValueOf(d).IsValid() {
+		d, err := TestProxy_Root_Adapter.Get(context.Background(), "/adapters/"+TestProxy_AdapterId, 1, false, "")
+		if err != nil {
+			BenchmarkProxy_Logger.Errorf("Failed to get updated adapter info from adapters proxy due to error: %v", err)
+			assert.NotNil(t, err)
+		}
+		if !reflect.ValueOf(d).IsValid() {
 			t.Error("Failed to find updated adapter (root proxy)")
 		} else {
 			djson, _ := json.Marshal(d)
@@ -398,7 +500,12 @@
 		"POST_REMOVE instructions (root proxy)", &postRemoveExecutedPtr,
 	)
 
-	if removed := TestProxy_Root_Device.Remove(context.Background(), "/devices/"+TestProxy_DeviceId, ""); removed == nil {
+	removed, err := TestProxy_Root_Device.Remove(context.Background(), "/devices/"+TestProxy_DeviceId, "")
+	if err != nil {
+		BenchmarkProxy_Logger.Errorf("Failed to remove device from devices proxy due to error: %v", err)
+		assert.NotNil(t, err)
+	}
+	if removed == nil {
 		t.Error("Failed to remove device")
 	} else {
 		t.Logf("Removed device : %+v", removed)
@@ -411,7 +518,12 @@
 		t.Error("POST_REMOVE callback was not executed")
 	}
 
-	if d := TestProxy_Root_Device.Get(context.Background(), "/devices/"+TestProxy_DeviceId, 0, false, ""); reflect.ValueOf(d).IsValid() {
+	d, err := TestProxy_Root_Device.Get(context.Background(), "/devices/"+TestProxy_DeviceId, 0, false, "")
+	if err != nil {
+		BenchmarkProxy_Logger.Errorf("Failed to get device info from devices proxy due to error: %v", err)
+		assert.NotNil(t, err)
+	}
+	if reflect.ValueOf(d).IsValid() {
 		djson, _ := json.Marshal(d)
 		t.Errorf("Device was not removed - %s", djson)
 	} else {
@@ -433,7 +545,12 @@
 	TestProxy_Root_LogicalDevice.RegisterCallback(PRE_ADD, commonChanCallback, "PRE_ADD instructions", &preAddExecutedPtr)
 	TestProxy_Root_LogicalDevice.RegisterCallback(POST_ADD, commonChanCallback, "POST_ADD instructions", &postAddExecutedPtr)
 
-	if added := TestProxy_Root_LogicalDevice.Add(context.Background(), "/logical_devices", TestProxy_LogicalDevice, ""); added == nil {
+	added, err := TestProxy_Root_LogicalDevice.Add(context.Background(), "/logical_devices", TestProxy_LogicalDevice, "")
+	if err != nil {
+		BenchmarkProxy_Logger.Errorf("Failed to add new logical device into proxy due to error: %v", err)
+		assert.NotNil(t, err)
+	}
+	if added == nil {
 		t.Error("Failed to add logical device")
 	} else {
 		t.Logf("Added logical device : %+v", added)
@@ -441,7 +558,12 @@
 
 	verifyGotResponse(postAddExecuted)
 
-	if ld := TestProxy_Root_LogicalDevice.Get(context.Background(), "/logical_devices/"+TestProxy_LogicalDeviceId, 0, false, ""); !reflect.ValueOf(ld).IsValid() {
+	ld, err := TestProxy_Root_LogicalDevice.Get(context.Background(), "/logical_devices/"+TestProxy_LogicalDeviceId, 0, false, "")
+	if err != nil {
+		BenchmarkProxy_Logger.Errorf("Failed to get logical device info from logical device proxy due to error: %v", err)
+		assert.NotNil(t, err)
+	}
+	if !reflect.ValueOf(ld).IsValid() {
 		t.Error("Failed to find added logical device")
 	} else {
 		ldJSON, _ := json.Marshal(ld)
@@ -459,15 +581,22 @@
 func TestProxy_2_1_2_Add_ExistingLogicalDevice(t *testing.T) {
 	TestProxy_LogicalDevice.Id = TestProxy_LogicalDeviceId
 
-	added := TestProxy_Root_LogicalDevice.Add(context.Background(), "/logical_devices", TestProxy_LogicalDevice, "")
+	added, err := TestProxy_Root_LogicalDevice.Add(context.Background(), "/logical_devices", TestProxy_LogicalDevice, "")
+	if err != nil {
+		BenchmarkProxy_Logger.Errorf("Failed to add logical device due to error: %v", err)
+		assert.NotNil(t, err)
+	}
 	if added.(proto.Message).String() != reflect.ValueOf(TestProxy_LogicalDevice).Interface().(proto.Message).String() {
 		t.Errorf("Logical devices don't match - existing: %+v returned: %+v", TestProxy_LogicalDevice, added)
 	}
 }
 
 func TestProxy_2_2_1_Get_AllLogicalDevices(t *testing.T) {
-	logicalDevices := TestProxy_Root_LogicalDevice.Get(context.Background(), "/logical_devices", 1, false, "")
-
+	logicalDevices, err := TestProxy_Root_LogicalDevice.Get(context.Background(), "/logical_devices", 1, false, "")
+	if err != nil {
+		BenchmarkProxy_Logger.Errorf("Failed to get all logical devices from proxy due to error: %v", err)
+		assert.NotNil(t, err)
+	}
 	if len(logicalDevices.([]interface{})) == 0 {
 		t.Error("there are no available logical devices to retrieve")
 	} else {
@@ -478,7 +607,12 @@
 }
 
 func TestProxy_2_2_2_Get_SingleLogicalDevice(t *testing.T) {
-	if ld := TestProxy_Root_LogicalDevice.Get(context.Background(), "/logical_devices/"+TestProxy_TargetLogicalDeviceId, 0, false, ""); !reflect.ValueOf(ld).IsValid() {
+	ld, err := TestProxy_Root_LogicalDevice.Get(context.Background(), "/logical_devices/"+TestProxy_TargetLogicalDeviceId, 0, false, "")
+	if err != nil {
+		BenchmarkProxy_Logger.Errorf("Failed to get single logical device from proxy due to error: %v", err)
+		assert.NotNil(t, err)
+	}
+	if !reflect.ValueOf(ld).IsValid() {
 		t.Errorf("Failed to find logical device : %s", TestProxy_TargetLogicalDeviceId)
 	} else {
 		ldJSON, _ := json.Marshal(ld)
@@ -493,7 +627,12 @@
 	postUpdateExecuted := make(chan struct{})
 	preUpdateExecutedPtr, postUpdateExecutedPtr := preUpdateExecuted, postUpdateExecuted
 
-	if retrieved := TestProxy_Root_LogicalDevice.Get(context.Background(), "/logical_devices/"+TestProxy_TargetLogicalDeviceId, 1, false, ""); retrieved == nil {
+	retrieved, err := TestProxy_Root_LogicalDevice.Get(context.Background(), "/logical_devices/"+TestProxy_TargetLogicalDeviceId, 1, false, "")
+	if err != nil {
+		BenchmarkProxy_Logger.Errorf("Failed to get logical devices due to error: %v", err)
+		assert.NotNil(t, err)
+	}
+	if retrieved == nil {
 		t.Error("Failed to get logical device")
 	} else {
 		t.Logf("Found raw logical device (root proxy): %+v", retrieved)
@@ -518,8 +657,13 @@
 
 		retrieved.(*voltha.LogicalDevice).RootDeviceId = strconv.Itoa(fwVersion)
 
-		if afterUpdate := TestProxy_Root_LogicalDevice.Update(context.Background(), "/logical_devices/"+TestProxy_TargetLogicalDeviceId, retrieved, false,
-			""); afterUpdate == nil {
+		afterUpdate, err := TestProxy_Root_LogicalDevice.Update(context.Background(), "/logical_devices/"+TestProxy_TargetLogicalDeviceId, retrieved, false,
+			"")
+		if err != nil {
+			BenchmarkProxy_Logger.Errorf("Faield to update logical device info due to error: %v", err)
+			assert.NotNil(t, err)
+		}
+		if afterUpdate == nil {
 			t.Error("Failed to update logical device")
 		} else {
 			t.Logf("Updated logical device : %+v", afterUpdate)
@@ -532,7 +676,12 @@
 			t.Error("POST_UPDATE callback was not executed")
 		}
 
-		if d := TestProxy_Root_LogicalDevice.Get(context.Background(), "/logical_devices/"+TestProxy_TargetLogicalDeviceId, 1, false, ""); !reflect.ValueOf(d).IsValid() {
+		d, err := TestProxy_Root_LogicalDevice.Get(context.Background(), "/logical_devices/"+TestProxy_TargetLogicalDeviceId, 1, false, "")
+		if err != nil {
+			BenchmarkProxy_Logger.Errorf("Failed to get logical device info due to error: %v", err)
+			assert.NotNil(t, err)
+		}
+		if !reflect.ValueOf(d).IsValid() {
 			t.Error("Failed to find updated logical device (root proxy)")
 		} else {
 			djson, _ := json.Marshal(d)
@@ -544,8 +693,15 @@
 
 func TestProxy_2_3_2_Update_LogicalDeviceFlows(t *testing.T) {
 	// Get a device proxy and update a specific port
-	ldFlowsProxy := TestProxy_Root.node.CreateProxy(context.Background(), "/logical_devices/"+TestProxy_LogicalDeviceId+"/flows", false)
-	flows := ldFlowsProxy.Get(context.Background(), "/", 0, false, "")
+	ldFlowsProxy, err := TestProxy_Root.node.CreateProxy(context.Background(), "/logical_devices/"+TestProxy_LogicalDeviceId+"/flows", false)
+	if err != nil {
+		log.With(log.Fields{"error": err}).Fatal("Failed to create logical device flows proxy")
+	}
+	flows, err := ldFlowsProxy.Get(context.Background(), "/", 0, false, "")
+	if err != nil {
+		BenchmarkProxy_Logger.Errorf("Failed to get flows from logical device flows proxy due to error: %v", err)
+		assert.NotNil(t, err)
+	}
 	flows.(*openflow_13.Flows).Items[0].TableId = rand.Uint32()
 	t.Logf("before updated flows: %+v", flows)
 
@@ -558,27 +714,40 @@
 		commonCallback2,
 	)
 
-	kvFlows := ldFlowsProxy.Get(context.Background(), "/", 0, false, "")
-
+	kvFlows, err := ldFlowsProxy.Get(context.Background(), "/", 0, false, "")
+	if err != nil {
+		BenchmarkProxy_Logger.Errorf("Faield to get flows from logical device flows proxy due to error: %v", err)
+		assert.NotNil(t, err)
+	}
 	if reflect.DeepEqual(flows, kvFlows) {
 		t.Errorf("Local changes have changed the KV store contents -  local:%+v, kv: %+v", flows, kvFlows)
 	}
 
-	if updated := ldFlowsProxy.Update(context.Background(), "/", flows.(*openflow_13.Flows), false, ""); updated == nil {
+	updated, err := ldFlowsProxy.Update(context.Background(), "/", flows.(*openflow_13.Flows), false, "")
+	if err != nil {
+		BenchmarkProxy_Logger.Errorf("Failed to update flows in logical device flows proxy due to error: %v", err)
+		assert.NotNil(t, err)
+	}
+	if updated == nil {
 		t.Error("Failed to update logical device flows")
 	} else {
 		t.Logf("Updated logical device flows : %+v", updated)
 	}
 
-	if d := ldFlowsProxy.Get(context.Background(), "/", 0, false, ""); d == nil {
+	if d, _ := ldFlowsProxy.Get(context.Background(), "/", 0, false, ""); d == nil {
 		t.Error("Failed to find updated logical device flows (flows proxy)")
 	} else {
 		djson, _ := json.Marshal(d)
 		t.Logf("Found flows (flows proxy): %s", string(djson))
 	}
 
-	if d := TestProxy_Root_LogicalDevice.Get(context.Background(), "/logical_devices/"+TestProxy_LogicalDeviceId+"/flows", 0, false,
-		""); !reflect.ValueOf(d).IsValid() {
+	d, err := TestProxy_Root_LogicalDevice.Get(context.Background(), "/logical_devices/"+TestProxy_LogicalDeviceId+"/flows", 0, false,
+		"")
+	if err != nil {
+		BenchmarkProxy_Logger.Errorf("Failed to get flows from logical device flows proxy due to error: %v", err)
+		assert.NotNil(t, err)
+	}
+	if !reflect.ValueOf(d).IsValid() {
 		t.Error("Failed to find updated logical device flows (root proxy)")
 	} else {
 		djson, _ := json.Marshal(d)
@@ -602,7 +771,12 @@
 		"POST_REMOVE instructions (root proxy)", &postRemoveExecutedPtr,
 	)
 
-	if removed := TestProxy_Root_LogicalDevice.Remove(context.Background(), "/logical_devices/"+TestProxy_LogicalDeviceId, ""); removed == nil {
+	removed, err := TestProxy_Root_LogicalDevice.Remove(context.Background(), "/logical_devices/"+TestProxy_LogicalDeviceId, "")
+	if err != nil {
+		BenchmarkProxy_Logger.Errorf("Failed to remove device from logical devices proxy due to error: %v", err)
+		assert.NotNil(t, err)
+	}
+	if removed == nil {
 		t.Error("Failed to remove logical device")
 	} else {
 		t.Logf("Removed device : %+v", removed)
@@ -615,7 +789,12 @@
 		t.Error("POST_REMOVE callback was not executed")
 	}
 
-	if d := TestProxy_Root_LogicalDevice.Get(context.Background(), "/logical_devices/"+TestProxy_LogicalDeviceId, 0, false, ""); reflect.ValueOf(d).IsValid() {
+	d, err := TestProxy_Root_LogicalDevice.Get(context.Background(), "/logical_devices/"+TestProxy_LogicalDeviceId, 0, false, "")
+	if err != nil {
+		BenchmarkProxy_Logger.Errorf("Failed to get logical device info due to error: %v", err)
+		assert.NotNil(t, err)
+	}
+	if reflect.ValueOf(d).IsValid() {
 		djson, _ := json.Marshal(d)
 		t.Errorf("Device was not removed - %s", djson)
 	} else {