Commit 803292a9 authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Add network-initiated service request procedure/ code cleanup

parent e20bc2a9
......@@ -300,7 +300,8 @@ class itti_n11_n1n2_message_transfer_response_status : public itti_n11_msg {
dest),
scid(0),
response_code(0),
msg_type(0) {
msg_type(0),
procedure_type(session_management_procedures_type_e::PROCEDURE_TYPE_UNKNOWN) {
}
itti_n11_n1n2_message_transfer_response_status(
const itti_n11_n1n2_message_transfer_response_status &i)
......@@ -308,7 +309,8 @@ class itti_n11_n1n2_message_transfer_response_status : public itti_n11_msg {
itti_n11_msg(i),
scid(i.scid),
response_code(i.response_code),
msg_type(i.msg_type) {
msg_type(i.msg_type),
procedure_type(i.procedure_type) {
}
itti_n11_n1n2_message_transfer_response_status(
const itti_n11_n1n2_message_transfer_response_status &i,
......@@ -317,7 +319,8 @@ class itti_n11_n1n2_message_transfer_response_status : public itti_n11_msg {
itti_n11_msg(i, orig, dest),
scid(i.scid),
response_code(i.response_code),
msg_type(i.msg_type) {
msg_type(i.msg_type),
procedure_type(i.procedure_type) {
}
const char* get_msg_name() {
return "N11_SESSION_N1N2_MESSAGE_TRANSFER_RESPONSE_STATUS";
......@@ -339,10 +342,15 @@ class itti_n11_n1n2_message_transfer_response_status : public itti_n11_msg {
msg_type = type;
}
;
void set_procedure_type(session_management_procedures_type_e type) {
procedure_type = type;
}
;
scid_t scid; //SM Context ID
int16_t response_code;
std::string cause;
uint8_t msg_type;
session_management_procedures_type_e procedure_type;
};
......@@ -396,8 +404,8 @@ class itti_n11_release_sm_context_request : public itti_n11_msg {
class itti_n11_release_sm_context_response : public itti_n11_msg {
public:
itti_n11_release_sm_context_response(const task_id_t orig,
const task_id_t dest,
Pistache::Http::ResponseWriter &response)
const task_id_t dest,
Pistache::Http::ResponseWriter &response)
:
itti_n11_msg(N11_SESSION_RELEASE_SM_CONTEXT_RESPONSE, orig, dest),
http_response(response.clone()),
......@@ -427,5 +435,30 @@ class itti_n11_release_sm_context_response : public itti_n11_msg {
};
//-----------------------------------------------------------------------------
class itti_n11_session_report_request : public itti_n11_msg {
public:
itti_n11_session_report_request(const task_id_t orig, const task_id_t dest)
:
itti_n11_msg(N11_SESSION_REPORT_RESPONSE, orig, dest),
res() {
}
itti_n11_session_report_request(const itti_n11_session_report_request &i)
:
itti_n11_msg(i) {
}
itti_n11_session_report_request(const itti_n11_session_report_request &i,
const task_id_t orig, const task_id_t dest)
:
itti_n11_msg(i, orig, dest),
res(i.res) {
}
const char* get_msg_name() {
return "N11_SESSION_REPORT_RESPONSE";
}
;
smf::pdu_session_report_response res;
};
#endif /* ITTI_MSG_N11_HPP_INCLUDED_ */
......@@ -109,22 +109,23 @@ enum class http_response_codes_e {
//From 23.502
enum class session_management_procedures_type_e {
PDU_SESSION_ESTABLISHMENT_UE_REQUESTED = 0,
SERVICE_REQUEST_UE_TRIGGERED_STEP1 = 1,
SERVICE_REQUEST_UE_TRIGGERED_STEP2 = 2,
SERVICE_REQUEST_NETWORK_TRIGGERED = 3,
PDU_SESSION_MODIFICATION_UE_INITIATED_STEP1 = 4,
PDU_SESSION_MODIFICATION_UE_INITIATED_STEP2 = 5,
PDU_SESSION_MODIFICATION_UE_INITIATED_STEP3 = 6,
PDU_SESSION_MODIFICATION_SMF_REQUESTED = 7,
PDU_SESSION_MODIFICATION_AN_REQUESTED = 8,
PDU_SESSION_RELEASE_UE_REQUESTED_STEP1 = 9,
PDU_SESSION_RELEASE_UE_REQUESTED_STEP2 = 10,
PDU_SESSION_RELEASE_UE_REQUESTED_STEP3 = 11,
PDU_SESSION_RELEASE_SMF_INITIATED = 12,
PDU_SESSION_RELEASE_AMF_INITIATED = 13,
PDU_SESSION_RELEASE_AN_INITIATED = 14,
PDU_SESSION_TEST = 15
PROCEDURE_TYPE_UNKNOWN = 0,
PDU_SESSION_ESTABLISHMENT_UE_REQUESTED = 1,
SERVICE_REQUEST_UE_TRIGGERED_STEP1 = 2,
SERVICE_REQUEST_UE_TRIGGERED_STEP2 = 3,
SERVICE_REQUEST_NETWORK_TRIGGERED = 4,
PDU_SESSION_MODIFICATION_UE_INITIATED_STEP1 = 5,
PDU_SESSION_MODIFICATION_UE_INITIATED_STEP2 = 6,
PDU_SESSION_MODIFICATION_UE_INITIATED_STEP3 = 7,
PDU_SESSION_MODIFICATION_SMF_REQUESTED = 8,
PDU_SESSION_MODIFICATION_AN_REQUESTED = 9,
PDU_SESSION_RELEASE_UE_REQUESTED_STEP1 = 10,
PDU_SESSION_RELEASE_UE_REQUESTED_STEP2 = 11,
PDU_SESSION_RELEASE_UE_REQUESTED_STEP3 = 12,
PDU_SESSION_RELEASE_SMF_INITIATED = 13,
PDU_SESSION_RELEASE_AMF_INITIATED = 14,
PDU_SESSION_RELEASE_AN_INITIATED = 15,
PDU_SESSION_TEST = 16
};
static const std::vector<std::string> session_management_procedures_type_e2str =
......@@ -190,9 +191,12 @@ static const std::vector<std::string> multipart_related_content_part_e2str = {
#define AMF_NUMBER_RETRIES 3
#define UDM_CURL_TIMEOUT_MS 100L
#define UDM_NUMBER_RETRIES 3
constexpr auto CURL_MIME_BOUNDARY = "----Boundary";
//for N1N2
#define BUF_LEN 512
//for PFCP
constexpr uint64_t SECONDS_SINCE_FIRST_EPOCH = 2208988800;
#endif
......@@ -116,6 +116,7 @@ typedef enum {
N11_SESSION_N1N2_MESSAGE_TRANSFER_RESPONSE_STATUS,
N11_SESSION_RELEASE_SM_CONTEXT_REQUEST,
N11_SESSION_RELEASE_SM_CONTEXT_RESPONSE,
N11_SESSION_REPORT_RESPONSE,
NX_TRIGGER_SESSION_MODIFICATION,
UDP_INIT,
UDP_DATA_REQ,
......
......@@ -383,28 +383,57 @@ void smf_app::handle_itti_msg(
Logger::smf_app().info("Process N1N2MessageTransfer Response");
//Update PDU Session accordingly
//TODO: to be completed (process cause)
pdu_session_status_e status = { pdu_session_status_e::PDU_SESSION_INACTIVE };
upCnx_state_e state = { upCnx_state_e::UPCNX_STATE_DEACTIVATED };
if ((static_cast<http_response_codes_e>(m.response_code)
== http_response_codes_e::HTTP_RESPONSE_CODE_OK)
or (static_cast<http_response_codes_e>(m.response_code)
== http_response_codes_e::HTTP_RESPONSE_CODE_ACCEPTED)) {
if (m.msg_type == PDU_SESSION_ESTABLISHMENT_REJECT) {
status = pdu_session_status_e::PDU_SESSION_INACTIVE;
} else if (m.msg_type == PDU_SESSION_ESTABLISHMENT_ACCEPT) {
status = pdu_session_status_e::PDU_SESSION_ESTABLISHMENT_PENDING;
state = upCnx_state_e::UPCNX_STATE_ACTIVATING;
switch (m.procedure_type) {
case session_management_procedures_type_e::PDU_SESSION_ESTABLISHMENT_UE_REQUESTED: {
pdu_session_status_e status =
{ pdu_session_status_e::PDU_SESSION_INACTIVE };
upCnx_state_e state = { upCnx_state_e::UPCNX_STATE_DEACTIVATED };
if ((static_cast<http_response_codes_e>(m.response_code)
== http_response_codes_e::HTTP_RESPONSE_CODE_OK)
or (static_cast<http_response_codes_e>(m.response_code)
== http_response_codes_e::HTTP_RESPONSE_CODE_ACCEPTED)) {
if (m.msg_type == PDU_SESSION_ESTABLISHMENT_REJECT) {
status = pdu_session_status_e::PDU_SESSION_INACTIVE;
} else if (m.msg_type == PDU_SESSION_ESTABLISHMENT_ACCEPT) {
status = pdu_session_status_e::PDU_SESSION_ESTABLISHMENT_PENDING;
state = upCnx_state_e::UPCNX_STATE_ACTIVATING;
}
update_pdu_session_status(m.scid, status);
update_pdu_session_upCnx_state(m.scid, state);
Logger::smf_app().debug(
"Got successful response from AMF (Response code %d), set session status to %s",
m.response_code,
pdu_session_status_e2str[static_cast<int>(status)].c_str());
} else {
//TODO:
Logger::smf_app().debug("Got response from AMF (Response code %d)",
m.response_code);
}
}
break;
case session_management_procedures_type_e::SERVICE_REQUEST_NETWORK_TRIGGERED: {
if ((static_cast<http_response_codes_e>(m.response_code)
== http_response_codes_e::HTTP_RESPONSE_CODE_OK)
or (static_cast<http_response_codes_e>(m.response_code)
== http_response_codes_e::HTTP_RESPONSE_CODE_ACCEPTED)) {
//TODO:
Logger::smf_app().debug(
"Got successful response from AMF (Response code %d)",
m.response_code);
} else {
//TODO:
Logger::smf_app().debug("Got response from AMF (Response code %d)",
m.response_code);
//send failure indication to UPF
}
}
break;
default: {
}
update_pdu_session_status(m.scid, status);
update_pdu_session_upCnx_state(m.scid, state);
Logger::smf_app().debug(
"Got successful response from AMF (Response code %d), set session status to %s",
m.response_code,
pdu_session_status_e2str[static_cast<int>(status)].c_str());
} else {
//TODO:
Logger::smf_app().debug("Got response from AMF (Response code %d)",
m.response_code);
}
}
......@@ -516,6 +545,7 @@ void smf_app::handle_pdu_session_create_sm_context_request(
//Get necessary information
supi_t supi = smreq->req.get_supi();
std::string supi_prefix = smreq->req.get_supi_prefix();
supi64_t supi64 = smf_supi_to_u64(supi);
std::string dnn = smreq->req.get_dnn();
snssai_t snssai = smreq->req.get_snssai();
......@@ -628,6 +658,7 @@ void smf_app::handle_pdu_session_create_sm_context_request(
"Create a new SMF context with SUPI " SUPI_64_FMT "", supi64);
sc = std::shared_ptr<smf_context>(new smf_context());
sc.get()->set_supi(supi);
sc.get()->set_supi_prefix(supi_prefix);
set_supi_2_smf_context(supi64, sc);
}
......@@ -894,10 +925,10 @@ void smf_app::handle_pdu_session_release_sm_context_request(
}
//------------------------------------------------------------------------------
void smf_app::trigger_pdu_session_modification(supi_t &supi, std::string &dnn,
pdu_session_id_t pdu_session_id,
snssai_t &snssai,
pfcp::qfi_t &qfi) {
void smf_app::trigger_pdu_session_modification(const supi_t &supi, const std::string &dnn,
const pdu_session_id_t pdu_session_id,
const snssai_t &snssai,
const pfcp::qfi_t &qfi) {
//SMF-requested session modification, see section 4.3.3.2@3GPP TS 23.502
//The SMF may decide to modify PDU Session. This procedure also may be
//triggered based on locally configured policy or triggered from the (R)AN (see clause 4.2.6 and clause 4.9.1).
......@@ -1007,22 +1038,22 @@ bool smf_app::use_local_configuration_subscription_data(
}
//------------------------------------------------------------------------------
bool smf_app::is_supi_dnn_snssai_subscription_data(supi_t &supi,
std::string &dnn,
snssai_t &snssai) {
bool smf_app::is_supi_dnn_snssai_subscription_data(const supi_t &supi,
const std::string &dnn,
const snssai_t &snssai) const {
//TODO: should be implemented
return false; //Session Management Subscription from UDM isn't available
}
//------------------------------------------------------------------------------
bool smf_app::is_create_sm_context_request_valid() {
bool smf_app::is_create_sm_context_request_valid() const {
//TODO: should be implemented
return true;
}
//---------------------------------------------------------------------------------------------
void smf_app::convert_string_2_hex(std::string &input_str,
void smf_app::convert_string_2_hex(const std::string &input_str,
std::string &output_str) {
Logger::smf_app().debug("Convert string to Hex");
unsigned char *data = (unsigned char*) malloc(input_str.length() + 1);
......@@ -1052,7 +1083,7 @@ void smf_app::convert_string_2_hex(std::string &input_str,
}
//---------------------------------------------------------------------------------------------
unsigned char* smf_app::format_string_as_hex(std::string &str) {
unsigned char* smf_app::format_string_as_hex(const std::string &str) {
unsigned int str_len = str.length();
char *data = (char*) malloc(str_len + 1);
memset(data, 0, str_len + 1);
......@@ -1192,7 +1223,7 @@ void smf_app::timer_t3591_timeout(timer_id_t timer_id, uint64_t arg2_user) {
}
//---------------------------------------------------------------------------------------------
n2_sm_info_type_e smf_app::n2_sm_info_type_str2e(std::string &n2_info_type) {
n2_sm_info_type_e smf_app::n2_sm_info_type_str2e(const std::string &n2_info_type) const {
std::size_t number_of_types = n2_sm_info_type_e2str.size();
for (auto i = 0; i < number_of_types; ++i) {
if (n2_info_type.compare(n2_sm_info_type_e2str[i]) == 0) {
......@@ -1202,7 +1233,7 @@ n2_sm_info_type_e smf_app::n2_sm_info_type_str2e(std::string &n2_info_type) {
}
bool smf_app::get_session_management_subscription_data(
supi64_t &supi, std::string &dnn, snssai_t &snssai,
const supi64_t &supi, const std::string &dnn, const snssai_t &snssai,
std::shared_ptr<session_management_subscription> subscription) {
Logger::smf_app().debug(
......
......@@ -392,16 +392,16 @@ class smf_app {
/*
* Trigger pdu session modification
* @param [supi_t &] supi
* @param [std::string &] dnn
* @param [pdu_session_id_t] pdu_session_id
* @param [snssai_t &] snssai
* @param [pfcp::qfi_t &] qfi
* @param [const supi_t &] supi
* @param [const std::string &] dnn
* @param [const pdu_session_id_t] pdu_session_id
* @param [const snssai_t &] snssai
* @param [const pfcp::qfi_t &] qfi
* @return void
*/
void trigger_pdu_session_modification(supi_t &supi, std::string &dnn,
pdu_session_id_t pdu_session_id,
snssai_t &snssai, pfcp::qfi_t &qfi);
void trigger_pdu_session_modification(const supi_t &supi, const std::string &dnn,
const pdu_session_id_t pdu_session_id,
const snssai_t &snssai, const pfcp::qfi_t &qfi);
/*
* Verify if SM Context is existed for this Supi
......@@ -412,7 +412,7 @@ class smf_app {
/*
* Create/Update SMF context with the corresponding supi
* @param [supi_t] supi
* @param [const supi_t&] supi
* @param [std::shared_ptr<smf_context>] sc Shared_ptr Pointer to an SMF context
* @return True if existed, otherwise false
*/
......@@ -428,7 +428,7 @@ class smf_app {
/*
* Check whether SMF uses local configuration instead of retrieving Session Management Data from UDM
* @param [std::string] dnn_selection_mode
* @param [const std::string&] dnn_selection_mode
* @return True if SMF uses the local configuration to check the validity of the UE request, False otherwise
*/
bool use_local_configuration_subscription_data(
......@@ -436,24 +436,25 @@ class smf_app {
/*
* Verify whether the Session Management Data is existed
* @param [supi_t] SUPI
* @param [std::string] DNN
* @param [snssai_t] S-NSSAI
* @param [const supi_t&] SUPI
* @param [const std::string&] DNN
* @param [const snssai_t&] S-NSSAI
* @return True if SMF uses the local configuration to check the validity of the UE request, False otherwise
*/
bool is_supi_dnn_snssai_subscription_data(supi_t &supi, std::string &dnn,
snssai_t &snssai);
bool is_supi_dnn_snssai_subscription_data(const supi_t &supi,
const std::string &dnn,
const snssai_t &snssai) const;
/*
* Get the Session Management Subscription data from local configuration
* @param [supi_t &] SUPI
* @param [std::string &] DNN
* @param [snssai_t &] S-NSSAI
* @param [std::shared_ptr<session_management_subscription>] subscription: store subscription data if exist
* @return True if local configuration for this session management subscription exists, False otherwise
*/
* Get the Session Management Subscription data from local configuration
* @param [const supi_t &] SUPI
* @param [const std::string &] DNN
* @param [const snssai_t &] S-NSSAI
* @param [std::shared_ptr<session_management_subscription>] subscription: store subscription data if exist
* @return True if local configuration for this session management subscription exists, False otherwise
*/
bool get_session_management_subscription_data(
supi64_t &supi, std::string &dnn, snssai_t &snssai,
const supi64_t &supi, const std::string &dnn, const snssai_t &snssai,
std::shared_ptr<session_management_subscription> subscription);
/*
......@@ -461,23 +462,23 @@ class smf_app {
* @param [..]
* @return True if the request is valid, otherwise False
*/
bool is_create_sm_context_request_valid();
bool is_create_sm_context_request_valid() const;
/*
* Convert a string to hex representing this string
* @param [std::string&] input_str Input string
* @param [const std::string&] input_str Input string
* @param [std::string&] output_str String represents string in hex format
* @return void
*/
void convert_string_2_hex(std::string &input_str, std::string &output_str);
void convert_string_2_hex(const std::string &input_str,
std::string &output_str);
/*
* Represent a string as hex
* @param [std::string&] str: input string
* @param [std::string&] output_str String represents string in hex format
* @return void
* @param [const std::string&] str: input string
* @return String represents string in hex format
*/
unsigned char* format_string_as_hex(std::string &str);
unsigned char* format_string_as_hex(const std::string &str);
/*
* Update PDU session status
......@@ -490,10 +491,10 @@ class smf_app {
/*
* Convert N2 Info type representing by a string to n2_sm_info_type_e
* @param [std::string] n2_info_type
* @param [const std::string] n2_info_type
* @return representing of N2 info type in a form of emum
*/
n2_sm_info_type_e n2_sm_info_type_str2e(std::string &n2_info_type);
n2_sm_info_type_e n2_sm_info_type_str2e(const std::string &n2_info_type) const;
/*
* Update PDU session UpCnxState
......
This diff is collapsed.
......@@ -328,10 +328,10 @@ class smf_pdu_session : public std::enable_shared_from_this<smf_pdu_session> {
/*
* Mark a QoS Rule to be synchronised with UE
* @param [uint8_t ]: rule_id: QoS Rule ID to be synchronised with UE
* @param [const uint8_t ]: rule_id: QoS Rule ID to be synchronised with UE
* @return void
*/
void mark_qos_rule_to_be_synchronised(uint8_t rule_id);
void mark_qos_rule_to_be_synchronised(const uint8_t rule_id);
/*
* Get all QoS Rules to be synchronised with UE
......@@ -363,7 +363,7 @@ class smf_pdu_session : public std::enable_shared_from_this<smf_pdu_session> {
* @param [QOSRulesIE &] qos_rule
* @return bool: Return true if Rule exist, otherwise return false
*/
bool get_qos_rule(uint8_t rule_id, QOSRulesIE &qos_rule) const;
bool get_qos_rule(const uint8_t rule_id, QOSRulesIE &qos_rule) const;
/*
* Update QoS Rule
......@@ -412,7 +412,7 @@ class smf_pdu_session : public std::enable_shared_from_this<smf_pdu_session> {
timer_id_t timer_T3591;
timer_id_t timer_T3592;
pfcp::qfi_t default_qfi; //Default QFI for this session
pfcp::qfi_t default_qfi; //Default QFI for this session
std::map<uint8_t, smf_qos_flow> qos_flows; // QFI <-> QoS Flow
std::map<uint8_t, QOSRulesIE> qos_rules; // QRI <-> QoS Rules
std::vector<uint8_t> qos_rules_to_be_synchronised;
......@@ -441,7 +441,8 @@ class session_management_subscription {
* @return void
*/
void insert_dnn_configuration(
const std::string &dnn, std::shared_ptr<dnn_configuration_t> &dnn_configuration);
const std::string &dnn,
std::shared_ptr<dnn_configuration_t> &dnn_configuration);
/*
* Find a DNN configuration
......@@ -450,7 +451,8 @@ class session_management_subscription {
* @return void
*/
void find_dnn_configuration(
const std::string &dnn, std::shared_ptr<dnn_configuration_t> &dnn_configuration) const;
const std::string &dnn,
std::shared_ptr<dnn_configuration_t> &dnn_configuration) const;
/*
* Verify whether DNN configuration with a given DNN exist
......@@ -509,7 +511,7 @@ class dnn_context {
* @param void
* @return size_t: number of PDU sessions
*/
size_t get_number_pdu_sessions();
size_t get_number_pdu_sessions() const;
/*
* Represent DNN Context as a string object
......@@ -536,6 +538,7 @@ class smf_context : public std::enable_shared_from_this<smf_context> {
pending_procedures(),
dnn_subscriptions(),
scid(0) {
supi_prefix = { };
}
smf_context(smf_context &b) = delete;
......@@ -663,11 +666,11 @@ class smf_context : public std::enable_shared_from_this<smf_context> {
/*
* Verify whether a subscription data exist with a given dnn and snssai
* @param [std::string &] dnn: DNN
* @param [const std::string &] dnn: DNN
* @param [const snssai_t&] snssai: single NSSAI
*@return bool: Return true if a subscription data corresponding with dnn and snssai exist, otherwise return false
*/
bool is_dnn_snssai_subscription_data(std::string &dnn, snssai_t &snssai);
bool is_dnn_snssai_subscription_data(const std::string &dnn, const snssai_t &snssai);
/*
* Find a session management subscription from a SMF context
......@@ -714,7 +717,7 @@ class smf_context : public std::enable_shared_from_this<smf_context> {
* @param
* @return std::size_t: the number of contexts
*/
std::size_t get_number_dnn_contexts();
std::size_t get_number_dnn_contexts() const;
/*
* Set SM Context ID
......@@ -730,9 +733,25 @@ class smf_context : public std::enable_shared_from_this<smf_context> {
*/
scid_t get_scid() const;
/*
* Get Supi prefix
* @param [const std::string &] prefix: Supi prefix (e.g., imsi)
* @return void
*/
void get_supi_prefix(std::string &prefix) const;
/*
* Get Supi prefix
* @param [const std::string &] prefix: Supi prefix (e.g., imsi)
* @return void
*/
void set_supi_prefix(std::string const &value);
/*
* Get the default QoS Rule for all QFIs
* @param [QOSRulesIE] qos_rule
* @param [const uint8_t] pdu_session_type: PDU session type (e.g., Ipv4, Ipv6)
* @return void
*/
void get_default_qos_rule(QOSRulesIE &qos_rule, uint8_t pdu_session_type);
......@@ -768,13 +787,26 @@ class smf_context : public std::enable_shared_from_this<smf_context> {
void get_session_ambr(Ngap_PDUSessionAggregateMaximumBitRate_t &session_ambr,
const snssai_t &snssai, const std::string &dnn);
/*
* Find the PDU Session, QFI associated with a given PDR_ID
* @param [const pfcp::pdr_id_t &] pdr_id: PDR ID
* @param [pfcp::qfi_t &] qfi: QFI
* @param [std::shared_ptr<dnn_context> &] sd: pointer to the DNN context
* @param [std::shared_ptr<smf_pdu_session> &] sp: pointer to the PDU session
* @return bool: return true if found, otherwise return false
*/
bool find_pdu_session(const pfcp::pdr_id_t &pdr_id, pfcp::qfi_t &qfi,
std::shared_ptr<dnn_context> &sd,
std::shared_ptr<smf_pdu_session> &sp);
private:
std::vector<std::shared_ptr<dnn_context>> dnns;
std::vector<std::shared_ptr<smf_procedure>> pending_procedures;
// snssai-sst <-> session management subscription
std::map<uint8_t, std::shared_ptr<session_management_subscription>> dnn_subscriptions;
supi_t supi;
scid_t scid; //SM Context ID
std::string supi_prefix;
scid_t scid; //SM Context ID
// Big recursive lock
mutable std::recursive_mutex m_context;
......
This diff is collapsed.
......@@ -124,23 +124,23 @@ class pdu_session_msg {
virtual ~pdu_session_msg() = default;
pdu_session_msg_type_t get_msg_type() const;
void set_msg_type(pdu_session_msg_type_t const &value);
void set_msg_type(const pdu_session_msg_type_t &value);
supi_t get_supi() const;
void set_supi(supi_t const &value);
void set_supi(const supi_t &value);
std::string get_supi_prefix() const;
void set_supi_prefix(std::string const &value);
void set_supi_prefix(const std::string &value);
pdu_session_id_t get_pdu_session_id() const;
void set_pdu_session_id(pdu_session_id_t const value);
void set_pdu_session_id(const pdu_session_id_t value);
std::string get_dnn() const;
void set_dnn(std::string const &value);
void set_dnn(const std::string &value);
snssai_t get_snssai() const;
void set_snssai(snssai_t const &value);
void set_api_root(std::string const &value);
void set_snssai(const snssai_t &value);
void set_api_root(const std::string &value);
std::string get_api_root() const;
uint8_t get_pdu_session_type() const;
void set_pdu_session_type(uint8_t const &pdu_session_type);
void set_pdu_session_type(const uint8_t &pdu_session_type);
procedure_transaction_id_t get_pti() const;
void set_pti(procedure_transaction_id_t const &pti);
void set_pti(const procedure_transaction_id_t &pti);
private:
pdu_session_msg_type_t m_msg_type;
......@@ -182,9 +182,9 @@ class pdu_session_create_sm_context : public pdu_session_msg {
}
extended_protocol_discriminator_t get_epd() const;
void set_epd(extended_protocol_discriminator_t const &epd);
void set_epd(const extended_protocol_discriminator_t &epd);
uint8_t get_message_type() const;
void set_message_type(uint8_t const &message_type);
void set_message_type(const uint8_t &message_type);
private:
extended_protocol_discriminator_t m_epd;
......@@ -210,12 +210,12 @@ class pdu_session_create_sm_context_request :
}
std::string get_n1_sm_message() const;
void set_n1_sm_message(std::string const &value);
void set_n1_sm_message(const std::string &value);
std::string get_serving_nf_id() const;
void set_serving_nf_id(std::string const &value);
void set_serving_nf_id(const std::string &value);
std::string get_request_type() const;
void set_request_type(std::string const &value);
void set_dnn_selection_mode(std::string const &value);
void set_request_type(const std::string &value);
void set_dnn_selection_mode(const std::string &value);
std::string get_dnn_selection_mode() const;
private:
......@@ -267,12 +267,12 @@ class pdu_session_create_sm_context_response :
void set_qos_flow_context(const qos_flow_context_updated &qos_flow);
qos_flow_context_updated get_qos_flow_context() const;
std::string get_n2_sm_information() const;
void set_n2_sm_information(std::string const &value);
void set_n2_sm_information(const std::string &value);
std::string get_n1_sm_message() const;
void set_n1_sm_message(std::string const &value);
void set_n1_sm_message(const std::string &value);
bool n1_sm_msg_is_set() const;
bool n2_sm_info_is_set() const;
void set_amf_url(std::string const &value);
void set_amf_url(const std::string &value);
std::string get_amf_url() const;
nlohmann::json n1n2_message_transfer_data; //N1N2MessageTransferReqData from oai::amf::model
......@@ -312,9 +312,9 @@ class pdu_session_update_sm_context : public pdu_session_msg {
std::string get_n2_sm_information() const;
void set_n2_sm_information(std::string const &value);
std::string get_n2_sm_info_type() const;
void set_n2_sm_info_type(std::string const &value);
void set_n2_sm_info_type(const std::string &value);
std::string get_n1_sm_message() const;
void set_n1_sm_message(std::string const &value);
void set_n1_sm_message(const std::string &value);
bool n1_sm_msg_is_set() const;
bool n2_sm_info_is_set() const;
......@@ -345,19 +345,19 @@ class pdu_session_update_sm_context_request :
}
;
void add_qfi(pfcp::qfi_t const &qfi);
void add_qfi(uint8_t const &qfi);
void add_qfi(const pfcp::qfi_t &qfi);
void add_qfi(const uint8_t &qfi);
void get_qfis(std::vector<pfcp::qfi_t> &q);
void set_dl_fteid(fteid_t const &t);
void set_dl_fteid(const fteid_t &t);
void get_dl_fteid(fteid_t &t);
void set_upCnx_state(std::string const &value);
void set_upCnx_state(const std::string &value);
bool upCnx_state_is_set() const;
void set_rat_type(std::string const &value);
void set_rat_type(const std::string &value);
bool rat_type_is_set() const;
void set_an_type(std::string const &value);
void set_an_type(const std::string &value);
bool an_type_is_set() const;
bool release_is_set() const;
void set_release(bool const value);
void set_release(bool value);
private:
std::vector<pfcp::qfi_t> qfis;
......@@ -456,10 +456,10 @@ class pdu_session_modification_network_requested :
void set_http_code(Pistache::Http::Code code);
Pistache::Http::Code get_http_code();
void set_amf_url(std::string const &value);
void set_amf_url(const std::string &value);
std::string get_amf_url() const;
void add_qfi(pfcp::qfi_t const &qfi);
void add_qfi(uint8_t const &qfi);
void add_qfi(const pfcp::qfi_t &qfi);
void add_qfi(const uint8_t &qfi);
void get_qfis(std::vector<pfcp::qfi_t> &q);
nlohmann::json n1n2_message_transfer_data; //N1N2MessageTransferReqData from oai::amf::model
......@@ -472,6 +472,55 @@ class pdu_session_modification_network_requested :
std::map<uint8_t, qos_flow_context_updated> qos_flow_context_updateds;
};
//---------------------------------------------------------------------------------------
class pdu_session_report_response : public pdu_session_msg {
public:
public:
pdu_session_report_response()
:
pdu_session_msg() {
m_n2_sm_info_is_set = false;
m_n1_sm_msg_is_set = false;
}
;
pdu_session_report_response(pdu_session_msg_type_t msg_type)
:
pdu_session_msg(msg_type) {
m_n2_sm_info_is_set = false;
m_n1_sm_msg_is_set = false;
}
;
void set_amf_url(std::string const &value);
std::string get_amf_url() const;
void add_qos_flow_context_updated(const qos_flow_context_updated &qos_flow);
bool get_qos_flow_context_updated(const pfcp::qfi_t &qfi,
qos_flow_context_updated &qos_flow);
void get_all_qos_flow_context_updateds(
std::map<uint8_t, qos_flow_context_updated> &all_flows);
std::string get_n2_sm_information() const;
void set_n2_sm_information(const std::string &value);
std::string get_n2_sm_info_type() const;
void set_n2_sm_info_type(const std::string &value);
std::string get_n1_sm_message() const;
void set_n1_sm_message(const std::string &value);
bool n1_sm_msg_is_set() const;
bool n2_sm_info_is_set() const;
nlohmann::json n1n2_message_transfer_data; //N1N2MessageTransferReqData from oai::amf::model
private:
supi_t m_supi;
std::string m_supi_prefix;
std::string amf_url;
std::map<uint8_t, qos_flow_context_updated> qos_flow_context_updateds;
std::string m_n1_sm_message;
bool m_n1_sm_msg_is_set;
std::string m_n2_sm_information;
bool m_n2_sm_info_is_set;
std::string m_n2_sm_info_type;
};
}
#endif
......@@ -101,7 +101,7 @@ smf_n10::smf_n10() {
//------------------------------------------------------------------------------
bool smf_n10::get_sm_data(
supi64_t &supi, std::string &dnn, snssai_t &snssai,
const supi64_t &supi, const std::string &dnn, const snssai_t &snssai,
std::shared_ptr<session_management_subscription> subscription) {
//retrieve a UE's Session Management Subscription Data (TS29503_Nudm_SDM.yaml: /{supi}/sm-data)
//use curl to send data for the moment
......@@ -114,7 +114,6 @@ bool smf_n10::get_sm_data(
headers = curl_slist_append(headers, "charsets: utf-8");
CURL *curl = curl_easy_init();
// std::string url = std::string(inet_ntoa (*((struct in_addr *)&smf_cfg.udm_addr.ipv4_addr))) + ":" + std::to_string(smf_cfg.udm_addr.port) + "/nudm-sdm/v2/" + std::to_string(supi) +"/sm-data";
std::string url = std::string(
inet_ntoa(*((struct in_addr*) &smf_cfg.udm_addr.ipv4_addr))) + ":"
+ std::to_string(smf_cfg.udm_addr.port)
......@@ -148,7 +147,6 @@ bool smf_n10::get_sm_data(
== http_response_codes_e::HTTP_RESPONSE_CODE_OK) {
Logger::smf_n10().debug("Got successful response from UDM, URL: %s ",
url.c_str());
//Logger::smf_n10().debug("[get_sm_data] Http Data from UDM: %s ", *httpData.get());
try {
jsonData = nlohmann::json::parse(*httpData.get());
//curl_easy_cleanup(curl);
......
......@@ -50,15 +50,15 @@ class smf_n10 {
/*
* Get SM subscription data from UDM
* @param [supi64_t &] supi
* @param [std::string &] dnn
* @param [snssai_t &] snssai
* @param [const supi64_t &] supi
* @param [const std::string &] dnn
* @param [const snssai_t &] snssai
* @param [std::shared_ptr<session_management_subscription>] subscription
* @return bool: True if successful, otherwise false
*
*/
bool get_sm_data(
supi64_t &supi, std::string &dnn, snssai_t &snssai,
const supi64_t &supi, const std::string &dnn, const snssai_t &snssai,
std::shared_ptr<session_management_subscription> subscription);
/*
......
This diff is collapsed.
......@@ -67,6 +67,14 @@ class smf_n11 {
void send_n1n2_message_transfer_request(
std::shared_ptr<itti_nx_trigger_pdu_session_modification> sm_context_res);
/*
* Send N1N2 Message Transfer Request to AMF
* @param [std::shared_ptr<itti_n11_session_report_request>] n11_msg: Content of message to be sent
* @return void
*/
void send_n1n2_message_transfer_request(
std::shared_ptr<itti_n11_session_report_request> report_msg);
/*
* Send update session response to AMF
* @param [std::shared_ptr<itti_n11_update_sm_context_response> sm_context_res] sm_context_res
......@@ -86,75 +94,75 @@ class smf_n11 {
/*
* Send update session response to AMF
* @param [Pistache::Http::ResponseWriter] httpResponse
* @param [ oai::smf_server::model::SmContextUpdateError] SmContextUpdateError
* @param [const oai::smf_server::model::SmContextUpdateError] SmContextUpdateError
* @param [Pistache::Http::Code] code, response code
* @return void
*/
void send_pdu_session_update_sm_context_response(
Pistache::Http::ResponseWriter &httpResponse,
oai::smf_server::model::SmContextUpdateError &smContextUpdateError,
const oai::smf_server::model::SmContextUpdateError &smContextUpdateError,
Pistache::Http::Code code);
/*
* Send Update session response to AMF
* @param [Pistache::Http::ResponseWriter] httpResponse
* @param [ oai::smf_server::model::SmContextUpdatedData] smContextUpdatedData
* @param [const oai::smf_server::model::SmContextUpdatedData] smContextUpdatedData
* @param [Pistache::Http::Code] code, response code
* @return void
*/
void send_pdu_session_update_sm_context_response(
Pistache::Http::ResponseWriter &httpResponse,
oai::smf_server::model::SmContextUpdatedData &smContextUpdatedData,
const oai::smf_server::model::SmContextUpdatedData &smContextUpdatedData,
Pistache::Http::Code code);
/*
* Send create session response to AMF
* @param [Pistache::Http::ResponseWriter] httpResponse
* @param [ oai::smf_server::model::SmContextCreateError] smContextCreateError
* @param [const oai::smf_server::model::SmContextCreateError] smContextCreateError
* @param [Pistache::Http::Code] code, response code
* @return void
*/
void send_pdu_session_create_sm_context_response(
Pistache::Http::ResponseWriter &httpResponse,
oai::smf_server::model::SmContextCreateError &smContextCreateError,
const oai::smf_server::model::SmContextCreateError &smContextCreateError,
Pistache::Http::Code code);
/*
* Send create session response to AMF
* @param [Pistache::Http::ResponseWriter] httpResponse
* @param [ oai::smf_server::model::SmContextCreateError] smContextCreateError
* @param [const oai::smf_server::model::SmContextCreateError] smContextCreateError
* @param [Pistache::Http::Code] code, response code
* @param [std::string] n1_sm_msg, N1 SM message content
* @return void
*/
void send_pdu_session_create_sm_context_response(
Pistache::Http::ResponseWriter &httpResponse,
oai::smf_server::model::SmContextCreateError &smContextCreateError,
const oai::smf_server::model::SmContextCreateError &smContextCreateError,
Pistache::Http::Code code, std::string &n1_sm_msg);
/*
* Send update session response to AMF
* @param [Pistache::Http::ResponseWriter] httpResponse
* @param [ oai::smf_server::model::SmContextUpdateError] smContextUpdateError
* @param [const oai::smf_server::model::SmContextUpdateError] smContextUpdateError
* @param [Pistache::Http::Code] code, response code
* @param [std::string] n1_sm_msg, N1 SM message content
* @return void
*/
void send_pdu_session_update_sm_context_response(
Pistache::Http::ResponseWriter &httpResponse,
oai::smf_server::model::SmContextUpdateError &smContextUpdateError,
const oai::smf_server::model::SmContextUpdateError &smContextUpdateError,
Pistache::Http::Code code, std::string &n1_sm_msg);
/*
* Send create session response to AMF
* @param [Pistache::Http::ResponseWriter] httpResponse
* @param [ oai::smf_server::model::SmContextCreatedData] smContextCreatedData
* @param [const oai::smf_server::model::SmContextCreatedData] smContextCreatedData
* @param [Pistache::Http::Code] code, response code
* @return void
*/
void send_pdu_session_create_sm_context_response(
Pistache::Http::ResponseWriter &httpResponse,
oai::smf_server::model::SmContextCreatedData &smContextCreatedData,
const oai::smf_server::model::SmContextCreatedData &smContextCreatedData,
Pistache::Http::Code code);
/*
......@@ -169,13 +177,13 @@ class smf_n11 {
/*
* Send release session response to AMF
* @param [Pistache::Http::ResponseWriter] httpResponse
* @param [oai::smf_server::model::ProblemDetails] problem
* @param [const oai::smf_server::model::ProblemDetails] problem
* @param [Pistache::Http::Code] code, response code
* @return void
*/
void send_pdu_session_release_sm_context_response(
Pistache::Http::ResponseWriter &httpResponse,
oai::smf_server::model::ProblemDetails &problem,
const oai::smf_server::model::ProblemDetails &problem,
Pistache::Http::Code code);
/*
......@@ -188,10 +196,10 @@ class smf_n11 {
* @return void
*/
void create_multipart_related_content(std::string &body,
std::string &json_part,
std::string &boundary,
std::string &n1_message,
std::string &n2_message);
const std::string &json_part,
const std::string boundary,
const std::string &n1_message,
const std::string &n2_message);
/*
* Create HTTP body content for multipart/related message
......@@ -203,8 +211,8 @@ class smf_n11 {
* @return void
*/
void create_multipart_related_content(
std::string &body, std::string &json_part, std::string &boundary,
std::string &message, multipart_related_content_part_e content_type);
std::string &body, const std::string &json_part, const std::string boundary,
const std::string &message, const multipart_related_content_part_e content_type);
};
......
......@@ -1554,7 +1554,7 @@ void smf_n1_n2::create_n2_sm_information(pdu_session_msg &msg,
//------------------------------------------------------------------------------
int smf_n1_n2::decode_n1_sm_container(nas_message_t &nas_msg,
std::string &n1_sm_msg) {
const std::string &n1_sm_msg) {
Logger::smf_app().info("Decode NAS message from N1 SM Container.");
//step 1. Decode NAS message (for instance, ... only served as an example)
......@@ -1592,7 +1592,7 @@ int smf_n1_n2::decode_n1_sm_container(nas_message_t &nas_msg,
//---------------------------------------------------------------------------------------------
int smf_n1_n2::decode_n2_sm_information(
std::shared_ptr<Ngap_PDUSessionResourceSetupResponseTransfer_t> &ngap_IE,
std::string &n2_sm_info) {
const std::string &n2_sm_info) {
Logger::smf_app().info(
"Decode NGAP message (PDUSessionResourceSetupResponseTransfer) from N2 SM Information");
unsigned int data_len = n2_sm_info.length();
......@@ -1627,7 +1627,7 @@ int smf_n1_n2::decode_n2_sm_information(
//---------------------------------------------------------------------------------------------
int smf_n1_n2::decode_n2_sm_information(
std::shared_ptr<Ngap_PDUSessionResourceModifyResponseTransfer_t> &ngap_IE,
std::string &n2_sm_info) {
const std::string &n2_sm_info) {
Logger::smf_app().info(
"Decode NGAP message (Ngap_PDUSessionResourceModifyResponseTransfer) from N2 SM Information");
......@@ -1657,7 +1657,7 @@ int smf_n1_n2::decode_n2_sm_information(
//---------------------------------------------------------------------------------------------
int smf_n1_n2::decode_n2_sm_information(
std::shared_ptr<Ngap_PDUSessionResourceReleaseResponseTransfer_t> &ngap_IE,
std::string &n2_sm_info) {
const std::string &n2_sm_info) {
Logger::smf_app().info(
"Decode NGAP message (Ngap_PDUSessionResourceReleaseResponseTransfer) from N2 SM Information");
......@@ -1689,7 +1689,7 @@ int smf_n1_n2::decode_n2_sm_information(
//---------------------------------------------------------------------------------------------
int smf_n1_n2::decode_n2_sm_information(
std::shared_ptr<Ngap_PDUSessionResourceSetupUnsuccessfulTransfer_t> &ngap_IE,
std::string &n2_sm_info) {
const std::string &n2_sm_info) {
Logger::smf_app().info(
"Decode NGAP message (Ngap_PDUSessionResourceSetupUnsuccessfulTransfer) from N2 SM Information");
......
......@@ -98,20 +98,20 @@ class smf_n1_n2 {
/*
* Decode N1 SM Container into the NAS mesasge (using NAS lib)
* @param [nas_message_t&] nas_msg Store NAS message after decoded
* @param [std::string&] n1_sm_msg N1 SM Container from AMF
* @param [const std::string&] n1_sm_msg N1 SM Container
* @return status of the decode process
*/
int decode_n1_sm_container(nas_message_t &nas_msg, std::string &n1_sm_msg);
int decode_n1_sm_container(nas_message_t &nas_msg, const std::string &n1_sm_msg);
/*
* Decode N2 SM Information Ngap_PDUSessionResourceSetupResponseTransfer
* @param [std::shared_ptr<Ngap_PDUSessionResourceSetupResponseTransfer_t>&] ngap_IE Store decoded NGAP message
* @param [std::string&] n2_sm_info N2 SM Information
* @param [const std::string&] n2_sm_info N2 SM Information
* @return status of the decode process
*/
int decode_n2_sm_information(
std::shared_ptr<Ngap_PDUSessionResourceSetupResponseTransfer_t> &ngap_IE,
std::string &n2_sm_info);
const std::string &n2_sm_info);
/*
* Decode N2 SM Information Ngap_PDUSessionResourceModifyResponseTransfer_t
......@@ -121,7 +121,7 @@ class smf_n1_n2 {
*/
int decode_n2_sm_information(
std::shared_ptr<Ngap_PDUSessionResourceModifyResponseTransfer_t> &ngap_IE,
std::string &n2_sm_info);
const std::string &n2_sm_info);
/*
* Decode N2 SM Information Ngap_PDUSessionResourceReleaseResponseTransfer_t
......@@ -131,7 +131,7 @@ class smf_n1_n2 {
*/
int decode_n2_sm_information(
std::shared_ptr<Ngap_PDUSessionResourceReleaseResponseTransfer_t> &ngap_IE,
std::string &n2_sm_info);
const std::string &n2_sm_info);
/*
* Decode N2 SM Information Ngap_PDUSessionResourceSetupUnsuccessfulTransfer
......@@ -141,7 +141,7 @@ class smf_n1_n2 {
*/
int decode_n2_sm_information(
std::shared_ptr<Ngap_PDUSessionResourceSetupUnsuccessfulTransfer_t> &ngap_IE,
std::string &n2_sm_info);
const std::string &n2_sm_info);
};
......
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