e2ap: ric_subscription add subscription_failure

master
Piotr Gawlowicz 2 years ago committed by Justin Tallon
parent 433e4b3ac1
commit 027590b858

@ -52,7 +52,7 @@ public:
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(ric_subscription_reponse_t ric_subscription_reponse); e2_ap_pdu_c generate_subscription_response(ric_subscription_reponse_t ric_subscription_reponse);
int generate_subscription_failure(); e2_ap_pdu_c generate_subscription_failure(ric_subscription_reponse_t ric_subscription_reponse);
e2_ap_pdu_c e2_ap_pdu_c
generate_subscription_delete_response(uint32_t ric_requestor_id, uint32_t ric_instance_id, uint32_t ra_nfunction_id); generate_subscription_delete_response(uint32_t ric_requestor_id, uint32_t ric_instance_id, uint32_t ra_nfunction_id);
e2_ap_pdu_c generate_indication(ric_indication_t& ric_indication); e2_ap_pdu_c generate_indication(ric_indication_t& ric_indication);

@ -30,14 +30,17 @@ public:
uint32_t get_ric_requestor_id() { return ric_requestor_id; }; uint32_t get_ric_requestor_id() { return ric_requestor_id; };
uint32_t get_ric_instance_id() { return ric_instance_id; }; uint32_t get_ric_instance_id() { return ric_instance_id; };
bool is_initialized() { return initialized; };
void start_subscription(); void start_subscription();
void send_subscription_failure();
void delete_subscription(); void delete_subscription();
private: private:
void send_ric_indication(); void send_ric_indication();
ric_client* parent = nullptr; ric_client* parent = nullptr;
bool initialized = false;
uint32_t ric_requestor_id; uint32_t ric_requestor_id;
uint32_t ric_instance_id; uint32_t ric_instance_id;

@ -115,6 +115,29 @@ e2_ap_pdu_c e2ap::generate_subscription_response(ric_subscription_reponse_t ric_
return pdu; return pdu;
} }
e2_ap_pdu_c e2ap::generate_subscription_failure(ric_subscription_reponse_t ric_subscription_reponse)
{
e2_ap_pdu_c pdu;
unsuccessful_outcome_s& failure = pdu.set_unsuccessful_outcome();
failure.load_info_obj(ASN1_E2AP_ID_RICSUBSCRIPTION);
failure.crit = asn1::crit_opts::reject;
ricsubscription_fail_s& sub_resp = failure.value.ricsubscription_fail();
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 = ric_subscription_reponse.ric_requestor_id;
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.id = ASN1_E2AP_ID_RA_NFUNCTION_ID;
sub_resp->ra_nfunction_id->value = ric_subscription_reponse.ra_nfunction_id;
sub_resp->cause->set_misc(); // TODO: set the cause and crit_diagnostics properly
sub_resp->crit_diagnostics_present = false;
return pdu;
}
e2_ap_pdu_c e2ap::generate_subscription_delete_response(uint32_t ric_requestor_id, e2_ap_pdu_c e2ap::generate_subscription_delete_response(uint32_t ric_requestor_id,
uint32_t ric_instance_id, uint32_t ric_instance_id,
uint32_t ra_nfunction_id) uint32_t ra_nfunction_id)

@ -272,8 +272,15 @@ bool ric_client::handle_ric_subscription_request(ricsubscription_request_s ric_s
std::unique_ptr<ric_client::ric_subscription> new_ric_subs = std::unique_ptr<ric_client::ric_subscription> new_ric_subs =
std::make_unique<ric_client::ric_subscription>(this, ric_subscription_request); std::make_unique<ric_client::ric_subscription>(this, ric_subscription_request);
if (new_ric_subs->is_initialized()) {
new_ric_subs->start_subscription(); new_ric_subs->start_subscription();
active_subscriptions.push_back(std::move(new_ric_subs)); active_subscriptions.push_back(std::move(new_ric_subs));
} else {
new_ric_subs->send_subscription_failure();
return false;
}
return true; return true;
} }

@ -18,6 +18,7 @@ namespace srsenb {
ric_client::ric_subscription::ric_subscription(ric_client* ric_client, ric_client::ric_subscription::ric_subscription(ric_client* ric_client,
ricsubscription_request_s ric_subscription_request) : ricsubscription_request_s ric_subscription_request) :
parent(ric_client), parent(ric_client),
initialized(false),
ric_requestor_id(ric_subscription_request->ri_crequest_id->ric_requestor_id), ric_requestor_id(ric_subscription_request->ri_crequest_id->ric_requestor_id),
ric_instance_id(ric_subscription_request->ri_crequest_id->ric_instance_id), ric_instance_id(ric_subscription_request->ri_crequest_id->ric_instance_id),
ra_nfunction_id(ric_subscription_request->ra_nfunction_id->value), ra_nfunction_id(ric_subscription_request->ra_nfunction_id->value),
@ -77,6 +78,7 @@ ric_client::ric_subscription::ric_subscription(ric_client* ric_cli
not_admitted_actions.push_back(action_item.ric_action_id); not_admitted_actions.push_back(action_item.ric_action_id);
} }
} }
initialized = true;
} }
void ric_client::ric_subscription::start_subscription() void ric_client::ric_subscription::start_subscription()
@ -106,6 +108,18 @@ void ric_client::ric_subscription::start_subscription()
} }
} }
void ric_client::ric_subscription::send_subscription_failure()
{
parent->logger.debug("Send RIC Subscription Failure Response to RIC Requestor ID: %i\n", ric_requestor_id);
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;
e2_ap_pdu_c send_pdu = parent->e2ap_.generate_subscription_failure(ric_subscription_reponse);
parent->queue_send_e2ap_pdu(send_pdu);
}
void ric_client::ric_subscription::delete_subscription() void ric_client::ric_subscription::delete_subscription()
{ {
if (reporting_timer.is_running()) { if (reporting_timer.is_running()) {

Loading…
Cancel
Save