forked from acouzens/open5gs
parent
0e0085c69f
commit
a712d865cd
|
@ -29,9 +29,9 @@ int amf_initialize()
|
|||
{
|
||||
int rv;
|
||||
|
||||
ogs_metrics_context_init();
|
||||
ogs_sbi_context_init();
|
||||
amf_metrics_init();
|
||||
|
||||
ogs_sbi_context_init();
|
||||
amf_context_init();
|
||||
|
||||
rv = ogs_sbi_context_parse_config("amf", "nrf", "scp");
|
||||
|
@ -53,8 +53,7 @@ int amf_initialize()
|
|||
ogs_app()->logger.domain, ogs_app()->logger.level);
|
||||
if (rv != OGS_OK) return rv;
|
||||
|
||||
rv = amf_metrics_open();
|
||||
if (rv != 0) return OGS_ERROR;
|
||||
ogs_metrics_context_open(ogs_metrics_self());
|
||||
|
||||
rv = amf_sbi_open();
|
||||
if (rv != OGS_OK) return rv;
|
||||
|
@ -102,11 +101,13 @@ void amf_terminate(void)
|
|||
|
||||
ngap_close();
|
||||
amf_sbi_close();
|
||||
amf_metrics_close();
|
||||
|
||||
ogs_metrics_context_close(ogs_metrics_self());
|
||||
|
||||
amf_context_final();
|
||||
ogs_sbi_context_final();
|
||||
ogs_metrics_context_final();
|
||||
|
||||
amf_metrics_final();
|
||||
}
|
||||
|
||||
static void amf_main(void *data)
|
||||
|
|
|
@ -247,10 +247,10 @@ int amf_metrics_free_inst_by_cause(ogs_metrics_inst_t **inst)
|
|||
return amf_metrics_free_inst(inst, _AMF_METR_BY_CAUSE_MAX);
|
||||
}
|
||||
|
||||
int amf_metrics_open(void)
|
||||
void amf_metrics_init(void)
|
||||
{
|
||||
ogs_metrics_context_t *ctx = ogs_metrics_self();
|
||||
ogs_metrics_context_open(ctx);
|
||||
ogs_metrics_context_init();
|
||||
|
||||
amf_metrics_init_spec(ctx, amf_metrics_spec_global, amf_metrics_spec_def_global,
|
||||
_AMF_METR_GLOB_MAX);
|
||||
|
@ -264,14 +264,11 @@ int amf_metrics_open(void)
|
|||
|
||||
amf_metrics_init_by_slice();
|
||||
amf_metrics_init_by_cause();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int amf_metrics_close(void)
|
||||
void amf_metrics_final(void)
|
||||
{
|
||||
ogs_hash_index_t *hi;
|
||||
ogs_metrics_context_t *ctx = ogs_metrics_self();
|
||||
|
||||
if (metrics_hash_by_slice) {
|
||||
for (hi = ogs_hash_first(metrics_hash_by_slice); hi; hi = ogs_hash_next(hi)) {
|
||||
|
@ -304,6 +301,5 @@ int amf_metrics_close(void)
|
|||
ogs_hash_destroy(metrics_hash_by_cause);
|
||||
}
|
||||
|
||||
ogs_metrics_context_close(ctx);
|
||||
return OGS_OK;
|
||||
ogs_metrics_context_final();
|
||||
}
|
||||
|
|
|
@ -46,8 +46,8 @@ typedef enum amf_metric_type_by_cause_s {
|
|||
void amf_metrics_inst_by_cause_add(
|
||||
uint8_t cause, amf_metric_type_by_cause_t t, int val);
|
||||
|
||||
int amf_metrics_open(void);
|
||||
int amf_metrics_close(void);
|
||||
void amf_metrics_init(void);
|
||||
void amf_metrics_final(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -75,21 +75,18 @@ int mme_metrics_free_inst_global(void)
|
|||
return mme_metrics_free_inst(mme_metrics_inst_global, _MME_METR_GLOB_MAX);
|
||||
}
|
||||
|
||||
int mme_metrics_open(void)
|
||||
void mme_metrics_init(void)
|
||||
{
|
||||
ogs_metrics_context_t *ctx = ogs_metrics_self();
|
||||
ogs_metrics_context_open(ctx);
|
||||
ogs_metrics_context_init();
|
||||
|
||||
mme_metrics_init_spec(ctx, mme_metrics_spec_global, mme_metrics_spec_def_global,
|
||||
_MME_METR_GLOB_MAX);
|
||||
|
||||
mme_metrics_init_inst_global();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int mme_metrics_close(void)
|
||||
void mme_metrics_final(void)
|
||||
{
|
||||
ogs_metrics_context_t *ctx = ogs_metrics_self();
|
||||
ogs_metrics_context_close(ctx);
|
||||
return OGS_OK;
|
||||
ogs_metrics_context_final();
|
||||
}
|
||||
|
|
|
@ -28,8 +28,8 @@ static inline void mme_metrics_inst_global_inc(mme_metric_type_global_t t)
|
|||
static inline void mme_metrics_inst_global_dec(mme_metric_type_global_t t)
|
||||
{ ogs_metrics_inst_dec(mme_metrics_inst_global[t]); }
|
||||
|
||||
int mme_metrics_open(void);
|
||||
int mme_metrics_close(void);
|
||||
void mme_metrics_init(void);
|
||||
void mme_metrics_final(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -39,7 +39,9 @@ static int initialized = 0;
|
|||
int mme_initialize()
|
||||
{
|
||||
int rv;
|
||||
ogs_metrics_context_init();
|
||||
|
||||
mme_metrics_init();
|
||||
|
||||
ogs_gtp_context_init(OGS_MAX_NUM_OF_GTPU_RESOURCE);
|
||||
mme_context_init();
|
||||
|
||||
|
@ -62,8 +64,7 @@ int mme_initialize()
|
|||
rv = mme_m_tmsi_pool_generate();
|
||||
if (rv != OGS_OK) return rv;
|
||||
|
||||
rv = mme_metrics_open();
|
||||
if (rv != 0) return OGS_ERROR;
|
||||
ogs_metrics_context_open(ogs_metrics_self());
|
||||
|
||||
rv = mme_fd_init();
|
||||
if (rv != OGS_OK) return OGS_ERROR;
|
||||
|
@ -96,7 +97,8 @@ void mme_terminate(void)
|
|||
mme_gtp_close();
|
||||
sgsap_close();
|
||||
s1ap_close();
|
||||
mme_metrics_close();
|
||||
|
||||
ogs_metrics_context_close(ogs_metrics_self());
|
||||
|
||||
mme_fd_final();
|
||||
|
||||
|
@ -106,7 +108,7 @@ void mme_terminate(void)
|
|||
|
||||
ogs_gtp_xact_final();
|
||||
|
||||
ogs_metrics_context_final();
|
||||
mme_metrics_final();
|
||||
}
|
||||
|
||||
static void mme_main(void *data)
|
||||
|
|
|
@ -28,7 +28,8 @@ int pcf_initialize()
|
|||
{
|
||||
int rv;
|
||||
|
||||
ogs_metrics_context_init();
|
||||
pcf_metrics_init();
|
||||
|
||||
ogs_sbi_context_init();
|
||||
pcf_context_init();
|
||||
|
||||
|
@ -45,8 +46,7 @@ int pcf_initialize()
|
|||
ogs_app()->logger.domain, ogs_app()->logger.level);
|
||||
if (rv != OGS_OK) return rv;
|
||||
|
||||
rv = pcf_metrics_open();
|
||||
if (rv != 0) return OGS_ERROR;
|
||||
ogs_metrics_context_open(ogs_metrics_self());
|
||||
|
||||
rv = ogs_dbi_init(ogs_app()->db_uri);
|
||||
if (rv != OGS_OK) return rv;
|
||||
|
@ -93,14 +93,15 @@ void pcf_terminate(void)
|
|||
ogs_timer_delete(t_termination_holding);
|
||||
|
||||
pcf_sbi_close();
|
||||
pcf_metrics_close();
|
||||
|
||||
ogs_metrics_context_close(ogs_metrics_self());
|
||||
|
||||
ogs_dbi_final();
|
||||
|
||||
pcf_context_final();
|
||||
|
||||
ogs_sbi_context_final();
|
||||
ogs_metrics_context_final();
|
||||
|
||||
pcf_metrics_final();
|
||||
}
|
||||
|
||||
static void pcf_main(void *data)
|
||||
|
|
|
@ -258,10 +258,10 @@ int pcf_metrics_free_inst_by_slice(ogs_metrics_inst_t **inst)
|
|||
return pcf_metrics_free_inst(inst, _PCF_METR_BY_SLICE_MAX);
|
||||
}
|
||||
|
||||
int pcf_metrics_open(void)
|
||||
void pcf_metrics_init(void)
|
||||
{
|
||||
ogs_metrics_context_t *ctx = ogs_metrics_self();
|
||||
ogs_metrics_context_open(ctx);
|
||||
ogs_metrics_context_init();
|
||||
|
||||
pcf_metrics_init_spec(ctx, pcf_metrics_spec_global,
|
||||
pcf_metrics_spec_def_global, _PCF_METR_GLOB_MAX);
|
||||
|
@ -273,14 +273,11 @@ int pcf_metrics_open(void)
|
|||
pcf_metrics_init_inst_global();
|
||||
pcf_metrics_init_by_plmn();
|
||||
pcf_metrics_init_by_slice();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int pcf_metrics_close(void)
|
||||
void pcf_metrics_final(void)
|
||||
{
|
||||
ogs_hash_index_t *hi;
|
||||
ogs_metrics_context_t *ctx = ogs_metrics_self();
|
||||
|
||||
if (metrics_hash_by_slice) {
|
||||
for (hi = ogs_hash_first(metrics_hash_by_slice); hi; hi = ogs_hash_next(hi)) {
|
||||
|
@ -313,6 +310,5 @@ int pcf_metrics_close(void)
|
|||
ogs_hash_destroy(metrics_hash_by_plmn);
|
||||
}
|
||||
|
||||
ogs_metrics_context_close(ctx);
|
||||
return OGS_OK;
|
||||
ogs_metrics_context_final();
|
||||
}
|
||||
|
|
|
@ -46,8 +46,8 @@ void pcf_metrics_inst_by_slice_add(
|
|||
ogs_plmn_id_t *plmn, ogs_s_nssai_t *snssai,
|
||||
pcf_metric_type_by_slice_t t, int val);
|
||||
|
||||
int pcf_metrics_open(void);
|
||||
int pcf_metrics_close(void);
|
||||
void pcf_metrics_init(void);
|
||||
void pcf_metrics_final(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -33,7 +33,8 @@ int smf_initialize()
|
|||
{
|
||||
int rv;
|
||||
|
||||
ogs_metrics_context_init();
|
||||
smf_metrics_init();
|
||||
|
||||
ogs_gtp_context_init(ogs_app()->pool.nf * OGS_MAX_NUM_OF_GTPU_RESOURCE);
|
||||
ogs_pfcp_context_init();
|
||||
ogs_sbi_context_init();
|
||||
|
@ -68,8 +69,7 @@ int smf_initialize()
|
|||
rv = ogs_pfcp_ue_pool_generate();
|
||||
if (rv != OGS_OK) return rv;
|
||||
|
||||
rv = smf_metrics_open();
|
||||
if (rv != 0) return OGS_ERROR;
|
||||
ogs_metrics_context_open(ogs_metrics_self());
|
||||
|
||||
rv = smf_fd_init();
|
||||
if (rv != 0) return OGS_ERROR;
|
||||
|
@ -124,7 +124,8 @@ void smf_terminate(void)
|
|||
smf_gtp_close();
|
||||
smf_pfcp_close();
|
||||
smf_sbi_close();
|
||||
smf_metrics_close();
|
||||
|
||||
ogs_metrics_context_close(ogs_metrics_self());
|
||||
|
||||
smf_fd_final();
|
||||
|
||||
|
@ -133,10 +134,11 @@ void smf_terminate(void)
|
|||
ogs_pfcp_context_final();
|
||||
ogs_sbi_context_final();
|
||||
ogs_gtp_context_final();
|
||||
ogs_metrics_context_final();
|
||||
|
||||
ogs_pfcp_xact_final();
|
||||
ogs_gtp_xact_final();
|
||||
|
||||
smf_metrics_final();
|
||||
}
|
||||
|
||||
static void smf_main(void *data)
|
||||
|
|
|
@ -462,10 +462,10 @@ int smf_metrics_free_inst_by_cause(ogs_metrics_inst_t **inst)
|
|||
return smf_metrics_free_inst(inst, _SMF_METR_BY_CAUSE_MAX);
|
||||
}
|
||||
|
||||
int smf_metrics_open(void)
|
||||
void smf_metrics_init(void)
|
||||
{
|
||||
ogs_metrics_context_t *ctx = ogs_metrics_self();
|
||||
ogs_metrics_context_open(ctx);
|
||||
ogs_metrics_context_init();
|
||||
|
||||
smf_metrics_init_spec(ctx, smf_metrics_spec_global, smf_metrics_spec_def_global,
|
||||
_SMF_METR_GLOB_MAX);
|
||||
|
@ -484,13 +484,11 @@ int smf_metrics_open(void)
|
|||
smf_metrics_init_by_slice();
|
||||
smf_metrics_init_by_5qi();
|
||||
smf_metrics_init_by_cause();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int smf_metrics_close(void)
|
||||
void smf_metrics_final(void)
|
||||
{
|
||||
ogs_hash_index_t *hi;
|
||||
ogs_metrics_context_t *ctx = ogs_metrics_self();
|
||||
|
||||
if (metrics_hash_by_slice) {
|
||||
for (hi = ogs_hash_first(metrics_hash_by_slice); hi; hi = ogs_hash_next(hi)) {
|
||||
|
@ -538,6 +536,5 @@ int smf_metrics_close(void)
|
|||
ogs_hash_destroy(metrics_hash_by_cause);
|
||||
}
|
||||
|
||||
ogs_metrics_context_close(ctx);
|
||||
return OGS_OK;
|
||||
ogs_metrics_context_final();
|
||||
}
|
||||
|
|
|
@ -93,8 +93,8 @@ typedef enum smf_metric_type_by_cause_s {
|
|||
|
||||
void smf_metrics_inst_by_cause_add(
|
||||
uint8_t cause, smf_metric_type_by_cause_t t, int val);
|
||||
int smf_metrics_open(void);
|
||||
int smf_metrics_close(void);
|
||||
void smf_metrics_init(void);
|
||||
void smf_metrics_final(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -31,7 +31,8 @@ int upf_initialize()
|
|||
{
|
||||
int rv;
|
||||
|
||||
ogs_metrics_context_init();
|
||||
upf_metrics_init();
|
||||
|
||||
ogs_gtp_context_init(OGS_MAX_NUM_OF_GTPU_RESOURCE);
|
||||
ogs_pfcp_context_init();
|
||||
|
||||
|
@ -61,8 +62,7 @@ int upf_initialize()
|
|||
rv = ogs_pfcp_ue_pool_generate();
|
||||
if (rv != OGS_OK) return rv;
|
||||
|
||||
rv = upf_metrics_open();
|
||||
if (rv != 0) return OGS_ERROR;
|
||||
ogs_metrics_context_open(ogs_metrics_self());
|
||||
|
||||
rv = upf_pfcp_open();
|
||||
if (rv != OGS_OK) return rv;
|
||||
|
@ -88,18 +88,20 @@ void upf_terminate(void)
|
|||
|
||||
upf_pfcp_close();
|
||||
upf_gtp_close();
|
||||
upf_metrics_close();
|
||||
|
||||
ogs_metrics_context_close(ogs_metrics_self());
|
||||
|
||||
upf_context_final();
|
||||
|
||||
ogs_pfcp_context_final();
|
||||
ogs_gtp_context_final();
|
||||
ogs_metrics_context_final();
|
||||
|
||||
ogs_pfcp_xact_final();
|
||||
|
||||
upf_gtp_final();
|
||||
upf_event_final();
|
||||
|
||||
upf_metrics_final();
|
||||
}
|
||||
|
||||
static void upf_main(void *data)
|
||||
|
|
|
@ -315,10 +315,10 @@ int upf_metrics_free_inst_by_dnn(ogs_metrics_inst_t **inst)
|
|||
return upf_metrics_free_inst(inst, _UPF_METR_BY_DNN_MAX);
|
||||
}
|
||||
|
||||
int upf_metrics_open(void)
|
||||
void upf_metrics_init(void)
|
||||
{
|
||||
ogs_metrics_context_t *ctx = ogs_metrics_self();
|
||||
ogs_metrics_context_open(ctx);
|
||||
ogs_metrics_context_init();
|
||||
|
||||
upf_metrics_init_spec(ctx, upf_metrics_spec_global, upf_metrics_spec_def_global,
|
||||
_UPF_METR_GLOB_MAX);
|
||||
|
@ -333,14 +333,11 @@ int upf_metrics_open(void)
|
|||
upf_metrics_init_by_qfi();
|
||||
upf_metrics_init_by_cause();
|
||||
upf_metrics_init_by_dnn();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int upf_metrics_close(void)
|
||||
void upf_metrics_final(void)
|
||||
{
|
||||
ogs_hash_index_t *hi;
|
||||
ogs_metrics_context_t *ctx = ogs_metrics_self();
|
||||
|
||||
if (metrics_hash_by_qfi) {
|
||||
for (hi = ogs_hash_first(metrics_hash_by_qfi); hi; hi = ogs_hash_next(hi)) {
|
||||
|
@ -388,6 +385,5 @@ int upf_metrics_close(void)
|
|||
ogs_hash_destroy(metrics_hash_by_dnn);
|
||||
}
|
||||
|
||||
ogs_metrics_context_close(ctx);
|
||||
return OGS_OK;
|
||||
ogs_metrics_context_final();
|
||||
}
|
||||
|
|
|
@ -59,8 +59,8 @@ typedef enum upf_metric_type_by_dnn_s {
|
|||
void upf_metrics_inst_by_dnn_add(
|
||||
char *dnn, upf_metric_type_by_dnn_t t, int val);
|
||||
|
||||
int upf_metrics_open(void);
|
||||
int upf_metrics_close(void);
|
||||
void upf_metrics_init(void);
|
||||
void upf_metrics_final(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue