sync R3 content from Azure
[ric-plt/e2mgr.git] / E2Manager / rNibWriter / rNibWriter_test.go
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.
16 //
17
18 package rNibWriter
19
20 import (
21         "e2mgr/mocks"
22         "errors"
23         "fmt"
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/stretchr/testify/assert"
28         "testing"
29         "time"
30 )
31
32 func initSdlInstanceMock(namespace string) (w RNibWriter, sdlInstanceMock *mocks.MockSdlInstance) {
33         sdlInstanceMock = new(mocks.MockSdlInstance)
34         w = GetRNibWriter(sdlInstanceMock)
35         return
36 }
37
38 var namespace = "namespace"
39
40 func TestUpdateNodebInfoSuccess(t *testing.T) {
41         inventoryName := "name"
42         plmnId := "02f829"
43         nbId := "4a952a0a"
44         w, sdlInstanceMock := initSdlInstanceMock(namespace)
45         nodebInfo := &entities.NodebInfo{}
46         nodebInfo.RanName = inventoryName
47         nodebInfo.GlobalNbId = &entities.GlobalNbId{PlmnId: plmnId, NbId: nbId}
48         nodebInfo.NodeType = entities.Node_ENB
49         nodebInfo.ConnectionStatus = 1
50         enb := entities.Enb{}
51         nodebInfo.Configuration = &entities.NodebInfo_Enb{Enb: &enb}
52         data, err := proto.Marshal(nodebInfo)
53         if err != nil {
54                 t.Errorf("#rNibWriter_test.TestSaveEnb - Failed to marshal NodeB entity. Error: %v", err)
55         }
56         var e error
57         var setExpected []interface{}
58
59         nodebNameKey := fmt.Sprintf("RAN:%s", inventoryName)
60         nodebIdKey := fmt.Sprintf("ENB:%s:%s", plmnId, nbId)
61         setExpected = append(setExpected, nodebNameKey, data)
62         setExpected = append(setExpected, nodebIdKey, data)
63
64         sdlInstanceMock.On("Set", []interface{}{setExpected}).Return(e)
65
66         rNibErr := w.UpdateNodebInfo(nodebInfo)
67         assert.Nil(t, rNibErr)
68 }
69
70 func TestUpdateNodebInfoMissingInventoryNameFailure(t *testing.T) {
71         inventoryName := "name"
72         plmnId := "02f829"
73         nbId := "4a952a0a"
74         w, sdlInstanceMock := initSdlInstanceMock(namespace)
75         nodebInfo := &entities.NodebInfo{}
76         data, err := proto.Marshal(nodebInfo)
77         if err != nil {
78                 t.Errorf("#rNibWriter_test.TestSaveEnb - Failed to marshal NodeB entity. Error: %v", err)
79         }
80         var e error
81         var setExpected []interface{}
82
83         nodebNameKey := fmt.Sprintf("RAN:%s", inventoryName)
84         nodebIdKey := fmt.Sprintf("ENB:%s:%s", plmnId, nbId)
85         setExpected = append(setExpected, nodebNameKey, data)
86         setExpected = append(setExpected, nodebIdKey, data)
87
88         sdlInstanceMock.On("Set", []interface{}{setExpected}).Return(e)
89
90         rNibErr := w.UpdateNodebInfo(nodebInfo)
91
92         assert.NotNil(t, rNibErr)
93         assert.IsType(t, &common.ValidationError{}, rNibErr)
94 }
95
96 func TestUpdateNodebInfoMissingGlobalNbId(t *testing.T) {
97         inventoryName := "name"
98         w, sdlInstanceMock := initSdlInstanceMock(namespace)
99         nodebInfo := &entities.NodebInfo{}
100         nodebInfo.RanName = inventoryName
101         data, err := proto.Marshal(nodebInfo)
102         if err != nil {
103                 t.Errorf("#rNibWriter_test.TestSaveEnb - Failed to marshal NodeB entity. Error: %v", err)
104         }
105         var e error
106         var setExpected []interface{}
107
108         nodebNameKey := fmt.Sprintf("RAN:%s", inventoryName)
109         setExpected = append(setExpected, nodebNameKey, data)
110         sdlInstanceMock.On("Set", []interface{}{setExpected}).Return(e)
111
112         rNibErr := w.UpdateNodebInfo(nodebInfo)
113
114         assert.Nil(t, rNibErr)
115 }
116
117 func TestSaveEnb(t *testing.T) {
118         name := "name"
119         ranName := "RAN:" + name
120         w, sdlInstanceMock := initSdlInstanceMock(namespace)
121         nb := entities.NodebInfo{}
122         nb.NodeType = entities.Node_ENB
123         nb.ConnectionStatus = 1
124         nb.Ip = "localhost"
125         nb.Port = 5656
126         enb := entities.Enb{}
127         cell := &entities.ServedCellInfo{CellId: "aaff", Pci: 3}
128         cellEntity := entities.Cell{Type: entities.Cell_LTE_CELL, Cell: &entities.Cell_ServedCellInfo{ServedCellInfo: cell}}
129         enb.ServedCells = []*entities.ServedCellInfo{cell}
130         nb.Configuration = &entities.NodebInfo_Enb{Enb: &enb}
131         data, err := proto.Marshal(&nb)
132         if err != nil {
133                 t.Errorf("#rNibWriter_test.TestSaveEnb - Failed to marshal NodeB entity. Error: %v", err)
134         }
135         var e error
136
137         cellData, err := proto.Marshal(&cellEntity)
138         if err != nil {
139                 t.Errorf("#rNibWriter_test.TestSaveEnb - Failed to marshal Cell entity. Error: %v", err)
140         }
141         var setExpected []interface{}
142         setExpected = append(setExpected, ranName, data)
143         setExpected = append(setExpected, "ENB:02f829:4a952a0a", data)
144         setExpected = append(setExpected, fmt.Sprintf("CELL:%s", cell.GetCellId()), cellData)
145         setExpected = append(setExpected, fmt.Sprintf("PCI:%s:%02x", name, cell.GetPci()), cellData)
146
147         sdlInstanceMock.On("Set", []interface{}{setExpected}).Return(e)
148
149         nbIdData, err := proto.Marshal(&entities.NbIdentity{InventoryName: name})
150         if err != nil {
151                 t.Errorf("#rNibWriter_test.TestSaveEnb - Failed to marshal nbIdentity entity. Error: %v", err)
152         }
153         sdlInstanceMock.On("RemoveMember", entities.Node_UNKNOWN.String(), []interface{}{nbIdData}).Return(e)
154
155         nbIdentity := &entities.NbIdentity{InventoryName: name, GlobalNbId: &entities.GlobalNbId{PlmnId: "02f829", NbId: "4a952a0a"}}
156         nbIdData, err = proto.Marshal(nbIdentity)
157         if err != nil {
158                 t.Errorf("#rNibWriter_test.TestSaveEnb - Failed to marshal NodeB Identity entity. Error: %v", err)
159         }
160         sdlInstanceMock.On("AddMember", "ENB", []interface{}{nbIdData}).Return(e)
161
162         rNibErr := w.SaveNodeb(nbIdentity, &nb)
163         assert.Nil(t, rNibErr)
164 }
165
166 func TestSaveEnbCellIdValidationFailure(t *testing.T) {
167         name := "name"
168         w, _ := initSdlInstanceMock(namespace)
169         nb := entities.NodebInfo{}
170         nb.NodeType = entities.Node_ENB
171         nb.ConnectionStatus = 1
172         nb.Ip = "localhost"
173         nb.Port = 5656
174         enb := entities.Enb{}
175         cell := &entities.ServedCellInfo{Pci: 3}
176         enb.ServedCells = []*entities.ServedCellInfo{cell}
177         nb.Configuration = &entities.NodebInfo_Enb{Enb: &enb}
178
179         nbIdentity := &entities.NbIdentity{InventoryName: name, GlobalNbId: &entities.GlobalNbId{PlmnId: "02f829", NbId: "4a952a0a"}}
180         rNibErr := w.SaveNodeb(nbIdentity, &nb)
181         assert.NotNil(t, rNibErr)
182         assert.IsType(t, &common.ValidationError{}, rNibErr)
183         assert.Equal(t, "#utils.ValidateAndBuildCellIdKey - an empty cell id received", rNibErr.Error())
184 }
185
186 func TestSaveEnbInventoryNameValidationFailure(t *testing.T) {
187         w, _ := initSdlInstanceMock(namespace)
188         nb := entities.NodebInfo{}
189         nb.NodeType = entities.Node_ENB
190         nb.ConnectionStatus = 1
191         nb.Ip = "localhost"
192         nb.Port = 5656
193         enb := entities.Enb{}
194         cell := &entities.ServedCellInfo{CellId: "aaa", Pci: 3}
195         enb.ServedCells = []*entities.ServedCellInfo{cell}
196         nb.Configuration = &entities.NodebInfo_Enb{Enb: &enb}
197
198         nbIdentity := &entities.NbIdentity{InventoryName: "", GlobalNbId: &entities.GlobalNbId{PlmnId: "02f829", NbId: "4a952a0a"}}
199         rNibErr := w.SaveNodeb(nbIdentity, &nb)
200         assert.NotNil(t, rNibErr)
201         assert.IsType(t, &common.ValidationError{}, rNibErr)
202         assert.Equal(t, "#utils.ValidateAndBuildNodeBNameKey - an empty inventory name received", rNibErr.Error())
203 }
204
205 func TestSaveGnbCellIdValidationFailure(t *testing.T) {
206         name := "name"
207         w, _ := initSdlInstanceMock(namespace)
208         nb := entities.NodebInfo{}
209         nb.NodeType = entities.Node_GNB
210         nb.ConnectionStatus = 1
211         nb.Ip = "localhost"
212         nb.Port = 5656
213         gnb := entities.Gnb{}
214         cellInfo := &entities.ServedNRCellInformation{NrPci: 2}
215         cell := &entities.ServedNRCell{ServedNrCellInformation: cellInfo}
216         gnb.ServedNrCells = []*entities.ServedNRCell{cell}
217         nb.Configuration = &entities.NodebInfo_Gnb{Gnb: &gnb}
218
219         nbIdentity := &entities.NbIdentity{InventoryName: name, GlobalNbId: &entities.GlobalNbId{PlmnId: "02f829", NbId: "4a952a0a"}}
220         rNibErr := w.SaveNodeb(nbIdentity, &nb)
221         assert.NotNil(t, rNibErr)
222         assert.IsType(t, &common.ValidationError{}, rNibErr)
223         assert.Equal(t, "#utils.ValidateAndBuildNrCellIdKey - an empty cell id received", rNibErr.Error())
224 }
225
226 func TestSaveGnb(t *testing.T) {
227         name := "name"
228         ranName := "RAN:" + name
229         w, sdlInstanceMock := initSdlInstanceMock(namespace)
230         nb := entities.NodebInfo{}
231         nb.NodeType = entities.Node_GNB
232         nb.ConnectionStatus = 1
233         nb.Ip = "localhost"
234         nb.Port = 5656
235         gnb := entities.Gnb{}
236         cellInfo := &entities.ServedNRCellInformation{NrPci: 2, CellId: "ccdd"}
237         cell := &entities.ServedNRCell{ServedNrCellInformation: cellInfo}
238         cellEntity := entities.Cell{Type: entities.Cell_NR_CELL, Cell: &entities.Cell_ServedNrCell{ServedNrCell: cell}}
239         gnb.ServedNrCells = []*entities.ServedNRCell{cell}
240         nb.Configuration = &entities.NodebInfo_Gnb{Gnb: &gnb}
241         data, err := proto.Marshal(&nb)
242         if err != nil {
243                 t.Errorf("#rNibWriter_test.TestSaveGnb - Failed to marshal NodeB entity. Error: %v", err)
244         }
245         var e error
246
247         cellData, err := proto.Marshal(&cellEntity)
248         if err != nil {
249                 t.Errorf("#rNibWriter_test.TestSaveGnb - Failed to marshal Cell entity. Error: %v", err)
250         }
251         var setExpected []interface{}
252         setExpected = append(setExpected, ranName, data)
253         setExpected = append(setExpected, "GNB:02f829:4a952a0a", data)
254         setExpected = append(setExpected, fmt.Sprintf("NRCELL:%s", cell.GetServedNrCellInformation().GetCellId()), cellData)
255         setExpected = append(setExpected, fmt.Sprintf("PCI:%s:%02x", name, cell.GetServedNrCellInformation().GetNrPci()), cellData)
256
257         sdlInstanceMock.On("Set", []interface{}{setExpected}).Return(e)
258         nbIdentity := &entities.NbIdentity{InventoryName: name, GlobalNbId: &entities.GlobalNbId{PlmnId: "02f829", NbId: "4a952a0a"}}
259         nbIdData, err := proto.Marshal(nbIdentity)
260         if err != nil {
261                 t.Errorf("#rNibWriter_test.TestSaveGnb - Failed to marshal NodeB Identity entity. Error: %v", err)
262         }
263         sdlInstanceMock.On("AddMember", "GNB", []interface{}{nbIdData}).Return(e)
264
265         nbIdData, err = proto.Marshal(&entities.NbIdentity{InventoryName: name})
266         if err != nil {
267                 t.Errorf("#rNibWriter_test.TestSaveEnb - Failed to marshal nbIdentity entity. Error: %v", err)
268         }
269         sdlInstanceMock.On("RemoveMember", entities.Node_UNKNOWN.String(), []interface{}{nbIdData}).Return(e)
270
271         rNibErr := w.SaveNodeb(nbIdentity, &nb)
272         assert.Nil(t, rNibErr)
273 }
274
275 func TestSaveRanLoadInformationSuccess(t *testing.T) {
276         inventoryName := "name"
277         loadKey, validationErr := common.ValidateAndBuildRanLoadInformationKey(inventoryName)
278
279         if validationErr != nil {
280                 t.Errorf("#rNibWriter_test.TestSaveRanLoadInformationSuccess - Failed to build ran load infromation key. Error: %v", validationErr)
281         }
282
283         w, sdlInstanceMock := initSdlInstanceMock(namespace)
284
285         ranLoadInformation := generateRanLoadInformation()
286         data, err := proto.Marshal(ranLoadInformation)
287
288         if err != nil {
289                 t.Errorf("#rNibWriter_test.TestSaveRanLoadInformation - Failed to marshal RanLoadInformation entity. Error: %v", err)
290         }
291
292         var e error
293         var setExpected []interface{}
294         setExpected = append(setExpected, loadKey, data)
295         sdlInstanceMock.On("Set", []interface{}{setExpected}).Return(e)
296
297         rNibErr := w.SaveRanLoadInformation(inventoryName, ranLoadInformation)
298         assert.Nil(t, rNibErr)
299 }
300
301 func TestSaveRanLoadInformationMarshalNilFailure(t *testing.T) {
302         inventoryName := "name2"
303         w, _ := initSdlInstanceMock(namespace)
304
305         expectedErr := common.NewInternalError(errors.New("proto: Marshal called with nil"))
306         err := w.SaveRanLoadInformation(inventoryName, nil)
307         assert.Equal(t, expectedErr, err)
308 }
309
310 func TestSaveRanLoadInformationEmptyInventoryNameFailure(t *testing.T) {
311         inventoryName := ""
312         w, _ := initSdlInstanceMock(namespace)
313
314         err := w.SaveRanLoadInformation(inventoryName, nil)
315         assert.NotNil(t, err)
316         assert.IsType(t, &common.ValidationError{}, err)
317 }
318
319 func TestSaveRanLoadInformationSdlFailure(t *testing.T) {
320         inventoryName := "name2"
321
322         loadKey, validationErr := common.ValidateAndBuildRanLoadInformationKey(inventoryName)
323
324         if validationErr != nil {
325                 t.Errorf("#rNibWriter_test.TestSaveRanLoadInformationSuccess - Failed to build ran load infromation key. Error: %v", validationErr)
326         }
327
328         w, sdlInstanceMock := initSdlInstanceMock(namespace)
329
330         ranLoadInformation := generateRanLoadInformation()
331         data, err := proto.Marshal(ranLoadInformation)
332
333         if err != nil {
334                 t.Errorf("#rNibWriter_test.TestSaveRanLoadInformation - Failed to marshal RanLoadInformation entity. Error: %v", err)
335         }
336
337         expectedErr := errors.New("expected error")
338         var setExpected []interface{}
339         setExpected = append(setExpected, loadKey, data)
340         sdlInstanceMock.On("Set", []interface{}{setExpected}).Return(expectedErr)
341
342         rNibErr := w.SaveRanLoadInformation(inventoryName, ranLoadInformation)
343         assert.NotNil(t, rNibErr)
344         assert.IsType(t, &common.InternalError{}, rNibErr)
345 }
346
347 func generateCellLoadInformation() *entities.CellLoadInformation {
348         cellLoadInformation := entities.CellLoadInformation{}
349
350         cellLoadInformation.CellId = "123"
351
352         ulInterferenceOverloadIndication := entities.UlInterferenceOverloadIndication_HIGH_INTERFERENCE
353         cellLoadInformation.UlInterferenceOverloadIndications = []entities.UlInterferenceOverloadIndication{ulInterferenceOverloadIndication}
354
355         ulHighInterferenceInformation := entities.UlHighInterferenceInformation{
356                 TargetCellId:                 "456",
357                 UlHighInterferenceIndication: "xxx",
358         }
359
360         cellLoadInformation.UlHighInterferenceInfos = []*entities.UlHighInterferenceInformation{&ulHighInterferenceInformation}
361
362         cellLoadInformation.RelativeNarrowbandTxPower = &entities.RelativeNarrowbandTxPower{
363                 RntpPerPrb:                       "xxx",
364                 RntpThreshold:                    entities.RntpThreshold_NEG_4,
365                 NumberOfCellSpecificAntennaPorts: entities.NumberOfCellSpecificAntennaPorts_V1_ANT_PRT,
366                 PB:                               1,
367                 PdcchInterferenceImpact:          2,
368                 EnhancedRntp: &entities.EnhancedRntp{
369                         EnhancedRntpBitmap:     "xxx",
370                         RntpHighPowerThreshold: entities.RntpThreshold_NEG_2,
371                         EnhancedRntpStartTime:  &entities.StartTime{StartSfn: 500, StartSubframeNumber: 5},
372                 },
373         }
374
375         cellLoadInformation.AbsInformation = &entities.AbsInformation{
376                 Mode:                             entities.AbsInformationMode_ABS_INFO_FDD,
377                 AbsPatternInfo:                   "xxx",
378                 NumberOfCellSpecificAntennaPorts: entities.NumberOfCellSpecificAntennaPorts_V2_ANT_PRT,
379                 MeasurementSubset:                "xxx",
380         }
381
382         cellLoadInformation.InvokeIndication = entities.InvokeIndication_ABS_INFORMATION
383
384         cellLoadInformation.ExtendedUlInterferenceOverloadInfo = &entities.ExtendedUlInterferenceOverloadInfo{
385                 AssociatedSubframes:                       "xxx",
386                 ExtendedUlInterferenceOverloadIndications: cellLoadInformation.UlInterferenceOverloadIndications,
387         }
388
389         compInformationItem := &entities.CompInformationItem{
390                 CompHypothesisSets: []*entities.CompHypothesisSet{&entities.CompHypothesisSet{CellId: "789", CompHypothesis: "xxx"}},
391                 BenefitMetric:      50,
392         }
393
394         cellLoadInformation.CompInformation = &entities.CompInformation{
395                 CompInformationItems:     []*entities.CompInformationItem{compInformationItem},
396                 CompInformationStartTime: &entities.StartTime{StartSfn: 123, StartSubframeNumber: 456},
397         }
398
399         cellLoadInformation.DynamicDlTransmissionInformation = &entities.DynamicDlTransmissionInformation{
400                 State:             entities.NaicsState_NAICS_ACTIVE,
401                 TransmissionModes: "xxx",
402                 PB:                2,
403                 PAList:            []entities.PA{entities.PA_DB_NEG_3},
404         }
405
406         return &cellLoadInformation
407 }
408
409 func generateRanLoadInformation() *entities.RanLoadInformation {
410         ranLoadInformation := entities.RanLoadInformation{}
411
412         ranLoadInformation.LoadTimestamp = uint64(time.Now().UnixNano())
413
414         cellLoadInformation := generateCellLoadInformation()
415         ranLoadInformation.CellLoadInfos = []*entities.CellLoadInformation{cellLoadInformation}
416
417         return &ranLoadInformation
418 }
419
420 func TestSaveNilEntityFailure(t *testing.T) {
421         w, _ := initSdlInstanceMock(namespace)
422         expectedErr := common.NewInternalError(errors.New("proto: Marshal called with nil"))
423         nbIdentity := &entities.NbIdentity{}
424         actualErr := w.SaveNodeb(nbIdentity, nil)
425         assert.Equal(t, expectedErr, actualErr)
426 }
427
428 func TestSaveUnknownTypeEntityFailure(t *testing.T) {
429         w, _ := initSdlInstanceMock(namespace)
430         expectedErr := common.NewValidationError("#rNibWriter.saveNodeB - Unknown responding node type, entity: ip:\"localhost\" port:5656 ")
431         nbIdentity := &entities.NbIdentity{InventoryName: "name", GlobalNbId: &entities.GlobalNbId{PlmnId: "02f829", NbId: "4a952a0a"}}
432         nb := &entities.NodebInfo{}
433         nb.Port = 5656
434         nb.Ip = "localhost"
435         actualErr := w.SaveNodeb(nbIdentity, nb)
436         assert.Equal(t, expectedErr, actualErr)
437 }
438
439 func TestSaveEntityFailure(t *testing.T) {
440         name := "name"
441         plmnId := "02f829"
442         nbId := "4a952a0a"
443
444         w, sdlInstanceMock := initSdlInstanceMock(namespace)
445         gnb := entities.NodebInfo{}
446         gnb.NodeType = entities.Node_GNB
447         data, err := proto.Marshal(&gnb)
448         if err != nil {
449                 t.Errorf("#rNibWriter_test.TestSaveEntityFailure - Failed to marshal NodeB entity. Error: %v", err)
450         }
451         nbIdentity := &entities.NbIdentity{InventoryName: name, GlobalNbId: &entities.GlobalNbId{PlmnId: plmnId, NbId: nbId}}
452         setExpected := []interface{}{"RAN:" + name, data}
453         setExpected = append(setExpected, "GNB:"+plmnId+":"+nbId, data)
454         expectedErr := errors.New("expected error")
455         sdlInstanceMock.On("Set", []interface{}{setExpected}).Return(expectedErr)
456         rNibErr := w.SaveNodeb(nbIdentity, &gnb)
457         assert.NotEmpty(t, rNibErr)
458 }
459
460 func TestGetRNibWriter(t *testing.T) {
461         received, _ := initSdlInstanceMock(namespace)
462         assert.NotEmpty(t, received)
463 }
464
465 //Integration tests
466 //
467 //func TestSaveEnbGnbInteg(t *testing.T){
468 //      for i := 0; i<10; i++{
469 //              Init("e2Manager", 1)
470 //              w := GetRNibWriter()
471 //              nb := entities.NodebInfo{}
472 //              nb.NodeType = entities.Node_ENB
473 //              nb.ConnectionStatus = entities.ConnectionStatus_CONNECTED
474 //              nb.Ip = "localhost"
475 //              nb.Port = uint32(5656 + i)
476 //              enb := entities.Enb{}
477 //              cell1 := &entities.ServedCellInfo{CellId:fmt.Sprintf("%02x",111 + i), Pci:uint32(11 + i)}
478 //              cell2 := &entities.ServedCellInfo{CellId:fmt.Sprintf("%02x",222 + i), Pci:uint32(22 + i)}
479 //              cell3 := &entities.ServedCellInfo{CellId:fmt.Sprintf("%02x",333 + i), Pci:uint32(33 + i)}
480 //              enb.ServedCells = []*entities.ServedCellInfo{cell1, cell2, cell3}
481 //              nb.Configuration = &entities.NodebInfo_Enb{Enb:&enb}
482 //              plmnId := 0x02f828
483 //              nbId := 0x4a952a0a
484 //              nbIdentity := &entities.NbIdentity{InventoryName: fmt.Sprintf("nameEnb%d" ,i), GlobalNbId:&entities.GlobalNbId{PlmnId:fmt.Sprintf("%02x", plmnId + i), NbId:fmt.Sprintf("%02x", nbId + i)}}
485 //              err := w.SaveNodeb(nbIdentity, &nb)
486 //              if err != nil{
487 //                      t.Errorf("#rNibWriter_test.TestSaveEnbInteg - Failed to save NodeB entity. Error: %v", err)
488 //              }
489 //
490 //              nb1 := entities.NodebInfo{}
491 //              nb1.NodeType = entities.Node_GNB
492 //              nb1.ConnectionStatus = entities.ConnectionStatus_CONNECTED
493 //              nb1.Ip = "localhost"
494 //              nb1.Port =  uint32(6565 + i)
495 //              gnb := entities.Gnb{}
496 //              gCell1 := &entities.ServedNRCell{ServedNrCellInformation:&entities.ServedNRCellInformation{CellId:fmt.Sprintf("%02x",1111 + i), NrPci:uint32(1 + i)}}
497 //              gCell2 := &entities.ServedNRCell{ServedNrCellInformation:&entities.ServedNRCellInformation{CellId:fmt.Sprintf("%02x",2222 + i), NrPci:uint32(2 + i)}}
498 //              gCell3 := &entities.ServedNRCell{ServedNrCellInformation:&entities.ServedNRCellInformation{CellId:fmt.Sprintf("%02x",3333 + i), NrPci:uint32(3 + i)}}
499 //              gnb.ServedNrCells = []*entities.ServedNRCell{gCell1, gCell2, gCell3,}
500 //              nb1.Configuration = &entities.NodebInfo_Gnb{Gnb:&gnb}
501 //              nbIdentity = &entities.NbIdentity{InventoryName: fmt.Sprintf("nameGnb%d" ,i), GlobalNbId:&entities.GlobalNbId{PlmnId:fmt.Sprintf("%02x", plmnId - i), NbId:fmt.Sprintf("%02x", nbId - i)}}
502 //              err = w.SaveNodeb(nbIdentity, &nb1)
503 //              if err != nil{
504 //                      t.Errorf("#rNibWriter_test.TestSaveEnbInteg - Failed to save NodeB entity. Error: %v", err)
505 //              }
506 //      }
507 //}
508 //
509 //func TestSaveNbRanNamesInteg(t *testing.T){
510 //      for i := 0; i<10; i++{
511 //              Init("e2Manager", 1)
512 //              w := GetRNibWriter()
513 //              nb := entities.NodebInfo{}
514 //              nb.ConnectionStatus = entities.ConnectionStatus_CONNECTING
515 //              nb.Ip = "localhost"
516 //              nb.Port = uint32(5656 + i)
517 //              nbIdentity := &entities.NbIdentity{InventoryName: fmt.Sprintf("nameOnly%d" ,i)}
518 //              err := w.SaveNodeb(nbIdentity, &nb)
519 //              if err != nil{
520 //                      t.Errorf("#rNibWriter_test.TestSaveEnbInteg - Failed to save NodeB entity. Error: %v", err)
521 //              }
522 //      }
523 //}
524 //
525 //func TestSaveRanLoadInformationInteg(t *testing.T){
526 //              Init("e2Manager", 1)
527 //              w := GetRNibWriter()
528 //              ranLoadInformation := generateRanLoadInformation()
529 //              err := w.SaveRanLoadInformation("ran_integ", ranLoadInformation)
530 //              if err != nil{
531 //                      t.Errorf("#rNibWriter_test.TestSaveRanLoadInformationInteg - Failed to save RanLoadInformation entity. Error: %v", err)
532 //              }
533 //}