[PATCH] osmo-msc[master]: VLR tests: add simple LU generator

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Max gerrit-no-reply at lists.osmocom.org
Thu Feb 15 16:32:36 UTC 2018


VLR tests: add simple LU generator

Generate LU REQ using function instead of hardcoded hex strings.

Change-Id: Iab8b07b3276b6f6ac0387df14abb98355ea0e99a
Related: OS#2864
---
M tests/msc_vlr/msc_vlr_test_gsm_authen.c
M tests/msc_vlr/msc_vlr_test_gsm_ciph.c
M tests/msc_vlr/msc_vlr_test_hlr_reject.c
M tests/msc_vlr/msc_vlr_test_hlr_timeout.c
M tests/msc_vlr/msc_vlr_test_ms_timeout.c
M tests/msc_vlr/msc_vlr_test_no_authen.c
M tests/msc_vlr/msc_vlr_test_reject_concurrency.c
M tests/msc_vlr/msc_vlr_test_rest.c
M tests/msc_vlr/msc_vlr_tests.c
M tests/msc_vlr/msc_vlr_tests.h
10 files changed, 208 insertions(+), 65 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/84/6484/2

diff --git a/tests/msc_vlr/msc_vlr_test_gsm_authen.c b/tests/msc_vlr/msc_vlr_test_gsm_authen.c
index 660a38b..6464575 100644
--- a/tests/msc_vlr/msc_vlr_test_gsm_authen.c
+++ b/tests/msc_vlr/msc_vlr_test_gsm_authen.c
@@ -34,7 +34,9 @@
 	btw("Location Update request causes a GSUP Send Auth Info request to HLR");
 	lu_result_sent = RES_NONE;
 	gsup_expect_tx("08010809710000004026f0");
-	ms_sends_msg("050802008168000130089910070000006402");
+
+	tx_loc_upd_imsi(imsi);
+
 	OSMO_ASSERT(gsup_tx_confirmed);
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
@@ -224,7 +226,8 @@
 	btw("Location Update request causes a GSUP Send Auth Info request to HLR");
 	lu_result_sent = RES_NONE;
 	gsup_expect_tx("08010809710000004026f0");
-	ms_sends_msg("050802008168000130089910070000006402");
+	tx_loc_upd_imsi(imsi);
+
 	OSMO_ASSERT(gsup_tx_confirmed);
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
@@ -431,7 +434,9 @@
 	lu_result_sent = RES_NONE;
 	auth_request_sent = false;
 	auth_request_expect_rand = "fa8f20b781b5881329d4fea26b1a3c51";
-	ms_sends_msg("050802008168000130" "05f4" "03020100");
+
+	tx_loc_upd_tmsi(0x03020100);
+
 	VERBOSE_ASSERT(auth_request_sent, == true, "%d");
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
@@ -500,7 +505,8 @@
 	btw("Location Update request causes a GSUP Send Auth Info request to HLR");
 	lu_result_sent = RES_NONE;
 	gsup_expect_tx("08010809710000004026f0");
-	ms_sends_msg("050802008168000130089910070000006402");
+	tx_loc_upd_imsi(imsi);
+
 	OSMO_ASSERT(gsup_tx_confirmed);
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
@@ -596,7 +602,9 @@
 	btw("Location Update request causes a GSUP Send Auth Info request to HLR");
 	lu_result_sent = RES_NONE;
 	gsup_expect_tx("08010809710000004026f0");
-	ms_sends_msg("050802008168000130089910070000006402");
+
+	tx_loc_upd_imsi(imsi);
+
 	OSMO_ASSERT(gsup_tx_confirmed);
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
@@ -711,13 +719,14 @@
 	btw("Location Update request causes a GSUP Send Auth Info request to HLR");
 	lu_result_sent = RES_NONE;
 	gsup_expect_tx("080108" "09710000000156f0");
