[VOL-2736]host and port should be specified as a single argument not as two separate arguments
Change-Id: I312fe753ac0fe62c942f335371e6449809ecfb85
diff --git a/pkg/techprofile/config.go b/pkg/techprofile/config.go
index 8a304be..fe3e4a2 100644
--- a/pkg/techprofile/config.go
+++ b/pkg/techprofile/config.go
@@ -76,8 +76,7 @@
// TechprofileFlags represents the set of configurations used
type TechProfileFlags struct {
- KVStoreHost string
- KVStorePort int
+ KVStoreAddress string
KVStoreType string
KVStoreTimeout time.Duration
KVBackend *db.Backend
@@ -93,12 +92,11 @@
DefaultNumGemPorts uint32
}
-func NewTechProfileFlags(KVStoreType string, KVStoreHost string, KVStorePort int) *TechProfileFlags {
+func NewTechProfileFlags(KVStoreType string, KVStoreAddress string) *TechProfileFlags {
// initialize with default values
var techProfileFlags = TechProfileFlags{
KVBackend: nil,
- KVStoreHost: KVStoreHost,
- KVStorePort: KVStorePort,
+ KVStoreAddress: KVStoreAddress,
KVStoreType: KVStoreType,
KVStoreTimeout: defaultKVStoreTimeout,
DefaultTPName: defaultTechProfileName,
diff --git a/pkg/techprofile/tech_profile.go b/pkg/techprofile/tech_profile.go
index 00208d6..afe5c09 100644
--- a/pkg/techprofile/tech_profile.go
+++ b/pkg/techprofile/tech_profile.go
@@ -243,12 +243,11 @@
}
func (t *TechProfileMgr) SetKVClient() *db.Backend {
- addr := t.config.KVStoreHost + ":" + strconv.Itoa(t.config.KVStorePort)
- kvClient, err := newKVClient(t.config.KVStoreType, addr, t.config.KVStoreTimeout)
+ kvClient, err := newKVClient(t.config.KVStoreType, t.config.KVStoreAddress, t.config.KVStoreTimeout)
if err != nil {
logger.Errorw("failed-to-create-kv-client",
log.Fields{
- "type": t.config.KVStoreType, "host": t.config.KVStoreHost, "port": t.config.KVStorePort,
+ "type": t.config.KVStoreType, "address": t.config.KVStoreAddress,
"timeout": t.config.KVStoreTimeout, "prefix": t.config.TPKVPathPrefix,
"error": err.Error(),
})
@@ -257,8 +256,7 @@
return &db.Backend{
Client: kvClient,
StoreType: t.config.KVStoreType,
- Host: t.config.KVStoreHost,
- Port: t.config.KVStorePort,
+ Address: t.config.KVStoreAddress,
Timeout: t.config.KVStoreTimeout,
PathPrefix: t.config.TPKVPathPrefix}
@@ -281,10 +279,10 @@
return nil, errors.New("unsupported-kv-store")
}
-func NewTechProfile(resourceMgr iPonResourceMgr, KVStoreType string, KVStoreHost string, KVStorePort int) (*TechProfileMgr, error) {
+func NewTechProfile(resourceMgr iPonResourceMgr, KVStoreType string, KVStoreAddress string) (*TechProfileMgr, error) {
var techprofileObj TechProfileMgr
logger.Debug("Initializing techprofile Manager")
- techprofileObj.config = NewTechProfileFlags(KVStoreType, KVStoreHost, KVStorePort)
+ techprofileObj.config = NewTechProfileFlags(KVStoreType, KVStoreAddress)
techprofileObj.config.KVBackend = techprofileObj.SetKVClient()
if techprofileObj.config.KVBackend == nil {
logger.Error("Failed to initialize KV backend\n")