Commit c4c3269b authored by liuyu's avatar liuyu

sync is successful

parent 6fbd0579
......@@ -3893,7 +3893,6 @@ bool smf_context::add_pdu_session(
pdu_sessions.insert(
std::pair<pdu_session_id_t, std::shared_ptr<smf_pdu_session>>(
psi, sp));
lock.unlock();
Logger::smf_app().debug(
"PDU Session Id (%d) has been added successfully", psi);
return true;
......@@ -5007,6 +5006,7 @@ void smf_context::send_pdu_session_create_response(
sc.get()->find_pdu_session(resp->res.get_pdu_session_id(), sp);
udpsmfcontext["up_fseid"] = sp.get()->up_fseid.seid;
udpsmfcontext["seid"] = sp.get()->seid;
udpsmfcontext["ipv4_address"] = inet_ntoa(sp.get()->ipv4_address);
UdpSend_smf(udpsmfcontext,"10.103.239.31", 20023);
// json_data["smfcontext"] = udpsmfcontext.dump();
......
......@@ -177,6 +177,9 @@ int udp_server_coop::udp_read_from_peer_smf() {
smf_app_inst->set_supi_2_smf_context(supi64, sc);
// sc.get()->set_plmn(smreq->req.get_plmn()); // PLMN
}
uint64_t seid = smfcontext["seid"];
smf_app_inst->set_seid_2_smf_context(seid, sc);
std::shared_ptr<smf_pdu_session> sp = {};
if (!sc.get()->find_pdu_session(scf.get()->pdu_session_id, sp)) {
......@@ -212,7 +215,6 @@ int udp_server_coop::udp_read_from_peer_smf() {
sp.get()->set_sessions_graph(graph);
uint64_t seid = smf_app_inst->generate_seid();
sp->set_seid(seid);
sp->up_fseid.seid = smfcontext["up_fseid"];
sp->ipv4 = true;
......@@ -222,11 +224,7 @@ int udp_server_coop::udp_read_from_peer_smf() {
// 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 = {};
std::shared_ptr<session_management_subscription> ss = {};
sc->get_default_qos(snssai, dnn, default_qos);
......@@ -252,10 +250,6 @@ int udp_server_coop::udp_read_from_peer_smf() {
flow.far_id_ul.first = true;
sp->generate_pdr_id(flow.pdr_id_ul);
smf_qos_flow current_flow{};
current_flow = flow;
Logger::smf_app().warn("----------liuyu-------start_asynch_dfs_procedure");
......@@ -267,67 +261,6 @@ int udp_server_coop::udp_read_from_peer_smf() {
Logger::smf_app().warn("----------liuyu-------dfs_next_upf");
graph->dfs_next_upf(dl_edges, ul_edges, upf);
// std::shared_ptr<pfcp_association> current_upf;
// std::vector<edge> dl_edges2;
// std::vector<edge> ul_edges2;
// std::shared_ptr<smf_session_procedure> ssp = {};
// // smf_procedure_code res = ssp.get()->get_current_upf(dl_edges2, ul_edges2, current_upf);
// edge dl_edge = dl_edges[0];
// // if (res != smf_procedure_code::OK) {
// // Logger::smf_app().error("----------liuyu-------smf_procedure_code");
// // }
// for (auto ul_edge : ul_edges) {
// //-------------------
// // IE CREATE_FAR
// //-------------------
// pfcp::create_far create_far = ssp.get()->pfcp_create_far(ul_edge, current_flow.qfi);
// // copy created FAR ID to DL edge for PDR
// ssp.get()->synch_ul_dl_edges(dl_edges, ul_edges, current_flow.qfi);
// // copy values from UL edge, so we simulate two downlink edges for PFCP
// auto flow = dl_edge.get_qos_flow(current_flow.qfi);
// flow->pdr_id_ul = 0;
// dl_edge.flow_description = ul_edge.flow_description;
// dl_edge.precedence = ul_edge.precedence;
// //-------------------
// // IE CREATE_PDR
// //-------------------
// pfcp::create_pdr create_pdr = ssp.get()->pfcp_create_pdr(
// dl_edge, current_flow.qfi, current_upf->function_features.second);
// ssp.get()->synch_ul_dl_edges(dl_edges, ul_edges, current_flow.qfi);
// ADD IEs to message
//-------------------
// n4_triggered->pfcp_ies.set(create_pdr);
// n4_triggered->pfcp_ies.set(create_far);
// if (smf_cfg.enable_dl_pdr_in_pfcp_sess_estab) {
// pfcp::create_far create_far_dl =
// pfcp_create_far(dl_edge, current_flow.qfi);
// pfcp::create_pdr create_pdr_dl =
// pfcp_create_pdr_dl(dl_edge, current_flow.qfi);
// n4_triggered->pfcp_ies.set(create_pdr_dl);
// n4_triggered->pfcp_ies.set(create_far_dl);
// }
// Handle PDR and FAR for downlink if thid feature is enabled
// if (smf_cfg.enable_dl_pdr_in_pfcp_sess_estab) {
// Logger::smf_app().info("Adding DL PDR and FAR start");
// }
// }
}
}
return 0;
......
diff --git a/src/smf_app/smf_context.cpp b/src/smf_app/smf_context.cpp
index 3c90e544..9db1e689 100644
--- a/src/smf_app/smf_context.cpp
+++ b/src/smf_app/smf_context.cpp
@@ -3893,7 +3893,6 @@ bool smf_context::add_pdu_session(
pdu_sessions.insert(
std::pair<pdu_session_id_t, std::shared_ptr<smf_pdu_session>>(
psi, sp));
- lock.unlock();
Logger::smf_app().debug(
"PDU Session Id (%d) has been added successfully", psi);
return true;
@@ -5007,6 +5006,7 @@ void smf_context::send_pdu_session_create_response(
sc.get()->find_pdu_session(resp->res.get_pdu_session_id(), sp);

udpsmfcontext["up_fseid"] = sp.get()->up_fseid.seid;
+ udpsmfcontext["seid"] = sp.get()->seid;
udpsmfcontext["ipv4_address"] = inet_ntoa(sp.get()->ipv4_address);
UdpSend_smf(udpsmfcontext,"10.103.239.31", 20023);
// json_data["smfcontext"] = udpsmfcontext.dump();
diff --git a/src/udp/cooudp.cpp b/src/udp/cooudp.cpp
index 839d702a..161fceec 100644
--- a/src/udp/cooudp.cpp
+++ b/src/udp/cooudp.cpp
@@ -177,6 +177,9 @@ int udp_server_coop::udp_read_from_peer_smf() {
smf_app_inst->set_supi_2_smf_context(supi64, sc);
// sc.get()->set_plmn(smreq->req.get_plmn()); // PLMN
}
+ uint64_t seid = smfcontext["seid"];
+ smf_app_inst->set_seid_2_smf_context(seid, sc);
+

std::shared_ptr<smf_pdu_session> sp = {};
if (!sc.get()->find_pdu_session(scf.get()->pdu_session_id, sp)) {
@@ -212,7 +215,6 @@ int udp_server_coop::udp_read_from_peer_smf() {
sp.get()->set_sessions_graph(graph);


- uint64_t seid = smf_app_inst->generate_seid();
sp->set_seid(seid);
sp->up_fseid.seid = smfcontext["up_fseid"];
sp->ipv4 = true;
@@ -222,11 +224,7 @@ int udp_server_coop::udp_read_from_peer_smf() {

// 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 = {};
std::shared_ptr<session_management_subscription> ss = {};
sc->get_default_qos(snssai, dnn, default_qos);
@@ -252,10 +250,6 @@ int udp_server_coop::udp_read_from_peer_smf() {
flow.far_id_ul.first = true;
sp->generate_pdr_id(flow.pdr_id_ul);

-
-
-
-
smf_qos_flow current_flow{};
current_flow = flow;
Logger::smf_app().warn("----------liuyu-------start_asynch_dfs_procedure");
@@ -267,67 +261,6 @@ int udp_server_coop::udp_read_from_peer_smf() {
Logger::smf_app().warn("----------liuyu-------dfs_next_upf");
graph->dfs_next_upf(dl_edges, ul_edges, upf);

- 
- 
-
- // std::shared_ptr<pfcp_association> current_upf;
- // std::vector<edge> dl_edges2;
- // std::vector<edge> ul_edges2;
- // std::shared_ptr<smf_session_procedure> ssp = {};
- 
- // // smf_procedure_code res = ssp.get()->get_current_upf(dl_edges2, ul_edges2, current_upf);
- // edge dl_edge = dl_edges[0];
- // // if (res != smf_procedure_code::OK) {
- // // Logger::smf_app().error("----------liuyu-------smf_procedure_code");
- // // }
- // for (auto ul_edge : ul_edges) {
- // //-------------------
- // // IE CREATE_FAR
- // //-------------------
- // pfcp::create_far create_far = ssp.get()->pfcp_create_far(ul_edge, current_flow.qfi);
- // // copy created FAR ID to DL edge for PDR
- // ssp.get()->synch_ul_dl_edges(dl_edges, ul_edges, current_flow.qfi);
-
- // // copy values from UL edge, so we simulate two downlink edges for PFCP
- // auto flow = dl_edge.get_qos_flow(current_flow.qfi);
- // flow->pdr_id_ul = 0;
- // dl_edge.flow_description = ul_edge.flow_description;
- // dl_edge.precedence = ul_edge.precedence;
-
- // //-------------------
- // // IE CREATE_PDR
- // //-------------------
- // pfcp::create_pdr create_pdr = ssp.get()->pfcp_create_pdr(
- // dl_edge, current_flow.qfi, current_upf->function_features.second);
- // ssp.get()->synch_ul_dl_edges(dl_edges, ul_edges, current_flow.qfi);
-
- // ADD IEs to message
- //-------------------
- // n4_triggered->pfcp_ies.set(create_pdr);
- // n4_triggered->pfcp_ies.set(create_far);
-
- // if (smf_cfg.enable_dl_pdr_in_pfcp_sess_estab) {
- // pfcp::create_far create_far_dl =
- // pfcp_create_far(dl_edge, current_flow.qfi);
- // pfcp::create_pdr create_pdr_dl =
- // pfcp_create_pdr_dl(dl_edge, current_flow.qfi);
- // n4_triggered->pfcp_ies.set(create_pdr_dl);
- // n4_triggered->pfcp_ies.set(create_far_dl);
- // }
- // Handle PDR and FAR for downlink if thid feature is enabled
- // if (smf_cfg.enable_dl_pdr_in_pfcp_sess_estab) {
- // Logger::smf_app().info("Adding DL PDR and FAR start");
- // }
- // }
- 
- 
- 
-
- 
-
-
-
-
}
}
return 0;
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