-	ms_sends_msg("0508" /* MM LU */
-		     "7" /* ciph key seq: no key available */
-		     "0" /* LU type: normal */
-		     "ffffff" "0000" /* LAI, LAC */
-		     "30" /* classmark 1: GSM phase 2 */
-		     "089910070000106005" /* IMSI */
-		     );
+
+	tx_loc_upd_req(imsi,
+		       0 /* LU type: normal */,
+		       1 /* Revision level: GSM */,
+		       true, true, 0,
+		       0xFFF /* MCC */, 0xFF /* MNC */,
+		       0, 7 /* ciph key seq: no key available */, 0);
+
 	OSMO_ASSERT(gsup_tx_confirmed);
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
diff --git a/tests/msc_vlr/msc_vlr_test_gsm_ciph.c b/tests/msc_vlr/msc_vlr_test_gsm_ciph.c
index 09c8369..17783a4 100644
--- a/tests/msc_vlr/msc_vlr_test_gsm_ciph.c
+++ b/tests/msc_vlr/msc_vlr_test_gsm_ciph.c
@@ -35,7 +35,8 @@
 	btw("Location Update request causes a GSUP Send Auth Info request to HLR");
 	lu_result_sent = RES_NONE;
 	gsup_expect_tx("08010809710000004026f0");
-	ms_sends_msg("050802008168000130089910070000006402");
+	tx_loc_upd_imsi(imsi);
+
 	OSMO_ASSERT(gsup_tx_confirmed);
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
@@ -247,7 +248,8 @@
 	btw("Location Update request causes a GSUP Send Auth Info request to HLR");
 	lu_result_sent = RES_NONE;
 	gsup_expect_tx("08010809710000004026f0");
-	ms_sends_msg("050802008168000130089910070000006402");
+	tx_loc_upd_imsi(imsi);
+
 	OSMO_ASSERT(gsup_tx_confirmed);
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
@@ -485,7 +487,9 @@
 	btw("Location Update request causes a GSUP Send Auth Info request to HLR");
 	lu_result_sent = RES_NONE;
 	gsup_expect_tx("08010809710000004026f0");
-	ms_sends_msg("050802008168000130089910070000006402");
+
+	tx_loc_upd_imsi(imsi);
+
 	OSMO_ASSERT(gsup_tx_confirmed);
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
@@ -586,7 +590,9 @@
 	btw("Location Update request causes a GSUP Send Auth Info request to HLR");
 	lu_result_sent = RES_NONE;
 	gsup_expect_tx("08010809710000004026f0");
-	ms_sends_msg("050802008168000130089910070000006402");
+
+	tx_loc_upd_imsi(imsi);
+
 	OSMO_ASSERT(gsup_tx_confirmed);
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
@@ -684,7 +690,9 @@
 	btw("Location Update request causes a GSUP Send Auth Info request to HLR");
 	lu_result_sent = RES_NONE;
 	gsup_expect_tx("08010809710000004026f0");
-	ms_sends_msg("050802008168000130089910070000006402");
+
+	tx_loc_upd_imsi(imsi);
+
 	OSMO_ASSERT(gsup_tx_confirmed);
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
@@ -796,7 +804,9 @@
 	btw("Location Update request with unknown TMSI sends ID Request for IMSI");
 	lu_result_sent = RES_NONE;
 	dtap_expect_tx("051801");
-	ms_sends_msg("050802008168000130" "05f4" "23422342");
+
+	tx_loc_upd_tmsi(0x23422342);
+
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
 	EXPECT_ACCEPTED(false);
diff --git a/tests/msc_vlr/msc_vlr_test_hlr_reject.c b/tests/msc_vlr/msc_vlr_test_hlr_reject.c
index 2d9b863..9a1f956 100644
--- a/tests/msc_vlr/msc_vlr_test_hlr_reject.c
+++ b/tests/msc_vlr/msc_vlr_test_hlr_reject.c
@@ -32,7 +32,9 @@
 	btw("Location Update request causes a GSUP Send Auth Info request to HLR");
 	lu_result_sent = RES_NONE;
 	gsup_expect_tx("08010809710000004026f0");
