Merge "MDCLOG Implementation with Dynamic log-level changes"
[ric-plt/e2mgr.git] / E2Manager / managers / ran_connect_status_change_manager.go
index 1e3b3aa..03c12a2 100644 (file)
@@ -22,12 +22,15 @@ package managers
 import (
        "e2mgr/logger"
        "e2mgr/services"
+       "time"
+
        "gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities"
 )
 
 const (
        CONNECTED_RAW_EVENT    = "CONNECTED"
        DISCONNECTED_RAW_EVENT = "DISCONNECTED"
+       UNDER_RESET_RAW_EVENT  = "UNDER_RESET"
        NONE_RAW_EVENT         = "NONE"
 )
 
@@ -61,7 +64,9 @@ func (m *RanConnectStatusChangeManager) ChangeStatus(nodebInfo *entities.NodebIn
        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 {
@@ -130,6 +135,8 @@ func (m *RanConnectStatusChangeManager) setEvent(nodebInfo *entities.NodebInfo,
                event = nodebInfo.RanName + "_" + CONNECTED_RAW_EVENT
        } else if currentConnectionStatus == entities.ConnectionStatus_CONNECTED && nextState != entities.ConnectionStatus_CONNECTED {
                event = nodebInfo.RanName + "_" + DISCONNECTED_RAW_EVENT
+       } else if nextState == entities.ConnectionStatus_UNDER_RESET {
+               event = nodebInfo.RanName + "_" + UNDER_RESET_RAW_EVENT
        } else {
                event = NONE_RAW_EVENT
        }