X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=E2Manager%2Fconfiguration%2Fconfiguration.go;h=8582edd3a2ed441f418c196f817a78f3fee476b3;hb=9377e3df9b861e512df33d8596a868b9e5e34e94;hp=f539c5d91407156be06ec034f5bdb2826e89af6c;hpb=197657e0e814c871b903ef779ad654b13347e430;p=ric-plt%2Fe2mgr.git diff --git a/E2Manager/configuration/configuration.go b/E2Manager/configuration/configuration.go index f539c5d..8582edd 100644 --- a/E2Manager/configuration/configuration.go +++ b/E2Manager/configuration/configuration.go @@ -26,6 +26,11 @@ import ( "strconv" ) +type RnibWriterConfig struct { + StateChangeMessageChannel string + RanManipulationMessageChannel string +} + type Configuration struct { Logging struct { LogLevel string @@ -53,7 +58,7 @@ type Configuration struct { Mcc string Mnc string } - StateChangeMessageChannel string + RnibWriter RnibWriterConfig } func ParseConfiguration() *Configuration { @@ -81,7 +86,7 @@ func ParseConfiguration() *Configuration { config.KeepAliveDelayMs = viper.GetInt("KeepAliveDelayMs") config.E2TInstanceDeletionTimeoutMs = viper.GetInt("e2tInstanceDeletionTimeoutMs") config.populateGlobalRicIdConfig(viper.Sub("globalRicId")) - config.StateChangeMessageChannel = viper.GetString("stateChangeMessageChannel") + config.populateRnibWriterConfig(viper.Sub("rnibWriter")) return &config } @@ -114,6 +119,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 +160,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 +187,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 +208,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 +226,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", + "globalRicId: { ricId: %s, mcc: %s, mnc: %s}, rnibWriter: { stateChangeMessageChannel: %s, ranManipulationChannel: %s}", c.Logging.LogLevel, c.Http.Port, c.Rmr.Port, @@ -235,6 +246,7 @@ func (c *Configuration) String() string { c.GlobalRicId.RicId, c.GlobalRicId.Mcc, c.GlobalRicId.Mnc, - c.StateChangeMessageChannel, + c.RnibWriter.StateChangeMessageChannel, + c.RnibWriter.RanManipulationMessageChannel, ) }