diff options
author | Jacob Erlbeck <jerlbeck@sysmocom.de> | 2015-01-29 14:12:29 +0100 |
---|---|---|
committer | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2015-01-30 21:28:17 +0100 |
commit | 466cedd052427254d5f90b4bd02795129b2c60a4 (patch) | |
tree | 73abe4feca0a516e549192923e1918586a1df23c | |
parent | 07f6e36ab42380f9a4c1af058c3021cb0e945dc4 (diff) |
sgsn/test: Add tests for PurgeMs responses
Currently there are not any test cases for PurgeMS GSUP messages in
test_subscriber_gsup.
This commit adds tests for incoming PurgeMSResult and -Error
messages.
Sponsored-by: On-Waves ehf
-rw-r--r-- | openbsc/tests/sgsn/sgsn_test.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/openbsc/tests/sgsn/sgsn_test.c b/openbsc/tests/sgsn/sgsn_test.c index 733380a59..25e031014 100644 --- a/openbsc/tests/sgsn/sgsn_test.c +++ b/openbsc/tests/sgsn/sgsn_test.c @@ -445,6 +445,19 @@ static void test_subscriber_gsup(void) 0x06, 0x01, 0x00, }; + static const uint8_t purge_ms_err[] = { + 0x0d, + TEST_GSUP_IMSI1_IE, + 0x02, 0x01, 0x02, /* IMSI unknown in HLR */ + }; + + static const uint8_t purge_ms_res[] = { + 0x0e, + TEST_GSUP_IMSI1_IE, + 0x07, 0x00, + }; + + static const uint8_t insert_data_req[] = { 0x10, TEST_GSUP_IMSI1_IE, @@ -507,6 +520,7 @@ static void test_subscriber_gsup(void) rc = rx_gsup_message(update_location_res, sizeof(update_location_res)); OSMO_ASSERT(rc >= 0); OSMO_ASSERT(last_updated_subscr == s1); + OSMO_ASSERT(s1->flags & GPRS_SUBSCRIBER_ENABLE_PURGE); /* Check authorization */ OSMO_ASSERT(s1->authorized == 1); @@ -552,12 +566,28 @@ static void test_subscriber_gsup(void) OSMO_ASSERT(s1->flags & GPRS_SUBSCRIBER_CANCELLED); OSMO_ASSERT(s1->sgsn_data->mm == NULL); + /* Inject PurgeMsRes GSUP message */ + rc = rx_gsup_message(purge_ms_res, + sizeof(purge_ms_res)); + OSMO_ASSERT(rc >= 0); + OSMO_ASSERT(!(s1->flags & GPRS_SUBSCRIBER_ENABLE_PURGE)); + /* Free MM context and subscriber */ subscr_put(s1); s1found = gprs_subscr_get_by_imsi(imsi1); OSMO_ASSERT(s1found == NULL); gprs_llgmm_assign(llme, local_tlli, 0xffffffff, GPRS_ALGO_GEA0, NULL); + /* Inject PurgeMsRes GSUP message */ + rc = rx_gsup_message(purge_ms_res, + sizeof(purge_ms_res)); + OSMO_ASSERT(rc >= 0); + + /* Inject PurgeMsErr(IMSI unknown in HLR) GSUP message */ + rc = rx_gsup_message(purge_ms_err, + sizeof(purge_ms_err)); + OSMO_ASSERT(rc == -GMM_CAUSE_IMSI_UNKNOWN); + /* Inject InsertSubscrData GSUP message (unknown IMSI) */ last_updated_subscr = NULL; rc = rx_gsup_message(insert_data_req, sizeof(insert_data_req)); |