2 // Copyright 2019 AT&T Intellectual Property
3 // Copyright 2019 Nokia
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
9 // http://www.apache.org/licenses/LICENSE-2.0
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.
17 // This source code is part of the near-RT RIC (RAN Intelligent Controller)
18 // platform project (RICP).
24 "gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/common"
25 "gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities"
26 "github.com/golang/protobuf/proto"
27 "github.com/pkg/errors"
28 "github.com/stretchr/testify/assert"
33 var namespace = "namespace"
35 func initSdlInstanceMock(namespace string) (w RNibReader, sdlInstanceMock *MockSdlInstance) {
36 sdlInstanceMock = new(MockSdlInstance)
37 w = GetRNibReader(sdlInstanceMock)
41 func TestGetNodeB(t *testing.T) {
43 w, sdlInstanceMock := initSdlInstanceMock(namespace)
44 nb := entities.NodebInfo{}
45 nb.ConnectionStatus = 1
49 cell := entities.ServedCellInfo{Tac: "tac"}
50 enb.ServedCells = []*entities.ServedCellInfo{&cell}
51 nb.Configuration = &entities.NodebInfo_Enb{Enb: &enb}
53 data, err := proto.Marshal(&nb)
55 t.Errorf("#rNibReader_test.TestGetNb - Failed to marshal ENB instance. Error: %v", err)
57 redisKey, rNibErr := common.ValidateAndBuildNodeBNameKey(name)
59 t.Errorf("#rNibReader_test.TestGetNodeB - failed to validate key parameter")
61 ret := map[string]interface{}{redisKey: string(data)}
62 sdlInstanceMock.On("Get", []string{redisKey}).Return(ret, e)
63 getNb, er := w.GetNodeb(name)
65 assert.Equal(t, getNb.Ip, nb.Ip)
66 assert.Equal(t, getNb.Port, nb.Port)
67 assert.Equal(t, getNb.ConnectionStatus, nb.ConnectionStatus)
68 assert.Len(t, getNb.GetEnb().GetServedCells(), 1)
69 assert.Equal(t, getNb.GetEnb().GetServedCells()[0].Tac, nb.GetEnb().GetServedCells()[0].Tac)
72 func TestGetNodeBNotFoundFailure(t *testing.T) {
74 w, sdlInstanceMock := initSdlInstanceMock(namespace)
76 var ret map[string]interface{}
77 redisKey, rNibErr := common.ValidateAndBuildNodeBNameKey(name)
79 t.Errorf("#rNibReader_test.TestGetNodeBNotFoundFailure - failed to validate key parameter")
81 sdlInstanceMock.On("Get", []string{redisKey}).Return(ret, e)
82 getNb, er := w.GetNodeb(name)
85 assert.IsType(t, &common.ResourceNotFoundError{}, er)
86 assert.EqualValues(t, "#rNibReader.getByKeyAndUnmarshal - entity of type *entities.NodebInfo not found. Key: RAN:name", er.Error())
89 func TestGetNodeBUnmarshalFailure(t *testing.T) {
91 w, sdlInstanceMock := initSdlInstanceMock(namespace)
93 ret := make(map[string]interface{}, 1)
94 redisKey, rNibErr := common.ValidateAndBuildNodeBNameKey(name)
96 t.Errorf("#rNibReader_test.TestGetNodeBUnmarshalFailure - failed to validate key parameter")
98 ret[redisKey] = "data"
99 sdlInstanceMock.On("Get", []string{redisKey}).Return(ret, e)
100 getNb, er := w.GetNodeb(name)
103 assert.IsType(t, &common.InternalError{}, er)
104 assert.EqualValues(t, "proto: can't skip unknown wire type 4", er.Error())
107 func TestGetNodeBSdlgoFailure(t *testing.T) {
109 errMsg := "expected Sdlgo error"
110 errMsgExpected := "expected Sdlgo error"
111 w, sdlInstanceMock := initSdlInstanceMock(namespace)
112 e := errors.New(errMsg)
113 var ret map[string]interface{}
114 redisKey, rNibErr := common.ValidateAndBuildNodeBNameKey(name)
116 t.Errorf("#rNibReader_test.TestGetNodeBSdlgoFailure - failed to validate key parameter")
118 sdlInstanceMock.On("Get", []string{redisKey}).Return(ret, e)
119 getNb, er := w.GetNodeb(name)
122 assert.IsType(t, &common.InternalError{}, er)
123 assert.EqualValues(t, errMsgExpected, er.Error())
126 func TestGetNodeBCellsListEnb(t *testing.T) {
128 w, sdlInstanceMock := initSdlInstanceMock(namespace)
129 nb := entities.NodebInfo{}
130 nb.ConnectionStatus = 1
133 enb := entities.Enb{}
134 cell := entities.ServedCellInfo{Tac: "tac"}
135 enb.ServedCells = []*entities.ServedCellInfo{&cell}
136 nb.Configuration = &entities.NodebInfo_Enb{Enb: &enb}
138 data, err := proto.Marshal(&nb)
140 t.Errorf("#rNibReader_test.GetNodeBCellsList - Failed to marshal ENB instance. Error: %v", err)
142 redisKey, rNibErr := common.ValidateAndBuildNodeBNameKey(name)
144 t.Errorf("#rNibReader_test.TestGetNodeBCellsListEnb - failed to validate key parameter")
146 ret := map[string]interface{}{redisKey: string(data)}
147 sdlInstanceMock.On("Get", []string{redisKey}).Return(ret, e)
148 cells, er := w.GetCellList(name)
150 assert.NotNil(t, cells)
151 assert.Len(t, cells.GetServedCellInfos().GetServedCells(), 1)
152 retCell := cells.GetServedCellInfos().GetServedCells()[0]
153 assert.Equal(t, retCell.Tac, "tac")
156 func TestGetNodeBCellsListGnb(t *testing.T) {
158 w, sdlInstanceMock := initSdlInstanceMock(namespace)
159 nb := entities.NodebInfo{}
160 nb.ConnectionStatus = 1
163 nb.NodeType = entities.Node_GNB
164 gnb := entities.Gnb{}
165 cell := entities.ServedNRCell{ServedNrCellInformation: &entities.ServedNRCellInformation{NrPci: 10}}
166 gnb.ServedNrCells = []*entities.ServedNRCell{&cell}
167 nb.Configuration = &entities.NodebInfo_Gnb{Gnb: &gnb}
169 data, err := proto.Marshal(&nb)
171 t.Errorf("#rNibReader_test.GetNodeBCellsList - Failed to marshal GNB instance. Error: %v", err)
173 redisKey, rNibErr := common.ValidateAndBuildNodeBNameKey(name)
175 t.Errorf("#rNibReader_test.TestGetNodeBCellsListGnb - failed to validate key parameter")
177 ret := map[string]interface{}{redisKey: string(data)}
178 sdlInstanceMock.On("Get", []string{redisKey}).Return(ret, e)
179 cells, er := w.GetCellList(name)
181 assert.NotNil(t, cells)
182 assert.Len(t, cells.GetServedNrCells().GetServedCells(), 1)
183 retCell := cells.GetServedNrCells().GetServedCells()[0]
184 assert.Equal(t, retCell.GetServedNrCellInformation().GetNrPci(), uint32(10))
187 func TestGetNodeBCellsListNodeUnmarshalFailure(t *testing.T) {
189 w, sdlInstanceMock := initSdlInstanceMock(namespace)
191 ret := make(map[string]interface{}, 1)
192 redisKey, rNibErr := common.ValidateAndBuildNodeBNameKey(name)
194 t.Errorf("#rNibReader_test.TestGetNodeBCellsListNodeUnmarshalFailure - failed to validate key parameter")
196 ret[redisKey] = "data"
197 sdlInstanceMock.On("Get", []string{redisKey}).Return(ret, e)
198 cells, er := w.GetCellList(name)
201 assert.IsType(t, &common.InternalError{}, er)
202 assert.EqualValues(t, "proto: can't skip unknown wire type 4", er.Error())
205 func TestGetNodeBCellsListNodeNotFoundFailure(t *testing.T) {
207 w, sdlInstanceMock := initSdlInstanceMock(namespace)
209 var ret map[string]interface{}
210 redisKey, rNibErr := common.ValidateAndBuildNodeBNameKey(name)
212 t.Errorf("#rNibReader_test.TestGetNodeBCellsListNodeNotFoundFailure - failed to validate key parameter")
214 sdlInstanceMock.On("Get", []string{redisKey}).Return(ret, e)
215 cells, er := w.GetCellList(name)
218 assert.IsType(t, &common.ResourceNotFoundError{}, er)
219 assert.EqualValues(t, "#rNibReader.getByKeyAndUnmarshal - entity of type *entities.NodebInfo not found. Key: RAN:name", er.Error())
222 func TestGetNodeBCellsListNotFoundFailureEnb(t *testing.T) {
224 w, sdlInstanceMock := initSdlInstanceMock(namespace)
225 nb := entities.NodebInfo{}
226 nb.ConnectionStatus = 1
229 enb := entities.Enb{}
230 nb.Configuration = &entities.NodebInfo_Enb{Enb: &enb}
232 data, err := proto.Marshal(&nb)
234 t.Errorf("#rNibReader_test.TestGetNbCellsListNotFoundFailure - Failed to marshal ENB instance. Error: %v", err)
236 redisKey, rNibErr := common.ValidateAndBuildNodeBNameKey(name)
238 t.Errorf("#rNibReader_test.TestGetNodeBCellsListNotFoundFailureEnb - failed to validate key parameter")
240 ret := map[string]interface{}{redisKey: string(data)}
241 sdlInstanceMock.On("Get", []string{redisKey}).Return(ret, e)
242 _, er := w.GetCellList(name)
244 assert.EqualValues(t, "#rNibReader.GetCellList - served cells not found. Responding node RAN name: name.", er.Error())
247 func TestGetNodeBCellsListNotFoundFailureGnb(t *testing.T) {
249 w, sdlInstanceMock := initSdlInstanceMock(namespace)
250 nb := entities.NodebInfo{}
251 nb.ConnectionStatus = 1
254 gnb := entities.Gnb{}
255 nb.Configuration = &entities.NodebInfo_Gnb{Gnb: &gnb}
257 data, err := proto.Marshal(&nb)
259 t.Errorf("#rNibReader_test.TestGetNodeBCellsListNotFoundFailureGnb - Failed to marshal ENB instance. Error: %v", err)
261 redisKey, rNibErr := common.ValidateAndBuildNodeBNameKey(name)
263 t.Errorf("#rNibReader_test.TestGetNodeBCellsListNotFoundFailureGnb - failed to validate key parameter")
265 ret := map[string]interface{}{redisKey: string(data)}
266 sdlInstanceMock.On("Get", []string{redisKey}).Return(ret, e)
267 _, er := w.GetCellList(name)
269 assert.EqualValues(t, "#rNibReader.GetCellList - served cells not found. Responding node RAN name: name.", er.Error())
272 func TestGetListGnbIdsUnmarshalFailure(t *testing.T) {
273 w, sdlInstanceMock := initSdlInstanceMock(namespace)
275 sdlInstanceMock.On("GetMembers", entities.Node_GNB.String()).Return([]string{"data"}, e)
276 ids, er := w.GetListGnbIds()
279 assert.IsType(t, &common.InternalError{}, er)
280 assert.Equal(t, "proto: can't skip unknown wire type 4", er.Error())
283 func TestGetListGnbIdsSdlgoFailure(t *testing.T) {
284 errMsg := "expected Sdlgo error"
285 errMsgExpected := "expected Sdlgo error"
286 w, sdlInstanceMock := initSdlInstanceMock(namespace)
287 e := errors.New(errMsg)
289 sdlInstanceMock.On("GetMembers", entities.Node_GNB.String()).Return(data, e)
290 ids, er := w.GetListGnbIds()
293 assert.IsType(t, &common.InternalError{}, er)
294 assert.EqualValues(t, errMsgExpected, er.Error())
297 func TestGetListNodesIdsGnbSdlgoFailure(t *testing.T) {
298 w, sdlInstanceMock := initSdlInstanceMock(namespace)
303 nbIdentity := &entities.NbIdentity{InventoryName: name, GlobalNbId: &entities.GlobalNbId{PlmnId: plmnId, NbId: nbId}}
305 data, err := proto.Marshal(nbIdentity)
307 t.Errorf("#rNibReader_test.TestGetListNodesIdsGnbSdlgoFailure - Failed to marshal nodeb identity entity. Error: %v", err)
309 sdlInstanceMock.On("GetMembers", entities.Node_ENB.String()).Return([]string{string(data)}, nilError)
311 errMsg := "expected Sdlgo error"
312 errMsgExpected := "expected Sdlgo error"
313 expectedError := errors.New(errMsg)
315 sdlInstanceMock.On("GetMembers", entities.Node_GNB.String()).Return(nilData, expectedError)
317 ids, er := w.GetListNodebIds()
320 assert.IsType(t, &common.InternalError{}, er)
321 assert.EqualValues(t, errMsgExpected, er.Error())
324 func TestGetListNodesIdsEnbSdlgoFailure(t *testing.T) {
325 w, sdlInstanceMock := initSdlInstanceMock(namespace)
330 nbIdentity := &entities.NbIdentity{InventoryName: name, GlobalNbId: &entities.GlobalNbId{PlmnId: plmnId, NbId: nbId}}
332 data, err := proto.Marshal(nbIdentity)
334 t.Errorf("#rNibReader_test.TestGetListNodesIdsEnbSdlgoFailure - Failed to marshal nodeb identity entity. Error: %v", err)
336 sdlInstanceMock.On("GetMembers", entities.Node_GNB.String()).Return([]string{string(data)}, nilError)
338 errMsg := "expected Sdlgo error"
339 errMsgExpected := "expected Sdlgo error"
340 expectedError := errors.New(errMsg)
342 sdlInstanceMock.On("GetMembers", entities.Node_ENB.String()).Return(nilData, expectedError)
344 ids, er := w.GetListNodebIds()
347 assert.IsType(t, &common.InternalError{}, er)
348 assert.EqualValues(t, errMsgExpected, er.Error())
351 func TestGetListNodesIdsSuccess(t *testing.T) {
352 w, sdlInstanceMock := initSdlInstanceMock(namespace)
358 nbIdentity := &entities.NbIdentity{InventoryName: name, GlobalNbId: &entities.GlobalNbId{PlmnId: plmnId, NbId: nbId}}
359 data, err := proto.Marshal(nbIdentity)
361 t.Errorf("#rNibReader_test.TestGetListNodesIdsSuccess - Failed to marshal nodeb identity entity. Error: %v", err)
367 nbIdentity1 := &entities.NbIdentity{InventoryName: name1, GlobalNbId: &entities.GlobalNbId{PlmnId: plmnId1, NbId: nbId1}}
368 data1, err := proto.Marshal(nbIdentity1)
370 t.Errorf("#rNibReader_test.TestGetListNodesIdsSuccess - Failed to marshal nodeb identity entity. Error: %v", err)
374 nbIdentity2 := &entities.NbIdentity{InventoryName: name2}
375 data2, err := proto.Marshal(nbIdentity2)
377 t.Errorf("#rNibReader_test.TestGetListNodesIdsSuccess - Failed to marshal nodeb identity entity. Error: %v", err)
380 sdlInstanceMock.On("GetMembers", entities.Node_GNB.String()).Return([]string{string(data)}, nilError)
381 sdlInstanceMock.On("GetMembers", entities.Node_ENB.String()).Return([]string{string(data1)}, nilError)
382 sdlInstanceMock.On("GetMembers", entities.Node_UNKNOWN.String()).Return([]string{string(data2)}, nilError)
384 ids, er := w.GetListNodebIds()
386 assert.NotNil(t, ids)
387 assert.Len(t, ids, 3)
390 func TestGetListEnbIdsUnmarshalFailure(t *testing.T) {
391 w, sdlInstanceMock := initSdlInstanceMock(namespace)
393 sdlInstanceMock.On("GetMembers", entities.Node_ENB.String()).Return([]string{"data"}, e)
394 ids, er := w.GetListEnbIds()
397 assert.IsType(t, &common.InternalError{}, er)
398 assert.Equal(t, "proto: can't skip unknown wire type 4", er.Error())
401 func TestGetListEnbIdsOneId(t *testing.T) {
405 w, sdlInstanceMock := initSdlInstanceMock(namespace)
406 nbIdentity := &entities.NbIdentity{InventoryName: name, GlobalNbId: &entities.GlobalNbId{PlmnId: plmnId, NbId: nbId}}
408 data, err := proto.Marshal(nbIdentity)
410 t.Errorf("#rNibReader_test.TestGetListEnbIds - Failed to marshal nodeb identity entity. Error: %v", err)
412 sdlInstanceMock.On("GetMembers", entities.Node_ENB.String()).Return([]string{string(data)}, e)
413 ids, er := w.GetListEnbIds()
415 assert.Len(t, ids, 1)
416 assert.Equal(t, (ids)[0].GetInventoryName(), name)
417 assert.Equal(t, (ids)[0].GetGlobalNbId().GetPlmnId(), nbIdentity.GetGlobalNbId().GetPlmnId())
418 assert.Equal(t, (ids)[0].GetGlobalNbId().GetNbId(), nbIdentity.GetGlobalNbId().GetNbId())
421 func TestGetListEnbIdsNoIds(t *testing.T) {
422 w, sdlInstanceMock := initSdlInstanceMock(namespace)
424 sdlInstanceMock.On("GetMembers", entities.Node_ENB.String()).Return([]string{}, e)
425 ids, er := w.GetListEnbIds()
427 assert.Len(t, ids, 0)
430 func TestGetListEnbIds(t *testing.T) {
435 w, sdlInstanceMock := initSdlInstanceMock(namespace)
436 idsData := make([]string, listSize)
437 idsEntities := make([]*entities.NbIdentity, listSize)
438 for i := 0; i < listSize; i++ {
439 nbIdentity := &entities.NbIdentity{InventoryName: name, GlobalNbId: &entities.GlobalNbId{PlmnId: string(plmnId + i), NbId: string(nbId + i)}}
440 data, err := proto.Marshal(nbIdentity)
442 t.Errorf("#rNibReader_test.TestGetListEnbIds - Failed to marshal nodeb identity entity. Error: %v", err)
444 idsData[i] = string(data)
445 idsEntities[i] = nbIdentity
448 sdlInstanceMock.On("GetMembers", entities.Node_ENB.String()).Return(idsData, e)
449 ids, er := w.GetListEnbIds()
451 assert.Len(t, ids, listSize)
452 for i, id := range ids {
453 assert.Equal(t, id.GetInventoryName(), name)
454 assert.Equal(t, id.GetGlobalNbId().GetPlmnId(), idsEntities[i].GetGlobalNbId().GetPlmnId())
455 assert.Equal(t, id.GetGlobalNbId().GetNbId(), idsEntities[i].GetGlobalNbId().GetNbId())
459 func TestGetListGnbIdsOneId(t *testing.T) {
463 w, sdlInstanceMock := initSdlInstanceMock(namespace)
464 nbIdentity := &entities.NbIdentity{InventoryName: name, GlobalNbId: &entities.GlobalNbId{PlmnId: plmnId, NbId: nbId}}
466 data, err := proto.Marshal(nbIdentity)
468 t.Errorf("#rNibReader_test.TestGetListGnbIds - Failed to marshal nodeb identity entity. Error: %v", err)
470 sdlInstanceMock.On("GetMembers", entities.Node_GNB.String()).Return([]string{string(data)}, e)
471 ids, er := w.GetListGnbIds()
473 assert.Len(t, ids, 1)
474 assert.Equal(t, (ids)[0].GetInventoryName(), name)
475 assert.Equal(t, (ids)[0].GetGlobalNbId().GetPlmnId(), nbIdentity.GetGlobalNbId().GetPlmnId())
476 assert.Equal(t, (ids)[0].GetGlobalNbId().GetNbId(), nbIdentity.GetGlobalNbId().GetNbId())
479 func TestGetListGnbIdsNoIds(t *testing.T) {
480 w, sdlInstanceMock := initSdlInstanceMock(namespace)
482 sdlInstanceMock.On("GetMembers", entities.Node_GNB.String()).Return([]string{}, e)
483 ids, er := w.GetListGnbIds()
485 assert.Len(t, ids, 0)
488 func TestGetListGnbIds(t *testing.T) {
493 w, sdlInstanceMock := initSdlInstanceMock(namespace)
494 idsData := make([]string, listSize)
495 idsEntities := make([]*entities.NbIdentity, listSize)
496 for i := 0; i < listSize; i++ {
497 nbIdentity := &entities.NbIdentity{InventoryName: name, GlobalNbId: &entities.GlobalNbId{PlmnId: string(plmnId + i), NbId: string(nbId + i)}}
498 data, err := proto.Marshal(nbIdentity)
500 t.Errorf("#rNibReader_test.TestGetListGnbIds - Failed to marshal nodeb identity entity. Error: %v", err)
502 idsData[i] = string(data)
503 idsEntities[i] = nbIdentity
506 sdlInstanceMock.On("GetMembers", entities.Node_GNB.String()).Return(idsData, e)
507 ids, er := w.GetListGnbIds()
509 assert.Len(t, ids, listSize)
510 for i, id := range ids {
511 assert.Equal(t, id.GetInventoryName(), name)
512 assert.Equal(t, id.GetGlobalNbId().GetPlmnId(), idsEntities[i].GetGlobalNbId().GetPlmnId())
513 assert.Equal(t, id.GetGlobalNbId().GetNbId(), idsEntities[i].GetGlobalNbId().GetNbId())
517 func TestGetListEnbIdsSdlgoFailure(t *testing.T) {
518 errMsg := "expected Sdlgo error"
519 errMsgExpected := "expected Sdlgo error"
520 w, sdlInstanceMock := initSdlInstanceMock(namespace)
521 e := errors.New(errMsg)
523 sdlInstanceMock.On("GetMembers", entities.Node_ENB.String()).Return(data, e)
524 ids, er := w.GetListEnbIds()
527 assert.IsType(t, &common.InternalError{}, er)
528 assert.EqualValues(t, errMsgExpected, er.Error())
531 func TestGetCountGnbListOneId(t *testing.T) {
532 w, sdlInstanceMock := initSdlInstanceMock(namespace)
534 sdlInstanceMock.On("GroupSize", entities.Node_GNB.String()).Return(1, e)
535 count, er := w.GetCountGnbList()
537 assert.Equal(t, count, 1)
540 func TestGetCountGnbList(t *testing.T) {
541 w, sdlInstanceMock := initSdlInstanceMock(namespace)
543 sdlInstanceMock.On("GroupSize", entities.Node_GNB.String()).Return(3, e)
544 count, er := w.GetCountGnbList()
546 assert.Equal(t, count, 3)
549 func TestGetCountGnbListSdlgoFailure(t *testing.T) {
550 errMsg := "expected Sdlgo error"
551 errMsgExpected := "expected Sdlgo error"
552 w, sdlInstanceMock := initSdlInstanceMock(namespace)
553 e := errors.New(errMsg)
555 sdlInstanceMock.On("GroupSize", entities.Node_GNB.String()).Return(count, e)
556 count, er := w.GetCountGnbList()
558 assert.Equal(t, 0, count)
559 assert.IsType(t, &common.InternalError{}, er)
560 assert.EqualValues(t, errMsgExpected, er.Error())
563 func TestGetCell(t *testing.T) {
566 w, sdlInstanceMock := initSdlInstanceMock(namespace)
567 cellEntity := entities.Cell{Type: entities.Cell_LTE_CELL, Cell: &entities.Cell_ServedCellInfo{ServedCellInfo: &entities.ServedCellInfo{Pci: pci}}}
568 cellData, err := proto.Marshal(&cellEntity)
570 t.Errorf("#rNibReader_test.TestGetCell - Failed to marshal Cell entity. Error: %v", err)
573 key, rNibErr := common.ValidateAndBuildCellNamePciKey(name, pci)
575 t.Errorf("#rNibReader_test.TestGetCell - failed to validate key parameter")
577 ret := map[string]interface{}{key: string(cellData)}
578 sdlInstanceMock.On("Get", []string{key}).Return(ret, e)
579 cell, er := w.GetCell(name, pci)
581 assert.NotNil(t, cell)
582 assert.Equal(t, cell.Type, entities.Cell_LTE_CELL)
583 assert.NotNil(t, cell.GetServedCellInfo())
584 assert.Equal(t, cell.GetServedCellInfo().GetPci(), pci)
587 func TestGetCellNotFoundFailure(t *testing.T) {
590 w, sdlInstanceMock := initSdlInstanceMock(namespace)
592 var ret map[string]interface{}
593 key, rNibErr := common.ValidateAndBuildCellNamePciKey(name, pci)
595 t.Errorf("#rNibReader_test.TestGetCellNotFoundFailure - failed to validate key parameter")
597 sdlInstanceMock.On("Get", []string{key}).Return(ret, e)
598 cell, er := w.GetCell(name, pci)
601 assert.IsType(t, &common.ResourceNotFoundError{}, er)
602 assert.EqualValues(t, "#rNibReader.getByKeyAndUnmarshal - entity of type *entities.Cell not found. Key: PCI:name:00", er.Error())
605 func TestGetCellUnmarshalFailure(t *testing.T) {
608 w, sdlInstanceMock := initSdlInstanceMock(namespace)
610 ret := make(map[string]interface{}, 1)
611 key, rNibErr := common.ValidateAndBuildCellNamePciKey(name, pci)
613 t.Errorf("#rNibReader_test.TestGetCellUnmarshalFailure - failed to validate key parameter")
616 sdlInstanceMock.On("Get", []string{key}).Return(ret, e)
617 cell, er := w.GetCell(name, pci)
620 assert.IsType(t, &common.InternalError{}, er)
621 assert.EqualValues(t, "proto: can't skip unknown wire type 4", er.Error())
624 func TestGetCellSdlgoFailure(t *testing.T) {
627 errMsg := "expected Sdlgo error"
628 errMsgExpected := "expected Sdlgo error"
629 w, sdlInstanceMock := initSdlInstanceMock(namespace)
630 e := errors.New(errMsg)
631 var ret map[string]interface{}
632 key, rNibErr := common.ValidateAndBuildCellNamePciKey(name, pci)
634 t.Errorf("#rNibReader_test.TestGetCellSdlgoFailure - failed to validate key parameter")
636 sdlInstanceMock.On("Get", []string{key}).Return(ret, e)
637 cell, er := w.GetCell(name, pci)
640 assert.IsType(t, &common.InternalError{}, er)
641 assert.EqualValues(t, errMsgExpected, er.Error())
644 func TestGetNodebById(t *testing.T) {
645 w, sdlInstanceMock := initSdlInstanceMock(namespace)
646 nb := entities.NodebInfo{NodeType: entities.Node_ENB}
647 nb.ConnectionStatus = 1
650 enb := entities.Enb{}
651 cell := entities.ServedCellInfo{Tac: "tac"}
652 enb.ServedCells = []*entities.ServedCellInfo{&cell}
653 nb.Configuration = &entities.NodebInfo_Enb{Enb: &enb}
655 data, err := proto.Marshal(&nb)
657 t.Errorf("#rNibReader_test.TestGetNodebById - Failed to marshal ENB instance. Error: %v", err)
662 key, rNibErr := common.ValidateAndBuildNodeBIdKey(entities.Node_ENB.String(), plmnId, nbId)
664 t.Errorf("Failed to validate nodeb identity, plmnId: %s, nbId: %s", plmnId, nbId)
666 ret := map[string]interface{}{key: string(data)}
667 sdlInstanceMock.On("Get", []string{key}).Return(ret, e)
668 globalNbId := &entities.GlobalNbId{PlmnId: plmnId, NbId: nbId}
669 getNb, er := w.GetNodebByGlobalNbId(entities.Node_ENB, globalNbId)
671 assert.Equal(t, getNb.Ip, nb.Ip)
672 assert.Equal(t, getNb.Port, nb.Port)
673 assert.Equal(t, getNb.ConnectionStatus, nb.ConnectionStatus)
674 assert.Len(t, getNb.GetEnb().GetServedCells(), 1)
675 assert.Equal(t, getNb.GetEnb().GetServedCells()[0].Tac, nb.GetEnb().GetServedCells()[0].Tac)
678 func TestGetNodebByIdNotFoundFailureEnb(t *testing.T) {
681 w, sdlInstanceMock := initSdlInstanceMock(namespace)
683 key, rNibErr := common.ValidateAndBuildNodeBIdKey(entities.Node_ENB.String(), plmnId, nbId)
685 t.Errorf("Failed to validate nodeb identity, plmnId: %s, nbId: %s", plmnId, nbId)
687 var ret map[string]interface{}
688 sdlInstanceMock.On("Get", []string{key}).Return(ret, e)
689 globalNbId := &entities.GlobalNbId{PlmnId: plmnId, NbId: nbId}
690 getNb, er := w.GetNodebByGlobalNbId(entities.Node_ENB, globalNbId)
693 assert.IsType(t, &common.ResourceNotFoundError{}, er)
694 assert.EqualValues(t, "#rNibReader.getByKeyAndUnmarshal - entity of type *entities.NodebInfo not found. Key: ENB:02f829:4a952a0a", er.Error())
697 func TestGetNodebByIdNotFoundFailureGnb(t *testing.T) {
700 w, sdlInstanceMock := initSdlInstanceMock(namespace)
702 key, rNibErr := common.ValidateAndBuildNodeBIdKey(entities.Node_GNB.String(), plmnId, nbId)
704 t.Errorf("Failed to validate nodeb identity, plmnId: %s, nbId: %s", plmnId, nbId)
706 var ret map[string]interface{}
707 sdlInstanceMock.On("Get", []string{key}).Return(ret, e)
708 globalNbId := &entities.GlobalNbId{PlmnId: plmnId, NbId: nbId}
709 getNb, er := w.GetNodebByGlobalNbId(entities.Node_GNB, globalNbId)
712 assert.IsType(t, &common.ResourceNotFoundError{}, er)
713 assert.EqualValues(t, "#rNibReader.getByKeyAndUnmarshal - entity of type *entities.NodebInfo not found. Key: GNB:02f829:4a952a0a", er.Error())
716 func TestGetNodeByIdUnmarshalFailure(t *testing.T) {
719 w, sdlInstanceMock := initSdlInstanceMock(namespace)
720 key, rNibErr := common.ValidateAndBuildNodeBIdKey(entities.Node_ENB.String(), plmnId, nbId)
722 t.Errorf("Failed to validate nodeb identity, plmnId: %s, nbId: %s", plmnId, nbId)
725 ret := make(map[string]interface{}, 1)
727 sdlInstanceMock.On("Get", []string{key}).Return(ret, e)
728 globalNbId := &entities.GlobalNbId{PlmnId: plmnId, NbId: nbId}
729 getNb, er := w.GetNodebByGlobalNbId(entities.Node_ENB, globalNbId)
732 assert.IsType(t, &common.InternalError{}, er)
733 assert.EqualValues(t, "proto: can't skip unknown wire type 4", er.Error())
736 func TestGetNodeByIdSdlgoFailure(t *testing.T) {
739 errMsg := "expected Sdlgo error"
740 errMsgExpected := "expected Sdlgo error"
741 w, sdlInstanceMock := initSdlInstanceMock(namespace)
742 key, rNibErr := common.ValidateAndBuildNodeBIdKey(entities.Node_GNB.String(), plmnId, nbId)
744 t.Errorf("Failed to validate nodeb identity, plmnId: %s, nbId: %s", plmnId, nbId)
746 e := errors.New(errMsg)
747 var ret map[string]interface{}
748 sdlInstanceMock.On("Get", []string{key}).Return(ret, e)
749 globalNbId := &entities.GlobalNbId{PlmnId: plmnId, NbId: nbId}
750 getNb, er := w.GetNodebByGlobalNbId(entities.Node_GNB, globalNbId)
753 assert.IsType(t, &common.InternalError{}, er)
754 assert.EqualValues(t, errMsgExpected, er.Error())
757 func TestGetCellById(t *testing.T) {
760 w, sdlInstanceMock := initSdlInstanceMock(namespace)
761 cellEntity := entities.Cell{Type: entities.Cell_LTE_CELL, Cell: &entities.Cell_ServedCellInfo{ServedCellInfo: &entities.ServedCellInfo{Pci: pci}}}
762 cellData, err := proto.Marshal(&cellEntity)
764 t.Errorf("#rNibReader_test.TestGetCellById - Failed to marshal Cell entity. Error: %v", err)
767 key, rNibErr := common.ValidateAndBuildCellIdKey(cellId)
769 t.Errorf("#rNibReader_test.TestGetCellById - failed to validate key parameter")
771 ret := map[string]interface{}{key: string(cellData)}
772 sdlInstanceMock.On("Get", []string{key}).Return(ret, e)
773 cell, er := w.GetCellById(entities.Cell_LTE_CELL, cellId)
775 assert.NotNil(t, cell)
776 assert.Equal(t, cell.Type, entities.Cell_LTE_CELL)
777 assert.NotNil(t, cell.GetServedCellInfo())
778 assert.Equal(t, cell.GetServedCellInfo().GetPci(), pci)
781 func TestGetCellByIdNotFoundFailureEnb(t *testing.T) {
783 w, sdlInstanceMock := initSdlInstanceMock(namespace)
785 var ret map[string]interface{}
786 key, rNibErr := common.ValidateAndBuildCellIdKey(cellId)
788 t.Errorf("#rNibReader_test.TestGetCellByIdNotFoundFailure - failed to validate key parameter")
790 sdlInstanceMock.On("Get", []string{key}).Return(ret, e)
791 cell, er := w.GetCellById(entities.Cell_LTE_CELL, cellId)
794 assert.IsType(t, &common.ResourceNotFoundError{}, er)
795 assert.EqualValues(t, "#rNibReader.getByKeyAndUnmarshal - entity of type *entities.Cell not found. Key: CELL:bbbb", er.Error())
798 func TestGetCellByIdNotFoundFailureGnb(t *testing.T) {
800 w, sdlInstanceMock := initSdlInstanceMock(namespace)
802 var ret map[string]interface{}
803 key, rNibErr := common.ValidateAndBuildNrCellIdKey(cellId)
805 t.Errorf("#rNibReader_test.TestGetCellByIdNotFoundFailure - failed to validate key parameter")
807 sdlInstanceMock.On("Get", []string{key}).Return(ret, e)
808 cell, er := w.GetCellById(entities.Cell_NR_CELL, cellId)
811 assert.IsType(t, &common.ResourceNotFoundError{}, er)
812 assert.EqualValues(t, "#rNibReader.getByKeyAndUnmarshal - entity of type *entities.Cell not found. Key: NRCELL:bbbb", er.Error())
815 func TestGetCellByIdTypeValidationFailure(t *testing.T) {
817 w, _ := initSdlInstanceMock(namespace)
818 cell, er := w.GetCellById(5, cellId)
821 assert.IsType(t, &common.ValidationError{}, er)
822 assert.EqualValues(t, "#rNibReader.GetCellById - invalid cell type: 5", er.Error())
825 func TestGetCellByIdValidationFailureGnb(t *testing.T) {
827 w, _ := initSdlInstanceMock(namespace)
828 cell, er := w.GetCellById(entities.Cell_NR_CELL, cellId)
831 assert.IsType(t, &common.ValidationError{}, er)
832 assert.EqualValues(t, "#utils.ValidateAndBuildNrCellIdKey - an empty cell id received", er.Error())
835 func TestGetCellByIdValidationFailureEnb(t *testing.T) {
837 w, _ := initSdlInstanceMock(namespace)
838 cell, er := w.GetCellById(entities.Cell_LTE_CELL, cellId)
841 assert.IsType(t, &common.ValidationError{}, er)
842 assert.EqualValues(t, "#utils.ValidateAndBuildCellIdKey - an empty cell id received", er.Error())
845 func TestGetRanLoadInformation(t *testing.T) {
847 w, sdlInstanceMock := initSdlInstanceMock(namespace)
848 loadInfo := generateRanLoadInformation()
850 data, err := proto.Marshal(loadInfo)
852 t.Errorf("#rNibReader_test.TestGetRanLoadInformation - Failed to marshal RanLoadInformation entity. Error: %v", err)
854 redisKey, rNibErr := common.ValidateAndBuildRanLoadInformationKey(name)
856 t.Errorf("#rNibReader_test.TestGetRanLoadInformationNotFoundFailure - failed to validate key parameter")
858 ret := map[string]interface{}{redisKey: string(data)}
859 sdlInstanceMock.On("Get", []string{redisKey}).Return(ret, e)
860 getLoadInfo, er := w.GetRanLoadInformation(name)
862 assert.NotNil(t, getLoadInfo)
863 expected, err := json.Marshal(loadInfo)
865 t.Errorf("#rNibReader_test.TestGetRanLoadInformation - Failed to marshal RanLoadInformation entity. Error: %v", err)
867 actual, err := json.Marshal(getLoadInfo)
869 t.Errorf("#rNibReader_test.TestGetRanLoadInformation - Failed to marshal RanLoadInformation entity. Error: %v", err)
871 assert.EqualValues(t, expected, actual)
874 func TestGetRanLoadInformationValidationFailure(t *testing.T) {
876 w, _ := initSdlInstanceMock(namespace)
877 getNb, er := w.GetRanLoadInformation(name)
880 assert.IsType(t, &common.ValidationError{}, er)
881 assert.EqualValues(t, "#utils.ValidateAndBuildRanLoadInformationKey - an empty inventory name received", er.Error())
884 func TestGetRanLoadInformationNotFoundFailure(t *testing.T) {
886 w, sdlInstanceMock := initSdlInstanceMock(namespace)
888 var ret map[string]interface{}
889 redisKey, rNibErr := common.ValidateAndBuildRanLoadInformationKey(name)
891 t.Errorf("#rNibReader_test.TestGetRanLoadInformationNotFoundFailure - failed to validate key parameter")
893 sdlInstanceMock.On("Get", []string{redisKey}).Return(ret, e)
894 getNb, er := w.GetRanLoadInformation(name)
897 assert.IsType(t, &common.ResourceNotFoundError{}, er)
898 assert.EqualValues(t, "#rNibReader.getByKeyAndUnmarshal - entity of type *entities.RanLoadInformation not found. Key: LOAD:name", er.Error())
901 func TestGetRanLoadInformationUnmarshalFailure(t *testing.T) {
903 w, sdlInstanceMock := initSdlInstanceMock(namespace)
905 ret := make(map[string]interface{}, 1)
906 redisKey, rNibErr := common.ValidateAndBuildRanLoadInformationKey(name)
908 t.Errorf("#rNibReader_test.TestGetRanLoadInformationUnmarshalFailure - failed to validate key parameter")
910 ret[redisKey] = "data"
911 sdlInstanceMock.On("Get", []string{redisKey}).Return(ret, e)
912 getNb, er := w.GetRanLoadInformation(name)
915 assert.IsType(t, &common.InternalError{}, er)
916 assert.EqualValues(t, "proto: can't skip unknown wire type 4", er.Error())
919 func TestGetRanLoadInformationSdlgoFailure(t *testing.T) {
921 errMsg := "expected Sdlgo error"
922 errMsgExpected := "expected Sdlgo error"
923 w, sdlInstanceMock := initSdlInstanceMock(namespace)
924 e := errors.New(errMsg)
925 var ret map[string]interface{}
926 redisKey, rNibErr := common.ValidateAndBuildRanLoadInformationKey(name)
928 t.Errorf("#rNibReader_test.TestGetRanLoadInformationSdlgoFailure - failed to validate key parameter")
930 sdlInstanceMock.On("Get", []string{redisKey}).Return(ret, e)
931 getNb, er := w.GetRanLoadInformation(name)
934 assert.IsType(t, &common.InternalError{}, er)
935 assert.EqualValues(t, errMsgExpected, er.Error())
938 func generateCellLoadInformation() *entities.CellLoadInformation {
939 cellLoadInformation := entities.CellLoadInformation{}
941 cellLoadInformation.CellId = "123"
943 ulInterferenceOverloadIndication := entities.UlInterferenceOverloadIndication_HIGH_INTERFERENCE
944 cellLoadInformation.UlInterferenceOverloadIndications = []entities.UlInterferenceOverloadIndication{ulInterferenceOverloadIndication}
946 ulHighInterferenceInformation := entities.UlHighInterferenceInformation{
948 UlHighInterferenceIndication: "xxx",
951 cellLoadInformation.UlHighInterferenceInfos = []*entities.UlHighInterferenceInformation{&ulHighInterferenceInformation}
953 cellLoadInformation.RelativeNarrowbandTxPower = &entities.RelativeNarrowbandTxPower{
955 RntpThreshold: entities.RntpThreshold_NEG_4,
956 NumberOfCellSpecificAntennaPorts: entities.NumberOfCellSpecificAntennaPorts_V1_ANT_PRT,
958 PdcchInterferenceImpact: 2,
959 EnhancedRntp: &entities.EnhancedRntp{
960 EnhancedRntpBitmap: "xxx",
961 RntpHighPowerThreshold: entities.RntpThreshold_NEG_2,
962 EnhancedRntpStartTime: &entities.StartTime{StartSfn: 500, StartSubframeNumber: 5},
966 cellLoadInformation.AbsInformation = &entities.AbsInformation{
967 Mode: entities.AbsInformationMode_ABS_INFO_FDD,
968 AbsPatternInfo: "xxx",
969 NumberOfCellSpecificAntennaPorts: entities.NumberOfCellSpecificAntennaPorts_V2_ANT_PRT,
970 MeasurementSubset: "xxx",
973 cellLoadInformation.InvokeIndication = entities.InvokeIndication_ABS_INFORMATION
975 cellLoadInformation.ExtendedUlInterferenceOverloadInfo = &entities.ExtendedUlInterferenceOverloadInfo{
976 AssociatedSubframes: "xxx",
977 ExtendedUlInterferenceOverloadIndications: cellLoadInformation.UlInterferenceOverloadIndications,
980 compInformationItem := &entities.CompInformationItem{
981 CompHypothesisSets: []*entities.CompHypothesisSet{{CellId: "789", CompHypothesis: "xxx"}},
985 cellLoadInformation.CompInformation = &entities.CompInformation{
986 CompInformationItems: []*entities.CompInformationItem{compInformationItem},
987 CompInformationStartTime: &entities.StartTime{StartSfn: 123, StartSubframeNumber: 456},
990 cellLoadInformation.DynamicDlTransmissionInformation = &entities.DynamicDlTransmissionInformation{
991 State: entities.NaicsState_NAICS_ACTIVE,
992 TransmissionModes: "xxx",
994 PAList: []entities.PA{entities.PA_DB_NEG_3},
997 return &cellLoadInformation
1000 func generateRanLoadInformation() *entities.RanLoadInformation {
1001 ranLoadInformation := entities.RanLoadInformation{}
1003 ranLoadInformation.LoadTimestamp = uint64(time.Now().UnixNano())
1005 cellLoadInformation := generateCellLoadInformation()
1006 ranLoadInformation.CellLoadInfos = []*entities.CellLoadInformation{cellLoadInformation}
1008 return &ranLoadInformation
1011 func TestGetE2TInstanceSuccess(t *testing.T) {
1012 address := "10.10.2.15:9800"
1013 redisKey, validationErr := common.ValidateAndBuildE2TInstanceKey(address)
1015 if validationErr != nil {
1016 t.Errorf("#rNibReader_test.TestGetE2TInstanceSuccess - Failed to build E2T Instance key. Error: %v", validationErr)
1019 w, sdlInstanceMock := initSdlInstanceMock(namespace)
1021 e2tInstance := generateE2tInstance(address)
1022 data, err := json.Marshal(e2tInstance)
1025 t.Errorf("#rNibReader_test.TestGetE2TInstanceSuccess - Failed to marshal E2tInstance entity. Error: %v", err)
1029 ret := map[string]interface{}{redisKey: string(data)}
1030 sdlInstanceMock.On("Get", []string{redisKey}).Return(ret, e)
1032 res, rNibErr := w.GetE2TInstance(address)
1033 assert.Nil(t, rNibErr)
1034 assert.Equal(t, e2tInstance, res)
1037 func TestGetE2TInstanceEmptyAddressFailure(t *testing.T) {
1038 w, _ := initSdlInstanceMock(namespace)
1039 res, err := w.GetE2TInstance("")
1040 assert.NotNil(t, err)
1041 assert.IsType(t, &common.ValidationError{}, err)
1045 func TestGetE2TInstanceSdlError(t *testing.T) {
1046 address := "10.10.2.15:9800"
1047 redisKey, validationErr := common.ValidateAndBuildE2TInstanceKey(address)
1049 if validationErr != nil {
1050 t.Errorf("#rNibReader_test.TestGetE2TInstanceSuccess - Failed to build E2T Instance key. Error: %v", validationErr)
1053 w, sdlInstanceMock := initSdlInstanceMock(namespace)
1055 expectedErr := errors.New("expected error")
1056 var ret map[string]interface{}
1057 sdlInstanceMock.On("Get", []string{redisKey}).Return(ret, expectedErr)
1059 res, rNibErr := w.GetE2TInstance(address)
1060 assert.NotNil(t, rNibErr)
1064 func generateE2tInstance(address string) *entities.E2TInstance {
1065 e2tInstance := entities.NewE2TInstance(address)
1066 e2tInstance.AssociatedRanList = []string{"test1", "test2"}
1070 func TestGetE2TInfoListSuccess(t *testing.T) {
1071 address := "10.10.2.15:9800"
1072 w, sdlInstanceMock := initSdlInstanceMock(namespace)
1074 e2tInfo := entities.NewE2TInstanceInfo(address)
1075 e2tInfoList := []*entities.E2TInstanceInfo{e2tInfo}
1076 data, err := json.Marshal(e2tInfoList)
1079 t.Errorf("#rNibReader_test.TestGetE2TInfoListSuccess - Failed to marshal E2TInfoList. Error: %v", err)
1083 ret := map[string]interface{}{E2TInfoListKey: string(data)}
1084 sdlInstanceMock.On("Get", []string{E2TInfoListKey}).Return(ret, e)
1086 res, rNibErr := w.GetE2TInfoList()
1087 assert.Nil(t, rNibErr)
1088 assert.Equal(t, e2tInfoList, res)
1091 func TestGetE2TInfoListSdlError(t *testing.T) {
1092 w, sdlInstanceMock := initSdlInstanceMock(namespace)
1094 expectedErr := errors.New("expected error")
1095 var ret map[string]interface{}
1096 sdlInstanceMock.On("Get", []string{E2TInfoListKey}).Return(ret, expectedErr)
1098 res, rNibErr := w.GetE2TInfoList()
1099 assert.NotNil(t, rNibErr)
1105 //func TestGetEnbInteg(t *testing.T){
1106 // name := "nameEnb1"
1107 // Init("namespace", 1)
1108 // w := GetRNibReader()
1109 // nb, err := w.GetNodeb(name)
1113 // fmt.Printf("#TestGetEnbInteg - responding node type: %v\n", nb)
1117 //func TestGetEnbCellsInteg(t *testing.T){
1118 // name := "nameEnb1"
1119 // Init("namespace", 1)
1120 // w := GetRNibReader()
1121 // cells, err := w.GetCellList(name)
1124 // } else if cells != nil{
1125 // for _, cell := range cells.GetServedCellInfos().ServedCells{
1126 // fmt.Printf("responding node type Cell: %v\n", *cell)
1131 //func TestGetGnbInteg(t *testing.T){
1132 // name := "nameGnb1"
1133 // Init("namespace", 1)
1134 // w := GetRNibReader()
1135 // nb, err := w.GetNodeb(name)
1139 // fmt.Printf("#TestGetGnbInteg - responding node type: %v\n", nb)
1143 //func TestGetGnbCellsInteg(t *testing.T){
1144 // name := "nameGnb1"
1145 // Init("namespace", 1)
1146 // w := GetRNibReader()
1147 // cells, err := w.GetCellList(name)
1150 // } else if cells != nil{
1151 // for _, cell := range cells.GetServedNrCells().ServedCells{
1152 // fmt.Printf("responding node type NR Cell: %v\n", *cell)
1157 //func TestGetListEnbIdsInteg(t *testing.T) {
1158 // Init("namespace", 1)
1159 // w := GetRNibReader()
1160 // ids, err := w.GetListEnbIds()
1164 // for _, id := range ids{
1165 // fmt.Printf("#TestGetListEnbIdsInteg - ENB ID: %s\n", id)
1170 //func TestGetListGnbIdsInteg(t *testing.T) {
1171 // Init("namespace", 1)
1172 // w := GetRNibReader()
1173 // ids, err := w.GetListGnbIds()
1177 // for _, id := range ids{
1178 // fmt.Printf("#TestGetListGnbIdsInteg - GNB ID: %s\n", id)
1183 //func TestGetCountGnbListInteg(t *testing.T) {
1184 // Init("namespace", 1)
1185 // w := GetRNibReader()
1186 // count, err := w.GetCountGnbList()
1190 // fmt.Printf("#TestGetCountGnbListInteg - count Gnb list: %d\n", count)
1194 //func TestGetGnbCellInteg(t *testing.T){
1195 // name := "nameGnb7"
1197 // Init("namespace", 1)
1198 // w := GetRNibReader()
1199 // cell, err := w.GetCell(name, uint32(pci))
1202 // } else if cell != nil{
1203 // fmt.Printf("responding node type NR Cell: %v\n", cell.GetServedNrCell())
1207 //func TestGetEnbCellInteg(t *testing.T) {
1208 // name := "nameEnb1"
1210 // Init("namespace", 1)
1211 // w := GetRNibReader()
1212 // cell, err := w.GetCell(name, uint32(pci))
1215 // } else if cell != nil {
1216 // fmt.Printf("responding node type LTE Cell: %v\n", cell.GetServedCellInfo())
1220 //func TestGetEnbCellByIdInteg(t *testing.T){
1221 // Init("namespace", 1)
1222 // w := GetRNibReader()
1223 // cell, err := w.GetCellById(entities.Cell_NR_CELL, "45d")
1226 // } else if cell != nil{
1227 // fmt.Printf("responding node type NR Cell: %v\n", cell.GetServedNrCell())
1231 //func TestGetListNbIdsInteg(t *testing.T) {
1232 // Init("e2Manager", 1)
1233 // w := GetRNibReader()
1234 // ids, err := w.GetListNodebIds()
1238 // for _, id := range ids{
1239 // fmt.Printf("#TestGetListGnbIdsInteg - NB ID: %s\n", id)
1244 //func TestGetRanLoadInformationInteg(t *testing.T){
1245 // Init("e2Manager", 1)
1246 // w := GetRNibReader()
1247 // ranLoadInformation, err := w.GetRanLoadInformation("ran_integ")
1249 // t.Errorf("#rNibReader_test.TestGetRanLoadInformationInteg - Failed to get RanLoadInformation entity. Error: %v", err)
1251 // assert.NotNil(t, ranLoadInformation)
1252 // fmt.Printf("#rNibReader_test.TestGetRanLoadInformationInteg - GNB ID: %s\n", ranLoadInformation)