[VOL-2736]host and port should be specified as a single argument not as two separate arguments

Change-Id: Id964d8e0d2e5867937de3efd239dd8a9250a56bb
diff --git a/VERSION b/VERSION
index 538ee20..6085e94 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-1.2.1-dev
+1.2.1
diff --git a/cmd/ofagent/config.go b/cmd/ofagent/config.go
index 33bda04..ba8b710 100644
--- a/cmd/ofagent/config.go
+++ b/cmd/ofagent/config.go
@@ -36,8 +36,7 @@
 	ConnectionMaxRetries      int
 	KVStoreType               string
 	KVStoreTimeout            time.Duration
-	KVStoreHost               string
-	KVStorePort               int
+	KVStoreAddress            string
 	InstanceID                string
 }
 
@@ -121,9 +120,7 @@
 
 	flag.DurationVar(&(config.KVStoreTimeout), "kv_store_request_timeout", 5*time.Second, "The default timeout when making a kv store request")
 
-	flag.StringVar(&(config.KVStoreHost), "kv_store_host", "voltha-etcd-cluster-client.voltha.svc.cluster.local", "KV store host")
-
-	flag.IntVar(&(config.KVStorePort), "kv_store_port", 2379, "KV store port")
+	flag.StringVar(&(config.KVStoreAddress), "kv_store_address", "voltha-etcd-cluster-client.voltha.svc.cluster.local:2379", "KV store address")
 
 	flag.StringVar(&(config.LogLevel), "log_level", "WARN", "Log level")
 
diff --git a/cmd/ofagent/main.go b/cmd/ofagent/main.go
index d32fecc..14b38ed 100644
--- a/cmd/ofagent/main.go
+++ b/cmd/ofagent/main.go
@@ -27,7 +27,6 @@
 	"github.com/opencord/voltha-lib-go/v3/pkg/probe"
 	"github.com/opencord/voltha-lib-go/v3/pkg/version"
 	"os"
-	"strconv"
 	"time"
 )
 
@@ -45,14 +44,14 @@
 	fmt.Println(version.VersionInfo.String("  "))
 }
 
