[VOL-5486] Upgrade library versions

Change-Id: I8b4e88699e03f44ee13e467867f45ae3f0a63c4b
Signed-off-by: Abhay Kumar <abhay.kumar@radisys.com>
diff --git a/pkg/db/kvstore/etcdclient.go b/pkg/db/kvstore/etcdclient.go
index d15bb6e..6828700 100644
--- a/pkg/db/kvstore/etcdclient.go
+++ b/pkg/db/kvstore/etcdclient.go
@@ -25,8 +25,9 @@
 	"time"
 
 	"github.com/opencord/voltha-lib-go/v7/pkg/log"
-	v3Client "go.etcd.io/etcd/clientv3"
-	v3rpcTypes "go.etcd.io/etcd/etcdserver/api/v3rpc/rpctypes"
+	v3rpcTypes "go.etcd.io/etcd/api/v3/v3rpc/rpctypes"
+
+	clientv3 "go.etcd.io/etcd/client/v3"
 )
 
 const (
@@ -43,7 +44,7 @@
 type EtcdClient struct {
 	pool               EtcdClientAllocator
 	watchedChannels    sync.Map
-	watchedClients     map[string]*v3Client.Client
+	watchedClients     map[string]*clientv3.Client
 	watchedClientsLock sync.RWMutex
 }
 
@@ -82,7 +83,7 @@
 	logger.Infow(ctx, "etcd-pool-created", log.Fields{"capacity": capacity, "max-usage": maxUsage})
 
 	return &EtcdClient{pool: pool,
-		watchedClients: make(map[string]*v3Client.Client),
+		watchedClients: make(map[string]*clientv3.Client),
 	}, nil
 }
 
@@ -109,7 +110,7 @@
 		return false, err
 	}
 	defer c.pool.Put(client)
-	resp, err := client.Get(ctx, key, v3Client.WithKeysOnly(), v3Client.WithCountOnly())
+	resp, err := client.Get(ctx, key, clientv3.WithKeysOnly(), clientv3.WithCountOnly())
 	if err != nil {
 		logger.Error(ctx, err)
 		return false, err
@@ -128,7 +129,7 @@
 		return nil, err
 	}
 	defer c.pool.Put(client)
-	resp, err := client.Get(ctx, key, v3Client.WithPrefix())
+	resp, err := client.Get(ctx, key, clientv3.WithPrefix())
 
 	if err != nil {
 		logger.Error(ctx, err)
@@ -201,7 +202,7 @@
 	defer c.pool.Put(client)
 
 	// Fetch keys with the prefix
-	resp, err := client.Get(ctx, prefixKey, v3Client.WithPrefix())
+	resp, err := client.Get(ctx, prefixKey, clientv3.WithPrefix())
 	if err != nil {
 		return nil, fmt.Errorf("failed to fetch entries for prefix %s: %w", prefixKey, err)
 	}
@@ -227,7 +228,7 @@
 	defer c.pool.Put(client)
 
 	// Fetch keys with the prefix
-	resp, err := client.Get(ctx, prefixKey, v3Client.WithPrefix(), v3Client.WithKeysOnly())
+	resp, err := client.Get(ctx, prefixKey, clientv3.WithPrefix(), clientv3.WithKeysOnly())
 	if err != nil {
 		return nil, fmt.Errorf("failed to fetch entries for prefix %s: %w", prefixKey, err)
 	}
@@ -346,7 +347,7 @@
 	defer c.pool.Put(client)
 
 	//delete the prefix
-	if _, err := client.Delete(ctx, prefixKey, v3Client.WithPrefix()); err != nil {
+	if _, err := client.Delete(ctx, prefixKey, clientv3.WithPrefix()); err != nil {
 		logger.Errorw(ctx, "failed-to-delete-prefix-key", log.Fields{"key": prefixKey, "error": err})
 		return err
 	}
@@ -372,11 +373,11 @@
 	}
 	c.watchedClientsLock.Unlock()
 
-	w := v3Client.NewWatcher(client)
+	w := clientv3.NewWatcher(client)
 	ctx, cancel := context.WithCancel(ctx)
-	var channel v3Client.WatchChan
+	var channel clientv3.WatchChan
 	if withPrefix {
-		channel = w.Watch(ctx, key, v3Client.WithPrefix())
+		channel = w.Watch(ctx, key, clientv3.WithPrefix())
 	} else {
 		channel = w.Watch(ctx, key)
 	}
@@ -385,7 +386,7 @@
 	ch := make(chan *Event, maxClientChannelBufferSize)
 
 	// Keep track of the created channels so they can be closed when required
-	channelMap := make(map[chan *Event]v3Client.Watcher)
+	channelMap := make(map[chan *Event]clientv3.Watcher)
 	channelMap[ch] = w
 	channelMaps := c.addChannelMap(key, channelMap)
 
@@ -399,33 +400,33 @@
 
 }
 
