Change log level
[ric-plt/xapp-frame.git] / pkg / xapp / xapp.go
index 0e85845..583d288 100755 (executable)
@@ -37,6 +37,7 @@ import (
 )
 
 // For testing purpose go version 1.13 ->
+
 var _ = func() bool {
        testing.Init()
        return true
@@ -49,6 +50,7 @@ var (
        // XApp is an application instance
        Rmr           *RMRClient
        Sdl           *SDLClient
+       SdlStorage    *SDLStorage
        Rnib          *RNIBClient
        Resource      *Router
        Metric        *Metrics
@@ -65,7 +67,7 @@ var (
 )
 
 func IsReady() bool {
-       return Rmr != nil && Rmr.IsReady() && Sdl != nil && Sdl.IsReady()
+       return Rmr != nil && Rmr.IsReady() && SdlStorage != nil && SdlStorage.IsReady()
 }
 
 func SetReadyCB(cb ReadyCB, params interface{}) {
@@ -100,7 +102,7 @@ func registerXapp() {
        for {
                time.Sleep(5 * time.Second)
                if !IsHealthProbeReady() {
-                       Logger.Info("Application='%s' is not ready yet, waiting ...", viper.GetString("name"))
+                       Logger.Debug("Application='%s' is not ready yet, waiting ...", viper.GetString("name"))
                        continue
                }
 
@@ -263,8 +265,9 @@ func init() {
        Config = Configurator{}
        Metric = NewMetrics(viper.GetString("metrics.url"), viper.GetString("metrics.namespace"), Resource.router)
        Subscription = NewSubscriber(viper.GetString("controls.subscription.host"), viper.GetInt("controls.subscription.timeout"))
+       SdlStorage = NewSdlStorage()
        Sdl = NewSDLClient(viper.GetString("controls.db.namespace"))
-       Rnib = NewRNIBClient()
+       Rnib = GetNewRnibClient(SdlStorage.db)
        Util = NewUtils()
 
        InstallSignalHandler()
@@ -302,13 +305,13 @@ func RunWithParams(c MessageConsumer, sdlcheck bool) {
        if ipString == "<nil>" {
                host = fmt.Sprintf(":%d", GetPortData("http").Port)
        } else {
-               host = fmt.Sprintf("%s:%d", ipString, GetPortData("http").Port)
+               host = fmt.Sprintf("[%s]:%d", ipString, GetPortData("http").Port)
        }
        go http.ListenAndServe(host, Resource.router)
        Logger.Info(fmt.Sprintf("Xapp started, listening on: %s", host))
 
        if sdlcheck {
-               Sdl.TestConnection()
+               SdlStorage.TestConnection(viper.GetString("controls.db.namespace"))
        }
        go registerXapp()