return err
}
} else {
- err := m.updateNodebConnectivityState(nodebInfo, event)
+ err := m.updateNodebInfoOnConnectionStatusInversion(nodebInfo, event)
if err != nil {
return err
}
return nil
}
-func (m *RanConnectStatusChangeManager) updateNodebConnectivityState(nodebInfo *entities.NodebInfo, event string) error {
+func (m *RanConnectStatusChangeManager) updateNodebInfoOnConnectionStatusInversion(nodebInfo *entities.NodebInfo, event string) error {
- err := m.rnibDataService.UpdateNodebConnectivityState(nodebInfo, event)
+ err := m.rnibDataService.UpdateNodebInfoOnConnectionStatusInversion(nodebInfo, event)
if err != nil {
- m.logger.Errorf("#RanConnectStatusChangeManager.updateNodebConnectivityState - RAN name: %s - Failed updating RAN's connection status in rNib. Error: %v", nodebInfo.RanName, err)
+ m.logger.Errorf("#RanConnectStatusChangeManager.updateNodebInfoOnConnectionStatusInversion - RAN name: %s - Failed updating RAN's connection status in rNib. Error: %v", nodebInfo.RanName, err)
return err
}
- m.logger.Infof("#RanConnectStatusChangeManager.updateNodebConnectivityState - RAN name: %s - Successfully updated rNib.", nodebInfo.RanName)
+ m.logger.Infof("#RanConnectStatusChangeManager.updateNodebInfoOnConnectionStatusInversion - RAN name: %s - Successfully updated rNib.", nodebInfo.RanName)
return nil
}
origNodebInfo := &entities.NodebInfo{RanName: RanName, ConnectionStatus: entities.ConnectionStatus_UNKNOWN_CONNECTION_STATUS}
updatedNodebInfo := *origNodebInfo
updatedNodebInfo.ConnectionStatus = entities.ConnectionStatus_CONNECTED
- writerMock.On("UpdateNodebConnectivityState", &updatedNodebInfo, EventChannelForTest, RanName + "_" + CONNECTED_RAW_EVENT).Return(nil)
+ writerMock.On("UpdateNodebInfoOnConnectionStatusInversion", &updatedNodebInfo, EventChannelForTest, RanName + "_" + CONNECTED_RAW_EVENT).Return(nil)
ranListManagerMock.On("UpdateRanState", &updatedNodebInfo).Return(nil)
ranAlarmServiceMock.On("SetConnectivityChangeAlarm", &updatedNodebInfo).Return(nil)
err := ranConnectStatusChangeManager.ChangeStatus(origNodebInfo, entities.ConnectionStatus_CONNECTED)
origNodebInfo := &entities.NodebInfo{RanName: RanName, ConnectionStatus: entities.ConnectionStatus_DISCONNECTED}
updatedNodebInfo := *origNodebInfo
updatedNodebInfo.ConnectionStatus = entities.ConnectionStatus_CONNECTED
- writerMock.On("UpdateNodebConnectivityState", &updatedNodebInfo, EventChannelForTest, RanName + "_" + CONNECTED_RAW_EVENT).Return(nil)
+ writerMock.On("UpdateNodebInfoOnConnectionStatusInversion", &updatedNodebInfo, EventChannelForTest, RanName + "_" + CONNECTED_RAW_EVENT).Return(nil)
ranListManagerMock.On("UpdateRanState", &updatedNodebInfo).Return(nil)
ranAlarmServiceMock.On("SetConnectivityChangeAlarm", &updatedNodebInfo).Return(nil)
err := ranConnectStatusChangeManager.ChangeStatus(origNodebInfo, entities.ConnectionStatus_CONNECTED)
origNodebInfo := &entities.NodebInfo{RanName: RanName, ConnectionStatus: entities.ConnectionStatus_CONNECTED}
updatedNodebInfo := *origNodebInfo
updatedNodebInfo.ConnectionStatus = entities.ConnectionStatus_DISCONNECTED
- writerMock.On("UpdateNodebConnectivityState", &updatedNodebInfo, EventChannelForTest, RanName + "_" + DISCONNECTED_RAW_EVENT).Return(nil)
+ writerMock.On("UpdateNodebInfoOnConnectionStatusInversion", &updatedNodebInfo, EventChannelForTest, RanName + "_" + DISCONNECTED_RAW_EVENT).Return(nil)
ranListManagerMock.On("UpdateRanState", &updatedNodebInfo).Return(nil)
ranAlarmServiceMock.On("SetConnectivityChangeAlarm", &updatedNodebInfo).Return(nil)
err := ranConnectStatusChangeManager.ChangeStatus(origNodebInfo, entities.ConnectionStatus_DISCONNECTED)
origNodebInfo := &entities.NodebInfo{RanName: RanName, ConnectionStatus: entities.ConnectionStatus_DISCONNECTED}
updatedNodebInfo := *origNodebInfo
updatedNodebInfo.ConnectionStatus = entities.ConnectionStatus_CONNECTED
- writerMock.On("UpdateNodebConnectivityState", &updatedNodebInfo, EventChannelForTest, RanName + "_" + CONNECTED_RAW_EVENT).Return(common.NewInternalError(errors.New("Error")))
+ writerMock.On("UpdateNodebInfoOnConnectionStatusInversion", &updatedNodebInfo, EventChannelForTest, RanName + "_" + CONNECTED_RAW_EVENT).Return(common.NewInternalError(errors.New("Error")))
err := ranConnectStatusChangeManager.ChangeStatus(origNodebInfo, entities.ConnectionStatus_CONNECTED)
assert.NotNil(t, err)
writerMock.AssertExpectations(t)
origNodebInfo := &entities.NodebInfo{RanName: ranName, ConnectionStatus: entities.ConnectionStatus_DISCONNECTED}
updatedNodebInfo := *origNodebInfo
updatedNodebInfo.ConnectionStatus = entities.ConnectionStatus_CONNECTED
- writerMock.On("UpdateNodebConnectivityState", &updatedNodebInfo, EventChannelForTest, RanName + "_" + CONNECTED_RAW_EVENT).Return(nil)
+ writerMock.On("UpdateNodebInfoOnConnectionStatusInversion", &updatedNodebInfo, EventChannelForTest, RanName + "_" + CONNECTED_RAW_EVENT).Return(nil)
ranListManagerMock.On("UpdateRanState", &updatedNodebInfo).Return(nil)
ranAlarmServiceMock.On("SetConnectivityChangeAlarm", &updatedNodebInfo).Return(common.NewInternalError(errors.New("Error")))
err := ranConnectStatusChangeManager.ChangeStatus(origNodebInfo, entities.ConnectionStatus_CONNECTED)
return args.Error(0)
}
-func (rnibWriterMock *RnibWriterMock) UpdateNodebConnectivityState(nodebInfo *entities.NodebInfo, stateChangeMessageChannel string, event string) error {
+func (rnibWriterMock *RnibWriterMock) UpdateNodebInfoOnConnectionStatusInversion(nodebInfo *entities.NodebInfo, stateChangeMessageChannel string, event string) error {
args := rnibWriterMock.Called(nodebInfo, stateChangeMessageChannel, event)
return args.Error(0)
}
\ No newline at end of file
RemoveE2TInstance(e2tAddress string) error
UpdateGnbCells(nodebInfo *entities.NodebInfo, servedNrCells []*entities.ServedNRCell) error
RemoveServedNrCells(inventoryName string, servedNrCells []*entities.ServedNRCell) error
- UpdateNodebConnectivityState(nodebInfo *entities.NodebInfo, stateChangeMessageChannel string, event string) error
+ UpdateNodebInfoOnConnectionStatusInversion(nodebInfo *entities.NodebInfo, stateChangeMessageChannel string, event string) error
}
/*
}
/*
-UpdateNodebConnectivityState...
+UpdateNodebInfoOnConnectionStatusInversion...
*/
-func (w *rNibWriterInstance) UpdateNodebConnectivityState(nodebInfo *entities.NodebInfo, stateChangeMessageChannel string, event string) error {
+func (w *rNibWriterInstance) UpdateNodebInfoOnConnectionStatusInversion(nodebInfo *entities.NodebInfo, stateChangeMessageChannel string, event string) error {
pairs, err := buildUpdateNodebInfoPairs(nodebInfo)
sdlInstanceMock.AssertExpectations(t)
}
-func TestUpdateNodebConnectivityStateSuccess(t *testing.T) {
+func TestUpdateNodebInfoOnConnectionStatusInversionSuccess(t *testing.T) {
inventoryName := "name"
plmnId := "02f829"
nbId := "4a952a0a"
nodebInfo := generateNodebInfo(inventoryName, entities.Node_ENB, plmnId, nbId)
data, err := proto.Marshal(nodebInfo)
if err != nil {
- t.Errorf("#rNibWriter_test.TestUpdateNodebConnectivityStateSuccess - Failed to marshal NodeB entity. Error: %v", err)
+ t.Errorf("#rNibWriter_test.TestUpdateNodebInfoOnConnectionStatusInversionSuccess - Failed to marshal NodeB entity. Error: %v", err)
}
var e error
var setExpected []interface{}
sdlInstanceMock.On("SetAndPublish", []string{channelName, eventName}, []interface{}{setExpected}).Return(e)
- rNibErr := w.UpdateNodebConnectivityState(nodebInfo, channelName, eventName)
+ rNibErr := w.UpdateNodebInfoOnConnectionStatusInversion(nodebInfo, channelName, eventName)
assert.Nil(t, rNibErr)
}
-func TestUpdateNodebConnectivityStateMissingInventoryNameFailure(t *testing.T) {
+func TestUpdateNodebInfoOnConnectionStatusInversionMissingInventoryNameFailure(t *testing.T) {
inventoryName := "name"
plmnId := "02f829"
nbId := "4a952a0a"
nodebInfo := &entities.NodebInfo{}
data, err := proto.Marshal(nodebInfo)
if err != nil {
- t.Errorf("#rNibWriter_test.TestUpdateNodebConnectivityStateMissingInventoryNameFailure - Failed to marshal NodeB entity. Error: %v", err)
+ t.Errorf("#rNibWriter_test.TestUpdateNodebInfoOnConnectionStatusInversionMissingInventoryNameFailure - Failed to marshal NodeB entity. Error: %v", err)
}
var e error
var setExpected []interface{}
sdlInstanceMock.On("SetAndPublish", []string{channelName, eventName}, []interface{}{setExpected}).Return(e)
- rNibErr := w.UpdateNodebConnectivityState(nodebInfo, channelName, eventName)
+ rNibErr := w.UpdateNodebInfoOnConnectionStatusInversion(nodebInfo, channelName, eventName)
assert.NotNil(t, rNibErr)
assert.IsType(t, &common.ValidationError{}, rNibErr)
}
-func TestUpdateNodebConnectivityStateMissingGlobalNbId(t *testing.T) {
+func TestUpdateNodebInfoOnConnectionStatusInversionMissingGlobalNbId(t *testing.T) {
inventoryName := "name"
channelName := "RAN_CONNECT_STATE_CHANGE"
eventName := inventoryName + "_" + "CONNECTED"
nodebInfo.RanName = inventoryName
data, err := proto.Marshal(nodebInfo)
if err != nil {
- t.Errorf("#rNibWriter_test.TestSaveEnb - Failed to marshal NodeB entity. Error: %v", err)
+ t.Errorf("#rNibWriter_test.TestUpdateNodebInfoOnConnectionStatusInversionMissingInventoryNameFailure - Failed to marshal NodeB entity. Error: %v", err)
}
var e error
var setExpected []interface{}
setExpected = append(setExpected, nodebNameKey, data)
sdlInstanceMock.On("SetAndPublish", []string{channelName, eventName}, []interface{}{setExpected}).Return(e)
- rNibErr := w.UpdateNodebConnectivityState(nodebInfo, channelName, eventName)
+ rNibErr := w.UpdateNodebInfoOnConnectionStatusInversion(nodebInfo, channelName, eventName)
assert.Nil(t, rNibErr)
}
UpdateGnbCells(nodebInfo *entities.NodebInfo, servedNrCells []*entities.ServedNRCell) error
RemoveServedNrCells(inventoryName string, servedNrCells []*entities.ServedNRCell) error
GetGeneralConfiguration() (*entities.GeneralConfiguration, error)
- UpdateNodebConnectivityState(nodebInfo *entities.NodebInfo, event string) error
+ UpdateNodebInfoOnConnectionStatusInversion(nodebInfo *entities.NodebInfo, event string) error
}
type rNibDataService struct {
return !isRnibConnectionError(err)
}
-func (w *rNibDataService) UpdateNodebConnectivityState(nodebInfo *entities.NodebInfo, event string) error {
- w.logger.Infof("#RnibDataService.UpdateNodebConnectivityState - nodebInfo: %s", nodebInfo)
+func (w *rNibDataService) UpdateNodebInfoOnConnectionStatusInversion(nodebInfo *entities.NodebInfo, event string) error {
+ w.logger.Infof("#RnibDataService.UpdateNodebInfoOnConnectionStatusInversion - nodebInfo: %s", nodebInfo)
- err := w.retry("UpdateNodebConnectivityState", func() (err error) {
- err = w.rnibWriter.UpdateNodebConnectivityState(nodebInfo, w.stateChangeMessageChannel, event)
+ err := w.retry("UpdateNodebInfoOnConnectionStatusInversion", func() (err error) {
+ err = w.rnibWriter.UpdateNodebInfoOnConnectionStatusInversion(nodebInfo, w.stateChangeMessageChannel, event)
return
})
assert.True(t, res)
}
-func TestSuccessfulUpdateNodebConnectivityState(t *testing.T) {
+func TestSuccessfulUpdateNodebInfoOnConnectionStatusInversion(t *testing.T) {
rnibDataService, _, writerMock := setupRnibDataServiceTest(t)
event := "event"
nodebInfo := &entities.NodebInfo{}
- writerMock.On("UpdateNodebConnectivityState", nodebInfo, CHANNEL_NAME, event).Return(nil)
+ writerMock.On("UpdateNodebInfoOnConnectionStatusInversion", nodebInfo, CHANNEL_NAME, event).Return(nil)
- rnibDataService.UpdateNodebConnectivityState(nodebInfo, event)
- writerMock.AssertNumberOfCalls(t, "UpdateNodebConnectivityState", 1)
+ rnibDataService.UpdateNodebInfoOnConnectionStatusInversion(nodebInfo, event)
+ writerMock.AssertNumberOfCalls(t, "UpdateNodebInfoOnConnectionStatusInversion", 1)
}
-func TestConnFailureUpdateNodebConnectivityState(t *testing.T) {
+func TestConnFailureUpdateNodebInfoOnConnectionStatusInversion(t *testing.T) {
rnibDataService, _, writerMock := setupRnibDataServiceTest(t)
event := "event"
nodebInfo := &entities.NodebInfo{}
mockErr := &common.InternalError{Err: &net.OpError{Err: fmt.Errorf("connection error")}}
- writerMock.On("UpdateNodebConnectivityState", nodebInfo, CHANNEL_NAME, event).Return(mockErr)
+ writerMock.On("UpdateNodebInfoOnConnectionStatusInversion", nodebInfo, CHANNEL_NAME, event).Return(mockErr)
- rnibDataService.UpdateNodebConnectivityState(nodebInfo, event)
- writerMock.AssertNumberOfCalls(t, "UpdateNodebConnectivityState", 3)
+ rnibDataService.UpdateNodebInfoOnConnectionStatusInversion(nodebInfo, event)
+ writerMock.AssertNumberOfCalls(t, "UpdateNodebInfoOnConnectionStatusInversion", 3)
}
//func TestConnFailureThenSuccessGetNodebIdList(t *testing.T) {