- rtmgr.Logger.Info("Recieved intial xapp data and platform data, writing into SDL.")
- // Combine the xapps data and platform data before writing to the SDL
- ricData := &rtmgr.RicComponents{Xapps: *xappData, Pcs: *pcData}
-
- writeErr := sdlEngine.WriteAll(fileName, ricData)
- if writeErr != nil {
- rtmgr.Logger.Error(writeErr.Error())
- }
- // post subscription req to appmgr
- readErr = PostSubReq(xmurl, nbiif)
- if readErr == nil {
- return nil
- }
- } else if err == nil {
- readErr = errors.New("Unexpected HTTP status code")
- } else {
- rtmgr.Logger.Warn("cannot get xapp data due to: " + err.Error())
- readErr = err
- }
- }
- return readErr
+func retrieveStartupData(xmurl string, nbiif string, fileName string, configfile string, sdlEngine sdl.Engine) error {
+ var readErr error
+ var maxRetries = 10
+ for i := 1; i <= maxRetries; i++ {
+ time.Sleep(2 * time.Second)
+ xappData, err := httpGetXApps(xmurl)
+ if xappData != nil && err == nil {
+ pcData, confErr := rtmgr.GetPlatformComponents(configfile)
+ if confErr != nil {
+ xapp.Logger.Error(confErr.Error())
+ return confErr
+ }
+ xapp.Logger.Info("Recieved intial xapp data and platform data, writing into SDL.")
+ // Combine the xapps data and platform data before writing to the SDL
+ ricData := &rtmgr.RicComponents{XApps: *xappData, Pcs: *pcData, E2Ts: make(map[string]rtmgr.E2TInstance)}
+ writeErr := sdlEngine.WriteAll(fileName, ricData)
+ if writeErr != nil {
+ xapp.Logger.Error(writeErr.Error())
+ }
+ // post subscription req to appmgr
+ readErr = PostSubReq(xmurl, nbiif)
+ if readErr == nil {
+ return nil
+ }
+ } else if err == nil {
+ readErr = errors.New("unexpected HTTP status code")
+ } else {
+ xapp.Logger.Warn("cannot get xapp data due to: " + err.Error())
+ readErr = err
+ }
+ }
+ return readErr