e2ap: parametrize subscription reponse

master
Piotr Gawlowicz 2 years ago committed by Justin Tallon
parent faa90aebdc
commit d1ed79175b

@ -36,6 +36,14 @@ typedef struct {
std::string response_part; std::string response_part;
} e2_node_component_t; } e2_node_component_t;
typedef struct {
uint32_t ric_requestor_id;
uint32_t ric_instance_id;
uint32_t ra_nfunction_id;
std::vector<uint32_t> admitted_actions;
std::vector<uint32_t> not_admitted_actions;
} ric_subscription_reponse_t;
class e2ap class e2ap
{ {
public: public:
@ -44,7 +52,7 @@ public:
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(ricsubscription_request_s subscription_request); int process_subscription_request(ricsubscription_request_s subscription_request);
e2_ap_pdu_c generate_subscription_response(); e2_ap_pdu_c generate_subscription_response(ric_subscription_reponse_t ric_subscription_reponse);
int generate_subscription_failure(); int generate_subscription_failure();
e2_ap_pdu_c generate_subscription_delete_response(); e2_ap_pdu_c generate_subscription_delete_response();
e2_ap_pdu_c generate_indication(); e2_ap_pdu_c generate_indication();

@ -66,7 +66,7 @@ e2_ap_pdu_c e2ap::generate_setup_request()
return pdu; return pdu;
} }
e2_ap_pdu_c e2ap::generate_subscription_response() e2_ap_pdu_c e2ap::generate_subscription_response(ric_subscription_reponse_t ric_subscription_reponse)
{ {
e2_ap_pdu_c pdu; e2_ap_pdu_c pdu;
successful_outcome_s& success = pdu.set_successful_outcome(); successful_outcome_s& success = pdu.set_successful_outcome();
@ -76,27 +76,33 @@ e2_ap_pdu_c e2ap::generate_subscription_response()
sub_resp->ri_crequest_id.crit = asn1::crit_opts::reject; 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.id = ASN1_E2AP_ID_RI_CREQUEST_ID;
sub_resp->ri_crequest_id.value.ric_requestor_id = 1021; sub_resp->ri_crequest_id.value.ric_requestor_id = ric_subscription_reponse.ric_requestor_id;
sub_resp->ri_crequest_id.value.ric_instance_id = 0; sub_resp->ri_crequest_id.value.ric_instance_id = ric_subscription_reponse.ric_instance_id;
sub_resp->ra_nfunction_id.crit = asn1::crit_opts::reject; sub_resp->ra_nfunction_id.crit = asn1::crit_opts::reject;
sub_resp->ra_nfunction_id.id = ASN1_E2AP_ID_RA_NFUNCTION_ID; sub_resp->ra_nfunction_id.id = ASN1_E2AP_ID_RA_NFUNCTION_ID;
sub_resp->ra_nfunction_id->value = 147; sub_resp->ra_nfunction_id->value = ric_subscription_reponse.ra_nfunction_id;
sub_resp->ri_cactions_admitted.crit = asn1::crit_opts::reject; sub_resp->ri_cactions_admitted.crit = asn1::crit_opts::reject;
auto& action_admit_list = sub_resp->ri_cactions_admitted.value; auto& action_admit_list = sub_resp->ri_cactions_admitted.value;
action_admit_list.resize(1); action_admit_list.resize(ric_subscription_reponse.admitted_actions.size());
action_admit_list[0].load_info_obj(ASN1_E2AP_ID_RI_CACTION_ADMITTED_ITEM); for (uint32_t i = 0; i < ric_subscription_reponse.admitted_actions.size(); i++) {
ri_caction_admitted_item_s& a_item = action_admit_list[0]->ri_caction_admitted_item(); action_admit_list[i].load_info_obj(ASN1_E2AP_ID_RI_CACTION_ADMITTED_ITEM);
a_item.ric_action_id = 0; ri_caction_admitted_item_s& a_item = action_admit_list[i]->ri_caction_admitted_item();
a_item.ric_action_id = ric_subscription_reponse.admitted_actions[i];
sub_resp->ri_cactions_not_admitted.crit = asn1::crit_opts::reject; }
auto& action_not_admit_list = sub_resp->ri_cactions_not_admitted.value;
action_not_admit_list.resize(1); if (ric_subscription_reponse.not_admitted_actions.size()) {
action_not_admit_list[0].load_info_obj(ASN1_E2AP_ID_RI_CACTION_NOT_ADMITTED_ITEM); sub_resp->ri_cactions_not_admitted.crit = asn1::crit_opts::reject;
ri_caction_not_admitted_item_s& not_a_item = action_not_admit_list[0]->ri_caction_not_admitted_item(); auto& action_not_admit_list = sub_resp->ri_cactions_not_admitted.value;
not_a_item.ric_action_id = 10; action_not_admit_list.resize(ric_subscription_reponse.not_admitted_actions.size());
not_a_item.cause.set_misc(); for (uint32_t i = 0; i < ric_subscription_reponse.not_admitted_actions.size(); i++) {
action_not_admit_list[i].load_info_obj(ASN1_E2AP_ID_RI_CACTION_NOT_ADMITTED_ITEM);
ri_caction_not_admitted_item_s& not_a_item = action_not_admit_list[i]->ri_caction_not_admitted_item();
not_a_item.ric_action_id = ric_subscription_reponse.not_admitted_actions[i];
not_a_item.cause.set_misc(); // TODO: support cause properly
}
}
return pdu; return pdu;
} }

@ -32,7 +32,15 @@ ric_client::ric_subscription::ric_subscription(ric_client* ric_cli
void ric_client::ric_subscription::start_ric_indication_reporting() void ric_client::ric_subscription::start_ric_indication_reporting()
{ {
parent->logger.debug("Send RIC Subscription Response to RIC Requestor ID: %i\n", ric_requestor_id); parent->logger.debug("Send RIC Subscription Response to RIC Requestor ID: %i\n", ric_requestor_id);
e2_ap_pdu_c send_pdu = parent->e2ap_.generate_subscription_response(); ric_subscription_reponse_t ric_subscription_reponse;
ric_subscription_reponse.ric_requestor_id = ric_requestor_id;
ric_subscription_reponse.ric_instance_id = ric_instance_id;
ric_subscription_reponse.ra_nfunction_id = ra_nfunction_id;
ric_subscription_reponse.admitted_actions.push_back(0);
ric_subscription_reponse.not_admitted_actions.push_back(10);
e2_ap_pdu_c send_pdu = parent->e2ap_.generate_subscription_response(ric_subscription_reponse);
parent->queue_send_e2ap_pdu(send_pdu); parent->queue_send_e2ap_pdu(send_pdu);
printf("Start sending RIC indication msgs every %i ms\n", reporting_period); printf("Start sending RIC indication msgs every %i ms\n", reporting_period);

Loading…
Cancel
Save