Code Review
/
ric-plt
/
xapp-frame.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
RunParams as struct to have possible to extend later.
[ric-plt/xapp-frame.git]
/
pkg
/
xapp
/
xapp.go
diff --git
a/pkg/xapp/xapp.go
b/pkg/xapp/xapp.go
index
d08e1cf
..
439c177
100755
(executable)
--- a/
pkg/xapp/xapp.go
+++ b/
pkg/xapp/xapp.go
@@
-48,22
+48,23
@@
type ShutdownCB func()
var (
// XApp is an application instance
var (
// XApp is an application instance
- Rmr *RMRClient
- Sdl *SDLClient
- SdlStorage *SDLStorage
- Rnib *RNIBClient
- Resource *Router
- Metric *Metrics
- Logger *Log
- Config Configurator
- Subscription *Subscriber
- Alarm *AlarmClient
- Util *Utils
- readyCb ReadyCB
- readyCbParams interface{}
- shutdownCb ShutdownCB
- shutdownFlag int32
- shutdownCnt int32
+ Rmr *RMRClient
+ Sdl *SDLClient
+ SdlStorage *SDLStorage
+ Rnib *RNIBClient
+ Resource *Router
+ Metric *Metrics
+ Logger *Log
+ Config Configurator
+ Subscription *Subscriber
+ Alarm *AlarmClient
+ Util *Utils
+ readyCb ReadyCB
+ readyCbParams interface{}
+ shutdownCb ShutdownCB
+ shutdownFlag int32
+ shutdownCnt int32
+ disableAlarmClient bool
)
var startTime time.Time
)
var startTime time.Time
@@
-86,7
+87,9
@@
func SetReadyCB(cb ReadyCB, params interface{}) {
}
func XappReadyCb(params interface{}) {
}
func XappReadyCb(params interface{}) {
- Alarm = NewAlarmClient(viper.GetString("moId"), viper.GetString("name"))
+ if disableAlarmClient == false {
+ Alarm = NewAlarmClient(viper.GetString("moId"), viper.GetString("name"))
+ }
if readyCb != nil {
readyCb(readyCbParams)
}
if readyCb != nil {
readyCb(readyCbParams)
}
@@
-317,7
+320,19
@@
func GetIpAddress() (string, error) {
return "<nil>", fmt.Errorf("Interface (%s) couldn't find ip", ifname)
}
return "<nil>", fmt.Errorf("Interface (%s) couldn't find ip", ifname)
}
-func RunWithParams(c MessageConsumer, sdlcheck bool) {
+type RunParams struct {
+ SdlCheck bool
+ DisableAlarmClient bool
+}
+
+func RunWithRunParams(c MessageConsumer, params RunParams) {
+
+ if params.DisableAlarmClient {
+ disableAlarmClient = true
+ } else {
+ disableAlarmClient = false
+ }
+
Rmr = NewRMRClient()
Rmr.SetReadyCB(XappReadyCb, nil)
Rmr = NewRMRClient()
Rmr.SetReadyCB(XappReadyCb, nil)
@@
-334,7
+349,7
@@
func RunWithParams(c MessageConsumer, sdlcheck bool) {
go http.ListenAndServe(host, Resource.router)
Logger.Info(fmt.Sprintf("Xapp started, listening on: %s", host))
go http.ListenAndServe(host, Resource.router)
Logger.Info(fmt.Sprintf("Xapp started, listening on: %s", host))
- if
sdlc
heck {
+ if
params.SdlC
heck {
SdlStorage.TestConnection(viper.GetString("controls.db.namespace"))
}
go registerXapp()
SdlStorage.TestConnection(viper.GetString("controls.db.namespace"))
}
go registerXapp()
@@
-342,6
+357,10
@@
func RunWithParams(c MessageConsumer, sdlcheck bool) {
Rmr.Start(c)
}
Rmr.Start(c)
}
+func RunWithParams(c MessageConsumer, sdlcheck bool) {
+ RunWithRunParams(c, RunParams{SdlCheck: sdlcheck, DisableAlarmClient: false})
+}
+
func Run(c MessageConsumer) {
RunWithParams(c, true)
}
func Run(c MessageConsumer) {
RunWithParams(c, true)
}