-	ms_sends_msg("050802008168000130089910070000006402");
+
+	tx_loc_upd_imsi(imsi);
+
 	OSMO_ASSERT(gsup_tx_confirmed);
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
@@ -58,7 +60,9 @@
 	btw("Location Update request causes a GSUP Send Auth Info request to HLR");
 	lu_result_sent = RES_NONE;
 	gsup_expect_tx("08010809710000004026f0");
-	ms_sends_msg("050802008168000130089910070000006402");
+
+	tx_loc_upd_imsi(imsi);
+
 	OSMO_ASSERT(gsup_tx_confirmed);
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
@@ -89,7 +93,9 @@
 	btw("Location Update request causes a GSUP Send Auth Info request to HLR");
 	lu_result_sent = RES_NONE;
 	gsup_expect_tx("08010809710000004026f0");
-	ms_sends_msg("050802008168000130089910070000006402");
+
+	tx_loc_upd_imsi(imsi);
+
 	OSMO_ASSERT(gsup_tx_confirmed);
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
@@ -144,7 +150,9 @@
 	btw("Location Update request causes a GSUP Send Auth Info request to HLR");
 	lu_result_sent = RES_NONE;
 	gsup_expect_tx("08010809710000004026f0");
-	ms_sends_msg("050802008168000130089910070000006402");
+
+	tx_loc_upd_imsi(imsi);
+
 	OSMO_ASSERT(gsup_tx_confirmed);
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
@@ -175,7 +183,9 @@
 	btw("Location Update request causes a GSUP Send Auth Info request to HLR");
 	lu_result_sent = RES_NONE;
 	gsup_expect_tx("08010809710000004026f0");
-	ms_sends_msg("050802008168000130089910070000006402");
+
+	tx_loc_upd_imsi(imsi);
+
 	OSMO_ASSERT(gsup_tx_confirmed);
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
@@ -231,7 +241,9 @@
 	btw("Location Update request causes a GSUP Send Auth Info request to HLR");
 	lu_result_sent = RES_NONE;
 	gsup_expect_tx("08010809710000004026f0");
-	ms_sends_msg("050802008168000130089910070000006402");
+
+	tx_loc_upd_imsi(imsi);
+
 	OSMO_ASSERT(gsup_tx_confirmed);
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
@@ -259,7 +271,9 @@
 	btw("Location Update request causes a GSUP Send Auth Info request to HLR");
 	lu_result_sent = RES_NONE;
 	gsup_expect_tx("08010809710000004026f0");
-	ms_sends_msg("050802008168000130089910070000006402");
+
+	tx_loc_upd_imsi(imsi);
+
 	OSMO_ASSERT(gsup_tx_confirmed);
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
@@ -294,7 +308,9 @@
 	btw("Location Update request causes a GSUP Send Auth Info request to HLR");
 	lu_result_sent = RES_NONE;
 	gsup_expect_tx("08010809710000004026f0");
-	ms_sends_msg("050802008168000130089910070000006402");
+
+	tx_loc_upd_imsi(imsi);
+
 	OSMO_ASSERT(gsup_tx_confirmed);
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
@@ -349,7 +365,9 @@
 	btw("Location Update request causes a GSUP Send Auth Info request to HLR");
 	lu_result_sent = RES_NONE;
 	gsup_expect_tx("08010809710000004026f0");
-	ms_sends_msg("050802008168000130089910070000006402");
+
+	tx_loc_upd_imsi(imsi);
+
 	OSMO_ASSERT(gsup_tx_confirmed);
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
@@ -389,7 +407,9 @@
 	btw("Location Update request causes a GSUP LU request to HLR");
 	lu_result_sent = RES_NONE;
 	gsup_expect_tx("04010809710000004026f0");
