forked from acouzens/open5gs
[SGsAP] server/client connected in test-code
This commit is contained in:
parent
5ce95f94ee
commit
0e0a69ed7c
|
@ -69,6 +69,7 @@ libepc_la_LIBADD = \
|
||||||
AM_CPPFLAGS = \
|
AM_CPPFLAGS = \
|
||||||
@OGSCORE_CFLAGS@ \
|
@OGSCORE_CFLAGS@ \
|
||||||
-I$(top_srcdir)/src \
|
-I$(top_srcdir)/src \
|
||||||
|
-I$(top_srcdir)/lib \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
AM_CFLAGS = \
|
AM_CFLAGS = \
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#include "mme/ogs-sctp.h"
|
||||||
|
|
||||||
#include "app/context.h"
|
#include "app/context.h"
|
||||||
#include "app/application.h"
|
#include "app/application.h"
|
||||||
|
|
||||||
|
@ -214,6 +216,7 @@ int epc_initialize(app_param_t *param)
|
||||||
}
|
}
|
||||||
|
|
||||||
ogs_info("MME try to initialize");
|
ogs_info("MME try to initialize");
|
||||||
|
ogs_sctp_init(context_self()->config.usrsctp.udp_port);
|
||||||
rv = mme_initialize();
|
rv = mme_initialize();
|
||||||
ogs_assert(rv == OGS_OK);
|
ogs_assert(rv == OGS_OK);
|
||||||
ogs_info("MME initialize...done");
|
ogs_info("MME initialize...done");
|
||||||
|
@ -230,6 +233,7 @@ void epc_terminate(void)
|
||||||
|
|
||||||
ogs_info("MME try to terminate");
|
ogs_info("MME try to terminate");
|
||||||
mme_terminate();
|
mme_terminate();
|
||||||
|
ogs_sctp_final();
|
||||||
ogs_info("MME terminate...done");
|
ogs_info("MME terminate...done");
|
||||||
|
|
||||||
if (context_self()->config.parameter.no_hss == 0)
|
if (context_self()->config.parameter.no_hss == 0)
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#include "mme/ogs-sctp.h"
|
||||||
|
|
||||||
#include "app/context.h"
|
#include "app/context.h"
|
||||||
#include "app/application.h"
|
#include "app/application.h"
|
||||||
|
|
||||||
|
@ -16,6 +18,7 @@ int app_initialize(app_param_t *param)
|
||||||
rv = app_will_initialize(param);
|
rv = app_will_initialize(param);
|
||||||
if (rv != OGS_OK) return rv;
|
if (rv != OGS_OK) return rv;
|
||||||
|
|
||||||
|
ogs_sctp_init(context_self()->config.usrsctp.udp_port);
|
||||||
rv = mme_initialize();
|
rv = mme_initialize();
|
||||||
if (rv != OGS_OK)
|
if (rv != OGS_OK)
|
||||||
{
|
{
|
||||||
|
@ -36,6 +39,7 @@ void app_terminate(void)
|
||||||
|
|
||||||
ogs_info("MME try to terminate");
|
ogs_info("MME try to terminate");
|
||||||
mme_terminate();
|
mme_terminate();
|
||||||
|
ogs_sctp_final();
|
||||||
ogs_info("MME terminate...done");
|
ogs_info("MME terminate...done");
|
||||||
|
|
||||||
app_did_terminate();
|
app_did_terminate();
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
#include "mme-event.h"
|
#include "mme-event.h"
|
||||||
|
|
||||||
#include "mme-fd-path.h"
|
#include "mme-fd-path.h"
|
||||||
#include "s1ap-path.h"
|
|
||||||
|
|
||||||
static ogs_thread_t *thread;
|
static ogs_thread_t *thread;
|
||||||
static void mme_main(void *data);
|
static void mme_main(void *data);
|
||||||
|
@ -22,8 +21,6 @@ int mme_initialize()
|
||||||
mme_context_init();
|
mme_context_init();
|
||||||
mme_event_init();
|
mme_event_init();
|
||||||
|
|
||||||
ogs_sctp_init(context_self()->config.usrsctp.udp_port);
|
|
||||||
|
|
||||||
rv = gtp_xact_init(mme_self()->timer_mgr);
|
rv = gtp_xact_init(mme_self()->timer_mgr);
|
||||||
if (rv != OGS_OK) return rv;
|
if (rv != OGS_OK) return rv;
|
||||||
|
|
||||||
|
@ -59,8 +56,6 @@ void mme_terminate(void)
|
||||||
|
|
||||||
mme_context_final();
|
mme_context_final();
|
||||||
|
|
||||||
ogs_sctp_final();
|
|
||||||
|
|
||||||
gtp_xact_final();
|
gtp_xact_final();
|
||||||
|
|
||||||
mme_event_final();
|
mme_event_final();
|
||||||
|
|
|
@ -48,14 +48,10 @@ static void test_fd_logger_handler(enum fd_hook_type type, struct msg * msg,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static ogs_socknode_t *sgsap = NULL;
|
|
||||||
|
|
||||||
void test_terminate(void)
|
void test_terminate(void)
|
||||||
{
|
{
|
||||||
ogs_msleep(300);
|
ogs_msleep(300);
|
||||||
|
|
||||||
testvlr_sgsap_close(sgsap);
|
|
||||||
|
|
||||||
testpacket_final();
|
testpacket_final();
|
||||||
test_app_terminate();
|
test_app_terminate();
|
||||||
|
|
||||||
|
@ -85,9 +81,6 @@ int test_initialize(app_param_t *param, int argc, const char *const argv[])
|
||||||
return OGS_ERROR;
|
return OGS_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
sgsap = testvlr_sgsap_server("127.0.0.2");
|
|
||||||
ogs_assert(sgsap);
|
|
||||||
|
|
||||||
while(1) {
|
while(1) {
|
||||||
if (connected_count == 1) break;
|
if (connected_count == 1) break;
|
||||||
ogs_msleep(50);
|
ogs_msleep(50);
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
|
#include "mme/ogs-sctp.h"
|
||||||
|
|
||||||
#include "app/context.h"
|
#include "app/context.h"
|
||||||
#include "app/application.h"
|
#include "app/application.h"
|
||||||
|
|
||||||
#include "app-init.h"
|
#include "app-init.h"
|
||||||
|
#include "test-packet.h"
|
||||||
|
|
||||||
static ogs_proc_mutex_t *pcrf_sem1 = NULL;
|
static ogs_proc_mutex_t *pcrf_sem1 = NULL;
|
||||||
static ogs_proc_mutex_t *pcrf_sem2 = NULL;
|
static ogs_proc_mutex_t *pcrf_sem2 = NULL;
|
||||||
|
@ -15,6 +18,8 @@ static ogs_proc_mutex_t *sgw_sem2 = NULL;
|
||||||
static ogs_proc_mutex_t *hss_sem1 = NULL;
|
static ogs_proc_mutex_t *hss_sem1 = NULL;
|
||||||
static ogs_proc_mutex_t *hss_sem2 = NULL;
|
static ogs_proc_mutex_t *hss_sem2 = NULL;
|
||||||
|
|
||||||
|
static ogs_socknode_t *sgsap = NULL;
|
||||||
|
|
||||||
int test_epc_initialize(app_param_t *param);
|
int test_epc_initialize(app_param_t *param);
|
||||||
|
|
||||||
int test_app_initialize(app_param_t *param)
|
int test_app_initialize(app_param_t *param)
|
||||||
|
@ -216,6 +221,11 @@ int test_epc_initialize(app_param_t *param)
|
||||||
}
|
}
|
||||||
|
|
||||||
ogs_info("MME try to initialize");
|
ogs_info("MME try to initialize");
|
||||||
|
ogs_sctp_init(context_self()->config.usrsctp.udp_port);
|
||||||
|
|
||||||
|
sgsap = testvlr_sgsap_server("127.0.0.2");
|
||||||
|
ogs_assert(sgsap);
|
||||||
|
|
||||||
rv = mme_initialize();
|
rv = mme_initialize();
|
||||||
ogs_assert(rv == OGS_OK);
|
ogs_assert(rv == OGS_OK);
|
||||||
ogs_info("MME initialize...done");
|
ogs_info("MME initialize...done");
|
||||||
|
@ -232,6 +242,10 @@ void test_app_terminate(void)
|
||||||
|
|
||||||
ogs_info("MME try to terminate");
|
ogs_info("MME try to terminate");
|
||||||
mme_terminate();
|
mme_terminate();
|
||||||
|
|
||||||
|
testvlr_sgsap_close(sgsap);
|
||||||
|
|
||||||
|
ogs_sctp_final();
|
||||||
ogs_info("MME terminate...done");
|
ogs_info("MME terminate...done");
|
||||||
|
|
||||||
if (context_self()->config.parameter.no_hss == 0)
|
if (context_self()->config.parameter.no_hss == 0)
|
||||||
|
|
|
@ -29,13 +29,13 @@ mme:
|
||||||
addr: 127.0.0.1
|
addr: 127.0.0.1
|
||||||
gtpc:
|
gtpc:
|
||||||
addr: 127.0.0.1
|
addr: 127.0.0.1
|
||||||
# sgsap:
|
sgsap:
|
||||||
# addr: 127.0.0.2
|
addr: 127.0.0.2
|
||||||
# plmn_id:
|
plmn_id:
|
||||||
# mcc: 901
|
mcc: 901
|
||||||
# mnc: 70
|
mnc: 70
|
||||||
# tac: 7
|
tac: 7
|
||||||
# lac: 2342
|
lac: 2342
|
||||||
gummei:
|
gummei:
|
||||||
plmn_id:
|
plmn_id:
|
||||||
mcc: 901
|
mcc: 901
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#include "mme/ogs-sctp.h"
|
||||||
|
|
||||||
#include "app/context.h"
|
#include "app/context.h"
|
||||||
#include "app/application.h"
|
#include "app/application.h"
|
||||||
|
|
||||||
|
@ -233,6 +235,7 @@ int test_app_initialize(app_param_t *param)
|
||||||
if (hss_sem2) ogs_proc_mutex_delete(hss_sem2);
|
if (hss_sem2) ogs_proc_mutex_delete(hss_sem2);
|
||||||
|
|
||||||
ogs_info("MME try to initialize");
|
ogs_info("MME try to initialize");
|
||||||
|
ogs_sctp_init(context_self()->config.usrsctp.udp_port);
|
||||||
rv = mme_initialize();
|
rv = mme_initialize();
|
||||||
ogs_assert(rv == OGS_OK);
|
ogs_assert(rv == OGS_OK);
|
||||||
ogs_info("MME initialize...done");
|
ogs_info("MME initialize...done");
|
||||||
|
@ -244,6 +247,7 @@ int test_app_initialize(app_param_t *param)
|
||||||
{
|
{
|
||||||
ogs_info("MME try to terminate");
|
ogs_info("MME try to terminate");
|
||||||
mme_terminate();
|
mme_terminate();
|
||||||
|
ogs_sctp_final();
|
||||||
ogs_info("MME terminate...done");
|
ogs_info("MME terminate...done");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue