2 // Copyright 2019 AT&T Intellectual Property
3 // Copyright 2019 Nokia
5 // Licensed under the Apache License, Version 2.0 (the "License");
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
24 ValidateAndBuildCellIdKey builds key according to the specified format returns the resulting string
26 func ValidateAndBuildCellIdKey(cellId string) (string, IRNibError) {
28 e := errors.New("#utils.ValidateAndBuildCellIdKey - an empty cell id received")
29 return "", NewValidationError(e)
31 return fmt.Sprintf("CELL:%s", cellId), nil
34 ValidateAndBuildNrCellIdKey builds key according to the specified format returns the resulting string
36 func ValidateAndBuildNrCellIdKey(cellId string) (string, IRNibError) {
38 e := errors.New("#utils.ValidateAndBuildNrCellIdKey - an empty cell id received")
39 return "", NewValidationError(e)
41 return fmt.Sprintf("NRCELL:%s", cellId), nil
44 ValidateAndBuildNodeBNameKey builds key according to the specified format returns the resulting string
46 func ValidateAndBuildNodeBNameKey(inventoryName string) (string, IRNibError) {
47 if inventoryName == "" {
48 e := errors.New("#utils.ValidateAndBuildNodeBNameKey - an empty inventory name received")
49 return "", NewValidationError(e)
51 return fmt.Sprintf("RAN:%s", inventoryName), nil
54 ValidateAndBuildNodeBIdKey builds key according to the specified format returns the resulting string
56 func ValidateAndBuildNodeBIdKey(nodeType string, plmnId string, nbId string) (string, IRNibError) {
58 e := errors.New("#utils.ValidateAndBuildNodeBIdKey - an empty node type received")
59 return "", NewValidationError(e)
62 e := errors.New("#utils.ValidateAndBuildNodeBIdKey - an empty plmnId received")
63 return "", NewValidationError(e)
66 e := errors.New("#utils.ValidateAndBuildNodeBIdKey - an empty nbId received")
67 return "", NewValidationError(e)
69 return fmt.Sprintf("%s:%s:%s", nodeType, plmnId, nbId), nil
72 ValidateAndBuildCellNamePciKey builds key according to the specified format returns the resulting string
74 func ValidateAndBuildCellNamePciKey(inventoryName string, pci uint32) (string, IRNibError) {
75 if inventoryName == "" {
76 e := errors.New("#utils.ValidateAndBuildCellNamePciKey - an empty inventory name received")
77 return "", NewValidationError(e)
79 return fmt.Sprintf("PCI:%s:%02x", inventoryName, pci), nil