Updating to newer xapp-frame 0.0.30 version. Prepared also for 4.* version 12/2912/2
authorJuha Hyttinen <juha.hyttinen@nokia.com>
Wed, 18 Mar 2020 09:45:57 +0000 (11:45 +0200)
committerJuha Hyttinen <juha.hyttinen@nokia.com>
Mon, 23 Mar 2020 07:27:10 +0000 (09:27 +0200)
Change-Id: I86866b1e57bbc84421eb365d38b62839c8954f50
Signed-off-by: Juha Hyttinen <juha.hyttinen@nokia.com>
Dockerfile
go.mod
go.sum
pkg/teststub/controlRmr.go
pkg/teststub/controlRmrStub.go
pkg/xapptweaks/rmrwrapper.go
run_submgr.sh
test/uta_rtg.rt [new file with mode: 0755]

index b7adf64..4e82a9a 100644 (file)
@@ -36,23 +36,30 @@ WORKDIR /tmp
 ##RUN cd asn1c && make check
 #RUN cd asn1c && make install
 
+#
+# Swagger
+#
+ARG SWAGGERVERSION=v0.19.0
+ARG SWAGGERURL=https://github.com/go-swagger/go-swagger/releases/download/${SWAGGERVERSION}/swagger_linux_amd64
+RUN wget --quiet ${SWAGGERURL} \
+    && mv swagger_linux_amd64 swagger \
+    && chmod +x swagger \
+    && mv swagger /usr/local/bin/
 
-ARG RMRVERSION=3.2.4
+#
+# GO DELVE
+#
+RUN export GOBIN=/usr/local/bin/ ; \
+    go get -u github.com/go-delve/delve/cmd/dlv \
+    && go install github.com/go-delve/delve/cmd/dlv
+
+
+ARG RMRVERSION=3.5.0
 # Install RMr shared library
 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 && rm -rf rmr_${RMRVERSION}_amd64.deb
 # Install RMr development header files
 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 && rm -rf rmr-dev_${RMRVERSION}_amd64.deb
 
-# "Installing Swagger"
-RUN wget --quiet https://github.com/go-swagger/go-swagger/releases/download/v0.19.0/swagger_linux_amd64 \
-    && mv swagger_linux_amd64 swagger \
-    && chmod +x swagger \
-    && mkdir -p /root/.go/bin \
-    && mv swagger /root/.go/bin
-
-ENV GOPATH=/root/.go
-ENV PATH=$PATH:/root/.go/bin
-RUN go get -u github.com/go-delve/delve/cmd/dlv
 
 WORKDIR /opt/submgr
 
@@ -140,6 +147,8 @@ RUN go mod tidy
 # unittest
 COPY test/config-file.json test/config-file.json
 ENV CFG_FILE=/opt/submgr/test/config-file.json
+COPY test/uta_rtg.rt test/uta_rtg.rt
+ENV RMR_SEED_RT=/opt/submgr/test/uta_rtg.rt 
 
 RUN go test -test.coverprofile /tmp/submgr_cover.out -count=1 -v ./pkg/control 
 
diff --git a/go.mod b/go.mod
index 4e1bc89..7c1c04b 100644 (file)
--- a/go.mod
+++ b/go.mod
@@ -11,11 +11,12 @@ require (
        github.com/go-openapi/swag v0.19.7
        github.com/go-openapi/validate v0.19.6
        github.com/spf13/viper v1.5.0
+       github.com/stretchr/testify v1.5.1
 )
 
 replace gerrit.o-ran-sc.org/r/ric-plt/sdlgo => gerrit.o-ran-sc.org/r/ric-plt/sdlgo.git v0.2.0
 
-replace gerrit.o-ran-sc.org/r/ric-plt/xapp-frame => gerrit.o-ran-sc.org/r/ric-plt/xapp-frame.git v0.0.28
+replace gerrit.o-ran-sc.org/r/ric-plt/xapp-frame => gerrit.o-ran-sc.org/r/ric-plt/xapp-frame.git v0.0.30
 
 replace gerrit.o-ran-sc.org/r/com/golog => gerrit.o-ran-sc.org/r/com/golog.git v0.0.1
 
diff --git a/go.sum b/go.sum
index 61749ed..d839f9e 100644 (file)
--- a/go.sum
+++ b/go.sum
@@ -1,6 +1,8 @@
 cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
 gerrit.o-ran-sc.org/r/com/golog.git v0.0.1 h1:9RfO/Whehaaq5KiJTT7s+YOzmi9mT1C3HktfhwwMEmw=
 gerrit.o-ran-sc.org/r/com/golog.git v0.0.1/go.mod h1:b8YB31U8/4iRpABioeSzGi/YMzOQ/Zq7hrJmmXKqlJk=
+gerrit.o-ran-sc.org/r/ric-plt/alarm-go.git/alarm v0.4.0 h1:Uvyfuq2jyb1aosy2BEzH1g3pe2gy4sMgpsXlvjVeBzI=
+gerrit.o-ran-sc.org/r/ric-plt/alarm-go.git/alarm v0.4.0/go.mod h1:AdEWKtERGvOQy9ybLhyhrb9w9LLVn8i9xzTwoR5n4BY=
 gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/common v1.0.21 h1:eK9nUZOTMJ/EnMpH9bkWtMgOvCn3u4+PNCb9gu10s6w=
 gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/common v1.0.21/go.mod h1:QJ1uPPZosGbhxUWpUpeM5fLqFHdnWTrVnvW2DgyOCes=
 gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities v1.0.21 h1:PQ/Mu2ol+8Oh/0BqCWWhPlVVoRCg5dQDEGm4+Opp5w4=
