fix: SBI heartbeat timer usage changed (#741)

This commit is contained in:
Sukchan Lee 2021-01-01 15:56:46 -05:00
parent b35eb9fcf4
commit 88346c0141
26 changed files with 162 additions and 52 deletions

View File

@ -283,15 +283,16 @@ pool:
#
# time:
#
# o NF Instance Heartbeat (Default : 10 seconds)
# o NF Instance Heartbeat (Default : 0)
# NFs will not send heart-beat timer in NFProfile
# NRF will send heart-beat timer in NFProfile
#
# o NF Instance Heartbeat (Disabled)
# nf_instance:
# heartbeat: 0
# o NF Instance Heartbeat (20 seconds)
# NFs will send heart-beat timer (20 seconds) in NFProfile
# NRF can change heart-beat timer in NFProfile
#
# o NF Instance Heartbeat (10 seconds)
# nf_instance:
# heartbeat: 10
# heartbeat: 20
#
# o Message Wait Duration (Default : 10,000 ms = 10 seconds)
#

View File

@ -159,15 +159,16 @@ pool:
#
# time:
#
# o NF Instance Heartbeat (Default : 10 seconds)
# o NF Instance Heartbeat (Default : 0)
# NFs will not send heart-beat timer in NFProfile
# NRF will send heart-beat timer in NFProfile
#
# o NF Instance Heartbeat (Disabled)
# nf_instance:
# heartbeat: 0
# o NF Instance Heartbeat (20 seconds)
# NFs will send heart-beat timer (20 seconds) in NFProfile
# NRF can change heart-beat timer in NFProfile
#
# o NF Instance Heartbeat (10 seconds)
# nf_instance:
# heartbeat: 10
# heartbeat: 20
#
# o Message Wait Duration (Default : 10,000 ms = 10 seconds)
#

View File

@ -131,6 +131,16 @@ pool:
#
# time:
#
# o NF Instance Heartbeat (Default : 10 seconds)
#
# o NF Instance Heartbeat (Disabled)
# nf_instance:
# heartbeat: 0
#
# o NF Instance Heartbeat (5 seconds)
# nf_instance:
# heartbeat: 5
#
# o NF Instance Validity (Default : 3600 seconds = 1 hour)
#
# o NF Instance Validity (10 seconds)

View File

@ -161,15 +161,16 @@ pool:
#
# time:
#
# o NF Instance Heartbeat (Default : 10 seconds)
# o NF Instance Heartbeat (Default : 0)
# NFs will not send heart-beat timer in NFProfile
# NRF will send heart-beat timer in NFProfile
#
# o NF Instance Heartbeat (Disabled)
# nf_instance:
# heartbeat: 0
# o NF Instance Heartbeat (20 seconds)
# NFs will send heart-beat timer (20 seconds) in NFProfile
# NRF can change heart-beat timer in NFProfile
#
# o NF Instance Heartbeat (10 seconds)
# nf_instance:
# heartbeat: 10
# heartbeat: 20
#
# o Message Wait Duration (Default : 10,000 ms = 10 seconds)
#

View File

@ -336,15 +336,16 @@ pool:
#
# time:
#
# o NF Instance Heartbeat (Default : 10 seconds)
# o NF Instance Heartbeat (Default : 0)
# NFs will not send heart-beat timer in NFProfile
# NRF will send heart-beat timer in NFProfile
#
# o NF Instance Heartbeat (Disabled)
# nf_instance:
# heartbeat: 0
# o NF Instance Heartbeat (20 seconds)
# NFs will send heart-beat timer (20 seconds) in NFProfile
# NRF can change heart-beat timer in NFProfile
#
# o NF Instance Heartbeat (10 seconds)
# nf_instance:
# heartbeat: 10
# heartbeat: 20
#
# o Message Wait Duration (Default : 10,000 ms = 10 seconds)
#

View File

@ -159,15 +159,16 @@ pool:
#
# time:
#
# o NF Instance Heartbeat (Default : 10 seconds)
# o NF Instance Heartbeat (Default : 0)
# NFs will not send heart-beat timer in NFProfile
# NRF will send heart-beat timer in NFProfile
#
# o NF Instance Heartbeat (Disabled)
# nf_instance:
# heartbeat: 0
# o NF Instance Heartbeat (20 seconds)
# NFs will send heart-beat timer (20 seconds) in NFProfile
# NRF can change heart-beat timer in NFProfile
#
# o NF Instance Heartbeat (10 seconds)
# nf_instance:
# heartbeat: 10
# heartbeat: 20
#
# o Message Wait Duration (Default : 10,000 ms = 10 seconds)
#

View File

@ -161,7 +161,16 @@ pool:
#
# time:
#
# o NF Instance Heartbeat (Default : 10 seconds)
# o NF Instance Heartbeat (Default : 0)
# NFs will not send heart-beat timer in NFProfile
# NRF will send heart-beat timer in NFProfile
#
# o NF Instance Heartbeat (20 seconds)
# NFs will send heart-beat timer (20 seconds) in NFProfile
# NRF can change heart-beat timer in NFProfile
#
# nf_instance:
# heartbeat: 20
#
# o NF Instance Heartbeat (Disabled)
# nf_instance:

View File

@ -183,8 +183,8 @@ static void app_context_prepare(void)
recalculate_pool_size();
/* 10 second */
self.time.nf_instance.heartbeat_interval = 10;
/* <Heartbeat Checking Interval>
* Heartbeat Interval(e.g: 10 seconds) + No Heartbeat Margin(1 second) */
self.time.nf_instance.no_heartbeat_margin = 1;
/* 3600 seconds = 1 hour */

View File

@ -18,6 +18,7 @@
*/
#include "ogs-sbi.h"
#include "ogs-app.h"
OpenAPI_nf_profile_t *ogs_nnrf_nfm_build_nf_profile(
ogs_sbi_nf_instance_t *nf_instance)
@ -259,7 +260,9 @@ ogs_sbi_request_t *ogs_nnrf_nfm_build_register(
NFProfile = ogs_nnrf_nfm_build_nf_profile(nf_instance);
ogs_assert(NFProfile);
NFProfile->heart_beat_timer = nf_instance->time.heartbeat_interval;
NFProfile->nf_profile_changes_support_ind = true;
nf_instance->time.heartbeat_interval = NFProfile->heart_beat_timer =
ogs_app()->time.nf_instance.heartbeat_interval;
message.NFProfile = NFProfile;

View File

@ -18,6 +18,7 @@
*/
#include "ogs-sbi.h"
#include "ogs-app.h"
bool ogs_sbi_nnrf_handle_nf_profile(ogs_sbi_nf_instance_t *nf_instance,
OpenAPI_nf_profile_t *NFProfile,

View File

@ -195,7 +195,8 @@ void amf_nf_state_registered(ogs_fsm_t *s, amf_event_t *e)
switch (e->id) {
case OGS_FSM_ENTRY_SIG:
if (NF_INSTANCE_IS_SELF(nf_instance->id)) {
ogs_info("[%s] NF registered", nf_instance->id);
ogs_info("[%s] NF registred [Heartbeat:%ds]",
nf_instance->id, nf_instance->time.heartbeat_interval);
client = nf_instance->client;
ogs_assert(client);

View File

@ -40,7 +40,12 @@ void amf_nnrf_handle_nf_register(
}
/* TIME : Update heartbeat from NRF */
nf_instance->time.heartbeat_interval = NFProfile->heart_beat_timer;
if (NFProfile->nf_profile_changes_ind == true) {
if (NFProfile->heart_beat_timer)
nf_instance->time.heartbeat_interval = NFProfile->heart_beat_timer;
} else {
nf_instance->time.heartbeat_interval = NFProfile->heart_beat_timer;
}
}
void amf_nnrf_handle_nf_status_subscribe(

View File

@ -195,7 +195,8 @@ void ausf_nf_state_registered(ogs_fsm_t *s, ausf_event_t *e)
switch (e->id) {
case OGS_FSM_ENTRY_SIG:
if (NF_INSTANCE_IS_SELF(nf_instance->id)) {
ogs_info("[%s] NF registered", nf_instance->id);
ogs_info("[%s] NF registred [Heartbeat:%ds]",
nf_instance->id, nf_instance->time.heartbeat_interval);
client = nf_instance->client;
ogs_assert(client);

View File

@ -38,7 +38,12 @@ void ausf_nnrf_handle_nf_register(
}
/* TIME : Update heartbeat from NRF */
nf_instance->time.heartbeat_interval = NFProfile->heart_beat_timer;
if (NFProfile->nf_profile_changes_ind == true) {
if (NFProfile->heart_beat_timer)
nf_instance->time.heartbeat_interval = NFProfile->heart_beat_timer;
} else {
nf_instance->time.heartbeat_interval = NFProfile->heart_beat_timer;
}
}
void ausf_nnrf_handle_nf_status_subscribe(

View File

@ -66,12 +66,13 @@ bool ausf_nudm_ueau_handle_get(ausf_ue_t *ausf_ue,
return false;
}
/* See TS29.509 6.1.7.3 Application Errors */
if (AuthenticationInfoResult->auth_type !=
OpenAPI_auth_type_5G_AKA) {
ogs_error("[%s] Not supported Auth Method [%d]",
ausf_ue->suci, AuthenticationInfoResult->auth_type);
ogs_sbi_server_send_error(stream,
OGS_SBI_HTTP_STATUS_FORBIDDEN,
OGS_SBI_HTTP_STATUS_NOT_IMPLEMENTED,
recvmsg, "Not supported Auth Method", ausf_ue->suci);
return false;
}

View File

@ -59,6 +59,11 @@ nrf_context_t *nrf_self(void)
static int nrf_context_prepare(void)
{
/* NF Instance Heartbeat
* Default value is 10 seconds if it is not configured in nrf.yaml */
if (!ogs_app()->time.nf_instance.heartbeat_interval)
ogs_app()->time.nf_instance.heartbeat_interval = 10;
return OGS_OK;
}

View File

@ -185,7 +185,8 @@ void nrf_nf_state_registered(ogs_fsm_t *s, nrf_event_t *e)
switch (e->id) {
case OGS_FSM_ENTRY_SIG:
ogs_info("[%s] NF registred", nf_instance->id);
ogs_info("[%s] NF registred [Heartbeat:%ds]",
nf_instance->id, nf_instance->time.heartbeat_interval);
if (nf_instance->time.heartbeat_interval) {
ogs_timer_start(nf_instance->t_no_heartbeat,
ogs_time_from_sec(

View File

@ -40,6 +40,10 @@ bool nrf_nnrf_handle_nf_register(ogs_sbi_nf_instance_t *nf_instance,
return false;
}
/* Store NFProfile */
nf_instance->nf_profile = OpenAPI_nf_profile_copy(
nf_instance->nf_profile, NFProfile);
/* ogs_sbi_nnrf_handle_nf_profile() sends error response */
handled = ogs_sbi_nnrf_handle_nf_profile(
nf_instance, NFProfile, stream, recvmsg);
@ -53,11 +57,46 @@ bool nrf_nnrf_handle_nf_register(ogs_sbi_nf_instance_t *nf_instance,
} else
ogs_assert_if_reached();
/* Store NFProfile */
nf_instance->nf_profile = OpenAPI_nf_profile_copy(
nf_instance->nf_profile, NFProfile);
/* NRF uses pre-configured heartbeat if NFs did not send it */
if (!NFProfile->heart_beat_timer)
nf_instance->time.heartbeat_interval =
ogs_app()->time.nf_instance.heartbeat_interval;
/*
* TS29.510
* Annex B (normative):NF Profile changes in NFRegister and NFUpdate
* (NF Profile Complete Replacement) responses
*/
if (NFProfile->nf_profile_changes_support_ind == true) {
OpenAPI_nf_profile_t NFProfileChanges;
ogs_sbi_message_t sendmsg;
memset(&NFProfileChanges, 0, sizeof(NFProfileChanges));
NFProfileChanges.nf_instance_id = NFProfile->nf_instance_id;
NFProfileChanges.nf_type = NFProfile->nf_type;
NFProfileChanges.nf_status = NFProfile->nf_status;
if (!NFProfile->heart_beat_timer)
NFProfileChanges.heart_beat_timer =
nf_instance->time.heartbeat_interval;
NFProfileChanges.nf_profile_changes_ind = true;
memset(&sendmsg, 0, sizeof(sendmsg));
sendmsg.http.location = recvmsg->http.location;
sendmsg.NFProfile = &NFProfileChanges;
response = ogs_sbi_build_response(&sendmsg, status);
} else {
if (!NFProfile->heart_beat_timer)
NFProfile->heart_beat_timer =
nf_instance->time.heartbeat_interval;
response = ogs_sbi_build_response(recvmsg, status);
}
response = ogs_sbi_build_response(recvmsg, status);
ogs_assert(response);
ogs_sbi_server_send_response(stream, response);

View File

@ -195,7 +195,8 @@ void pcf_nf_state_registered(ogs_fsm_t *s, pcf_event_t *e)
switch (e->id) {
case OGS_FSM_ENTRY_SIG:
if (NF_INSTANCE_IS_SELF(nf_instance->id)) {
ogs_info("[%s] NF registered", nf_instance->id);
ogs_info("[%s] NF registred [Heartbeat:%ds]",
nf_instance->id, nf_instance->time.heartbeat_interval);
client = nf_instance->client;
ogs_assert(client);

View File

@ -38,7 +38,12 @@ void pcf_nnrf_handle_nf_register(
}
/* TIME : Update heartbeat from NRF */
nf_instance->time.heartbeat_interval = NFProfile->heart_beat_timer;
if (NFProfile->nf_profile_changes_ind == true) {
if (NFProfile->heart_beat_timer)
nf_instance->time.heartbeat_interval = NFProfile->heart_beat_timer;
} else {
nf_instance->time.heartbeat_interval = NFProfile->heart_beat_timer;
}
}
void pcf_nnrf_handle_nf_status_subscribe(

View File

@ -196,7 +196,8 @@ void smf_nf_state_registered(ogs_fsm_t *s, smf_event_t *e)
switch (e->id) {
case OGS_FSM_ENTRY_SIG:
if (NF_INSTANCE_IS_SELF(nf_instance->id)) {
ogs_info("[%s] NF registered", nf_instance->id);
ogs_info("[%s] NF registred [Heartbeat:%ds]",
nf_instance->id, nf_instance->time.heartbeat_interval);
client = nf_instance->client;
ogs_assert(client);

View File

@ -38,7 +38,12 @@ void smf_nnrf_handle_nf_register(
}
/* TIME : Update heartbeat from NRF */
nf_instance->time.heartbeat_interval = NFProfile->heart_beat_timer;
if (NFProfile->nf_profile_changes_ind == true) {
if (NFProfile->heart_beat_timer)
nf_instance->time.heartbeat_interval = NFProfile->heart_beat_timer;
} else {
nf_instance->time.heartbeat_interval = NFProfile->heart_beat_timer;
}
}
void smf_nnrf_handle_nf_status_subscribe(

View File

@ -195,7 +195,8 @@ void udm_nf_state_registered(ogs_fsm_t *s, udm_event_t *e)
switch (e->id) {
case OGS_FSM_ENTRY_SIG:
if (NF_INSTANCE_IS_SELF(nf_instance->id)) {
ogs_info("[%s] NF registered", nf_instance->id);
ogs_info("[%s] NF registred [Heartbeat:%ds]",
nf_instance->id, nf_instance->time.heartbeat_interval);
client = nf_instance->client;
ogs_assert(client);

View File

@ -38,7 +38,12 @@ void udm_nnrf_handle_nf_register(
}
/* TIME : Update heartbeat from NRF */
nf_instance->time.heartbeat_interval = NFProfile->heart_beat_timer;
if (NFProfile->nf_profile_changes_ind == true) {
if (NFProfile->heart_beat_timer)
nf_instance->time.heartbeat_interval = NFProfile->heart_beat_timer;
} else {
nf_instance->time.heartbeat_interval = NFProfile->heart_beat_timer;
}
}
void udm_nnrf_handle_nf_status_subscribe(

View File

@ -195,7 +195,8 @@ void udr_nf_state_registered(ogs_fsm_t *s, udr_event_t *e)
switch (e->id) {
case OGS_FSM_ENTRY_SIG:
if (NF_INSTANCE_IS_SELF(nf_instance->id)) {
ogs_info("[%s] NF registered", nf_instance->id);
ogs_info("[%s] NF registred [Heartbeat:%ds]",
nf_instance->id, nf_instance->time.heartbeat_interval);
client = nf_instance->client;
ogs_assert(client);

View File

@ -38,7 +38,12 @@ void udr_nnrf_handle_nf_register(
}
/* TIME : Update heartbeat from NRF */
nf_instance->time.heartbeat_interval = NFProfile->heart_beat_timer;
if (NFProfile->nf_profile_changes_ind == true) {
if (NFProfile->heart_beat_timer)
nf_instance->time.heartbeat_interval = NFProfile->heart_beat_timer;
} else {
nf_instance->time.heartbeat_interval = NFProfile->heart_beat_timer;
}
}
void udr_nnrf_handle_nf_status_subscribe(