[VOL-2736]host and port should be specified as a single argument not as two separate arguments
Change-Id: I5a3a494c38dafa1e7e18e1f1cd55c0035359c7a9
diff --git a/VERSION b/VERSION
index ad8f890..8e8299d 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.4.2-dev
+2.4.2
diff --git a/go.mod b/go.mod
index 3c7631c..fac50d7 100644
--- a/go.mod
+++ b/go.mod
@@ -6,7 +6,7 @@
github.com/gogo/protobuf v1.3.0
github.com/golang/protobuf v1.3.2
github.com/google/uuid v1.1.1
- github.com/opencord/voltha-lib-go/v3 v3.1.12
+ github.com/opencord/voltha-lib-go/v3 v3.1.13
github.com/opencord/voltha-protos/v3 v3.3.3
github.com/phayes/freeport v0.0.0-20180830031419-95f893ade6f2
github.com/stretchr/testify v1.4.0
diff --git a/go.sum b/go.sum
index 98a0e62..37e49c1 100644
--- a/go.sum
+++ b/go.sum
@@ -196,8 +196,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/v3 v3.1.12 h1:ey3mpwB0mOuoK0cnonF6O0cNJlb75ZudqGpGz/50l4k=
-github.com/opencord/voltha-lib-go/v3 v3.1.12/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/rw_core/config/config.go b/rw_core/config/config.go
index e7e5c4f..dca40d0 100644
--- a/rw_core/config/config.go
+++ b/rw_core/config/config.go
@@ -26,16 +26,12 @@
const (
ConsulStoreName = "consul"
EtcdStoreName = "etcd"
- defaultGrpcPort = 50057
- defaultGrpcHost = ""
- defaultKafkaAdapterHost = "127.0.0.1"
- defaultKafkaAdapterPort = 9092
- defaultKafkaClusterHost = "127.0.0.1"
- defaultKafkaClusterPort = 9094
+ defaultGrpcAddress = ":50057"
+ defaultKafkaAdapterAddress = "127.0.0.1:9092"
+ defaultKafkaClusterAddress = "127.0.0.1:9094"
defaultKVStoreType = EtcdStoreName
defaultKVStoreTimeout = 5 * time.Second
- defaultKVStoreHost = "127.0.0.1"
- defaultKVStorePort = 2379 // Consul = 8500; Etcd = 2379
+ defaultKVStoreAddress = "127.0.0.1:2379" // Consul = 8500; Etcd = 2379
defaultKVTxnKeyDelTime = 60
defaultLogLevel = "WARN"
defaultBanner = false
@@ -55,24 +51,19 @@
defaultConnectionRetryInterval = 2 * time.Second
defaultLiveProbeInterval = 60 * time.Second
defaultNotLiveProbeInterval = 5 * time.Second // Probe more frequently when not alive
- defaultProbeHost = ""
- defaultProbePort = 8080
+ defaultProbeAddress = ":8080"
)
// RWCoreFlags represents the set of configurations used by the read-write core service
type RWCoreFlags struct {
// Command line parameters
RWCoreEndpoint string
- GrpcHost string
- GrpcPort int
- KafkaAdapterHost string
- KafkaAdapterPort int
- KafkaClusterHost string
- KafkaClusterPort int
+ GrpcAddress string
+ KafkaAdapterAddress string
+ KafkaClusterAddress string
KVStoreType string
KVStoreTimeout time.Duration
- KVStoreHost string
- KVStorePort int
+ KVStoreAddress string
KVTxnKeyDelTime int
CoreTopic string
LogLevel string
@@ -91,24 +82,19 @@
ConnectionRetryInterval time.Duration
LiveProbeInterval time.Duration
NotLiveProbeInterval time.Duration
- ProbeHost string
- ProbePort int
+ ProbeAddress string
}
// NewRWCoreFlags returns a new RWCore config
func NewRWCoreFlags() *RWCoreFlags {
var rwCoreFlag = RWCoreFlags{ // Default values
RWCoreEndpoint: defaultRWCoreEndpoint,
- GrpcHost: defaultGrpcHost,
- GrpcPort: defaultGrpcPort,
- KafkaAdapterHost: defaultKafkaAdapterHost,
- KafkaAdapterPort: defaultKafkaAdapterPort,
- KafkaClusterHost: defaultKafkaClusterHost,
- KafkaClusterPort: defaultKafkaClusterPort,
+ GrpcAddress: defaultGrpcAddress,
+ KafkaAdapterAddress: defaultKafkaAdapterAddress,
+ KafkaClusterAddress: defaultKafkaClusterAddress,
KVStoreType: defaultKVStoreType,
KVStoreTimeout: defaultKVStoreTimeout,
- KVStoreHost: defaultKVStoreHost,
- KVStorePort: defaultKVStorePort,
+ KVStoreAddress: defaultKVStoreAddress,
KVTxnKeyDelTime: defaultKVTxnKeyDelTime,
CoreTopic: defaultCoreTopic,
LogLevel: defaultLogLevel,
@@ -127,8 +113,7 @@
ConnectionRetryInterval: defaultConnectionRetryInterval,
LiveProbeInterval: defaultLiveProbeInterval,
NotLiveProbeInterval: defaultNotLiveProbeInterval,
- ProbeHost: defaultProbeHost,
- ProbePort: defaultProbePort,
+ ProbeAddress: defaultProbeAddress,
}
return &rwCoreFlag
}
@@ -139,23 +124,14 @@
help := fmt.Sprintf("RW core endpoint address")
flag.StringVar(&(cf.RWCoreEndpoint), "vcore-endpoint", defaultRWCoreEndpoint, help)
- help = fmt.Sprintf("GRPC server - host")
- flag.StringVar(&(cf.GrpcHost), "grpc_host", defaultGrpcHost, help)
+ help = fmt.Sprintf("GRPC server - address")
+ flag.StringVar(&(cf.GrpcAddress), "grpc_address", defaultGrpcAddress, help)
- help = fmt.Sprintf("GRPC server - port")
- flag.IntVar(&(cf.GrpcPort), "grpc_port", defaultGrpcPort, help)
+ help = fmt.Sprintf("Kafka - Adapter messaging address")
+ flag.StringVar(&(cf.KafkaAdapterAddress), "kafka_adapter_address", defaultKafkaAdapterAddress, help)
- help = fmt.Sprintf("Kafka - Adapter messaging host")
- flag.StringVar(&(cf.KafkaAdapterHost), "kafka_adapter_host", defaultKafkaAdapterHost, help)
-
- help = fmt.Sprintf("Kafka - Adapter messaging port")
- flag.IntVar(&(cf.KafkaAdapterPort), "kafka_adapter_port", defaultKafkaAdapterPort, help)
-
- help = fmt.Sprintf("Kafka - Cluster messaging host")
- flag.StringVar(&(cf.KafkaClusterHost), "kafka_cluster_host", defaultKafkaClusterHost, help)
-
- help = fmt.Sprintf("Kafka - Cluster messaging port")
- flag.IntVar(&(cf.KafkaClusterPort), "kafka_cluster_port", defaultKafkaClusterPort, help)
+ help = fmt.Sprintf("Kafka - Cluster messaging address")
+ flag.StringVar(&(cf.KafkaClusterAddress), "kafka_cluster_address", defaultKafkaClusterAddress, help)
help = fmt.Sprintf("RW Core topic")
flag.StringVar(&(cf.CoreTopic), "rw_core_topic", defaultCoreTopic, help)
@@ -172,11 +148,8 @@
help = fmt.Sprintf("The default timeout when making a kv store request")
flag.DurationVar(&(cf.KVStoreTimeout), "kv_store_request_timeout", defaultKVStoreTimeout, help)
- help = fmt.Sprintf("KV store host")
- flag.StringVar(&(cf.KVStoreHost), "kv_store_host", defaultKVStoreHost, help)
-
- help = fmt.Sprintf("KV store port")
- flag.IntVar(&(cf.KVStorePort), "kv_store_port", defaultKVStorePort, help)
+ help = fmt.Sprintf("KV store address")
+ flag.StringVar(&(cf.KVStoreAddress), "kv_store_address", defaultKVStoreAddress, help)
help = fmt.Sprintf("The time to wait before deleting a completed transaction key")
flag.IntVar(&(cf.KVTxnKeyDelTime), "kv_txn_delete_time", defaultKVTxnKeyDelTime, help)
@@ -214,11 +187,8 @@
help = fmt.Sprintf("The number of seconds between liveness probes while in a not live state")
flag.DurationVar(&(cf.NotLiveProbeInterval), "not_live_probe_interval", defaultNotLiveProbeInterval, help)
- help = fmt.Sprintf("The host on which to listen to answer liveness and readiness probe queries over HTTP.")
- flag.StringVar(&(cf.ProbeHost), "probe_host", defaultProbeHost, help)
-
- help = fmt.Sprintf("The port on which to listen to answer liveness and readiness probe queries over HTTP.")
- flag.IntVar(&(cf.ProbePort), "probe_port", defaultProbePort, help)
+ help = fmt.Sprintf("The address on which to listen to answer liveness and readiness probe queries over HTTP.")
+ flag.StringVar(&(cf.ProbeAddress), "probe_address", defaultProbeAddress, help)
flag.Parse()
}
diff --git a/rw_core/core/api/grpc_nbi_handler_test.go b/rw_core/core/api/grpc_nbi_handler_test.go
index 0fe877e..5801f27 100755
--- a/rw_core/core/api/grpc_nbi_handler_test.go
+++ b/rw_core/core/api/grpc_nbi_handler_test.go
@@ -24,6 +24,7 @@
"os"
"runtime"
"runtime/pprof"
+ "strconv"
"strings"
"sync"
"testing"
@@ -93,26 +94,23 @@
cfg.CoreTopic = "rw_core"
cfg.DefaultRequestTimeout = nb.defaultTimeout
cfg.DefaultCoreTimeout = nb.defaultTimeout
- cfg.KVStorePort = nb.kvClientPort
cfg.InCompetingMode = inCompeteMode
+ cfg.KVStoreAddress = "127.0.0.1" + ":" + strconv.Itoa(nb.kvClientPort)
grpcPort, err := freeport.GetFreePort()
if err != nil {
logger.Fatal("Cannot get a freeport for grpc")
}
- cfg.GrpcPort = grpcPort
- cfg.GrpcHost = "127.0.0.1"
+ cfg.GrpcAddress = "127.0.0.1" + ":" + strconv.Itoa(grpcPort)
setCoreCompeteMode(inCompeteMode)
client := tst.SetupKVClient(cfg, nb.coreInstanceID)
backend := &db.Backend{
Client: client,
StoreType: cfg.KVStoreType,
- Host: cfg.KVStoreHost,
- Port: cfg.KVStorePort,
+ Address: cfg.KVStoreAddress,
Timeout: cfg.KVStoreTimeout,
LivenessChannelInterval: cfg.LiveProbeInterval / 2}
nb.kmp = kafka.NewInterContainerProxy(
- kafka.InterContainerHost(cfg.KafkaAdapterHost),
- kafka.InterContainerPort(cfg.KafkaAdapterPort),
+ kafka.InterContainerAddress(cfg.KafkaAdapterAddress),
kafka.MsgClient(nb.kClient),
kafka.DefaultTopic(&kafka.Topic{Name: cfg.CoreTopic}),
kafka.DeviceDiscoveryTopic(&kafka.Topic{Name: cfg.AffinityRouterTopic}))
diff --git a/rw_core/core/core.go b/rw_core/core/core.go
index 0a76ca2..0cfa915 100644
--- a/rw_core/core/core.go
+++ b/rw_core/core/core.go
@@ -18,7 +18,6 @@
import (
"context"
- "strconv"
"time"
"github.com/opencord/voltha-go/db/model"
@@ -73,14 +72,14 @@
// setup kv client
logger.Debugw("create-kv-client", log.Fields{"kvstore": cf.KVStoreType})
- kvClient, err := newKVClient(cf.KVStoreType, cf.KVStoreHost+":"+strconv.Itoa(cf.KVStorePort), cf.KVStoreTimeout)
+ kvClient, err := newKVClient(cf.KVStoreType, cf.KVStoreAddress, cf.KVStoreTimeout)
if err != nil {
logger.Fatal(err)
}
defer stopKVClient(context.Background(), kvClient)
// sync logging config with kv store
- cm := conf.NewConfigManager(kvClient, cf.KVStoreType, cf.KVStoreHost, cf.KVStorePort, cf.KVStoreTimeout)
+ cm := conf.NewConfigManager(kvClient, cf.KVStoreType, cf.KVStoreAddress, cf.KVStoreTimeout)
go conf.StartLogLevelConfigProcessing(cm, ctx)
backend := cm.Backend
@@ -94,8 +93,7 @@
// create kafka client
kafkaClient := kafka.NewSaramaClient(
- kafka.Host(cf.KafkaAdapterHost),
- kafka.Port(cf.KafkaAdapterPort),
+ kafka.Address(cf.KafkaAdapterAddress),
kafka.ConsumerType(kafka.GroupCustomer),
kafka.ProducerReturnOnErrors(true),
kafka.ProducerReturnOnSuccess(true),
@@ -119,7 +117,7 @@
// connect to kafka, then wait until reachable and publisher/consumer created
// core.kmp must be created before deviceMgr and adapterMgr
- kmp, err := startKafkInterContainerProxy(ctx, kafkaClient, cf.KafkaAdapterHost, cf.KafkaAdapterPort, cf.CoreTopic, cf.AffinityRouterTopic, cf.ConnectionRetryInterval)
+ kmp, err := startKafkInterContainerProxy(ctx, kafkaClient, cf.KafkaAdapterAddress, cf.CoreTopic, cf.AffinityRouterTopic, cf.ConnectionRetryInterval)
if err != nil {
logger.Warn("Failed to setup kafka connection")
return
@@ -135,7 +133,7 @@
registerAdapterRequestHandlers(kmp, deviceMgr, adapterMgr, cf.CoreTopic)
// start gRPC handler
- grpcServer := grpcserver.NewGrpcServer(cf.GrpcHost, cf.GrpcPort, nil, false, probe.GetProbeFromContext(ctx))
+ grpcServer := grpcserver.NewGrpcServer(cf.GrpcAddress, nil, false, probe.GetProbeFromContext(ctx))
go startGRPCService(ctx, grpcServer, api.NewNBIHandler(deviceMgr, logicalDeviceMgr, adapterMgr))
defer grpcServer.Stop()
diff --git a/rw_core/core/device/agent_test.go b/rw_core/core/device/agent_test.go
index cd49681..93277ff 100755
--- a/rw_core/core/device/agent_test.go
+++ b/rw_core/core/device/agent_test.go
@@ -20,6 +20,7 @@
"context"
"math/rand"
"sort"
+ "strconv"
"strings"
"sync"
"testing"
@@ -114,25 +115,22 @@
cfg := config.NewRWCoreFlags()
cfg.CoreTopic = "rw_core"
cfg.DefaultRequestTimeout = dat.defaultTimeout
- cfg.KVStorePort = dat.kvClientPort
+ cfg.KVStoreAddress = "127.0.0.1" + ":" + strconv.Itoa(dat.kvClientPort)
cfg.InCompetingMode = inCompeteMode
grpcPort, err := freeport.GetFreePort()
if err != nil {
logger.Fatal("Cannot get a freeport for grpc")
}
- cfg.GrpcPort = grpcPort
- cfg.GrpcHost = "127.0.0.1"
+ cfg.GrpcAddress = "127.0.0.1" + ":" + strconv.Itoa(grpcPort)
client := tst.SetupKVClient(cfg, dat.coreInstanceID)
backend := &db.Backend{
Client: client,
StoreType: cfg.KVStoreType,
- Host: cfg.KVStoreHost,
- Port: cfg.KVStorePort,
+ Address: cfg.KVStoreAddress,
Timeout: cfg.KVStoreTimeout,
LivenessChannelInterval: cfg.LiveProbeInterval / 2}
dat.kmp = kafka.NewInterContainerProxy(
- kafka.InterContainerHost(cfg.KafkaAdapterHost),
- kafka.InterContainerPort(cfg.KafkaAdapterPort),
+ kafka.InterContainerAddress(cfg.KafkaAdapterAddress),
kafka.MsgClient(dat.kClient),
kafka.DefaultTopic(&kafka.Topic{Name: cfg.CoreTopic}),
kafka.DeviceDiscoveryTopic(&kafka.Topic{Name: cfg.AffinityRouterTopic}))
diff --git a/rw_core/core/device/logical_agent_test.go b/rw_core/core/device/logical_agent_test.go
index 2649ee4..2e1b1d3 100644
--- a/rw_core/core/device/logical_agent_test.go
+++ b/rw_core/core/device/logical_agent_test.go
@@ -18,6 +18,7 @@
import (
"context"
"math/rand"
+ "strconv"
"sync"
"testing"
"time"
@@ -456,25 +457,22 @@
cfg := config.NewRWCoreFlags()
cfg.CoreTopic = "rw_core"
cfg.DefaultRequestTimeout = lda.defaultTimeout
- cfg.KVStorePort = lda.kvClientPort
+ cfg.KVStoreAddress = "127.0.0.1" + ":" + strconv.Itoa(lda.kvClientPort)
cfg.InCompetingMode = inCompeteMode
grpcPort, err := freeport.GetFreePort()
if err != nil {
logger.Fatal("Cannot get a freeport for grpc")
}
- cfg.GrpcPort = grpcPort
- cfg.GrpcHost = "127.0.0.1"
+ cfg.GrpcAddress = "127.0.0.1" + ":" + strconv.Itoa(grpcPort)
client := tst.SetupKVClient(cfg, lda.coreInstanceID)
backend := &db.Backend{
Client: client,
StoreType: cfg.KVStoreType,
- Host: cfg.KVStoreHost,
- Port: cfg.KVStorePort,
+ Address: cfg.KVStoreAddress,
Timeout: cfg.KVStoreTimeout,
LivenessChannelInterval: cfg.LiveProbeInterval / 2}
lda.kmp = kafka.NewInterContainerProxy(
- kafka.InterContainerHost(cfg.KafkaAdapterHost),
- kafka.InterContainerPort(cfg.KafkaAdapterPort),
+ kafka.InterContainerAddress(cfg.KafkaAdapterAddress),
kafka.MsgClient(lda.kClient),
kafka.DefaultTopic(&kafka.Topic{Name: cfg.CoreTopic}),
kafka.DeviceDiscoveryTopic(&kafka.Topic{Name: cfg.AffinityRouterTopic}))
diff --git a/rw_core/core/kafka.go b/rw_core/core/kafka.go
index 18b9ec8..3cb0292 100644
--- a/rw_core/core/kafka.go
+++ b/rw_core/core/kafka.go
@@ -29,15 +29,14 @@
)
// startKafkInterContainerProxy is responsible for starting the Kafka Interadapter Proxy
-func startKafkInterContainerProxy(ctx context.Context, kafkaClient kafka.Client, host string, port int, coreTopic, affinityRouterTopic string, connectionRetryInterval time.Duration) (kafka.InterContainerProxy, error) {
- logger.Infow("initialize-kafka-manager", log.Fields{"host": host, "port": port, "topic": coreTopic})
+func startKafkInterContainerProxy(ctx context.Context, kafkaClient kafka.Client, address string, coreTopic, affinityRouterTopic string, connectionRetryInterval time.Duration) (kafka.InterContainerProxy, error) {
+ logger.Infow("initialize-kafka-manager", log.Fields{"address": address, "topic": coreTopic})
probe.UpdateStatusFromContext(ctx, "message-bus", probe.ServiceStatusPreparing)
// create the kafka RPC proxy
kmp := kafka.NewInterContainerProxy(
- kafka.InterContainerHost(host),
- kafka.InterContainerPort(port),
+ kafka.InterContainerAddress(address),
kafka.MsgClient(kafkaClient),
kafka.DefaultTopic(&kafka.Topic{Name: coreTopic}),
kafka.DeviceDiscoveryTopic(&kafka.Topic{Name: affinityRouterTopic}))
@@ -45,8 +44,8 @@
probe.UpdateStatusFromContext(ctx, "message-bus", probe.ServiceStatusPrepared)
// wait for connectivity
- logger.Infow("starting-kafka-manager", log.Fields{"host": host,
- "port": port, "topic": coreTopic})
+ logger.Infow("starting-kafka-manager", log.Fields{"address": address,
+ "topic": coreTopic})
for {
// If we haven't started yet, then try to start
diff --git a/rw_core/main.go b/rw_core/main.go
index 6884993..ddfb2b1 100644
--- a/rw_core/main.go
+++ b/rw_core/main.go
@@ -136,7 +136,7 @@
* objects there can be a single probe end point for the process.
*/
p := &probe.Probe{}
- go p.ListenAndServe(fmt.Sprintf("%s:%d", cf.ProbeHost, cf.ProbePort))
+ go p.ListenAndServe(cf.ProbeAddress)
// Add the probe to the context to pass to all the services started
probeCtx := context.WithValue(ctx, probe.ProbeContextKey, p)
diff --git a/rw_core/test/utils.go b/rw_core/test/utils.go
index 7d2dda0..b831e4c 100644
--- a/rw_core/test/utils.go
+++ b/rw_core/test/utils.go
@@ -18,7 +18,6 @@
package test
import (
- "strconv"
"testing"
"github.com/opencord/voltha-go/rw_core/config"
@@ -147,8 +146,7 @@
//SetupKVClient creates a new etcd client
func SetupKVClient(cf *config.RWCoreFlags, coreInstanceID string) kvstore.Client {
- addr := cf.KVStoreHost + ":" + strconv.Itoa(cf.KVStorePort)
- client, err := kvstore.NewEtcdClient(addr, cf.KVStoreTimeout, log.FatalLevel)
+ client, err := kvstore.NewEtcdClient(cf.KVStoreAddress, cf.KVStoreTimeout, log.FatalLevel)
if err != nil {
panic("no kv client")
}
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 ef71b07..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
@@ -96,7 +96,7 @@
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
@@ -111,8 +111,7 @@
Backend: &db.Backend{
Client: kvClient,
StoreType: kvStoreType,
- Host: kvStoreHost,
- Port: kvStorePort,
+ Address: kvStoreAddress,
Timeout: kvStoreTimeout,
PathPrefix: kvStorePrefix,
},
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/github.com/opencord/voltha-lib-go/v3/pkg/grpc/server.go b/vendor/github.com/opencord/voltha-lib-go/v3/pkg/grpc/server.go
index 43f2912..fa5c521 100644
--- a/vendor/github.com/opencord/voltha-lib-go/v3/pkg/grpc/server.go
+++ b/vendor/github.com/opencord/voltha-lib-go/v3/pkg/grpc/server.go
@@ -17,7 +17,6 @@
import (
"context"
- "fmt"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/credentials"
@@ -62,7 +61,6 @@
type GrpcServer struct {
gs *grpc.Server
address string
- port int
secure bool
services []func(*grpc.Server)
probe ReadyProbe // optional
@@ -75,14 +73,12 @@
*/
func NewGrpcServer(
address string,
- port int,
certs *GrpcSecurity,
secure bool,
probe ReadyProbe,
) *GrpcServer {
server := &GrpcServer{
address: address,
- port: port,
secure: secure,
GrpcSecurity: certs,
probe: probe,
@@ -95,9 +91,7 @@
*/
func (s *GrpcServer) Start(ctx context.Context) {
- host := fmt.Sprintf("%s:%d", s.address, s.port)
-
- lis, err := net.Listen("tcp", host)
+ lis, err := net.Listen("tcp", s.address)
if err != nil {
logger.Fatalf("failed to listen: %v", err)
}
diff --git a/vendor/github.com/opencord/voltha-lib-go/v3/pkg/kafka/client.go b/vendor/github.com/opencord/voltha-lib-go/v3/pkg/kafka/client.go
index 0919a0c..0d9e3a5 100644
--- a/vendor/github.com/opencord/voltha-lib-go/v3/pkg/kafka/client.go
+++ b/vendor/github.com/opencord/voltha-lib-go/v3/pkg/kafka/client.go
@@ -39,6 +39,7 @@
const (
DefaultKafkaHost = "127.0.0.1"
DefaultKafkaPort = 9092
+ DefaultKafkaAddress = DefaultKafkaHost + ":" + string(DefaultKafkaPort)
DefaultGroupName = "voltha"
DefaultSleepOnError = 1
DefaultProducerFlushFrequency = 10
diff --git a/vendor/github.com/opencord/voltha-lib-go/v3/pkg/kafka/kafka_inter_container_library.go b/vendor/github.com/opencord/voltha-lib-go/v3/pkg/kafka/kafka_inter_container_library.go
index beda537..9f9fbfc 100644
--- a/vendor/github.com/opencord/voltha-lib-go/v3/pkg/kafka/kafka_inter_container_library.go
+++ b/vendor/github.com/opencord/voltha-lib-go/v3/pkg/kafka/kafka_inter_container_library.go
@@ -79,8 +79,7 @@
// interContainerProxy represents the messaging proxy
type interContainerProxy struct {
- kafkaHost string
- kafkaPort int
+ kafkaAddress string
defaultTopic *Topic
defaultRequestHandlerInterface interface{}
deviceDiscoveryTopic *Topic
@@ -107,15 +106,9 @@
type InterContainerProxyOption func(*interContainerProxy)
-func InterContainerHost(host string) InterContainerProxyOption {
+func InterContainerAddress(address string) InterContainerProxyOption {
return func(args *interContainerProxy) {
- args.kafkaHost = host
- }
-}
-
-func InterContainerPort(port int) InterContainerProxyOption {
- return func(args *interContainerProxy) {
- args.kafkaPort = port
+ args.kafkaAddress = address
}
}
@@ -145,9 +138,8 @@
func newInterContainerProxy(opts ...InterContainerProxyOption) *interContainerProxy {
proxy := &interContainerProxy{
- kafkaHost: DefaultKafkaHost,
- kafkaPort: DefaultKafkaPort,
- doneCh: make(chan struct{}),
+ kafkaAddress: DefaultKafkaAddress,
+ doneCh: make(chan struct{}),
}
for _, option := range opts {
diff --git a/vendor/github.com/opencord/voltha-lib-go/v3/pkg/kafka/sarama_client.go b/vendor/github.com/opencord/voltha-lib-go/v3/pkg/kafka/sarama_client.go
index 468e546..581cf49 100644
--- a/vendor/github.com/opencord/voltha-lib-go/v3/pkg/kafka/sarama_client.go
+++ b/vendor/github.com/opencord/voltha-lib-go/v3/pkg/kafka/sarama_client.go
@@ -47,8 +47,7 @@
// SaramaClient represents the messaging proxy
type SaramaClient struct {
cAdmin sarama.ClusterAdmin
- KafkaHost string
- KafkaPort int
+ KafkaAddress string
producer sarama.AsyncProducer
consumer sarama.Consumer
groupConsumers map[string]*scc.Consumer
@@ -86,15 +85,9 @@
type SaramaClientOption func(*SaramaClient)
-func Host(host string) SaramaClientOption {
+func Address(address string) SaramaClientOption {
return func(args *SaramaClient) {
- args.KafkaHost = host
- }
-}
-
-func Port(port int) SaramaClientOption {
- return func(args *SaramaClient) {
- args.KafkaPort = port
+ args.KafkaAddress = address
}
}
@@ -202,8 +195,7 @@
func NewSaramaClient(opts ...SaramaClientOption) *SaramaClient {
client := &SaramaClient{
- KafkaHost: DefaultKafkaHost,
- KafkaPort: DefaultKafkaPort,
+ KafkaAddress: DefaultKafkaAddress,
}
client.consumerType = DefaultConsumerType
client.producerFlushFrequency = DefaultProducerFlushFrequency
@@ -695,15 +687,14 @@
}
func (sc *SaramaClient) createClusterAdmin() error {
- kafkaFullAddr := fmt.Sprintf("%s:%d", sc.KafkaHost, sc.KafkaPort)
config := sarama.NewConfig()
config.Version = sarama.V1_0_0_0
// Create a cluster Admin
var cAdmin sarama.ClusterAdmin
var err error
- if cAdmin, err = sarama.NewClusterAdmin([]string{kafkaFullAddr}, config); err != nil {
- logger.Errorw("cluster-admin-failure", log.Fields{"error": err, "broker-address": kafkaFullAddr})
+ if cAdmin, err = sarama.NewClusterAdmin([]string{sc.KafkaAddress}, config); err != nil {
+ logger.Errorw("cluster-admin-failure", log.Fields{"error": err, "broker-address": sc.KafkaAddress})
return err
}
sc.cAdmin = cAdmin
@@ -841,8 +832,7 @@
//config.Producer.RequiredAcks = sarama.WaitForAll
config.Producer.RequiredAcks = sarama.WaitForLocal
- kafkaFullAddr := fmt.Sprintf("%s:%d", sc.KafkaHost, sc.KafkaPort)
- brokers := []string{kafkaFullAddr}
+ brokers := []string{sc.KafkaAddress}
if producer, err := sarama.NewAsyncProducer(brokers, config); err != nil {
logger.Errorw("error-starting-publisher", log.Fields{"error": err})
@@ -862,8 +852,7 @@
config.Consumer.MaxProcessingTime = time.Duration(sc.maxProcessingTime) * time.Millisecond
config.Consumer.Offsets.Initial = sarama.OffsetNewest
config.Metadata.Retry.Max = sc.metadataMaxRetry
- kafkaFullAddr := fmt.Sprintf("%s:%d", sc.KafkaHost, sc.KafkaPort)
- brokers := []string{kafkaFullAddr}
+ brokers := []string{sc.KafkaAddress}
if consumer, err := sarama.NewConsumer(brokers, config); err != nil {
logger.Errorw("error-starting-consumers", log.Fields{"error": err})
@@ -887,8 +876,7 @@
//config.Consumer.MaxProcessingTime = time.Duration(DefaultMaxProcessingTime) * time.Millisecond
config.Consumer.Offsets.Initial = initialOffset
//config.Consumer.Offsets.Initial = sarama.OffsetOldest
- kafkaFullAddr := fmt.Sprintf("%s:%d", sc.KafkaHost, sc.KafkaPort)
- brokers := []string{kafkaFullAddr}
+ brokers := []string{sc.KafkaAddress}
topics := []string{topic.Name}
var consumer *scc.Consumer
diff --git a/vendor/modules.txt b/vendor/modules.txt
index 518c70f..2470123 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -99,7 +99,7 @@
github.com/modern-go/concurrent
# github.com/modern-go/reflect2 v1.0.1
github.com/modern-go/reflect2
-# github.com/opencord/voltha-lib-go/v3 v3.1.12
+# github.com/opencord/voltha-lib-go/v3 v3.1.13
github.com/opencord/voltha-lib-go/v3/pkg/adapters
github.com/opencord/voltha-lib-go/v3/pkg/adapters/adapterif
github.com/opencord/voltha-lib-go/v3/pkg/adapters/common