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

update logs/correct typo

parent 9497248e
......@@ -211,6 +211,7 @@ void amf_n1::handle_itti_message(itti_uplink_nas_data_ind &nas_data_ind) {
uint32_t mac32 = 0;
if (!nas_message_integrity_protected(nc.get()->security_ctx, NAS_MESSAGE_UPLINK, (uint8_t*) bdata(recved_nas_msg) + 6, blength(recved_nas_msg) - 6, mac32)) {
//IA0_5G
//TODO:
} else {
bool isMatched = false;
uint8_t *buf = (uint8_t*) bdata(recved_nas_msg);
......@@ -219,6 +220,7 @@ void amf_n1::handle_itti_message(itti_uplink_nas_data_ind &nas_data_ind) {
Logger::amf_n1().debug("Received mac32 (0x%x) from the message", mac32_recv);
if (mac32 == mac32_recv) {
isMatched = true;
Logger::amf_n1().error("Integrity matched");
//nc.get()->security_ctx->ul_count.seq_num ++;
}
if (!isMatched) {
......@@ -1113,7 +1115,7 @@ void amf_n1::authentication_response_handle(uint32_t ran_ue_ngap_id, long amf_ue
response_registration_reject_msg(_5GMM_CAUSE_ILLEGAL_UE, ran_ue_ngap_id, amf_ue_ngap_id); //cause?
return;
} else {
Logger::amf_n1().debug("Authenticated successfully by network!");
Logger::amf_n1().debug("Authentication successful by network!");
if (!nc.get()->is_current_security_available) {
if (!start_security_mode_control_procedure(nc)) {
Logger::amf_n1().error("Start SMC procedure failure");
......@@ -1262,7 +1264,7 @@ void amf_n1::security_mode_complete_handle(uint32_t ran_ue_ngap_id, long amf_ue_
std::string mnc;
uint32_t tmsi = 0;
if (!amf_app_inst->generate_5g_guti(ran_ue_ngap_id, amf_ue_ngap_id, mcc, mnc, tmsi)) {
Logger::amf_n1().error("Generate 5G GTUI error! exit");
Logger::amf_n1().error("Generate 5G GUTI error! exit");
//TODO:
return;
}
......@@ -1291,6 +1293,7 @@ void amf_n1::security_mode_complete_handle(uint32_t ran_ue_ngap_id, long amf_ue_
std::string guti = mcc + mnc + amf_cfg.guami.regionID + amf_cfg.guami.AmfSetID + amf_cfg.guami.AmfPointer + std::to_string(tmsi);
Logger::amf_n1().debug("Allocated GUTI %s", guti.c_str());
//TODO: remove hardcoded values
regAccept->set_5GS_Network_Feature_Support(0x00, 0x00);
regAccept->setT3512_Value(0x5, 0x1e);
uint8_t buffer[1024] = { 0 };
......@@ -1340,7 +1343,7 @@ void amf_n1::security_mode_complete_handle(uint32_t ran_ue_ngap_id, long amf_ue_
itti_msg->amf_ue_ngap_id = amf_ue_ngap_id;
itti_msg->kgnb = kgnb_bs;
itti_msg->nas = protectedNas;
itti_msg->is_sr = false;
itti_msg->is_sr = false; //TODO: for Setup Request procedure
std::shared_ptr<itti_initial_context_setup_request> i = std::shared_ptr < itti_initial_context_setup_request > (itti_msg);
int ret = itti_inst->send_msg(i);
if (0 != ret) {
......@@ -1428,7 +1431,7 @@ bool amf_n1::nas_message_integrity_protected(nas_secu_ctx *nsc, uint8_t directio
}
Logger::amf_n1().debug("Parameters for NIA, count: 0x%x", count);
stream_cipher.bearer = 0x01; //33.501 section 8.1.1
Logger::amf_n1().debug("Parameters for NIA, bearer: 0x%x", 0x01);
Logger::amf_n1().debug("Parameters for NIA, bearer: 0x%x", stream_cipher.bearer);
stream_cipher.direction = direction; // "1" for downlink
Logger::amf_n1().debug("Parameters for NIA, direction: 0x%x", direction);
stream_cipher.message = (uint8_t*) input_nas;
......
......@@ -105,7 +105,7 @@ void amf_n11_task(void*) {
amf_n11_inst->handle_itti_message(ref(*m));
}
break;
case NSMF_PDU_SESS_UPDATE_SMCTX: {
case NSMF_PDU_SESSION_UPDATE_SM_CTX: {
Logger::amf_n1().info("Receive Nsmf_PDUSessionUpdateSMContext, handling ...");
itti_nsmf_pdusession_update_sm_context *m = dynamic_cast<itti_nsmf_pdusession_update_sm_context*>(msg);
amf_n11_inst->handle_itti_message(ref(*m));
......
......@@ -491,7 +491,7 @@ void amf_n2::handle_itti_message(itti_initial_context_setup_request &itti_msg) {
memcpy(uecap, (uint8_t*) bdata(ueCapability), blength(ueCapability));
uecap[blength(ueCapability)] = '\0';
msg->setUERadioCapability(uecap, (size_t)blength(ueCapability));
Logger::amf_n2().debug("Encoding parameters for service request");
Logger::amf_n2().debug("Encoding parameters for Service Request");
std::vector<PDUSessionResourceSetupRequestItem_t> list;
PDUSessionResourceSetupRequestItem_t item;
item.pduSessionId = itti_msg.pdu_session_id;
......@@ -543,8 +543,8 @@ void amf_n2::handle_itti_message(itti_pdu_session_resource_setup_request &itti_m
nas_pdu[blength(itti_msg.nas)] = '\0';
item.pduSessionNAS_PDU = nas_pdu;
item.sizeofpduSessionNAS_PDU = blength(itti_msg.nas);
item.s_nssai.sst = "01";
item.s_nssai.sd = "";
item.s_nssai.sst = "01"; //TODO: get from N1N2msgTranferMsg
item.s_nssai.sd = ""; //TODO: get from N1N2msgTranferMsg
item.pduSessionResourceSetupRequestTransfer.buf = (uint8_t*) bdata(itti_msg.n2sm);
item.pduSessionResourceSetupRequestTransfer.size = blength(itti_msg.n2sm);
list.push_back(item);
......
......@@ -73,7 +73,7 @@ typedef enum {
NAS_SIG_ESTAB_REQ,//task amf_app
N1N2_MESSAGE_TRANSFER_REQ,
SMF_SERVICES_CONSUMER,
NSMF_PDU_SESS_UPDATE_SMCTX,
NSMF_PDU_SESSION_UPDATE_SM_CTX,
PDU_SESS_RES_SET_RESP,
TIME_OUT,
HEALTH_PING,
......
......@@ -46,7 +46,7 @@ public:
class itti_nsmf_pdusession_update_sm_context : public itti_msg_n11{
public:
itti_nsmf_pdusession_update_sm_context(const task_id_t origin, const task_id_t destination) : itti_msg_n11(NSMF_PDU_SESS_UPDATE_SMCTX, origin, destination){}
itti_nsmf_pdusession_update_sm_context(const task_id_t origin, const task_id_t destination) : itti_msg_n11(NSMF_PDU_SESSION_UPDATE_SM_CTX, origin, destination){}
itti_nsmf_pdusession_update_sm_context(const itti_nsmf_pdusession_update_sm_context &i) : itti_msg_n11(i){}
public:
uint8_t pdu_session_id;
......
......@@ -111,7 +111,6 @@ int ngap_amf_handle_uplink_nas_transport(const sctp_assoc_id_t assoc_id, const s
//------------------------------------------------------------------------------
int ngap_amf_handle_initial_context_setup_response(const sctp_assoc_id_t assoc_id, const sctp_stream_id_t stream, struct Ngap_NGAP_PDU *message_p) {
Logger::ngap().debug("Handling Initial Context Setup Response...");
Logger::ngap().debug("Sending ITTI Initial Context Setup Response to TASK_AMF_N11");
InitialContextSetupResponseMsg *initCtxResp = new InitialContextSetupResponseMsg();
if (!initCtxResp->decodefrompdu(message_p)) {
Logger::ngap().error("Decoding InitialContextSetupResponse message error");
......@@ -119,13 +118,14 @@ int ngap_amf_handle_initial_context_setup_response(const sctp_assoc_id_t assoc_i
}
std::vector<PDUSessionResourceSetupResponseItem_t> list;
if (!initCtxResp->getPduSessionResourceSetupResponseList(list)) {
Logger::ngap().error("Decoding PduSessionResourceSetupResponseMsg getPduSessionResourceSetupResponseList IE error or this IE is not available");
Logger::ngap().error("Decode PduSessionResourceSetupResponseList IE error or this IE is not available");
return 0;
}
uint8_t transferIe[500];
memcpy(transferIe, list[0].pduSessionResourceSetupResponseTransfer.buf, list[0].pduSessionResourceSetupResponseTransfer.size);
bstring n2sm = blk2bstr(transferIe, list[0].pduSessionResourceSetupResponseTransfer.size);
Logger::ngap().debug("Sending ITTI Initial Context Setup Response to TASK_AMF_N11");
itti_nsmf_pdusession_update_sm_context *itti_msg = new itti_nsmf_pdusession_update_sm_context(TASK_NGAP, TASK_AMF_N11);
itti_msg->pdu_session_id = list[0].pduSessionId;
itti_msg->n2sm = n2sm;
......@@ -189,7 +189,7 @@ int ngap_amf_handle_ue_context_release_complete(const sctp_assoc_id_t assoc_id,
//------------------------------------------------------------------------------
int ngap_amf_handle_pdu_session_resource_setup_response(const sctp_assoc_id_t assoc_id, const sctp_stream_id_t stream, struct Ngap_NGAP_PDU *message_p) {
Logger::ngap().debug("Sending itti pdu_session_resource_setup_response to TASK_AMF_N11");
Logger::ngap().debug("Handle PDU Session Resource Setup Response");
PduSessionResourceSetupResponseMsg *pduresp = new PduSessionResourceSetupResponseMsg();
if (!pduresp->decodefrompdu(message_p)) {
Logger::ngap().error("Decoding PduSessionResourceSetupResponseMsg message error");
......@@ -204,6 +204,7 @@ int ngap_amf_handle_pdu_session_resource_setup_response(const sctp_assoc_id_t as
memcpy(transferIe, list[0].pduSessionResourceSetupResponseTransfer.buf, list[0].pduSessionResourceSetupResponseTransfer.size);
bstring n2sm = blk2bstr(transferIe, list[0].pduSessionResourceSetupResponseTransfer.size);
Logger::ngap().debug("Sending itti pdu_session_resource_setup_response to TASK_AMF_N11");
itti_nsmf_pdusession_update_sm_context *itti_msg = new itti_nsmf_pdusession_update_sm_context(TASK_NGAP, TASK_AMF_N11);
itti_msg->pdu_session_id = list[0].pduSessionId;
itti_msg->n2sm = n2sm;
......
......@@ -42,7 +42,7 @@ void N1N2MessageCollectionDocumentApi::setupRoutes() {
void N1N2MessageCollectionDocumentApi::n1_n2_message_transfer_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
// Getting the path params
auto ueContextId = request.param(":ueContextId").as<std::string>();
Logger::amf_server().debug("Received a N1N2MessageTrasfer request with ue_ctx_id %s ",ueContextId.c_str());
Logger::amf_server().debug("Received a N1N2MessageTrasfer request with ue_ctx_id %s", ueContextId.c_str());
// Getting the body param
//simple parser
......@@ -57,16 +57,17 @@ void N1N2MessageCollectionDocumentApi::n1_n2_message_transfer_handler(const Pist
//at least 2 parts for Json data and N1 (+ N2)
if (size < 2) {
response.send(Pistache::Http::Code::Bad_Request);
Logger::amf_server().debug("Bad request: should have at least 2 MIME parts");
return;
}
Logger::amf_server().debug("Request body, part 1: \n%s", parts[0].body.c_str());
Logger::amf_server().debug("Request body, part 2: \n %s",parts[1].body.c_str());
Logger::amf_server().debug("Request body, part 2: \n %s", parts[1].body.c_str());
bool is_ngap = false;
if (size > 2) {
is_ngap = true;
Logger::amf_server().debug("Request body, part 3: \n %s",parts[2].body.c_str());
Logger::amf_server().debug("Request body, part 3: \n %s", parts[2].body.c_str());
}
N1N2MessageTransferReqData n1N2MessageTransferReqData = {};
......@@ -79,12 +80,12 @@ void N1N2MessageCollectionDocumentApi::n1_n2_message_transfer_handler(const Pist
this->n1_n2_message_transfer(ueContextId, n1N2MessageTransferReqData, parts[1].body, parts[2].body, response);
} catch (nlohmann::detail::exception &e) {
//send a 400 error
Logger::amf_server().error("response 400 error");
Logger::amf_server().error("Error %s, send a msg with error code 400 to SMF", e.what());
response.send(Pistache::Http::Code::Bad_Request, e.what());
return;
} catch (std::exception &e) {
//send a 500 error
Logger::amf_server().error("response 500 error");
Logger::amf_server().error("Error %s, send a msg with error code 500 to SMF", e.what());
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
return;
}
......
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