Commit 5b21c545 authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen
Browse files

Send NF registration after initiating HTTP server

parent 787c2036
......@@ -150,6 +150,9 @@ int main(int argc, char** argv) {
smf_http1_manager.join();
smf_http2_manager.join();
// Register to NRF and discover appropriate UPFs
smf_app_inst->start_nf_registration_discovery();
FILE* fp = NULL;
std::string filename = fmt::format("/tmp/smf_{}.status", getpid());
fp = fopen(filename.c_str(), "w+");
......
......@@ -341,6 +341,19 @@ smf_app::smf_app(const std::string& config_file)
throw;
}
Logger::smf_app().startup("Started");
}
//------------------------------------------------------------------------------
smf_app::~smf_app() {
Logger::smf_app().debug("Delete SMF_APP instance...");
// TODO: Unregister NRF
if (smf_n4_inst) delete smf_n4_inst;
if (smf_sbi_inst) delete smf_sbi_inst;
}
//------------------------------------------------------------------------------
void smf_app::start_nf_registration_discovery() {
if (smf_cfg.discover_upf) {
// Trigger NFStatusNotify subscription to be noticed when a new UPF becomes
// available (if this option is enabled)
......@@ -360,17 +373,8 @@ smf_app::smf_app(const std::string& config_file)
usleep(microsecond);
register_to_nrf();
}
Logger::smf_app().startup("Started");
}
//------------------------------------------------------------------------------
smf_app::~smf_app() {
Logger::smf_app().debug("Delete SMF_APP instance...");
// TODO: Unregister NRF
if (smf_n4_inst) delete smf_n4_inst;
if (smf_sbi_inst) delete smf_sbi_inst;
}
//------------------------------------------------------------------------------
void smf_app::start_upf_association(const pfcp::node_id_t& node_id) {
std::time_t time_epoch = std::time(nullptr);
......
......@@ -665,6 +665,13 @@ class smf_app {
void start_upf_association(
const pfcp::node_id_t& node_id, const upf_profile& profile);
/*
* To start NF registration with NRF and subscribe to UPF event notification
* @param void
* @return void
*/
void start_nf_registration_discovery();
/*
* To store a promise of a PDU Session Create SM Contex Response to be
* triggered when the result is ready
......
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