1 /*******************************************************************************
3 * Copyright (c) 2019 AT&T Intellectual Property.
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 *******************************************************************************/
21 "gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities"
25 Test permutations of eNB Load Information to protobuf
28 type LoadInformationTestCaseName string
30 const LoadTimestamp = 1257894000000000000
33 SingleCellWithCellIdOnly LoadInformationTestCaseName = "SINGLE CELL WITH CELL ID ONLY" //base
34 SingleCellPartiallyPopulated LoadInformationTestCaseName = "SINGLE CELL PARTIALLY POPULATED" //8
35 TwoCellsFullInfo LoadInformationTestCaseName = "TWO CELLS FULLY POPULATED" //13
38 type LoadInformationTestCase struct {
39 loadInformationTestCaseName LoadInformationTestCaseName
42 expectedLoadInformation *entities.RanLoadInformation
45 var testCases = []LoadInformationTestCase{
47 loadInformationTestCaseName: SingleCellWithCellIdOnly,
48 packedAperPdu: "000240140000010006400d00000740080002f8290007ab50",
49 packedUperPdu: "004898000400190d0000074200017c148003d5a80000",
50 expectedLoadInformation: GenerateSingleCellWithCellIdOnlyRanLoadInformation(),
53 loadInformationTestCaseName: SingleCellPartiallyPopulated,
54 packedAperPdu: "", //TODO: populate and USE
55 packedUperPdu: "004b380004001961000007571e017c148003d5a8205000017c180003d5a875555003331420008007a85801f07c1f07c41f07c1e07801f2020000c680b0003220664102800d8908020000be0c4001ead4016e007ab50100002f8320067ab5005b8c1ead5070190c000000",
56 expectedLoadInformation: GenerateSingleCellPartiallyPopulatedLoadInformation(),
59 loadInformationTestCaseName: TwoCellsFullInfo,
60 packedAperPdu: "", //TODO: populate and USE
61 packedUperPdu: "004c07080004001980da0100075bde017c148003d5a8205000017c180003d5a875555403331420000012883a0003547400cd20002801ea16007c1f07c1f107c1f0781e007c80800031a02c000c88199040a00352083669190000d8908020000be0c4001ead4016e007ab50100002f8320067ab5005b8c1ead5070190c00001d637805f220000f56a081400005f020000f56a1d555400ccc508002801ea16007c1f07c1f107c1f0781e007c80800031a02c000c88199040a00352083669190000d8908020000be044001ead4016e007ab50100002f8120067ab5005b8c1ead5070190c00000",
62 expectedLoadInformation: GenerateTwoCellsFullyPopulatedRanLoadInformation(),
66 //func TestExtractAndBuildRanLoadInformation(t *testing.T) {
67 // logger, _ := logger.InitLogger(logger.InfoLevel)
69 // for _, tc := range testCases {
70 // t.Run(string(tc.loadInformationTestCaseName), func(t *testing.T) {
73 // _, err := fmt.Sscanf(tc.packedUperPdu, "%x", &payload)
76 // t.Errorf("convert inputPayloadAsStr to payloadAsByte. Error: %v\n", err)
79 // pdu, err := unpackX2apPduUPer(logger, MaxAsn1CodecAllocationBufferSize, len(payload), payload, MaxAsn1CodecMessageBufferSize)
81 // actualRanLoadInformation := &entities.RanLoadInformation{LoadTimestamp: LoadTimestamp}
83 // err = extractAndBuildRanLoadInformation(pdu, actualRanLoadInformation)
86 // t.Errorf("want: success, got: error: %v\n", err)
89 // if !assert.Equal(t, tc.expectedLoadInformation, actualRanLoadInformation) {
90 // t.Errorf("want: %v, got: %v", tc.expectedLoadInformation, actualRanLoadInformation)
96 func GenerateSingleCellWithCellIdOnlyRanLoadInformation() *entities.RanLoadInformation {
97 return &entities.RanLoadInformation{
98 LoadTimestamp: LoadTimestamp,
99 CellLoadInfos: []*entities.CellLoadInformation{
100 {CellId: "02f829:0007ab50"},
105 func GenerateSingleCellPartiallyPopulatedLoadInformation() *entities.RanLoadInformation {
107 ulInterferenceOverloadIndications := []entities.UlInterferenceOverloadIndication{
108 entities.UlInterferenceOverloadIndication_HIGH_INTERFERENCE,
109 entities.UlInterferenceOverloadIndication_MEDIUM_INTERFERENCE,
110 entities.UlInterferenceOverloadIndication_LOW_INTERFERENCE,
113 rntp := entities.RelativeNarrowbandTxPower{
115 RntpThreshold: entities.RntpThreshold_NEG_6,
116 NumberOfCellSpecificAntennaPorts: entities.NumberOfCellSpecificAntennaPorts_V2_ANT_PRT,
118 PdcchInterferenceImpact: 1,
121 absInformation := entities.AbsInformation{
122 Mode: entities.AbsInformationMode_ABS_INFO_FDD,
123 AbsPatternInfo: "07c1f07c1f",
124 NumberOfCellSpecificAntennaPorts: entities.NumberOfCellSpecificAntennaPorts_V1_ANT_PRT,
125 MeasurementSubset: "83e0f83c0f",
128 extendedUlInterferenceOverloadInfo := entities.ExtendedUlInterferenceOverloadInfo{
129 AssociatedSubframes: "c8",
130 ExtendedUlInterferenceOverloadIndications: ulInterferenceOverloadIndications,
133 compInformationStartTime := entities.StartTime{
135 StartSubframeNumber: 3,
138 return &entities.RanLoadInformation{
139 LoadTimestamp: LoadTimestamp,
140 CellLoadInfos: []*entities.CellLoadInformation{
142 CellId: "02f829:0007ab50",
143 UlInterferenceOverloadIndications: ulInterferenceOverloadIndications,
144 UlHighInterferenceInfos: []*entities.UlHighInterferenceInformation{{TargetCellId: "02f830:0007ab50", UlHighInterferenceIndication: "aaaa"}},
145 RelativeNarrowbandTxPower: &rntp,
146 AbsInformation: &absInformation,
147 InvokeIndication: entities.InvokeIndication_ABS_INFORMATION,
148 IntendedUlDlConfiguration: entities.SubframeAssignment_SA6,
149 ExtendedUlInterferenceOverloadInfo: &extendedUlInterferenceOverloadInfo,
150 CompInformation: &entities.CompInformation{
151 CompInformationItems: []*entities.CompInformationItem{
153 CompHypothesisSets: []*entities.CompHypothesisSet{{CellId: "02f831:0007ab50", CompHypothesis: "e007ab50"}},
157 CompHypothesisSets: []*entities.CompHypothesisSet{{CellId: "02f832:0067ab50", CompHypothesis: "e307ab50"}},
161 CompInformationStartTime: &compInformationStartTime,
169 func GenerateTwoCellsFullyPopulatedRanLoadInformation() *entities.RanLoadInformation {
171 ulInterferenceOverloadIndications := []entities.UlInterferenceOverloadIndication{
172 entities.UlInterferenceOverloadIndication_HIGH_INTERFERENCE,
173 entities.UlInterferenceOverloadIndication_MEDIUM_INTERFERENCE,
174 entities.UlInterferenceOverloadIndication_LOW_INTERFERENCE,
177 rntp := entities.RelativeNarrowbandTxPower{
179 RntpThreshold: entities.RntpThreshold_NEG_6,
180 NumberOfCellSpecificAntennaPorts: entities.NumberOfCellSpecificAntennaPorts_V2_ANT_PRT,
182 PdcchInterferenceImpact: 1,
185 enhancedRntp := entities.EnhancedRntp{
186 EnhancedRntpBitmap: "aa38",
187 RntpHighPowerThreshold: entities.RntpThreshold_NEG_4,
188 EnhancedRntpStartTime: &entities.StartTime{StartSfn: 51, StartSubframeNumber: 9},
191 rntpWithEnhanced := rntp
192 rntpWithEnhanced.EnhancedRntp = &enhancedRntp
194 absInformation := entities.AbsInformation{
195 Mode: entities.AbsInformationMode_ABS_INFO_FDD,
196 AbsPatternInfo: "07c1f07c1f",
197 NumberOfCellSpecificAntennaPorts: entities.NumberOfCellSpecificAntennaPorts_V1_ANT_PRT,
198 MeasurementSubset: "83e0f83c0f",
201 extendedUlInterferenceOverloadInfo := entities.ExtendedUlInterferenceOverloadInfo{
202 AssociatedSubframes: "c8",
203 ExtendedUlInterferenceOverloadIndications: ulInterferenceOverloadIndications,
206 compInformationStartTime := entities.StartTime{
208 StartSubframeNumber: 3,
211 dynamicDlTransmissionInformation := entities.DynamicDlTransmissionInformation{
212 State: entities.NaicsState_NAICS_ACTIVE,
213 TransmissionModes: "cd",
215 PAList: []entities.PA{entities.PA_DB_NEG_1_DOT_77, entities.PA_DB_NEG_3},
218 return &entities.RanLoadInformation{
219 LoadTimestamp: LoadTimestamp,
220 CellLoadInfos: []*entities.CellLoadInformation{
222 CellId: "02f829:0007ab50",
223 UlInterferenceOverloadIndications: ulInterferenceOverloadIndications,
224 UlHighInterferenceInfos: []*entities.UlHighInterferenceInformation{{TargetCellId: "02f830:0007ab50", UlHighInterferenceIndication: "aaaa"}},
225 RelativeNarrowbandTxPower: &rntpWithEnhanced,
226 AbsInformation: &absInformation,
227 InvokeIndication: entities.InvokeIndication_ABS_INFORMATION,
228 IntendedUlDlConfiguration: entities.SubframeAssignment_SA6,
229 ExtendedUlInterferenceOverloadInfo: &extendedUlInterferenceOverloadInfo,
230 CompInformation: &entities.CompInformation{
231 CompInformationItems: []*entities.CompInformationItem{
233 CompHypothesisSets: []*entities.CompHypothesisSet{{CellId: "02f831:0007ab50", CompHypothesis: "e007ab50"}},
237 CompHypothesisSets: []*entities.CompHypothesisSet{{CellId: "02f832:0067ab50", CompHypothesis: "e307ab50"}},
241 CompInformationStartTime: &compInformationStartTime,
243 DynamicDlTransmissionInformation: &dynamicDlTransmissionInformation,
246 CellId: "02f910:0007ab50",
247 UlInterferenceOverloadIndications: ulInterferenceOverloadIndications,
248 UlHighInterferenceInfos: []*entities.UlHighInterferenceInformation{{TargetCellId: "02f810:0007ab50", UlHighInterferenceIndication: "aaaa"}},
249 RelativeNarrowbandTxPower: &rntp,
250 AbsInformation: &absInformation,
251 InvokeIndication: entities.InvokeIndication_ABS_INFORMATION,
252 IntendedUlDlConfiguration: entities.SubframeAssignment_SA6,
253 ExtendedUlInterferenceOverloadInfo: &extendedUlInterferenceOverloadInfo,
254 CompInformation: &entities.CompInformation{
255 CompInformationItems: []*entities.CompInformationItem{
257 CompHypothesisSets: []*entities.CompHypothesisSet{{CellId: "02f811:0007ab50", CompHypothesis: "e007ab50"}},
261 CompHypothesisSets: []*entities.CompHypothesisSet{{CellId: "02f812:0067ab50", CompHypothesis: "e307ab50"}},
265 CompInformationStartTime: &compInformationStartTime,
267 DynamicDlTransmissionInformation: &dynamicDlTransmissionInformation,