From fe4cb9bf715853d6badeed028ab799b015a4dfe2 Mon Sep 17 00:00:00 2001 From: ss412g Date: Tue, 26 Nov 2019 17:54:04 +0200 Subject: [PATCH] [RICPLT-2788] Fix Enb1MeasurementId value, Fix num of failures and add logs Change-Id: I0ad5f5a583a1f75f9825c92a8546787396d8da8b Signed-off-by: ss412g --- RSM/handlers/httpmsghandlers/resource_status_request_handler.go | 8 ++++++-- .../httpmsghandlers/resource_status_request_handler_test.go | 8 ++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/RSM/handlers/httpmsghandlers/resource_status_request_handler.go b/RSM/handlers/httpmsghandlers/resource_status_request_handler.go index 0e8018d..4d0575f 100644 --- a/RSM/handlers/httpmsghandlers/resource_status_request_handler.go +++ b/RSM/handlers/httpmsghandlers/resource_status_request_handler.go @@ -61,8 +61,11 @@ func (h ResourceStatusRequestHandler) Handle(request models.Request) error { numberOfFails := 0 for _, nbIdentity := range nbIdentityList { - nodeb, err := h.rNibDataService.GetNodeb((*nbIdentity).GetInventoryName()) + ranName := (*nbIdentity).GetInventoryName() + + nodeb, err := h.rNibDataService.GetNodeb(ranName) if err != nil { + h.logger.Errorf("#ResourceStatusRequestHandler.Handle - Couldn't find RAN %s in RSM DB", ranName) numberOfFails++ continue } @@ -72,7 +75,6 @@ func (h ResourceStatusRequestHandler) Handle(request models.Request) error { if nodeb.ConnectionStatus != entities.ConnectionStatus_CONNECTED { h.logger.Infof("#ResourceStatusRequestHandler.Handle - RAN name: %s - connection status not CONNECTED, ignore", nodeb.RanName) h.logger.Infof("#ResourceStatusRequestHandler.Handle - handle RAN: %s completed", nodeb.RanName) - numberOfFails++ continue } @@ -109,6 +111,7 @@ func (h ResourceStatusRequestHandler) handleNotStoppedRsmRanInfo(nodebInfo *enti } if rsmRanInfo.Enb2MeasurementId == 0 { + h.logger.Errorf("#ResourceStatusRequestHandler.handleNotStoppedRsmRanInfo - RAN: %s Enb2MeasurementId is zero", nodebInfo.RanName) return rsmerrors.NewInternalError() } @@ -150,6 +153,7 @@ func (h ResourceStatusRequestHandler) saveRsmRanInfoStartFalse(rsmRanInfo *model rsmRanInfo.Action = enums.Start rsmRanInfo.ActionStatus = false rsmRanInfo.Enb2MeasurementId = 0 + rsmRanInfo.Enb1MeasurementId = enums.Enb1MeasurementId return h.rNibDataService.SaveRsmRanInfo(rsmRanInfo) } diff --git a/RSM/handlers/httpmsghandlers/resource_status_request_handler_test.go b/RSM/handlers/httpmsghandlers/resource_status_request_handler_test.go index 4109f39..0dbc012 100644 --- a/RSM/handlers/httpmsghandlers/resource_status_request_handler_test.go +++ b/RSM/handlers/httpmsghandlers/resource_status_request_handler_test.go @@ -149,7 +149,7 @@ func TestResourceStatusRequestHandlerTrueStartSuccess(t *testing.T) { assert.Equal(t, actualErr, nil) } -func TestResourceStatusRequestHandlerTrueNumberOfFails2(t *testing.T) { +func TestResourceStatusRequestHandlerTrueNumberOfFails1(t *testing.T) { handler, readerMock, rsmReaderMock, rsmWriterMock, resourceStatusServiceMock := initTest(t) @@ -185,7 +185,7 @@ func TestResourceStatusRequestHandlerTrueNumberOfFails2(t *testing.T) { rsmWriterMock.AssertNumberOfCalls(t, "SaveRsmRanInfo", 1) resourceStatusServiceMock.AssertNumberOfCalls(t, "BuildAndSendInitiateRequest", 1) - rsmError := rsmerrors.NewRsmError(2) + rsmError := rsmerrors.NewRsmError(1) assert.Equal(t, actualErr, rsmError) assert.Equal(t, actualErr.Error(), rsmError.Error()) } @@ -272,7 +272,7 @@ func TestResourceStatusRequestHandlerFalseStopSuccess(t *testing.T) { assert.Equal(t, actualErr, nil) } -func TestResourceStatusRequestHandlerFalseNumberOfFails2(t *testing.T) { +func TestResourceStatusRequestHandlerFalseNumberOfFails1(t *testing.T) { handler, readerMock, rsmReaderMock, rsmWriterMock, resourceStatusServiceMock := initTest(t) @@ -308,7 +308,7 @@ func TestResourceStatusRequestHandlerFalseNumberOfFails2(t *testing.T) { rsmWriterMock.AssertNumberOfCalls(t, "SaveRsmRanInfo", 1) resourceStatusServiceMock.AssertNumberOfCalls(t, "BuildAndSendStopRequest", 1) - rsmError := rsmerrors.NewRsmError(2) + rsmError := rsmerrors.NewRsmError(1) assert.Equal(t, actualErr, rsmError) assert.Equal(t, actualErr.Error(), rsmError.Error()) } -- 2.16.6