Commit da971243 authored by liuyu's avatar liuyu

change for UERANSIM(UERANSIM service response is not enough, can't establish new n3 turnel)

parent 1d4bc491
......@@ -96,6 +96,11 @@ void amf_app::allRegistredModulesInit(const amf_modules& modules) {
void amf_app_task(void*) {
const task_id_t task_id = TASK_AMF_APP;
itti_inst->notify_task_ready(task_id);
// nlohmann::json udsf_response2;
// std::string record_id = "RECORD_ID=\'" + to_string(1221) + "\'";
// std::string udsf_url = "http://10.112.202.24:7123/nudsf-dr/v1/amfdata/"+ std::string("nas_context/records/") + record_id;
// while(1)
// {amf_n2_inst->curl_http_client_udsf(udsf_url,"","GET",udsf_response2);}
do {
std::shared_ptr<itti_msg> shared_msg = itti_inst->receive_msg(task_id);
auto* msg = shared_msg.get();
......@@ -424,7 +429,7 @@ bool amf_app::generate_5g_guti(
// }
// std::shared_ptr<ue_context> uc;
// uc = ran_amf_id_2_ue_context(ue_context_key);
ue_context *uc1 = new ue_context();
std::shared_ptr<ue_context> uc = std::shared_ptr<ue_context>(new ue_context());
nlohmann::json udsf_response;
std::string record_id = "RECORD_ID=\'" + ue_context_key + "\'";
std::string udsf_url = "http://10.112.202.24:7123/nudsf-dr/v1/amfdata/" + std::string("ue_context/records/") + record_id;
......@@ -433,9 +438,8 @@ bool amf_app::generate_5g_guti(
return false;
}
Logger::amf_n2().debug("udsf_response: %s", udsf_response.dump().c_str());
uc1->ue_context_from_json(udsf_response);
std::shared_ptr<ue_context> uc;
uc = std::shared_ptr<ue_context>(uc1);
uc.get()->ue_context_from_json(udsf_response);
mcc = uc.get()->tai.mcc;
......
......@@ -68,7 +68,8 @@
#include "ConfirmationDataResponse.h"
#include "UEAuthenticationCtx.h"
#include <curl/curl.h>
#include <nlohmann/json.hpp>
#include "Record.h"
extern "C" {
#include "bstrlib.h"
#include "dynamic_memory_check.h"
......@@ -122,7 +123,7 @@ void amf_n1_task(void *) {
default:
Logger::amf_n1().error("No handler for msg type %d", msg->msg_type);
}
} while (true);
}while (true);
}
//------------------------------------------------------------------------------
......
......@@ -273,9 +273,11 @@ void amf_n11::handle_itti_message(itti_smf_services_consumer& smf) {
Logger::amf_n2().error("No existing pdu_session_context with assoc_id ");
psc = std::shared_ptr<pdu_session_context>(new pdu_session_context());
}
if(udsf_response.dump().c_str() == nullptr)
else if(udsf_response.dump().length() < 8)
{
Logger::amf_n2().error("No existing pdu_session_context with assoc_id ");
Logger::amf_n2().error("No existing pdu_session_context with assoc_id----length = %d ",udsf_response.dump().length());
Logger::amf_n2().error("No existing pdu_session_context with assoc_id 2222");
psc = std::shared_ptr<pdu_session_context>(new pdu_session_context());
}
else{
Logger::amf_n2().debug("udsf_response: %s", udsf_response.dump().c_str());
......@@ -292,7 +294,7 @@ void amf_n11::handle_itti_message(itti_smf_services_consumer& smf) {
// set_supi_to_pdu_ctx(supi, psc);
// }
pduid2supi[smf.pdu_sess_id] = supi;
//pduid2supi[smf.pdu_sess_id] = supi;
psc.get()->amf_ue_ngap_id = nc.get()->amf_ue_ngap_id;
psc.get()->ran_ue_ngap_id = nc.get()->ran_ue_ngap_id;
psc.get()->req_type = smf.req_type;
......@@ -811,7 +813,7 @@ void amf_n11::curl_http_client(
{{"Content-ID", "smf_context_location"},{"Content-Type", "varchar(128)"},{"content",psc.get()->smf_context_location}},
});
std::string json_part = udsf_put_pdu_session_context.dump();
while(!(amf_n2_inst->curl_http_client_udsf(udsf_put_url,json_part,"PUT",udsf_response)));
amf_n2_inst->curl_http_client_udsf(udsf_put_url,json_part,"PUT",udsf_response);
}
}
......
This diff is collapsed.
......@@ -42,7 +42,7 @@
namespace amf_application{
#define UDSF_CURL_TIMEOUT_MS 100L
#define UDSF_CURL_TIMEOUT_MS 2000L
class amf_n2 : public ngap::ngap_app {
public:
......
......@@ -360,7 +360,7 @@ void pdu_session_context::pdu_session_context_n1sm_from_json(nlohmann::json j)
if(it_block->at("Content-ID") == "n1sm")
{
string s = it_block->at("content");
s= s.substr(0, s.length() - 2);
// s= s.substr(0, s.length());
// msg_str_2_msg_hex(s.substr(0, s.length()),n1sm);
unsigned int msg_len = s.length();
char* data = (char*) malloc(msg_len + 1);
......
......@@ -101,25 +101,25 @@ int _5GSMobilityIdentity::_5g_s_tmsi_decodefrombuffer(uint8_t* buf, int len) {
decoded_size++;
Logger::nas_mm().debug("Octet 0x%x", octet);
digit[0] = octet;
tmsi |= octet;
tmsi |= octet<<24;
octet = *(buf + decoded_size);
Logger::nas_mm().debug("fourth octet 0x%x", octet);
decoded_size++;
Logger::nas_mm().debug("Octet 0x%x", octet);
digit[1] = octet;
tmsi |= octet << 8;
tmsi |= octet << 16;
octet = *(buf + decoded_size);
Logger::nas_mm().debug("fifth octet 0x%x", octet);
decoded_size++;
Logger::nas_mm().debug("Octet 0x%x", octet);
digit[2] = octet;
tmsi |= octet << 16;
tmsi |= octet << 8;
octet = *(buf + decoded_size);
Logger::nas_mm().debug("sixth octet 0x%x", octet);
decoded_size++;
Logger::nas_mm().debug("Octet 0x%x", octet);
digit[3] = octet;
tmsi |= octet << 24;
tmsi |= octet ;
_5g_s_tmsi->_5g_tmsi = (const string)(std::to_string(tmsi));
return decoded_size;
}
......
......@@ -231,6 +231,7 @@ int ServiceRequest::decodefrombuffer(
octet = *(buf + decoded_size);
Logger::nas_mm().debug("Next IEI (0x%x)", octet);
} break;
default: octet =0;break;
}
}
Logger::nas_mm().debug(
......
......@@ -90,7 +90,7 @@ void N1N2MessageCollectionDocumentApiImpl::n1_n2_message_transfer(
//std::shared_ptr<pdu_session_context> psc;
std::shared_ptr<pdu_session_context> psc = std::shared_ptr<pdu_session_context>(new pdu_session_context());
//***************************stateless
sleep(1);
nlohmann::json udsf_response;
std::string record_id = "RECORD_ID=\'" +supi + "\'";
......
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