Integrate RNIB with SDL SyncStorage to xapp-frame 33/6733/1 v0.9.1
authorTimo Tietavainen <timo.tietavainen@nokia.com>
Wed, 22 Sep 2021 23:52:32 +0000 (02:52 +0300)
committerTimo Tietavainen <timo.tietavainen@nokia.com>
Thu, 23 Sep 2021 00:43:09 +0000 (03:43 +0300)
SdlInstance type with its API functions has been deprecated and its
source code will be removed at some point of time from sdlgo repository.
sdlgo repository provides the SyncStorage type what should be used
instead of the SdlInstance type.

Upgrade xapp-frame to use Nodeb-rnib reader version 1.2.1, which has
a new reader type, which takes SyncStorage type reference in.

Change xapp-frame RNIB writer instance rNibWriterInstance to use SDL
instance of type SyncStorage.

Issue-Id: RIC-805

Signed-off-by: Timo Tietavainen <timo.tietavainen@nokia.com>
Change-Id: I4d6010c806370f0157a94f6f79f04ff90e11b63b

go.mod
go.sum
pkg/rnib/rNibWriter.go
pkg/xapp/db.go
pkg/xapp/xapp.go

diff --git a/go.mod b/go.mod
index a5b90af..18fa7cc 100644 (file)
--- a/go.mod
+++ b/go.mod
@@ -5,9 +5,9 @@ go 1.12
 require (
        gerrit.o-ran-sc.org/r/com/golog v0.0.2
        gerrit.o-ran-sc.org/r/ric-plt/alarm-go.git/alarm v0.5.0
-       gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/common v1.0.35
-       gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities v1.0.35
-       gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/reader v1.0.35
+       gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/common v1.2.1
+       gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities v1.2.1
+       gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/reader v1.2.1
        gerrit.o-ran-sc.org/r/ric-plt/sdlgo v0.7.0
        github.com/fsnotify/fsnotify v1.4.9
        github.com/go-openapi/errors v0.19.3
@@ -31,10 +31,10 @@ replace gerrit.o-ran-sc.org/r/ric-plt/sdlgo => gerrit.o-ran-sc.org/r/ric-plt/sdl
 
 replace gerrit.o-ran-sc.org/r/com/golog => gerrit.o-ran-sc.org/r/com/golog.git v0.0.2
 
-replace gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/common => gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/common v1.0.35
+replace gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/common => gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/common v1.2.1
 
-replace gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities => gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities v1.0.35
+replace gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities => gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities v1.2.1
 
-replace gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/reader => gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/reader v1.0.35
+replace gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/reader => gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/reader v1.2.1
 
 replace gerrit.o-ran-sc.org/r/ric-plt/alarm-go.git/alarm => gerrit.o-ran-sc.org/r/ric-plt/alarm-go.git/alarm v0.5.0
diff --git a/go.sum b/go.sum
index 937605b..1caf2ec 100644 (file)
--- a/go.sum
+++ b/go.sum
@@ -3,12 +3,12 @@ gerrit.o-ran-sc.org/r/com/golog.git v0.0.2 h1:Ix6SgFuzd6yW6Ur6+qDlGhDO65UYs8PiIk
 gerrit.o-ran-sc.org/r/com/golog.git v0.0.2/go.mod h1:A7hUL52YQSO4dFIZNcj76XQ09C9PftAe3LyL7kqBnok=
 gerrit.o-ran-sc.org/r/ric-plt/alarm-go.git/alarm v0.5.0 h1:OKDsIDlttbaoHwleyjflIWVZPgPvYbDhim6gWF0zf5E=
 gerrit.o-ran-sc.org/r/ric-plt/alarm-go.git/alarm v0.5.0/go.mod h1:AdEWKtERGvOQy9ybLhyhrb9w9LLVn8i9xzTwoR5n4BY=
-gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/common v1.0.35 h1:TGXHb4DNY8on+ej4S9VUnk2HibIC/5chDy64OE+bQBQ=
-gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/common v1.0.35/go.mod h1:QJ1uPPZosGbhxUWpUpeM5fLqFHdnWTrVnvW2DgyOCes=
-gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities v1.0.35 h1:tkM3yE8UzmuH4nf9TqAmiNBSuIZ2CtcMRH2eBIYIzpQ=
-gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities v1.0.35/go.mod h1:G+4sUBMbLfQ+RrGS65U15tKmbnP+/1b5oLTPmMfyfT4=
-gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/reader v1.0.35 h1:LcxnUUDwsCzYEISKmkjkyYfg/lnLt8ofkPiGK69vNIA=
-gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/reader v1.0.35/go.mod h1:2bSaXTpECbZieB8bMnubTqMwF3n+mMBxlTaAXvcduNg=
+gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/common v1.2.1 h1:3FFbXx55BODThXfyWAiz6cPXVELXFICDQUmJi13EoxM=
+gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/common v1.2.1/go.mod h1:QJ1uPPZosGbhxUWpUpeM5fLqFHdnWTrVnvW2DgyOCes=
+gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities v1.2.1 h1:8Z60JRsPgcS1Ona4fEh6d0/03nLq1WHoZcNnBsni5+g=
+gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities v1.2.1/go.mod h1:YaQ+XEI4PcAoISxp9wUpUr2TP0J7JihpQTD0G1Lpd4A=
+gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/reader v1.2.1 h1:BG3kste8PLVTG0m8CRB/VP2tAV5JImKueBGuOsUNcR8=
+gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/reader v1.2.1/go.mod h1:zX8rW6YEsagHrRGVW5YO50Ku/Csrpzsuvblhr4DbYi4=
 gerrit.o-ran-sc.org/r/ric-plt/sdlgo.git v0.7.0 h1:mxlBo54jxwHHFmGYzFI+fBIkOGwarQP4dx2KBxQ8ln8=
 gerrit.o-ran-sc.org/r/ric-plt/sdlgo.git v0.7.0/go.mod h1:KCHu4JkWnw2Ro6P747wU9S2t7zxFLmBNCiYvGZo3CHo=
 github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
@@ -45,7 +45,6 @@ github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8
 github.com/docker/go-units v0.3.3/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
 github.com/docker/go-units v0.4.0 h1:3uh0PgVws3nIA0Q+MwDC8yjEPf9zjRfZZWXZYDct3Tw=
 github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
-github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
 github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
 github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=
 github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
@@ -119,8 +118,6 @@ github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4er
 github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
 github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
 github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
-github.com/golang/protobuf v1.3.4 h1:87PNWwrRvUSnqS4dlcBU/ftvOIBep4sYuBLlh6rX2wk=
-github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
 github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
 github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
 github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
@@ -130,11 +127,11 @@ github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0
 github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
 github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
 github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
-github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY=
 github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
 github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
-github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4=
 github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
+github.com/google/go-cmp v0.4.1 h1:/exdXoGamhu5ONeUJH0deniYLWYvQwW66yvlfiiKTu0=
+github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
 github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
 github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY=
 github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
@@ -146,7 +143,6 @@ github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgf
 github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
 github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
 github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
-github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI=
 github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
 github.com/jessevdk/go-flags v1.4.0 h1:4IU2WS7AumrZ/40jfhf4QVDMsQwqA7VEHozFRrGARJA=
 github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
@@ -211,7 +207,6 @@ github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAm
 github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
 github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
 github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
-github.com/spf13/afero v1.1.2 h1:m8/z1t7/fwjysjQRYbP0RD+bUIF/8tJwPdEZsI83ACI=
 github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=
 github.com/spf13/afero v1.2.2 h1:5jhuqJyZCZf2JRofRvN/nIFgIWNzPa3/Vz8mYylgbWc=
 github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk=
@@ -264,7 +259,6 @@ golang.org/x/net v0.0.0-20190320064053-1272bf9dcd53/go.mod h1:t9HGtf8HONx5eT2rtn
 golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
 golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
 golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
-golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297 h1:k7pJ2yAPLPgbskkFdhRCsA77k2fySZ1zf2zCjvQCiIM=
 golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
 golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7 h1:AeiKBIuRw3UomYXSbLy0Mc2dDLfdtbT/IVn4keq83P0=
 golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
@@ -281,7 +275,6 @@ golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5h
 golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
 golang.org/x/sys v0.0.0-20190321052220-f7bb7a8bee54/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
 golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/sys v0.0.0-20190616124812-15dcb6c0061f h1:25KHgbfyiSm6vwQLbM3zZIe1v9p/3ea4Rz+nnM5K/i4=
 golang.org/x/sys v0.0.0-20190616124812-15dcb6c0061f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
 golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
 golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
@@ -317,7 +310,6 @@ gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLks
 gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
 gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
 gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
-gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4=
 gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
 gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo=
 gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
@@ -325,7 +317,6 @@ gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWD
 gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74=
 gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
 gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
-gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I=
 gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
 gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU=
 gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
index 74fb557..135b9a2 100755 (executable)
@@ -25,7 +25,9 @@ import (
 )
 
 type rNibWriterInstance struct {
-       sdl rnibcommon.ISdlInstance
+       sdl        rnibcommon.ISdlInstance //Deprecated: Will be removed in a future release and replaced by sdlStorage
+       sdlStorage rnibcommon.ISdlSyncStorage
+       ns         string
 }
 
 /*
@@ -36,11 +38,24 @@ type RNibWriter interface {
 }
 
 /*
-GetRNibWriter returns reference to RNibWriter
+GetNewRNibWriter returns reference to RNibWriter
 */
+func GetNewRNibWriter(sdlStorage rnibcommon.ISdlSyncStorage) RNibWriter {
+       return &rNibWriterInstance{
+               sdl:        nil,
+               sdlStorage: sdlStorage,
+               ns:         rnibcommon.GetRNibNamespace(),
+       }
+}
 
+//GetRNibWriter returns reference to RNibWriter
+//Deprecated: Will be removed in a future release, please use GetNewRNibWriter instead.
 func GetRNibWriter(sdl rnibcommon.ISdlInstance) RNibWriter {
-       return &rNibWriterInstance{sdl: sdl}
+       return &rNibWriterInstance{
+               sdl:        sdl,
+               sdlStorage: nil,
+               ns:         "",
+       }
 }
 
 /*
@@ -83,7 +98,11 @@ func (w *rNibWriterInstance) SaveNodeb(nbIdentity *rnibentities.NbIdentity, enti
                        return rNibErr
                }
        }
-       err = w.sdl.Set(pairs)
+       if w.sdlStorage != nil {
+               err = w.sdlStorage.Set(w.ns, pairs)
+       } else {
+               err = w.sdl.Set(pairs)
+       }
        if err != nil {
                return rnibcommon.NewInternalError(err)
        }
@@ -95,7 +114,11 @@ func (w *rNibWriterInstance) SaveNodeb(nbIdentity *rnibentities.NbIdentity, enti
                if err != nil {
                        return rnibcommon.NewInternalError(err)
                }
-               err = w.sdl.RemoveMember(rnibentities.Node_UNKNOWN.String(), nbIdData)
+               if w.sdlStorage != nil {
+                       err = w.sdlStorage.RemoveMember(w.ns, rnibentities.Node_UNKNOWN.String(), nbIdData)
+               } else {
+                       err = w.sdl.RemoveMember(rnibentities.Node_UNKNOWN.String(), nbIdData)
+               }
                if err != nil {
                        return rnibcommon.NewInternalError(err)
                }
@@ -107,7 +130,11 @@ func (w *rNibWriterInstance) SaveNodeb(nbIdentity *rnibentities.NbIdentity, enti
        if err != nil {
                return rnibcommon.NewInternalError(err)
        }
-       err = w.sdl.AddMember(entity.GetNodeType().String(), nbIdData)
+       if w.sdlStorage != nil {
+               err = w.sdlStorage.AddMember(w.ns, entity.GetNodeType().String(), nbIdData)
+       } else {
+               err = w.sdl.AddMember(entity.GetNodeType().String(), nbIdData)
+       }
        if err != nil {
                return rnibcommon.NewInternalError(err)
        }
index 4cfc399..0a37caa 100755 (executable)
@@ -20,6 +20,7 @@
 package xapp
 
 import (
+       rnibcommon "gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/common"
        rnibentities "gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities"
        rnibreader "gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/reader"
        sdl "gerrit.o-ran-sc.org/r/ric-plt/sdlgo"
@@ -72,7 +73,7 @@ type RNIBServedNRCellInformation = rnibentities.ServedNRCellInformation
 type RNIBNrNeighbourInformation = rnibentities.NrNeighbourInformation
 
 type RNIBClient struct {
-       db     *sdl.SdlInstance
+       db     rnibcommon.ISdlSyncStorage
        reader rnibreader.RNibReader
        writer rnibwriter.RNibWriter
 }
@@ -262,55 +263,64 @@ func (c *SDLClient) GetStat() (t SDLStatistics) {
        return c.db.GetStat()
 }
 
+func GetNewRnibClient(sdlStorage rnibcommon.ISdlSyncStorage) *RNIBClient {
+       return &RNIBClient{
+               db:     sdlStorage,
+               reader: rnibreader.GetNewRNibReader(sdlStorage),
+               writer: rnibwriter.GetNewRNibWriter(sdlStorage),
+       }
+}
+
+//Deprecated: Will be removed in a future release, please use GetNewRnibClient instead.
 func NewRNIBClient() *RNIBClient {
-       s := sdl.NewSdlInstance("e2Manager", sdl.NewDatabase())
+       s := sdl.NewSyncStorage()
        return &RNIBClient{
                db:     s,
-               reader: nil,
-               writer: nil,
+               reader: rnibreader.GetNewRNibReader(s),
+               writer: rnibwriter.GetNewRNibWriter(s),
        }
 }
 
 func (r *RNIBClient) Subscribe(cb func(string, ...string), channel string) error {
-       return r.db.SubscribeChannel(cb, channel)
+       return r.db.SubscribeChannel(rnibcommon.GetRNibNamespace(), cb, channel)
 }
 
 func (r *RNIBClient) StoreAndPublish(channel string, event string, pairs ...interface{}) error {
-       return r.db.SetAndPublish([]string{channel, event}, pairs...)
+       return r.db.SetAndPublish(rnibcommon.GetRNibNamespace(), []string{channel, event}, pairs...)
 }
 
 func (r *RNIBClient) GetNodeb(invName string) (*RNIBNodebInfo, RNIBIRNibError) {
-       return rnibreader.GetRNibReader(r.db).GetNodeb(invName)
+       return r.reader.GetNodeb(invName)
 }
 
 func (r *RNIBClient) GetNodebByGlobalNbId(t RNIBNodeType, gid *RNIBGlobalNbId) (*RNIBNodebInfo, RNIBIRNibError) {
-       return rnibreader.GetRNibReader(r.db).GetNodebByGlobalNbId(t, gid)
+       return r.reader.GetNodebByGlobalNbId(t, gid)
 }
 
 func (r *RNIBClient) GetCellList(invName string) (*RNIBCells, RNIBIRNibError) {
-       return rnibreader.GetRNibReader(r.db).GetCellList(invName)
+       return r.reader.GetCellList(invName)
 }
 
 func (r *RNIBClient) GetListGnbIds() ([]*RNIBNbIdentity, RNIBIRNibError) {
-       return rnibreader.GetRNibReader(r.db).GetListGnbIds()
+       return r.reader.GetListGnbIds()
 }
 
 func (r *RNIBClient) GetListEnbIds() ([]*RNIBNbIdentity, RNIBIRNibError) {
-       return rnibreader.GetRNibReader(r.db).GetListEnbIds()
+       return r.reader.GetListEnbIds()
 }
 
 func (r *RNIBClient) GetCountGnbList() (int, RNIBIRNibError) {
-       return rnibreader.GetRNibReader(r.db).GetCountGnbList()
+       return r.reader.GetCountGnbList()
 }
 
 func (r *RNIBClient) GetCell(invName string, pci uint32) (*RNIBCell, RNIBIRNibError) {
-       return rnibreader.GetRNibReader(r.db).GetCell(invName, pci)
+       return r.reader.GetCell(invName, pci)
 }
 
 func (r *RNIBClient) GetCellById(cellType RNIBCellType, cellId string) (*RNIBCell, RNIBIRNibError) {
-       return rnibreader.GetRNibReader(r.db).GetCellById(cellType, cellId)
+       return r.reader.GetCellById(cellType, cellId)
 }
 
 func (r *RNIBClient) SaveNodeb(nbIdentity *RNIBNbIdentity, entity *RNIBNodebInfo) RNIBIRNibError {
-       return rnibwriter.GetRNibWriter(r.db).SaveNodeb(nbIdentity, entity)
+       return r.writer.SaveNodeb(nbIdentity, entity)
 }
index a316d9c..96aa057 100755 (executable)
@@ -265,7 +265,7 @@ func init() {
        Subscription = NewSubscriber(viper.GetString("controls.subscription.host"), viper.GetInt("controls.subscription.timeout"))
        SdlStorage = NewSdlStorage()
        Sdl = NewSDLClient(viper.GetString("controls.db.namespace"))
-       Rnib = NewRNIBClient()
+       Rnib = GetNewRnibClient(SdlStorage.db)
        Util = NewUtils()
 
        InstallSignalHandler()