-	ms_sends_msg("050802008168000130089910070000006402");
+
+	tx_loc_upd_imsi(imsi);
+
 	OSMO_ASSERT(gsup_tx_confirmed);
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
@@ -412,7 +432,9 @@
 	btw("Location Update request causes a GSUP LU request to HLR");
 	lu_result_sent = RES_NONE;
 	gsup_expect_tx("04010809710000004026f0");
-	ms_sends_msg("050802008168000130089910070000006402");
+
+	tx_loc_upd_imsi(imsi);
+
 	OSMO_ASSERT(gsup_tx_confirmed);
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
diff --git a/tests/msc_vlr/msc_vlr_test_hlr_timeout.c b/tests/msc_vlr/msc_vlr_test_hlr_timeout.c
index 4dc453b..ef74952 100644
--- a/tests/msc_vlr/msc_vlr_test_hlr_timeout.c
+++ b/tests/msc_vlr/msc_vlr_test_hlr_timeout.c
@@ -36,7 +36,9 @@
 	btw("Location Update request causes a GSUP Send Auth Info request to HLR");
 	lu_result_sent = RES_NONE;
 	gsup_expect_tx("08010809710000004026f0");
-	ms_sends_msg("050802008168000130089910070000006402");
+
+	tx_loc_upd_imsi(imsi);
+
 	OSMO_ASSERT(gsup_tx_confirmed);
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
@@ -73,7 +75,9 @@
 	btw("Location Update request causes a GSUP LU request to HLR");
 	lu_result_sent = RES_NONE;
 	gsup_expect_tx("04010809710000004026f0");
-	ms_sends_msg("050802008168000130089910070000006402");
+
+	tx_loc_upd_imsi(imsi);
+
 	OSMO_ASSERT(gsup_tx_confirmed);
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
diff --git a/tests/msc_vlr/msc_vlr_test_ms_timeout.c b/tests/msc_vlr/msc_vlr_test_ms_timeout.c
index 569bbf5..0979f33 100644
--- a/tests/msc_vlr/msc_vlr_test_ms_timeout.c
+++ b/tests/msc_vlr/msc_vlr_test_ms_timeout.c
@@ -34,7 +34,9 @@
 	btw("Location Update request causes a GSUP Send Auth Info request to HLR");
 	lu_result_sent = RES_NONE;
 	gsup_expect_tx("08010809710000004026f0");
-	ms_sends_msg("050802008168000130089910070000006402");
+
+	tx_loc_upd_imsi(imsi);
+
 	OSMO_ASSERT(gsup_tx_confirmed);
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
@@ -94,7 +96,9 @@
 	btw("Location Update request causes a GSUP Send Auth Info request to HLR");
 	lu_result_sent = RES_NONE;
 	gsup_expect_tx("08010809710000004026f0");
-	ms_sends_msg("050802008168000130089910070000006402");
+
+	tx_loc_upd_imsi(imsi);
+
 	OSMO_ASSERT(gsup_tx_confirmed);
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
@@ -195,7 +199,9 @@
 	btw("Location Update request causes a GSUP LU request to HLR");
 	lu_result_sent = RES_NONE;
 	gsup_expect_tx("04010809710000004026f0");
-	ms_sends_msg("050802008168000130089910070000006402");
+
+	tx_loc_upd_imsi(imsi);
+
 	OSMO_ASSERT(gsup_tx_confirmed);
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
diff --git a/tests/msc_vlr/msc_vlr_test_no_authen.c b/tests/msc_vlr/msc_vlr_test_no_authen.c
index 55c14cd..daa1ddb 100644
--- a/tests/msc_vlr/msc_vlr_test_no_authen.c
+++ b/tests/msc_vlr/msc_vlr_test_no_authen.c
@@ -35,7 +35,9 @@
 	btw("Location Update request causes a GSUP LU request to HLR");
 	lu_result_sent = RES_NONE;
 	gsup_expect_tx("04010809710000004026f0");
