X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=E2Manager%2FrNibWriter%2FrNibWriter.go;h=3186d7037622f7a1619608c5bc3a3251add92e84;hb=refs%2Fheads%2FPI5;hp=5bc4a68b3cdb0de30a45549345e3872ca800d886;hpb=05c890a91a4cd043df7367d4dea35c083241bb2e;p=ric-plt%2Fe2mgr.git diff --git a/E2Manager/rNibWriter/rNibWriter.go b/E2Manager/rNibWriter/rNibWriter.go index 5bc4a68..3186d70 100644 --- a/E2Manager/rNibWriter/rNibWriter.go +++ b/E2Manager/rNibWriter/rNibWriter.go @@ -45,7 +45,8 @@ type RNibWriter interface { RemoveE2TInstance(e2tAddress string) error UpdateGnbCells(nodebInfo *entities.NodebInfo, servedNrCells []*entities.ServedNRCell) error RemoveServedNrCells(inventoryName string, servedNrCells []*entities.ServedNRCell) error - UpdateNodebConnectivityState(nodebInfo *entities.NodebInfo, stateChangeMessageChannel string, event string) error + UpdateNodebInfoOnConnectionStatusInversion(nodebInfo *entities.NodebInfo, stateChangeMessageChannel string, event string) error + SaveGeneralConfiguration(config *entities.GeneralConfiguration) error } /* @@ -68,6 +69,17 @@ func (w *rNibWriterInstance) RemoveServedNrCells(inventoryName string, servedNrC return nil } +func (w *rNibWriterInstance) SaveGeneralConfiguration(config *entities.GeneralConfiguration) error { + + err := w.SaveWithKeyAndMarshal(common.BuildGeneralConfigurationKey(), config) + + if err != nil { + return common.NewInternalError(err) + } + + return nil +} + /* SaveNodeb saves nodeB entity data in the redis DB according to the specified data model */ @@ -316,10 +328,30 @@ func (w *rNibWriterInstance) RemoveE2TInstance(address string) error { return nil } +func (w *rNibWriterInstance) SaveWithKeyAndMarshal(key string, entity interface{}) error { + + data, err := json.Marshal(entity) + + 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 +} + /* -UpdateNodebConnectivityState... +UpdateNodebInfoOnConnectionStatusInversion... */ -func (w *rNibWriterInstance) UpdateNodebConnectivityState(nodebInfo *entities.NodebInfo, stateChangeMessageChannel string, event string) error { +func (w *rNibWriterInstance) UpdateNodebInfoOnConnectionStatusInversion(nodebInfo *entities.NodebInfo, stateChangeMessageChannel string, event string) error { pairs, err := buildUpdateNodebInfoPairs(nodebInfo) @@ -387,4 +419,4 @@ func appendGnbCells(inventoryName string, cells []*entities.ServedNRCell, pairs func isNotEmpty(nbIdentity *entities.NbIdentity) bool { return nbIdentity.GlobalNbId != nil && nbIdentity.GlobalNbId.PlmnId != "" && nbIdentity.GlobalNbId.NbId != "" -} +} \ No newline at end of file