Message handler for RMR messages 88/6188/1
authorsubhash kumar singh <subh.singh@samsung.com>
Tue, 1 Jun 2021 13:52:39 +0000 (19:22 +0530)
committersubhash kumar singh <subh.singh@samsung.com>
Tue, 1 Jun 2021 13:52:39 +0000 (19:22 +0530)
xApp will recive messages over RMR. Provide message consumer.

Signed-off-by: subhash kumar singh <subh.singh@samsung.com>
Change-Id: I327227cbfee0adf7728d1e49ad0cb9dad73302f3

hwApp.go

index 90aed67..2f82210 100755 (executable)
--- 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
 }