Commit 9a3d4c98 authored by Tien Thinh NGUYEN's avatar Tien Thinh NGUYEN

Add condition to Update AMF conf

parent ff92e538
......@@ -778,9 +778,26 @@ bool amf_app::read_amf_configuration(nlohmann::json& json_data) {
//---------------------------------------------------------------------------------------------
bool amf_app::update_amf_configuration(nlohmann::json& json_data) {
if (get_number_registered_ues() > 0) {
Logger::amf_app().info(
"AMF is actively handling UEs, could not update AMF configuration");
return false;
}
return amf_cfg.from_json(json_data);
}
//---------------------------------------------------------------------------------------------
void amf_app::get_number_registered_ues(uint32_t& num_ues) const {
std::shared_lock lock(m_amf_ue_ngap_id2ue_ctx);
num_ues = amf_ue_ngap_id2ue_ctx.size();
return;
}
//---------------------------------------------------------------------------------------------
uint32_t amf_app::get_number_registered_ues() const {
std::shared_lock lock(m_amf_ue_ngap_id2ue_ctx);
return amf_ue_ngap_id2ue_ctx.size();
}
//---------------------------------------------------------------------------------------------
void amf_app::add_n1n2_message_subscription(
const std::string& ue_ctx_id, const n1n2sub_id_t& sub_id,
......
......@@ -166,9 +166,34 @@ class amf_app {
*/
void handle_itti_message(itti_sbi_update_amf_configuration& itti_msg);
/*
* Get the current AMF's configuration
* @param [nlohmann::json&]: json_data: Store AMF configuration
* @return true if success, otherwise return false
*/
bool read_amf_configuration(nlohmann::json& json_data);
/*
* Update AMF configuration
* @param [nlohmann::json&]: json_data: New AMF configuration
* @return true if success, otherwise return false
*/
bool update_amf_configuration(nlohmann::json& json_data);
/*
* Get number of registered UEs to this AMF
* @param [uint32_t&]: num_ues: Store the number of registered UEs
* @return void
*/
void get_number_registered_ues(uint32_t& num_ues) const;
/*
* Get number of registered UEs to this AMF
* @param void
* @return: number of registered UEs
*/
uint32_t get_number_registered_ues() const;
/*
* Verify if a UE context associated with an AMF UE NGAP ID exist
* @param [const long&] amf_ue_ngap_id: AMF UE NGAP ID
......
......@@ -1017,6 +1017,7 @@ void amf_config::to_json(nlohmann::json& json_data) const {
}
}
//------------------------------------------------------------------------------
bool amf_config::from_json(nlohmann::json& json_data) {
try {
if (json_data.find("instance") != json_data.end()) {
......
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