Commit c9867719 authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Cleanup ITTI

parent 7f52e8b8
...@@ -455,58 +455,6 @@ void amf_n1::nas_signalling_establishment_request_handle( ...@@ -455,58 +455,6 @@ void amf_n1::nas_signalling_establishment_request_handle(
} }
} }
//------------------------------------------------------------------------------
void amf_n1::uplink_nas_msg_handle(
uint32_t ran_ue_ngap_id, long amf_ue_ngap_id, bstring plain_msg) {
uint8_t* buf = (uint8_t*) bdata(plain_msg);
uint8_t message_type = *(buf + 2);
switch (message_type) {
case AUTHENTICATION_RESPONSE: {
Logger::amf_n1().debug(
"Received authentication response message, handling...");
authentication_response_handle(ran_ue_ngap_id, amf_ue_ngap_id, plain_msg);
} break;
case AUTHENTICATION_FAILURE: {
Logger::amf_n1().debug(
"Received authentication failure message, handling...");
authentication_failure_handle(ran_ue_ngap_id, amf_ue_ngap_id, plain_msg);
} break;
case SECURITY_MODE_COMPLETE: {
Logger::amf_n1().debug(
"Received security mode complete message, handling...");
security_mode_complete_handle(ran_ue_ngap_id, amf_ue_ngap_id, plain_msg);
} break;
case SECURITY_MODE_REJECT: {
Logger::amf_n1().debug(
"Received security mode reject message, handling...");
security_mode_reject_handle(ran_ue_ngap_id, amf_ue_ngap_id, plain_msg);
} break;
case UL_NAS_TRANSPORT: {
Logger::amf_n1().debug("Received UL NAS transport message, handling...");
ul_nas_transport_handle(ran_ue_ngap_id, amf_ue_ngap_id, plain_msg);
} break;
case UE_INIT_DEREGISTER: {
Logger::amf_n1().debug(
"Received de-registration request message, handling...");
ue_initiate_de_registration_handle(
ran_ue_ngap_id, amf_ue_ngap_id, plain_msg);
} break;
case IDENTITY_RESPONSE: {
Logger::amf_n1().debug("received identity response message , handle ...");
identity_response_handle(ran_ue_ngap_id, amf_ue_ngap_id, plain_msg);
} break;
case REGISTRATION_COMPLETE: {
Logger::amf_n1().debug(
"Received registration complete message, handling...");
registration_complete_handle(ran_ue_ngap_id, amf_ue_ngap_id, plain_msg);
// TODO
} break;
default: {
// TODO:
}
}
}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void amf_n1::uplink_nas_msg_handle( void amf_n1::uplink_nas_msg_handle(
uint32_t ran_ue_ngap_id, long amf_ue_ngap_id, bstring plain_msg, uint32_t ran_ue_ngap_id, long amf_ue_ngap_id, bstring plain_msg,
...@@ -2583,10 +2531,8 @@ void amf_n1::ul_nas_transport_handle( ...@@ -2583,10 +2531,8 @@ void amf_n1::ul_nas_transport_handle(
Logger::amf_n1().error("Cannot decode Payload Container"); Logger::amf_n1().error("Cannot decode Payload Container");
return; return;
} }
// send_itti_to_smf_services_consumer(ran_ue_ngap_id, amf_ue_ngap_id, itti_nsmf_pdusession_create_sm_context* itti_msg =
// request_type, pdu_session_id, dnn, sm_msg); new itti_nsmf_pdusession_create_sm_context(TASK_AMF_N1, TASK_AMF_N11);
itti_smf_services_consumer* itti_msg =
new itti_smf_services_consumer(TASK_AMF_N1, TASK_AMF_N11);
itti_msg->ran_ue_ngap_id = ran_ue_ngap_id; itti_msg->ran_ue_ngap_id = ran_ue_ngap_id;
itti_msg->amf_ue_ngap_id = amf_ue_ngap_id; itti_msg->amf_ue_ngap_id = amf_ue_ngap_id;
itti_msg->req_type = request_type; itti_msg->req_type = request_type;
...@@ -2595,8 +2541,8 @@ void amf_n1::ul_nas_transport_handle( ...@@ -2595,8 +2541,8 @@ void amf_n1::ul_nas_transport_handle(
itti_msg->sm_msg = sm_msg; itti_msg->sm_msg = sm_msg;
itti_msg->snssai.sST = snssai.sst; itti_msg->snssai.sST = snssai.sst;
itti_msg->snssai.sD = std::to_string(snssai.sd); itti_msg->snssai.sD = std::to_string(snssai.sd);
std::shared_ptr<itti_smf_services_consumer> i = std::shared_ptr<itti_nsmf_pdusession_create_sm_context> i =
std::shared_ptr<itti_smf_services_consumer>(itti_msg); std::shared_ptr<itti_nsmf_pdusession_create_sm_context>(itti_msg);
int ret = itti_inst->send_msg(i); int ret = itti_inst->send_msg(i);
if (0 != ret) { if (0 != ret) {
Logger::amf_n1().error( Logger::amf_n1().error(
...@@ -2634,10 +2580,8 @@ void amf_n1::ul_nas_transport_handle( ...@@ -2634,10 +2580,8 @@ void amf_n1::ul_nas_transport_handle(
Logger::amf_n1().error("Cannot decode Payload Container"); Logger::amf_n1().error("Cannot decode Payload Container");
return; return;
} }
// send_itti_to_smf_services_consumer(ran_ue_ngap_id, amf_ue_ngap_id, itti_nsmf_pdusession_create_sm_context* itti_msg =
// request_type, pdu_session_id, dnn, sm_msg); new itti_nsmf_pdusession_create_sm_context(TASK_AMF_N1, TASK_AMF_N11);
itti_smf_services_consumer* itti_msg =
new itti_smf_services_consumer(TASK_AMF_N1, TASK_AMF_N11);
itti_msg->ran_ue_ngap_id = ran_ue_ngap_id; itti_msg->ran_ue_ngap_id = ran_ue_ngap_id;
itti_msg->amf_ue_ngap_id = amf_ue_ngap_id; itti_msg->amf_ue_ngap_id = amf_ue_ngap_id;
itti_msg->req_type = request_type; itti_msg->req_type = request_type;
...@@ -2648,8 +2592,8 @@ void amf_n1::ul_nas_transport_handle( ...@@ -2648,8 +2592,8 @@ void amf_n1::ul_nas_transport_handle(
itti_msg->snssai.sD = std::to_string(snssai.sd); itti_msg->snssai.sD = std::to_string(snssai.sd);
itti_msg->plmn.mnc = plmn.mnc; itti_msg->plmn.mnc = plmn.mnc;
itti_msg->plmn.mcc = plmn.mcc; itti_msg->plmn.mcc = plmn.mcc;
std::shared_ptr<itti_smf_services_consumer> i = std::shared_ptr<itti_nsmf_pdusession_create_sm_context> i =
std::shared_ptr<itti_smf_services_consumer>(itti_msg); std::shared_ptr<itti_nsmf_pdusession_create_sm_context>(itti_msg);
int ret = itti_inst->send_msg(i); int ret = itti_inst->send_msg(i);
if (0 != ret) { if (0 != ret) {
Logger::amf_n1().error( Logger::amf_n1().error(
...@@ -2661,28 +2605,6 @@ void amf_n1::ul_nas_transport_handle( ...@@ -2661,28 +2605,6 @@ void amf_n1::ul_nas_transport_handle(
} }
} }
//------------------------------------------------------------------------------
void amf_n1::send_itti_to_smf_services_consumer(
uint32_t ran_ue_ngap_id, long amf_ue_ngap_id, uint8_t request_type,
uint8_t pdu_session_id, bstring dnn, bstring sm_msg) {
itti_smf_services_consumer* itti_msg =
new itti_smf_services_consumer(TASK_AMF_N1, TASK_AMF_N11);
itti_msg->ran_ue_ngap_id = ran_ue_ngap_id;
itti_msg->amf_ue_ngap_id = amf_ue_ngap_id;
itti_msg->req_type = request_type;
itti_msg->pdu_sess_id = pdu_session_id;
itti_msg->dnn = dnn;
itti_msg->sm_msg = sm_msg;
std::shared_ptr<itti_smf_services_consumer> i =
std::shared_ptr<itti_smf_services_consumer>(itti_msg);
int ret = itti_inst->send_msg(i);
if (0 != ret) {
Logger::amf_n1().error(
"Could not send ITTI message %s to task TASK_AMF_N11",
i->get_msg_name());
}
}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void amf_n1::dump_nas_message(uint8_t* buf, int len) { void amf_n1::dump_nas_message(uint8_t* buf, int len) {
for (int i = 0; i < len; i++) for (int i = 0; i < len; i++)
......
...@@ -69,8 +69,6 @@ class amf_n1 { ...@@ -69,8 +69,6 @@ class amf_n1 {
SecurityHeaderType type, std::shared_ptr<nas_context> nc, SecurityHeaderType type, std::shared_ptr<nas_context> nc,
uint32_t ran_ue_ngap_id, long amf_ue_ngap_id, bstring plain_msg, uint32_t ran_ue_ngap_id, long amf_ue_ngap_id, bstring plain_msg,
std::string snn, uint8_t ulCount); std::string snn, uint8_t ulCount);
void uplink_nas_msg_handle(
uint32_t ran_ue_ngap_id, long amf_ue_ngap_id, bstring plain_msg);
void uplink_nas_msg_handle( void uplink_nas_msg_handle(
uint32_t ran_ue_ngap_id, long amf_ue_ngap_id, bstring plain_msg, uint32_t ran_ue_ngap_id, long amf_ue_ngap_id, bstring plain_msg,
plmn_t plmn); plmn_t plmn);
...@@ -152,9 +150,6 @@ class amf_n1 { ...@@ -152,9 +150,6 @@ class amf_n1 {
void annex_a_4_33501( void annex_a_4_33501(
uint8_t ck[16], uint8_t ik[16], uint8_t* input, uint8_t rand[16], uint8_t ck[16], uint8_t ik[16], uint8_t* input, uint8_t rand[16],
std::string serving_network, uint8_t* output); std::string serving_network, uint8_t* output);
void send_itti_to_smf_services_consumer(
uint32_t ran_ue_ngap_id, long amf_ue_ngap_id, uint8_t request_type,
uint8_t pdu_session_id, bstring dnn, bstring sm_msg);
void set_5gmm_state(std::shared_ptr<nas_context> nc, _5gmm_state_t state); void set_5gmm_state(std::shared_ptr<nas_context> nc, _5gmm_state_t state);
void get_5gmm_state(std::shared_ptr<nas_context> nc, _5gmm_state_t& state); void get_5gmm_state(std::shared_ptr<nas_context> nc, _5gmm_state_t& state);
......
...@@ -104,10 +104,10 @@ void amf_n11_task(void*) { ...@@ -104,10 +104,10 @@ void amf_n11_task(void*) {
std::shared_ptr<itti_msg> shared_msg = itti_inst->receive_msg(task_id); std::shared_ptr<itti_msg> shared_msg = itti_inst->receive_msg(task_id);
auto* msg = shared_msg.get(); auto* msg = shared_msg.get();
switch (msg->msg_type) { switch (msg->msg_type) {
case SMF_SERVICES_CONSUMER: { case NSMF_PDU_SESSION_CREATE_SM_CTX: {
Logger::amf_n11().info("Running SMF_SERVICES_CONSUMER"); Logger::amf_n11().info("Running ITTI_SMF_PDU_SESSION_CREATE_SM_CTX");
itti_smf_services_consumer* m = itti_nsmf_pdusession_create_sm_context* m =
dynamic_cast<itti_smf_services_consumer*>(msg); dynamic_cast<itti_nsmf_pdusession_create_sm_context*>(msg);
amf_n11_inst->handle_itti_message(ref(*m)); amf_n11_inst->handle_itti_message(ref(*m));
} break; } break;
case NSMF_PDU_SESSION_UPDATE_SM_CTX: { case NSMF_PDU_SESSION_UPDATE_SM_CTX: {
...@@ -117,7 +117,7 @@ void amf_n11_task(void*) { ...@@ -117,7 +117,7 @@ void amf_n11_task(void*) {
dynamic_cast<itti_nsmf_pdusession_update_sm_context*>(msg); dynamic_cast<itti_nsmf_pdusession_update_sm_context*>(msg);
amf_n11_inst->handle_itti_message(ref(*m)); amf_n11_inst->handle_itti_message(ref(*m));
} break; } break;
case PDU_SESS_RES_SET_RESP: { case PDU_SESSION_RESOURCE_SETUP_RESPONSE: {
Logger::amf_n11().info( Logger::amf_n11().info(
"Receive PDU Session Resource Setup Response, handling ..."); "Receive PDU Session Resource Setup Response, handling ...");
itti_pdu_session_resource_setup_response* m = itti_pdu_session_resource_setup_response* m =
...@@ -216,8 +216,8 @@ void amf_n11::handle_itti_message( ...@@ -216,8 +216,8 @@ void amf_n11::handle_itti_message(
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void amf_n11::handle_itti_message(itti_smf_services_consumer& smf) { void amf_n11::handle_itti_message(itti_nsmf_pdusession_create_sm_context& smf) {
Logger::amf_n11().debug("Handle ITTI_SMF_SERVICES_CONSUMER"); Logger::amf_n11().debug("Handle SMF_PDU_SESSION_CREATE_SM_CTX");
std::shared_ptr<nas_context> nc; std::shared_ptr<nas_context> nc;
nc = amf_n1_inst->amf_ue_id_2_nas_context(smf.amf_ue_ngap_id); nc = amf_n1_inst->amf_ue_id_2_nas_context(smf.amf_ue_ngap_id);
std::string supi = "imsi-" + nc.get()->imsi; std::string supi = "imsi-" + nc.get()->imsi;
......
...@@ -45,7 +45,7 @@ class amf_n11 { ...@@ -45,7 +45,7 @@ class amf_n11 {
amf_n11(); amf_n11();
~amf_n11(); ~amf_n11();
void handle_itti_message(itti_smf_services_consumer&); void handle_itti_message(itti_nsmf_pdusession_create_sm_context&);
void handle_pdu_session_initial_request( void handle_pdu_session_initial_request(
std::string supi, std::shared_ptr<pdu_session_context> psc, std::string supi, std::shared_ptr<pdu_session_context> psc,
std::string smf_addr, std::string smf_api_version, bstring sm_msg, std::string smf_addr, std::string smf_api_version, bstring sm_msg,
......
...@@ -77,7 +77,7 @@ typedef enum { ...@@ -77,7 +77,7 @@ typedef enum {
DOWNLINK_NAS_TRANSFER, DOWNLINK_NAS_TRANSFER,
NAS_SIG_ESTAB_REQ, // task amf_app NAS_SIG_ESTAB_REQ, // task amf_app
N1N2_MESSAGE_TRANSFER_REQ, N1N2_MESSAGE_TRANSFER_REQ,
SMF_SERVICES_CONSUMER, NSMF_PDU_SESSION_CREATE_SM_CTX,
NSMF_PDU_SESSION_UPDATE_SM_CTX, NSMF_PDU_SESSION_UPDATE_SM_CTX,
N11_REGISTER_NF_INSTANCE_REQUEST, N11_REGISTER_NF_INSTANCE_REQUEST,
N11_REGISTER_NF_INSTANCE_RESPONSE, N11_REGISTER_NF_INSTANCE_RESPONSE,
...@@ -85,12 +85,12 @@ typedef enum { ...@@ -85,12 +85,12 @@ typedef enum {
N11_UPDATE_NF_INSTANCE_RESPONSE, N11_UPDATE_NF_INSTANCE_RESPONSE,
N11_DEREGISTER_NF_INSTANCE, N11_DEREGISTER_NF_INSTANCE,
UE_CONTEXT_RELEASE_COMMAND, UE_CONTEXT_RELEASE_COMMAND,
NSMF_PDU_SESS_RELEASE_SMCTX, NSMF_PDU_SESSION_RELEASE_SM_CTX,
HANDOVER_REQUIRED, HANDOVER_REQUIRED,
HANDOVER_REQUEST_ACK, HANDOVER_REQUEST_ACK,
HANDOVER_NOTIFY, HANDOVER_NOTIFY,
UPLINK_RAN_STATUS_TRANSFER, UPLINK_RAN_STATUS_TRANSFER,
PDU_SESS_RES_SET_RESP, PDU_SESSION_RESOURCE_SETUP_RESPONSE,
TIME_OUT, TIME_OUT,
HEALTH_PING, HEALTH_PING,
TERMINATE, TERMINATE,
......
...@@ -45,12 +45,13 @@ class itti_msg_n11 : public itti_msg { ...@@ -45,12 +45,13 @@ class itti_msg_n11 : public itti_msg {
uint32_t ran_ue_ngap_id; uint32_t ran_ue_ngap_id;
}; };
class itti_smf_services_consumer : public itti_msg_n11 { class itti_nsmf_pdusession_create_sm_context : public itti_msg_n11 {
public: public:
itti_smf_services_consumer( itti_nsmf_pdusession_create_sm_context(
const task_id_t origin, const task_id_t destination) const task_id_t origin, const task_id_t destination)
: itti_msg_n11(SMF_SERVICES_CONSUMER, origin, destination) {} : itti_msg_n11(NSMF_PDU_SESSION_CREATE_SM_CTX, origin, destination) {}
itti_smf_services_consumer(const itti_smf_services_consumer& i) itti_nsmf_pdusession_create_sm_context(
const itti_nsmf_pdusession_create_sm_context& i)
: itti_msg_n11(i) {} : itti_msg_n11(i) {}
public: public:
...@@ -66,7 +67,8 @@ class itti_pdu_session_resource_setup_response : public itti_msg_n11 { ...@@ -66,7 +67,8 @@ class itti_pdu_session_resource_setup_response : public itti_msg_n11 {
public: public:
itti_pdu_session_resource_setup_response( itti_pdu_session_resource_setup_response(
const task_id_t origin, const task_id_t destination) const task_id_t origin, const task_id_t destination)
: itti_msg_n11(PDU_SESS_RES_SET_RESP, origin, destination) {} : itti_msg_n11(PDU_SESSION_RESOURCE_SETUP_RESPONSE, origin, destination) {
}
itti_pdu_session_resource_setup_response( itti_pdu_session_resource_setup_response(
const itti_pdu_session_resource_setup_response& i) const itti_pdu_session_resource_setup_response& i)
: itti_msg_n11(i) {} : itti_msg_n11(i) {}
...@@ -110,7 +112,7 @@ class itti_nsmf_pdusession_release_sm_context : public itti_msg_n11 { ...@@ -110,7 +112,7 @@ class itti_nsmf_pdusession_release_sm_context : public itti_msg_n11 {
public: public:
itti_nsmf_pdusession_release_sm_context( itti_nsmf_pdusession_release_sm_context(
const task_id_t origin, const task_id_t destination) const task_id_t origin, const task_id_t destination)
: itti_msg_n11(NSMF_PDU_SESS_RELEASE_SMCTX, origin, destination) {} : itti_msg_n11(NSMF_PDU_SESSION_RELEASE_SM_CTX, origin, destination) {}
itti_nsmf_pdusession_release_sm_context( itti_nsmf_pdusession_release_sm_context(
const itti_nsmf_pdusession_update_sm_context& i) const itti_nsmf_pdusession_update_sm_context& i)
: itti_msg_n11(i) {} : itti_msg_n11(i) {}
......
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