-	ms_sends_msg("050802008168000130089910070000006402");
+
+	tx_loc_upd_imsi(imsi);
+
 	OSMO_ASSERT(gsup_tx_confirmed);
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
@@ -174,7 +176,9 @@
 	btw("Location Update request causes a GSUP LU request to HLR");
 	lu_result_sent = RES_NONE;
 	gsup_expect_tx("04010809710000004026f0");
-	ms_sends_msg("050802008168000130089910070000006402");
+
+	tx_loc_upd_imsi(imsi);
+
 	OSMO_ASSERT(gsup_tx_confirmed);
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
@@ -323,7 +327,9 @@
 	btw("Location Update request causes a GSUP LU request to HLR");
 	lu_result_sent = RES_NONE;
 	gsup_expect_tx("04010809710000004026f0");
-	ms_sends_msg("050802008168000130" "05f4" "03020100");
+
+	tx_loc_upd_tmsi(0x03020100);
+
 	OSMO_ASSERT(gsup_tx_confirmed);
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
@@ -393,7 +399,9 @@
 	btw("Location Update request causes a GSUP LU request to HLR");
 	lu_result_sent = RES_NONE;
 	gsup_expect_tx("04010809710000004026f0");
-	ms_sends_msg("050802008168000130089910070000006402");
+
+	tx_loc_upd_imsi(imsi);
+
 	OSMO_ASSERT(gsup_tx_confirmed);
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
@@ -461,7 +469,9 @@
 	btw("Location Update request causes a GSUP LU request to HLR");
 	lu_result_sent = RES_NONE;
 	gsup_expect_tx("04010809710000004026f0");
-	ms_sends_msg("050802008168000130089910070000006402");
+
+	tx_loc_upd_imsi(imsi);
+
 	OSMO_ASSERT(gsup_tx_confirmed);
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
@@ -537,7 +547,9 @@
 	btw("Location Update request causes an IMEISV ID request back to the MS");
 	lu_result_sent = RES_NONE;
 	dtap_expect_tx("051803");
-	ms_sends_msg("050802008168000130089910070000006402");
+
+	tx_loc_upd_imsi(imsi);
+
 	OSMO_ASSERT(dtap_tx_confirmed);
 
 	btw("MS replies with an Identity Response, causes LU to commence with a GSUP LU request to HLR");
@@ -597,7 +609,9 @@
 	btw("Location Update request causes an IMEISV ID request back to the MS");
 	lu_result_sent = RES_NONE;
 	dtap_expect_tx("051803");
-	ms_sends_msg("050802008168000130089910070000006402");
+
+	tx_loc_upd_imsi(imsi);
+
 	OSMO_ASSERT(dtap_tx_confirmed);
 
 	btw("MS replies with an Identity Response, causes LU to commence with a GSUP LU request to HLR");
@@ -674,7 +688,9 @@
 	btw("Location Update request causes an IMEISV ID request back to the MS");
 	lu_result_sent = RES_NONE;
 	dtap_expect_tx("051803");
-	ms_sends_msg("050802008168000130089910070000006402");
+
+	tx_loc_upd_imsi(imsi);
+
 	OSMO_ASSERT(dtap_tx_confirmed);
 
 	btw("MS replies with an Identity Response, causes LU to commence with a GSUP LU request to HLR");
@@ -729,7 +745,9 @@
 	btw("Location Update request causes an IMEISV ID request back to the MS");
 	lu_result_sent = RES_NONE;
 	dtap_expect_tx("051803");
-	ms_sends_msg("050802008168000130089910070000006402");
+
+	tx_loc_upd_imsi(imsi);
+
 	OSMO_ASSERT(dtap_tx_confirmed);
 
 	btw("MS replies with an Identity Response, causes LU to commence with a GSUP LU request to HLR");
@@ -812,7 +830,9 @@
 	btw("Location Update request causes an IMEISV ID request back to the MS");
 	lu_result_sent = RES_NONE;
 	dtap_expect_tx("051803");
-	ms_sends_msg("050802008168000130089910070000006402");
+
+	tx_loc_upd_imsi(imsi);
+
 	OSMO_ASSERT(dtap_tx_confirmed);
 
 	btw("MS replies with an Identity Response, causes LU to commence with a GSUP LU request to HLR");
diff --git a/tests/msc_vlr/msc_vlr_test_reject_concurrency.c b/tests/msc_vlr/msc_vlr_test_reject_concurrency.c
index c7af200..f053eff 100644
--- a/tests/msc_vlr/msc_vlr_test_reject_concurrency.c
+++ b/tests/msc_vlr/msc_vlr_test_reject_concurrency.c
@@ -31,7 +31,9 @@
 	btw("Location Update Request on one connection");
 	lu_result_sent = RES_NONE;
 	gsup_expect_tx("04010809710000004026f0");
-	ms_sends_msg("050802008168000130089910070000006402");
+
+	tx_loc_upd_imsi(imsi);
+
 	OSMO_ASSERT(gsup_tx_confirmed);
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 	EXPECT_CONN_COUNT(1);
@@ -40,7 +42,9 @@
 	conn1 = g_conn;
 	g_conn = NULL;
 	expect_bssap_clear();
-	ms_sends_msg("050802008168000130089910070000006402");
+
+	tx_loc_upd_imsi(imsi);
+
 	VERBOSE_ASSERT(bssap_clear_sent, == true, "%d");
 	VERBOSE_ASSERT(lu_result_sent, == RES_REJECT, "%d");
 	EXPECT_CONN_COUNT(1);
@@ -67,12 +71,14 @@
 	comment_end(nr, imsi);
 }
 
-void _normal_lu_part1()
+static inline void _normal_lu_part1(const char *imsi)
 {
 	btw("Location Update Request");
 	lu_result_sent = RES_NONE;
 	gsup_expect_tx("04010809710000004026f0");
-	ms_sends_msg("050802008168000130089910070000006402");
+
+	tx_loc_upd_imsi(imsi);
+
 	OSMO_ASSERT(gsup_tx_confirmed);
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 	EXPECT_CONN_COUNT(1);
@@ -96,10 +102,10 @@
 	EXPECT_CONN_COUNT(0);
 }
 
-void _normal_lu()
+void _normal_lu(const char *imsi)
 {
 	BTW("Subscriber does a normal LU");
-	_normal_lu_part1();
+	_normal_lu_part1(imsi);
 	_normal_lu_part2();
 }
 
