From c2a6b3a80ba41f292e0fa31334e53ab278d103fe Mon Sep 17 00:00:00 2001 From: Juha Hyttinen Date: Wed, 18 Mar 2020 11:45:57 +0200 Subject: [PATCH] Updating to newer xapp-frame 0.0.30 version. Prepared also for 4.* version Change-Id: I86866b1e57bbc84421eb365d38b62839c8954f50 Signed-off-by: Juha Hyttinen --- Dockerfile | 31 ++++++++++++++++++++----------- go.mod | 3 ++- go.sum | 11 ++++++----- pkg/teststub/controlRmr.go | 2 ++ pkg/teststub/controlRmrStub.go | 2 +- pkg/xapptweaks/rmrwrapper.go | 6 ++++-- run_submgr.sh | 1 + test/uta_rtg.rt | 3 +++ 8 files changed, 39 insertions(+), 20 deletions(-) create mode 100755 test/uta_rtg.rt diff --git a/Dockerfile b/Dockerfile index b7adf64..4e82a9a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 --- 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 --- 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= diff --git a/pkg/teststub/controlRmr.go b/pkg/teststub/controlRmr.go index bcea500..f47bafa 100644 --- a/pkg/teststub/controlRmr.go +++ b/pkg/teststub/controlRmr.go @@ -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{}) } diff --git a/pkg/teststub/controlRmrStub.go b/pkg/teststub/controlRmrStub.go index e486d13..05a8e32 100644 --- a/pkg/teststub/controlRmrStub.go +++ b/pkg/teststub/controlRmrStub.go @@ -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) diff --git a/pkg/xapptweaks/rmrwrapper.go b/pkg/xapptweaks/rmrwrapper.go index 5d59363..09fa6de 100644 --- a/pkg/xapptweaks/rmrwrapper.go +++ b/pkg/xapptweaks/rmrwrapper.go @@ -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++ } diff --git a/run_submgr.sh b/run_submgr.sh index 90c2891..2834086 100755 --- a/run_submgr.sh +++ b/run_submgr.sh @@ -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 index 0000000..bc06bd2 --- /dev/null +++ b/test/uta_rtg.rt @@ -0,0 +1,3 @@ +newrt|start +newrt|end + -- 2.16.6