+func TestGetRanLoadInformationUnmarshalFailure(t *testing.T) {
+ name := "name"
+ readerPool = nil
+ sdlInstanceMock := initSdlInstanceMock(namespace, 1)
+ w := &rNibReaderInstance{}
+ var e error
+ ret := make(map[string]interface{}, 1)
+ redisKey, rNibErr := common.ValidateAndBuildRanLoadInformationKey(name)
+ if rNibErr != nil {
+ t.Errorf("#rNibReader_test.TestGetRanLoadInformationUnmarshalFailure - failed to validate key parameter")
+ }
+ ret[redisKey] = "data"
+ sdlInstanceMock.On("Get", []string{redisKey}).Return(ret, e)
+ getNb, er := w.GetRanLoadInformation(name)
+ assert.NotNil(t, er)
+ assert.Nil(t, getNb)
+ assert.IsType(t, &common.InternalError{}, er)
+ assert.EqualValues(t, "proto: can't skip unknown wire type 4", er.Error())
+}
+
+func TestGetRanLoadInformationSdlgoFailure(t *testing.T) {
+ name := "name"
+ errMsg := "expected Sdlgo error"
+ errMsgExpected := "expected Sdlgo error"
+ readerPool = nil
+ sdlInstanceMock := initSdlInstanceMock(namespace, 1)
+ w := &rNibReaderInstance{}
+ e := errors.New(errMsg)
+ var ret map[string]interface{}
+ redisKey, rNibErr := common.ValidateAndBuildRanLoadInformationKey(name)
+ if rNibErr != nil {
+ t.Errorf("#rNibReader_test.TestGetRanLoadInformationSdlgoFailure - failed to validate key parameter")
+ }
+ sdlInstanceMock.On("Get", []string{redisKey}).Return(ret, e)
+ getNb, er := w.GetRanLoadInformation(name)
+ assert.NotNil(t, er)
+ assert.Nil(t, getNb)
+ assert.IsType(t, &common.InternalError{}, er)
+ assert.EqualValues(t, errMsgExpected, er.Error())
+}
+
+func generateCellLoadInformation() *entities.CellLoadInformation {
+ cellLoadInformation := entities.CellLoadInformation{}
+
+ cellLoadInformation.CellId = "123"
+
+ ulInterferenceOverloadIndication := entities.UlInterferenceOverloadIndication_HIGH_INTERFERENCE
+ cellLoadInformation.UlInterferenceOverloadIndications = []entities.UlInterferenceOverloadIndication{ulInterferenceOverloadIndication}
+
+ ulHighInterferenceInformation := entities.UlHighInterferenceInformation{
+ TargetCellId:"456",
+ UlHighInterferenceIndication:"xxx",
+ }
+
+ cellLoadInformation.UlHighInterferenceInfos = []*entities.UlHighInterferenceInformation{&ulHighInterferenceInformation }
+
+ cellLoadInformation.RelativeNarrowbandTxPower = &entities.RelativeNarrowbandTxPower{
+ RntpPerPrb:"xxx",
+ RntpThreshold:entities.RntpThreshold_NEG_4,
+ NumberOfCellSpecificAntennaPorts: entities.NumberOfCellSpecificAntennaPorts_V1_ANT_PRT,
+ PB: 1,
+ PdcchInterferenceImpact:2,
+ EnhancedRntp: &entities.EnhancedRntp{
+ EnhancedRntpBitmap:"xxx",
+ RntpHighPowerThreshold:entities.RntpThreshold_NEG_2,
+ EnhancedRntpStartTime: &entities.StartTime{StartSfn:500,StartSubframeNumber:5},
+ },
+ }
+
+ cellLoadInformation.AbsInformation = &entities.AbsInformation{
+ Mode: entities.AbsInformationMode_ABS_INFO_FDD,
+ AbsPatternInfo:"xxx",
+ NumberOfCellSpecificAntennaPorts:entities.NumberOfCellSpecificAntennaPorts_V2_ANT_PRT,
+ MeasurementSubset:"xxx",
+ }
+
+ cellLoadInformation.InvokeIndication = entities.InvokeIndication_ABS_INFORMATION
+
+ cellLoadInformation.ExtendedUlInterferenceOverloadInfo = &entities.ExtendedUlInterferenceOverloadInfo{
+ AssociatedSubframes:"xxx",
+ ExtendedUlInterferenceOverloadIndications:cellLoadInformation.UlInterferenceOverloadIndications,
+ }
+
+ compInformationItem := &entities.CompInformationItem{
+ CompHypothesisSets: []*entities.CompHypothesisSet{{CellId: "789", CompHypothesis: "xxx"}},
+ BenefitMetric:50,
+ }
+
+ cellLoadInformation.CompInformation = &entities.CompInformation{
+ CompInformationItems:[]*entities.CompInformationItem{compInformationItem},
+ CompInformationStartTime:&entities.StartTime{StartSfn:123,StartSubframeNumber:456},
+ }
+
+ cellLoadInformation.DynamicDlTransmissionInformation = &entities.DynamicDlTransmissionInformation{
+ State: entities.NaicsState_NAICS_ACTIVE,
+ TransmissionModes:"xxx",
+ PB: 2,
+ PAList:[]entities.PA{entities.PA_DB_NEG_3},
+ }
+
+ return &cellLoadInformation
+}
+
+func generateRanLoadInformation() *entities.RanLoadInformation {
+ ranLoadInformation := entities.RanLoadInformation{}
+
+ ranLoadInformation.LoadTimestamp = uint64(time.Now().UnixNano())
+
+ cellLoadInformation := generateCellLoadInformation()
+ ranLoadInformation.CellLoadInfos = []*entities.CellLoadInformation{cellLoadInformation}
+
+ return &ranLoadInformation
+}
+
+//integration tests
+//