VOL-1775 VOL-1779 VOL-1780 : Fix several issues with overall stability

- Apply changes as reported by golang race utility
- Added version attribute in KV object
- Added context object to db/model api
- Carrying timestamp info through context to help in the
  decision making when applying a revision change
- Replaced proxy access control mechanism with etcd reservation mechanism

Change-Id: If3d142a73b1da0d64fa6a819530f297dbfada2d3
diff --git a/db/model/transaction_test.go b/db/model/transaction_test.go
index bc53791..3660a86 100644
--- a/db/model/transaction_test.go
+++ b/db/model/transaction_test.go
@@ -17,6 +17,7 @@
 package model
 
 import (
+	"context"
 	"encoding/hex"
 	"github.com/google/uuid"
 	"github.com/opencord/voltha-protos/go/common"
@@ -34,7 +35,7 @@
 
 func init() {
 	TestTransaction_Root = NewRoot(&voltha.Voltha{}, nil)
-	TestTransaction_RootProxy = TestTransaction_Root.node.CreateProxy("/", false)
+	TestTransaction_RootProxy = TestTransaction_Root.node.CreateProxy(context.Background(), "/", false)
 }
 
 //func TestTransaction_1_GetDevices(t *testing.T) {
@@ -79,7 +80,7 @@
 
 	addTx := TestTransaction_RootProxy.OpenTransaction()
 
-	if added := addTx.Add("/devices", device); added == nil {
+	if added := addTx.Add(context.Background(), "/devices", device); added == nil {
 		t.Error("Failed to add device")
 	} else {
 		TestTransaction_TargetDeviceId = added.(*voltha.Device).Id
@@ -93,12 +94,12 @@
 	basePath := "/devices/" + TestTransaction_DeviceId
 
 	getDevWithPortsTx := TestTransaction_RootProxy.OpenTransaction()
-	device1 := getDevWithPortsTx.Get(basePath+"/ports", 1, false)
+	device1 := getDevWithPortsTx.Get(context.Background(), basePath+"/ports", 1, false)
 	t.Logf("retrieved device with ports: %+v", device1)
 	getDevWithPortsTx.Commit()
 
 	getDevTx := TestTransaction_RootProxy.OpenTransaction()
-	device2 := getDevTx.Get(basePath, 0, false)
+	device2 := getDevTx.Get(context.Background(), basePath, 0, false)
 	t.Logf("retrieved device: %+v", device2)
 
 	getDevTx.Commit()
@@ -106,7 +107,7 @@
 
 func TestTransaction_4_UpdateDevice(t *testing.T) {
 	updateTx := TestTransaction_RootProxy.OpenTransaction()
-	if retrieved := updateTx.Get("/devices/"+TestTransaction_TargetDeviceId, 1, false); retrieved == nil {
+	if retrieved := updateTx.Get(context.Background(), "/devices/"+TestTransaction_TargetDeviceId, 1, false); retrieved == nil {
 		t.Error("Failed to get device")
 	} else {
 		var fwVersion int
@@ -122,7 +123,7 @@
 		t.Logf("Before update : %+v", retrieved)
 
 		// FIXME: The makeBranch passed in function is nil or not being executed properly!!!!!
-		if afterUpdate := updateTx.Update("/devices/"+TestTransaction_TargetDeviceId, retrieved, false); afterUpdate == nil {
+		if afterUpdate := updateTx.Update(context.Background(), "/devices/"+TestTransaction_TargetDeviceId, retrieved, false); afterUpdate == nil {
 			t.Error("Failed to update device")
 		} else {
 			t.Logf("Updated device : %+v", afterUpdate)
@@ -136,12 +137,12 @@
 	basePath := "/devices/" + TestTransaction_DeviceId
 
 	getDevWithPortsTx := TestTransaction_RootProxy.OpenTransaction()
-	device1 := getDevWithPortsTx.Get(basePath+"/ports", 1, false)
+	device1 := getDevWithPortsTx.Get(context.Background(), basePath+"/ports", 1, false)
 	t.Logf("retrieved device with ports: %+v", device1)
 	getDevWithPortsTx.Commit()
 
 	getDevTx := TestTransaction_RootProxy.OpenTransaction()
-	device2 := getDevTx.Get(basePath, 0, false)
+	device2 := getDevTx.Get(context.Background(), basePath, 0, false)
 	t.Logf("retrieved device: %+v", device2)
 
 	getDevTx.Commit()
@@ -149,7 +150,7 @@
 
 func TestTransaction_6_RemoveDevice(t *testing.T) {
 	removeTx := TestTransaction_RootProxy.OpenTransaction()
-	if removed := removeTx.Remove("/devices/" + TestTransaction_DeviceId); removed == nil {
+	if removed := removeTx.Remove(context.Background(), "/devices/"+TestTransaction_DeviceId); removed == nil {
 		t.Error("Failed to remove device")
 	} else {
 		t.Logf("Removed device : %+v", removed)
@@ -162,7 +163,7 @@
 	basePath := "/devices/" + TestTransaction_DeviceId
 
 	getDevTx := TestTransaction_RootProxy.OpenTransaction()
-	device := TestTransaction_RootProxy.Get(basePath, 0, false, "")
+	device := TestTransaction_RootProxy.Get(context.Background(), basePath, 0, false, "")
 	t.Logf("retrieved device: %+v", device)
 
 	getDevTx.Commit()