Some more test cases in rtmgr
[ric-plt/rtmgr.git] / pkg / sdl / sdl.go
index 198b05a..88b19e7 100644 (file)
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
+
+   This source code is part of the near-RT RIC (RAN Intelligent Controller)
+   platform project (RICP).
+
 ==================================================================================
 */
 /*
 ==================================================================================
 */
 /*
@@ -26,49 +30,35 @@ package sdl
 
 import (
        "errors"
 
 import (
        "errors"
-       "fmt"
-       "rtmgr"
 )
 
 var (
 )
 
 var (
-       SupportedSdls = []*SdlEngineConfig{
-               &SdlEngineConfig{
-                       SdlEngine{
-                               Name:     "file",
-                               Version:  "v1",
-                               Protocol: "rawfile",
-                       },
-                       readAll(fileReadAll),
-                       writeAll(fileWriteAll),
-                       true,
+       SupportedSdls = []*EngineConfig{
+               {
+                       Name:        "file",
+                       Version:     "v1",
+                       Protocol:    "rawfile",
+                       Instance:    NewFile(),
+                       IsAvailable: true,
                },
                },
-               &SdlEngineConfig{
-                       SdlEngine{
-                               Name:     "redis",
-                               Version:  "v1",
-                               Protocol: "nsdl",
-                       },
-                       readAll(nil),
-                       writeAll(nil),
-                       false,
+               {
+                       Name:        "redis",
+                       Version:     "v1",
+                       Protocol:    "ndsl",
+                       Instance:    nil,
+                       IsAvailable: false,
                },
        }
 )
 
                },
        }
 )
 
-func ListSdls() {
-       fmt.Printf("SDL:\n")
+func GetSdl(sdlName string) (Engine, error) {
        for _, sdl := range SupportedSdls {
        for _, sdl := range SupportedSdls {
-               if sdl.IsAvailable {
-                       rtmgr.Logger.Info(sdl.Engine.Name + "/" + sdl.Engine.Version)
+               if sdl.Name == sdlName && sdl.IsAvailable {
+                       return sdl.Instance, nil
                }
        }
                }
        }
+       return nil, errors.New("SDL:" + sdlName + " is not supported or still not a available")
 }
 
 }
 
-func GetSdl(sdlName string) (*SdlEngineConfig, error) {
-       for _, sdl := range SupportedSdls {
-               if sdl.Engine.Name == sdlName && sdl.IsAvailable {
-                       return sdl, nil
-               }
-       }
-       return nil, errors.New("SDL:" + sdlName + " is not supported or still not a available")
+type Sdl struct {
 }
 }