Commit 99a1fc56 authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

First version for Mobility Registration Update

parent 632c3bb9
......@@ -58,7 +58,6 @@ extern amf_config amf_cfg;
extern statistics stacs;
void amf_app_task(void*);
uint32_t golbal_tmsi = 1;
//------------------------------------------------------------------------------
amf_app::amf_app(const amf_config& amf_cfg)
......@@ -394,6 +393,11 @@ void amf_app::handle_post_sm_context_response_error_400() {
Logger::amf_app().error("Post SM context response error 400");
}
//------------------------------------------------------------------------------
uint32_t amf_app::generate_tmsi() {
return tmsi_generator.get_uid();
}
//------------------------------------------------------------------------------
bool amf_app::generate_5g_guti(
uint32_t ranid, long amfid, string& mcc, string& mnc, uint32_t& tmsi) {
......@@ -404,12 +408,12 @@ bool amf_app::generate_5g_guti(
"No UE context for ran_amf_id %s, exit", ue_context_key.c_str());
return false;
}
std::shared_ptr<ue_context> uc;
uc = ran_amf_id_2_ue_context(ue_context_key);
mcc = uc.get()->tai.mcc;
mnc = uc.get()->tai.mnc;
tmsi = golbal_tmsi;
golbal_tmsi++;
std::shared_ptr<ue_context> uc = {};
uc = ran_amf_id_2_ue_context(ue_context_key);
mcc = uc.get()->tai.mcc;
mnc = uc.get()->tai.mnc;
tmsi = generate_tmsi();
uc.get()->tmsi = tmsi;
return true;
}
......
......@@ -70,6 +70,8 @@ class amf_app {
mutable std::shared_mutex m_amf_event_subscriptions;
util::uint_generator<uint32_t> tmsi_generator;
public:
explicit amf_app(const amf_config& amf_cfg);
amf_app(amf_app const&) = delete;
......@@ -107,6 +109,7 @@ class amf_app {
// SMF Client response handlers
void handle_post_sm_context_response_error_400();
// others
uint32_t generate_tmsi();
bool generate_5g_guti(
uint32_t ranid, long amfid, std::string& mcc, std::string& mnc,
uint32_t& tmsi);
......
This diff is collapsed.
......@@ -45,6 +45,7 @@
#include "nas_context.hpp"
#include "pdu_session_context.hpp"
#include "amf_event.hpp"
#include "RegistrationAccept.hpp"
namespace amf_application {
......@@ -102,7 +103,6 @@ class amf_n1 {
// procedures
// specific procedures running logic
void run_registration_procedure(std::shared_ptr<nas_context>& nc);
void run_initial_registration_procedure();
void run_mobility_registration_update_procedure(
std::shared_ptr<nas_context> nc, uint16_t uplink_data_status,
uint16_t pdu_session_status);
......@@ -164,6 +164,12 @@ class amf_n1 {
void handle_ue_reachability_status_change(
std::string supi, uint8_t http_version);
void get_pdu_session_to_be_activated(
uint16_t pdu_session_status,
std::vector<uint8_t>& pdu_session_to_be_activated);
void initialize_registration_accept(
std::shared_ptr<nas::RegistrationAccept>& registration_accept);
private:
void ue_initiate_de_registration_handle(
uint32_t ran_ue_ngap_id, long amf_ue_ngap_id, bstring nas);
......
......@@ -30,6 +30,7 @@ ue_context::ue_context() {
cgi = {};
tai = {};
pdu_sessions = {};
tmsi = 0;
}
//------------------------------------------------------------------------------
......
......@@ -68,6 +68,7 @@ class ue_context {
NrCgi_t cgi;
Tai_t tai;
std::string supi;
uint32_t tmsi;
// pdu session id <-> pdu_session_contex: map stores all pdu sessions for this
// UE
std::map<std::uint8_t, std::shared_ptr<pdu_session_context>> pdu_sessions;
......
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