X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=E2Manager%2Fmanagers%2Fe2t_instances_manager.go;h=0a95f5f1eccd0167054e075525509d240866d91c;hb=refs%2Fchanges%2F21%2F2121%2F1;hp=74f6a5188345eef4657762594783d3955853ae84;hpb=372a275602ae05da22130a4601709291c7fbbaa6;p=ric-plt%2Fe2mgr.git diff --git a/E2Manager/managers/e2t_instances_manager.go b/E2Manager/managers/e2t_instances_manager.go index 74f6a51..0a95f5f 100644 --- a/E2Manager/managers/e2t_instances_manager.go +++ b/E2Manager/managers/e2t_instances_manager.go @@ -15,6 +15,9 @@ // limitations under the License. // +// This source code is part of the near-RT RIC (RAN Intelligent Controller) +// platform project (RICP). + package managers import ( @@ -41,8 +44,8 @@ type IE2TInstancesManager interface { AddE2TInstance(e2tAddress string) error RemoveE2TInstance(e2tInstance *entities.E2TInstance) error SelectE2TInstance() (string, error) - AssociateRan(ranName string, e2tAddress string) error - DissociateRan(ranName string, e2tAddress string) error + AddRanToInstance(ranName string, e2tAddress string) error + RemoveRanFromInstance(ranName string, e2tAddress string) error ActivateE2TInstance(e2tInstance *entities.E2TInstance) error ResetKeepAliveTimestamp(e2tAddress string) error } @@ -223,7 +226,7 @@ func (m *E2TInstancesManager) AddE2TInstance(e2tAddress string) error { return nil } -func (m *E2TInstancesManager) DissociateRan(ranName string, e2tAddress string) error { +func (m *E2TInstancesManager) RemoveRanFromInstance(ranName string, e2tAddress string) error { m.mux.Lock() defer m.mux.Unlock() @@ -231,8 +234,8 @@ func (m *E2TInstancesManager) DissociateRan(ranName string, e2tAddress string) e e2tInstance, err := m.rnibDataService.GetE2TInstance(e2tAddress) if err != nil { - m.logger.Errorf("#E2TInstancesManager.DissociateRan - E2T Instance address: %s - Failed retrieving E2TInstance. error: %s", e2tAddress, err) - return err + m.logger.Errorf("#E2TInstancesManager.RemoveRanFromInstance - E2T Instance address: %s - Failed retrieving E2TInstance. error: %s", e2tAddress, err) + return e2managererrors.NewRnibDbError() } i := 0 // output index @@ -249,11 +252,11 @@ func (m *E2TInstancesManager) DissociateRan(ranName string, e2tAddress string) e err = m.rnibDataService.SaveE2TInstance(e2tInstance) if err != nil { - m.logger.Errorf("#E2TInstancesManager.DissociateRan - E2T Instance address: %s - Failed saving E2TInstance. error: %s", e2tAddress, err) - return err + m.logger.Errorf("#E2TInstancesManager.RemoveRanFromInstance - E2T Instance address: %s - Failed saving E2TInstance. error: %s", e2tAddress, err) + return e2managererrors.NewRnibDbError() } - m.logger.Infof("#E2TInstancesManager.DissociateRan - successfully dissociated RAN %s from E2T %s", ranName, e2tInstance.Address) + m.logger.Infof("#E2TInstancesManager.RemoveRanFromInstance - successfully dissociated RAN %s from E2T %s", ranName, e2tInstance.Address) return nil } @@ -284,7 +287,7 @@ func (m *E2TInstancesManager) SelectE2TInstance() (string, error) { return min.Address, nil } -func (m *E2TInstancesManager) AssociateRan(ranName string, e2tAddress string) error { +func (m *E2TInstancesManager) AddRanToInstance(ranName string, e2tAddress string) error { m.mux.Lock() defer m.mux.Unlock() @@ -292,7 +295,7 @@ func (m *E2TInstancesManager) AssociateRan(ranName string, e2tAddress string) er e2tInstance, err := m.rnibDataService.GetE2TInstance(e2tAddress) if err != nil { - m.logger.Errorf("#E2TInstancesManager.AssociateRan - E2T Instance address: %s - Failed retrieving E2TInstance. error: %s", e2tAddress, err) + m.logger.Errorf("#E2TInstancesManager.AddRanToInstance - E2T Instance address: %s - Failed retrieving E2TInstance. error: %s", e2tAddress, err) return e2managererrors.NewRnibDbError() } @@ -301,29 +304,29 @@ func (m *E2TInstancesManager) AssociateRan(ranName string, e2tAddress string) er err = m.rnibDataService.SaveE2TInstance(e2tInstance) if err != nil { - m.logger.Errorf("#E2TInstancesManager.AssociateRan - E2T Instance address: %s - Failed saving E2TInstance. error: %s", e2tAddress, err) + m.logger.Errorf("#E2TInstancesManager.AddRanToInstance - E2T Instance address: %s - Failed saving E2TInstance. error: %s", e2tAddress, err) return e2managererrors.NewRnibDbError() } - m.logger.Infof("#E2TInstancesManager.AssociateRan - successfully associated RAN %s with E2T %s", ranName, e2tInstance.Address) + m.logger.Infof("#E2TInstancesManager.AddRanToInstance - RAN %s was added successfully to E2T %s", ranName, e2tInstance.Address) return nil } -func (h E2TInstancesManager) ActivateE2TInstance(e2tInstance *entities.E2TInstance) error{ +func (m E2TInstancesManager) ActivateE2TInstance(e2tInstance *entities.E2TInstance) error{ if e2tInstance == nil { - h.logger.Errorf("#E2TInstancesManager.ActivateE2TInstance - e2tInstance empty") + m.logger.Errorf("#E2TInstancesManager.ActivateE2TInstance - e2tInstance empty") return e2managererrors.NewInternalError() } - h.logger.Infof("#E2TInstancesManager.ActivateE2TInstance - E2T Address: %s - activate E2T instance", e2tInstance.Address) + m.logger.Infof("#E2TInstancesManager.ActivateE2TInstance - E2T Address: %s - activate E2T instance", e2tInstance.Address) e2tInstance.State = entities.Active e2tInstance.KeepAliveTimestamp = time.Now().UnixNano() - err := h.rnibDataService.SaveE2TInstance(e2tInstance) + err := m.rnibDataService.SaveE2TInstance(e2tInstance) if err != nil { - h.logger.Errorf("#E2TInstancesManager.ActivateE2TInstance - E2T Instance address: %s - Failed saving E2TInstance. error: %s", e2tInstance.Address, err) + m.logger.Errorf("#E2TInstancesManager.ActivateE2TInstance - E2T Instance address: %s - Failed saving E2TInstance. error: %s", e2tInstance.Address, err) return err } return nil