X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=pkg%2Fteststub%2FcontrolRmrStub.go;h=7edc22b6f97ac8b2aedb7b4a16af304adfcb438b;hb=e60d7b6dc1c2244ef9f885d03984d2bd238a49e0;hp=60b3cc55869a79c08ad77e022444429df8c27f20;hpb=9dc5adc78d459157a42ef8997eeced82a3616f01;p=ric-plt%2Fsubmgr.git diff --git a/pkg/teststub/controlRmrStub.go b/pkg/teststub/controlRmrStub.go index 60b3cc5..7edc22b 100644 --- a/pkg/teststub/controlRmrStub.go +++ b/pkg/teststub/controlRmrStub.go @@ -20,7 +20,6 @@ package teststub import ( "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/xapp" - "strconv" "strings" "testing" "time" @@ -67,13 +66,26 @@ func (tc *RmrStubControl) TestMsgChanEmpty(t *testing.T) { } } -func (tc *RmrStubControl) Init(desc string, srcId RmrSrcId, rtgSvc RmrRtgSvc, stat string, initMsg int) { +func (tc *RmrStubControl) Init(desc string, srcId RmrSrcId, rtgSvc RmrRtgSvc, statDesc string, initMsg int) { tc.InitMsg = initMsg tc.Active = false tc.RecvChan = make(chan *xapp.RMRParams) tc.RmrControl.Init(desc, srcId, rtgSvc) - tc.RMRClient = xapp.NewRMRClientWithParams("tcp:"+strconv.FormatUint(uint64(srcId.Port), 10), 65534, 0, stat) + tc.RMRClient = xapp.NewRMRClientWithParams(&xapp.RMRClientParams{ + StatDesc: statDesc, + RmrData: xapp.PortData{ + Name: "", // Not used currently + Port: int(srcId.Port), + MaxSize: 65534, + ThreadType: 0, + LowLatency: false, + FastAck: false, + //Policies: // Not used currently + MaxRetryOnFailure: 1, + }, + }) + tc.RMRClient.SetReadyCB(tc.ReadyCB, nil) go tc.RMRClient.Start(tc) @@ -89,17 +101,17 @@ func (tc *RmrStubControl) Consume(msg *xapp.RMRParams) (err error) { msg.PayloadLen = len(cPay) if msg.Mtype == tc.InitMsg { - tc.Info("Testing message ignore %s", msg.String()) + tc.Debug("Testing message ignore %s", msg.String()) tc.SetActive() return } if tc.IsCheckXid() == true && strings.Contains(msg.Xid, tc.GetDesc()) == false { - tc.Info("Ignore %s", msg.String()) + tc.Debug("Ignore %s", msg.String()) return } - tc.Info("Consume %s", msg.String()) + tc.Debug("Consume %s", msg.String()) tc.PushMsg(msg) return } @@ -149,14 +161,14 @@ func RmrStubControlWaitAlive(seconds int, mtype int, rmr *xapp.RMRClient, tent * params.Mbuf = nil if len(allRmrStubs) == 0 { - tent.Info("No rmr stubs so no need to wait those to be alive") + tent.Debug("No rmr stubs so no need to wait those to be alive") return true } status := false i := 1 for ; i <= seconds*2 && status == false; i++ { - tent.Info("SEND TESTPING: %s", params.String()) + tent.Debug("SEND TESTPING: %s", params.String()) rmr.SendWithRetry(params, false, 0) status = true @@ -169,7 +181,7 @@ func RmrStubControlWaitAlive(seconds int, mtype int, rmr *xapp.RMRClient, tent * if status == true { break } - tent.Info("Sleep 0.5 secs and try routes again") + tent.Debug("Sleep 0.5 secs and try routes again") time.Sleep(500 * time.Millisecond) }