RUN curl -s https://packagecloud.io/install/repositories/o-ran-sc/master/script.deb.sh | bash
# RMR
-ARG RMRVERSION=3.5.0
+ARG RMRVERSION=3.5.2
#RUN apt-get install -y rmr=${RMRVERSION} rmr-dev=${RMRVERSION}
RUN wget --content-disposition https://packagecloud.io/o-ran-sc/staging/packages/debian/stretch/rmr_${RMRVERSION}_amd64.deb/download.deb && dpkg -i rmr_${RMRVERSION}_amd64.deb
RUN wget --content-disposition https://packagecloud.io/o-ran-sc/staging/packages/debian/stretch/rmr-dev_${RMRVERSION}_amd64.deb/download.deb && dpkg -i rmr-dev_${RMRVERSION}_amd64.deb
Src string
Mbuf *C.rmr_mbuf_t
Whid int
+ Callid int
+ Timeout int
status int
}
return m.Send(params, true)
}
-func (m *RMRClient) Send(params *RMRParams, isRts bool) bool {
+func (m *RMRClient) CopyBuffer(params *RMRParams) *C.rmr_mbuf_t {
txBuffer := params.Mbuf
if txBuffer == nil {
txBuffer = m.Allocate()
if txBuffer == nil {
- return false
+ return nil
}
}
}
}
C.write_bytes_array(txBuffer.payload, datap, txBuffer.len)
+ return txBuffer
+}
+
+func (m *RMRClient) Send(params *RMRParams, isRts bool) bool {
+ txBuffer := m.CopyBuffer(params)
+ if txBuffer == nil {
+ return false
+ }
params.status = m.SendBuf(txBuffer, isRts, params.Whid)
if params.status == int(C.RMR_OK) {
return true
return int(currBuffer.state)
}
+func (m *RMRClient) SendCallMsg(params *RMRParams) (int, string) {
+ var (
+ currBuffer *C.rmr_mbuf_t
+ counterName string = "Transmitted"
+ )
+ txBuffer := m.CopyBuffer(params)
+ if txBuffer == nil {
+ return C.RMR_ERR_INITFAILED, ""
+ }
+
+ txBuffer.state = 0
+
+ currBuffer = C.rmr_wh_call(m.context, C.int(params.Whid), txBuffer, C.int(params.Callid), C.int(params.Timeout))
+
+ if currBuffer == nil {
+ m.UpdateStatCounter("TransmitError")
+ return m.LogMBufError("SendBuf failed", txBuffer), ""
+ }
+
+ if currBuffer.state != C.RMR_OK {
+ counterName = "TransmitError"
+ m.LogMBufError("SendBuf failed", currBuffer)
+ }
+
+ m.UpdateStatCounter(counterName)
+ defer m.Free(currBuffer)
+
+ cptr := unsafe.Pointer(currBuffer.payload)
+ payload := C.GoBytes(cptr, C.int(currBuffer.len))
+
+ return int(currBuffer.state), string(payload)
+}
+
func (m *RMRClient) Openwh(target string) C.rmr_whid_t {
return m.Wh_open(target)
}
Rmr.Closewh(int(whid))
}
+func TestMessagesReceivedSuccessfullyUsingWhCall(t *testing.T) {
+ time.Sleep(time.Duration(5) * time.Second)
+ whid := Rmr.Openwh("localhost:4560")
+ params := &RMRParams{}
+ params.Payload = []byte("newrt|start\nnewrt|end\n")
+ params.Whid = int(whid)
+ params.Callid = 4
+ params.Timeout = 1000
+ Rmr.SendCallMsg(params)
+
+ // Allow time to process the messages
+ time.Sleep(time.Duration(2) * time.Second)
+
+ waitForSdl := viper.GetBool("db.waitForSdl")
+ stats := getMetrics(t)
+ if !strings.Contains(stats, "ricxapp_RMR_Transmitted 200") {
+ t.Errorf("Error: ricxapp_RMR_Transmitted value incorrect: %v", stats)
+ }
+
+ if !strings.Contains(stats, "ricxapp_RMR_Received 201") {
+ t.Errorf("Error: ricxapp_RMR_Received value incorrect: %v", stats)
+ }
+
+ if !strings.Contains(stats, "ricxapp_RMR_TransmitError 1") {
+ t.Errorf("Error: ricxapp_RMR_TransmitError value incorrect")
+ }
+
+ if !strings.Contains(stats, "ricxapp_RMR_ReceiveError 0") {
+ t.Errorf("Error: ricxapp_RMR_ReceiveError value incorrect")
+ }
+
+ if waitForSdl && !strings.Contains(stats, "ricxapp_SDL_Stored 201") {
+ t.Errorf("Error: ricxapp_SDL_Stored value incorrect")
+ }
+
+ if waitForSdl && !strings.Contains(stats, "ricxapp_SDL_StoreError 0") {
+ t.Errorf("Error: ricxapp_SDL_StoreError value incorrect")
+ }
+ Rmr.Closewh(int(whid))
+}
+
func TestSubscribeChannels(t *testing.T) {
if !viper.GetBool("db.waitForSdl") {
return