Commit 75ff49e5 authored by liuyu's avatar liuyu

smfcontext

parent cfe412f5
...@@ -135,7 +135,7 @@ int main(int argc, char** argv) { ...@@ -135,7 +135,7 @@ int main(int argc, char** argv) {
udp_server_coop udp_uplink_(inet_ntoa(smf_cfg.sbi.addr4),20001); udp_server_coop udp_uplink_(inet_ntoa(smf_cfg.sbi.addr4),20001);
udp_server_coop udp_downlink_(inet_ntoa(smf_cfg.sbi.addr4),20004); udp_server_coop udp_downlink_(inet_ntoa(smf_cfg.sbi.addr4),20004);
udp_server_coop udp_smf_(inet_ntoa(smf_cfg.sbi.addr4),2023); udp_server_coop udp_smf_(inet_ntoa(smf_cfg.sbi.addr4),20023);
// SMF Pistache API server (HTTP1) // SMF Pistache API server (HTTP1)
Pistache::Address addr( Pistache::Address addr(
......
...@@ -53,7 +53,7 @@ using namespace std; ...@@ -53,7 +53,7 @@ using namespace std;
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);
pfcp::ue_ip_address_t smf_session_procedure::pfcp_ue_ip_address( pfcp::ue_ip_address_t smf_session_procedure::pfcp_ue_ip_address(
const edge& edge) { const edge& edge) {
// only used in PDR,so when it is an downlink edge, we are in UL procedure // only used in PDR,so when it is an downlink edge, we are in UL procedure
...@@ -738,12 +738,12 @@ smf_procedure_code session_create_sm_context_procedure::run( ...@@ -738,12 +738,12 @@ smf_procedure_code session_create_sm_context_procedure::run(
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"] = "2"; udpsmfcontext["scid"] = sm_context_req->scid;
// udpsmfcontext["pdu_session_id"] = "2"; udpsmfcontext["pdu_session_id"] = scf.get()->pdu_session_id;
// UdpSend_smf(udpsmfcontext,"10.103.239.31", 2023); UdpSend_smf(udpsmfcontext,"10.103.239.31", 2023);
// extern void UdpSend_downlink(nlohmann::json aggregation,string ip,int port);
return send_n4_session_establishment_request(); return send_n4_session_establishment_request();
} }
......
...@@ -107,12 +107,13 @@ void udp_server_coop::start_receive(udp_server_coop* udp, uint16_t udp_port_num) ...@@ -107,12 +107,13 @@ void udp_server_coop::start_receive(udp_server_coop* udp, uint16_t udp_port_num)
thread_ = std::thread(&udp_server_coop::udp_read_from_socket_to_center,this); thread_ = std::thread(&udp_server_coop::udp_read_from_socket_to_center,this);
thread_.detach(); thread_.detach();
} }
if (udp_port_num == 2023) if (udp_port_num == 20023)
{ {
thread_ = std::thread(&udp_server_coop::udp_read_from_peer_smf,this); thread_ = std::thread(&udp_server_coop::udp_read_from_peer_smf,this);
thread_.detach(); thread_.detach();
} }
else{ if (udp_port_num == 20004)
{
thread_ = std::thread(&udp_server_coop::udp_read_from_socket_from_center,this); thread_ = std::thread(&udp_server_coop::udp_read_from_socket_from_center,this);
thread_.detach(); thread_.detach();
} }
...@@ -137,7 +138,7 @@ int udp_server_coop::udp_read_from_peer_smf() { ...@@ -137,7 +138,7 @@ int udp_server_coop::udp_read_from_peer_smf() {
//socklen_t addr_len; //socklen_t addr_len;
int udp_len; int udp_len;
size_t bytes_received = 0; size_t bytes_received = 0;
cout<<"start receive"<<endl; cout<<"start receive udp_read_from_peer_smf"<<endl;
struct timeval time; struct timeval time;
while(1){ while(1){
...@@ -155,10 +156,7 @@ int udp_server_coop::udp_read_from_peer_smf() { ...@@ -155,10 +156,7 @@ int udp_server_coop::udp_read_from_peer_smf() {
nlohmann::json smfcontext = nlohmann::json::parse(received_data); nlohmann::json smfcontext = nlohmann::json::parse(received_data);
scid_t scid = smfcontext["scid"]; scid_t scid = smfcontext["scid"];
std::shared_ptr<smf_context_ref> scf = {}; if (!smf_app_inst->is_scid_2_smf_context(scid)) {
if (smf_app_inst->is_scid_2_smf_context(scid)) {
scf = smf_app_inst->scid_2_smf_context(scid);
} else {
Logger::smf_app().warn("SM Context associated with this id " SCID_FMT " does not exit!", scid); Logger::smf_app().warn("SM Context associated with this id " SCID_FMT " does not exit!", scid);
std::shared_ptr<smf_context_ref> scf = std::shared_ptr<smf_context_ref>(new smf_context_ref()); std::shared_ptr<smf_context_ref> scf = std::shared_ptr<smf_context_ref>(new smf_context_ref());
// supi_t supi = smreq->req.get_supi(); // supi_t supi = smreq->req.get_supi();
...@@ -183,7 +181,7 @@ int udp_server_coop::udp_read_from_socket_to_center() { ...@@ -183,7 +181,7 @@ int udp_server_coop::udp_read_from_socket_to_center() {
//socklen_t addr_len; //socklen_t addr_len;
int udp_len; int udp_len;
size_t bytes_received = 0; size_t bytes_received = 0;
cout<<"start receive"<<endl; cout<<"start receive udp_read_from_socket_to_center"<<endl;
struct timeval time; struct timeval time;
while(1){ while(1){
...@@ -225,7 +223,7 @@ int udp_server_coop::udp_read_from_socket_from_center() { ...@@ -225,7 +223,7 @@ int udp_server_coop::udp_read_from_socket_from_center() {
//socklen_t addr_len; //socklen_t addr_len;
int udp_len; int udp_len;
size_t bytes_received = 0; size_t bytes_received = 0;
cout<<"start receive"<<endl; cout<<"start receive udp_read_from_socket_from_center"<<endl;
struct timeval time; struct timeval time;
while(1){ while(1){
......
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