open5gs/src/upf/n4-handler.c

493 lines
16 KiB
C
Raw Normal View History

2020-04-26 19:36:05 +00:00
/*
* Copyright (C) 2019-2024 by Sukchan Lee <acetcom@gmail.com>
2020-04-26 19:36:05 +00:00
*
* This file is part of Open5GS.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "context.h"
#include "pfcp-path.h"
#include "gtp-path.h"
2020-04-26 19:36:05 +00:00
#include "n4-handler.h"
static void upf_n4_handle_create_urr(upf_sess_t *sess, ogs_pfcp_tlv_create_urr_t *create_urr_arr,
uint8_t *cause_value, uint8_t *offending_ie_value)
{
int i;
ogs_pfcp_urr_t *urr;
*cause_value = OGS_PFCP_CAUSE_REQUEST_ACCEPTED;
for (i = 0; i < OGS_MAX_NUM_OF_URR; i++) {
urr = ogs_pfcp_handle_create_urr(&sess->pfcp, &create_urr_arr[i],
cause_value, offending_ie_value);
if (!urr)
return;
/* TODO: enable counters somewhere else if ISTM not set, upon first pkt received */
if (urr->meas_info.istm) {
upf_sess_urr_acc_timers_setup(sess, urr);
}
}
}
2020-04-26 19:36:05 +00:00
void upf_n4_handle_session_establishment_request(
upf_sess_t *sess, ogs_pfcp_xact_t *xact,
2020-04-26 19:36:05 +00:00
ogs_pfcp_session_establishment_request_t *req)
{
2020-07-20 01:42:58 +00:00
ogs_pfcp_pdr_t *pdr = NULL;
2020-08-13 00:31:22 +00:00
ogs_pfcp_far_t *far = NULL;
2020-04-26 19:36:05 +00:00
ogs_pfcp_pdr_t *created_pdr[OGS_MAX_NUM_OF_PDR];
int num_of_created_pdr = 0;
uint8_t cause_value = 0;
uint8_t offending_ie_value = 0;
int i;
ogs_pfcp_sereq_flags_t sereq_flags;
bool restoration_indication = false;
[UPF] Add metrics support Expose metrics with labels according to ETSI TS 128 552 V16.13.0 in UPF by using hash. The metrics are named respecting the rule: <generation>_<measurement_object_class>_<measurement_family_name>_<metric_name_as_in_TS_128_552> 5qi is not available in UPF. To present 5qi to the user, MN will have to maintain a table qfi->5qi for each QoS flow (will have to get information from SMF). So UPF has to expose qfi. qfi itself is not useful. When used, UPF will have to expose additional label to define the session (e.g. source interface). Label dnn is set to value of APN/DNN received in Establishment. Since SMF does not add APN/DNN to Establishment, the label is empty. When APN/DNN will be set by SMF, it should be added to sess in UPF and used in metrics on Modification and Deletion. Both datavolumeqosleveln3upf are exposed in bytes. MN is providing the transformation to kbits. fivegs_upffunction_upf_qosflows should expose the number of QFIs used in sessions, but exposes number of QER rules, which is currently equal to QFIs. The label snsssai is not provided since the slice is not available on UPF. Exposed metrics example: Standard counters: fivegs_ep_n3_gtp_indatapktn3upf 28637 fivegs_ep_n3_gtp_outdatapktn3upf 14729 fivegs_upffunction_sm_n4sessionestabreq 4 fivegs_upffunction_sm_n4sessionestabfail{cause="66"} 1 fivegs_upffunction_sm_n4sessionestabfail{cause="71"} 68 fivegs_upffunction_sm_n4sessionestabfail{cause="68"} 4 fivegs_upffunction_sm_n4sessionestabfail{cause="72"} 15 fivegs_upffunction_sm_n4sessionestabfail{cause="75"} 3 fivegs_upffunction_sm_n4sessionestabfail{cause="65"} 4 fivegs_upffunction_sm_n4sessionreport 0 fivegs_upffunction_sm_n4sessionreportsucc 0 fivegs_ep_n3_gtp_indatavolumeqosleveln3upf{qfi="1"} 39792997 fivegs_ep_n3_gtp_outdatavolumeqosleveln3upf{qfi="1"} 737548 Nonstandard gauge (added for controlling purposes - same metric as existing metric on AMF and SMF): fivegs_upffunction_upf_sessionnbr 1 Standard gauge: fivegs_upffunction_upf_qosflows{dnn=""} 1
2022-08-19 12:08:27 +00:00
upf_metrics_inst_global_inc(UPF_METR_GLOB_CTR_SM_N4SESSIONESTABREQ);
2020-04-26 19:36:05 +00:00
ogs_assert(xact);
ogs_assert(req);
2020-07-09 05:38:09 +00:00
ogs_debug("Session Establishment Request");
2020-04-26 19:36:05 +00:00
cause_value = OGS_PFCP_CAUSE_REQUEST_ACCEPTED;
if (!sess) {
ogs_error("No Context");
ogs_pfcp_send_error_message(xact,
OGS_PFCP_SEID_NO_PRESENCE, 0,
2020-04-26 19:36:05 +00:00
OGS_PFCP_SESSION_ESTABLISHMENT_RESPONSE_TYPE,
OGS_PFCP_CAUSE_MANDATORY_IE_MISSING, 0);
[UPF] Add metrics support Expose metrics with labels according to ETSI TS 128 552 V16.13.0 in UPF by using hash. The metrics are named respecting the rule: <generation>_<measurement_object_class>_<measurement_family_name>_<metric_name_as_in_TS_128_552> 5qi is not available in UPF. To present 5qi to the user, MN will have to maintain a table qfi->5qi for each QoS flow (will have to get information from SMF). So UPF has to expose qfi. qfi itself is not useful. When used, UPF will have to expose additional label to define the session (e.g. source interface). Label dnn is set to value of APN/DNN received in Establishment. Since SMF does not add APN/DNN to Establishment, the label is empty. When APN/DNN will be set by SMF, it should be added to sess in UPF and used in metrics on Modification and Deletion. Both datavolumeqosleveln3upf are exposed in bytes. MN is providing the transformation to kbits. fivegs_upffunction_upf_qosflows should expose the number of QFIs used in sessions, but exposes number of QER rules, which is currently equal to QFIs. The label snsssai is not provided since the slice is not available on UPF. Exposed metrics example: Standard counters: fivegs_ep_n3_gtp_indatapktn3upf 28637 fivegs_ep_n3_gtp_outdatapktn3upf 14729 fivegs_upffunction_sm_n4sessionestabreq 4 fivegs_upffunction_sm_n4sessionestabfail{cause="66"} 1 fivegs_upffunction_sm_n4sessionestabfail{cause="71"} 68 fivegs_upffunction_sm_n4sessionestabfail{cause="68"} 4 fivegs_upffunction_sm_n4sessionestabfail{cause="72"} 15 fivegs_upffunction_sm_n4sessionestabfail{cause="75"} 3 fivegs_upffunction_sm_n4sessionestabfail{cause="65"} 4 fivegs_upffunction_sm_n4sessionreport 0 fivegs_upffunction_sm_n4sessionreportsucc 0 fivegs_ep_n3_gtp_indatavolumeqosleveln3upf{qfi="1"} 39792997 fivegs_ep_n3_gtp_outdatavolumeqosleveln3upf{qfi="1"} 737548 Nonstandard gauge (added for controlling purposes - same metric as existing metric on AMF and SMF): fivegs_upffunction_upf_sessionnbr 1 Standard gauge: fivegs_upffunction_upf_qosflows{dnn=""} 1
2022-08-19 12:08:27 +00:00
upf_metrics_inst_by_cause_add(OGS_PFCP_CAUSE_MANDATORY_IE_MISSING,
UPF_METR_CTR_SM_N4SESSIONESTABFAIL, 1);
2020-04-26 19:36:05 +00:00
return;
}
memset(&sereq_flags, 0, sizeof(sereq_flags));
if (req->pfcpsereq_flags.presence == 1)
sereq_flags.value = req->pfcpsereq_flags.u8;
2020-04-26 19:36:05 +00:00
for (i = 0; i < OGS_MAX_NUM_OF_PDR; i++) {
2020-08-13 00:31:22 +00:00
created_pdr[i] = ogs_pfcp_handle_create_pdr(&sess->pfcp,
&req->create_pdr[i], &sereq_flags,
&cause_value, &offending_ie_value);
2020-04-26 19:36:05 +00:00
if (created_pdr[i] == NULL)
break;
}
num_of_created_pdr = i;
if (cause_value != OGS_PFCP_CAUSE_REQUEST_ACCEPTED)
goto cleanup;
for (i = 0; i < OGS_MAX_NUM_OF_FAR; i++) {
2020-08-13 00:31:22 +00:00
if (ogs_pfcp_handle_create_far(&sess->pfcp, &req->create_far[i],
2020-04-26 19:36:05 +00:00
&cause_value, &offending_ie_value) == NULL)
break;
}
if (cause_value != OGS_PFCP_CAUSE_REQUEST_ACCEPTED)
goto cleanup;
upf_n4_handle_create_urr(sess, &req->create_urr[0], &cause_value, &offending_ie_value);
2021-10-04 13:28:32 +00:00
if (cause_value != OGS_PFCP_CAUSE_REQUEST_ACCEPTED)
goto cleanup;
if (req->apn_dnn.presence) {
char apn_dnn[OGS_MAX_DNN_LEN+1];
ogs_assert(0 < ogs_fqdn_parse(apn_dnn, req->apn_dnn.data,
ogs_min(req->apn_dnn.len, OGS_MAX_DNN_LEN)));
if (sess->apn_dnn)
ogs_free(sess->apn_dnn);
sess->apn_dnn = ogs_strdup(apn_dnn);
ogs_assert(sess->apn_dnn);
}
2020-04-26 19:36:05 +00:00
for (i = 0; i < OGS_MAX_NUM_OF_QER; i++) {
2020-08-13 00:31:22 +00:00
if (ogs_pfcp_handle_create_qer(&sess->pfcp, &req->create_qer[i],
2020-04-26 19:36:05 +00:00
&cause_value, &offending_ie_value) == NULL)
break;
upf_metrics_inst_by_dnn_add(sess->apn_dnn,
UPF_METR_GAUGE_UPF_QOSFLOWS, 1);
2020-04-26 19:36:05 +00:00
}
if (cause_value != OGS_PFCP_CAUSE_REQUEST_ACCEPTED)
goto cleanup;
ogs_pfcp_handle_create_bar(&sess->pfcp, &req->create_bar,
&cause_value, &offending_ie_value);
if (cause_value != OGS_PFCP_CAUSE_REQUEST_ACCEPTED)
goto cleanup;
/* Setup GTP Node */
ogs_list_for_each(&sess->pfcp.far_list, far) {
if (OGS_ERROR == ogs_pfcp_setup_far_gtpu_node(far)) {
ogs_fatal("CHECK CONFIGURATION: upf.gtpu");
ogs_fatal("ogs_pfcp_setup_far_gtpu_node() failed");
goto cleanup;
}
if (far->gnode)
ogs_pfcp_far_f_teid_hash_set(far);
}
/* PFCPSEReq-Flags */
if (sereq_flags.restoration_indication == 1) {
for (i = 0; i < num_of_created_pdr; i++) {
pdr = created_pdr[i];
ogs_assert(pdr);
if (pdr->f_teid_len)
ogs_pfcp_pdr_swap_teid(pdr);
}
restoration_indication = true;
}
2020-07-20 01:42:58 +00:00
for (i = 0; i < num_of_created_pdr; i++) {
pdr = created_pdr[i];
ogs_assert(pdr);
/* Setup UE IP address */
if (pdr->ue_ip_addr_len) {
if (req->pdn_type.presence == 1) {
cause_value = upf_sess_set_ue_ip(sess, req->pdn_type.u8, pdr);
if (cause_value != OGS_PFCP_CAUSE_REQUEST_ACCEPTED)
goto cleanup;
} else {
ogs_error("No PDN Type");
}
}
2023-01-18 11:32:42 +00:00
if (pdr->ipv4_framed_routes) {
cause_value =
upf_sess_set_ue_ipv4_framed_routes(sess,
pdr->ipv4_framed_routes);
if (cause_value != OGS_PFCP_CAUSE_REQUEST_ACCEPTED)
goto cleanup;
}
if (pdr->ipv6_framed_routes) {
cause_value =
upf_sess_set_ue_ipv6_framed_routes(sess,
pdr->ipv6_framed_routes);
if (cause_value != OGS_PFCP_CAUSE_REQUEST_ACCEPTED)
goto cleanup;
}
/* Setup UPF-N3-TEID & QFI Hash */
if (pdr->f_teid_len)
ogs_pfcp_object_teid_hash_set(
OGS_PFCP_OBJ_SESS_TYPE, pdr, restoration_indication);
2020-07-20 01:42:58 +00:00
}
/* Send Buffered Packet to gNB/SGW */
ogs_list_for_each(&sess->pfcp.pdr_list, pdr) {
if (pdr->src_if == OGS_PFCP_INTERFACE_CORE) { /* Downlink */
2020-08-13 00:31:22 +00:00
ogs_pfcp_send_buffered_packet(pdr);
2020-07-20 01:42:58 +00:00
}
}
if (restoration_indication == true ||
ogs_pfcp_self()->up_function_features.ftup == 0)
ogs_assert(OGS_OK ==
upf_pfcp_send_session_establishment_response(
xact, sess, NULL, 0));
else
ogs_assert(OGS_OK ==
upf_pfcp_send_session_establishment_response(
xact, sess, created_pdr, num_of_created_pdr));
2020-04-26 19:36:05 +00:00
return;
cleanup:
[UPF] Add metrics support Expose metrics with labels according to ETSI TS 128 552 V16.13.0 in UPF by using hash. The metrics are named respecting the rule: <generation>_<measurement_object_class>_<measurement_family_name>_<metric_name_as_in_TS_128_552> 5qi is not available in UPF. To present 5qi to the user, MN will have to maintain a table qfi->5qi for each QoS flow (will have to get information from SMF). So UPF has to expose qfi. qfi itself is not useful. When used, UPF will have to expose additional label to define the session (e.g. source interface). Label dnn is set to value of APN/DNN received in Establishment. Since SMF does not add APN/DNN to Establishment, the label is empty. When APN/DNN will be set by SMF, it should be added to sess in UPF and used in metrics on Modification and Deletion. Both datavolumeqosleveln3upf are exposed in bytes. MN is providing the transformation to kbits. fivegs_upffunction_upf_qosflows should expose the number of QFIs used in sessions, but exposes number of QER rules, which is currently equal to QFIs. The label snsssai is not provided since the slice is not available on UPF. Exposed metrics example: Standard counters: fivegs_ep_n3_gtp_indatapktn3upf 28637 fivegs_ep_n3_gtp_outdatapktn3upf 14729 fivegs_upffunction_sm_n4sessionestabreq 4 fivegs_upffunction_sm_n4sessionestabfail{cause="66"} 1 fivegs_upffunction_sm_n4sessionestabfail{cause="71"} 68 fivegs_upffunction_sm_n4sessionestabfail{cause="68"} 4 fivegs_upffunction_sm_n4sessionestabfail{cause="72"} 15 fivegs_upffunction_sm_n4sessionestabfail{cause="75"} 3 fivegs_upffunction_sm_n4sessionestabfail{cause="65"} 4 fivegs_upffunction_sm_n4sessionreport 0 fivegs_upffunction_sm_n4sessionreportsucc 0 fivegs_ep_n3_gtp_indatavolumeqosleveln3upf{qfi="1"} 39792997 fivegs_ep_n3_gtp_outdatavolumeqosleveln3upf{qfi="1"} 737548 Nonstandard gauge (added for controlling purposes - same metric as existing metric on AMF and SMF): fivegs_upffunction_upf_sessionnbr 1 Standard gauge: fivegs_upffunction_upf_qosflows{dnn=""} 1
2022-08-19 12:08:27 +00:00
upf_metrics_inst_by_cause_add(cause_value,
UPF_METR_CTR_SM_N4SESSIONESTABFAIL, 1);
2020-04-26 19:36:05 +00:00
ogs_pfcp_sess_clear(&sess->pfcp);
ogs_pfcp_send_error_message(xact,
sess ? OGS_PFCP_SEID_PRESENCE : OGS_PFCP_SEID_NO_PRESENCE,
sess ? sess->smf_n4_f_seid.seid : 0,
2020-04-26 19:36:05 +00:00
OGS_PFCP_SESSION_ESTABLISHMENT_RESPONSE_TYPE,
cause_value, offending_ie_value);
}
void upf_n4_handle_session_modification_request(
upf_sess_t *sess, ogs_pfcp_xact_t *xact,
2020-04-26 19:36:05 +00:00
ogs_pfcp_session_modification_request_t *req)
{
2020-07-20 01:42:58 +00:00
ogs_pfcp_pdr_t *pdr = NULL;
2020-08-13 00:31:22 +00:00
ogs_pfcp_far_t *far = NULL;
2020-04-26 19:36:05 +00:00
ogs_pfcp_pdr_t *created_pdr[OGS_MAX_NUM_OF_PDR];
int num_of_created_pdr = 0;
uint8_t cause_value = 0;
uint8_t offending_ie_value = 0;
int i;
ogs_assert(xact);
ogs_assert(req);
2020-07-09 05:38:09 +00:00
ogs_debug("Session Modification Request");
2020-04-26 19:36:05 +00:00
cause_value = OGS_PFCP_CAUSE_REQUEST_ACCEPTED;
if (!sess) {
2020-08-13 00:31:22 +00:00
ogs_error("No Context");
ogs_pfcp_send_error_message(xact,
OGS_PFCP_SEID_NO_PRESENCE, 0,
2020-04-26 19:36:05 +00:00
OGS_PFCP_SESSION_MODIFICATION_RESPONSE_TYPE,
OGS_PFCP_CAUSE_SESSION_CONTEXT_NOT_FOUND, 0);
return;
}
for (i = 0; i < OGS_MAX_NUM_OF_PDR; i++) {
2020-08-13 00:31:22 +00:00
created_pdr[i] = ogs_pfcp_handle_create_pdr(&sess->pfcp,
&req->create_pdr[i], NULL, &cause_value, &offending_ie_value);
2020-04-26 19:36:05 +00:00
if (created_pdr[i] == NULL)
break;
}
num_of_created_pdr = i;
if (cause_value != OGS_PFCP_CAUSE_REQUEST_ACCEPTED)
goto cleanup;
for (i = 0; i < OGS_MAX_NUM_OF_PDR; i++) {
2020-08-13 00:31:22 +00:00
if (ogs_pfcp_handle_update_pdr(&sess->pfcp, &req->update_pdr[i],
&cause_value, &offending_ie_value) == NULL)
break;
}
if (cause_value != OGS_PFCP_CAUSE_REQUEST_ACCEPTED)
goto cleanup;
for (i = 0; i < OGS_MAX_NUM_OF_PDR; i++) {
if (ogs_pfcp_handle_remove_pdr(&sess->pfcp, &req->remove_pdr[i],
2020-04-26 19:36:05 +00:00
&cause_value, &offending_ie_value) == false)
break;
}
if (cause_value != OGS_PFCP_CAUSE_REQUEST_ACCEPTED)
goto cleanup;
for (i = 0; i < OGS_MAX_NUM_OF_FAR; i++) {
2020-08-13 00:31:22 +00:00
if (ogs_pfcp_handle_create_far(&sess->pfcp, &req->create_far[i],
2020-04-26 19:36:05 +00:00
&cause_value, &offending_ie_value) == NULL)
break;
}
if (cause_value != OGS_PFCP_CAUSE_REQUEST_ACCEPTED)
goto cleanup;
2020-06-17 05:22:28 +00:00
for (i = 0; i < OGS_MAX_NUM_OF_FAR; i++) {
2020-08-13 00:31:22 +00:00
if (ogs_pfcp_handle_update_far_flags(&sess->pfcp, &req->update_far[i],
2020-06-17 05:22:28 +00:00
&cause_value, &offending_ie_value) == NULL)
break;
}
if (cause_value != OGS_PFCP_CAUSE_REQUEST_ACCEPTED)
goto cleanup;
2020-08-13 00:31:22 +00:00
/* Send End Marker to gNB */
ogs_list_for_each(&sess->pfcp.pdr_list, pdr) {
if (pdr->src_if == OGS_PFCP_INTERFACE_CORE) { /* Downlink */
far = pdr->far;
if (far && far->smreq_flags.send_end_marker_packets)
ogs_assert(OGS_ERROR != ogs_pfcp_send_end_marker(pdr));
}
2020-08-13 00:31:22 +00:00
}
/* Clear PFCPSMReq-Flags */
ogs_list_for_each(&sess->pfcp.far_list, far)
far->smreq_flags.value = 0;
2020-06-17 05:22:28 +00:00
for (i = 0; i < OGS_MAX_NUM_OF_FAR; i++) {
2020-08-13 00:31:22 +00:00
if (ogs_pfcp_handle_update_far(&sess->pfcp, &req->update_far[i],
&cause_value, &offending_ie_value) == NULL)
break;
}
if (cause_value != OGS_PFCP_CAUSE_REQUEST_ACCEPTED)
goto cleanup;
for (i = 0; i < OGS_MAX_NUM_OF_FAR; i++) {
if (ogs_pfcp_handle_remove_far(&sess->pfcp, &req->remove_far[i],
2020-04-26 19:36:05 +00:00
&cause_value, &offending_ie_value) == false)
break;
}
if (cause_value != OGS_PFCP_CAUSE_REQUEST_ACCEPTED)
goto cleanup;
upf_n4_handle_create_urr(sess, &req->create_urr[0], &cause_value, &offending_ie_value);
2021-10-04 13:28:32 +00:00
if (cause_value != OGS_PFCP_CAUSE_REQUEST_ACCEPTED)
goto cleanup;
for (i = 0; i < OGS_MAX_NUM_OF_URR; i++) {
if (ogs_pfcp_handle_update_urr(&sess->pfcp, &req->update_urr[i],
&cause_value, &offending_ie_value) == NULL)
break;
}
if (cause_value != OGS_PFCP_CAUSE_REQUEST_ACCEPTED)
goto cleanup;
for (i = 0; i < OGS_MAX_NUM_OF_URR; i++) {
if (ogs_pfcp_handle_remove_urr(&sess->pfcp, &req->remove_urr[i],
&cause_value, &offending_ie_value) == false)
break;
}
if (cause_value != OGS_PFCP_CAUSE_REQUEST_ACCEPTED)
goto cleanup;
2020-04-26 19:36:05 +00:00
for (i = 0; i < OGS_MAX_NUM_OF_QER; i++) {
2020-08-13 00:31:22 +00:00
if (ogs_pfcp_handle_create_qer(&sess->pfcp, &req->create_qer[i],
2020-04-26 19:36:05 +00:00
&cause_value, &offending_ie_value) == NULL)
break;
upf_metrics_inst_by_dnn_add(sess->apn_dnn,
[UPF] Add metrics support Expose metrics with labels according to ETSI TS 128 552 V16.13.0 in UPF by using hash. The metrics are named respecting the rule: <generation>_<measurement_object_class>_<measurement_family_name>_<metric_name_as_in_TS_128_552> 5qi is not available in UPF. To present 5qi to the user, MN will have to maintain a table qfi->5qi for each QoS flow (will have to get information from SMF). So UPF has to expose qfi. qfi itself is not useful. When used, UPF will have to expose additional label to define the session (e.g. source interface). Label dnn is set to value of APN/DNN received in Establishment. Since SMF does not add APN/DNN to Establishment, the label is empty. When APN/DNN will be set by SMF, it should be added to sess in UPF and used in metrics on Modification and Deletion. Both datavolumeqosleveln3upf are exposed in bytes. MN is providing the transformation to kbits. fivegs_upffunction_upf_qosflows should expose the number of QFIs used in sessions, but exposes number of QER rules, which is currently equal to QFIs. The label snsssai is not provided since the slice is not available on UPF. Exposed metrics example: Standard counters: fivegs_ep_n3_gtp_indatapktn3upf 28637 fivegs_ep_n3_gtp_outdatapktn3upf 14729 fivegs_upffunction_sm_n4sessionestabreq 4 fivegs_upffunction_sm_n4sessionestabfail{cause="66"} 1 fivegs_upffunction_sm_n4sessionestabfail{cause="71"} 68 fivegs_upffunction_sm_n4sessionestabfail{cause="68"} 4 fivegs_upffunction_sm_n4sessionestabfail{cause="72"} 15 fivegs_upffunction_sm_n4sessionestabfail{cause="75"} 3 fivegs_upffunction_sm_n4sessionestabfail{cause="65"} 4 fivegs_upffunction_sm_n4sessionreport 0 fivegs_upffunction_sm_n4sessionreportsucc 0 fivegs_ep_n3_gtp_indatavolumeqosleveln3upf{qfi="1"} 39792997 fivegs_ep_n3_gtp_outdatavolumeqosleveln3upf{qfi="1"} 737548 Nonstandard gauge (added for controlling purposes - same metric as existing metric on AMF and SMF): fivegs_upffunction_upf_sessionnbr 1 Standard gauge: fivegs_upffunction_upf_qosflows{dnn=""} 1
2022-08-19 12:08:27 +00:00
UPF_METR_GAUGE_UPF_QOSFLOWS, 1);
2020-04-26 19:36:05 +00:00
}
if (cause_value != OGS_PFCP_CAUSE_REQUEST_ACCEPTED)
goto cleanup;
for (i = 0; i < OGS_MAX_NUM_OF_QER; i++) {
2020-08-13 00:31:22 +00:00
if (ogs_pfcp_handle_update_qer(&sess->pfcp, &req->update_qer[i],
2020-04-26 19:36:05 +00:00
&cause_value, &offending_ie_value) == NULL)
break;
}
if (cause_value != OGS_PFCP_CAUSE_REQUEST_ACCEPTED)
goto cleanup;
2020-06-17 05:22:28 +00:00
for (i = 0; i < OGS_MAX_NUM_OF_QER; i++) {
2020-08-13 00:31:22 +00:00
if (ogs_pfcp_handle_remove_qer(&sess->pfcp, &req->remove_qer[i],
2020-04-26 19:36:05 +00:00
&cause_value, &offending_ie_value) == false)
break;
upf_metrics_inst_by_dnn_add(sess->apn_dnn,
[UPF] Add metrics support Expose metrics with labels according to ETSI TS 128 552 V16.13.0 in UPF by using hash. The metrics are named respecting the rule: <generation>_<measurement_object_class>_<measurement_family_name>_<metric_name_as_in_TS_128_552> 5qi is not available in UPF. To present 5qi to the user, MN will have to maintain a table qfi->5qi for each QoS flow (will have to get information from SMF). So UPF has to expose qfi. qfi itself is not useful. When used, UPF will have to expose additional label to define the session (e.g. source interface). Label dnn is set to value of APN/DNN received in Establishment. Since SMF does not add APN/DNN to Establishment, the label is empty. When APN/DNN will be set by SMF, it should be added to sess in UPF and used in metrics on Modification and Deletion. Both datavolumeqosleveln3upf are exposed in bytes. MN is providing the transformation to kbits. fivegs_upffunction_upf_qosflows should expose the number of QFIs used in sessions, but exposes number of QER rules, which is currently equal to QFIs. The label snsssai is not provided since the slice is not available on UPF. Exposed metrics example: Standard counters: fivegs_ep_n3_gtp_indatapktn3upf 28637 fivegs_ep_n3_gtp_outdatapktn3upf 14729 fivegs_upffunction_sm_n4sessionestabreq 4 fivegs_upffunction_sm_n4sessionestabfail{cause="66"} 1 fivegs_upffunction_sm_n4sessionestabfail{cause="71"} 68 fivegs_upffunction_sm_n4sessionestabfail{cause="68"} 4 fivegs_upffunction_sm_n4sessionestabfail{cause="72"} 15 fivegs_upffunction_sm_n4sessionestabfail{cause="75"} 3 fivegs_upffunction_sm_n4sessionestabfail{cause="65"} 4 fivegs_upffunction_sm_n4sessionreport 0 fivegs_upffunction_sm_n4sessionreportsucc 0 fivegs_ep_n3_gtp_indatavolumeqosleveln3upf{qfi="1"} 39792997 fivegs_ep_n3_gtp_outdatavolumeqosleveln3upf{qfi="1"} 737548 Nonstandard gauge (added for controlling purposes - same metric as existing metric on AMF and SMF): fivegs_upffunction_upf_sessionnbr 1 Standard gauge: fivegs_upffunction_upf_qosflows{dnn=""} 1
2022-08-19 12:08:27 +00:00
UPF_METR_GAUGE_UPF_QOSFLOWS, -1);
2020-04-26 19:36:05 +00:00
}
if (cause_value != OGS_PFCP_CAUSE_REQUEST_ACCEPTED)
goto cleanup;
ogs_pfcp_handle_create_bar(&sess->pfcp, &req->create_bar,
&cause_value, &offending_ie_value);
if (cause_value != OGS_PFCP_CAUSE_REQUEST_ACCEPTED)
goto cleanup;
ogs_pfcp_handle_remove_bar(&sess->pfcp, &req->remove_bar,
&cause_value, &offending_ie_value);
if (cause_value != OGS_PFCP_CAUSE_REQUEST_ACCEPTED)
goto cleanup;
2020-08-13 00:31:22 +00:00
/* Setup GTP Node */
2021-03-15 01:01:55 +00:00
ogs_list_for_each(&sess->pfcp.far_list, far) {
if (OGS_ERROR == ogs_pfcp_setup_far_gtpu_node(far)) {
ogs_fatal("CHECK CONFIGURATION: upf.gtpu");
ogs_fatal("ogs_pfcp_setup_far_gtpu_node() failed");
goto cleanup;
}
2021-03-15 01:01:55 +00:00
if (far->gnode)
ogs_pfcp_far_f_teid_hash_set(far);
}
2020-08-13 00:31:22 +00:00
2020-07-20 01:42:58 +00:00
for (i = 0; i < num_of_created_pdr; i++) {
pdr = created_pdr[i];
ogs_assert(pdr);
/* Setup UPF-N3-TEID & QFI Hash */
if (pdr->f_teid_len)
ogs_pfcp_object_teid_hash_set(OGS_PFCP_OBJ_SESS_TYPE, pdr, false);
2020-07-20 01:42:58 +00:00
}
/* Send Buffered Packet to gNB/SGW */
ogs_list_for_each(&sess->pfcp.pdr_list, pdr) {
if (pdr->src_if == OGS_PFCP_INTERFACE_CORE) { /* Downlink */
2020-08-13 00:31:22 +00:00
ogs_pfcp_send_buffered_packet(pdr);
2020-07-20 01:42:58 +00:00
}
}
if (ogs_pfcp_self()->up_function_features.ftup == 0)
ogs_assert(OGS_OK ==
upf_pfcp_send_session_modification_response(
xact, sess, NULL, 0));
else
ogs_assert(OGS_OK ==
upf_pfcp_send_session_modification_response(
xact, sess, created_pdr, num_of_created_pdr));
2020-04-26 19:36:05 +00:00
return;
cleanup:
ogs_pfcp_sess_clear(&sess->pfcp);
ogs_pfcp_send_error_message(xact,
sess ? OGS_PFCP_SEID_PRESENCE : OGS_PFCP_SEID_NO_PRESENCE,
sess ? sess->smf_n4_f_seid.seid : 0,
2020-04-26 19:36:05 +00:00
OGS_PFCP_SESSION_MODIFICATION_RESPONSE_TYPE,
cause_value, offending_ie_value);
}
void upf_n4_handle_session_deletion_request(
upf_sess_t *sess, ogs_pfcp_xact_t *xact,
ogs_pfcp_session_deletion_request_t *req)
{
[UPF] Add metrics support Expose metrics with labels according to ETSI TS 128 552 V16.13.0 in UPF by using hash. The metrics are named respecting the rule: <generation>_<measurement_object_class>_<measurement_family_name>_<metric_name_as_in_TS_128_552> 5qi is not available in UPF. To present 5qi to the user, MN will have to maintain a table qfi->5qi for each QoS flow (will have to get information from SMF). So UPF has to expose qfi. qfi itself is not useful. When used, UPF will have to expose additional label to define the session (e.g. source interface). Label dnn is set to value of APN/DNN received in Establishment. Since SMF does not add APN/DNN to Establishment, the label is empty. When APN/DNN will be set by SMF, it should be added to sess in UPF and used in metrics on Modification and Deletion. Both datavolumeqosleveln3upf are exposed in bytes. MN is providing the transformation to kbits. fivegs_upffunction_upf_qosflows should expose the number of QFIs used in sessions, but exposes number of QER rules, which is currently equal to QFIs. The label snsssai is not provided since the slice is not available on UPF. Exposed metrics example: Standard counters: fivegs_ep_n3_gtp_indatapktn3upf 28637 fivegs_ep_n3_gtp_outdatapktn3upf 14729 fivegs_upffunction_sm_n4sessionestabreq 4 fivegs_upffunction_sm_n4sessionestabfail{cause="66"} 1 fivegs_upffunction_sm_n4sessionestabfail{cause="71"} 68 fivegs_upffunction_sm_n4sessionestabfail{cause="68"} 4 fivegs_upffunction_sm_n4sessionestabfail{cause="72"} 15 fivegs_upffunction_sm_n4sessionestabfail{cause="75"} 3 fivegs_upffunction_sm_n4sessionestabfail{cause="65"} 4 fivegs_upffunction_sm_n4sessionreport 0 fivegs_upffunction_sm_n4sessionreportsucc 0 fivegs_ep_n3_gtp_indatavolumeqosleveln3upf{qfi="1"} 39792997 fivegs_ep_n3_gtp_outdatavolumeqosleveln3upf{qfi="1"} 737548 Nonstandard gauge (added for controlling purposes - same metric as existing metric on AMF and SMF): fivegs_upffunction_upf_sessionnbr 1 Standard gauge: fivegs_upffunction_upf_qosflows{dnn=""} 1
2022-08-19 12:08:27 +00:00
ogs_pfcp_qer_t *qer = NULL;
2020-04-26 19:36:05 +00:00
ogs_assert(xact);
ogs_assert(req);
2020-07-09 05:38:09 +00:00
ogs_debug("Session Deletion Request");
2020-04-26 19:36:05 +00:00
if (!sess) {
2020-08-13 00:31:22 +00:00
ogs_error("No Context");
ogs_pfcp_send_error_message(xact,
OGS_PFCP_SEID_NO_PRESENCE, 0,
2020-07-04 03:14:48 +00:00
OGS_PFCP_SESSION_DELETION_RESPONSE_TYPE,
2020-04-26 19:36:05 +00:00
OGS_PFCP_CAUSE_SESSION_CONTEXT_NOT_FOUND, 0);
return;
}
upf_pfcp_send_session_deletion_response(xact, sess);
[UPF] Add metrics support Expose metrics with labels according to ETSI TS 128 552 V16.13.0 in UPF by using hash. The metrics are named respecting the rule: <generation>_<measurement_object_class>_<measurement_family_name>_<metric_name_as_in_TS_128_552> 5qi is not available in UPF. To present 5qi to the user, MN will have to maintain a table qfi->5qi for each QoS flow (will have to get information from SMF). So UPF has to expose qfi. qfi itself is not useful. When used, UPF will have to expose additional label to define the session (e.g. source interface). Label dnn is set to value of APN/DNN received in Establishment. Since SMF does not add APN/DNN to Establishment, the label is empty. When APN/DNN will be set by SMF, it should be added to sess in UPF and used in metrics on Modification and Deletion. Both datavolumeqosleveln3upf are exposed in bytes. MN is providing the transformation to kbits. fivegs_upffunction_upf_qosflows should expose the number of QFIs used in sessions, but exposes number of QER rules, which is currently equal to QFIs. The label snsssai is not provided since the slice is not available on UPF. Exposed metrics example: Standard counters: fivegs_ep_n3_gtp_indatapktn3upf 28637 fivegs_ep_n3_gtp_outdatapktn3upf 14729 fivegs_upffunction_sm_n4sessionestabreq 4 fivegs_upffunction_sm_n4sessionestabfail{cause="66"} 1 fivegs_upffunction_sm_n4sessionestabfail{cause="71"} 68 fivegs_upffunction_sm_n4sessionestabfail{cause="68"} 4 fivegs_upffunction_sm_n4sessionestabfail{cause="72"} 15 fivegs_upffunction_sm_n4sessionestabfail{cause="75"} 3 fivegs_upffunction_sm_n4sessionestabfail{cause="65"} 4 fivegs_upffunction_sm_n4sessionreport 0 fivegs_upffunction_sm_n4sessionreportsucc 0 fivegs_ep_n3_gtp_indatavolumeqosleveln3upf{qfi="1"} 39792997 fivegs_ep_n3_gtp_outdatavolumeqosleveln3upf{qfi="1"} 737548 Nonstandard gauge (added for controlling purposes - same metric as existing metric on AMF and SMF): fivegs_upffunction_upf_sessionnbr 1 Standard gauge: fivegs_upffunction_upf_qosflows{dnn=""} 1
2022-08-19 12:08:27 +00:00
ogs_list_for_each(&sess->pfcp.qer_list, qer) {
upf_metrics_inst_by_dnn_add(sess->apn_dnn,
UPF_METR_GAUGE_UPF_QOSFLOWS, -1);
[UPF] Add metrics support Expose metrics with labels according to ETSI TS 128 552 V16.13.0 in UPF by using hash. The metrics are named respecting the rule: <generation>_<measurement_object_class>_<measurement_family_name>_<metric_name_as_in_TS_128_552> 5qi is not available in UPF. To present 5qi to the user, MN will have to maintain a table qfi->5qi for each QoS flow (will have to get information from SMF). So UPF has to expose qfi. qfi itself is not useful. When used, UPF will have to expose additional label to define the session (e.g. source interface). Label dnn is set to value of APN/DNN received in Establishment. Since SMF does not add APN/DNN to Establishment, the label is empty. When APN/DNN will be set by SMF, it should be added to sess in UPF and used in metrics on Modification and Deletion. Both datavolumeqosleveln3upf are exposed in bytes. MN is providing the transformation to kbits. fivegs_upffunction_upf_qosflows should expose the number of QFIs used in sessions, but exposes number of QER rules, which is currently equal to QFIs. The label snsssai is not provided since the slice is not available on UPF. Exposed metrics example: Standard counters: fivegs_ep_n3_gtp_indatapktn3upf 28637 fivegs_ep_n3_gtp_outdatapktn3upf 14729 fivegs_upffunction_sm_n4sessionestabreq 4 fivegs_upffunction_sm_n4sessionestabfail{cause="66"} 1 fivegs_upffunction_sm_n4sessionestabfail{cause="71"} 68 fivegs_upffunction_sm_n4sessionestabfail{cause="68"} 4 fivegs_upffunction_sm_n4sessionestabfail{cause="72"} 15 fivegs_upffunction_sm_n4sessionestabfail{cause="75"} 3 fivegs_upffunction_sm_n4sessionestabfail{cause="65"} 4 fivegs_upffunction_sm_n4sessionreport 0 fivegs_upffunction_sm_n4sessionreportsucc 0 fivegs_ep_n3_gtp_indatavolumeqosleveln3upf{qfi="1"} 39792997 fivegs_ep_n3_gtp_outdatavolumeqosleveln3upf{qfi="1"} 737548 Nonstandard gauge (added for controlling purposes - same metric as existing metric on AMF and SMF): fivegs_upffunction_upf_sessionnbr 1 Standard gauge: fivegs_upffunction_upf_qosflows{dnn=""} 1
2022-08-19 12:08:27 +00:00
}
2020-04-26 19:36:05 +00:00
upf_sess_remove(sess);
}
2021-01-18 16:48:35 +00:00
void upf_n4_handle_session_report_response(
upf_sess_t *sess, ogs_pfcp_xact_t *xact,
ogs_pfcp_session_report_response_t *rsp)
{
uint8_t cause_value = 0;
ogs_assert(xact);
ogs_assert(rsp);
ogs_pfcp_xact_commit(xact);
ogs_debug("Session Report Response");
2021-01-18 16:48:35 +00:00
cause_value = OGS_PFCP_CAUSE_REQUEST_ACCEPTED;
if (!sess) {
ogs_warn("No Context");
cause_value = OGS_PFCP_CAUSE_SESSION_CONTEXT_NOT_FOUND;
}
if (rsp->cause.presence) {
if (rsp->cause.u8 != OGS_PFCP_CAUSE_REQUEST_ACCEPTED) {
ogs_error("PFCP Cause[%d] : Not Accepted", rsp->cause.u8);
cause_value = rsp->cause.u8;
}
} else {
ogs_error("No Cause");
cause_value = OGS_PFCP_CAUSE_MANDATORY_IE_MISSING;
}
if (cause_value != OGS_PFCP_CAUSE_REQUEST_ACCEPTED) {
ogs_error("Cause request not accepted[%d]", cause_value);
return;
[UPF] Add metrics support Expose metrics with labels according to ETSI TS 128 552 V16.13.0 in UPF by using hash. The metrics are named respecting the rule: <generation>_<measurement_object_class>_<measurement_family_name>_<metric_name_as_in_TS_128_552> 5qi is not available in UPF. To present 5qi to the user, MN will have to maintain a table qfi->5qi for each QoS flow (will have to get information from SMF). So UPF has to expose qfi. qfi itself is not useful. When used, UPF will have to expose additional label to define the session (e.g. source interface). Label dnn is set to value of APN/DNN received in Establishment. Since SMF does not add APN/DNN to Establishment, the label is empty. When APN/DNN will be set by SMF, it should be added to sess in UPF and used in metrics on Modification and Deletion. Both datavolumeqosleveln3upf are exposed in bytes. MN is providing the transformation to kbits. fivegs_upffunction_upf_qosflows should expose the number of QFIs used in sessions, but exposes number of QER rules, which is currently equal to QFIs. The label snsssai is not provided since the slice is not available on UPF. Exposed metrics example: Standard counters: fivegs_ep_n3_gtp_indatapktn3upf 28637 fivegs_ep_n3_gtp_outdatapktn3upf 14729 fivegs_upffunction_sm_n4sessionestabreq 4 fivegs_upffunction_sm_n4sessionestabfail{cause="66"} 1 fivegs_upffunction_sm_n4sessionestabfail{cause="71"} 68 fivegs_upffunction_sm_n4sessionestabfail{cause="68"} 4 fivegs_upffunction_sm_n4sessionestabfail{cause="72"} 15 fivegs_upffunction_sm_n4sessionestabfail{cause="75"} 3 fivegs_upffunction_sm_n4sessionestabfail{cause="65"} 4 fivegs_upffunction_sm_n4sessionreport 0 fivegs_upffunction_sm_n4sessionreportsucc 0 fivegs_ep_n3_gtp_indatavolumeqosleveln3upf{qfi="1"} 39792997 fivegs_ep_n3_gtp_outdatavolumeqosleveln3upf{qfi="1"} 737548 Nonstandard gauge (added for controlling purposes - same metric as existing metric on AMF and SMF): fivegs_upffunction_upf_sessionnbr 1 Standard gauge: fivegs_upffunction_upf_qosflows{dnn=""} 1
2022-08-19 12:08:27 +00:00
} else {
upf_metrics_inst_global_inc(UPF_METR_GLOB_CTR_SM_N4SESSIONREPORTSUCC);
2021-01-18 16:48:35 +00:00
}
[UPF] Add metrics support Expose metrics with labels according to ETSI TS 128 552 V16.13.0 in UPF by using hash. The metrics are named respecting the rule: <generation>_<measurement_object_class>_<measurement_family_name>_<metric_name_as_in_TS_128_552> 5qi is not available in UPF. To present 5qi to the user, MN will have to maintain a table qfi->5qi for each QoS flow (will have to get information from SMF). So UPF has to expose qfi. qfi itself is not useful. When used, UPF will have to expose additional label to define the session (e.g. source interface). Label dnn is set to value of APN/DNN received in Establishment. Since SMF does not add APN/DNN to Establishment, the label is empty. When APN/DNN will be set by SMF, it should be added to sess in UPF and used in metrics on Modification and Deletion. Both datavolumeqosleveln3upf are exposed in bytes. MN is providing the transformation to kbits. fivegs_upffunction_upf_qosflows should expose the number of QFIs used in sessions, but exposes number of QER rules, which is currently equal to QFIs. The label snsssai is not provided since the slice is not available on UPF. Exposed metrics example: Standard counters: fivegs_ep_n3_gtp_indatapktn3upf 28637 fivegs_ep_n3_gtp_outdatapktn3upf 14729 fivegs_upffunction_sm_n4sessionestabreq 4 fivegs_upffunction_sm_n4sessionestabfail{cause="66"} 1 fivegs_upffunction_sm_n4sessionestabfail{cause="71"} 68 fivegs_upffunction_sm_n4sessionestabfail{cause="68"} 4 fivegs_upffunction_sm_n4sessionestabfail{cause="72"} 15 fivegs_upffunction_sm_n4sessionestabfail{cause="75"} 3 fivegs_upffunction_sm_n4sessionestabfail{cause="65"} 4 fivegs_upffunction_sm_n4sessionreport 0 fivegs_upffunction_sm_n4sessionreportsucc 0 fivegs_ep_n3_gtp_indatavolumeqosleveln3upf{qfi="1"} 39792997 fivegs_ep_n3_gtp_outdatavolumeqosleveln3upf{qfi="1"} 737548 Nonstandard gauge (added for controlling purposes - same metric as existing metric on AMF and SMF): fivegs_upffunction_upf_sessionnbr 1 Standard gauge: fivegs_upffunction_upf_qosflows{dnn=""} 1
2022-08-19 12:08:27 +00:00
2021-01-18 16:48:35 +00:00
}