[RICPLT-2523] Update UTs.............
[ric-plt/e2mgr.git] / E2Manager / handlers / httpmsghandlers / setup_request_handler.go
index 981e9c6..19c1182 100644 (file)
@@ -114,13 +114,12 @@ func (h *SetupRequestHandler) connectExistingRanWithoutAssociatedE2TAddress(node
        if err != nil {
                h.logger.Errorf("#SetupRequestHandler.connectExistingRanWithoutAssociatedE2TAddress - RAN name: %s - failed selecting E2T instance", nodebInfo.RanName)
 
-               // TODO: reset connection attempts?
-
-               if nodebInfo.ConnectionStatus == entities.ConnectionStatus_DISCONNECTED {
+               if nodebInfo.ConnectionStatus == entities.ConnectionStatus_DISCONNECTED && nodebInfo.ConnectionAttempts == 0 {
                        return err
                }
 
                nodebInfo.ConnectionStatus = entities.ConnectionStatus_DISCONNECTED
+               nodebInfo.ConnectionAttempts = 0
                updateError := h.rNibDataService.UpdateNodebInfo(nodebInfo)
 
                if updateError != nil {
@@ -162,11 +161,11 @@ func (h *SetupRequestHandler) connectExistingRanWithAssociatedE2TAddress(nodebIn
        err := h.rNibDataService.UpdateNodebInfo(nodebInfo)
 
        if err != nil {
-               h.logger.Errorf("#SetupRequestHandler.connectExistingRanWithAssociatedE2TAddress - RAN name: %s - failed updating nodeb in rNib. error: %s", nodebInfo.RanName, err)
+               h.logger.Errorf("#SetupRequestHandler.connectExistingRanWithAssociatedE2TAddress - RAN name: %s - failed resetting connection attempts of RAN. error: %s", nodebInfo.RanName, err)
                return e2managererrors.NewRnibDbError()
        }
 
-       h.logger.Infof("#SetupRequestHandler.connectExistingRanWithAssociatedE2TAddress - RAN name: %s - successfully updated nodeb in rNib", nodebInfo.RanName)
+       h.logger.Infof("#SetupRequestHandler.connectExistingRanWithAssociatedE2TAddress - RAN name: %s - successfully reset connection attempts of RAN", nodebInfo.RanName)
 
 
        result := h.ranSetupManager.ExecuteSetup(nodebInfo, status)