Changed xapptweak rmr send function to take in retry releated timeout
Change-Id: I5c92ecbfb578ec45ffb72600d45f7f858ce05394
Signed-off-by: Juha Hyttinen <juha.hyttinen@nokia.com>
diff --git a/pkg/xapptweaks/rmrparams.go b/pkg/xapptweaks/rmrparams.go
index f0ac9fb..30f42fd 100644
--- a/pkg/xapptweaks/rmrparams.go
+++ b/pkg/xapptweaks/rmrparams.go
@@ -29,14 +29,46 @@
//-----------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------
+type RMRMeid struct {
+ *xapp.RMRMeid
+}
+
+func (meid *RMRMeid) String() string {
+ str := "meid("
+ pad := ""
+ if len(meid.PlmnID) > 0 {
+ str += pad + "PlmnID=" + meid.PlmnID
+ pad = " "
+ }
+ if len(meid.EnbID) > 0 {
+ str += pad + "EnbID=" + meid.EnbID
+ pad = " "
+ }
+ if len(meid.RanName) > 0 {
+ str += pad + "RanName=" + meid.RanName
+ pad = " "
+ }
+ str += ")"
+ return str
+}
+
+func NewMeid(meid *xapp.RMRMeid) *RMRMeid {
+ if meid != nil {
+ return &RMRMeid{meid}
+ }
+ return &RMRMeid{&xapp.RMRMeid{}}
+}
+
+//-----------------------------------------------------------------------------
+//
+//-----------------------------------------------------------------------------
type RMRParams struct {
*xapp.RMRParams
}
func (params *RMRParams) String() string {
var b bytes.Buffer
- sum := md5.Sum(params.Payload)
- fmt.Fprintf(&b, "params(Src=%s Mtype=%d SubId=%d Xid=%s Meid=%s Paylens=%d/%d Payhash=%x)", params.Src, params.Mtype, params.SubId, params.Xid, params.Meid.RanName, params.PayloadLen, len(params.Payload), sum)
+ fmt.Fprintf(&b, "params(Src=%s Mtype=%d SubId=%d Xid=%s Meid=%s Paylens=%d/%d Paymd5=%x)", params.Src, params.Mtype, params.SubId, params.Xid, (&RMRMeid{params.Meid}).String(), params.PayloadLen, len(params.Payload), md5.Sum(params.Payload))
return b.String()
}
diff --git a/pkg/xapptweaks/rmrwrapper.go b/pkg/xapptweaks/rmrwrapper.go
index ef633bd..ac602bf 100644
--- a/pkg/xapptweaks/rmrwrapper.go
+++ b/pkg/xapptweaks/rmrwrapper.go
@@ -47,14 +47,16 @@
func (tc *RmrWrapper) Init() {
}
-func (tc *RmrWrapper) RmrSend(params *RMRParams) (err error) {
+func (tc *RmrWrapper) RmrSend(params *RMRParams, to time.Duration) (err error) {
if tc.Rmr == nil {
err = fmt.Errorf("Failed rmr object nil for %s", params.String())
return
}
- status := false
- i := 1
- for ; i <= 10 && status == false; i++ {
+ tc.Lock()
+ status := tc.Rmr.Send(params.RMRParams, false)
+ tc.Unlock()
+ i := 0
+ for ; i < int(to)*2 && status == false; i++ {
tc.Lock()
status = tc.Rmr.Send(params.RMRParams, false)
tc.Unlock()
diff --git a/pkg/xapptweaks/xappwrapper.go b/pkg/xapptweaks/xappwrapper.go
index 8b7c91d..faf3c18 100644
--- a/pkg/xapptweaks/xappwrapper.go
+++ b/pkg/xapptweaks/xappwrapper.go
@@ -21,13 +21,14 @@
import (
"gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/xapp"
+ "time"
)
//-----------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------
type XAppWrapperIf interface {
- RmrSend(params *RMRParams) (err error)
+ RmrSend(params *RMRParams, to time.Duration) (err error)
GetLogger() *xapp.Log
}