blob: 4e38c3bae773c09fc4bee41011afd28c893840bf [file] [log] [blame]
Mohamed Abukar2e78e422019-06-02 11:45:52 +03001package main
2
3import (
4 "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/xapp"
5)
6
7type Forwarder struct {
8}
9
Mohamed Abukarf11ab7a2019-08-14 16:55:01 +030010func (m Forwarder) Consume(params *xapp.RMRParams) (err error) {
Mohamed Abukar19461e12019-08-23 08:46:11 +030011 xapp.Logger.Debug("Message received - type=%d txid=%s subId=%d meid=%s",
12 params.Mtype, params.Xid, params.SubId, params.Meid.RanName)
Mohamed Abukar2e78e422019-06-02 11:45:52 +030013
14 // Store data and reply with the same message payload
15 if xapp.Config.GetInt("test.store") != 0 {
Mohamed Abukarf11ab7a2019-08-14 16:55:01 +030016 xapp.Sdl.Store("myKey", params.Payload)
Mohamed Abukar2e78e422019-06-02 11:45:52 +030017 }
18
19 mid := xapp.Config.GetInt("test.mtype")
20 if mid != 0 {
Mohamed Abukarf11ab7a2019-08-14 16:55:01 +030021 params.Mtype = mid
Mohamed Abukar2e78e422019-06-02 11:45:52 +030022 } else {
Mohamed Abukarf11ab7a2019-08-14 16:55:01 +030023 params.Mtype = params.Mtype + 1
Mohamed Abukar2e78e422019-06-02 11:45:52 +030024 }
25
26 sid := xapp.Config.GetInt("test.subId")
27 if sid != 0 {
Mohamed Abukarf11ab7a2019-08-14 16:55:01 +030028 params.SubId = sid
Mohamed Abukar2e78e422019-06-02 11:45:52 +030029 }
30
Mohamed Abukar5b964f42019-08-19 11:09:37 +030031 if ok := xapp.Rmr.SendRts(params); !ok {
Mohamed Abukar2e78e422019-06-02 11:45:52 +030032 xapp.Logger.Info("Rmr.Send failed ...")
33 }
34 return
35}
36
37func forwarder() {
38 xapp.Run(Forwarder{})
39}