From 4e69e56276c4236516d20340b47072cc74fc95f1 Mon Sep 17 00:00:00 2001 From: Juha Hyttinen Date: Tue, 25 Feb 2020 12:23:20 +0200 Subject: [PATCH] Added hash to params payload string print Change-Id: Ie7ec49455b0cb775cd9826946ad051ff49000e80 Signed-off-by: Juha Hyttinen --- pkg/teststube2ap/stubE2.go | 6 ++++++ pkg/xapptweaks/rmrparams.go | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/pkg/teststube2ap/stubE2.go b/pkg/teststube2ap/stubE2.go index dbd518b..9323555 100644 --- a/pkg/teststube2ap/stubE2.go +++ b/pkg/teststube2ap/stubE2.go @@ -198,6 +198,7 @@ func (tc *E2Stub) SendSubsReq(t *testing.T, rparams *E2StubSubsReqParams, oldTra params.Mtype = xapp.RIC_SUB_REQ params.SubId = -1 params.Payload = packedMsg.Buf + params.PayloadLen = len(packedMsg.Buf) params.Meid = trans.meid params.Xid = trans.xid params.Mbuf = nil @@ -282,6 +283,7 @@ func (tc *E2Stub) SendSubsResp(t *testing.T, req *e2ap.E2APSubscriptionRequest, //params.SubId = msg.SubId params.SubId = -1 params.Payload = packedMsg.Buf + params.PayloadLen = len(packedMsg.Buf) params.Meid = msg.Meid //params.Xid = msg.Xid params.Mbuf = nil @@ -354,6 +356,7 @@ func (tc *E2Stub) SendSubsFail(t *testing.T, fparams *E2StubSubsFailParams, msg params.Mtype = xapp.RIC_SUB_FAILURE params.SubId = msg.SubId params.Payload = packedMsg.Buf + params.PayloadLen = len(packedMsg.Buf) params.Meid = msg.Meid params.Xid = msg.Xid params.Mbuf = nil @@ -436,6 +439,7 @@ func (tc *E2Stub) SendSubsDelReq(t *testing.T, oldTrans *RmrTransactionId, e2Sub params.Mtype = xapp.RIC_SUB_DEL_REQ params.SubId = int(e2SubsId) params.Payload = packedMsg.Buf + params.PayloadLen = len(packedMsg.Buf) params.Meid = trans.meid params.Xid = trans.xid params.Mbuf = nil @@ -505,6 +509,7 @@ func (tc *E2Stub) SendSubsDelResp(t *testing.T, req *e2ap.E2APSubscriptionDelete params.Mtype = xapp.RIC_SUB_DEL_RESP params.SubId = msg.SubId params.Payload = packedMsg.Buf + params.PayloadLen = len(packedMsg.Buf) params.Meid = msg.Meid params.Xid = msg.Xid params.Mbuf = nil @@ -576,6 +581,7 @@ func (tc *E2Stub) SendSubsDelFail(t *testing.T, req *e2ap.E2APSubscriptionDelete params.Mtype = xapp.RIC_SUB_DEL_FAILURE params.SubId = msg.SubId params.Payload = packedMsg.Buf + params.PayloadLen = len(packedMsg.Buf) params.Meid = msg.Meid params.Xid = msg.Xid params.Mbuf = nil diff --git a/pkg/xapptweaks/rmrparams.go b/pkg/xapptweaks/rmrparams.go index 812a43e..f0ac9fb 100644 --- a/pkg/xapptweaks/rmrparams.go +++ b/pkg/xapptweaks/rmrparams.go @@ -21,6 +21,7 @@ package xapptweaks import ( "bytes" + "crypto/md5" "fmt" "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/xapp" ) @@ -34,7 +35,8 @@ type RMRParams struct { func (params *RMRParams) String() string { var b bytes.Buffer - fmt.Fprintf(&b, "params(Src=%s Mtype=%d SubId=%d Xid=%s Meid=%s Paylens=%d/%d)", params.Src, params.Mtype, params.SubId, params.Xid, params.Meid.RanName, params.PayloadLen, len(params.Payload)) + 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) return b.String() } -- 2.16.6