Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenXG
OpenXG-RAN
Commits
df2c92e6
Commit
df2c92e6
authored
May 27, 2024
by
Guido Casati
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test for F1AP Setup Response enc/dec lib
parent
30628b82
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
60 additions
and
0 deletions
+60
-0
openair2/F1AP/tests/f1ap_lib_test.c
openair2/F1AP/tests/f1ap_lib_test.c
+60
-0
No files found.
openair2/F1AP/tests/f1ap_lib_test.c
View file @
df2c92e6
...
...
@@ -3,6 +3,7 @@
#include <stdio.h>
#include "common/utils/assertions.h"
#include "common/utils/utils.h"
#include "f1ap_messages_types.h"
#include "F1AP_F1AP-PDU.h"
...
...
@@ -271,11 +272,70 @@ static void test_f1ap_setup_request(void)
free_f1ap_setup_request
(
&
orig
);
}
/**
* @brief Test F1AP Setup Response Encoding/Decoding
*/
static
void
test_f1ap_setup_response
(
void
)
{
/* allocate memory */
/* gNB_CU_name */
char
*
cu_name
=
"OAI-CU"
;
int
len
=
strlen
(
cu_name
)
+
1
;
uint8_t
*
gNB_CU_name
=
calloc
(
len
,
sizeof
(
uint8_t
));
AssertFatal
(
gNB_CU_name
!=
NULL
,
"out of memory
\n
"
);
memcpy
((
void
*
)
gNB_CU_name
,
cu_name
,
len
);
/* create message */
f1ap_setup_resp_t
orig
=
{
.
gNB_CU_name
=
(
char
*
)
gNB_CU_name
,
.
transaction_id
=
2
,
.
rrc_ver
[
0
]
=
12
,
.
rrc_ver
[
1
]
=
34
,
.
rrc_ver
[
2
]
=
56
,
.
num_cells_to_activate
=
1
,
.
cells_to_activate
[
0
].
nr_cellid
=
123456
,
.
cells_to_activate
[
0
].
nrpci
=
1
,
.
cells_to_activate
[
0
].
plmn
.
mcc
=
12
,
.
cells_to_activate
[
0
].
plmn
.
mnc
=
123
,
.
cells_to_activate
[
0
].
plmn
.
mnc_digit_length
=
3
,
};
/* Cells to activate */
if
(
orig
.
num_cells_to_activate
)
{
/* SI_container */
char
*
s
=
"test"
;
int
SI_container_length
=
strlen
(
s
)
+
1
;
orig
.
cells_to_activate
[
0
].
num_SI
=
1
;
f1ap_sib_msg_t
*
SI_msg
=
&
orig
.
cells_to_activate
[
0
].
SI_msg
[
0
];
SI_msg
->
SI_container
=
malloc_or_fail
(
SI_container_length
);
memcpy
(
SI_msg
->
SI_container
,
(
uint8_t
*
)
s
,
SI_container_length
);
SI_msg
->
SI_container_length
=
SI_container_length
;
SI_msg
->
SI_type
=
7
;
}
F1AP_F1AP_PDU_t
*
f1enc
=
encode_f1ap_setup_response
(
&
orig
);
F1AP_F1AP_PDU_t
*
f1dec
=
f1ap_encode_decode
(
f1enc
);
f1ap_msg_free
(
f1enc
);
f1ap_setup_resp_t
decoded
=
{
0
};
bool
ret
=
decode_f1ap_setup_response
(
f1dec
,
&
decoded
);
AssertFatal
(
ret
,
"decode_f1ap_setup_response(): could not decode message
\n
"
);
f1ap_msg_free
(
f1dec
);
ret
=
eq_f1ap_setup_response
(
&
orig
,
&
decoded
);
AssertFatal
(
ret
,
"eq_f1ap_setup_response(): decoded message doesn't match
\n
"
);
free_f1ap_setup_response
(
&
decoded
);
f1ap_setup_resp_t
cp
=
cp_f1ap_setup_response
(
&
orig
);
ret
=
eq_f1ap_setup_response
(
&
orig
,
&
cp
);
AssertFatal
(
ret
,
"eq_f1ap_setup_response(): copied message doesn't match
\n
"
);
free_f1ap_setup_response
(
&
cp
);
free_f1ap_setup_response
(
&
orig
);
}
int
main
()
{
test_initial_ul_rrc_message_transfer
();
test_dl_rrc_message_transfer
();
test_ul_rrc_message_transfer
();
test_f1ap_setup_request
();
test_f1ap_setup_response
();
return
0
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment