-func SetLogLevel(loglevel string) {
- switch loglevel {
- case "INFO":
- Logger.Level(lumber.INFO)
- case "WARN":
- Logger.Level(lumber.WARN)
- case "ERROR":
- Logger.Level(lumber.ERROR)
- case "DEBUG":
- Logger.Info("debugmode")
- Logger.Level(lumber.DEBUG)
+func GetPlatformComponents(configfile string) (*PlatformComponents, error) {
+ xapp.Logger.Debug("Invoked rtmgr.GetPlatformComponents(" + configfile + ")")
+ var rcfg ConfigRtmgr
+ var rtroutes RtmgrRoutes
+ var mtypes MessageTypeIdentifier
+ yamlFile, err := os.Open(configfile)
+ if err != nil {
+ return nil, errors.New("cannot open the file due to: " + err.Error())
+ }
+ defer yamlFile.Close()
+ byteValue, err := ioutil.ReadAll(yamlFile)
+ if err != nil {
+ return nil, errors.New("cannot read the file due to: " + err.Error())
+ }
+ jsonByteValue, err := yaml.YAMLToJSON(byteValue)
+ if err != nil {
+ return nil, errors.New("cannot read the file due to: " + err.Error())
+ }
+ err = json.Unmarshal(jsonByteValue, &rtroutes)
+ if err != nil {
+ return nil, errors.New("cannot parse data due to: " + err.Error())
+ }
+ PrsCfg = &(rtroutes.Prs)
+
+ err = json.Unmarshal(jsonByteValue, &mtypes)
+ if err != nil {
+ return nil, errors.New("cannot parse data due to: " + err.Error())
+ } else {
+ xapp.Logger.Debug("Messgaetypes = %v", mtypes)
+ for _, m := range mtypes.Mit {
+ splitstr := strings.Split(m, "=")
+ Mtype[splitstr[0]] = splitstr[1]
+ }
+ }
+ err = json.Unmarshal(jsonByteValue, &rcfg)
+ if err != nil {
+ return nil, errors.New("cannot parse data due to: " + err.Error())