Update RMR to v4.8.0
[ric-plt/e2mgr.git] / E2Manager / managers / ran_setup_manager.go
index 40b4d00..f855df4 100644 (file)
@@ -29,6 +29,7 @@ import (
        "e2mgr/services"
        "e2mgr/services/rmrsender"
        "gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities"
+       "unsafe"
 )
 
 type RanSetupManager struct {
@@ -37,6 +38,10 @@ type RanSetupManager struct {
        rmrSender       *rmrsender.RmrSender
 }
 
+type IRanSetupManager interface {
+       ExecuteSetup(nodebInfo *entities.NodebInfo, status entities.ConnectionStatus) error
+}
+
 func NewRanSetupManager(logger *logger.Logger, rmrSender *rmrsender.RmrSender, rnibDataService services.RNibDataService) *RanSetupManager {
        return &RanSetupManager{
                logger:          logger,
@@ -49,12 +54,11 @@ func NewRanSetupManager(logger *logger.Logger, rmrSender *rmrsender.RmrSender, r
 func (m *RanSetupManager) updateConnectionStatus(nodebInfo *entities.NodebInfo, status entities.ConnectionStatus) error {
        // Update retries and connection status
        nodebInfo.ConnectionStatus = status
-       nodebInfo.ConnectionAttempts++
        err := m.rnibDataService.UpdateNodebInfo(nodebInfo)
        if err != nil {
                m.logger.Errorf("#RanSetupManager.updateConnectionStatus - Ran name: %s - Failed updating RAN's connection status to %v : %s", nodebInfo.RanName, status, err)
        } else {
-               m.logger.Infof("#RanSetupManager.updateConnectionStatus - Ran name: %s - Successfully updated rNib. RAN's current connection status: %v, RAN's current connection attempts: %d", nodebInfo.RanName, status, nodebInfo.ConnectionAttempts)
+               m.logger.Infof("#RanSetupManager.updateConnectionStatus - Ran name: %s - Successfully updated rNib. RAN's current connection status: %v", nodebInfo.RanName, status)
        }
        return err
 }
@@ -63,12 +67,11 @@ func (m *RanSetupManager) updateConnectionStatus(nodebInfo *entities.NodebInfo,
 func (m *RanSetupManager) updateConnectionStatusDisconnected(nodebInfo *entities.NodebInfo) error {
        // Update retries and connection status
        nodebInfo.ConnectionStatus = entities.ConnectionStatus_DISCONNECTED
-       nodebInfo.ConnectionAttempts--
        err := m.rnibDataService.UpdateNodebInfo(nodebInfo)
        if err != nil {
                m.logger.Errorf("#RanSetupManager.updateConnectionStatusDisconnected - Ran name: %s - Failed updating RAN's connection status to DISCONNECTED : %s", nodebInfo.RanName, err)
        } else {
-               m.logger.Infof("#RanSetupManager.updateConnectionStatusDisconnected - Ran name: %s - Successfully updated rNib. RAN's current connection status: DISCONNECTED, RAN's current connection attempts: %d", nodebInfo.RanName, nodebInfo.ConnectionAttempts)
+               m.logger.Infof("#RanSetupManager.updateConnectionStatusDisconnected - Ran name: %s - Successfully updated rNib. RAN's current connection status: DISCONNECTED", nodebInfo.RanName)
        }
        return err
 }
@@ -105,7 +108,9 @@ func (m *RanSetupManager) ExecuteSetup(nodebInfo *entities.NodebInfo, status ent
        }
 
        // Send the endc/x2 setup request
-       msg := models.NewRmrMessage(rmrMsgType, nodebInfo.RanName, request.GetMessageAsBytes(m.logger))
+       var xAction []byte
+       var msgSrc unsafe.Pointer
+       msg := models.NewRmrMessage(rmrMsgType, nodebInfo.RanName, request.GetMessageAsBytes(m.logger), xAction, msgSrc)
 
        err = m.rmrSender.Send(msg)