X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=E2Manager%2Fconfiguration%2Fconfiguration.go;h=56b9d1ea717d393b23024a20aa0954551d57c698;hb=2dbd50dd984febead7704ab7524ae20aa8d294fa;hp=f539c5d91407156be06ec034f5bdb2826e89af6c;hpb=a07b8597afc9d063a7f37a376a5bcf29ba29b557;p=ric-plt%2Fe2mgr.git diff --git a/E2Manager/configuration/configuration.go b/E2Manager/configuration/configuration.go index f539c5d..56b9d1e 100644 --- a/E2Manager/configuration/configuration.go +++ b/E2Manager/configuration/configuration.go @@ -22,10 +22,16 @@ package configuration import ( "errors" "fmt" - "github.com/spf13/viper" "strconv" + + "github.com/spf13/viper" ) +type RnibWriterConfig struct { + StateChangeMessageChannel string + RanManipulationMessageChannel string +} + type Configuration struct { Logging struct { LogLevel string @@ -48,12 +54,13 @@ type Configuration struct { KeepAliveResponseTimeoutMs int KeepAliveDelayMs int E2TInstanceDeletionTimeoutMs int + E2ResetTimeOutSec int GlobalRicId struct { RicId string Mcc string Mnc string } - StateChangeMessageChannel string + RnibWriter RnibWriterConfig } func ParseConfiguration() *Configuration { @@ -80,8 +87,10 @@ func ParseConfiguration() *Configuration { config.KeepAliveResponseTimeoutMs = viper.GetInt("keepAliveResponseTimeoutMs") config.KeepAliveDelayMs = viper.GetInt("KeepAliveDelayMs") config.E2TInstanceDeletionTimeoutMs = viper.GetInt("e2tInstanceDeletionTimeoutMs") + //E2ResetTimeOutSec : timeout expiry threshold required for handling reset and thus the time for which the nodeb is under reset connection state. + config.E2ResetTimeOutSec = viper.GetInt("e2ResetTimeOutSec") config.populateGlobalRicIdConfig(viper.Sub("globalRicId")) - config.StateChangeMessageChannel = viper.GetString("stateChangeMessageChannel") + config.populateRnibWriterConfig(viper.Sub("rnibWriter")) return &config } @@ -114,6 +123,14 @@ func (c *Configuration) populateRoutingManagerConfig(rmConfig *viper.Viper) { c.RoutingManager.BaseUrl = rmConfig.GetString("baseUrl") } +func (c *Configuration) populateRnibWriterConfig(rnibWriterConfig *viper.Viper) { + if rnibWriterConfig == nil { + panic(fmt.Sprintf("#configuration.populateRnibWriterConfig - failed to populate Rnib Writer configuration: The entry 'rnibWriter' not found\n")) + } + c.RnibWriter.StateChangeMessageChannel = rnibWriterConfig.GetString("stateChangeMessageChannel") + c.RnibWriter.RanManipulationMessageChannel = rnibWriterConfig.GetString("ranManipulationMessageChannel") +} + func (c *Configuration) populateGlobalRicIdConfig(globalRicIdConfig *viper.Viper) { err := validateGlobalRicIdConfig(globalRicIdConfig) if err != nil { @@ -147,23 +164,22 @@ func validateGlobalRicIdConfig(globalRicIdConfig *viper.Viper) error { return err } - return nil } func validateMcc(mcc string) error { - if len(mcc) == 0{ + if len(mcc) == 0 { return errors.New("#configuration.validateMcc - mcc is missing or empty\n") } - if len(mcc) != 3{ + if len(mcc) != 3 { return errors.New("#configuration.validateMcc - mcc is not 3 digits\n") } mccInt, err := strconv.Atoi(mcc) - if err != nil{ + if err != nil { return errors.New("#configuration.validateMcc - mcc is not a number\n") } @@ -175,17 +191,17 @@ func validateMcc(mcc string) error { func validateMnc(mnc string) error { - if len(mnc) == 0{ + if len(mnc) == 0 { return errors.New("#configuration.validateMnc - mnc is missing or empty\n") } - if len(mnc) < 2 || len(mnc) >3 { + if len(mnc) < 2 || len(mnc) > 3 { return errors.New("#configuration.validateMnc - mnc is not 2 or 3 digits\n") } mncAsInt, err := strconv.Atoi(mnc) - if err != nil{ + if err != nil { return errors.New("#configuration.validateMnc - mnc is not a number\n") } @@ -196,9 +212,9 @@ func validateMnc(mnc string) error { return nil } -func validateRicId(ricId string) error{ +func validateRicId(ricId string) error { - if len(ricId) == 0{ + if len(ricId) == 0 { return errors.New("#configuration.validateRicId - ricId is missing or empty\n") } @@ -214,12 +230,11 @@ func validateRicId(ricId string) error{ return nil } - 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, maxRnibConnectionAttempts: %d, "+ - "rnibRetryIntervalMs: %d, keepAliveResponseTimeoutMs: %d, keepAliveDelayMs: %d, e2tInstanceDeletionTimeoutMs: %d, "+ - "globalRicId: { ricId: %s, mcc: %s, mnc: %s}, StateChangeMessageChannel: %s", + "rnibRetryIntervalMs: %d, keepAliveResponseTimeoutMs: %d, keepAliveDelayMs: %d, e2tInstanceDeletionTimeoutMs: %d,e2ResetTimeOutSec: %d,"+ + "globalRicId: { ricId: %s, mcc: %s, mnc: %s}, rnibWriter: { stateChangeMessageChannel: %s, ranManipulationChannel: %s}", c.Logging.LogLevel, c.Http.Port, c.Rmr.Port, @@ -232,9 +247,11 @@ func (c *Configuration) String() string { c.KeepAliveResponseTimeoutMs, c.KeepAliveDelayMs, c.E2TInstanceDeletionTimeoutMs, + c.E2ResetTimeOutSec, c.GlobalRicId.RicId, c.GlobalRicId.Mcc, c.GlobalRicId.Mnc, - c.StateChangeMessageChannel, + c.RnibWriter.StateChangeMessageChannel, + c.RnibWriter.RanManipulationMessageChannel, ) }