X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=E2Manager%2Fhandlers%2Frmrmsghandlers%2Fe2_setup_request_notification_handler.go;h=0b8ce33effba186cbded54ff0f9ba4349f6c61bc;hb=5830d4db63151dd466533673fd76d842302f0034;hp=7420a29197a649cd4e1d4bb343ee2ef9c1b61c04;hpb=a07b8597afc9d063a7f37a376a5bcf29ba29b557;p=ric-plt%2Fe2mgr.git diff --git a/E2Manager/handlers/rmrmsghandlers/e2_setup_request_notification_handler.go b/E2Manager/handlers/rmrmsghandlers/e2_setup_request_notification_handler.go index 7420a29..0b8ce33 100644 --- a/E2Manager/handlers/rmrmsghandlers/e2_setup_request_notification_handler.go +++ b/E2Manager/handlers/rmrmsghandlers/e2_setup_request_notification_handler.go @@ -44,22 +44,24 @@ var ( ) type E2SetupRequestNotificationHandler struct { - logger *logger.Logger - config *configuration.Configuration - e2tInstancesManager managers.IE2TInstancesManager - rmrSender *rmrsender.RmrSender - rNibDataService services.RNibDataService - e2tAssociationManager *managers.E2TAssociationManager + logger *logger.Logger + config *configuration.Configuration + e2tInstancesManager managers.IE2TInstancesManager + rmrSender *rmrsender.RmrSender + rNibDataService services.RNibDataService + e2tAssociationManager *managers.E2TAssociationManager + ranConnectStatusChangeManager managers.IRanConnectStatusChangeManager } -func NewE2SetupRequestNotificationHandler(logger *logger.Logger, config *configuration.Configuration, e2tInstancesManager managers.IE2TInstancesManager, rmrSender *rmrsender.RmrSender, rNibDataService services.RNibDataService, e2tAssociationManager *managers.E2TAssociationManager) *E2SetupRequestNotificationHandler { +func NewE2SetupRequestNotificationHandler(logger *logger.Logger, config *configuration.Configuration, e2tInstancesManager managers.IE2TInstancesManager, rmrSender *rmrsender.RmrSender, rNibDataService services.RNibDataService, e2tAssociationManager *managers.E2TAssociationManager, ranConnectStatusChangeManager managers.IRanConnectStatusChangeManager) *E2SetupRequestNotificationHandler { return &E2SetupRequestNotificationHandler{ - logger: logger, - config: config, - e2tInstancesManager: e2tInstancesManager, - rmrSender: rmrSender, - rNibDataService: rNibDataService, - e2tAssociationManager: e2tAssociationManager, + logger: logger, + config: config, + e2tInstancesManager: e2tInstancesManager, + rmrSender: rmrSender, + rNibDataService: rNibDataService, + e2tAssociationManager: e2tAssociationManager, + ranConnectStatusChangeManager: ranConnectStatusChangeManager, } } @@ -70,10 +72,12 @@ func (h *E2SetupRequestNotificationHandler) Handle(request *models.NotificationR generalConfiguration, err := h.rNibDataService.GetGeneralConfiguration() if err != nil { - h.logger.Errorf("#E2SetupRequestNotificationHandler.Handle - Failed retrieving e2m general configuration. error: %s", err) + h.logger.Errorf("#E2SetupRequestNotificationHandler.Handle - Failed retrieving e2m general configuration - quitting e2 setup flow. error: %s", err) return } + h.logger.Infof("#E2SetupRequestNotificationHandler.Handle - got general configuration from rnib - enableRic: %t", generalConfiguration.EnableRic) + if !generalConfiguration.EnableRic { cause := models.Cause{Misc: &models.CauseMisc{OmIntervention: &struct{}{}}} h.handleUnsuccessfulResponse(ranName, request, cause) @@ -151,14 +155,12 @@ func (h *E2SetupRequestNotificationHandler) handleNewRan(ranName string, e2tIpAd return nodebInfo, nil } -func (h *E2SetupRequestNotificationHandler) setGnbFunctions(nodebInfo *entities.NodebInfo, setupRequest *models.E2SetupRequestMessage) error { +func (h *E2SetupRequestNotificationHandler) setGnbFunctions(nodebInfo *entities.NodebInfo, setupRequest *models.E2SetupRequestMessage) { ranFunctions := setupRequest.ExtractRanFunctionsList() if ranFunctions != nil { nodebInfo.GetGnb().RanFunctions = ranFunctions } - - return nil } func (h *E2SetupRequestNotificationHandler) handleExistingRan(ranName string, nodebInfo *entities.NodebInfo, setupRequest *models.E2SetupRequestMessage) error { @@ -167,8 +169,9 @@ func (h *E2SetupRequestNotificationHandler) handleExistingRan(ranName string, no return errors.New("nodeB entity in incorrect state") } - err := h.setGnbFunctions(nodebInfo, setupRequest) - return err + h.setGnbFunctions(nodebInfo, setupRequest) + + return h.rNibDataService.UpdateNodebInfo(nodebInfo) } func (h *E2SetupRequestNotificationHandler) handleUnsuccessfulResponse(ranName string, req *models.NotificationRequest, cause models.Cause) { @@ -283,30 +286,29 @@ func normalizeXml(payload []byte) []byte { return []byte(normalized) } -func (h E2SetupRequestNotificationHandler) buildNodebInfo(ranName string, e2tAddress string, request *models.E2SetupRequestMessage) (*entities.NodebInfo, error) { +func (h *E2SetupRequestNotificationHandler) buildNodebInfo(ranName string, e2tAddress string, request *models.E2SetupRequestMessage) (*entities.NodebInfo, error) { var err error nodebInfo := &entities.NodebInfo{ AssociatedE2TInstanceAddress: e2tAddress, - ConnectionStatus: entities.ConnectionStatus_CONNECTED, RanName: ranName, NodeType: entities.Node_GNB, Configuration: &entities.NodebInfo_Gnb{Gnb: &entities.Gnb{}}, GlobalNbId: h.buildGlobalNbId(request), } - err = h.setGnbFunctions(nodebInfo, request) + h.setGnbFunctions(nodebInfo, request) return nodebInfo, err } -func (h E2SetupRequestNotificationHandler) buildGlobalNbId(setupRequest *models.E2SetupRequestMessage) *entities.GlobalNbId { +func (h *E2SetupRequestNotificationHandler) buildGlobalNbId(setupRequest *models.E2SetupRequestMessage) *entities.GlobalNbId { return &entities.GlobalNbId{ PlmnId: setupRequest.GetPlmnId(), NbId: setupRequest.GetNbId(), } } -func (h E2SetupRequestNotificationHandler) buildNbIdentity(ranName string, setupRequest *models.E2SetupRequestMessage) *entities.NbIdentity { +func (h *E2SetupRequestNotificationHandler) buildNbIdentity(ranName string, setupRequest *models.E2SetupRequestMessage) *entities.NbIdentity { return &entities.NbIdentity{ InventoryName: ranName, GlobalNbId: h.buildGlobalNbId(setupRequest),