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/entities"
28 //Test permutations of eNB Load Information to protobuf
31 //type LoadInformationTestCaseName string
33 //const LoadTimestamp = 1257894000000000000
36 // SingleCellWithCellIdOnly LoadInformationTestCaseName = "SINGLE CELL WITH CELL ID ONLY" //base
37 // SingleCellPartiallyPopulated LoadInformationTestCaseName = "SINGLE CELL PARTIALLY POPULATED" //8
38 // TwoCellsFullInfo LoadInformationTestCaseName = "TWO CELLS FULLY POPULATED" //13
41 //type LoadInformationTestCase struct {
42 // loadInformationTestCaseName LoadInformationTestCaseName
43 // packedUperPdu string
44 // packedAperPdu string
45 // expectedLoadInformation *entities.RanLoadInformation
48 //var testCases = []LoadInformationTestCase{
50 // loadInformationTestCaseName: SingleCellWithCellIdOnly,
51 // packedAperPdu: "000240140000010006400d00000740080002f8290007ab50",
52 // packedUperPdu: "004898000400190d0000074200017c148003d5a80000",
53 // expectedLoadInformation: GenerateSingleCellWithCellIdOnlyRanLoadInformation(),
56 // loadInformationTestCaseName: SingleCellPartiallyPopulated,
57 // packedAperPdu: "", //TODO: populate and USE
58 // packedUperPdu: "004b380004001961000007571e017c148003d5a8205000017c180003d5a875555003331420008007a85801f07c1f07c41f07c1e07801f2020000c680b0003220664102800d8908020000be0c4001ead4016e007ab50100002f8320067ab5005b8c1ead5070190c000000",
59 // expectedLoadInformation: GenerateSingleCellPartiallyPopulatedLoadInformation(),
62 // loadInformationTestCaseName: TwoCellsFullInfo,
63 // packedAperPdu: "", //TODO: populate and USE
64 // packedUperPdu: "004c07080004001980da0100075bde017c148003d5a8205000017c180003d5a875555403331420000012883a0003547400cd20002801ea16007c1f07c1f107c1f0781e007c80800031a02c000c88199040a00352083669190000d8908020000be0c4001ead4016e007ab50100002f8320067ab5005b8c1ead5070190c00001d637805f220000f56a081400005f020000f56a1d555400ccc508002801ea16007c1f07c1f107c1f0781e007c80800031a02c000c88199040a00352083669190000d8908020000be044001ead4016e007ab50100002f8120067ab5005b8c1ead5070190c00000",
65 // expectedLoadInformation: GenerateTwoCellsFullyPopulatedRanLoadInformation(),
69 //func TestExtractAndBuildRanLoadInformation(t *testing.T) {
70 // logger, _ := logger.InitLogger(logger.InfoLevel)
72 // for _, tc := range testCases {
73 // t.Run(string(tc.loadInformationTestCaseName), func(t *testing.T) {
76 // _, err := fmt.Sscanf(tc.packedUperPdu, "%x", &payload)
79 // t.Errorf("convert inputPayloadAsStr to payloadAsByte. Error: %v\n", err)
82 // pdu, err := unpackX2apPduUPer(logger, MaxAsn1CodecAllocationBufferSize, len(payload), payload, MaxAsn1CodecMessageBufferSize)
84 // actualRanLoadInformation := &entities.RanLoadInformation{LoadTimestamp: LoadTimestamp}
86 // err = ExtractAndBuildRanLoadInformation(pdu, actualRanLoadInformation)
89 // t.Errorf("want: success, got: error: %v\n", err)
92 // if !assert.Equal(t, tc.expectedLoadInformation, actualRanLoadInformation) {
93 // t.Errorf("want: %v, got: %v", tc.expectedLoadInformation, actualRanLoadInformation)
99 /*func GenerateSingleCellWithCellIdOnlyRanLoadInformation() *entities.RanLoadInformation {
100 return &entities.RanLoadInformation{
101 LoadTimestamp: LoadTimestamp,
102 CellLoadInfos: []*entities.CellLoadInformation{
103 {CellId: "02f829:0007ab50"},
108 func GenerateSingleCellPartiallyPopulatedLoadInformation() *entities.RanLoadInformation {
110 ulInterferenceOverloadIndications := []entities.UlInterferenceOverloadIndication{
111 entities.UlInterferenceOverloadIndication_HIGH_INTERFERENCE,
112 entities.UlInterferenceOverloadIndication_MEDIUM_INTERFERENCE,
113 entities.UlInterferenceOverloadIndication_LOW_INTERFERENCE,
116 rntp := entities.RelativeNarrowbandTxPower{
118 RntpThreshold: entities.RntpThreshold_NEG_6,
119 NumberOfCellSpecificAntennaPorts: entities.NumberOfCellSpecificAntennaPorts_V2_ANT_PRT,
121 PdcchInterferenceImpact: 1,
124 absInformation := entities.AbsInformation{
125 Mode: entities.AbsInformationMode_ABS_INFO_FDD,
126 AbsPatternInfo: "07c1f07c1f",
127 NumberOfCellSpecificAntennaPorts: entities.NumberOfCellSpecificAntennaPorts_V1_ANT_PRT,
128 MeasurementSubset: "83e0f83c0f",
131 extendedUlInterferenceOverloadInfo := entities.ExtendedUlInterferenceOverloadInfo{
132 AssociatedSubframes: "c8",
133 ExtendedUlInterferenceOverloadIndications: ulInterferenceOverloadIndications,
136 compInformationStartTime := entities.StartTime{
138 StartSubframeNumber: 3,
141 return &entities.RanLoadInformation{
142 LoadTimestamp: LoadTimestamp,
143 CellLoadInfos: []*entities.CellLoadInformation{
145 CellId: "02f829:0007ab50",
146 UlInterferenceOverloadIndications: ulInterferenceOverloadIndications,
147 UlHighInterferenceInfos: []*entities.UlHighInterferenceInformation{{TargetCellId: "02f830:0007ab50", UlHighInterferenceIndication: "aaaa"}},
148 RelativeNarrowbandTxPower: &rntp,
149 AbsInformation: &absInformation,
150 InvokeIndication: entities.InvokeIndication_ABS_INFORMATION,
151 IntendedUlDlConfiguration: entities.SubframeAssignment_SA6,
152 ExtendedUlInterferenceOverloadInfo: &extendedUlInterferenceOverloadInfo,
153 CompInformation: &entities.CompInformation{
154 CompInformationItems: []*entities.CompInformationItem{
156 CompHypothesisSets: []*entities.CompHypothesisSet{{CellId: "02f831:0007ab50", CompHypothesis: "e007ab50"}},
160 CompHypothesisSets: []*entities.CompHypothesisSet{{CellId: "02f832:0067ab50", CompHypothesis: "e307ab50"}},
164 CompInformationStartTime: &compInformationStartTime,
172 func GenerateTwoCellsFullyPopulatedRanLoadInformation() *entities.RanLoadInformation {
174 ulInterferenceOverloadIndications := []entities.UlInterferenceOverloadIndication{
175 entities.UlInterferenceOverloadIndication_HIGH_INTERFERENCE,
176 entities.UlInterferenceOverloadIndication_MEDIUM_INTERFERENCE,
177 entities.UlInterferenceOverloadIndication_LOW_INTERFERENCE,
180 rntp := entities.RelativeNarrowbandTxPower{
182 RntpThreshold: entities.RntpThreshold_NEG_6,
183 NumberOfCellSpecificAntennaPorts: entities.NumberOfCellSpecificAntennaPorts_V2_ANT_PRT,
185 PdcchInterferenceImpact: 1,
188 enhancedRntp := entities.EnhancedRntp{
189 EnhancedRntpBitmap: "aa38",
190 RntpHighPowerThreshold: entities.RntpThreshold_NEG_4,
191 EnhancedRntpStartTime: &entities.StartTime{StartSfn: 51, StartSubframeNumber: 9},
194 rntpWithEnhanced := rntp
195 rntpWithEnhanced.EnhancedRntp = &enhancedRntp
197 absInformation := entities.AbsInformation{
198 Mode: entities.AbsInformationMode_ABS_INFO_FDD,
199 AbsPatternInfo: "07c1f07c1f",
200 NumberOfCellSpecificAntennaPorts: entities.NumberOfCellSpecificAntennaPorts_V1_ANT_PRT,
201 MeasurementSubset: "83e0f83c0f",
204 extendedUlInterferenceOverloadInfo := entities.ExtendedUlInterferenceOverloadInfo{
205 AssociatedSubframes: "c8",
206 ExtendedUlInterferenceOverloadIndications: ulInterferenceOverloadIndications,
209 compInformationStartTime := entities.StartTime{
211 StartSubframeNumber: 3,
214 dynamicDlTransmissionInformation := entities.DynamicDlTransmissionInformation{
215 State: entities.NaicsState_NAICS_ACTIVE,
216 TransmissionModes: "cd",
218 PAList: []entities.PA{entities.PA_DB_NEG_1_DOT_77, entities.PA_DB_NEG_3},
221 return &entities.RanLoadInformation{
222 LoadTimestamp: LoadTimestamp,
223 CellLoadInfos: []*entities.CellLoadInformation{
225 CellId: "02f829:0007ab50",
226 UlInterferenceOverloadIndications: ulInterferenceOverloadIndications,
227 UlHighInterferenceInfos: []*entities.UlHighInterferenceInformation{{TargetCellId: "02f830:0007ab50", UlHighInterferenceIndication: "aaaa"}},
228 RelativeNarrowbandTxPower: &rntpWithEnhanced,
229 AbsInformation: &absInformation,
230 InvokeIndication: entities.InvokeIndication_ABS_INFORMATION,
231 IntendedUlDlConfiguration: entities.SubframeAssignment_SA6,
232 ExtendedUlInterferenceOverloadInfo: &extendedUlInterferenceOverloadInfo,
233 CompInformation: &entities.CompInformation{
234 CompInformationItems: []*entities.CompInformationItem{
236 CompHypothesisSets: []*entities.CompHypothesisSet{{CellId: "02f831:0007ab50", CompHypothesis: "e007ab50"}},
240 CompHypothesisSets: []*entities.CompHypothesisSet{{CellId: "02f832:0067ab50", CompHypothesis: "e307ab50"}},
244 CompInformationStartTime: &compInformationStartTime,
246 DynamicDlTransmissionInformation: &dynamicDlTransmissionInformation,
249 CellId: "02f910:0007ab50",
250 UlInterferenceOverloadIndications: ulInterferenceOverloadIndications,
251 UlHighInterferenceInfos: []*entities.UlHighInterferenceInformation{{TargetCellId: "02f810:0007ab50", UlHighInterferenceIndication: "aaaa"}},
252 RelativeNarrowbandTxPower: &rntp,
253 AbsInformation: &absInformation,
254 InvokeIndication: entities.InvokeIndication_ABS_INFORMATION,
255 IntendedUlDlConfiguration: entities.SubframeAssignment_SA6,
256 ExtendedUlInterferenceOverloadInfo: &extendedUlInterferenceOverloadInfo,
257 CompInformation: &entities.CompInformation{
258 CompInformationItems: []*entities.CompInformationItem{
260 CompHypothesisSets: []*entities.CompHypothesisSet{{CellId: "02f811:0007ab50", CompHypothesis: "e007ab50"}},
264 CompHypothesisSets: []*entities.CompHypothesisSet{{CellId: "02f812:0067ab50", CompHypothesis: "e307ab50"}},
268 CompInformationStartTime: &compInformationStartTime,
270 DynamicDlTransmissionInformation: &dynamicDlTransmissionInformation,