Commit d8a69dde authored by Niuhaiwen's avatar Niuhaiwen

stateless-authentication-procedure-ok

parent 5d65c90e
################################################################################
# Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The OpenAirInterface Software Alliance licenses this file to You under
# the OAI Public License, Version 1.1 (the "License"); you may not use this file
# except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.openairinterface.org/?page_id=698
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#-------------------------------------------------------------------------------
# For more information about the OpenAirInterface (OAI) Software Alliance:
# contact@openairinterface.org
################################################################################
AMF =
{
INSTANCE_ID = 10; # 0 is the default
PID_DIRECTORY = "/var/run"; # /var/run is the default
AMF_NAME = "OAI-AMF";
RELATIVE_CAPACITY = 30;
# Display statistics about whole system (in seconds)
STATISTICS_TIMER_INTERVAL = 20; # YOUR CONFIG HERE
CORE_CONFIGURATION:
{
EMERGENCY_SUPPORT = "false";
};
GUAMI:
{
MCC = "460"; MNC = "99"; RegionID = "128"; AMFSetID = "1"; AMFPointer = "1" # YOUR GUAMI CONFIG HERE
}
SERVED_GUAMI_LIST = (
{MCC = "460"; MNC = "99"; RegionID = "128"; AMFSetID = "1"; AMFPointer = "0"} #48bits <MCC><MNC><RegionID><AMFSetID><AMFPointer>
#{MCC = "110"; MNC = "11"; RegionID = "10"; AMFSetID = "1"; AMFPointer = "1"} #48bits <MCC><MNC><RegionID><AMFSetID><AMFPointer>
);
PLMN_SUPPORT_LIST = (
{
MCC = "460"; MNC = "99"; TAC = 100; # YOUR PLMN CONFIG HERE
SLICE_SUPPORT_LIST = (
{SST = "1"; SD = "none"} # YOUR NSSAI CONFIG HERE
# {SST = "1"; SD = "12"} # YOUR NSSAI CONFIG HERE
)
}
);
INTERFACES:
{
# AMF binded interface for N1/N2 interface (NGAP)
NGAP_AMF:
{
INTERFACE_NAME = "ens34"; # YOUR NETWORK CONFIG HERE
IPV4_ADDRESS = "read";
PORT = 9999; # YOUR NETWORK CONFIG HERE
PPID = 60; # YOUR NETWORK CONFIG HERE
};
# AMF binded interface for Nausf interface
NAUSF:
{
INTERFACE_NAME = "ens18"; # YOUR NETWORK CONFIG HERE
IPV4_ADDRESS = "read";
PORT = 8383; # YOUR NETWORK CONFIG HERE
};
NRF :
{
IPV4_ADDRESS = "10.103.239.54"; # YOUR NRF CONFIG HERE
PORT = 80; # YOUR NRF CONFIG HERE (default: 80)
API_VERSION = "v1"; # YOUR NRF API VERSION FOR SBI CONFIG HERE
};
SUPPORT_FEATURES:
{
# STRING, {"yes", "no"},
NF_REGISTRATION = "yes"; # Set to yes if AMF resgisters to an NRF
SMF_SELECTION = "yes"; # Set to yes to enable SMF discovery and selection
EXTERNAL_AUSF = "yes"; # Set to yes if AMF works with an external AUSF
EXTERNAL_UDM = "no"; # Set to yes if AMF works with an external UDM
};
# AMF binded interface for N11
N11:
{
INTERFACE_NAME = "ens19"; # YOUR NETWORK CONFIG HERE
IPV4_ADDRESS = "read";
PORT = 8283; # YOUR NETWORK CONFIG HERE
SMF_INSTANCES_POOL = (
{SMF_INSTANCE_ID = 1; IPV4_ADDRESS = "10.103.239.53"; PORT = "8889"; VERSION = "v2"; SELECTED = "false"}, # YOUR SMF CONFIG HERE
{SMF_INSTANCE_ID = 2; IPV4_ADDRESS = "192.168.122.2"; PORT = "80"; VERSION = "v1"; SELECTED = "false"} # YOUR SMF CONFIG HERE
);
};
};
AUTHENTICATION:
{
## MySQL mandatory options
MYSQL_server = "127.0.0.1"; # MySQL Server address
MYSQL_user = "witcomm"; # Database server login
MYSQL_pass = "123456"; # Database server password
MYSQL_db = "witcomm"; # Your database name
## OP
OPERATOR_key = "63bfa50ee6523365ff14c1f45f88737d"; # OP key matching your database
RANDOM = "true";
};
NAS:
{
ORDERED_SUPPORTED_INTEGRITY_ALGORITHM_LIST = [ "NIA1" , "NIA1" , "NIA1" ];
ORDERED_SUPPORTED_CIPHERING_ALGORITHM_LIST = [ "NEA0" , "NEA1" , "NEA2" ];
};
};
MODULES =
{
NGAP_MESSAGE = (
{MSG_NAME = "NGSetupRequest"; ProcedureCode = 21; TypeOfMessage = "initialMessage"}
);
};
......@@ -339,36 +339,8 @@ void amf_app::handle_itti_message(
uc.get()->isUeContextRequest = true;
uc.get()->ran_ue_ngap_id = itti_msg.ran_ue_ngap_id;
uc.get()->amf_ue_ngap_id = amf_ue_ngap_id;
// send to TASK_AMF_N1
std::string guti;
bool is_guti_valid = false;
if (itti_msg.is_5g_s_tmsi_present) {
guti = itti_msg.tai.mcc + itti_msg.tai.mnc + amf_cfg.guami.regionID +
itti_msg._5g_s_tmsi;
is_guti_valid = true;
Logger::amf_app().debug("Receiving GUTI %s", guti.c_str());
}
itti_uplink_nas_data_ind* itti_n1_msg =
new itti_uplink_nas_data_ind(TASK_AMF_APP, TASK_AMF_N1);
itti_n1_msg->amf_ue_ngap_id = amf_ue_ngap_id;
itti_n1_msg->ran_ue_ngap_id = itti_msg.ran_ue_ngap_id;
itti_n1_msg->is_nas_signalling_estab_req = true;
itti_n1_msg->nas_msg = itti_msg.nas_buf;
itti_n1_msg->mcc = itti_msg.tai.mcc;
itti_n1_msg->mnc = itti_msg.tai.mnc;
itti_n1_msg->is_guti_valid = is_guti_valid;
if (is_guti_valid) {
itti_n1_msg->guti = guti;
}
std::shared_ptr<itti_uplink_nas_data_ind> i =
std::shared_ptr<itti_uplink_nas_data_ind>(itti_n1_msg);
int ret = itti_inst->send_msg(i);
if (0 != ret) {
Logger::amf_app().error(
"Could not send ITTI message %s to task TASK_AMF_N1",
i->get_msg_name());
}
//Update ue_context to UDSF
Logger::amf_app().debug("Update ue_context to UDSF");
record_id = "amf_ue_ngap_id=\'" + to_string(amf_ue_ngap_id) + "\'";
udsf_url = "http://10.103.239.53:7123/nudsf-dr/v1/amfdata/" + std::string("ue_context/records/") + record_id ;
nlohmann::json udsf_ue_context;
......@@ -397,8 +369,37 @@ void amf_app::handle_itti_message(
udsf_ue_context["blocks"].push_back(cgi);
udsf_ue_context["blocks"].push_back(tai);
std::string json_part = udsf_ue_context.dump();
//nlohmann::json udsf_response;
amf_n2_inst->curl_http_client_udsf(udsf_url,json_part,"PUT",udsf_response);
Logger::amf_app().debug("Update ue_context to UDSF finished");
// send to TASK_AMF_N1
std::string guti;
bool is_guti_valid = false;
if (itti_msg.is_5g_s_tmsi_present) {
guti = itti_msg.tai.mcc + itti_msg.tai.mnc + amf_cfg.guami.regionID +
itti_msg._5g_s_tmsi;
is_guti_valid = true;
Logger::amf_app().debug("Receiving GUTI %s", guti.c_str());
}
itti_uplink_nas_data_ind* itti_n1_msg =
new itti_uplink_nas_data_ind(TASK_AMF_APP, TASK_AMF_N1);
itti_n1_msg->amf_ue_ngap_id = amf_ue_ngap_id;
itti_n1_msg->ran_ue_ngap_id = itti_msg.ran_ue_ngap_id;
itti_n1_msg->is_nas_signalling_estab_req = true;
itti_n1_msg->nas_msg = itti_msg.nas_buf;
itti_n1_msg->mcc = itti_msg.tai.mcc;
itti_n1_msg->mnc = itti_msg.tai.mnc;
itti_n1_msg->is_guti_valid = is_guti_valid;
if (is_guti_valid) {
itti_n1_msg->guti = guti;
}
std::shared_ptr<itti_uplink_nas_data_ind> i =
std::shared_ptr<itti_uplink_nas_data_ind>(itti_n1_msg);
int ret = itti_inst->send_msg(i);
if (0 != ret) {
Logger::amf_app().error(
"Could not send ITTI message %s to task TASK_AMF_N1",
i->get_msg_name());
}
#if 0
......
This diff is collapsed.
......@@ -95,7 +95,8 @@ class amf_n1 {
std::shared_ptr<nas_context> guti_2_nas_context_in_udsf(const std::string& guti) const;
bool is_amf_ue_id_2_nas_context_in_udsf(const long& amf_ue_ngap_id) const;
std::shared_ptr<nas_context> amf_ue_id_2_nas_context_in_udsf(const long& amf_ue_ngap_id) const;
void amf_ue_id_2_nas_context_in_udsf(const long& amf_ue_ngap_id, std::shared_ptr<nas_context> &) const;
//std::shared_ptr<nas_context> amf_ue_id_2_nas_context_in_udsf(const long& amf_ue_ngap_id) const;
mutable std::shared_mutex m_amfueid2nas_context;
bool is_amf_ue_id_2_nas_context(const long& amf_ue_ngap_id) const;
......@@ -125,6 +126,7 @@ class amf_n1 {
bool _5g_aka_confirmation_from_ausf(
std::shared_ptr<nas_context>& nc, bstring resStar);
void http_update_nas_context_into_udsf(std::shared_ptr<nas_context> nc);
bool authentication_vectors_generator_in_ausf(
std::shared_ptr<nas_context>& nc);
bool authentication_vectors_generator_in_udm(
......
......@@ -647,6 +647,9 @@ void amf_n2::handle_itti_message(itti_initial_ue_message& init_ue_msg) {
Tai_t tai;
NrCgi_t cgi;
init_ue_msg.initUeMsg->getUserLocationInfoNR(cgi, tai);
itti_msg->cgi = cgi;
itti_msg->tai = tai;
Logger::amf_n2().debug("parse tai from INITIAL UE MESSAGE(mcc %s, mnc %s)", tai.mcc.c_str(), tai.mnc.c_str());
// parse rrc_establishment from INITIAL_UE_MESSAGE
Logger::amf_n2().debug("try to parse rrc_establiehment from INITIAL_UE_MESSAGE in amf_n2.cpp");
if (init_ue_msg.initUeMsg->getRRCEstablishmentCause() == -1) {
......
......@@ -47,6 +47,7 @@ nas_context::nas_context() {
is_common_procedure_for_identification_running = false;
is_common_procedure_for_security_mode_control_running = false;
is_common_procedure_for_nas_transport_running = false;
is_current_security_available = false;
auts = NULL;
ueSecurityCaplen = 2;
ueSecurityCapEEnc = 0;
......@@ -833,35 +834,59 @@ std::string nas_context::nas_context_guti_from_json(nlohmann::json j)
bool nas_context::nas_context_from_json(nlohmann::json j)
{
// ctx_avaliability_ind = nas_context_ctx_avaliability_ind_from_json(j);
// is_stacs_available = nas_context_is_stacs_available_from_json(j);
Logger::amf_n1().debug("------------------ 1");
ctx_avaliability_ind = nas_context_ctx_avaliability_ind_from_json(j);
Logger::amf_n1().debug("------------------ 2");
is_stacs_available = nas_context_is_stacs_available_from_json(j);
Logger::amf_n1().debug("------------------ 3");
amf_ue_ngap_id = nas_context_amf_ue_ngap_id_from_json(j);
Logger::amf_n1().debug("------------------ 4");
ran_ue_ngap_id = nas_context_ran_ue_ngap_id_from_json(j);
// nas_status = nas_context_nas_status_from_json(j);
// _5gmm_state = nas_context__5gmm_state_from_json( j);
// registration_type = nas_context_registration_type_from_json(j);
// follow_on_req_pending_ind = nas_context_follow_on_req_pending_ind_from_json(j);
// ngKsi= nas_context_ngKsi_from_json(j);
imsi = nas_context_imsi_from_json(j);
// nas_context_requestedNssai_from_json( j);
//serving_network = nas_context_serving_network_from_json(j);
//nas_context_auts_from_json(j);
// is_specific_procedure_for_registration_running = nas_context_is_specific_procedure_for_registration_running_from_json(j);
// is_specific_procedure_for_deregistration_running = nas_context_is_specific_procedure_for_deregistration_running_from_json(j);
// is_specific_procedure_for_eCell_inactivity_running = nas_context_is_specific_procedure_for_eCell_inactivity_running_from_json(j);
// is_common_procedure_for_authentication_running = nas_context_is_common_procedure_for_authentication_running_from_json(j);
// is_common_procedure_for_identification_running = nas_context_is_common_procedure_for_identification_running_from_json(j);
// is_common_procedure_for_security_mode_control_running = nas_context_is_common_procedure_for_security_mode_control_running_from_json(j);
// is_common_procedure_for_nas_transport_running = nas_context_is_common_procedure_for_nas_transport_running_from_json(j);
Logger::amf_n1().debug("------------------ 5");
nas_status = nas_context_nas_status_from_json(j);
Logger::amf_n1().debug("------------------ 6");
//_5gmm_state = nas_context__5gmm_state_from_json( j);
Logger::amf_n1().debug("------------------ 7");
//registration_type = nas_context_registration_type_from_json(j);
Logger::amf_n1().debug("------------------ 8");
follow_on_req_pending_ind = nas_context_follow_on_req_pending_ind_from_json(j);
Logger::amf_n1().debug("------------------ 9");
ngKsi= nas_context_ngKsi_from_json(j);
Logger::amf_n1().debug("------------------ 10");
imsi = nas_context_imsi_from_json(j);
Logger::amf_n1().debug("------------------ 11");
//nas_context_requestedNssai_from_json( j);
Logger::amf_n1().debug("------------------ 12");
serving_network = nas_context_serving_network_from_json(j);
Logger::amf_n1().debug("------------------ 13");
nas_context_auts_from_json(j);
Logger::amf_n1().debug("------------------ 14");
is_specific_procedure_for_registration_running = nas_context_is_specific_procedure_for_registration_running_from_json(j);
Logger::amf_n1().debug("------------------ 15");
is_specific_procedure_for_deregistration_running = nas_context_is_specific_procedure_for_deregistration_running_from_json(j);
Logger::amf_n1().debug("------------------ 16");
is_specific_procedure_for_eCell_inactivity_running = nas_context_is_specific_procedure_for_eCell_inactivity_running_from_json(j);
Logger::amf_n1().debug("------------------ 17");
is_common_procedure_for_authentication_running = nas_context_is_common_procedure_for_authentication_running_from_json(j);
Logger::amf_n1().debug("------------------ 18");
is_common_procedure_for_identification_running = nas_context_is_common_procedure_for_identification_running_from_json(j);
Logger::amf_n1().debug("------------------ 19");
is_common_procedure_for_security_mode_control_running = nas_context_is_common_procedure_for_security_mode_control_running_from_json(j);
Logger::amf_n1().debug("------------------ 20");
is_common_procedure_for_nas_transport_running = nas_context_is_common_procedure_for_nas_transport_running_from_json(j);
Logger::amf_n1().debug("------------------ 21");
//Href = nas_context_Href_from_json(j);
//kamf = nas_context_kamf_from_json(j);
//is_current_security_available = nas_context_is_current_security_available_from_json(j);
Href = nas_context_Href_from_json(j);
Logger::amf_n1().debug("------------------ 22");
//kamf = nas_context_kamf_from_json(j);
Logger::amf_n1().debug("------------------ 23");
is_current_security_available = nas_context_is_current_security_available_from_json(j);
Logger::amf_n1().debug("------------------ 24");
nas_context_security_ctx_from_json(j);
nas_context_kamf_from_json(j);
// nas_context_security_ctx_from_json(j);
// nas_context_kamf_from_json(j);
return true;
}
\ No newline at end of file
}
......@@ -7,15 +7,15 @@ file_name="/home/xgcore/Haiwen/amf/stateless/stateless_amf.log" # 日志
date >> /home/xgcore/Haiwen/amf/stateless/run_status.log
echo "the shell is running" >> /home/xgcore/Haiwen/amf/stateless/run_status.log
while :
do
stillRunning=$(ps -ef |grep $proc_name |grep -v "grep")
if [ -z "$stillRunning" ]
then
#while :
#do
#stillRunning=$(ps -ef |grep $proc_name |grep -v "grep")
#if [ -z "$stillRunning" ]
#then
date >> /home/xgcore/Haiwen/amf/stateless/run_status.log
echo "the amf was closed!!!!!!!!!!!!!!!!!" >> /home/xgcore/Haiwen/amf/stateless/run_status.log
/home/xgcore/Haiwen/amf/build/amf/build/amf -c /home/xgcore/Haiwen/amf/etc/register+stateless.conf -o | tee /home/xgcore/Haiwen/amf/stateless/stateless_amf.log
date >> /home/xgcore/Haiwen/amf/stateless/run_status.log
echo "the amf was started!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" >> /home/xgcore/Haiwen/amf/stateless/run_status.log
fi
done
#fi
#done
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