Commit b2a7610d authored by Niuhaiwen's avatar Niuhaiwen

add amf_id_region

parent 823e1158
......@@ -173,10 +173,13 @@ void amf_app_task(void*) {
//------------------------------------------------------------------------------
long amf_app::generate_amf_ue_ngap_id() {
long tmp = 0;
//tmp = __sync_fetch_and_add(&amf_app_ue_ngap_id_generator, 1);
//time_t now_time = time(NULL);
//tm* t_tm = localtime(&now_time);
//long current = t_tm->tm_mday*24*60*60 + t_tm->tm_hour*60*60 + t_tm->tm_min*60 + t_tm->tm_sec;
//long tmp = (rand()+current)%100000 + 1;
long tmp = __sync_fetch_and_add(&amf_cfg.amf_id_region, 1);
//srand(time(NULL));
tmp = rand()%1000 + 1;
//tmp = rand()%1000 + 1;
//return tmp & 0xffffffffff;
return tmp;
}
......@@ -309,6 +312,7 @@ void amf_app::handle_itti_message(
long amf_ue_ngap_id = 0;
if ((amf_ue_ngap_id = itti_msg.amf_ue_ngap_id) == -1) {
amf_ue_ngap_id = generate_amf_ue_ngap_id();
Logger::amf_app().debug("Generated amf_ue_ngap_id(%d) for UE (ran_ue_ngap_id = %d)", amf_ue_ngap_id, itti_msg.ran_ue_ngap_id);
}else{
amf_ue_ngap_id = itti_msg.amf_ue_ngap_id;
}
......
......@@ -109,6 +109,13 @@ int amf_config::load(const std::string& config_file) {
Logger::amf_app().error(
"%s : %s, using defaults", nfex.what(), nfex.getPath());
}
try {
amf_cfg.lookupValue(
"AMF_ID_REGION", amf_id_region);
} catch (const SettingNotFoundException& nfex) {
Logger::amf_app().error(
"%s : %s, using defaults", nfex.what(), nfex.getPath());
}
try {
amf_cfg.lookupValue(AMF_CONFIG_STRING_PID_DIRECTORY, pid_dir);
} catch (const SettingNotFoundException& nfex) {
......
......@@ -181,6 +181,7 @@ class amf_config {
util::thread_sched_params& cfg);
void display();
unsigned int instance;
int amf_id_region;
std::string pid_dir;
interface_cfg_t n2;
interface_cfg_t n11;
......
......@@ -1241,6 +1241,7 @@ void amf_n1::registration_request_handle(bool isNasSig,
}
nc.get()->is_imsi_present = true;
nc.get()->imsi = imsi.mcc + imsi.mnc + imsi.msin;
Logger::amf_n1().debug("Receiving Registration Request message from UE (imsi-%s)",nc.get()->imsi.c_str());
Logger::amf_n1().debug("Received IMSI %s", nc.get()->imsi.c_str());
supi2amfId[("imsi-" + nc.get()->imsi)] = amf_ue_ngap_id;
supi2ranId[("imsi-" + nc.get()->imsi)] = ran_ue_ngap_id;
......@@ -1892,7 +1893,7 @@ void amf_n1::response_registration_reject_msg(uint8_t cause_value,
//------------------------------------------------------------------------------
// specific procedures running logic
void amf_n1::run_registration_procedure(std::shared_ptr<nas_context> &nc) {
Logger::amf_n1().debug("Start to run registration procedure");
Logger::amf_n1().debug("Start to run registration procedure with UE (%s)", nc.get()->imsi.c_str());
#if 0
nlohmann::json udsf_nas_context;
nlohmann::json udsf_response;
......@@ -2023,7 +2024,7 @@ bool amf_n1::auth_vectors_generator(std::shared_ptr<nas_context> &nc) {
return true;
}
//------------------------------------------------------------------------------
#define CURL_TIMEOUT_MS 300L
#define CURL_TIMEOUT_MS 3000L
std::size_t callback_ausf(const char *in, std::size_t size, std::size_t num,
std::string *out) {
......@@ -2767,6 +2768,7 @@ bool amf_n1::start_authentication_procedure(std::shared_ptr<nas_context> nc,
is_common_procedure_for_authentication_running["content"] = to_string(nc.get()->is_common_procedure_for_authentication_running);
udsf_nas_context["blocks"].push_back(is_common_procedure_for_authentication_running);
#endif
Logger::amf_n1().debug("Sending Authentication Request to UE (%s)",nc.get()->imsi.c_str());
AuthenticationRequest *authReq = new AuthenticationRequest();
authReq->setHeader(PLAIN_5GS_MSG);
authReq->setngKSI(NAS_KEY_SET_IDENTIFIER_NATIVE, ngksi);
......
......@@ -617,7 +617,7 @@ void amf_n2::handle_itti_message(itti_initial_ue_message& init_ue_msg) {
} else if (gc.get()->ng_state != NGAP_READY) {
Logger::amf_n2().debug(
"gNB with assoc_id (%d) is illegal", init_ue_msg.assoc_id);
return;
//return;
}
......
......@@ -81,7 +81,7 @@ enum class http_response_codes_e {
};
// for CURL
#define SMF_CURL_TIMEOUT_MS 100L
#define SMF_CURL_TIMEOUT_MS 50000L
#define SMF_NUMBER_RETRIES 3
constexpr auto CURL_MIME_BOUNDARY = "----Boundary";
#define NRF_CURL_TIMEOUT_MS 100L
......
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