RIC:1060: Change in PTL
[ric-plt/nodeb-rnib.git] / reader / rNibReader.go
index 77fee8d..6f33273 100644 (file)
@@ -1,6 +1,7 @@
 //
 // Copyright 2019 AT&T Intellectual Property
 // Copyright 2019 Nokia
+// Copyright 2023 Capgemini
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -42,7 +43,7 @@ type RNibReader interface {
        // GetNodeb retrieves responding nodeb entity from redis DB by nodeb inventory name
        GetNodeb(inventoryName string) (*entities.NodebInfo, error)
        // GetNodebByGlobalNbId retrieves responding nodeb entity from redis DB by nodeb global Id
-       GetNodebByGlobalNbId(nodeType entities.Node_Type, globalNbId *entities.GlobalNbId) (*entities.NodebInfo, error)
+       GetNodebByGlobalNbId(nodeType entities.Node_Type, globalNbId *entities.GlobalNbId, cuupId string,duid string) (*entities.NodebInfo, error)
        // GetCellList retrieves the list of cell entities belonging to responding nodeb entity from redis DB by nodeb inventory name
        GetCellList(inventoryName string) (*entities.Cells, error)
        // GetListGnbIds retrieves the list of gNodeb identity entities
@@ -67,6 +68,8 @@ type RNibReader interface {
        GetE2TAddresses() ([]string, error)
 
        GetGeneralConfiguration() (*entities.GeneralConfiguration, error)
+
+        GetRanFunctionDefinition(inventoryName string, Oid string) ([]string, error)
 }
 
 //GetNewRNibReader returns reference to RNibReader
@@ -78,6 +81,22 @@ func GetNewRNibReader(storage common.ISdlSyncStorage) RNibReader {
        }
 }
 
+//GetRanFunctionDefinition from the OID
+func (w *rNibReaderInstance) GetRanFunctionDefinition(inventoryName string, oid string) ([]string, error){
+    nb, err := w.GetNodeb (inventoryName)
+    if (nb.GetGnb() != nil) {
+        ranFunction := nb.GetGnb().RanFunctions
+        functionDefinitionList := make([]string, 0)
+        for _, ranFunction := range ranFunction {
+            if (oid == ranFunction.RanFunctionOid) {
+                functionDefinitionList = append(functionDefinitionList ,ranFunction.RanFunctionDefinition)
+                }
+        }
+        return functionDefinitionList, err
+    }
+    return nil, common.NewResourceNotFoundErrorf("#rNibReader.GetCellList - served cells not found. Responding node RAN name: %    s.", inventoryName)
+}
+
 //GetRNibReader returns reference to RNibReader
 //Deprecated: Will be removed in a future release, please use GetNewRNibReader instead.
 func GetRNibReader(sdl common.ISdlInstance) RNibReader {
@@ -101,8 +120,8 @@ func (w *rNibReaderInstance) GetNodeb(inventoryName string) (*entities.NodebInfo
        return nbInfo, nil
 }
 
-func (w *rNibReaderInstance) GetNodebByGlobalNbId(nodeType entities.Node_Type, globalNbId *entities.GlobalNbId) (*entities.NodebInfo, error) {
-       key, rNibErr := common.ValidateAndBuildNodeBIdKey(nodeType.String(), globalNbId.GetPlmnId(), globalNbId.GetNbId())
+func (w *rNibReaderInstance) GetNodebByGlobalNbId(nodeType entities.Node_Type, globalNbId *entities.GlobalNbId, cuupid string, duid string) (*entities.NodebInfo, error) {
+       key, rNibErr := common.ValidateAndBuildNodeBIdKey(nodeType.String(), globalNbId.GetPlmnId(), globalNbId.GetNbId(), cuupid, duid)
        if rNibErr != nil {
                return nil, rNibErr
        }