sdlgo versions updated to v0.3.1
[ric-plt/nodeb-rnib.git] / common / utils.go
index f7a84ad..baf5d23 100644 (file)
 package common
 
 import (
-       "errors"
        "fmt"
 )
+
 /*
 ValidateAndBuildCellIdKey builds key according to the specified format returns the resulting string
- */
-func ValidateAndBuildCellIdKey(cellId string) (string, IRNibError) {
+*/
+func ValidateAndBuildCellIdKey(cellId string) (string, error) {
        if cellId == "" {
-               e := errors.New("#utils.ValidateAndBuildCellIdKey - an empty cell id received")
-               return "", NewValidationError(e)
+               return "", NewValidationError("#utils.ValidateAndBuildCellIdKey - an empty cell id received")
        }
        return fmt.Sprintf("CELL:%s", cellId), nil
 }
+
 /*
 ValidateAndBuildNrCellIdKey builds key according to the specified format returns the resulting string
- */
-func ValidateAndBuildNrCellIdKey(cellId string) (string, IRNibError) {
+*/
+func ValidateAndBuildNrCellIdKey(cellId string) (string, error) {
        if cellId == "" {
-               e := errors.New("#utils.ValidateAndBuildNrCellIdKey - an empty cell id received")
-               return "", NewValidationError(e)
+               return "", NewValidationError("#utils.ValidateAndBuildNrCellIdKey - an empty cell id received")
        }
        return fmt.Sprintf("NRCELL:%s", cellId), nil
 }
+
 /*
 ValidateAndBuildNodeBNameKey builds key according to the specified format returns the resulting string
- */
-func ValidateAndBuildNodeBNameKey(inventoryName string) (string, IRNibError) {
+*/
+func ValidateAndBuildNodeBNameKey(inventoryName string) (string, error) {
        if inventoryName == "" {
-               e := errors.New("#utils.ValidateAndBuildNodeBNameKey - an empty inventory name received")
-               return "", NewValidationError(e)
+               return "", NewValidationError("#utils.ValidateAndBuildNodeBNameKey - an empty inventory name received")
        }
        return fmt.Sprintf("RAN:%s", inventoryName), nil
 }
+
 /*
 ValidateAndBuildNodeBIdKey builds key according to the specified format returns the resulting string
- */
-func ValidateAndBuildNodeBIdKey(nodeType string, plmnId string, nbId string) (string, IRNibError) {
+*/
+func ValidateAndBuildNodeBIdKey(nodeType string, plmnId string, nbId string) (string, error) {
        if nodeType == "" {
-               e := errors.New("#utils.ValidateAndBuildNodeBIdKey - an empty node type received")
-               return "", NewValidationError(e)
+               return "", NewValidationError("#utils.ValidateAndBuildNodeBIdKey - an empty node type received")
        }
        if plmnId == "" {
-               e := errors.New("#utils.ValidateAndBuildNodeBIdKey - an empty plmnId received")
-               return "", NewValidationError(e)
+               return "", NewValidationError("#utils.ValidateAndBuildNodeBIdKey - an empty plmnId received")
        }
        if nbId == "" {
-               e := errors.New("#utils.ValidateAndBuildNodeBIdKey - an empty nbId received")
-               return "", NewValidationError(e)
+               return "", NewValidationError("#utils.ValidateAndBuildNodeBIdKey - an empty nbId received")
        }
        return fmt.Sprintf("%s:%s:%s", nodeType, plmnId, nbId), nil
 }
+
 /*
 ValidateAndBuildCellNamePciKey builds key according to the specified format returns the resulting string
- */
-func ValidateAndBuildCellNamePciKey(inventoryName string, pci uint32) (string, IRNibError) {
+*/
+func ValidateAndBuildCellNamePciKey(inventoryName string, pci uint32) (string, error) {
        if inventoryName == "" {
-               e := errors.New("#utils.ValidateAndBuildCellNamePciKey - an empty inventory name received")
-               return "", NewValidationError(e)
+               return "", NewValidationError("#utils.ValidateAndBuildCellNamePciKey - an empty inventory name received")
        }
        return fmt.Sprintf("PCI:%s:%02x", inventoryName, pci), nil
-}
\ No newline at end of file
+}
+
+func ValidateAndBuildRanLoadInformationKey(inventoryName string) (string, error) {
+
+       if inventoryName == "" {
+               return "", NewValidationError("#utils.ValidateAndBuildRanLoadInformationKey - an empty inventory name received")
+       }
+
+       return fmt.Sprintf("LOAD:%s", inventoryName), nil
+}