Commit c8356911 authored by Tien Thinh NGUYEN's avatar Tien Thinh NGUYEN

First version for Update AMF conf API

parent 50653056
...@@ -749,7 +749,8 @@ void amf_app::handle_itti_message(itti_sbi_update_amf_configuration& itti_msg) { ...@@ -749,7 +749,8 @@ void amf_app::handle_itti_message(itti_sbi_update_amf_configuration& itti_msg) {
// Process the request and trigger the response from AMF API Server // Process the request and trigger the response from AMF API Server
nlohmann::json response_data = {}; nlohmann::json response_data = {};
response_data["content"] = {}; response_data["content"] = itti_msg.configuration;
if (update_amf_configuration(response_data["content"])) { if (update_amf_configuration(response_data["content"])) {
Logger::amf_app().debug( Logger::amf_app().debug(
"AMF configuration:\n %s", response_data["content"].dump().c_str()); "AMF configuration:\n %s", response_data["content"].dump().c_str());
......
This diff is collapsed.
...@@ -288,7 +288,6 @@ typedef struct plmn_support_item_s { ...@@ -288,7 +288,6 @@ typedef struct plmn_support_item_s {
this->mnc = json_data["mnc"].get<std::string>(); this->mnc = json_data["mnc"].get<std::string>();
this->tac = json_data["tac"].get<int>(); this->tac = json_data["tac"].get<int>();
json_data["slice_list"] = nlohmann::json::array();
for (auto s : json_data["slice_list"]) { for (auto s : json_data["slice_list"]) {
slice_t sl = {}; slice_t sl = {};
sl.from_json(s); sl.from_json(s);
...@@ -314,6 +313,21 @@ typedef struct { ...@@ -314,6 +313,21 @@ typedef struct {
} }
return json_data; return json_data;
} }
/*
void from_json(nlohmann::json& json_data) {
uint8_t i = 0;
for (auto s : json_data["prefered_integrity_algorithm"]) {
uint8_t integ_alg = s.get<int>();
prefered_integrity_algorithm[i] = integ_alg;
++i;
}
i = 0;
for (auto s : json_data["prefered_ciphering_algorithm"]) {
uint8_t cipher_alg = s.get<int>();
prefered_ciphering_algorithm[i] = cipher_alg;
++i;
}
}*/
} nas_conf_t; } nas_conf_t;
typedef struct { typedef struct {
...@@ -354,12 +368,14 @@ typedef struct nf_addr_s { ...@@ -354,12 +368,14 @@ typedef struct nf_addr_s {
struct in_addr ipv4_addr; struct in_addr ipv4_addr;
unsigned int port; unsigned int port;
std::string api_version; std::string api_version;
std::string fqdn;
nlohmann::json to_json() const { nlohmann::json to_json() const {
nlohmann::json json_data = {}; nlohmann::json json_data = {};
json_data["ipv4_addr"] = inet_ntoa(this->ipv4_addr); json_data["ipv4_addr"] = inet_ntoa(this->ipv4_addr);
json_data["port"] = this->port; json_data["port"] = this->port;
json_data["api_version"] = this->api_version; json_data["api_version"] = this->api_version;
json_data["fqdn"] = this->fqdn;
return json_data; return json_data;
} }
...@@ -370,6 +386,7 @@ typedef struct nf_addr_s { ...@@ -370,6 +386,7 @@ typedef struct nf_addr_s {
"BAD IPv4 ADDRESS FORMAT FOR INTERFACE !"); "BAD IPv4 ADDRESS FORMAT FOR INTERFACE !");
this->port = json_data["port"].get<int>(); this->port = json_data["port"].get<int>();
this->api_version = json_data["api_version"].get<std::string>(); this->api_version = json_data["api_version"].get<std::string>();
this->fqdn = json_data["fqdn"].get<std::string>();
} }
} nf_addr_t; } nf_addr_t;
...@@ -394,6 +411,8 @@ class amf_config { ...@@ -394,6 +411,8 @@ class amf_config {
*/ */
int load_interface(const Setting& if_cfg, interface_cfg_t& cfg); int load_interface(const Setting& if_cfg, interface_cfg_t& cfg);
bool resolve_fqdn(const std::string& fqdn, struct in_addr& ipv4_addr);
/* /*
* Get the URI of AMF N1N2MessageSubscribe * Get the URI of AMF N1N2MessageSubscribe
* @param [const std::string&] ue_cxt_id: UE Context Id * @param [const std::string&] ue_cxt_id: UE Context Id
...@@ -467,10 +486,10 @@ class amf_config { ...@@ -467,10 +486,10 @@ class amf_config {
unsigned int sbi_http2_port; unsigned int sbi_http2_port;
unsigned int statistics_interval; unsigned int statistics_interval;
std::string AMF_Name; std::string amf_name;
guami_t guami; guami_t guami;
std::vector<guami_t> guami_list; std::vector<guami_t> guami_list;
unsigned int relativeAMFCapacity; unsigned int relative_amf_capacity;
std::vector<plmn_item_t> plmn_list; std::vector<plmn_item_t> plmn_list;
std::string is_emergency_support; std::string is_emergency_support;
auth_conf auth_para; auth_conf auth_para;
......
...@@ -420,7 +420,7 @@ void amf_n2::handle_itti_message(itti_ng_setup_request& itti_msg) { ...@@ -420,7 +420,7 @@ void amf_n2::handle_itti_message(itti_ng_setup_request& itti_msg) {
// file and send_msg // file and send_msg
uint8_t* buffer = (uint8_t*) calloc(1, BUFFER_SIZE_1024); uint8_t* buffer = (uint8_t*) calloc(1, BUFFER_SIZE_1024);
NGSetupResponseMsg ngSetupResp; NGSetupResponseMsg ngSetupResp;
ngSetupResp.setAMFName(amf_cfg.AMF_Name); ngSetupResp.setAMFName(amf_cfg.amf_name);
std::vector<struct GuamiItem_s> guami_list; std::vector<struct GuamiItem_s> guami_list;
for (int i = 0; i < amf_cfg.guami_list.size(); i++) { for (int i = 0; i < amf_cfg.guami_list.size(); i++) {
struct GuamiItem_s tmp; struct GuamiItem_s tmp;
...@@ -433,7 +433,7 @@ void amf_n2::handle_itti_message(itti_ng_setup_request& itti_msg) { ...@@ -433,7 +433,7 @@ void amf_n2::handle_itti_message(itti_ng_setup_request& itti_msg) {
} }
ngSetupResp.setGUAMIList(guami_list); ngSetupResp.setGUAMIList(guami_list);
ngSetupResp.setRelativeAmfCapacity(amf_cfg.relativeAMFCapacity); ngSetupResp.setRelativeAmfCapacity(amf_cfg.relative_amf_capacity);
std::vector<PlmnSliceSupport_t> plmn_list; std::vector<PlmnSliceSupport_t> plmn_list;
for (int i = 0; i < amf_cfg.plmn_list.size(); i++) { for (int i = 0; i < amf_cfg.plmn_list.size(); i++) {
PlmnSliceSupport_t tmp; PlmnSliceSupport_t tmp;
......
...@@ -29,6 +29,9 @@ ...@@ -29,6 +29,9 @@
#ifndef _3GPP_TS_24501_H_ #ifndef _3GPP_TS_24501_H_
#define _3GPP_TS_24501_H_ #define _3GPP_TS_24501_H_
#include <string>
#include <vector>
/********** epd type **************/ /********** epd type **************/
#define EPD_5GS_MM_MSG 0b01111110 #define EPD_5GS_MM_MSG 0b01111110
...@@ -129,6 +132,10 @@ ...@@ -129,6 +132,10 @@
#define EA1_128_5G 0b001 #define EA1_128_5G 0b001
#define EA2_128_5G 0b010 #define EA2_128_5G 0b010
static const std::vector<std::string> nas_itegrity_algorithm_list_e2str = {
"NIA0", "NIA1", "NIA2"};
static const std::vector<std::string> nas_ciphering_algorithm_list_e2str = {
"NEA0", "NEA1", "NEA2"};
/************************** cause value for 5g mobility management(Annex A) /************************** cause value for 5g mobility management(Annex A)
* ********************************/ * ********************************/
#define _5GMM_CAUSE_ILLEGAL_UE 3 #define _5GMM_CAUSE_ILLEGAL_UE 3
......
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