X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=pkg%2Fxapp%2Frmr.go;h=ef8aea5d8c50d32156c735b2126e8393bf3bdbea;hb=refs%2Fchanges%2F19%2F5319%2F1;hp=f2d09dacc63be5606904e2d58296be0ca4c3ec90;hpb=b8b191fe31602c53414f8086381aef1a48e8be09;p=ric-plt%2Fxapp-frame.git diff --git a/pkg/xapp/rmr.go b/pkg/xapp/rmr.go index f2d09da..ef8aea5 100755 --- a/pkg/xapp/rmr.go +++ b/pkg/xapp/rmr.go @@ -67,6 +67,7 @@ import ( "bytes" "crypto/md5" "fmt" + "github.com/spf13/viper" "strings" "time" "unsafe" @@ -132,8 +133,9 @@ type RMRClientParams struct { } func (params *RMRClientParams) String() string { - return fmt.Sprintf("ProtPort=%d MaxSize=%d ThreadType=%d StatDesc=%s LowLatency=%t FastAck=%t", - params.RmrData.Port, params.RmrData.MaxSize, params.RmrData.ThreadType, params.StatDesc, params.RmrData.LowLatency, params.RmrData.FastAck) + return fmt.Sprintf("ProtPort=%d MaxSize=%d ThreadType=%d StatDesc=%s LowLatency=%t FastAck=%t Policies=%v", + params.RmrData.Port, params.RmrData.MaxSize, params.RmrData.ThreadType, params.StatDesc, + params.RmrData.LowLatency, params.RmrData.FastAck, params.RmrData.Policies) } //----------------------------------------------------------------------------- @@ -168,6 +170,16 @@ func NewRMRClientWithParams(params *RMRClientParams) *RMRClient { func NewRMRClient() *RMRClient { p := GetPortData("rmr-data") + if p.Port == 0 || viper.IsSet("rmr.protPort") { + // Old xApp descriptor used, fallback to rmr section + fmt.Sscanf(viper.GetString("rmr.protPort"), "tcp:%d", &p.Port) + p.MaxSize = viper.GetInt("rmr.maxSize") + p.ThreadType = viper.GetInt("rmr.threadType") + p.LowLatency = viper.GetBool("rmr.lowLatency") + p.FastAck = viper.GetBool("rmr.fastAck") + p.MaxRetryOnFailure = viper.GetInt("rmr.maxRetryOnFailure") + } + return NewRMRClientWithParams( &RMRClientParams{ RmrData: p,