Compare commits

...

14 Commits

Author SHA1 Message Date
Robert Schmidt
3c53e03fe2 SDAP 2023-10-11 08:31:27 +02:00
Robert Schmidt
99e5cb71b3 Activate DRB before 2023-10-11 08:31:27 +02:00
Robert Schmidt
20010499fc fix SDAP 2023-10-11 08:31:27 +02:00
Robert Schmidt
6b8a627c4c properly release bearer 2023-10-11 08:31:27 +02:00
Robert Schmidt
eef0313ff9 hacks to make it work 2023-10-06 18:48:56 +02:00
Robert Schmidt
60b279e02a Merge remote-tracking branch 'origin/e2ap_v3_v2' into oran_phnx 2023-10-06 16:31:41 +02:00
mir
3a0364bbf9 Naive SDAP classifier added 2023-10-06 16:28:53 +02:00
Robert Schmidt
a4fcc9dfff Scheduler: sort second bearer before first one 2023-10-06 16:14:25 +02:00
Robert Schmidt
de44dc2b57 UE Context Modification Handler: also trigger CellConfig if only UE Capability changes 2023-10-06 15:57:11 +02:00
Robert Schmidt
735449222d F1 UE Context Modification Request: forward Capabilities 2023-10-06 15:56:59 +02:00
mir
3fbc20412a Bug in j and i idx 2023-10-05 15:04:47 +02:00
mir
58134a29d9 Fixes from Teodora applied 2023-10-05 14:54:39 +02:00
mir
0ffb01b9c3 NG-RAN was not compiling due to struct definition missing 2023-10-04 14:20:30 +02:00
mir
12e09526e8 E2AP Version 1,2,3 and KPM version 2, 3 2023-10-04 12:12:53 +02:00
29 changed files with 487 additions and 202 deletions

View File

