X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=E2Manager%2Fmanagers%2Fran_connect_status_change_manager.go;h=d3d596bb3e3298d7945fa260a1bb8d312f301712;hb=edeb7325d2d9e796f21d0c7d2e6e5731876af719;hp=ecb645ccc5b5d7b9bc03e14515b225a1e8c96fb3;hpb=67b5aa5e2f37db23fb7d1c086e9c540a61f43917;p=ric-plt%2Fe2mgr.git diff --git a/E2Manager/managers/ran_connect_status_change_manager.go b/E2Manager/managers/ran_connect_status_change_manager.go index ecb645c..d3d596b 100644 --- a/E2Manager/managers/ran_connect_status_change_manager.go +++ b/E2Manager/managers/ran_connect_status_change_manager.go @@ -22,6 +22,8 @@ package managers import ( "e2mgr/logger" "e2mgr/services" + "time" + "gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities" ) @@ -32,7 +34,7 @@ const ( ) type IRanConnectStatusChangeManager interface { - ChangeStatus(nodebInfo *entities.NodebInfo, nextStatus entities.ConnectionStatus) error + ChangeStatus(nodebInfo *entities.NodebInfo, nextStatus entities.ConnectionStatus) (bool, error) } type RanConnectStatusChangeManager struct { @@ -51,30 +53,36 @@ func NewRanConnectStatusChangeManager(logger *logger.Logger, rnibDataService ser } } -func (m *RanConnectStatusChangeManager) ChangeStatus(nodebInfo *entities.NodebInfo, nextStatus entities.ConnectionStatus) error { +func (m *RanConnectStatusChangeManager) ChangeStatus(nodebInfo *entities.NodebInfo, nextStatus entities.ConnectionStatus) (bool, error) { m.logger.Infof("#RanConnectStatusChangeManager.ChangeStatus - RAN name: %s, currentStatus: %s, nextStatus: %s", nodebInfo.RanName, nodebInfo.GetConnectionStatus(), nextStatus) + var ranStatusChangePublished bool + // set the proper event event := m.setEvent(nodebInfo, nextStatus) isConnectivityEvent := event != NONE_RAW_EVENT // only after determining event we set next status - nodebInfo.ConnectionStatus = nextStatus; + nodebInfo.ConnectionStatus = nextStatus + // filling the timeStamp for the last Connection Status update + nodebInfo.StatusUpdateTimeStamp = uint64(time.Now().UnixNano()) if !isConnectivityEvent { err := m.updateNodebInfo(nodebInfo) if err != nil { - return err + return ranStatusChangePublished, err } } else { err := m.updateNodebInfoOnConnectionStatusInversion(nodebInfo, event) if err != nil { - return err + return ranStatusChangePublished, err } + ranStatusChangePublished = true } // in any case, update RanListManager - m.logger.Infof("#RanConnectStatusChangeManager.ChangeStatus - RAN name: %s, updating RanListManager... status: %s", nodebInfo.RanName, nodebInfo.GetConnectionStatus()) - err := m.ranListManager.UpdateRanState(nodebInfo) + connectionStatus := nodebInfo.GetConnectionStatus() + m.logger.Infof("#RanConnectStatusChangeManager.ChangeStatus - RAN name: %s, updating RanListManager... status: %s", nodebInfo.RanName, connectionStatus) + err := m.ranListManager.UpdateNbIdentityConnectionStatus(nodebInfo.GetNodeType(), nodebInfo.RanName, connectionStatus) if err != nil { m.logger.Errorf("#RanConnectStatusChangeManager.ChangeStatus - RAN name: %s - Failed updating RAN's connection status by RanListManager. Error: %v", nodebInfo.RanName, err) // log and proceed... @@ -89,7 +97,7 @@ func (m *RanConnectStatusChangeManager) ChangeStatus(nodebInfo *entities.NodebIn } } - return nil + return ranStatusChangePublished, nil } func (m *RanConnectStatusChangeManager) updateNodebInfoOnConnectionStatusInversion(nodebInfo *entities.NodebInfo, event string) error {