[RICPLT-213] Print configurations to log on startup 89/3089/1
authorAmichai <amichai.sichel@intl.att.com>
Wed, 1 Apr 2020 08:12:59 +0000 (11:12 +0300)
committerAmichai <amichai.sichel@intl.att.com>
Wed, 1 Apr 2020 08:13:06 +0000 (11:13 +0300)
Change-Id: Ib86747db31d9caa1715b5ae4bb8809248955907e
Signed-off-by: Amichai <amichai.sichel@intl.att.com>
E2Manager/app/main.go
E2Manager/configuration/configuration.go
E2Manager/configuration/configuration_test.go

index 719e8d7..f597e9c 100644 (file)
@@ -49,6 +49,7 @@ func main() {
                fmt.Printf("#app.main - failed to initialize logger, error: %s", err)
                os.Exit(1)
        }
+       logger.Infof("#app.main - Configuration %s", config)
        db := sdlgo.NewDatabase()
        sdl := sdlgo.NewSdlInstance("e2Manager", db)
        defer sdl.Close()
index 267c25a..9ef7c33 100644 (file)
@@ -117,3 +117,26 @@ func (c *Configuration) populateGlobalRicIdConfig(globalRicIdConfig *viper.Viper
        c.GlobalRicId.PlmnId = globalRicIdConfig.GetString("plmnId")
        c.GlobalRicId.RicNearRtId = globalRicIdConfig.GetString("ricNearRtId")
 }
+
+func (c *Configuration) String() string {
+       return fmt.Sprintf("{logging.logLevel: %s, http.port: %d, rmr: { port: %d, maxMsgSize: %d}, routingManager.baseUrl: %s, "+
+               "notificationResponseBuffer: %d, bigRedButtonTimeoutSec: %d, maxConnectionAttempts: %d, maxRnibConnectionAttempts: %d, "+
+               "rnibRetryIntervalMs: %d, keepAliveResponseTimeoutMs: %d, keepAliveDelayMs: %d, e2tInstanceDeletionTimeoutMs: %d, "+
+               "globalRicId: { plmnId: %s, ricNearRtId: %s}}",
+               c.Logging.LogLevel,
+               c.Http.Port,
+               c.Rmr.Port,
+               c.Rmr.MaxMsgSize,
+               c.RoutingManager.BaseUrl,
+               c.NotificationResponseBuffer,
+               c.BigRedButtonTimeoutSec,
+               c.MaxConnectionAttempts,
+               c.MaxRnibConnectionAttempts,
+               c.RnibRetryIntervalMs,
+               c.KeepAliveResponseTimeoutMs,
+               c.KeepAliveDelayMs,
+               c.E2TInstanceDeletionTimeoutMs,
+               c.GlobalRicId.PlmnId,
+               c.GlobalRicId.RicNearRtId,
+       )
+}
index ac76d99..38f8bba 100644 (file)
@@ -44,6 +44,11 @@ func TestParseConfigurationSuccess(t *testing.T) {
        assert.NotEmpty(t, config.GlobalRicId.RicNearRtId)
 }
 
+func TestStringer(t *testing.T) {
+       config := ParseConfiguration().String()
+       assert.NotEmpty(t, config)
+}
+
 func TestParseConfigurationFileNotFoundFailure(t *testing.T) {
        configPath := "../resources/configuration.yaml"
        configPathTmp := "../resources/configuration.yaml_tmp"