-func (c *EtcdClient) addChannelMap(key string, channelMap map[chan *Event]v3Client.Watcher) []map[chan *Event]v3Client.Watcher {
+func (c *EtcdClient) addChannelMap(key string, channelMap map[chan *Event]clientv3.Watcher) []map[chan *Event]clientv3.Watcher {
 	var channels interface{}
 	var exists bool
 
 	if channels, exists = c.watchedChannels.Load(key); exists {
-		channels = append(channels.([]map[chan *Event]v3Client.Watcher), channelMap)
+		channels = append(channels.([]map[chan *Event]clientv3.Watcher), channelMap)
 	} else {
-		channels = []map[chan *Event]v3Client.Watcher{channelMap}
+		channels = []map[chan *Event]clientv3.Watcher{channelMap}
 	}
 	c.watchedChannels.Store(key, channels)
 
-	return channels.([]map[chan *Event]v3Client.Watcher)
+	return channels.([]map[chan *Event]clientv3.Watcher)
 }
 
-func (c *EtcdClient) removeChannelMap(key string, pos int) []map[chan *Event]v3Client.Watcher {
+func (c *EtcdClient) removeChannelMap(key string, pos int) []map[chan *Event]clientv3.Watcher {
 	var channels interface{}
 	var exists bool
 
 	if channels, exists = c.watchedChannels.Load(key); exists {
-		channels = append(channels.([]map[chan *Event]v3Client.Watcher)[:pos], channels.([]map[chan *Event]v3Client.Watcher)[pos+1:]...)
+		channels = append(channels.([]map[chan *Event]clientv3.Watcher)[:pos], channels.([]map[chan *Event]clientv3.Watcher)[pos+1:]...)
 		c.watchedChannels.Store(key, channels)
 	}
 
-	return channels.([]map[chan *Event]v3Client.Watcher)
+	return channels.([]map[chan *Event]clientv3.Watcher)
 }
 
-func (c *EtcdClient) getChannelMaps(key string) ([]map[chan *Event]v3Client.Watcher, bool) {
+func (c *EtcdClient) getChannelMaps(key string) ([]map[chan *Event]clientv3.Watcher, bool) {
 	var channels interface{}
 	var exists bool
 
@@ -435,14 +436,14 @@
 		return nil, exists
 	}
 
-	return channels.([]map[chan *Event]v3Client.Watcher), exists
+	return channels.([]map[chan *Event]clientv3.Watcher), exists
 }
 
 // CloseWatch closes a specific watch. Both the key and the channel are required when closing a watch as there
 // may be multiple listeners on the same key.  The previously created channel serves as a key
 func (c *EtcdClient) CloseWatch(ctx context.Context, key string, ch chan *Event) {
 	// Get the array of channels mapping
-	var watchedChannels []map[chan *Event]v3Client.Watcher
+	var watchedChannels []map[chan *Event]clientv3.Watcher
 	var ok bool
 
 	if watchedChannels, ok = c.getChannelMaps(key); !ok {
@@ -482,7 +483,7 @@
 	logger.Infow(ctx, "watcher-channel-exiting", log.Fields{"key": key, "channel": channelMaps})
 }
 
-func (c *EtcdClient) listenForKeyChange(ctx context.Context, channel v3Client.WatchChan, ch chan<- *Event, cancel context.CancelFunc) {
+func (c *EtcdClient) listenForKeyChange(ctx context.Context, channel clientv3.WatchChan, ch chan<- *Event, cancel context.CancelFunc) {
 	logger.Debug(ctx, "start-listening-on-channel ...")
 	defer cancel()
 	defer close(ch)
@@ -494,11 +495,11 @@
 	logger.Debug(ctx, "stop-listening-on-channel ...")
 }
 
-func getEventType(event *v3Client.Event) int {
+func getEventType(event *clientv3.Event) int {
 	switch event.Type {
-	case v3Client.EventTypePut:
+	case clientv3.EventTypePut:
 		return PUT
-	case v3Client.EventTypeDelete:
+	case clientv3.EventTypeDelete:
 		return DELETE
 	}
 	return UNKNOWN