import (
"encoding/json"
"fmt"
+ "strconv"
+
"gerrit.o-ran-sc.org/r/ric-plt/e2ap/pkg/e2ap"
sdl "gerrit.o-ran-sc.org/r/ric-plt/sdlgo"
"gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/xapp"
- "strconv"
)
type SubscriptionInfo struct {
}
func CreateSdl() Sdlnterface {
- return sdl.NewSdlInstance("submgr", sdl.NewDatabase())
+ return sdl.NewSdlInstance("submgr_e2SubsDb", sdl.NewDatabase())
}
func (c *Control) WriteSubscriptionToSdl(subId uint32, subs *Subscription) error {
return fmt.Errorf("SDL: WriteSubscriptionToSdl() json.Marshal error: %s", err.Error())
}
- if err = c.db.Set(strconv.FormatUint(uint64(subId), 10), jsonData); err != nil {
+ if err = c.e2SubsDb.Set(strconv.FormatUint(uint64(subId), 10), jsonData); err != nil {
c.UpdateCounter(cSDLWriteFailure)
return fmt.Errorf("SDL: WriteSubscriptionToSdl(): %s", err.Error())
} else {
- xapp.Logger.Debug("SDL: Subscription written in db. subId = %v", subId)
+ xapp.Logger.Debug("SDL: Subscription written in e2SubsDb. subId = %v", subId)
}
return nil
}
// This function is now just for testing purpose
key := strconv.FormatUint(uint64(subId), 10)
- retMap, err := c.db.Get([]string{key})
+ retMap, err := c.e2SubsDb.Get([]string{key})
if err != nil {
c.UpdateCounter(cSDLReadFailure)
return nil, fmt.Errorf("SDL: ReadSubscriptionFromSdl(): %s", err.Error())
} else {
- xapp.Logger.Debug("SDL: Subscription read from db. subId = %v", subId)
+ xapp.Logger.Debug("SDL: Subscription read from e2SubsDb. subId = %v", subId)
}
subs := &Subscription{}
func (c *Control) RemoveSubscriptionFromSdl(subId uint32) error {
key := strconv.FormatUint(uint64(subId), 10)
- if err := c.db.Remove([]string{key}); err != nil {
+ if err := c.e2SubsDb.Remove([]string{key}); err != nil {
return fmt.Errorf("SDL: RemoveSubscriptionfromSdl(): %s\n", err.Error())
} else {
- xapp.Logger.Debug("SDL: Subscription removed from db. subId = %v", subId)
+ xapp.Logger.Debug("SDL: Subscription removed from e2SubsDb. subId = %v", subId)
}
return nil
}
retMap := make(map[uint32]*Subscription)
// Get all keys
- keys, err := c.db.GetAll()
+ keys, err := c.e2SubsDb.GetAll()
if err != nil {
c.UpdateCounter(cSDLReadFailure)
- return nil, nil, fmt.Errorf("SDL: ReadAllSubscriptionsFromSdl(), GetAll(). Error while reading keys from DBAAS %s\n", err.Error())
+ return nil, nil, fmt.Errorf("SDL: ReadAllSubscriptionsFromSdl(), GetAll(). Error while reading E2 subscriptions keys from DBAAS %s\n", err.Error())
}
if len(keys) == 0 {
}
// Get all subscriptionInfos
- iSubscriptionMap, err := c.db.Get(keys)
+ iSubscriptionMap, err := c.e2SubsDb.Get(keys)
if err != nil {
c.UpdateCounter(cSDLReadFailure)
- return nil, nil, fmt.Errorf("SDL: ReadAllSubscriptionsFromSdl(), Get(): Error while reading subscriptions from DBAAS %s\n", err.Error())
+ return nil, nil, fmt.Errorf("SDL: ReadAllSubscriptionsFromSdl(), Get(): Error while reading E2 subscriptions from DBAAS %s\n", err.Error())
}
for _, iSubscriptionInfo := range iSubscriptionMap {
}
func (c *Control) RemoveAllSubscriptionsFromSdl() error {
- if err := c.db.RemoveAll(); err != nil {
+ if err := c.e2SubsDb.RemoveAll(); err != nil {
c.UpdateCounter(cSDLRemoveFailure)
return fmt.Errorf("SDL: RemoveAllSubscriptionsFromSdl(): %s\n", err.Error())
} else {
- xapp.Logger.Debug("SDL: All subscriptions removed from db")
+ xapp.Logger.Debug("SDL: All subscriptions removed from e2SubsDb")
}
return nil
}