Commit b621e54d authored by liuyu's avatar liuyu

can storage in udsf and cpe can software network

parent 6fd4a8a4
This diff is collapsed.
This diff is collapsed.
...@@ -461,7 +461,7 @@ void amf_n2::handle_itti_message(itti_ng_setup_request& itti_msg) { ...@@ -461,7 +461,7 @@ void amf_n2::handle_itti_message(itti_ng_setup_request& itti_msg) {
{{"Content-ID", "ng_state"},{"Content-Type", "varchar(32)"},{"content", to_string(gc.get()->ng_state )}}, {{"Content-ID", "ng_state"},{"Content-Type", "varchar(32)"},{"content", to_string(gc.get()->ng_state )}},
{{"Content-ID", "globalRanNodeId"},{"Content-Type", "varchar(32)"},{"content", to_string( gc->globalRanNodeId)}}, {{"Content-ID", "globalRanNodeId"},{"Content-Type", "varchar(32)"},{"content", to_string( gc->globalRanNodeId)}},
{{"Content-ID", "gnb_name"},{"Content-Type", "varchar(32)"},{"content", gc->gnb_name}}, {{"Content-ID", "gnb_name"},{"Content-Type", "varchar(32)"},{"content", gc->gnb_name}},
{{"Content-ID", "ue_radio_cap_ind"},{"Content-Type", "varchar(32)"},{"content", ue_radio_cap_ind}}, {{"Content-ID", "ue_radio_cap_ind"},{"Content-Type", "varchar(1024)"},{"content", ue_radio_cap_ind}},
{{"Content-ID", "mcc"},{"Content-Type", "varchar(32)"},{"content", gnbItem.mcc}}, {{"Content-ID", "mcc"},{"Content-Type", "varchar(32)"},{"content", gnbItem.mcc}},
{{"Content-ID", "mnc"},{"Content-Type", "varchar(32)"},{"content", gnbItem.mnc}}, {{"Content-ID", "mnc"},{"Content-Type", "varchar(32)"},{"content", gnbItem.mnc}},
{{"Content-ID", "tac"},{"Content-Type", "varchar(32)"},{"content", to_string(gnbItem.tac)}} {{"Content-ID", "tac"},{"Content-Type", "varchar(32)"},{"content", to_string(gnbItem.tac)}}
...@@ -544,7 +544,7 @@ bool amf_n2::curl_http_client_udsf(std::string remoteUrl,std::string jsonData,st ...@@ -544,7 +544,7 @@ bool amf_n2::curl_http_client_udsf(std::string remoteUrl,std::string jsonData,st
udsf_response = nlohmann::json::parse(response); udsf_response = nlohmann::json::parse(response);
//Logger::amf_n2().debug("Get response with jsonData: %s", response_data.dump().c_str()); //Logger::amf_n2().debug("Get response with jsonData: %s", response_data.dump().c_str());
} catch (nlohmann::json::exception &e) { } catch (nlohmann::json::exception &e) {
Logger::amf_n11().warn("Could not get Json content from the response"); Logger::amf_n11().warn("Could not get Json content from usdf the response");
} }
curl_slist_free_all(headers); curl_slist_free_all(headers);
curl_easy_cleanup(curl); curl_easy_cleanup(curl);
...@@ -999,11 +999,13 @@ void amf_n2::handle_itti_message(itti_initial_context_setup_request& itti_msg) { ...@@ -999,11 +999,13 @@ void amf_n2::handle_itti_message(itti_initial_context_setup_request& itti_msg) {
//bstring n2sm = itti_msg.n2sm; //bstring n2sm = itti_msg.n2sm;
if (blength(itti_msg.n2sm) != 0) { if (blength(itti_msg.n2sm) != 0) {
Logger::amf_n2().debug("*** test into itti_msg.n2sm ***"); Logger::amf_n2().debug("*** test into itti_msg.n2sm ***");
item.pduSessionResourceSetupRequestTransfer.buf = item.pduSessionResourceSetupRequestTransfer.buf = (uint8_t*) bdata(itti_msg.n2sm);
(uint8_t*) bdata(itti_msg.n2sm); Logger::amf_n2().debug("*** test into item.pduSessionResourceSetupRequestTransfer.buf ***");
Logger::amf_n2().debug("*** test into item.pduSessionResourceSetupRequestTransfer.buf ***"); string ssaa;
item.pduSessionResourceSetupRequestTransfer.size = octet_stream_2_hex_stream((uint8_t*) bdata(itti_msg.n2sm), blength(itti_msg.n2sm), ssaa);
blength(itti_msg.n2sm); printf("----service accept n2sm ----------------(%s)\n",ssaa.c_str());
item.pduSessionResourceSetupRequestTransfer.size = blength(itti_msg.n2sm);
} else { } else {
Logger::amf_n2().error("n2sm empty!"); Logger::amf_n2().error("n2sm empty!");
} }
...@@ -1093,19 +1095,20 @@ void amf_n2::handle_itti_message( ...@@ -1093,19 +1095,20 @@ void amf_n2::handle_itti_message(
} }
string supi = "imsi-" + nc.get()->imsi; string supi = "imsi-" + nc.get()->imsi;
Logger::amf_n2().debug("SUPI (%s)", supi.c_str()); Logger::amf_n2().debug("SUPI (%s)", supi.c_str());
std::shared_ptr<pdu_session_context> psc; //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 //***************************stateless
pdu_session_context *psc1 = new pdu_session_context(); pdu_session_context *psc1 = new pdu_session_context();
// nlohmann::json udsf_response; // nlohmann::json udsf_response;
udsf_url = "http://10.112.202.24:7123/nudsf-dr/v1/amfdata/" + std::string("pdu_session_context/records/") + supi ; udsf_url = "http://10.112.202.24:7123/nudsf-dr/v1/amfdata/" + std::string("pdu_session_context/records/") + supi ;
if(!amf_n2_inst->curl_http_client_udsf(udsf_url,"","GET",udsf_response)){ if(!amf_n2_inst->curl_http_client_udsf(udsf_url,"","GET",udsf_response)){
Logger::amf_n2().error("No existing pdu_session_context with assoc_id "); Logger::amf_n2().error("No existing pdu_session_context with assoc_id ");
return;
} }
Logger::amf_n2().debug("udsf_response: %s", udsf_response.dump().c_str()); else{
psc1->pdu_session_context_from_json(udsf_response); Logger::amf_n2().debug("udsf_response: %s", udsf_response.dump().c_str());
psc = std::shared_ptr<pdu_session_context>(psc1); psc.get()->pdu_session_context_from_json(udsf_response);
// psc = std::shared_ptr<pdu_session_context>(psc1);
}
//***************************stateless //***************************stateless
// if (amf_n11_inst->is_supi_to_pdu_ctx(supi)) // if (amf_n11_inst->is_supi_to_pdu_ctx(supi))
...@@ -1347,10 +1350,9 @@ void amf_n2::handle_itti_message( ...@@ -1347,10 +1350,9 @@ void amf_n2::handle_itti_message(
{"from_nf_ID",nlohmann::json::array({"AMF_1234"})} {"from_nf_ID",nlohmann::json::array({"AMF_1234"})}
} ; } ;
udsf_gnb_update_context["blocks"] = nlohmann::json::array({ udsf_gnb_update_context["blocks"] = nlohmann::json::array({
{{"Content-ID", "ue_radio_cap_ind"},{"Content-Type", "varchar(32)"},{"content", ue_radio_cap_ind}} {{"Content-ID", "ue_radio_cap_ind"},{"Content-Type", "varchar(1024)"},{"content", ue_radio_cap_ind}}
}); });
std::string json_part = udsf_gnb_update_context.dump(); amf_n2_inst->curl_http_client_udsf(udsf_update_url,udsf_gnb_update_context.dump(),"PUT",udsf_response);
amf_n2_inst->curl_http_client_udsf(udsf_update_url,json_part,"PUT",udsf_response);
} }
...@@ -1495,21 +1497,22 @@ void amf_n2::handle_itti_message(itti_handover_required& itti_msg) { ...@@ -1495,21 +1497,22 @@ void amf_n2::handle_itti_message(itti_handover_required& itti_msg) {
// handoverrequest->setSourceToTarget_TransparentContainer(sourceTotarget); // handoverrequest->setSourceToTarget_TransparentContainer(sourceTotarget);
string supi = "imsi-" + nc.get()->imsi; string supi = "imsi-" + nc.get()->imsi;
std::shared_ptr<pdu_session_context> psc; //std::shared_ptr<pdu_session_context> psc;
// = // =
// amf_n11_inst->supi_to_pdu_ctx(supi); // amf_n11_inst->supi_to_pdu_ctx(supi);
std::shared_ptr<pdu_session_context> psc = std::shared_ptr<pdu_session_context>(new pdu_session_context());
//***************************stateless //***************************stateless
pdu_session_context *psc1 = new pdu_session_context(); pdu_session_context *psc1 = new pdu_session_context();
nlohmann::json udsf_response; nlohmann::json udsf_response;
std::string udsf_url = "http://10.112.202.24:7123/nudsf-dr/v1/amfdata/" + std::string("pdu_session_context/records/") + supi ; std::string udsf_url = "http://10.112.202.24:7123/nudsf-dr/v1/amfdata/" + std::string("pdu_session_context/records/") + supi ;
if(!amf_n2_inst->curl_http_client_udsf(udsf_url,"","GET",udsf_response)){ if(!amf_n2_inst->curl_http_client_udsf(udsf_url,"","GET",udsf_response)){
Logger::amf_n2().error("No existing pdu_session_context with assoc_id "); Logger::amf_n2().error("No existing pdu_session_context with assoc_id ");
return;
} }
Logger::amf_n2().debug("udsf_response: %s", udsf_response.dump().c_str()); else{
psc1->pdu_session_context_from_json(udsf_response); Logger::amf_n2().debug("udsf_response: %s", udsf_response.dump().c_str());
psc = std::shared_ptr<pdu_session_context>(psc1); psc.get()->pdu_session_context_from_json(udsf_response);
// psc = std::shared_ptr<pdu_session_context>(psc1);
}
//***************************stateless //***************************stateless
std::vector<PDUSessionResourceSetupRequestItem_t> list; std::vector<PDUSessionResourceSetupRequestItem_t> list;
......
...@@ -30,8 +30,11 @@ ...@@ -30,8 +30,11 @@
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
#include "logger.hpp" #include "logger.hpp"
#include "Record.h" #include "Record.h"
#include "conversions.hpp"
using namespace std; using namespace std;
using namespace oai::amf::model; using namespace oai::amf::model;
extern void msg_str_2_msg_hex(std::string msg, bstring& b);
bool get_value_string(const nlohmann::json &j, const string & nm, string &value){ bool get_value_string(const nlohmann::json &j, const string & nm, string &value){
Record record; Record record;
...@@ -181,6 +184,34 @@ sctp_stream_id_t gnb_context::gnb_context_instreams_from_json(nlohmann::json j) ...@@ -181,6 +184,34 @@ sctp_stream_id_t gnb_context::gnb_context_instreams_from_json(nlohmann::json j)
} }
Logger::amf_server().error("get_value from json is error"); Logger::amf_server().error("get_value from json is error");
} }
void gnb_context::gnb_context_ue_radio_cap_ind_from_json(nlohmann::json j)
{
Record record;
nlohmann::json::parse(j.dump()).get_to(record);
std::set<nlohmann::json> block_set = record.getBlocks();
std::set<nlohmann::json>::iterator it_block;
for(it_block=block_set.begin();it_block!=block_set.end();)
{
if(it_block->at("Content-ID") == "ue_radio_cap_ind")
{
string s = it_block->at("content");
//msg_str_2_msg_hex(s.substr(0, s.length()),ue_radio_cap_ind);
unsigned int msg_len = s.length();
char* data = (char*) malloc(msg_len + 1);
memset(data, 0, msg_len + 1);
memcpy((void*) data, (void*) s.c_str(), msg_len);
//printf("data: %s\n", data);
uint8_t* msg_hex = (uint8_t*) malloc(msg_len / 2 + 1);
conv::ascii_to_hex(msg_hex, (const char*) data);
ue_radio_cap_ind = blk2bstr(msg_hex, (msg_len / 2));
return ;
}
block_set.erase(it_block++);
}
Logger::amf_server().error("get_value n2sm from json is error");
}
bool gnb_context::gnb_context_from_json(nlohmann::json j) bool gnb_context::gnb_context_from_json(nlohmann::json j)
{ {
//std::shared_ptr<gnb_context> gc1; //std::shared_ptr<gnb_context> gc1;
...@@ -190,7 +221,7 @@ bool gnb_context::gnb_context_from_json(nlohmann::json j) ...@@ -190,7 +221,7 @@ bool gnb_context::gnb_context_from_json(nlohmann::json j)
ng_state = amf_ng_gnb_state_s(gnb_context_ng_state_from_json(j)); ng_state = amf_ng_gnb_state_s(gnb_context_ng_state_from_json(j));
next_sctp_stream = gnb_context_next_sctp_stream_from_json(j); next_sctp_stream = gnb_context_next_sctp_stream_from_json(j);
next_sctp_stream = gnb_context_instreams_from_json(j); next_sctp_stream = gnb_context_instreams_from_json(j);
gnb_context_ue_radio_cap_ind_from_json(j);
// printf("gnbname-%s\n",gnb_name.c_str()); // printf("gnbname-%s\n",gnb_name.c_str());
// printf("globalgnbid-%d\n",globalRanNodeId); // printf("globalgnbid-%d\n",globalRanNodeId);
// printf("next stream-%d\n",next_sctp_stream); // printf("next stream-%d\n",next_sctp_stream);
......
...@@ -48,6 +48,7 @@ using namespace std; ...@@ -48,6 +48,7 @@ using namespace std;
enum amf_ng_gnb_state_s { NGAP_INIT, NGAP_RESETING, NGAP_READY, NGAP_SHUTDOWN }; enum amf_ng_gnb_state_s { NGAP_INIT, NGAP_RESETING, NGAP_READY, NGAP_SHUTDOWN };
class gnb_context { class gnb_context {
public: public:
void gnb_context_ue_radio_cap_ind_from_json(nlohmann::json j);
uint32_t gnb_context_sctp_assoc_id_from_json(nlohmann::json j); uint32_t gnb_context_sctp_assoc_id_from_json(nlohmann::json j);
long gnb_context_globalRanNodeId_from_json(nlohmann::json j); long gnb_context_globalRanNodeId_from_json(nlohmann::json j);
std::string gnb_context_gnb_name_from_json(nlohmann::json j); std::string gnb_context_gnb_name_from_json(nlohmann::json j);
......
This diff is collapsed.
...@@ -37,7 +37,28 @@ class pdu_session_context { ...@@ -37,7 +37,28 @@ class pdu_session_context {
public: public:
pdu_session_context(); pdu_session_context();
~pdu_session_context(); ~pdu_session_context();
void pdu_session_context_n1sm_from_json(nlohmann::json j);
void pdu_session_context_n2sm_from_json(nlohmann::json j);
bool pdu_session_context_from_json(nlohmann::json j); bool pdu_session_context_from_json(nlohmann::json j);
uint32_t pdu_session_context_ran_ue_ngap_id_from_json(nlohmann::json j);
long pdu_session_context_amf_ue_ngap_id_from_json(nlohmann::json j);
uint8_t pdu_session_context_req_type_from_json(nlohmann::json j);
uint8_t pdu_session_context_pdu_session_id_from_json(nlohmann::json j);
bool pdu_session_context_isn2sm_avaliable_from_json(nlohmann::json j);
bool pdu_session_context_isn1sm_avaliable_from_json(nlohmann::json j);
std::string pdu_session_context_dnn_from_json(nlohmann::json j);
std::string pdu_session_context_remote_smf_addr_from_json(nlohmann::json j);
bool pdu_session_context_smf_available_from_json(nlohmann::json j);
std::string pdu_session_context_location_from_json(nlohmann::json j);
void pdu_session_context_snssai_from_json(nlohmann::json j,snssai_t &snssai_json);
void pdu_session_context_plmn_from_json(nlohmann::json j,plmn_t &plmn_json);
std::string pdu_session_context_smf_context_location_from_json(nlohmann::json j);
uint32_t ran_ue_ngap_id; uint32_t ran_ue_ngap_id;
long amf_ue_ngap_id; long amf_ue_ngap_id;
uint8_t req_type; uint8_t req_type;
...@@ -53,7 +74,6 @@ class pdu_session_context { ...@@ -53,7 +74,6 @@ class pdu_session_context {
snssai_t snssai; snssai_t snssai;
plmn_t plmn; plmn_t plmn;
std::string smf_context_location; std::string smf_context_location;
//15 //15
}; };
#endif #endif
...@@ -52,7 +52,7 @@ uint32_t ue_context::ue_context_ran_ue_ngap_id_from_json(nlohmann::json j) ...@@ -52,7 +52,7 @@ uint32_t ue_context::ue_context_ran_ue_ngap_id_from_json(nlohmann::json j)
} }
Logger::amf_server().error("get_value from json is error"); Logger::amf_server().error("get_value from json is error");
} }
void ue_context::ue_context_tai_from_json(nlohmann::json j,Tai_t &tai_json) void ue_context::ue_context_tai_from_json(nlohmann::json j,Tai_t &Tai_json)
{ {
Record record; Record record;
nlohmann::json::parse(j.dump()).get_to(record); nlohmann::json::parse(j.dump()).get_to(record);
...@@ -67,10 +67,10 @@ void ue_context::ue_context_tai_from_json(nlohmann::json j,Tai_t &tai_json) ...@@ -67,10 +67,10 @@ void ue_context::ue_context_tai_from_json(nlohmann::json j,Tai_t &tai_json)
string j; string j;
s = it_block->at("content"); s = it_block->at("content");
tai_json.mcc = s.at("mcc"); Tai_json.mcc = s.at("mcc");
tai_json.mnc = s.at("mnc") ; Tai_json.mnc = s.at("mnc") ;
j = s.at("tac"); j = s.at("tac");
tai_json.tac = atoi(j.c_str()); Tai_json.tac = atoi(j.c_str());
//printf("ue_context_tai_from_json %s---mcc %s---mnc %s--\n",s.dump().c_str(),tai_json.mcc,tai_json.mnc); //printf("ue_context_tai_from_json %s---mcc %s---mnc %s--\n",s.dump().c_str(),tai_json.mcc,tai_json.mnc);
return ; return ;
// s = nlohmann::json::parse(j); // s = nlohmann::json::parse(j);
...@@ -82,6 +82,9 @@ void ue_context::ue_context_tai_from_json(nlohmann::json j,Tai_t &tai_json) ...@@ -82,6 +82,9 @@ void ue_context::ue_context_tai_from_json(nlohmann::json j,Tai_t &tai_json)
} }
Logger::amf_server().error("get_value from json is error"); Logger::amf_server().error("get_value from json is error");
} }
bool ue_context::ue_context_from_json(nlohmann::json j) bool ue_context::ue_context_from_json(nlohmann::json j)
{ {
//std::shared_ptr<gnb_context> gc1; //std::shared_ptr<gnb_context> gc1;
......
...@@ -386,8 +386,8 @@ int ngap_amf_handle_pdu_session_resource_setup_response( ...@@ -386,8 +386,8 @@ int ngap_amf_handle_pdu_session_resource_setup_response(
std::shared_ptr<nas_context> nct = std::shared_ptr<nas_context> nct =
amf_n1_inst->amf_ue_id_2_nas_context(amf_ue_ngap_id); amf_n1_inst->amf_ue_id_2_nas_context(amf_ue_ngap_id);
string supi = "imsi-" + nct.get()->imsi; string supi = "imsi-" + nct.get()->imsi;
std::shared_ptr<pdu_session_context> psc; // 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 //***************************stateless
pdu_session_context *psc1 = new pdu_session_context(); pdu_session_context *psc1 = new pdu_session_context();
nlohmann::json udsf_response; nlohmann::json udsf_response;
...@@ -396,9 +396,12 @@ int ngap_amf_handle_pdu_session_resource_setup_response( ...@@ -396,9 +396,12 @@ int ngap_amf_handle_pdu_session_resource_setup_response(
Logger::amf_n2().error("No existing pdu_session_context with assoc_id "); Logger::amf_n2().error("No existing pdu_session_context with assoc_id ");
return 0 ; return 0 ;
} }
Logger::amf_n2().debug("udsf_response: %s", udsf_response.dump().c_str());
psc1->pdu_session_context_from_json(udsf_response); else{
psc = std::shared_ptr<pdu_session_context>(psc1); Logger::amf_n2().debug("udsf_response: %s", udsf_response.dump().c_str());
psc.get()->pdu_session_context_from_json(udsf_response);
//psc = std::shared_ptr<pdu_session_context>(psc1);
}
//***************************stateless //***************************stateless
// if (amf_n11_inst->is_supi_to_pdu_ctx(supi)) { // if (amf_n11_inst->is_supi_to_pdu_ctx(supi)) {
......
...@@ -87,19 +87,20 @@ void N1N2MessageCollectionDocumentApiImpl::n1_n2_message_transfer( ...@@ -87,19 +87,20 @@ void N1N2MessageCollectionDocumentApiImpl::n1_n2_message_transfer(
std::string supi = ueContextId; std::string supi = ueContextId;
Logger::amf_server().debug( Logger::amf_server().debug(
"Key for PDU Session context: SUPI (%s)", supi.c_str()); "Key for PDU Session context: SUPI (%s)", supi.c_str());
std::shared_ptr<pdu_session_context> psc; //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 //***************************stateless
pdu_session_context *psc1 = new pdu_session_context(); pdu_session_context *psc1 = new pdu_session_context();
nlohmann::json udsf_response; nlohmann::json udsf_response;
std::string udsf_url = "http://10.112.202.24:7123/nudsf-dr/v1/amfdata/" + std::string("pdu_session_context/records/") + supi ; std::string udsf_url = "http://10.112.202.24:7123/nudsf-dr/v1/amfdata/" + std::string("pdu_session_context/records/") + supi ;
if(!amf_n2_inst->curl_http_client_udsf(udsf_url,"","GET",udsf_response)){ if(!amf_n2_inst->curl_http_client_udsf(udsf_url,"","GET",udsf_response)){
Logger::amf_n2().error("No existing pdu_session_context with assoc_id "); Logger::amf_n2().error("No existing pdu_session_context with assoc_id ");
return;
} }
Logger::amf_n2().debug("udsf_response: %s", udsf_response.dump().c_str()); else{
psc1->pdu_session_context_from_json(udsf_response); Logger::amf_n2().debug("udsf_response: %s", udsf_response.dump().c_str());
psc = std::shared_ptr<pdu_session_context>(psc1); psc.get()->pdu_session_context_from_json(udsf_response);
//psc = std::shared_ptr<pdu_session_context>(psc1);
}
//***************************stateless //***************************stateless
// if (amf_n11_inst->is_supi_to_pdu_ctx(supi)) { // if (amf_n11_inst->is_supi_to_pdu_ctx(supi)) {
...@@ -108,7 +109,6 @@ void N1N2MessageCollectionDocumentApiImpl::n1_n2_message_transfer( ...@@ -108,7 +109,6 @@ void N1N2MessageCollectionDocumentApiImpl::n1_n2_message_transfer(
// Logger::amf_server().error( // Logger::amf_server().error(
// "Cannot get pdu_session_context with SUPI (%s)", supi.c_str()); // "Cannot get pdu_session_context with SUPI (%s)", supi.c_str());
// } // }
bstring n1sm; bstring n1sm;
msg_str_2_msg_hex( msg_str_2_msg_hex(
n1sm_str.substr(0, n1sm_str.length()), n1sm_str.substr(0, n1sm_str.length()),
...@@ -126,6 +126,7 @@ void N1N2MessageCollectionDocumentApiImpl::n1_n2_message_transfer( ...@@ -126,6 +126,7 @@ void N1N2MessageCollectionDocumentApiImpl::n1_n2_message_transfer(
string n2sm_udsf; string n2sm_udsf;
octet_stream_2_hex_stream((uint8_t*) bdata(psc.get()->n1sm), blength(psc.get()->n1sm), n1sm_udsf); octet_stream_2_hex_stream((uint8_t*) bdata(psc.get()->n1sm), blength(psc.get()->n1sm), n1sm_udsf);
octet_stream_2_hex_stream((uint8_t*) bdata(psc.get()->n2sm), blength(psc.get()->n2sm), n2sm_udsf); octet_stream_2_hex_stream((uint8_t*) bdata(psc.get()->n2sm), blength(psc.get()->n2sm), n2sm_udsf);
std::string udsf_put_url = "http://10.112.202.24:7123/nudsf-dr/v1/amfdata/" + std::string("pdu_session_context/records/") + supi ; std::string udsf_put_url = "http://10.112.202.24:7123/nudsf-dr/v1/amfdata/" + std::string("pdu_session_context/records/") + supi ;
nlohmann::json udsf_put_pdu_session_context; nlohmann::json udsf_put_pdu_session_context;
//nlohmann::json udsf_response; //nlohmann::json udsf_response;
...@@ -134,9 +135,9 @@ void N1N2MessageCollectionDocumentApiImpl::n1_n2_message_transfer( ...@@ -134,9 +135,9 @@ void N1N2MessageCollectionDocumentApiImpl::n1_n2_message_transfer(
{"from_nf_ID",nlohmann::json::array({"AMF_1234"})} {"from_nf_ID",nlohmann::json::array({"AMF_1234"})}
} ; } ;
udsf_put_pdu_session_context["blocks"] = nlohmann::json::array({ udsf_put_pdu_session_context["blocks"] = nlohmann::json::array({
{{"Content-ID", "n2sm"},{"Content-Type", "varchar(32)"},{"content",n2sm_udsf}}, {{"Content-ID", "n2sm"},{"Content-Type", "varchar(1024)"},{"content",n2sm_udsf}},
{{"Content-ID", "isn2sm_avaliable"},{"Content-Type", "varchar(32)"},{"content",to_string(psc.get()->isn2sm_avaliable)}}, {{"Content-ID", "isn2sm_avaliable"},{"Content-Type", "varchar(32)"},{"content",to_string(psc.get()->isn2sm_avaliable)}},
{{"Content-ID", "n1sm"},{"Content-Type", "varchar(32)"},{"content", n1sm_udsf}}, {{"Content-ID", "n1sm"},{"Content-Type", "varchar(1024)"},{"content", n1sm_udsf}},
{{"Content-ID", "isn1sm_avaliable"},{"Content-Type", "varchar(32)"},{"content", to_string(psc.get()->isn1sm_avaliable)}}, {{"Content-ID", "isn1sm_avaliable"},{"Content-Type", "varchar(32)"},{"content", to_string(psc.get()->isn1sm_avaliable)}},
}); });
std::string json_part = udsf_put_pdu_session_context.dump(); std::string json_part = udsf_put_pdu_session_context.dump();
......
...@@ -32,16 +32,16 @@ void TestSignallingApiImpl:: ...@@ -32,16 +32,16 @@ void TestSignallingApiImpl::
std::string supi = subscriptionId; std::string supi = subscriptionId;
Logger::amf_server().debug( Logger::amf_server().debug(
"Key for PDU Session context: SUPI (%s)", supi.c_str()); "Key for PDU Session context: SUPI (%s)", supi.c_str());
std::shared_ptr<pdu_session_context> psc; //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 //***************************stateless
pdu_session_context *psc1 = new pdu_session_context(); pdu_session_context *psc1 = new pdu_session_context();
nlohmann::json udsf_response; nlohmann::json udsf_response;
std::string udsf_url = "http://10.112.202.24:7123/nudsf-dr/v1/amfdata/" + std::string("pdu_session_context/records/") + supi ; std::string udsf_url = "http://10.112.202.24:7123/nudsf-dr/v1/amfdata/" + std::string("pdu_session_context/records/") + supi ;
if(amf_n2_inst->curl_http_client_udsf(udsf_url,"","GET",udsf_response)){ if(amf_n2_inst->curl_http_client_udsf(udsf_url,"","GET",udsf_response)){
Logger::amf_server().debug("udsf_response: %s", udsf_response.dump().c_str()); Logger::amf_server().debug("udsf_response: %s", udsf_response.dump().c_str());
psc1->pdu_session_context_from_json(udsf_response); psc.get()->pdu_session_context_from_json(udsf_response);
psc = std::shared_ptr<pdu_session_context>(psc1); //psc = std::shared_ptr<pdu_session_context>(psc1);
itti_test_signalling_network_initiated_deregistration* itti_msg = itti_test_signalling_network_initiated_deregistration* itti_msg =
new itti_test_signalling_network_initiated_deregistration(AMF_SERVER, TASK_AMF_APP); new itti_test_signalling_network_initiated_deregistration(AMF_SERVER, TASK_AMF_APP);
...@@ -97,16 +97,16 @@ void TestSignallingApiImpl::test_signalling_paging( ...@@ -97,16 +97,16 @@ void TestSignallingApiImpl::test_signalling_paging(
std::string supi = ueContextId; std::string supi = ueContextId;
Logger::amf_server().debug( Logger::amf_server().debug(
"Key for PDU Session context: SUPI (%s)", supi.c_str()); "Key for PDU Session context: SUPI (%s)", supi.c_str());
std::shared_ptr<pdu_session_context> psc; //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 //***************************stateless
pdu_session_context *psc1 = new pdu_session_context(); pdu_session_context *psc1 = new pdu_session_context();
nlohmann::json udsf_response; nlohmann::json udsf_response;
std::string udsf_url = "http://10.112.202.24:7123/nudsf-dr/v1/amfdata/" + std::string("pdu_session_context/records/") + supi ; std::string udsf_url = "http://10.112.202.24:7123/nudsf-dr/v1/amfdata/" + std::string("pdu_session_context/records/") + supi ;
if(amf_n2_inst->curl_http_client_udsf(udsf_url,"","GET",udsf_response)){ if(amf_n2_inst->curl_http_client_udsf(udsf_url,"","GET",udsf_response)){
Logger::amf_server().debug("udsf_response: %s", udsf_response.dump().c_str()); Logger::amf_server().debug("udsf_response: %s", udsf_response.dump().c_str());
psc1->pdu_session_context_from_json(udsf_response); psc.get()->pdu_session_context_from_json(udsf_response);
psc = std::shared_ptr<pdu_session_context>(psc1); //psc = std::shared_ptr<pdu_session_context>(psc1);
itti_test_signalling_paging* itti_msg = itti_test_signalling_paging* itti_msg =
new itti_test_signalling_paging(AMF_SERVER, TASK_AMF_APP); new itti_test_signalling_paging(AMF_SERVER, TASK_AMF_APP);
......
...@@ -8,7 +8,6 @@ uint8_t multipart_parser( ...@@ -8,7 +8,6 @@ uint8_t multipart_parser(
// simple parser // simple parser
mime_parser sp = {}; mime_parser sp = {};
sp.parse(input); sp.parse(input);
std::vector<mime_part> parts = {}; std::vector<mime_part> parts = {};
sp.get_mime_parts(parts); sp.get_mime_parts(parts);
uint8_t size = parts.size(); uint8_t size = parts.size();
......
...@@ -34,7 +34,9 @@ bool mime_parser::parse(const std::string& str) { ...@@ -34,7 +34,9 @@ bool mime_parser::parse(const std::string& str) {
// find boundary // find boundary
std::size_t content_type_pos = str.find("Content-Type"); // first part std::size_t content_type_pos = str.find("Content-Type"); // first part
if ((content_type_pos <= 4) or (content_type_pos == std::string::npos)) if ((content_type_pos <= 4) or (content_type_pos == std::string::npos))
{
return false; return false;
}
std::string boundary_str = std::string boundary_str =
str.substr(2, content_type_pos - 4); // 2 for -- and 2 for CRLF str.substr(2, content_type_pos - 4); // 2 for -- and 2 for CRLF
......
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