package rNibWriter
import (
- "gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities"
"e2mgr/mocks"
- "gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/common"
"errors"
"fmt"
+ "gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/common"
+ "gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities"
"github.com/golang/protobuf/proto"
- "github.com/golang/protobuf/ptypes/timestamp"
"github.com/stretchr/testify/assert"
"testing"
"time"
setExpected = append(setExpected, fmt.Sprintf("PCI:%s:%02x", name, cell.GetPci()), cellData)
sdlInstanceMock.On("Set", []interface{}{setExpected}).Return(e)
+
+ nbIdData, err := proto.Marshal(&entities.NbIdentity{InventoryName: name})
+ if err != nil {
+ t.Errorf("#rNibWriter_test.TestSaveEnb - Failed to marshal nbIdentity entity. Error: %v", err)
+ }
+ sdlInstanceMock.On("RemoveMember", entities.Node_UNKNOWN.String(), []interface{}{nbIdData}).Return(e)
+
nbIdentity := &entities.NbIdentity{InventoryName:name, GlobalNbId:&entities.GlobalNbId{PlmnId:"02f829", NbId:"4a952a0a"}}
- nbIdData, err := proto.Marshal(nbIdentity)
+ nbIdData, err = proto.Marshal(nbIdentity)
if err != nil {
t.Errorf("#rNibWriter_test.TestSaveEnb - Failed to marshal NodeB Identity entity. Error: %v", err)
}
sdlInstanceMock.On("AddMember", "ENB", []interface{}{nbIdData}).Return(e)
+
rNibErr := w.SaveNodeb(nbIdentity, &nb)
assert.Nil(t, rNibErr)
}
}
sdlInstanceMock.On("AddMember", "GNB", []interface{}{nbIdData}).Return(e)
+ nbIdData, err = proto.Marshal(&entities.NbIdentity{InventoryName: name})
+ if err != nil {
+ t.Errorf("#rNibWriter_test.TestSaveEnb - Failed to marshal nbIdentity entity. Error: %v", err)
+ }
+ sdlInstanceMock.On("RemoveMember", entities.Node_UNKNOWN.String(), []interface{}{nbIdData}).Return(e)
+
rNibErr := w.SaveNodeb(nbIdentity, &nb)
assert.Nil(t, rNibErr)
}
EnhancedRntp: &entities.EnhancedRntp{
EnhancedRntpBitmap:"xxx",
RntpHighPowerThreshold:entities.RntpThreshold_NEG_2,
- EnhancedRntpStartTimes: []*entities.StartTime{&entities.StartTime{StartSfn:500,StartSubframeNumber:5}},
+ EnhancedRntpStartTime: &entities.StartTime{StartSfn:500,StartSubframeNumber:5},
},
}
cellLoadInformation.CompInformation = &entities.CompInformation{
CompInformationItems:[]*entities.CompInformationItem{compInformationItem},
- CompInformationStartTime:[]*entities.StartTime{&entities.StartTime{StartSfn:123,StartSubframeNumber:456}},
+ CompInformationStartTime:&entities.StartTime{StartSfn:123,StartSubframeNumber:456},
}
cellLoadInformation.DynamicDlTransmissionInformation = &entities.DynamicDlTransmissionInformation{
func generateRanLoadInformation() *entities.RanLoadInformation {
ranLoadInformation := entities.RanLoadInformation{}
- ranLoadInformation.LoadTimestamp = ×tamp.Timestamp{Seconds:time.Now().Unix(),Nanos: int32(time.Now().UnixNano())}
+ ranLoadInformation.LoadTimestamp = uint64(time.Now().UnixNano())
cellLoadInformation := generateCellLoadInformation()
//Integration tests
//
-//func TestSaveEnbInteg(t *testing.T){
+//func TestSaveEnbGnbInteg(t *testing.T){
// for i := 0; i<10; i++{
// Init("e2Manager", 1)
// w := GetRNibWriter()
//
// nb1 := entities.NodebInfo{}
// nb1.NodeType = entities.Node_GNB
-// nb.ConnectionStatus = entities.ConnectionStatus_CONNECTED
+// nb1.ConnectionStatus = entities.ConnectionStatus_CONNECTED
// nb1.Ip = "localhost"
// nb1.Port = uint32(6565 + i)
// gnb := entities.Gnb{}
// }
// }
//}
-
+//
+//func TestSaveNbRanNamesInteg(t *testing.T){
+// for i := 0; i<10; i++{
+// Init("e2Manager", 1)
+// w := GetRNibWriter()
+// nb := entities.NodebInfo{}
+// nb.ConnectionStatus = entities.ConnectionStatus_CONNECTING
+// nb.Ip = "localhost"
+// nb.Port = uint32(5656 + i)
+// nbIdentity := &entities.NbIdentity{InventoryName: fmt.Sprintf("nameOnly%d" ,i)}
+// err := w.SaveNodeb(nbIdentity, &nb)
+// if err != nil{
+// t.Errorf("#rNibWriter_test.TestSaveEnbInteg - Failed to save NodeB entity. Error: %v", err)
+// }
+// }
+//}
+//
//func TestSaveRanLoadInformationInteg(t *testing.T){
// Init("e2Manager", 1)
// w := GetRNibWriter()