aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2019-09-02 16:45:27 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2019-09-03 15:22:12 +0200
commit31c4657c971e40407163034526aafeb9b5a83460 (patch)
tree3f034b28108531fdbc6c1911b12c4572690b96a2 /tests
parent2e91fee1ad5c69f9336716b57979eb7557251778 (diff)
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
Diffstat (limited to 'tests')
-rw-r--r--tests/sgsn/Makefile.am1
-rw-r--r--tests/sgsn/sgsn_test.c8
2 files changed, 5 insertions, 4 deletions
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 <osmocom/gsupclient/gsup_client.h>
#include <osmocom/sgsn/gprs_utils.h>
#include <osmocom/sgsn/gprs_gb_parse.h>
+#include <osmocom/sgsn/gprs_gmm_fsm.h>
#include <osmocom/gprs/gprs_bssgp.h>
@@ -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);