Commit 9c9b9f84 authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

update N11/N10 and SMF messages

parent 2870865c
This diff is collapsed.
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include "3gpp_29.244.h" #include "3gpp_29.244.h"
#include "3gpp_24.007.h" #include "3gpp_24.007.h"
#include "3gpp_24.501.h" #include "3gpp_24.501.h"
#include "3gpp_29.571.h"
#include "Guami.h" #include "Guami.h"
#include "RefToBinaryData.h" #include "RefToBinaryData.h"
#include "NgRanTargetId.h" #include "NgRanTargetId.h"
...@@ -57,13 +58,30 @@ public: ...@@ -57,13 +58,30 @@ public:
void set_cause(const uint8_t cause); void set_cause(const uint8_t cause);
void set_qfi(const pfcp::qfi_t& q); void set_qfi(const pfcp::qfi_t& q);
void set_ul_fteid(const fteid_t& teid); void set_ul_fteid(const fteid_t& teid);
void set_arp(const arp_5gc_t& a);
void set_priority_level (uint8_t p);
private:
uint8_t cause_value; uint8_t cause_value;
pfcp::qfi_t qfi; pfcp::qfi_t qfi;
fteid_t ul_fteid; fteid_t ul_fteid;
arp_5gc_t arp;
uint8_t priority_level;//1-127
}; };
class qos_flow_context_modified {
public:
void set_cause(const uint8_t cause);
void set_qfi(const pfcp::qfi_t& q);
void set_ul_fteid(const fteid_t& teid);
uint8_t cause_value;
pfcp::qfi_t qfi;
fteid_t ul_fteid;
};
class pdu_session_msg { class pdu_session_msg {
public: public:
pdu_session_msg(){}; pdu_session_msg(){};
...@@ -249,8 +267,26 @@ public: ...@@ -249,8 +267,26 @@ public:
paa_t get_paa(); paa_t get_paa();
void set_http_code(Pistache::Http::Code code); void set_http_code(Pistache::Http::Code code);
Pistache::Http::Code get_http_code(); Pistache::Http::Code get_http_code();
void set_qos_flow_context(const qos_flow_context_created qos_flow); void set_qos_flow_context(const qos_flow_context_created& qos_flow);
qos_flow_context_created get_qos_flow_context() const;
nlohmann::json n1n2_message_transfer_data; //N1N2MessageTransferReqData from oai::amf::model
std::string get_n2_sm_information() const;
void set_n2_sm_information(std::string const& value);
std::string get_n1_sm_message() const;
void set_n1_sm_message(std::string const& value);
bool n1_sm_msg_is_set() const;
bool n2_sm_info_is_set() const;
std::string n1_sm_message; //N1 SM message
bool m_n1_sm_msg_is_set;
std::string n2_sm_information; //N2 SM info
bool m_n2_sm_info_is_set;
void set_amf_url(std::string const& value);
std::string get_amf_url() const;
private: private:
uint8_t m_cause; uint8_t m_cause;
paa_t m_paa; paa_t m_paa;
...@@ -258,6 +294,7 @@ private: ...@@ -258,6 +294,7 @@ private:
qos_flow_context_created qos_flow_context; qos_flow_context_created qos_flow_context;
supi_t m_supi; supi_t m_supi;
std::string m_supi_prefix; std::string m_supi_prefix;
std::string amf_url;
/* PDU Session establishment accept /* PDU Session establishment accept
ExtendedProtocolDiscriminator extendedprotocoldiscriminator; ExtendedProtocolDiscriminator extendedprotocoldiscriminator;
...@@ -298,17 +335,42 @@ private: ...@@ -298,17 +335,42 @@ private:
}; };
//see SmContextUpdateData (TS29502_Nsmf_PDUSession.yaml) //see SmContextUpdateData (TS29502_Nsmf_PDUSession.yaml)
class pdu_session_update_sm_context_request: public pdu_session_msg { class pdu_session_update_sm_context_request: public pdu_session_msg {
public: public:
pdu_session_update_sm_context_request(): pdu_session_msg(PDU_SESSION_UPDATE_SM_CONTEXT_REQUEST){ }; pdu_session_update_sm_context_request(): pdu_session_msg(PDU_SESSION_UPDATE_SM_CONTEXT_REQUEST){
m_n1_sm_msg_is_set = false;
m_n2_sm_info_is_set = false;
m_5gMm_cause_value = 0;
m_data_forwarding = false;
};
std::string get_n2_sm_information() const; std::string get_n2_sm_information() const;
void set_n2_sm_information(std::string const& value); void set_n2_sm_information(std::string const& value);
std::string get_n2_sm_info_type() const; std::string get_n2_sm_info_type() const;
void set_n2_sm_info_type(std::string const& value); void set_n2_sm_info_type(std::string const& value);
std::string get_n1_sm_message() const;
void set_n1_sm_message(std::string const& value);
bool n1_sm_msg_is_set() const;
bool n2_sm_info_is_set() const;
void add_qfi(pfcp::qfi_t const& qfi);
void get_qfis(std::vector<pfcp::qfi_t>& q);
void set_dl_fteid(fteid_t const& t);
void get_dl_fteid(fteid_t& t);
void set_upCnx_state(std::string const& value);
bool upCnx_state_is_set() const;
void set_rat_type(std::string const& value);
void set_an_type(std::string const& value);
private: private:
std::string n2_sm_information; std::vector<pfcp::qfi_t> qfis;
fteid_t dl_fteid; //AN Tunnel Info
std::string n1_sm_message; //N1 SM message before decoding
bool m_n1_sm_msg_is_set;
std::string n2_sm_information; //N2 SM before decoding
bool m_n2_sm_info_is_set;
std::string n2_sm_info_type; std::string n2_sm_info_type;
//std::string m_Ppei; //std::string m_Ppei;
std::string m_nf_instanceId; std::string m_nf_instanceId;
...@@ -351,6 +413,7 @@ private: ...@@ -351,6 +413,7 @@ private:
type: boolean type: boolean
*/ */
std::string m_upCnx_state; //'#/components/schemas/UpCnxState' std::string m_upCnx_state; //'#/components/schemas/UpCnxState'
bool m_upCnx_state_is_set; //'#/components/schemas/UpCnxState'
oai::smf_server::model::RefToBinaryData m_n1_sm_msg; //n1SmMsg oai::smf_server::model::RefToBinaryData m_n1_sm_msg; //n1SmMsg
oai::smf_server::model::RefToBinaryData m_n2_sm_info; //n2SmInfo oai::smf_server::model::RefToBinaryData m_n2_sm_info; //n2SmInfo
...@@ -396,7 +459,7 @@ private: ...@@ -396,7 +459,7 @@ private:
$ref: '#/components/schemas/Cause' $ref: '#/components/schemas/Cause'
*/ */
//NgApCause m_ngAp_cause; // $ref: '../TS29571_CommonData.yaml#/components/schemas/NgApCause //NgApCause m_ngAp_cause; // $ref: '../TS29571_CommonData.yaml#/components/schemas/NgApCause
unsigned int m_5gMm_cause_value; // 5GMmCause, $ref: '../TS29571_CommonData.yaml#/components/schemas/5GMmCause' uint8_t m_5gMm_cause_value; // 5GMmCause, $ref: '../TS29571_CommonData.yaml#/components/schemas/5GMmCause'
/* /*
sNssai: sNssai:
$ref: '../TS29571_CommonData.yaml#/components/schemas/Snssai' $ref: '../TS29571_CommonData.yaml#/components/schemas/Snssai'
...@@ -426,8 +489,37 @@ public: ...@@ -426,8 +489,37 @@ public:
pdu_session_update_sm_context_response(): pdu_session_msg(PDU_SESSION_UPDATE_SM_CONTEXT_RESPONSE){ }; pdu_session_update_sm_context_response(): pdu_session_msg(PDU_SESSION_UPDATE_SM_CONTEXT_RESPONSE){ };
void set_cause(uint8_t cause); void set_cause(uint8_t cause);
uint8_t get_cause(); uint8_t get_cause();
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);
std::string get_n1_sm_message() const;
void set_n1_sm_message(std::string const& value);
std::string get_n1_sm_msg_type() const;
void set_n1_sm_msg_type(std::string const& value);
bool n1_sm_msg_is_set() const;
bool n2_sm_info_is_set() const;
void add_qos_flow_context_modified(const qos_flow_context_modified& qos_flow);
bool get_qos_flow_context_modified (const pfcp::qfi_t& qfi, qos_flow_context_modified& qos_flow);
void get_all_qos_flow_context_modifieds (std::map<uint8_t, qos_flow_context_modified>& all_flows);
private: private:
uint8_t m_cause; uint8_t m_cause;
std::string n1_sm_message; //N1 SM after decoding
bool m_n1_sm_msg_is_set;
std::string n1_sm_msg_type;
std::string n2_sm_information; //N2 SM after decoding
bool m_n2_sm_info_is_set;
std::string n2_sm_info_type;
std::map<uint8_t, qos_flow_context_modified> qos_flow_context_modifieds;
}; };
} }
......
...@@ -40,7 +40,6 @@ ...@@ -40,7 +40,6 @@
#define UDM_CURL_TIMEOUT_MS 100L #define UDM_CURL_TIMEOUT_MS 100L
#define UDM_NUMBER_RETRIES 3 #define UDM_NUMBER_RETRIES 3
#define HTTP_STATUS_OK 200
using namespace smf; using namespace smf;
using namespace std; using namespace std;
...@@ -125,7 +124,7 @@ bool smf_n10::get_sm_data(supi64_t& supi, std::string& dnn, snssai_t& snssai, st ...@@ -125,7 +124,7 @@ bool smf_n10::get_sm_data(supi64_t& supi, std::string& dnn, snssai_t& snssai, st
nlohmann::json jsonData; nlohmann::json jsonData;
curl_global_init(CURL_GLOBAL_DEFAULT); curl_global_init(CURL_GLOBAL_DEFAULT);
struct curl_slist *headers = NULL; struct curl_slist *headers = nullptr;
headers = curl_slist_append(headers, "Accept: application/json"); headers = curl_slist_append(headers, "Accept: application/json");
headers = curl_slist_append(headers, "Content-Type: application/json"); headers = curl_slist_append(headers, "Content-Type: application/json");
headers = curl_slist_append(headers, "charsets: utf-8"); headers = curl_slist_append(headers, "charsets: utf-8");
...@@ -156,7 +155,7 @@ bool smf_n10::get_sm_data(supi64_t& supi, std::string& dnn, snssai_t& snssai, st ...@@ -156,7 +155,7 @@ bool smf_n10::get_sm_data(supi64_t& supi, std::string& dnn, snssai_t& snssai, st
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &httpCode); curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &httpCode);
Logger::smf_n10().debug("[get_sm_data] Response from UDM, Http Code: %d ", httpCode); Logger::smf_n10().debug("[get_sm_data] Response from UDM, Http Code: %d ", httpCode);
if (httpCode == HTTP_STATUS_OK) if (static_cast<http_response_codes_e> (httpCode) == http_response_codes_e::HTTP_RESPONSE_CODE_OK)
{ {
Logger::smf_n10().debug("[get_sm_data] Got successful response from UDM, URL: %s ", url.c_str()); Logger::smf_n10().debug("[get_sm_data] Got successful response from UDM, URL: %s ", url.c_str());
//Logger::smf_n10().debug("[get_sm_data] Http Data from UDM: %s ", *httpData.get()); //Logger::smf_n10().debug("[get_sm_data] Http Data from UDM: %s ", *httpData.get());
......
This diff is collapsed.
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include "smf.h" #include "smf.h"
#include "3gpp_29.503.h" #include "3gpp_29.503.h"
#include "smf_context.hpp" #include "smf_context.hpp"
#include "SmContextCreatedData.h"
#include <thread> #include <thread>
#include <map> #include <map>
...@@ -48,8 +49,39 @@ public: ...@@ -48,8 +49,39 @@ public:
smf_n11(); smf_n11();
smf_n11(smf_n11 const&) = delete; smf_n11(smf_n11 const&) = delete;
void operator=(smf_n11 const&) = delete; void operator=(smf_n11 const&) = delete;
void send_msg_to_amf(std::shared_ptr<itti_n11_create_sm_context_response> sm_context_res); void send_n1n2_message_transfer_request(std::shared_ptr<itti_n11_create_sm_context_response> sm_context_res);
void send_msg_to_amf(std::shared_ptr<itti_n11_update_sm_context_response> sm_context_res); void send_pdu_session_update_sm_context_response(std::shared_ptr<itti_n11_update_sm_context_response> sm_context_res);
void send_n1n2_message_transfer_request(std::shared_ptr<itti_n11_modify_session_request_smf_requested> sm_context_mod);
/*
* Send create session response to AMF
* @param [Pistache::Http::ResponseWriter] httpResponse
* @param [ oai::smf_server::model::SmContextCreateError] smContextCreateError
* @param [Pistache::Http::Code] code, response code
*
*/
void send_pdu_session_create_sm_context_response(Pistache::Http::ResponseWriter& httpResponse, 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 [Pistache::Http::Code] code, response code
* @param [std::string] n1_sm_msg, N1 SM message content
*
*/
void send_pdu_session_create_sm_context_response(Pistache::Http::ResponseWriter& httpResponse, oai::smf_server::model::SmContextCreateError& smContextCreateError, 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 [Pistache::Http::Code] code, response code
*
*/
void send_pdu_session_create_sm_context_response(Pistache::Http::ResponseWriter& httpResponse, oai::smf_server::model::SmContextCreatedData& smContextCreatedData, Pistache::Http::Code code);
}; };
......
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