[RICPLT-2527] Fix according to acceptance comments
Change-Id: I7b791a984e4cdc0d8db4d243c970038f6d75bd01
Signed-off-by: Amichai <amichai.sichel@intl.att.com>
diff --git a/E2Manager/clients/routing_manager_client.go b/E2Manager/clients/routing_manager_client.go
index 52e9250..5257d04 100644
--- a/E2Manager/clients/routing_manager_client.go
+++ b/E2Manager/clients/routing_manager_client.go
@@ -95,7 +95,7 @@
}
body := bytes.NewBuffer(marshaled)
- c.logger.Infof("[E2M -> Routing Manager] #RoutingManagerClient.PostMessage - url: %s, request body: %+v", url, body)
+ c.logger.Infof("[E2 Manager -> Routing Manager] #RoutingManagerClient.PostMessage - url: %s, request body: %+v", url, body)
resp, err := c.httpClient.Post(url, "application/json", body)
@@ -107,11 +107,11 @@
defer resp.Body.Close()
if resp.StatusCode >= http.StatusOK && resp.StatusCode < http.StatusMultipleChoices {
- c.logger.Infof("[Routing Manager -> E2M] #RoutingManagerClient.PostMessage - success. http status code: %d", resp.StatusCode)
+ c.logger.Infof("[Routing Manager -> E2 Manager] #RoutingManagerClient.PostMessage - success. http status code: %d", resp.StatusCode)
return nil
}
- c.logger.Errorf("[Routing Manager -> E2M] #RoutingManagerClient.PostMessage - failure. http status code: %d", resp.StatusCode)
+ c.logger.Errorf("[Routing Manager -> E2 Manager] #RoutingManagerClient.PostMessage - failure. http status code: %d", resp.StatusCode)
return e2managererrors.NewRoutingManagerError()
}
diff --git a/E2Manager/handlers/httpmsghandlers/setup_request_handler.go b/E2Manager/handlers/httpmsghandlers/setup_request_handler.go
index c5ce648..51e579b 100644
--- a/E2Manager/handlers/httpmsghandlers/setup_request_handler.go
+++ b/E2Manager/handlers/httpmsghandlers/setup_request_handler.go
@@ -94,7 +94,7 @@
return nil, result
}
-func createInitialNodeInfo(requestDetails *models.SetupRequest, protocol entities.E2ApplicationProtocol, e2tAddress string) (*entities.NodebInfo, *entities.NbIdentity) {
+func createInitialNodeInfo(requestDetails *models.SetupRequest, protocol entities.E2ApplicationProtocol) (*entities.NodebInfo, *entities.NbIdentity) {
nodebInfo := &entities.NodebInfo{
Ip: requestDetails.RanIp,
@@ -133,7 +133,7 @@
return err
}
- err = h.e2tAssociationManager.AssociateRan(e2tAddress, nodebInfo.RanName)
+ err = h.e2tAssociationManager.AssociateRan(e2tAddress, nodebInfo)
if err != nil {
h.logger.Errorf("#SetupRequestHandler.connectExistingRanWithoutAssociatedE2TAddress - RAN name: %s - failed associating ran to e2t address %s. error: %s", nodebInfo.RanName, e2tAddress, err)
@@ -174,7 +174,7 @@
return err
}
- nodebInfo, nodebIdentity := createInitialNodeInfo(request, protocol, e2tAddress)
+ nodebInfo, nodebIdentity := createInitialNodeInfo(request, protocol)
err = h.rNibDataService.SaveNodeb(nodebIdentity, nodebInfo)
@@ -185,7 +185,7 @@
h.logger.Infof("#SetupRequestHandler.connectNewRan - RAN name: %s - initial nodeb entity was saved to rNib", request.RanName)
- err = h.e2tAssociationManager.AssociateRan(e2tAddress, request.RanName)
+ err = h.e2tAssociationManager.AssociateRan(e2tAddress, nodebInfo)
if err != nil {
h.logger.Errorf("#SetupRequestHandler.connectNewRan - RAN name: %s - failed associating ran to e2t address %s. error: %s", request.RanName, e2tAddress, err)
diff --git a/E2Manager/handlers/httpmsghandlers/setup_request_handler_test.go b/E2Manager/handlers/httpmsghandlers/setup_request_handler_test.go
index e8a6736..b27b54e 100644
--- a/E2Manager/handlers/httpmsghandlers/setup_request_handler_test.go
+++ b/E2Manager/handlers/httpmsghandlers/setup_request_handler_test.go
@@ -169,10 +169,15 @@
readerMock, writerMock, handler, e2tInstancesManagerMock, ranSetupManagerMock, httpClientMock := initSetupRequestTest(t, entities.E2ApplicationProtocol_X2_SETUP_REQUEST)
readerMock.On("GetNodeb", RanName).Return(&entities.NodebInfo{}, common.NewResourceNotFoundError(""))
e2tInstancesManagerMock.On("SelectE2TInstance").Return(E2TAddress, nil)
- nbIdentity := &entities.NbIdentity{InventoryName: RanName}
+ e2tInstancesManagerMock.On("AddRanToInstance", RanName, E2TAddress).Return(e2managererrors.NewRnibDbError())
+ setupRequest := &models.SetupRequest{"127.0.0.1", 8080, RanName,}
+ nb, nbIdentity := createInitialNodeInfo(setupRequest, entities.E2ApplicationProtocol_X2_SETUP_REQUEST)
writerMock.On("SaveNodeb", nbIdentity, mock.Anything).Return(nil)
- _, err := handler.Handle(models.SetupRequest{"127.0.0.1", 8080, RanName,})
- assert.IsType(t, &common.ResourceNotFoundError{}, err)
+ nb.AssociatedE2TInstanceAddress = E2TAddress
+ nb.ConnectionAttempts = 0
+ writerMock.On("UpdateNodebInfo", nb).Return(nil)
+ _, err := handler.Handle(*setupRequest)
+ assert.IsType(t, &e2managererrors.RnibDbError{}, err)
writerMock.AssertExpectations(t)
readerMock.AssertExpectations(t)
e2tInstancesManagerMock.AssertExpectations(t)
@@ -186,7 +191,7 @@
e2tInstancesManagerMock.On("SelectE2TInstance").Return(E2TAddress, nil)
e2tInstancesManagerMock.On("AddRanToInstance", RanName, E2TAddress).Return(nil)
setupRequest := models.SetupRequest{"127.0.0.1", 8080, RanName,}
- nodebInfo, nbIdentity := createInitialNodeInfo(&setupRequest, entities.E2ApplicationProtocol_X2_SETUP_REQUEST, E2TAddress)
+ nodebInfo, nbIdentity := createInitialNodeInfo(&setupRequest, entities.E2ApplicationProtocol_X2_SETUP_REQUEST)
writerMock.On("SaveNodeb", nbIdentity, nodebInfo).Return(common.NewInternalError(fmt.Errorf("")))
_, err := handler.Handle(setupRequest)
assert.IsType(t, &e2managererrors.RnibDbError{}, err)
@@ -197,13 +202,19 @@
readerMock, writerMock, handler, e2tInstancesManagerMock, ranSetupManagerMock, _ := initSetupRequestTest(t, entities.E2ApplicationProtocol_X2_SETUP_REQUEST)
readerMock.On("GetNodeb", RanName).Return(&entities.NodebInfo{}, common.NewResourceNotFoundError(""))
e2tInstancesManagerMock.On("SelectE2TInstance").Return(E2TAddress, nil)
- e2tInstancesManagerMock.On("AddRanToInstance", RanName, E2TAddress).Return(nil)
+ e2tInstancesManagerMock.On("AddRanToInstance", RanName, E2TAddress).Return(e2managererrors.NewRnibDbError())
setupRequest := models.SetupRequest{"127.0.0.1", 8080, RanName,}
- nodebInfo, nbIdentity := createInitialNodeInfo(&setupRequest, entities.E2ApplicationProtocol_X2_SETUP_REQUEST, E2TAddress)
+ nodebInfo, nbIdentity := createInitialNodeInfo(&setupRequest, entities.E2ApplicationProtocol_X2_SETUP_REQUEST)
writerMock.On("SaveNodeb", nbIdentity, nodebInfo).Return(nil)
- ranSetupManagerMock.On("ExecuteSetup", nodebInfo, entities.ConnectionStatus_CONNECTING).Return(e2managererrors.NewRnibDbError())
+ updatedNb := *nodebInfo
+ updatedNb.ConnectionAttempts = 0
+ updatedNb.AssociatedE2TInstanceAddress = E2TAddress
+ writerMock.On("UpdateNodebInfo", &updatedNb).Return(nil)
_, err := handler.Handle(setupRequest)
- assert.IsType(t, &common.ResourceNotFoundError{}, err)
+ assert.IsType(t, &e2managererrors.RnibDbError{}, err)
+ readerMock.AssertExpectations(t)
+ writerMock.AssertExpectations(t)
+ ranSetupManagerMock.AssertExpectations(t)
}
func TestSetupNewRanSetupRmrError(t *testing.T) {
@@ -212,11 +223,15 @@
e2tInstancesManagerMock.On("SelectE2TInstance").Return(E2TAddress, nil)
e2tInstancesManagerMock.On("AddRanToInstance", RanName, E2TAddress).Return(nil)
setupRequest := models.SetupRequest{"127.0.0.1", 8080, RanName,}
- nodebInfo, nbIdentity := createInitialNodeInfo(&setupRequest, entities.E2ApplicationProtocol_X2_SETUP_REQUEST, E2TAddress)
+ nodebInfo, nbIdentity := createInitialNodeInfo(&setupRequest, entities.E2ApplicationProtocol_X2_SETUP_REQUEST)
writerMock.On("SaveNodeb", nbIdentity, nodebInfo).Return(nil)
- ranSetupManagerMock.On("ExecuteSetup", nodebInfo, entities.ConnectionStatus_CONNECTING).Return(e2managererrors.NewRmrError())
+ updatedNb := *nodebInfo
+ updatedNb.ConnectionAttempts = 0
+ updatedNb.AssociatedE2TInstanceAddress = E2TAddress
+ writerMock.On("UpdateNodebInfo", &updatedNb).Return(nil)
+ ranSetupManagerMock.On("ExecuteSetup", &updatedNb, entities.ConnectionStatus_CONNECTING).Return(e2managererrors.NewRmrError())
_, err := handler.Handle(setupRequest)
- assert.IsType(t, /* &e2managererrors.RmrError{} */ &common.ResourceNotFoundError{}, err)
+ assert.IsType(t, &e2managererrors.RmrError{}, err)
}
func TestSetupNewRanSetupSuccess(t *testing.T) {
@@ -225,12 +240,15 @@
e2tInstancesManagerMock.On("SelectE2TInstance").Return(E2TAddress, nil)
e2tInstancesManagerMock.On("AddRanToInstance", RanName, E2TAddress).Return(nil)
setupRequest := models.SetupRequest{"127.0.0.1", 8080, RanName,}
- nodebInfo, nbIdentity := createInitialNodeInfo(&setupRequest, entities.E2ApplicationProtocol_X2_SETUP_REQUEST, E2TAddress)
+ nodebInfo, nbIdentity := createInitialNodeInfo(&setupRequest, entities.E2ApplicationProtocol_X2_SETUP_REQUEST)
writerMock.On("SaveNodeb", nbIdentity, nodebInfo).Return(nil)
- ranSetupManagerMock.On("ExecuteSetup", nodebInfo, entities.ConnectionStatus_CONNECTING).Return(nil)
+ updatedNb := *nodebInfo
+ updatedNb.ConnectionAttempts = 0
+ updatedNb.AssociatedE2TInstanceAddress = E2TAddress
+ writerMock.On("UpdateNodebInfo", &updatedNb).Return(nil)
+ ranSetupManagerMock.On("ExecuteSetup", &updatedNb, entities.ConnectionStatus_CONNECTING).Return(nil)
_, err := handler.Handle(setupRequest)
- //assert.Nil(t, err)
- assert.IsType(t, /* &e2managererrors.RnibDbError{} */ &common.ResourceNotFoundError{}, err)
+ assert.Nil(t, err)
}
func TestX2SetupExistingRanShuttingDown(t *testing.T) {
diff --git a/E2Manager/handlers/rmrmsghandlers/ran_lost_connection_handler_test.go b/E2Manager/handlers/rmrmsghandlers/ran_lost_connection_handler_test.go
index 1220c79..836c02a 100644
--- a/E2Manager/handlers/rmrmsghandlers/ran_lost_connection_handler_test.go
+++ b/E2Manager/handlers/rmrmsghandlers/ran_lost_connection_handler_test.go
@@ -80,10 +80,13 @@
origNodebInfo := &entities.NodebInfo{RanName: ranName, GlobalNbId: &entities.GlobalNbId{PlmnId: "xxx", NbId: "yyy"}, ConnectionStatus: entities.ConnectionStatus_CONNECTING, ConnectionAttempts: 20, AssociatedE2TInstanceAddress: e2tAddress}
var rnibErr error
readerMock.On("GetNodeb", ranName).Return(origNodebInfo, rnibErr)
- updatedNodebInfo := *origNodebInfo
- updatedNodebInfo.ConnectionStatus = entities.ConnectionStatus_DISCONNECTED
- updatedNodebInfo.AssociatedE2TInstanceAddress = ""
- writerMock.On("UpdateNodebInfo", &updatedNodebInfo).Return(rnibErr)
+ updatedNodebInfo1 := *origNodebInfo
+ updatedNodebInfo1.ConnectionStatus = entities.ConnectionStatus_DISCONNECTED
+ writerMock.On("UpdateNodebInfo", &updatedNodebInfo1).Return(rnibErr)
+ updatedNodebInfo2 := *origNodebInfo
+ updatedNodebInfo2.ConnectionStatus = entities.ConnectionStatus_DISCONNECTED
+ updatedNodebInfo2.AssociatedE2TInstanceAddress = ""
+ writerMock.On("UpdateNodebInfo", &updatedNodebInfo2).Return(rnibErr)
e2tInstance := &entities.E2TInstance{Address: e2tAddress, AssociatedRanList:[]string{ranName}}
readerMock.On("GetE2TInstance", e2tAddress).Return(e2tInstance, nil)
e2tInstanceToSave := *e2tInstance
diff --git a/E2Manager/managers/e2t_association_manager.go b/E2Manager/managers/e2t_association_manager.go
index 78ae6d7..e313c19 100644
--- a/E2Manager/managers/e2t_association_manager.go
+++ b/E2Manager/managers/e2t_association_manager.go
@@ -23,6 +23,7 @@
"e2mgr/clients"
"e2mgr/logger"
"e2mgr/services"
+ "gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities"
)
type E2TAssociationManager struct {
@@ -41,7 +42,8 @@
}
}
-func (m *E2TAssociationManager) AssociateRan(e2tAddress string, ranName string) error {
+func (m *E2TAssociationManager) AssociateRan(e2tAddress string, nodebInfo *entities.NodebInfo) error {
+ ranName := nodebInfo.RanName
m.logger.Infof("#E2TAssociationManager.AssociateRan - Associating RAN %s to E2T Instance address: %s", ranName, e2tAddress)
err := m.rmClient.AssociateRanToE2TInstance(e2tAddress, ranName)
@@ -50,16 +52,9 @@
return err
}
- nodebInfo, rnibErr := m.rnibDataService.GetNodeb(ranName)
-
- if rnibErr != nil {
- m.logger.Errorf("#E2TAssociationManager.AssociateRan - RAN name: %s - Failed fetching RAN from rNib. Error: %s", ranName, rnibErr)
- return rnibErr
- }
-
nodebInfo.AssociatedE2TInstanceAddress = e2tAddress
nodebInfo.ConnectionAttempts = 0
- rnibErr = m.rnibDataService.UpdateNodebInfo(nodebInfo)
+ rnibErr := m.rnibDataService.UpdateNodebInfo(nodebInfo)
if rnibErr != nil {
m.logger.Errorf("#E2TAssociationManager.AssociateRan - RAN name: %s - Failed to update RAN.AssociatedE2TInstanceAddress in rNib. Error: %s", ranName, rnibErr)
return rnibErr
diff --git a/E2Manager/managers/e2t_association_manager_test.go b/E2Manager/managers/e2t_association_manager_test.go
index cdaed68..fa13848 100644
--- a/E2Manager/managers/e2t_association_manager_test.go
+++ b/E2Manager/managers/e2t_association_manager_test.go
@@ -72,7 +72,6 @@
manager, readerMock, writerMock, httpClientMock := initE2TAssociationManagerTest(t)
mockHttpClient(httpClientMock, clients.AssociateRanToE2TInstanceApiSuffix, true)
nb := &entities.NodebInfo{RanName: RanName, AssociatedE2TInstanceAddress: "", ConnectionAttempts: 1}
- readerMock.On("GetNodeb", RanName).Return(nb, nil)
updatedNb := *nb
updatedNb.ConnectionAttempts = 0
updatedNb.AssociatedE2TInstanceAddress = E2TAddress
@@ -83,7 +82,7 @@
updatedE2tInstance.AssociatedRanList = append(updatedE2tInstance.AssociatedRanList, RanName)
writerMock.On("SaveE2TInstance", &updatedE2tInstance).Return(nil)
- err := manager.AssociateRan(E2TAddress, RanName)
+ err := manager.AssociateRan(E2TAddress, nb)
assert.Nil(t, err)
readerMock.AssertExpectations(t)
@@ -95,7 +94,8 @@
manager, readerMock, writerMock, httpClientMock := initE2TAssociationManagerTest(t)
mockHttpClient(httpClientMock, clients.AssociateRanToE2TInstanceApiSuffix, false)
- err := manager.AssociateRan(E2TAddress, RanName)
+ nb := &entities.NodebInfo{RanName: RanName, AssociatedE2TInstanceAddress: "", ConnectionAttempts: 1}
+ err := manager.AssociateRan(E2TAddress, nb)
assert.NotNil(t, err)
assert.IsType(t, &e2managererrors.RoutingManagerError{}, err)
@@ -104,32 +104,16 @@
httpClientMock.AssertExpectations(t)
}
-func TestAssociateRanGetNodebError(t *testing.T) {
- manager, readerMock, writerMock, httpClientMock := initE2TAssociationManagerTest(t)
- mockHttpClient(httpClientMock, clients.AssociateRanToE2TInstanceApiSuffix, true)
- var nb *entities.NodebInfo
- readerMock.On("GetNodeb", RanName).Return(nb, e2managererrors.NewRnibDbError())
-
- err := manager.AssociateRan(E2TAddress, RanName)
-
- assert.NotNil(t, err)
- assert.IsType(t, &e2managererrors.RnibDbError{}, err)
- readerMock.AssertExpectations(t)
- writerMock.AssertExpectations(t)
- httpClientMock.AssertExpectations(t)
-}
-
func TestAssociateRanUpdateNodebError(t *testing.T) {
manager, readerMock, writerMock, httpClientMock := initE2TAssociationManagerTest(t)
mockHttpClient(httpClientMock, clients.AssociateRanToE2TInstanceApiSuffix, true)
nb := &entities.NodebInfo{RanName: RanName, AssociatedE2TInstanceAddress: "", ConnectionAttempts: 1}
- readerMock.On("GetNodeb", RanName).Return(nb, nil)
updatedNb := *nb
updatedNb.ConnectionAttempts = 0
updatedNb.AssociatedE2TInstanceAddress = E2TAddress
writerMock.On("UpdateNodebInfo", &updatedNb).Return(e2managererrors.NewRnibDbError())
- err := manager.AssociateRan(E2TAddress, RanName)
+ err := manager.AssociateRan(E2TAddress, nb)
assert.NotNil(t, err)
assert.IsType(t, &e2managererrors.RnibDbError{}, err)
@@ -142,7 +126,6 @@
manager, readerMock, writerMock, httpClientMock := initE2TAssociationManagerTest(t)
mockHttpClient(httpClientMock, clients.AssociateRanToE2TInstanceApiSuffix, true)
nb := &entities.NodebInfo{RanName: RanName, AssociatedE2TInstanceAddress: "", ConnectionAttempts: 1}
- readerMock.On("GetNodeb", RanName).Return(nb, nil)
updatedNb := *nb
updatedNb.ConnectionAttempts = 0
updatedNb.AssociatedE2TInstanceAddress = E2TAddress
@@ -150,7 +133,7 @@
var e2tInstance *entities.E2TInstance
readerMock.On("GetE2TInstance", E2TAddress).Return(e2tInstance, errors.New("test"))
- err := manager.AssociateRan(E2TAddress, RanName)
+ err := manager.AssociateRan(E2TAddress, nb)
assert.NotNil(t, err)
assert.IsType(t, &e2managererrors.RnibDbError{}, err)
@@ -163,7 +146,6 @@
manager, readerMock, writerMock, httpClientMock := initE2TAssociationManagerTest(t)
mockHttpClient(httpClientMock, clients.AssociateRanToE2TInstanceApiSuffix, true)
nb := &entities.NodebInfo{RanName: RanName, AssociatedE2TInstanceAddress: "", ConnectionAttempts: 1}
- readerMock.On("GetNodeb", RanName).Return(nb, nil)
updatedNb := *nb
updatedNb.ConnectionAttempts = 0
updatedNb.AssociatedE2TInstanceAddress = E2TAddress
@@ -174,7 +156,7 @@
updatedE2tInstance.AssociatedRanList = append(updatedE2tInstance.AssociatedRanList, RanName)
writerMock.On("SaveE2TInstance", &updatedE2tInstance).Return(errors.New("test"))
- err := manager.AssociateRan(E2TAddress, RanName)
+ err := manager.AssociateRan(E2TAddress, nb)
assert.NotNil(t, err)
assert.IsType(t, &e2managererrors.RnibDbError{}, err)
diff --git a/E2Manager/managers/ran_reconnection_manager.go b/E2Manager/managers/ran_reconnection_manager.go
index 530131f..b733142 100644
--- a/E2Manager/managers/ran_reconnection_manager.go
+++ b/E2Manager/managers/ran_reconnection_manager.go
@@ -94,14 +94,10 @@
int(nodebInfo.GetConnectionAttempts()) < m.config.MaxConnectionAttempts
}
-func (m *RanReconnectionManager) updateNodebInfo(nodebInfo *entities.NodebInfo, connectionStatus entities.ConnectionStatus, resetE2tAddress bool) error {
+func (m *RanReconnectionManager) updateNodebInfo(nodebInfo *entities.NodebInfo, connectionStatus entities.ConnectionStatus) error {
nodebInfo.ConnectionStatus = connectionStatus;
- if resetE2tAddress {
- nodebInfo.AssociatedE2TInstanceAddress = ""
- }
-
err := m.rnibDataService.UpdateNodebInfo(nodebInfo)
if err != nil {
@@ -123,12 +119,12 @@
if connectionStatus == entities.ConnectionStatus_SHUTTING_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)
+ return m.updateNodebInfo(nodebInfo, entities.ConnectionStatus_SHUT_DOWN)
}
if m.isRanExceededConnectionAttempts(nodebInfo) {
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 m.updateNodebInfo(nodebInfo, entities.ConnectionStatus_DISCONNECTED)
}
return nil
diff --git a/E2Manager/managers/ran_reconnection_manager_test.go b/E2Manager/managers/ran_reconnection_manager_test.go
index c4c30d6..7927d0c 100644
--- a/E2Manager/managers/ran_reconnection_manager_test.go
+++ b/E2Manager/managers/ran_reconnection_manager_test.go
@@ -108,10 +108,13 @@
origNodebInfo := &entities.NodebInfo{RanName: ranName, GlobalNbId: &entities.GlobalNbId{PlmnId: "xxx", NbId: "yyy"}, ConnectionStatus: entities.ConnectionStatus_CONNECTING, ConnectionAttempts: 20, AssociatedE2TInstanceAddress: E2TAddress}
var rnibErr error
readerMock.On("GetNodeb", ranName).Return(origNodebInfo, rnibErr)
- updatedNodebInfo := *origNodebInfo
- updatedNodebInfo.ConnectionStatus = entities.ConnectionStatus_DISCONNECTED
- updatedNodebInfo.AssociatedE2TInstanceAddress = ""
- writerMock.On("UpdateNodebInfo", &updatedNodebInfo).Return(rnibErr)
+ updatedNodebInfo1 := *origNodebInfo
+ updatedNodebInfo1.ConnectionStatus = entities.ConnectionStatus_DISCONNECTED
+ writerMock.On("UpdateNodebInfo", &updatedNodebInfo1).Return(rnibErr)
+ updatedNodebInfo2 := *origNodebInfo
+ updatedNodebInfo2.ConnectionStatus = entities.ConnectionStatus_DISCONNECTED
+ updatedNodebInfo2.AssociatedE2TInstanceAddress = ""
+ writerMock.On("UpdateNodebInfo", &updatedNodebInfo2).Return(rnibErr)
e2tInstance := &entities.E2TInstance{Address: E2TAddress, AssociatedRanList:[]string{ranName}}
readerMock.On("GetE2TInstance", E2TAddress).Return(e2tInstance, nil)
e2tInstanceToSave := * e2tInstance
@@ -130,10 +133,13 @@
origNodebInfo := &entities.NodebInfo{RanName: ranName, GlobalNbId: &entities.GlobalNbId{PlmnId: "xxx", NbId: "yyy"}, ConnectionStatus: entities.ConnectionStatus_CONNECTING, ConnectionAttempts: 20, AssociatedE2TInstanceAddress: e2tAddress}
var rnibErr error
readerMock.On("GetNodeb", ranName).Return(origNodebInfo, rnibErr)
- updatedNodebInfo := *origNodebInfo
- updatedNodebInfo.ConnectionStatus = entities.ConnectionStatus_DISCONNECTED
- updatedNodebInfo.AssociatedE2TInstanceAddress = ""
- writerMock.On("UpdateNodebInfo", &updatedNodebInfo).Return(rnibErr)
+ updatedNodebInfo1 := *origNodebInfo
+ updatedNodebInfo1.ConnectionStatus = entities.ConnectionStatus_DISCONNECTED
+ writerMock.On("UpdateNodebInfo", &updatedNodebInfo1).Return(rnibErr)
+ updatedNodebInfo2 := *origNodebInfo
+ updatedNodebInfo2.ConnectionStatus = entities.ConnectionStatus_DISCONNECTED
+ updatedNodebInfo2.AssociatedE2TInstanceAddress = ""
+ writerMock.On("UpdateNodebInfo", &updatedNodebInfo2).Return(rnibErr)
e2tInstance := &entities.E2TInstance{Address:e2tAddress, AssociatedRanList:[]string{ranName}}
readerMock.On("GetE2TInstance",e2tAddress).Return(e2tInstance, common.NewInternalError(errors.New("Error")))
err := ranReconnectionManager.ReconnectRan(ranName)