e2ap: add e2 setup response processing, add RANfunction storage functionality.

master
yagoda 2 years ago committed by Justin Tallon
parent cd442e57ca
commit 07929b74f6

@ -22,6 +22,18 @@
using namespace asn1::e2ap;
using namespace asn1::e2sm_kpm;
typedef struct {
uint16_t ric_id;
uint16_t plmn_id;
} global_ric_id_t;
typedef struct {
e2node_component_interface_type_e interface_type;
std::string amf_name;
std::string request_part;
std::string response_part;
} e2_node_component_t;
class e2ap
{
public:
@ -43,6 +55,8 @@ private:
int setup_procedure_transaction_id = 0;
uint64_t plmn_id = 3617847;
uint64_t gnb_id = 381210353;
global_ric_id_t global_ric_id = {};
std::map<uint32_t, RANfunction_description> ran_functions;
};
#endif /* RIC_E2AP_H */

@ -17,11 +17,20 @@
#ifndef RIC_E2SM_KPM_H
#define RIC_E2SM_KPM_H
struct RANfunction_description {
bool accepted = false;
std::string function_desc;
std::string function_shortname;
std::string function_e2_sm_oid;
int function_instance;
};
class e2sm_kpm
{
public:
e2sm_kpm(srslog::basic_logger& logger_);
bool generate_ran_function_description(srsran::unique_byte_buffer_t& buf);
bool
generate_ran_function_description(int function_id, RANfunction_description desc, srsran::unique_byte_buffer_t& buf);
bool process_ric_action_definition();
bool generate_indication_header();
bool generate_indication_message();

@ -27,11 +27,19 @@ e2_ap_pdu_c e2ap::generate_setup_request()
asn1::protocol_ie_single_container_s<ra_nfunction_item_ies_o> item;
item.load_info_obj(ASN1_E2AP_ID_RA_NFUNCTION_ITEM);
item.value().ra_nfunction_item().ran_function_id = 0;
item.value().ra_nfunction_item().ran_function_revision = 1;
// pack E2SM-KPM-PDU into ran function definition
// add function to map
RANfunction_description add_func;
add_func.function_desc = "KPM monitor";
add_func.function_shortname = "ORAN-E2SM-KPM";
add_func.function_instance = 0;
ran_functions[item.value().ra_nfunction_item().ran_function_id] = add_func;
auto& ran_func_def = item.value().ra_nfunction_item().ran_function_definition;
srsran::unique_byte_buffer_t buf = srsran::make_byte_buffer();
e2sm_.generate_ran_function_description(buf);
e2sm_.generate_ran_function_description(item.value().ra_nfunction_item().ran_function_id, add_func, buf);
ran_func_def.resize(buf->N_bytes);
std::copy(buf->msg, buf->msg + buf->N_bytes, ran_func_def.data());
@ -71,10 +79,29 @@ e2_ap_pdu_c e2ap::generate_subscription_response()
action_admit_list[0].value().ri_caction_admitted_item().ric_action_id = 1;
return pdu;
}
int e2ap::process_setup_response(e2setup_resp_s setup_response)
{
setup_response_received = true;
// TODO process setup response
if (setup_procedure_transaction_id == setup_response->transaction_id.value.value) {
setup_procedure_transaction_id++;
} else {
logger.error("Received setup response with wrong transaction id");
}
global_ric_id.plmn_id = setup_response->global_ric_id.value.plmn_id.to_number();
global_ric_id.ric_id = setup_response->global_ric_id.value.ric_id.to_number();
if (setup_response->ra_nfunctions_accepted_present) {
for (int i = 0; i < (int)setup_response->ra_nfunctions_accepted.value.size(); i++) {
uint32_t ran_func_id = setup_response->ra_nfunctions_accepted.value[i]->ra_nfunction_id_item().ran_function_id;
if (ran_functions.find(ran_func_id) == ran_functions.end()) {
logger.error("Received setup response with unknown ran function id %d", ran_func_id);
} else {
logger.info("Received setup response with ran function id %d", ran_func_id);
ran_functions[ran_func_id].accepted = true;
}
}
}
return 0;
}

@ -2,15 +2,17 @@
e2sm_kpm::e2sm_kpm(srslog::basic_logger& logger_) : logger(logger_) {}
bool e2sm_kpm::generate_ran_function_description(srsran::unique_byte_buffer_t& buf)
bool e2sm_kpm::generate_ran_function_description(int function_id,
RANfunction_description desc,
srsran::unique_byte_buffer_t& buf)
{
using namespace asn1::e2sm_kpm;
e2_sm_kpm_ra_nfunction_description_s e2sm_kpm_ra_nfunction_description;
e2sm_kpm_ra_nfunction_description.ran_function_name.ran_function_instance_present = true;
e2sm_kpm_ra_nfunction_description.ran_function_name.ran_function_instance = 0;
e2sm_kpm_ra_nfunction_description.ran_function_name.ran_function_short_name.from_string("ORAN-E2SM-KPM");
e2sm_kpm_ra_nfunction_description.ran_function_name.ran_function_e2_sm_oid.from_string("OID123");
e2sm_kpm_ra_nfunction_description.ran_function_name.ran_function_description.from_string("KPM monitor");
e2sm_kpm_ra_nfunction_description.ran_function_name.ran_function_instance = desc.function_instance;
e2sm_kpm_ra_nfunction_description.ran_function_name.ran_function_short_name.from_string(desc.function_shortname);
e2sm_kpm_ra_nfunction_description.ran_function_name.ran_function_e2_sm_oid.from_string(desc.function_e2_sm_oid);
e2sm_kpm_ra_nfunction_description.ran_function_name.ran_function_description.from_string(desc.function_desc);
e2sm_kpm_ra_nfunction_description.e2_sm_kpm_ra_nfunction_item.ric_event_trigger_style_list.resize(1);
auto& ric_event_trigger_style_list_item =

Loading…
Cancel
Save