4 "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/xapp"
17 type Generator struct {
20 func (m Generator) Consume(params *xapp.RMRParams) (err error) {
21 xapp.Logger.Debug("message received - type=%d txid=%s ubId=%d meid=%s", params.Mtype, params.Xid, params.SubId, params.Meid.RanName)
27 ack := xapp.Config.GetInt("test.waitForAck")
35 func waitForMessages() {
36 done := make(chan struct{})
45 case <-time.After(5000 * time.Millisecond):
46 xapp.Logger.Warn("Message waiting timed out!")
50 func runTests(mtype, subId, amount, msize, ack int) {
53 s := make([]byte, msize, msize)
56 for i := 0; i < amount; i++ {
57 params := &xapp.RMRParams{}
61 params.Meid = &xapp.RMRMeid{PlmnID: "123456", EnbID: "7788", RanName: "RanName-gnb-1234"}
62 params.Xid = "TestXID1234"
63 if ok := xapp.Rmr.SendMsg(params); ok {
73 // Wait until all replies are received, or timeout occurs
76 elapsed := time.Since(start)
77 xapp.Logger.Info("amount=%d|tx=%d|rx=%d|failed=%d|time=%v\n", amount, tx, rx, failed, elapsed)
81 // Start RMR and wait until engine is ready
82 go xapp.Rmr.Start(Generator{})
83 for xapp.Rmr.IsReady() == false {
84 time.Sleep(time.Duration(2) * time.Second)
88 interval := 1000000 * 1.0 / xapp.Config.GetInt("test.rate")
89 mtype := xapp.Config.GetInt("test.mtype")
90 subId := xapp.Config.GetInt("test.subId")
91 amount := xapp.Config.GetInt("test.amount")
92 size := xapp.Config.GetInt("test.size")
93 ack := xapp.Config.GetInt("test.waitForAck")
94 rounds := xapp.Config.GetInt("test.rounds")
96 // Now generate message load as per request
97 for i := 0; i < rounds; i++ {
98 runTests(mtype, subId, amount, size, ack)
100 time.Sleep(time.Duration(interval) * time.Microsecond)