2 * Copyright 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.
19 * This source code is part of the near-RT RIC (RAN Intelligent Controller)
20 * platform project (RICP).
28 #include <resource_status_request_wrapper.h>
30 void test_build_pack_resource_status_request();
31 void test_build_pack_resource_status_request_stop();
32 void test_unpack(void);
35 main(int argc, char* argv[])
37 test_build_pack_resource_status_request();
38 test_build_pack_resource_status_request_stop();
42 /*reportCharacteristics:
43 1) First Bit = PRB Periodic,
44 2) Second Bit = TNL load Ind Periodic,
45 3) Third Bit = HW Load Ind Periodic,
46 4) Fourth Bit = Composite Available Capacity Periodic, this bit should be set to 1 if at least one of the First, Second
47 or Third bits is set to 1,
48 5) Fifth Bit = ABS Status Periodic,
49 6) Sixth Bit = RSRP Measurement Report Periodic,
50 7) Seventh Bit = CSI Report Periodic
52 void test_build_pack_resource_status_request(){
53 size_t error_buf_size = 8192;
54 size_t packed_buf_size = 4096;
55 unsigned char outBuf[packed_buf_size];
56 char errorBuf[error_buf_size];
57 const uint8_t pLMN_Identity[] = {0xa,0xb,0xc};
58 const uint8_t eUTRANCellIdentifier[] = {0xab, 0xcd, 0x70, 0};
59 const uint8_t *pLMN_Identities[] = {pLMN_Identity};
60 const uint8_t *eUTRANCellIdentifiers[] = {eUTRANCellIdentifier};
63 bool result = build_pack_resource_status_request(
64 pLMN_Identities, eUTRANCellIdentifiers, 1,
65 15 /*measurement_ID*/, 0 /*measurement_ID2*/,
66 Registration_Request_start /*Registration_Request_start,Registration_Request_stop,Registration_Request_partial_stop, Registration_Request_add*/,
68 ReportingPeriodicity_one_thousand_ms /*ReportingPeriodicity_one_thousand_ms, ReportingPeriodicity_two_thousand_ms, ReportingPeriodicity_five_thousand_ms,ReportingPeriodicity_ten_thousand_ms*/,
69 PartialSuccessIndicator_partial_success_allowed /*PartialSuccessIndicator_partial_success_allowed*/,
70 ReportingPeriodicityRSRPMR_one_hundred_20_ms /*ReportingPeriodicityRSRPMR_one_hundred_20_ms, ReportingPeriodicityRSRPMR_two_hundred_40_ms, ReportingPeriodicityRSRPMR_four_hundred_80_ms,ReportingPeriodicityRSRPMR_six_hundred_40_ms*/,
71 ReportingPeriodicityCSIR_ms5 /* ReportingPeriodicityCSIR_ms5, ReportingPeriodicityCSIR_ms10,ReportingPeriodicityCSIR_ms20,ReportingPeriodicityCSIR_ms40,ReportingPeriodicityCSIR_ms80*/,
72 &packed_buf_size, outBuf, error_buf_size, errorBuf);
75 printf("#%s failed. Packing error %s\n", __func__,errorBuf);
78 printf("packed size:%lu\nPayload:\n", packed_buf_size);
79 for (size_t i = 0; i < packed_buf_size; ++i)
80 printf("%02x",outBuf[i]);
83 pdu = calloc(1, sizeof(E2AP_PDU_t));
84 if (!unpack_pdu_aux(pdu, packed_buf_size, outBuf,error_buf_size, errorBuf,ATS_ALIGNED_BASIC_PER)){
85 printf("#%s failed. Unpacking error %s\n", __func__, errorBuf);
88 asn1_pdu_printer(pdu, sizeof(errorBuf), errorBuf);
89 printf("#%s: %s\n", __func__, errorBuf);
93 void test_build_pack_resource_status_request_stop(){
94 size_t error_buf_size = 8192;
95 size_t packed_buf_size = 4096;
96 unsigned char outBuf[packed_buf_size];
97 char errorBuf[error_buf_size];
98 const uint8_t pLMN_Identity[] = {0xa,0xb,0xc};
99 const uint8_t eUTRANCellIdentifier[] = {0xab, 0xcd, 0x70, 0};
100 const uint8_t *pLMN_Identities[] = {pLMN_Identity};
101 const uint8_t *eUTRANCellIdentifiers[] = {eUTRANCellIdentifier};
104 bool result = build_pack_resource_status_request(
105 pLMN_Identities, eUTRANCellIdentifiers, 1,
106 15 /*measurement_ID*/, 2 /*measurement_ID2*/,
107 Registration_Request_stop /*Registration_Request_start,Registration_Request_stop,Registration_Request_partial_stop, Registration_Request_add*/,
109 ReportingPeriodicity_one_thousand_ms /*ReportingPeriodicity_one_thousand_ms, ReportingPeriodicity_two_thousand_ms, ReportingPeriodicity_five_thousand_ms,ReportingPeriodicity_ten_thousand_ms*/,
110 PartialSuccessIndicator_partial_success_allowed /*PartialSuccessIndicator_partial_success_allowed*/,
111 ReportingPeriodicityRSRPMR_one_hundred_20_ms /*ReportingPeriodicityRSRPMR_one_hundred_20_ms, ReportingPeriodicityRSRPMR_two_hundred_40_ms, ReportingPeriodicityRSRPMR_four_hundred_80_ms,ReportingPeriodicityRSRPMR_six_hundred_40_ms*/,
112 ReportingPeriodicityCSIR_ms5 /* ReportingPeriodicityCSIR_ms5, ReportingPeriodicityCSIR_ms10,ReportingPeriodicityCSIR_ms20,ReportingPeriodicityCSIR_ms40,ReportingPeriodicityCSIR_ms80*/,
113 &packed_buf_size, outBuf, error_buf_size, errorBuf);
116 printf("#%s failed. Packing error %s\n", __func__,errorBuf);
119 printf("packed size:%lu\nPayload:\n", packed_buf_size);
120 for (size_t i = 0; i < packed_buf_size; ++i)
121 printf("%02x",outBuf[i]);
124 pdu = calloc(1, sizeof(E2AP_PDU_t));
125 if (!unpack_pdu_aux(pdu, packed_buf_size, outBuf,error_buf_size, errorBuf,ATS_ALIGNED_BASIC_PER)){
126 printf("#%s failed. Unpacking error %s\n", __func__, errorBuf);
129 asn1_pdu_printer(pdu, sizeof(errorBuf), errorBuf);
130 printf("#%s: %s\n", __func__, errorBuf);