2 // Copyright (c) 2023 Samsung Electronics Co., Ltd. All Rights Reserved.
\r
4 // Licensed under the Apache License, Version 2.0 (the "License");
\r
5 // you may not use this file except in compliance with the License.
\r
6 // You may obtain a copy of the License at
\r
8 // http://www.apache.org/licenses/LICENSE-2.0
\r
10 // Unless required by applicable law or agreed to in writing, software
\r
11 // distributed under the License is distributed on an "AS IS" BASIS,
\r
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
13 // See the License for the specific language governing permissions and
\r
14 // limitations under the License.
\r
16 // This source code is part of the near-RT RIC (RAN Intelligent Controller)
\r
17 // platform project (RICP).
\r
19 package rmrmsghandlers
\r
26 "gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities"
\r
29 const E2ResetRequestLogInfoElapsedTime = "#E2ResetRequestNotificationHandler.Handle - Summary: elapsed time for receiving and handling reset request message from E2 terminator: %f ms"
\r
31 type E2ResetRequestNotificationHandler struct {
\r
32 logger *logger.Logger
\r
33 rnibDataService services.RNibDataService
\r
36 func NewE2ResetRequestNotificationHandler(logger *logger.Logger, rnibDataService services.RNibDataService) *E2ResetRequestNotificationHandler {
\r
37 return &E2ResetRequestNotificationHandler{
\r
39 rnibDataService: rnibDataService,
\r
43 func (e *E2ResetRequestNotificationHandler) Handle(request *models.NotificationRequest) {
\r
45 e.logger.Infof("#E2ResetRequestNotificationHandler.Handle - RAN name: %s - received E2_Reset. Payload: %x", request.RanName, request.Payload)
\r
47 e.logger.Debugf("#E2ResetRequestNotificationHandler.Handle - RIC_E2_Node_Reset parsed successfully ")
\r
49 nodebInfo, err := e.getNodebInfo(request.RanName)
\r
51 e.logger.Errorf("#E2ResetRequestNotificationHandler.Handle - failed to retrieve nodeB entity. RanName: %s. Error: %s", request.RanName, err.Error())
\r
52 e.logger.Infof(E2ResetRequestLogInfoElapsedTime, utils.ElapsedTime(request.StartTime))
\r
56 e.logger.Debugf("#E2ResetRequestNotificationHandler.Handle - nodeB entity retrieved. RanName %s, ConnectionStatus %s", nodebInfo.RanName, nodebInfo.ConnectionStatus)
\r
58 nodebInfo.ConnectionStatus = entities.ConnectionStatus_UNDER_RESET
\r
60 err = e.rnibDataService.UpdateNodebInfoAndPublish(nodebInfo)
\r
63 e.logger.Errorf("#E2ResetRequestNotificationHandler.Handle - failed to update connection status of nodeB entity. RanName: %s. Error: %s", request.RanName, err.Error())
\r
66 e.logger.Debugf("#E2ResetRequestNotificationHandler.Handle - nodeB entity under reset state. RanName %s, ConnectionStatus %s", nodebInfo.RanName, nodebInfo.ConnectionStatus)
\r
68 e.logger.Infof(E2ResetRequestLogInfoElapsedTime, utils.ElapsedTime(request.StartTime))
\r
71 func (e *E2ResetRequestNotificationHandler) getNodebInfo(ranName string) (*entities.NodebInfo, error) {
\r
73 nodebInfo, err := e.rnibDataService.GetNodeb(ranName)
\r
75 e.logger.Errorf("#E2ResetRequestNotificationHandler.Handle - failed to retrieve nodeB entity. RanName: %s. Error: %s", ranName, err.Error())
\r
78 return nodebInfo, err
\r