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=9ea0ef5929fe1205b3a6afd78cefa5211f40d044;hb=refs%2Fchanges%2F45%2F3545%2F1;hp=d71810e38c5cab1f9aba6ea4c2e7c577313e8561;hpb=a3c6fa9122ad3e4e76042d994c8b47dbea11cb2b;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 d71810e..9ea0ef5 100644 --- a/E2Manager/handlers/rmrmsghandlers/e2_setup_request_notification_handler.go +++ b/E2Manager/handlers/rmrmsghandlers/e2_setup_request_notification_handler.go @@ -132,16 +132,11 @@ func (h E2SetupRequestNotificationHandler) handleNewRan(ranName string, e2tIpAdd return nodebInfo, nil } -func (h E2SetupRequestNotificationHandler) handleExistingRan(ranName string, nodebInfo *entities.NodebInfo, setupRequest *models.E2SetupRequestMessage) error { - if nodebInfo.GetConnectionStatus() == entities.ConnectionStatus_SHUTTING_DOWN { - h.logger.Errorf("#E2SetupRequestNotificationHandler.Handle - RAN name: %s, connection status: %s - nodeB entity in incorrect state", ranName, nodebInfo.ConnectionStatus) - return errors.New("nodeB entity in incorrect state") - } - +func (h E2SetupRequestNotificationHandler) setGnbFunctions(nodebInfo *entities.NodebInfo, setupRequest *models.E2SetupRequestMessage) error { ranFunctions, err := setupRequest.ExtractRanFunctionsList() if err != nil { - h.logger.Errorf("#E2SetupRequestNotificationHandler.Handle - RAN name: %s - failed to update nodebInfo entity. Error: %s", ranName, err) + h.logger.Errorf("#E2SetupRequestNotificationHandler.setGnbFunctions - RAN name: %s - failed to update nodebInfo entity. Error: %s", nodebInfo.GetRanName(), err) return err } @@ -149,6 +144,16 @@ func (h E2SetupRequestNotificationHandler) handleExistingRan(ranName string, nod return nil } +func (h E2SetupRequestNotificationHandler) handleExistingRan(ranName string, nodebInfo *entities.NodebInfo, setupRequest *models.E2SetupRequestMessage) error { + if nodebInfo.GetConnectionStatus() == entities.ConnectionStatus_SHUTTING_DOWN { + h.logger.Errorf("#E2SetupRequestNotificationHandler.Handle - RAN name: %s, connection status: %s - nodeB entity in incorrect state", ranName, nodebInfo.ConnectionStatus) + return errors.New("nodeB entity in incorrect state") + } + + err := h.setGnbFunctions(nodebInfo, setupRequest) + return err +} + func (h E2SetupRequestNotificationHandler) handleUnsuccessfulResponse(nodebInfo *entities.NodebInfo, req *models.NotificationRequest) { failureResponse := models.NewE2SetupFailureResponseMessage(models.TimeToWaitEnum.V60s) h.logger.Debugf("#E2SetupRequestNotificationHandler.handleUnsuccessfulResponse - E2_SETUP_RESPONSE has been built successfully %+v", failureResponse) @@ -222,6 +227,9 @@ func (h E2SetupRequestNotificationHandler) parseSetupRequest(payload []byte) (*m if len(e2tIpAddress) == 0 { return nil, "", errors.New("#E2SetupRequestNotificationHandler.parseSetupRequest - Empty E2T Address received") } + + h.logger.Infof("#E2SetupRequestNotificationHandler.parseSetupRequest - payload: %s", payload[pipInd+1:]) + setupRequest := &models.E2SetupRequestMessage{} err := xml.Unmarshal(payload[pipInd+1:], &setupRequest.E2APPDU) if err != nil { @@ -232,6 +240,7 @@ func (h E2SetupRequestNotificationHandler) parseSetupRequest(payload []byte) (*m } func (h E2SetupRequestNotificationHandler) buildNodebInfo(ranName string, e2tAddress string, request *models.E2SetupRequestMessage) (*entities.NodebInfo, error) { + var err error nodebInfo := &entities.NodebInfo{ AssociatedE2TInstanceAddress: e2tAddress, @@ -239,21 +248,23 @@ func (h E2SetupRequestNotificationHandler) buildNodebInfo(ranName string, e2tAdd RanName: ranName, NodeType: entities.Node_GNB, Configuration: &entities.NodebInfo_Gnb{Gnb: &entities.Gnb{}}, - GlobalNbId: &entities.GlobalNbId{ - PlmnId: request.GetPlmnId(), - NbId: request.GetNbId(), - }, + GlobalNbId: h.buildGlobalNbId(request), } - nodebInfo.GetGnb().RanFunctions, err = request.ExtractRanFunctionsList() + + err = h.setGnbFunctions(nodebInfo, request) return nodebInfo, err } +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 { return &entities.NbIdentity{ InventoryName: ranName, - GlobalNbId: &entities.GlobalNbId{ - PlmnId: setupRequest.GetPlmnId(), - NbId: setupRequest.GetNbId(), - }, + GlobalNbId: h.buildGlobalNbId(setupRequest), } }