VOL-2134 - update voltha-go to use v2.2.5 of voltha-lib-go

Change-Id: I8ec822ad0c4d28118ae6d8d68cf697eef21cfea9
diff --git a/go.mod b/go.mod
index 296baf4..6595e62 100644
--- a/go.mod
+++ b/go.mod
@@ -9,7 +9,7 @@
 	github.com/golang/protobuf v1.3.2
 	github.com/google/uuid v1.1.1
 	github.com/gyuho/goraph v0.0.0-20160328020532-d460590d53a9
-	github.com/opencord/voltha-lib-go v0.0.0-20191018190138-62f0709e8232
+	github.com/opencord/voltha-lib-go v0.0.0-20191023185531-80258b36a64b
 	github.com/opencord/voltha-protos v1.0.3
 	github.com/stretchr/testify v1.4.0
 	google.golang.org/grpc v1.24.0
diff --git a/go.sum b/go.sum
index 58978ba..5331e02 100644
--- a/go.sum
+++ b/go.sum
@@ -192,8 +192,8 @@
 github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
 github.com/onsi/gomega v1.4.2 h1:3mYCb7aPxS/RU7TI1y4rkEn1oKmPRjNJLNEXgw7MH2I=
 github.com/onsi/gomega v1.4.2/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
-github.com/opencord/voltha-lib-go v0.0.0-20191018190138-62f0709e8232 h1:2+lgStiINTrNdCvyVHFmPoVpWO5/6RdeQF6oZqSlimc=
-github.com/opencord/voltha-lib-go v0.0.0-20191018190138-62f0709e8232/go.mod h1:+bjwfm5bbP1j6liscpn3UFqbh6hHDkmLDWU3AdYLDY4=
+github.com/opencord/voltha-lib-go v0.0.0-20191023185531-80258b36a64b h1:s3zvCa27RhpVy+wCk5R4iKa9H61B1MzbSL2164B1w68=
+github.com/opencord/voltha-lib-go v0.0.0-20191023185531-80258b36a64b/go.mod h1:+bjwfm5bbP1j6liscpn3UFqbh6hHDkmLDWU3AdYLDY4=
 github.com/opencord/voltha-protos v1.0.3 h1:9v+R/QGF1xK+HKTqFM0IqCABoGCAxC8iKH4VzNBJDto=
 github.com/opencord/voltha-protos v1.0.3/go.mod h1:myfFIkJdA+rCXmKdLImhh79MfabN4ZOKQ4grk32DnPQ=
 github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
diff --git a/vendor/github.com/opencord/voltha-lib-go/pkg/adapters/common/core_proxy.go b/vendor/github.com/opencord/voltha-lib-go/pkg/adapters/common/core_proxy.go
index 30117ca..1daeacb 100644
--- a/vendor/github.com/opencord/voltha-lib-go/pkg/adapters/common/core_proxy.go
+++ b/vendor/github.com/opencord/voltha-lib-go/pkg/adapters/common/core_proxy.go
@@ -500,6 +500,30 @@
 	return unPackResponse(rpc, deviceId, success, result)
 }
 
+func (ap *CoreProxy) DeviceReasonUpdate(ctx context.Context, deviceId string, deviceReason string) error {
+	log.Debugw("DeviceReasonUpdate", log.Fields{"deviceId": deviceId, "deviceReason": deviceReason})
+	rpc := "DeviceReasonUpdate"
+	// Use a device specific topic to send the request.  The adapter handling the device creates a device
+	// specific topic
+	toTopic := ap.getCoreTopic(deviceId)
+	replyToTopic := ap.getAdapterTopic()
+
+	args := make([]*kafka.KVArg, 2)
+	id := &voltha.ID{Id: deviceId}
+	args[0] = &kafka.KVArg{
+		Key:   "device_id",
+		Value: id,
+	}
+	reason := &ic.StrType{Val: deviceReason}
+	args[1] = &kafka.KVArg{
+		Key:   "device_reason",
+		Value: reason,
+	}
+	success, result := ap.kafkaICProxy.InvokeRPC(nil, rpc, &toTopic, &replyToTopic, true, deviceId, args...)
+	log.Debugw("DeviceReason-response", log.Fields{"pDeviceId": deviceId, "success": success})
+	return unPackResponse(rpc, deviceId, success, result)
+}
+
 func (ap *CoreProxy) DevicePMConfigUpdate(ctx context.Context, pmConfigs *voltha.PmConfigs) error {
 	log.Debugw("DevicePMConfigUpdate", log.Fields{"pmConfigs": pmConfigs})
 	rpc := "DevicePMConfigUpdate"
diff --git a/vendor/github.com/opencord/voltha-lib-go/pkg/db/model/non_persisted_revision.go b/vendor/github.com/opencord/voltha-lib-go/pkg/db/model/non_persisted_revision.go
index 88320cb..514b3b3 100644
--- a/vendor/github.com/opencord/voltha-lib-go/pkg/db/model/non_persisted_revision.go
+++ b/vendor/github.com/opencord/voltha-lib-go/pkg/db/model/non_persisted_revision.go
@@ -25,6 +25,7 @@
 	"github.com/opencord/voltha-lib-go/pkg/log"
 	"reflect"
 	"sort"
+	"strings"
 	"sync"
 	"time"
 )
@@ -284,12 +285,7 @@
 	npr.mutex.Lock()
 	defer npr.mutex.Unlock()
 
