e2ap,ric: adding support of E2-RIC subscription request/response

master
yagoda 2 years ago committed by Justin Tallon
parent be2442a459
commit d34bd957bc

@ -25,14 +25,15 @@ public:
e2_ap_pdu_c generate_setup_request(); e2_ap_pdu_c generate_setup_request();
int process_setup_response(e2setup_resp_s setup_response); int process_setup_response(e2setup_resp_s setup_response);
int process_setup_failure(); int process_setup_failure();
int process_subscription_request(); int process_subscription_request(ricsubscription_request_s subscription_request);
int generate_subscription_response(); e2_ap_pdu_c generate_subscription_response();
int generate_subscription_failure(); int generate_subscription_failure();
int generate_indication(); int generate_indication();
bool has_setup_response() { return setup_response_received; } bool has_setup_response() { return setup_response_received; }
private: private:
bool setup_response_received = false; bool setup_response_received = false;
bool pending_subscription_request = false;
}; };
#endif /* RIC_E2AP_H */ #endif /* RIC_E2AP_H */

@ -37,6 +37,7 @@ public:
bool handle_e2_successful_outcome(asn1::e2ap::successful_outcome_s& successful_outcome); bool handle_e2_successful_outcome(asn1::e2ap::successful_outcome_s& successful_outcome);
bool handle_e2_unsuccessful_outcome(asn1::e2ap::unsuccessful_outcome_s& unsuccessful_outcome); bool handle_e2_unsuccessful_outcome(asn1::e2ap::unsuccessful_outcome_s& unsuccessful_outcome);
bool handle_e2_setup_response(e2setup_resp_s setup_response); bool handle_e2_setup_response(e2setup_resp_s setup_response);
bool handle_ric_subscription_request(ricsubscription_request_s ric_subscription_request);
private: private:
e2ap e2ap_; e2ap e2ap_;

@ -52,9 +52,37 @@ e2_ap_pdu_c e2ap::generate_setup_request()
return pdu; return pdu;
} }
e2_ap_pdu_c e2ap::generate_subscription_response()
{
e2_ap_pdu_c pdu;
successful_outcome_s& success = pdu.set_successful_outcome();
success.load_info_obj(ASN1_E2AP_ID_RICSUBSCRIPTION);
ricsubscription_resp_s& sub_resp = success.value.ricsubscription_resp();
sub_resp->ri_crequest_id.crit = asn1::crit_opts::reject;
sub_resp->ri_crequest_id.id = ASN1_E2AP_ID_RI_CREQUEST_ID;
sub_resp->ri_crequest_id.value.ric_requestor_id = 123;
sub_resp->ri_crequest_id.value.ric_instance_id = 21;
sub_resp->ra_nfunction_id.crit = asn1::crit_opts::reject;
sub_resp->ra_nfunction_id.id = ASN1_E2AP_ID_RA_NFUNCTION_ID;
sub_resp->ri_cactions_admitted.crit = asn1::crit_opts::reject;
auto& action_admit_list = sub_resp->ri_cactions_admitted.value;
action_admit_list.resize(1);
action_admit_list[0].load_info_obj(ASN1_E2AP_ID_RI_CACTION_ADMITTED_ITEM);
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) int e2ap::process_setup_response(e2setup_resp_s setup_response)
{ {
setup_response_received = true; setup_response_received = true;
// TODO process setup response // TODO process setup response
return 0; return 0;
} }
int e2ap::process_subscription_request(ricsubscription_request_s subscription_request)
{
pending_subscription_request = true;
// TODO process subscription request
return 0;
}