@@ -192,10 +198,12 @@
 {
 	comment_start(nr, imsi);
 
-	_normal_lu_part1();
+	_normal_lu_part1(imsi);
 
 	BTW("Another Location Update Request from the same subscriber on the same conn is dropped silently");
-	ms_sends_msg("050802008168000130089910070000006402");
+
+	tx_loc_upd_imsi(imsi);
+
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 	EXPECT_CONN_COUNT(1);
 
@@ -210,7 +218,7 @@
 {
 	comment_start(nr, imsi);
 
-	_normal_lu_part1();
+	_normal_lu_part1(imsi);
 
 	BTW("A CM Service Request in the middle of a LU is rejected");
 	cm_service_result_sent = RES_NONE;
@@ -231,7 +239,7 @@
 {
 	comment_start(nr, imsi);
 
-	_normal_lu_part1();
+	_normal_lu_part1(imsi);
 
 	BTW("An erratic Paging Response is dropped silently");
 	ms_sends_msg("06270703305882089910070000006402");
@@ -249,13 +257,15 @@
 {
 	comment_start(nr, imsi);
 
-	_normal_lu();
+	_normal_lu(imsi);
 	_normal_cm_service_req();
 
 	btw("A LU request on an open conn is dropped silently");
 	/* TODO: accept periodic LU on an already open conn? */
 	lu_result_sent = RES_NONE;
-	ms_sends_msg("050802008168000130089910070000006402");
+
+	tx_loc_upd_imsi(imsi);
+
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 	EXPECT_CONN_COUNT(1);
 
@@ -273,7 +283,7 @@
 {
 	comment_start(nr, imsi);
 
-	_normal_lu();
+	_normal_lu(imsi);
 	_normal_cm_service_req();
 
 	btw("A second CM Service Request on the same conn is accepted without another auth dance");
@@ -296,7 +306,7 @@
 {
 	comment_start(nr, imsi);
 
-	_normal_lu();
+	_normal_lu(imsi);
 	_normal_cm_service_req();
 
 	BTW("An erratic Paging Response on the same conn is dropped silently");
@@ -321,7 +331,7 @@
 {
 	comment_start(nr, imsi);
 
-	_normal_lu();
+	_normal_lu(imsi);
 	_page(imsi);
 	_paging_resp_part1();
 
@@ -338,13 +348,15 @@
 {
 	comment_start(nr, imsi);
 
-	_normal_lu();
+	_normal_lu(imsi);
 	_page(imsi);
 	_paging_resp_part1();
 
 	BTW("MS sends erratic LU Request, which is dropped silently");
 	lu_result_sent = RES_NONE;
-	ms_sends_msg("050802008168000130089910070000006402");
+
+	tx_loc_upd_imsi(imsi);
+
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 	EXPECT_CONN_COUNT(1);
 
@@ -358,7 +370,7 @@
 {
 	comment_start(nr, imsi);
 
-	_normal_lu();
+	_normal_lu(imsi);
 	_page(imsi);
 	_paging_resp_part1();
 
diff --git a/tests/msc_vlr/msc_vlr_test_rest.c b/tests/msc_vlr/msc_vlr_test_rest.c
index 8bf8c3a..5ef621a 100644
--- a/tests/msc_vlr/msc_vlr_test_rest.c
+++ b/tests/msc_vlr/msc_vlr_test_rest.c
@@ -85,7 +85,9 @@
 	btw("Location Update request causes a GSUP LU request to HLR");
 	lu_result_sent = RES_NONE;
 	gsup_expect_tx("04010809710000004026f0");
-	ms_sends_msg("050802008168000130089910070000006402");
+
+	tx_loc_upd_imsi(imsi);
+
 	OSMO_ASSERT(gsup_tx_confirmed);
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
@@ -115,7 +117,9 @@
 	btw("Location Update request causes a GSUP LU request to HLR");
 	lu_result_sent = RES_NONE;
 	gsup_expect_tx("04010809710000004026f0");
-	ms_sends_msg("050802008168000130089910070000006402");
+
+	tx_loc_upd_imsi(imsi);
+
 	OSMO_ASSERT(gsup_tx_confirmed);
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
@@ -157,7 +161,9 @@
 	btw("Location Update request with unknown TMSI sends ID Request for IMSI");
 	lu_result_sent = RES_NONE;
 	dtap_expect_tx("051801");
-	ms_sends_msg("050802008168000130" "05f4" "23422342");
+
+	tx_loc_upd_tmsi(0x23422342);
+
 	VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d");
 
 	EXPECT_ACCEPTED(false);
diff --git a/tests/msc_vlr/msc_vlr_tests.c b/tests/msc_vlr/msc_vlr_tests.c
index c3d3d37..19a8bfe 100644
--- a/tests/msc_vlr/msc_vlr_tests.c
+++ b/tests/msc_vlr/msc_vlr_tests.c
@@ -765,6 +765,46 @@
 	msgb_free(msg);
 }
 
+void tx_loc_upd_req(const char *imsi, uint8_t lu_type, uint8_t rev_lv,
+		    bool a5_1, bool es_ind, uint8_t pwr_lv, uint16_t mcc, uint16_t mnc, uint8_t lac, uint8_t key_seq,
+		    uint32_t tmsi)
+{
+	struct msgb *nmsg = gsm48_msgb_alloc_name("3GPP TS 24.008 LU");
+	struct gsm48_hdr *ngh;
+	struct gsm48_loc_upd_req *nlu; /* NOTE: mi_len is part of struct */
+	uint8_t buf[11];
+
+	ngh = (struct gsm48_hdr *)msgb_put(nmsg, sizeof(*ngh));
+	nlu = (struct gsm48_loc_upd_req *)msgb_put(nmsg, sizeof(*nlu));
+
+	ngh->proto_discr = GSM48_PDISC_MM;
+	ngh->msg_type = GSM48_MT_MM_LOC_UPD_REQUEST;
+
+	/* location updating type */
+	nlu->type = lu_type;
+
+	/* cipering key */
+	nlu->key_seq = key_seq;
+
+	gsm48_generate_lai(&nlu->lai, mcc, mnc, lac);
+
+	/* classmark 1 */
+	gsm48_encode_classmark1(&nlu->classmark1, rev_lv, es_ind, a5_1, pwr_lv);
+
+	/* MI */
+	if (imsi)
+		gsm48_generate_mid(buf, imsi, GSM_MI_TYPE_IMSI);
+	else
+		gsm48_generate_mid_from_tmsi(buf, tmsi);
+
+	msgb_put(nmsg, buf[1]); /* length is part of nlu */
+	memcpy(&nlu->mi_len, buf + 1, 1 + buf[1]);
+
+	ms_sends_msg(msgb_hexdump(nmsg));
+
+	msgb_free(nmsg);
+}
+
 const struct timeval fake_time_start_time = { 123, 456 };
 
 void fake_time_start()
diff --git a/tests/msc_vlr/msc_vlr_tests.h b/tests/msc_vlr/msc_vlr_tests.h
index a59b5d9..1ab1a7e 100644
--- a/tests/msc_vlr/msc_vlr_tests.h
+++ b/tests/msc_vlr/msc_vlr_tests.h
@@ -135,6 +135,20 @@
 void paging_expect_imsi(const char *imsi);
 void paging_expect_tmsi(uint32_t tmsi);
 void tx_identity_resp(const char *imsi, uint8_t mi_type, uint8_t seq);
+void tx_loc_upd_req(const char *imsi, uint8_t lu_type, uint8_t rev_lv,
+		    bool a5_1, bool es_ind, uint8_t pwr_lv, uint16_t mcc, uint16_t mnc, uint8_t lac, uint8_t key_seq,
+		    uint32_t tmsi);
+
+#define tx_loc_upd_imsi(imsi) tx_loc_upd_req(imsi, 2 /* LU type: IMSI ATTACH */, 1 /* Revision level: GSM */, \
+					     true, true, 0,		\
+					     0xFFF /* MCC */, 0xFF /* MNC */, \
+					     1 /* LAC */, 7 /* ciph key seq: no key available */, 0);
+
+#define tx_loc_upd_tmsi(tmsi) tx_loc_upd_req(NULL, 2 /* LU type: IMSI ATTACH */, 1 /* Revision level: GSM */, \
+					     true, true, 0,		\
+					     0xFFF /* MCC */, 0xFF /* MNC */, \
+					     1 /* LAC */, 7 /* ciph key seq: no key available */, tmsi);
+
 void ms_sends_msg(const char *hex);
 void ms_sends_security_mode_complete();
 void gsup_rx(const char *rx_hex, const char *expect_tx_hex);

-- 
To view, visit https://gerrit.osmocom.org/6484
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Iab8b07b3276b6f6ac0387df14abb98355ea0e99a
Gerrit-PatchSet: 2
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: neels <nhofmeyr at sysmocom.de>



More information about the gerrit-log mailing list