Commit 5df62e5d authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

First version for UE Reachability Status

parent aeddeef3
......@@ -48,7 +48,6 @@ using namespace ngap;
using namespace nas;
using namespace amf_application;
using namespace config;
using namespace amf;
extern void print_buffer(
const std::string app, const std::string commit, uint8_t* buf, int len);
......
......@@ -59,8 +59,6 @@ static uint32_t amf_app_ue_ngap_id_generator = 1;
namespace amf_application {
using namespace amf;
#define TASK_AMF_APP_PERIODIC_STATISTICS (0)
class amf_app {
......
......@@ -28,8 +28,7 @@
*/
#include "amf_event.hpp"
#include "amf_app.hpp"
using namespace amf_application;
//------------------------------------------------------------------------------
bs2::connection amf_event::subscribe_ue_reachability_status(
const ue_reachability_status_sig_t::slot_type& sig) {
......
......@@ -33,7 +33,7 @@ namespace bs2 = boost::signals2;
#include "amf.hpp"
#include "amf_event_sig.hpp"
namespace amf {
namespace amf_application {
class amf_event {
public:
amf_event(){};
......@@ -47,7 +47,7 @@ class amf_event {
// class register/handle event
friend class amf_app;
friend class amf_context;
friend class amf_n1;
friend class amf_profile;
/*
......@@ -64,4 +64,4 @@ class amf_event {
ue_reachability_status_sig_t
ue_reachability_status; // Signal for UE Reachability Report
};
} // namespace amf
} // namespace amf_application
......@@ -35,7 +35,7 @@
namespace bs2 = boost::signals2;
namespace amf {
namespace amf_application {
// Signal for UE Reachability Report
// SUPI, HTTP version
......@@ -44,5 +44,5 @@ typedef bs2::signal_type<
bs2::keywords::mutex_type<bs2::dummy_mutex>>::type
ue_reachability_status_sig_t;
} // namespace amf
} // namespace amf_application
#endif
......@@ -125,6 +125,11 @@ amf_n1::amf_n1() {
throw std::runtime_error("Cannot create task TASK_AMF_N1");
}
Logger::amf_n1().startup("amf_n1 started");
// Subscribe to UE Reachability Status change
ee_ue_reachability_status_connection =
event_sub.subscribe_ue_reachability_status(boost::bind(
&amf_n1::handle_ue_reachability_status_change, this, _1, _2));
}
//------------------------------------------------------------------------------
......@@ -417,6 +422,14 @@ void amf_n1::nas_signalling_establishment_request_handle(
nc.get()->ran_ue_ngap_id = ran_ue_ngap_id;
nc.get()->serving_network = snn;
// stacs.UE_connected += 1;
// Trigger UE Reachability Status Notify
string supi = "imsi-" + nc.get()->imsi;
Logger::amf_n1().debug(
"Signal the UE Reachability Status Event notification for SUPI %s",
supi.c_str());
event_sub.ue_reachability_status(supi, 1);
} else {
// Logger::amf_n1().debug("existing nas_context with amf_ue_ngap_id(0x%x)
// --> Update",amf_ue_ngap_id); nc =
......@@ -2793,3 +2806,28 @@ void amf_n1::get_5gmm_state(
// TODO:
state = nc.get()->_5gmm_state;
}
//------------------------------------------------------------------------------
void amf_n1::handle_ue_reachability_status_change(
std::string supi, uint8_t http_version) {
Logger::amf_n1().debug(
"Send request to SBI to triger UE Reachability Status Notification (SUPI "
"%s )",
supi.c_str());
std::shared_ptr<itti_sbi_notify_subscribed_event> itti_msg =
std::make_shared<itti_sbi_notify_subscribed_event>(
TASK_AMF_N1, TASK_AMF_N11);
// TODO:
itti_msg->notif_id = "";
itti_msg->http_version = 1;
// std::vector<amf_application::event_notification> event_notifs;
int ret = itti_inst->send_msg(itti_msg);
if (0 != ret) {
Logger::amf_n1().error(
"Could not send ITTI message %s to task TASK_AMF_N11",
itti_msg->get_msg_name());
}
}
......@@ -44,6 +44,7 @@
#include "mysql_db.hpp"
#include "nas_context.hpp"
#include "pdu_session_context.hpp"
#include "amf_event.hpp"
namespace amf_application {
......@@ -154,7 +155,10 @@ class amf_n1 {
void set_5gmm_state(std::shared_ptr<nas_context> nc, _5gmm_state_t state);
void get_5gmm_state(std::shared_ptr<nas_context> nc, _5gmm_state_t& state);
private: // nas message handlers
void handle_ue_reachability_status_change(
std::string supi, uint8_t http_version);
private:
void ue_initiate_de_registration_handle(
uint32_t ran_ue_ngap_id, long amf_ue_ngap_id, bstring nas);
void registration_request_handle(
......@@ -188,6 +192,10 @@ class amf_n1 {
// response message
void response_registration_reject_msg(
uint8_t cause_value, uint32_t ran_ue_ngap_id, long amf_ue_ngap_id);
// for Event Handling
amf_event event_sub;
bs2::connection ee_ue_reachability_status_connection;
};
} // namespace amf_application
......
......@@ -30,7 +30,7 @@
#include "3gpp_29.518.h"
#include "amf.hpp"
namespace amf {
namespace amf_application {
/*
* Manage the Subscription Info
......@@ -48,4 +48,4 @@ class amf_subscription {
std::string nf_id;
};
} // namespace amf
} // namespace amf_application
......@@ -87,6 +87,7 @@ typedef enum {
N11_DEREGISTER_NF_INSTANCE,
SBI_EVENT_EXPOSURE_REQUEST,
SBI_NOTIFICATION_DATA,
SBI_NOTIFY_SUBSCRIBED_EVENT,
UE_CONTEXT_RELEASE_COMMAND,
NSMF_PDU_SESSION_RELEASE_SM_CTX,
HANDOVER_REQUIRED,
......
......@@ -93,4 +93,26 @@ class itti_sbi_notification_data : public itti_sbi_msg {
uint8_t http_version;
};
//-----------------------------------------------------------------------------
class itti_sbi_notify_subscribed_event : public itti_sbi_msg {
public:
itti_sbi_notify_subscribed_event(const task_id_t orig, const task_id_t dest)
: itti_sbi_msg(SBI_NOTIFY_SUBSCRIBED_EVENT, orig, dest),
notif_id(),
http_version() {}
itti_sbi_notify_subscribed_event(const itti_sbi_notify_subscribed_event& i)
: itti_sbi_msg(i), notif_id(i.notif_id), http_version(i.http_version) {}
itti_sbi_notify_subscribed_event(
const itti_sbi_notify_subscribed_event& i, const task_id_t orig,
const task_id_t dest)
: itti_sbi_msg(i, orig, dest),
notif_id(i.notif_id),
http_version(i.http_version) {}
const char* get_msg_name() { return "SBI_NOTIFY_SUBSCRIBED_EVENT"; };
std::string notif_id;
std::vector<amf_application::event_notification> event_notifs;
uint8_t http_version;
};
#endif /* ITTI_MSG_SBI_HPP_INCLUDED_ */
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