ss412g | 07ef76d | 2019-08-12 17:26:40 +0300 | [diff] [blame] | 1 | // |
| 2 | // Copyright 2019 AT&T Intellectual Property |
| 3 | // Copyright 2019 Nokia |
| 4 | // |
| 5 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | // you may not use this file except in compliance with the License. |
| 7 | // You may obtain a copy of the License at |
| 8 | // |
| 9 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | // |
| 11 | // Unless required by applicable law or agreed to in writing, software |
| 12 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | // See the License for the specific language governing permissions and |
| 15 | // limitations under the License. |
nm755n | 15d3982 | 2019-11-28 16:56:00 +0000 | [diff] [blame] | 16 | |
| 17 | // This source code is part of the near-RT RIC (RAN Intelligent Controller) |
| 18 | // platform project (RICP). |
| 19 | |
ss412g | 07ef76d | 2019-08-12 17:26:40 +0300 | [diff] [blame] | 20 | package rNibWriter |
| 21 | |
| 22 | import ( |
Idan Shalom | 14eb513 | 2020-07-06 09:41:46 +0000 | [diff] [blame^] | 23 | "e2mgr/configuration" |
ss412g | 07ef76d | 2019-08-12 17:26:40 +0300 | [diff] [blame] | 24 | "e2mgr/mocks" |
ss412g | efcb452 | 2019-12-02 16:59:19 +0200 | [diff] [blame] | 25 | "encoding/json" |
ss412g | 07ef76d | 2019-08-12 17:26:40 +0300 | [diff] [blame] | 26 | "errors" |
| 27 | "fmt" |
is005q | 19bf35e | 2019-08-12 18:59:29 +0300 | [diff] [blame] | 28 | "gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/common" |
| 29 | "gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities" |
ss412g | 07ef76d | 2019-08-12 17:26:40 +0300 | [diff] [blame] | 30 | "github.com/golang/protobuf/proto" |
ss412g | 07ef76d | 2019-08-12 17:26:40 +0300 | [diff] [blame] | 31 | "github.com/stretchr/testify/assert" |
| 32 | "testing" |
| 33 | "time" |
| 34 | ) |
| 35 | |
idanshal | 08bbf91 | 2020-04-20 17:11:33 +0300 | [diff] [blame] | 36 | var namespace = "namespace" |
Idan Shalom | 14eb513 | 2020-07-06 09:41:46 +0000 | [diff] [blame^] | 37 | |
idanshal | d916e2a | 2020-04-22 15:56:43 +0300 | [diff] [blame] | 38 | const ( |
| 39 | RanName = "test" |
| 40 | ) |
idanshal | 08bbf91 | 2020-04-20 17:11:33 +0300 | [diff] [blame] | 41 | |
ss412g | efcb452 | 2019-12-02 16:59:19 +0200 | [diff] [blame] | 42 | func initSdlInstanceMock(namespace string) (w RNibWriter, sdlInstanceMock *mocks.MockSdlInstance) { |
| 43 | sdlInstanceMock = new(mocks.MockSdlInstance) |
Idan Shalom | 14eb513 | 2020-07-06 09:41:46 +0000 | [diff] [blame^] | 44 | w = GetRNibWriter(sdlInstanceMock, configuration.RnibWriterConfig{StateChangeMessageChannel: "RAN_CONNECTION_STATUS_CHANGE", RanManipulationMessageChannel: "RAN_MANIPULATION"}) |
ss412g | efcb452 | 2019-12-02 16:59:19 +0200 | [diff] [blame] | 45 | return |
ss412g | 07ef76d | 2019-08-12 17:26:40 +0300 | [diff] [blame] | 46 | } |
| 47 | |
idanshal | 08bbf91 | 2020-04-20 17:11:33 +0300 | [diff] [blame] | 48 | func generateNodebInfo(inventoryName string, nodeType entities.Node_Type, plmnId string, nbId string) *entities.NodebInfo { |
| 49 | nodebInfo := &entities.NodebInfo{ |
| 50 | RanName: inventoryName, |
| 51 | GlobalNbId: &entities.GlobalNbId{PlmnId: plmnId, NbId: nbId}, |
| 52 | NodeType: nodeType, |
| 53 | ConnectionStatus: entities.ConnectionStatus_CONNECTED, |
| 54 | } |
| 55 | |
| 56 | if nodeType == entities.Node_ENB { |
| 57 | nodebInfo.Configuration = &entities.NodebInfo_Enb{ |
| 58 | Enb: &entities.Enb{}, |
| 59 | } |
| 60 | } else if nodeType == entities.Node_GNB { |
| 61 | nodebInfo.Configuration = &entities.NodebInfo_Gnb{ |
| 62 | Gnb: &entities.Gnb{}, |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | return nodebInfo |
| 67 | } |
| 68 | |
| 69 | func generateServedNrCells(cellIds ...string) []*entities.ServedNRCell { |
| 70 | |
| 71 | servedNrCells := []*entities.ServedNRCell{} |
| 72 | |
idanshal | d916e2a | 2020-04-22 15:56:43 +0300 | [diff] [blame] | 73 | for i, v := range cellIds { |
idanshal | 08bbf91 | 2020-04-20 17:11:33 +0300 | [diff] [blame] | 74 | servedNrCells = append(servedNrCells, &entities.ServedNRCell{ServedNrCellInformation: &entities.ServedNRCellInformation{ |
| 75 | CellId: v, |
| 76 | ChoiceNrMode: &entities.ServedNRCellInformation_ChoiceNRMode{ |
| 77 | Fdd: &entities.ServedNRCellInformation_ChoiceNRMode_FddInfo{ |
| 78 | |
| 79 | }, |
| 80 | }, |
| 81 | NrMode: entities.Nr_FDD, |
idanshal | d916e2a | 2020-04-22 15:56:43 +0300 | [diff] [blame] | 82 | NrPci: uint32(i + 1), |
idanshal | 08bbf91 | 2020-04-20 17:11:33 +0300 | [diff] [blame] | 83 | ServedPlmns: []string{"whatever"}, |
| 84 | }}) |
| 85 | } |
| 86 | |
| 87 | return servedNrCells |
| 88 | } |
| 89 | |
idanshal | d916e2a | 2020-04-22 15:56:43 +0300 | [diff] [blame] | 90 | func TestRemoveServedNrCellsSuccess(t *testing.T) { |
| 91 | w, sdlInstanceMock := initSdlInstanceMock(namespace) |
| 92 | servedNrCellsToRemove := generateServedNrCells("whatever1", "whatever2") |
| 93 | sdlInstanceMock.On("Remove", buildCellKeysToRemove(RanName, servedNrCellsToRemove)).Return(nil) |
| 94 | err := w.RemoveServedNrCells(RanName, servedNrCellsToRemove) |
| 95 | assert.Nil(t, err) |
| 96 | } |
| 97 | |
| 98 | func TestRemoveServedNrCellsFailure(t *testing.T) { |
| 99 | w, sdlInstanceMock := initSdlInstanceMock(namespace) |
| 100 | servedNrCellsToRemove := generateServedNrCells("whatever1", "whatever2") |
| 101 | sdlInstanceMock.On("Remove", buildCellKeysToRemove(RanName, servedNrCellsToRemove)).Return(errors.New("expected error")) |
| 102 | err := w.RemoveServedNrCells(RanName, servedNrCellsToRemove) |
| 103 | assert.IsType(t, &common.InternalError{}, err) |
| 104 | } |
| 105 | |
idanshal | 08bbf91 | 2020-04-20 17:11:33 +0300 | [diff] [blame] | 106 | func TestUpdateGnbCellsInvalidNodebInfoFailure(t *testing.T) { |
| 107 | w, sdlInstanceMock := initSdlInstanceMock(namespace) |
| 108 | servedNrCells := generateServedNrCells("test1", "test2") |
| 109 | nodebInfo := &entities.NodebInfo{} |
| 110 | sdlInstanceMock.AssertNotCalled(t, "Set") |
| 111 | rNibErr := w.UpdateGnbCells(nodebInfo, servedNrCells) |
| 112 | assert.IsType(t, &common.ValidationError{}, rNibErr) |
| 113 | } |
| 114 | |
| 115 | func TestUpdateGnbCellsInvalidCellFailure(t *testing.T) { |
| 116 | inventoryName := "name" |
| 117 | plmnId := "02f829" |
| 118 | nbId := "4a952a0a" |
| 119 | w, sdlInstanceMock := initSdlInstanceMock(namespace) |
| 120 | servedNrCells := []*entities.ServedNRCell{{ServedNrCellInformation: &entities.ServedNRCellInformation{}}} |
| 121 | nodebInfo := generateNodebInfo(inventoryName, entities.Node_GNB, plmnId, nbId) |
| 122 | nodebInfo.GetGnb().ServedNrCells = servedNrCells |
| 123 | sdlInstanceMock.AssertNotCalled(t, "Set") |
| 124 | rNibErr := w.UpdateGnbCells(nodebInfo, servedNrCells) |
| 125 | assert.IsType(t, &common.ValidationError{}, rNibErr) |
| 126 | } |
| 127 | |
| 128 | func getUpdateGnbCellsSetExpected(t *testing.T, nodebInfo *entities.NodebInfo, servedNrCells []*entities.ServedNRCell) []interface{} { |
| 129 | |
| 130 | nodebInfoData, err := proto.Marshal(nodebInfo) |
| 131 | if err != nil { |
| 132 | t.Fatalf("#rNibWriter_test.getUpdateGnbCellsSetExpected - Failed to marshal NodeB entity. Error: %s", err) |
| 133 | } |
| 134 | |
| 135 | nodebNameKey, _ := common.ValidateAndBuildNodeBNameKey(nodebInfo.RanName) |
| 136 | nodebIdKey, _ := common.ValidateAndBuildNodeBIdKey(nodebInfo.NodeType.String(), nodebInfo.GlobalNbId.PlmnId, nodebInfo.GlobalNbId.NbId) |
| 137 | setExpected := []interface{}{nodebNameKey, nodebInfoData, nodebIdKey, nodebInfoData} |
| 138 | |
| 139 | for _, v := range servedNrCells { |
| 140 | |
| 141 | cellEntity := entities.Cell{Type: entities.Cell_NR_CELL, Cell: &entities.Cell_ServedNrCell{ServedNrCell: v}} |
| 142 | cellData, err := proto.Marshal(&cellEntity) |
| 143 | |
| 144 | if err != nil { |
| 145 | t.Fatalf("#rNibWriter_test.getUpdateGnbCellsSetExpected - Failed to marshal cell entity. Error: %s", err) |
| 146 | } |
| 147 | |
| 148 | nrCellIdKey, _ := common.ValidateAndBuildNrCellIdKey(v.GetServedNrCellInformation().GetCellId()) |
| 149 | cellNamePciKey, _ := common.ValidateAndBuildCellNamePciKey(nodebInfo.RanName, v.GetServedNrCellInformation().GetNrPci()) |
| 150 | setExpected = append(setExpected, nrCellIdKey, cellData, cellNamePciKey, cellData) |
| 151 | } |
| 152 | |
| 153 | return setExpected |
| 154 | } |
| 155 | |
| 156 | func TestUpdateGnbCellsSdlFailure(t *testing.T) { |
| 157 | inventoryName := "name" |
| 158 | plmnId := "02f829" |
| 159 | nbId := "4a952a0a" |
| 160 | w, sdlInstanceMock := initSdlInstanceMock(namespace) |
| 161 | servedNrCells := generateServedNrCells("test1", "test2") |
| 162 | nodebInfo := generateNodebInfo(inventoryName, entities.Node_GNB, plmnId, nbId) |
| 163 | nodebInfo.GetGnb().ServedNrCells = servedNrCells |
| 164 | setExpected := getUpdateGnbCellsSetExpected(t, nodebInfo, servedNrCells) |
| 165 | sdlInstanceMock.On("Set", []interface{}{setExpected}).Return(errors.New("expected error")) |
| 166 | rNibErr := w.UpdateGnbCells(nodebInfo, servedNrCells) |
| 167 | assert.IsType(t, &common.InternalError{}, rNibErr) |
| 168 | } |
| 169 | |
| 170 | func TestUpdateGnbCellsSuccess(t *testing.T) { |
| 171 | inventoryName := "name" |
| 172 | plmnId := "02f829" |
| 173 | nbId := "4a952a0a" |
| 174 | w, sdlInstanceMock := initSdlInstanceMock(namespace) |
| 175 | servedNrCells := generateServedNrCells("test1", "test2") |
| 176 | nodebInfo := generateNodebInfo(inventoryName, entities.Node_GNB, plmnId, nbId) |
| 177 | nodebInfo.GetGnb().ServedNrCells = servedNrCells |
| 178 | setExpected := getUpdateGnbCellsSetExpected(t, nodebInfo, servedNrCells) |
| 179 | var e error |
| 180 | sdlInstanceMock.On("Set", []interface{}{setExpected}).Return(e) |
| 181 | rNibErr := w.UpdateGnbCells(nodebInfo, servedNrCells) |
| 182 | assert.Nil(t, rNibErr) |
| 183 | } |
ss412g | 07ef76d | 2019-08-12 17:26:40 +0300 | [diff] [blame] | 184 | |
is005q | 19e72a5 | 2019-08-26 17:56:18 +0300 | [diff] [blame] | 185 | func TestUpdateNodebInfoSuccess(t *testing.T) { |
| 186 | inventoryName := "name" |
| 187 | plmnId := "02f829" |
| 188 | nbId := "4a952a0a" |
ss412g | efcb452 | 2019-12-02 16:59:19 +0200 | [diff] [blame] | 189 | w, sdlInstanceMock := initSdlInstanceMock(namespace) |
idanshal | 08bbf91 | 2020-04-20 17:11:33 +0300 | [diff] [blame] | 190 | nodebInfo := generateNodebInfo(inventoryName, entities.Node_ENB, plmnId, nbId) |
is005q | 19e72a5 | 2019-08-26 17:56:18 +0300 | [diff] [blame] | 191 | data, err := proto.Marshal(nodebInfo) |
| 192 | if err != nil { |
| 193 | t.Errorf("#rNibWriter_test.TestSaveEnb - Failed to marshal NodeB entity. Error: %v", err) |
| 194 | } |
| 195 | var e error |
| 196 | var setExpected []interface{} |
| 197 | |
| 198 | nodebNameKey := fmt.Sprintf("RAN:%s", inventoryName) |
| 199 | nodebIdKey := fmt.Sprintf("ENB:%s:%s", plmnId, nbId) |
| 200 | setExpected = append(setExpected, nodebNameKey, data) |
| 201 | setExpected = append(setExpected, nodebIdKey, data) |
| 202 | |
| 203 | sdlInstanceMock.On("Set", []interface{}{setExpected}).Return(e) |
| 204 | |
| 205 | rNibErr := w.UpdateNodebInfo(nodebInfo) |
| 206 | assert.Nil(t, rNibErr) |
| 207 | } |
| 208 | |
| 209 | func TestUpdateNodebInfoMissingInventoryNameFailure(t *testing.T) { |
| 210 | inventoryName := "name" |
| 211 | plmnId := "02f829" |
| 212 | nbId := "4a952a0a" |
ss412g | efcb452 | 2019-12-02 16:59:19 +0200 | [diff] [blame] | 213 | w, sdlInstanceMock := initSdlInstanceMock(namespace) |
is005q | 19e72a5 | 2019-08-26 17:56:18 +0300 | [diff] [blame] | 214 | nodebInfo := &entities.NodebInfo{} |
| 215 | data, err := proto.Marshal(nodebInfo) |
| 216 | if err != nil { |
| 217 | t.Errorf("#rNibWriter_test.TestSaveEnb - Failed to marshal NodeB entity. Error: %v", err) |
| 218 | } |
| 219 | var e error |
| 220 | var setExpected []interface{} |
| 221 | |
| 222 | nodebNameKey := fmt.Sprintf("RAN:%s", inventoryName) |
| 223 | nodebIdKey := fmt.Sprintf("ENB:%s:%s", plmnId, nbId) |
| 224 | setExpected = append(setExpected, nodebNameKey, data) |
| 225 | setExpected = append(setExpected, nodebIdKey, data) |
| 226 | |
| 227 | sdlInstanceMock.On("Set", []interface{}{setExpected}).Return(e) |
| 228 | |
| 229 | rNibErr := w.UpdateNodebInfo(nodebInfo) |
| 230 | |
| 231 | assert.NotNil(t, rNibErr) |
irina | 006fbce | 2019-09-05 16:11:02 +0300 | [diff] [blame] | 232 | assert.IsType(t, &common.ValidationError{}, rNibErr) |
is005q | 19e72a5 | 2019-08-26 17:56:18 +0300 | [diff] [blame] | 233 | } |
| 234 | |
is005q | 2647319 | 2019-08-28 17:51:37 +0300 | [diff] [blame] | 235 | func TestUpdateNodebInfoMissingGlobalNbId(t *testing.T) { |
is005q | 19e72a5 | 2019-08-26 17:56:18 +0300 | [diff] [blame] | 236 | inventoryName := "name" |
ss412g | efcb452 | 2019-12-02 16:59:19 +0200 | [diff] [blame] | 237 | w, sdlInstanceMock := initSdlInstanceMock(namespace) |
is005q | 19e72a5 | 2019-08-26 17:56:18 +0300 | [diff] [blame] | 238 | nodebInfo := &entities.NodebInfo{} |
| 239 | nodebInfo.RanName = inventoryName |
| 240 | data, err := proto.Marshal(nodebInfo) |
| 241 | if err != nil { |
| 242 | t.Errorf("#rNibWriter_test.TestSaveEnb - Failed to marshal NodeB entity. Error: %v", err) |
| 243 | } |
| 244 | var e error |
| 245 | var setExpected []interface{} |
| 246 | |
| 247 | nodebNameKey := fmt.Sprintf("RAN:%s", inventoryName) |
is005q | 19e72a5 | 2019-08-26 17:56:18 +0300 | [diff] [blame] | 248 | setExpected = append(setExpected, nodebNameKey, data) |
is005q | 19e72a5 | 2019-08-26 17:56:18 +0300 | [diff] [blame] | 249 | sdlInstanceMock.On("Set", []interface{}{setExpected}).Return(e) |
| 250 | |
| 251 | rNibErr := w.UpdateNodebInfo(nodebInfo) |
| 252 | |
is005q | 2647319 | 2019-08-28 17:51:37 +0300 | [diff] [blame] | 253 | assert.Nil(t, rNibErr) |
is005q | 19e72a5 | 2019-08-26 17:56:18 +0300 | [diff] [blame] | 254 | } |
| 255 | |
ss412g | 07ef76d | 2019-08-12 17:26:40 +0300 | [diff] [blame] | 256 | func TestSaveEnb(t *testing.T) { |
| 257 | name := "name" |
| 258 | ranName := "RAN:" + name |
ss412g | efcb452 | 2019-12-02 16:59:19 +0200 | [diff] [blame] | 259 | w, sdlInstanceMock := initSdlInstanceMock(namespace) |
ss412g | 07ef76d | 2019-08-12 17:26:40 +0300 | [diff] [blame] | 260 | nb := entities.NodebInfo{} |
Idan Shalom | 14eb513 | 2020-07-06 09:41:46 +0000 | [diff] [blame^] | 261 | nb.RanName = name |
ss412g | 07ef76d | 2019-08-12 17:26:40 +0300 | [diff] [blame] | 262 | nb.NodeType = entities.Node_ENB |
| 263 | nb.ConnectionStatus = 1 |
| 264 | nb.Ip = "localhost" |
| 265 | nb.Port = 5656 |
| 266 | enb := entities.Enb{} |
is005q | 19e72a5 | 2019-08-26 17:56:18 +0300 | [diff] [blame] | 267 | cell := &entities.ServedCellInfo{CellId: "aaff", Pci: 3} |
| 268 | cellEntity := entities.Cell{Type: entities.Cell_LTE_CELL, Cell: &entities.Cell_ServedCellInfo{ServedCellInfo: cell}} |
ss412g | 07ef76d | 2019-08-12 17:26:40 +0300 | [diff] [blame] | 269 | enb.ServedCells = []*entities.ServedCellInfo{cell} |
is005q | 19e72a5 | 2019-08-26 17:56:18 +0300 | [diff] [blame] | 270 | nb.Configuration = &entities.NodebInfo_Enb{Enb: &enb} |
ss412g | 07ef76d | 2019-08-12 17:26:40 +0300 | [diff] [blame] | 271 | data, err := proto.Marshal(&nb) |
| 272 | if err != nil { |
| 273 | t.Errorf("#rNibWriter_test.TestSaveEnb - Failed to marshal NodeB entity. Error: %v", err) |
| 274 | } |
| 275 | var e error |
| 276 | |
| 277 | cellData, err := proto.Marshal(&cellEntity) |
| 278 | if err != nil { |
| 279 | t.Errorf("#rNibWriter_test.TestSaveEnb - Failed to marshal Cell entity. Error: %v", err) |
| 280 | } |
| 281 | var setExpected []interface{} |
| 282 | setExpected = append(setExpected, ranName, data) |
| 283 | setExpected = append(setExpected, "ENB:02f829:4a952a0a", data) |
| 284 | setExpected = append(setExpected, fmt.Sprintf("CELL:%s", cell.GetCellId()), cellData) |
| 285 | setExpected = append(setExpected, fmt.Sprintf("PCI:%s:%02x", name, cell.GetPci()), cellData) |
| 286 | |
Idan Shalom | 14eb513 | 2020-07-06 09:41:46 +0000 | [diff] [blame^] | 287 | sdlInstanceMock.On("SetAndPublish", []string{"RAN_MANIPULATION", name + "_" + RanAddedEvent}, []interface{}{setExpected}).Return(e) |
ns019t | 57c3fae | 2019-08-12 20:08:49 +0300 | [diff] [blame] | 288 | |
| 289 | nbIdData, err := proto.Marshal(&entities.NbIdentity{InventoryName: name}) |
| 290 | if err != nil { |
| 291 | t.Errorf("#rNibWriter_test.TestSaveEnb - Failed to marshal nbIdentity entity. Error: %v", err) |
| 292 | } |
| 293 | sdlInstanceMock.On("RemoveMember", entities.Node_UNKNOWN.String(), []interface{}{nbIdData}).Return(e) |
| 294 | |
is005q | 19e72a5 | 2019-08-26 17:56:18 +0300 | [diff] [blame] | 295 | nbIdentity := &entities.NbIdentity{InventoryName: name, GlobalNbId: &entities.GlobalNbId{PlmnId: "02f829", NbId: "4a952a0a"}} |
ns019t | 57c3fae | 2019-08-12 20:08:49 +0300 | [diff] [blame] | 296 | nbIdData, err = proto.Marshal(nbIdentity) |
ss412g | 07ef76d | 2019-08-12 17:26:40 +0300 | [diff] [blame] | 297 | if err != nil { |
| 298 | t.Errorf("#rNibWriter_test.TestSaveEnb - Failed to marshal NodeB Identity entity. Error: %v", err) |
| 299 | } |
| 300 | sdlInstanceMock.On("AddMember", "ENB", []interface{}{nbIdData}).Return(e) |
ns019t | 57c3fae | 2019-08-12 20:08:49 +0300 | [diff] [blame] | 301 | |
ss412g | 07ef76d | 2019-08-12 17:26:40 +0300 | [diff] [blame] | 302 | rNibErr := w.SaveNodeb(nbIdentity, &nb) |
| 303 | assert.Nil(t, rNibErr) |
| 304 | } |
| 305 | |
| 306 | func TestSaveEnbCellIdValidationFailure(t *testing.T) { |
| 307 | name := "name" |
ss412g | efcb452 | 2019-12-02 16:59:19 +0200 | [diff] [blame] | 308 | w, _ := initSdlInstanceMock(namespace) |
ss412g | 07ef76d | 2019-08-12 17:26:40 +0300 | [diff] [blame] | 309 | nb := entities.NodebInfo{} |
| 310 | nb.NodeType = entities.Node_ENB |
| 311 | nb.ConnectionStatus = 1 |
| 312 | nb.Ip = "localhost" |
| 313 | nb.Port = 5656 |
| 314 | enb := entities.Enb{} |
is005q | 19e72a5 | 2019-08-26 17:56:18 +0300 | [diff] [blame] | 315 | cell := &entities.ServedCellInfo{Pci: 3} |
ss412g | 07ef76d | 2019-08-12 17:26:40 +0300 | [diff] [blame] | 316 | enb.ServedCells = []*entities.ServedCellInfo{cell} |
is005q | 19e72a5 | 2019-08-26 17:56:18 +0300 | [diff] [blame] | 317 | nb.Configuration = &entities.NodebInfo_Enb{Enb: &enb} |
ss412g | 07ef76d | 2019-08-12 17:26:40 +0300 | [diff] [blame] | 318 | |
is005q | 19e72a5 | 2019-08-26 17:56:18 +0300 | [diff] [blame] | 319 | nbIdentity := &entities.NbIdentity{InventoryName: name, GlobalNbId: &entities.GlobalNbId{PlmnId: "02f829", NbId: "4a952a0a"}} |
ss412g | 07ef76d | 2019-08-12 17:26:40 +0300 | [diff] [blame] | 320 | rNibErr := w.SaveNodeb(nbIdentity, &nb) |
| 321 | assert.NotNil(t, rNibErr) |
irina | 006fbce | 2019-09-05 16:11:02 +0300 | [diff] [blame] | 322 | assert.IsType(t, &common.ValidationError{}, rNibErr) |
| 323 | assert.Equal(t, "#utils.ValidateAndBuildCellIdKey - an empty cell id received", rNibErr.Error()) |
ss412g | 07ef76d | 2019-08-12 17:26:40 +0300 | [diff] [blame] | 324 | } |
| 325 | |
| 326 | func TestSaveEnbInventoryNameValidationFailure(t *testing.T) { |
ss412g | efcb452 | 2019-12-02 16:59:19 +0200 | [diff] [blame] | 327 | w, _ := initSdlInstanceMock(namespace) |
ss412g | 07ef76d | 2019-08-12 17:26:40 +0300 | [diff] [blame] | 328 | nb := entities.NodebInfo{} |
| 329 | nb.NodeType = entities.Node_ENB |
| 330 | nb.ConnectionStatus = 1 |
| 331 | nb.Ip = "localhost" |
| 332 | nb.Port = 5656 |
| 333 | enb := entities.Enb{} |
is005q | 19e72a5 | 2019-08-26 17:56:18 +0300 | [diff] [blame] | 334 | cell := &entities.ServedCellInfo{CellId: "aaa", Pci: 3} |
ss412g | 07ef76d | 2019-08-12 17:26:40 +0300 | [diff] [blame] | 335 | enb.ServedCells = []*entities.ServedCellInfo{cell} |
is005q | 19e72a5 | 2019-08-26 17:56:18 +0300 | [diff] [blame] | 336 | nb.Configuration = &entities.NodebInfo_Enb{Enb: &enb} |
ss412g | 07ef76d | 2019-08-12 17:26:40 +0300 | [diff] [blame] | 337 | |
is005q | 19e72a5 | 2019-08-26 17:56:18 +0300 | [diff] [blame] | 338 | nbIdentity := &entities.NbIdentity{InventoryName: "", GlobalNbId: &entities.GlobalNbId{PlmnId: "02f829", NbId: "4a952a0a"}} |
ss412g | 07ef76d | 2019-08-12 17:26:40 +0300 | [diff] [blame] | 339 | rNibErr := w.SaveNodeb(nbIdentity, &nb) |
| 340 | assert.NotNil(t, rNibErr) |
irina | 006fbce | 2019-09-05 16:11:02 +0300 | [diff] [blame] | 341 | assert.IsType(t, &common.ValidationError{}, rNibErr) |
| 342 | assert.Equal(t, "#utils.ValidateAndBuildNodeBNameKey - an empty inventory name received", rNibErr.Error()) |
ss412g | 07ef76d | 2019-08-12 17:26:40 +0300 | [diff] [blame] | 343 | } |
| 344 | |
ss412g | 07ef76d | 2019-08-12 17:26:40 +0300 | [diff] [blame] | 345 | func TestSaveGnbCellIdValidationFailure(t *testing.T) { |
| 346 | name := "name" |
ss412g | efcb452 | 2019-12-02 16:59:19 +0200 | [diff] [blame] | 347 | w, _ := initSdlInstanceMock(namespace) |
ss412g | 07ef76d | 2019-08-12 17:26:40 +0300 | [diff] [blame] | 348 | nb := entities.NodebInfo{} |
| 349 | nb.NodeType = entities.Node_GNB |
| 350 | nb.ConnectionStatus = 1 |
| 351 | nb.Ip = "localhost" |
| 352 | nb.Port = 5656 |
| 353 | gnb := entities.Gnb{} |
is005q | 19e72a5 | 2019-08-26 17:56:18 +0300 | [diff] [blame] | 354 | cellInfo := &entities.ServedNRCellInformation{NrPci: 2} |
| 355 | cell := &entities.ServedNRCell{ServedNrCellInformation: cellInfo} |
ss412g | 07ef76d | 2019-08-12 17:26:40 +0300 | [diff] [blame] | 356 | gnb.ServedNrCells = []*entities.ServedNRCell{cell} |
is005q | 19e72a5 | 2019-08-26 17:56:18 +0300 | [diff] [blame] | 357 | nb.Configuration = &entities.NodebInfo_Gnb{Gnb: &gnb} |
ss412g | 07ef76d | 2019-08-12 17:26:40 +0300 | [diff] [blame] | 358 | |
is005q | 19e72a5 | 2019-08-26 17:56:18 +0300 | [diff] [blame] | 359 | nbIdentity := &entities.NbIdentity{InventoryName: name, GlobalNbId: &entities.GlobalNbId{PlmnId: "02f829", NbId: "4a952a0a"}} |
ss412g | 07ef76d | 2019-08-12 17:26:40 +0300 | [diff] [blame] | 360 | rNibErr := w.SaveNodeb(nbIdentity, &nb) |
| 361 | assert.NotNil(t, rNibErr) |
irina | 006fbce | 2019-09-05 16:11:02 +0300 | [diff] [blame] | 362 | assert.IsType(t, &common.ValidationError{}, rNibErr) |
| 363 | assert.Equal(t, "#utils.ValidateAndBuildNrCellIdKey - an empty cell id received", rNibErr.Error()) |
ss412g | 07ef76d | 2019-08-12 17:26:40 +0300 | [diff] [blame] | 364 | } |
| 365 | |
| 366 | func TestSaveGnb(t *testing.T) { |
| 367 | name := "name" |
| 368 | ranName := "RAN:" + name |
ss412g | efcb452 | 2019-12-02 16:59:19 +0200 | [diff] [blame] | 369 | w, sdlInstanceMock := initSdlInstanceMock(namespace) |
ss412g | 07ef76d | 2019-08-12 17:26:40 +0300 | [diff] [blame] | 370 | nb := entities.NodebInfo{} |
| 371 | nb.NodeType = entities.Node_GNB |
| 372 | nb.ConnectionStatus = 1 |
| 373 | nb.Ip = "localhost" |
| 374 | nb.Port = 5656 |
| 375 | gnb := entities.Gnb{} |
is005q | 19e72a5 | 2019-08-26 17:56:18 +0300 | [diff] [blame] | 376 | cellInfo := &entities.ServedNRCellInformation{NrPci: 2, CellId: "ccdd"} |
| 377 | cell := &entities.ServedNRCell{ServedNrCellInformation: cellInfo} |
| 378 | cellEntity := entities.Cell{Type: entities.Cell_NR_CELL, Cell: &entities.Cell_ServedNrCell{ServedNrCell: cell}} |
ss412g | 07ef76d | 2019-08-12 17:26:40 +0300 | [diff] [blame] | 379 | gnb.ServedNrCells = []*entities.ServedNRCell{cell} |
is005q | 19e72a5 | 2019-08-26 17:56:18 +0300 | [diff] [blame] | 380 | nb.Configuration = &entities.NodebInfo_Gnb{Gnb: &gnb} |
ss412g | 07ef76d | 2019-08-12 17:26:40 +0300 | [diff] [blame] | 381 | data, err := proto.Marshal(&nb) |
| 382 | if err != nil { |
| 383 | t.Errorf("#rNibWriter_test.TestSaveGnb - Failed to marshal NodeB entity. Error: %v", err) |
| 384 | } |
| 385 | var e error |
| 386 | |
ss412g | 07ef76d | 2019-08-12 17:26:40 +0300 | [diff] [blame] | 387 | cellData, err := proto.Marshal(&cellEntity) |
| 388 | if err != nil { |
| 389 | t.Errorf("#rNibWriter_test.TestSaveGnb - Failed to marshal Cell entity. Error: %v", err) |
| 390 | } |
| 391 | var setExpected []interface{} |
| 392 | setExpected = append(setExpected, ranName, data) |
| 393 | setExpected = append(setExpected, "GNB:02f829:4a952a0a", data) |
| 394 | setExpected = append(setExpected, fmt.Sprintf("NRCELL:%s", cell.GetServedNrCellInformation().GetCellId()), cellData) |
| 395 | setExpected = append(setExpected, fmt.Sprintf("PCI:%s:%02x", name, cell.GetServedNrCellInformation().GetNrPci()), cellData) |
| 396 | |
| 397 | sdlInstanceMock.On("Set", []interface{}{setExpected}).Return(e) |
is005q | 19e72a5 | 2019-08-26 17:56:18 +0300 | [diff] [blame] | 398 | nbIdentity := &entities.NbIdentity{InventoryName: name, GlobalNbId: &entities.GlobalNbId{PlmnId: "02f829", NbId: "4a952a0a"}} |
ss412g | 07ef76d | 2019-08-12 17:26:40 +0300 | [diff] [blame] | 399 | nbIdData, err := proto.Marshal(nbIdentity) |
| 400 | if err != nil { |
| 401 | t.Errorf("#rNibWriter_test.TestSaveGnb - Failed to marshal NodeB Identity entity. Error: %v", err) |
| 402 | } |
| 403 | sdlInstanceMock.On("AddMember", "GNB", []interface{}{nbIdData}).Return(e) |
| 404 | |
ns019t | 57c3fae | 2019-08-12 20:08:49 +0300 | [diff] [blame] | 405 | nbIdData, err = proto.Marshal(&entities.NbIdentity{InventoryName: name}) |
| 406 | if err != nil { |
| 407 | t.Errorf("#rNibWriter_test.TestSaveEnb - Failed to marshal nbIdentity entity. Error: %v", err) |
| 408 | } |
| 409 | sdlInstanceMock.On("RemoveMember", entities.Node_UNKNOWN.String(), []interface{}{nbIdData}).Return(e) |
| 410 | |
ss412g | 07ef76d | 2019-08-12 17:26:40 +0300 | [diff] [blame] | 411 | rNibErr := w.SaveNodeb(nbIdentity, &nb) |
| 412 | assert.Nil(t, rNibErr) |
| 413 | } |
| 414 | |
| 415 | func TestSaveRanLoadInformationSuccess(t *testing.T) { |
| 416 | inventoryName := "name" |
| 417 | loadKey, validationErr := common.ValidateAndBuildRanLoadInformationKey(inventoryName) |
| 418 | |
| 419 | if validationErr != nil { |
| 420 | t.Errorf("#rNibWriter_test.TestSaveRanLoadInformationSuccess - Failed to build ran load infromation key. Error: %v", validationErr) |
| 421 | } |
| 422 | |
ss412g | efcb452 | 2019-12-02 16:59:19 +0200 | [diff] [blame] | 423 | w, sdlInstanceMock := initSdlInstanceMock(namespace) |
ss412g | 07ef76d | 2019-08-12 17:26:40 +0300 | [diff] [blame] | 424 | |
ss412g | 07ef76d | 2019-08-12 17:26:40 +0300 | [diff] [blame] | 425 | ranLoadInformation := generateRanLoadInformation() |
| 426 | data, err := proto.Marshal(ranLoadInformation) |
| 427 | |
| 428 | if err != nil { |
| 429 | t.Errorf("#rNibWriter_test.TestSaveRanLoadInformation - Failed to marshal RanLoadInformation entity. Error: %v", err) |
| 430 | } |
| 431 | |
| 432 | var e error |
| 433 | var setExpected []interface{} |
| 434 | setExpected = append(setExpected, loadKey, data) |
| 435 | sdlInstanceMock.On("Set", []interface{}{setExpected}).Return(e) |
| 436 | |
ss412g | 07ef76d | 2019-08-12 17:26:40 +0300 | [diff] [blame] | 437 | rNibErr := w.SaveRanLoadInformation(inventoryName, ranLoadInformation) |
| 438 | assert.Nil(t, rNibErr) |
| 439 | } |
| 440 | |
| 441 | func TestSaveRanLoadInformationMarshalNilFailure(t *testing.T) { |
| 442 | inventoryName := "name2" |
ss412g | efcb452 | 2019-12-02 16:59:19 +0200 | [diff] [blame] | 443 | w, _ := initSdlInstanceMock(namespace) |
ss412g | 07ef76d | 2019-08-12 17:26:40 +0300 | [diff] [blame] | 444 | |
| 445 | expectedErr := common.NewInternalError(errors.New("proto: Marshal called with nil")) |
is005q | 19e72a5 | 2019-08-26 17:56:18 +0300 | [diff] [blame] | 446 | err := w.SaveRanLoadInformation(inventoryName, nil) |
ss412g | 07ef76d | 2019-08-12 17:26:40 +0300 | [diff] [blame] | 447 | assert.Equal(t, expectedErr, err) |
| 448 | } |
| 449 | |
| 450 | func TestSaveRanLoadInformationEmptyInventoryNameFailure(t *testing.T) { |
| 451 | inventoryName := "" |
ss412g | efcb452 | 2019-12-02 16:59:19 +0200 | [diff] [blame] | 452 | w, _ := initSdlInstanceMock(namespace) |
ss412g | 07ef76d | 2019-08-12 17:26:40 +0300 | [diff] [blame] | 453 | |
is005q | 19e72a5 | 2019-08-26 17:56:18 +0300 | [diff] [blame] | 454 | err := w.SaveRanLoadInformation(inventoryName, nil) |
ss412g | 07ef76d | 2019-08-12 17:26:40 +0300 | [diff] [blame] | 455 | assert.NotNil(t, err) |
irina | 006fbce | 2019-09-05 16:11:02 +0300 | [diff] [blame] | 456 | assert.IsType(t, &common.ValidationError{}, err) |
ss412g | 07ef76d | 2019-08-12 17:26:40 +0300 | [diff] [blame] | 457 | } |
| 458 | |
| 459 | func TestSaveRanLoadInformationSdlFailure(t *testing.T) { |
| 460 | inventoryName := "name2" |
| 461 | |
| 462 | loadKey, validationErr := common.ValidateAndBuildRanLoadInformationKey(inventoryName) |
| 463 | |
| 464 | if validationErr != nil { |
| 465 | t.Errorf("#rNibWriter_test.TestSaveRanLoadInformationSuccess - Failed to build ran load infromation key. Error: %v", validationErr) |
| 466 | } |
| 467 | |
ss412g | efcb452 | 2019-12-02 16:59:19 +0200 | [diff] [blame] | 468 | w, sdlInstanceMock := initSdlInstanceMock(namespace) |
ss412g | 07ef76d | 2019-08-12 17:26:40 +0300 | [diff] [blame] | 469 | |
| 470 | ranLoadInformation := generateRanLoadInformation() |
| 471 | data, err := proto.Marshal(ranLoadInformation) |
| 472 | |
| 473 | if err != nil { |
| 474 | t.Errorf("#rNibWriter_test.TestSaveRanLoadInformation - Failed to marshal RanLoadInformation entity. Error: %v", err) |
| 475 | } |
| 476 | |
ss412g | 07ef76d | 2019-08-12 17:26:40 +0300 | [diff] [blame] | 477 | expectedErr := errors.New("expected error") |
| 478 | var setExpected []interface{} |
| 479 | setExpected = append(setExpected, loadKey, data) |
| 480 | sdlInstanceMock.On("Set", []interface{}{setExpected}).Return(expectedErr) |
| 481 | |
ss412g | 07ef76d | 2019-08-12 17:26:40 +0300 | [diff] [blame] | 482 | rNibErr := w.SaveRanLoadInformation(inventoryName, ranLoadInformation) |
| 483 | assert.NotNil(t, rNibErr) |
irina | 006fbce | 2019-09-05 16:11:02 +0300 | [diff] [blame] | 484 | assert.IsType(t, &common.InternalError{}, rNibErr) |
ss412g | 07ef76d | 2019-08-12 17:26:40 +0300 | [diff] [blame] | 485 | } |
| 486 | |
| 487 | func generateCellLoadInformation() *entities.CellLoadInformation { |
| 488 | cellLoadInformation := entities.CellLoadInformation{} |
| 489 | |
| 490 | cellLoadInformation.CellId = "123" |
| 491 | |
| 492 | ulInterferenceOverloadIndication := entities.UlInterferenceOverloadIndication_HIGH_INTERFERENCE |
| 493 | cellLoadInformation.UlInterferenceOverloadIndications = []entities.UlInterferenceOverloadIndication{ulInterferenceOverloadIndication} |
| 494 | |
| 495 | ulHighInterferenceInformation := entities.UlHighInterferenceInformation{ |
is005q | 19e72a5 | 2019-08-26 17:56:18 +0300 | [diff] [blame] | 496 | TargetCellId: "456", |
| 497 | UlHighInterferenceIndication: "xxx", |
ss412g | 07ef76d | 2019-08-12 17:26:40 +0300 | [diff] [blame] | 498 | } |
| 499 | |
is005q | 19e72a5 | 2019-08-26 17:56:18 +0300 | [diff] [blame] | 500 | cellLoadInformation.UlHighInterferenceInfos = []*entities.UlHighInterferenceInformation{&ulHighInterferenceInformation} |
ss412g | 07ef76d | 2019-08-12 17:26:40 +0300 | [diff] [blame] | 501 | |
| 502 | cellLoadInformation.RelativeNarrowbandTxPower = &entities.RelativeNarrowbandTxPower{ |
is005q | 19e72a5 | 2019-08-26 17:56:18 +0300 | [diff] [blame] | 503 | RntpPerPrb: "xxx", |
| 504 | RntpThreshold: entities.RntpThreshold_NEG_4, |
ss412g | 07ef76d | 2019-08-12 17:26:40 +0300 | [diff] [blame] | 505 | NumberOfCellSpecificAntennaPorts: entities.NumberOfCellSpecificAntennaPorts_V1_ANT_PRT, |
is005q | 19e72a5 | 2019-08-26 17:56:18 +0300 | [diff] [blame] | 506 | PB: 1, |
| 507 | PdcchInterferenceImpact: 2, |
ss412g | 07ef76d | 2019-08-12 17:26:40 +0300 | [diff] [blame] | 508 | EnhancedRntp: &entities.EnhancedRntp{ |
is005q | 19e72a5 | 2019-08-26 17:56:18 +0300 | [diff] [blame] | 509 | EnhancedRntpBitmap: "xxx", |
| 510 | RntpHighPowerThreshold: entities.RntpThreshold_NEG_2, |
| 511 | EnhancedRntpStartTime: &entities.StartTime{StartSfn: 500, StartSubframeNumber: 5}, |
ss412g | 07ef76d | 2019-08-12 17:26:40 +0300 | [diff] [blame] | 512 | }, |
| 513 | } |
| 514 | |
| 515 | cellLoadInformation.AbsInformation = &entities.AbsInformation{ |
is005q | 19e72a5 | 2019-08-26 17:56:18 +0300 | [diff] [blame] | 516 | Mode: entities.AbsInformationMode_ABS_INFO_FDD, |
| 517 | AbsPatternInfo: "xxx", |
| 518 | NumberOfCellSpecificAntennaPorts: entities.NumberOfCellSpecificAntennaPorts_V2_ANT_PRT, |
| 519 | MeasurementSubset: "xxx", |
ss412g | 07ef76d | 2019-08-12 17:26:40 +0300 | [diff] [blame] | 520 | } |
| 521 | |
| 522 | cellLoadInformation.InvokeIndication = entities.InvokeIndication_ABS_INFORMATION |
| 523 | |
| 524 | cellLoadInformation.ExtendedUlInterferenceOverloadInfo = &entities.ExtendedUlInterferenceOverloadInfo{ |
is005q | 19e72a5 | 2019-08-26 17:56:18 +0300 | [diff] [blame] | 525 | AssociatedSubframes: "xxx", |
| 526 | ExtendedUlInterferenceOverloadIndications: cellLoadInformation.UlInterferenceOverloadIndications, |
ss412g | 07ef76d | 2019-08-12 17:26:40 +0300 | [diff] [blame] | 527 | } |
| 528 | |
| 529 | compInformationItem := &entities.CompInformationItem{ |
idanshal | 08bbf91 | 2020-04-20 17:11:33 +0300 | [diff] [blame] | 530 | CompHypothesisSets: []*entities.CompHypothesisSet{{CellId: "789", CompHypothesis: "xxx"}}, |
is005q | 19e72a5 | 2019-08-26 17:56:18 +0300 | [diff] [blame] | 531 | BenefitMetric: 50, |
ss412g | 07ef76d | 2019-08-12 17:26:40 +0300 | [diff] [blame] | 532 | } |
| 533 | |
| 534 | cellLoadInformation.CompInformation = &entities.CompInformation{ |
is005q | 19e72a5 | 2019-08-26 17:56:18 +0300 | [diff] [blame] | 535 | CompInformationItems: []*entities.CompInformationItem{compInformationItem}, |
| 536 | CompInformationStartTime: &entities.StartTime{StartSfn: 123, StartSubframeNumber: 456}, |
ss412g | 07ef76d | 2019-08-12 17:26:40 +0300 | [diff] [blame] | 537 | } |
| 538 | |
| 539 | cellLoadInformation.DynamicDlTransmissionInformation = &entities.DynamicDlTransmissionInformation{ |
is005q | 19e72a5 | 2019-08-26 17:56:18 +0300 | [diff] [blame] | 540 | State: entities.NaicsState_NAICS_ACTIVE, |
| 541 | TransmissionModes: "xxx", |
| 542 | PB: 2, |
| 543 | PAList: []entities.PA{entities.PA_DB_NEG_3}, |
ss412g | 07ef76d | 2019-08-12 17:26:40 +0300 | [diff] [blame] | 544 | } |
| 545 | |
| 546 | return &cellLoadInformation |
| 547 | } |
| 548 | |
| 549 | func generateRanLoadInformation() *entities.RanLoadInformation { |
| 550 | ranLoadInformation := entities.RanLoadInformation{} |
| 551 | |
is005q | 19bf35e | 2019-08-12 18:59:29 +0300 | [diff] [blame] | 552 | ranLoadInformation.LoadTimestamp = uint64(time.Now().UnixNano()) |
ss412g | 07ef76d | 2019-08-12 17:26:40 +0300 | [diff] [blame] | 553 | |
| 554 | cellLoadInformation := generateCellLoadInformation() |
| 555 | ranLoadInformation.CellLoadInfos = []*entities.CellLoadInformation{cellLoadInformation} |
| 556 | |
| 557 | return &ranLoadInformation |
| 558 | } |
| 559 | |
| 560 | func TestSaveNilEntityFailure(t *testing.T) { |
ss412g | efcb452 | 2019-12-02 16:59:19 +0200 | [diff] [blame] | 561 | w, _ := initSdlInstanceMock(namespace) |
ss412g | 07ef76d | 2019-08-12 17:26:40 +0300 | [diff] [blame] | 562 | expectedErr := common.NewInternalError(errors.New("proto: Marshal called with nil")) |
| 563 | nbIdentity := &entities.NbIdentity{} |
| 564 | actualErr := w.SaveNodeb(nbIdentity, nil) |
| 565 | assert.Equal(t, expectedErr, actualErr) |
| 566 | } |
| 567 | |
| 568 | func TestSaveUnknownTypeEntityFailure(t *testing.T) { |
ss412g | efcb452 | 2019-12-02 16:59:19 +0200 | [diff] [blame] | 569 | w, _ := initSdlInstanceMock(namespace) |
is005q | 19e72a5 | 2019-08-26 17:56:18 +0300 | [diff] [blame] | 570 | nbIdentity := &entities.NbIdentity{InventoryName: "name", GlobalNbId: &entities.GlobalNbId{PlmnId: "02f829", NbId: "4a952a0a"}} |
ss412g | 07ef76d | 2019-08-12 17:26:40 +0300 | [diff] [blame] | 571 | nb := &entities.NodebInfo{} |
| 572 | nb.Port = 5656 |
| 573 | nb.Ip = "localhost" |
| 574 | actualErr := w.SaveNodeb(nbIdentity, nb) |
ss412g | a07b859 | 2020-06-16 21:51:33 +0300 | [diff] [blame] | 575 | assert.IsType(t, &common.ValidationError{}, actualErr) |
ss412g | 07ef76d | 2019-08-12 17:26:40 +0300 | [diff] [blame] | 576 | } |
| 577 | |
| 578 | func TestSaveEntityFailure(t *testing.T) { |
| 579 | name := "name" |
| 580 | plmnId := "02f829" |
| 581 | nbId := "4a952a0a" |
| 582 | |
ss412g | efcb452 | 2019-12-02 16:59:19 +0200 | [diff] [blame] | 583 | w, sdlInstanceMock := initSdlInstanceMock(namespace) |
ss412g | 07ef76d | 2019-08-12 17:26:40 +0300 | [diff] [blame] | 584 | gnb := entities.NodebInfo{} |
| 585 | gnb.NodeType = entities.Node_GNB |
| 586 | data, err := proto.Marshal(&gnb) |
| 587 | if err != nil { |
| 588 | t.Errorf("#rNibWriter_test.TestSaveEntityFailure - Failed to marshal NodeB entity. Error: %v", err) |
| 589 | } |
is005q | 19e72a5 | 2019-08-26 17:56:18 +0300 | [diff] [blame] | 590 | nbIdentity := &entities.NbIdentity{InventoryName: name, GlobalNbId: &entities.GlobalNbId{PlmnId: plmnId, NbId: nbId}} |
ss412g | 07ef76d | 2019-08-12 17:26:40 +0300 | [diff] [blame] | 591 | setExpected := []interface{}{"RAN:" + name, data} |
is005q | 19e72a5 | 2019-08-26 17:56:18 +0300 | [diff] [blame] | 592 | setExpected = append(setExpected, "GNB:"+plmnId+":"+nbId, data) |
ss412g | 07ef76d | 2019-08-12 17:26:40 +0300 | [diff] [blame] | 593 | expectedErr := errors.New("expected error") |
| 594 | sdlInstanceMock.On("Set", []interface{}{setExpected}).Return(expectedErr) |
| 595 | rNibErr := w.SaveNodeb(nbIdentity, &gnb) |
| 596 | assert.NotEmpty(t, rNibErr) |
| 597 | } |
| 598 | |
ss412g | 07ef76d | 2019-08-12 17:26:40 +0300 | [diff] [blame] | 599 | func TestGetRNibWriter(t *testing.T) { |
ss412g | efcb452 | 2019-12-02 16:59:19 +0200 | [diff] [blame] | 600 | received, _ := initSdlInstanceMock(namespace) |
| 601 | assert.NotEmpty(t, received) |
ss412g | 07ef76d | 2019-08-12 17:26:40 +0300 | [diff] [blame] | 602 | } |
| 603 | |
ss412g | efcb452 | 2019-12-02 16:59:19 +0200 | [diff] [blame] | 604 | func TestSaveE2TInstanceSuccess(t *testing.T) { |
| 605 | address := "10.10.2.15:9800" |
| 606 | loadKey, validationErr := common.ValidateAndBuildE2TInstanceKey(address) |
| 607 | |
| 608 | if validationErr != nil { |
| 609 | t.Errorf("#rNibWriter_test.TestSaveE2TInstanceSuccess - Failed to build E2T Instance key. Error: %v", validationErr) |
| 610 | } |
| 611 | |
| 612 | w, sdlInstanceMock := initSdlInstanceMock(namespace) |
| 613 | |
| 614 | e2tInstance := generateE2tInstance(address) |
| 615 | data, err := json.Marshal(e2tInstance) |
| 616 | |
| 617 | if err != nil { |
| 618 | t.Errorf("#rNibWriter_test.TestSaveE2TInstanceSuccess - Failed to marshal E2tInstance entity. Error: %v", err) |
| 619 | } |
| 620 | |
ss412g | 07ef76d | 2019-08-12 17:26:40 +0300 | [diff] [blame] | 621 | var e error |
ss412g | efcb452 | 2019-12-02 16:59:19 +0200 | [diff] [blame] | 622 | var setExpected []interface{} |
| 623 | setExpected = append(setExpected, loadKey, data) |
| 624 | sdlInstanceMock.On("Set", []interface{}{setExpected}).Return(e) |
| 625 | |
| 626 | rNibErr := w.SaveE2TInstance(e2tInstance) |
| 627 | assert.Nil(t, rNibErr) |
ss412g | 07ef76d | 2019-08-12 17:26:40 +0300 | [diff] [blame] | 628 | } |
| 629 | |
ss412g | efcb452 | 2019-12-02 16:59:19 +0200 | [diff] [blame] | 630 | func TestSaveE2TInstanceNullE2tInstanceFailure(t *testing.T) { |
| 631 | w, _ := initSdlInstanceMock(namespace) |
| 632 | var address string |
Irina | 4914446 | 2020-04-07 16:37:20 +0300 | [diff] [blame] | 633 | e2tInstance := entities.NewE2TInstance(address, "test") |
ss412g | efcb452 | 2019-12-02 16:59:19 +0200 | [diff] [blame] | 634 | err := w.SaveE2TInstance(e2tInstance) |
| 635 | assert.NotNil(t, err) |
| 636 | assert.IsType(t, &common.ValidationError{}, err) |
| 637 | } |
| 638 | |
| 639 | func TestSaveE2TInstanceSdlFailure(t *testing.T) { |
| 640 | address := "10.10.2.15:9800" |
| 641 | loadKey, validationErr := common.ValidateAndBuildE2TInstanceKey(address) |
| 642 | |
| 643 | if validationErr != nil { |
| 644 | t.Errorf("#rNibWriter_test.TestSaveE2TInstanceSdlFailure - Failed to build E2T Instance key. Error: %v", validationErr) |
| 645 | } |
| 646 | |
| 647 | w, sdlInstanceMock := initSdlInstanceMock(namespace) |
| 648 | |
| 649 | e2tInstance := generateE2tInstance(address) |
| 650 | data, err := json.Marshal(e2tInstance) |
| 651 | |
| 652 | if err != nil { |
| 653 | t.Errorf("#rNibWriter_test.TestSaveE2TInstanceSdlFailure - Failed to marshal E2tInstance entity. Error: %v", err) |
| 654 | } |
| 655 | |
| 656 | expectedErr := errors.New("expected error") |
| 657 | var setExpected []interface{} |
| 658 | setExpected = append(setExpected, loadKey, data) |
| 659 | sdlInstanceMock.On("Set", []interface{}{setExpected}).Return(expectedErr) |
| 660 | |
| 661 | rNibErr := w.SaveE2TInstance(e2tInstance) |
| 662 | assert.NotNil(t, rNibErr) |
| 663 | assert.IsType(t, &common.InternalError{}, rNibErr) |
| 664 | } |
| 665 | |
| 666 | func generateE2tInstance(address string) *entities.E2TInstance { |
Irina | 4914446 | 2020-04-07 16:37:20 +0300 | [diff] [blame] | 667 | e2tInstance := entities.NewE2TInstance(address, "pod test") |
ss412g | efcb452 | 2019-12-02 16:59:19 +0200 | [diff] [blame] | 668 | |
| 669 | e2tInstance.AssociatedRanList = []string{"test1", "test2"} |
| 670 | |
| 671 | return e2tInstance |
| 672 | } |
| 673 | |
| 674 | func TestSaveE2TAddressesSuccess(t *testing.T) { |
| 675 | address := "10.10.2.15:9800" |
| 676 | w, sdlInstanceMock := initSdlInstanceMock(namespace) |
| 677 | |
| 678 | e2tAddresses := []string{address} |
| 679 | data, err := json.Marshal(e2tAddresses) |
| 680 | |
| 681 | if err != nil { |
| 682 | t.Errorf("#rNibWriter_test.TestSaveE2TInfoListSuccess - Failed to marshal E2TInfoList. Error: %v", err) |
| 683 | } |
| 684 | |
ss412g | 07ef76d | 2019-08-12 17:26:40 +0300 | [diff] [blame] | 685 | var e error |
ss412g | efcb452 | 2019-12-02 16:59:19 +0200 | [diff] [blame] | 686 | var setExpected []interface{} |
| 687 | setExpected = append(setExpected, E2TAddressesKey, data) |
| 688 | sdlInstanceMock.On("Set", []interface{}{setExpected}).Return(e) |
| 689 | |
| 690 | rNibErr := w.SaveE2TAddresses(e2tAddresses) |
| 691 | assert.Nil(t, rNibErr) |
ss412g | 07ef76d | 2019-08-12 17:26:40 +0300 | [diff] [blame] | 692 | } |
| 693 | |
ss412g | efcb452 | 2019-12-02 16:59:19 +0200 | [diff] [blame] | 694 | func TestSaveE2TAddressesSdlFailure(t *testing.T) { |
| 695 | address := "10.10.2.15:9800" |
| 696 | w, sdlInstanceMock := initSdlInstanceMock(namespace) |
ss412g | 07ef76d | 2019-08-12 17:26:40 +0300 | [diff] [blame] | 697 | |
ss412g | efcb452 | 2019-12-02 16:59:19 +0200 | [diff] [blame] | 698 | e2tAddresses := []string{address} |
| 699 | data, err := json.Marshal(e2tAddresses) |
| 700 | |
| 701 | if err != nil { |
| 702 | t.Errorf("#rNibWriter_test.TestSaveE2TInfoListSdlFailure - Failed to marshal E2TInfoList. Error: %v", err) |
| 703 | } |
| 704 | |
| 705 | expectedErr := errors.New("expected error") |
| 706 | var setExpected []interface{} |
| 707 | setExpected = append(setExpected, E2TAddressesKey, data) |
| 708 | sdlInstanceMock.On("Set", []interface{}{setExpected}).Return(expectedErr) |
| 709 | |
| 710 | rNibErr := w.SaveE2TAddresses(e2tAddresses) |
| 711 | assert.NotNil(t, rNibErr) |
| 712 | assert.IsType(t, &common.InternalError{}, rNibErr) |
ss412g | 07ef76d | 2019-08-12 17:26:40 +0300 | [diff] [blame] | 713 | } |
| 714 | |
Amichai | f846c59 | 2020-01-08 16:45:07 +0200 | [diff] [blame] | 715 | func TestRemoveE2TInstanceSuccess(t *testing.T) { |
| 716 | address := "10.10.2.15:9800" |
| 717 | w, sdlInstanceMock := initSdlInstanceMock(namespace) |
| 718 | |
| 719 | e2tAddresses := []string{fmt.Sprintf("E2TInstance:%s", address)} |
| 720 | var e error |
| 721 | sdlInstanceMock.On("Remove", e2tAddresses).Return(e) |
| 722 | |
| 723 | rNibErr := w.RemoveE2TInstance(address) |
| 724 | assert.Nil(t, rNibErr) |
| 725 | sdlInstanceMock.AssertExpectations(t) |
| 726 | } |
| 727 | |
| 728 | func TestRemoveE2TInstanceSdlFailure(t *testing.T) { |
| 729 | address := "10.10.2.15:9800" |
| 730 | w, sdlInstanceMock := initSdlInstanceMock(namespace) |
| 731 | |
| 732 | e2tAddresses := []string{fmt.Sprintf("E2TInstance:%s", address)} |
| 733 | expectedErr := errors.New("expected error") |
| 734 | sdlInstanceMock.On("Remove", e2tAddresses).Return(expectedErr) |
| 735 | |
| 736 | rNibErr := w.RemoveE2TInstance(address) |
| 737 | assert.IsType(t, &common.InternalError{}, rNibErr) |
| 738 | } |
| 739 | |
| 740 | func TestRemoveE2TInstanceEmptyAddressFailure(t *testing.T) { |
| 741 | w, sdlInstanceMock := initSdlInstanceMock(namespace) |
| 742 | |
| 743 | rNibErr := w.RemoveE2TInstance("") |
| 744 | assert.IsType(t, &common.ValidationError{}, rNibErr) |
| 745 | sdlInstanceMock.AssertExpectations(t) |
| 746 | } |
| 747 | |
ss412g | a07b859 | 2020-06-16 21:51:33 +0300 | [diff] [blame] | 748 | func TestUpdateNodebInfoOnConnectionStatusInversionSuccess(t *testing.T) { |
| 749 | inventoryName := "name" |
| 750 | plmnId := "02f829" |
| 751 | nbId := "4a952a0a" |
| 752 | channelName := "RAN_CONNECT_STATE_CHANGE" |
| 753 | eventName := inventoryName + "_" + "CONNECTED" |
Idan Shalom | 14eb513 | 2020-07-06 09:41:46 +0000 | [diff] [blame^] | 754 | w, sdlInstanceMock := initSdlInstanceMock(namespace) |
ss412g | a07b859 | 2020-06-16 21:51:33 +0300 | [diff] [blame] | 755 | nodebInfo := generateNodebInfo(inventoryName, entities.Node_ENB, plmnId, nbId) |
| 756 | data, err := proto.Marshal(nodebInfo) |
| 757 | if err != nil { |
| 758 | t.Errorf("#rNibWriter_test.TestUpdateNodebInfoOnConnectionStatusInversionSuccess - Failed to marshal NodeB entity. Error: %v", err) |
| 759 | } |
| 760 | var e error |
| 761 | var setExpected []interface{} |
| 762 | |
| 763 | nodebNameKey := fmt.Sprintf("RAN:%s", inventoryName) |
| 764 | nodebIdKey := fmt.Sprintf("ENB:%s:%s", plmnId, nbId) |
| 765 | setExpected = append(setExpected, nodebNameKey, data) |
| 766 | setExpected = append(setExpected, nodebIdKey, data) |
| 767 | |
idanshal | 1766b71 | 2020-06-22 12:41:02 +0300 | [diff] [blame] | 768 | sdlInstanceMock.On("SetAndPublish", []string{channelName, eventName}, []interface{}{setExpected}).Return(e) |
ss412g | a07b859 | 2020-06-16 21:51:33 +0300 | [diff] [blame] | 769 | |
| 770 | rNibErr := w.UpdateNodebInfoOnConnectionStatusInversion(nodebInfo, channelName, eventName) |
| 771 | assert.Nil(t, rNibErr) |
| 772 | } |
| 773 | |
| 774 | func TestUpdateNodebInfoOnConnectionStatusInversionMissingInventoryNameFailure(t *testing.T) { |
| 775 | inventoryName := "name" |
| 776 | plmnId := "02f829" |
| 777 | nbId := "4a952a0a" |
| 778 | channelName := "RAN_CONNECT_STATE_CHANGE" |
| 779 | eventName := inventoryName + "_" + "CONNECTED" |
| 780 | w, sdlInstanceMock := initSdlInstanceMock(namespace) |
| 781 | nodebInfo := &entities.NodebInfo{} |
| 782 | data, err := proto.Marshal(nodebInfo) |
| 783 | if err != nil { |
| 784 | t.Errorf("#rNibWriter_test.TestUpdateNodebInfoOnConnectionStatusInversionMissingInventoryNameFailure - Failed to marshal NodeB entity. Error: %v", err) |
| 785 | } |
| 786 | var e error |
| 787 | var setExpected []interface{} |
| 788 | |
| 789 | nodebNameKey := fmt.Sprintf("RAN:%s", inventoryName) |
| 790 | nodebIdKey := fmt.Sprintf("ENB:%s:%s", plmnId, nbId) |
| 791 | setExpected = append(setExpected, nodebNameKey, data) |
| 792 | setExpected = append(setExpected, nodebIdKey, data) |
| 793 | |
idanshal | 1766b71 | 2020-06-22 12:41:02 +0300 | [diff] [blame] | 794 | sdlInstanceMock.On("SetAndPublish", []string{channelName, eventName}, []interface{}{setExpected}).Return(e) |
ss412g | a07b859 | 2020-06-16 21:51:33 +0300 | [diff] [blame] | 795 | |
| 796 | rNibErr := w.UpdateNodebInfoOnConnectionStatusInversion(nodebInfo, channelName, eventName) |
| 797 | |
| 798 | assert.NotNil(t, rNibErr) |
| 799 | assert.IsType(t, &common.ValidationError{}, rNibErr) |
| 800 | } |
| 801 | |
| 802 | func TestUpdateNodebInfoOnConnectionStatusInversionMissingGlobalNbId(t *testing.T) { |
| 803 | inventoryName := "name" |
| 804 | channelName := "RAN_CONNECT_STATE_CHANGE" |
| 805 | eventName := inventoryName + "_" + "CONNECTED" |
| 806 | w, sdlInstanceMock := initSdlInstanceMock(namespace) |
| 807 | nodebInfo := &entities.NodebInfo{} |
| 808 | nodebInfo.RanName = inventoryName |
| 809 | data, err := proto.Marshal(nodebInfo) |
| 810 | if err != nil { |
| 811 | t.Errorf("#rNibWriter_test.TestUpdateNodebInfoOnConnectionStatusInversionMissingInventoryNameFailure - Failed to marshal NodeB entity. Error: %v", err) |
| 812 | } |
| 813 | var e error |
| 814 | var setExpected []interface{} |
| 815 | |
| 816 | nodebNameKey := fmt.Sprintf("RAN:%s", inventoryName) |
| 817 | setExpected = append(setExpected, nodebNameKey, data) |
idanshal | 1766b71 | 2020-06-22 12:41:02 +0300 | [diff] [blame] | 818 | sdlInstanceMock.On("SetAndPublish", []string{channelName, eventName}, []interface{}{setExpected}).Return(e) |
ss412g | a07b859 | 2020-06-16 21:51:33 +0300 | [diff] [blame] | 819 | |
| 820 | rNibErr := w.UpdateNodebInfoOnConnectionStatusInversion(nodebInfo, channelName, eventName) |
| 821 | |
| 822 | assert.Nil(t, rNibErr) |
| 823 | } |
| 824 | |
| 825 | func TestSaveGeneralConfiguration(t *testing.T) { |
| 826 | w, sdlInstanceMock := initSdlInstanceMock(namespace) |
| 827 | |
| 828 | key := common.BuildGeneralConfigurationKey() |
| 829 | configurationData := "{\"enableRic\":true}" |
| 830 | configuration := &entities.GeneralConfiguration{} |
| 831 | configuration.EnableRic = true |
| 832 | |
Idan Shalom | 14eb513 | 2020-07-06 09:41:46 +0000 | [diff] [blame^] | 833 | sdlInstanceMock.On("Set", []interface{}{[]interface{}{key, []byte(configurationData)}}).Return(nil) |
ss412g | a07b859 | 2020-06-16 21:51:33 +0300 | [diff] [blame] | 834 | rNibErr := w.SaveGeneralConfiguration(configuration) |
| 835 | |
| 836 | assert.Nil(t, rNibErr) |
| 837 | sdlInstanceMock.AssertExpectations(t) |
| 838 | } |
| 839 | |
| 840 | func TestSaveGeneralConfigurationDbError(t *testing.T) { |
| 841 | w, sdlInstanceMock := initSdlInstanceMock(namespace) |
| 842 | |
| 843 | key := common.BuildGeneralConfigurationKey() |
| 844 | configurationData := "{\"enableRic\":true}" |
| 845 | configuration := &entities.GeneralConfiguration{} |
| 846 | configuration.EnableRic = true |
| 847 | |
| 848 | expectedErr := errors.New("expected error") |
| 849 | |
Idan Shalom | 14eb513 | 2020-07-06 09:41:46 +0000 | [diff] [blame^] | 850 | sdlInstanceMock.On("Set", []interface{}{[]interface{}{key, []byte(configurationData)}}).Return(expectedErr) |
ss412g | a07b859 | 2020-06-16 21:51:33 +0300 | [diff] [blame] | 851 | rNibErr := w.SaveGeneralConfiguration(configuration) |
| 852 | |
| 853 | assert.NotNil(t, rNibErr) |
| 854 | } |
| 855 | |
ss412g | 07ef76d | 2019-08-12 17:26:40 +0300 | [diff] [blame] | 856 | //Integration tests |
| 857 | // |
ns019t | 57c3fae | 2019-08-12 20:08:49 +0300 | [diff] [blame] | 858 | //func TestSaveEnbGnbInteg(t *testing.T){ |
ss412g | 07ef76d | 2019-08-12 17:26:40 +0300 | [diff] [blame] | 859 | // for i := 0; i<10; i++{ |
| 860 | // Init("e2Manager", 1) |
| 861 | // w := GetRNibWriter() |
| 862 | // nb := entities.NodebInfo{} |
| 863 | // nb.NodeType = entities.Node_ENB |
| 864 | // nb.ConnectionStatus = entities.ConnectionStatus_CONNECTED |
| 865 | // nb.Ip = "localhost" |
| 866 | // nb.Port = uint32(5656 + i) |
| 867 | // enb := entities.Enb{} |
| 868 | // cell1 := &entities.ServedCellInfo{CellId:fmt.Sprintf("%02x",111 + i), Pci:uint32(11 + i)} |
| 869 | // cell2 := &entities.ServedCellInfo{CellId:fmt.Sprintf("%02x",222 + i), Pci:uint32(22 + i)} |
| 870 | // cell3 := &entities.ServedCellInfo{CellId:fmt.Sprintf("%02x",333 + i), Pci:uint32(33 + i)} |
| 871 | // enb.ServedCells = []*entities.ServedCellInfo{cell1, cell2, cell3} |
| 872 | // nb.Configuration = &entities.NodebInfo_Enb{Enb:&enb} |
| 873 | // plmnId := 0x02f828 |
| 874 | // nbId := 0x4a952a0a |
ss412g | a07b859 | 2020-06-16 21:51:33 +0300 | [diff] [blame] | 875 | // nbIdentity := &entities.NbIdentity{InventoryName: fmt.Sprintf("nameEnb%d" ,i), GlobalNbId:&entities.GlobalNbId{RicId:fmt.Sprintf("%02x", plmnId + i), NbId:fmt.Sprintf("%02x", nbId + i)}} |
ss412g | 07ef76d | 2019-08-12 17:26:40 +0300 | [diff] [blame] | 876 | // err := w.SaveNodeb(nbIdentity, &nb) |
| 877 | // if err != nil{ |
| 878 | // t.Errorf("#rNibWriter_test.TestSaveEnbInteg - Failed to save NodeB entity. Error: %v", err) |
| 879 | // } |
| 880 | // |
| 881 | // nb1 := entities.NodebInfo{} |
| 882 | // nb1.NodeType = entities.Node_GNB |
ns019t | 57c3fae | 2019-08-12 20:08:49 +0300 | [diff] [blame] | 883 | // nb1.ConnectionStatus = entities.ConnectionStatus_CONNECTED |
ss412g | 07ef76d | 2019-08-12 17:26:40 +0300 | [diff] [blame] | 884 | // nb1.Ip = "localhost" |
| 885 | // nb1.Port = uint32(6565 + i) |
| 886 | // gnb := entities.Gnb{} |
| 887 | // gCell1 := &entities.ServedNRCell{ServedNrCellInformation:&entities.ServedNRCellInformation{CellId:fmt.Sprintf("%02x",1111 + i), NrPci:uint32(1 + i)}} |
| 888 | // gCell2 := &entities.ServedNRCell{ServedNrCellInformation:&entities.ServedNRCellInformation{CellId:fmt.Sprintf("%02x",2222 + i), NrPci:uint32(2 + i)}} |
| 889 | // gCell3 := &entities.ServedNRCell{ServedNrCellInformation:&entities.ServedNRCellInformation{CellId:fmt.Sprintf("%02x",3333 + i), NrPci:uint32(3 + i)}} |
| 890 | // gnb.ServedNrCells = []*entities.ServedNRCell{gCell1, gCell2, gCell3,} |
| 891 | // nb1.Configuration = &entities.NodebInfo_Gnb{Gnb:&gnb} |
ss412g | a07b859 | 2020-06-16 21:51:33 +0300 | [diff] [blame] | 892 | // nbIdentity = &entities.NbIdentity{InventoryName: fmt.Sprintf("nameGnb%d" ,i), GlobalNbId:&entities.GlobalNbId{RicId:fmt.Sprintf("%02x", plmnId - i), NbId:fmt.Sprintf("%02x", nbId - i)}} |
ss412g | 07ef76d | 2019-08-12 17:26:40 +0300 | [diff] [blame] | 893 | // err = w.SaveNodeb(nbIdentity, &nb1) |
| 894 | // if err != nil{ |
| 895 | // t.Errorf("#rNibWriter_test.TestSaveEnbInteg - Failed to save NodeB entity. Error: %v", err) |
| 896 | // } |
| 897 | // } |
| 898 | //} |
ns019t | 57c3fae | 2019-08-12 20:08:49 +0300 | [diff] [blame] | 899 | // |
| 900 | //func TestSaveNbRanNamesInteg(t *testing.T){ |
| 901 | // for i := 0; i<10; i++{ |
| 902 | // Init("e2Manager", 1) |
| 903 | // w := GetRNibWriter() |
| 904 | // nb := entities.NodebInfo{} |
| 905 | // nb.ConnectionStatus = entities.ConnectionStatus_CONNECTING |
| 906 | // nb.Ip = "localhost" |
| 907 | // nb.Port = uint32(5656 + i) |
| 908 | // nbIdentity := &entities.NbIdentity{InventoryName: fmt.Sprintf("nameOnly%d" ,i)} |
| 909 | // err := w.SaveNodeb(nbIdentity, &nb) |
| 910 | // if err != nil{ |
| 911 | // t.Errorf("#rNibWriter_test.TestSaveEnbInteg - Failed to save NodeB entity. Error: %v", err) |
| 912 | // } |
| 913 | // } |
| 914 | //} |
| 915 | // |
ss412g | 07ef76d | 2019-08-12 17:26:40 +0300 | [diff] [blame] | 916 | //func TestSaveRanLoadInformationInteg(t *testing.T){ |
| 917 | // Init("e2Manager", 1) |
| 918 | // w := GetRNibWriter() |
| 919 | // ranLoadInformation := generateRanLoadInformation() |
| 920 | // err := w.SaveRanLoadInformation("ran_integ", ranLoadInformation) |
| 921 | // if err != nil{ |
| 922 | // t.Errorf("#rNibWriter_test.TestSaveRanLoadInformationInteg - Failed to save RanLoadInformation entity. Error: %v", err) |
| 923 | // } |
is005q | 19e72a5 | 2019-08-26 17:56:18 +0300 | [diff] [blame] | 924 | //} |