m.logger.Infof("#RanReconnectionManager.ReconnectRan - RAN name: %s - RAN's connection status: %s, RAN's connection attempts: %d", nodebInfo.RanName, nodebInfo.ConnectionStatus, nodebInfo.ConnectionAttempts)
if !m.canReconnectRan(nodebInfo) {
- err := m.setConnectionStatusOfUnconnectableRan(nodebInfo)
+ e2tAddress := nodebInfo.AssociatedE2TInstanceAddress
+ err := m.updateUnconnectableRan(nodebInfo)
if err != nil {
return err
}
if m.isRanExceededConnectionAttempts(nodebInfo) {
- return m.e2tInstancesManager.DeassociateRan(nodebInfo.RanName, nodebInfo.AssociatedE2TInstanceAddress)
+ return m.e2tInstancesManager.DissociateRan(nodebInfo.RanName, e2tAddress)
}
return nil
int(nodebInfo.GetConnectionAttempts()) < m.config.MaxConnectionAttempts
}
-func (m *RanReconnectionManager) updateNodebInfoStatus(nodebInfo *entities.NodebInfo, connectionStatus entities.ConnectionStatus) error {
- if nodebInfo.ConnectionStatus == connectionStatus {
- return nil
- }
+func (m *RanReconnectionManager) updateNodebInfo(nodebInfo *entities.NodebInfo, connectionStatus entities.ConnectionStatus, resetE2tAddress bool) error {
nodebInfo.ConnectionStatus = connectionStatus;
+
+ if resetE2tAddress {
+ nodebInfo.AssociatedE2TInstanceAddress = ""
+ }
+
err := m.rnibDataService.UpdateNodebInfo(nodebInfo)
if err != nil {
- m.logger.Errorf("#RanReconnectionManager.updateNodebInfoStatus - RAN name: %s - Failed updating RAN's connection status to %s in rNib. Error: %v", nodebInfo.RanName, connectionStatus, err)
+ m.logger.Errorf("#RanReconnectionManager.updateNodebInfo - RAN name: %s - Failed updating RAN's connection status to %s in rNib. Error: %v", nodebInfo.RanName, connectionStatus, err)
return err
}
- m.logger.Infof("#RanReconnectionManager.updateNodebInfoStatus - RAN name: %s - Successfully updated rNib. RAN's current connection status: %s", nodebInfo.RanName, nodebInfo.ConnectionStatus)
+ m.logger.Infof("#RanReconnectionManager.updateNodebInfo - RAN name: %s - Successfully updated rNib. RAN's current connection status: %s", nodebInfo.RanName, nodebInfo.ConnectionStatus)
return nil
}
-func (m *RanReconnectionManager) setConnectionStatusOfUnconnectableRan(nodebInfo *entities.NodebInfo) error {
+func (m *RanReconnectionManager) updateUnconnectableRan(nodebInfo *entities.NodebInfo) error {
connectionStatus := nodebInfo.GetConnectionStatus()
if connectionStatus == entities.ConnectionStatus_SHUT_DOWN {
- m.logger.Warnf("#RanReconnectionManager.ReconnectRan - RAN name: %s - Cannot reconnect RAN. Reason: connection status is SHUT_DOWN", nodebInfo.RanName)
+ m.logger.Warnf("#RanReconnectionManager.updateUnconnectableRan - RAN name: %s - Cannot reconnect RAN. Reason: connection status is SHUT_DOWN", nodebInfo.RanName)
return nil
}
if connectionStatus == entities.ConnectionStatus_SHUTTING_DOWN {
- m.logger.Warnf("#RanReconnectionManager.ReconnectRan - RAN name: %s - Cannot reconnect RAN. Reason: connection status is SHUTTING_DOWN", nodebInfo.RanName)
- return m.updateNodebInfoStatus(nodebInfo, entities.ConnectionStatus_SHUT_DOWN)
+ m.logger.Warnf("#RanReconnectionManager.updateUnconnectableRan - RAN name: %s - Cannot reconnect RAN. Reason: connection status is SHUTTING_DOWN", nodebInfo.RanName)
+ return m.updateNodebInfo(nodebInfo, entities.ConnectionStatus_SHUT_DOWN, false)
}
if m.isRanExceededConnectionAttempts(nodebInfo) {
- m.logger.Warnf("#RanReconnectionManager.ReconnectRan - RAN name: %s - Cannot reconnect RAN. Reason: RAN's connection attempts exceeded the limit (%d)", nodebInfo.RanName, m.config.MaxConnectionAttempts)
- return m.updateNodebInfoStatus(nodebInfo, entities.ConnectionStatus_DISCONNECTED)
+ m.logger.Warnf("#RanReconnectionManager.updateUnconnectableRan - RAN name: %s - Cannot reconnect RAN. Reason: RAN's connection attempts exceeded the limit (%d)", nodebInfo.RanName, m.config.MaxConnectionAttempts)
+ return m.updateNodebInfo(nodebInfo, entities.ConnectionStatus_DISCONNECTED, true)
}
return nil