X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=E2Manager%2Fproviders%2Frmrmsghandlerprovider%2Fnotification_handler_provider.go;h=55c786b2db37769e63f6a538597e180e81d799f8;hb=735697511c75ea86ec22d62d0c3ccb6afbb134eb;hp=f65dee3dc9a418b41db9229ed29045e4a804c7f3;hpb=19e72a51b5edbf108d230093fdf85b42fe5ab470;p=ric-plt%2Fe2mgr.git diff --git a/E2Manager/providers/rmrmsghandlerprovider/notification_handler_provider.go b/E2Manager/providers/rmrmsghandlerprovider/notification_handler_provider.go index f65dee3..55c786b 100644 --- a/E2Manager/providers/rmrmsghandlerprovider/notification_handler_provider.go +++ b/E2Manager/providers/rmrmsghandlerprovider/notification_handler_provider.go @@ -13,46 +13,51 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -// + +// This source code is part of the near-RT RIC (RAN Intelligent Controller) +// platform project (RICP). + package rmrmsghandlerprovider import ( - "e2mgr/handlers" + "e2mgr/converters" + "e2mgr/handlers/rmrmsghandlers" + "e2mgr/logger" "e2mgr/managers" - "e2mgr/rNibWriter" "e2mgr/rmrCgo" + "e2mgr/services" + "e2mgr/services/rmrsender" "fmt" - "gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/reader" ) type NotificationHandlerProvider struct { - notificationHandlers map[int]handlers.NotificationHandler + notificationHandlers map[int]rmrmsghandlers.NotificationHandler } -func NewNotificationHandlerProvider(rnibReaderProvider func() reader.RNibReader, rnibWriterProvider func() rNibWriter.RNibWriter, ranReconnectionManager *managers.RanReconnectionManager) *NotificationHandlerProvider { +func NewNotificationHandlerProvider(logger *logger.Logger, rnibDataService services.RNibDataService, ranReconnectionManager *managers.RanReconnectionManager, ranStatusChangeManager *managers.RanStatusChangeManager, rmrSender *rmrsender.RmrSender, x2SetupResponseManager *managers.X2SetupResponseManager, x2SetupFailureResponseManager *managers.X2SetupFailureResponseManager) *NotificationHandlerProvider { return &NotificationHandlerProvider{ - notificationHandlers: initNotificationHandlersMap(rnibReaderProvider, rnibWriterProvider, ranReconnectionManager), + notificationHandlers: initNotificationHandlersMap(logger, rnibDataService, ranReconnectionManager, ranStatusChangeManager, rmrSender, x2SetupResponseManager, x2SetupFailureResponseManager), } } -func initNotificationHandlersMap(rnibReaderProvider func() reader.RNibReader, rnibWriterProvider func() rNibWriter.RNibWriter, ranReconnectionManager *managers.RanReconnectionManager) map[int]handlers.NotificationHandler { - return map[int]handlers.NotificationHandler{ - //TODO change handlers.NotificationHandler to *handlers.NotificationHandler - rmrCgo.RIC_X2_SETUP_RESP: handlers.X2SetupResponseNotificationHandler{}, - rmrCgo.RIC_X2_SETUP_FAILURE: handlers.X2SetupFailureResponseNotificationHandler{}, - rmrCgo.RIC_ENDC_X2_SETUP_RESP: handlers.EndcX2SetupResponseNotificationHandler{}, - rmrCgo.RIC_ENDC_X2_SETUP_FAILURE: handlers.EndcX2SetupFailureResponseNotificationHandler{}, - rmrCgo.RIC_SCTP_CONNECTION_FAILURE: handlers.NewRanLostConnectionHandler(ranReconnectionManager), - rmrCgo.RIC_ENB_LOAD_INFORMATION: handlers.NewEnbLoadInformationNotificationHandler(rnibWriterProvider), - rmrCgo.RIC_ENB_CONF_UPDATE: handlers.X2EnbConfigurationUpdateHandler{}, - rmrCgo.RIC_ENDC_CONF_UPDATE: handlers.EndcConfigurationUpdateHandler{}, - rmrCgo.RIC_X2_RESET_RESP: handlers.NewX2ResetResponseHandler(rnibReaderProvider), - rmrCgo.RIC_X2_RESET: handlers.NewX2ResetRequestNotificationHandler(rnibReaderProvider), +func initNotificationHandlersMap(logger *logger.Logger, rnibDataService services.RNibDataService, ranReconnectionManager *managers.RanReconnectionManager, ranStatusChangeManager *managers.RanStatusChangeManager, rmrSender *rmrsender.RmrSender, x2SetupResponseManager *managers.X2SetupResponseManager, x2SetupFailureResponseManager *managers.X2SetupFailureResponseManager) map[int]rmrmsghandlers.NotificationHandler { + return map[int]rmrmsghandlers.NotificationHandler{ + rmrCgo.RIC_X2_SETUP_RESP: rmrmsghandlers.NewSetupResponseNotificationHandler(logger, rnibDataService, x2SetupResponseManager, ranStatusChangeManager, rmrCgo.RIC_X2_SETUP_RESP), + rmrCgo.RIC_X2_SETUP_FAILURE: rmrmsghandlers.NewSetupResponseNotificationHandler(logger, rnibDataService, x2SetupFailureResponseManager, nil, rmrCgo.RIC_X2_SETUP_FAILURE), + rmrCgo.RIC_ENDC_X2_SETUP_RESP: rmrmsghandlers.NewSetupResponseNotificationHandler(logger, rnibDataService, managers.NewEndcSetupResponseManager(), ranStatusChangeManager, rmrCgo.RIC_ENDC_X2_SETUP_RESP), + rmrCgo.RIC_ENDC_X2_SETUP_FAILURE: rmrmsghandlers.NewSetupResponseNotificationHandler(logger, rnibDataService, managers.NewEndcSetupFailureResponseManager(), nil, rmrCgo.RIC_ENDC_X2_SETUP_FAILURE), + rmrCgo.RIC_SCTP_CONNECTION_FAILURE: rmrmsghandlers.NewRanLostConnectionHandler(logger, ranReconnectionManager), + rmrCgo.RIC_ENB_LOAD_INFORMATION: rmrmsghandlers.NewEnbLoadInformationNotificationHandler(logger, rnibDataService, converters.NewEnbLoadInformationExtractor(logger)), + rmrCgo.RIC_ENB_CONF_UPDATE: rmrmsghandlers.NewX2EnbConfigurationUpdateHandler(logger, rmrSender), + rmrCgo.RIC_ENDC_CONF_UPDATE: rmrmsghandlers.NewEndcConfigurationUpdateHandler(logger, rmrSender), + rmrCgo.RIC_X2_RESET_RESP: rmrmsghandlers.NewX2ResetResponseHandler(logger, rnibDataService, ranStatusChangeManager, converters.NewX2ResetResponseExtractor(logger)), + rmrCgo.RIC_X2_RESET: rmrmsghandlers.NewX2ResetRequestNotificationHandler(logger, rnibDataService, ranStatusChangeManager, rmrSender), + rmrCgo.RIC_E2_TERM_INIT: rmrmsghandlers.NewE2TermInitNotificationHandler(logger, ranReconnectionManager, rnibDataService), } } -func (provider NotificationHandlerProvider) GetNotificationHandler(messageType int) (handlers.NotificationHandler, error) { +func (provider NotificationHandlerProvider) GetNotificationHandler(messageType int) (rmrmsghandlers.NotificationHandler, error) { handler, ok := provider.notificationHandlers[messageType] if !ok { @@ -60,5 +65,4 @@ func (provider NotificationHandlerProvider) GetNotificationHandler(messageType i } return handler, nil - }