[VOL-2736]:host and port should be specified as a single argument not as two separate arguments
Change-Id: I14b59b4e42b1cf0821807cdb3dd6eef2094077da
diff --git a/internal/pkg/core/device_handler.go b/internal/pkg/core/device_handler.go
index 212e096..39775a0 100644
--- a/internal/pkg/core/device_handler.go
+++ b/internal/pkg/core/device_handler.go
@@ -712,9 +712,8 @@
if err != nil {
return olterrors.NewErrAdapter("populate-device-info-failed", log.Fields{"device-id": dh.device.Id}, err)
}
- KVStoreHostPort := fmt.Sprintf("%s:%d", dh.openOLT.KVStoreHost, dh.openOLT.KVStorePort)
// Instantiate resource manager
- if dh.resourceMgr = rsrcMgr.NewResourceMgr(ctx, dh.device.Id, KVStoreHostPort, dh.openOLT.KVStoreType, dh.device.Type, deviceInfo); dh.resourceMgr == nil {
+ if dh.resourceMgr = rsrcMgr.NewResourceMgr(ctx, dh.device.Id, dh.openOLT.KVStoreAddress, dh.openOLT.KVStoreType, dh.device.Type, deviceInfo); dh.resourceMgr == nil {
return olterrors.ErrResourceManagerInstantiating
}
diff --git a/internal/pkg/core/openolt.go b/internal/pkg/core/openolt.go
index 354382a..36a609e 100644
--- a/internal/pkg/core/openolt.go
+++ b/internal/pkg/core/openolt.go
@@ -41,8 +41,7 @@
kafkaICProxy kafka.InterContainerProxy
config *config.AdapterFlags
numOnus int
- KVStoreHost string
- KVStorePort int
+ KVStoreAddress string
KVStoreType string
exitChannel chan int
HeartbeatCheckInterval time.Duration
@@ -64,8 +63,7 @@
openOLT.coreProxy = coreProxy
openOLT.adapterProxy = adapterProxy
openOLT.eventProxy = eventProxy
- openOLT.KVStoreHost = cfg.KVStoreHost
- openOLT.KVStorePort = cfg.KVStorePort
+ openOLT.KVStoreAddress = cfg.KVStoreAddress
openOLT.KVStoreType = cfg.KVStoreType
openOLT.HeartbeatCheckInterval = cfg.HeartbeatCheckInterval
openOLT.HeartbeatFailReportInterval = cfg.HeartbeatFailReportInterval
diff --git a/internal/pkg/core/openolt_test.go b/internal/pkg/core/openolt_test.go
index 9c9094f..704c0b5 100644
--- a/internal/pkg/core/openolt_test.go
+++ b/internal/pkg/core/openolt_test.go
@@ -48,8 +48,7 @@
eventProxy *com.EventProxy
kafkaICProxy kafka.InterContainerProxy
numOnus int
- KVStoreHost string
- KVStorePort int
+ KVStoreAddress string
KVStoreType string
exitChannel chan int
lockDeviceHandlersMap sync.RWMutex
@@ -74,8 +73,7 @@
eventProxy: testOlt.eventProxy,
kafkaICProxy: testOlt.kafkaICProxy,
numOnus: testOlt.numOnus,
- KVStoreHost: testOlt.KVStoreHost,
- KVStorePort: testOlt.KVStorePort,
+ KVStoreAddress: testOlt.KVStoreAddress,
KVStoreType: testOlt.KVStoreType,
exitChannel: testOlt.exitChannel,
}
@@ -109,12 +107,12 @@
configFlags *config.AdapterFlags
want *OpenOLT
}{
- {"newopenolt-1", &fields{}, &config.AdapterFlags{OnuNumber: 1, KVStorePort: 1, KVStoreType: "consul", KVStoreHost: "1.1.1.1"},
- &OpenOLT{numOnus: 1, KVStorePort: 1, KVStoreType: "consul", KVStoreHost: "1.1.1.1"}},
- {"newopenolt-2", &fields{}, &config.AdapterFlags{OnuNumber: 2, KVStorePort: 2, KVStoreType: "etcd", KVStoreHost: "2.2.2.2"},
- &OpenOLT{numOnus: 2, KVStorePort: 2, KVStoreType: "etcd", KVStoreHost: "2.2.2.2"}},
- {"newopenolt-3", &fields{}, &config.AdapterFlags{OnuNumber: 3, KVStorePort: 3, KVStoreType: "consul", KVStoreHost: "3.3.3.3"},
- &OpenOLT{numOnus: 3, KVStorePort: 3, KVStoreType: "consul", KVStoreHost: "3.3.3.3"}},
+ {"newopenolt-1", &fields{}, &config.AdapterFlags{OnuNumber: 1, KVStoreAddress: "1.1.1.1:1", KVStoreType: "consul"},
+ &OpenOLT{numOnus: 1, KVStoreAddress: "1.1.1.1:1", KVStoreType: "consul"}},
+ {"newopenolt-2", &fields{}, &config.AdapterFlags{OnuNumber: 2, KVStoreAddress: "2.2.2.2:2", KVStoreType: "etcd"},
+ &OpenOLT{numOnus: 2, KVStoreAddress: "2.2.2.2:2", KVStoreType: "etcd"}},
+ {"newopenolt-3", &fields{}, &config.AdapterFlags{OnuNumber: 3, KVStoreAddress: "3.3.3.3:3", KVStoreType: "consul"},
+ &OpenOLT{numOnus: 3, KVStoreAddress: "3.3.3.3:3", KVStoreType: "consul"}},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {