From 0e0a69ed7c67b84233e945f0657dc5431bb90708 Mon Sep 17 00:00:00 2001 From: Sukchan Lee Date: Tue, 18 Jun 2019 17:38:25 +0900 Subject: [PATCH] [SGsAP] server/client connected in test-code --- src/Makefile.am | 1 + src/epc.c | 4 ++++ src/mme.c | 4 ++++ src/mme/mme-init.c | 5 ----- tests/csfb/abts-main.c | 7 ------- tests/csfb/test-app.c | 14 ++++++++++++++ tests/sample-csfb.conf.in | 14 +++++++------- tests/volte/test-app.c | 4 ++++ 8 files changed, 34 insertions(+), 19 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 7bbeaa6c7..c38364e27 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -69,6 +69,7 @@ libepc_la_LIBADD = \ AM_CPPFLAGS = \ @OGSCORE_CFLAGS@ \ -I$(top_srcdir)/src \ + -I$(top_srcdir)/lib \ $(NULL) AM_CFLAGS = \ diff --git a/src/epc.c b/src/epc.c index 8cd1393ae..4fcf682ea 100644 --- a/src/epc.c +++ b/src/epc.c @@ -1,3 +1,5 @@ +#include "mme/ogs-sctp.h" + #include "app/context.h" #include "app/application.h" @@ -214,6 +216,7 @@ int epc_initialize(app_param_t *param) } ogs_info("MME try to initialize"); + ogs_sctp_init(context_self()->config.usrsctp.udp_port); rv = mme_initialize(); ogs_assert(rv == OGS_OK); ogs_info("MME initialize...done"); @@ -230,6 +233,7 @@ void epc_terminate(void) ogs_info("MME try to terminate"); mme_terminate(); + ogs_sctp_final(); ogs_info("MME terminate...done"); if (context_self()->config.parameter.no_hss == 0) diff --git a/src/mme.c b/src/mme.c index e52bc796d..76afa2680 100644 --- a/src/mme.c +++ b/src/mme.c @@ -1,3 +1,5 @@ +#include "mme/ogs-sctp.h" + #include "app/context.h" #include "app/application.h" @@ -16,6 +18,7 @@ int app_initialize(app_param_t *param) rv = app_will_initialize(param); if (rv != OGS_OK) return rv; + ogs_sctp_init(context_self()->config.usrsctp.udp_port); rv = mme_initialize(); if (rv != OGS_OK) { @@ -36,6 +39,7 @@ void app_terminate(void) ogs_info("MME try to terminate"); mme_terminate(); + ogs_sctp_final(); ogs_info("MME terminate...done"); app_did_terminate(); diff --git a/src/mme/mme-init.c b/src/mme/mme-init.c index 4feb077be..2277a11af 100644 --- a/src/mme/mme-init.c +++ b/src/mme/mme-init.c @@ -8,7 +8,6 @@ #include "mme-event.h" #include "mme-fd-path.h" -#include "s1ap-path.h" static ogs_thread_t *thread; static void mme_main(void *data); @@ -22,8 +21,6 @@ int mme_initialize() mme_context_init(); mme_event_init(); - ogs_sctp_init(context_self()->config.usrsctp.udp_port); - rv = gtp_xact_init(mme_self()->timer_mgr); if (rv != OGS_OK) return rv; @@ -59,8 +56,6 @@ void mme_terminate(void) mme_context_final(); - ogs_sctp_final(); - gtp_xact_final(); mme_event_final(); diff --git a/tests/csfb/abts-main.c b/tests/csfb/abts-main.c index 13b025336..57b166047 100644 --- a/tests/csfb/abts-main.c +++ b/tests/csfb/abts-main.c @@ -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) { ogs_msleep(300); - testvlr_sgsap_close(sgsap); - testpacket_final(); test_app_terminate(); @@ -85,9 +81,6 @@ int test_initialize(app_param_t *param, int argc, const char *const argv[]) return OGS_ERROR; } - sgsap = testvlr_sgsap_server("127.0.0.2"); - ogs_assert(sgsap); - while(1) { if (connected_count == 1) break; ogs_msleep(50); diff --git a/tests/csfb/test-app.c b/tests/csfb/test-app.c index 99dc1484b..1d59fa0b3 100644 --- a/tests/csfb/test-app.c +++ b/tests/csfb/test-app.c @@ -1,7 +1,10 @@ +#include "mme/ogs-sctp.h" + #include "app/context.h" #include "app/application.h" #include "app-init.h" +#include "test-packet.h" static ogs_proc_mutex_t *pcrf_sem1 = 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_sem2 = NULL; +static ogs_socknode_t *sgsap = NULL; + int test_epc_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_sctp_init(context_self()->config.usrsctp.udp_port); + + sgsap = testvlr_sgsap_server("127.0.0.2"); + ogs_assert(sgsap); + rv = mme_initialize(); ogs_assert(rv == OGS_OK); ogs_info("MME initialize...done"); @@ -232,6 +242,10 @@ void test_app_terminate(void) ogs_info("MME try to terminate"); mme_terminate(); + + testvlr_sgsap_close(sgsap); + + ogs_sctp_final(); ogs_info("MME terminate...done"); if (context_self()->config.parameter.no_hss == 0) diff --git a/tests/sample-csfb.conf.in b/tests/sample-csfb.conf.in index 879717b22..a8110f244 100644 --- a/tests/sample-csfb.conf.in +++ b/tests/sample-csfb.conf.in @@ -29,13 +29,13 @@ mme: addr: 127.0.0.1 gtpc: addr: 127.0.0.1 -# sgsap: -# addr: 127.0.0.2 -# plmn_id: -# mcc: 901 -# mnc: 70 -# tac: 7 -# lac: 2342 + sgsap: + addr: 127.0.0.2 + plmn_id: + mcc: 901 + mnc: 70 + tac: 7 + lac: 2342 gummei: plmn_id: mcc: 901 diff --git a/tests/volte/test-app.c b/tests/volte/test-app.c index 5529905dc..6a4c75058 100644 --- a/tests/volte/test-app.c +++ b/tests/volte/test-app.c @@ -1,3 +1,5 @@ +#include "mme/ogs-sctp.h" + #include "app/context.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); ogs_info("MME try to initialize"); + ogs_sctp_init(context_self()->config.usrsctp.udp_port); rv = mme_initialize(); ogs_assert(rv == OGS_OK); ogs_info("MME initialize...done"); @@ -244,6 +247,7 @@ int test_app_initialize(app_param_t *param) { ogs_info("MME try to terminate"); mme_terminate(); + ogs_sctp_final(); ogs_info("MME terminate...done"); }