[PCF] Fix calculation of NF Instance load information

- the 'if' clause was comparing some value with an always '1' due to
wrong calculation. Consequently, this 'if' statement never executed.
- sizes for session pool and UE pools are directly linked between each
other. We need to count the number of items only in one of the pools to
correctly represent the NF load
- if anything, we should also check the load of the application pool to
determine correct load of the NF
This commit is contained in:
Bostjan Meglic 2023-05-23 10:31:11 +00:00 committed by Sukchan Lee
parent 31deecb03f
commit 8671b0cc78
1 changed files with 3 additions and 11 deletions

View File

@ -597,15 +597,7 @@ pcf_app_t *pcf_app_find_by_app_session_id(char *app_session_id)
int get_pcf_load(void)
{
if (ogs_pool_avail(&pcf_ue_pool) / ogs_pool_size(&pcf_ue_pool) <
ogs_pool_avail(&pcf_sess_pool) /
ogs_pool_avail(&pcf_sess_pool)) {
return (((ogs_pool_size(&pcf_ue_pool) -
ogs_pool_avail(&pcf_ue_pool)) * 100) /
ogs_pool_size(&pcf_ue_pool));
} else {
return (((ogs_pool_size(&pcf_sess_pool) -
ogs_pool_avail(&pcf_sess_pool)) * 100) /
ogs_pool_size(&pcf_sess_pool));
}
return (((ogs_pool_size(&pcf_ue_pool) -
ogs_pool_avail(&pcf_ue_pool)) * 100) /
ogs_pool_size(&pcf_ue_pool));
}