[VOL-5359] Add redis option as KVStore
Change-Id: I5c2c837162685e45a50f8a4bef73bcf723a11f48
Signed-off-by: Abhay Kumar <abhayk@radisys.com>
diff --git a/VERSION b/VERSION
index a950b04..6295798 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-4.5.2-dev1
+4.5.2-dev2
diff --git a/cmd/openolt-adapter/main.go b/cmd/openolt-adapter/main.go
index 6b5b42a..be2c534 100644
--- a/cmd/openolt-adapter/main.go
+++ b/cmd/openolt-adapter/main.go
@@ -21,13 +21,14 @@
"context"
"errors"
"fmt"
- grpc_retry "github.com/grpc-ecosystem/go-grpc-middleware/retry"
- codes "google.golang.org/grpc/codes"
"os"
"os/signal"
"syscall"
"time"
+ grpc_retry "github.com/grpc-ecosystem/go-grpc-middleware/retry"
+ codes "google.golang.org/grpc/codes"
+
conf "github.com/opencord/voltha-lib-go/v7/pkg/config"
"github.com/opencord/voltha-lib-go/v7/pkg/db/kvstore"
"github.com/opencord/voltha-lib-go/v7/pkg/events"
@@ -303,6 +304,10 @@
switch storeType {
case "etcd":
return kvstore.NewEtcdClient(ctx, address, timeout, log.FatalLevel)
+ case "redis":
+ return kvstore.NewRedisClient(address, timeout, false)
+ case "redis-sentinel":
+ return kvstore.NewRedisClient(address, timeout, true)
}
return nil, errors.New("unsupported-kv-store")
}
diff --git a/internal/pkg/config/config.go b/internal/pkg/config/config.go
index 209247c..abd3617 100644
--- a/internal/pkg/config/config.go
+++ b/internal/pkg/config/config.go
@@ -25,10 +25,10 @@
// Open OLT default constants
const (
- EtcdStoreName = "etcd"
+ KVStoreName = "etcd"
defaultInstanceid = "openOlt001"
defaultKafkaclusteraddress = "127.0.0.1:9092"
- defaultKvstoretype = EtcdStoreName
+ defaultKvstoretype = KVStoreName
defaultKvstoretimeout = 5 * time.Second
defaultRPCTimeout = 10 * time.Second
defaultPerRPCRetryTimeout = 2 * time.Second
diff --git a/internal/pkg/core/device_handler.go b/internal/pkg/core/device_handler.go
index e46999c..48eff8d 100755
--- a/internal/pkg/core/device_handler.go
+++ b/internal/pkg/core/device_handler.go
@@ -244,6 +244,10 @@
switch storeType {
case "etcd":
return kvstore.NewEtcdClient(ctx, address, timeout, log.FatalLevel)
+ case "redis":
+ return kvstore.NewRedisClient(address, timeout, false)
+ case "redis-sentinel":
+ return kvstore.NewRedisClient(address, timeout, true)
}
return nil, errors.New("unsupported-kv-store")
}
diff --git a/internal/pkg/resourcemanager/resourcemanager.go b/internal/pkg/resourcemanager/resourcemanager.go
index f51737f..3fde9e0 100755
--- a/internal/pkg/resourcemanager/resourcemanager.go
+++ b/internal/pkg/resourcemanager/resourcemanager.go
@@ -173,6 +173,10 @@
switch storeType {
case "etcd":
return kvstore.NewEtcdClient(ctx, address, timeout, log.FatalLevel)
+ case "redis":
+ return kvstore.NewRedisClient(address, timeout, false)
+ case "redis-sentinel":
+ return kvstore.NewRedisClient(address, timeout, true)
}
return nil, errors.New("unsupported-kv-store")
}