[VOL-5402]-VGC all fixes till date from jan 2024
Change-Id: I2857e0ef9b1829a28c6e3ad04da96b826cb900b6
Signed-off-by: Akash Soni <akash.soni@radisys.com>
diff --git a/database/database.go b/database/database.go
index 0178a07..c3ad13f 100644
--- a/database/database.go
+++ b/database/database.go
@@ -40,6 +40,10 @@
"github.com/opencord/voltha-lib-go/v7/pkg/db/kvstore"
)
+const (
+ PonPort = "/pon-port/"
+)
+
var logger log.CLogger
// Database structure
@@ -748,7 +752,7 @@
// PutNbDevicePort to add device port info
func (db *Database) PutNbDevicePort(ctx context.Context, device string, ponPortID uint32, value string) {
- key := GetKeyPath(NbDevicePath) + device + "/pon-port/" + fmt.Sprintf("%v", ponPortID)
+ key := GetKeyPath(NbDevicePath) + device + PonPort + fmt.Sprintf("%v", ponPortID)
if err := db.kvc.Put(ctx, key, value); err != nil {
logger.Warnw(ctx, "Put Device Port failed", log.Fields{"key": key})
@@ -774,7 +778,7 @@
// DelNbDevicePort to delete device port
func (db *Database) DelNbDevicePort(ctx context.Context, device string, ponPortID uint32) {
- key := GetKeyPath(NbDevicePath) + device + "/pon-port/" + fmt.Sprintf("%v", ponPortID)
+ key := GetKeyPath(NbDevicePath) + device + PonPort + fmt.Sprintf("%v", ponPortID)
if err := db.kvc.Delete(ctx, key); err != nil {
logger.Warnw(ctx, "Delete Device Port failed", log.Fields{"key": key})
@@ -783,7 +787,7 @@
// GetAllNbPorts to get all ports info
func (db *Database) GetAllNbPorts(ctx context.Context, deviceID string) (map[string]*kvstore.KVPair, error) {
- key := GetKeyPath(NbDevicePath) + deviceID + "/pon-port/"
+ key := GetKeyPath(NbDevicePath) + deviceID + PonPort
return db.List(ctx, key)
}