From 79f08ec96c59c506b242d59c234010bca57e3233 Mon Sep 17 00:00:00 2001 From: is005q Date: Mon, 18 Nov 2019 09:17:22 +0200 Subject: [PATCH] [RICPLT-2537] minor fixes Change-Id: I7f9d2b4a11f99cb1225bb45367ccf62c4fbd2350 Signed-off-by: is005q --- ...esource_status_initiate_notification_handler.go | 4 ++- .../resource_status_response_handler.go | 4 +-- RSM/services/resource_status_service.go | 4 +-- RSM/services/rnib_data_service.go | 30 +++++++++------------- 4 files changed, 18 insertions(+), 24 deletions(-) diff --git a/RSM/handlers/rmrmsghandlers/resource_status_initiate_notification_handler.go b/RSM/handlers/rmrmsghandlers/resource_status_initiate_notification_handler.go index 9f6bf43..293078b 100644 --- a/RSM/handlers/rmrmsghandlers/resource_status_initiate_notification_handler.go +++ b/RSM/handlers/rmrmsghandlers/resource_status_initiate_notification_handler.go @@ -56,7 +56,7 @@ func (h ResourceStatusInitiateNotificationHandler) UnmarshalResourceStatusPayloa return nil, fmt.Errorf("unknown node type for RAN %s", inventoryName) } - h.logger.Infof("#ResourceStatusInitiateNotificationHandler.UnmarshalResourceStatusPayload - Unmarshaled payload successfully: %+v", payload) + h.logger.Infof("#ResourceStatusInitiateNotificationHandler.UnmarshalResourceStatusPayload - Unmarshaled payload successfully: %+v", unmarshalledPayload) return &unmarshalledPayload, nil } @@ -100,6 +100,8 @@ func (h ResourceStatusInitiateNotificationHandler) Handle(request *models.RmrReq nodebConnectionStatus := nodeb.GetConnectionStatus() + h.logger.Infof("#ResourceStatusInitiateNotificationHandler.Handle - RAN name: %s - successfully fetched RAN from db. RAN's connection status: %s", inventoryName, nodebConnectionStatus) + if nodebConnectionStatus != entities.ConnectionStatus_CONNECTED { h.logger.Errorf("#ResourceStatusInitiateNotificationHandler.Handle - RAN name: %s - RAN's connection status isn't CONNECTED", inventoryName) h.SaveRsmRanInfoStopTrue(inventoryName) diff --git a/RSM/handlers/rmrmsghandlers/resource_status_response_handler.go b/RSM/handlers/rmrmsghandlers/resource_status_response_handler.go index e9ff602..765abd1 100644 --- a/RSM/handlers/rmrmsghandlers/resource_status_response_handler.go +++ b/RSM/handlers/rmrmsghandlers/resource_status_response_handler.go @@ -59,7 +59,7 @@ func (h ResourceStatusResponseHandler) Handle(request *models.RmrRequest) { } if response.ENB2_Measurement_ID == 0 { - h.logger.Errorf("#ResourceStatusResponseHandler.Handle - RAN name: %s - ignoring response without ENB2_Measurement_ID for ENB1_Measurement_ID = %d", request.RanName, response.ENB1_Measurement_ID) + h.logger.Errorf("#ResourceStatusResponseHandler.Handle - RAN name: %s - ignoring response without ENB2_Measurement_ID", request.RanName) return } @@ -71,7 +71,6 @@ func (h ResourceStatusResponseHandler) Handle(request *models.RmrRequest) { rsmRanInfo, err := h.rnibDataService.GetRsmRanInfo(request.RanName) if err != nil { - h.logger.Errorf("#ResourceStatusResponseHandler.Handle - RAN name: %s - Failed fetching RsmRanInfo", request.RanName) return } @@ -81,7 +80,6 @@ func (h ResourceStatusResponseHandler) Handle(request *models.RmrRequest) { err = h.rnibDataService.SaveRsmRanInfo(rsmRanInfo) if err != nil { - h.logger.Errorf("#ResourceStatusResponseHandler.Handle - RAN name: %s - Failed saving RsmRanInfo", request.RanName) return } diff --git a/RSM/services/resource_status_service.go b/RSM/services/resource_status_service.go index 1430ffa..d10da61 100644 --- a/RSM/services/resource_status_service.go +++ b/RSM/services/resource_status_service.go @@ -72,14 +72,14 @@ func (m *ResourceStatusService) extractCellIdList(nodeb *entities.NodebInfo) ([] enb, ok := nodeb.Configuration.(*entities.NodebInfo_Enb) if !ok { - m.logger.Errorf("#ResourceStatusService.extractCellIdList - Invalid configuration for RAN %s", nodeb.RanName) + m.logger.Errorf("#ResourceStatusService.extractCellIdList - RAN name: %s - invalid configuration", nodeb.RanName) return []string{}, fmt.Errorf("Invalid configuration for RAN %s", nodeb.RanName) } cells := enb.Enb.ServedCells if len(cells) == 0 { - m.logger.Errorf("#ResourceStatusService.extractCellIdList - Empty cell list for RAN %s", nodeb.RanName) + m.logger.Errorf("#ResourceStatusService.extractCellIdList - RAN name: %s - empty cell list", nodeb.RanName) return []string{}, fmt.Errorf("empty cell list for RAN %s", nodeb.RanName) } diff --git a/RSM/services/rnib_data_service.go b/RSM/services/rnib_data_service.go index 44e9024..9e7d332 100644 --- a/RSM/services/rnib_data_service.go +++ b/RSM/services/rnib_data_service.go @@ -59,8 +59,6 @@ func NewRnibDataService(logger *logger.Logger, config *configuration.Configurati } func (w *rNibDataService) GetRsmGeneralConfiguration() (*models.RsmGeneralConfiguration, error) { - w.logger.Infof("#RnibDataService.GetRsmGeneralConfiguration") - var rsmGeneralConfiguration *models.RsmGeneralConfiguration = nil err := w.retry("GetRsmGeneralConfiguration", func() (err error) { @@ -68,46 +66,42 @@ func (w *rNibDataService) GetRsmGeneralConfiguration() (*models.RsmGeneralConfig return }) - if err != nil { - w.logger.Infof("#RnibDataService.GetRsmGeneralConfiguration - Configuration: %+v", rsmGeneralConfiguration) + if err == nil { + w.logger.Infof("#RnibDataService.GetRsmGeneralConfiguration - configuration: %+v", *rsmGeneralConfiguration) } return rsmGeneralConfiguration, err } func (w *rNibDataService) GetRsmRanInfo(ranName string) (*models.RsmRanInfo, error) { - w.logger.Infof("#RnibDataService.GetRsmRanInfo - RAN name: %s", ranName) - - var rsmData *models.RsmRanInfo = nil + var rsmRanInfo *models.RsmRanInfo = nil err := w.retry("GetRsmRanInfo", func() (err error) { - rsmData, err = w.rsmReader.GetRsmRanInfo(ranName) + rsmRanInfo, err = w.rsmReader.GetRsmRanInfo(ranName) return }) - if err != nil { - w.logger.Infof("#RnibDataService.GetRsmRanInfo - RsmRanInfo: %+v", ranName) + if err == nil { + w.logger.Infof("#RnibDataService.GetRsmRanInfo - RAN name: %s, RsmRanInfo: %+v", ranName, *rsmRanInfo) } - - - return rsmData, err + return rsmRanInfo, err } func (w *rNibDataService) SaveRsmRanInfo(rsmRanInfo *models.RsmRanInfo) error { - w.logger.Infof("#RnibDataService.SaveRsmRanInfo - RsmRanInfo: %+v", rsmRanInfo) - err := w.retry("SaveRsmRanInfo", func() (err error) { err = w.rsmWriter.SaveRsmRanInfo(rsmRanInfo) return }) + if err == nil { + w.logger.Infof("#RnibDataService.SaveRsmRanInfo - RAN name: %s, RsmRanInfo: %+v", rsmRanInfo.RanName, *rsmRanInfo) + } + return err } func (w *rNibDataService) GetNodeb(ranName string) (*entities.NodebInfo, error) { - w.logger.Infof("#RnibDataService.GetNodeb - ranName: %s", ranName) - var nodeb *entities.NodebInfo = nil err := w.retry("GetNodeb", func() (err error) { @@ -149,7 +143,7 @@ func (w *rNibDataService) retry(rnibFunc string, f func() error) (err error) { return } if !isRnibConnectionError(err) { - w.logger.Errorf("#RnibDataService.retry - error in %s: %s", rnibFunc, err) + w.logger.Errorf("#RnibDataService - error in %s: %s", rnibFunc, err) return err } if i >= attempts { -- 2.16.6