Skip to content

Commit

Permalink
add cdrs to smf
Browse files Browse the repository at this point in the history
  • Loading branch information
aseaudi committed Sep 13, 2023
1 parent 33c09e3 commit 86c017a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
6 changes: 6 additions & 0 deletions configs/open5gs/smf.yaml.in
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,12 @@ smf:
mtu: 1400
ctf:
enabled: auto
cdr:
enabled: True
file_capture_period_sec: 1800
reporting_period_sec: 10
log_dir: /var/log/open5gs
sgw_name: PGW-01
freeDiameter: @sysconfdir@/freeDiameter/smf.conf

#
Expand Down
11 changes: 11 additions & 0 deletions src/smf/n4-handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@
#include "ngap-path.h"
#include "fd-path.h"

static void log_usage_reports(sgwc_sess_t *sess, ogs_pfcp_session_report_request_t *pfcp_req);
static void log_deletion_usage_reports(sgwc_sess_t *sess, ogs_pfcp_session_deletion_response_t *pfcp_rsp);
static void log_start_usage_reports(sgwc_sess_t *sess);
static UsageLoggerData build_usage_logger_data(sgwc_sess_t *sess, char const* event, uint64_t octets_in, uint64_t octets_out);
static void log_usage_logger_data(UsageLoggerData usageLoggerData);
static bool hex_array_to_string(uint8_t* hex_array, size_t hex_array_len, char* hex_string, size_t hex_string_len);

uint8_t gtp_cause_from_pfcp(uint8_t pfcp_cause, uint8_t gtp_version)
{
switch (gtp_version) {
Expand Down Expand Up @@ -184,6 +191,10 @@ uint8_t smf_5gc_n4_handle_session_establishment_response(
if (cause_value != OGS_PFCP_CAUSE_REQUEST_ACCEPTED)
return cause_value;

if (ogs_pfcp_self()->usageLoggerState.enabled) {
log_start_usage_reports(sess);
}

for (i = 0; i < OGS_MAX_NUM_OF_PDR; i++) {
pdr = ogs_pfcp_handle_created_pdr(
&sess->pfcp, &rsp->created_pdr[i],
Expand Down

0 comments on commit 86c017a

Please sign in to comment.