2 // Copyright 2019 AT&T Intellectual Property
3 // Copyright 2019 Nokia
4 // Copyright 2023 Capgemini
6 // Licensed under the Apache License, Version 2.0 (the "License");
7 // you may not use this file except in compliance with the License.
8 // You may obtain a copy of the License at
10 // http://www.apache.org/licenses/LICENSE-2.0
12 // Unless required by applicable law or agreed to in writing, software
13 // distributed under the License is distributed on an "AS IS" BASIS,
14 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 // See the License for the specific language governing permissions and
16 // limitations under the License.
18 // This source code is part of the near-RT RIC (RAN Intelligent Controller)
19 // platform project (RICP).
27 //SDL namespace used by the RNIB
28 const rnibNamespace = "e2Manager"
31 ValidateAndBuildCellIdKey builds key according to the specified format returns the resulting string
33 func ValidateAndBuildCellIdKey(cellId string) (string, error) {
35 return "", NewValidationError("#utils.ValidateAndBuildCellIdKey - an empty cell id received")
37 return fmt.Sprintf("CELL:%s", cellId), nil
41 ValidateAndBuildNrCellIdKey builds key according to the specified format returns the resulting string
43 func ValidateAndBuildNrCellIdKey(cellId string) (string, error) {
45 return "", NewValidationError("#utils.ValidateAndBuildNrCellIdKey - an empty cell id received")
47 return fmt.Sprintf("NRCELL:%s", cellId), nil
51 ValidateAndBuildNodeBNameKey builds key according to the specified format returns the resulting string
53 func ValidateAndBuildNodeBNameKey(inventoryName string) (string, error) {
54 if inventoryName == "" {
55 return "", NewValidationError("#utils.ValidateAndBuildNodeBNameKey - an empty inventory name received")
57 return fmt.Sprintf("RAN:%s", inventoryName), nil
61 ValidateAndBuildNodeBIdKey builds key according to the specified format returns the resulting string
63 func ValidateAndBuildNodeBIdKey(nodeType string, plmnId string, nbId string, cuupId string, duId string) (string, error) {
65 return "", NewValidationError("#utils.ValidateAndBuildNodeBIdKey - an empty node type received")
68 return "", NewValidationError("#utils.ValidateAndBuildNodeBIdKey - an empty plmnId received")
71 return "", NewValidationError("#utils.ValidateAndBuildNodeBIdKey - an empty nbId received")
73 /*Note: Deployment where CU-UP and DU are combined
74 (but do not include the CP-CP) and have a single E2 connection
75 is not supported. The combination of CU-CP, CU-UP, and DU will be
76 treated as a single gNB and expect it to have only the
77 global gNB ID in its E2 Setup ID*/
79 if cuupId != "" && duId != ""{
80 return fmt.Sprintf("%s:%s:%s", nodeType, plmnId, nbId), nil
81 }else if cuupId != "" {
82 return fmt.Sprintf("%s:%s:%s:%s", nodeType, plmnId, nbId, cuupId), nil
84 return fmt.Sprintf("%s:%s:%s:%s", nodeType, plmnId, nbId, duId ), nil
86 return fmt.Sprintf("%s:%s:%s", nodeType, plmnId, nbId), nil
91 ValidateAndBuildCellNamePciKey builds key according to the specified format returns the resulting string
93 func ValidateAndBuildCellNamePciKey(inventoryName string, pci uint32) (string, error) {
94 if inventoryName == "" {
95 return "", NewValidationError("#utils.ValidateAndBuildCellNamePciKey - an empty inventory name received")
97 return fmt.Sprintf("PCI:%s:%02x", inventoryName, pci), nil
100 func ValidateAndBuildRanLoadInformationKey(inventoryName string) (string, error) {
102 if inventoryName == "" {
103 return "", NewValidationError("#utils.ValidateAndBuildRanLoadInformationKey - an empty inventory name received")
106 return fmt.Sprintf("LOAD:%s", inventoryName), nil
109 func ValidateAndBuildE2TInstanceKey(address string) (string, error) {
112 return "", NewValidationError("#utils.ValidateAndBuildE2TInstanceKey - an empty E2T address received")
115 return fmt.Sprintf("E2TInstance:%s", address), nil
118 func BuildGeneralConfigurationKey() string {
122 func MapE2TAddressesToKeys(addresses []string) []string {
125 for _, v := range addresses {
127 keys = append(keys, fmt.Sprintf("E2TInstance:%s", v))
134 //GetRNibNamespace returns namespace used by the RNIB in SDL.
135 func GetRNibNamespace() string {