-	if ctx != nil {
-		if ctxTS, ok := ctx.Value(RequestTimestamp).(int64); ok && npr.lastUpdate.UnixNano() > ctxTS {
-			log.Warnw("data-is-older-than-current", log.Fields{"ctx-ts": ctxTS, "rev-ts": npr.lastUpdate.UnixNano()})
-			return npr
-		}
-	}
+	log.Debugw("update-data", log.Fields{"hash": npr.GetHash(), "current": npr.Config.Data, "provided": data})
 
 	// Do not update the revision if data is the same
 	if npr.Config.Data != nil && npr.Config.hashData(npr.Root, data) == npr.Config.Hash {
@@ -313,6 +309,8 @@
 
 	newRev.Finalize(false)
 
+	log.Debugw("update-data-complete", log.Fields{"updated": newRev.Config.Data, "provided": data})
+
 	return &newRev
 }
 
@@ -461,6 +459,25 @@
 	}
 }
 
+/// ChildDropByName will remove a child entry matching the type and name
+func (npr *NonPersistedRevision) ChildDropByName(childName string) {
+	// Extract device type
+	parts := strings.SplitN(childName, "/", 2)
+	childType := parts[0]
+
+	if childType != "" {
+		children := make([]Revision, len(npr.GetChildren(childType)))
+		copy(children, npr.GetChildren(childType))
+		for i, child := range children {
+			if child.GetName() == childName {
+				children = append(children[:i], children[i+1:]...)
+				npr.SetChildren(childType, children)
+				break
+			}
+		}
+	}
+}
+
 func (npr *NonPersistedRevision) SetLastUpdate(ts ...time.Time) {
 	npr.mutex.Lock()
 	defer npr.mutex.Unlock()
diff --git a/vendor/github.com/opencord/voltha-lib-go/pkg/db/model/persisted_revision.go b/vendor/github.com/opencord/voltha-lib-go/pkg/db/model/persisted_revision.go
index c644e14..8ab182b 100644
--- a/vendor/github.com/opencord/voltha-lib-go/pkg/db/model/persisted_revision.go
+++ b/vendor/github.com/opencord/voltha-lib-go/pkg/db/model/persisted_revision.go
@@ -162,7 +162,14 @@
 			switch event.EventType {
 			case kvstore.DELETE:
 				log.Debugw("delete-from-memory", log.Fields{"key": latestRev.GetHash(), "watch": latestRev.GetName()})
-				pr.Revision.Drop("", true)
+
+				// Remove reference from cache
+				GetRevCache().Delete(latestRev.GetName())
+
+				// Remove reference from parent
+				parent := pr.GetBranch().Node.GetRoot()
+				parent.GetBranch(NONE).Latest.ChildDropByName(latestRev.GetName())
+
 				break StopWatchLoop
 
 			case kvstore.PUT:
@@ -382,10 +389,11 @@
 		// Also check if we are treating a newer revision of the data or not
 		if childRev.GetData().(proto.Message).String() != data.(proto.Message).String() && childRev.getVersion() < version {
 			log.Debugw("revision-data-is-different", log.Fields{
-				"key":     childRev.GetHash(),
-				"name":    childRev.GetName(),
-				"data":    childRev.GetData(),
-				"version": childRev.getVersion(),
+				"key":               childRev.GetHash(),
+				"name":              childRev.GetName(),
+				"data":              childRev.GetData(),
+				"in-memory-version": childRev.getVersion(),
+				"persisted-version": version,
 			})
 
 			//
@@ -436,9 +444,11 @@
 		} else {
 			if childRev != nil {
 				log.Debugw("keeping-revision-data", log.Fields{
-					"key":  childRev.GetHash(),
-					"name": childRev.GetName(),
-					"data": childRev.GetData(),
+					"key":                 childRev.GetHash(),
+					"name":                childRev.GetName(),
+					"data":                childRev.GetData(),
+					"in-memory-version":   childRev.getVersion(),
+					"persistence-version": version,
 				})
 
 				// Update timestamp to reflect when it was last read and to reset tracked timeout
@@ -455,9 +465,10 @@
 		// There is no available child with that key value.
 		// Create a new child and update the parent revision.
 		log.Debugw("no-such-revision-entry", log.Fields{
-			"key":  keyValue,
-			"name": typeName,
-			"data": data,
+			"key":     keyValue,
+			"name":    typeName,
+			"data":    data,
+			"version": version,
 		})
 
 		// BEGIN child lock
diff --git a/vendor/github.com/opencord/voltha-lib-go/pkg/db/model/revision.go b/vendor/github.com/opencord/voltha-lib-go/pkg/db/model/revision.go
index bb61355..71c5d0c 100644
--- a/vendor/github.com/opencord/voltha-lib-go/pkg/db/model/revision.go
+++ b/vendor/github.com/opencord/voltha-lib-go/pkg/db/model/revision.go
@@ -28,6 +28,7 @@
 	Drop(txid string, includeConfig bool)
 	StorageDrop(txid string, includeConfig bool)
 	ChildDrop(childType string, childHash string)
+	ChildDropByName(childName string)
 	SetChildren(name string, children []Revision)
 	GetChildren(name string) []Revision
 	SetAllChildren(children map[string][]Revision)
diff --git a/vendor/modules.txt b/vendor/modules.txt
index 2874a69..d52f030 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -62,7 +62,7 @@
 github.com/mitchellh/go-homedir
 # github.com/mitchellh/mapstructure v1.1.2
 github.com/mitchellh/mapstructure
-# github.com/opencord/voltha-lib-go v0.0.0-20191018190138-62f0709e8232
+# github.com/opencord/voltha-lib-go v0.0.0-20191023185531-80258b36a64b
 github.com/opencord/voltha-lib-go/pkg/log
 github.com/opencord/voltha-lib-go/pkg/db/kvstore
 github.com/opencord/voltha-lib-go/pkg/grpc