VOL-4154: Changes to techprofile module for etcd storage improvements.
- using protobuf definitions of techprofile template and instance
- store smaller footprint resource instance on the kv store
- store techprofile instance in cache
- reconcile techprofile instance from resource instance on adapter restart
- retry etcd get/put/delete on failure
- remove dealing of onu-gem-info data from PONResourceManager module
as adapter has to deal with this.
Change-Id: I741181e3f0dc5c4a419ffbed577eb4d21b73c4d6
diff --git a/pkg/techprofile/config.go b/pkg/techprofile/config.go
index 438ea4a..d13a876 100644
--- a/pkg/techprofile/config.go
+++ b/pkg/techprofile/config.go
@@ -17,7 +17,7 @@
import (
"fmt"
- "github.com/opencord/voltha-lib-go/v4/pkg/db"
+ "github.com/opencord/voltha-lib-go/v5/pkg/db"
"time"
)
@@ -39,12 +39,12 @@
// Tech profile path prefix in kv store (for TP instances)
defaultKVPathPrefix = "%s/technology_profiles"
+ // Resource instance path prefix in KV store (for Resource Instances)
+ defaultResourceInstancePathPrefix = "%s/resource_instances"
+
// Tech profile path in kv store
defaultTechProfileKVPath = "%s/%d" // <technology>/<tech_profile_tableID>
- // Tech profile instance path in kv store
- // Format: <technology>/<tech_profile_tableID>/<uni_port_name>
- defaultTPInstanceKVPath = "%s/%d/%s"
)
//Tech-Profile JSON String Keys
@@ -98,41 +98,42 @@
// TechprofileFlags represents the set of configurations used
type TechProfileFlags struct {
- KVStoreAddress string
- KVStoreType string
- KVStoreTimeout time.Duration
- KVBackend *db.Backend // this is the backend used to store TP instances
- DefaultTpKVBackend *db.Backend // this is the backend used to read the TP profile
- TPKVPathPrefix string
- defaultTpKvPathPrefix string
- TPFileKVPath string
- TPInstanceKVPath string
- DefaultTPName string
- TPVersion int
- NumGemPorts uint32
- DefaultPbits []string
- LogLevel int
- DefaultTechProfileID uint32
- DefaultNumGemPorts uint32
+ KVStoreAddress string
+ KVStoreType string
+ KVStoreTimeout time.Duration
+ KVBackend *db.Backend // this is the backend used to store TP instances
+ DefaultTpKVBackend *db.Backend // this is the backend used to read the TP profile
+ ResourceInstanceKVBacked *db.Backend // this is the backed used to read/write Resource Instances
+ TPKVPathPrefix string
+ defaultTpKvPathPrefix string
+ TPFileKVPath string
+ ResourceInstanceKVPathPrefix string
+ DefaultTPName string
+ TPVersion uint32
+ NumGemPorts uint32
+ DefaultPbits []string
+ LogLevel int
+ DefaultTechProfileID uint32
+ DefaultNumGemPorts uint32
}
func NewTechProfileFlags(KVStoreType string, KVStoreAddress string, basePathKvStore string) *TechProfileFlags {
// initialize with default values
var techProfileFlags = TechProfileFlags{
- KVBackend: nil,
- KVStoreAddress: KVStoreAddress,
- KVStoreType: KVStoreType,
- KVStoreTimeout: defaultKVStoreTimeout,
- DefaultTPName: defaultTechProfileName,
- TPKVPathPrefix: fmt.Sprintf(defaultKVPathPrefix, basePathKvStore),
- defaultTpKvPathPrefix: defaultTpKvPathPrefix,
- TPVersion: defaultVersion,
- TPFileKVPath: defaultTechProfileKVPath,
- TPInstanceKVPath: defaultTPInstanceKVPath,
- DefaultTechProfileID: DEFAULT_TECH_PROFILE_TABLE_ID,
- DefaultNumGemPorts: defaultGemportsCount,
- DefaultPbits: []string{defaultPbits},
- LogLevel: defaultLogLevel,
+ KVBackend: nil,
+ KVStoreAddress: KVStoreAddress,
+ KVStoreType: KVStoreType,
+ KVStoreTimeout: defaultKVStoreTimeout,
+ DefaultTPName: defaultTechProfileName,
+ TPKVPathPrefix: fmt.Sprintf(defaultKVPathPrefix, basePathKvStore),
+ defaultTpKvPathPrefix: defaultTpKvPathPrefix,
+ TPVersion: defaultVersion,
+ TPFileKVPath: defaultTechProfileKVPath,
+ ResourceInstanceKVPathPrefix: fmt.Sprintf(defaultResourceInstancePathPrefix, basePathKvStore),
+ DefaultTechProfileID: DEFAULT_TECH_PROFILE_TABLE_ID,
+ DefaultNumGemPorts: defaultGemportsCount,
+ DefaultPbits: []string{defaultPbits},
+ LogLevel: defaultLogLevel,
}
return &techProfileFlags