forked from acouzens/open5gs
Synchronize all timers [#512]
This commit is contained in:
parent
1d61c94f54
commit
0cabf9de11
|
@ -300,4 +300,10 @@ pool:
|
|||
# o NF Instance Heartbeat (10 seconds)
|
||||
# nf_instance:
|
||||
# heartbeat: 10
|
||||
#
|
||||
# o Message Wait Duration (Default : 2000ms = 2 seconds)
|
||||
#
|
||||
# o Message Wait Duration (3 seconds)
|
||||
# message:
|
||||
# duration: 3000
|
||||
time:
|
||||
|
|
|
@ -176,4 +176,10 @@ pool:
|
|||
# o NF Instance Heartbeat (10 seconds)
|
||||
# nf_instance:
|
||||
# heartbeat: 10
|
||||
#
|
||||
# o Message Wait Duration (Default : 2000ms = 2 seconds)
|
||||
#
|
||||
# o Message Wait Duration (3 seconds)
|
||||
# message:
|
||||
# duration: 3000
|
||||
time:
|
||||
|
|
|
@ -153,4 +153,9 @@ pool:
|
|||
# subscription:
|
||||
# validity: 3600
|
||||
#
|
||||
# o Message Wait Duration (Default : 2000ms = 2 seconds)
|
||||
#
|
||||
# o Message Wait Duration (3 seconds)
|
||||
# message:
|
||||
# duration: 3000
|
||||
time:
|
||||
|
|
|
@ -360,4 +360,10 @@ pool:
|
|||
# o NF Instance Heartbeat (10 seconds)
|
||||
# nf_instance:
|
||||
# heartbeat: 10
|
||||
#
|
||||
# o Message Wait Duration (Default : 2000ms = 2 seconds)
|
||||
#
|
||||
# o Message Wait Duration (3 seconds)
|
||||
# message:
|
||||
# duration: 3000
|
||||
time:
|
||||
|
|
|
@ -176,4 +176,10 @@ pool:
|
|||
# o NF Instance Heartbeat (10 seconds)
|
||||
# nf_instance:
|
||||
# heartbeat: 10
|
||||
#
|
||||
# o Message Wait Duration (Default : 2000ms = 2 seconds)
|
||||
#
|
||||
# o Message Wait Duration (3 seconds)
|
||||
# message:
|
||||
# duration: 3000
|
||||
time:
|
||||
|
|
|
@ -178,4 +178,10 @@ pool:
|
|||
# o NF Instance Heartbeat (10 seconds)
|
||||
# nf_instance:
|
||||
# heartbeat: 10
|
||||
#
|
||||
# o Message Wait Duration (Default : 2000ms = 2 seconds)
|
||||
#
|
||||
# o Message Wait Duration (3 seconds)
|
||||
# message:
|
||||
# duration: 3000
|
||||
time:
|
||||
|
|
|
@ -154,6 +154,75 @@ static void recalculate_pool_size(void)
|
|||
self.pool.nf_subscription = self.max.nf * MAX_NUM_OF_NF_SUBSCRIPTION;
|
||||
}
|
||||
|
||||
static void regenerate_all_timer_duration(void)
|
||||
{
|
||||
ogs_assert(self.time.message.duration);
|
||||
|
||||
self.time.message.sbi.client_wait_duration = self.time.message.duration;
|
||||
self.time.message.sbi.server_response_deadline =
|
||||
self.time.message.sbi.client_wait_duration + ogs_time_from_sec(1);
|
||||
self.time.message.sbi.nf_register_interval =
|
||||
ogs_max(ogs_time_from_sec(3),
|
||||
self.time.message.sbi.client_wait_duration + ogs_time_from_sec(1));
|
||||
self.time.message.sbi.nf_register_interval_in_exception =
|
||||
ogs_time_from_msec(300);
|
||||
|
||||
#define PFCP_N1_RESPONSE_RETRY_COUNT 3
|
||||
self.time.message.pfcp.n1_response_rcount = PFCP_N1_RESPONSE_RETRY_COUNT;
|
||||
self.time.message.pfcp.t1_response_duration =
|
||||
(self.time.message.duration /
|
||||
(self.time.message.pfcp.n1_response_rcount + 1));
|
||||
ogs_assert(self.time.message.pfcp.t1_response_duration);
|
||||
|
||||
#define PFCP_N1_HOLDING_RETRY_COUNT 1
|
||||
self.time.message.pfcp.n1_holding_rcount = PFCP_N1_HOLDING_RETRY_COUNT;
|
||||
self.time.message.pfcp.t1_holding_duration =
|
||||
self.time.message.pfcp.n1_response_rcount *
|
||||
self.time.message.pfcp.t1_response_duration;
|
||||
ogs_assert(self.time.message.pfcp.t1_holding_duration);
|
||||
|
||||
self.time.message.pfcp.association_interval =
|
||||
ogs_max(ogs_time_from_sec(3),
|
||||
self.time.message.sbi.client_wait_duration + ogs_time_from_sec(1));
|
||||
|
||||
self.time.message.pfcp.no_heartbeat_duration =
|
||||
ogs_max(ogs_time_from_sec(10),
|
||||
self.time.message.sbi.client_wait_duration + ogs_time_from_sec(1));
|
||||
|
||||
#define GTP_N3_RESPONSE_RETRY_COUNT 3
|
||||
self.time.message.gtp.n3_response_rcount = GTP_N3_RESPONSE_RETRY_COUNT;
|
||||
self.time.message.gtp.t3_response_duration =
|
||||
(self.time.message.duration /
|
||||
(self.time.message.gtp.n3_response_rcount + 1));
|
||||
ogs_assert(self.time.message.gtp.t3_response_duration);
|
||||
|
||||
#define GTP_N3_HOLDING_RETRY_COUNT 1
|
||||
self.time.message.gtp.n3_holding_rcount = GTP_N3_HOLDING_RETRY_COUNT;
|
||||
self.time.message.gtp.t3_holding_duration =
|
||||
self.time.message.gtp.n3_response_rcount *
|
||||
self.time.message.gtp.t3_response_duration;
|
||||
ogs_assert(self.time.message.gtp.t3_holding_duration);
|
||||
|
||||
#if 0
|
||||
ogs_trace("%lld, %lld, %lld, %d, %lld, %d %lld, %d, %lld, %d, %lld",
|
||||
(long long)self.time.message.duration,
|
||||
(long long)self.time.message.sbi.client_wait_duration,
|
||||
(long long)self.time.message.sbi.server_response_deadline,
|
||||
self.time.message.pfcp.n1_response_rcount,
|
||||
(long long)self.time.message.pfcp.t1_response_duration,
|
||||
self.time.message.pfcp.n1_holding_rcount,
|
||||
(long long)self.time.message.pfcp.t1_holding_duration,
|
||||
self.time.message.gtp.n3_response_rcount,
|
||||
(long long)self.time.message.gtp.t3_response_duration,
|
||||
self.time.message.gtp.n3_holding_rcount,
|
||||
(long long)self.time.message.gtp.t3_holding_duration);
|
||||
ogs_trace("%lld, %lld, %lld",
|
||||
(long long)self.time.message.sbi.nf_register_interval,
|
||||
(long long)self.time.message.pfcp.association_interval,
|
||||
(long long)self.time.message.pfcp.no_heartbeat_duration);
|
||||
#endif
|
||||
}
|
||||
|
||||
static int config_prepare(void)
|
||||
{
|
||||
#define USRSCTP_LOCAL_UDP_PORT 9899
|
||||
|
@ -187,13 +256,24 @@ static int config_prepare(void)
|
|||
|
||||
recalculate_pool_size();
|
||||
|
||||
self.time.nf_instance.heartbeat = 10; /* 10 second */
|
||||
self.time.nf_instance.validity = 3600; /* 3600 seconds = 1 hour */
|
||||
self.time.subscription.validity = 86400; /* 86400 seconds = 1 day */
|
||||
/* 10 second */
|
||||
self.time.nf_instance.heartbeat_interval = 10;
|
||||
self.time.nf_instance.no_heartbeat_margin = 1;
|
||||
|
||||
/* 3600 seconds = 1 hour */
|
||||
self.time.nf_instance.validity_duration = 3600;
|
||||
|
||||
/* 86400 seconds = 1 day */
|
||||
self.time.subscription.validity_duration = 86400;
|
||||
|
||||
/* Message Wait Duration : 2 seconds */
|
||||
self.time.message.duration = ogs_time_from_sec(2);
|
||||
|
||||
regenerate_all_timer_duration();
|
||||
|
||||
return OGS_OK;
|
||||
}
|
||||
|
||||
|
||||
static int ogs_app_ctx_validation(void)
|
||||
{
|
||||
if (self.parameter.no_ipv4 == 1 &&
|
||||
|
@ -203,7 +283,7 @@ static int ogs_app_ctx_validation(void)
|
|||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
if (self.time.nf_instance.validity == 0) {
|
||||
if (self.time.nf_instance.validity_duration == 0) {
|
||||
ogs_error("NF Instance validity-time should not 0");
|
||||
ogs_error("time:");
|
||||
ogs_error(" nf_instance:");
|
||||
|
@ -425,10 +505,12 @@ int ogs_config_parse()
|
|||
|
||||
if (!strcmp(sbi_key, "heartbeat")) {
|
||||
const char *v = ogs_yaml_iter_value(&sbi_iter);
|
||||
if (v) self.time.nf_instance.heartbeat = atoi(v);
|
||||
if (v) self.time.nf_instance.heartbeat_interval =
|
||||
atoi(v);
|
||||
} else if (!strcmp(sbi_key, "validity")) {
|
||||
const char *v = ogs_yaml_iter_value(&sbi_iter);
|
||||
if (v) self.time.nf_instance.validity = atoi(v);
|
||||
if (v) self.time.nf_instance.validity_duration =
|
||||
atoi(v);
|
||||
} else
|
||||
ogs_warn("unknown key `%s`", sbi_key);
|
||||
}
|
||||
|
@ -443,10 +525,30 @@ int ogs_config_parse()
|
|||
|
||||
if (!strcmp(sbi_key, "validity")) {
|
||||
const char *v = ogs_yaml_iter_value(&sbi_iter);
|
||||
if (v) self.time.subscription.validity = atoi(v);
|
||||
if (v) self.time.subscription.validity_duration =
|
||||
atoi(v);
|
||||
} else
|
||||
ogs_warn("unknown key `%s`", sbi_key);
|
||||
}
|
||||
} else if (!strcmp(time_key, "message")) {
|
||||
ogs_yaml_iter_t msg_iter;
|
||||
ogs_yaml_iter_recurse(&time_iter, &msg_iter);
|
||||
|
||||
while (ogs_yaml_iter_next(&msg_iter)) {
|
||||
const char *msg_key =
|
||||
ogs_yaml_iter_key(&msg_iter);
|
||||
ogs_assert(msg_key);
|
||||
|
||||
if (!strcmp(msg_key, "duration")) {
|
||||
const char *v = ogs_yaml_iter_value(&msg_iter);
|
||||
if (v) {
|
||||
self.time.message.duration =
|
||||
ogs_time_from_msec(atoll(v));
|
||||
regenerate_all_timer_duration();
|
||||
}
|
||||
} else
|
||||
ogs_warn("unknown key `%s`", msg_key);
|
||||
}
|
||||
} else
|
||||
ogs_warn("unknown key `%s`", time_key);
|
||||
}
|
||||
|
|
|
@ -100,12 +100,39 @@ typedef struct ogs_config_s {
|
|||
|
||||
struct {
|
||||
struct {
|
||||
int heartbeat;
|
||||
int validity;
|
||||
int heartbeat_interval;
|
||||
int no_heartbeat_margin;
|
||||
int validity_duration;
|
||||
} nf_instance;
|
||||
struct {
|
||||
int validity;
|
||||
int validity_duration;
|
||||
} subscription;
|
||||
|
||||
struct {
|
||||
ogs_time_t duration;
|
||||
struct {
|
||||
ogs_time_t client_wait_duration;
|
||||
ogs_time_t server_response_deadline;
|
||||
ogs_time_t nf_register_interval;
|
||||
ogs_time_t nf_register_interval_in_exception;
|
||||
} sbi;
|
||||
|
||||
struct {
|
||||
ogs_time_t t3_response_duration;
|
||||
int n3_response_rcount;
|
||||
ogs_time_t t3_holding_duration;
|
||||
int n3_holding_rcount;
|
||||
} gtp;
|
||||
|
||||
struct {
|
||||
ogs_time_t t1_response_duration;
|
||||
int n1_response_rcount;
|
||||
ogs_time_t t1_holding_duration;
|
||||
int n1_holding_rcount;
|
||||
ogs_time_t association_interval;
|
||||
ogs_time_t no_heartbeat_duration;
|
||||
} pfcp;
|
||||
} message;
|
||||
} time;
|
||||
} ogs_config_t;
|
||||
|
||||
|
|
|
@ -44,10 +44,10 @@ libgtp = library('ogsgtp',
|
|||
version : libogslib_version,
|
||||
c_args : '-DOGS_GTP_COMPILATION',
|
||||
include_directories : [libgtp_inc, libinc],
|
||||
dependencies : libcore_dep,
|
||||
dependencies : [libcore_dep, libapp_dep],
|
||||
install : true)
|
||||
|
||||
libgtp_dep = declare_dependency(
|
||||
link_with : libgtp,
|
||||
include_directories : [libgtp_inc, libinc],
|
||||
dependencies : libcore_dep)
|
||||
dependencies : [libcore_dep, libapp_dep])
|
||||
|
|
|
@ -18,12 +18,7 @@
|
|||
*/
|
||||
|
||||
#include "ogs-gtp.h"
|
||||
|
||||
#define GTP_T3_RESPONSE_DURATION ogs_time_from_sec(3) /* 3 seconds */
|
||||
#define GTP_T3_RESPONSE_RETRY_COUNT 3
|
||||
#define GTP_T3_DUPLICATED_DURATION \
|
||||
(GTP_T3_RESPONSE_DURATION * GTP_T3_RESPONSE_RETRY_COUNT) /* 9 seconds */
|
||||
#define GTP_T3_DUPLICATED_RETRY_COUNT 1
|
||||
#include "ogs-app.h"
|
||||
|
||||
typedef enum {
|
||||
GTP_XACT_UNKNOWN_STAGE,
|
||||
|
@ -99,11 +94,11 @@ ogs_gtp_xact_t *ogs_gtp_xact_local_create(ogs_gtp_node_t *gnode,
|
|||
|
||||
xact->tm_response = ogs_timer_add(g_timer_mgr, response_timeout, xact);
|
||||
ogs_assert(xact->tm_response);
|
||||
xact->response_rcount = GTP_T3_RESPONSE_RETRY_COUNT;
|
||||
xact->response_rcount = ogs_config()->time.message.gtp.n3_response_rcount,
|
||||
|
||||
xact->tm_holding = ogs_timer_add(g_timer_mgr, holding_timeout, xact);
|
||||
ogs_assert(xact->tm_holding);
|
||||
xact->holding_rcount = GTP_T3_DUPLICATED_RETRY_COUNT;
|
||||
xact->holding_rcount = ogs_config()->time.message.gtp.n3_holding_rcount,
|
||||
|
||||
ogs_list_add(xact->org == OGS_GTP_LOCAL_ORIGINATOR ?
|
||||
&xact->gnode->local_list : &xact->gnode->remote_list, xact);
|
||||
|
@ -142,11 +137,11 @@ ogs_gtp_xact_t *ogs_gtp_xact_remote_create(ogs_gtp_node_t *gnode, uint32_t sqn)
|
|||
|
||||
xact->tm_response = ogs_timer_add(g_timer_mgr, response_timeout, xact);
|
||||
ogs_assert(xact->tm_response);
|
||||
xact->response_rcount = GTP_T3_RESPONSE_RETRY_COUNT;
|
||||
xact->response_rcount = ogs_config()->time.message.gtp.n3_response_rcount,
|
||||
|
||||
xact->tm_holding = ogs_timer_add(g_timer_mgr, holding_timeout, xact);
|
||||
ogs_assert(xact->tm_holding);
|
||||
xact->holding_rcount = GTP_T3_DUPLICATED_RETRY_COUNT;
|
||||
xact->holding_rcount = ogs_config()->time.message.gtp.n3_holding_rcount,
|
||||
|
||||
ogs_list_add(xact->org == OGS_GTP_LOCAL_ORIGINATOR ?
|
||||
&xact->gnode->local_list : &xact->gnode->remote_list, xact);
|
||||
|
@ -311,8 +306,9 @@ int ogs_gtp_xact_update_rx(ogs_gtp_xact_t *xact, uint8_t type)
|
|||
pkbuf = xact->seq[2].pkbuf;
|
||||
if (pkbuf) {
|
||||
if (xact->tm_holding)
|
||||
ogs_timer_start(
|
||||
xact->tm_holding, GTP_T3_DUPLICATED_DURATION);
|
||||
ogs_timer_start(xact->tm_holding,
|
||||
ogs_config()->time.message.
|
||||
gtp.t3_holding_duration);
|
||||
|
||||
ogs_warn("[%d] %s Request Duplicated. Retransmit!"
|
||||
" for step %d type %d peer [%s]:%d",
|
||||
|
@ -346,8 +342,8 @@ int ogs_gtp_xact_update_rx(ogs_gtp_xact_t *xact, uint8_t type)
|
|||
}
|
||||
|
||||
if (xact->tm_holding)
|
||||
ogs_timer_start(
|
||||
xact->tm_holding, GTP_T3_DUPLICATED_DURATION);
|
||||
ogs_timer_start(xact->tm_holding,
|
||||
ogs_config()->time.message.gtp.t3_holding_duration);
|
||||
|
||||
break;
|
||||
|
||||
|
@ -376,8 +372,9 @@ int ogs_gtp_xact_update_rx(ogs_gtp_xact_t *xact, uint8_t type)
|
|||
pkbuf = xact->seq[1].pkbuf;
|
||||
if (pkbuf) {
|
||||
if (xact->tm_holding)
|
||||
ogs_timer_start(
|
||||
xact->tm_holding, GTP_T3_DUPLICATED_DURATION);
|
||||
ogs_timer_start(xact->tm_holding,
|
||||
ogs_config()->time.message.
|
||||
gtp.t3_holding_duration);
|
||||
|
||||
ogs_warn("[%d] %s Request Duplicated. Retransmit!"
|
||||
" for step %d type %d peer [%s]:%d",
|
||||
|
@ -410,8 +407,8 @@ int ogs_gtp_xact_update_rx(ogs_gtp_xact_t *xact, uint8_t type)
|
|||
return OGS_ERROR;
|
||||
}
|
||||
if (xact->tm_holding)
|
||||
ogs_timer_start(
|
||||
xact->tm_holding, GTP_T3_DUPLICATED_DURATION);
|
||||
ogs_timer_start(xact->tm_holding,
|
||||
ogs_config()->time.message.gtp.t3_holding_duration);
|
||||
|
||||
break;
|
||||
|
||||
|
@ -481,7 +478,8 @@ int ogs_gtp_xact_commit(ogs_gtp_xact_t *xact)
|
|||
}
|
||||
|
||||
if (xact->tm_response)
|
||||
ogs_timer_start(xact->tm_response, GTP_T3_RESPONSE_DURATION);
|
||||
ogs_timer_start(xact->tm_response,
|
||||
ogs_config()->time.message.gtp.t3_response_duration);
|
||||
|
||||
break;
|
||||
|
||||
|
@ -522,8 +520,8 @@ int ogs_gtp_xact_commit(ogs_gtp_xact_t *xact)
|
|||
return OGS_ERROR;
|
||||
}
|
||||
if (xact->tm_response)
|
||||
ogs_timer_start(
|
||||
xact->tm_response, GTP_T3_RESPONSE_DURATION);
|
||||
ogs_timer_start(xact->tm_response,
|
||||
ogs_config()->time.message.gtp.t3_response_duration);
|
||||
|
||||
break;
|
||||
|
||||
|
@ -580,7 +578,8 @@ static void response_timeout(void *data)
|
|||
ogs_pkbuf_t *pkbuf = NULL;
|
||||
|
||||
if (xact->tm_response)
|
||||
ogs_timer_start(xact->tm_response, GTP_T3_RESPONSE_DURATION);
|
||||
ogs_timer_start(xact->tm_response,
|
||||
ogs_config()->time.message.gtp.t3_response_duration);
|
||||
|
||||
pkbuf = xact->seq[xact->step-1].pkbuf;
|
||||
ogs_assert(pkbuf);
|
||||
|
@ -628,7 +627,8 @@ static void holding_timeout(void *data)
|
|||
|
||||
if (--xact->holding_rcount > 0) {
|
||||
if (xact->tm_holding)
|
||||
ogs_timer_start(xact->tm_holding, GTP_T3_DUPLICATED_DURATION);
|
||||
ogs_timer_start(xact->tm_holding,
|
||||
ogs_config()->time.message.gtp.t3_holding_duration);
|
||||
} else {
|
||||
ogs_debug("[%d] %s Delete Transaction "
|
||||
"for step %d type %d peer [%s]:%d",
|
||||
|
|
|
@ -75,7 +75,7 @@ typedef struct ogs_pfcp_node_s {
|
|||
|
||||
ogs_fsm_t sm; /* A state machine */
|
||||
ogs_timer_t *t_association; /* timer to retry to associate peer node */
|
||||
ogs_timer_t *t_heartbeat; /* heartbeat timer to check UPF aliveness */
|
||||
ogs_timer_t *t_no_heartbeat; /* heartbeat timer to check aliveness */
|
||||
|
||||
uint16_t tac[OGS_MAX_NUM_OF_TAI];
|
||||
uint8_t num_of_tac;
|
||||
|
|
|
@ -18,16 +18,11 @@
|
|||
*/
|
||||
|
||||
#include "ogs-pfcp.h"
|
||||
#include "ogs-app.h"
|
||||
|
||||
#define PFCP_MIN_XACT_ID 1
|
||||
#define PFCP_MAX_XACT_ID 0x800000
|
||||
|
||||
#define PFCP_T3_RESPONSE_DURATION ogs_time_from_sec(3) /* 3 seconds */
|
||||
#define PFCP_T3_RESPONSE_RETRY_COUNT 3
|
||||
#define PFCP_T3_DUPLICATED_DURATION \
|
||||
(PFCP_T3_RESPONSE_DURATION * PFCP_T3_RESPONSE_RETRY_COUNT) /* 9 seconds */
|
||||
#define PFCP_T3_DUPLICATED_RETRY_COUNT 1
|
||||
|
||||
typedef enum {
|
||||
PFCP_XACT_UNKNOWN_STAGE,
|
||||
PFCP_XACT_INITIAL_STAGE,
|
||||
|
@ -95,11 +90,11 @@ ogs_pfcp_xact_t *ogs_pfcp_xact_local_create(ogs_pfcp_node_t *node,
|
|||
|
||||
xact->tm_response = ogs_timer_add(g_timer_mgr, response_timeout, xact);
|
||||
ogs_assert(xact->tm_response);
|
||||
xact->response_rcount = PFCP_T3_RESPONSE_RETRY_COUNT;
|
||||
xact->response_rcount = ogs_config()->time.message.pfcp.n1_response_rcount,
|
||||
|
||||
xact->tm_holding = ogs_timer_add(g_timer_mgr, holding_timeout, xact);
|
||||
ogs_assert(xact->tm_holding);
|
||||
xact->holding_rcount = PFCP_T3_DUPLICATED_RETRY_COUNT;
|
||||
xact->holding_rcount = ogs_config()->time.message.pfcp.n1_holding_rcount,
|
||||
|
||||
ogs_list_add(xact->org == OGS_PFCP_LOCAL_ORIGINATOR ?
|
||||
&xact->node->local_list : &xact->node->remote_list, xact);
|
||||
|
@ -139,11 +134,11 @@ ogs_pfcp_xact_t *ogs_pfcp_xact_remote_create(
|
|||
|
||||
xact->tm_response = ogs_timer_add(g_timer_mgr, response_timeout, xact);
|
||||
ogs_assert(xact->tm_response);
|
||||
xact->response_rcount = PFCP_T3_RESPONSE_RETRY_COUNT;
|
||||
xact->response_rcount = ogs_config()->time.message.pfcp.n1_response_rcount,
|
||||
|
||||
xact->tm_holding = ogs_timer_add(g_timer_mgr, holding_timeout, xact);
|
||||
ogs_assert(xact->tm_holding);
|
||||
xact->holding_rcount = PFCP_T3_DUPLICATED_RETRY_COUNT;
|
||||
xact->holding_rcount = ogs_config()->time.message.pfcp.n1_holding_rcount,
|
||||
|
||||
ogs_list_add(xact->org == OGS_PFCP_LOCAL_ORIGINATOR ?
|
||||
&xact->node->local_list : &xact->node->remote_list, xact);
|
||||
|
@ -308,8 +303,9 @@ int ogs_pfcp_xact_update_rx(ogs_pfcp_xact_t *xact, uint8_t type)
|
|||
pkbuf = xact->seq[2].pkbuf;
|
||||
if (pkbuf) {
|
||||
if (xact->tm_holding)
|
||||
ogs_timer_start(
|
||||
xact->tm_holding, PFCP_T3_DUPLICATED_DURATION);
|
||||
ogs_timer_start(xact->tm_holding,
|
||||
ogs_config()->time.message.
|
||||
pfcp.t1_holding_duration);
|
||||
|
||||
ogs_warn("[%d] %s Request Duplicated. Retransmit!"
|
||||
" for step %d type %d peer [%s]:%d",
|
||||
|
@ -343,8 +339,8 @@ int ogs_pfcp_xact_update_rx(ogs_pfcp_xact_t *xact, uint8_t type)
|
|||
}
|
||||
|
||||
if (xact->tm_holding)
|
||||
ogs_timer_start(
|
||||
xact->tm_holding, PFCP_T3_DUPLICATED_DURATION);
|
||||
ogs_timer_start(xact->tm_holding,
|
||||
ogs_config()->time.message.pfcp.t1_holding_duration);
|
||||
|
||||
break;
|
||||
|
||||
|
@ -373,8 +369,9 @@ int ogs_pfcp_xact_update_rx(ogs_pfcp_xact_t *xact, uint8_t type)
|
|||
pkbuf = xact->seq[1].pkbuf;
|
||||
if (pkbuf) {
|
||||
if (xact->tm_holding)
|
||||
ogs_timer_start(
|
||||
xact->tm_holding, PFCP_T3_DUPLICATED_DURATION);
|
||||
ogs_timer_start(xact->tm_holding,
|
||||
ogs_config()->time.message.
|
||||
pfcp.t1_holding_duration);
|
||||
|
||||
ogs_warn("[%d] %s Request Duplicated. Retransmit!"
|
||||
" for step %d type %d peer [%s]:%d",
|
||||
|
@ -407,8 +404,8 @@ int ogs_pfcp_xact_update_rx(ogs_pfcp_xact_t *xact, uint8_t type)
|
|||
return OGS_ERROR;
|
||||
}
|
||||
if (xact->tm_holding)
|
||||
ogs_timer_start(
|
||||
xact->tm_holding, PFCP_T3_DUPLICATED_DURATION);
|
||||
ogs_timer_start(xact->tm_holding,
|
||||
ogs_config()->time.message.pfcp.t1_holding_duration);
|
||||
|
||||
break;
|
||||
|
||||
|
@ -478,7 +475,8 @@ int ogs_pfcp_xact_commit(ogs_pfcp_xact_t *xact)
|
|||
}
|
||||
|
||||
if (xact->tm_response)
|
||||
ogs_timer_start(xact->tm_response, PFCP_T3_RESPONSE_DURATION);
|
||||
ogs_timer_start(xact->tm_response,
|
||||
ogs_config()->time.message.pfcp.t1_response_duration);
|
||||
|
||||
break;
|
||||
|
||||
|
@ -519,8 +517,8 @@ int ogs_pfcp_xact_commit(ogs_pfcp_xact_t *xact)
|
|||
return OGS_ERROR;
|
||||
}
|
||||
if (xact->tm_response)
|
||||
ogs_timer_start(
|
||||
xact->tm_response, PFCP_T3_RESPONSE_DURATION);
|
||||
ogs_timer_start(xact->tm_response,
|
||||
ogs_config()->time.message.pfcp.t1_response_duration);
|
||||
|
||||
break;
|
||||
|
||||
|
@ -577,7 +575,8 @@ static void response_timeout(void *data)
|
|||
ogs_pkbuf_t *pkbuf = NULL;
|
||||
|
||||
if (xact->tm_response)
|
||||
ogs_timer_start(xact->tm_response, PFCP_T3_RESPONSE_DURATION);
|
||||
ogs_timer_start(xact->tm_response,
|
||||
ogs_config()->time.message.pfcp.t1_response_duration);
|
||||
|
||||
pkbuf = xact->seq[xact->step-1].pkbuf;
|
||||
ogs_assert(pkbuf);
|
||||
|
@ -625,7 +624,8 @@ static void holding_timeout(void *data)
|
|||
|
||||
if (--xact->holding_rcount > 0) {
|
||||
if (xact->tm_holding)
|
||||
ogs_timer_start(xact->tm_holding, PFCP_T3_DUPLICATED_DURATION);
|
||||
ogs_timer_start(xact->tm_holding,
|
||||
ogs_config()->time.message.pfcp.t1_holding_duration);
|
||||
} else {
|
||||
ogs_debug("[%d] %s Delete Transaction "
|
||||
"for step %d type %d peer [%s]:%d",
|
||||
|
|
|
@ -440,7 +440,8 @@ ogs_sbi_nf_instance_t *ogs_sbi_nf_instance_add(char *id)
|
|||
nf_instance->id = ogs_strdup(id);
|
||||
ogs_assert(nf_instance->id);
|
||||
|
||||
nf_instance->time.heartbeat = ogs_config()->time.nf_instance.heartbeat;
|
||||
nf_instance->time.heartbeat_interval =
|
||||
ogs_config()->time.nf_instance.heartbeat_interval;
|
||||
|
||||
nf_instance->t_registration_interval = ogs_timer_add(
|
||||
ogs_sbi_self()->timer_mgr, NULL, nf_instance);
|
||||
|
@ -448,9 +449,9 @@ ogs_sbi_nf_instance_t *ogs_sbi_nf_instance_add(char *id)
|
|||
nf_instance->t_heartbeat_interval = ogs_timer_add(
|
||||
ogs_sbi_self()->timer_mgr, NULL, nf_instance);
|
||||
ogs_assert(nf_instance->t_heartbeat_interval);
|
||||
nf_instance->t_heartbeat = ogs_timer_add(
|
||||
nf_instance->t_no_heartbeat = ogs_timer_add(
|
||||
ogs_sbi_self()->timer_mgr, NULL, nf_instance);
|
||||
ogs_assert(nf_instance->t_heartbeat);
|
||||
ogs_assert(nf_instance->t_no_heartbeat);
|
||||
nf_instance->t_validity = ogs_timer_add(
|
||||
ogs_sbi_self()->timer_mgr, NULL, nf_instance);
|
||||
ogs_assert(nf_instance->t_validity);
|
||||
|
@ -500,7 +501,7 @@ void ogs_sbi_nf_instance_remove(ogs_sbi_nf_instance_t *nf_instance)
|
|||
|
||||
ogs_timer_delete(nf_instance->t_registration_interval);
|
||||
ogs_timer_delete(nf_instance->t_heartbeat_interval);
|
||||
ogs_timer_delete(nf_instance->t_heartbeat);
|
||||
ogs_timer_delete(nf_instance->t_no_heartbeat);
|
||||
ogs_timer_delete(nf_instance->t_validity);
|
||||
|
||||
if (nf_instance->client)
|
||||
|
@ -990,7 +991,8 @@ ogs_sbi_subscription_t *ogs_sbi_subscription_add(void)
|
|||
ogs_assert(subscription);
|
||||
memset(subscription, 0, sizeof(ogs_sbi_subscription_t));
|
||||
|
||||
subscription->time.validity = ogs_config()->time.subscription.validity;
|
||||
subscription->time.validity_duration =
|
||||
ogs_config()->time.subscription.validity_duration;
|
||||
|
||||
ogs_list_add(&ogs_sbi_self()->subscription_list, subscription);
|
||||
|
||||
|
|
|
@ -64,14 +64,13 @@ typedef struct ogs_sbi_nf_instance_s {
|
|||
ogs_fsm_t sm; /* A state machine */
|
||||
ogs_timer_t *t_registration_interval; /* timer to retry
|
||||
to register peer node */
|
||||
#define OGS_SBI_HEARTBEAT_RETRYCOUNT 4
|
||||
struct {
|
||||
int heartbeat;
|
||||
int validity;
|
||||
int heartbeat_interval;
|
||||
int validity_duration;
|
||||
} time;
|
||||
|
||||
ogs_timer_t *t_heartbeat_interval; /* heartbeat interval */
|
||||
ogs_timer_t *t_heartbeat; /* check heartbeat */
|
||||
ogs_timer_t *t_no_heartbeat; /* check heartbeat */
|
||||
ogs_timer_t *t_validity; /* check validation */
|
||||
|
||||
#define NF_INSTANCE_IS_SELF(_iD) \
|
||||
|
@ -159,7 +158,7 @@ typedef struct ogs_sbi_subscription_s {
|
|||
ogs_lnode_t lnode;
|
||||
|
||||
struct {
|
||||
int validity;
|
||||
int validity_duration;
|
||||
} time;
|
||||
|
||||
ogs_timer_t *t_validity; /* check validation */
|
||||
|
|
|
@ -259,7 +259,7 @@ 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;
|
||||
NFProfile->heart_beat_timer = nf_instance->time.heartbeat_interval;
|
||||
|
||||
message.NFProfile = NFProfile;
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ bool ogs_sbi_nnrf_handle_nf_profile(ogs_sbi_nf_instance_t *nf_instance,
|
|||
|
||||
nf_instance->nf_type = NFProfile->nf_type;
|
||||
nf_instance->nf_status = NFProfile->nf_status;
|
||||
nf_instance->time.heartbeat = NFProfile->heart_beat_timer;
|
||||
nf_instance->time.heartbeat_interval = NFProfile->heart_beat_timer;
|
||||
|
||||
if (NFProfile->fqdn)
|
||||
ogs_fqdn_parse(nf_instance->fqdn,
|
||||
|
|
|
@ -115,9 +115,10 @@ static ogs_sbi_session_t *session_add(ogs_sbi_server_t *server,
|
|||
ogs_sbi_self()->timer_mgr, session_timer_expired, session);
|
||||
ogs_assert(session->timer);
|
||||
|
||||
/* If User does not send http response within 3 second,
|
||||
* we will assert this program. */
|
||||
ogs_timer_start(session->timer, ogs_time_from_sec(3));
|
||||
/* If User does not send http response within deadline,
|
||||
* Open5GS will assert this program. */
|
||||
ogs_timer_start(session->timer,
|
||||
ogs_config()->time.message.sbi.server_response_deadline);
|
||||
|
||||
ogs_list_add(&server->suspended_session_list, session);
|
||||
|
||||
|
|
|
@ -299,7 +299,7 @@ void amf_state_operational(ogs_fsm_t *s, amf_event_t *e)
|
|||
ogs_fsm_dispatch(&nf_instance->sm, e);
|
||||
|
||||
if (OGS_FSM_CHECK(&nf_instance->sm, amf_nf_state_exception)) {
|
||||
ogs_error("[%s] State machine exception", nf_instance->id);
|
||||
ogs_warn("[%s] State machine exception", nf_instance->id);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -435,7 +435,7 @@ void amf_state_operational(ogs_fsm_t *s, amf_event_t *e)
|
|||
switch(e->timer_id) {
|
||||
case AMF_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL:
|
||||
case AMF_TIMER_NF_INSTANCE_HEARTBEAT_INTERVAL:
|
||||
case AMF_TIMER_NF_INSTANCE_HEARTBEAT:
|
||||
case AMF_TIMER_NF_INSTANCE_NO_HEARTBEAT:
|
||||
case AMF_TIMER_NF_INSTANCE_VALIDITY:
|
||||
nf_instance = e->sbi.data;
|
||||
ogs_assert(nf_instance);
|
||||
|
|
|
@ -68,8 +68,8 @@ void amf_nf_state_initial(ogs_fsm_t *s, amf_event_t *e)
|
|||
ogs_assert(nf_instance->t_heartbeat_interval);
|
||||
nf_instance->t_heartbeat_interval->cb =
|
||||
amf_timer_nf_instance_heartbeat_interval;
|
||||
ogs_assert(nf_instance->t_heartbeat);
|
||||
nf_instance->t_heartbeat->cb = amf_timer_nf_instance_heartbeat;
|
||||
ogs_assert(nf_instance->t_no_heartbeat);
|
||||
nf_instance->t_no_heartbeat->cb = amf_timer_nf_instance_no_heartbeat;
|
||||
ogs_assert(nf_instance->t_validity);
|
||||
nf_instance->t_validity->cb = amf_timer_nf_instance_validity;
|
||||
|
||||
|
@ -107,8 +107,7 @@ void amf_nf_state_will_register(ogs_fsm_t *s, amf_event_t *e)
|
|||
case OGS_FSM_ENTRY_SIG:
|
||||
if (NF_INSTANCE_IS_SELF(nf_instance->id))
|
||||
ogs_timer_start(nf_instance->t_registration_interval,
|
||||
amf_timer_cfg(AMF_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL)->
|
||||
duration);
|
||||
ogs_config()->time.message.sbi.nf_register_interval);
|
||||
|
||||
ogs_nnrf_nfm_send_nf_register(nf_instance);
|
||||
break;
|
||||
|
@ -163,8 +162,7 @@ void amf_nf_state_will_register(ogs_fsm_t *s, amf_event_t *e)
|
|||
|
||||
if (NF_INSTANCE_IS_SELF(nf_instance->id))
|
||||
ogs_timer_start(nf_instance->t_registration_interval,
|
||||
amf_timer_cfg(AMF_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL)->
|
||||
duration);
|
||||
ogs_config()->time.message.sbi.nf_register_interval);
|
||||
|
||||
ogs_nnrf_nfm_send_nf_register(nf_instance);
|
||||
break;
|
||||
|
@ -202,12 +200,13 @@ void amf_nf_state_registered(ogs_fsm_t *s, amf_event_t *e)
|
|||
client = nf_instance->client;
|
||||
ogs_assert(client);
|
||||
|
||||
if (nf_instance->time.heartbeat) {
|
||||
if (nf_instance->time.heartbeat_interval) {
|
||||
ogs_timer_start(nf_instance->t_heartbeat_interval,
|
||||
ogs_time_from_sec(nf_instance->time.heartbeat));
|
||||
ogs_timer_start(nf_instance->t_heartbeat,
|
||||
ogs_time_from_sec(nf_instance->time.heartbeat *
|
||||
OGS_SBI_HEARTBEAT_RETRYCOUNT));
|
||||
ogs_time_from_sec(nf_instance->time.heartbeat_interval));
|
||||
ogs_timer_start(nf_instance->t_no_heartbeat,
|
||||
ogs_time_from_sec(
|
||||
nf_instance->time.heartbeat_interval +
|
||||
ogs_config()->time.nf_instance.no_heartbeat_margin));
|
||||
}
|
||||
|
||||
ogs_nnrf_nfm_send_nf_status_subscribe(client,
|
||||
|
@ -220,12 +219,14 @@ void amf_nf_state_registered(ogs_fsm_t *s, amf_event_t *e)
|
|||
if (NF_INSTANCE_IS_SELF(nf_instance->id)) {
|
||||
ogs_info("[%s] NF de-registered", nf_instance->id);
|
||||
|
||||
if (nf_instance->time.heartbeat) {
|
||||
if (nf_instance->time.heartbeat_interval) {
|
||||
ogs_timer_stop(nf_instance->t_heartbeat_interval);
|
||||
ogs_timer_stop(nf_instance->t_heartbeat);
|
||||
ogs_timer_stop(nf_instance->t_no_heartbeat);
|
||||
}
|
||||
|
||||
ogs_nnrf_nfm_send_nf_de_register(nf_instance);
|
||||
if (!OGS_FSM_CHECK(&nf_instance->sm, amf_nf_state_exception)) {
|
||||
ogs_nnrf_nfm_send_nf_de_register(nf_instance);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -241,13 +242,16 @@ void amf_nf_state_registered(ogs_fsm_t *s, amf_event_t *e)
|
|||
|
||||
if (message->res_status == OGS_SBI_HTTP_STATUS_NO_CONTENT ||
|
||||
message->res_status == OGS_SBI_HTTP_STATUS_OK) {
|
||||
if (nf_instance->time.heartbeat)
|
||||
ogs_timer_start(nf_instance->t_heartbeat,
|
||||
ogs_time_from_sec(nf_instance->time.heartbeat *
|
||||
OGS_SBI_HEARTBEAT_RETRYCOUNT));
|
||||
if (nf_instance->time.heartbeat_interval)
|
||||
ogs_timer_start(nf_instance->t_no_heartbeat,
|
||||
ogs_time_from_sec(
|
||||
nf_instance->time.heartbeat_interval +
|
||||
ogs_config()->time.nf_instance.
|
||||
no_heartbeat_margin));
|
||||
} else {
|
||||
ogs_error("[%s] HTTP response error [%d]",
|
||||
ogs_warn("[%s] HTTP response error [%d]",
|
||||
nf_instance->id, message->res_status);
|
||||
OGS_FSM_TRAN(s, &amf_nf_state_exception);
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -267,14 +271,14 @@ void amf_nf_state_registered(ogs_fsm_t *s, amf_event_t *e)
|
|||
case AMF_EVT_SBI_TIMER:
|
||||
switch(e->timer_id) {
|
||||
case AMF_TIMER_NF_INSTANCE_HEARTBEAT_INTERVAL:
|
||||
if (nf_instance->time.heartbeat)
|
||||
if (nf_instance->time.heartbeat_interval)
|
||||
ogs_timer_start(nf_instance->t_heartbeat_interval,
|
||||
ogs_time_from_sec(nf_instance->time.heartbeat));
|
||||
ogs_time_from_sec(nf_instance->time.heartbeat_interval));
|
||||
|
||||
ogs_nnrf_nfm_send_nf_update(nf_instance);
|
||||
break;
|
||||
|
||||
case AMF_TIMER_NF_INSTANCE_HEARTBEAT:
|
||||
case AMF_TIMER_NF_INSTANCE_NO_HEARTBEAT:
|
||||
OGS_FSM_TRAN(s, &amf_nf_state_will_register);
|
||||
break;
|
||||
|
||||
|
@ -329,6 +333,7 @@ void amf_nf_state_exception(ogs_fsm_t *s, amf_event_t *e)
|
|||
{
|
||||
ogs_sbi_nf_instance_t *nf_instance = NULL;
|
||||
ogs_sbi_client_t *client = NULL;
|
||||
ogs_sbi_message_t *message = NULL;
|
||||
ogs_sockaddr_t *addr = NULL;
|
||||
ogs_assert(s);
|
||||
ogs_assert(e);
|
||||
|
@ -342,8 +347,8 @@ void amf_nf_state_exception(ogs_fsm_t *s, amf_event_t *e)
|
|||
case OGS_FSM_ENTRY_SIG:
|
||||
if (NF_INSTANCE_IS_SELF(nf_instance->id))
|
||||
ogs_timer_start(nf_instance->t_registration_interval,
|
||||
amf_timer_cfg(AMF_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL)->
|
||||
duration);
|
||||
ogs_config()->time.message.sbi.
|
||||
nf_register_interval_in_exception);
|
||||
break;
|
||||
|
||||
case OGS_FSM_EXIT_SIG:
|
||||
|
@ -371,6 +376,26 @@ void amf_nf_state_exception(ogs_fsm_t *s, amf_event_t *e)
|
|||
}
|
||||
break;
|
||||
|
||||
case AMF_EVT_SBI_CLIENT:
|
||||
message = e->sbi.message;
|
||||
ogs_assert(message);
|
||||
|
||||
SWITCH(message->h.service.name)
|
||||
CASE(OGS_SBI_SERVICE_NAME_NNRF_NFM)
|
||||
|
||||
SWITCH(message->h.resource.component[0])
|
||||
CASE(OGS_SBI_RESOURCE_NAME_NF_INSTANCES)
|
||||
break;
|
||||
DEFAULT
|
||||
ogs_error("Invalid resource name [%s]",
|
||||
message->h.resource.component[0]);
|
||||
END
|
||||
break;
|
||||
DEFAULT
|
||||
ogs_error("Invalid API name [%s]", message->h.service.name);
|
||||
END
|
||||
break;
|
||||
|
||||
default:
|
||||
ogs_error("[%s] Unknown event %s",
|
||||
nf_instance->id, amf_event_get_name(e));
|
||||
|
|
|
@ -40,7 +40,7 @@ void amf_nnrf_handle_nf_register(
|
|||
}
|
||||
|
||||
/* TIME : Update heartbeat from NRF */
|
||||
nf_instance->time.heartbeat = NFProfile->heart_beat_timer;
|
||||
nf_instance->time.heartbeat_interval = NFProfile->heart_beat_timer;
|
||||
}
|
||||
|
||||
void amf_nnrf_handle_nf_status_subscribe(
|
||||
|
@ -277,11 +277,12 @@ void amf_nnrf_handle_nf_discover(
|
|||
|
||||
/* TIME : Update validity from NRF */
|
||||
if (SearchResult->validity_period) {
|
||||
nf_instance->time.validity = SearchResult->validity_period;
|
||||
nf_instance->time.validity_duration =
|
||||
SearchResult->validity_period;
|
||||
|
||||
ogs_assert(nf_instance->t_validity);
|
||||
ogs_timer_start(nf_instance->t_validity,
|
||||
ogs_time_from_sec(nf_instance->time.validity));
|
||||
ogs_time_from_sec(nf_instance->time.validity_duration));
|
||||
|
||||
} else
|
||||
ogs_warn("[%s] NF Instance validity-time should not 0",
|
||||
|
|
|
@ -125,7 +125,7 @@ void amf_ue_sbi_discover_and_send(
|
|||
|
||||
amf_ue->sbi.nf_state_registered = amf_nf_state_registered;
|
||||
amf_ue->sbi.client_wait.duration =
|
||||
amf_timer_cfg(AMF_TIMER_SBI_CLIENT_WAIT)->duration;
|
||||
ogs_config()->time.message.sbi.client_wait_duration;
|
||||
amf_ue->sbi.client_cb = client_cb;
|
||||
|
||||
if (ogs_sbi_discover_and_send(
|
||||
|
@ -145,7 +145,7 @@ void amf_sess_sbi_discover_and_send(
|
|||
|
||||
sess->sbi.nf_state_registered = amf_nf_state_registered;
|
||||
sess->sbi.client_wait.duration =
|
||||
amf_timer_cfg(AMF_TIMER_SBI_CLIENT_WAIT)->duration;
|
||||
ogs_config()->time.message.sbi.client_wait_duration;
|
||||
sess->sbi.client_cb = client_cb;
|
||||
|
||||
if (ogs_sbi_discover_and_send(
|
||||
|
|
|
@ -20,8 +20,6 @@
|
|||
#include "context.h"
|
||||
|
||||
static amf_timer_cfg_t g_amf_timer_cfg[MAX_NUM_OF_AMF_TIMER] = {
|
||||
[AMF_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL] =
|
||||
{ .duration = ogs_time_from_sec(3) },
|
||||
[AMF_TIMER_SBI_CLIENT_WAIT] =
|
||||
{ .duration = ogs_time_from_msec(500) },
|
||||
|
||||
|
@ -70,8 +68,8 @@ const char *amf_timer_get_name(amf_timer_e id)
|
|||
return "AMF_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL";
|
||||
case AMF_TIMER_NF_INSTANCE_HEARTBEAT_INTERVAL:
|
||||
return "AMF_TIMER_NF_INSTANCE_HEARTBEAT_INTERVAL";
|
||||
case AMF_TIMER_NF_INSTANCE_HEARTBEAT:
|
||||
return "AMF_TIMER_NF_INSTANCE_HEARTBEAT";
|
||||
case AMF_TIMER_NF_INSTANCE_NO_HEARTBEAT:
|
||||
return "AMF_TIMER_NF_INSTANCE_NO_HEARTBEAT";
|
||||
case AMF_TIMER_NF_INSTANCE_VALIDITY:
|
||||
return "AMF_TIMER_NF_INSTANCE_VALIDITY";
|
||||
case AMF_TIMER_SUBSCRIPTION_VALIDITY:
|
||||
|
@ -124,7 +122,7 @@ static void sbi_timer_send_event(int timer_id, void *data)
|
|||
switch (timer_id) {
|
||||
case AMF_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL:
|
||||
case AMF_TIMER_NF_INSTANCE_HEARTBEAT_INTERVAL:
|
||||
case AMF_TIMER_NF_INSTANCE_HEARTBEAT:
|
||||
case AMF_TIMER_NF_INSTANCE_NO_HEARTBEAT:
|
||||
case AMF_TIMER_NF_INSTANCE_VALIDITY:
|
||||
case AMF_TIMER_SUBSCRIPTION_VALIDITY:
|
||||
e = amf_event_new(AMF_EVT_SBI_TIMER);
|
||||
|
@ -162,9 +160,9 @@ void amf_timer_nf_instance_heartbeat_interval(void *data)
|
|||
sbi_timer_send_event(AMF_TIMER_NF_INSTANCE_HEARTBEAT_INTERVAL, data);
|
||||
}
|
||||
|
||||
void amf_timer_nf_instance_heartbeat(void *data)
|
||||
void amf_timer_nf_instance_no_heartbeat(void *data)
|
||||
{
|
||||
sbi_timer_send_event(AMF_TIMER_NF_INSTANCE_HEARTBEAT, data);
|
||||
sbi_timer_send_event(AMF_TIMER_NF_INSTANCE_NO_HEARTBEAT, data);
|
||||
}
|
||||
|
||||
void amf_timer_nf_instance_validity(void *data)
|
||||
|
|
|
@ -32,7 +32,7 @@ typedef enum {
|
|||
|
||||
AMF_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL,
|
||||
AMF_TIMER_NF_INSTANCE_HEARTBEAT_INTERVAL,
|
||||
AMF_TIMER_NF_INSTANCE_HEARTBEAT,
|
||||
AMF_TIMER_NF_INSTANCE_NO_HEARTBEAT,
|
||||
AMF_TIMER_NF_INSTANCE_VALIDITY,
|
||||
AMF_TIMER_SUBSCRIPTION_VALIDITY,
|
||||
AMF_TIMER_SBI_CLIENT_WAIT,
|
||||
|
@ -61,7 +61,7 @@ const char *amf_timer_get_name(amf_timer_e id);
|
|||
|
||||
void amf_timer_nf_instance_registration_interval(void *data);
|
||||
void amf_timer_nf_instance_heartbeat_interval(void *data);
|
||||
void amf_timer_nf_instance_heartbeat(void *data);
|
||||
void amf_timer_nf_instance_no_heartbeat(void *data);
|
||||
void amf_timer_nf_instance_validity(void *data);
|
||||
void amf_timer_subscription_validity(void *data);
|
||||
void amf_timer_sbi_client_wait_expire(void *data);
|
||||
|
|
|
@ -207,7 +207,7 @@ void ausf_state_operational(ogs_fsm_t *s, ausf_event_t *e)
|
|||
ogs_fsm_dispatch(&nf_instance->sm, e);
|
||||
|
||||
if (OGS_FSM_CHECK(&nf_instance->sm, ausf_nf_state_exception)) {
|
||||
ogs_error("[%s] State machine exception", nf_instance->id);
|
||||
ogs_warn("[%s] State machine exception", nf_instance->id);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -315,7 +315,7 @@ void ausf_state_operational(ogs_fsm_t *s, ausf_event_t *e)
|
|||
switch(e->timer_id) {
|
||||
case AUSF_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL:
|
||||
case AUSF_TIMER_NF_INSTANCE_HEARTBEAT_INTERVAL:
|
||||
case AUSF_TIMER_NF_INSTANCE_HEARTBEAT:
|
||||
case AUSF_TIMER_NF_INSTANCE_NO_HEARTBEAT:
|
||||
case AUSF_TIMER_NF_INSTANCE_VALIDITY:
|
||||
nf_instance = e->sbi.data;
|
||||
ogs_assert(nf_instance);
|
||||
|
|
|
@ -68,8 +68,8 @@ void ausf_nf_state_initial(ogs_fsm_t *s, ausf_event_t *e)
|
|||
ogs_assert(nf_instance->t_heartbeat_interval);
|
||||
nf_instance->t_heartbeat_interval->cb =
|
||||
ausf_timer_nf_instance_heartbeat_interval;
|
||||
ogs_assert(nf_instance->t_heartbeat);
|
||||
nf_instance->t_heartbeat->cb = ausf_timer_nf_instance_heartbeat;
|
||||
ogs_assert(nf_instance->t_no_heartbeat);
|
||||
nf_instance->t_no_heartbeat->cb = ausf_timer_nf_instance_no_heartbeat;
|
||||
ogs_assert(nf_instance->t_validity);
|
||||
nf_instance->t_validity->cb = ausf_timer_nf_instance_validity;
|
||||
|
||||
|
@ -107,8 +107,7 @@ void ausf_nf_state_will_register(ogs_fsm_t *s, ausf_event_t *e)
|
|||
case OGS_FSM_ENTRY_SIG:
|
||||
if (NF_INSTANCE_IS_SELF(nf_instance->id))
|
||||
ogs_timer_start(nf_instance->t_registration_interval,
|
||||
ausf_timer_cfg(AUSF_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL)->
|
||||
duration);
|
||||
ogs_config()->time.message.sbi.nf_register_interval);
|
||||
|
||||
ogs_nnrf_nfm_send_nf_register(nf_instance);
|
||||
break;
|
||||
|
@ -163,8 +162,7 @@ void ausf_nf_state_will_register(ogs_fsm_t *s, ausf_event_t *e)
|
|||
|
||||
if (NF_INSTANCE_IS_SELF(nf_instance->id))
|
||||
ogs_timer_start(nf_instance->t_registration_interval,
|
||||
ausf_timer_cfg(AUSF_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL)->
|
||||
duration);
|
||||
ogs_config()->time.message.sbi.nf_register_interval);
|
||||
|
||||
ogs_nnrf_nfm_send_nf_register(nf_instance);
|
||||
break;
|
||||
|
@ -202,12 +200,13 @@ void ausf_nf_state_registered(ogs_fsm_t *s, ausf_event_t *e)
|
|||
client = nf_instance->client;
|
||||
ogs_assert(client);
|
||||
|
||||
if (nf_instance->time.heartbeat) {
|
||||
if (nf_instance->time.heartbeat_interval) {
|
||||
ogs_timer_start(nf_instance->t_heartbeat_interval,
|
||||
ogs_time_from_sec(nf_instance->time.heartbeat));
|
||||
ogs_timer_start(nf_instance->t_heartbeat,
|
||||
ogs_time_from_sec(nf_instance->time.heartbeat *
|
||||
OGS_SBI_HEARTBEAT_RETRYCOUNT));
|
||||
ogs_time_from_sec(nf_instance->time.heartbeat_interval));
|
||||
ogs_timer_start(nf_instance->t_no_heartbeat,
|
||||
ogs_time_from_sec(
|
||||
nf_instance->time.heartbeat_interval +
|
||||
ogs_config()->time.nf_instance.no_heartbeat_margin));
|
||||
}
|
||||
|
||||
ogs_nnrf_nfm_send_nf_status_subscribe(client,
|
||||
|
@ -220,12 +219,14 @@ void ausf_nf_state_registered(ogs_fsm_t *s, ausf_event_t *e)
|
|||
if (NF_INSTANCE_IS_SELF(nf_instance->id)) {
|
||||
ogs_info("[%s] NF de-registered", nf_instance->id);
|
||||
|
||||
if (nf_instance->time.heartbeat) {
|
||||
if (nf_instance->time.heartbeat_interval) {
|
||||
ogs_timer_stop(nf_instance->t_heartbeat_interval);
|
||||
ogs_timer_stop(nf_instance->t_heartbeat);
|
||||
ogs_timer_stop(nf_instance->t_no_heartbeat);
|
||||
}
|
||||
|
||||
ogs_nnrf_nfm_send_nf_de_register(nf_instance);
|
||||
if (!OGS_FSM_CHECK(&nf_instance->sm, ausf_nf_state_exception)) {
|
||||
ogs_nnrf_nfm_send_nf_de_register(nf_instance);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -241,13 +242,16 @@ void ausf_nf_state_registered(ogs_fsm_t *s, ausf_event_t *e)
|
|||
|
||||
if (message->res_status == OGS_SBI_HTTP_STATUS_NO_CONTENT ||
|
||||
message->res_status == OGS_SBI_HTTP_STATUS_OK) {
|
||||
if (nf_instance->time.heartbeat)
|
||||
ogs_timer_start(nf_instance->t_heartbeat,
|
||||
ogs_time_from_sec(nf_instance->time.heartbeat *
|
||||
OGS_SBI_HEARTBEAT_RETRYCOUNT));
|
||||
if (nf_instance->time.heartbeat_interval)
|
||||
ogs_timer_start(nf_instance->t_no_heartbeat,
|
||||
ogs_time_from_sec(
|
||||
nf_instance->time.heartbeat_interval +
|
||||
ogs_config()->time.nf_instance.
|
||||
no_heartbeat_margin));
|
||||
} else {
|
||||
ogs_error("[%s] HTTP response error [%d]",
|
||||
ogs_warn("[%s] HTTP response error [%d]",
|
||||
nf_instance->id, message->res_status);
|
||||
OGS_FSM_TRAN(s, &ausf_nf_state_exception);
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -267,14 +271,14 @@ void ausf_nf_state_registered(ogs_fsm_t *s, ausf_event_t *e)
|
|||
case AUSF_EVT_SBI_TIMER:
|
||||
switch(e->timer_id) {
|
||||
case AUSF_TIMER_NF_INSTANCE_HEARTBEAT_INTERVAL:
|
||||
if (nf_instance->time.heartbeat)
|
||||
if (nf_instance->time.heartbeat_interval)
|
||||
ogs_timer_start(nf_instance->t_heartbeat_interval,
|
||||
ogs_time_from_sec(nf_instance->time.heartbeat));
|
||||
ogs_time_from_sec(nf_instance->time.heartbeat_interval));
|
||||
|
||||
ogs_nnrf_nfm_send_nf_update(nf_instance);
|
||||
break;
|
||||
|
||||
case AUSF_TIMER_NF_INSTANCE_HEARTBEAT:
|
||||
case AUSF_TIMER_NF_INSTANCE_NO_HEARTBEAT:
|
||||
OGS_FSM_TRAN(s, &ausf_nf_state_will_register);
|
||||
break;
|
||||
|
||||
|
@ -331,6 +335,7 @@ void ausf_nf_state_exception(ogs_fsm_t *s, ausf_event_t *e)
|
|||
{
|
||||
ogs_sbi_nf_instance_t *nf_instance = NULL;
|
||||
ogs_sbi_client_t *client = NULL;
|
||||
ogs_sbi_message_t *message = NULL;
|
||||
ogs_sockaddr_t *addr = NULL;
|
||||
ogs_assert(s);
|
||||
ogs_assert(e);
|
||||
|
@ -344,8 +349,8 @@ void ausf_nf_state_exception(ogs_fsm_t *s, ausf_event_t *e)
|
|||
case OGS_FSM_ENTRY_SIG:
|
||||
if (NF_INSTANCE_IS_SELF(nf_instance->id))
|
||||
ogs_timer_start(nf_instance->t_registration_interval,
|
||||
ausf_timer_cfg(AUSF_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL)->
|
||||
duration);
|
||||
ogs_config()->time.message.sbi.
|
||||
nf_register_interval_in_exception);
|
||||
break;
|
||||
|
||||
case OGS_FSM_EXIT_SIG:
|
||||
|
@ -373,6 +378,26 @@ void ausf_nf_state_exception(ogs_fsm_t *s, ausf_event_t *e)
|
|||
}
|
||||
break;
|
||||
|
||||
case AUSF_EVT_SBI_CLIENT:
|
||||
message = e->sbi.message;
|
||||
ogs_assert(message);
|
||||
|
||||
SWITCH(message->h.service.name)
|
||||
CASE(OGS_SBI_SERVICE_NAME_NNRF_NFM)
|
||||
|
||||
SWITCH(message->h.resource.component[0])
|
||||
CASE(OGS_SBI_RESOURCE_NAME_NF_INSTANCES)
|
||||
break;
|
||||
DEFAULT
|
||||
ogs_error("Invalid resource name [%s]",
|
||||
message->h.resource.component[0]);
|
||||
END
|
||||
break;
|
||||
DEFAULT
|
||||
ogs_error("Invalid API name [%s]", message->h.service.name);
|
||||
END
|
||||
break;
|
||||
|
||||
default:
|
||||
ogs_error("[%s] Unknown event %s",
|
||||
nf_instance->id, ausf_event_get_name(e));
|
||||
|
|
|
@ -38,7 +38,7 @@ void ausf_nnrf_handle_nf_register(
|
|||
}
|
||||
|
||||
/* TIME : Update heartbeat from NRF */
|
||||
nf_instance->time.heartbeat = NFProfile->heart_beat_timer;
|
||||
nf_instance->time.heartbeat_interval = NFProfile->heart_beat_timer;
|
||||
}
|
||||
|
||||
void ausf_nnrf_handle_nf_status_subscribe(
|
||||
|
@ -275,11 +275,12 @@ void ausf_nnrf_handle_nf_discover(
|
|||
|
||||
/* TIME : Update validity from NRF */
|
||||
if (SearchResult->validity_period) {
|
||||
nf_instance->time.validity = SearchResult->validity_period;
|
||||
nf_instance->time.validity_duration =
|
||||
SearchResult->validity_period;
|
||||
|
||||
ogs_assert(nf_instance->t_validity);
|
||||
ogs_timer_start(nf_instance->t_validity,
|
||||
ogs_time_from_sec(nf_instance->time.validity));
|
||||
ogs_time_from_sec(nf_instance->time.validity_duration));
|
||||
|
||||
} else
|
||||
ogs_warn("[%s] NF Instance validity-time should not 0",
|
||||
|
|
|
@ -127,7 +127,7 @@ void ausf_sbi_discover_and_send(
|
|||
|
||||
ausf_ue->sbi.nf_state_registered = ausf_nf_state_registered;
|
||||
ausf_ue->sbi.client_wait.duration =
|
||||
ausf_timer_cfg(AUSF_TIMER_SBI_CLIENT_WAIT)->duration;
|
||||
ogs_config()->time.message.sbi.client_wait_duration;
|
||||
ausf_ue->sbi.client_cb = client_cb;
|
||||
|
||||
if (ogs_sbi_discover_and_send(
|
||||
|
|
|
@ -19,19 +19,6 @@
|
|||
|
||||
#include "context.h"
|
||||
|
||||
static ausf_timer_cfg_t g_ausf_timer_cfg[MAX_NUM_OF_AUSF_TIMER] = {
|
||||
[AUSF_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL] =
|
||||
{ .duration = ogs_time_from_sec(3) },
|
||||
[AUSF_TIMER_SBI_CLIENT_WAIT] =
|
||||
{ .duration = ogs_time_from_msec(500) },
|
||||
};
|
||||
|
||||
ausf_timer_cfg_t *ausf_timer_cfg(ausf_timer_e id)
|
||||
{
|
||||
ogs_assert(id < MAX_NUM_OF_AUSF_TIMER);
|
||||
return &g_ausf_timer_cfg[id];
|
||||
}
|
||||
|
||||
const char *ausf_timer_get_name(ausf_timer_e id)
|
||||
{
|
||||
switch (id) {
|
||||
|
@ -39,8 +26,8 @@ const char *ausf_timer_get_name(ausf_timer_e id)
|
|||
return "AUSF_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL";
|
||||
case AUSF_TIMER_NF_INSTANCE_HEARTBEAT_INTERVAL:
|
||||
return "AUSF_TIMER_NF_INSTANCE_HEARTBEAT_INTERVAL";
|
||||
case AUSF_TIMER_NF_INSTANCE_HEARTBEAT:
|
||||
return "AUSF_TIMER_NF_INSTANCE_HEARTBEAT";
|
||||
case AUSF_TIMER_NF_INSTANCE_NO_HEARTBEAT:
|
||||
return "AUSF_TIMER_NF_INSTANCE_NO_HEARTBEAT";
|
||||
case AUSF_TIMER_NF_INSTANCE_VALIDITY:
|
||||
return "AUSF_TIMER_NF_INSTANCE_VALIDITY";
|
||||
case AUSF_TIMER_SUBSCRIPTION_VALIDITY:
|
||||
|
@ -63,7 +50,7 @@ static void sbi_timer_send_event(int timer_id, void *data)
|
|||
switch (timer_id) {
|
||||
case AUSF_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL:
|
||||
case AUSF_TIMER_NF_INSTANCE_HEARTBEAT_INTERVAL:
|
||||
case AUSF_TIMER_NF_INSTANCE_HEARTBEAT:
|
||||
case AUSF_TIMER_NF_INSTANCE_NO_HEARTBEAT:
|
||||
case AUSF_TIMER_NF_INSTANCE_VALIDITY:
|
||||
case AUSF_TIMER_SUBSCRIPTION_VALIDITY:
|
||||
case AUSF_TIMER_SBI_CLIENT_WAIT:
|
||||
|
@ -96,9 +83,9 @@ void ausf_timer_nf_instance_heartbeat_interval(void *data)
|
|||
sbi_timer_send_event(AUSF_TIMER_NF_INSTANCE_HEARTBEAT_INTERVAL, data);
|
||||
}
|
||||
|
||||
void ausf_timer_nf_instance_heartbeat(void *data)
|
||||
void ausf_timer_nf_instance_no_heartbeat(void *data)
|
||||
{
|
||||
sbi_timer_send_event(AUSF_TIMER_NF_INSTANCE_HEARTBEAT, data);
|
||||
sbi_timer_send_event(AUSF_TIMER_NF_INSTANCE_NO_HEARTBEAT, data);
|
||||
}
|
||||
|
||||
void ausf_timer_nf_instance_validity(void *data)
|
||||
|
|
|
@ -32,7 +32,7 @@ typedef enum {
|
|||
|
||||
AUSF_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL,
|
||||
AUSF_TIMER_NF_INSTANCE_HEARTBEAT_INTERVAL,
|
||||
AUSF_TIMER_NF_INSTANCE_HEARTBEAT,
|
||||
AUSF_TIMER_NF_INSTANCE_NO_HEARTBEAT,
|
||||
AUSF_TIMER_NF_INSTANCE_VALIDITY,
|
||||
AUSF_TIMER_SUBSCRIPTION_VALIDITY,
|
||||
AUSF_TIMER_SBI_CLIENT_WAIT,
|
||||
|
@ -41,18 +41,11 @@ typedef enum {
|
|||
|
||||
} ausf_timer_e;
|
||||
|
||||
typedef struct ausf_timer_cfg_s {
|
||||
int max_count;
|
||||
ogs_time_t duration;
|
||||
} ausf_timer_cfg_t;
|
||||
|
||||
ausf_timer_cfg_t *ausf_timer_cfg(ausf_timer_e id);
|
||||
|
||||
const char *ausf_timer_get_name(ausf_timer_e id);
|
||||
|
||||
void ausf_timer_nf_instance_registration_interval(void *data);
|
||||
void ausf_timer_nf_instance_heartbeat_interval(void *data);
|
||||
void ausf_timer_nf_instance_heartbeat(void *data);
|
||||
void ausf_timer_nf_instance_no_heartbeat(void *data);
|
||||
void ausf_timer_nf_instance_validity(void *data);
|
||||
void ausf_timer_subscription_validity(void *data);
|
||||
void ausf_timer_sbi_client_wait_expire(void *data);
|
||||
|
|
|
@ -59,9 +59,9 @@ void nrf_nf_state_initial(ogs_fsm_t *s, nrf_event_t *e)
|
|||
nf_instance = e->nf_instance;
|
||||
ogs_assert(nf_instance);
|
||||
|
||||
nf_instance->t_heartbeat = ogs_timer_add(nrf_self()->timer_mgr,
|
||||
nrf_timer_nf_instance_heartbeat, nf_instance);
|
||||
ogs_assert(nf_instance->t_heartbeat);
|
||||
nf_instance->t_no_heartbeat = ogs_timer_add(nrf_self()->timer_mgr,
|
||||
nrf_timer_nf_instance_no_heartbeat, nf_instance);
|
||||
ogs_assert(nf_instance->t_no_heartbeat);
|
||||
|
||||
OGS_FSM_TRAN(s, &nrf_nf_state_will_register);
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ void nrf_nf_state_final(ogs_fsm_t *s, nrf_event_t *e)
|
|||
nf_instance = e->nf_instance;
|
||||
ogs_assert(nf_instance);
|
||||
|
||||
ogs_timer_delete(nf_instance->t_heartbeat);
|
||||
ogs_timer_delete(nf_instance->t_no_heartbeat);
|
||||
}
|
||||
|
||||
void nrf_nf_state_will_register(ogs_fsm_t *s, nrf_event_t *e)
|
||||
|
@ -186,10 +186,11 @@ 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);
|
||||
if (nf_instance->time.heartbeat) {
|
||||
ogs_timer_start(nf_instance->t_heartbeat,
|
||||
ogs_time_from_sec(nf_instance->time.heartbeat) *
|
||||
OGS_SBI_HEARTBEAT_RETRYCOUNT);
|
||||
if (nf_instance->time.heartbeat_interval) {
|
||||
ogs_timer_start(nf_instance->t_no_heartbeat,
|
||||
ogs_time_from_sec(
|
||||
nf_instance->time.heartbeat_interval +
|
||||
ogs_config()->time.nf_instance.no_heartbeat_margin));
|
||||
}
|
||||
|
||||
nrf_nnrf_nfm_send_nf_status_notify_all(
|
||||
|
@ -198,8 +199,8 @@ void nrf_nf_state_registered(ogs_fsm_t *s, nrf_event_t *e)
|
|||
|
||||
case OGS_FSM_EXIT_SIG:
|
||||
ogs_info("[%s] NF de-registered", nf_instance->id);
|
||||
if (nf_instance->time.heartbeat) {
|
||||
ogs_timer_stop(nf_instance->t_heartbeat);
|
||||
if (nf_instance->time.heartbeat_interval) {
|
||||
ogs_timer_stop(nf_instance->t_no_heartbeat);
|
||||
}
|
||||
|
||||
nrf_nnrf_nfm_send_nf_status_notify_all(
|
||||
|
@ -221,10 +222,12 @@ void nrf_nf_state_registered(ogs_fsm_t *s, nrf_event_t *e)
|
|||
SWITCH(message->h.method)
|
||||
CASE(OGS_SBI_HTTP_METHOD_PUT)
|
||||
CASE(OGS_SBI_HTTP_METHOD_PATCH)
|
||||
if (nf_instance->time.heartbeat) {
|
||||
ogs_timer_start(nf_instance->t_heartbeat,
|
||||
ogs_time_from_sec(nf_instance->time.heartbeat) *
|
||||
OGS_SBI_HEARTBEAT_RETRYCOUNT);
|
||||
if (nf_instance->time.heartbeat_interval) {
|
||||
ogs_timer_start(nf_instance->t_no_heartbeat,
|
||||
ogs_time_from_sec(
|
||||
nf_instance->time.heartbeat_interval +
|
||||
ogs_config()->time.nf_instance.
|
||||
no_heartbeat_margin));
|
||||
}
|
||||
|
||||
handled = nrf_nnrf_handle_nf_update(
|
||||
|
|
|
@ -178,15 +178,16 @@ bool nrf_nnrf_handle_nf_status_subscribe(
|
|||
|
||||
ogs_freeaddrinfo(addr);
|
||||
|
||||
if (subscription->time.validity) {
|
||||
if (subscription->time.validity_duration) {
|
||||
SubscriptionData->validity_time = ogs_sbi_localtime_string(
|
||||
ogs_time_now() + ogs_time_from_sec(subscription->time.validity));
|
||||
ogs_time_now() + ogs_time_from_sec(
|
||||
subscription->time.validity_duration));
|
||||
|
||||
subscription->t_validity = ogs_timer_add(nrf_self()->timer_mgr,
|
||||
nrf_timer_subscription_validity, subscription);
|
||||
ogs_assert(subscription->t_validity);
|
||||
ogs_timer_start(subscription->t_validity,
|
||||
ogs_time_from_sec(subscription->time.validity));
|
||||
ogs_time_from_sec(subscription->time.validity_duration));
|
||||
}
|
||||
|
||||
message->http.location = message->h.uri;
|
||||
|
@ -357,7 +358,8 @@ bool nrf_nnrf_handle_nf_discover(
|
|||
SearchResult = ogs_calloc(1, sizeof(*SearchResult));
|
||||
ogs_assert(SearchResult);
|
||||
|
||||
SearchResult->validity_period = ogs_config()->time.nf_instance.validity;
|
||||
SearchResult->validity_period =
|
||||
ogs_config()->time.nf_instance.validity_duration;
|
||||
ogs_assert(SearchResult->validity_period);
|
||||
|
||||
SearchResult->nf_instances = OpenAPI_list_create();
|
||||
|
|
|
@ -112,7 +112,7 @@ void nrf_state_operational(ogs_fsm_t *s, nrf_event_t *e)
|
|||
nrf_nf_fsm_init(nf_instance);
|
||||
break;
|
||||
DEFAULT
|
||||
ogs_error("Not found [%s]",
|
||||
ogs_warn("Not found [%s]",
|
||||
message.h.resource.component[1]);
|
||||
ogs_sbi_server_send_error(session,
|
||||
OGS_SBI_HTTP_STATUS_NOT_FOUND,
|
||||
|
@ -216,7 +216,7 @@ void nrf_state_operational(ogs_fsm_t *s, nrf_event_t *e)
|
|||
|
||||
case NRF_EVT_SBI_TIMER:
|
||||
switch(e->timer_id) {
|
||||
case NRF_TIMER_NF_INSTANCE_HEARTBEAT:
|
||||
case NRF_TIMER_NF_INSTANCE_NO_HEARTBEAT:
|
||||
nf_instance = e->nf_instance;
|
||||
ogs_assert(nf_instance);
|
||||
|
||||
|
|
|
@ -32,8 +32,8 @@ nrf_timer_cfg_t *nrf_timer_cfg(nrf_timer_e id)
|
|||
const char *nrf_timer_get_name(nrf_timer_e id)
|
||||
{
|
||||
switch (id) {
|
||||
case NRF_TIMER_NF_INSTANCE_HEARTBEAT:
|
||||
return "NRF_TIMER_NF_INSTANCE_HEARTBEAT";
|
||||
case NRF_TIMER_NF_INSTANCE_NO_HEARTBEAT:
|
||||
return "NRF_TIMER_NF_INSTANCE_NO_HEARTBEAT";
|
||||
case NRF_TIMER_SUBSCRIPTION_VALIDITY:
|
||||
return "NRF_TIMER_SUBSCRIPTION_VALIDITY";
|
||||
default:
|
||||
|
@ -50,7 +50,7 @@ static void timer_send_event(int timer_id, void *data)
|
|||
ogs_assert(data);
|
||||
|
||||
switch (timer_id) {
|
||||
case NRF_TIMER_NF_INSTANCE_HEARTBEAT:
|
||||
case NRF_TIMER_NF_INSTANCE_NO_HEARTBEAT:
|
||||
e = nrf_event_new(NRF_EVT_SBI_TIMER);
|
||||
e->timer_id = timer_id;
|
||||
e->nf_instance = data;
|
||||
|
@ -73,9 +73,9 @@ static void timer_send_event(int timer_id, void *data)
|
|||
}
|
||||
}
|
||||
|
||||
void nrf_timer_nf_instance_heartbeat(void *data)
|
||||
void nrf_timer_nf_instance_no_heartbeat(void *data)
|
||||
{
|
||||
timer_send_event(NRF_TIMER_NF_INSTANCE_HEARTBEAT, data);
|
||||
timer_send_event(NRF_TIMER_NF_INSTANCE_NO_HEARTBEAT, data);
|
||||
}
|
||||
|
||||
void nrf_timer_subscription_validity(void *data)
|
||||
|
|
|
@ -30,7 +30,7 @@ extern "C" {
|
|||
typedef enum {
|
||||
NRF_TIMER_BASE = 0,
|
||||
|
||||
NRF_TIMER_NF_INSTANCE_HEARTBEAT,
|
||||
NRF_TIMER_NF_INSTANCE_NO_HEARTBEAT,
|
||||
NRF_TIMER_SUBSCRIPTION_VALIDITY,
|
||||
|
||||
MAX_NUM_OF_NRF_TIMER,
|
||||
|
@ -46,7 +46,7 @@ nrf_timer_cfg_t *nrf_timer_cfg(nrf_timer_e id);
|
|||
|
||||
const char *nrf_timer_get_name(nrf_timer_e id);
|
||||
|
||||
void nrf_timer_nf_instance_heartbeat(void *data);
|
||||
void nrf_timer_nf_instance_no_heartbeat(void *data);
|
||||
void nrf_timer_subscription_validity(void *data);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -165,8 +165,8 @@ void smf_n4_handle_heartbeat_response(
|
|||
ogs_assert(xact);
|
||||
ogs_pfcp_xact_commit(xact);
|
||||
|
||||
ogs_timer_start(node->t_heartbeat,
|
||||
smf_timer_cfg(SMF_TIMER_PFCP_HEARTBEAT)->duration);
|
||||
ogs_timer_start(node->t_no_heartbeat,
|
||||
ogs_config()->time.message.pfcp.no_heartbeat_duration);
|
||||
}
|
||||
|
||||
void smf_5gc_n4_handle_session_establishment_response(
|
||||
|
|
|
@ -68,8 +68,8 @@ void smf_nf_state_initial(ogs_fsm_t *s, smf_event_t *e)
|
|||
ogs_assert(nf_instance->t_heartbeat_interval);
|
||||
nf_instance->t_heartbeat_interval->cb =
|
||||
smf_timer_nf_instance_heartbeat_interval;
|
||||
ogs_assert(nf_instance->t_heartbeat);
|
||||
nf_instance->t_heartbeat->cb = smf_timer_nf_instance_heartbeat;
|
||||
ogs_assert(nf_instance->t_no_heartbeat);
|
||||
nf_instance->t_no_heartbeat->cb = smf_timer_nf_instance_no_heartbeat;
|
||||
ogs_assert(nf_instance->t_validity);
|
||||
nf_instance->t_validity->cb = smf_timer_nf_instance_validity;
|
||||
|
||||
|
@ -107,8 +107,7 @@ void smf_nf_state_will_register(ogs_fsm_t *s, smf_event_t *e)
|
|||
case OGS_FSM_ENTRY_SIG:
|
||||
if (NF_INSTANCE_IS_SELF(nf_instance->id))
|
||||
ogs_timer_start(nf_instance->t_registration_interval,
|
||||
smf_timer_cfg(SMF_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL)->
|
||||
duration);
|
||||
ogs_config()->time.message.sbi.nf_register_interval);
|
||||
|
||||
ogs_nnrf_nfm_send_nf_register(nf_instance);
|
||||
break;
|
||||
|
@ -163,8 +162,7 @@ void smf_nf_state_will_register(ogs_fsm_t *s, smf_event_t *e)
|
|||
|
||||
if (NF_INSTANCE_IS_SELF(nf_instance->id))
|
||||
ogs_timer_start(nf_instance->t_registration_interval,
|
||||
smf_timer_cfg(SMF_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL)->
|
||||
duration);
|
||||
ogs_config()->time.message.sbi.nf_register_interval);
|
||||
|
||||
ogs_nnrf_nfm_send_nf_register(nf_instance);
|
||||
break;
|
||||
|
@ -203,12 +201,13 @@ void smf_nf_state_registered(ogs_fsm_t *s, smf_event_t *e)
|
|||
client = nf_instance->client;
|
||||
ogs_assert(client);
|
||||
|
||||
if (nf_instance->time.heartbeat) {
|
||||
if (nf_instance->time.heartbeat_interval) {
|
||||
ogs_timer_start(nf_instance->t_heartbeat_interval,
|
||||
ogs_time_from_sec(nf_instance->time.heartbeat));
|
||||
ogs_timer_start(nf_instance->t_heartbeat,
|
||||
ogs_time_from_sec(nf_instance->time.heartbeat *
|
||||
OGS_SBI_HEARTBEAT_RETRYCOUNT));
|
||||
ogs_time_from_sec(nf_instance->time.heartbeat_interval));
|
||||
ogs_timer_start(nf_instance->t_no_heartbeat,
|
||||
ogs_time_from_sec(
|
||||
nf_instance->time.heartbeat_interval +
|
||||
ogs_config()->time.nf_instance.no_heartbeat_margin));
|
||||
}
|
||||
|
||||
ogs_nnrf_nfm_send_nf_status_subscribe(client,
|
||||
|
@ -221,12 +220,14 @@ void smf_nf_state_registered(ogs_fsm_t *s, smf_event_t *e)
|
|||
if (NF_INSTANCE_IS_SELF(nf_instance->id)) {
|
||||
ogs_info("[%s] NF de-registered", nf_instance->id);
|
||||
|
||||
if (nf_instance->time.heartbeat) {
|
||||
if (nf_instance->time.heartbeat_interval) {
|
||||
ogs_timer_stop(nf_instance->t_heartbeat_interval);
|
||||
ogs_timer_stop(nf_instance->t_heartbeat);
|
||||
ogs_timer_stop(nf_instance->t_no_heartbeat);
|
||||
}
|
||||
|
||||
ogs_nnrf_nfm_send_nf_de_register(nf_instance);
|
||||
if (!OGS_FSM_CHECK(&nf_instance->sm, smf_nf_state_exception)) {
|
||||
ogs_nnrf_nfm_send_nf_de_register(nf_instance);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -242,13 +243,16 @@ void smf_nf_state_registered(ogs_fsm_t *s, smf_event_t *e)
|
|||
|
||||
if (message->res_status == OGS_SBI_HTTP_STATUS_NO_CONTENT ||
|
||||
message->res_status == OGS_SBI_HTTP_STATUS_OK) {
|
||||
if (nf_instance->time.heartbeat)
|
||||
ogs_timer_start(nf_instance->t_heartbeat,
|
||||
ogs_time_from_sec(nf_instance->time.heartbeat *
|
||||
OGS_SBI_HEARTBEAT_RETRYCOUNT));
|
||||
if (nf_instance->time.heartbeat_interval)
|
||||
ogs_timer_start(nf_instance->t_no_heartbeat,
|
||||
ogs_time_from_sec(
|
||||
nf_instance->time.heartbeat_interval +
|
||||
ogs_config()->time.nf_instance.
|
||||
no_heartbeat_margin));
|
||||
} else {
|
||||
ogs_error("[%s] HTTP response error [%d]",
|
||||
ogs_warn("[%s] HTTP response error [%d]",
|
||||
nf_instance->id, message->res_status);
|
||||
OGS_FSM_TRAN(s, &smf_nf_state_exception);
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -268,14 +272,14 @@ void smf_nf_state_registered(ogs_fsm_t *s, smf_event_t *e)
|
|||
case SMF_EVT_SBI_TIMER:
|
||||
switch(e->timer_id) {
|
||||
case SMF_TIMER_NF_INSTANCE_HEARTBEAT_INTERVAL:
|
||||
if (nf_instance->time.heartbeat)
|
||||
if (nf_instance->time.heartbeat_interval)
|
||||
ogs_timer_start(nf_instance->t_heartbeat_interval,
|
||||
ogs_time_from_sec(nf_instance->time.heartbeat));
|
||||
ogs_time_from_sec(nf_instance->time.heartbeat_interval));
|
||||
|
||||
ogs_nnrf_nfm_send_nf_update(nf_instance);
|
||||
break;
|
||||
|
||||
case SMF_TIMER_NF_INSTANCE_HEARTBEAT:
|
||||
case SMF_TIMER_NF_INSTANCE_NO_HEARTBEAT:
|
||||
OGS_FSM_TRAN(s, &smf_nf_state_will_register);
|
||||
break;
|
||||
|
||||
|
@ -332,6 +336,7 @@ void smf_nf_state_exception(ogs_fsm_t *s, smf_event_t *e)
|
|||
{
|
||||
ogs_sbi_nf_instance_t *nf_instance = NULL;
|
||||
ogs_sbi_client_t *client = NULL;
|
||||
ogs_sbi_message_t *message = NULL;
|
||||
ogs_sockaddr_t *addr = NULL;
|
||||
ogs_assert(s);
|
||||
ogs_assert(e);
|
||||
|
@ -345,8 +350,8 @@ void smf_nf_state_exception(ogs_fsm_t *s, smf_event_t *e)
|
|||
case OGS_FSM_ENTRY_SIG:
|
||||
if (NF_INSTANCE_IS_SELF(nf_instance->id))
|
||||
ogs_timer_start(nf_instance->t_registration_interval,
|
||||
smf_timer_cfg(SMF_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL)->
|
||||
duration);
|
||||
ogs_config()->time.message.sbi.
|
||||
nf_register_interval_in_exception);
|
||||
break;
|
||||
|
||||
case OGS_FSM_EXIT_SIG:
|
||||
|
@ -374,6 +379,26 @@ void smf_nf_state_exception(ogs_fsm_t *s, smf_event_t *e)
|
|||
}
|
||||
break;
|
||||
|
||||
case SMF_EVT_SBI_CLIENT:
|
||||
message = e->sbi.message;
|
||||
ogs_assert(message);
|
||||
|
||||
SWITCH(message->h.service.name)
|
||||
CASE(OGS_SBI_SERVICE_NAME_NNRF_NFM)
|
||||
|
||||
SWITCH(message->h.resource.component[0])
|
||||
CASE(OGS_SBI_RESOURCE_NAME_NF_INSTANCES)
|
||||
break;
|
||||
DEFAULT
|
||||
ogs_error("Invalid resource name [%s]",
|
||||
message->h.resource.component[0]);
|
||||
END
|
||||
break;
|
||||
DEFAULT
|
||||
ogs_error("Invalid API name [%s]", message->h.service.name);
|
||||
END
|
||||
break;
|
||||
|
||||
default:
|
||||
ogs_error("[%s] Unknown event %s",
|
||||
nf_instance->id, smf_event_get_name(e));
|
||||
|
|
|
@ -38,7 +38,7 @@ void smf_nnrf_handle_nf_register(
|
|||
}
|
||||
|
||||
/* TIME : Update heartbeat from NRF */
|
||||
nf_instance->time.heartbeat = NFProfile->heart_beat_timer;
|
||||
nf_instance->time.heartbeat_interval = NFProfile->heart_beat_timer;
|
||||
}
|
||||
|
||||
void smf_nnrf_handle_nf_status_subscribe(
|
||||
|
@ -275,11 +275,12 @@ void smf_nnrf_handle_nf_discover(
|
|||
|
||||
/* TIME : Update validity from NRF */
|
||||
if (SearchResult->validity_period) {
|
||||
nf_instance->time.validity = SearchResult->validity_period;
|
||||
nf_instance->time.validity_duration =
|
||||
SearchResult->validity_period;
|
||||
|
||||
ogs_assert(nf_instance->t_validity);
|
||||
ogs_timer_start(nf_instance->t_validity,
|
||||
ogs_time_from_sec(nf_instance->time.validity));
|
||||
ogs_time_from_sec(nf_instance->time.validity_duration));
|
||||
|
||||
} else
|
||||
ogs_warn("[%s] NF Instance validity-time should not 0",
|
||||
|
|
|
@ -40,9 +40,9 @@ void smf_pfcp_state_initial(ogs_fsm_t *s, smf_event_t *e)
|
|||
ogs_pfcp_self()->pfcp_sock, ogs_pfcp_self()->pfcp_sock6, node);
|
||||
ogs_assert(rv == OGS_OK);
|
||||
|
||||
node->t_heartbeat = ogs_timer_add(smf_self()->timer_mgr,
|
||||
smf_timer_pfcp_heartbeat, node);
|
||||
ogs_assert(node->t_heartbeat);
|
||||
node->t_no_heartbeat = ogs_timer_add(smf_self()->timer_mgr,
|
||||
smf_timer_pfcp_no_heartbeat, node);
|
||||
ogs_assert(node->t_no_heartbeat);
|
||||
|
||||
OGS_FSM_TRAN(s, &smf_pfcp_state_will_associate);
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ void smf_pfcp_state_final(ogs_fsm_t *s, smf_event_t *e)
|
|||
node = e->pfcp_node;
|
||||
ogs_assert(node);
|
||||
|
||||
ogs_timer_delete(node->t_heartbeat);
|
||||
ogs_timer_delete(node->t_no_heartbeat);
|
||||
}
|
||||
|
||||
void smf_pfcp_state_will_associate(ogs_fsm_t *s, smf_event_t *e)
|
||||
|
@ -85,7 +85,7 @@ void smf_pfcp_state_will_associate(ogs_fsm_t *s, smf_event_t *e)
|
|||
case OGS_FSM_ENTRY_SIG:
|
||||
if (node->t_association) {
|
||||
ogs_timer_start(node->t_association,
|
||||
smf_timer_cfg(SMF_TIMER_PFCP_ASSOCIATION)->duration);
|
||||
ogs_config()->time.message.pfcp.association_interval);
|
||||
|
||||
smf_pfcp_send_association_setup_request(node);
|
||||
}
|
||||
|
@ -108,7 +108,7 @@ void smf_pfcp_state_will_associate(ogs_fsm_t *s, smf_event_t *e)
|
|||
|
||||
ogs_assert(node->t_association);
|
||||
ogs_timer_start(node->t_association,
|
||||
smf_timer_cfg(SMF_TIMER_PFCP_ASSOCIATION)->duration);
|
||||
ogs_config()->time.message.pfcp.association_interval);
|
||||
|
||||
smf_pfcp_send_association_setup_request(node);
|
||||
break;
|
||||
|
@ -171,12 +171,12 @@ void smf_pfcp_state_associated(ogs_fsm_t *s, smf_event_t *e)
|
|||
switch (e->id) {
|
||||
case OGS_FSM_ENTRY_SIG:
|
||||
ogs_info("PFCP associated");
|
||||
ogs_timer_start(node->t_heartbeat,
|
||||
smf_timer_cfg(SMF_TIMER_PFCP_HEARTBEAT)->duration);
|
||||
ogs_timer_start(node->t_no_heartbeat,
|
||||
ogs_config()->time.message.pfcp.no_heartbeat_duration);
|
||||
break;
|
||||
case OGS_FSM_EXIT_SIG:
|
||||
ogs_info("PFCP de-associated");
|
||||
ogs_timer_stop(node->t_heartbeat);
|
||||
ogs_timer_stop(node->t_no_heartbeat);
|
||||
break;
|
||||
case SMF_EVT_N4_MESSAGE:
|
||||
message = e->pfcp_message;
|
||||
|
@ -257,7 +257,7 @@ void smf_pfcp_state_associated(ogs_fsm_t *s, smf_event_t *e)
|
|||
break;
|
||||
case SMF_EVT_N4_TIMER:
|
||||
switch(e->timer_id) {
|
||||
case SMF_TIMER_PFCP_HEARTBEAT:
|
||||
case SMF_TIMER_PFCP_NO_HEARTBEAT:
|
||||
node = e->pfcp_node;
|
||||
ogs_assert(node);
|
||||
|
||||
|
|
|
@ -134,7 +134,7 @@ void smf_sbi_discover_and_send(
|
|||
|
||||
sess->sbi.nf_state_registered = smf_nf_state_registered;
|
||||
sess->sbi.client_wait.duration =
|
||||
smf_timer_cfg(SMF_TIMER_SBI_CLIENT_WAIT)->duration;
|
||||
ogs_config()->time.message.sbi.client_wait_duration;
|
||||
sess->sbi.client_cb = client_cb;
|
||||
|
||||
if (ogs_sbi_discover_and_send(
|
||||
|
|
|
@ -442,7 +442,7 @@ void smf_state_operational(ogs_fsm_t *s, smf_event_t *e)
|
|||
ogs_fsm_dispatch(&nf_instance->sm, e);
|
||||
|
||||
if (OGS_FSM_CHECK(&nf_instance->sm, smf_nf_state_exception)) {
|
||||
ogs_error("State machine exception");
|
||||
ogs_warn("State machine exception");
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -552,7 +552,7 @@ void smf_state_operational(ogs_fsm_t *s, smf_event_t *e)
|
|||
switch(e->timer_id) {
|
||||
case SMF_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL:
|
||||
case SMF_TIMER_NF_INSTANCE_HEARTBEAT_INTERVAL:
|
||||
case SMF_TIMER_NF_INSTANCE_HEARTBEAT:
|
||||
case SMF_TIMER_NF_INSTANCE_NO_HEARTBEAT:
|
||||
case SMF_TIMER_NF_INSTANCE_VALIDITY:
|
||||
nf_instance = e->sbi.data;
|
||||
ogs_assert(nf_instance);
|
||||
|
|
|
@ -21,36 +21,19 @@
|
|||
#include "event.h"
|
||||
#include "context.h"
|
||||
|
||||
static smf_timer_cfg_t g_smf_timer_cfg[MAX_NUM_OF_SMF_TIMER] = {
|
||||
[SMF_TIMER_PFCP_ASSOCIATION] =
|
||||
{ .duration = ogs_time_from_sec(12) },
|
||||
[SMF_TIMER_PFCP_HEARTBEAT] =
|
||||
{ .duration = ogs_time_from_sec(12) },
|
||||
[SMF_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL] =
|
||||
{ .duration = ogs_time_from_sec(3) },
|
||||
[SMF_TIMER_SBI_CLIENT_WAIT] =
|
||||
{ .duration = ogs_time_from_msec(500) },
|
||||
};
|
||||
|
||||
smf_timer_cfg_t *smf_timer_cfg(smf_timer_e id)
|
||||
{
|
||||
ogs_assert(id < MAX_NUM_OF_SMF_TIMER);
|
||||
return &g_smf_timer_cfg[id];
|
||||
}
|
||||
|
||||
const char *smf_timer_get_name(smf_timer_e id)
|
||||
{
|
||||
switch (id) {
|
||||
case SMF_TIMER_PFCP_ASSOCIATION:
|
||||
return "SMF_TIMER_PFCP_ASSOCIATION";
|
||||
case SMF_TIMER_PFCP_HEARTBEAT:
|
||||
return "SMF_TIMER_PFCP_HEARTBEAT";
|
||||
case SMF_TIMER_PFCP_NO_HEARTBEAT:
|
||||
return "SMF_TIMER_PFCP_NO_HEARTBEAT";
|
||||
case SMF_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL:
|
||||
return "SMF_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL";
|
||||
case SMF_TIMER_NF_INSTANCE_HEARTBEAT_INTERVAL:
|
||||
return "SMF_TIMER_NF_INSTANCE_HEARTBEAT_INTERVAL";
|
||||
case SMF_TIMER_NF_INSTANCE_HEARTBEAT:
|
||||
return "SMF_TIMER_NF_INSTANCE_HEARTBEAT";
|
||||
case SMF_TIMER_NF_INSTANCE_NO_HEARTBEAT:
|
||||
return "SMF_TIMER_NF_INSTANCE_NO_HEARTBEAT";
|
||||
case SMF_TIMER_NF_INSTANCE_VALIDITY:
|
||||
return "SMF_TIMER_NF_INSTANCE_VALIDITY";
|
||||
case SMF_TIMER_SUBSCRIPTION_VALIDITY:
|
||||
|
@ -72,7 +55,7 @@ static void timer_send_event(int timer_id, void *data)
|
|||
|
||||
switch (timer_id) {
|
||||
case SMF_TIMER_PFCP_ASSOCIATION:
|
||||
case SMF_TIMER_PFCP_HEARTBEAT:
|
||||
case SMF_TIMER_PFCP_NO_HEARTBEAT:
|
||||
e = smf_event_new(SMF_EVT_N4_TIMER);
|
||||
ogs_assert(e);
|
||||
e->timer_id = timer_id;
|
||||
|
@ -80,7 +63,7 @@ static void timer_send_event(int timer_id, void *data)
|
|||
break;
|
||||
case SMF_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL:
|
||||
case SMF_TIMER_NF_INSTANCE_HEARTBEAT_INTERVAL:
|
||||
case SMF_TIMER_NF_INSTANCE_HEARTBEAT:
|
||||
case SMF_TIMER_NF_INSTANCE_NO_HEARTBEAT:
|
||||
case SMF_TIMER_NF_INSTANCE_VALIDITY:
|
||||
case SMF_TIMER_SUBSCRIPTION_VALIDITY:
|
||||
e = smf_event_new(SMF_EVT_SBI_TIMER);
|
||||
|
@ -113,9 +96,9 @@ void smf_timer_pfcp_association(void *data)
|
|||
timer_send_event(SMF_TIMER_PFCP_ASSOCIATION, data);
|
||||
}
|
||||
|
||||
void smf_timer_pfcp_heartbeat(void *data)
|
||||
void smf_timer_pfcp_no_heartbeat(void *data)
|
||||
{
|
||||
timer_send_event(SMF_TIMER_PFCP_HEARTBEAT, data);
|
||||
timer_send_event(SMF_TIMER_PFCP_NO_HEARTBEAT, data);
|
||||
}
|
||||
|
||||
void smf_timer_nf_instance_registration_interval(void *data)
|
||||
|
@ -128,9 +111,9 @@ void smf_timer_nf_instance_heartbeat_interval(void *data)
|
|||
timer_send_event(SMF_TIMER_NF_INSTANCE_HEARTBEAT_INTERVAL, data);
|
||||
}
|
||||
|
||||
void smf_timer_nf_instance_heartbeat(void *data)
|
||||
void smf_timer_nf_instance_no_heartbeat(void *data)
|
||||
{
|
||||
timer_send_event(SMF_TIMER_NF_INSTANCE_HEARTBEAT, data);
|
||||
timer_send_event(SMF_TIMER_NF_INSTANCE_NO_HEARTBEAT, data);
|
||||
}
|
||||
|
||||
void smf_timer_nf_instance_validity(void *data)
|
||||
|
|
|
@ -31,11 +31,11 @@ typedef enum {
|
|||
SMF_TIMER_BASE = 0,
|
||||
|
||||
SMF_TIMER_PFCP_ASSOCIATION,
|
||||
SMF_TIMER_PFCP_HEARTBEAT,
|
||||
SMF_TIMER_PFCP_NO_HEARTBEAT,
|
||||
|
||||
SMF_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL,
|
||||
SMF_TIMER_NF_INSTANCE_HEARTBEAT_INTERVAL,
|
||||
SMF_TIMER_NF_INSTANCE_HEARTBEAT,
|
||||
SMF_TIMER_NF_INSTANCE_NO_HEARTBEAT,
|
||||
SMF_TIMER_NF_INSTANCE_VALIDITY,
|
||||
SMF_TIMER_SUBSCRIPTION_VALIDITY,
|
||||
SMF_TIMER_SBI_CLIENT_WAIT,
|
||||
|
@ -44,21 +44,14 @@ typedef enum {
|
|||
|
||||
} smf_timer_e;
|
||||
|
||||
typedef struct smf_timer_cfg_s {
|
||||
int max_count;
|
||||
ogs_time_t duration;
|
||||
} smf_timer_cfg_t;
|
||||
|
||||
smf_timer_cfg_t *smf_timer_cfg(smf_timer_e id);
|
||||
|
||||
const char *smf_timer_get_name(smf_timer_e id);
|
||||
|
||||
void smf_timer_pfcp_association(void *data);
|
||||
void smf_timer_pfcp_heartbeat(void *data);
|
||||
void smf_timer_pfcp_no_heartbeat(void *data);
|
||||
|
||||
void smf_timer_nf_instance_registration_interval(void *data);
|
||||
void smf_timer_nf_instance_heartbeat_interval(void *data);
|
||||
void smf_timer_nf_instance_heartbeat(void *data);
|
||||
void smf_timer_nf_instance_no_heartbeat(void *data);
|
||||
void smf_timer_nf_instance_validity(void *data);
|
||||
void smf_timer_subscription_validity(void *data);
|
||||
void smf_timer_sbi_client_wait_expire(void *data);
|
||||
|
|
|
@ -68,8 +68,8 @@ void udm_nf_state_initial(ogs_fsm_t *s, udm_event_t *e)
|
|||
ogs_assert(nf_instance->t_heartbeat_interval);
|
||||
nf_instance->t_heartbeat_interval->cb =
|
||||
udm_timer_nf_instance_heartbeat_interval;
|
||||
ogs_assert(nf_instance->t_heartbeat);
|
||||
nf_instance->t_heartbeat->cb = udm_timer_nf_instance_heartbeat;
|
||||
ogs_assert(nf_instance->t_no_heartbeat);
|
||||
nf_instance->t_no_heartbeat->cb = udm_timer_nf_instance_no_heartbeat;
|
||||
ogs_assert(nf_instance->t_validity);
|
||||
nf_instance->t_validity->cb = udm_timer_nf_instance_validity;
|
||||
|
||||
|
@ -107,8 +107,7 @@ void udm_nf_state_will_register(ogs_fsm_t *s, udm_event_t *e)
|
|||
case OGS_FSM_ENTRY_SIG:
|
||||
if (NF_INSTANCE_IS_SELF(nf_instance->id))
|
||||
ogs_timer_start(nf_instance->t_registration_interval,
|
||||
udm_timer_cfg(UDM_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL)->
|
||||
duration);
|
||||
ogs_config()->time.message.sbi.nf_register_interval);
|
||||
|
||||
ogs_nnrf_nfm_send_nf_register(nf_instance);
|
||||
break;
|
||||
|
@ -163,8 +162,7 @@ void udm_nf_state_will_register(ogs_fsm_t *s, udm_event_t *e)
|
|||
|
||||
if (NF_INSTANCE_IS_SELF(nf_instance->id))
|
||||
ogs_timer_start(nf_instance->t_registration_interval,
|
||||
udm_timer_cfg(UDM_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL)->
|
||||
duration);
|
||||
ogs_config()->time.message.sbi.nf_register_interval);
|
||||
|
||||
ogs_nnrf_nfm_send_nf_register(nf_instance);
|
||||
break;
|
||||
|
@ -202,12 +200,13 @@ void udm_nf_state_registered(ogs_fsm_t *s, udm_event_t *e)
|
|||
client = nf_instance->client;
|
||||
ogs_assert(client);
|
||||
|
||||
if (nf_instance->time.heartbeat) {
|
||||
if (nf_instance->time.heartbeat_interval) {
|
||||
ogs_timer_start(nf_instance->t_heartbeat_interval,
|
||||
ogs_time_from_sec(nf_instance->time.heartbeat));
|
||||
ogs_timer_start(nf_instance->t_heartbeat,
|
||||
ogs_time_from_sec(nf_instance->time.heartbeat *
|
||||
OGS_SBI_HEARTBEAT_RETRYCOUNT));
|
||||
ogs_time_from_sec(nf_instance->time.heartbeat_interval));
|
||||
ogs_timer_start(nf_instance->t_no_heartbeat,
|
||||
ogs_time_from_sec(
|
||||
nf_instance->time.heartbeat_interval +
|
||||
ogs_config()->time.nf_instance.no_heartbeat_margin));
|
||||
}
|
||||
|
||||
ogs_nnrf_nfm_send_nf_status_subscribe(client,
|
||||
|
@ -220,12 +219,14 @@ void udm_nf_state_registered(ogs_fsm_t *s, udm_event_t *e)
|
|||
if (NF_INSTANCE_IS_SELF(nf_instance->id)) {
|
||||
ogs_info("[%s] NF de-registered", nf_instance->id);
|
||||
|
||||
if (nf_instance->time.heartbeat) {
|
||||
if (nf_instance->time.heartbeat_interval) {
|
||||
ogs_timer_stop(nf_instance->t_heartbeat_interval);
|
||||
ogs_timer_stop(nf_instance->t_heartbeat);
|
||||
ogs_timer_stop(nf_instance->t_no_heartbeat);
|
||||
}
|
||||
|
||||
ogs_nnrf_nfm_send_nf_de_register(nf_instance);
|
||||
if (!OGS_FSM_CHECK(&nf_instance->sm, udm_nf_state_exception)) {
|
||||
ogs_nnrf_nfm_send_nf_de_register(nf_instance);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -241,13 +242,16 @@ void udm_nf_state_registered(ogs_fsm_t *s, udm_event_t *e)
|
|||
|
||||
if (message->res_status == OGS_SBI_HTTP_STATUS_NO_CONTENT ||
|
||||
message->res_status == OGS_SBI_HTTP_STATUS_OK) {
|
||||
if (nf_instance->time.heartbeat)
|
||||
ogs_timer_start(nf_instance->t_heartbeat,
|
||||
ogs_time_from_sec(nf_instance->time.heartbeat *
|
||||
OGS_SBI_HEARTBEAT_RETRYCOUNT));
|
||||
if (nf_instance->time.heartbeat_interval)
|
||||
ogs_timer_start(nf_instance->t_no_heartbeat,
|
||||
ogs_time_from_sec(
|
||||
nf_instance->time.heartbeat_interval +
|
||||
ogs_config()->time.nf_instance.
|
||||
no_heartbeat_margin));
|
||||
} else {
|
||||
ogs_error("[%s] HTTP response error [%d]",
|
||||
ogs_warn("[%s] HTTP response error [%d]",
|
||||
nf_instance->id, message->res_status);
|
||||
OGS_FSM_TRAN(s, &udm_nf_state_exception);
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -267,14 +271,14 @@ void udm_nf_state_registered(ogs_fsm_t *s, udm_event_t *e)
|
|||
case UDM_EVT_SBI_TIMER:
|
||||
switch(e->timer_id) {
|
||||
case UDM_TIMER_NF_INSTANCE_HEARTBEAT_INTERVAL:
|
||||
if (nf_instance->time.heartbeat)
|
||||
if (nf_instance->time.heartbeat_interval)
|
||||
ogs_timer_start(nf_instance->t_heartbeat_interval,
|
||||
ogs_time_from_sec(nf_instance->time.heartbeat));
|
||||
ogs_time_from_sec(nf_instance->time.heartbeat_interval));
|
||||
|
||||
ogs_nnrf_nfm_send_nf_update(nf_instance);
|
||||
break;
|
||||
|
||||
case UDM_TIMER_NF_INSTANCE_HEARTBEAT:
|
||||
case UDM_TIMER_NF_INSTANCE_NO_HEARTBEAT:
|
||||
OGS_FSM_TRAN(s, &udm_nf_state_will_register);
|
||||
break;
|
||||
|
||||
|
@ -331,6 +335,7 @@ void udm_nf_state_exception(ogs_fsm_t *s, udm_event_t *e)
|
|||
{
|
||||
ogs_sbi_nf_instance_t *nf_instance = NULL;
|
||||
ogs_sbi_client_t *client = NULL;
|
||||
ogs_sbi_message_t *message = NULL;
|
||||
ogs_sockaddr_t *addr = NULL;
|
||||
ogs_assert(s);
|
||||
ogs_assert(e);
|
||||
|
@ -344,8 +349,8 @@ void udm_nf_state_exception(ogs_fsm_t *s, udm_event_t *e)
|
|||
case OGS_FSM_ENTRY_SIG:
|
||||
if (NF_INSTANCE_IS_SELF(nf_instance->id))
|
||||
ogs_timer_start(nf_instance->t_registration_interval,
|
||||
udm_timer_cfg(UDM_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL)->
|
||||
duration);
|
||||
ogs_config()->time.message.sbi.
|
||||
nf_register_interval_in_exception);
|
||||
break;
|
||||
|
||||
case OGS_FSM_EXIT_SIG:
|
||||
|
@ -373,6 +378,26 @@ void udm_nf_state_exception(ogs_fsm_t *s, udm_event_t *e)
|
|||
}
|
||||
break;
|
||||
|
||||
case UDM_EVT_SBI_CLIENT:
|
||||
message = e->sbi.message;
|
||||
ogs_assert(message);
|
||||
|
||||
SWITCH(message->h.service.name)
|
||||
CASE(OGS_SBI_SERVICE_NAME_NNRF_NFM)
|
||||
|
||||
SWITCH(message->h.resource.component[0])
|
||||
CASE(OGS_SBI_RESOURCE_NAME_NF_INSTANCES)
|
||||
break;
|
||||
DEFAULT
|
||||
ogs_error("Invalid resource name [%s]",
|
||||
message->h.resource.component[0]);
|
||||
END
|
||||
break;
|
||||
DEFAULT
|
||||
ogs_error("Invalid API name [%s]", message->h.service.name);
|
||||
END
|
||||
break;
|
||||
|
||||
default:
|
||||
ogs_error("[%s] Unknown event %s",
|
||||
nf_instance->id, udm_event_get_name(e));
|
||||
|
|
|
@ -38,7 +38,7 @@ void udm_nnrf_handle_nf_register(
|
|||
}
|
||||
|
||||
/* TIME : Update heartbeat from NRF */
|
||||
nf_instance->time.heartbeat = NFProfile->heart_beat_timer;
|
||||
nf_instance->time.heartbeat_interval = NFProfile->heart_beat_timer;
|
||||
}
|
||||
|
||||
void udm_nnrf_handle_nf_status_subscribe(
|
||||
|
@ -275,11 +275,12 @@ void udm_nnrf_handle_nf_discover(
|
|||
|
||||
/* TIME : Update validity from NRF */
|
||||
if (SearchResult->validity_period) {
|
||||
nf_instance->time.validity = SearchResult->validity_period;
|
||||
nf_instance->time.validity_duration =
|
||||
SearchResult->validity_period;
|
||||
|
||||
ogs_assert(nf_instance->t_validity);
|
||||
ogs_timer_start(nf_instance->t_validity,
|
||||
ogs_time_from_sec(nf_instance->time.validity));
|
||||
ogs_time_from_sec(nf_instance->time.validity_duration));
|
||||
|
||||
} else
|
||||
ogs_warn("[%s] NF Instance validity-time should not 0",
|
||||
|
|
|
@ -137,7 +137,7 @@ void udm_sbi_discover_and_send(
|
|||
|
||||
udm_ue->sbi.nf_state_registered = udm_nf_state_registered;
|
||||
udm_ue->sbi.client_wait.duration =
|
||||
udm_timer_cfg(UDM_TIMER_SBI_CLIENT_WAIT)->duration;
|
||||
ogs_config()->time.message.sbi.client_wait_duration;
|
||||
udm_ue->sbi.client_cb = client_cb;
|
||||
|
||||
if (ogs_sbi_discover_and_send(
|
||||
|
|
|
@ -19,19 +19,6 @@
|
|||
|
||||
#include "context.h"
|
||||
|
||||
static udm_timer_cfg_t g_udm_timer_cfg[MAX_NUM_OF_UDM_TIMER] = {
|
||||
[UDM_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL] =
|
||||
{ .duration = ogs_time_from_sec(3) },
|
||||
[UDM_TIMER_SBI_CLIENT_WAIT] =
|
||||
{ .duration = ogs_time_from_msec(500) },
|
||||
};
|
||||
|
||||
udm_timer_cfg_t *udm_timer_cfg(udm_timer_e id)
|
||||
{
|
||||
ogs_assert(id < MAX_NUM_OF_UDM_TIMER);
|
||||
return &g_udm_timer_cfg[id];
|
||||
}
|
||||
|
||||
const char *udm_timer_get_name(udm_timer_e id)
|
||||
{
|
||||
switch (id) {
|
||||
|
@ -39,8 +26,8 @@ const char *udm_timer_get_name(udm_timer_e id)
|
|||
return "UDM_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL";
|
||||
case UDM_TIMER_NF_INSTANCE_HEARTBEAT_INTERVAL:
|
||||
return "UDM_TIMER_NF_INSTANCE_HEARTBEAT_INTERVAL";
|
||||
case UDM_TIMER_NF_INSTANCE_HEARTBEAT:
|
||||
return "UDM_TIMER_NF_INSTANCE_HEARTBEAT";
|
||||
case UDM_TIMER_NF_INSTANCE_NO_HEARTBEAT:
|
||||
return "UDM_TIMER_NF_INSTANCE_NO_HEARTBEAT";
|
||||
case UDM_TIMER_NF_INSTANCE_VALIDITY:
|
||||
return "UDM_TIMER_NF_INSTANCE_VALIDITY";
|
||||
case UDM_TIMER_SUBSCRIPTION_VALIDITY:
|
||||
|
@ -63,7 +50,7 @@ static void sbi_timer_send_event(int timer_id, void *data)
|
|||
switch (timer_id) {
|
||||
case UDM_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL:
|
||||
case UDM_TIMER_NF_INSTANCE_HEARTBEAT_INTERVAL:
|
||||
case UDM_TIMER_NF_INSTANCE_HEARTBEAT:
|
||||
case UDM_TIMER_NF_INSTANCE_NO_HEARTBEAT:
|
||||
case UDM_TIMER_NF_INSTANCE_VALIDITY:
|
||||
case UDM_TIMER_SUBSCRIPTION_VALIDITY:
|
||||
case UDM_TIMER_SBI_CLIENT_WAIT:
|
||||
|
@ -96,9 +83,9 @@ void udm_timer_nf_instance_heartbeat_interval(void *data)
|
|||
sbi_timer_send_event(UDM_TIMER_NF_INSTANCE_HEARTBEAT_INTERVAL, data);
|
||||
}
|
||||
|
||||
void udm_timer_nf_instance_heartbeat(void *data)
|
||||
void udm_timer_nf_instance_no_heartbeat(void *data)
|
||||
{
|
||||
sbi_timer_send_event(UDM_TIMER_NF_INSTANCE_HEARTBEAT, data);
|
||||
sbi_timer_send_event(UDM_TIMER_NF_INSTANCE_NO_HEARTBEAT, data);
|
||||
}
|
||||
|
||||
void udm_timer_nf_instance_validity(void *data)
|
||||
|
|
|
@ -32,7 +32,7 @@ typedef enum {
|
|||
|
||||
UDM_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL,
|
||||
UDM_TIMER_NF_INSTANCE_HEARTBEAT_INTERVAL,
|
||||
UDM_TIMER_NF_INSTANCE_HEARTBEAT,
|
||||
UDM_TIMER_NF_INSTANCE_NO_HEARTBEAT,
|
||||
UDM_TIMER_NF_INSTANCE_VALIDITY,
|
||||
UDM_TIMER_SUBSCRIPTION_VALIDITY,
|
||||
UDM_TIMER_SBI_CLIENT_WAIT,
|
||||
|
@ -41,18 +41,11 @@ typedef enum {
|
|||
|
||||
} udm_timer_e;
|
||||
|
||||
typedef struct udm_timer_cfg_s {
|
||||
int max_count;
|
||||
ogs_time_t duration;
|
||||
} udm_timer_cfg_t;
|
||||
|
||||
udm_timer_cfg_t *udm_timer_cfg(udm_timer_e id);
|
||||
|
||||
const char *udm_timer_get_name(udm_timer_e id);
|
||||
|
||||
void udm_timer_nf_instance_registration_interval(void *data);
|
||||
void udm_timer_nf_instance_heartbeat_interval(void *data);
|
||||
void udm_timer_nf_instance_heartbeat(void *data);
|
||||
void udm_timer_nf_instance_no_heartbeat(void *data);
|
||||
void udm_timer_nf_instance_validity(void *data);
|
||||
void udm_timer_subscription_validity(void *data);
|
||||
void udm_timer_sbi_client_wait_expire(void *data);
|
||||
|
|
|
@ -234,7 +234,7 @@ void udm_state_operational(ogs_fsm_t *s, udm_event_t *e)
|
|||
ogs_fsm_dispatch(&nf_instance->sm, e);
|
||||
|
||||
if (OGS_FSM_CHECK(&nf_instance->sm, udm_nf_state_exception)) {
|
||||
ogs_error("[%s] State machine exception", nf_instance->id);
|
||||
ogs_warn("[%s] State machine exception", nf_instance->id);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -350,7 +350,7 @@ void udm_state_operational(ogs_fsm_t *s, udm_event_t *e)
|
|||
switch(e->timer_id) {
|
||||
case UDM_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL:
|
||||
case UDM_TIMER_NF_INSTANCE_HEARTBEAT_INTERVAL:
|
||||
case UDM_TIMER_NF_INSTANCE_HEARTBEAT:
|
||||
case UDM_TIMER_NF_INSTANCE_NO_HEARTBEAT:
|
||||
case UDM_TIMER_NF_INSTANCE_VALIDITY:
|
||||
nf_instance = e->sbi.data;
|
||||
ogs_assert(nf_instance);
|
||||
|
|
|
@ -68,8 +68,8 @@ void udr_nf_state_initial(ogs_fsm_t *s, udr_event_t *e)
|
|||
ogs_assert(nf_instance->t_heartbeat_interval);
|
||||
nf_instance->t_heartbeat_interval->cb =
|
||||
udr_timer_nf_instance_heartbeat_interval;
|
||||
ogs_assert(nf_instance->t_heartbeat);
|
||||
nf_instance->t_heartbeat->cb = udr_timer_nf_instance_heartbeat;
|
||||
ogs_assert(nf_instance->t_no_heartbeat);
|
||||
nf_instance->t_no_heartbeat->cb = udr_timer_nf_instance_no_heartbeat;
|
||||
ogs_assert(nf_instance->t_validity);
|
||||
nf_instance->t_validity->cb = udr_timer_nf_instance_validity;
|
||||
|
||||
|
@ -107,8 +107,7 @@ void udr_nf_state_will_register(ogs_fsm_t *s, udr_event_t *e)
|
|||
case OGS_FSM_ENTRY_SIG:
|
||||
if (NF_INSTANCE_IS_SELF(nf_instance->id))
|
||||
ogs_timer_start(nf_instance->t_registration_interval,
|
||||
udr_timer_cfg(UDR_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL)->
|
||||
duration);
|
||||
ogs_config()->time.message.sbi.nf_register_interval);
|
||||
|
||||
ogs_nnrf_nfm_send_nf_register(nf_instance);
|
||||
break;
|
||||
|
@ -163,8 +162,7 @@ void udr_nf_state_will_register(ogs_fsm_t *s, udr_event_t *e)
|
|||
|
||||
if (NF_INSTANCE_IS_SELF(nf_instance->id))
|
||||
ogs_timer_start(nf_instance->t_registration_interval,
|
||||
udr_timer_cfg(UDR_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL)->
|
||||
duration);
|
||||
ogs_config()->time.message.sbi.nf_register_interval);
|
||||
|
||||
ogs_nnrf_nfm_send_nf_register(nf_instance);
|
||||
break;
|
||||
|
@ -202,12 +200,13 @@ void udr_nf_state_registered(ogs_fsm_t *s, udr_event_t *e)
|
|||
client = nf_instance->client;
|
||||
ogs_assert(client);
|
||||
|
||||
if (nf_instance->time.heartbeat) {
|
||||
if (nf_instance->time.heartbeat_interval) {
|
||||
ogs_timer_start(nf_instance->t_heartbeat_interval,
|
||||
ogs_time_from_sec(nf_instance->time.heartbeat));
|
||||
ogs_timer_start(nf_instance->t_heartbeat,
|
||||
ogs_time_from_sec(nf_instance->time.heartbeat *
|
||||
OGS_SBI_HEARTBEAT_RETRYCOUNT));
|
||||
ogs_time_from_sec(nf_instance->time.heartbeat_interval));
|
||||
ogs_timer_start(nf_instance->t_no_heartbeat,
|
||||
ogs_time_from_sec(
|
||||
nf_instance->time.heartbeat_interval +
|
||||
ogs_config()->time.nf_instance.no_heartbeat_margin));
|
||||
}
|
||||
|
||||
ogs_nnrf_nfm_send_nf_status_subscribe(client,
|
||||
|
@ -220,12 +219,14 @@ void udr_nf_state_registered(ogs_fsm_t *s, udr_event_t *e)
|
|||
if (NF_INSTANCE_IS_SELF(nf_instance->id)) {
|
||||
ogs_info("[%s] NF de-registered", nf_instance->id);
|
||||
|
||||
if (nf_instance->time.heartbeat) {
|
||||
if (nf_instance->time.heartbeat_interval) {
|
||||
ogs_timer_stop(nf_instance->t_heartbeat_interval);
|
||||
ogs_timer_stop(nf_instance->t_heartbeat);
|
||||
ogs_timer_stop(nf_instance->t_no_heartbeat);
|
||||
}
|
||||
|
||||
ogs_nnrf_nfm_send_nf_de_register(nf_instance);
|
||||
if (!OGS_FSM_CHECK(&nf_instance->sm, udr_nf_state_exception)) {
|
||||
ogs_nnrf_nfm_send_nf_de_register(nf_instance);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -241,13 +242,16 @@ void udr_nf_state_registered(ogs_fsm_t *s, udr_event_t *e)
|
|||
|
||||
if (message->res_status == OGS_SBI_HTTP_STATUS_NO_CONTENT ||
|
||||
message->res_status == OGS_SBI_HTTP_STATUS_OK) {
|
||||
if (nf_instance->time.heartbeat)
|
||||
ogs_timer_start(nf_instance->t_heartbeat,
|
||||
ogs_time_from_sec(nf_instance->time.heartbeat *
|
||||
OGS_SBI_HEARTBEAT_RETRYCOUNT));
|
||||
if (nf_instance->time.heartbeat_interval)
|
||||
ogs_timer_start(nf_instance->t_no_heartbeat,
|
||||
ogs_time_from_sec(
|
||||
nf_instance->time.heartbeat_interval +
|
||||
ogs_config()->time.nf_instance.
|
||||
no_heartbeat_margin));
|
||||
} else {
|
||||
ogs_error("[%s] HTTP response error [%d]",
|
||||
ogs_warn("[%s] HTTP response error [%d]",
|
||||
nf_instance->id, message->res_status);
|
||||
OGS_FSM_TRAN(s, &udr_nf_state_exception);
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -267,14 +271,14 @@ void udr_nf_state_registered(ogs_fsm_t *s, udr_event_t *e)
|
|||
case UDR_EVT_SBI_TIMER:
|
||||
switch(e->timer_id) {
|
||||
case UDR_TIMER_NF_INSTANCE_HEARTBEAT_INTERVAL:
|
||||
if (nf_instance->time.heartbeat)
|
||||
if (nf_instance->time.heartbeat_interval)
|
||||
ogs_timer_start(nf_instance->t_heartbeat_interval,
|
||||
ogs_time_from_sec(nf_instance->time.heartbeat));
|
||||
ogs_time_from_sec(nf_instance->time.heartbeat_interval));
|
||||
|
||||
ogs_nnrf_nfm_send_nf_update(nf_instance);
|
||||
break;
|
||||
|
||||
case UDR_TIMER_NF_INSTANCE_HEARTBEAT:
|
||||
case UDR_TIMER_NF_INSTANCE_NO_HEARTBEAT:
|
||||
OGS_FSM_TRAN(s, &udr_nf_state_will_register);
|
||||
break;
|
||||
|
||||
|
@ -331,6 +335,7 @@ void udr_nf_state_exception(ogs_fsm_t *s, udr_event_t *e)
|
|||
{
|
||||
ogs_sbi_nf_instance_t *nf_instance = NULL;
|
||||
ogs_sbi_client_t *client = NULL;
|
||||
ogs_sbi_message_t *message = NULL;
|
||||
ogs_sockaddr_t *addr = NULL;
|
||||
ogs_assert(s);
|
||||
ogs_assert(e);
|
||||
|
@ -344,8 +349,8 @@ void udr_nf_state_exception(ogs_fsm_t *s, udr_event_t *e)
|
|||
case OGS_FSM_ENTRY_SIG:
|
||||
if (NF_INSTANCE_IS_SELF(nf_instance->id))
|
||||
ogs_timer_start(nf_instance->t_registration_interval,
|
||||
udr_timer_cfg(UDR_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL)->
|
||||
duration);
|
||||
ogs_config()->time.message.sbi.
|
||||
nf_register_interval_in_exception);
|
||||
break;
|
||||
|
||||
case OGS_FSM_EXIT_SIG:
|
||||
|
@ -373,6 +378,26 @@ void udr_nf_state_exception(ogs_fsm_t *s, udr_event_t *e)
|
|||
}
|
||||
break;
|
||||
|
||||
case UDR_EVT_SBI_CLIENT:
|
||||
message = e->sbi.message;
|
||||
ogs_assert(message);
|
||||
|
||||
SWITCH(message->h.service.name)
|
||||
CASE(OGS_SBI_SERVICE_NAME_NNRF_NFM)
|
||||
|
||||
SWITCH(message->h.resource.component[0])
|
||||
CASE(OGS_SBI_RESOURCE_NAME_NF_INSTANCES)
|
||||
break;
|
||||
DEFAULT
|
||||
ogs_error("Invalid resource name [%s]",
|
||||
message->h.resource.component[0]);
|
||||
END
|
||||
break;
|
||||
DEFAULT
|
||||
ogs_error("Invalid API name [%s]", message->h.service.name);
|
||||
END
|
||||
break;
|
||||
|
||||
default:
|
||||
ogs_error("[%s] Unknown event %s",
|
||||
nf_instance->id, udr_event_get_name(e));
|
||||
|
|
|
@ -38,7 +38,7 @@ void udr_nnrf_handle_nf_register(
|
|||
}
|
||||
|
||||
/* TIME : Update heartbeat from NRF */
|
||||
nf_instance->time.heartbeat = NFProfile->heart_beat_timer;
|
||||
nf_instance->time.heartbeat_interval = NFProfile->heart_beat_timer;
|
||||
}
|
||||
|
||||
void udr_nnrf_handle_nf_status_subscribe(
|
||||
|
|
|
@ -19,17 +19,6 @@
|
|||
|
||||
#include "context.h"
|
||||
|
||||
static udr_timer_cfg_t g_udr_timer_cfg[MAX_NUM_OF_UDR_TIMER] = {
|
||||
[UDR_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL] =
|
||||
{ .duration = ogs_time_from_sec(3) },
|
||||
};
|
||||
|
||||
udr_timer_cfg_t *udr_timer_cfg(udr_timer_e id)
|
||||
{
|
||||
ogs_assert(id < MAX_NUM_OF_UDR_TIMER);
|
||||
return &g_udr_timer_cfg[id];
|
||||
}
|
||||
|
||||
const char *udr_timer_get_name(udr_timer_e id)
|
||||
{
|
||||
switch (id) {
|
||||
|
@ -37,8 +26,8 @@ const char *udr_timer_get_name(udr_timer_e id)
|
|||
return "UDR_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL";
|
||||
case UDR_TIMER_NF_INSTANCE_HEARTBEAT_INTERVAL:
|
||||
return "UDR_TIMER_NF_INSTANCE_HEARTBEAT_INTERVAL";
|
||||
case UDR_TIMER_NF_INSTANCE_HEARTBEAT:
|
||||
return "UDR_TIMER_NF_INSTANCE_HEARTBEAT";
|
||||
case UDR_TIMER_NF_INSTANCE_NO_HEARTBEAT:
|
||||
return "UDR_TIMER_NF_INSTANCE_NO_HEARTBEAT";
|
||||
case UDR_TIMER_NF_INSTANCE_VALIDITY:
|
||||
return "UDR_TIMER_NF_INSTANCE_VALIDITY";
|
||||
case UDR_TIMER_SUBSCRIPTION_VALIDITY:
|
||||
|
@ -59,7 +48,7 @@ static void sbi_timer_send_event(int timer_id, void *data)
|
|||
switch (timer_id) {
|
||||
case UDR_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL:
|
||||
case UDR_TIMER_NF_INSTANCE_HEARTBEAT_INTERVAL:
|
||||
case UDR_TIMER_NF_INSTANCE_HEARTBEAT:
|
||||
case UDR_TIMER_NF_INSTANCE_NO_HEARTBEAT:
|
||||
case UDR_TIMER_NF_INSTANCE_VALIDITY:
|
||||
case UDR_TIMER_SUBSCRIPTION_VALIDITY:
|
||||
e = udr_event_new(UDR_EVT_SBI_TIMER);
|
||||
|
@ -91,9 +80,9 @@ void udr_timer_nf_instance_heartbeat_interval(void *data)
|
|||
sbi_timer_send_event(UDR_TIMER_NF_INSTANCE_HEARTBEAT_INTERVAL, data);
|
||||
}
|
||||
|
||||
void udr_timer_nf_instance_heartbeat(void *data)
|
||||
void udr_timer_nf_instance_no_heartbeat(void *data)
|
||||
{
|
||||
sbi_timer_send_event(UDR_TIMER_NF_INSTANCE_HEARTBEAT, data);
|
||||
sbi_timer_send_event(UDR_TIMER_NF_INSTANCE_NO_HEARTBEAT, data);
|
||||
}
|
||||
|
||||
void udr_timer_nf_instance_validity(void *data)
|
||||
|
|
|
@ -32,7 +32,7 @@ typedef enum {
|
|||
|
||||
UDR_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL,
|
||||
UDR_TIMER_NF_INSTANCE_HEARTBEAT_INTERVAL,
|
||||
UDR_TIMER_NF_INSTANCE_HEARTBEAT,
|
||||
UDR_TIMER_NF_INSTANCE_NO_HEARTBEAT,
|
||||
UDR_TIMER_NF_INSTANCE_VALIDITY,
|
||||
UDR_TIMER_SUBSCRIPTION_VALIDITY,
|
||||
|
||||
|
@ -40,18 +40,11 @@ typedef enum {
|
|||
|
||||
} udr_timer_e;
|
||||
|
||||
typedef struct udr_timer_cfg_s {
|
||||
int max_count;
|
||||
ogs_time_t duration;
|
||||
} udr_timer_cfg_t;
|
||||
|
||||
udr_timer_cfg_t *udr_timer_cfg(udr_timer_e id);
|
||||
|
||||
const char *udr_timer_get_name(udr_timer_e id);
|
||||
|
||||
void udr_timer_nf_instance_registration_interval(void *data);
|
||||
void udr_timer_nf_instance_heartbeat_interval(void *data);
|
||||
void udr_timer_nf_instance_heartbeat(void *data);
|
||||
void udr_timer_nf_instance_no_heartbeat(void *data);
|
||||
void udr_timer_nf_instance_validity(void *data);
|
||||
void udr_timer_subscription_validity(void *data);
|
||||
|
||||
|
|
|
@ -212,7 +212,7 @@ void udr_state_operational(ogs_fsm_t *s, udr_event_t *e)
|
|||
ogs_fsm_dispatch(&nf_instance->sm, e);
|
||||
|
||||
if (OGS_FSM_CHECK(&nf_instance->sm, udr_nf_state_exception)) {
|
||||
ogs_error("[%s] State machine exception", nf_instance->id);
|
||||
ogs_warn("[%s] State machine exception", nf_instance->id);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -271,7 +271,7 @@ void udr_state_operational(ogs_fsm_t *s, udr_event_t *e)
|
|||
switch(e->timer_id) {
|
||||
case UDR_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL:
|
||||
case UDR_TIMER_NF_INSTANCE_HEARTBEAT_INTERVAL:
|
||||
case UDR_TIMER_NF_INSTANCE_HEARTBEAT:
|
||||
case UDR_TIMER_NF_INSTANCE_NO_HEARTBEAT:
|
||||
case UDR_TIMER_NF_INSTANCE_VALIDITY:
|
||||
nf_instance = e->sbi.data;
|
||||
ogs_assert(nf_instance);
|
||||
|
|
|
@ -54,8 +54,8 @@ void upf_n4_handle_heartbeat_response(
|
|||
ogs_assert(xact);
|
||||
ogs_pfcp_xact_commit(xact);
|
||||
|
||||
ogs_timer_start(node->t_heartbeat,
|
||||
upf_timer_cfg(UPF_TIMER_HEARTBEAT)->duration);
|
||||
ogs_timer_start(node->t_no_heartbeat,
|
||||
ogs_config()->time.message.pfcp.no_heartbeat_duration);
|
||||
}
|
||||
|
||||
static void setup_gtp_node(ogs_pfcp_far_t *far,
|
||||
|
|
|
@ -42,9 +42,9 @@ void upf_pfcp_state_initial(ogs_fsm_t *s, upf_event_t *e)
|
|||
ogs_pfcp_self()->pfcp_sock, ogs_pfcp_self()->pfcp_sock6, node);
|
||||
ogs_assert(rv == OGS_OK);
|
||||
|
||||
node->t_heartbeat = ogs_timer_add(upf_self()->timer_mgr,
|
||||
upf_timer_heartbeat, node);
|
||||
ogs_assert(node->t_heartbeat);
|
||||
node->t_no_heartbeat = ogs_timer_add(upf_self()->timer_mgr,
|
||||
upf_timer_no_heartbeat, node);
|
||||
ogs_assert(node->t_no_heartbeat);
|
||||
|
||||
OGS_FSM_TRAN(s, &upf_pfcp_state_will_associate);
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ void upf_pfcp_state_final(ogs_fsm_t *s, upf_event_t *e)
|
|||
node = e->pfcp_node;
|
||||
ogs_assert(node);
|
||||
|
||||
ogs_timer_delete(node->t_heartbeat);
|
||||
ogs_timer_delete(node->t_no_heartbeat);
|
||||
}
|
||||
|
||||
void upf_pfcp_state_will_associate(ogs_fsm_t *s, upf_event_t *e)
|
||||
|
@ -83,7 +83,7 @@ void upf_pfcp_state_will_associate(ogs_fsm_t *s, upf_event_t *e)
|
|||
case OGS_FSM_ENTRY_SIG:
|
||||
if (node->t_association) {
|
||||
ogs_timer_start(node->t_association,
|
||||
upf_timer_cfg(UPF_TIMER_ASSOCIATION)->duration);
|
||||
ogs_config()->time.message.pfcp.association_interval);
|
||||
|
||||
upf_pfcp_send_association_setup_request(node);
|
||||
}
|
||||
|
@ -106,7 +106,7 @@ void upf_pfcp_state_will_associate(ogs_fsm_t *s, upf_event_t *e)
|
|||
|
||||
ogs_assert(node->t_association);
|
||||
ogs_timer_start(node->t_association,
|
||||
upf_timer_cfg(UPF_TIMER_ASSOCIATION)->duration);
|
||||
ogs_config()->time.message.pfcp.association_interval);
|
||||
|
||||
upf_pfcp_send_association_setup_request(node);
|
||||
break;
|
||||
|
@ -169,12 +169,12 @@ void upf_pfcp_state_associated(ogs_fsm_t *s, upf_event_t *e)
|
|||
switch (e->id) {
|
||||
case OGS_FSM_ENTRY_SIG:
|
||||
ogs_info("PFCP associated");
|
||||
ogs_timer_start(node->t_heartbeat,
|
||||
upf_timer_cfg(UPF_TIMER_HEARTBEAT)->duration);
|
||||
ogs_timer_start(node->t_no_heartbeat,
|
||||
ogs_config()->time.message.pfcp.no_heartbeat_duration);
|
||||
break;
|
||||
case OGS_FSM_EXIT_SIG:
|
||||
ogs_info("PFCP de-associated");
|
||||
ogs_timer_stop(node->t_heartbeat);
|
||||
ogs_timer_stop(node->t_no_heartbeat);
|
||||
break;
|
||||
case UPF_EVT_N4_MESSAGE:
|
||||
message = e->pfcp_message;
|
||||
|
@ -231,7 +231,7 @@ void upf_pfcp_state_associated(ogs_fsm_t *s, upf_event_t *e)
|
|||
break;
|
||||
case UPF_EVT_N4_TIMER:
|
||||
switch(e->timer_id) {
|
||||
case UPF_TIMER_HEARTBEAT:
|
||||
case UPF_TIMER_NO_HEARTBEAT:
|
||||
node = e->pfcp_node;
|
||||
ogs_assert(node);
|
||||
|
||||
|
|
|
@ -21,26 +21,13 @@
|
|||
#include "event.h"
|
||||
#include "context.h"
|
||||
|
||||
static upf_timer_cfg_t g_upf_timer_cfg[MAX_NUM_OF_UPF_TIMER] = {
|
||||
[UPF_TIMER_ASSOCIATION] =
|
||||
{ .duration = ogs_time_from_sec(12) },
|
||||
[UPF_TIMER_HEARTBEAT] =
|
||||
{ .duration = ogs_time_from_sec(12) },
|
||||
};
|
||||
|
||||
upf_timer_cfg_t *upf_timer_cfg(upf_timer_e id)
|
||||
{
|
||||
ogs_assert(id < MAX_NUM_OF_UPF_TIMER);
|
||||
return &g_upf_timer_cfg[id];
|
||||
}
|
||||
|
||||
const char *upf_timer_get_name(upf_timer_e id)
|
||||
{
|
||||
switch (id) {
|
||||
case UPF_TIMER_ASSOCIATION:
|
||||
return "UPF_TIMER_ASSOCIATION";
|
||||
case UPF_TIMER_HEARTBEAT:
|
||||
return "UPF_TIMER_HEARTBEAT";
|
||||
case UPF_TIMER_NO_HEARTBEAT:
|
||||
return "UPF_TIMER_NO_HEARTBEAT";
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -70,7 +57,7 @@ void upf_timer_association(void *data)
|
|||
timer_send_event(UPF_TIMER_ASSOCIATION, data);
|
||||
}
|
||||
|
||||
void upf_timer_heartbeat(void *data)
|
||||
void upf_timer_no_heartbeat(void *data)
|
||||
{
|
||||
timer_send_event(UPF_TIMER_HEARTBEAT, data);
|
||||
timer_send_event(UPF_TIMER_NO_HEARTBEAT, data);
|
||||
}
|
||||
|
|
|
@ -31,23 +31,16 @@ typedef enum {
|
|||
UPF_TIMER_BASE = 0,
|
||||
|
||||
UPF_TIMER_ASSOCIATION,
|
||||
UPF_TIMER_HEARTBEAT,
|
||||
UPF_TIMER_NO_HEARTBEAT,
|
||||
|
||||
MAX_NUM_OF_UPF_TIMER,
|
||||
|
||||
} upf_timer_e;
|
||||
|
||||
typedef struct upf_timer_cfg_s {
|
||||
int max_count;
|
||||
ogs_time_t duration;
|
||||
} upf_timer_cfg_t;
|
||||
|
||||
upf_timer_cfg_t *upf_timer_cfg(upf_timer_e id);
|
||||
|
||||
const char *upf_timer_get_name(upf_timer_e id);
|
||||
|
||||
void upf_timer_association(void *data);
|
||||
void upf_timer_heartbeat(void *data);
|
||||
void upf_timer_no_heartbeat(void *data);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue