sgsn/test: Add test case for unexpected Detach Accepts

The commit "sgsn: Don't send XID reset after Detach Accept" fixed the
SGSN to not respond to a Detach Accept message when there is no MM
context.

This patch adds a test case to verify, that there is really no
message sent in that case.

The test fails when the commit mentioned aboved is reverted.

Sponsored-by: On-Waves ehf
This commit is contained in:
Jacob Erlbeck 2014-11-24 15:04:15 +01:00 committed by Holger Hans Peter Freyther
parent aec03a1f13
commit de4bbc7146
2 changed files with 36 additions and 0 deletions

View File

@ -256,6 +256,40 @@ static void test_gmm_detach_no_mmctx(void)
OSMO_ASSERT(count(gprs_llme_list()) == 0);
}
/*
* Test that a single GMM Detach Accept message will not cause the SGSN to send
* any message or leave an MM context at the SGSN.
*/
static void test_gmm_detach_accept_unexpected(void)
{
struct gprs_llc_lle *lle;
uint32_t local_tlli;
printf("Testing GMM detach accept (unexpected)\n");
/* DTAP - Detach Accept (MT) */
/* normal detach */
static const unsigned char detach_acc[] = {
0x08, 0x06
};
/* Create an LLME */
OSMO_ASSERT(count(gprs_llme_list()) == 0);
local_tlli = gprs_tmsi2tlli(0x23, TLLI_LOCAL);
lle = gprs_lle_get_or_create(local_tlli, 3);
/* inject the detach */
send_0408_message(lle->llme, local_tlli,
detach_acc, ARRAY_SIZE(detach_acc));
/* verify that no message (and therefore no Status or XID reset) has been
* sent by the SGSN */
OSMO_ASSERT(sgsn_tx_counter == 0);
/* verify that things are gone */
OSMO_ASSERT(count(gprs_llme_list()) == 0);
}
/*
* Test that a GMM Status will remove the associated LLME if there is no MMCTX.
*/
@ -812,6 +846,7 @@ int main(int argc, char **argv)
test_gmm_detach();
test_gmm_detach_power_off();
test_gmm_detach_no_mmctx();
test_gmm_detach_accept_unexpected();
test_gmm_status_no_mmctx();
test_gmm_attach();
test_gmm_reject();

View File

@ -2,6 +2,7 @@ Testing LLME allocations
Testing GMM detach
Testing GMM detach (power off)
Testing GMM detach (no MMCTX)
Testing GMM detach accept (unexpected)
Testing GMM Status (no MMCTX)
Testing GMM attach
Testing GMM reject