Commit f99ccb40 authored by KARIM BOUTIBA's avatar KARIM BOUTIBA

Merge remote-tracking branch 'origin/pdu_session_establishment_event' into event_exposure

parents 03ad3782 ee27f251
{
"files.associations": {
"cctype": "cpp",
"clocale": "cpp",
"cmath": "cpp",
"csignal": "cpp",
"cstdarg": "cpp",
"cstddef": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cstring": "cpp",
"ctime": "cpp",
"cwchar": "cpp",
"cwctype": "cpp",
"array": "cpp",
"atomic": "cpp",
"strstream": "cpp",
"*.tcc": "cpp",
"bitset": "cpp",
"chrono": "cpp",
"codecvt": "cpp",
"complex": "cpp",
"condition_variable": "cpp",
"cstdint": "cpp",
"deque": "cpp",
"list": "cpp",
"unordered_map": "cpp",
"vector": "cpp",
"exception": "cpp",
"algorithm": "cpp",
"functional": "cpp",
"iterator": "cpp",
"map": "cpp",
"memory": "cpp",
"memory_resource": "cpp",
"numeric": "cpp",
"optional": "cpp",
"ratio": "cpp",
"set": "cpp",
"string": "cpp",
"string_view": "cpp",
"system_error": "cpp",
"tuple": "cpp",
"type_traits": "cpp",
"utility": "cpp",
"fstream": "cpp",
"future": "cpp",
"initializer_list": "cpp",
"iomanip": "cpp",
"iosfwd": "cpp",
"iostream": "cpp",
"istream": "cpp",
"limits": "cpp",
"mutex": "cpp",
"new": "cpp",
"ostream": "cpp",
"shared_mutex": "cpp",
"sstream": "cpp",
"stdexcept": "cpp",
"streambuf": "cpp",
"thread": "cpp",
"cfenv": "cpp",
"cinttypes": "cpp",
"typeindex": "cpp",
"typeinfo": "cpp",
"valarray": "cpp"
}
}
\ No newline at end of file
......@@ -31,6 +31,7 @@ typedef enum smf_event_e {
SMF_EVENT_PLMN_CH = 4,
SMF_EVENT_UE_IP_CH = 5,
SMF_EVENT_DDDS = 6,
SMF_EVENT_PDUSESEST = 7,
SMF_EVENT_FLEXCN = 99
} smf_event_t;
......@@ -41,6 +42,7 @@ static std::string smf_event_from_enum(smf_event_t e) {
if (e == smf_event_t::SMF_EVENT_PLMN_CH) return "PLMN_CH";
if (e == smf_event_t::SMF_EVENT_UE_IP_CH) return "UE_IP_CH";
if (e == smf_event_t::SMF_EVENT_DDDS) return "DDDS";
if (e == smf_event_t::SMF_EVENT_PDUSESEST) return "PDU_SES_EST";
if (e == smf_event_t::SMF_EVENT_FLEXCN) return "FLEXCN";
return "";
}
......@@ -53,6 +55,7 @@ static const std::vector<std::string> smf_event_e2str = {
"PLMN Change",
"UE IP address change",
"Downlink data delivery status",
"PDU Session Establishment",
"FlexCN"};
enum class notification_method_e {
......
......@@ -538,6 +538,8 @@ void xgpp_conv::smf_event_exposure_notification_from_openapi(
event_subscription.smf_event = smf_event_e::SMF_EVENT_UE_IP_CH;
} else if (event_id.compare("DDDS") == 0) {
event_subscription.smf_event = smf_event_e::SMF_EVENT_DDDS;
} else if (event_id.compare("PDU_SES_EST") == 0) {
event_subscription.smf_event = smf_event_e::SMF_EVENT_PDUSESEST;
} else if (event_id.compare("FLEXCN") == 0) {
event_subscription.smf_event = smf_event_e::SMF_EVENT_FLEXCN;
} else {
......
......@@ -4209,10 +4209,182 @@ void smf_context::trigger_flexcn_event(scid_t scid, uint8_t http_version) {
}
////------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void smf_context::handle_pdusesest(scid_t scid, uint8_t http_version) {
Logger::smf_app().debug(
"Send request to N11 to triger pdusesest, "
"SMF Context ID " SCID_FMT " ",
scid);
// get the smf context
std::shared_ptr<smf_context_ref> scf = {};
if (smf_app_inst->is_scid_2_smf_context(scid)) {
scf = smf_app_inst->scid_2_smf_context(scid);
} else {
Logger::smf_app().warn(
"Context associated with this id " SCID_FMT " does not exit!", scid);
return;
}
supi_t supi = scf.get()->supi;
supi64_t supi64 = smf_supi_to_u64(supi);
pdu_session_id_t pdu_session_id = scf.get()->pdu_session_id;
std::shared_ptr<smf_context> sc = {};
if (smf_app_inst->is_supi_2_smf_context(supi64)) {
sc = smf_app_inst->supi_2_smf_context(supi64);
Logger::smf_app().debug(
"Retrieve SMF context with SUPI " SUPI_64_FMT "", supi64);
} else {
Logger::smf_app().warn(
"Could not retrieve the corresponding SMF context with "
"Supi " SUPI_64_FMT "!",
supi64);
}
// get smf_pdu_session
std::shared_ptr<smf_pdu_session> sp = {};
if (!find_pdu_session(pdu_session_id, sp)) {
Logger::smf_app().warn(
"Could not retrieve the corresponding SMF PDU Session context!");
return;
}
Logger::smf_app().debug(
"Send request to N11 to triger PDU_SES_EST (Event "
"Exposure), SUPI " SUPI_64_FMT " , PDU Session ID %d, HTTP version %d",
supi, pdu_session_id, http_version);
std::vector<std::shared_ptr<smf_subscription>> subscriptions = {};
smf_app_inst->get_ee_subscriptions(
smf_event_t::SMF_EVENT_PDUSESEST, subscriptions);
if (subscriptions.size() > 0) {
// Send request to N11 to trigger the notification to the subscribed event
Logger::smf_app().debug(
"Send ITTI msg to SMF N11 to trigger the event notification");
std::shared_ptr<itti_n11_notify_subscribed_event> itti_msg =
std::make_shared<itti_n11_notify_subscribed_event>(
TASK_SMF_APP, TASK_SMF_SBI);
for (auto i : subscriptions) {
event_notification ev_notif = {};
ev_notif.set_supi(supi64); // SUPI
ev_notif.set_pdu_session_id(pdu_session_id); // PDU session ID
ev_notif.set_smf_event(smf_event_t::SMF_EVENT_PDUSESEST);
ev_notif.set_notif_uri(i.get()->notif_uri);
ev_notif.set_notif_id(i.get()->notif_id);
// timestamp
std::time_t time_epoch_ntp = std::time(nullptr);
uint64_t tv_ntp = time_epoch_ntp + SECONDS_SINCE_FIRST_EPOCH;
ev_notif.set_timestamp(std::to_string(tv_ntp));
// UE IPv4
if (sp->ipv4) {
ev_notif.set_ad_ipv4_addr(conv::toString(sp->ipv4_address));
}
// UE IPv6 Prefix
if (sp->ipv6) {
char str_addr6[INET6_ADDRSTRLEN];
if (inet_ntop(
AF_INET6, &sp->ipv6_address, str_addr6, sizeof(str_addr6))) {
// TODO
// ev_notif.set_ad_ipv6_prefix(conv::toString(sp->ipv4_address));
}
}
ev_notif.set_pdu_session_type(sp->pdu_session_type.toString()); // PDU Session Type
ev_notif.set_sst(sp->get_snssai().sst);
ev_notif.set_sd(std::to_string(sp->get_snssai().sd));
ev_notif.set_dnn(sp->get_dnn());
itti_msg->event_notifs.push_back(ev_notif);
}
itti_msg->http_version = http_version;
int ret = itti_inst->send_msg(itti_msg);
if (RETURNok != ret) {
Logger::smf_app().error(
"Could not send ITTI message %s to task TASK_SMF_SBI",
itti_msg->get_msg_name());
}
} else {
Logger::smf_app().debug("No subscription available for this event");
}
}
//------------------------------------------------------------------------------
void smf_context::trigger_pdusesest(scid_t scid, uint8_t http_version) {
event_sub.ee_pdusesest(scid, http_version);
}
////------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//-----------
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void smf_context::trigger_plmn_change(scid_t scid, uint8_t http_version) {
event_sub.ee_plmn_change(scid, http_version);
}
//------------------------------------------------------------------------------
void smf_context::handle_plmn_change(scid_t scid, uint8_t http_version) {
Logger::smf_app().debug(
......
......@@ -690,6 +690,10 @@ class smf_context : public std::enable_shared_from_this<smf_context> {
ee_ddds_connection = event_sub.subscribe_ee_ddds(
boost::bind(&smf_context::handle_ddds, this, _1, _2));
// Subscribe to PDU SESSION ESTABLISHMENT event
ee_pdusesest = event_sub.subscribe_ee_pdusesest(
boost::bind(&smf_context::handle_pdusesest, this, _1, _2));
// Subscribe to FlexCN event
ee_flexcn = event_sub.subscribe_ee_flexcn_event(
boost::bind(&smf_context::handle_flexcn_event, this, _1, _2));
......@@ -709,6 +713,7 @@ class smf_context : public std::enable_shared_from_this<smf_context> {
if (ee_plmn_change_connection.connected())
ee_plmn_change_connection.disconnect();
if (ee_ddds_connection.connected()) ee_ddds_connection.disconnect();
if (ee_pdusesest.connected()) ee_pdusesest.disconnect();
if (ee_flexcn.connected()) ee_flexcn.disconnect();
}
......@@ -1252,6 +1257,9 @@ class smf_context : public std::enable_shared_from_this<smf_context> {
void trigger_ddds(scid_t scid, uint8_t http_version);
void handle_ddds(scid_t scid, uint8_t http_version);
void trigger_pdusesest(scid_t scid, uint8_t http_version);
void handle_pdusesest(scid_t scid, uint8_t http_version);
void trigger_flexcn_event(scid_t scid, uint8_t http_version);
void handle_flexcn_event(scid_t scid, uint8_t http_version);
/*
......@@ -1384,6 +1392,7 @@ class smf_context : public std::enable_shared_from_this<smf_context> {
bs2::connection ee_ue_ip_change_connection;
bs2::connection ee_plmn_change_connection;
bs2::connection ee_ddds_connection;
bs2::connection ee_pdusesest;
bs2::connection ee_flexcn;
};
} // namespace smf
......
......@@ -61,10 +61,17 @@ bs2::connection smf_event::subscribe_ee_plmn_change(
}
//------------------------------------------------------------------------------
bs2::connection smf_event::subscribe_ee_ddds(
const ee_ddds_sig_t::slot_type& sig) {
return ee_ddds.connect(sig);
}
//------------------------------------------------------------------------------
bs2::connection smf_event::subscribe_ee_pdusesest(
const ee_pdusesest_sig_t::slot_type& sig) {
return ee_pdusesest.connect(sig);
}
//------------------------------------------------------------------------------
bs2::connection smf_event::subscribe_ee_flexcn_event(
......
......@@ -82,6 +82,9 @@ class smf_event {
// download link data status
bs2::connection subscribe_ee_ddds(const ee_ddds_sig_t::slot_type& sig);
bs2::connection subscribe_ee_pdusesest(
const ee_pdusesest_sig_t::slot_type& sig);
bs2::connection subscribe_ee_flexcn_event(
const ee_flexcn_sig_t::slot_type& sig);
......@@ -93,6 +96,7 @@ class smf_event {
ee_ue_ip_change_sig_t ee_ue_ip_change; // Signal for UE IP Addr change
ee_plmn_change_sig_t ee_plmn_change; // Signal for UE IP Addr change
ee_ddds_sig_t ee_ddds;
ee_pdusesest_sig_t ee_pdusesest; // Signal for pdu session establishment
ee_flexcn_sig_t ee_flexcn; // Signal for FlexCN Event
};
} // namespace smf
......
......@@ -70,6 +70,11 @@ typedef bs2::signal_type<
void(scid_t, uint8_t), bs2::keywords::mutex_type<bs2::dummy_mutex>>::type
ee_ddds_sig_t;
// Signal for PDU SESSION ESTABLISHMENT
// SCID, HTTP version
typedef bs2::signal_type<
void(scid_t, uint8_t), bs2::keywords::mutex_type<bs2::dummy_mutex>>::type
ee_pdusesest_sig_t;
// Signal for FlexCN event (for Event Exposure)
// SCID, HTTP version
typedef bs2::signal_type<
......
......@@ -1152,3 +1152,73 @@ void data_notification_msg::set_profile(const std::shared_ptr<nf_profile>& p) {
void data_notification_msg::get_profile(std::shared_ptr<nf_profile>& p) const {
p = profile;
}
//-----------------------------------------------------------------------------
void event_notification::set_dnn(std::string const& value) {
m_dnn = value;
m_dnn_is_set = true;
}
//-----------------------------------------------------------------------------
std::string event_notification::get_dnn() const {
return m_dnn;
}
//-----------------------------------------------------------------------------
bool event_notification::is_dnn_set() const {
return m_dnn_is_set;
}
//-----------------------------------------------------------------------------
void event_notification::set_sst(uint8_t const& value) {
m_sst = value;
m_sst_is_set = true;
}
//-----------------------------------------------------------------------------
uint8_t event_notification::get_sst() const {
return m_sst;
}
//-----------------------------------------------------------------------------
bool event_notification::is_sst_set() const {
return m_sst_is_set;
}
//-----------------------------------------------------------------------------
void event_notification::set_sd(std::string const& value) {
m_sd = value;
m_sd_is_set = true;
}
//-----------------------------------------------------------------------------
std::string event_notification::get_sd() const {
return m_sd;
}
//-----------------------------------------------------------------------------
bool event_notification::is_sd_set() const {
return m_sd_is_set;
}
//-----------------------------------------------------------------------------
void event_notification::set_pdu_session_type(std::string const& value) {
m_pdu_session_type = value;
m_pdu_session_type_is_set = true;
}
//-----------------------------------------------------------------------------
std::string event_notification::get_pdu_session_type() const {
return m_pdu_session_type;
}
//-----------------------------------------------------------------------------
bool event_notification::is_pdu_session_type_set() const {
return m_pdu_session_type_is_set;
}
......@@ -632,6 +632,23 @@ class event_notification {
oai::smf_server::model::DddStatus get_ddds() const;
bool is_ddds_is_set() const;
void set_dnn(std::string const& value);
std::string get_dnn() const;
bool is_dnn_set() const;
void set_sst(uint8_t const& value);
uint8_t get_sst() const;
bool is_sst_set() const;
void set_sd(std::string const& value);
std::string get_sd() const;
bool is_sd_set() const;
void set_pdu_session_type(std::string const& value);
std::string get_pdu_session_type() const;
bool is_pdu_session_type_set() const;
void set_pdu_session_id(const pdu_session_id_t value);
pdu_session_id_t get_pdu_session_id() const;
bool is_psi_is_set() const;
......@@ -668,6 +685,15 @@ class event_notification {
oai::smf_server::model::DddStatus m_DddStatus;
bool m_DddStatusIsSet;
bool m_dnn_is_set;
std::string m_dnn;
bool m_sst_is_set;
uint8_t m_sst;
bool m_sd_is_set;
std::string m_sd;
bool m_pdu_session_type_is_set;
std::string m_pdu_session_type;
// for an access type change
// AccessType m_AccType;
// bool m_AccTypeIsSet;
......
......@@ -1247,6 +1247,7 @@ void session_update_sm_context_procedure::handle_itti_msg(
sc.get()->trigger_ue_ip_change(scid, 1);
sc.get()->trigger_plmn_change(scid, 1);
sc.get()->trigger_ddds(scid, 1);
sc.get()->trigger_pdusesest(scid, 1);
sc.get()->trigger_flexcn_event(scid, 1);
} break;
......
......@@ -522,6 +522,14 @@ void smf_sbi::notify_subscribed_event(
// event_notif["dddStatus"] = i.get_ddds();
event_notif["dddStatus"] = "TRANSMITTED";
}
if (i.is_dnn_set()) event_notif["dnn"] = i.get_dnn();
if (i.is_pdu_session_type_set()) event_notif["pduSessType"] = i.get_pdu_session_type();
if (i.is_sst_set()){
nlohmann::json snssai_data = {};
snssai_data["sst"] = i.get_sst();
if (i.is_sd_set()) snssai_data["sd"] = i.get_sd();
event_notif["snssai"] = snssai_data;
}
// customized data
nlohmann::json customized_data = {};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment