Commit 43624b7f authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Merge branch 'event_exposure_registration_state' into 'develop'

Event exposure registration state

See merge request oai/cn5g/oai-cn5g-amf!79
parents 4b6a5e0d 88db239f
...@@ -21,16 +21,33 @@ ...@@ -21,16 +21,33 @@
/*! \file amf_event.cpp /*! \file amf_event.cpp
\brief \brief
\author Shivam Gandhi \author Shivam Gandhi (KCL), Tien-Thinh NGUYEN (EURECOM)
\company KCL \company
\date 2021 \date 2021
\email: shivam.gandhi@kcl.ac.uk \email: contact@openairinterface.org
*/ */
#include "amf_event.hpp" #include "amf_event.hpp"
using namespace amf_application; using namespace amf_application;
//------------------------------------------------------------------------------
bs2::connection amf_event::subscribe_ue_location_report(
const ue_location_report_sig_t::slot_type& sig) {
return ue_location_report.connect(sig);
}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bs2::connection amf_event::subscribe_ue_reachability_status( bs2::connection amf_event::subscribe_ue_reachability_status(
const ue_reachability_status_sig_t::slot_type& sig) { const ue_reachability_status_sig_t::slot_type& sig) {
return ue_reachability_status.connect(sig); return ue_reachability_status.connect(sig);
} }
//------------------------------------------------------------------------------
bs2::connection amf_event::subscribe_ue_registration_state(
const ue_registration_state_sig_t::slot_type& sig) {
return ue_registration_state.connect(sig);
}
bs2::connection amf_event::subscribe_ue_connectivity_state(
const ue_connectivity_state_sig_t::slot_type& sig) {
return ue_connectivity_state.connect(sig);
}
...@@ -21,10 +21,10 @@ ...@@ -21,10 +21,10 @@
/*! \file amf_event.hpp /*! \file amf_event.hpp
\brief \brief
\author Shivam Gandhi \author Shivam Gandhi (KCL), Tien-Thinh NGUYEN (EURECOM)
\company KCL \company
\date 2021 \date 2021
\email: shivam.gandhi@kcl.ac.uk \email: contact@openairinterface.org
*/ */
#include <boost/signals2.hpp> #include <boost/signals2.hpp>
...@@ -50,9 +50,19 @@ class amf_event { ...@@ -50,9 +50,19 @@ class amf_event {
friend class amf_n1; friend class amf_n1;
friend class amf_profile; friend class amf_profile;
/*
* Subscribe to Location Report signal
* @param [const ue_location_report_sig_t::slot_type&] sig: slot_type
* parameter
* @return boost::signals2::connection: the connection between the signal and
* the slot
*/
bs2::connection subscribe_ue_location_report(
const ue_location_report_sig_t::slot_type& sig);
/* /*
* Subscribe to UE Reachability Status Notification signal * Subscribe to UE Reachability Status Notification signal
* @param [const ue_reachability_status_sig_t::slot_type&] sig: slot_type * @param [const ue_reachability_status_sig_t::slot_type&] sig: slot_type
* parameter * parameter
* @return boost::signals2::connection: the connection between the signal and * @return boost::signals2::connection: the connection between the signal and
* the slot * the slot
...@@ -60,8 +70,33 @@ class amf_event { ...@@ -60,8 +70,33 @@ class amf_event {
bs2::connection subscribe_ue_reachability_status( bs2::connection subscribe_ue_reachability_status(
const ue_reachability_status_sig_t::slot_type& sig); const ue_reachability_status_sig_t::slot_type& sig);
/*
* Subscribe to UE Registration State Notification signal
* @param [const ue_registration_state_sig_t::slot_type&] sig: slot_type
* parameter
* @return boost::signals2::connection: the connection between the signal and
* the slot
*/
bs2::connection subscribe_ue_registration_state(
const ue_registration_state_sig_t::slot_type& sig);
/*
* Subscribe to UE Connectivity State Notification signal
* @param [const ue_connectivity_state_sig_t::slot_type&] sig: slot_type
* parameter
* @return boost::signals2::connection: the connection between the signal and
* the slot
*/
bs2::connection subscribe_ue_connectivity_state(
const ue_connectivity_state_sig_t::slot_type& sig);
private: private:
ue_location_report_sig_t ue_location_report; // Signal for UE Location Report
ue_reachability_status_sig_t ue_reachability_status_sig_t
ue_reachability_status; // Signal for UE Reachability Report ue_reachability_status; // Signal for UE Reachability Report
ue_registration_state_sig_t
ue_registration_state; // Signal for UE Registration State Report
ue_connectivity_state_sig_t
ue_connectivity_state; // Signal for UE Connectivity State Report
}; };
} // namespace amf_application } // namespace amf_application
...@@ -21,10 +21,10 @@ ...@@ -21,10 +21,10 @@
/*! \file amf_event_sig.hpp /*! \file amf_event_sig.hpp
\brief \brief
\author Shivam Gandhi \author Shivam Gandhi (KCL), Tien-Thinh NGUYEN (EURECOM)
\company KCL \company
\date 2021 \date 2021
\email: shivam.gandhi@kcl.ac.uk \email: contact@openairinterface.org
*/ */
#ifndef FILE_SMF_EVENT_SIG_HPP_SEEN #ifndef FILE_SMF_EVENT_SIG_HPP_SEEN
...@@ -32,17 +32,46 @@ ...@@ -32,17 +32,46 @@
#include <boost/signals2.hpp> #include <boost/signals2.hpp>
#include <string> #include <string>
#include "UserLocation.h"
namespace bs2 = boost::signals2; namespace bs2 = boost::signals2;
namespace amf_application { namespace amf_application {
// Signal for UE Location Report
// SUPI, User Location, HTTP version
typedef bs2::signal_type<
void(std::string, oai::amf::model::UserLocation, uint8_t),
bs2::keywords::mutex_type<bs2::dummy_mutex>>::type ue_location_report_sig_t;
// TODO: Presence-In-AOI-Report
// TODO: Time-Zone-Report
// TODO: Access-Type-Report
// Signal for UE Reachability Report // Signal for UE Reachability Report
// SUPI, HTTP version // SUPI, status, HTTP version
typedef bs2::signal_type< typedef bs2::signal_type<
void(std::string, uint8_t), void(std::string, uint8_t, uint8_t),
bs2::keywords::mutex_type<bs2::dummy_mutex>>::type bs2::keywords::mutex_type<bs2::dummy_mutex>>::type
ue_reachability_status_sig_t; ue_reachability_status_sig_t;
// Signal for UE Registration State Report
// SUPI, registration state, HTTP version
typedef bs2::signal_type<
void(std::string, uint8_t, uint8_t),
bs2::keywords::mutex_type<bs2::dummy_mutex>>::type
ue_registration_state_sig_t;
// Signal for Connectivity State Report
// SUPI, connectivity state, HTTP version
typedef bs2::signal_type<
void(std::string, uint8_t, uint8_t),
bs2::keywords::mutex_type<bs2::dummy_mutex>>::type
ue_connectivity_state_sig_t;
// TODO: Communication-Failure-Report
// TODO: UEs-In-Area-Report
// TODO: Loss-of-Connectivity
} // namespace amf_application } // namespace amf_application
#endif #endif
...@@ -144,13 +144,15 @@ std::string event_notification::get_subs_change_notify_correlation_id() const { ...@@ -144,13 +144,15 @@ std::string event_notification::get_subs_change_notify_correlation_id() const {
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void event_notification::add_report(const amf_event_report_t& report) { void event_notification::add_report(
m_report_list.push_back(report); const oai::amf::model::AmfEventReport& report) {
m_event_report_list.push_back(report);
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
std::vector<amf_event_report_t> event_notification::get_reports() const { void event_notification::get_reports(
return m_report_list; std::vector<oai::amf::model::AmfEventReport>& reports) const {
reports = m_event_report_list;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include "amf.hpp" #include "amf.hpp"
#include "3gpp_29.518.h" #include "3gpp_29.518.h"
#include "amf_profile.hpp" #include "amf_profile.hpp"
#include "AmfEventReport.h"
namespace amf_application { namespace amf_application {
...@@ -88,8 +89,8 @@ class event_notification { ...@@ -88,8 +89,8 @@ class event_notification {
std::string get_notify_correlation_id() const; std::string get_notify_correlation_id() const;
void set_subs_change_notify_correlation_id(std::string const& value); void set_subs_change_notify_correlation_id(std::string const& value);
std::string get_subs_change_notify_correlation_id() const; std::string get_subs_change_notify_correlation_id() const;
void add_report(const amf_event_report_t& report); void add_report(const oai::amf::model::AmfEventReport& report);
std::vector<amf_event_report_t> get_reports() const; void get_reports(std::vector<oai::amf::model::AmfEventReport>& reports) const;
private: private:
std::string m_notify_correlation_id; // notifyCorrelationId std::string m_notify_correlation_id; // notifyCorrelationId
...@@ -97,7 +98,8 @@ class event_notification { ...@@ -97,7 +98,8 @@ class event_notification {
std::string std::string
m_subs_change_notify_correlation_id; // SubsChangeNotifyCorrelationId; m_subs_change_notify_correlation_id; // SubsChangeNotifyCorrelationId;
bool m_subs_change_notify_correlation_id_is_set; bool m_subs_change_notify_correlation_id_is_set;
std::vector<amf_event_report_t> m_report_list; // Report List std::vector<oai::amf::model::AmfEventReport>
m_event_report_list; // Report List
bool m_report_list_is_set; bool m_report_list_is_set;
}; };
......
This diff is collapsed.
...@@ -173,8 +173,16 @@ class amf_n1 { ...@@ -173,8 +173,16 @@ class amf_n1 {
void get_5gcm_state( void get_5gcm_state(
const std::shared_ptr<nas_context>& nc, cm_state_t& state) const; const std::shared_ptr<nas_context>& nc, cm_state_t& state) const;
void handle_ue_location_change(
std::string supi, oai::amf::model::UserLocation, uint8_t http_version);
void handle_ue_reachability_status_change( void handle_ue_reachability_status_change(
std::string supi, uint8_t http_version); std::string supi, uint8_t status, uint8_t http_version);
void handle_ue_registration_state_change(
std::string supi, uint8_t status, uint8_t http_version);
void handle_ue_connectivity_state_change(
std::string supi, uint8_t status, uint8_t http_version);
void get_pdu_session_to_be_activated( void get_pdu_session_to_be_activated(
uint16_t pdu_session_status, uint16_t pdu_session_status,
...@@ -244,7 +252,10 @@ class amf_n1 { ...@@ -244,7 +252,10 @@ class amf_n1 {
// for Event Handling // for Event Handling
amf_event event_sub; amf_event event_sub;
bs2::connection ee_ue_location_report_connection;
bs2::connection ee_ue_reachability_status_connection; bs2::connection ee_ue_reachability_status_connection;
bs2::connection ee_ue_registration_state_connection;
bs2::connection ee_ue_connectivity_state_connection;
}; };
} // namespace amf_application } // namespace amf_application
......
...@@ -52,6 +52,7 @@ ...@@ -52,6 +52,7 @@
#include "conversions.hpp" #include "conversions.hpp"
#include "comUt.hpp" #include "comUt.hpp"
#include "AmfEventReport.h"
extern "C" { extern "C" {
#include "dynamic_memory_check.h" #include "dynamic_memory_check.h"
...@@ -539,16 +540,16 @@ void amf_n11::handle_itti_message(itti_sbi_notify_subscribed_event& itti_msg) { ...@@ -539,16 +540,16 @@ void amf_n11::handle_itti_message(itti_sbi_notify_subscribed_event& itti_msg) {
auto report_lists = nlohmann::json::array(); auto report_lists = nlohmann::json::array();
nlohmann::json report = {}; nlohmann::json report = {};
std::vector<amf_event_report_t> reports = i.get_reports(); std::vector<oai::amf::model::AmfEventReport> event_reports = {};
i.get_reports(event_reports);
for (auto r : reports) { for (auto r : event_reports) {
report["type"] = amf_event_type_e2str.at(static_cast<uint8_t>(r.m_type)); report["type"] = r.getType().get_value();
report["state"]["active"] = "TRUE"; report["state"]["active"] = "TRUE";
if (r.m_supi_is_set) { if (r.supiIsSet()) {
report["supi"] = r.m_supi; // TODO report["supi"] = r.getSupi();
} }
if (r.m_reachability_is_set) { if (r.reachabilityIsSet()) {
report["reachability"] = r.m_reachability; report["reachability"] = r.getReachability().get_value();
} }
// timestamp // timestamp
......
...@@ -75,61 +75,6 @@ typedef struct amf_event_s { ...@@ -75,61 +75,6 @@ typedef struct amf_event_s {
} amf_event_t; } amf_event_t;
typedef struct amf_event_state_s {
bool m_active;
int32_t m_remain_reports;
bool m_remain_reports_is_set;
int32_t m_remain_duration;
bool m_remain_duration_is_set;
} amf_event_state_t;
typedef enum ue_reachability_e {
UNREACHABLE = 1,
REACHABLE = 2,
REGULATORY_ONLY = 3
} ue_reachability_t;
typedef struct amf_event_report_s {
amf_event_type_t m_type; // Mandatory
amf_event_state_t m_state; // Mandatory
std::string m_TimeStamp; // Mandatory
ue_reachability_t m_reachability;
bool m_reachability_is_set;
std::string m_supi;
bool m_supi_is_set;
std::string m_subscription_id;
bool m_subscription_id_is_set;
bool m_any_ue;
bool m_any_ue_is_set;
/*
std::vector<AmfEventArea> m_AreaList;
bool m_AreaListIsSet;
int32_t m_RefId;
bool m_RefIdIsSet;
std::string m_Gpsi;
bool m_GpsiIsSet;
std::string m_Pei;
bool m_PeiIsSet;
UserLocation m_Location;
bool m_LocationIsSet;
std::string m_Timezone;
bool m_TimezoneIsSet;
std::vector<AccessType> m_AccessTypeList;
bool m_AccessTypeListIsSet;
std::vector<RmInfo> m_RmInfoList;
bool m_RmInfoListIsSet;
std::vector<CmInfo> m_CmInfoList;
bool m_CmInfoListIsSet;
//CommunicationFailure m_CommFailure;
// bool m_CommFailureIsSet;
// int32_t m_NumberOfUes;
// bool m_NumberOfUesIsSet;
// std::vector<_5GsUserStateInfo> m_r_5gsUserStateList;
// bool m_r_5gsUserStateListIsSet;
*/
} amf_event_report_t;
enum n1_n2_message_transfer_cause_e { enum n1_n2_message_transfer_cause_e {
ATTEMPTING_TO_REACH_UE = 1, ATTEMPTING_TO_REACH_UE = 1,
N1_N2_TRANSFER_INITIATED = 2, N1_N2_TRANSFER_INITIATED = 2,
......
...@@ -49,10 +49,21 @@ bool CmState::operator!=(const CmState& rhs) const { ...@@ -49,10 +49,21 @@ bool CmState::operator!=(const CmState& rhs) const {
return !(*this == rhs); return !(*this == rhs);
} }
void CmState::set_value(std::string value) {
this->value = value;
}
void CmState::get_value(std::string& value) const {
value = this->value;
}
std::string CmState::get_value() const {
return value;
}
void to_json(nlohmann::json& j, const CmState& o) { void to_json(nlohmann::json& j, const CmState& o) {
j = nlohmann::json(); j = o.get_value();
} }
void from_json(const nlohmann::json& j, CmState& o) {} void from_json(const nlohmann::json& j, CmState& o) {
o.set_value(j.get<std::string>());
}
} // namespace oai::amf::model } // namespace oai::amf::model
...@@ -38,6 +38,10 @@ class CmState { ...@@ -38,6 +38,10 @@ class CmState {
/// </summary> /// </summary>
void validate() const; void validate() const;
void set_value(std::string value);
void get_value(std::string& value) const;
std::string get_value() const;
/// <summary> /// <summary>
/// Validate the current data in the model. Returns false on error and writes /// Validate the current data in the model. Returns false on error and writes
/// an error message into the given stringstream. /// an error message into the given stringstream.
...@@ -54,6 +58,7 @@ class CmState { ...@@ -54,6 +58,7 @@ class CmState {
friend void from_json(const nlohmann::json& j, CmState& o); friend void from_json(const nlohmann::json& j, CmState& o);
protected: protected:
std::string value;
// Helper overload for validate. Used when one model stores another model and // Helper overload for validate. Used when one model stores another model and
// calls it's validate. // calls it's validate.
bool validate(std::stringstream& msg, const std::string& pathPrefix) const; bool validate(std::stringstream& msg, const std::string& pathPrefix) const;
......
...@@ -49,10 +49,22 @@ bool RmState::operator!=(const RmState& rhs) const { ...@@ -49,10 +49,22 @@ bool RmState::operator!=(const RmState& rhs) const {
return !(*this == rhs); return !(*this == rhs);
} }
void RmState::set_value(std::string value) {
this->value = value;
}
void RmState::get_value(std::string& value) const {
value = this->value;
}
std::string RmState::get_value() const {
return value;
}
void to_json(nlohmann::json& j, const RmState& o) { void to_json(nlohmann::json& j, const RmState& o) {
j = nlohmann::json(); j = o.get_value();
} }
void from_json(const nlohmann::json& j, RmState& o) {} void from_json(const nlohmann::json& j, RmState& o) {
o.set_value(j.get<std::string>());
}
} // namespace oai::amf::model } // namespace oai::amf::model
...@@ -44,6 +44,10 @@ class RmState { ...@@ -44,6 +44,10 @@ class RmState {
/// </summary> /// </summary>
bool validate(std::stringstream& msg) const; bool validate(std::stringstream& msg) const;
void set_value(std::string value);
void get_value(std::string& value) const;
std::string get_value() const;
bool operator==(const RmState& rhs) const; bool operator==(const RmState& rhs) const;
bool operator!=(const RmState& rhs) const; bool operator!=(const RmState& rhs) const;
...@@ -54,6 +58,7 @@ class RmState { ...@@ -54,6 +58,7 @@ class RmState {
friend void from_json(const nlohmann::json& j, RmState& o); friend void from_json(const nlohmann::json& j, RmState& o);
protected: protected:
std::string value;
// Helper overload for validate. Used when one model stores another model and // Helper overload for validate. Used when one model stores another model and
// calls it's validate. // calls it's validate.
bool validate(std::stringstream& msg, const std::string& pathPrefix) const; bool validate(std::stringstream& msg, const std::string& pathPrefix) const;
......
...@@ -50,10 +50,22 @@ bool UeReachability::operator!=(const UeReachability& rhs) const { ...@@ -50,10 +50,22 @@ bool UeReachability::operator!=(const UeReachability& rhs) const {
return !(*this == rhs); return !(*this == rhs);
} }
void UeReachability::set_value(std::string value) {
this->value = value;
}
void UeReachability::get_value(std::string& value) const {
value = this->value;
}
std::string UeReachability::get_value() const {
return value;
}
void to_json(nlohmann::json& j, const UeReachability& o) { void to_json(nlohmann::json& j, const UeReachability& o) {
j = nlohmann::json(); j = o.get_value();
} }
void from_json(const nlohmann::json& j, UeReachability& o) {} void from_json(const nlohmann::json& j, UeReachability& o) {
o.set_value(j.get<std::string>());
}
} // namespace oai::amf::model } // namespace oai::amf::model
...@@ -50,10 +50,15 @@ class UeReachability { ...@@ -50,10 +50,15 @@ class UeReachability {
///////////////////////////////////////////// /////////////////////////////////////////////
/// UeReachability members /// UeReachability members
void set_value(std::string value);
void get_value(std::string& value) const;
std::string get_value() const;
friend void to_json(nlohmann::json& j, const UeReachability& o); friend void to_json(nlohmann::json& j, const UeReachability& o);
friend void from_json(const nlohmann::json& j, UeReachability& o); friend void from_json(const nlohmann::json& j, UeReachability& o);
protected: protected:
std::string value;
// Helper overload for validate. Used when one model stores another model and // Helper overload for validate. Used when one model stores another model and
// calls it's validate. // calls it's validate.
bool validate(std::stringstream& msg, const std::string& pathPrefix) const; bool validate(std::stringstream& msg, const std::string& pathPrefix) const;
......
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