X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=E2Manager%2Fhandlers%2Frmrmsghandlers%2Fe2_term_init_notification_handler.go;h=ca8a4c53927bb0aba9b731e2a4e258b8a0454405;hb=0249b5fc410b6c6814906b185dfdf25b27621148;hp=0059b2a94248e059db710c123176c9f069afa170;hpb=a75da9a56d61ca4754650d44a54bbf0b04f610d1;p=ric-plt%2Fe2mgr.git diff --git a/E2Manager/handlers/rmrmsghandlers/e2_term_init_notification_handler.go b/E2Manager/handlers/rmrmsghandlers/e2_term_init_notification_handler.go index 0059b2a..ca8a4c5 100644 --- a/E2Manager/handlers/rmrmsghandlers/e2_term_init_notification_handler.go +++ b/E2Manager/handlers/rmrmsghandlers/e2_term_init_notification_handler.go @@ -17,7 +17,6 @@ // This source code is part of the near-RT RIC (RAN Intelligent Controller) // platform project (RICP). - package rmrmsghandlers import ( @@ -62,7 +61,7 @@ func (h E2TermInitNotificationHandler) Handle(request *models.NotificationReques return } - h.logger.Infof("#E2TermInitNotificationHandler.Handle - E2T address: %s - handling E2_TERM_INIT", e2tAddress) + h.logger.Infof("#E2TermInitNotificationHandler.Handle - E2T payload: %s - handling E2_TERM_INIT", unmarshalledPayload) e2tInstance, err := h.e2tInstancesManager.GetE2TInstance(e2tAddress) @@ -74,16 +73,17 @@ func (h E2TermInitNotificationHandler) Handle(request *models.NotificationReques return } - h.HandleNewE2TInstance(e2tAddress) + h.HandleNewE2TInstance(e2tAddress, unmarshalledPayload.PodName) return } if len(e2tInstance.AssociatedRanList) == 0 { h.logger.Infof("#E2TermInitNotificationHandler.Handle - E2T Address: %s - E2T instance has no associated RANs", e2tInstance.Address) + h.UpdateExistingE2TInstanceToRtmgr(e2tAddress) return } - if e2tInstance.State == entities.ToBeDeleted{ + if e2tInstance.State == entities.ToBeDeleted { h.logger.Infof("#E2TermInitNotificationHandler.Handle - E2T Address: %s - E2T instance status is: %s, ignore", e2tInstance.Address, e2tInstance.State) return } @@ -98,21 +98,47 @@ func (h E2TermInitNotificationHandler) HandleExistingE2TInstance(e2tInstance *en for _, ranName := range e2tInstance.AssociatedRanList { if err := h.ranDisconnectionManager.DisconnectRan(ranName); err != nil { - if _, ok := err.(*common.ResourceNotFoundError); !ok{ + if _, ok := err.(*common.ResourceNotFoundError); !ok { break } } } } -func (h E2TermInitNotificationHandler) HandleNewE2TInstance(e2tAddress string) { +func (h E2TermInitNotificationHandler) HandleNewE2TInstance(e2tAddress string, podName string) { - err := h.routingManagerClient.AddE2TInstance(e2tAddress) + for i := 1; i < 4; i++ { - if err != nil{ - h.logger.Errorf("#E2TermInitNotificationHandler.HandleNewE2TInstance - e2t address: %s - routing manager failure", e2tAddress) - return - } + err := h.routingManagerClient.AddE2TInstance(e2tAddress) + + if err == nil{ + + _ = h.e2tInstancesManager.AddE2TInstance(e2tAddress, podName) + + break + } else { + + h.logger.Errorf("#E2TermInitNotificationHandler.HandleNewE2TInstance - e2t address count - %d : %s - routing manager failure", i, e2tAddress) + } + + } +} + +func (h E2TermInitNotificationHandler) UpdateExistingE2TInstanceToRtmgr(e2tAddress string) { + + _ = h.e2tInstancesManager.ResetKeepAliveTimestamp(e2tAddress) + for i := 1; i < 4; i++ { + + err := h.routingManagerClient.AddE2TInstance(e2tAddress) + + if err == nil{ + break + } else { + + h.logger.Errorf("#E2TermInitNotificationHandler.UpdateExistingE2TInstanceToRtmgr - e2t address count - %d : %s - routing manager failure", i, e2tAddress) + } + + } + +} - _ = h.e2tInstancesManager.AddE2TInstance(e2tAddress) -} \ No newline at end of file