Commit 0304b108 authored by liuyu's avatar liuyu

sync context

parent 21a4a9a9
...@@ -85,7 +85,7 @@ using namespace smf; ...@@ -85,7 +85,7 @@ using namespace smf;
extern itti_mw* itti_inst; extern itti_mw* itti_inst;
extern smf::smf_app* smf_app_inst; extern smf::smf_app* smf_app_inst;
extern smf::smf_config smf_cfg; extern smf::smf_config smf_cfg;
extern void UdpSend_smf(nlohmann::json aggregation,string ip,int port);
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void smf_pdu_session::get_pdu_session_id(uint32_t& psi) const { void smf_pdu_session::get_pdu_session_id(uint32_t& psi) const {
psi = pdu_session_id; psi = pdu_session_id;
...@@ -4991,6 +4991,24 @@ void smf_context::send_pdu_session_create_response( ...@@ -4991,6 +4991,24 @@ void smf_context::send_pdu_session_create_response(
// need this info for the moment // need this info for the moment
json_data["pduSessionId"] = resp->res.get_pdu_session_id(); json_data["pduSessionId"] = resp->res.get_pdu_session_id();
Logger::smf_app().info("---------------liuyu--udpsend",resp->scid);
nlohmann::json udpsmfcontext;
udpsmfcontext["scid"] = resp->scid;
udpsmfcontext["supi"] = smf_supi_to_string(resp->res.get_supi());
udpsmfcontext["pdu_session_id"] = resp->res.get_pdu_session_id();
udpsmfcontext["dnn"] = resp->res.get_dnn();
udpsmfcontext["snssai"] = resp->res.get_snssai().toString();
udpsmfcontext["pdu_session_type"] = 0;
supi64_t supi64 = smf_supi_to_u64(resp->res.get_supi());
std::shared_ptr<smf_context> sc = {};
sc = smf_app_inst->supi_2_smf_context(supi64);
std::shared_ptr<smf_pdu_session> sp = {};
sc.get()->find_pdu_session(resp->res.get_pdu_session_id(), sp);
udpsmfcontext["seid"] = sp.get()->seid;
UdpSend_smf(udpsmfcontext,"10.103.239.31", 20023);
// json_data["smfcontext"] = udpsmfcontext.dump();
resp->res.set_json_data(json_data); resp->res.set_json_data(json_data);
// send ITTI message to APP to trigger N1N2MessageTransfer towards AMFs // send ITTI message to APP to trigger N1N2MessageTransfer towards AMFs
......
...@@ -737,18 +737,18 @@ smf_procedure_code session_create_sm_context_procedure::run( ...@@ -737,18 +737,18 @@ smf_procedure_code session_create_sm_context_procedure::run(
// Get next UPF for the first N4 session establishment // Get next UPF for the first N4 session establishment
get_next_upf(dl_edges, ul_edges, upf); get_next_upf(dl_edges, ul_edges, upf);
Logger::smf_app().info("-----------------udpsend",sm_context_req->scid); // Logger::smf_app().info("-----------------udpsend",sm_context_req->scid);
nlohmann::json udpsmfcontext; // nlohmann::json udpsmfcontext;
udpsmfcontext["scid"] = sm_context_req->scid; // udpsmfcontext["scid"] = sm_context_req->scid;
udpsmfcontext["supi"] = smf_supi_to_string(scf.get()->supi); // udpsmfcontext["supi"] = smf_supi_to_string(scf.get()->supi);
udpsmfcontext["pdu_session_id"] = scf.get()->pdu_session_id; // udpsmfcontext["pdu_session_id"] = scf.get()->pdu_session_id;
udpsmfcontext["dnn"] = dnn; // udpsmfcontext["dnn"] = dnn;
udpsmfcontext["snssai"] = snssai.toString(); // udpsmfcontext["snssai"] = snssai.toString();
udpsmfcontext["pdu_session_type"] = sm_context_req->req.get_pdu_session_type(); // udpsmfcontext["pdu_session_type"] = sm_context_req->req.get_pdu_session_type();
UdpSend_smf(udpsmfcontext,"10.103.239.31", 20023); // UdpSend_smf(udpsmfcontext,"10.103.239.31", 20023);
return send_n4_session_establishment_request(); return send_n4_session_establishment_request();
...@@ -788,6 +788,7 @@ smf_procedure_code session_create_sm_context_procedure::handle_itti_msg( ...@@ -788,6 +788,7 @@ smf_procedure_code session_create_sm_context_procedure::handle_itti_msg(
if (smf_cfg.enable_dl_pdr_in_pfcp_sess_estab && if (smf_cfg.enable_dl_pdr_in_pfcp_sess_estab &&
resp.pfcp_ies.created_pdrs.empty()) { resp.pfcp_ies.created_pdrs.empty()) {
pfcp::pdr_id_t pdr_id_tmp; pfcp::pdr_id_t pdr_id_tmp;
Logger::smf_app().info("liuyu22222222)");
// we use qos flow for 1st PDR for the moment // we use qos flow for 1st PDR for the moment
// TODO: remove this hardcoding of qos flow // TODO: remove this hardcoding of qos flow
pdr_id_tmp.rule_id = 1; pdr_id_tmp.rule_id = 1;
......
...@@ -205,9 +205,20 @@ int udp_server_coop::udp_read_from_peer_smf() { ...@@ -205,9 +205,20 @@ int udp_server_coop::udp_read_from_peer_smf() {
sc.get()->insert_dnn_subscription(snssai, dnn, subscription); sc.get()->insert_dnn_subscription(snssai, dnn, subscription);
} }
sp.get()->set_dnn(dnn);
sp.get()->set_snssai(snssai);
std::shared_ptr<upf_graph> graph = {}; std::shared_ptr<upf_graph> graph = {};
graph = pfcp_associations::get_instance().select_up_node(snssai, dnn); graph = pfcp_associations::get_instance().select_up_node(snssai, dnn);
sp.get()->set_sessions_graph(graph);
sp->set_seid(smfcontext["seid"]);
// for finding procedure when receiving response
smf_app_inst->set_seid_2_smf_context(sp.get()->seid, sc);
subscribed_default_qos_t default_qos = {}; subscribed_default_qos_t default_qos = {};
std::shared_ptr<session_management_subscription> ss = {}; std::shared_ptr<session_management_subscription> ss = {};
...@@ -241,9 +252,8 @@ int udp_server_coop::udp_read_from_peer_smf() { ...@@ -241,9 +252,8 @@ int udp_server_coop::udp_read_from_peer_smf() {
Logger::smf_app().warn("----------liuyu-------dfs_next_upf"); Logger::smf_app().warn("----------liuyu-------dfs_next_upf");
graph->dfs_next_upf(dl_edges, ul_edges, upf); graph->dfs_next_upf(dl_edges, ul_edges, upf);
sp.get()->set_dnn(dnn);
sp.get()->set_snssai(snssai);
sp.get()->set_sessions_graph(graph);
// std::shared_ptr<pfcp_association> current_upf; // std::shared_ptr<pfcp_association> current_upf;
// std::vector<edge> dl_edges2; // std::vector<edge> dl_edges2;
......
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