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
22 // "e2mgr/configuration"
\r
26 "gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities"
\r
29 type IChangeStatusToConnectedRanManager interface {
\r
30 ChangeStatusToConnectedRan(inventoryName string) error
\r
33 type ChangeStatusToConnectedRanManager struct {
\r
34 logger *logger.Logger
\r
35 rnibDataService services.RNibDataService
\r
36 ranConnectStatusChangeManager IRanConnectStatusChangeManager
\r
39 func NewChangeStatusToConnectedRanManager(logger *logger.Logger, rnibDataService services.RNibDataService, ranConnectStatusChangeManager IRanConnectStatusChangeManager) *ChangeStatusToConnectedRanManager {
\r
40 return &ChangeStatusToConnectedRanManager{
\r
42 rnibDataService: rnibDataService,
\r
43 ranConnectStatusChangeManager: ranConnectStatusChangeManager,
\r
47 func (m *ChangeStatusToConnectedRanManager) ChangeStatusToConnectedRan(inventoryName string) (bool, error) {
\r
48 nodebInfo, err := m.rnibDataService.GetNodeb(inventoryName)
\r
51 m.logger.Errorf("#ChangeStatusToConnectedRanManager.ChangeStatusToConnectedRan - RAN name: %s - Failed fetching RAN from rNib. Error: %v", inventoryName, err)
\r
54 connectionStatus := nodebInfo.GetConnectionStatus()
\r
55 m.logger.Infof("#ChangeStatusToConnectedRanManager.ChangeStatusToConnectedRan - RAN name: %s - RAN's connection status: %s", nodebInfo.RanName, connectionStatus)
\r
57 ranConnectStatusChange, err := m.ranConnectStatusChangeManager.ChangeStatus(nodebInfo, entities.ConnectionStatus_CONNECTED)
\r
60 return ranConnectStatusChange, err
\r
62 m.logger.Infof("#ChangeStatusToConnectedRanManager.ChangeStatusToConnectedRan Status changed \n")
\r
63 return ranConnectStatusChange, nil
\r