@@ -289,6 +289,15 @@ add_definitions(-DHAVE_NETINET_IN_H)
set(E2_AGENT "OFF" CACHE STRING "O-RAN-compliant E2 Agent")
set_property(CACHE E2_AGENT PROPERTY STRINGS "ON" "OFF")
set(E2AP_VERSION "E2AP_V2" CACHE STRING "E2AP version")
set_property(CACHE E2AP_VERSION PROPERTY STRINGS "E2AP_V1" "E2AP_V2" "E2AP_V3")
message(STATUS "Selected E2AP_VERSION: ${E2AP_VERSION}")
set(KPM_VERSION "KPM_V2" CACHE STRING "The KPM SM version to use")
set_property(CACHE KPM_VERSION PROPERTY STRINGS "KPM_V2" "KPM_V3")
message(STATUS "Selected KPM Version: ${KPM_VERSION}")
##################################################
# ASN.1 grammar C code generation & dependencies #
##################################################
@@ -1409,9 +1418,11 @@ add_library(L2
)
target_link_libraries(L2 PRIVATE x2ap s1ap lte_rrc m2ap)
target_link_libraries(L2 PRIVATE asn1_lte_rrc_hdrs asn1_nr_rrc_hdrs)
if(E2_AGENT)
target_link_libraries(L2 PUBLIC e2_agent e2_ran_func)
target_compile_definitions(L2 PRIVATE E2_AGENT)
target_compile_definitions(L2 PRIVATE ${E2AP_VERSION} ${KPM_VERSION})
endif()
@@ -1443,6 +1454,7 @@ target_link_libraries(e1_pdcp_if PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs)
target_link_libraries(L2_NR PRIVATE f1ap x2ap s1ap ngap nr_rrc e1ap nr_rlc)
if(E2_AGENT)
target_link_libraries(L2_NR PUBLIC e2_agent e2_ran_func)
target_compile_definitions(L2_NR PRIVATE ${E2AP_VERSION} ${KPM_VERSION})
target_compile_definitions(L2_NR PRIVATE E2_AGENT)
endif()
@@ -1965,6 +1977,7 @@ target_link_libraries(lte-softmodem PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs)
if(E2_AGENT)
target_compile_definitions(lte-softmodem PRIVATE E2_AGENT)
target_compile_definitions(lte-softmodem PRIVATE ${E2AP_VERSION} ${KPM_VERSION})
endif()
add_executable(oairu
@@ -2061,6 +2074,11 @@ target_link_libraries(nr-softmodem PRIVATE
target_link_libraries(nr-softmodem PRIVATE pthread m CONFIG_LIB rt sctp)
target_link_libraries(nr-softmodem PRIVATE ${T_LIB})
target_link_libraries(nr-softmodem PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs)
target_link_libraries(nr-softmodem PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs)
if(E2_AGENT)
target_compile_definitions(nr-softmodem PRIVATE ${E2AP_VERSION} ${KPM_VERSION})
endif()
add_dependencies(nr-softmodem ldpc_orig ldpc_optim ldpc_optim8seg ldpc)

View File

@@ -696,10 +696,13 @@ int main( int argc, char **argv ) {
// OAI Wrapper
e2_agent_args_t oai_args = RCconfig_NR_E2agent();
AssertFatal(oai_args.sm_dir != NULL , "Please, specify the directory where the SMs are located in the config file, i.e., e2_agent = {near_ric_ip_addr = \"127.0.0.1\"; sm_dir = \"/usr/local/lib/flexric/\");} ");
AssertFatal(oai_args.sm_dir != NULL , "Please, specify the directory where the SMs are located in the config file, i.e., add in config file the next line: e2_agent = {near_ric_ip_addr = \"127.0.0.1\"; sm_dir = \"/usr/local/lib/flexric/\");} ");
AssertFatal(oai_args.ip != NULL , "Please, specify the IP address of the nearRT-RIC in the config file, i.e., e2_agent = {near_ric_ip_addr = \"127.0.0.1\"; sm_dir = \"/usr/local/lib/flexric/\"");
fr_args_t args = {.ip = oai_args.ip}; // init_fr_args(0, NULL);
printf("After RCconfig_NR_E2agent %s %s \n",oai_args.sm_dir, oai_args.ip );
fr_args_t args = { .ip = oai_args.ip }; // init_fr_args(0, NULL);
memcpy(args.libs_dir, oai_args.sm_dir, 128);
sleep(1);
@@ -726,6 +729,7 @@ int main( int argc, char **argv ) {
printf("[E2 NODE]: mcc = %d mnc = %d mnc_digit = %d nb_id = %d \n", mcc, mnc, mnc_digit_len, nb_id);
printf("[E2 NODE]: Args %s %s \n", args.ip, args.libs_dir);
init_agent_api(mcc, mnc, mnc_digit_len, nb_id, cu_du_id, node_type, io, &args);
// }

View File

@@ -29,6 +29,9 @@ else()
message(FATAL_ERROR "Unknown building type. Either choose a static or a dynamic library")
endif()
#######
## E2AP encoding and versioning
#######
set(E2AP_ENCODING "ASN" CACHE STRING "The E2AP encoding to use")
set_property(CACHE E2AP_ENCODING PROPERTY STRINGS "ASN" "FLATBUFFERS")
@@ -76,6 +79,35 @@ set(SM_ENCODING_GTP "PLAIN" CACHE STRING "The GTP SM encoding to use")
set_property(CACHE SM_ENCODING_GTP PROPERTY STRINGS "PLAIN")
message(STATUS "Selected GTP SM_ENCODING: ${SM_ENCODING_GTP}")
if(E2AP_VERSION STREQUAL "E2AP_V1")
add_library(e2ap_ran_func_obj OBJECT
flexric/src/lib/e2ap/v1_01/e2ap_types/common/e2ap_ran_function.c )
add_library(e2ap_plmn_obj OBJECT
flexric/src/lib/e2ap/v1_01/e2ap_types/common/e2ap_plmn.c )
add_library(e2ap_global_node_id_obj OBJECT
flexric/src/lib/e2ap/v1_01/e2ap_types/common/e2ap_global_node_id.c )
elseif(E2AP_VERSION STREQUAL "E2AP_V2")
add_library(e2ap_ran_func_obj OBJECT
flexric/src/lib/e2ap/v2_03/e2ap_types/common/e2ap_ran_function.c )
add_library(e2ap_plmn_obj OBJECT
flexric/src/lib/e2ap/v2_03/e2ap_types/common/e2ap_plmn.c )
add_library(e2ap_global_node_id_obj OBJECT
flexric/src/lib/e2ap/v2_03/e2ap_types/common/e2ap_global_node_id.c )
elseif(E2AP_VERSION STREQUAL "E2AP_V3")
add_library(e2ap_ran_func_obj OBJECT
flexric/src/lib/e2ap/v3_01/e2ap_types/common/e2ap_ran_function.c )
add_library(e2ap_plmn_obj OBJECT
flexric/src/lib/e2ap/v3_01/e2ap_types/common/e2ap_plmn.c )
add_library(e2ap_global_node_id_obj OBJECT
flexric/src/lib/e2ap/v3_01/e2ap_types/common/e2ap_global_node_id.c )
else()
message(FATAL_ERROR "E2AP Unknown version selected")
endif()
########
### Flatbuffer
########

View File

@@ -3,6 +3,8 @@ add_subdirectory(O-RAN)
add_library(e2_ran_func STATIC
init_ran_func.c
read_setup_ran.c
../flexric/test/rnd/fill_rnd_data_e2_setup_req.c
)
target_link_libraries(e2_ran_func
@@ -10,3 +12,6 @@ target_link_libraries(e2_ran_func
e2_ran_func_cust
e2_ran_func_oran
)
# This dependency sucks! Create pointers and forward declarations!
target_compile_definitions(e2_ran_func PRIVATE ${E2AP_VERSION} ${KPM_VERSION})

View File

@@ -16,3 +16,5 @@ add_library(e2_ran_func_cust STATIC
)
target_link_libraries(e2_ran_func_cust PUBLIC asn1_nr_rrc nr_rrc asn1_nr_rrc_hdrs)
# This dependency sucks! Create pointers and forward declarations!
target_compile_definitions(e2_ran_func_cust PRIVATE ${E2AP_VERSION} ${KPM_VERSION} )

View File

@@ -1,7 +1,14 @@
#include "ran_func_gtp.h"
#include "openair2/E2AP/flexric/test/rnd/fill_rnd_data_gtp.h"
#include <assert.h>
#include "openair2/E2AP/flexric/test/rnd/fill_rnd_data_gtp.h"
#include "common/ran_context.h"
#include "openair2/LAYER2/NR_MAC_gNB/mac_proto.h"
#include "openair2/E2AP/flexric/src/util/time_now_us.h"
#include "openair2/RRC/NR/rrc_gNB_UE_context.h"
static
const int mod_id = 0;

View File

@@ -2,10 +2,6 @@
#define RAN_FUNC_SM_GTP_READ_WRITE_AGENT_H
#include "openair2/E2AP/flexric/src/agent/../sm/sm_io.h"
#include "common/ran_context.h"
#include "openair2/LAYER2/NR_MAC_gNB/mac_proto.h"
#include "openair2/E2AP/flexric/src/util/time_now_us.h"
#include "openair2/RRC/NR/rrc_gNB_UE_context.h"
void read_gtp_sm(void*);

View File

@@ -1,6 +1,17 @@
#include "ran_func_pdcp.h"
#include "openair2/E2AP/flexric/test/rnd/fill_rnd_data_pdcp.h"
#include <assert.h>
#include <stdint.h>
#include <stdlib.h>
#include "openair2/E2AP/flexric/test/rnd/fill_rnd_data_pdcp.h"
#include "common/ran_context.h"
#include "openair2/RRC/NR/rrc_gNB_UE_context.h"
#include "openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.h"
#include "openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h"
#include "openair2/LAYER2/NR_MAC_gNB/mac_proto.h"
#include "openair2/E2AP/flexric/src/util/time_now_us.h"
static
const int mod_id = 0;

View File

@@ -2,12 +2,6 @@
#define RAN_FUNC_SM_PDCP_READ_WRITE_AGENT_H
#include "openair2/E2AP/flexric/src/agent/../sm/sm_io.h"
#include "common/ran_context.h"
#include "openair2/RRC/NR/rrc_gNB_UE_context.h"
#include "openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.h"
#include "openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h"
#include "openair2/LAYER2/NR_MAC_gNB/mac_proto.h"
#include "openair2/E2AP/flexric/src/util/time_now_us.h"
void read_pdcp_sm(void*);

View File

@@ -1,5 +1,12 @@
#include <assert.h>
#include <stdint.h>
#include <stdlib.h>
#include "ran_func_rlc.h"
#include "common/ran_context.h"
#include "openair2/LAYER2/NR_MAC_gNB/mac_proto.h"
#include "openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h"
#include "openair2/E2AP/flexric/src/util/time_now_us.h"
#include "openair2/E2AP/flexric/test/rnd/fill_rnd_data_rlc.h"
static

View File

@@ -2,11 +2,6 @@
#define RAN_FUNC_SM_RLC_READ_WRITE_AGENT_H
#include "openair2/E2AP/flexric/src/agent/../sm/sm_io.h"
#include "common/ran_context.h"
#include "openair2/LAYER2/NR_MAC_gNB/mac_proto.h"
#include "openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h"
#include "openair2/E2AP/flexric/src/util/time_now_us.h"
void read_rlc_sm(void*);

View File

@@ -7,3 +7,4 @@ add_library(e2_ran_func_oran STATIC
)
target_link_libraries(e2_ran_func_oran PUBLIC asn1_nr_rrc nr_rrc asn1_nr_rrc_hdrs)
target_compile_definitions(e2_ran_func_oran PRIVATE ${E2AP_VERSION} ${KPM_VERSION})

View File

@@ -20,7 +20,7 @@ typedef struct {
static
matched_ues_mac_t filter_ues_by_s_nssai_in_du_or_monolithic(test_cond_e const * condition, int64_t const value)
matched_ues_mac_t filter_ues_by_s_nssai_in_du_or_monolithic(test_cond_e const condition, int64_t const value)
{
matched_ues_mac_t matched_ues = {.num_ues = 0, .ue_list = calloc(MAX_MOBILES_PER_GNB, sizeof(NR_UE_info_t)) };
assert(matched_ues.ue_list != NULL && "Memory exhausted");
@@ -37,16 +37,17 @@ matched_ues_mac_t filter_ues_by_s_nssai_in_du_or_monolithic(test_cond_e const *
// Filter connected UEs by S-NSSAI test condition to get list of matched UEs
// note: not possible to filter
switch (*condition)
switch (condition)
{
case EQUAL_TEST_COND:
{
if (NODE_IS_MONOLITHIC(RC.nrrrc[0]->node_type))
case GREATERTHAN_TEST_COND:
case EQUAL_TEST_COND:
{
rrc_gNB_ue_context_t *rrc_ue_context_list = rrc_gNB_get_ue_context_by_rnti(RC.nrrrc[0], ue->rnti);
ngap_ue_context_list = ngap_get_ue_context(rrc_ue_context_list->ue_context.rrc_ue_id);
assert(ngap_ue_context_list->gNB_instance[0].s_nssai[0][0].sST == value && "Please, check the condition for S-NSSAI. At the moment, OAI supports eMBB");
}
if (NODE_IS_MONOLITHIC(RC.nrrrc[0]->node_type))
{
rrc_gNB_ue_context_t *rrc_ue_context_list = rrc_gNB_get_ue_context_by_rnti(RC.nrrrc[0], ue->rnti);
ngap_ue_context_list = ngap_get_ue_context(rrc_ue_context_list->ue_context.rrc_ue_id);
assert(ngap_ue_context_list->gNB_instance[0].s_nssai[0][0].sST == value && "Please, check the condition for S-NSSAI. At the moment, OAI supports eMBB");
}
matched_ues.ue_list[matched_ues.num_ues] = *ue;
matched_ues.num_ues++;
break;
@@ -73,7 +74,7 @@ typedef struct {
} matched_ues_rrc_t;
static
matched_ues_rrc_t filter_ues_by_s_nssai_in_cu(test_cond_e const * condition, int64_t const value)
matched_ues_rrc_t filter_ues_by_s_nssai_in_cu(test_cond_e const condition, int64_t const value)
{
matched_ues_rrc_t matched_ues = {.num_ues = 0, .rrc_ue_id_list = calloc(MAX_MOBILES_PER_GNB, sizeof(f1_ue_data_t)) };
assert(matched_ues.rrc_ue_id_list != NULL && "Memory exhausted");
@@ -85,7 +86,7 @@ matched_ues_rrc_t filter_ues_by_s_nssai_in_cu(test_cond_e const * condition, int
ngap_gNB_ue_context_t *ngap_ue_context_list = ngap_get_ue_context(ue_context_p1->ue_context.rrc_ue_id);
// Filter connected UEs by S-NSSAI test condition to get list of matched UEs
switch (*condition)
switch (condition)
{
case EQUAL_TEST_COND:
assert(ngap_ue_context_list->gNB_instance[0].s_nssai[0][0].sST == value && "Please, check the condition for S-NSSAI. At the moment, OAI supports eMBB");
@@ -104,7 +105,7 @@ matched_ues_rrc_t filter_ues_by_s_nssai_in_cu(test_cond_e const * condition, int
}
static
nr_rlc_statistics_t get_rlc_stats_per_drb(NR_UE_info_t * const UE)
nr_rlc_statistics_t get_rlc_stats_per_drb(NR_UE_info_t const * UE)
{
assert(UE != NULL);
@@ -195,13 +196,14 @@ gnb_du_e2sm_t fill_gnb_du_data(const f1_ue_data_t * rrc_ue_id)
return gnb_du;
}
uint32_t last_dl_rlc_pdu_total_bytes[MAX_MOBILES_PER_GNB] = {0};
uint32_t last_ul_rlc_pdu_total_bytes[MAX_MOBILES_PER_GNB] = {0};
uint32_t last_dl_total_prbs[MAX_MOBILES_PER_GNB] = {0};
uint32_t last_ul_total_prbs[MAX_MOBILES_PER_GNB] = {0};
uint32_t last_dl_pdcp_sdu_total_bytes[MAX_MOBILES_PER_GNB] = {0};
uint32_t last_ul_pdcp_sdu_total_bytes[MAX_MOBILES_PER_GNB] = {0};
// Bad bad bad. Create a proper exponential moving average filter or at least, only read statistics
// Avoid coupling among sublayers
static uint32_t last_dl_rlc_pdu_total_bytes[MAX_MOBILES_PER_GNB] = {0};
static uint32_t last_ul_rlc_pdu_total_bytes[MAX_MOBILES_PER_GNB] = {0};
static uint32_t last_dl_total_prbs[MAX_MOBILES_PER_GNB] = {0};
static uint32_t last_ul_total_prbs[MAX_MOBILES_PER_GNB] = {0};
static uint32_t last_dl_pdcp_sdu_total_bytes[MAX_MOBILES_PER_GNB] = {0};
static uint32_t last_ul_pdcp_sdu_total_bytes[MAX_MOBILES_PER_GNB] = {0};
static
@@ -596,18 +598,23 @@ kpm_ind_msg_format_3_t fill_kpm_ind_msg_frm_3_in_monolithic(const matched_ues_ma
msg_frm_3.meas_report_per_ue[i].ind_msg_format_1 = fill_kpm_ind_msg_frm_1_in_monolithic(&matched_ues.ue_list[i], i, rrc_ue_context_list->ue_context.rrc_ue_id, act_def_fr_1);
}
return msg_frm_3;
}
static
kpm_ric_ind_hdr_format_1_t fill_kpm_ind_hdr_frm_1(void)
static
kpm_ric_ind_hdr_format_1_t kpm_ind_hdr_frm_1(void)
{
kpm_ric_ind_hdr_format_1_t hdr_frm_1 = {0};
hdr_frm_1.collectStartTime = time_now_us();
int64_t const t = time_now_us();
#if defined KPM_V2
hdr_frm_1.collectStartTime = t/1000000; // seconds
#elif defined KPM_V3
hdr_frm_1.collectStartTime = t; // microseconds
#else
static_assert(0!=0, "Undefined KPM SM Version");
#endif
hdr_frm_1.fileformat_version = NULL;
// Check E2 Node NG-RAN Type
@@ -617,7 +624,7 @@ kpm_ric_ind_hdr_format_1_t fill_kpm_ind_hdr_frm_1(void)
hdr_frm_1.sender_name->buf = calloc(strlen("My OAI-DU") + 1, sizeof(char));
memcpy(hdr_frm_1.sender_name->buf, "My OAI-DU", strlen("My OAI-DU"));
hdr_frm_1.sender_name->len = strlen("My OAI-DU");
hdr_frm_1.sender_type = calloc(1, sizeof(byte_array_t));
hdr_frm_1.sender_type->buf = calloc(strlen("DU") + 1, sizeof(char));
memcpy(hdr_frm_1.sender_type->buf, "DU", strlen("DU"));
@@ -629,7 +636,7 @@ kpm_ric_ind_hdr_format_1_t fill_kpm_ind_hdr_frm_1(void)
hdr_frm_1.sender_name->buf = calloc(strlen("My OAI-CU") + 1, sizeof(char));
memcpy(hdr_frm_1.sender_name->buf, "My OAI-CU", strlen("My OAI-CU"));
hdr_frm_1.sender_name->len = strlen("My OAI-CU");
hdr_frm_1.sender_type = calloc(1, sizeof(byte_array_t));
hdr_frm_1.sender_type->buf = calloc(strlen("CU") + 1, sizeof(char));
memcpy(hdr_frm_1.sender_type->buf, "CU", strlen("CU"));
@@ -641,14 +648,15 @@ kpm_ric_ind_hdr_format_1_t fill_kpm_ind_hdr_frm_1(void)
hdr_frm_1.sender_name->buf = calloc(strlen("My OAI-MONO") + 1, sizeof(char));
memcpy(hdr_frm_1.sender_name->buf, "My OAI-MONO", strlen("My OAI-MONO"));
hdr_frm_1.sender_name->len = strlen("My OAI-MONO");
hdr_frm_1.sender_type = calloc(1, sizeof(byte_array_t));
hdr_frm_1.sender_type->buf = calloc(strlen("MONO") + 1, sizeof(char));
memcpy(hdr_frm_1.sender_type->buf, "MONO", strlen("MONO"));
hdr_frm_1.sender_type->len = strlen("MONO");
} else {
assert(0!=0 && "Unknown node type");
}
hdr_frm_1.vendor_name = calloc(1, sizeof(byte_array_t));
hdr_frm_1.vendor_name->buf = calloc(strlen("OAI") + 1, sizeof(char));
memcpy(hdr_frm_1.vendor_name->buf, "OAI", strlen("OAI"));
@@ -657,87 +665,126 @@ kpm_ric_ind_hdr_format_1_t fill_kpm_ind_hdr_frm_1(void)
return hdr_frm_1;
}
static
kpm_ind_hdr_t fill_kpm_ind_hdr(void)
kpm_ind_hdr_t kpm_ind_hdr(void)
{
kpm_ind_hdr_t hdr = {0};
hdr.type = FORMAT_1_INDICATION_HEADER;
hdr.kpm_ric_ind_hdr_format_1 = fill_kpm_ind_hdr_frm_1();
hdr.kpm_ric_ind_hdr_format_1 = kpm_ind_hdr_frm_1();
return hdr;
}
void read_kpm_sm(void* data)
{
assert(data != NULL);
//assert(data->type == KPM_STATS_V3_0);
// assert(data->type == KPM_STATS_V3_0);
kpm_rd_ind_data_t* const kpm = (kpm_rd_ind_data_t*)data;
assert(kpm->act_def!= NULL && "Cannot be NULL");
assert(kpm->act_def != NULL && "Cannot be NULL");
// 7.8 Supported RIC Styles and E2SM IE Formats
// Action Definition Format 4 corresponds to Indication Message Format 3
switch (kpm->act_def->type)
{
case FORMAT_4_ACTION_DEFINITION:
{
kpm->ind.hdr = fill_kpm_ind_hdr();
kpm->ind.msg.type = FORMAT_3_INDICATION_MESSAGE;
switch (kpm->act_def->type) {
case FORMAT_4_ACTION_DEFINITION: {
kpm->ind.hdr = kpm_ind_hdr();
// Filter the UE by the test condition criteria
for (size_t i = 0; i<kpm->act_def->frm_4.matching_cond_lst_len; i++)
{
switch (kpm->act_def->frm_4.matching_cond_lst[i].test_info_lst.test_cond_type)
{
case S_NSSAI_TEST_COND_TYPE:
assert(kpm->act_def->frm_4.matching_cond_lst[i].test_info_lst.S_NSSAI == TRUE_TEST_COND_TYPE && "Must be true");
// Check E2 Node NG-RAN Type
if (NODE_IS_DU(RC.nrrrc[0]->node_type))
{
matched_ues_mac_t matched_ues = filter_ues_by_s_nssai_in_du_or_monolithic(kpm->act_def->frm_4.matching_cond_lst[i].test_info_lst.test_cond, *kpm->act_def->frm_4.matching_cond_lst[i].test_info_lst.int_value);
kpm->ind.msg.frm_3 = fill_kpm_ind_msg_frm_3_in_du(matched_ues, &kpm->act_def->frm_4.action_def_format_1);
}
else if (NODE_IS_CU(RC.nrrrc[0]->node_type))
{
matched_ues_rrc_t matched_ues = filter_ues_by_s_nssai_in_cu(kpm->act_def->frm_4.matching_cond_lst[i].test_info_lst.test_cond, *kpm->act_def->frm_4.matching_cond_lst[i].test_info_lst.int_value);
kpm->ind.msg.frm_3 = fill_kpm_ind_msg_frm_3_in_cu(matched_ues, &kpm->act_def->frm_4.action_def_format_1);
}
else if (NODE_IS_MONOLITHIC(RC.nrrrc[0]->node_type))
{
matched_ues_mac_t matched_ues = filter_ues_by_s_nssai_in_du_or_monolithic(kpm->act_def->frm_4.matching_cond_lst[i].test_info_lst.test_cond, *kpm->act_def->frm_4.matching_cond_lst[i].test_info_lst.int_value);
kpm->ind.msg.frm_3 = fill_kpm_ind_msg_frm_3_in_monolithic(matched_ues, &kpm->act_def->frm_4.action_def_format_1);
}
else
{
assert(false && "NG-RAN Type not yet implemented");
}
kpm->ind.msg.type = FORMAT_3_INDICATION_MESSAGE;
// Filter the UE by the test condition criteria
kpm_act_def_format_4_t const* frm_4 = &kpm->act_def->frm_4; // 8.2.1.2.4
for (size_t i = 0; i < frm_4->matching_cond_lst_len; i++) {
switch (frm_4->matching_cond_lst[i].test_info_lst.test_cond_type) {
case GBR_TEST_COND_TYPE: {
assert(0 != 0 && "Not implemented");
break;
}
case AMBR_TEST_COND_TYPE: {
assert(0 != 0 && "Not implemented");
break;
}
case IsStat_TEST_COND_TYPE: {
assert(0 != 0 && "Not implemented");
break;
}
case IsCatM_TEST_COND_TYPE: {
assert(0 != 0 && "Not implemented");
break;
}
break;
default:
assert(false && "Test condition type not yet implemented");
case DL_RSRP_TEST_COND_TYPE: {
assert(0 != 0 && "Not implemented");
break;
}
case DL_RSRQ_TEST_COND_TYPE: {
assert(0 != 0 && "Not implemented");
break;
}
case UL_RSRP_TEST_COND_TYPE: {
assert(0 != 0 && "Not implemented");
break;
}
//case CQI_TEST_COND_TYPE: {
// // This is a bad idea. Done only to check FlexRIC xAPP
// printf("CQI not implemented!. Randomly filling the data \n");
// goto rnd_data_label;
// break;
//}
case fiveQI_TEST_COND_TYPE: {
assert(0 != 0 && "Not implemented");
break;
}
case QCI_TEST_COND_TYPE: {
;
assert(0 != 0 && "Not implemented");
break;
}
case CQI_TEST_COND_TYPE:
case S_NSSAI_TEST_COND_TYPE: {
assert(frm_4->matching_cond_lst[i].test_info_lst.S_NSSAI == TRUE_TEST_COND_TYPE && "Must be true");
assert(frm_4->matching_cond_lst[i].test_info_lst.test_cond != NULL && "Even though is optional..");
assert(frm_4->matching_cond_lst[i].test_info_lst.int_value != NULL && "Even though is optional..");
test_cond_e const test_cond = *frm_4->matching_cond_lst[i].test_info_lst.test_cond;
int64_t const value = *frm_4->matching_cond_lst[i].test_info_lst.int_value;
// Check E2 Node NG-RAN Type
if (NODE_IS_DU(RC.nrrrc[0]->node_type)) {
matched_ues_mac_t matched_ues = filter_ues_by_s_nssai_in_du_or_monolithic(test_cond, value);
kpm->ind.msg.frm_3 = fill_kpm_ind_msg_frm_3_in_du(matched_ues, &frm_4->action_def_format_1);
} else if (NODE_IS_CU(RC.nrrrc[0]->node_type)) {
matched_ues_rrc_t matched_ues = filter_ues_by_s_nssai_in_cu(test_cond, value);
kpm->ind.msg.frm_3 = fill_kpm_ind_msg_frm_3_in_cu(matched_ues, &frm_4->action_def_format_1);
} else if (NODE_IS_MONOLITHIC(RC.nrrrc[0]->node_type)) {
matched_ues_mac_t matched_ues = filter_ues_by_s_nssai_in_du_or_monolithic(test_cond, value);
kpm->ind.msg.frm_3 = fill_kpm_ind_msg_frm_3_in_monolithic(matched_ues, &frm_4->action_def_format_1);
} else {
assert(false && "NG-RAN Type not implemented");
}
break;
}
default:
assert(false && "Unknown Test condition");
}
}
break;
}
break;
}
default:
{
kpm->ind.hdr = fill_rnd_kpm_ind_hdr();
kpm->ind.msg = fill_rnd_kpm_ind_msg();
default: {
rnd_data_label:
kpm->ind.hdr = fill_rnd_kpm_ind_hdr();
kpm->ind.msg = fill_rnd_kpm_ind_msg();
break;
break;
}
}
}
}
void read_kpm_setup_sm(void* e2ap)

View File

@@ -2,6 +2,8 @@
#include "../../flexric/test/rnd/fill_rnd_data_rc.h"
#include "../../flexric/src/sm/rc_sm/ie/ir/lst_ran_param.h"
#include "../../flexric/src/sm/rc_sm/ie/ir/ran_param_list.h"
#include "../../flexric/src/agent/e2_agent_api.h"
#include <assert.h>
#include <stdio.h>
#include <pthread.h>

View File

@@ -1,4 +1,6 @@
#include "init_ran_func.h"
#include "read_setup_ran.h"
#include "../flexric/src/agent/e2_agent_api.h"
#include "CUSTOMIZED/ran_func_mac.h"
#include "CUSTOMIZED/ran_func_rlc.h"
#include "CUSTOMIZED/ran_func_pdcp.h"
@@ -67,6 +69,10 @@ sm_io_ag_ran_t init_ran_func_ag(void)
init_write_ctrl(&io.write_ctrl_tbl);
init_write_subs(&io.write_subs_tbl);
#if defined(E2AP_V2) || defined(E2AP_V3)
io.read_setup_ran = read_setup_ran;
#endif
return io;
}

View File

@@ -0,0 +1,42 @@
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include "read_setup_ran.h"
#include "../../E2AP/flexric/src/lib/e2ap/e2ap_node_component_config_add_wrapper.h"
#include "../../E2AP/flexric/test/rnd/fill_rnd_data_e2_setup_req.h"
#include <assert.h>
#include <stdlib.h>
void read_setup_ran(void* data)
{
assert(data != NULL);
#ifdef E2AP_V1
#elif defined(E2AP_V2) || defined(E2AP_V3)
*((e2ap_node_component_config_add_t*)data) = fill_e2ap_node_component_config_add();
#else
static_assert(0!=0, "Unknown E2AP version");
#endif
}

View File

@@ -0,0 +1,27 @@
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#ifndef READ_SETUP_RAN_E2_AGENT_H
#define READ_SETUP_RAN_E2_AGENT_H
void read_setup_ran(void* data);
#endif

View File

@@ -11,7 +11,7 @@ Please see [NOTICE](NOTICE.md) file for third party software that is included in
# Overview
This tutorial describes the steps of deployment 5G OAI RAN, with integrated E2 agent, and FlexRIC, O-RAN compliant nearRT-RIC.
This tutorial describes the steps of deployment 5G OAI RAN, with integrated E2 agent and a nearRT-RIC using O-RAN compliant FlexRIC.
# 1. Installation
@@ -29,9 +29,10 @@ This tutorial describes the steps of deployment 5G OAI RAN, with integrated E2 a
```bash
git clone https://github.com/swig/swig.git
cd swig
git checkout release-4.1
./autogen.sh
./configure --prefix=/usr/
make
make -j8
make install
```
@@ -57,12 +58,15 @@ git clone https://gitlab.eurecom.fr/oai/openairinterface5g oai
cd oai/
```
### 2.1.2 Build OAI
### 2.1.2 Build OAI with E2 Agent
- By default, OAI will build the E2 Agent with E2AP v2 and KPM v2. If you want a different version, edit the variable E2AP\_VERSION and KPM\_VERSION at OAI's CMakeLists.txt file.
```bash
cd cmake_targets/
./build_oai -I -w SIMU --gNB --nrUE --build-e2 --ninja
```
If the flexric folder is empty, try manually the following commands
If the openair2/E2AP/flexric folder is empty, try manually the following commands
```bash
git submodule init
@@ -74,15 +78,18 @@ git submodule update
* `--gNB` is to build the `nr-softmodem` and `nr-cuup` executables and all required shared libraries
* `--nrUE` is to build the `nr-uesoftmodem` executable and all required shared libraries
* `--ninja` is to use the ninja build tool, which speeds up compilation
* `--build-e2` option is to use the E2 agent, integrated within gNB.
* `--build-e2` option is to use the E2 agent, integrated within RAN.
## 2.2 FlexRIC
- By default, FlexRIC will build the nearRT-RIC with E2AP v2 and KPM v2. If you want a different version, edit the variable E2AP\_VERSION and KPM\_VERSION at FlexRIC's CMakeLists.txt file. Note that OAI's and FlexRIC's E2AP\_VERSION and KPM\_VERSION need to match due to O-RAN incompatibilities among versions.
### 2.2.1 Clone the FlexRIC repository
```bash
git clone https://gitlab.eurecom.fr/mosaic5g/flexric flexric
cd flexric/
git checkout 8ee3aca107a9da8ccf425e623bed18cd40a31fa1
git checkout 035fd2e8f9a9d2c16df8d44c9e8c13ccddf9ff19
```
### 2.2.2 Build FlexRIC
@@ -98,7 +105,8 @@ sudo make install
By default the service model libraries will be installed in the path `/usr/local/lib/flexric` while the configuration file in `/usr/local/etc/flexric`.
Available SMs in this version are:
* KPM v03.00 (xapp_kpm_moni)
* KPM v02.03 and KPM v03.00 (xapp_kpm_moni)
* RC v01.03 (xapp_kpm_rc)
* GTP (xapp_gtp_moni)
* MAC + RLC + PDCP (xapp_mac_rlc_pdcp_moni)
@@ -106,7 +114,7 @@ If you are interested in TC and SLICE SMs, please follow the instructions at htt
# 3. Start the process
In order to configure E2 agent, please, add the following block in the configuration file:
In order to configure E2 agent, please, add the following block in OAI's configuration file:
```bash
e2_agent = {
near_ric_ip_addr = "127.0.0.1";

View File

@@ -935,6 +935,29 @@ int DU_handle_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance, sctp_assoc_t
LOG_D(F1AP, "can't find RRCContainer in UEContextModificationRequestIEs by id %ld \n", F1AP_ProtocolIE_ID_id_RRCContainer);
}
/* CU2DU Information */
F1AP_UEContextModificationRequestIEs_t *ieCU2DU = NULL;
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextModificationRequestIEs_t,
ieCU2DU,
container,
F1AP_ProtocolIE_ID_id_CUtoDURRCInformation,
false);
if (ieCU2DU != NULL) {
f1ap_ue_context_modification_req->cu_to_du_rrc_information =
calloc(1, sizeof(*f1ap_ue_context_modification_req->cu_to_du_rrc_information));
AssertFatal(f1ap_ue_context_modification_req->cu_to_du_rrc_information != NULL, "out of memory\n");
cu_to_du_rrc_information_t *cu2du = f1ap_ue_context_modification_req->cu_to_du_rrc_information;
const F1AP_CUtoDURRCInformation_t *cu2duie = &ieCU2DU->value.choice.CUtoDURRCInformation;
AssertFatal(cu2duie->cG_ConfigInfo == NULL, "cg_ConfigInfo not implemented\n");
AssertFatal(cu2duie->measConfig == NULL, "measConfig not implemented\n");
AssertFatal(cu2duie->uE_CapabilityRAT_ContainerList != NULL, "uE_CapabilityRAT_ContainerList must be present\n");
F1AP_UE_CapabilityRAT_ContainerList_t *uecap = cu2duie->uE_CapabilityRAT_ContainerList;
cu2du->uE_CapabilityRAT_ContainerList = calloc(uecap->size, sizeof(*cu2du->uE_CapabilityRAT_ContainerList));
AssertFatal(cu2du->uE_CapabilityRAT_ContainerList != NULL, "out of memory\n");
cu2du->uE_CapabilityRAT_ContainerList_length = uecap->size;
memcpy(cu2du->uE_CapabilityRAT_ContainerList, uecap->buf, uecap->size);
}
ue_context_modification_request(f1ap_ue_context_modification_req);
return 0;
}

View File

@@ -62,10 +62,12 @@ static void process_rlcBearerConfig(struct NR_CellGroupConfig__rlc_BearerToAddMo
if (rlc_bearer2release_list) {
for (int i = 0; i < rlc_bearer2release_list->list.count; i++) {
for (int idx = 0; idx < sched_ctrl->dl_lc_num; idx++) {
if (sched_ctrl->dl_lc_ids[idx] == *rlc_bearer2release_list->list.array[i]) {
const int lcid = *rlc_bearer2release_list->list.array[i];
if (sched_ctrl->dl_lc_ids[idx] == lcid) {
const int remaining_lcs = sched_ctrl->dl_lc_num - idx - 1;
memmove(&sched_ctrl->dl_lc_ids[idx], &sched_ctrl->dl_lc_ids[idx + 1], sizeof(sched_ctrl->dl_lc_ids[idx]) * remaining_lcs);
sched_ctrl->dl_lc_num--;
LOG_I(NR_MAC, "remove LCID %d (%s %d)\n", lcid, lcid < 4 ? "SRB" : "DRB", lcid);
break;
}
}
@@ -75,7 +77,7 @@ static void process_rlcBearerConfig(struct NR_CellGroupConfig__rlc_BearerToAddMo
if (rlc_bearer2add_list) {
// keep lcids
for (int i = 0; i < rlc_bearer2add_list->list.count; i++) {
const int lcid = rlc_bearer2add_list->list.array[i]->logicalChannelIdentity;
const uint8_t lcid = rlc_bearer2add_list->list.array[i]->logicalChannelIdentity;
bool found = false;
for (int idx = 0; idx < sched_ctrl->dl_lc_num; idx++) {
if (sched_ctrl->dl_lc_ids[idx] == lcid) {
@@ -85,9 +87,21 @@ static void process_rlcBearerConfig(struct NR_CellGroupConfig__rlc_BearerToAddMo
}
if (!found) {
/* we assume that the first two are SRB bearers, and we add before
* other DRB */
uint8_t i = 0;
/* go beyond all SRBs */
while (i < sched_ctrl->dl_lc_num && sched_ctrl->dl_lc_ids[i] < 4)
i++;
uint8_t remaining_lcs = sched_ctrl->dl_lc_num - i;
memmove(&sched_ctrl->dl_lc_ids[i + 1], &sched_ctrl->dl_lc_ids[i], sizeof(sched_ctrl->dl_lc_ids[i]) * remaining_lcs);
sched_ctrl->dl_lc_ids[i] = lcid;
sched_ctrl->dl_lc_num++;
sched_ctrl->dl_lc_ids[sched_ctrl->dl_lc_num - 1] = lcid;
LOG_D(NR_MAC, "Adding LCID %d (%s %d)\n", lcid, lcid < 4 ? "SRB" : "DRB", lcid);
LOG_I(NR_MAC, "Adding LCID %d (%s %d)\n", lcid, lcid < 4 ? "SRB" : "DRB", lcid);
for (i = 0; i < sched_ctrl->dl_lc_num; ++i)
LOG_E(NR_MAC, "bearer %d LCID %s %d\n", i, lcid < 4 ? "SRB" : "DRB", sched_ctrl->dl_lc_ids[i]);
}
}
}

View File

@@ -329,7 +329,7 @@ static void nr_store_dlsch_buffer(module_id_t module_id, frame_t frame, sub_fram
const int lcid = sched_ctrl->dl_lc_ids[i];
const uint16_t rnti = UE->rnti;
LOG_D(NR_MAC, "In %s: UE %x: LCID %d\n", __FUNCTION__, rnti, lcid);
if (lcid == DL_SCH_LCID_DTCH && sched_ctrl->rrc_processing_timer > 0) {
if (lcid >= DL_SCH_LCID_DTCH && sched_ctrl->rrc_processing_timer > 0) {
continue;
}
start_meas(&RC.nrmac[module_id]->rlc_status_ind);

View File

@@ -369,7 +369,8 @@ void ue_context_modification_request(const f1ap_ue_context_modif_req_t *req)
update_cellGroupConfig(new_CellGroup, UE->uid, UE->capability, &mac->radio_config, scc);
}
if (req->srbs_to_be_setup_length > 0 || req->drbs_to_be_setup_length > 0 || req->drbs_to_be_released_length > 0) {
if (req->srbs_to_be_setup_length > 0 || req->drbs_to_be_setup_length > 0 || req->drbs_to_be_released_length > 0
|| ue_cap != NULL) {
resp.du_to_cu_rrc_information = calloc(1, sizeof(du_to_cu_rrc_information_t));
AssertFatal(resp.du_to_cu_rrc_information != NULL, "out of memory\n");
resp.du_to_cu_rrc_information->cellGroupConfig = calloc(1, 1024);

View File

@@ -892,7 +892,7 @@ void add_drb(int is_gnb,
has_integrity ? integrity_key : NULL);
nr_pdcp_ue_add_drb_pdcp_entity(ue, drb_id, pdcp_drb);
LOG_D(PDCP, "%s:%d:%s: added drb %d to UE ID/RNTI %ld\n", __FILE__, __LINE__, __FUNCTION__, drb_id, rntiMaybeUEid);
LOG_I(PDCP, "%s:%d:%s: added drb %d to UE ID/RNTI %ld\n", __FILE__, __LINE__, __FUNCTION__, drb_id, rntiMaybeUEid);
new_nr_sdap_entity(is_gnb, has_sdap_rx, has_sdap_tx, rntiMaybeUEid, pdusession_id, is_sdap_DefaultDRB, drb_id, mappedQFIs2Add, mappedQFIs2AddCount);
}
@@ -1100,9 +1100,16 @@ void nr_pdcp_release_drb(ue_id_t ue_id, int drb_id)
nr_pdcp_ue_t *ue = nr_pdcp_manager_get_ue(nr_pdcp_ue_manager, ue_id);
nr_pdcp_entity_t *drb = ue->drb[drb_id - 1];
if (drb) {
LOG_I(PDCP, "release bearer %d of UE %ld\n", drb_id, ue_id);
drb->release_entity(drb);
drb->delete_entity(drb);
ue->drb[drb_id - 1] = NULL;
int sessionId = 1;
nr_sdap_entity_t *sdap = nr_sdap_get_entity(ue_id, sessionId); /* default */
if (sdap == NULL)
LOG_E(PDCP, "no SDAP entity for UE %ld PDU session ID %d\n", ue_id, sessionId);
else
sdap->has_second_bearer = 0;
}
else
LOG_E(PDCP, "Attempting to release DRB%d but it is not configured\n", drb_id);

View File

@@ -78,14 +78,15 @@ static int generate_tx_pdu(nr_rlc_entity_tm_t *entity, char *buffer, int size)
entity->tx_size -= sdu->size;
entity->common.stats.txpdu_pkts++;
entity->common.stats.txpdu_bytes += size;
/* No need to 'zero' time-of-arrival;
Segmented packets do need to be duplicated in time-sensitive use cases */
if (entity->common.avg_time_is_on) {
/*
if (sdu->sdu->time_of_arrival) {
uint64_t time_now = time_average_now();
uint64_t waited_time = time_now - sdu->sdu->time_of_arrival;
// set time_of_arrival to 0 so as to update stats only once
sdu->sdu->time_of_arrival = 0;
time_average_add(entity->common.txsdu_avg_time_to_tx, time_now, waited_time);
}
*/
/* update buffer status */
entity->common.bstatus.tx_size -= sdu->size;

View File

@@ -521,13 +521,15 @@ static int generate_tx_pdu(nr_rlc_entity_um_t *entity, char *buffer, int size)
entity->common.stats.txpdu_pkts++;
entity->common.stats.txpdu_bytes += size;
/* No need to 'zero' time-of-arrival;
Segmented packets do need to be duplicated in time-sensitive use cases */
if (entity->common.avg_time_is_on) {
/*
if (sdu->sdu->time_of_arrival) {
uint64_t time_now = time_average_now();
uint64_t waited_time = time_now - sdu->sdu->time_of_arrival;
// set time_of_arrival to 0 so as to update stats only once
sdu->sdu->time_of_arrival = 0;
time_average_add(entity->common.txsdu_avg_time_to_tx, time_now, waited_time);
}
*/
nr_rlc_free_sdu_segment(sdu);

View File

@@ -909,89 +909,21 @@ rrc_gNB_generate_dedicatedRRCReconfiguration_release(
static void rrc_gNB_process_RRCReconfigurationComplete(const protocol_ctxt_t *const ctxt_pP, rrc_gNB_ue_context_t *ue_context_pP, const uint8_t xid)
{
int drb_id;
uint8_t kRRCenc[16] = {0};
uint8_t kRRCint[16] = {0};
uint8_t kUPenc[16] = {0};
uint8_t kUPint[16] = {0};
gNB_RRC_UE_t *ue_p = &ue_context_pP->ue_context;
NR_DRB_ToAddModList_t *DRB_configList = createDRBlist(ue_p, false);
/* Derive the keys from kgnb */
if (DRB_configList != NULL) {
nr_derive_key(UP_ENC_ALG, ue_p->ciphering_algorithm, ue_p->kgnb, kUPenc);
nr_derive_key(UP_INT_ALG, ue_p->integrity_algorithm, ue_p->kgnb, kUPint);
}
nr_derive_key(RRC_ENC_ALG, ue_p->ciphering_algorithm, ue_p->kgnb, kRRCenc);
nr_derive_key(RRC_INT_ALG, ue_p->integrity_algorithm, ue_p->kgnb, kRRCint);
/* Refresh SRBs/DRBs */
LOG_D(NR_RRC, "Configuring PDCP DRBs/SRBs for UE %04x\n", ue_p->rnti);
ue_context_pP->ue_context.ue_reconfiguration_after_reestablishment_counter++;
NR_SRB_ToAddModList_t *SRBs = createSRBlist(ue_p, false);
nr_pdcp_add_srbs(ctxt_pP->enb_flag,
ue_p->rrc_ue_id,
SRBs,
(ue_p->integrity_algorithm << 4) | ue_p->ciphering_algorithm,
kRRCenc,
kRRCint);
freeSRBlist(SRBs);
nr_pdcp_add_drbs(ctxt_pP->enb_flag,
ue_p->rrc_ue_id,
DRB_configList,
(ue_p->integrity_algorithm << 4) | ue_p->ciphering_algorithm,
kUPenc,
kUPint);
/* Loop through DRBs and establish if necessary */
if (DRB_configList != NULL) {
for (int i = 0; i < DRB_configList->list.count; i++) {
if (DRB_configList->list.array[i]) {
drb_id = (int)DRB_configList->list.array[i]->drb_Identity;
LOG_A(NR_RRC,
"[gNB %d] Frame %d : Logical Channel UL-DCCH, Received NR_RRCReconfigurationComplete from UE rnti %lx, reconfiguring DRB %d\n",
ctxt_pP->module_id,
ctxt_pP->frame,
ctxt_pP->rntiMaybeUEid,
(int)DRB_configList->list.array[i]->drb_Identity);
//(int)*DRB_configList->list.array[i]->pdcp_Config->moreThanOneRLC->primaryPath.logicalChannel);
if (ue_p->DRB_active[drb_id - 1] == 0) {
ue_p->DRB_active[drb_id - 1] = DRB_ACTIVE;
LOG_D(NR_RRC, "[gNB %d] Frame %d: Establish RLC UM Bidirectional, DRB %d Active\n",
ctxt_pP->module_id, ctxt_pP->frame, (int)DRB_configList->list.array[i]->drb_Identity);
LOG_D(NR_RRC,
PROTOCOL_NR_RRC_CTXT_UE_FMT" RRC_gNB --- MAC_CONFIG_REQ (DRB) ---> MAC_gNB\n",
PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP));
//if (DRB_configList->list.array[i]->pdcp_Config->moreThanOneRLC->primaryPath.logicalChannel) {
// nr_DRB2LCHAN[i] = (uint8_t) * DRB_configList->list.array[i]->pdcp_Config->moreThanOneRLC->primaryPath.logicalChannel;
//}
// rrc_mac_config_req_eNB
} else { // remove LCHAN from MAC/PHY
if (ue_p->DRB_active[drb_id] == 1) {
/* TODO : It may be needed if gNB goes into full stack working. */
// DRB has just been removed so remove RLC + PDCP for DRB
/* rrc_pdcp_config_req (ctxt_pP->module_id, frameP, 1, CONFIG_ACTION_REMOVE,
(ue_mod_idP * NB_RB_MAX) + DRB2LCHAN[i],UNDEF_SECURITY_MODE);
*/
/*rrc_rlc_config_req(ctxt_pP,
SRB_FLAG_NO,
MBMS_FLAG_NO,
CONFIG_ACTION_REMOVE,
nr_DRB2LCHAN[i]);*/
}
// ue_p->DRB_active[drb_id] = 0;
LOG_D(NR_RRC, PROTOCOL_NR_RRC_CTXT_UE_FMT" RRC_eNB --- MAC_CONFIG_REQ (DRB) ---> MAC_eNB\n",
PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP));
// rrc_mac_config_req_eNB
} // end else of if (ue_p->DRB_active[drb_id] == 0)
}
} // end if (DRB_configList->list.array[i])
} // end for (int i = 0; i < DRB_configList->list.count; i++)
@@ -2338,6 +2270,50 @@ int rrc_gNB_process_e1_setup_req(e1ap_setup_req_t *req, instance_t instance) {
return 0;
}
static void activate_srb(gNB_RRC_UE_t *UE, int srb_id)
{
LOG_I(RRC, "activate SRB %d of UE %d\n", srb_id, UE->rrc_ue_id);
uint8_t kRRCenc[16] = {0};
uint8_t kRRCint[16] = {0};
nr_derive_key(RRC_ENC_ALG, UE->ciphering_algorithm, UE->kgnb, kRRCenc);
nr_derive_key(RRC_INT_ALG, UE->integrity_algorithm, UE->kgnb, kRRCint);
NR_SRB_ToAddModList_t *list = CALLOC(sizeof(*list), 1);
asn1cSequenceAdd(list->list, NR_SRB_ToAddMod_t, srb);
srb->srb_Identity = srb_id;
nr_pdcp_add_srbs(true,
UE->rrc_ue_id,
list,
(UE->integrity_algorithm << 4) | UE->ciphering_algorithm,
kRRCenc,
kRRCint);
freeSRBlist(list);
}
static void activate_drb(gNB_RRC_UE_t *UE, int drb_id)
{
LOG_I(RRC, "activate DRB %d of UE %d\n", drb_id, UE->rrc_ue_id);
/* Derive the keys from kgnb */
uint8_t kUPenc[16] = {0};
uint8_t kUPint[16] = {0};
nr_derive_key(UP_ENC_ALG, UE->ciphering_algorithm, UE->kgnb, kUPenc);
nr_derive_key(UP_INT_ALG, UE->integrity_algorithm, UE->kgnb, kUPint);
NR_DRB_ToAddModList_t *DRB_configList = CALLOC(sizeof(*DRB_configList), 1);
//AssertFatal(UE->established_drbs[drb_id - 1].status == DRB_ACTIVE, "logic bug: DRB %d inactive\n", drb_id);
NR_DRB_ToAddMod_t *DRB_config = generateDRB_ASN1(&UE->established_drbs[drb_id - 1]);
asn1cSeqAdd(&DRB_configList->list, DRB_config);
nr_pdcp_add_drbs(true,
UE->rrc_ue_id,
DRB_configList,
(UE->integrity_algorithm << 4) | UE->ciphering_algorithm,
kUPenc,
kUPint);
}
void prepare_and_send_ue_context_modification_f1(rrc_gNB_ue_context_t *ue_context_p, e1ap_bearer_setup_resp_t *e1ap_resp)
{
/* Generate a UE context modification request message towards the DU to
@@ -2357,12 +2333,15 @@ void prepare_and_send_ue_context_modification_f1(rrc_gNB_ue_context_t *ue_contex
drbs[i].up_ul_tnl[0].port = rrc->eth_params_s.my_portd;
drbs[i].up_ul_tnl[0].teid = e1ap_resp->pduSession[0].DRBnGRanList[i].UpParamList[0].teId;
drbs[i].up_ul_tnl_length = 1;
activate_drb(UE, drbs[i].drb_id);
}
/* Instruction towards the DU for SRB2 configuration */
int nb_srb = 0;
f1ap_srb_to_be_setup_t srbs[1];
if (UE->Srb[2].Active == 0) {
/* hack: we activate SRB2 here */
activate_srb(UE, 2);
UE->Srb[2].Active = 1;
nb_srb = 1;
srbs[0].srb_id = 2;
@@ -2924,8 +2903,6 @@ void rrc_gNB_trigger_new_bearer(int rnti)
}
int xid = rrc_gNB_get_next_transaction_identifier(0);
/* generate a new bearer, it will be put into internal RRC state and picked
* up later */
generateDRB(ue,
drb_id,
&ue->pduSession[0],
@@ -2958,8 +2935,9 @@ void rrc_gNB_trigger_release_bearer(int rnti)
// don't use E1: bearer release is not implemented, call directly
// into PDCP/SDAP and then send corresponding message via F1
int drb_id = 2;
nr_pdcp_release_drb(ue->rrc_ue_id, drb_id);
ue->established_drbs[1].status = DRB_INACTIVE;
ue->DRB_ReleaseList = calloc(1, sizeof(*ue->DRB_ReleaseList));
AssertFatal(ue->DRB_ReleaseList != NULL, "out of memory\n");

View File

@@ -25,6 +25,13 @@
#include <openair3/ocp-gtpu/gtp_itf.h>
#include "openair2/LAYER2/nr_pdcp/nr_pdcp_ue_manager.h"
#include <arpa/inet.h>
#include <netinet/ip.h>
#include <netinet/ip6.h>
#include <netinet/tcp.h>
#include <netinet/udp.h>
#include <netinet/ip_icmp.h>
#include <stdlib.h>
#include <string.h>
#include <pthread.h>
@@ -92,7 +99,45 @@ static bool nr_sdap_tx_entity(nr_sdap_entity_t *entity,
if(!pdcp_ent_has_sdap){
LOG_D(SDAP, "TX - DRB ID: %ld does not have SDAP\n", entity->qfi2drb_table[qfi].drb_id);
ret = nr_pdcp_data_req_drb(ctxt_p,
// Flag only for the gNB defined
//#ifdef MIR_FLAG
// mir
// Naive L4/L3 packet classifier
struct iphdr* hdr = (struct iphdr*)sdu_buffer;
if(hdr->protocol == IPPROTO_TCP){
struct tcphdr* tcp = (struct tcphdr*)((uint32_t*)hdr + hdr->ihl);
uint16_t const src_port = ntohs(tcp->source);
uint16_t const dst_port = ntohs(tcp->dest);
//printf("TCP pkt src_port %d dst_port %d \n", src_port, dst_port);
if (entity->is_gnb && entity->has_second_bearer && dst_port != 10101 && dst_port != 5201) {
sdap_drb_id += 1;
}
//printf("TCP to bearer %ld\n", sdap_drb_id);
} else if(hdr->protocol == IPPROTO_UDP){
struct udphdr *udp = (struct udphdr *)((uint32_t*)hdr + hdr->ihl);
uint16_t const src_port = ntohs(udp->source);
uint16_t const dst_port = ntohs(udp->dest);
// printf("UDP pkt src_port %d dst_port %d \n", src_port, dst_port);
if (entity->is_gnb && entity->has_second_bearer && dst_port != 10101 && dst_port != 5201 && dst_port != 2154 && dst_port != 2153) {
sdap_drb_id += 1;
}
} else if(hdr->protocol == IPPROTO_ICMP){
//printf("Ping packet detected \n");
if (entity->is_gnb && entity->has_second_bearer) {
sdap_drb_id += 1;
}
//printf("ping to bearer %ld\n", sdap_drb_id);
//cnt++;
}
//#endif
//label:
ret = nr_pdcp_data_req_drb(ctxt_p,
srb_flag,
sdap_drb_id,
mui,
@@ -103,6 +148,12 @@ static bool nr_sdap_tx_entity(nr_sdap_entity_t *entity,
sourceL2Id,
destinationL2Id);
// if(!ret && sdap_drb_id == 2){
// sdap_drb_id = 1;
// goto label;
// }
if(!ret)
LOG_E(SDAP, "%s:%d:%s: PDCP refused PDU\n", __FILE__, __LINE__, __FUNCTION__);
@@ -407,11 +458,12 @@ void nr_sdap_ue_qfi2drb_config(nr_sdap_entity_t *existing_sdap_entity, rb_id_t p
nr_sdap_entity_t *new_nr_sdap_entity(int is_gnb, bool has_sdap_rx, bool has_sdap_tx, ue_id_t ue_id, int pdusession_id, bool is_defaultDRB, uint8_t drb_identity, NR_QFI_t *mapped_qfi_2_add, uint8_t mappedQFIs2AddCount)
{
if (nr_sdap_get_entity(ue_id, pdusession_id)) {
LOG_E(SDAP, "SDAP Entity for UE already exists with RNTI/UE ID: %lu and PDU SESSION ID: %d\n", ue_id, pdusession_id);
LOG_I(SDAP, "SDAP Entity for UE already exists with RNTI/UE ID: %lu and PDU SESSION ID: %d\n", ue_id, pdusession_id);
nr_sdap_entity_t *existing_sdap_entity = nr_sdap_get_entity(ue_id, pdusession_id);
rb_id_t pdcp_entity = existing_sdap_entity->default_drb;
if(!is_gnb)
nr_sdap_ue_qfi2drb_config(existing_sdap_entity, pdcp_entity, ue_id, mapped_qfi_2_add, mappedQFIs2AddCount, drb_identity, has_sdap_rx, has_sdap_tx);
existing_sdap_entity->has_second_bearer = 1;
return existing_sdap_entity;
}
@@ -425,6 +477,7 @@ nr_sdap_entity_t *new_nr_sdap_entity(int is_gnb, bool has_sdap_rx, bool has_sdap
sdap_entity->ue_id = ue_id;
sdap_entity->pdusession_id = pdusession_id;
sdap_entity->is_gnb = is_gnb;
sdap_entity->tx_entity = nr_sdap_tx_entity;
sdap_entity->rx_entity = nr_sdap_rx_entity;

View File

@@ -79,6 +79,8 @@ void nr_pdcp_submit_sdap_ctrl_pdu(ue_id_t ue_id, rb_id_t sdap_ctrl_pdu_drb, nr_s
typedef struct nr_sdap_entity_s {
ue_id_t ue_id;
rb_id_t default_drb;
int is_gnb;
int has_second_bearer;
int pdusession_id;
qfi2drb_t qfi2drb_table[SDAP_MAX_QFI];