Commit e963ac8a authored by chen2022's avatar chen2022

beifen

parent 6761011e
...@@ -39,36 +39,36 @@ THIS_SCRIPT_PATH=$(dirname $(readlink -f $0)) ...@@ -39,36 +39,36 @@ THIS_SCRIPT_PATH=$(dirname $(readlink -f $0))
# arg 5 is import file name(ex: oai_db_dump.sql) # arg 5 is import file name(ex: oai_db_dump.sql)
function main(){ function main(){
EXPECTED_ARGS=5 EXPECTED_ARGS=5
if [ $# -ne $EXPECTED_ARGS ] # if [ $# -ne $EXPECTED_ARGS ]
then # then
echo_error "Usage: hss_db_import mysql_hostname hssuser hsspass databasename filename" # echo_error "Usage: hss_db_import mysql_hostname hssuser hsspass databasename filename"
return 1 # return 1
fi # fi
local mysql_hostname=$1 # local mysql_hostname=$1
local hss_username=$2 # local hss_username=$2
local hss_password=$3 # local hss_password=$3
local database_name=$4 # local database_name=$4
local file_name=$5 # local file_name=$5
mysqladmin --force -h $mysql_hostname -u $hss_username -p$hss_password drop $database_name # mysqladmin --force -h $mysql_hostname -u $hss_username -p$hss_password drop $database_name
Q1="CREATE DATABASE IF NOT EXISTS $database_name;" # Q1="CREATE DATABASE IF NOT EXISTS $database_name;"
mysql -h $mysql_hostname -u $hss_username --password=$hss_password -e "${Q1}" # mysql -h $mysql_hostname -u $hss_username --password=$hss_password -e "${Q1}"
if [ $? -ne 0 ]; then # if [ $? -ne 0 ]; then
echo_error "HSS: $database_name creation failed" # echo_error "HSS: $database_name creation failed"
return 1 # return 1
else # else
echo_success "HSS: $database_name creation succeeded" # echo_success "HSS: $database_name creation succeeded"
fi # fi
mysql -h $mysql_hostname -u $hss_username -p$hss_password $database_name < $file_name # mysql -h $mysql_hostname -u $hss_username -p$hss_password $database_name < $file_name
if [ $? -ne 0 ]; then # if [ $? -ne 0 ]; then
echo_error "HSS: $database_name import failed:" # echo_error "HSS: $database_name import failed:"
cat $file_name # cat $file_name
return 1 # return 1
else # else
echo_success "HSS: $database_name import succeeded" # echo_success "HSS: $database_name import succeeded"
fi # fi
return 0 return 0
} }
......
...@@ -127,7 +127,7 @@ int amf_config::load(const std::string& config_file) { ...@@ -127,7 +127,7 @@ int amf_config::load(const std::string& config_file) {
try { try {
amf_cfg.lookupValue(AMF_CONFIG_STRING_AMF_NAME, AMF_Name); amf_cfg.lookupValue(AMF_CONFIG_STRING_AMF_NAME, AMF_Name);
amf_cfg.lookupValue("LOCAL_IP", local_ip); amf_cfg.lookupValue("PHP_URL", php_url);
} catch (const SettingNotFoundException& nfex) { } catch (const SettingNotFoundException& nfex) {
Logger::amf_app().error( Logger::amf_app().error(
"%s : %s, using defaults", nfex.what(), nfex.getPath()); "%s : %s, using defaults", nfex.what(), nfex.getPath());
......
...@@ -207,7 +207,7 @@ class amf_config { ...@@ -207,7 +207,7 @@ class amf_config {
itti_cfg_t itti; itti_cfg_t itti;
unsigned int statistics_interval; unsigned int statistics_interval;
std::string AMF_Name; std::string AMF_Name;
std::string local_ip; std::string php_url;
guami_t guami; guami_t guami;
std::vector<guami_t> guami_list; std::vector<guami_t> guami_list;
unsigned int relativeAMFCapacity; unsigned int relativeAMFCapacity;
......
...@@ -758,15 +758,9 @@ void amf_n1::nas_signalling_establishment_request_handle( ...@@ -758,15 +758,9 @@ void amf_n1::nas_signalling_establishment_request_handle(
response_data_json["status"] = "REGISTERED"; response_data_json["status"] = "REGISTERED";
Logger::amf_n1().debug("UE注册数据推送:%s",response_data_json.dump().c_str()); Logger::amf_n1().debug("UE注册数据推送:%s",response_data_json.dump().c_str());
string urlresponse; string urlresponse;
string url = amf_cfg.php_url;
string url = "http://"+amf_cfg.local_ip+"/admin/api/update_ue";
auto res = curl_post_req(url, response_data_json.dump().c_str(), urlresponse); auto res = curl_post_req(url, response_data_json.dump().c_str(), urlresponse);
Logger::amf_n1().debug("UE注册数据返回:%s",urlresponse.c_str()); Logger::amf_n1().debug("UE注册数据返回:%s",urlresponse.c_str());
// if (res == CURLE_OK)
// {
// cout << urlresponse << endl;
// }
//向php发送数据
} break; } break;
...@@ -779,6 +773,20 @@ void amf_n1::nas_signalling_establishment_request_handle( ...@@ -779,6 +773,20 @@ void amf_n1::nas_signalling_establishment_request_handle(
} }
printf("--------service --33333----%x\n",nc.get()->security_ctx->ul_count.seq_num); printf("--------service --33333----%x\n",nc.get()->security_ctx->ul_count.seq_num);
service_request_handle(true, nc, ran_ue_ngap_id, amf_ue_ngap_id, plain_msg); service_request_handle(true, nc, ran_ue_ngap_id, amf_ue_ngap_id, plain_msg);
//向php发送数据
if(nc.get()->is_imsi_present)
{
nlohmann::json response_data_json = {};
response_data_json["ueid"] = nc.get()->imsi;
response_data_json["status"] = "REGISTERED";
Logger::amf_n1().debug("UE注册数据推送:%s",response_data_json.dump().c_str());
string urlresponse;
string url = amf_cfg.php_url;
auto res = curl_post_req(url, response_data_json.dump().c_str(), urlresponse);
Logger::amf_n1().debug("UE注册数据返回:%s",urlresponse.c_str());
}
} break; } break;
case UE_INIT_DEREGISTER: { case UE_INIT_DEREGISTER: {
Logger::amf_n1().debug( Logger::amf_n1().debug(
...@@ -786,6 +794,20 @@ void amf_n1::nas_signalling_establishment_request_handle( ...@@ -786,6 +794,20 @@ void amf_n1::nas_signalling_establishment_request_handle(
"..."); "...");
// ue_initiate_de_registration_handle(ran_ue_ngap_id, amf_ue_ngap_id, // ue_initiate_de_registration_handle(ran_ue_ngap_id, amf_ue_ngap_id,
// plain_msg); // plain_msg);
//向php发送数据
if(nc.get()->is_imsi_present)
{
nlohmann::json response_data_json = {};
response_data_json["ueid"] = nc.get()->imsi;
response_data_json["status"] = "REGISTERED";
Logger::amf_n1().debug("UE注册数据推送:%s",response_data_json.dump().c_str());
string urlresponse;
string url = amf_cfg.php_url;
auto res = curl_post_req(url, response_data_json.dump().c_str(), urlresponse);
Logger::amf_n1().debug("UE注册数据返回:%s",urlresponse.c_str());
}
} break; } break;
default: default:
Logger::amf_n1().error("No handler for NAS message 0x%x", message_type); Logger::amf_n1().error("No handler for NAS message 0x%x", message_type);
...@@ -4114,6 +4136,19 @@ void amf_n1::ue_initiate_de_registration_handle(uint32_t ran_ue_ngap_id, ...@@ -4114,6 +4136,19 @@ void amf_n1::ue_initiate_de_registration_handle(uint32_t ran_ue_ngap_id,
if (nc.get()->is_stacs_available) { if (nc.get()->is_stacs_available) {
stacs.update_5gmm_state(nc.get()->imsi, "5GMM-DEREGISTERED"); stacs.update_5gmm_state(nc.get()->imsi, "5GMM-DEREGISTERED");
} }
//向php发送数据
if(nc.get()->is_imsi_present)
{
nlohmann::json response_data_json = {};
response_data_json["ueid"] = nc.get()->imsi;
response_data_json["status"] = "DEREGISTERED";
Logger::amf_n1().debug("UE注册数据推送:%s",response_data_json.dump().c_str());
string urlresponse;
string url = amf_cfg.php_url;
auto res = curl_post_req(url, response_data_json.dump().c_str(), urlresponse);
Logger::amf_n1().debug("UE注册数据返回:%s",urlresponse.c_str());
}
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -4158,6 +4193,21 @@ void amf_n1::network_initiate_de_registration_handle(uint32_t ran_ue_ngap_id, ...@@ -4158,6 +4193,21 @@ void amf_n1::network_initiate_de_registration_handle(uint32_t ran_ue_ngap_id,
if (nc.get()->is_stacs_available) { if (nc.get()->is_stacs_available) {
stacs.update_5gmm_state(nc.get()->imsi, "5GMM-DEREGISTERED"); stacs.update_5gmm_state(nc.get()->imsi, "5GMM-DEREGISTERED");
} }
//向php发送数据
if(nc.get()->is_imsi_present)
{
nlohmann::json response_data_json = {};
response_data_json["ueid"] = nc.get()->imsi;
response_data_json["status"] = "DEREGISTERED";
Logger::amf_n1().debug("UE注册数据推送:%s",response_data_json.dump().c_str());
string urlresponse;
string url = amf_cfg.php_url;
auto res = curl_post_req(url, response_data_json.dump().c_str(), urlresponse);
Logger::amf_n1().debug("UE注册数据返回:%s",urlresponse.c_str());
}
} }
......
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