Commit 97450c68 authored by Tien Thinh NGUYEN's avatar Tien Thinh NGUYEN

Update condition to process AMF configuration update

parent 9a3d4c98
...@@ -88,7 +88,10 @@ amf_app::amf_app(const amf_config& amf_cfg) ...@@ -88,7 +88,10 @@ amf_app::amf_app(const amf_config& amf_cfg)
throw; throw;
} }
// Generate an AMF profile (including NF instance) // Generate NF Instance ID (UUID)
generate_uuid();
// Generate an AMF profile
generate_amf_profile(); generate_amf_profile();
// Register to NRF if needed // Register to NRF if needed
...@@ -756,6 +759,16 @@ void amf_app::handle_itti_message(itti_sbi_update_amf_configuration& itti_msg) { ...@@ -756,6 +759,16 @@ void amf_app::handle_itti_message(itti_sbi_update_amf_configuration& itti_msg) {
"AMF configuration:\n %s", response_data["content"].dump().c_str()); "AMF configuration:\n %s", response_data["content"].dump().c_str());
response_data["httpResponseCode"] = 200; // TODO: response_data["httpResponseCode"] = 200; // TODO:
// TODO: Send message to update AMF profile at NRF // TODO: Send message to update AMF profile at NRF
// Update AMF profile
generate_amf_profile();
// Update AMF profile at NRF
/* if (amf_cfg.support_features.enable_nf_registration and
amf_cfg.support_features.enable_external_nrf)
update_amf_profile();
*/
} else { } else {
response_data["httpResponseCode"] = 400; // TODO: response_data["httpResponseCode"] = 400; // TODO:
oai::amf::model::ProblemDetails problem_details = {}; oai::amf::model::ProblemDetails problem_details = {};
...@@ -778,9 +791,9 @@ bool amf_app::read_amf_configuration(nlohmann::json& json_data) { ...@@ -778,9 +791,9 @@ bool amf_app::read_amf_configuration(nlohmann::json& json_data) {
//--------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------
bool amf_app::update_amf_configuration(nlohmann::json& json_data) { bool amf_app::update_amf_configuration(nlohmann::json& json_data) {
if (get_number_registered_ues() > 0) { if (stacs.get_number_connected_gnbs() > 0) {
Logger::amf_app().info( Logger::amf_app().info(
"AMF is actively handling UEs, could not update AMF configuration"); "Could not update AMF configuration (connected with gNBs)");
return false; return false;
} }
return amf_cfg.from_json(json_data); return amf_cfg.from_json(json_data);
...@@ -998,8 +1011,6 @@ void amf_app::get_ee_subscriptions( ...@@ -998,8 +1011,6 @@ void amf_app::get_ee_subscriptions(
//--------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------
void amf_app::generate_amf_profile() { void amf_app::generate_amf_profile() {
// generate UUID
generate_uuid();
nf_instance_profile.set_nf_instance_id(amf_instance_id); nf_instance_profile.set_nf_instance_id(amf_instance_id);
nf_instance_profile.set_nf_instance_name(amf_cfg.amf_name); nf_instance_profile.set_nf_instance_name(amf_cfg.amf_name);
nf_instance_profile.set_nf_type("AMF"); nf_instance_profile.set_nf_type("AMF");
...@@ -1014,7 +1025,7 @@ void amf_app::generate_amf_profile() { ...@@ -1014,7 +1025,7 @@ void amf_app::generate_amf_profile() {
nf_service.service_instance_id = "namf_communication"; nf_service.service_instance_id = "namf_communication";
nf_service.service_name = "namf_communication"; nf_service.service_name = "namf_communication";
nf_service_version_t version = {}; nf_service_version_t version = {};
version.api_version_in_uri = "v1"; version.api_version_in_uri = amf_cfg.sbi_api_version;
version.api_full_version = "1.0.0"; // TODO: to be updated version.api_full_version = "1.0.0"; // TODO: to be updated
nf_service.versions.push_back(version); nf_service.versions.push_back(version);
nf_service.scheme = "http"; nf_service.scheme = "http";
......
...@@ -305,10 +305,10 @@ typedef struct { ...@@ -305,10 +305,10 @@ typedef struct {
nlohmann::json json_data = {}; nlohmann::json json_data = {};
json_data["prefered_integrity_algorithm"] = nlohmann::json::array(); json_data["prefered_integrity_algorithm"] = nlohmann::json::array();
json_data["prefered_ciphering_algorithm"] = nlohmann::json::array(); json_data["prefered_ciphering_algorithm"] = nlohmann::json::array();
for (auto s : prefered_integrity_algorithm) { for (auto s : this->prefered_integrity_algorithm) {
json_data["prefered_integrity_algorithm"].push_back(s); json_data["prefered_integrity_algorithm"].push_back(s);
} }
for (auto s : prefered_ciphering_algorithm) { for (auto s : this->prefered_ciphering_algorithm) {
json_data["prefered_ciphering_algorithm"].push_back(s); json_data["prefered_ciphering_algorithm"].push_back(s);
} }
return json_data; return json_data;
......
...@@ -163,3 +163,9 @@ void statistics::update_gnb(const uint32_t& gnb_id, const gnb_infos& gnb) { ...@@ -163,3 +163,9 @@ void statistics::update_gnb(const uint32_t& gnb_id, const gnb_infos& gnb) {
gnbs[gnb_id] = gnb; gnbs[gnb_id] = gnb;
} }
} }
//------------------------------------------------------------------------------
uint32_t statistics::get_number_connected_gnbs() const {
std::shared_lock lock(m_gnbs);
return gnbs.size();
}
...@@ -124,6 +124,13 @@ class statistics { ...@@ -124,6 +124,13 @@ class statistics {
*/ */
void update_gnb(const uint32_t& gnb_id, const gnb_infos& gnb); void update_gnb(const uint32_t& gnb_id, const gnb_infos& gnb);
/*
* Get number of connected gNBs
* @param void
* @return number of connected gNBs
*/
uint32_t get_number_connected_gnbs() const;
public: public:
uint32_t gNB_connected; uint32_t gNB_connected;
uint32_t UE_connected; uint32_t UE_connected;
......
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