X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=E2Manager%2FrNibWriter%2FrNibWriter.go;h=3186d7037622f7a1619608c5bc3a3251add92e84;hb=a07b8597afc9d063a7f37a376a5bcf29ba29b557;hp=a44f38822cf10cf53144f48314d2318894dae075;hpb=663195b03ce7fca8f82e399be26459771bc89f77;p=ric-plt%2Fe2mgr.git diff --git a/E2Manager/rNibWriter/rNibWriter.go b/E2Manager/rNibWriter/rNibWriter.go index a44f388..3186d70 100644 --- a/E2Manager/rNibWriter/rNibWriter.go +++ b/E2Manager/rNibWriter/rNibWriter.go @@ -45,6 +45,8 @@ type RNibWriter interface { RemoveE2TInstance(e2tAddress string) error UpdateGnbCells(nodebInfo *entities.NodebInfo, servedNrCells []*entities.ServedNRCell) error RemoveServedNrCells(inventoryName string, servedNrCells []*entities.ServedNRCell) error + UpdateNodebInfoOnConnectionStatusInversion(nodebInfo *entities.NodebInfo, stateChangeMessageChannel string, event string) error + SaveGeneralConfiguration(config *entities.GeneralConfiguration) error } /* @@ -67,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 */ @@ -315,6 +328,46 @@ 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 +} + +/* +UpdateNodebInfoOnConnectionStatusInversion... +*/ +func (w *rNibWriterInstance) UpdateNodebInfoOnConnectionStatusInversion(nodebInfo *entities.NodebInfo, stateChangeMessageChannel string, event string) error { + + pairs, err := buildUpdateNodebInfoPairs(nodebInfo) + + if err != nil { + return err + } + + err = w.sdl.SetAndPublish([]string{stateChangeMessageChannel, event}, pairs) + + if err != nil { + return common.NewInternalError(err) + } + + return nil +} + /* Close the writer */ @@ -366,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