Commit 3803303c authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen
Browse files

get PAA from session subscription

parent 3950badb
......@@ -1091,15 +1091,16 @@ void pgw_context::handle_amf_msg (std::shared_ptr<pdu_session_create_sm_context_
bool paa_res = false; //how to define static or dynamic
//depend of subscription information: staticIpAddress in DNN Configuration
//TODO: check static IP address is available in the subscription information (SessionManagementSubscription) or in DHCP/DN-AAA
/*
std::shared_ptr<session_management_subscription> ss;
sd.get()->find_dnn_subscription(snssai.sST, ss);
if (nullptr != ss.get()){
//ss.get()->
}
*/
//TODO: set value for paa
paa.pdn_type.pdn_type = PDN_TYPE_E_IPV4;
std::shared_ptr<session_management_subscription> ss;
std::shared_ptr<dnn_configuration_t> sdc;
sd.get()->find_dnn_subscription(snssai, ss);
if (nullptr != ss.get()){
ss.get()->find_dnn_configuration(sd->dnn_in_use, sdc);
if (nullptr != sdc.get()){
paa.pdn_type.pdn_type = sdc.get()->pdu_session_types.default_session_type.pdu_session_type;
}
}
if ((not paa_res) || (not paa.is_ip_assigned())) {
bool success = paa_dynamic::get_instance().get_free_paa(sd->dnn_in_use, paa);
......@@ -1288,15 +1289,14 @@ void dnn_context::insert_pdn_connection(std::shared_ptr<pgw_pdn_connection>& sp)
//------------------------------------------------------------------------------
void session_management_subscription::insert_dnn_configuration(std::string dnn, dnn_configuration_t dnn_configuration){
dnn_configurations.insert(std::pair<std::string, dnn_configuration_t>(dnn,dnn_configuration));
void session_management_subscription::insert_dnn_configuration(std::string dnn, std::shared_ptr<dnn_configuration_t>& dnn_configuration){
dnn_configurations.insert(std::pair<std::string, std::shared_ptr<dnn_configuration_t>>(dnn,dnn_configuration));
}
//------------------------------------------------------------------------------
dnn_configuration_t session_management_subscription::get_dnn_configuration(std::string dnn){
void session_management_subscription::find_dnn_configuration(std::string dnn, std::shared_ptr<dnn_configuration_t>& dnn_configuration){
if (dnn_configurations.count(dnn) > 0){
return dnn_configurations.at(dnn);
} else
return dnn_configuration_t();
dnn_configuration = dnn_configurations.at(dnn);
}
}
......@@ -284,11 +284,11 @@ public:
class session_management_subscription {
public:
session_management_subscription(snssai_t snssai): single_nssai(snssai), dnn_configurations() {}
void insert_dnn_configuration(std::string dnn, dnn_configuration_t dnn_configuration);
dnn_configuration_t get_dnn_configuration(std::string dnn);
void insert_dnn_configuration(std::string dnn, std::shared_ptr<dnn_configuration_t>& dnn_configuration);
void find_dnn_configuration(std::string dnn, std::shared_ptr<dnn_configuration_t>& dnn_configuration);
private:
snssai_t single_nssai;
std::map <std::string, dnn_configuration_t> dnn_configurations;
std::map <std::string, std::shared_ptr<dnn_configuration_t>> dnn_configurations;
};
/*
......
......@@ -187,7 +187,10 @@ bool smf_n10::get_sm_data(supi64_t& supi, std::string& dnn, snssai_t& snssai, st
//retrieve SessionManagementSubscription and store in the context
for (nlohmann::json::iterator it = jsonData["dnnConfigurations"].begin(); it != jsonData["dnnConfigurations"].end(); ++it ){
Logger::smf_n10().debug("[get_sm_data] DNN %s", it.key().c_str());
dnn_configuration_t dnn_configuration;
dnn_configuration_t *dnn_configuration = new (dnn_configuration_t);
std::shared_ptr<dnn_configuration_t> sdc;
//subscription->find_dnn_configuration(it.key(), sdc);
try {
//PDU Session Type
......@@ -201,26 +204,27 @@ bool smf_n10::get_sm_data(supi64_t& supi, std::string& dnn, snssai_t& snssai, st
} else if (default_session_type.compare("IPV4V6") == 0) {
pdu_session_type.pdu_session_type = pdu_session_type_e::PDU_SESSION_TYPE_E_IPV4V6;
}
dnn_configuration.pdu_session_types.default_session_type = pdu_session_type;
dnn_configuration->pdu_session_types.default_session_type = pdu_session_type;
//Ssc_Mode
ssc_mode_t ssc_mode(ssc_mode_e::SSC_MODE_1);
std::string default_ssc_mode = it.value()["sscModes"]["defaultSscMode"];
Logger::smf_n10().debug("[get_sm_data] defaultSscMode %s", default_ssc_mode.c_str());
if (default_ssc_mode.compare("SSC_MODE_1") == 0) {
dnn_configuration.ssc_modes.default_ssc_mode = ssc_mode_t(ssc_mode_e::SSC_MODE_1);
dnn_configuration->ssc_modes.default_ssc_mode = ssc_mode_t(ssc_mode_e::SSC_MODE_1);
} else if (default_ssc_mode.compare("SSC_MODE_2") == 0) {
dnn_configuration.ssc_modes.default_ssc_mode = ssc_mode_t(ssc_mode_e::SSC_MODE_2);
dnn_configuration->ssc_modes.default_ssc_mode = ssc_mode_t(ssc_mode_e::SSC_MODE_2);
} else if (default_ssc_mode.compare("SSC_MODE_3") == 0) {
dnn_configuration.ssc_modes.default_ssc_mode = ssc_mode_t(ssc_mode_e::SSC_MODE_3);
dnn_configuration->ssc_modes.default_ssc_mode = ssc_mode_t(ssc_mode_e::SSC_MODE_3);
}
//session_ambr
dnn_configuration.session_ambr.uplink = it.value()["sessionAmbr"]["uplink"];
dnn_configuration.session_ambr.downlink = it.value()["sessionAmbr"]["downlink"];
Logger::smf_n10().debug("[get_sm_data] sessionAmbr uplink %s, downlink %s", dnn_configuration.session_ambr.uplink.c_str(), dnn_configuration.session_ambr.downlink.c_str());
dnn_configuration->session_ambr.uplink = it.value()["sessionAmbr"]["uplink"];
dnn_configuration->session_ambr.downlink = it.value()["sessionAmbr"]["downlink"];
Logger::smf_n10().debug("[get_sm_data] sessionAmbr uplink %s, downlink %s", dnn_configuration->session_ambr.uplink.c_str(), dnn_configuration->session_ambr.downlink.c_str());
subscription->insert_dnn_configuration(it.key(), dnn_configuration);
sdc = std::shared_ptr<dnn_configuration_t> (dnn_configuration);
subscription->insert_dnn_configuration(it.key(), sdc);
} catch (nlohmann::json::exception& e){
Logger::smf_n10().warn("[get_sm_data] exception message %s, exception id %d ", e.what(), e.id);
return false;
......
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