aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2015-12-30 12:27:11 +0100
committerJacob Erlbeck <jerlbeck@sysmocom.de>2015-12-30 12:27:11 +0100
commitf2e9e0d64e14528ac8f7597a88e19d41e5b44add (patch)
tree559e5f66821247b8ec39ef129df33f7cb20b5ca4
parenteaf8beda440f957258458e3f39c65a89ed415746 (diff)
sgsn/test: Add bssgp_raid parameter to send_0408_message (TODO)
Sponsored-by: On-Waves ehf
-rw-r--r--openbsc/tests/sgsn/sgsn_test.c55
1 files changed, 30 insertions, 25 deletions
diff --git a/openbsc/tests/sgsn/sgsn_test.c b/openbsc/tests/sgsn/sgsn_test.c
index a8690474b..f64f74c4a 100644
--- a/openbsc/tests/sgsn/sgsn_test.c
+++ b/openbsc/tests/sgsn/sgsn_test.c
@@ -186,6 +186,7 @@ static struct sgsn_mm_ctx *alloc_mm_ctx(uint32_t tlli, struct gprs_ra_id *raid)
}
static void send_0408_message(struct gprs_llc_llme *llme, uint32_t tlli,
+ const struct gprs_ra_id *bssgp_raid,
const uint8_t *data, size_t data_len)
{
struct msgb *msg;
@@ -195,6 +196,7 @@ static void send_0408_message(struct gprs_llc_llme *llme, uint32_t tlli,
msg = create_msg(data, data_len);
msgb_tlli(msg) = tlli;
+ bssgp_create_cell_id(msgb_bcid(msg), bssgp_raid, 0);
gsm0408_gprs_rcvmsg(msg, llme);
msgb_free(msg);
}
@@ -730,7 +732,7 @@ static void test_gmm_detach(void)
ctx = alloc_mm_ctx(local_tlli, &raid);
/* inject the detach */
- send_0408_message(ctx->llme, local_tlli,
+ send_0408_message(ctx->llme, local_tlli, &raid,
detach_req, ARRAY_SIZE(detach_req));
/* verify that a single message (hopefully the Detach Accept) has been
@@ -771,7 +773,7 @@ static void test_gmm_detach_power_off(void)
ctx = alloc_mm_ctx(local_tlli, &raid);
/* inject the detach */
- send_0408_message(ctx->llme, local_tlli,
+ send_0408_message(ctx->llme, local_tlli, &raid,
detach_req, ARRAY_SIZE(detach_req));
/* verify that no message (and therefore no Detach Accept) has been
@@ -791,6 +793,7 @@ static void test_gmm_detach_power_off(void)
*/
static void test_gmm_detach_no_mmctx(void)
{
+ struct gprs_ra_id raid = { 0, };
struct gprs_llc_lle *lle;
uint32_t local_tlli;
@@ -811,7 +814,7 @@ static void test_gmm_detach_no_mmctx(void)
OSMO_ASSERT(count(gprs_llme_list()) == 1);
/* inject the detach */
- send_0408_message(lle->llme, local_tlli,
+ send_0408_message(lle->llme, local_tlli, &raid,
detach_req, ARRAY_SIZE(detach_req));
/* verify that the LLME is gone */
@@ -826,6 +829,7 @@ static void test_gmm_detach_no_mmctx(void)
*/
static void test_gmm_detach_accept_unexpected(void)
{
+ struct gprs_ra_id raid = { 0, };
struct gprs_llc_lle *lle;
uint32_t local_tlli;
@@ -843,7 +847,7 @@ static void test_gmm_detach_accept_unexpected(void)
lle = gprs_lle_get_or_create(local_tlli, 3);
/* inject the detach */
- send_0408_message(lle->llme, local_tlli,
+ send_0408_message(lle->llme, local_tlli, &raid,
detach_acc, ARRAY_SIZE(detach_acc));
/* verify that no message (and therefore no Status or XID reset) has been
@@ -861,6 +865,7 @@ static void test_gmm_detach_accept_unexpected(void)
*/
static void test_gmm_status_no_mmctx(void)
{
+ struct gprs_ra_id raid = { 0, };
struct gprs_llc_lle *lle;
uint32_t local_tlli;
@@ -879,7 +884,7 @@ static void test_gmm_status_no_mmctx(void)
OSMO_ASSERT(count(gprs_llme_list()) == 1);
/* inject the detach */
- send_0408_message(lle->llme, local_tlli,
+ send_0408_message(lle->llme, local_tlli, &raid,
gmm_status, ARRAY_SIZE(gmm_status));
/* verify that no message has been sent by the SGSN */
@@ -954,7 +959,7 @@ static void test_gmm_attach(int retry)
OSMO_ASSERT(count(gprs_llme_list()) == 1);
/* inject the attach request */
- send_0408_message(lle->llme, foreign_tlli,
+ send_0408_message(lle->llme, foreign_tlli, &raid,
attach_req, ARRAY_SIZE(attach_req));
ctx = sgsn_mm_ctx_by_tlli(foreign_tlli, &raid);
@@ -965,14 +970,14 @@ static void test_gmm_attach(int retry)
OSMO_ASSERT(sgsn_tx_counter == 1);
/* inject the identity response (IMEI) */
- send_0408_message(ctx->llme, foreign_tlli,
+ send_0408_message(ctx->llme, foreign_tlli, &raid,
ident_resp_imei, ARRAY_SIZE(ident_resp_imei));
/* we expect an identity request (IMSI) */
OSMO_ASSERT(sgsn_tx_counter == 1);
/* inject the identity response (IMSI) */
- send_0408_message(ctx->llme, foreign_tlli,
+ send_0408_message(ctx->llme, foreign_tlli, &raid,
ident_resp_imsi, ARRAY_SIZE(ident_resp_imsi));
/* check that the MM context has not been removed due to a failed
@@ -986,7 +991,7 @@ retry_attach_req:
if (retry && sgsn_tx_counter == 0) {
fprintf(stderr, "Retrying attach request\n");
/* re-inject the attach request */
- send_0408_message(lle->llme, foreign_tlli,
+ send_0408_message(lle->llme, foreign_tlli, &raid,
attach_req, ARRAY_SIZE(attach_req));
}
@@ -994,7 +999,7 @@ retry_attach_req:
/* we got an auth & ciph request */
/* inject the auth & ciph response */
- send_0408_message(ctx->llme, foreign_tlli,
+ send_0408_message(ctx->llme, foreign_tlli, &raid,
auth_ciph_resp, ARRAY_SIZE(auth_ciph_resp));
/* check that the MM context has not been removed due to a
@@ -1016,7 +1021,7 @@ retry_attach_req:
local_tlli = gprs_tmsi2tlli(ptmsi1, TLLI_LOCAL);
/* inject the attach complete */
- send_0408_message(ctx->llme, local_tlli,
+ send_0408_message(ctx->llme, local_tlli, &raid,
attach_compl, ARRAY_SIZE(attach_compl));
OSMO_ASSERT(ctx->mm_state == GMM_REGISTERED_NORMAL);
@@ -1025,7 +1030,7 @@ retry_attach_req:
OSMO_ASSERT(sgsn_tx_counter == 0);
/* inject the detach */
- send_0408_message(ctx->llme, local_tlli,
+ send_0408_message(ctx->llme, local_tlli, &raid,
detach_req, ARRAY_SIZE(detach_req));
/* verify that things are gone */
@@ -1472,7 +1477,7 @@ static void test_gmm_reject(void)
OSMO_ASSERT(count(gprs_llme_list()) == 1);
/* Inject the Request message */
- send_0408_message(lle->llme, foreign_tlli,
+ send_0408_message(lle->llme, foreign_tlli, &raid,
test->msg, test->msg_len);
/* We expect a Reject message */
@@ -1542,7 +1547,7 @@ static void test_gmm_cancel(void)
OSMO_ASSERT(count(gprs_llme_list()) == 1);
/* inject the attach request */
- send_0408_message(lle->llme, foreign_tlli,
+ send_0408_message(lle->llme, foreign_tlli, &raid,
attach_req, ARRAY_SIZE(attach_req));
ctx = sgsn_mm_ctx_by_tlli(foreign_tlli, &raid);
@@ -1553,14 +1558,14 @@ static void test_gmm_cancel(void)
OSMO_ASSERT(sgsn_tx_counter == 1);
/* inject the identity response (IMEI) */
- send_0408_message(ctx->llme, foreign_tlli,
+ send_0408_message(ctx->llme, foreign_tlli, &raid,
ident_resp_imei, ARRAY_SIZE(ident_resp_imei));
/* we expect an identity request (IMSI) */
OSMO_ASSERT(sgsn_tx_counter == 1);
/* inject the identity response (IMSI) */
- send_0408_message(ctx->llme, foreign_tlli,
+ send_0408_message(ctx->llme, foreign_tlli, &raid,
ident_resp_imsi, ARRAY_SIZE(ident_resp_imsi));
/* check that the MM context has not been removed due to a failed
@@ -1578,7 +1583,7 @@ static void test_gmm_cancel(void)
local_tlli = gprs_tmsi2tlli(ptmsi1, TLLI_LOCAL);
/* inject the attach complete */
- send_0408_message(ctx->llme, local_tlli,
+ send_0408_message(ctx->llme, local_tlli, &raid,
attach_compl, ARRAY_SIZE(attach_compl));
OSMO_ASSERT(ctx->mm_state == GMM_REGISTERED_NORMAL);
@@ -1690,7 +1695,7 @@ static void test_gmm_ptmsi_allocation(void)
OSMO_ASSERT(count(gprs_llme_list()) == 1);
/* inject the attach request */
- send_0408_message(lle->llme, foreign_tlli,
+ send_0408_message(lle->llme, foreign_tlli, &raid,
attach_req, ARRAY_SIZE(attach_req));
ctx = sgsn_mm_ctx_by_tlli(foreign_tlli, &raid);
@@ -1705,7 +1710,7 @@ static void test_gmm_ptmsi_allocation(void)
OSMO_ASSERT(sgsn_tx_counter == 1);
/* inject the identity response (IMEI) */
- send_0408_message(ctx->llme, foreign_tlli,
+ send_0408_message(ctx->llme, foreign_tlli, &raid,
ident_resp_imei, ARRAY_SIZE(ident_resp_imei));
/* check that the MM context has not been removed due to a failed
@@ -1721,7 +1726,7 @@ static void test_gmm_ptmsi_allocation(void)
OSMO_ASSERT(received_ptmsi == ptmsi1);
/* we ignore this and send the attach again */
- send_0408_message(lle->llme, foreign_tlli,
+ send_0408_message(lle->llme, foreign_tlli, &raid,
attach_req, ARRAY_SIZE(attach_req));
/* the allocated P-TMSI should be the same */
@@ -1738,7 +1743,7 @@ static void test_gmm_ptmsi_allocation(void)
/* inject the attach complete */
local_tlli = gprs_tmsi2tlli(ptmsi1, TLLI_LOCAL);
- send_0408_message(ctx->llme, local_tlli,
+ send_0408_message(ctx->llme, local_tlli, &raid,
attach_compl, ARRAY_SIZE(attach_compl));
/* we don't expect a response */
@@ -1751,7 +1756,7 @@ static void test_gmm_ptmsi_allocation(void)
printf(" - Repeated RA Update Request\n");
/* inject the RA update request */
- send_0408_message(ctx->llme, local_tlli,
+ send_0408_message(ctx->llme, local_tlli, &raid,
ra_upd_req, ARRAY_SIZE(ra_upd_req));
/* we expect an RA update accept */
@@ -1764,7 +1769,7 @@ static void test_gmm_ptmsi_allocation(void)
ptmsi2 = ctx->p_tmsi;
/* repeat the RA update request */
- send_0408_message(ctx->llme, local_tlli,
+ send_0408_message(ctx->llme, local_tlli, &raid,
ra_upd_req, ARRAY_SIZE(ra_upd_req));
/* we expect an RA update accept */
@@ -1778,7 +1783,7 @@ static void test_gmm_ptmsi_allocation(void)
/* inject the RA update complete */
local_tlli = gprs_tmsi2tlli(ptmsi2, TLLI_LOCAL);
- send_0408_message(ctx->llme, local_tlli,
+ send_0408_message(ctx->llme, local_tlli, &raid,
ra_upd_complete, ARRAY_SIZE(ra_upd_complete));
/* we don't expect a response */
@@ -1789,7 +1794,7 @@ static void test_gmm_ptmsi_allocation(void)
OSMO_ASSERT(ctx->p_tmsi == ptmsi2);
/* inject the detach */
- send_0408_message(ctx->llme, local_tlli,
+ send_0408_message(ctx->llme, local_tlli, &raid,
detach_req, ARRAY_SIZE(detach_req));
/* verify that things are gone */