Commit 21a4a9a9 authored by liuyu's avatar liuyu

sync partial ^Cntext

parent 0de64c70
......@@ -31,8 +31,8 @@ SMF =
N4 :
{
# SMF binded interface for N4 communication (UPF)
INTERFACE_NAME = "lo"; # YOUR NETWORK CONFIG HERE
IPV4_ADDRESS = "127.0.0.100/8";
INTERFACE_NAME = "ens18"; # YOUR NETWORK CONFIG HERE
IPV4_ADDRESS = "read";
};
SBI :
......@@ -138,7 +138,7 @@ SMF =
UPF_LIST = (
{
IPV4_ADDRESS = "127.0.0.101";
IPV4_ADDRESS = "10.103.238.93";
FQDN = "UPF";
NWI_LIST = (
{
......
......@@ -744,6 +744,7 @@ smf_procedure_code session_create_sm_context_procedure::run(
udpsmfcontext["pdu_session_id"] = scf.get()->pdu_session_id;
udpsmfcontext["dnn"] = dnn;
udpsmfcontext["snssai"] = snssai.toString();
udpsmfcontext["pdu_session_type"] = sm_context_req->req.get_pdu_session_type();
......
......@@ -179,6 +179,13 @@ int udp_server_coop::udp_read_from_peer_smf() {
}
std::shared_ptr<smf_pdu_session> sp = {};
if (!sc.get()->find_pdu_session(scf.get()->pdu_session_id, sp)) {
Logger::smf_app().debug("Create a new PDU session");
sp = std::shared_ptr<smf_pdu_session>(new smf_pdu_session(scf.get()->pdu_session_id));
sp.get()->pdu_session_type.pdu_session_type = smfcontext["pdu_session_type"];
sc.get()->add_pdu_session(scf.get()->pdu_session_id, sp);
}
std::string dnn = smfcontext["dnn"];
snssai_t snssai = {};
std::string sstsd = smfcontext["snssai"];
......@@ -190,18 +197,108 @@ int udp_server_coop::udp_read_from_peer_smf() {
if (sdPos != std::string::npos) {
snssai.sd = std::stoi(sstsd.substr(sdPos + 3));
}
std::shared_ptr<session_management_subscription> subscription =
std::shared_ptr<session_management_subscription>(
new session_management_subscription(snssai));
if (smf_app_inst->get_session_management_subscription_data(supi64, dnn, snssai, subscription)) {
// update dnn_context with subscription info
sc.get()->insert_dnn_subscription(snssai, dnn, subscription);
}
std::shared_ptr<upf_graph> graph = {};
graph = pfcp_associations::get_instance().select_up_node(snssai, dnn);
subscribed_default_qos_t default_qos = {};
std::shared_ptr<session_management_subscription> ss = {};
sc->get_default_qos(snssai, dnn, default_qos);
// Create default QoS (Non-GBR) and associate far id and pdr id to this flow
smf_qos_flow flow = {};
flow.pdu_session_id = scf.get()->pdu_session_id;
// default QoS profile
flow.qfi.qfi = default_qos._5qi;
flow.qos_profile._5qi = default_qos._5qi;
flow.qos_profile.arp = default_qos.arp;
flow.qos_profile.priority_level = default_qos.priority_level;
// assign default QoS rule for this flow
QOSRulesIE qos_rule = {};
sc->get_default_qos_rule(qos_rule, sp.get()->pdu_session_type.pdu_session_type);
uint8_t rule_id = {0};
sp->generate_qos_rule_id(rule_id);
qos_rule.qosruleidentifer = rule_id;
qos_rule.qosflowidentifer = flow.qfi.qfi;
sp->add_qos_rule(qos_rule);
sp->add_qos_flow(flow);
sp->set_default_qos_flow(flow.qfi);
smf_qos_flow current_flow{};
current_flow = flow;
Logger::smf_app().warn("----------liuyu-------start_asynch_dfs_procedure");
graph->start_asynch_dfs_procedure(true, flow);
std::vector<edge> dl_edges;
std::vector<edge> ul_edges;
std::shared_ptr<pfcp_association> upf = {};
// Get next UPF for the first N4 session establishment
Logger::smf_app().warn("----------liuyu-------dfs_next_upf");
graph->dfs_next_upf(dl_edges, ul_edges, upf);
if (!sc.get()->find_pdu_session(scf.get()->pdu_session_id, sp)) {
Logger::smf_app().debug("Create a new PDU session");
sp = std::shared_ptr<smf_pdu_session>(new smf_pdu_session(scf.get()->pdu_session_id));
// sp.get()->pdu_session_type.pdu_session_type = smreq->req.get_pdu_session_type();
sp.get()->set_dnn(dnn);
sp.get()->set_snssai(snssai);
sp.get()->set_sessions_graph(graph);
sc.get()->add_pdu_session(scf.get()->pdu_session_id, sp);
}
// 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");
// }
// }
......
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