"e2mgr/logger"
"e2mgr/managers"
"e2mgr/models"
+ "e2mgr/services"
"gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/common"
- "gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/reader"
)
type E2TermInitNotificationHandler struct {
- rnibReaderProvider func() reader.RNibReader
+ logger *logger.Logger
+ rnibDataService services.RNibDataService
ranReconnectionManager *managers.RanReconnectionManager
}
-func NewE2TermInitNotificationHandler(ranReconnectionManager *managers.RanReconnectionManager, rnibReaderProvider func() reader.RNibReader) E2TermInitNotificationHandler {
+func NewE2TermInitNotificationHandler(logger *logger.Logger, ranReconnectionManager *managers.RanReconnectionManager, rnibDataService services.RNibDataService) E2TermInitNotificationHandler {
return E2TermInitNotificationHandler{
- rnibReaderProvider: rnibReaderProvider,
+ logger: logger,
+ rnibDataService: rnibDataService,
ranReconnectionManager: ranReconnectionManager,
}
}
-func (handler E2TermInitNotificationHandler) Handle(logger *logger.Logger, request *models.NotificationRequest, messageChannel chan<- *models.NotificationResponse) {
+func (h E2TermInitNotificationHandler) Handle(request *models.NotificationRequest) {
-logger.Infof("#E2TermInitNotificationHandler.Handle - Handling E2_TERM_INIT")
+ h.logger.Infof("#E2TermInitNotificationHandler.Handle - Handling E2_TERM_INIT")
- nbIdentityList, err := handler.rnibReaderProvider().GetListNodebIds()
+ nbIdentityList, err := h.rnibDataService.GetListNodebIds()
if err != nil {
- logger.Errorf("#E2TermInitNotificationHandler.Handle - Failed to get nodes list from RNIB. Error: %s", err.Error())
+ h.logger.Errorf("#E2TermInitNotificationHandler.Handle - Failed to get nodes list from RNIB. Error: %s", err.Error())
return
}
if len(nbIdentityList) == 0 {
- logger.Warnf("#E2TermInitNotificationHandler.Handle - The Nodes list in RNIB is empty")
+ h.logger.Warnf("#E2TermInitNotificationHandler.Handle - The Nodes list in RNIB is empty")
return
}
for _, nbIdentity := range nbIdentityList {
- if err := handler.ranReconnectionManager.ReconnectRan(nbIdentity.InventoryName); err != nil {
- logger.Errorf("#E2TermInitNotificationHandler.Handle - Ran name: %s - connection attempt failure, error: %s", (*nbIdentity).GetInventoryName(), err.Error())
+ if err := h.ranReconnectionManager.ReconnectRan(nbIdentity.InventoryName); err != nil {
+ h.logger.Errorf("#E2TermInitNotificationHandler.Handle - Ran name: %s - connection attempt failure, error: %s", (*nbIdentity).GetInventoryName(), err.Error())
_, ok := err.(*common.ResourceNotFoundError)
if !ok {
break
}
}
- logger.Infof("#E2TermInitNotificationHandler.Handle - Completed handling of E2_TERM_INIT")
+ h.logger.Infof("#E2TermInitNotificationHandler.Handle - Completed handling of E2_TERM_INIT")
}