-func setLogConfig(ctx context.Context, kvStoreHost, kvStoreType string, kvStorePort int, kvStoreTimeout time.Duration) (kvstore.Client, error) {
-	client, err := kvstore.NewEtcdClient(kvStoreHost+":"+strconv.Itoa(kvStorePort), kvStoreTimeout, log.WarnLevel)
+func setLogConfig(ctx context.Context, kvStoreAddress, kvStoreType string, kvStoreTimeout time.Duration) (kvstore.Client, error) {
+	client, err := kvstore.NewEtcdClient(kvStoreAddress, kvStoreTimeout, log.WarnLevel)
 
 	if err != nil {
 		return nil, err
 	}
 
-	cm := conf.NewConfigManager(client, kvStoreType, kvStoreHost, kvStorePort, kvStoreTimeout)
+	cm := conf.NewConfigManager(client, kvStoreType, kvStoreAddress, kvStoreTimeout)
 	go conf.StartLogLevelConfigProcessing(cm, ctx)
 	return client, nil
 }
@@ -128,7 +127,7 @@
 	 */
 	ctx := context.WithValue(context.Background(), probe.ProbeContextKey, p)
 
-	client, err := setLogConfig(ctx, config.KVStoreHost, config.KVStoreType, config.KVStorePort, config.KVStoreTimeout)
+	client, err := setLogConfig(ctx, config.KVStoreAddress, config.KVStoreType, config.KVStoreTimeout)
 	if err != nil {
 		logger.Warnw("unable-to-create-kvstore-client", log.Fields{"error": err})
 	}
diff --git a/go.mod b/go.mod
index fc176f1..df7cacc 100644
--- a/go.mod
+++ b/go.mod
@@ -5,7 +5,7 @@
 require (
 	github.com/golang/protobuf v1.3.2
 	github.com/opencord/goloxi v1.0.1
-	github.com/opencord/voltha-lib-go/v3 v3.1.9
+	github.com/opencord/voltha-lib-go/v3 v3.1.13
 	github.com/opencord/voltha-protos/v3 v3.3.3
 	github.com/stretchr/testify v1.4.0
 	golang.org/x/net v0.0.0-20191112182307-2180aed22343
diff --git a/go.sum b/go.sum
index ec65f13..7924398 100644
--- a/go.sum
+++ b/go.sum
@@ -194,8 +194,8 @@
 github.com/onsi/gomega v1.4.2/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
 github.com/opencord/goloxi v1.0.1 h1:QCOZUqgNLi72ylaIPWSLvSvGVDB2FHyatIkAePXr+Dk=
 github.com/opencord/goloxi v1.0.1/go.mod h1:A5U6uO6EaPuQkB5N1RjIV66tYgsKejiGTsEZrU/c19A=
-github.com/opencord/voltha-lib-go/v3 v3.1.9 h1:8Py2yDYDg956Tcv7r/oRdZGMaT1myvnL1en9HoptPRU=
-github.com/opencord/voltha-lib-go/v3 v3.1.9/go.mod h1:26TG6ABl+ppP754YWhhgao9wKNL3SuUf/KztQcJFqrQ=
+github.com/opencord/voltha-lib-go/v3 v3.1.13 h1:kgf2aMkiUR5IbJpQ/E7pMNcwR2KxhLchP26CSyY+rbY=
+github.com/opencord/voltha-lib-go/v3 v3.1.13/go.mod h1:26TG6ABl+ppP754YWhhgao9wKNL3SuUf/KztQcJFqrQ=
 github.com/opencord/voltha-protos/v3 v3.3.3 h1:OO0H+YMxjLFQifoYXwBp1JN5rpEVMQnhGGEdP6pLrY0=
 github.com/opencord/voltha-protos/v3 v3.3.3/go.mod h1:nl1ETp5Iw3avxOaKD8BJlYY5wYI4KeV95aT1pL63nto=
 github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
diff --git a/vendor/github.com/opencord/voltha-lib-go/v3/pkg/config/configmanager.go b/vendor/github.com/opencord/voltha-lib-go/v3/pkg/config/configmanager.go
index c0915af..24988be 100644
--- a/vendor/github.com/opencord/voltha-lib-go/v3/pkg/config/configmanager.go
+++ b/vendor/github.com/opencord/voltha-lib-go/v3/pkg/config/configmanager.go
@@ -18,17 +18,19 @@
 import (
 	"context"
 	"fmt"
+	"os"
+	"strings"
+	"time"
+
 	"github.com/opencord/voltha-lib-go/v3/pkg/db"
 	"github.com/opencord/voltha-lib-go/v3/pkg/db/kvstore"
 	"github.com/opencord/voltha-lib-go/v3/pkg/log"
-	"strings"
-	"time"
 )
 
 const (
-	defaultkvStoreConfigPath = "config"
-	kvStoreDataPathPrefix    = "service/voltha"
-	kvStorePathSeparator     = "/"
+	defaultkvStoreConfigPath     = "config"
+	defaultkvStoreDataPathPrefix = "service/voltha"
+	kvStorePathSeparator         = "/"
 )
 
 // ConfigType represents the type for which config is created inside the kvstore
@@ -68,8 +70,9 @@
 // ConfigManager is a wrapper over Backend to maintain Configuration of voltha components
 // in kvstore based persistent storage
 type ConfigManager struct {
-	Backend             *db.Backend
-	KvStoreConfigPrefix string
+	Backend               *db.Backend
+	KVStoreConfigPrefix   string
+	KVStoreDataPathPrefix string
 }
 
 // ComponentConfig represents a category of configuration for a specific VOLTHA component type
@@ -93,24 +96,31 @@
 	kvStoreEventChan chan *kvstore.Event
 }
 
-func NewConfigManager(kvClient kvstore.Client, kvStoreType, kvStoreHost string, kvStorePort int, kvStoreTimeout time.Duration) *ConfigManager {
-
+func NewConfigManager(kvClient kvstore.Client, kvStoreType, kvStoreAddress string, kvStoreTimeout time.Duration) *ConfigManager {
+	var kvStorePrefix string
+	if prefix, present := os.LookupEnv("KV_STORE_DATAPATH_PREFIX"); present {
+		kvStorePrefix = prefix
+		logger.Infow("KV_STORE_DATAPATH_PREFIX env variable is set, ", log.Fields{"kvStoreDataPathPrefix": kvStorePrefix})
+	} else {
+		kvStorePrefix = defaultkvStoreDataPathPrefix
+		logger.Infow("KV_STORE_DATAPATH_PREFIX env variable is not set, using default", log.Fields{"kvStoreDataPathPrefix": defaultkvStoreDataPathPrefix})
+	}
 	return &ConfigManager{
-		KvStoreConfigPrefix: defaultkvStoreConfigPath,
+		KVStoreConfigPrefix:   defaultkvStoreConfigPath,
+		KVStoreDataPathPrefix: kvStorePrefix,
 		Backend: &db.Backend{
 			Client:     kvClient,
 			StoreType:  kvStoreType,
-			Host:       kvStoreHost,
-			Port:       kvStorePort,
+			Address:    kvStoreAddress,
 			Timeout:    kvStoreTimeout,
-			PathPrefix: kvStoreDataPathPrefix,
+			PathPrefix: kvStorePrefix,
 		},
 	}
 }
 
 // RetrieveComponentList list the component Names for which loglevel is stored in kvstore
 func (c *ConfigManager) RetrieveComponentList(ctx context.Context, configType ConfigType) ([]string, error) {
-	data, err := c.Backend.List(ctx, c.KvStoreConfigPrefix)
+	data, err := c.Backend.List(ctx, c.KVStoreConfigPrefix)
 	if err != nil {
 		return nil, err
 	}
@@ -120,7 +130,7 @@
 	// For Example, recieved key would be <Backend Prefix Path>/<Config Prefix>/<Component Name>/<Config Type>/default and value \"DEBUG\"
 	// Then in default will be stored as PackageName,componentName as <Component Name> and DEBUG will be stored as value in List struct
 	ccPathPrefix := kvStorePathSeparator + configType.String() + kvStorePathSeparator
-	pathPrefix := kvStoreDataPathPrefix + kvStorePathSeparator + c.KvStoreConfigPrefix + kvStorePathSeparator
+	pathPrefix := c.KVStoreDataPathPrefix + kvStorePathSeparator + c.KVStoreConfigPrefix + kvStorePathSeparator
 	var list []string
 	keys := make(map[string]interface{})
 	for attr := range data {
@@ -153,7 +163,7 @@
 func (c *ComponentConfig) makeConfigPath() string {
 
 	cType := c.configType.String()
-	return c.cManager.KvStoreConfigPrefix + kvStorePathSeparator +
+	return c.cManager.KVStoreConfigPrefix + kvStorePathSeparator +
 		c.componentLabel + kvStorePathSeparator + cType
 }
 
diff --git a/vendor/github.com/opencord/voltha-lib-go/v3/pkg/db/backend.go b/vendor/github.com/opencord/voltha-lib-go/v3/pkg/db/backend.go
index 20bacad..1e23a0f 100644
--- a/vendor/github.com/opencord/voltha-lib-go/v3/pkg/db/backend.go
+++ b/vendor/github.com/opencord/voltha-lib-go/v3/pkg/db/backend.go
@@ -20,7 +20,6 @@
 	"context"
 	"errors"
 	"fmt"
-	"strconv"
 	"time"
 
 	"github.com/opencord/voltha-lib-go/v3/pkg/db/kvstore"
@@ -38,9 +37,8 @@
 type Backend struct {
 	Client                  kvstore.Client
 	StoreType               string
-	Host                    string
-	Port                    int
 	Timeout                 time.Duration
+	Address                 string
 	PathPrefix              string
 	alive                   bool          // Is this backend connection alive?
 	liveness                chan bool     // channel to post alive state
@@ -49,24 +47,22 @@
 }
 
 // NewBackend creates a new instance of a Backend structure
-func NewBackend(storeType string, host string, port int, timeout time.Duration, pathPrefix string) *Backend {
+func NewBackend(storeType string, address string, timeout time.Duration, pathPrefix string) *Backend {
 	var err error
 
 	b := &Backend{
 		StoreType:               storeType,
-		Host:                    host,
-		Port:                    port,
+		Address:                 address,
 		Timeout:                 timeout,
 		LivenessChannelInterval: DefaultLivenessChannelInterval,
 		PathPrefix:              pathPrefix,
 		alive:                   false, // connection considered down at start
 	}
 
-	address := host + ":" + strconv.Itoa(port)
 	if b.Client, err = b.newClient(address, timeout); err != nil {
 		logger.Errorw("failed-to-create-kv-client",
 			log.Fields{
-				"type": storeType, "host": host, "port": port,
+				"type": storeType, "address": address,
 				"timeout": timeout, "prefix": pathPrefix,
 				"error": err.Error(),
 			})
diff --git a/vendor/modules.txt b/vendor/modules.txt
index f78412e..3e2db5b 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -39,7 +39,7 @@
 # github.com/opencord/goloxi v1.0.1
 github.com/opencord/goloxi
 github.com/opencord/goloxi/of13
-# github.com/opencord/voltha-lib-go/v3 v3.1.9
+# github.com/opencord/voltha-lib-go/v3 v3.1.13
 github.com/opencord/voltha-lib-go/v3/pkg/config
 github.com/opencord/voltha-lib-go/v3/pkg/db
 github.com/opencord/voltha-lib-go/v3/pkg/db/kvstore