From 2ba8bc2ade86b8db83c900cc0ca3105b33ca212d Mon Sep 17 00:00:00 2001 From: subhash kumar singh Date: Tue, 1 Jun 2021 19:22:39 +0530 Subject: [PATCH] Message handler for RMR messages xApp will recive messages over RMR. Provide message consumer. Signed-off-by: subhash kumar singh Change-Id: I327227cbfee0adf7728d1e49ad0cb9dad73302f3 --- hwApp.go | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/hwApp.go b/hwApp.go index 90aed67..2f82210 100755 --- a/hwApp.go +++ b/hwApp.go @@ -31,12 +31,32 @@ func (e *HWApp) ConfigChangeHandler(f string) { xapp.Logger.Info("Config file changed") } - func (e *HWApp) xAppStartCB(d interface{}) { xapp.Logger.Info("xApp ready call back received") } -func (e *HWApp) Consume(rp *xapp.RMRParams) (err error) { +func (e *HWApp) Consume(msg *xapp.RMRParams) (err error) { + id := xapp.Rmr.GetRicMessageName(msg.Mtype) + + xapp.Logger.Info("Message received: name=%s meid=%s subId=%d txid=%s len=%d", id, msg.Meid.RanName, msg.SubId, msg.Xid, msg.PayloadLen) + + switch id { + // policy request handler + case "A1_POLICY_REQUEST": + xapp.Logger.Info("Recived policy instance list") + + // health check request + case "RIC_HEALTH_CHECK_REQ": + xapp.Logger.Info("Received health check request") + + default: + xapp.Logger.Info("Unknown message type '%d', discarding", msg.Mtype) + } + + defer func() { + xapp.Rmr.Free(msg.Mbuf) + msg.Mbuf = nil + }() return } -- 2.16.6