Commit 1e775c88 authored by kharade's avatar kharade

get nwi info from upf profile

parent 139576b9
...@@ -1163,3 +1163,17 @@ bool smf_config::get_nwi_list_index( ...@@ -1163,3 +1163,17 @@ bool smf_config::get_nwi_list_index(
} }
return true; return true;
} }
//------------------------------------------------------------------------------
std::string smf_config::get_nwi(
const std::vector<interface_upf_info_item_t>& int_list,
const std::string& int_type) {
std::string nwi = {};
for (auto ui : int_list) {
if (!ui.interface_type.compare(int_type)) nwi = ui.network_instance;
}
Logger::smf_app().debug(
"Interface Type - %s, NWI - %s", int_type.c_str(), nwi.c_str());
return nwi;
}
//------------------------------------------------------------------------------
...@@ -329,6 +329,9 @@ class smf_config { ...@@ -329,6 +329,9 @@ class smf_config {
std::string get_default_dnn(); std::string get_default_dnn();
bool get_nwi_list_index( bool get_nwi_list_index(
bool nwi_enabled, uint8_t nwi_list_index, pfcp::node_id_t node_id); bool nwi_enabled, uint8_t nwi_list_index, pfcp::node_id_t node_id);
std::string get_nwi(
const std::vector<interface_upf_info_item_t>& int_list,
const std::string& int_type);
}; };
} // namespace smf } // namespace smf
......
...@@ -636,6 +636,25 @@ void smf_pdu_session::get_upf_node_id(pfcp::node_id_t& node_id) const { ...@@ -636,6 +636,25 @@ void smf_pdu_session::get_upf_node_id(pfcp::node_id_t& node_id) const {
pfcp::node_id_t smf_pdu_session::get_upf_node_id() const { pfcp::node_id_t smf_pdu_session::get_upf_node_id() const {
return upf_node_id; return upf_node_id;
} }
//-----------------------------------------------------------------------------
void smf_pdu_session::set_nwi_access(const std::string& nwiAccess) {
nwi_access = nwiAccess;
}
//-----------------------------------------------------------------------------
std::string smf_pdu_session::get_nwi_access() const {
return nwi_access;
}
//-----------------------------------------------------------------------------
void smf_pdu_session::set_nwi_core(const std::string& nwiCore) {
nwi_core = nwiCore;
}
//-----------------------------------------------------------------------------
std::string smf_pdu_session::get_nwi_core() const {
return nwi_core;
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
std::string smf_pdu_session::get_dnn() const { std::string smf_pdu_session::get_dnn() const {
......
...@@ -448,6 +448,34 @@ class smf_pdu_session : public std::enable_shared_from_this<smf_pdu_session> { ...@@ -448,6 +448,34 @@ class smf_pdu_session : public std::enable_shared_from_this<smf_pdu_session> {
*/ */
pdu_session_type_t get_pdu_session_type() const; pdu_session_type_t get_pdu_session_type() const;
/*
* Get NWI associated with this PDU Session
* @param void
* @return std::string: NWI
*/
std::string get_nwi_access() const;
/*
* Set DNN associated with this PDU Session
* @param [const std::string&] nwi: NWI
* @return void
*/
void set_nwi_access(const std::string& nwiAccess);
/*
* Get NWI associated with this PDU Session
* @param void
* @return std::string: NWI
*/
std::string get_nwi_core() const;
/*
* Set DNN associated with this PDU Session
* @param [const std::string&] nwi: NWI
* @return void
*/
void set_nwi_core(const std::string& nwiCore);
/* /*
* Set UPF Node ID of this PDU Session * Set UPF Node ID of this PDU Session
* @param [const pfcp::node_id_t&] node_id: UPF Node Id * @param [const pfcp::node_id_t&] node_id: UPF Node Id
...@@ -520,6 +548,9 @@ class smf_pdu_session : public std::enable_shared_from_this<smf_pdu_session> { ...@@ -520,6 +548,9 @@ class smf_pdu_session : public std::enable_shared_from_this<smf_pdu_session> {
std::string dnn; // associated DNN std::string dnn; // associated DNN
snssai_t snssai; // associated SNSSAI snssai_t snssai; // associated SNSSAI
std::string nwi_access; // associated nwi_access
std::string nwi_core; // associated nwi_core
pfcp::node_id_t upf_node_id; pfcp::node_id_t upf_node_id;
pdu_session_status_e pdu_session_status; pdu_session_status_e pdu_session_status;
......
...@@ -420,7 +420,8 @@ bool pfcp_associations::select_up_node( ...@@ -420,7 +420,8 @@ bool pfcp_associations::select_up_node(
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool pfcp_associations::select_up_node( bool pfcp_associations::select_up_node(
pfcp::node_id_t& node_id, const snssai_t& snssai, const std::string& dnn) { pfcp::node_id_t& node_id, const snssai_t& snssai, const std::string& dnn,
upf_info_t& upf_info) {
node_id = {}; node_id = {};
if (associations.empty()) { if (associations.empty()) {
Logger::smf_app().debug("No UPF available"); Logger::smf_app().debug("No UPF available");
...@@ -438,7 +439,6 @@ bool pfcp_associations::select_up_node( ...@@ -438,7 +439,6 @@ bool pfcp_associations::select_up_node(
} }
// else, verify that UPF belongs to the same slice and supports this dnn // else, verify that UPF belongs to the same slice and supports this dnn
std::vector<snssai_t> snssais = {}; std::vector<snssai_t> snssais = {};
upf_info_t upf_info = {};
a->get_upf_node_profile().get_upf_info(upf_info); a->get_upf_node_profile().get_upf_info(upf_info);
// UPF info // UPF info
......
...@@ -220,7 +220,8 @@ class pfcp_associations { ...@@ -220,7 +220,8 @@ class pfcp_associations {
bool select_up_node( bool select_up_node(
pfcp::node_id_t& node_id, const int node_selection_criteria); pfcp::node_id_t& node_id, const int node_selection_criteria);
bool select_up_node( bool select_up_node(
pfcp::node_id_t& node_id, const snssai_t& snssai, const std::string& dnn); pfcp::node_id_t& node_id, const snssai_t& snssai, const std::string& dnn,
upf_info_t& upf_info);
bool add_peer_candidate_node(const pfcp::node_id_t& node_id); bool add_peer_candidate_node(const pfcp::node_id_t& node_id);
bool add_peer_candidate_node( bool add_peer_candidate_node(
const pfcp::node_id_t& node_id, const upf_profile& profile); const pfcp::node_id_t& node_id, const upf_profile& profile);
......
...@@ -106,9 +106,10 @@ int session_create_sm_context_procedure::run( ...@@ -106,9 +106,10 @@ int session_create_sm_context_procedure::run(
snssai_t snssai = sm_context_req->req.get_snssai(); snssai_t snssai = sm_context_req->req.get_snssai();
std::string dnn = sm_context_req->req.get_dnn(); std::string dnn = sm_context_req->req.get_dnn();
pdu_session_id_t pdu_session_id = sm_context_req->req.get_pdu_session_id(); pdu_session_id_t pdu_session_id = sm_context_req->req.get_pdu_session_id();
upf_info_t upf_info = {};
if (not pfcp_associations::get_instance().select_up_node( if (not pfcp_associations::get_instance().select_up_node(
up_node_id, snssai, dnn)) { up_node_id, snssai, dnn, upf_info)) {
sm_context_resp->res.set_cause( sm_context_resp->res.set_cause(
PDU_SESSION_APPLICATION_ERROR_PEER_NOT_RESPONDING); PDU_SESSION_APPLICATION_ERROR_PEER_NOT_RESPONDING);
return RETURNerror; return RETURNerror;
...@@ -168,10 +169,13 @@ int session_create_sm_context_procedure::run( ...@@ -168,10 +169,13 @@ int session_create_sm_context_procedure::run(
//------------------- //-------------------
bool nwi_list_present = false; bool nwi_list_present = false;
uint8_t nwi_list_index = 0; uint8_t nwi_list_index = 0;
if (smf_cfg.get_nwi_list_index(nwi_list_present, nwi_list_index, up_node_id) & if ((smf_cfg.get_nwi_list_index(
nwi_list_present, nwi_list_index, up_node_id) ||
!upf_info.interface_upf_info_list.empty()) &
smf_cfg.use_nwi) smf_cfg.use_nwi)
nwi_list_present = true; nwi_list_present = true;
else
Logger::smf_app().debug("NWI (optional) config not found");
//******************* //*******************
// UPLINK // UPLINK
//******************* //*******************
...@@ -195,8 +199,13 @@ int session_create_sm_context_procedure::run( ...@@ -195,8 +199,13 @@ int session_create_sm_context_procedure::run(
if (nwi_list_present) { if (nwi_list_present) {
pfcp::network_instance_t network_instance = {}; pfcp::network_instance_t network_instance = {};
if (!upf_info.interface_upf_info_list.empty()) {
network_instance.network_instance =
smf_cfg.get_nwi(upf_info.interface_upf_info_list, "N6");
} else
network_instance.network_instance = network_instance.network_instance =
smf_cfg.upf_nwi_list[nwi_list_index].domain_core; smf_cfg.upf_nwi_list[nwi_list_index].domain_core;
sps.get()->set_nwi_core(network_instance.network_instance);
forwarding_parameters.set(network_instance); forwarding_parameters.set(network_instance);
} }
...@@ -249,7 +258,13 @@ int session_create_sm_context_procedure::run( ...@@ -249,7 +258,13 @@ int session_create_sm_context_procedure::run(
if (nwi_list_present) { if (nwi_list_present) {
pfcp::network_instance_t network_instance = {}; pfcp::network_instance_t network_instance = {};
network_instance.network_instance = smf_cfg.upf_nwi_list[0].domain_access; if (!upf_info.interface_upf_info_list.empty()) {
network_instance.network_instance =
smf_cfg.get_nwi(upf_info.interface_upf_info_list, "N3");
} else
network_instance.network_instance =
smf_cfg.upf_nwi_list[nwi_list_index].domain_access;
sps.get()->set_nwi_access(network_instance.network_instance);
pdi.set(network_instance); pdi.set(network_instance);
} }
...@@ -587,15 +602,6 @@ int session_update_sm_context_procedure::run( ...@@ -587,15 +602,6 @@ int session_update_sm_context_procedure::run(
} }
*/ */
//-------------------
// IE network instance
//-------------------
bool nwi_list_present = false;
uint8_t nwi_list_index = 0;
if (smf_cfg.get_nwi_list_index(nwi_list_present, nwi_list_index, up_node_id) &
smf_cfg.use_nwi)
nwi_list_present = true;
//------------------- //-------------------
n11_trigger = sm_context_req; n11_trigger = sm_context_req;
n11_triggered_pending = sm_context_resp; n11_triggered_pending = sm_context_resp;
...@@ -729,10 +735,9 @@ int session_update_sm_context_procedure::run( ...@@ -729,10 +735,9 @@ int session_update_sm_context_procedure::run(
destination_interface.interface_value = destination_interface.interface_value =
pfcp::INTERFACE_VALUE_ACCESS; // ACCESS is for downlink, CORE for pfcp::INTERFACE_VALUE_ACCESS; // ACCESS is for downlink, CORE for
// uplink // uplink
if (nwi_list_present) { if (smf_cfg.use_nwi) {
pfcp::network_instance_t network_instance = {}; pfcp::network_instance_t network_instance = {};
network_instance.network_instance = network_instance.network_instance = sps.get()->get_nwi_access();
smf_cfg.upf_nwi_list[0].domain_access;
forwarding_parameters.set(network_instance); forwarding_parameters.set(network_instance);
} }
forwarding_parameters.set(destination_interface); forwarding_parameters.set(destination_interface);
...@@ -787,11 +792,10 @@ int session_update_sm_context_procedure::run( ...@@ -787,11 +792,10 @@ int session_update_sm_context_procedure::run(
// pfcp::framed_routing_t framed_routing = {}; // pfcp::framed_routing_t framed_routing = {};
// pfcp::framed_ipv6_route_t framed_ipv6_route = {}; // pfcp::framed_ipv6_route_t framed_ipv6_route = {};
source_interface.interface_value = pfcp::INTERFACE_VALUE_CORE; source_interface.interface_value = pfcp::INTERFACE_VALUE_CORE;
if (nwi_list_present) { if (smf_cfg.use_nwi) {
pfcp::network_instance_t network_instance = pfcp::network_instance_t network_instance =
{}; // mandatory for travelping {}; // mandatory for travelping
network_instance.network_instance = network_instance.network_instance = sps.get()->get_nwi_core();
smf_cfg.upf_nwi_list[0].domain_core;
pdi.set(network_instance); pdi.set(network_instance);
} }
// local_fteid.from_core_fteid(qos_flow.qos_flow.dl_fteid); // local_fteid.from_core_fteid(qos_flow.qos_flow.dl_fteid);
...@@ -875,11 +879,10 @@ int session_update_sm_context_procedure::run( ...@@ -875,11 +879,10 @@ int session_update_sm_context_procedure::run(
precedence.precedence = flow.precedence.precedence; precedence.precedence = flow.precedence.precedence;
source_interface.interface_value = pfcp::INTERFACE_VALUE_CORE; source_interface.interface_value = pfcp::INTERFACE_VALUE_CORE;
if (nwi_list_present) { if (smf_cfg.use_nwi) {
pfcp::network_instance_t network_instance = pfcp::network_instance_t network_instance =
{}; // mandatory for travelping {}; // mandatory for travelping
network_instance.network_instance = network_instance.network_instance = sps.get()->get_nwi_core();
smf_cfg.upf_nwi_list[0].domain_core;
pdi.set(network_instance); pdi.set(network_instance);
} }
pdi.set(source_interface); pdi.set(source_interface);
......
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