@ -136,7 +136,7 @@ bool ric_client::handle_e2_rx_msg(srsran::unique_byte_buffer_t pdu,
handle_e2_init_msg(pdu_c.init_msg()); handle_e2_init_msg(pdu_c.init_msg());
} else if (pdu_c.type().value == e2_ap_pdu_c::types_opts::successful_outcome) { } else if (pdu_c.type().value == e2_ap_pdu_c::types_opts::successful_outcome) {
logger.info("Received E2AP Successful Outcome"); logger.info("Received E2AP Successful Outcome");
// handle_e2_successful_outcome(pdu_c.successful_outcome()); handle_e2_successful_outcome(pdu_c.successful_outcome());
} else if (pdu_c.type().value == e2_ap_pdu_c::types_opts::unsuccessful_outcome) { } else if (pdu_c.type().value == e2_ap_pdu_c::types_opts::unsuccessful_outcome) {
logger.info("Received E2AP Unsuccessful Outcome "); logger.info("Received E2AP Unsuccessful Outcome ");
// handle_e2_unsuccessful_outcome(pdu_c.unsuccessful_outcome()); // handle_e2_unsuccessful_outcome(pdu_c.unsuccessful_outcome());
@ -149,6 +149,27 @@ bool ric_client::handle_e2_rx_msg(srsran::unique_byte_buffer_t pdu,
bool ric_client::handle_e2_init_msg(asn1::e2ap::init_msg_s& init_msg) bool ric_client::handle_e2_init_msg(asn1::e2ap::init_msg_s& init_msg)
{ {
using namespace asn1::e2ap; using namespace asn1::e2ap;
if (init_msg.value.type() == e2_ap_elem_procs_o::init_msg_c::types_opts::ricsubscription_request) {
logger.info("Received E2AP RIC Subscription Request");
handle_ric_subscription_request(init_msg.value.ricsubscription_request());
} else if (init_msg.value.type() == e2_ap_elem_procs_o::init_msg_c::types_opts::ricsubscription_delete_request) {
logger.info("Received E2AP RIC Subscription Delete Request");
// handle_ric_subscription_delete_request(init_msg.value.ricsubscription_delete_request());
} else if (init_msg.value.type() == e2_ap_elem_procs_o::init_msg_c::types_opts::ri_cctrl_request) {
logger.info("Received E2AP RIC Control Request");
// handle_ri_cctrl_request(init_msg.value.ri_cctrl_request());
} else if (init_msg.value.type() == e2_ap_elem_procs_o::init_msg_c::types_opts::e2conn_upd) {
logger.info("Received E2AP E2 Connection Update");
//handle_e2conn_upd(init_msg.value.e2conn_upd());
} else if (init_msg.value.type() == e2_ap_elem_procs_o::init_msg_c::types_opts::reset_request) {
logger.info("Received E2AP E2 Reset Request");
//handle_reset_request(init_msg.value.reset_request());
} else if (init_msg.value.type() == e2_ap_elem_procs_o::init_msg_c::types_opts::e2_removal_request) {
logger.info("Received E2AP E2 Removal Request");
//handle_e2_removal_request(init_msg.value.e2_removal_request());
} else {
logger.warning("Received E2AP Unknown Init Message ");
}
// TODO check for different type of RIC generated init messages // TODO check for different type of RIC generated init messages
// eg. RIC subscription request, RIC Reset request, RIC control request, RIC subscription delete request // eg. RIC subscription request, RIC Reset request, RIC control request, RIC subscription delete request
return true; return true;
@ -201,3 +222,14 @@ bool ric_client::handle_e2_unsuccessful_outcome(asn1::e2ap::unsuccessful_outcome
// eg. RIC subscription failure, RIC Reset failure, RIC control failure, RIC subscription delete failure // eg. RIC subscription failure, RIC Reset failure, RIC control failure, RIC subscription delete failure
return true; return true;
} }
bool ric_client::handle_ric_subscription_request(ricsubscription_request_s ric_subscription_request)
{
auto send_sub_resp =
[this]() {
send_e2_msg(E2_SUB_RESPONSE);
};
ric_rece_task_queue.push(send_sub_resp);
// TODO handle RIC subscription request
return true;
}

@ -98,9 +98,45 @@ void test_native_e2ap_setup_request()
printf("Unpacked native E2AP PDU %d\n", (int)unpack_ret); printf("Unpacked native E2AP PDU %d\n", (int)unpack_ret);
} }
void test_reference_e2ap_subscription_request()
{
uint8_t e2ap_msg_foreign[] = {0x00, 0x08, 0x40, 0x2b, 0x00, 0x00, 0x03, 0x00, 0x1d, 0x00, 0x05, 0x00,
0x00, 0x7b, 0x00, 0x15, 0x00, 0x05, 0x00, 0x02, 0x00, 0x01, 0x00, 0x1e,
0x00, 0x15, 0x00, 0x04, 0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x13, 0x40,
0x0a, 0x60, 0x01, 0x00, 0x04, 0x01, 0x02, 0x03, 0x04, 0x02, 0x00};
asn1::cbit_ref bref(&e2ap_msg_foreign[0], sizeof(e2ap_msg_foreign));
e2_ap_pdu_c pdu;
asn1::SRSASN_CODE unpack_ret = pdu.unpack(bref);
TESTASSERT_EQ(asn1::SRSASN_SUCCESS, unpack_ret);
printf("Unpacked E2AP PDU (subscription request) %d\n", (int)unpack_ret);
}
void test_native_e2ap_subscription_response()
{
srsran::unique_byte_buffer_t buf = srsran::make_byte_buffer();
e2_ap_pdu_c pdu, pdu2;
e2ap e2ap_;
pdu = e2ap_.generate_subscription_response();
asn1::bit_ref bref(buf->msg, buf->get_tailroom());
if (pdu.pack(bref) != asn1::SRSASN_SUCCESS) {
printf("Failed to pack TX E2 PDU\n");
return;
}
asn1::cbit_ref bref2(buf->msg, buf->get_tailroom());
asn1::SRSASN_CODE unpack_ret = pdu2.unpack(bref2);
TESTASSERT_EQ(asn1::SRSASN_SUCCESS, unpack_ret);
printf("Unpacked native E2AP PDU (subscription response) %d\n", (int)unpack_ret);
}
int main() int main()
{ {
test_reference_e2ap_setup_request(); test_reference_e2ap_setup_request();
test_native_e2ap_setup_request(); test_native_e2ap_setup_request();
test_reference_e2ap_subscription_request();
test_native_e2ap_subscription_response();
return 0; return 0;
} }
Loading…
Cancel
Save