@@ -9,11 +11,8 @@ gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/reader v1.0.21 h1:N3UbqJ9WqC8JEz/Tw
 gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/reader v1.0.21/go.mod h1:SQBZLy1HP94i1vQ3y730wGFsrHqZtgPaEkzPgtqBNw0=
 gerrit.o-ran-sc.org/r/ric-plt/sdlgo.git v0.2.0 h1:7edCLIQtk9xCwxTtLRUlXr8wQ6nmr/Mo4ZoqjF3m0NE=
 gerrit.o-ran-sc.org/r/ric-plt/sdlgo.git v0.2.0/go.mod h1:2Y8gw2jqj9urI8VFqFQn7BX0J3A852+YrXVV9V8gOt4=
-gerrit.o-ran-sc.org/r/ric-plt/xapp-frame.git v0.0.23 h1:T8Q6dtYFsTXg60Xyz4GhsmEHsi9TdPbgc44caQpVgXY=
-gerrit.o-ran-sc.org/r/ric-plt/xapp-frame.git v0.0.23/go.mod h1:WHzMFLWFYnKZzAT76Lu8wXqcM9MQ9hHM0sxlV45icSw=
-gerrit.o-ran-sc.org/r/ric-plt/xapp-frame.git v0.0.25 h1:wRu8Cn1pP0+YKp1L8pa3rAD1oNqJZwCK57tcyFHi4yA=
-gerrit.o-ran-sc.org/r/ric-plt/xapp-frame.git v0.0.28 h1:L+bOJX53K0BPwdBDg26EIa1wTGiXSZZJothSVovwxsE=
-gerrit.o-ran-sc.org/r/ric-plt/xapp-frame.git v0.0.28/go.mod h1:lW3UYpVXwPiOR39t6JgNCE4kdmMSdPVelMPC/Pp9fQM=
+gerrit.o-ran-sc.org/r/ric-plt/xapp-frame.git v0.4.1 h1:ydw6WM3PNOKI0LAEyCKWCJ4LncHMfyHdpvCAHBYwrdE=
+gerrit.o-ran-sc.org/r/ric-plt/xapp-frame.git v0.4.1/go.mod h1:29CdUcCrNEqVBjQWAlgeGrYxSWqSZ4e67xzhuSf6BkI=
 github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
 github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
 github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
@@ -232,6 +231,8 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf
 github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
 github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
 github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
+github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4=
+github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
 github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s=
 github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=
 github.com/tidwall/pretty v1.0.0 h1:HsD+QiTn7sK6flMKIvNmpqz1qrpP3Ps6jOKIKMooyg4=
index bcea500..f47bafa 100644 (file)
@@ -46,8 +46,10 @@ func (tc *RmrControl) Init(desc string, rtfile string, port string) {
        tc.TestWrapper.Init(desc)
        os.Setenv("RMR_SEED_RT", rtfile)
        os.Setenv("RMR_SRC_ID", "localhost:"+port)
+       //os.Setenv("RMR_RTG_SVC", "localhost:"+port)
        xapp.Logger.Info("Using rt file %s", os.Getenv("RMR_SEED_RT"))
        xapp.Logger.Info("Using src id  %s", os.Getenv("RMR_SRC_ID"))
+       //xapp.Logger.Info("Using rtg svc  %s", os.Getenv("RMR_RTG_SVC"))
        tc.syncChan = make(chan struct{})
 }
 
index e486d13..05a8e32 100644 (file)
@@ -74,7 +74,7 @@ func (tc *RmrStubControl) Init(desc string, rtfile string, port string, stat str
        tc.RmrControl.Init(desc, rtfile, port)
        tc.RmrWrapper.Init()
 
-       tc.Rmr = xapp.NewRMRClientWithParams("tcp:"+port, 4096, 1, stat)
+       tc.Rmr = xapp.NewRMRClientWithParams("tcp:"+port, 65534, 1, 0, stat)
        tc.Rmr.SetReadyCB(tc.ReadyCB, nil)
        go tc.Rmr.Start(tc)
 
index 5d59363..09fa6de 100644 (file)
@@ -66,8 +66,10 @@ func (tc *RmrWrapper) RmrSend(params *RMRParams, to time.Duration) (err error) {
        }
        if status == false {
                err = fmt.Errorf("Failed with retries(%d) %s", i, params.String())
-               tc.Rmr.Free(params.Mbuf)
-               params.Mbuf = nil
+               if params.Mbuf != nil {
+                       tc.Rmr.Free(params.Mbuf)
+                       params.Mbuf = nil
+               }
        } else {
                tc.CntSentMsg++
        }
index 90c2891..2834086 100755 (executable)
@@ -22,4 +22,5 @@
 #      Abstract:       Starts the submgr service
 #      Date:           28 May 2019
 #
+
 exec ./submgr -f $CFGFILE
diff --git a/test/uta_rtg.rt b/test/uta_rtg.rt
new file mode 100755 (executable)
index 0000000..bc06bd2
--- /dev/null
@@ -0,0 +1,3 @@
+newrt|start
+newrt|end
+