Commit 057332aa authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

polish the code

parent 9dddb5c1
......@@ -1427,7 +1427,6 @@ void smf_context::handle_pdu_session_update_sm_context_request(
int i = 0;
int length_of_rule = 0;
while (length_of_rule_ie > 0) {
//for (int i = 0; i < number_of_rules; i++) {
uint8_t rule_id = { 0 };
QOSRulesIE qos_rule = { };
pfcp::qfi_t qfi = { };
......@@ -1509,7 +1508,7 @@ void smf_context::handle_pdu_session_update_sm_context_request(
qcu.set_qos_profile(qos_flow.qos_profile);
sm_context_resp_pending->res.add_qos_flow_context_updated(qcu);
} else {
} else { //update existing QRI
qfi.qfi = qos_rules_ie[i].qosflowidentifer;
sp.get()->get_qos_flow(qfi, qos_flow);
qos_flow.update_qos_rule(qos_rules_ie[i]);
......@@ -1525,7 +1524,7 @@ void smf_context::handle_pdu_session_update_sm_context_request(
sm_context_resp_pending->res.add_qos_flow_context_updated(qcu);
}
length_of_rule_ie -= (length_of_rule + 3);
length_of_rule_ie -= (length_of_rule + 3); // 2 for Length of QoS rules IE and 1 for QoS rule identifier
}
......@@ -1626,16 +1625,6 @@ void smf_context::handle_pdu_session_update_sm_context_request(
//stop T3591
itti_inst->timer_remove(sp.get()->timer_T3591);
/* //Send PDUSession_UpdateSMContext Response to AMF
//No need to create N1/N2 Container
Logger::smf_app().info(
"PDU Session Modification UE-initiated (Step 3)");
smContextUpdatedData = { };
smf_n11_inst->send_pdu_session_update_sm_context_response(
n11_sm_context_resp->http_response, smContextUpdatedData,
Pistache::Http::Code::No_Content);
*/
//don't need to create a procedure to update UPF
//Send ITTI to N11 to send PDUSession_UpdateSMContext Response to AMF
//No need to create N1/N2 Container
......@@ -1694,16 +1683,6 @@ void smf_context::handle_pdu_session_update_sm_context_request(
//stop T3591
itti_inst->timer_remove(sp.get()->timer_T3591);
/* //Send PDUSession_UpdateSMContext Response to AMF
//No need to create N1/N2 Container
Logger::smf_app().info(
"PDU Session Modification UE-initiated (Step 3)");
smContextUpdatedData = { };
smf_n11_inst->send_pdu_session_update_sm_context_response(
n11_sm_context_resp->http_response, smContextUpdatedData,
Pistache::Http::Code::No_Content);
*/
//don't need to create a procedure to update UPF
//Send ITTI to N11 to send PDUSession_UpdateSMContext Response to AMF
//No need to create N1/N2 Container
......@@ -1869,12 +1848,6 @@ void smf_context::handle_pdu_session_update_sm_context_request(
//Stop timer T3592
itti_inst->timer_remove(sp.get()->timer_T3592);
/* //send response to AMF
smf_n11_inst->send_pdu_session_update_sm_context_response(
smreq->http_response, smContextUpdatedData,
Pistache::Http::Code::No_Content);
*/
//don't need to create a procedure to update UPF
//Send ITTI to N11 to send PDUSession_UpdateSMContext Response to AMF
//No need to create N1/N2 Container
......@@ -1891,18 +1864,7 @@ void smf_context::handle_pdu_session_update_sm_context_request(
//TODO: SMF invokes Nsmf_PDUSession_SMContextStatusNotify to notify AMF that the SM context for this PDU Session is released
//TODO: if dynamic PCC applied, SMF invokes an SM Policy Association Termination
//TODO: SMF unsubscribes from Session Management Subscription data changes notification from UDM by invoking Numd_SDM_Unsubscribe
//find dnn context
/* std::shared_ptr<dnn_context> sd = { };
bool find_dnn = find_dnn_context(sm_context_req_msg.get_snssai(),
sm_context_req_msg.get_dnn(), sd);
//At this step, this context should be existed
if (nullptr == sd.get()) {
Logger::smf_app().debug(
"DNN context (dnn_in_use %s) is not existed yet!",
sm_context_req_msg.get_dnn().c_str());
//TODO:
}
*/
if (sd.get()->get_number_pdu_sessions() == 0) {
Logger::smf_app().debug(
"Unsubscribe from Session Management Subscription data changes notification from UDM");
......@@ -2142,12 +2104,6 @@ void smf_context::handle_pdu_session_update_sm_context_request(
return;
}
/* //SMF send response to AMF
oai::smf_server::model::SmContextCreatedData smContextCreatedData; //Verify, do we need this?
smf_n11_inst->send_pdu_session_create_sm_context_response(
smreq->http_response, smContextCreatedData,
Pistache::Http::Code::Ok);
*/
//don't need to create a procedure to update UPF
//Send ITTI to N11 to send PDUSession_UpdateSMContext Response to AMF
//No need to create N1/N2 Container
......
......@@ -692,7 +692,6 @@ void smf_n1_n2::create_n2_sm_information(pdu_session_msg &msg,
switch (ngap_ie_type) {
//PDU Session Resource Setup Request Transfer
//need to be verified with Wireshark (case 1)
case n2_sm_info_type_e::PDU_RES_SETUP_REQ: {
//PDU Session Resource Setup Request Transfer
//This IE is included in the following messages:
......@@ -991,6 +990,15 @@ void smf_n1_n2::create_n2_sm_information(pdu_session_msg &msg,
ngap_IEs = (Ngap_PDUSessionResourceModifyRequestTransfer_t*) calloc(
1, sizeof(Ngap_PDUSessionResourceModifyRequestTransfer_t));
/*
Ngap_PDUSessionAggregateMaximumBitRate_t PDUSessionAggregateMaximumBitRate;
Ngap_UL_NGU_UP_TNLModifyList_t UL_NGU_UP_TNLModifyList;
Ngap_NetworkInstance_t NetworkInstance;
Ngap_QosFlowAddOrModifyRequestList_t QosFlowAddOrModifyRequestList;
Ngap_QosFlowListWithCause_t QosFlowListWithCause;
Ngap_UPTransportLayerInformationList_t UPTransportLayerInformationList;
*/
//PDUSessionAggregateMaximumBitRate
Ngap_PDUSessionResourceModifyRequestTransferIEs_t *pduSessionAggregateMaximumBitRate =
nullptr;
......@@ -1022,7 +1030,8 @@ void smf_n1_n2::create_n2_sm_information(pdu_session_msg &msg,
ASN_SEQUENCE_ADD(&ngap_IEs->protocolIEs.list,
pduSessionAggregateMaximumBitRate);
//Ngap_UL_NGU_UP_TNLModifyList_t
//Ngap_UL_NGU_UP_TNLModifyList_t (included if the PDU Session modification was requested by the UE for a
//PDU Session that has no established User Plane resources)
Ngap_PDUSessionResourceModifyRequestTransferIEs_t *ul_NGU_UP_TNLModifyList =
nullptr;
ul_NGU_UP_TNLModifyList =
......
......@@ -270,7 +270,7 @@ int session_create_sm_context_procedure::run(
QOSRulesIE qos_rule = { };
pc.get()->get_default_qos_rule(qos_rule,
sm_context_req->req.get_pdu_session_type());
uint8_t rule_id = {0};
uint8_t rule_id = { 0 };
ppc->generate_qos_rule_id(rule_id);
qos_rule.qosruleidentifer = rule_id;
qos_rule.qosflowidentifer = q.qfi.qfi;
......@@ -346,7 +346,7 @@ void session_create_sm_context_procedure::handle_itti_msg(
//TODO: how about pdu_session_id??
smf_qos_flow q = { };
QOSRulesIE qos_rule = {};
QOSRulesIE qos_rule = { };
qos_flow_context_updated qos_flow = { }; //default flow, so Non-GBR, TODO: //we can use smf_qos_flow instead!
qos_flow.set_cause(REQUEST_ACCEPTED);
if (not ppc->get_qos_flow(qfi, q)) {
......@@ -549,7 +549,8 @@ int session_update_sm_context_procedure::run(
pfcp::pdr_id_t pdr_id = { };
//if FAR DL exist -> remove it
if ((qos_flow.far_id_dl.first) && (qos_flow.far_id_dl.second.far_id)) {
Logger::smf_app().debug("Update SM Context procedure: send a request to remove FAR DL at UPF");
Logger::smf_app().debug(
"Update SM Context procedure: send a request to remove FAR DL at UPF");
// Remove FAR
far_id.far_id = qos_flow.far_id_dl.second.far_id;
pfcp::remove_far remove_far = { };
......@@ -561,7 +562,8 @@ int session_update_sm_context_procedure::run(
}
//remove PDR DL if exist
if (qos_flow.pdr_id_dl.rule_id) {
Logger::smf_app().debug("Update SM Context procedure: send a request to remove PDR DL at UPF");
Logger::smf_app().debug(
"Update SM Context procedure: send a request to remove PDR DL at UPF");
//Remove PDR DL
pdr_id.rule_id = qos_flow.pdr_id_dl.rule_id;
pfcp::remove_pdr remove_pdr = { };
......@@ -931,14 +933,16 @@ void session_update_sm_context_procedure::handle_itti_msg(
if ((qos_flow.far_id_dl.first)
&& (qos_flow.far_id_dl.second.far_id)) {
Logger::smf_app().debug(
"Update SM Context procedure: FAR DL %d has been removed", qos_flow.far_id_dl.second.far_id);
"Update SM Context procedure: FAR DL %d has been removed",
qos_flow.far_id_dl.second.far_id);
qos_flow.far_id_dl.first = false;
qos_flow.far_id_dl.second.far_id = 0;
}
//remove PDR DL if exist
if (qos_flow.pdr_id_dl.rule_id) {
Logger::smf_app().debug(
"Update SM Context procedure: PDR DL %d has been removed", qos_flow.pdr_id_dl.rule_id);
"Update SM Context procedure: PDR DL %d has been removed",
qos_flow.pdr_id_dl.rule_id);
qos_flow.pdr_id_dl.rule_id = 0;
}
// Update QoS Flow
......@@ -1180,7 +1184,8 @@ void session_update_sm_context_procedure::handle_itti_msg(
N2_SM_CONTENT_ID;
n11_triggered_pending->res.sm_context_updated_data["n2InfoContainer"]["smInfo"]["n2InfoContent"]["ngapIeType"] =
"PDU_RES_SETUP_REQ"; //NGAP message
n11_triggered_pending->res.sm_context_updated_data["upCnxState"] = "ACTIVATING";
n11_triggered_pending->res.sm_context_updated_data["upCnxState"] =
"ACTIVATING";
//TODO: verify whether cause is needed (as in 23.502 but not in 3GPP TS 29.502)
//Update upCnxState to ACTIVATING
......@@ -1198,37 +1203,6 @@ void session_update_sm_context_procedure::handle_itti_msg(
}
break;
//PDU Session Modification UE-initiated (Step 1)
case session_management_procedures_type_e::PDU_SESSION_MODIFICATION_UE_INITIATED_STEP1: {
//N1 SM: PDU Session Modification Command​
//N2 SM: PDU Session Resource Modify Request Transfer IE
//N1 SM
smf_n1_n2_inst.create_n1_sm_container(
n11_triggered_pending->res, PDU_SESSION_MODIFICATION_COMMAND,
n1_sm_msg, cause_value_5gsm_e::CAUSE_0_UNKNOWN); //TODO: need cause?
smf_app_inst->convert_string_2_hex(n1_sm_msg, n1_sm_msg_hex);
n11_triggered_pending->res.set_n1_sm_message(n1_sm_msg_hex);
//N2 SM Information
smf_n1_n2_inst.create_n2_sm_information(
n11_triggered_pending->res, 1, n2_sm_info_type_e::PDU_RES_MOD_REQ,
n2_sm_info);
smf_app_inst->convert_string_2_hex(n2_sm_info, n2_sm_info_hex);
n11_triggered_pending->res.set_n2_sm_information(n2_sm_info_hex);
//fill the content of SmContextUpdatedData
n11_triggered_pending->res.sm_context_updated_data =
sm_context_updated_data;
n11_triggered_pending->res.sm_context_updated_data["n2InfoContainer"]["smInfo"]["n2InfoContent"]["ngapIeType"] =
"PDU_RES_MOD_REQ"; //NGAP message
//Update PDU session status to PDU_SESSION_MODIFICATION_PENDING
ppc->set_pdu_session_status(
pdu_session_status_e::PDU_SESSION_MODIFICATION_PENDING);
}
break;
//PDU Session Modification UE-initiated (Step 2)
case session_management_procedures_type_e::PDU_SESSION_MODIFICATION_UE_INITIATED_STEP2: {
//No need to create N1/N2 Container
......
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