Mohamed Abukar | 2e78e42 | 2019-06-02 11:45:52 +0300 | [diff] [blame] | 1 | package main |
| 2 | |
| 3 | import ( |
| 4 | "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/xapp" |
| 5 | ) |
| 6 | |
| 7 | type Forwarder struct { |
| 8 | } |
| 9 | |
Mohamed Abukar | f11ab7a | 2019-08-14 16:55:01 +0300 | [diff] [blame] | 10 | func (m Forwarder) Consume(params *xapp.RMRParams) (err error) { |
Mohamed Abukar | 19461e1 | 2019-08-23 08:46:11 +0300 | [diff] [blame] | 11 | xapp.Logger.Debug("Message received - type=%d txid=%s subId=%d meid=%s", |
| 12 | params.Mtype, params.Xid, params.SubId, params.Meid.RanName) |
Mohamed Abukar | 2e78e42 | 2019-06-02 11:45:52 +0300 | [diff] [blame] | 13 | |
| 14 | // Store data and reply with the same message payload |
| 15 | if xapp.Config.GetInt("test.store") != 0 { |
Mohamed Abukar | f11ab7a | 2019-08-14 16:55:01 +0300 | [diff] [blame] | 16 | xapp.Sdl.Store("myKey", params.Payload) |
Mohamed Abukar | 2e78e42 | 2019-06-02 11:45:52 +0300 | [diff] [blame] | 17 | } |
| 18 | |
| 19 | mid := xapp.Config.GetInt("test.mtype") |
| 20 | if mid != 0 { |
Mohamed Abukar | f11ab7a | 2019-08-14 16:55:01 +0300 | [diff] [blame] | 21 | params.Mtype = mid |
Mohamed Abukar | 2e78e42 | 2019-06-02 11:45:52 +0300 | [diff] [blame] | 22 | } else { |
Mohamed Abukar | f11ab7a | 2019-08-14 16:55:01 +0300 | [diff] [blame] | 23 | params.Mtype = params.Mtype + 1 |
Mohamed Abukar | 2e78e42 | 2019-06-02 11:45:52 +0300 | [diff] [blame] | 24 | } |
| 25 | |
| 26 | sid := xapp.Config.GetInt("test.subId") |
| 27 | if sid != 0 { |
Mohamed Abukar | f11ab7a | 2019-08-14 16:55:01 +0300 | [diff] [blame] | 28 | params.SubId = sid |
Mohamed Abukar | 2e78e42 | 2019-06-02 11:45:52 +0300 | [diff] [blame] | 29 | } |
| 30 | |
Mohamed Abukar | 5b964f4 | 2019-08-19 11:09:37 +0300 | [diff] [blame] | 31 | if ok := xapp.Rmr.SendRts(params); !ok { |
Mohamed Abukar | 2e78e42 | 2019-06-02 11:45:52 +0300 | [diff] [blame] | 32 | xapp.Logger.Info("Rmr.Send failed ...") |
| 33 | } |
| 34 | return |
| 35 | } |
| 36 | |
| 37 | func forwarder() { |
| 38 | xapp.Run(Forwarder{}) |
| 39 | } |