package rNibWriter
import (
+ "encoding/json"
"fmt"
"gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/common"
"gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities"
"github.com/golang/protobuf/proto"
)
+const E2TAddressesKey = "E2TAddresses"
+
type rNibWriterInstance struct {
sdl common.ISdlInstance
}
SaveNodeb(nbIdentity *entities.NbIdentity, nb *entities.NodebInfo) error
UpdateNodebInfo(nodebInfo *entities.NodebInfo) error
SaveRanLoadInformation(inventoryName string, ranLoadInformation *entities.RanLoadInformation) error
+ SaveE2TInstance(e2tInstance *entities.E2TInstance) error
+ SaveE2TAddresses(addresses []string) error
}
/*
return nil
}
+func (w *rNibWriterInstance) SaveE2TInstance(e2tInstance *entities.E2TInstance) error {
+
+ key, rnibErr := common.ValidateAndBuildE2TInstanceKey(e2tInstance.Address)
+
+ if rnibErr != nil {
+ return rnibErr
+ }
+
+ data, err := json.Marshal(e2tInstance)
+
+ if err != nil {
+ return common.NewInternalError(err)
+ }
+
+ var pairs []interface{}
+ pairs = append(pairs, key, data)
+
+ err = w.sdl.Set(pairs)
+
+ if err != nil {
+ return common.NewInternalError(err)
+ }
+
+ return nil
+}
+
+func (w *rNibWriterInstance) SaveE2TAddresses(addresses []string) error {
+
+ data, err := json.Marshal(addresses)
+
+ if err != nil {
+ return common.NewInternalError(err)
+ }
+
+ var pairs []interface{}
+ pairs = append(pairs, E2TAddressesKey, data)
+
+ err = w.sdl.Set(pairs)
+
+ if err != nil {
+ return common.NewInternalError(err)
+ }
+
+ return nil
+}
+
/*
Close the writer
*/