From 31c4657c971e40407163034526aafeb9b5a83460 Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Mon, 2 Sep 2019 16:45:27 +0200 Subject: Implement GMM State using osmocom FSM State machine inspired in the one from TS 24.008 4.1.3.3.1. Some state transitions are inroduced in the code but are still commented out since we lack some functionalitites or improvements in the code to handle different scenarios. Most of the logic is still outside of the FSM, but at least now the states are handled in a sane way triggered by events. Change-Id: Idecb43c10d66224d4f9ba9320825040ce6cf9a07 --- tests/sgsn/Makefile.am | 1 + tests/sgsn/sgsn_test.c | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/sgsn/Makefile.am b/tests/sgsn/Makefile.am index 7ba70eb6a..9afe0f704 100644 --- a/tests/sgsn/Makefile.am +++ b/tests/sgsn/Makefile.am @@ -48,6 +48,7 @@ sgsn_test_LDADD = \ $(top_builddir)/src/sgsn/gprs_sndcp.o \ $(top_builddir)/src/sgsn/gprs_gmm_attach.o \ $(top_builddir)/src/sgsn/gprs_gmm.o \ + $(top_builddir)/src/sgsn/gprs_gmm_fsm.o \ $(top_builddir)/src/sgsn/gprs_mm_state_gb_fsm.o \ $(top_builddir)/src/sgsn/gprs_mm_state_iu_fsm.o \ $(top_builddir)/src/sgsn/gprs_sgsn.o \ diff --git a/tests/sgsn/sgsn_test.c b/tests/sgsn/sgsn_test.c index cc25d47ff..7399573fc 100644 --- a/tests/sgsn/sgsn_test.c +++ b/tests/sgsn/sgsn_test.c @@ -28,6 +28,7 @@ #include #include #include +#include #include @@ -192,7 +193,6 @@ static struct sgsn_mm_ctx *alloc_mm_ctx(uint32_t tlli, struct gprs_ra_id *raid) lle = gprs_lle_get_or_create(tlli, 3); ctx = sgsn_mm_ctx_alloc_gb(tlli, raid); - ctx->gmm_state = GMM_REGISTERED_NORMAL; ctx->gb.llme = lle->llme; ictx = sgsn_mm_ctx_by_tlli(tlli, raid); @@ -1286,7 +1286,7 @@ static void test_gmm_cancel(void) ctx = sgsn_mm_ctx_by_tlli(foreign_tlli, &raid); OSMO_ASSERT(ctx != NULL); - OSMO_ASSERT(ctx->gmm_state == GMM_COMMON_PROC_INIT); + OSMO_ASSERT(ctx->gmm_fsm->state == ST_GMM_COMMON_PROC_INIT); /* we expect an identity request (IMEI) */ OSMO_ASSERT(sgsn_tx_counter == 1); @@ -1306,7 +1306,7 @@ static void test_gmm_cancel(void) * authorization */ OSMO_ASSERT(ctx == sgsn_mm_ctx_by_tlli(foreign_tlli, &raid)); - OSMO_ASSERT(ctx->gmm_state == GMM_COMMON_PROC_INIT); + OSMO_ASSERT(ctx->gmm_fsm->state == ST_GMM_COMMON_PROC_INIT); /* we expect an attach accept/reject */ OSMO_ASSERT(sgsn_tx_counter == 1); @@ -1320,7 +1320,7 @@ static void test_gmm_cancel(void) send_0408_message(ctx->gb.llme, foreign_tlli, &raid, attach_compl, ARRAY_SIZE(attach_compl)); - OSMO_ASSERT(ctx->gmm_state == GMM_REGISTERED_NORMAL); + OSMO_ASSERT(ctx->gmm_fsm->state == ST_GMM_REGISTERED_NORMAL); /* we don't expect a response */ OSMO_ASSERT(sgsn_tx_counter == 0); -- cgit v1.2.3