2 // Copyright 2019 AT&T Intellectual Property
3 // Copyright 2019 Nokia
5 // Licensed under the Apache License, Version 2.0 (the "License");
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
26 "e2mgr/managers/notificationmanager"
27 "e2mgr/providers/httpmsghandlerprovider"
28 "e2mgr/providers/rmrmsghandlerprovider"
32 "e2mgr/services/rmrreceiver"
33 "e2mgr/services/rmrsender"
35 "gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/reader"
36 "gerrit.o-ran-sc.org/r/ric-plt/sdlgo"
42 config := configuration.ParseConfiguration()
43 logLevel, _ := logger.LogLevelTokenToLevel(config.Logging.LogLevel)
44 logger, err := logger.InitLogger(logLevel)
46 fmt.Printf("#app.main - failed to initialize logger, error: %s", err)
49 db := sdlgo.NewDatabase()
50 sdl := sdlgo.NewSdlInstance("e2Manager", db)
52 rnibDataService := services.NewRnibDataService(logger, config, reader.GetRNibReader(sdl), rNibWriter.GetRNibWriter( sdl))
53 var msgImpl *rmrCgo.Context
54 rmrMessenger := msgImpl.Init("tcp:"+strconv.Itoa(config.Rmr.Port), config.Rmr.MaxMsgSize, 0, logger)
55 rmrSender := rmrsender.NewRmrSender(logger, rmrMessenger)
56 ranSetupManager := managers.NewRanSetupManager(logger, rmrSender, rnibDataService)
57 rmrNotificationHandlerProvider := rmrmsghandlerprovider.NewNotificationHandlerProvider()
58 rmrNotificationHandlerProvider.Init(logger, config, rnibDataService, rmrSender, ranSetupManager)
60 notificationManager := notificationmanager.NewNotificationManager(logger, rmrNotificationHandlerProvider)
61 rmrReceiver := rmrreceiver.NewRmrReceiver(logger, rmrMessenger, notificationManager)
63 defer rmrMessenger.Close()
65 go rmrReceiver.ListenAndHandle()
67 httpMsgHandlerProvider := httpmsghandlerprovider.NewIncomingRequestHandlerProvider(logger, rmrSender, config, rnibDataService, ranSetupManager)
68 rootController := controllers.NewRootController(rnibDataService)
69 nodebController := controllers.NewNodebController(logger, httpMsgHandlerProvider)
70 _ = httpserver.Run(logger, config.Http.Port, rootController, nodebController)