[VOL-3624] Templatizing the technology_profile path
Change-Id: I40f9041901a60efb8b9872612b21ee1b0cad82ef
diff --git a/VERSION b/VERSION
index 1454f6e..4d54dad 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-4.0.1
+4.0.2
diff --git a/pkg/ponresourcemanager/ponresourcemanager.go b/pkg/ponresourcemanager/ponresourcemanager.go
index b4c2fec..408936b 100755
--- a/pkg/ponresourcemanager/ponresourcemanager.go
+++ b/pkg/ponresourcemanager/ponresourcemanager.go
@@ -213,7 +213,7 @@
return nil, errors.New("Failed to init KV Config client")
}
// Initialize techprofile for this technology
- if PONMgr.TechProfileMgr, _ = tp.NewTechProfile(ctx, &PONMgr, Backend, Address); PONMgr.TechProfileMgr == nil {
+ if PONMgr.TechProfileMgr, _ = tp.NewTechProfile(ctx, &PONMgr, Backend, Address, basePathKvStore); PONMgr.TechProfileMgr == nil {
logger.Error(ctx, "Techprofile initialization failed")
return nil, errors.New("Failed to init tech profile")
}
diff --git a/pkg/techprofile/config.go b/pkg/techprofile/config.go
index bcec75e..07926c5 100644
--- a/pkg/techprofile/config.go
+++ b/pkg/techprofile/config.go
@@ -16,6 +16,7 @@
package techprofile
import (
+ "fmt"
"github.com/opencord/voltha-lib-go/v4/pkg/db"
"time"
)
@@ -32,7 +33,7 @@
defaultKVStoreTimeout = 5 * time.Second //in seconds
// Tech profile path prefix in kv store
- defaultKVPathPrefix = "service/voltha/technology_profiles"
+ defaultKVPathPrefix = "%s/technology_profiles"
// Tech profile path in kv store
defaultTechProfileKVPath = "%s/%d" // <technology>/<tech_profile_tableID>
@@ -109,7 +110,7 @@
DefaultNumGemPorts uint32
}
-func NewTechProfileFlags(KVStoreType string, KVStoreAddress string) *TechProfileFlags {
+func NewTechProfileFlags(KVStoreType string, KVStoreAddress string, basePathKvStore string) *TechProfileFlags {
// initialize with default values
var techProfileFlags = TechProfileFlags{
KVBackend: nil,
@@ -117,7 +118,7 @@
KVStoreType: KVStoreType,
KVStoreTimeout: defaultKVStoreTimeout,
DefaultTPName: defaultTechProfileName,
- TPKVPathPrefix: defaultKVPathPrefix,
+ TPKVPathPrefix: fmt.Sprintf(defaultKVPathPrefix, basePathKvStore),
TPVersion: defaultVersion,
TPFileKVPath: defaultTechProfileKVPath,
TPInstanceKVPath: defaultTPInstanceKVPath,
diff --git a/pkg/techprofile/tech_profile.go b/pkg/techprofile/tech_profile.go
index b80f136..c066542 100644
--- a/pkg/techprofile/tech_profile.go
+++ b/pkg/techprofile/tech_profile.go
@@ -419,10 +419,10 @@
return nil, errors.New("unsupported-kv-store")
}
-func NewTechProfile(ctx context.Context, resourceMgr iPonResourceMgr, KVStoreType string, KVStoreAddress string) (*TechProfileMgr, error) {
+func NewTechProfile(ctx context.Context, resourceMgr iPonResourceMgr, KVStoreType string, KVStoreAddress string, basePathKvStore string) (*TechProfileMgr, error) {
var techprofileObj TechProfileMgr
logger.Debug(ctx, "Initializing techprofile Manager")
- techprofileObj.config = NewTechProfileFlags(KVStoreType, KVStoreAddress)
+ techprofileObj.config = NewTechProfileFlags(KVStoreType, KVStoreAddress, basePathKvStore)
techprofileObj.config.KVBackend = techprofileObj.SetKVClient(ctx)
if techprofileObj.config.KVBackend == nil {
logger.Error(ctx, "Failed to initialize KV backend\n")