Commit 49a3ced2 authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Merge branch 'smf_event_exposure' into 'develop'

Smf event exposure

See merge request oai/cn5g/oai-cn5g-smf!87
parents a4675fff eb7f144f
...@@ -3,13 +3,13 @@ ...@@ -3,13 +3,13 @@
INSTANCE=1 INSTANCE=1
PREFIX='/usr/local/etc/oai' PREFIX='/usr/local/etc/oai'
sudo mkdir -m 0777 -p $PREFIX mkdir -m 0777 -p $PREFIX
cp ../../etc/smf.conf $PREFIX cp ../../etc/smf.conf $PREFIX
declare -A SMF_CONF declare -A SMF_CONF
SMF_CONF[@INSTANCE@]=$INSTANCE SMF_CONF[@INSTANCE@]=$INSTANCE
SMF_CONF[@PREFIX@]=$PREFIX # SMF_CONF[@PREFIX@]=$PREFIX
SMF_CONF[@PID_DIRECTORY@]='/var/run' SMF_CONF[@PID_DIRECTORY@]='/var/run'
SMF_CONF[@SMF_INTERFACE_NAME_FOR_N4@]='wlo1' SMF_CONF[@SMF_INTERFACE_NAME_FOR_N4@]='wlo1'
...@@ -27,7 +27,7 @@ SMF_CONF[@UDM_PORT@]='80' ...@@ -27,7 +27,7 @@ SMF_CONF[@UDM_PORT@]='80'
SMF_CONF[@UDM_API_VERSION@]='v2' SMF_CONF[@UDM_API_VERSION@]='v2'
SMF_CONF[@UDM_FQDN@]='localhost' SMF_CONF[@UDM_FQDN@]='localhost'
SMF_CONF[@AMF_IPV4_ADDRESS@]='192.168.122.183' SMF_CONF[@AMF_IPV4_ADDRESS@]='192.168.74.195'
SMF_CONF[@AMF_PORT@]='80' SMF_CONF[@AMF_PORT@]='80'
SMF_CONF[@AMF_API_VERSION@]='v1' SMF_CONF[@AMF_API_VERSION@]='v1'
SMF_CONF[@AMF_FQDN@]='localhost' SMF_CONF[@AMF_FQDN@]='localhost'
...@@ -35,7 +35,7 @@ SMF_CONF[@AMF_FQDN@]='localhost' ...@@ -35,7 +35,7 @@ SMF_CONF[@AMF_FQDN@]='localhost'
SMF_CONF[@UPF_IPV4_ADDRESS@]='192.168.12.245' SMF_CONF[@UPF_IPV4_ADDRESS@]='192.168.12.245'
SMF_CONF[@UPF_FQDN@]='localhost' SMF_CONF[@UPF_FQDN@]='localhost'
SMF_CONF[@NRF_IPV4_ADDRESS@]='192.168.1.23' SMF_CONF[@NRF_IPV4_ADDRESS@]='127.0.0.1'
SMF_CONF[@NRF_PORT@]='8080' SMF_CONF[@NRF_PORT@]='8080'
SMF_CONF[@NRF_API_VERSION@]='v1' SMF_CONF[@NRF_API_VERSION@]='v1'
SMF_CONF[@NRF_FQDN@]='localhost' SMF_CONF[@NRF_FQDN@]='localhost'
......
...@@ -270,9 +270,13 @@ bool NsmfEventExposure::altNotifIpv6AddrsIsSet() const { ...@@ -270,9 +270,13 @@ bool NsmfEventExposure::altNotifIpv6AddrsIsSet() const {
void NsmfEventExposure::unsetAltNotifIpv6Addrs() { void NsmfEventExposure::unsetAltNotifIpv6Addrs() {
m_AltNotifIpv6AddrsIsSet = false; m_AltNotifIpv6AddrsIsSet = false;
} }
std::vector<EventSubscription>& NsmfEventExposure::getEventSubs() { std::vector<EventSubscription> NsmfEventExposure::getEventSubs() const {
return m_EventSubs; return m_EventSubs;
} }
void NsmfEventExposure::getEventSubs(std::vector<EventSubscription>& es) const {
es = m_EventSubs;
}
void NsmfEventExposure::setEventSubs( void NsmfEventExposure::setEventSubs(
std::vector<EventSubscription> const& value) { std::vector<EventSubscription> const& value) {
m_EventSubs = value; m_EventSubs = value;
......
...@@ -119,7 +119,8 @@ class NsmfEventExposure { ...@@ -119,7 +119,8 @@ class NsmfEventExposure {
/// <summary> /// <summary>
/// Subscribed events /// Subscribed events
/// </summary> /// </summary>
std::vector<EventSubscription>& getEventSubs(); std::vector<EventSubscription> getEventSubs() const;
void getEventSubs(std::vector<EventSubscription>&) const;
void setEventSubs(std::vector<EventSubscription> const& value); void setEventSubs(std::vector<EventSubscription> const& value);
/// <summary> /// <summary>
/// ///
......
...@@ -25,11 +25,23 @@ void SmfEvent::validate() { ...@@ -25,11 +25,23 @@ void SmfEvent::validate() {
// TODO: implement validation // TODO: implement validation
} }
void SmfEvent::set_value(std::string value) {
this->value = value;
}
void SmfEvent::get_value(std::string& value) const {
value = this->value;
}
std::string SmfEvent::get_value() const {
return value;
}
void to_json(nlohmann::json& j, const SmfEvent& o) { void to_json(nlohmann::json& j, const SmfEvent& o) {
j = nlohmann::json(); j = o.get_value();
} }
void from_json(const nlohmann::json& j, SmfEvent& o) {} void from_json(const nlohmann::json& j, SmfEvent& o) {
o.set_value(j.get<std::string>());
}
} // namespace model } // namespace model
} // namespace smf_server } // namespace smf_server
......
...@@ -39,6 +39,9 @@ class SmfEvent { ...@@ -39,6 +39,9 @@ class SmfEvent {
void validate(); void validate();
void set_value(std::string value);
void get_value(std::string& value) const;
std::string get_value() const;
///////////////////////////////////////////// /////////////////////////////////////////////
/// SmfEvent members /// SmfEvent members
...@@ -46,6 +49,8 @@ class SmfEvent { ...@@ -46,6 +49,8 @@ class SmfEvent {
friend void from_json(const nlohmann::json& j, SmfEvent& o); friend void from_json(const nlohmann::json& j, SmfEvent& o);
protected: protected:
private:
std::string value;
}; };
} // namespace model } // namespace model
......
...@@ -30,9 +30,21 @@ typedef enum smf_event_e { ...@@ -30,9 +30,21 @@ typedef enum smf_event_e {
SMF_EVENT_PDU_SES_REL = 3, SMF_EVENT_PDU_SES_REL = 3,
SMF_EVENT_PLMN_CH = 4, SMF_EVENT_PLMN_CH = 4,
SMF_EVENT_UE_IP_CH = 5, SMF_EVENT_UE_IP_CH = 5,
SMF_EVENT_DDDS = 6 SMF_EVENT_DDDS = 6,
SMF_EVENT_FLEXCN = 99
} smf_event_t; } smf_event_t;
static std::string smf_event_from_enum(smf_event_t e) {
if (e == smf_event_t::SMF_EVENT_AC_TY_CH) return "AC_TY_CH";
if (e == smf_event_t::SMF_EVENT_UP_PATH_CH) return "UP_PATH_CH";
if (e == smf_event_t::SMF_EVENT_PDU_SES_REL) return "PDU_SES_REL";
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_FLEXCN) return "FLEXCN";
return "";
}
static const std::vector<std::string> smf_event_e2str = { static const std::vector<std::string> smf_event_e2str = {
"SMF_EVENT_UNKNOWN", "SMF_EVENT_UNKNOWN",
"Access Type Change", "Access Type Change",
...@@ -40,7 +52,8 @@ static const std::vector<std::string> smf_event_e2str = { ...@@ -40,7 +52,8 @@ static const std::vector<std::string> smf_event_e2str = {
"PDU Session Release", "PDU Session Release",
"PLMN Change", "PLMN Change",
"UE IP address change", "UE IP address change",
"Downlink data delivery status"}; "Downlink data delivery status",
"FlexCN"};
enum class notification_method_e { enum class notification_method_e {
PERIODIC = 1, PERIODIC = 1,
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include "SmContextCreateData.h" #include "SmContextCreateData.h"
#include "SmContextUpdateData.h" #include "SmContextUpdateData.h"
#include "SmContextReleaseData.h" #include "SmContextReleaseData.h"
#include "EventSubscription.h"
#include "3gpp_29.500.h" #include "3gpp_29.500.h"
#include "3gpp_24.501.h" #include "3gpp_24.501.h"
#include "conversions.hpp" #include "conversions.hpp"
...@@ -506,23 +507,51 @@ void xgpp_conv::smf_event_exposure_notification_from_openapi( ...@@ -506,23 +507,51 @@ void xgpp_conv::smf_event_exposure_notification_from_openapi(
Logger::smf_api_server().debug("PDU Session ID %d", nee.getPduSeId()); Logger::smf_api_server().debug("PDU Session ID %d", nee.getPduSeId());
eem.set_pdu_session_id(nee.getPduSeId()); eem.set_pdu_session_id(nee.getPduSeId());
} }
// TODO: groupId
// TODO: DNN
// TODO: GUAMI
eem.set_notif_id(nee.getNotifId()); // NotifId eem.set_notif_id(nee.getNotifId()); // NotifId
eem.set_notif_uri(nee.getNotifUri()); // NotifUri eem.set_notif_uri(nee.getNotifUri()); // NotifUri
std::vector<oai::smf_server::model::EventSubscription> event_subcription_api =
{};
nee.getEventSubs(event_subcription_api);
std::vector<event_subscription_t> event_subscriptions = {};
for (auto e : event_subcription_api) {
// EventSubscription: TODO // EventSubscription: TODO
event_subscription_t event_subscription = {}; event_subscription_t event_subscription = {};
event_subscription.smf_event = smf_event_t::SMF_EVENT_PDU_SES_REL; uint8_t event_id_enum = 0;
std::vector<event_subscription_t> event_subscriptions = {}; std::string event_id = e.getEvent().get_value();
if (event_id.compare("AC_TY_CH") == 0) {
event_subscription.smf_event = smf_event_e::SMF_EVENT_AC_TY_CH;
} else if (event_id.compare("UP_PATH_CH") == 0) {
event_subscription.smf_event = smf_event_e::SMF_EVENT_UP_PATH_CH;
} else if (event_id.compare("PDU_SES_REL") == 0) {
event_subscription.smf_event = smf_event_e::SMF_EVENT_PDU_SES_REL;
} else if (event_id.compare("PLMN_CH") == 0) {
event_subscription.smf_event = smf_event_e::SMF_EVENT_PLMN_CH;
} else if (event_id.compare("UE_IP_CH") == 0) {
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("FLEXCN") == 0) {
event_subscription.smf_event = smf_event_e::SMF_EVENT_FLEXCN;
} else {
Logger::smf_api_server().debug("Unknown SMF Event %s", event_id.c_str());
break;
}
// event_subscription.smf_event =
// static_cast<smf_event_t>(e.getEvent().get_value());
// TODO: dnaiChType (for event UP path change)
// TODO: dddTraDes/ddsStati (for event downlink data delivery status)
// TODO: altNotifIpv4Addrs, altNotifIpv6Addrs, serviceName, ImmeRep,
// notifMethod, maxReportNbr, expiry
event_subscriptions.push_back(event_subscription); event_subscriptions.push_back(event_subscription);
}
eem.set_event_subs(event_subscriptions); eem.set_event_subs(event_subscriptions);
// std::vector<EventSubscription> eventSubscriptions;
// for (auto it: nee.getEventSubs()){
// event_subscription.smf_event = it.getEvent();
// getDnaiChgType
// event_subscriptions.push_back(event_subscription);
//}
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
......
...@@ -107,6 +107,7 @@ std::string conv::mccToString( ...@@ -107,6 +107,7 @@ std::string conv::mccToString(
s.append(std::to_string(mcc16)); s.append(std::to_string(mcc16));
return s; return s;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
std::string conv::mncToString( std::string conv::mncToString(
const uint8_t digit1, const uint8_t digit2, const uint8_t digit3) { const uint8_t digit1, const uint8_t digit2, const uint8_t digit3) {
...@@ -122,6 +123,7 @@ std::string conv::mncToString( ...@@ -122,6 +123,7 @@ std::string conv::mncToString(
return s; return s;
} }
//------------------------------------------------------------------------------
bool conv::plmnFromString( bool conv::plmnFromString(
plmn_t& p, const std::string mcc, const std::string mnc) { plmn_t& p, const std::string mcc, const std::string mnc) {
// MCC // MCC
...@@ -159,6 +161,23 @@ bool conv::plmnFromString( ...@@ -159,6 +161,23 @@ bool conv::plmnFromString(
return true; return true;
} }
//------------------------------------------------------------------------------
void conv::plmnToMccMnc(
const plmn_t& plmn, std::string& mcc, std::string& mnc) {
uint16_t mcc_dec = 0;
uint16_t mnc_dec = 0;
uint16_t mnc_len = 0;
mcc_dec = plmn.mcc_digit1 * 100 + plmn.mcc_digit2 * 10 + plmn.mcc_digit3;
mnc_len = (plmn.mnc_digit3 == 0x0 ? 2 : 3);
mnc_dec = plmn.mnc_digit1 * 10 + plmn.mnc_digit2;
mnc_dec = (mnc_len == 2 ? mnc_dec : mnc_dec * 10 + plmn.mnc_digit3);
mcc = std::to_string(mcc_dec);
mnc = std::to_string(mnc_dec);
return;
}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
struct in_addr conv::fromString(const std::string addr4) { struct in_addr conv::fromString(const std::string addr4) {
unsigned char buf[sizeof(struct in6_addr)] = {}; unsigned char buf[sizeof(struct in6_addr)] = {};
......
...@@ -57,6 +57,8 @@ class conv { ...@@ -57,6 +57,8 @@ class conv {
static struct in_addr fromString(const std::string addr4); static struct in_addr fromString(const std::string addr4);
static bool plmnFromString( static bool plmnFromString(
plmn_t& p, const std::string mcc, const std::string mnc); plmn_t& p, const std::string mcc, const std::string mnc);
static void plmnToMccMnc(
const plmn_t& plmn, std::string& mcc, std::string& mnc);
static std::string toString(const struct in_addr& inaddr); static std::string toString(const struct in_addr& inaddr);
static std::string toString(const struct in6_addr& in6addr); static std::string toString(const struct in6_addr& in6addr);
static std::string mccToString( static std::string mccToString(
......
This diff is collapsed.
...@@ -134,6 +134,9 @@ class smf_pdu_session : public std::enable_shared_from_this<smf_pdu_session> { ...@@ -134,6 +134,9 @@ class smf_pdu_session : public std::enable_shared_from_this<smf_pdu_session> {
smf_pdu_session(smf_pdu_session& b) = delete; smf_pdu_session(smf_pdu_session& b) = delete;
void get_pdu_session_id(uint32_t& psi) const;
uint32_t get_pdu_session_id() const;
/* /*
* Set UE Address for this session * Set UE Address for this session
* @param [paa_t &] paa: PAA * @param [paa_t &] paa: PAA
...@@ -591,14 +594,31 @@ class smf_context : public std::enable_shared_from_this<smf_context> { ...@@ -591,14 +594,31 @@ class smf_context : public std::enable_shared_from_this<smf_context> {
event_sub(), event_sub(),
plmn() { plmn() {
supi_prefix = {}; supi_prefix = {};
// Subscribe to sm context status change
// Subscribe to SM Context Status change (to notify to AMF)
sm_context_status_connection = sm_context_status_connection =
event_sub.subscribe_sm_context_status(boost::bind( event_sub.subscribe_sm_context_status(boost::bind(
&smf_context::handle_sm_context_status_change, this, _1, _2, _3)); &smf_context::handle_sm_context_status_change, this, _1, _2, _3));
// Subscribe to pdu session release (event exposure) // Subscribe to PDU Session Release (event exposure)
ee_pdu_session_release_connection = ee_pdu_session_release_connection =
event_sub.subscribe_ee_pdu_session_release(boost::bind( event_sub.subscribe_ee_pdu_session_release(boost::bind(
&smf_context::handle_ee_pdu_session_release, this, _1, _2, _3)); &smf_context::handle_ee_pdu_session_release, this, _1, _2, _3));
// Subscribe to UE IP Change Event
ee_ue_ip_change_connection = event_sub.subscribe_ee_ue_ip_change(
boost::bind(&smf_context::handle_ue_ip_change, this, _1, _2));
// Subscribe to PLMN Change Event
ee_plmn_change_connection = event_sub.subscribe_ee_plmn_change(
boost::bind(&smf_context::handle_plmn_change, this, _1, _2));
// Subscribe to DDDS event
ee_ddds_connection = event_sub.subscribe_ee_ddds(
boost::bind(&smf_context::handle_ddds, 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));
} }
smf_context(smf_context& b) = delete; smf_context(smf_context& b) = delete;
...@@ -610,6 +630,12 @@ class smf_context : public std::enable_shared_from_this<smf_context> { ...@@ -610,6 +630,12 @@ class smf_context : public std::enable_shared_from_this<smf_context> {
sm_context_status_connection.disconnect(); sm_context_status_connection.disconnect();
if (ee_pdu_session_release_connection.connected()) if (ee_pdu_session_release_connection.connected())
ee_pdu_session_release_connection.disconnect(); ee_pdu_session_release_connection.disconnect();
if (ee_ue_ip_change_connection.connected())
ee_ue_ip_change_connection.disconnect();
if (ee_plmn_change_connection.connected())
ee_plmn_change_connection.disconnect();
if (ee_ddds_connection.connected()) ee_ddds_connection.disconnect();
if (ee_flexcn.connected()) ee_flexcn.disconnect();
} }
/* /*
...@@ -1130,6 +1156,17 @@ class smf_context : public std::enable_shared_from_this<smf_context> { ...@@ -1130,6 +1156,17 @@ class smf_context : public std::enable_shared_from_this<smf_context> {
void handle_ee_pdu_session_release( void handle_ee_pdu_session_release(
supi64_t supi, pdu_session_id_t pdu_session_id, uint8_t http_version); supi64_t supi, pdu_session_id_t pdu_session_id, uint8_t http_version);
void trigger_ue_ip_change(scid_t scid, uint8_t http_version);
void handle_ue_ip_change(scid_t scid, uint8_t http_version);
void trigger_plmn_change(scid_t scid, uint8_t http_version);
void handle_plmn_change(scid_t scid, uint8_t http_version);
void trigger_ddds(scid_t scid, uint8_t http_version);
void handle_ddds(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);
/* /*
* Update QoS information in the Response message according to the content of * Update QoS information in the Response message according to the content of
* decoded NAS msg * decoded NAS msg
...@@ -1202,6 +1239,10 @@ class smf_context : public std::enable_shared_from_this<smf_context> { ...@@ -1202,6 +1239,10 @@ class smf_context : public std::enable_shared_from_this<smf_context> {
smf_event event_sub; smf_event event_sub;
bs2::connection sm_context_status_connection; bs2::connection sm_context_status_connection;
bs2::connection ee_pdu_session_release_connection; bs2::connection ee_pdu_session_release_connection;
bs2::connection ee_ue_ip_change_connection;
bs2::connection ee_plmn_change_connection;
bs2::connection ee_ddds_connection;
bs2::connection ee_flexcn;
}; };
} // namespace smf } // namespace smf
......
...@@ -47,3 +47,27 @@ bs2::connection smf_event::subscribe_ee_pdu_session_release( ...@@ -47,3 +47,27 @@ bs2::connection smf_event::subscribe_ee_pdu_session_release(
const ee_pdu_session_release_sig_t::slot_type& sig) { const ee_pdu_session_release_sig_t::slot_type& sig) {
return ee_pdu_session_release.connect(sig); return ee_pdu_session_release.connect(sig);
} }
//------------------------------------------------------------------------------
bs2::connection smf_event::subscribe_ee_ue_ip_change(
const ee_ue_ip_change_sig_t::slot_type& sig) {
return ee_ue_ip_change.connect(sig);
}
//------------------------------------------------------------------------------
bs2::connection smf_event::subscribe_ee_plmn_change(
const ee_plmn_change_sig_t::slot_type& sig) {
return ee_plmn_change.connect(sig);
}
//------------------------------------------------------------------------------
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_flexcn_event(
const ee_flexcn_sig_t::slot_type& sig) {
return ee_flexcn.connect(sig);
}
...@@ -73,11 +73,27 @@ class smf_event { ...@@ -73,11 +73,27 @@ class smf_event {
bs2::connection subscribe_ee_pdu_session_release( bs2::connection subscribe_ee_pdu_session_release(
const ee_pdu_session_release_sig_t::slot_type& sig); const ee_pdu_session_release_sig_t::slot_type& sig);
bs2::connection subscribe_ee_ue_ip_change(
const ee_ue_ip_change_sig_t::slot_type& sig);
bs2::connection subscribe_ee_plmn_change(
const ee_plmn_change_sig_t::slot_type& sig);
// download link data status
bs2::connection subscribe_ee_ddds(const ee_ddds_sig_t::slot_type& sig);
bs2::connection subscribe_ee_flexcn_event(
const ee_flexcn_sig_t::slot_type& sig);
private: private:
sm_context_status_sig_t sm_context_status_sig_t
sm_context_status; // Signal for SM Context status update sm_context_status; // Signal for SM Context status update
ee_pdu_session_release_sig_t ee_pdu_session_release_sig_t
ee_pdu_session_release; // Signal for SM Context status update ee_pdu_session_release; // Signal for PDU Session Release
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_flexcn_sig_t ee_flexcn; // Signal for FlexCN Event
}; };
} // namespace smf } // namespace smf
#endif /* FILE_SMF_EVENT_HPP_SEEN */ #endif /* FILE_SMF_EVENT_HPP_SEEN */
...@@ -52,10 +52,29 @@ typedef bs2::signal_type< ...@@ -52,10 +52,29 @@ typedef bs2::signal_type<
ee_pdu_session_release_sig_t; ee_pdu_session_release_sig_t;
// TODO: ee_ue_ip_address_change_sig_t; //UI IP Address, UE ID // TODO: ee_ue_ip_address_change_sig_t; //UI IP Address, UE ID
// Signal for Event exposure
// UE Addr Change, SUPI, PDU SessionID, HTTP version
typedef bs2::signal_type<
void(supi64_t, uint8_t), bs2::keywords::mutex_type<bs2::dummy_mutex>>::type
ee_ue_ip_change_sig_t;
// TODO: Access Type Change // TODO: Access Type Change
// TODO: UP Path Change // TODO: UP Path Change
// TODO: PLMN Change // TODO: PLMN Change
typedef bs2::signal_type<
void(scid_t, uint8_t), bs2::keywords::mutex_type<bs2::dummy_mutex>>::type
ee_plmn_change_sig_t;
// TODO: Downlink data delivery status // TODO: Downlink data delivery status
typedef bs2::signal_type<
void(scid_t, uint8_t), bs2::keywords::mutex_type<bs2::dummy_mutex>>::type
ee_ddds_sig_t;
// Signal for FlexCN event (for Event Exposure)
// SCID, HTTP version
typedef bs2::signal_type<
void(scid_t, uint8_t), bs2::keywords::mutex_type<bs2::dummy_mutex>>::type
ee_flexcn_sig_t;
} // namespace smf } // namespace smf
#endif /* FILE_SMF_EVENT_SIG_HPP_SEEN */ #endif /* FILE_SMF_EVENT_SIG_HPP_SEEN */
...@@ -976,11 +976,42 @@ void event_exposure_msg::set_event_subs( ...@@ -976,11 +976,42 @@ void event_exposure_msg::set_event_subs(
void event_notification::set_smf_event(const smf_event_t& ev) { void event_notification::set_smf_event(const smf_event_t& ev) {
m_event = ev; m_event = ev;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
smf_event_t event_notification::get_smf_event() const { smf_event_t event_notification::get_smf_event() const {
return m_event; return m_event;
} }
//-----------------------------------------------------------------------------
// ddds change
void event_notification::set_Ddds(
oai::smf_server::model::DddStatus const& value) {
m_DddStatus = value;
m_DddStatusIsSet = true;
}
oai::smf_server::model::DddStatus event_notification::get_ddds() const {
return m_DddStatus;
}
bool event_notification::is_ddds_is_set() const {
return m_DddStatusIsSet;
}
//-----------------------------------------------------------------------------
void event_notification::set_timestamp(const std::string& ss) {
m_timestamp = ss;
}
//-----------------------------------------------------------------------------
void event_notification::get_timestamp(std::string& ss) const {
ss = m_timestamp;
}
//-----------------------------------------------------------------------------
std::string event_notification::get_timestamp() const {
return m_timestamp;
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
supi64_t event_notification::get_supi() const { supi64_t event_notification::get_supi() const {
return m_supi; return m_supi;
...@@ -1029,6 +1060,21 @@ bool event_notification::is_re_ipv4_addr_is_set() const { ...@@ -1029,6 +1060,21 @@ bool event_notification::is_re_ipv4_addr_is_set() const {
return m_re_ipv4_addr_is_set; return m_re_ipv4_addr_is_set;
} }
// m_PlmnId
void event_notification::set_PlmnId(
oai::smf_server::model::PlmnId const& value) {
m_PlmnId = value;
m_PlmnIdIsSet = true;
}
oai::smf_server::model::PlmnId event_notification::get_plmnid() const {
return m_PlmnId;
}
bool event_notification::is_plmnid_is_set() const {
return m_PlmnIdIsSet;
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void event_notification::set_pdu_session_id(const pdu_session_id_t value) { void event_notification::set_pdu_session_id(const pdu_session_id_t value) {
m_pdu_session_id = value; m_pdu_session_id = value;
...@@ -1065,6 +1111,16 @@ std::string event_notification::get_notif_id() const { ...@@ -1065,6 +1111,16 @@ std::string event_notification::get_notif_id() const {
return m_notif_id; return m_notif_id;
} }
//------------------------------------------------------------------------------
void event_notification::set_custom_info(const nlohmann::json& c) {
custom_info = c;
}
//------------------------------------------------------------------------------
void event_notification::get_custom_info(nlohmann::json& c) const {
c = custom_info;
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void data_notification_msg::set_notification_event_type( void data_notification_msg::set_notification_event_type(
const std::string& type) { const std::string& type) {
......
...@@ -35,11 +35,13 @@ ...@@ -35,11 +35,13 @@
#include "3gpp_24.501.h" #include "3gpp_24.501.h"
#include "3gpp_29.244.h" #include "3gpp_29.244.h"
#include "3gpp_29.508.h" #include "3gpp_29.508.h"
#include "3gpp_29.518.h"
#include "3gpp_29.571.h" #include "3gpp_29.571.h"
#include "NgRanTargetId.h" #include "NgRanTargetId.h"
#include "pistache/http.h" #include "pistache/http.h"
#include "smf_profile.hpp" #include "smf_profile.hpp"
#include "3gpp_29.518.h" #include "PlmnId.h"
#include "DddStatus.h"
extern "C" { extern "C" {
#include "QOSRules.h" #include "QOSRules.h"
...@@ -604,6 +606,10 @@ class event_notification { ...@@ -604,6 +606,10 @@ class event_notification {
void set_smf_event(const smf_event_t& ev); void set_smf_event(const smf_event_t& ev);
smf_event_t get_smf_event() const; smf_event_t get_smf_event() const;
void set_timestamp(const std::string& ss);
void get_timestamp(std::string& ss) const;
std::string get_timestamp() const;
void set_supi(const supi64_t& supi); void set_supi(const supi64_t& supi);
supi64_t get_supi() const; supi64_t get_supi() const;
bool is_supi_is_set() const; bool is_supi_is_set() const;
...@@ -616,6 +622,16 @@ class event_notification { ...@@ -616,6 +622,16 @@ class event_notification {
std::string get_re_ipv4_addr() const; std::string get_re_ipv4_addr() const;
bool is_re_ipv4_addr_is_set() const; bool is_re_ipv4_addr_is_set() const;
// m_PlmnId
void set_PlmnId(oai::smf_server::model::PlmnId const& value);
oai::smf_server::model::PlmnId get_plmnid() const;
bool is_plmnid_is_set() const;
// ddds change
void set_Ddds(oai::smf_server::model::DddStatus const& value);
oai::smf_server::model::DddStatus get_ddds() const;
bool is_ddds_is_set() const;
void set_pdu_session_id(const pdu_session_id_t value); void set_pdu_session_id(const pdu_session_id_t value);
pdu_session_id_t get_pdu_session_id() const; pdu_session_id_t get_pdu_session_id() const;
bool is_psi_is_set() const; bool is_psi_is_set() const;
...@@ -624,13 +640,16 @@ class event_notification { ...@@ -624,13 +640,16 @@ class event_notification {
std::string get_notif_uri() const; std::string get_notif_uri() const;
void set_notif_id(std::string const& value); void set_notif_id(std::string const& value);
std::string get_notif_id() const; std::string get_notif_id() const;
void set_custom_info(const nlohmann::json& c);
void get_custom_info(nlohmann::json& c) const;
private: private:
nlohmann::json custom_info; // store extra json data
std::string m_notif_uri; // m_NotifUri; std::string m_notif_uri; // m_NotifUri;
std::string m_notif_id; // m_NotifId; std::string m_notif_id; // m_NotifId;
smf_event_t m_event; // SmfEvent smf_event_t m_event; // SmfEvent
// std::string m_TimeStamp; std::string m_timestamp;
supi64_t m_supi; supi64_t m_supi;
bool m_supi_is_set; bool m_supi_is_set;
...@@ -642,8 +661,12 @@ class event_notification { ...@@ -642,8 +661,12 @@ class event_notification {
bool m_re_ipv4_addr_is_set; // m_ReIpv4AddrIsSet; bool m_re_ipv4_addr_is_set; // m_ReIpv4AddrIsSet;
// for a PLMN Change // for a PLMN Change
// PlmnId m_PlmnId; oai::smf_server::model::PlmnId m_PlmnId;
// bool m_PlmnIdIsSet; bool m_PlmnIdIsSet;
// for ddds change
oai::smf_server::model::DddStatus m_DddStatus;
bool m_DddStatusIsSet;
// for an access type change // for an access type change
// AccessType m_AccType; // AccessType m_AccType;
...@@ -679,8 +702,6 @@ class event_notification { ...@@ -679,8 +702,6 @@ class event_notification {
// bool m_AdIpv6PrefixIsSet; // bool m_AdIpv6PrefixIsSet;
// Ipv6Prefix m_ReIpv6Prefix; // Ipv6Prefix m_ReIpv6Prefix;
// bool m_ReIpv6PrefixIsSet; // bool m_ReIpv6PrefixIsSet;
// DddStatus m_DddStatus;
// bool m_DddStatusIsSet;
// std::string m_MaxWaitTime; // std::string m_MaxWaitTime;
// bool m_MaxWaitTimeIsSet; // bool m_MaxWaitTimeIsSet;
}; };
......
...@@ -1123,8 +1123,19 @@ void session_update_sm_context_procedure::handle_itti_msg( ...@@ -1123,8 +1123,19 @@ void session_update_sm_context_procedure::handle_itti_msg(
// Update PDU session status to ACTIVE // Update PDU session status to ACTIVE
sps->set_pdu_session_status(pdu_session_status_e::PDU_SESSION_ACTIVE); sps->set_pdu_session_status(pdu_session_status_e::PDU_SESSION_ACTIVE);
// set UpCnxState to DEACTIVATED // set UpCnxState to ACTIVATED
sps->set_upCnx_state(upCnx_state_e::UPCNX_STATE_ACTIVATED); sps->set_upCnx_state(upCnx_state_e::UPCNX_STATE_ACTIVATED);
// Trigger Event_exposure event
std::string str_scid = n11_trigger.get()->scid;
// TODO: validate the str_scid
//
scid_t scid = (scid_t) std::stoul(str_scid, nullptr, 0);
sc.get()->trigger_ue_ip_change(scid, 1);
sc.get()->trigger_plmn_change(scid, 1);
sc.get()->trigger_ddds(scid, 1);
sc.get()->trigger_flexcn_event(scid, 1);
} break; } break;
// UE-Triggered Service Request Procedure (Step 1) // UE-Triggered Service Request Procedure (Step 1)
......
...@@ -495,9 +495,35 @@ void smf_sbi::notify_subscribed_event( ...@@ -495,9 +495,35 @@ void smf_sbi::notify_subscribed_event(
json_data["notifId"] = i.get_notif_id(); json_data["notifId"] = i.get_notif_id();
auto event_notifs = nlohmann::json::array(); auto event_notifs = nlohmann::json::array();
nlohmann::json event_notif = {}; nlohmann::json event_notif = {};
event_notif["event"] = i.get_smf_event(); event_notif["event"] = smf_event_from_enum(i.get_smf_event());
event_notif["pduSeId"] = i.get_pdu_session_id(); event_notif["pduSeId"] = i.get_pdu_session_id();
event_notif["supi"] = std::to_string(i.get_supi()); event_notif["supi"] = std::to_string(i.get_supi());
if (i.is_ad_ipv4_addr_is_set()) {
event_notif["adIpv4Addr"] = i.get_ad_ipv4_addr();
}
if (i.is_re_ipv4_addr_is_set()) {
event_notif["reIpv4Addr"] = i.get_re_ipv4_addr();
}
// add support for plmn change.
if (i.is_plmnid_is_set()) {
event_notif["plmnId"] = i.get_plmnid();
}
// add support for ddds
if (i.is_ddds_is_set()) {
// TODO: change this one to the real value when finished the event for
// ddds
// event_notif["dddStatus"] = i.get_ddds();
event_notif["dddStatus"] = "TRANSMITTED";
}
// customized data
nlohmann::json customized_data = {};
i.get_custom_info(customized_data);
if (!customized_data.is_null())
event_notif["customized_data"] = customized_data;
// timestamp // timestamp
std::time_t time_epoch_ntp = std::time(nullptr); std::time_t time_epoch_ntp = std::time(nullptr);
uint64_t tv_ntp = time_epoch_ntp + SECONDS_SINCE_FIRST_EPOCH; uint64_t tv_ntp = time_epoch_ntp + SECONDS_SINCE_FIRST_EPOCH;
......
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