Replace deprecated SDL APIs 32/6832/2
authorTimo Tietavainen <timo.tietavainen@nokia.com>
Thu, 7 Oct 2021 12:48:02 +0000 (15:48 +0300)
committerTimo Tietavainen <timo.tietavainen@nokia.com>
Thu, 7 Oct 2021 13:24:28 +0000 (16:24 +0300)
Replace deprecated SDL SdlInstance usage with SDL SyncStorage.
Upgrade RNIB version to v1.2.1 and SDL version to v0.8.0.
Bump E2-manager's Docker container tag to 5.4.18

Issue-Id: RIC-805

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

E2Manager/Dockerfile
E2Manager/app/main.go
E2Manager/container-tag.yaml
E2Manager/go.mod
E2Manager/go.sum
E2Manager/mocks/sdlInstanceMock.go [deleted file]
E2Manager/mocks/sdlSyncStorageMock.go [new file with mode: 0644]
E2Manager/rNibWriter/rNibWriter.go
E2Manager/rNibWriter/rNibWriter_test.go

index 27ad56a..0f18fa1 100755 (executable)
@@ -27,6 +27,13 @@ COPY . .
 
 # Install dependencies, compile and test the module
 RUN apt-get update && apt-get install -y sudo
+
+# Update CA certificates
+RUN apt update && apt install --reinstall -y \
+  ca-certificates \
+  && \
+  update-ca-certificates
+
 RUN bash build-e2mgr-ubuntu.sh
 
 # Build deployable container
index 4708b05..f8510ea 100755 (executable)
@@ -35,19 +35,17 @@ import (
        "e2mgr/services/rmrreceiver"
        "e2mgr/services/rmrsender"
        "fmt"
+       "gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/common"
        "gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/reader"
        "gerrit.o-ran-sc.org/r/ric-plt/sdlgo"
        "os"
        "strconv"
 )
 
-const (
-       GeneralKey             = "GENERAL"
-       GeneralKeyDefaultValue = "{\"enableRic\":true}"
-)
+const GeneralKeyDefaultValue = "{\"enableRic\":true}"
 
-func initKeys(logger *logger.Logger, sdl *sdlgo.SdlInstance) error {
-       ok, err := sdl.SetIfNotExists(GeneralKey, GeneralKeyDefaultValue)
+func initKeys(logger *logger.Logger, sdl *sdlgo.SyncStorage) error {
+       ok, err := sdl.SetIfNotExists(common.GetRNibNamespace(), common.BuildGeneralConfigurationKey(), GeneralKeyDefaultValue)
 
        if err != nil {
                logger.Errorf("#app.main - Failed setting GENERAL key")
@@ -73,8 +71,7 @@ func main() {
                os.Exit(1)
        }
        logger.Infof("#app.main - Configuration %s", config)
-       db := sdlgo.NewDatabase()
-       sdl := sdlgo.NewSdlInstance("e2Manager", db)
+       sdl := sdlgo.NewSyncStorage()
        err = initKeys(logger, sdl)
 
        if err != nil {
@@ -82,7 +79,7 @@ func main() {
        }
 
        defer sdl.Close()
-       rnibDataService := services.NewRnibDataService(logger, config, reader.GetRNibReader(sdl), rNibWriter.GetRNibWriter(sdl, config.RnibWriter))
+       rnibDataService := services.NewRnibDataService(logger, config, reader.GetNewRNibReader(sdl), rNibWriter.GetRNibWriter(sdl, config.RnibWriter))
 
        ranListManager := managers.NewRanListManager(logger, rnibDataService)
 
index d84e8e8..b49bdf7 100644 (file)
@@ -1,4 +1,4 @@
 # The Jenkins job requires a tag to build the Docker image.
 # Global-JJB script assumes this file is in the repo root.
 ---
-tag: 5.4.17
+tag: 5.4.18
index 3f0f970..b14d5fb 100644 (file)
@@ -1,10 +1,10 @@
 module e2mgr
 
 require (
-       gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/common v1.0.48
-       gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities v1.0.48
-       gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/reader v1.0.48
-       gerrit.o-ran-sc.org/r/ric-plt/sdlgo v0.7.0
+       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.8.0
        github.com/golang/protobuf v1.4.2
        github.com/gorilla/mux v1.7.0
        github.com/kr/pretty v0.2.0 // indirect
@@ -26,4 +26,6 @@ require (
        gopkg.in/yaml.v2 v2.3.0
 )
 
-replace gerrit.o-ran-sc.org/r/ric-plt/sdlgo => gerrit.o-ran-sc.org/r/ric-plt/sdlgo.git v0.7.0
+replace gerrit.o-ran-sc.org/r/ric-plt/sdlgo => gerrit.o-ran-sc.org/r/ric-plt/sdlgo.git v0.8.0
+
+go 1.13
index 91500f1..9dc065f 100644 (file)
@@ -1,12 +1,12 @@
 cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
-gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/common v1.0.48 h1:gPM24V9fheL+VPAADqPVR16tpyTxVuROJfpkcZJp4KY=
-gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/common v1.0.48/go.mod h1:QJ1uPPZosGbhxUWpUpeM5fLqFHdnWTrVnvW2DgyOCes=
-gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities v1.0.48 h1:py36QUO+1NwPtUD/aQdF+Lzm/aK6Fg5UoF19Fys7GR0=
-gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities v1.0.48/go.mod h1:YaQ+XEI4PcAoISxp9wUpUr2TP0J7JihpQTD0G1Lpd4A=
-gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/reader v1.0.48 h1:uMHAAmBhJku8MoCqoc7mluTPgb/OXjjZauCiAM4yV48=
-gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/reader v1.0.48/go.mod h1:sj8NXrAPE8qw/8DvussZp7e0q8RAbAwC2gQGKK3la0k=
-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=
+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.8.0 h1:H7GtCRC+pGn6oOxYalUZr7LinQX5jQCVa+ConX7PB5Q=
+gerrit.o-ran-sc.org/r/ric-plt/sdlgo.git v0.8.0/go.mod h1:KCHu4JkWnw2Ro6P747wU9S2t7zxFLmBNCiYvGZo3CHo=
 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=
diff --git a/E2Manager/mocks/sdlInstanceMock.go b/E2Manager/mocks/sdlInstanceMock.go
deleted file mode 100644 (file)
index 00eea6b..0000000
+++ /dev/null
@@ -1,136 +0,0 @@
-//
-// Copyright 2019 AT&T Intellectual Property
-// Copyright 2019 Nokia
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-//  This source code is part of the near-RT RIC (RAN Intelligent Controller)
-//  platform project (RICP).
-
-package mocks
-
-import "github.com/stretchr/testify/mock"
-
-type MockSdlInstance struct {
-       mock.Mock
-}
-
-func (m *MockSdlInstance) SubscribeChannel(cb func(string, ...string), channels ...string) error {
-       a := m.Called(cb, channels)
-       return a.Error(0)
-}
-
-func (m *MockSdlInstance) UnsubscribeChannel(channels ...string) error {
-       a := m.Called(channels)
-       return a.Error(0)
-}
-
-func (m *MockSdlInstance) SetAndPublish(channelsAndEvents []string, pairs ...interface{}) error {
-       a := m.Called(channelsAndEvents, pairs)
-       return a.Error(0)
-}
-
-func (m *MockSdlInstance) SetIfAndPublish(channelsAndEvents []string, key string, oldData, newData interface{}) (bool, error) {
-       a := m.Called(channelsAndEvents, key, oldData, newData)
-       return a.Bool(0), a.Error(1)
-}
-
-func (m *MockSdlInstance) SetIfNotExistsAndPublish(channelsAndEvents []string, key string, data interface{}) (bool, error) {
-       a := m.Called(channelsAndEvents, key, data)
-       return a.Bool(0), a.Error(1)
-}
-
-func (m *MockSdlInstance) RemoveAndPublish(channelsAndEvents []string, keys []string) error {
-       a := m.Called(channelsAndEvents, keys)
-       return a.Error(0)
-}
-
-func (m *MockSdlInstance) RemoveIfAndPublish(channelsAndEvents []string, key string, data interface{}) (bool, error) {
-       a := m.Called(channelsAndEvents, key, data)
-       return a.Bool(0), a.Error(1)
-}
-
-func (m *MockSdlInstance) RemoveAllAndPublish(channelsAndEvents []string) error {
-       a := m.Called(channelsAndEvents)
-       return a.Error(0)
-}
-
-func (m *MockSdlInstance) Set(pairs ...interface{}) error {
-       a := m.Called(pairs)
-       return a.Error(0)
-}
-
-func (m *MockSdlInstance) Get(keys []string) (map[string]interface{}, error) {
-       a := m.Called(keys)
-       return a.Get(0).(map[string]interface{}), a.Error(1)
-}
-
-func (m *MockSdlInstance) GetAll() ([]string, error) {
-       a := m.Called()
-       return a.Get(0).([]string), a.Error(1)
-}
-
-func (m *MockSdlInstance) Close() error {
-       a := m.Called()
-       return a.Error(0)
-}
-
-func (m *MockSdlInstance) Remove(keys []string) error {
-       a := m.Called(keys)
-       return a.Error(0)
-}
-
-func (m *MockSdlInstance) RemoveAll() error {
-       a := m.Called()
-       return a.Error(0)
-}
-
-func (m *MockSdlInstance) SetIf(key string, oldData, newData interface{}) (bool, error) {
-       a := m.Called(key, oldData, newData)
-       return a.Bool(0), a.Error(1)
-}
-
-func (m *MockSdlInstance) SetIfNotExists(key string, data interface{}) (bool, error) {
-       a := m.Called(key, data)
-       return a.Bool(0), a.Error(1)
-}
-func (m *MockSdlInstance) RemoveIf(key string, data interface{}) (bool, error) {
-       a := m.Called(key, data)
-       return a.Bool(0), a.Error(1)
-}
-
-func (m *MockSdlInstance) AddMember(group string, member ...interface{}) error{
-       a := m.Called(group, member)
-       return a.Error(0)
-}
-
-func (m *MockSdlInstance) RemoveMember(group string, member ...interface{}) error {
-       a := m.Called(group, member)
-       return a.Error(0)
-}
-func (m *MockSdlInstance) RemoveGroup(group string) error {
-       a := m.Called(group)
-       return a.Error(0)
-}
-func (m *MockSdlInstance) GetMembers(group string) ([]string, error) {
-       a := m.Called(group)
-       return a.Get(0).([]string), a.Error(1)
-}
-func (m *MockSdlInstance) IsMember(group string, member interface{}) (bool, error){
-       a := m.Called(group, member)
-       return a.Bool(0), a.Error(1)
-}
-func (m *MockSdlInstance) GroupSize(group string) (int64, error){
-       a := m.Called(group,)
-       return int64(a.Int(0)), a.Error(1)
-}
diff --git a/E2Manager/mocks/sdlSyncStorageMock.go b/E2Manager/mocks/sdlSyncStorageMock.go
new file mode 100644 (file)
index 0000000..8ac3b3d
--- /dev/null
@@ -0,0 +1,141 @@
+//
+// Copyright 2021 AT&T Intellectual Property
+// Copyright 2021 Nokia
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+//  This source code is part of the near-RT RIC (RAN Intelligent Controller)
+//  platform project (RICP).
+
+package mocks
+
+import "github.com/stretchr/testify/mock"
+
+type MockSdlSyncStorage struct {
+       mock.Mock
+}
+
+func (m *MockSdlSyncStorage) SubscribeChannel(ns string, cb func(string, ...string), channels ...string) error {
+       a := m.Called(ns, cb, channels)
+       return a.Error(0)
+}
+
+func (m *MockSdlSyncStorage) UnsubscribeChannel(ns string, channels ...string) error {
+       a := m.Called(ns, channels)
+       return a.Error(0)
+}
+
+func (m *MockSdlSyncStorage) SetAndPublish(ns string, channelsAndEvents []string, pairs ...interface{}) error {
+       a := m.Called(ns, channelsAndEvents, pairs)
+       return a.Error(0)
+}
+
+func (m *MockSdlSyncStorage) SetIfAndPublish(ns string, channelsAndEvents []string, key string, oldData, newData interface{}) (bool, error) {
+       a := m.Called(ns, channelsAndEvents, key, oldData, newData)
+       return a.Bool(0), a.Error(1)
+}
+
+func (m *MockSdlSyncStorage) SetIfNotExistsAndPublish(ns string, channelsAndEvents []string, key string, data interface{}) (bool, error) {
+       a := m.Called(ns, channelsAndEvents, key, data)
+       return a.Bool(0), a.Error(1)
+}
+
+func (m *MockSdlSyncStorage) RemoveAndPublish(ns string, channelsAndEvents []string, keys []string) error {
+       a := m.Called(ns, channelsAndEvents, keys)
+       return a.Error(0)
+}
+
+func (m *MockSdlSyncStorage) RemoveIfAndPublish(ns string, channelsAndEvents []string, key string, data interface{}) (bool, error) {
+       a := m.Called(ns, channelsAndEvents, key, data)
+       return a.Bool(0), a.Error(1)
+}
+
+func (m *MockSdlSyncStorage) RemoveAllAndPublish(ns string, channelsAndEvents []string) error {
+       a := m.Called(ns, channelsAndEvents)
+       return a.Error(0)
+}
+
+func (m *MockSdlSyncStorage) Set(ns string, pairs ...interface{}) error {
+       a := m.Called(ns, pairs)
+       return a.Error(0)
+}
+
+func (m *MockSdlSyncStorage) Get(ns string, keys []string) (map[string]interface{}, error) {
+       a := m.Called(ns, keys)
+       return a.Get(0).(map[string]interface{}), a.Error(1)
+}
+
+func (m *MockSdlSyncStorage) GetAll(ns string) ([]string, error) {
+       a := m.Called(ns)
+       return a.Get(0).([]string), a.Error(1)
+}
+
+func (m *MockSdlSyncStorage) ListKeys(ns string, pattern string) ([]string, error) {
+       a := m.Called(ns, pattern)
+       return a.Get(0).([]string), a.Error(1)
+}
+
+func (m *MockSdlSyncStorage) Close() error {
+       a := m.Called()
+       return a.Error(0)
+}
+
+func (m *MockSdlSyncStorage) Remove(ns string, keys []string) error {
+       a := m.Called(ns, keys)
+       return a.Error(0)
+}
+
+func (m *MockSdlSyncStorage) RemoveAll(ns string) error {
+       a := m.Called(ns)
+       return a.Error(0)
+}
+
+func (m *MockSdlSyncStorage) SetIf(ns string, key string, oldData, newData interface{}) (bool, error) {
+       a := m.Called(ns, key, oldData, newData)
+       return a.Bool(0), a.Error(1)
+}
+
+func (m *MockSdlSyncStorage) SetIfNotExists(ns string, key string, data interface{}) (bool, error) {
+       a := m.Called(ns, key, data)
+       return a.Bool(0), a.Error(1)
+}
+func (m *MockSdlSyncStorage) RemoveIf(ns string, key string, data interface{}) (bool, error) {
+       a := m.Called(ns, key, data)
+       return a.Bool(0), a.Error(1)
+}
+
+func (m *MockSdlSyncStorage) AddMember(ns string, group string, member ...interface{}) error {
+       a := m.Called(ns, group, member)
+       return a.Error(0)
+}
+
+func (m *MockSdlSyncStorage) RemoveMember(ns string, group string, member ...interface{}) error {
+       a := m.Called(ns, group, member)
+       return a.Error(0)
+}
+func (m *MockSdlSyncStorage) RemoveGroup(ns string, group string) error {
+       a := m.Called(ns, group)
+       return a.Error(0)
+}
+func (m *MockSdlSyncStorage) GetMembers(ns string, group string) ([]string, error) {
+       a := m.Called(ns, group)
+       return a.Get(0).([]string), a.Error(1)
+}
+func (m *MockSdlSyncStorage) IsMember(ns string, group string, member interface{}) (bool, error) {
+       a := m.Called(ns, group, member)
+       return a.Bool(0), a.Error(1)
+}
+func (m *MockSdlSyncStorage) GroupSize(ns string, group string) (int64, error) {
+       a := m.Called(ns, group)
+       return int64(a.Int(0)), a.Error(1)
+}
index bbf485b..d107f55 100644 (file)
@@ -36,8 +36,9 @@ const (
 )
 
 type rNibWriterInstance struct {
-       sdl              common.ISdlInstance
+       sdl              common.ISdlSyncStorage
        rnibWriterConfig configuration.RnibWriterConfig
+       ns               string
 }
 
 /*
@@ -63,12 +64,17 @@ type RNibWriter interface {
        AddEnb(nodebInfo *entities.NodebInfo) error
        UpdateNbIdentities(nodeType entities.Node_Type, oldNbIdentities []*entities.NbIdentity, newNbIdentities []*entities.NbIdentity) error
 }
+
 /*
 GetRNibWriter returns reference to RNibWriter
 */
 
-func GetRNibWriter(sdl common.ISdlInstance, rnibWriterConfig configuration.RnibWriterConfig) RNibWriter {
-       return &rNibWriterInstance{sdl: sdl, rnibWriterConfig: rnibWriterConfig}
+func GetRNibWriter(sdl common.ISdlSyncStorage, rnibWriterConfig configuration.RnibWriterConfig) RNibWriter {
+       return &rNibWriterInstance{
+               sdl:              sdl,
+               rnibWriterConfig: rnibWriterConfig,
+               ns:               common.GetRNibNamespace(),
+       }
 }
 
 func getChannelsAndEventsPair(channel string, ranName string, event string) []string {
@@ -82,7 +88,7 @@ func (w *rNibWriterInstance) AddNbIdentity(nodeType entities.Node_Type, nbIdenti
                return common.NewInternalError(err)
        }
 
-       err = w.sdl.AddMember(nodeType.String(), nbIdData)
+       err = w.sdl.AddMember(w.ns, nodeType.String(), nbIdData)
 
        if err != nil {
                return common.NewInternalError(err)
@@ -93,7 +99,7 @@ func (w *rNibWriterInstance) AddNbIdentity(nodeType entities.Node_Type, nbIdenti
 func (w *rNibWriterInstance) RemoveServedNrCells(inventoryName string, servedNrCells []*entities.ServedNRCell) error {
        cellKeysToRemove := buildServedNRCellKeysToRemove(inventoryName, servedNrCells)
 
-       err := w.sdl.Remove(cellKeysToRemove)
+       err := w.sdl.Remove(w.ns, cellKeysToRemove)
 
        if err != nil {
                return common.NewInternalError(err)
@@ -105,7 +111,7 @@ func (w *rNibWriterInstance) RemoveServedNrCells(inventoryName string, servedNrC
 func (w *rNibWriterInstance) RemoveServedCells(inventoryName string, servedCells []*entities.ServedCellInfo) error {
        cellKeysToRemove := buildServedCellInfoKeysToRemove(inventoryName, servedCells)
 
-       err := w.sdl.Remove(cellKeysToRemove)
+       err := w.sdl.Remove(w.ns, cellKeysToRemove)
 
        if err != nil {
                return common.NewInternalError(err)
@@ -168,7 +174,7 @@ func (w *rNibWriterInstance) SaveNodeb(nodebInfo *entities.NodebInfo) error {
                }
        }
 
-       err = w.sdl.Set(pairs)
+       err = w.sdl.Set(w.ns, pairs)
 
        if err != nil {
                return common.NewInternalError(err)
@@ -209,7 +215,7 @@ func (w *rNibWriterInstance) AddEnb(nodebInfo *entities.NodebInfo) error {
        }
 
        channelsAndEvents := getChannelsAndEventsPair(w.rnibWriterConfig.RanManipulationMessageChannel, nodebInfo.RanName, RanAddedEvent)
-       err = w.sdl.SetAndPublish(channelsAndEvents, pairs)
+       err = w.sdl.SetAndPublish(w.ns, channelsAndEvents, pairs)
        if err != nil {
                return common.NewInternalError(err)
        }
@@ -224,7 +230,7 @@ func (w *rNibWriterInstance) UpdateNbIdentities(nodeType entities.Node_Type, old
                return err
        }
 
-       err = w.sdl.RemoveMember(nodeType.String(), nbIdIdentitiesToRemove[:]...)
+       err = w.sdl.RemoveMember(w.ns, nodeType.String(), nbIdIdentitiesToRemove[:]...)
        if err != nil {
                return err
        }
@@ -234,7 +240,7 @@ func (w *rNibWriterInstance) UpdateNbIdentities(nodeType entities.Node_Type, old
                return err
        }
 
-       err = w.sdl.AddMember(nodeType.String(), nbIdIdentitiesToAdd[:]...)
+       err = w.sdl.AddMember(w.ns, nodeType.String(), nbIdIdentitiesToAdd[:]...)
        if err != nil {
                return err
        }
@@ -257,7 +263,7 @@ func (w *rNibWriterInstance) UpdateGnbCells(nodebInfo *entities.NodebInfo, serve
        }
 
        channelsAndEvents := getChannelsAndEventsPair(w.rnibWriterConfig.RanManipulationMessageChannel, nodebInfo.RanName, RanUpdatedEvent)
-       err = w.sdl.SetAndPublish(channelsAndEvents, pairs)
+       err = w.sdl.SetAndPublish(w.ns, channelsAndEvents, pairs)
 
        if err != nil {
                return common.NewInternalError(err)
@@ -359,7 +365,7 @@ func (w *rNibWriterInstance) RemoveNbIdentity(nodeType entities.Node_Type, nbIde
        if err != nil {
                return common.NewInternalError(err)
        }
-       err = w.sdl.RemoveMember(nodeType.String(), nbIdData)
+       err = w.sdl.RemoveMember(w.ns, nodeType.String(), nbIdData)
        if err != nil {
                return common.NewInternalError(err)
        }
@@ -376,9 +382,9 @@ func (w *rNibWriterInstance) updateNodebInfo(nodebInfo *entities.NodebInfo, publ
 
        if publish {
                channelsAndEvents := getChannelsAndEventsPair(w.rnibWriterConfig.RanManipulationMessageChannel, nodebInfo.RanName, RanUpdatedEvent)
-               err = w.sdl.SetAndPublish(channelsAndEvents, pairs)
+               err = w.sdl.SetAndPublish(w.ns, channelsAndEvents, pairs)
        } else {
-               err = w.sdl.Set(pairs)
+               err = w.sdl.Set(w.ns, pairs)
        }
 
        if err != nil {
@@ -402,7 +408,6 @@ func (w *rNibWriterInstance) UpdateNodebInfoAndPublish(nodebInfo *entities.Nodeb
        return w.updateNodebInfo(nodebInfo, true)
 }
 
-
 /*
 SaveRanLoadInformation stores ran load information for the provided ran
 */
@@ -423,7 +428,7 @@ func (w *rNibWriterInstance) SaveRanLoadInformation(inventoryName string, ranLoa
        var pairs []interface{}
        pairs = append(pairs, key, data)
 
-       err = w.sdl.Set(pairs)
+       err = w.sdl.Set(w.ns, pairs)
 
        if err != nil {
                return common.NewInternalError(err)
@@ -449,7 +454,7 @@ func (w *rNibWriterInstance) SaveE2TInstance(e2tInstance *entities.E2TInstance)
        var pairs []interface{}
        pairs = append(pairs, key, data)
 
-       err = w.sdl.Set(pairs)
+       err = w.sdl.Set(w.ns, pairs)
 
        if err != nil {
                return common.NewInternalError(err)
@@ -469,7 +474,7 @@ func (w *rNibWriterInstance) SaveE2TAddresses(addresses []string) error {
        var pairs []interface{}
        pairs = append(pairs, E2TAddressesKey, data)
 
-       err = w.sdl.Set(pairs)
+       err = w.sdl.Set(w.ns, pairs)
 
        if err != nil {
                return common.NewInternalError(err)
@@ -483,7 +488,7 @@ func (w *rNibWriterInstance) RemoveE2TInstance(address string) error {
        if rNibErr != nil {
                return rNibErr
        }
-       err := w.sdl.Remove([]string{key})
+       err := w.sdl.Remove(w.ns, []string{key})
 
        if err != nil {
                return common.NewInternalError(err)
@@ -502,7 +507,7 @@ func (w *rNibWriterInstance) SaveWithKeyAndMarshal(key string, entity interface{
        var pairs []interface{}
        pairs = append(pairs, key, data)
 
-       err = w.sdl.Set(pairs)
+       err = w.sdl.Set(w.ns, pairs)
 
        if err != nil {
                return common.NewInternalError(err)
@@ -522,7 +527,7 @@ func (w *rNibWriterInstance) UpdateNodebInfoOnConnectionStatusInversion(nodebInf
                return err
        }
 
-       err = w.sdl.SetAndPublish([]string{w.rnibWriterConfig.StateChangeMessageChannel, event}, pairs)
+       err = w.sdl.SetAndPublish(w.ns, []string{w.rnibWriterConfig.StateChangeMessageChannel, event}, pairs)
 
        if err != nil {
                return common.NewInternalError(err)
@@ -538,7 +543,7 @@ func (w *rNibWriterInstance) RemoveEnb(nodebInfo *entities.NodebInfo) error {
        }
 
        channelsAndEvents := getChannelsAndEventsPair(w.rnibWriterConfig.RanManipulationMessageChannel, nodebInfo.RanName, RanDeletedEvent)
-       err = w.sdl.RemoveAndPublish(channelsAndEvents, keysToRemove)
+       err = w.sdl.RemoveAndPublish(w.ns, channelsAndEvents, keysToRemove)
 
        if err != nil {
                return common.NewInternalError(err)
@@ -562,7 +567,7 @@ func (w *rNibWriterInstance) UpdateEnb(nodebInfo *entities.NodebInfo, servedCell
        }
 
        channelsAndEvents := getChannelsAndEventsPair(w.rnibWriterConfig.RanManipulationMessageChannel, nodebInfo.RanName, RanUpdatedEvent)
-       err = w.sdl.SetAndPublish(channelsAndEvents, pairs)
+       err = w.sdl.SetAndPublish(w.ns, channelsAndEvents, pairs)
 
        if err != nil {
                return common.NewInternalError(err)
@@ -585,6 +590,7 @@ func (w *rNibWriterInstance) buildNbIdentitiesMembers(nbIdentities []*entities.N
 
        return nbIdIdentitiesMembers, nil
 }
+
 /*
 Close the writer
 */
index dde1f3a..81183b7 100644 (file)
@@ -33,7 +33,7 @@ import (
        "time"
 )
 
-var namespace = "namespace"
+var namespace = common.GetRNibNamespace()
 
 const (
        RanName = "test"
@@ -41,9 +41,9 @@ const (
        NbId    = "4a952a0a"
 )
 
-func initSdlInstanceMock(namespace string) (w RNibWriter, sdlInstanceMock *mocks.MockSdlInstance) {
-       sdlInstanceMock = new(mocks.MockSdlInstance)
-       w = GetRNibWriter(sdlInstanceMock, configuration.RnibWriterConfig{StateChangeMessageChannel: "RAN_CONNECTION_STATUS_CHANGE", RanManipulationMessageChannel: "RAN_MANIPULATION"})
+func initSdlMock() (w RNibWriter, sdlMock *mocks.MockSdlSyncStorage) {
+       sdlMock = new(mocks.MockSdlSyncStorage)
+       w = GetRNibWriter(sdlMock, configuration.RnibWriterConfig{StateChangeMessageChannel: "RAN_CONNECTION_STATUS_CHANGE", RanManipulationMessageChannel: "RAN_MANIPULATION"})
        return
 }
 
@@ -120,32 +120,32 @@ func generateServedCellInfos(cellIds ...string) []*entities.ServedCellInfo {
 }
 
 func TestRemoveServedNrCellsSuccess(t *testing.T) {
-       w, sdlInstanceMock := initSdlInstanceMock(namespace)
+       w, sdlMock := initSdlMock()
        servedNrCellsToRemove := generateServedNrCells("whatever1", "whatever2")
-       sdlInstanceMock.On("Remove", buildServedNRCellKeysToRemove(RanName, servedNrCellsToRemove)).Return(nil)
+       sdlMock.On("Remove", namespace, buildServedNRCellKeysToRemove(RanName, servedNrCellsToRemove)).Return(nil)
        err := w.RemoveServedNrCells(RanName, servedNrCellsToRemove)
        assert.Nil(t, err)
 }
 
 func TestRemoveServedNrCellsFailure(t *testing.T) {
-       w, sdlInstanceMock := initSdlInstanceMock(namespace)
+       w, sdlMock := initSdlMock()
        servedNrCellsToRemove := generateServedNrCells("whatever1", "whatever2")
-       sdlInstanceMock.On("Remove", buildServedNRCellKeysToRemove(RanName, servedNrCellsToRemove)).Return(errors.New("expected error"))
+       sdlMock.On("Remove", namespace, buildServedNRCellKeysToRemove(RanName, servedNrCellsToRemove)).Return(errors.New("expected error"))
        err := w.RemoveServedNrCells(RanName, servedNrCellsToRemove)
        assert.IsType(t, &common.InternalError{}, err)
 }
 
 func TestUpdateGnbCellsInvalidNodebInfoFailure(t *testing.T) {
-       w, sdlInstanceMock := initSdlInstanceMock(namespace)
+       w, sdlMock := initSdlMock()
        servedNrCells := generateServedNrCells("test1", "test2")
        nodebInfo := &entities.NodebInfo{}
-       sdlInstanceMock.AssertNotCalled(t, "SetAndPublish")
+       sdlMock.AssertNotCalled(t, "SetAndPublish")
        rNibErr := w.UpdateGnbCells(nodebInfo, servedNrCells)
        assert.IsType(t, &common.ValidationError{}, rNibErr)
 }
 
 func TestAddNbIdentitySuccess(t *testing.T) {
-       w, sdlInstanceMock := initSdlInstanceMock(namespace)
+       w, sdlMock := initSdlMock()
 
        nbIdentity := &entities.NbIdentity{InventoryName: RanName, GlobalNbId: &entities.GlobalNbId{PlmnId: PlmnId, NbId: NbId}}
        nbIdData, err := proto.Marshal(nbIdentity)
@@ -153,13 +153,13 @@ func TestAddNbIdentitySuccess(t *testing.T) {
                t.Fatalf("#rNibWriter_test.TestAddNbIdentitySuccess - Failed to marshal NodeB Identity entity. Error: %v", err)
        }
 
-       sdlInstanceMock.On("AddMember", "ENB", []interface{}{nbIdData}).Return(nil)
+       sdlMock.On("AddMember", namespace, "ENB", []interface{}{nbIdData}).Return(nil)
        rNibErr := w.AddNbIdentity(entities.Node_ENB, nbIdentity)
        assert.Nil(t, rNibErr)
 }
 
 func TestAddNbIdentityMarshalNilFailure(t *testing.T) {
-       w, _ := initSdlInstanceMock(namespace)
+       w, _ := initSdlMock()
 
        rNibErr := w.AddNbIdentity(entities.Node_ENB, nil)
        expectedErr := common.NewInternalError(errors.New("proto: Marshal called with nil"))
@@ -167,7 +167,7 @@ func TestAddNbIdentityMarshalNilFailure(t *testing.T) {
 }
 
 func TestAddNbIdentitySdlFailure(t *testing.T) {
-       w, sdlInstanceMock := initSdlInstanceMock(namespace)
+       w, sdlMock := initSdlMock()
 
        nbIdentity := &entities.NbIdentity{InventoryName: RanName, GlobalNbId: &entities.GlobalNbId{PlmnId: PlmnId, NbId: NbId}}
        nbIdData, err := proto.Marshal(nbIdentity)
@@ -175,7 +175,7 @@ func TestAddNbIdentitySdlFailure(t *testing.T) {
                t.Fatalf("#rNibWriter_test.TestAddNbIdentitySdlFailure - Failed to marshal NodeB Identity entity. Error: %v", err)
        }
 
-       sdlInstanceMock.On("AddMember", "ENB", []interface{}{nbIdData}).Return(errors.New("expected error"))
+       sdlMock.On("AddMember", namespace, "ENB", []interface{}{nbIdData}).Return(errors.New("expected error"))
        rNibErr := w.AddNbIdentity(entities.Node_ENB, nbIdentity)
        assert.IsType(t, &common.InternalError{}, rNibErr)
 }
@@ -184,11 +184,11 @@ func TestUpdateGnbCellsInvalidCellFailure(t *testing.T) {
        inventoryName := "name"
        plmnId := "02f829"
        nbId := "4a952a0a"
-       w, sdlInstanceMock := initSdlInstanceMock(namespace)
+       w, sdlMock := initSdlMock()
        servedNrCells := []*entities.ServedNRCell{{ServedNrCellInformation: &entities.ServedNRCellInformation{}}}
        nodebInfo := generateNodebInfo(inventoryName, entities.Node_GNB, plmnId, nbId)
        nodebInfo.GetGnb().ServedNrCells = servedNrCells
-       sdlInstanceMock.AssertNotCalled(t, "SetAndPublish")
+       sdlMock.AssertNotCalled(t, "SetAndPublish")
        rNibErr := w.UpdateGnbCells(nodebInfo, servedNrCells)
        assert.IsType(t, &common.ValidationError{}, rNibErr)
 }
@@ -253,12 +253,12 @@ func TestUpdateGnbCellsSdlFailure(t *testing.T) {
        inventoryName := "name"
        plmnId := "02f829"
        nbId := "4a952a0a"
-       w, sdlInstanceMock := initSdlInstanceMock(namespace)
+       w, sdlMock := initSdlMock()
        servedNrCells := generateServedNrCells("test1", "test2")
        nodebInfo := generateNodebInfo(inventoryName, entities.Node_GNB, plmnId, nbId)
        nodebInfo.GetGnb().ServedNrCells = servedNrCells
        setExpected := getUpdateGnbCellsSetExpected(t, nodebInfo, servedNrCells)
-       sdlInstanceMock.On("SetAndPublish", []string{"RAN_MANIPULATION", inventoryName + "_" + RanUpdatedEvent}, []interface{}{setExpected}).Return(errors.New("expected error"))
+       sdlMock.On("SetAndPublish", namespace, []string{"RAN_MANIPULATION", inventoryName + "_" + RanUpdatedEvent}, []interface{}{setExpected}).Return(errors.New("expected error"))
        rNibErr := w.UpdateGnbCells(nodebInfo, servedNrCells)
        assert.IsType(t, &common.InternalError{}, rNibErr)
 }
@@ -268,7 +268,7 @@ func TestUpdateGnbCellsRnibKeyValidationError(t *testing.T) {
        inventoryName := ""
        plmnId := "02f829"
        nbId := "4a952a0a"
-       w, _ := initSdlInstanceMock(namespace)
+       w, _ := initSdlMock()
        servedNrCells := generateServedNrCells("test1", "test2")
        nodebInfo := generateNodebInfo(inventoryName, entities.Node_GNB, plmnId, nbId)
        nodebInfo.GetGnb().ServedNrCells = servedNrCells
@@ -281,13 +281,13 @@ func TestUpdateGnbCellsSuccess(t *testing.T) {
        inventoryName := "name"
        plmnId := "02f829"
        nbId := "4a952a0a"
-       w, sdlInstanceMock := initSdlInstanceMock(namespace)
+       w, sdlMock := initSdlMock()
        servedNrCells := generateServedNrCells("test1", "test2")
        nodebInfo := generateNodebInfo(inventoryName, entities.Node_GNB, plmnId, nbId)
        nodebInfo.GetGnb().ServedNrCells = servedNrCells
        setExpected := getUpdateGnbCellsSetExpected(t, nodebInfo, servedNrCells)
        var e error
-       sdlInstanceMock.On("SetAndPublish", []string{"RAN_MANIPULATION", inventoryName + "_" + RanUpdatedEvent}, []interface{}{setExpected}).Return(e)
+       sdlMock.On("SetAndPublish", namespace, []string{"RAN_MANIPULATION", inventoryName + "_" + RanUpdatedEvent}, []interface{}{setExpected}).Return(e)
        rNibErr := w.UpdateGnbCells(nodebInfo, servedNrCells)
        assert.Nil(t, rNibErr)
 }
@@ -296,7 +296,7 @@ func TestUpdateNodebInfoSuccess(t *testing.T) {
        inventoryName := "name"
        plmnId := "02f829"
        nbId := "4a952a0a"
-       w, sdlInstanceMock := initSdlInstanceMock(namespace)
+       w, sdlMock := initSdlMock()
        nodebInfo := generateNodebInfo(inventoryName, entities.Node_ENB, plmnId, nbId)
        data, err := proto.Marshal(nodebInfo)
        if err != nil {
@@ -310,18 +310,18 @@ func TestUpdateNodebInfoSuccess(t *testing.T) {
        setExpected = append(setExpected, nodebNameKey, data)
        setExpected = append(setExpected, nodebIdKey, data)
 
-       sdlInstanceMock.On("Set", []interface{}{setExpected}).Return(e)
+       sdlMock.On("Set", namespace, []interface{}{setExpected}).Return(e)
 
        rNibErr := w.UpdateNodebInfo(nodebInfo)
        assert.Nil(t, rNibErr)
-       sdlInstanceMock.AssertExpectations(t)
+       sdlMock.AssertExpectations(t)
 }
 
 func TestUpdateNodebInfoAndPublishSuccess(t *testing.T) {
        inventoryName := "name"
        plmnId := "02f829"
        nbId := "4a952a0a"
-       w, sdlInstanceMock := initSdlInstanceMock(namespace)
+       w, sdlMock := initSdlMock()
        nodebInfo := generateNodebInfo(inventoryName, entities.Node_ENB, plmnId, nbId)
        data, err := proto.Marshal(nodebInfo)
        if err != nil {
@@ -335,18 +335,18 @@ func TestUpdateNodebInfoAndPublishSuccess(t *testing.T) {
        setExpected = append(setExpected, nodebNameKey, data)
        setExpected = append(setExpected, nodebIdKey, data)
 
-       sdlInstanceMock.On("SetAndPublish", []string{"RAN_MANIPULATION", inventoryName + "_" + RanUpdatedEvent}, []interface{}{setExpected}).Return(e)
+       sdlMock.On("SetAndPublish", namespace, []string{"RAN_MANIPULATION", inventoryName + "_" + RanUpdatedEvent}, []interface{}{setExpected}).Return(e)
 
        rNibErr := w.UpdateNodebInfoAndPublish(nodebInfo)
        assert.Nil(t, rNibErr)
-       sdlInstanceMock.AssertExpectations(t)
+       sdlMock.AssertExpectations(t)
 }
 
 func TestUpdateNodebInfoMissingInventoryNameFailure(t *testing.T) {
        inventoryName := "name"
        plmnId := "02f829"
        nbId := "4a952a0a"
-       w, sdlInstanceMock := initSdlInstanceMock(namespace)
+       w, sdlMock := initSdlMock()
        nodebInfo := &entities.NodebInfo{}
        data, err := proto.Marshal(nodebInfo)
        if err != nil {
@@ -360,7 +360,7 @@ func TestUpdateNodebInfoMissingInventoryNameFailure(t *testing.T) {
        setExpected = append(setExpected, nodebNameKey, data)
        setExpected = append(setExpected, nodebIdKey, data)
 
-       sdlInstanceMock.On("Set", []interface{}{setExpected}).Return(e)
+       sdlMock.On("Set", namespace, []interface{}{setExpected}).Return(e)
 
        rNibErr := w.UpdateNodebInfo(nodebInfo)
 
@@ -370,7 +370,7 @@ func TestUpdateNodebInfoMissingInventoryNameFailure(t *testing.T) {
 
 func TestUpdateNodebInfoMissingGlobalNbId(t *testing.T) {
        inventoryName := "name"
-       w, sdlInstanceMock := initSdlInstanceMock(namespace)
+       w, sdlMock := initSdlMock()
        nodebInfo := &entities.NodebInfo{}
        nodebInfo.RanName = inventoryName
        data, err := proto.Marshal(nodebInfo)
@@ -382,7 +382,7 @@ func TestUpdateNodebInfoMissingGlobalNbId(t *testing.T) {
 
        nodebNameKey := fmt.Sprintf("RAN:%s", inventoryName)
        setExpected = append(setExpected, nodebNameKey, data)
-       sdlInstanceMock.On("Set", []interface{}{setExpected}).Return(e)
+       sdlMock.On("Set", namespace, []interface{}{setExpected}).Return(e)
 
        rNibErr := w.UpdateNodebInfo(nodebInfo)
 
@@ -393,7 +393,7 @@ func TestUpdateNodebInfoSdlSetFailure(t *testing.T) {
        inventoryName := "name"
        plmnId := "02f829"
        nbId := "4a952a0a"
-       w, sdlInstanceMock := initSdlInstanceMock(namespace)
+       w, sdlMock := initSdlMock()
        nodebInfo := generateNodebInfo(inventoryName, entities.Node_ENB, plmnId, nbId)
        data, err := proto.Marshal(nodebInfo)
        if err != nil {
@@ -407,17 +407,17 @@ func TestUpdateNodebInfoSdlSetFailure(t *testing.T) {
        setExpected = append(setExpected, nodebNameKey, data)
        setExpected = append(setExpected, nodebIdKey, data)
 
-       sdlInstanceMock.On("Set", []interface{}{setExpected}).Return(e)
+       sdlMock.On("Set", namespace, []interface{}{setExpected}).Return(e)
 
        rNibErr := w.UpdateNodebInfo(nodebInfo)
        assert.NotNil(t, rNibErr)
        assert.IsType(t, &common.InternalError{}, rNibErr)
-       sdlInstanceMock.AssertExpectations(t)
+       sdlMock.AssertExpectations(t)
 }
 
 func TestSaveEnb(t *testing.T) {
        ranName := "RAN:" + RanName
-       w, sdlInstanceMock := initSdlInstanceMock(namespace)
+       w, sdlMock := initSdlMock()
        nb := entities.NodebInfo{
                RanName:          RanName,
                NodeType:         entities.Node_ENB,
@@ -451,13 +451,13 @@ func TestSaveEnb(t *testing.T) {
        setExpected = append(setExpected, fmt.Sprintf("CELL:%s", cell.GetCellId()), cellData)
        setExpected = append(setExpected, fmt.Sprintf("PCI:%s:%02x", RanName, cell.GetPci()), cellData)
 
-       sdlInstanceMock.On("Set", []interface{}{setExpected}).Return(e)
+       sdlMock.On("Set", namespace, []interface{}{setExpected}).Return(e)
        rNibErr := w.SaveNodeb(&nb)
        assert.Nil(t, rNibErr)
 }
 
 func TestSaveEnbCellIdValidationFailure(t *testing.T) {
-       w, _ := initSdlInstanceMock(namespace)
+       w, _ := initSdlMock()
        nb := entities.NodebInfo{}
        nb.RanName = "name"
        nb.NodeType = entities.Node_ENB
@@ -475,7 +475,7 @@ func TestSaveEnbCellIdValidationFailure(t *testing.T) {
 }
 
 func TestSaveEnbInventoryNameValidationFailure(t *testing.T) {
-       w, _ := initSdlInstanceMock(namespace)
+       w, _ := initSdlMock()
        nb := entities.NodebInfo{
                NodeType:         entities.Node_ENB,
                ConnectionStatus: entities.ConnectionStatus_CONNECTED,
@@ -497,7 +497,7 @@ func TestSaveEnbInventoryNameValidationFailure(t *testing.T) {
 }
 
 func TestSaveEnbGlobalNbIdPlmnValidationFailure(t *testing.T) {
-       w, _ := initSdlInstanceMock(namespace)
+       w, _ := initSdlMock()
        nb := entities.NodebInfo{
                RanName:          RanName,
                NodeType:         entities.Node_ENB,
@@ -521,7 +521,7 @@ func TestSaveEnbGlobalNbIdPlmnValidationFailure(t *testing.T) {
 }
 
 func TestSaveGnbCellIdValidationFailure(t *testing.T) {
-       w, _ := initSdlInstanceMock(namespace)
+       w, _ := initSdlMock()
        nb := entities.NodebInfo{}
        nb.RanName = "name"
        nb.NodeType = entities.Node_GNB
@@ -542,7 +542,7 @@ func TestSaveGnbCellIdValidationFailure(t *testing.T) {
 
 func TestSaveGnb(t *testing.T) {
        ranName := "RAN:" + RanName
-       w, sdlInstanceMock := initSdlInstanceMock(namespace)
+       w, sdlMock := initSdlMock()
        nb := entities.NodebInfo{
                RanName:          RanName,
                NodeType:         entities.Node_GNB,
@@ -577,7 +577,7 @@ func TestSaveGnb(t *testing.T) {
        setExpected = append(setExpected, fmt.Sprintf("NRCELL:%s", cell.GetServedNrCellInformation().GetCellId()), cellData)
        setExpected = append(setExpected, fmt.Sprintf("PCI:%s:%02x", RanName, cell.GetServedNrCellInformation().GetNrPci()), cellData)
 
-       sdlInstanceMock.On("Set", []interface{}{setExpected}).Return(e)
+       sdlMock.On("Set", namespace, []interface{}{setExpected}).Return(e)
        rNibErr := w.SaveNodeb(&nb)
        assert.Nil(t, rNibErr)
 }
@@ -590,7 +590,7 @@ func TestSaveRanLoadInformationSuccess(t *testing.T) {
                t.Errorf("#rNibWriter_test.TestSaveRanLoadInformationSuccess - Failed to build ran load infromation key. Error: %v", validationErr)
        }
 
-       w, sdlInstanceMock := initSdlInstanceMock(namespace)
+       w, sdlMock := initSdlMock()
 
        ranLoadInformation := generateRanLoadInformation()
        data, err := proto.Marshal(ranLoadInformation)
@@ -602,7 +602,7 @@ func TestSaveRanLoadInformationSuccess(t *testing.T) {
        var e error
        var setExpected []interface{}
        setExpected = append(setExpected, loadKey, data)
-       sdlInstanceMock.On("Set", []interface{}{setExpected}).Return(e)
+       sdlMock.On("Set", namespace, []interface{}{setExpected}).Return(e)
 
        rNibErr := w.SaveRanLoadInformation(inventoryName, ranLoadInformation)
        assert.Nil(t, rNibErr)
@@ -610,7 +610,7 @@ func TestSaveRanLoadInformationSuccess(t *testing.T) {
 
 func TestSaveRanLoadInformationMarshalNilFailure(t *testing.T) {
        inventoryName := "name2"
-       w, _ := initSdlInstanceMock(namespace)
+       w, _ := initSdlMock()
 
        expectedErr := common.NewInternalError(errors.New("proto: Marshal called with nil"))
        err := w.SaveRanLoadInformation(inventoryName, nil)
@@ -619,7 +619,7 @@ func TestSaveRanLoadInformationMarshalNilFailure(t *testing.T) {
 
 func TestSaveRanLoadInformationEmptyInventoryNameFailure(t *testing.T) {
        inventoryName := ""
-       w, _ := initSdlInstanceMock(namespace)
+       w, _ := initSdlMock()
 
        err := w.SaveRanLoadInformation(inventoryName, nil)
        assert.NotNil(t, err)
@@ -635,7 +635,7 @@ func TestSaveRanLoadInformationSdlFailure(t *testing.T) {
                t.Errorf("#rNibWriter_test.TestSaveRanLoadInformationSuccess - Failed to build ran load infromation key. Error: %v", validationErr)
        }
 
-       w, sdlInstanceMock := initSdlInstanceMock(namespace)
+       w, sdlMock := initSdlMock()
 
        ranLoadInformation := generateRanLoadInformation()
        data, err := proto.Marshal(ranLoadInformation)
@@ -647,7 +647,7 @@ func TestSaveRanLoadInformationSdlFailure(t *testing.T) {
        expectedErr := errors.New("expected error")
        var setExpected []interface{}
        setExpected = append(setExpected, loadKey, data)
-       sdlInstanceMock.On("Set", []interface{}{setExpected}).Return(expectedErr)
+       sdlMock.On("Set", namespace, []interface{}{setExpected}).Return(expectedErr)
 
        rNibErr := w.SaveRanLoadInformation(inventoryName, ranLoadInformation)
        assert.NotNil(t, rNibErr)
@@ -728,14 +728,14 @@ func generateRanLoadInformation() *entities.RanLoadInformation {
 }
 
 func TestSaveNilEntityFailure(t *testing.T) {
-       w, _ := initSdlInstanceMock(namespace)
+       w, _ := initSdlMock()
        expectedErr := common.NewInternalError(errors.New("proto: Marshal called with nil"))
        actualErr := w.SaveNodeb(nil)
        assert.Equal(t, expectedErr, actualErr)
 }
 
 func TestSaveUnknownTypeEntityFailure(t *testing.T) {
-       w, _ := initSdlInstanceMock(namespace)
+       w, _ := initSdlMock()
        nb := &entities.NodebInfo{}
        nb.Port = 5656
        nb.Ip = "localhost"
@@ -748,7 +748,7 @@ func TestSaveEntitySetFailure(t *testing.T) {
        plmnId := "02f829"
        nbId := "4a952a0a"
 
-       w, sdlInstanceMock := initSdlInstanceMock(namespace)
+       w, sdlMock := initSdlMock()
        gnb := entities.NodebInfo{
                RanName:          name,
                NodeType:         entities.Node_GNB,
@@ -767,7 +767,7 @@ func TestSaveEntitySetFailure(t *testing.T) {
        setExpected := []interface{}{"RAN:" + name, data}
        setExpected = append(setExpected, "GNB:"+plmnId+":"+nbId, data)
        expectedErr := errors.New("expected error")
-       sdlInstanceMock.On("Set", []interface{}{setExpected}).Return(expectedErr)
+       sdlMock.On("Set", namespace, []interface{}{setExpected}).Return(expectedErr)
        rNibErr := w.SaveNodeb(&gnb)
        assert.NotEmpty(t, rNibErr)
 }
@@ -777,7 +777,7 @@ func TestSaveEntitySetAndPublishFailure(t *testing.T) {
        plmnId := "02f829"
        nbId := "4a952a0a"
 
-       w, sdlInstanceMock := initSdlInstanceMock(namespace)
+       w, sdlMock := initSdlMock()
        enb := entities.NodebInfo{
                RanName:          name,
                NodeType:         entities.Node_ENB,
@@ -796,13 +796,13 @@ func TestSaveEntitySetAndPublishFailure(t *testing.T) {
        setExpected := []interface{}{"RAN:" + name, data}
        setExpected = append(setExpected, "ENB:"+plmnId+":"+nbId, data)
        expectedErr := errors.New("expected error")
-       sdlInstanceMock.On("SetAndPublish", []string{"RAN_MANIPULATION", name + "_" + RanAddedEvent}, []interface{}{setExpected}).Return(expectedErr)
+       sdlMock.On("SetAndPublish", namespace, []string{"RAN_MANIPULATION", name + "_" + RanAddedEvent}, []interface{}{setExpected}).Return(expectedErr)
        rNibErr := w.AddEnb(&enb)
        assert.NotEmpty(t, rNibErr)
 }
 
 func TestGetRNibWriter(t *testing.T) {
-       received, _ := initSdlInstanceMock(namespace)
+       received, _ := initSdlMock()
        assert.NotEmpty(t, received)
 }
 
@@ -814,7 +814,7 @@ func TestSaveE2TInstanceSuccess(t *testing.T) {
                t.Errorf("#rNibWriter_test.TestSaveE2TInstanceSuccess - Failed to build E2T Instance key. Error: %v", validationErr)
        }
 
-       w, sdlInstanceMock := initSdlInstanceMock(namespace)
+       w, sdlMock := initSdlMock()
 
        e2tInstance := generateE2tInstance(address)
        data, err := json.Marshal(e2tInstance)
@@ -826,14 +826,14 @@ func TestSaveE2TInstanceSuccess(t *testing.T) {
        var e error
        var setExpected []interface{}
        setExpected = append(setExpected, loadKey, data)
-       sdlInstanceMock.On("Set", []interface{}{setExpected}).Return(e)
+       sdlMock.On("Set", namespace, []interface{}{setExpected}).Return(e)
 
        rNibErr := w.SaveE2TInstance(e2tInstance)
        assert.Nil(t, rNibErr)
 }
 
 func TestSaveE2TInstanceNullE2tInstanceFailure(t *testing.T) {
-       w, _ := initSdlInstanceMock(namespace)
+       w, _ := initSdlMock()
        var address string
        e2tInstance := entities.NewE2TInstance(address, "test")
        err := w.SaveE2TInstance(e2tInstance)
@@ -849,7 +849,7 @@ func TestSaveE2TInstanceSdlFailure(t *testing.T) {
                t.Errorf("#rNibWriter_test.TestSaveE2TInstanceSdlFailure - Failed to build E2T Instance key. Error: %v", validationErr)
        }
 
-       w, sdlInstanceMock := initSdlInstanceMock(namespace)
+       w, sdlMock := initSdlMock()
 
        e2tInstance := generateE2tInstance(address)
        data, err := json.Marshal(e2tInstance)
@@ -861,7 +861,7 @@ func TestSaveE2TInstanceSdlFailure(t *testing.T) {
        expectedErr := errors.New("expected error")
        var setExpected []interface{}
        setExpected = append(setExpected, loadKey, data)
-       sdlInstanceMock.On("Set", []interface{}{setExpected}).Return(expectedErr)
+       sdlMock.On("Set", namespace, []interface{}{setExpected}).Return(expectedErr)
 
        rNibErr := w.SaveE2TInstance(e2tInstance)
        assert.NotNil(t, rNibErr)
@@ -878,7 +878,7 @@ func generateE2tInstance(address string) *entities.E2TInstance {
 
 func TestSaveE2TAddressesSuccess(t *testing.T) {
        address := "10.10.2.15:9800"
-       w, sdlInstanceMock := initSdlInstanceMock(namespace)
+       w, sdlMock := initSdlMock()
 
        e2tAddresses := []string{address}
        data, err := json.Marshal(e2tAddresses)
@@ -890,7 +890,7 @@ func TestSaveE2TAddressesSuccess(t *testing.T) {
        var e error
        var setExpected []interface{}
        setExpected = append(setExpected, E2TAddressesKey, data)
-       sdlInstanceMock.On("Set", []interface{}{setExpected}).Return(e)
+       sdlMock.On("Set", namespace, []interface{}{setExpected}).Return(e)
 
        rNibErr := w.SaveE2TAddresses(e2tAddresses)
        assert.Nil(t, rNibErr)
@@ -898,7 +898,7 @@ func TestSaveE2TAddressesSuccess(t *testing.T) {
 
 func TestSaveE2TAddressesSdlFailure(t *testing.T) {
        address := "10.10.2.15:9800"
-       w, sdlInstanceMock := initSdlInstanceMock(namespace)
+       w, sdlMock := initSdlMock()
 
        e2tAddresses := []string{address}
        data, err := json.Marshal(e2tAddresses)
@@ -910,7 +910,7 @@ func TestSaveE2TAddressesSdlFailure(t *testing.T) {
        expectedErr := errors.New("expected error")
        var setExpected []interface{}
        setExpected = append(setExpected, E2TAddressesKey, data)
-       sdlInstanceMock.On("Set", []interface{}{setExpected}).Return(expectedErr)
+       sdlMock.On("Set", namespace, []interface{}{setExpected}).Return(expectedErr)
 
        rNibErr := w.SaveE2TAddresses(e2tAddresses)
        assert.NotNil(t, rNibErr)
@@ -919,35 +919,35 @@ func TestSaveE2TAddressesSdlFailure(t *testing.T) {
 
 func TestRemoveE2TInstanceSuccess(t *testing.T) {
        address := "10.10.2.15:9800"
-       w, sdlInstanceMock := initSdlInstanceMock(namespace)
+       w, sdlMock := initSdlMock()
 
        e2tAddresses := []string{fmt.Sprintf("E2TInstance:%s", address)}
        var e error
-       sdlInstanceMock.On("Remove", e2tAddresses).Return(e)
+       sdlMock.On("Remove", namespace, e2tAddresses).Return(e)
 
        rNibErr := w.RemoveE2TInstance(address)
        assert.Nil(t, rNibErr)
-       sdlInstanceMock.AssertExpectations(t)
+       sdlMock.AssertExpectations(t)
 }
 
 func TestRemoveE2TInstanceSdlFailure(t *testing.T) {
        address := "10.10.2.15:9800"
-       w, sdlInstanceMock := initSdlInstanceMock(namespace)
+       w, sdlMock := initSdlMock()
 
        e2tAddresses := []string{fmt.Sprintf("E2TInstance:%s", address)}
        expectedErr := errors.New("expected error")
-       sdlInstanceMock.On("Remove", e2tAddresses).Return(expectedErr)
+       sdlMock.On("Remove", namespace, e2tAddresses).Return(expectedErr)
 
        rNibErr := w.RemoveE2TInstance(address)
        assert.IsType(t, &common.InternalError{}, rNibErr)
 }
 
 func TestRemoveE2TInstanceEmptyAddressFailure(t *testing.T) {
-       w, sdlInstanceMock := initSdlInstanceMock(namespace)
+       w, sdlMock := initSdlMock()
 
        rNibErr := w.RemoveE2TInstance("")
        assert.IsType(t, &common.ValidationError{}, rNibErr)
-       sdlInstanceMock.AssertExpectations(t)
+       sdlMock.AssertExpectations(t)
 }
 
 func TestUpdateNodebInfoOnConnectionStatusInversionSuccess(t *testing.T) {
@@ -956,7 +956,7 @@ func TestUpdateNodebInfoOnConnectionStatusInversionSuccess(t *testing.T) {
        nbId := "4a952a0a"
        channelName := "RAN_CONNECTION_STATUS_CHANGE"
        eventName := inventoryName + "_" + "CONNECTED"
-       w, sdlInstanceMock := initSdlInstanceMock(namespace)
+       w, sdlMock := initSdlMock()
        nodebInfo := generateNodebInfo(inventoryName, entities.Node_ENB, plmnId, nbId)
        data, err := proto.Marshal(nodebInfo)
        if err != nil {
@@ -970,7 +970,7 @@ func TestUpdateNodebInfoOnConnectionStatusInversionSuccess(t *testing.T) {
        setExpected = append(setExpected, nodebNameKey, data)
        setExpected = append(setExpected, nodebIdKey, data)
 
-       sdlInstanceMock.On("SetAndPublish", []string{channelName, eventName}, []interface{}{setExpected}).Return(e)
+       sdlMock.On("SetAndPublish", namespace, []string{channelName, eventName}, []interface{}{setExpected}).Return(e)
 
        rNibErr := w.UpdateNodebInfoOnConnectionStatusInversion(nodebInfo, eventName)
        assert.Nil(t, rNibErr)
@@ -982,7 +982,7 @@ func TestUpdateNodebInfoOnConnectionStatusInversionMissingInventoryNameFailure(t
        nbId := "4a952a0a"
        channelName := "RAN_CONNECTION_STATUS_CHANGE"
        eventName := inventoryName + "_" + "CONNECTED"
-       w, sdlInstanceMock := initSdlInstanceMock(namespace)
+       w, sdlMock := initSdlMock()
        nodebInfo := &entities.NodebInfo{}
        data, err := proto.Marshal(nodebInfo)
        if err != nil {
@@ -996,7 +996,7 @@ func TestUpdateNodebInfoOnConnectionStatusInversionMissingInventoryNameFailure(t
        setExpected = append(setExpected, nodebNameKey, data)
        setExpected = append(setExpected, nodebIdKey, data)
 
-       sdlInstanceMock.On("SetAndPublish", []string{channelName, eventName}, []interface{}{setExpected}).Return(e)
+       sdlMock.On("SetAndPublish", namespace, []string{channelName, eventName}, []interface{}{setExpected}).Return(e)
 
        rNibErr := w.UpdateNodebInfoOnConnectionStatusInversion(nodebInfo, eventName)
 
@@ -1008,7 +1008,7 @@ func TestUpdateNodebInfoOnConnectionStatusInversionMissingGlobalNbId(t *testing.
        inventoryName := "name"
        channelName := "RAN_CONNECTION_STATUS_CHANGE"
        eventName := inventoryName + "_" + "CONNECTED"
-       w, sdlInstanceMock := initSdlInstanceMock(namespace)
+       w, sdlMock := initSdlMock()
        nodebInfo := &entities.NodebInfo{}
        nodebInfo.RanName = inventoryName
        data, err := proto.Marshal(nodebInfo)
@@ -1020,7 +1020,7 @@ func TestUpdateNodebInfoOnConnectionStatusInversionMissingGlobalNbId(t *testing.
 
        nodebNameKey := fmt.Sprintf("RAN:%s", inventoryName)
        setExpected = append(setExpected, nodebNameKey, data)
-       sdlInstanceMock.On("SetAndPublish", []string{channelName, eventName}, []interface{}{setExpected}).Return(e)
+       sdlMock.On("SetAndPublish", namespace, []string{channelName, eventName}, []interface{}{setExpected}).Return(e)
 
        rNibErr := w.UpdateNodebInfoOnConnectionStatusInversion(nodebInfo, eventName)
 
@@ -1033,7 +1033,7 @@ func TestUpdateNodebInfoOnConnectionStatusInversionSdlFailure(t *testing.T) {
        nbId := "4a952a0a"
        channelName := "RAN_CONNECTION_STATUS_CHANGE"
        eventName := inventoryName + "_" + "CONNECTED"
-       w, sdlInstanceMock := initSdlInstanceMock(namespace)
+       w, sdlMock := initSdlMock()
        nodebInfo := generateNodebInfo(inventoryName, entities.Node_ENB, plmnId, nbId)
        data, err := proto.Marshal(nodebInfo)
        if err != nil {
@@ -1047,7 +1047,7 @@ func TestUpdateNodebInfoOnConnectionStatusInversionSdlFailure(t *testing.T) {
        setExpected = append(setExpected, nodebNameKey, data)
        setExpected = append(setExpected, nodebIdKey, data)
 
-       sdlInstanceMock.On("SetAndPublish", []string{channelName, eventName}, []interface{}{setExpected}).Return(e)
+       sdlMock.On("SetAndPublish", namespace, []string{channelName, eventName}, []interface{}{setExpected}).Return(e)
 
        rNibErr := w.UpdateNodebInfoOnConnectionStatusInversion(nodebInfo, eventName)
        assert.NotNil(t, rNibErr)
@@ -1055,22 +1055,22 @@ func TestUpdateNodebInfoOnConnectionStatusInversionSdlFailure(t *testing.T) {
 }
 
 func TestSaveGeneralConfiguration(t *testing.T) {
-       w, sdlInstanceMock := initSdlInstanceMock(namespace)
+       w, sdlMock := initSdlMock()
 
        key := common.BuildGeneralConfigurationKey()
        configurationData := "{\"enableRic\":true}"
        configuration := &entities.GeneralConfiguration{}
        configuration.EnableRic = true
 
-       sdlInstanceMock.On("Set", []interface{}{[]interface{}{key, []byte(configurationData)}}).Return(nil)
+       sdlMock.On("Set", namespace, []interface{}{[]interface{}{key, []byte(configurationData)}}).Return(nil)
        rNibErr := w.SaveGeneralConfiguration(configuration)
 
        assert.Nil(t, rNibErr)
-       sdlInstanceMock.AssertExpectations(t)
+       sdlMock.AssertExpectations(t)
 }
 
 func TestSaveGeneralConfigurationDbError(t *testing.T) {
-       w, sdlInstanceMock := initSdlInstanceMock(namespace)
+       w, sdlMock := initSdlMock()
 
        key := common.BuildGeneralConfigurationKey()
        configurationData := "{\"enableRic\":true}"
@@ -1079,17 +1079,17 @@ func TestSaveGeneralConfigurationDbError(t *testing.T) {
 
        expectedErr := errors.New("expected error")
 
-       sdlInstanceMock.On("Set", []interface{}{[]interface{}{key, []byte(configurationData)}}).Return(expectedErr)
+       sdlMock.On("Set", namespace, []interface{}{[]interface{}{key, []byte(configurationData)}}).Return(expectedErr)
        rNibErr := w.SaveGeneralConfiguration(configuration)
 
        assert.NotNil(t, rNibErr)
 }
 
 func TestRemoveServedCellsFailure(t *testing.T) {
-       w, sdlInstanceMock := initSdlInstanceMock(namespace)
+       w, sdlMock := initSdlMock()
        servedCellsToRemove := generateServedCells("whatever1", "whatever2")
        expectedErr := errors.New("expected error")
-       sdlInstanceMock.On("Remove", buildServedCellInfoKeysToRemove(RanName, servedCellsToRemove)).Return(expectedErr)
+       sdlMock.On("Remove", namespace, buildServedCellInfoKeysToRemove(RanName, servedCellsToRemove)).Return(expectedErr)
 
        rNibErr := w.RemoveServedCells(RanName, servedCellsToRemove)
 
@@ -1097,18 +1097,18 @@ func TestRemoveServedCellsFailure(t *testing.T) {
 }
 
 func TestRemoveServedCellsSuccess(t *testing.T) {
-       w, sdlInstanceMock := initSdlInstanceMock(namespace)
+       w, sdlMock := initSdlMock()
        servedCellsToRemove := generateServedCells("whatever1", "whatever2")
-       sdlInstanceMock.On("Remove", buildServedCellInfoKeysToRemove(RanName, servedCellsToRemove)).Return(nil)
+       sdlMock.On("Remove", namespace, buildServedCellInfoKeysToRemove(RanName, servedCellsToRemove)).Return(nil)
        err := w.RemoveServedCells(RanName, servedCellsToRemove)
        assert.Nil(t, err)
 }
 
 func TestUpdateEnbInvalidNodebInfoFailure(t *testing.T) {
-       w, sdlInstanceMock := initSdlInstanceMock(namespace)
+       w, sdlMock := initSdlMock()
        servedCells := generateServedCells("test1", "test2")
        nodebInfo := &entities.NodebInfo{}
-       sdlInstanceMock.AssertNotCalled(t, "SetAndPublish")
+       sdlMock.AssertNotCalled(t, "SetAndPublish")
        rNibErr := w.UpdateEnb(nodebInfo, servedCells)
        assert.IsType(t, &common.ValidationError{}, rNibErr)
 }
@@ -1117,11 +1117,11 @@ func TestUpdateEnbInvalidCellFailure(t *testing.T) {
        inventoryName := "name"
        plmnId := "02f829"
        nbId := "4a952a0a"
-       w, sdlInstanceMock := initSdlInstanceMock(namespace)
+       w, sdlMock := initSdlMock()
        servedCells := []*entities.ServedCellInfo{{CellId: ""}}
        nodebInfo := generateNodebInfo(inventoryName, entities.Node_ENB, plmnId, nbId)
        nodebInfo.GetEnb().ServedCells = servedCells
-       sdlInstanceMock.AssertNotCalled(t, "SetAndPublish")
+       sdlMock.AssertNotCalled(t, "SetAndPublish")
        rNibErr := w.UpdateEnb(nodebInfo, servedCells)
        assert.IsType(t, &common.ValidationError{}, rNibErr)
 }
@@ -1131,7 +1131,7 @@ func TestUpdateEnbRnibKeyValidationError(t *testing.T) {
        inventoryName := ""
        plmnId := "02f829"
        nbId := "4a952a0a"
-       w, _ := initSdlInstanceMock(namespace)
+       w, _ := initSdlMock()
        servedCells := generateServedCells("test1", "test2")
        nodebInfo := generateNodebInfo(inventoryName, entities.Node_ENB, plmnId, nbId)
        nodebInfo.GetEnb().ServedCells = servedCells
@@ -1144,12 +1144,12 @@ func TestUpdateEnbSdlFailure(t *testing.T) {
        inventoryName := "name"
        plmnId := "02f829"
        nbId := "4a952a0a"
-       w, sdlInstanceMock := initSdlInstanceMock(namespace)
+       w, sdlMock := initSdlMock()
        servedCells := generateServedCells("test1", "test2")
        nodebInfo := generateNodebInfo(inventoryName, entities.Node_ENB, plmnId, nbId)
        nodebInfo.GetEnb().ServedCells = servedCells
        setExpected := getUpdateEnbCellsSetExpected(t, nodebInfo, servedCells)
-       sdlInstanceMock.On("SetAndPublish", []string{"RAN_MANIPULATION", inventoryName + "_" + RanUpdatedEvent}, []interface{}{setExpected}).Return(errors.New("expected error"))
+       sdlMock.On("SetAndPublish", namespace, []string{"RAN_MANIPULATION", inventoryName + "_" + RanUpdatedEvent}, []interface{}{setExpected}).Return(errors.New("expected error"))
        rNibErr := w.UpdateEnb(nodebInfo, servedCells)
        assert.IsType(t, &common.InternalError{}, rNibErr)
 }
@@ -1158,14 +1158,14 @@ func TestUpdateEnbSuccess(t *testing.T) {
        inventoryName := "name"
        plmnId := "02f829"
        nbId := "4a952a0a"
-       w, sdlInstanceMock := initSdlInstanceMock(namespace)
+       w, sdlMock := initSdlMock()
        servedCells := generateServedCells("test1", "test2")
        nodebInfo := generateNodebInfo(inventoryName, entities.Node_ENB, plmnId, nbId)
        nodebInfo.GetEnb().ServedCells = servedCells
        setExpected := getUpdateEnbCellsSetExpected(t, nodebInfo, servedCells)
 
        var e error
-       sdlInstanceMock.On("SetAndPublish", []string{"RAN_MANIPULATION", inventoryName + "_" + RanUpdatedEvent}, []interface{}{setExpected}).Return(e)
+       sdlMock.On("SetAndPublish", namespace, []string{"RAN_MANIPULATION", inventoryName + "_" + RanUpdatedEvent}, []interface{}{setExpected}).Return(e)
        rNibErr := w.UpdateEnb(nodebInfo, servedCells)
        assert.Nil(t, rNibErr)
 }
@@ -1203,7 +1203,7 @@ func TestRemoveEnbSuccess(t *testing.T) {
        nbId := "4a952a0a"
        channelName := "RAN_MANIPULATION"
        eventName := inventoryName + "_" + "DELETED"
-       w, sdlInstanceMock := initSdlInstanceMock(namespace)
+       w, sdlMock := initSdlMock()
        nodebInfo := generateNodebInfo(inventoryName, entities.Node_ENB, plmnId, nbId)
        nodebInfo.GetEnb().ServedCells = generateServedCellInfos("cell1", "cell2")
 
@@ -1217,11 +1217,11 @@ func TestRemoveEnbSuccess(t *testing.T) {
        nodebNameKey := fmt.Sprintf("RAN:%s", inventoryName)
        nodebIdKey := fmt.Sprintf("ENB:%s:%s", plmnId, nbId)
        expectedKeys = append(expectedKeys, cell1Key, cell1PciKey, cell2Key, cell2PciKey, nodebNameKey, nodebIdKey)
-       sdlInstanceMock.On("RemoveAndPublish", []string{channelName, eventName}, expectedKeys).Return(e)
+       sdlMock.On("RemoveAndPublish", namespace, []string{channelName, eventName}, expectedKeys).Return(e)
 
        rNibErr := w.RemoveEnb(nodebInfo)
        assert.Nil(t, rNibErr)
-       sdlInstanceMock.AssertExpectations(t)
+       sdlMock.AssertExpectations(t)
 }
 
 func TestRemoveEnbRnibKeyValidationError(t *testing.T) {
@@ -1229,7 +1229,7 @@ func TestRemoveEnbRnibKeyValidationError(t *testing.T) {
        inventoryName := ""
        plmnId := "02f829"
        nbId := "4a952a0a"
-       w, _ := initSdlInstanceMock(namespace)
+       w, _ := initSdlMock()
        nodebInfo := generateNodebInfo(inventoryName, entities.Node_ENB, plmnId, nbId)
        nodebInfo.GetEnb().ServedCells = generateServedCellInfos("cell1", "cell2")
 
@@ -1243,7 +1243,7 @@ func TestRemoveEnbRemoveAndPublishError(t *testing.T) {
        nbId := "4a952a0a"
        channelName := "RAN_MANIPULATION"
        eventName := inventoryName + "_" + "DELETED"
-       w, sdlInstanceMock := initSdlInstanceMock(namespace)
+       w, sdlMock := initSdlMock()
        nodebInfo := generateNodebInfo(inventoryName, entities.Node_ENB, plmnId, nbId)
        nodebInfo.GetEnb().ServedCells = generateServedCellInfos("cell1", "cell2")
 
@@ -1255,30 +1255,30 @@ func TestRemoveEnbRemoveAndPublishError(t *testing.T) {
        nodebNameKey := fmt.Sprintf("RAN:%s", inventoryName)
        nodebIdKey := fmt.Sprintf("ENB:%s:%s", plmnId, nbId)
        expectedKeys = append(expectedKeys, cell1Key, cell1PciKey, cell2Key, cell2PciKey, nodebNameKey, nodebIdKey)
-       sdlInstanceMock.On("RemoveAndPublish", []string{channelName, eventName}, expectedKeys).Return(errors.New("for test"))
+       sdlMock.On("RemoveAndPublish", namespace, []string{channelName, eventName}, expectedKeys).Return(errors.New("for test"))
 
        rNibErr := w.RemoveEnb(nodebInfo)
        assert.NotNil(t, rNibErr)
-       sdlInstanceMock.AssertExpectations(t)
+       sdlMock.AssertExpectations(t)
 }
 
 func TestRemoveNbIdentitySuccess(t *testing.T) {
-       w, sdlInstanceMock := initSdlInstanceMock(namespace)
+       w, sdlMock := initSdlMock()
        nbIdentity := &entities.NbIdentity{InventoryName: "ran1", ConnectionStatus: entities.ConnectionStatus_DISCONNECTED, GlobalNbId: &entities.GlobalNbId{PlmnId: "plmnId1", NbId: "nbId1"}}
        nbIdData, err := proto.Marshal(nbIdentity)
        if err != nil {
                t.Errorf("#TestRemoveNbIdentitySuccess - failed to Marshal NbIdentity")
        }
 
-       sdlInstanceMock.On("RemoveMember", entities.Node_ENB.String(), []interface{}{nbIdData}).Return(nil)
+       sdlMock.On("RemoveMember", namespace, entities.Node_ENB.String(), []interface{}{nbIdData}).Return(nil)
 
        rNibErr := w.RemoveNbIdentity(entities.Node_ENB, nbIdentity)
        assert.Nil(t, rNibErr)
-       sdlInstanceMock.AssertExpectations(t)
+       sdlMock.AssertExpectations(t)
 }
 
 func TestRemoveNbIdentityMarshalNilFailure(t *testing.T) {
-       w, _ := initSdlInstanceMock(namespace)
+       w, _ := initSdlMock()
 
        rNibErr := w.RemoveNbIdentity(entities.Node_ENB, nil)
        expectedErr := common.NewInternalError(errors.New("proto: Marshal called with nil"))
@@ -1286,23 +1286,23 @@ func TestRemoveNbIdentityMarshalNilFailure(t *testing.T) {
 }
 
 func TestRemoveNbIdentityError(t *testing.T) {
-       w, sdlInstanceMock := initSdlInstanceMock(namespace)
+       w, sdlMock := initSdlMock()
        nbIdentity := &entities.NbIdentity{InventoryName: "ran1", ConnectionStatus: entities.ConnectionStatus_DISCONNECTED, GlobalNbId: &entities.GlobalNbId{PlmnId: "plmnId1", NbId: "nbId1"}}
        nbIdData, err := proto.Marshal(nbIdentity)
        if err != nil {
                t.Errorf("#TestRemoveNbIdentitySuccess - failed to Marshal NbIdentity")
        }
 
-       sdlInstanceMock.On("RemoveMember", entities.Node_ENB.String(), []interface{}{nbIdData}).Return(fmt.Errorf("for test"))
+       sdlMock.On("RemoveMember", namespace, entities.Node_ENB.String(), []interface{}{nbIdData}).Return(fmt.Errorf("for test"))
 
        rNibErr := w.RemoveNbIdentity(entities.Node_ENB, nbIdentity)
        assert.NotNil(t, rNibErr)
-       sdlInstanceMock.AssertExpectations(t)
+       sdlMock.AssertExpectations(t)
 }
 
 func TestAddEnb(t *testing.T) {
        ranName := "RAN:" + RanName
-       w, sdlInstanceMock := initSdlInstanceMock(namespace)
+       w, sdlMock := initSdlMock()
        nb := entities.NodebInfo{
                RanName:          RanName,
                NodeType:         entities.Node_ENB,
@@ -1336,14 +1336,14 @@ func TestAddEnb(t *testing.T) {
        setExpected = append(setExpected, fmt.Sprintf("CELL:%s", cell.GetCellId()), cellData)
        setExpected = append(setExpected, fmt.Sprintf("PCI:%s:%02x", RanName, cell.GetPci()), cellData)
 
-       sdlInstanceMock.On("SetAndPublish", []string{"RAN_MANIPULATION", RanName + "_" + RanAddedEvent}, []interface{}{setExpected}).Return(e)
+       sdlMock.On("SetAndPublish", namespace, []string{"RAN_MANIPULATION", RanName + "_" + RanAddedEvent}, []interface{}{setExpected}).Return(e)
 
        rNibErr := w.AddEnb(&nb)
        assert.Nil(t, rNibErr)
 }
 
 func TestAddEnbMarshalNilFailure(t *testing.T) {
-       w, _ := initSdlInstanceMock(namespace)
+       w, _ := initSdlMock()
 
        rNibErr := w.AddEnb(nil)
        expectedErr := common.NewInternalError(errors.New("proto: Marshal called with nil"))
@@ -1351,7 +1351,7 @@ func TestAddEnbMarshalNilFailure(t *testing.T) {
 }
 
 func TestAddEnbCellIdValidationFailure(t *testing.T) {
-       w, _ := initSdlInstanceMock(namespace)
+       w, _ := initSdlMock()
        nb := entities.NodebInfo{}
        nb.RanName = "name"
        nb.NodeType = entities.Node_ENB
@@ -1369,7 +1369,7 @@ func TestAddEnbCellIdValidationFailure(t *testing.T) {
 }
 
 func TestAddEnbInventoryNameValidationFailure(t *testing.T) {
-       w, _ := initSdlInstanceMock(namespace)
+       w, _ := initSdlMock()
        nb := entities.NodebInfo{
                NodeType:         entities.Node_ENB,
                ConnectionStatus: entities.ConnectionStatus_CONNECTED,
@@ -1391,7 +1391,7 @@ func TestAddEnbInventoryNameValidationFailure(t *testing.T) {
 }
 
 func TestAddEnbGlobalNbIdPlmnValidationFailure(t *testing.T) {
-       w, _ := initSdlInstanceMock(namespace)
+       w, _ := initSdlMock()
        nb := entities.NodebInfo{
                RanName:          "name",
                NodeType:         entities.Node_ENB,
@@ -1415,40 +1415,40 @@ func TestAddEnbGlobalNbIdPlmnValidationFailure(t *testing.T) {
 }
 
 func TestUpdateNbIdentityOneMemberSuccess(t *testing.T) {
-       w, sdlInstanceMock := initSdlInstanceMock(namespace)
+       w, sdlMock := initSdlMock()
 
        proto, nbIdentity := createNbIdentityProto(t, "ran1", "plmnId1", "nbId1", entities.ConnectionStatus_DISCONNECTED)
        val := []interface{}{proto}
 
-       sdlInstanceMock.On("RemoveMember", entities.Node_ENB.String(), val).Return(nil)
+       sdlMock.On("RemoveMember", namespace, entities.Node_ENB.String(), val).Return(nil)
 
        protoAdd, nbIdentityAdd := createNbIdentityProto(t, "ran1_add", "plmnId1_add", "nbId1_add", entities.ConnectionStatus_CONNECTED)
-       sdlInstanceMock.On("AddMember", entities.Node_ENB.String(), []interface{}{protoAdd}).Return(nil)
+       sdlMock.On("AddMember", namespace, entities.Node_ENB.String(), []interface{}{protoAdd}).Return(nil)
 
        newNbIdIdentities := []*entities.NbIdentity{nbIdentityAdd}
        oldNbIdIdentities := []*entities.NbIdentity{nbIdentity}
 
        rNibErr := w.UpdateNbIdentities(entities.Node_ENB, oldNbIdIdentities, newNbIdIdentities)
        assert.Nil(t, rNibErr)
-       sdlInstanceMock.AssertExpectations(t)
+       sdlMock.AssertExpectations(t)
 }
 
 func TestUpdateNbIdentitySuccess(t *testing.T) {
-       w, sdlInstanceMock := initSdlInstanceMock(namespace)
+       w, sdlMock := initSdlMock()
 
        var nbIdIdentitiesProtoToRemove []interface{}
        protoRan1, _ := createNbIdentityProto(t, "ran1", "plmnId1", "nbId1", entities.ConnectionStatus_DISCONNECTED)
        protoRan2, _ := createNbIdentityProto(t, "ran2", "plmnId2", "nbId2", entities.ConnectionStatus_DISCONNECTED)
        nbIdIdentitiesProtoToRemove = append(nbIdIdentitiesProtoToRemove, protoRan1)
        nbIdIdentitiesProtoToRemove = append(nbIdIdentitiesProtoToRemove, protoRan2)
-       sdlInstanceMock.On("RemoveMember", entities.Node_ENB.String(), nbIdIdentitiesProtoToRemove).Return(nil)
+       sdlMock.On("RemoveMember", namespace, entities.Node_ENB.String(), nbIdIdentitiesProtoToRemove).Return(nil)
 
        var nbIdIdentitiesProtoToAdd []interface{}
        protoRan1Add, _ := createNbIdentityProto(t, "ran1_add", "plmnId1_add", "nbId1_add", entities.ConnectionStatus_CONNECTED)
        protoRan2Add, _ := createNbIdentityProto(t, "ran2_add", "plmnId2_add", "nbId2_add", entities.ConnectionStatus_CONNECTED)
        nbIdIdentitiesProtoToAdd = append(nbIdIdentitiesProtoToAdd, protoRan1Add)
        nbIdIdentitiesProtoToAdd = append(nbIdIdentitiesProtoToAdd, protoRan2Add)
-       sdlInstanceMock.On("AddMember", entities.Node_ENB.String(), nbIdIdentitiesProtoToAdd).Return(nil)
+       sdlMock.On("AddMember", namespace, entities.Node_ENB.String(), nbIdIdentitiesProtoToAdd).Return(nil)
 
        var newNbIdIdentities []*entities.NbIdentity
        firstNewNbIdIdentity := &entities.NbIdentity{InventoryName: "ran1_add", ConnectionStatus: entities.ConnectionStatus_CONNECTED, GlobalNbId: &entities.GlobalNbId{PlmnId: "plmnId1_add", NbId: "nbId1_add"}}
@@ -1464,11 +1464,11 @@ func TestUpdateNbIdentitySuccess(t *testing.T) {
 
        rNibErr := w.UpdateNbIdentities(entities.Node_ENB, oldNbIdIdentities, newNbIdIdentities)
        assert.Nil(t, rNibErr)
-       sdlInstanceMock.AssertExpectations(t)
+       sdlMock.AssertExpectations(t)
 }
 
 func TestUpdateNbIdentityOldIdentityMarshalNilFailure(t *testing.T) {
-       w, _ := initSdlInstanceMock(namespace)
+       w, _ := initSdlMock()
 
        oldNbIdIdentities := []*entities.NbIdentity{nil}
        newNbIdIdentities := []*entities.NbIdentity{
@@ -1485,12 +1485,12 @@ func TestUpdateNbIdentityOldIdentityMarshalNilFailure(t *testing.T) {
 }
 
 func TestUpdateNbIdentityNewIdentityMarshalNilFailure(t *testing.T) {
-       w, sdlInstanceMock := initSdlInstanceMock(namespace)
+       w, sdlMock := initSdlMock()
 
        var nbIdIdentitiesProtoToRemove []interface{}
        protoRan1, _ := createNbIdentityProto(t, "ran1", "plmnId1", "nbId1", entities.ConnectionStatus_DISCONNECTED)
        nbIdIdentitiesProtoToRemove = append(nbIdIdentitiesProtoToRemove, protoRan1)
-       sdlInstanceMock.On("RemoveMember", entities.Node_ENB.String(), nbIdIdentitiesProtoToRemove).Return(nil)
+       sdlMock.On("RemoveMember", namespace, entities.Node_ENB.String(), nbIdIdentitiesProtoToRemove).Return(nil)
 
        oldNbIdIdentities := []*entities.NbIdentity{
                &entities.NbIdentity{
@@ -1507,7 +1507,7 @@ func TestUpdateNbIdentityNewIdentityMarshalNilFailure(t *testing.T) {
 }
 
 func TestUpdateNbIdentityRemoveFailure(t *testing.T) {
-       w, sdlInstanceMock := initSdlInstanceMock(namespace)
+       w, sdlMock := initSdlMock()
 
        var nbIdIdentitiesProtoToRemove []interface{}
        protoRan1, _ := createNbIdentityProto(t, "ran1", "plmnId1", "nbId1", entities.ConnectionStatus_DISCONNECTED)
@@ -1515,7 +1515,7 @@ func TestUpdateNbIdentityRemoveFailure(t *testing.T) {
        protoRan2, _ := createNbIdentityProto(t, "ran2", "plmnId2", "nbId2", entities.ConnectionStatus_DISCONNECTED)
        nbIdIdentitiesProtoToRemove = append(nbIdIdentitiesProtoToRemove, protoRan2)
 
-       sdlInstanceMock.On("RemoveMember", entities.Node_ENB.String(), nbIdIdentitiesProtoToRemove).Return(fmt.Errorf("for test"))
+       sdlMock.On("RemoveMember", namespace, entities.Node_ENB.String(), nbIdIdentitiesProtoToRemove).Return(fmt.Errorf("for test"))
 
        var oldNbIdIdentities []*entities.NbIdentity
        firstOldNbIdIdentity := &entities.NbIdentity{InventoryName: "ran1", ConnectionStatus: entities.ConnectionStatus_DISCONNECTED, GlobalNbId: &entities.GlobalNbId{PlmnId: "plmnId1", NbId: "nbId1"}}
@@ -1527,21 +1527,21 @@ func TestUpdateNbIdentityRemoveFailure(t *testing.T) {
 
        rNibErr := w.UpdateNbIdentities(entities.Node_ENB, oldNbIdIdentities, newNbIdIdentities)
        assert.NotNil(t, rNibErr)
-       sdlInstanceMock.AssertExpectations(t)
+       sdlMock.AssertExpectations(t)
 }
 
 func TestUpdateNbIdentitySdlAddMemberFailure(t *testing.T) {
-       w, sdlInstanceMock := initSdlInstanceMock(namespace)
+       w, sdlMock := initSdlMock()
 
        var nbIdIdentitiesProtoToRemove []interface{}
        protoRan1, _ := createNbIdentityProto(t, "ran1", "plmnId1", "nbId1", entities.ConnectionStatus_DISCONNECTED)
        nbIdIdentitiesProtoToRemove = append(nbIdIdentitiesProtoToRemove, protoRan1)
-       sdlInstanceMock.On("RemoveMember", entities.Node_ENB.String(), nbIdIdentitiesProtoToRemove).Return(nil)
+       sdlMock.On("RemoveMember", namespace, entities.Node_ENB.String(), nbIdIdentitiesProtoToRemove).Return(nil)
 
        var nbIdIdentitiesProtoToAdd []interface{}
        protoRan1Add, _ := createNbIdentityProto(t, "ran1_add", "plmnId1_add", "nbId1_add", entities.ConnectionStatus_CONNECTED)
        nbIdIdentitiesProtoToAdd = append(nbIdIdentitiesProtoToAdd, protoRan1Add)
-       sdlInstanceMock.On("AddMember", entities.Node_ENB.String(), nbIdIdentitiesProtoToAdd).Return(fmt.Errorf("for test"))
+       sdlMock.On("AddMember", namespace, entities.Node_ENB.String(), nbIdIdentitiesProtoToAdd).Return(fmt.Errorf("for test"))
 
        var oldNbIdIdentities []*entities.NbIdentity
        firstOldNbIdIdentity := &entities.NbIdentity{InventoryName: "ran1", ConnectionStatus: entities.ConnectionStatus_DISCONNECTED, GlobalNbId: &entities.GlobalNbId{PlmnId: "plmnId1", NbId: "nbId1"}}
@@ -1553,49 +1553,49 @@ func TestUpdateNbIdentitySdlAddMemberFailure(t *testing.T) {
 
        rNibErr := w.UpdateNbIdentities(entities.Node_ENB, oldNbIdIdentities, newNbIdIdentities)
        assert.NotNil(t, rNibErr)
-       sdlInstanceMock.AssertExpectations(t)
+       sdlMock.AssertExpectations(t)
 }
 
 func TestUpdateNbIdentityAddFailure(t *testing.T) {
-       w, sdlInstanceMock := initSdlInstanceMock(namespace)
+       w, sdlMock := initSdlMock()
        nbIdentity := &entities.NbIdentity{InventoryName: "ran1", ConnectionStatus: entities.ConnectionStatus_DISCONNECTED, GlobalNbId: &entities.GlobalNbId{PlmnId: "plmnId1", NbId: "nbId1"}}
        nbIdData, err := proto.Marshal(nbIdentity)
        if err != nil {
                t.Errorf("#TestRemoveNbIdentitySuccess - failed to Marshal NbIdentity")
        }
-       sdlInstanceMock.On("RemoveMember", entities.Node_ENB.String(), []interface{}{nbIdData}).Return(fmt.Errorf("for test"))
+       sdlMock.On("RemoveMember", namespace, entities.Node_ENB.String(), []interface{}{nbIdData}).Return(fmt.Errorf("for test"))
 
        rNibErr := w.RemoveNbIdentity(entities.Node_ENB, nbIdentity)
        assert.NotNil(t, rNibErr)
-       sdlInstanceMock.AssertExpectations(t)
+       sdlMock.AssertExpectations(t)
 }
 
 func TestUpdateNbIdentityNoNbIdentityToRemove(t *testing.T) {
-       w, sdlInstanceMock := initSdlInstanceMock(namespace)
+       w, sdlMock := initSdlMock()
        nbIdentity := &entities.NbIdentity{InventoryName: "ran1", ConnectionStatus: entities.ConnectionStatus_DISCONNECTED, GlobalNbId: &entities.GlobalNbId{PlmnId: "plmnId1", NbId: "nbId1"}}
        nbIdData, err := proto.Marshal(nbIdentity)
        if err != nil {
                t.Errorf("#TestRemoveNbIdentitySuccess - failed to Marshal NbIdentity")
        }
-       sdlInstanceMock.On("RemoveMember", entities.Node_ENB.String(), []interface{}{nbIdData}).Return(fmt.Errorf("for test"))
+       sdlMock.On("RemoveMember", namespace, entities.Node_ENB.String(), []interface{}{nbIdData}).Return(fmt.Errorf("for test"))
 
        rNibErr := w.RemoveNbIdentity(entities.Node_ENB, nbIdentity)
        assert.NotNil(t, rNibErr)
-       sdlInstanceMock.AssertExpectations(t)
+       sdlMock.AssertExpectations(t)
 }
 
 func TestUpdateNbIdentityNoNbIdentityToAdd(t *testing.T) {
-       w, sdlInstanceMock := initSdlInstanceMock(namespace)
+       w, sdlMock := initSdlMock()
        nbIdentity := &entities.NbIdentity{InventoryName: "ran1", ConnectionStatus: entities.ConnectionStatus_DISCONNECTED, GlobalNbId: &entities.GlobalNbId{PlmnId: "plmnId1", NbId: "nbId1"}}
        nbIdData, err := proto.Marshal(nbIdentity)
        if err != nil {
                t.Errorf("#TestRemoveNbIdentitySuccess - failed to Marshal NbIdentity")
        }
-       sdlInstanceMock.On("RemoveMember", entities.Node_ENB.String(), []interface{}{nbIdData}).Return(fmt.Errorf("for test"))
+       sdlMock.On("RemoveMember", namespace, entities.Node_ENB.String(), []interface{}{nbIdData}).Return(fmt.Errorf("for test"))
 
        rNibErr := w.RemoveNbIdentity(entities.Node_ENB, nbIdentity)
        assert.NotNil(t, rNibErr)
-       sdlInstanceMock.AssertExpectations(t)
+       sdlMock.AssertExpectations(t)
 }
 
 func createNbIdentityProto(t *testing.T, ranName string, plmnId string, nbId string, connectionStatus entities.ConnectionStatus) ([]byte, *entities.NbIdentity) {