+func (h *E2SetupRequestNotificationHandler) handleNewRan(ranName string, e2tIpAddress string, setupRequest *models.E2SetupRequestMessage) (*entities.NodebInfo, error) {
+
+ nodebInfo, err := h.buildNodebInfo(ranName, e2tIpAddress, setupRequest)
+
+ if err != nil {
+ h.logger.Errorf("#E2SetupRequestNotificationHandler.handleNewRan - RAN name: %s - failed to build nodebInfo entity. Error: %s", ranName, err)
+ return nil, err
+ }
+
+ nbIdentity := h.buildNbIdentity(ranName, setupRequest)
+ err = h.rNibDataService.SaveNodeb(nbIdentity, nodebInfo)
+
+ if err != nil {
+ h.logger.Errorf("#E2SetupRequestNotificationHandler.handleNewRan - RAN name: %s - failed to save nodebInfo entity. Error: %s", ranName, err)
+ return nil, err
+ }
+
+ return nodebInfo, nil
+}
+
+func (h *E2SetupRequestNotificationHandler) setGnbFunctions(nodebInfo *entities.NodebInfo, setupRequest *models.E2SetupRequestMessage) {
+ ranFunctions := setupRequest.ExtractRanFunctionsList()
+
+ if ranFunctions != nil {
+ nodebInfo.GetGnb().RanFunctions = ranFunctions
+ }
+}
+
+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")
+ }
+
+ h.setGnbFunctions(nodebInfo, setupRequest)
+
+ return h.rNibDataService.UpdateNodebInfo(nodebInfo)
+}
+
+func (h *E2SetupRequestNotificationHandler) handleUnsuccessfulResponse(ranName string, req *models.NotificationRequest, cause models.Cause) {
+ failureResponse := models.NewE2SetupFailureResponseMessage(models.TimeToWaitEnum.V60s, cause)